import{A as e,B as t,O as n,St as r,Z as i,c as a,h as o,l as s,m as c,o as l,p as u,r as d,rt as f,s as p,u as m}from"./runtime-core.esm-bundler-A2Q6NZG4.js";import{t as h}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as g}from"./KsInlineMessage-t_pxFiJO.js";import{d as _,i as v,o as y,r as b,s as x}from"./components-CrqHwrS5.js";import{t as S}from"./DataGridShell-B6KxLgLX.js";import{t as C}from"./PageLayout-D6g_--o1.js";import{i as w,n as T,r as E}from"./financial-BRiI2vgB.js";var D={class:`ks-stack`},O={class:`targets ks-stack`},k={class:`ks-stack`},A={class:`mono`},j=h(o({__name:`RebalanceForm`,setup(o){let h=i([{symbol:`AAPL`,quantity:100,marketPrice:150.25,marketValue:15025,weightPercent:35.3},{symbol:`MSFT`,quantity:80,marketPrice:320.5,marketValue:25640,weightPercent:60.2},{symbol:`GOOGL`,quantity:50,marketPrice:140.75,marketValue:7037.5,weightPercent:16.5}]),j=l(()=>[{field:`symbol`,header:`종목코드`},{field:`quantity`,header:`수량`,formatter:e=>w(e,0)},{field:`marketPrice`,header:`현재가`,formatter:e=>T(e,`USD`)},{field:`marketValue`,header:`평가금액`,formatter:e=>T(e,`USD`)},{field:`weightPercent`,header:`비중`,formatter:e=>E(e/100,1)}]),M=i(5),N=i([{symbol:`AAPL`,targetPercent:40},{symbol:`MSFT`,targetPercent:35},{symbol:`GOOGL`,targetPercent:25}]),P=i(null),F=i(42700),I=()=>{N.value.push({symbol:``,targetPercent:0})},L=e=>{N.value.splice(e,1)},R=async()=>{P.value={jobId:`550e8400-e29b-41d4-a716-446655440001`,status:`Queued`,estimatedTradeCount:3,estimatedCost:127.35}};return(i,o)=>(n(),a(C,{title:`포트폴리오 리밸런싱`,subtitle:`목표 비중을 조정하고 리밸런싱을 실행합니다.`},{default:t(()=>[c(f(b),{title:`현재 구성`},{default:t(()=>[c(S,{rows:h.value,columns:j.value,"empty-message":`보유 종목이 없습니다.`},null,8,[`rows`,`columns`]),p(`p`,D,[o[1]||=p(`strong`,null,`포트폴리오 총 평가액:`,-1),u(` `+r(f(T)(F.value,`USD`)),1)])]),_:1}),c(f(b),{title:`목표 비중 설정`},{actions:t(()=>[c(f(g),{severity:`secondary`,label:`종목 추가`,onClick:I}),c(f(g),{severity:`primary`,label:`리밸런싱 실행`,onClick:R})]),default:t(()=>[c(f(v),{columns:1,"aria-label":`리밸런싱 설정`},{default:t(()=>[c(f(x),{modelValue:M.value,"onUpdate:modelValue":o[0]||=e=>M.value=e,label:`허용 이탈 임계값 %`,min:0,max:50,"max-fraction-digits":0},null,8,[`modelValue`])]),_:1}),p(`div`,O,[(n(!0),m(d,null,e(N.value,(e,t)=>(n(),m(`div`,{key:t,class:`target-row`},[c(f(_),{modelValue:e.symbol,"onUpdate:modelValue":t=>e.symbol=t,label:`종목코드`,"input-id":`target-symbol-${t}`},null,8,[`modelValue`,`onUpdate:modelValue`,`input-id`]),c(f(x),{modelValue:e.targetPercent,"onUpdate:modelValue":t=>e.targetPercent=t,label:`목표 비중 %`,min:0,max:100,"max-fraction-digits":0,"input-id":`target-percent-${t}`},null,8,[`modelValue`,`onUpdate:modelValue`,`input-id`]),c(f(g),{severity:`danger`,label:`삭제`,onClick:e=>L(t)},null,8,[`onClick`])]))),128))])]),_:1}),P.value?(n(),a(f(b),{key:0,title:`리밸런싱 대기열 등록됨`},{default:t(()=>[p(`dl`,k,[o[2]||=p(`dt`,null,`Job ID`,-1),p(`dd`,A,r(P.value.jobId),1),o[3]||=p(`dt`,null,`상태`,-1),p(`dd`,null,[c(f(y),{value:P.value.status,severity:`info`},null,8,[`value`])]),o[4]||=p(`dt`,null,`예상 거래 건수`,-1),p(`dd`,null,r(f(w)(P.value.estimatedTradeCount,0)),1),o[5]||=p(`dt`,null,`예상 비용`,-1),p(`dd`,null,r(f(T)(P.value.estimatedCost,`USD`)),1)])]),_:1})):s(``,!0)]),_:1}))}}),[[`__scopeId`,`data-v-2ad60885`]]);export{j as default};