PageSourceSearch

https://dashboard.glide-path.org/_next/static/chunks/4967-880b9e7342f28640.js

js glide-path.org collected 2026-10-08 18:32:02 UTC 365,606 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4967],{3668:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>en,Ld:()=>Z,zO:()=>ee,vA:()=>Q});var n=s(70127),a=s(70567),l=s(65313),r=s(38448),i=s(98240),o=s(76773),d=s(6763),c=s(48858),u=s(52481),x=s(42309),m=s(99011);let h={self:"본인",spouse:"배우자",joint:"본인"},p={fixed:"고정",inflation:"물가연동",rate_linked:"물가연동"},f={equal_installment:"원리금균등상환",equal_principal:"원금균등상환",bullet:"만기일시상환",graduated:"체증식상환"},b={civil_servant:"공무원",private_school:"사학",military:"군인"},v={paying:"납입 중",paid_up:"납입 완료\xb7개시 전",receiving:"수령 중"},g={daily_living:"dailyLiving",travel_leisure:"travelLeisure",medical:"medical"};function j(e){var t;return{...(0,m.rn)(e.id),name:null!=(t=e.name)?t:"",owner:h[e.owner],annualAmount:e.annual_amount,...e.hire_date?{hireYear:new Date(e.hire_date).getFullYear()}:{},growthRate:100*e.growth_rate,withholdingRate:100*e.withholding_rate,endsMode:"age"===e.ends_at_kind&&null!=e.ends_at_age?"나이 지정":"은퇴 시",...null!=e.ends_at_age?{endsAge:e.ends_at_age}:{},severanceOn:e.severance_enabled,severanceMode:"lump_sum"===e.severance_mode?"일시금":"IRP 이전"}}function y(e){var t,s;return{id:e.id,category:g[e.category],itemKey:null!=(t=e.item_key)?t:"",label:null!=(s=e.label)?s:"",monthly:e.monthly_amount}}function k(e){return null!=e.remaining_months?Math.max(1,Math.round(e.remaining_months/12)):e.matures_at?Math.max(1,new Date(e.matures_at).getFullYear()-new Date().getFullYear()):1}let N=new Set(["irp","pension_savings"]);function w(e){var t,s;return{...(0,c.pH)(e.id),name:"national"===e.kind?"국민연금":"직역연금",accountType:"national"===e.kind?"national_pension":"occupational_pension",owner:h[e.owner],monthlyPension:null!=(t=e.amount_snapshot_monthly)?t:0,nationalClaimAge:null!=(s=e.claim_age)?s:0,pensionEscalation:p[e.escalation],...e.occupational_kind?{occupationalKind:b[e.occupational_kind]}:{}}}function _(e){var t,s,n,a,l,r,i;return{...(0,c.pH)(e.id),name:null!=(t=e.name)?t:"연금저축보험",accountType:"pension_insurance",owner:h[e.owner],insuranceStatus:v[e.status],monthlyPremium:null!=(s=e.monthly_premium)?s:0,premiumEndYear:null!=(n=e.premium_end_year)?n:0,insuranceClaimAge:null!=(a=e.claim_age)?a:65,monthlyInsuranceBenefit:e.monthly_benefit,insurancePayoutType:"fixed_term"===e.payout_type?"확정기간":"종신",insurancePayoutYears:null!=(l=e.payout_years)?l:10,insuranceBenefitStartYear:null!=(r=e.benefit_start_year)?r:0,insuranceEscalation:p[e.escalation],taxCreditRate:null!=(i=e.tax_credit_rate)?i:0}}async function S(e,t){var s,n,a,l,r,i,o,d,m,p,b,v,g,S,C,T,E,A,F,D,M,P,L,R,z,B;let[I,Y,O,W,U,V,K,q,H]=await Promise.all([e.from("wp_persons").select("*").eq("household_id",t),e.from("wp_households").select("*").eq("id",t).single(),e.from("wp_accounts").select("*").eq("household_id",t).or("portfolio_type.is.null,portfolio_type.neq.test"),e.from("wp_properties").select("*").eq("household_id",t),e.from("wp_loans").select("*").eq("household_id",t),e.from("wp_pensions").select("*").eq("household_id",t),e.from("wp_pension_insurances").select("*").eq("household_id",t),e.from("wp_incomes").select("*").eq("household_id",t),e.from("wp_expense_items").select("*").eq("household_id",t)]),G=null!=(o=null==(s=O.data)?void 0:s.map(e=>e.id))?o:[],J=G.length?await e.from("wp_account_holdings").select("*").in("account_id",G):{data:[],error:null},$=null!=(T=null!=(C=null!=(S=null!=(g=null!=(v=null!=(b=null!=(p=null!=(m=null!=(d=I.error)?d:Y.error)?m:O.error)?p:J.error)?b:W.error)?v:U.error)?g:V.error)?S:K.error)?C:q.error)?T:H.error;if($)throw $;let X=new Map;for(let e of J.data){let t=X.get(e.account_id);t?t.push(e):X.set(e.account_id,[e])}let Z=[...O.data.map(e=>{var t;return function(e,t){var s,n,a,l,r;let i=t.reduce((e,t)=>{var s;return e+(null!=(s=t.market_value)?s:0)},0),o=0===t.length||1===t.length&&"cash"===t[0].product_type;return{...(0,c.pH)(e.id),name:e.name,accountType:e.account_type,irpProvider:null!=(s=e.irp_provider)?s:"",isaType:null!=(n=e.isa_type)?n:"",owner:h[e.owner],balance:i,monthlyContribution:Math.round(e.annual_contribution/12),taxCreditRate:null!=(a=e.tax_credit_rate)?a:0,annualReturnRate:null!=(l=e.annual_return_rate)?l:0,pensionStartAge:null!=(r=e.pension_start_age)?r:0,...o?{}:{inputMode:"detail",holdings:t.map(e=>{var t,s,n,a,l,r;return{id:e.id,productType:"deposit"===e.product_type?"principal_protected":null!=(t=e.product_type)?t:"cash",productC
1ode:null!=(s=e.product_code)?s:"",productName:null!=(n=e.product_name)?n:"",units:null!=(a=e.units)?a:0,unitPrice:null!=(l=e.unit_price)?l:0,marketValue:null!=(r=e.market_value)?r:0}})},...N.has(e.account_type)?{taxExempt:e.tax_exempt_balance,taxable:e.tax_deducted_contribution,deferred:e.deferred_retirement_balance,retirementTax:e.irp_retirement_tax_total,isReceivingPension:e.pension_receipt_years>0,receiptYears:e.pension_receipt_years}:{}}}(e,null!=(t=X.get(e.id))?t:[])}),...V.data.map(w),...K.data.map(_)],Q=new Map,ee=[];for(let e of U.data)e.linked_property_id?Q.set(e.linked_property_id,e):ee.push({...(0,x.b)(e.id),name:e.name,owner:h[e.owner],balance:e.balance,rate:100*e.annual_rate,rateType:"fixed"===e.rate_type?"고정":"변동",repayment:f[e.repayment],graceMonths:null!=(E=e.grace_months)?E:0,termYears:k(e)});let et=W.data.map(e=>{var t,s,n,a;let l=Q.get(e.id);return{...(0,u.HO)(e.id),name:null!=(t=e.name)?t:"",owner:h[e.owner],marketValue:e.market_value,purchasePrice:null!=(s=e.purchase_price)?s:0,propertyTaxBase:null!=(n=e.property_tax_base)?n:0,status:"financed"===e.status?"대출 있음":"완전 보유",...l?{loanBalance:l.balance,loanRate:100*l.annual_rate,rateType:"fixed"===l.rate_type?"고정":"변동",repayment:f[l.repayment],graceMonths:null!=(a=l.grace_months)?a:0,termYears:k(l)}:{}}}),es=I.data,en=Y.data,ea=es.find(e=>"self"===e.role),el=es.find(e=>"spouse"===e.role),er=e=>{if(!e)return[null,null];let[,t,s]=e.split("-").map(Number);return[t,s]},[ei,eo]=er(null==ea?void 0:ea.birth_date),[ed,ec]=er(null==el?void 0:el.birth_date);return{accounts:Z,properties:et,debts:ee,incomes:q.data.map(j),expenses:H.data.map(y),planningAsCouple:en.planning_as_couple,selfName:null!=(A=null==ea?void 0:ea.name)?A:null,selfBirthYear:null!=(F=null==ea?void 0:ea.birth_year)?F:null,selfBirthMonth:ei,selfBirthDay:eo,spouseName:null!=(D=null==el?void 0:el.name)?D:null,spouseBirthYear:null!=(M=null==el?void 0:el.birth_year)?M:null,spouseBirthMonth:ed,spouseBirthDay:ec,selfRetirementAge:null!=(P=null==(n=es.find(e=>"self"===e.role))?void 0:n.retirement_age)?P:null,spouseRetirementAge:null!=(L=null==(a=es.find(e=>"spouse"===e.role))?void 0:a.retirement_age)?L:null,selfLifeExpectancy:null!=(R=null==(l=es.find(e=>"self"===e.role))?void 0:l.life_expectancy)?R:null,selfInsuredType:null!=(z=null==(r=es.find(e=>"self"===e.role))?void 0:r.pre_retirement_insured_type)?z:null,spouseInsuredType:null!=(B=null==(i=es.find(e=>"spouse"===e.role))?void 0:i.pre_retirement_insured_type)?B:null,riskProfile:en.risk_profile,targetAsset:en.target_asset,incomeYieldAccumulation:en.income_yield_accumulation,incomeYieldDrawdown:en.income_yield_drawdown,comprehensiveTaxBase:en.comprehensive_tax_base,fpLinked:null!=en.fp_customer_id,fpEditLocked:null!=en.fp_customer_id&&!en.customer_edit_allowed}}var C=s(58086);let T=[{...(0,c.pH)("dummy-acc-1"),name:"증권 일반계좌",accountType:"general",balance:115e6},{...(0,c.pH)("dummy-acc-2"),name:"입출금\xb7CMA",accountType:"cma",balance:15e6},{...(0,c.pH)("dummy-acc-3"),name:"IRP",accountType:"irp",balance:55e6,deferred:55e6,monthlyContribution:5e5},{...(0,c.pH)("dummy-acc-4"),name:"국민연금",accountType:"national_pension",monthlyPension:11e5,pensionEscalation:"물가연동"}],E=[{...(0,u.HO)("dummy-prop-1"),name:"거주 아파트",marketValue:6e8,status:"완전 보유"}],A={accounts:T,properties:E,debts:[],incomes:[{...(0,m.rn)("dummy-inc-1"),name:"본인 급여",annualAmount:65e6,hireYear:2010,growthRate:2}],expenses:[{...(0,C.Sn)("dummy-exp-1"),category:"dailyLiving",itemKey:"food",label:"식비",monthly:15e5},{...(0,C.Sn)("dummy-exp-2"),category:"dailyLiving",itemKey:"housing",label:"주거비",monthly:6e5},{...(0,C.Sn)("dummy-exp-3"),category:"dailyLiving",itemKey:"utilities",label:"공과금",monthly:3e5},{...(0,C.Sn)("dummy-exp-4"),category:"travelLeisure",itemKey:"domestic_travel",label:"국내 여행",monthly:3e5},{...(0,C.Sn)("dummy-exp-5"),category:"travelLeisure",itemKey:"overseas_travel",label:"해외 여행",monthly:4e5},{...(0,C.Sn)("dummy-exp-6"),category:"medical",itemKey:"hospital",label:"병원\xb7진료비",monthly:3e5}]},F={본인:"self",배우자:"spouse"},D={dailyLiving:"daily_living",travelLeisure:"travel_leisure",medical:"medical"};function M(e,t,s){if(t)throw t;
1if(!e)throw Error("".concat(s,": 저장 결과가 비어 있음 (RLS 차단 가능성)"));return e}async function P(e,t,s,n){let a=function(e,t){let s="나이 지정"===t.endsMode;return{household_id:e,name:t.name,owner:F[t.owner],kind:"salary",annual_amount:t.annualAmount,hire_date:t.hireYear>0?"".concat(t.hireYear,"-01-01"):null,growth_rate:t.growthRate/100,withholding_rate:t.withholdingRate/100,ends_at_kind:s?"age":"retirement",ends_at_age:s?t.endsAge:null,severance_enabled:t.severanceOn,severance_mode:"일시금"===t.severanceMode?"lump_sum":"irp"}}(t,s),{data:l,error:r}=n?await e.from("wp_incomes").update(a).eq("id",n).select("id").single():await e.from("wp_incomes").insert(a).select("id").single(),i=M(l,r,"wp_incomes").id;return{...s,id:i}}async function L(e,t){let{error:s}=await e.from("wp_incomes").delete().eq("id",t);if(s)throw s}async function R(e,t,s,n){let a={household_id:t,owner:"self",category:D[s.category],item_key:s.itemKey||null,label:s.label||(s.itemKey?null:"항목"),monthly_amount:s.monthly},{data:l,error:r}=n?await e.from("wp_expense_items").update(a).eq("id",n).select("id").single():await e.from("wp_expense_items").insert(a).select("id").single(),i=M(l,r,"wp_expense_items").id;return{...s,id:i}}async function z(e,t){let{error:s}=await e.from("wp_expense_items").delete().eq("id",t);if(s)throw s}async function B(e,t,s,n,a,l,r){let{error:i}=await e.from("wp_persons").upsert({household_id:t,role:s,birth_year:n,birth_date:function(e,t,s){let n=String(t).padStart(2,"0"),a=String(s||1).padStart(2,"0");return"".concat(e,"-").concat(n,"-").concat(a)}(n,a,l),...null!=r?{name:r}:{}},{onConflict:"household_id,role"});if(i)throw i}async function I(e,t,s,n,a){let{error:l}=await e.from("wp_persons").upsert({household_id:t,role:s,birth_year:n,pre_retirement_insured_type:a},{onConflict:"household_id,role"});if(l)throw l}async function Y(e,t,s,n){let{error:a}=await e.from("wp_persons").update({retirement_age:s}).eq("household_id",t).eq("role","self");if(a)throw a;if(null!=n){let{error:s}=await e.from("wp_persons").update({retirement_age:n}).eq("household_id",t).eq("role","spouse");if(s)throw s}}async function O(e,t,s){let{error:n}=await e.from("wp_persons").update({life_expectancy:s}).eq("household_id",t).eq("role","self");if(n)throw n}async function W(e,t,s){let{error:n}=await e.from("wp_households").update({planning_as_couple:s}).eq("id",t);if(n)throw n}async function U(e,t,s){let{error:n}=await e.from("wp_households").update({risk_profile:s}).eq("id",t);if(n)throw n}async function V(e,t,s){let{error:n}=await e.from("wp_households").update({target_asset:null!=s&&s>0?Math.round(s):null}).eq("id",t);if(n)throw n}async function K(e,t,s){let{error:n}=await e.from("wp_households").update({income_yield_accumulation:s.incomeYieldAccumulation,income_yield_drawdown:s.incomeYieldDrawdown,comprehensive_tax_base:Math.round(s.comprehensiveTaxBase)}).eq("id",t);if(n)throw n}var q=s(95058),H=s(26896),G=s(34383);async function J(e){let t=await fetch("/api/facts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("api/facts ".concat(t.status,": ").concat(await t.text()));return t.json()}let $=(0,a.createContext)(null),X={name:"나",birthMonth:r.jH,birthDay:r.NW,birthYear:r.YZ};function Z(e){return e.birthYear===r.YZ&&e.birthMonth===r.jH&&e.birthDay===r.NW}function Q(){let{accounts:e,properties:t,debts:s}=ee();return e.length>0||t.length>0||s.length>0}function ee(){let e=(0,a.useContext)($);if(!e)throw Error("useFacts must be used within FactsProvider");return e}function et(e,t){console.error("[FactsProvider] ".concat(e," 저장 실패:"),t),window.alert("".concat(e," 저장에 실패했어요. 잠시 후 다시 시도해 주세요."))}let es=e=>"wp:applied-strategy:".concat(e);function en(e){let{children:t}=e,{householdId:s,status:r,ensureHousehold:c}=(0,d.G)(),[u,x]=(0,a.useState)([]),[m,h]=(0,a.useState)([]),[p,f]=(0,a.useState)([]),[b,v]=(0,a.useState)([]),[g,j]=(0,a.useState)([]),[y,k]=(0,a.useState)(!1),[N,w]=(0,a.useState)(!1),[_,C]=(0,a.useState)("single"),[T,E]=(0,a.useState)({...X}),F=(0,G.o)(),[D,M]=(0,a.useState)(!1);(0,a.useEffect)(()=>{!D&&F&&E(e=>e.name===X.name?{...e,name:F}:e)},[F,D]);let[Q,ee]=(0,a.useState)({name:"배우자",birthMonth:8,birthDay:1,birthYear:1982}),[en,ea]=(0,a.useState)(i.K),[el,er]=(0,a.useState)(i.K),[ei,eo]=(0,a.useState)(i.I7.self),[ed,ec]=(0,a.useState)(null),[eu,ex]=(0,a.useState)(null),[em,eh]=(0,a.useState)(i.On),[ep,ef]=(0,a.useState)(null),[eb,ev]=(0,a.useState)(l.oA.accumulation),[eg,ej]=(0,a.useState)(l.oA.drawdown),[ey,ek]=(0,a.useState)(0),[eN,ew]=(0,a.useState)({}),[e_,eS]=(0,a.useState)(!1),[eC,eT]=(0,a.useState)(!1),eE=(0,a.useRef)(null);(0,a.useEffect)(()=>
1{if(!s||eE.current===s)return;eE.current=s;let e=localStorage.getItem(es(s));if(!e)return void ew({});try{ew(JSON.parse(e))}catch(e){ew({})}},[s]);let eA=(0,a.useCallback)(e=>{ew(e),s&&(eE.current=s,e.strategy?localStorage.setItem(es(s),JSON.stringify(e)):localStorage.removeItem(es(s)))},[s]),eF=(0,a.useRef)(null),[eD,eM]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=()=>{eF.current=null,eM(e=>e+1)};return window.addEventListener("wp:accounts-changed",e),()=>window.removeEventListener("wp:accounts-changed",e)},[]),(0,a.useEffect)(()=>{if(!s){"ready"===r&&k(!0);return}eF.current!==s&&(eF.current=s,S((0,o.U)(),s).then(e=>{x(e.accounts),h(e.properties),f(e.debts),v(e.incomes),j(e.expenses),C(e.planningAsCouple?"couple":"single"),e.selfName&&M(!0),(null!=e.selfName||null!=e.selfBirthYear)&&E(t=>({...t,...null!=e.selfName?{name:e.selfName}:{},...null!=e.selfBirthYear?{birthYear:e.selfBirthYear,...null!=e.selfBirthMonth?{birthMonth:e.selfBirthMonth,birthDay:e.selfBirthDay}:{}}:{}})),(null!=e.spouseName||null!=e.spouseBirthYear)&&ee(t=>({...t,...null!=e.spouseName?{name:e.spouseName}:{},...null!=e.spouseBirthYear?{birthYear:e.spouseBirthYear,...null!=e.spouseBirthMonth?{birthMonth:e.spouseBirthMonth,birthDay:e.spouseBirthDay}:{}}:{}})),null!=e.selfRetirementAge&&ea(e.selfRetirementAge),null!=e.spouseRetirementAge&&er(e.spouseRetirementAge),null!=e.selfLifeExpectancy&&eo(e.selfLifeExpectancy),ec(e.selfInsuredType),ex(e.spouseInsuredType),eh(e.riskProfile),ef(e.targetAsset),ev(e.incomeYieldAccumulation),ej(e.incomeYieldDrawdown),ek(e.comprehensiveTaxBase),eS(e.fpLinked),eT(e.fpEditLocked),k(!0)}).catch(e=>{console.error("[FactsProvider] Facts 초기 로드 실패:",e),eF.current=null}))},[s,r,eD]),(0,a.useEffect)(()=>{if(!s||!y)return;let e=setTimeout(()=>{let e=(0,q.t)(u,m,p);(0,q.he)((0,o.U)(),s,(0,H.gV)(),e).catch(e=>console.error("[FactsProvider] 진척 스냅샷 저장 실패:",e)).finally(()=>w(!0))},800);return()=>clearTimeout(e)},[s,y,u,m,p]);let eP=(0,a.useCallback)(async e=>{let t=u.some(t=>t.id===e.id);x(s=>t?s.map(t=>t.id===e.id?e:t):[...s,e]);let n=null!=s?s:await c();if(!n)return e.id;try{let{id:s}=await J({op:"saveAccount",householdId:n,fact:e,existingId:t?e.id:null});return s&&s!==e.id&&x(t=>t.map(t=>t.id===e.id?{...t,id:s}:t)),null!=s?s:e.id}catch(e){throw et("금융자산",e),e}},[u,s,c]),eL=(0,a.useCallback)(e=>{x(t=>t.filter(t=>t.id!==e.id)),s&&J({op:"deleteAccount",fact:e}).catch(e=>et("금융자산 삭제",e))},[s]),eR=(0,a.useCallback)(async e=>{let t=m.some(t=>t.id===e.id);h(s=>t?s.map(t=>t.id===e.id?e:t):[...s,e]);let n=null!=s?s:await c();n&&J({op:"saveProperty",householdId:n,fact:e,existingId:t?e.id:null}).then(t=>{let{id:s}=t;s&&s!==e.id&&h(t=>t.map(t=>t.id===e.id?{...t,id:s}:t))}).catch(e=>et("부동산",e))},[m,s,c]),ez=(0,a.useCallback)(e=>{h(t=>t.filter(t=>t.id!==e)),s&&J({op:"deleteProperty",id:e}).catch(e=>et("부동산 삭제",e))},[s]),eB=(0,a.useCallback)(async e=>{let t=p.some(t=>t.id===e.id);f(s=>t?s.map(t=>t.id===e.id?e:t):[...s,e]);let n=null!=s?s:await c();n&&J({op:"saveDebt",householdId:n,fact:e,existingId:t?e.id:null}).then(t=>{let{id:s}=t;s&&s!==e.id&&f(t=>t.map(t=>t.id===e.id?{...t,id:s}:t))}).catch(e=>et("부채",e))},[p,s,c]),eI=(0,a.useCallback)(e=>{f(t=>t.filter(t=>t.id!==e)),s&&J({op:"deleteDebt",id:e}).catch(e=>et("부채 삭제",e))},[s]),eY=(0,a.useCallback)(async e=>{let t=b.some(t=>t.id===e.id);v(s=>t?s.map(t=>t.id===e.id?e:t):[...s,e]);let n=null!=s?s:await c();if(!n)return e.id;try{let s=await P((0,o.U)(),n,e,t?e.id:null);return s.id!==e.id&&v(t=>t.map(t=>t.id===e.id?{...t,id:s.id}:t)),s.id}catch(e){throw et("소득",e),e}},[b,s,c]),eO=(0,a.useCallback)(e=>{v(t=>t.filter(t=>t.id!==e)),s&&L((0,o.U)(),e).catch(e=>et("소득 삭제",e))},[s]),eW=(0,a.useCallback)(async e=>{let t=g.some(t=>t.id===e.id);j(s=>t?s.map(t=>t.id===e.id?e:t):[...s,e]);let n=null!=s?s:await c();if(!n)return e.id;try{let s=await R((0,o.U)(),n,e,t?e.id:null);return s.id!==e.id&&j(t=>t.map(t=>t.id===e.id?{...t,id:s.id}:t)),s.id}catch(e){throw et("지출",e),e}},[g,s,c]),eU=(0,a.useCallback)(e=>{j(t=>t.filter(t=>t.id!==e)),s&&z((0,o.U)(),e).catch(e=>et("지출 삭제",e))},[s]),eV=(0,a.useCallback)(async e=>{C(e);let t=null!=s?s:await c();if(!t)return;let n=(0,o.U)();W(n,t,"couple"===e).catch(e=>et("계획 방식",e)),"couple"===e&&B(n,t,"spouse",Q.birthYear,Q.birthMonth,Q.birthDay).catch(e=>et("배우자 정보",e))},[s,c,Q.birthYear,Q.birthMonth,Q.birthDay]),eK=(0,a.useCallback)(async e=>{E(e);let t=null!=s?s:await c();t&&B((0,o.U)(),t,"self",e.birthYear,e.birthMonth,e.birthDay,e.name).catch(e=>et("내 정보",e))},[s,c]),eq=(0,a.useCallback)(async e=>{ee(e);let t=null!=s?s:await c();t&&B((0,o.U)(),t,"spouse",e.birthYear,e.birthMonth,e.birthDay,e.name).catch(e=>et("배우자 정보",e))},[s,c]),eH=(0,a.useCallback)(async(e,t)=>{ea(e),er(t);let n=null!=s?s:await c();
1n&&Y((0,o.U)(),n,e,"couple"===_?t:null).catch(e=>et("은퇴 나이",e))},[s,c,_]),eG=(0,a.useCallback)(async e=>{eo(e);let t=null!=s?s:await c();t&&O((0,o.U)(),t,e).catch(e=>et("기대수명",e))},[s,c]),eJ=(0,a.useCallback)(async e=>{ec(e);let t=null!=s?s:await c();t&&I((0,o.U)(),t,"self",T.birthYear,e).catch(e=>et("건강보험 가입자유형",e))},[s,c,T.birthYear]),e$=(0,a.useCallback)(async e=>{ex(e);let t=null!=s?s:await c();t&&I((0,o.U)(),t,"spouse",Q.birthYear,e).catch(e=>et("건강보험 가입자유형",e))},[s,c,Q.birthYear]),eX=(0,a.useCallback)(async e=>{eh(e);let t=null!=s?s:await c();t&&U((0,o.U)(),t,e).catch(e=>et("위험성향",e))},[s,c]),eZ=(0,a.useCallback)(async e=>{let t=null!=e&&e>0?e:null;ef(t);let n=null!=s?s:await c();n&&V((0,o.U)(),n,t).catch(e=>et("목표 자산",e))},[s,c]),eQ=(0,a.useCallback)(async e=>{ev(e.incomeYieldAccumulation),ej(e.incomeYieldDrawdown),ek(e.comprehensiveTaxBase);let t=null!=s?s:await c();t&&K((0,o.U)(),t,e).catch(e=>et("세금 계산 가정",e))},[s,c]),e0=u.length>0||m.length>0||p.length>0,e1=e0&&Z(T),e2=!s||!e0||e1,e4=(0,a.useMemo)(()=>e2?A:{accounts:u,properties:m,debts:p,incomes:b,expenses:g},[e2,u,m,p,b,g]),e3=(0,a.useMemo)(()=>({planningAsCouple:"couple"===_,selfBirthYear:e2?1979:T.birthYear,spouseBirthYear:Q.birthYear,selfBirthUnset:e1,selfRetirementAge:en,spouseRetirementAge:el,selfLifeExpectancy:ei,spouseLifeExpectancy:i.I7.spouse,...ed?{selfInsuredType:ed}:{},...eu?{spouseInsuredType:eu}:{},riskProfile:em,financialIncomeYield:{accumulation:eb,drawdown:eg},comprehensiveTaxBase:ey}),[_,T,e2,e1,Q.birthYear,en,el,ei,ed,eu,em,eb,eg,ey]),e5=(0,a.useMemo)(()=>(0,i.H)(e4,e3,"current","현재",eN.strategy),[e4,e3,eN]),e6=(0,a.useMemo)(()=>({accounts:u,setAccounts:x,properties:m,setProperties:h,debts:p,setDebts:f,incomes:b,setIncomes:v,expenses:g,setExpenses:j,saveAccount:eP,removeAccount:eL,saveProperty:eR,removeProperty:ez,saveDebt:eB,removeDebt:eI,saveIncome:eY,removeIncome:eO,saveExpense:eW,removeExpense:eU,planningMode:_,setPlanningMode:C,self:T,setSelf:E,spouse:Q,setSpouse:ee,updatePlanningMode:eV,updateSelfProfile:eK,updateSpouseProfile:eq,updateRetirementAges:eH,selfLifeExpectancy:ei,updateSelfLifeExpectancy:eG,selfInsuredType:ed,spouseInsuredType:eu,updateSelfInsuredType:eJ,updateSpouseInsuredType:e$,riskProfile:em,updateRiskProfile:eX,targetAsset:ep,updateTargetAsset:eZ,incomeYieldAccumulation:eb,incomeYieldDrawdown:eg,comprehensiveTaxBase:ey,updateFinancialAssumptions:eQ,appliedStrategy:eN,updateAppliedStrategy:eA,fpLinked:e_,fpEditLocked:eC,factsLoaded:y,snapshotSynced:N,ui:e4,household:e3,simulation:e5}),[u,m,p,b,g,eP,eL,eR,ez,eB,eI,eY,eO,eW,eU,_,T,Q,eV,eK,eq,eH,ei,eG,ed,eu,eJ,e$,em,eX,ep,eZ,eb,eg,ey,eQ,eN,eA,e_,eC,y,N,e4,e3,e5]);return(0,n.jsx)($.Provider,{value:e6,children:t})}},6612:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var n=s(70127),a=s(70567),l=s(36870);function r(e){let{isOpen:t,onConfirm:s,onCancel:r}=e,i=(0,a.useRef)(null),o=(0,a.useRef)(null);if((0,a.useEffect)(()=>{if(t){let e=window.scrollY;document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top="-".concat(e,"px"),document.body.style.width="100%";let t=()=>{if(o.current){let e=window.innerHeight,t=window.innerWidth,s=t<768;o.current.style.position="fixed",o.current.style.top="50%",o.current.style.left="50%",o.current.style.transform="translate(-50%, -50%)",o.current.style.maxHeight="".concat(e-40,"px"),o.current.style.overflowY="auto",s?(o.current.style.width="".concat(s?.9*t:"auto","px"),o.current.style.maxWidth="none"):(o.current.style.width="",o.current.style.maxWidth="28rem")}};return setTimeout(t,0),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),document.body.style.overflow="",document.body.style.position="",document.body.style.top="",document.body.style.width="",window.scrollTo(0,e)}}},[t]),!t)return null;let d=(0,n.jsx)("div",{ref:i,className:"fixed inset-0 bg-black/40 z-[9999999999]",style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",zIndex:0x2540be3ff},onClick:r,children:(0,n.jsxs)("div",{ref:o,className:"bg-white rounded-2xl shadow-xl md:max-w-md w-[90%] md:w-full p-6 md:p-8",style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e10,maxHeight:"90vh",overflowY:"auto"},onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"mb-6 text-center",children:[(0,n.jsx)("h2",{className:"text-2xl font-bold tracking-tight text-ink mb-3 break-keep",children:"선택한 상품을 저장하시겠습니까?"}),(0,n.jsx)("p",{className:"text-sm text-ink-soft break-keep",children:"저장하면 포트폴리오에 상품이 추가됩니다."})]}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("button",{onClick:r,className:"flex-1 py-3 px-4 bg-secondary text-ink-soft hover:text-ink font-medium rounded-lg transition-colors",children:"취소"}),(0,n.jsx)("button",{onClick:s,className:"flex-1 py-3 px-4 bg-ink hover:bg-ink/90 text-white font-semibold rounded-lg transition-colors",children:"확인"})]})]})});return(0,l.createPortal)(d,document.body)}},6763:(e,t,s)=>{"use strict";s.d(t,{A:()=>d,G:()=>o});var n=s(70127),a=s(70567),l=s(76773),r=s(38448);let i=(0,a.createContext)({householdId:null,authUserId:null,status:"idle",ensureHousehold:async()=>null});function o(){return(0,a.useContext)(i)}function d(e){let{children:t}=e,[s,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(null),[u,x]=(0,a.useState)("idle"),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=(0,l.U)(),t=t=>{c(t),(0,r.sP)(e,t).then(e=>{e&&o(e.householdId)}).catch(e=>console.error("[DbProvider] household 조회 실패:",e)).finally(()=>x("ready"))};e.auth.getSession().then(e=>{let{data:{session:s}}=e;(null==s?void 0:s.user)?t(s.user.id):x("ready")});let{data:{subscription:s}}=e.auth.onAuthStateChange((e,s)=>{(null==s?void 0:s.user)&&t(s.user.id),"SIGNED_OUT"===e&&(m.current=null,c(null),o(null),x("idle"))});return()=>s.unsubscribe()},[]);let h=async()=>
1{if(s)return s;if(!d)return null;if(!m.current){let e=(0,l.U)();m.current=(0,r.a7)(e,d).then(e=>{let{householdId:t}=e;return o(t),t}).catch(e=>(console.error("[DbProvider] household bootstrap 실패:",e),m.current=null,null))}return m.current};return(0,n.jsx)(i.Provider,{value:{householdId:s,authUserId:d,status:u,ensureHousehold:h},children:t})}},7261:(e,t,s)=>{"use strict";s.d(t,{q:()=>a});var n=s(76003);let a={cma:{icon:n.MqL,bg:"#0F766E"},general:{icon:n.Jqh,bg:"#0F766E"},isa:{icon:n.f9v,bg:"#0F766E"},savings:{icon:n.cq2,bg:"#E0A32E"},irp:{icon:n.uEw,bg:"#3B82F6"},pension_savings:{icon:n.IU1,bg:"#3B82F6"},pension_insurance:{icon:n.f9v,bg:"#3B82F6"},dc:{icon:n.vXv,bg:"#6366F1"},severance:{icon:n.oAR,bg:"#6366F1"},national_pension:{icon:n.E6G,bg:"#DE6262"},occupational_pension:{icon:n.dkU,bg:"#DE6262"}}},9638:(e,t,s)=>{"use strict";s.d(t,{r:()=>l});var n=s(28832);function a(e){if("string"==typeof e)return e;let{pathname:t="/",query:s}=null!=e?e:{},n=new URLSearchParams;for(let[e,t]of Object.entries(null!=s?s:{}))null!=t&&""!==t&&n.set(e,String(t));let a=n.toString();return a?"".concat(t,"?").concat(a):t}function l(){let e=(0,n.usePathname)(),t=(0,n.useRouter)();return{pathname:null!=e?e:"/",asPath:null!=e?e:"/",query:{},isReady:!0,push:e=>t.push(a(e)),replace:e=>t.replace(a(e)),back:()=>t.back()}}},12134:(e,t,s)=>{"use strict";s.d(t,{A:()=>T});var n=s(70127),a=s(70567),l=s(12900),r=s(51652),i=s(93374),o=s(50625),d=s(45575),c=s(61838),u=s(43774),x=s(70746),m=s(99834),h=s(59317),p=s(71341),f=s(9638),b=s(74590),v=s(83843),g=s(56971),j=s(6612);let y=e=>{var t,s;let{token:l,show_selection:r="true",updateResponse:i,setUpdateResponse:o,handleCloseModal:d,selectedAccountType:b,setSaveRefresh:y,setMainTab:k,submitButtonLabel:N="포트폴리오에 추가",onSubmitSelection:w,maxSelectionCount:_,initialSelectedItems:S=null}=e,C=(0,f.r)(),T=(0,a.useRef)(null),[E,A]=(0,a.useState)(""),[F,D]=(0,a.useState)(!1),[M,P]=(0,a.useState)(!1),[L,R]=(0,a.useState)(!1);(0,a.useRef)(null),(0,a.useRef)(null);let[z,B]=(0,a.useState)(null),[I,Y]=(0,a.useState)([]),[O,W]=(0,a.useState)(!1),U=(0,a.useRef)(null),[V,K]=(0,a.useState)(-1),q=(0,a.useRef)(null),[H,G]=(0,a.useState)(!1),[J,$]=(0,a.useState)(!1),{setProducts:X}=(0,v.A)(),{data:Z,FilterDetails:Q,loading:ee,setSelectedOptions:et,selectedOptions:es,setSorting:en,sorting:ea,setLoading:el,setData:er,message:ei,option:eo,setOption:ed,search:ec,setSearch:eu,glideClassifications:ex,setGlideClassifications:em,glideUniverseFlag:eh,setGlideUniverseFlag:ep}=(0,u.A)(),[ef,eb]=(0,a.useState)([]),[ev,eg]=(0,a.useState)(!1),[ej,ey]=(0,a.useState)(!1),[ek,eN]=(0,a.useState)("all"),[ew,e_]=(0,a.useState)(!1),[eS,eC]=(0,a.useState)({안전자산:[],위험자산:[],all:[]}),[eT,eE]=(0,a.useState)({data:[],loading:!1,message:null}),eA=Number(_),eF=Number.isFinite(eA)&&eA>0,eD="function"==typeof w,eM=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new Map;return e.forEach((e,s)=>{let n=(null==e?void 0:e.표준코드)||(null==e?void 0:e.kr_code)||(null==e?void 0:e.단축코드)||(null==e?void 0:e.한글종목약명)||"__fallback_".concat(s);t.has(n)||t.set(n,e)}),Array.from(t.values())},[eP,eL]=(0,a.useState)({지역:"전체",자산군:"전체",운용방식:"전체"}),eR=Array.isArray(Z)?Z:[],ez=eR.some(e=>Object.keys(p.Oj).some(t=>(null==e?void 0:e[t])!=null)),eB=ez?eR.filter(e=>(0,p.sO)(e,eP)):eR;(0,a.useEffect)(()=>{ed("stock")},[ed]);let eI=async e=>{if(e.preventDefault(),!E.trim())return void m.Ay.error("검색어를 입력해주세요.");Q(l,E,ek)},eY=e=>{let t="object"==typeof e?e.name:e;A(t),eb([]),K(-1),el(!0),Q(l,t,ek)},eO=async e=>{ef.length>0?"ArrowDown"===e.key?(e.preventDefault(),K(e=>e<ef.length-1?e+1:0)):"ArrowUp"===e.key?(e.preventDefault(),K(e=>e>0?e-1:ef.length-1)):"Enter"===e.key?(e.preventDefault(),V>=0&&V<ef.length?eY(ef[V]):(eb([]),E.trim()&&(el(!0),Q(l,E,ek)))):"Escape"===e.key&&(eb([]),K(-1)):"Enter"===e.key&&E.trim()&&(el(!0),Q(l,E,ek))},eW=async()=>{var e;if((null==(e=eT.data)?void 0:e.length)===0)return void m.Ay.error("종목을 선택해주세요.");if(eF&&eT.data.length>eA)return void m.Ay.error("최대 ".concat(eA,"개까지 선택할 수 있습니다."));if(eD){w(eT.data.slice(0,eA||eT.data.length)),d&&d();return}b?$(!0):(X(eT.data.map(e=>({kr_code:e.표준코드,asset_type:"ETF",fund_name:e.한글종목약명||e.펀드명||e.종목이름||e.fund_name}))),G(!0))};return(0,a.useEffect)(()=>{Array.isArray(S)&&0!==S.length&&eE(e=>{let t=eM([...e.data||[],...S]);return{...e,data:t}})},[S]),(0,a.useEffect)(()=>{!ej&&C.query.stock&&(A(C.query.stock),el(!0),Q(l,C.query.stock,ek),ey(!0))},[C.query.stock,ej]),(0,a.useEffect)(()=>{ee&&!ej&&Q(l,E,ek)},[es,ea,E,ek,ex,eh]),(0,a.useEffect)(()=>{let e=e=>{q.current&&!q.current.contains(e.target)&&(eb([]),K(-1))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,n.jsxs)("div",{className:"w-full px-3",children:[(0,n.jsx)("h1",{className:"text-ink text-xl md:text-2xl font-bold tracking-tight md:pt-4 pt-4 md:px-0 px-2",children:"주식으로 ETF 찾기"}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 mb-4 mt-6",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsx)(h.A,{options:[{value:"all",label:"전체"},{value:"안전자산",label:"안전자산"},{value:"위험자산",label:"위험자산"}],value:ek,onChange:e=>{eN(e),el(!0)}}),(0,n.jsxs)("div",{className:"hidden flex-col items-end gap-1 md:flex",children:[eF&&(0,n.jsxs)("span",{className:"text-xs text-ink-mute text-right whitespace-nowrap",children:["선택 ",(null==(t=eT.data)?void 0:t.length)||0,"/",eA]}),(0,n.jsx)("button",{onClick:()=>eW(),disabled:eT.loading,className:"bg-ink hover:bg-ink/90 px-6 h-[36px] text-white text-sm font-semibold flex items-center justify-center min-w-[160px] rounded-lg disabled:opacity-50",children:N})]})]}),(0,n.jsx)("div",{className:"w-full",children:(0,n.jsx)("form",{onSubmit:eI,className:"w-full",children:(0,n.jsxs)("div",{className:"relative",ref:q,children:[(0,n.jsx)("input",{type:"text",placeholder:"주식 또는 ETF 검색...",value:E,onChange:e=>{let t=e.target.value;A(t),U.current&&clearTimeout(U.current),t.trim().length>0?(eg(!0),U.current=setTimeout(async()=>{try{let e=await fetch("/api/search-suggestions",{method:"POST",headers:{"Content-Type":"application/json",...l?{Authorization:l}:{}},body:JSON.stringify({text:t,option:"stock",category:ek,glide_classification:eS[ek]||[],safe_asset:"안전자산"===ek||"위험자산"!==ek&&void 0})}),s=await e.json();eb(s.suggestions||[])}catch(e){console.error("오토컴플리트 요청 실패:",e),eb([])}finally{eg(!1)}},300)):(eb([]),eg(!1))},onKeyDown:eO,className:"block p-4 text-[15px] w-full text-ink placeholder:text-ink-mute bg-white border border-line focus:border-brand-700/60 rounded-xl outline-none"}),ev&&(0,n.jsx)("div",{className:"absolute right-12 top-5",children:(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-line border-t-brand-700 rounded-full animate-spin"})}),(0,n.jsx)("div",{className:"absolute right-4 top-5",children:(0,n.jsx)("button",{type:"submit",className:"w-4 h-4 text-ink-mute",children:(0,n.jsx)("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",className:"w-4 h-4",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"})})})}),E&&ef.length>0&&(0,n.jsx)("div",{className:"absolute left-0 right-0 mt-1 bg-white rounded-xl shadow-lg z-[9999] border border-line",children:(0,n.jsx)("ul",{className:"py-1 max-h-60 overflow-y-auto",children:ef.map((e,t)=>(0,n.jsx)("li",{className:"px-4 py-2 cursor-pointer transition-colors ".concat(t===V?"bg-secondary text-ink":"text-ink-soft hover:bg-secondary/60"),onClick:()=>eY(e),onMouseEnter:()=>K(t),children:"object"==typeof e?(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)("span",{children:e.name}),(0,n.jsx)("span",{className:"text-xs text-ink-mute ml-2",children:e.ticker})]}):(0,n.jsx)("span",{children:e})},t))})})]})})}),ez?(0,n.jsx)(p.Ay,{value:eP,onChange:eL}):(0,n.jsx)("div",{className:"border-line border-t","aria-hidden":!0})]}),eT.loading&&(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full fixed top-0 left-0 bg-white/60 z-[999999999]",children:(0,n.jsx)(x.Ay,{})}),(0,n.jsx)("div",{children:(0,n.jsxs)("div",{ref:T,className:"w-full max-h-[80vh] min-h-[30vh] py-0 pb-4 overflow-auto scroll-container relative mx-auto",children:[ee&&(0,n.jsx)(()=>(0,n.jsx)("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-sm z-[45] flex items-center justify-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,n.jsx)("div",{className:"w-12 h-12 border-4 border-brand-700 border-t-transparent roun
1ded-full animate-spin"}),(0,n.jsx)("p",{className:"text-brand-700 font-medium",children:"데이터를 불러오는 중..."})]})}),{}),eB.length>0?(0,n.jsx)(c.A,{data:eB,search:E,option:"stock",show_selection:r,selectedItems:eT,setSelectedItems:e=>{eE(t=>{let s="function"==typeof e?e(t):e,n=eM((null==s?void 0:s.data)||[]);return eF&&n.length>eA?(m.Ay.error("최대 ".concat(eA,"개까지 선택할 수 있습니다.")),t):{...s,data:n}})},loading:ee}):ee?null:(0,n.jsxs)("div",{className:"text-center text-ink-soft text-base mt-4 flex flex-col gap-2 justify-center items-center w-full",children:[(0,n.jsx)("span",{children:"내용을 찾을 수 없습니다"}),ei&&(0,n.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-2",children:[null==ei?void 0:ei.map((e,t)=>(0,n.jsx)("div",{onClick:async t=>{el(!0),A(e),Q(l,e,ek)},className:"text-brand-700 underline cursor-pointer",children:e},t)),(0,n.jsx)("span",{children:"로 검색한 결과 찾아보기"})]})]})]})}),(0,n.jsx)("div",{className:"fixed bottom-0 left-0 right-0 z-[1000000000] pointer-events-none block md:hidden","aria-live":"polite",children:(0,n.jsxs)("div",{className:"pointer-events-auto w-full border-t border-line bg-white px-4 pt-3 shadow-[0_-8px_32px_rgba(15,23,42,0.12)] pb-[max(1rem,env(safe-area-inset-bottom))]",children:[eF&&(0,n.jsxs)("p",{className:"mb-3 text-center text-xs font-semibold text-ink-soft",children:["선택 ",(null==(s=eT.data)?void 0:s.length)||0,"/",eA]}),(0,n.jsx)("button",{type:"button",onClick:()=>eW(),disabled:eT.loading,className:"w-full rounded-xl px-4 py-3.5 text-[15px] font-semibold shadow-sm transition-colors bg-ink text-white hover:bg-ink/90 disabled:cursor-not-allowed disabled:opacity-50",children:N})]})}),(0,n.jsx)(g.A,{isOpen:H,onClose:()=>G(!1)}),(0,n.jsx)(j.A,{isOpen:J,onConfirm:()=>{X(eT.data.map(e=>({kr_code:e.표준코드,asset_type:"ETF",fund_name:e.한글종목약명||e.펀드명||e.종목이름||e.fund_name}))),eE(e=>({...e,data:[]})),$(!1),d&&d()},onCancel:()=>$(!1)})]})};var k=s(58442);s(63512);var N=s(35103),w=s(50440),_=s(38848);let S=(0,o.default)(()=>Promise.all([s.e(1173),s.e(2572),s.e(2432),s.e(3763),s.e(2985),s.e(7238),s.e(7269)]).then(s.bind(s,17238)),{loadableGenerated:{webpack:()=>[17238]},ssr:!1}),C=(0,o.default)(()=>s.e(970).then(s.bind(s,10970)),{loadableGenerated:{webpack:()=>[10970]},ssr:!1}),T=e=>{let{isModalOpen:t,handleCloseModal:s,token:o,show_selection:c="true",updateResponse:u,setUpdateResponse:m,selectedAccountType:h,props:p,setSaveRefresh:f,setMainTab:v,submitButtonLabel:g="포트폴리오에 추가",onSubmitSelection:j,maxSelectionCount:T,initialSelectedItems:E,hideModelPortfolioTab:A=!1}=e,F=a.useRef(null),D=a.useRef(null),[M,P]=(0,a.useState)("dashboard"),[L,R]=(0,a.useState)("category"),[z,B]=(0,a.useState)(null),[I,Y]=(0,a.useState)([]),[O,W]=(0,a.useState)(""),[U,V]=(0,a.useState)(!1),[K,q]=(0,a.useState)(!1),[H,G]=(0,a.useState)(null),{user:J}=(0,w.Ay)(),{SubscriptionModalComponent:$}=(0,_.R)(),[X,Z]=(0,a.useState)(!0),[Q,ee]=(0,a.useState)(null),[et,es]=(0,a.useState)(null),[en,ea]=(0,a.useState)([]),[el,er]=(0,a.useState)([]),[ei,eo]=(0,a.useState)([]),[ed,ec]=(0,a.useState)("1y"),[eu,ex]=(0,a.useState)("1y"),[em,eh]=(0,a.useState)(!1),[ep,ef]=(0,a.useState)(!1),[eb,ev]=(0,a.useState)(null),[eg,ej]=(0,a.useState)(null),ey=(null==H?void 0:H.표준코드)||(null==H?void 0:H.standard_code)||(null==H?void 0:H.kr_code),ek=async e=>{B(e),V(!0);try{let t=await b.O.get("/api/v2/etf_strategy_builder?strategy_code=".concat(e));t.data&&t.data.length>0&&(Y(t.data),W(t.data[0].strategy_name),R("builder"))}catch(e){console.error("Error fetching strategy data:",e)}finally{V(!1)}},eN=()=>{R("category"),B(null),Y([]),W("")},ew=()=>{f&&f(!0),P("dashboard"),R("category"),B(null),Y([]),W(""),q(!1),G(null),s()};return(0,a.useEffect)(()=>{"model"!==M&&(R("category"),B(null),Y([]),W(""))},[M]),(0,a.useEffect)(()=>{t&&(R("category"),B(null),Y([]),W(""),q(!1),G(null))},[t]),(0,a.useEffect)(()=>{t&&A&&"model"===M&&P("dashboard")},[t,A,M]),(0,a.useEffect)(()=>{if(!K||!ey||et)return void Z(!1);(async()=>{try{Z(!0),ee(null);let e={"Content-Type":"application/json"},[t,s]=await Promise.all([fetch("/api/v1/dividend/summary?standard_code=".concat(ey,"&months=12"),{headers:e}),fetch("/api/v1/dividend/calendar?standard_code=".concat(ey,"&months=12"),{headers:e})]);if(!t.ok||!s.ok)throw Error("API 호출에 실패했습니다.");let n=await t.json(),a=await s.json();es(n),ea(a.months||[])}catch(e){console.error("초기 데이터 로딩 실패:",e),ee(e.message)}finally{Z(!1)}})()}
1,[K,ey]),(0,a.useEffect)(()=>{K&&ey&&(eb!==ed||null==el||!el.series)&&(async()=>{try{eh(!0);let e=await fetch("/api/v1/dividend/distributions/chart?standard_code=".concat(ey,"&period=").concat(ed),{headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("분배금 차트 데이터 로딩 실패");let t=await e.json();er(t),ev(ed)}catch(e){console.error("분배금 차트 로딩 실패:",e)}finally{eh(!1)}})()},[K,ey,ed]),(0,a.useEffect)(()=>{K&&ey&&(eg!==eu||null==ei||!ei.etf_price_return)&&(async()=>{try{ef(!0);let e=await fetch("/api/v1/dividend/returns/chart?standard_code=".concat(ey,"&period=").concat(eu),{headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("수익률 차트 데이터 로딩 실패");let t=await e.json();eo(t),ej(eu)}catch(e){console.error("수익률 차트 로딩 실패:",e)}finally{ef(!1)}})()},[K,ey,eu]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(l.e.Root,{show:t,as:a.Fragment,children:(0,n.jsxs)(r.lG,{as:"div",className:"relative z-[999999999]",initialFocus:F,onClose:ew,children:[(0,n.jsx)(l.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 flex w-screen items-center justify-center overflow-hidden p-2 py-2 md:p-2",children:(0,n.jsx)("div",{className:"flex min-h-0 w-full max-w-full items-center justify-center text-center",children:(0,n.jsx)(l.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsx)(r.lG.Panel,{className:"relative flex h-[min(90dvh,920px)] max-h-[90vh] w-full min-h-0 transform flex-col overflow-hidden rounded-2xl bg-white text-left shadow-xl transition-all",children:(0,n.jsxs)("div",{className:"flex min-h-0 w-full flex-1 flex-col bg-white",children:[(0,n.jsxs)("div",{className:"flex w-full justify-between items-center py-4 px-4 flex-shrink-0",children:[K?(0,n.jsxs)("button",{onClick:()=>{q(!1),G(null),es(null),ea([]),er([]),eo([]),ec("1y"),ex("1y"),ee(null),ev(null),ej(null)},className:"flex items-center gap-2 text-brand-700 hover:text-brand-700/80 font-semibold transition-colors",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),"뒤로가기"]}):"model"===M&&"builder"===L?(0,n.jsxs)("button",{onClick:eN,className:"flex items-center gap-2 text-brand-700 hover:text-brand-700/80 font-semibold transition-colors",children:[(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),"모델 선택으로 돌아가기"]}):(0,n.jsx)("div",{}),(0,n.jsx)("div",{onClick:ew,className:"cursor-pointer text-ink-soft hover:text-ink",children:(0,n.jsx)(i.$8F,{className:"text-[24px]"})})]}),!K&&(0,n.jsxs)("div",{className:"border-line flex gap-2 border-b px-4 flex-shrink-0",children:[(0,n.jsx)("button",{onClick:()=>
1P("dashboard"),className:"break-keep px-2 md:px-6 py-3 text-sm md:text-base transition-all border-b-2 ".concat("dashboard"===M?"-mb-px border-brand-700 text-ink font-semibold":"border-transparent text-ink-mute hover:text-ink-soft font-medium"),children:"ETF Dashboard"}),(0,n.jsx)("button",{onClick:()=>P("stock-finder"),className:"break-keep  px-2 md:px-6 py-3 text-sm md:text-base transition-all border-b-2 ".concat("stock-finder"===M?"-mb-px border-brand-700 text-ink font-semibold":"border-transparent text-ink-mute hover:text-ink-soft font-medium"),children:"주식으로 ETF찾기"}),!A&&(0,n.jsx)("button",{onClick:()=>P("model"),className:"break-keep  px-2 md:px-6 py-3 text-sm md:text-base transition-all border-b-2 ".concat("model"===M?"-mb-px border-brand-700 text-ink font-semibold":"border-transparent text-ink-mute hover:text-ink-soft font-medium"),children:"모델 포트폴리오"})]}),(0,n.jsx)("div",{ref:D,className:"w-full flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-0",children:K?(0,n.jsx)("div",{className:"w-full h-full p-4 sm:p-6 md:p-8",children:X?(0,n.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,n.jsx)(x.hn,{}),(0,n.jsx)("p",{className:"text-brand-700 font-medium",children:"데이터를 불러오는 중..."})]})}):Q?(0,n.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"text-debt font-medium mb-2",children:"오류가 발생했습니다"}),(0,n.jsx)("p",{className:"text-ink-soft text-sm",children:Q})]})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(N.A,{summaryData:et,calendarData:en,distributionChartData:el,returnChartData:ei,distributionPeriod:ed,returnPeriod:eu,onDistributionPeriodChange:e=>{ec(e)},onReturnPeriodChange:e=>{ex(e)},distributionLoading:em,returnLoading:ep,standardCode:ey,isPaidUser:!0,isLoggedIn:!0}),$]})}):(0,n.jsxs)(n.Fragment,{children:["dashboard"===M&&(0,n.jsx)(d.EtfFilter,{token:o,show_selection:c,updateResponse:u,setUpdateResponse:m,handleCloseModal:ew,selectedAccountType:h,props:p,setSaveRefresh:f,setMainTab:v,onDistributionClick:e=>{G(e),q(!0),es(null),ea([]),er([]),eo([]),ec("1y"),ex("1y"),ee(null),ev(null),ej(null)},submitButtonLabel:g,onSubmitSelection:j,maxSelectionCount:T,initialSelectedItems:E,scrollContainerRef:D}),"stock-finder"===M&&(0,n.jsx)(y,{token:o,show_selection:c,updateResponse:u,setUpdateResponse:m,handleCloseModal:ew,selectedAccountType:h,setSaveRefresh:f,setMainTab:v,submitButtonLabel:g,onSubmitSelection:j,maxSelectionCount:T,initialSelectedItems:E}),!A&&"model"===M&&(0,n.jsx)(n.Fragment,{children:"category"===L?(0,n.jsx)(C,{isModal:!0,onSelectStrategy:ek}):U?(0,n.jsx)("div",{className:"flex justify-center items-center py-20",children:(0,n.jsx)("div",{className:"text-brand-700 text-lg",children:"로딩 중..."})}):(0,n.jsx)(S,{token:o,show_selection:c,updateResponse:u,setUpdateResponse:m,handleCloseModal:ew,selectedAccountType:h,onBack:eN,selectedStrategyCode:z,selectedStrategyName:O,strategyFullData:I,isLoading:U})})]})}),(0,n.jsx)(k.N9,{position:"top-center"})]})})})})})]})})})}},12699:(e,t,s)=>{"use strict";s.d(t,{A:()=>f});var n=s(70127);s(70567);var a=s(70746),l=s(9879),r=s(57088),i=s(31975),o=s(93721),d=s(67118),c=s(10895),u=s(6476);let x=e=>{let{data:t}=e,s=(e=>e?Object.entries(e).filter(e=>{let[t]=e;return t.startsWith("TDF")&&"TIF"!==t}).map(e=>{let[t,s]=e,n=t.match(/TDF(\d{4})/);return{name:t,year:n?parseInt(n[1]):0,stockWeight:"number"==typeof s?s:parseFloat(s)||0}}).sort((e,t)=>t.year-e.year):[])(null==t?void 0:t.glide_path_stock_weights);return(0,n.jsxs)("div",{className:"p-[12px] flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"text-[15px] font-[500] text-ink",children:["주요 정보:",(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-2",children:[(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["AI가 매칭한 종목명: ",(null==t?void 0:t.asset_name)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["목표시점: ",(null==t?void 0:t.target_year)||"","년"]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["위험등급: ",(null==t?void 0:t.risk_grade)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["주식비중: ",(null==t?void 0:t.stock_weight)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["보수: ",(null==t?void 0:t.expense_ratio)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["운용사: ",(null==t?void 0:t.fund_manager)||""]})]})]}),(null==t?void 0:t.glide_path_stock_weights)&&s.length>0&&(0,n.jsxs)("div",{className:"text-[15px] font-[500] text-ink",children:["주식 비중:",(0,n.jsx)("div",{className:"mt-3 h-64 w-full",children:(0,n.jsx)(l.u,{width:"100%",height:"100%",children:(0,n.jsxs)(r.b,{data:s,margin:{top:5,right:30,left:2
10,bottom:5},children:[(0,n.jsx)(i.d,{strokeDasharray:"3 3",stroke:"#e6ebe9"}),(0,n.jsx)(o.W,{dataKey:"name",stroke:"#7e8f8a",fontSize:12,angle:-45,textAnchor:"end",height:60}),(0,n.jsx)(d.h,{stroke:"#7e8f8a",fontSize:12,domain:["dataMin - 5","dataMax + 5"],tickFormatter:e=>e.toFixed(2)}),(0,n.jsx)(c.m,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e6ebe9",borderRadius:"8px",fontSize:"12px"},formatter:e=>["".concat(e,"%"),"주식 비중"],labelFormatter:e=>"".concat(e)}),(0,n.jsx)(u.N1,{type:"monotone",dataKey:"stockWeight",stroke:"#167a5c",strokeWidth:2,dot:{fill:"#167a5c",strokeWidth:2,r:4},activeDot:{r:6,stroke:"#167a5c",strokeWidth:2,fill:"#fff"}})]})})})]}),(0,n.jsx)(h,{data:t.performance_summary,type:"TDF"}),(0,n.jsx)(p,{data:t.investment_strategies})]})},m=e=>{let{data:t}=e;return(0,n.jsxs)("div",{className:"p-[12px] flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"text-[15px] font-[500] text-ink",children:["주요 정보:",(0,n.jsxs)("div",{className:"mt-2 flex flex-col gap-2",children:[(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["AI가 매칭한 종목명: ",(null==t?void 0:t.asset_name)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["기초자산: ",(null==t?void 0:t.underlying_index)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["총비용비율: ",(null==t?void 0:t.expense_ratio)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["투자위험등급: ",(null==t?void 0:t.risk_grade)||""]}),(0,n.jsxs)("span",{className:"text-[13px] font-[500] text-ink",children:["운용사: ",(null==t?void 0:t.fund_manager)||""]})]})]}),(0,n.jsx)(h,{data:t.performance_summary,type:"ETF"}),(0,n.jsx)(p,{data:t.investment_strategies})]})},h=e=>{let{data:t,type:s}=e;if(!t||!("TDF"!==s||Object.keys(t).some(e=>["ytd","this_month","1yr_before","2yr_before","3yr_before","after_inception"].includes(e))))return null;let a="TDF"===s?[{period:"이번달",value:t.this_month,key:"this_month"},{period:"올해",value:t.ytd,key:"ytd"},{period:"1년",value:t["1yr_before"],key:"1yr_before"},{period:"2년",value:t["2yr_before"],key:"2yr_before"},{period:"3년",value:t["3yr_before"],key:"3yr_before"},{period:"설정이후",value:t.after_inception,key:"after_inception"}]:[{period:"이번달",value:t.return_mtd,key:"return_mtd"},{period:"올해",value:t.return_ytd,key:"return_ytd"},{period:"1년",value:t.return_1yr,key:"return_1yr"},{period:"2년",value:t.return_2yr,key:"return_2yr"},{period:"3년",value:t.return_3yr,key:"return_3yr"},{period:"설정이후",value:t.return_since_inception,key:"return_since_inception"}];return(0,n.jsxs)("div",{className:"text-[15px] font-[500] text-ink mt-3",children:["성과:",(0,n.jsx)("div",{className:"mt-3",children:(0,n.jsx)("div",{className:"overflow-hidden rounded-lg border border-line",children:(0,n.jsxs)("table",{className:"w-full text-[13px]",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"bg-secondary/60 border-b border-line",children:[(0,n.jsx)("th",{className:"text-left py-2 px-3 font-medium text-ink-mute text-xs",children:"기간"}),(0,n.jsx)("th",{className:"text-right py-2 px-3 font-medium text-ink-mute text-xs",children:"수익률"})]})}),(0,n.jsx)("tbody",{children:a.map((e,t)=>(0,n.jsxs)("tr",{className:"border-b border-line last:border-b-0 hover:bg-secondary/40 ".concat(t%2==0?"bg-white":"bg-secondary/20"),children:[(0,n.jsx)("td",{className:"py-2 px-3 text-ink",children:e.period}),(0,n.jsx)("td",{className:"py-2 px-3 text-right font-medium tabular-nums ".concat((e=>{if(!e||"-"===e||"N/A"===e)return"text-ink-mute";let t=parseFloat(e.toString().replace("%",""));return isNaN(t)?"text-ink-mute":t>0?"text-brand-700":t<0?"text-debt":"text-ink-mute"})(e.value)),children:e.value||"N/A"})]},t))})]})})})]})},p=e=>{let{data:t}=e;return t?(0,n.jsxs)("div",{className:"text-[15px] font-[500] text-ink",children:["투자설명:",(0,n.jsxs)("ul",{className:"list-disc pl-5 mt-2 text-ink-soft text-[13px]",children:[(0,n.jsxs)("li",{children:["투자전략: ",(0,n.jsx)("br",{})," ",t.investment_strategy]}
1),(0,n.jsxs)("li",{children:["매수방법: ",(0,n.jsx)("br",{})," ",t.purchase_method]}),(0,n.jsxs)("li",{children:["환매방법: ",(0,n.jsx)("br",{})," ",t.redemption_method]})]})]}):null},f=e=>{let{tickerDetail:t,assetType:s}=e;return t.loading?(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full",children:(0,n.jsx)(a.Ay,{})}):t.data?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-[17px] font-[600] text-ink p-[12px] border-b border-line w-full",children:"선택한 자산 세부정보"}),"TDF"===s?(0,n.jsx)(x,{data:t.data}):(0,n.jsx)(m,{data:t.data})]}):(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full text-ink-soft",children:"데이터를 불러올 수 없습니다."})}},13904:()=>{},17665:(e,t,s)=>{"use strict";s.d(t,{A:()=>l});var n=s(70127),a=s(86685);function l(e){let{label:t="전일"}=e;return(0,n.jsxs)("span",{className:"group relative inline-flex items-center gap-1",children:[t,(0,n.jsx)("button",{type:"button","aria-label":"전일 수익률 기준 설명 보기",className:"rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-700",onClick:e=>e.stopPropagation(),children:(0,n.jsx)(a.A,{className:"h-4 w-4",strokeWidth:2})}),(0,n.jsx)("span",{role:"tooltip",className:"pointer-events-none absolute left-1/2 top-full z-50 mt-2 w-max max-w-[calc(100vw-2rem)] -translate-x-1/2 rounded-xl bg-ink px-4 py-3 text-left text-sm font-normal leading-snug break-keep text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100",children:"ETF는 시장 종가, 펀드(TDF 포함)는 수정기준가 기준 수익률이에요."})]})}},19450:(e,t,s)=>{"use strict";function n(e){return"personal_pension"===String(null!=e?e:"").trim().toLowerCase()?"personal_pension":"retirement_pension"}s.d(t,{o:()=>n})},20451:(e,t,s)=>{"use strict";s.d(t,{$:()=>o});var n=s(70127),a=s(88312),l=s(34620),r=s(26896);let i=(0,l.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:s="default",size:l="default",...o}=e;return(0,n.jsx)(a.$,{"data-slot":"button",className:(0,r.cn)(i({variant:s,size:l,className:t})),...o})}},21300:(e,t,s)=>{"use strict";s.d(t,{YT:()=>i,_N:()=>d,$U:()=>c,Gn:()=>x,nu:()=>u,ML:()=>m});var n=s(76773);async function a(e){let{userId:t,eventName:s,metadata:a,clientEventId:l,supabase:r}=e,i=null==t?void 0:t.trim();if(!i)return{ok:!1,message:"empty userId"};let o=null==s?void 0:s.trim();if(!o)return{ok:!1,message:"empty eventName"};let d=null!=r?r:(0,n.U)(),c={user_id:i,event_name:o};null!=a&&Object.keys(a).length>0&&(c.metadata=a),null!=l&&""!==String(l).trim()&&(c.client_event_id=String(l).trim());let{error:u}=await d.from("user_event_logs").insert(c);return u?(console.warn("[logUserEvent] insert failed:",u.message,{event_name:o}),{ok:!1,message:u.message}):{ok:!0}}async function l(e){var t,s;let l=null!=(s=e.supabase)?s:(0,n.U)(),{data:{session:r},error:i}=await l.auth.getSession();if(i||!(null==r||null==(t=r.user)?void 0:t.id))return{ok:!1,message:"no session"};let{supabase:o,...d}=e;return a({...d,supabase:l,userId:r.user.id})}function r(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID()}let i=e=>{let{user_event_log:t,...s}=e;window.dataLayer&&window.dataLayer.push(s),t&&function(e){let t=e.user_event_log;if(!t)return;let s="object"==typeof t,n=s&&t.event_name?t.event_name:e.event,{user_event_log:a,event:i,...o}=e,d=s&&void 0!==t.metadata?t.metadata:Object.keys(o).length>0?{...o}:void 0,c=s&&t.client_event_id?t.client_event_id:r();l({eventName:n,metadata:d&&Object.keys(d).length>0?d:void 0,clientEventId:c})}(e)},o=(e,t,s)=>{window.fbq&&window.fbq.loaded&&window.fbq("track",e,t),function(e,t,s){if(!s)return;let n="object"==typeof s,a=n&&s.event_name?s.event_name:e,i=n&&void 0!==s.metadata?s.metadata:t&&Object.keys(t).length>0?{...t}:void 0,o=n&&s.client_event_id?s.client_event_id:r();l({eventName:a,metadata:i&&Object.keys(i).length>0?i:void 0,clientEventId:o})}("pixel_".concat(String(e)),t,s)},d=(e,t,s)=>{(e=>{if(e.ga&&i(e.ga),e.pixel){let{eventName:t,parameters:s,user_event_log:n}=e.pixel;o(t,s,n)}})({ga:{event:e,...t},pixel:s?{eventName:"Lead",parameters:s,user_event_log:!0}:void 0})},c=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];o("InitiateCheckout",e,t)},u=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];o("Purchase",{currency:"KRW",...e},t)},x=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];o("Lead",e,t)},m=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];o("StartTrial",e,t)}},26896:(e,t,s)=>{"use strict";s.d(t,{HH:()=>c,JS:()=>x,Xk:()=>r,cn:()=>l,d5:()=>u,gV:()=>d,gY:()=>o,hG:()=>h,iq:()=>m});var n=s(74154),a=s(10742);function l(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,a.QP)((0,n.$)(t))}let r=e=>Math.abs(e)>=1e8?"".concat((e/1e8).toFixed(1).replace(/\.0$/,""),"억"):"".concat(Math.round(e/1e4).toLocaleStr
1ing(),"만"),i=0;function o(e){return i+=1,"".concat(e,"-").concat(Date.now(),"-").concat(i)}function d(){return new Intl.DateTimeFormat("en-CA",{timeZone:"Asia/Seoul"}).format(new Date)}function c(e){return e?String(Math.round(e/1e4)):""}function u(e){let t=Number(e.replace(/,/g,""));return!Number.isFinite(t)||t<0?0:Math.round(1e4*t)}function x(e){return"tdf"===e.trim().toLowerCase()}function m(e,t,s){return Math.floor(x(e)?t*s/1e3:t*s)}function h(e,t,s){return s>0?Math.round(100*(x(e)?t/s*1e3:t/s))/100:0}},29657:(e,t,s)=>{"use strict";s.d(t,{A:()=>o});var n=s(70127),a=s(70567),l=s(26896),r=s(90636);let i="TDF는 1000좌당 기준가로 입력합니다.";function o(e){let{className:t}=e,[s,o]=(0,a.useState)(!1);return(0,n.jsxs)(r.m_,{open:s,onOpenChange:o,children:[(0,n.jsx)(r.k$,{"aria-label":i,onClick:e=>{e.stopPropagation(),o(e=>!e)},className:(0,l.cn)("border-line text-ink-mute hover:border-brand-700/40 hover:text-brand-700 flex h-3.5 w-3.5 shrink-0 cursor-help items-center justify-center rounded-full border text-[9px] font-semibold",t),children:"?"}),(0,n.jsx)(r.ZI,{children:i})]})}},34383:(e,t,s)=>{"use strict";s.d(t,{o:()=>r});var n=s(70567),a=s(76773),l=s(50440);function r(){var e;let[t,s]=(0,n.useState)(null),r=(0,l.Ay)(e=>e.user);return(0,n.useEffect)(()=>{(0,a.U)().auth.getUser().then(e=>{var t,n,a,l;let{data:r}=e,i=null==(t=r.user)?void 0:t.user_metadata;s(null!=(l=null!=(a=null!=(n=null==i?void 0:i.user_name)?n:null==i?void 0:i.name)?a:null==i?void 0:i.full_name)?l:null)}),l.Ay.getState().user||l.Ay.getState().fetchUser()},[]),null!=(e=null!=t?t:null==r?void 0:r.name)?e:null}},35024:(e,t,s)=>{"use strict";s.d(t,{A:()=>b});var n=s(70127);s(70567);var a=s(77483),l=s(841),r=s(393),i=s(89573),o=s(65847),d=s(26896),c=s(20451),u=s(30233);function x(e){let{...t}=e;return(0,n.jsx)(a.D,{"data-slot":"dialog",...t})}function m(e){let{...t}=e;return(0,n.jsx)(l.Z,{"data-slot":"dialog-portal",...t})}function h(e){let{className:t,...s}=e;return(0,n.jsx)(r.X,{"data-slot":"dialog-overlay",className:(0,d.cn)("fixed inset-0 isolate z-50 bg-black/40 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...s})}function p(e){let{className:t,children:s,showCloseButton:a=!0,...l}=e;return(0,n.jsxs)(m,{children:[(0,n.jsx)(h,{}),(0,n.jsxs)(i.h,{"data-slot":"dialog-content",className:(0,d.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...l,children:[s,a&&(0,n.jsxs)(o.H,{"data-slot":"dialog-close",render:(0,n.jsx)(c.$,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,n.jsx)(u.A,{}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}let f={"max-w-[360px]":"w-[min(360px,calc(100vw-2rem))]","max-w-[480px]":"w-[min(480px,calc(100vw-2rem))]","max-w-[560px]":"w-[min(560px,calc(100vw-2rem))]","max-w-[600px]":"w-[min(600px,calc(100vw-2rem))]","max-w-[720px]":"w-[min(720px,calc(100vw-2rem))]","max-w-[860px]":"w-[min(860px,calc(100vw-2rem))]","max-w-[960px]":"w-[min(960px,calc(100vw-3rem))]","max-w-[1080px]":"w-[min(1080px,calc(100vw-3rem))]"};function b(e){var t;let{open:s,onClose:a,labelledBy:l,maxWidth:r="max-w-[560px]",children:i}=e;return(0,n.jsx)(x,{open:s,onOpenChange:e=>{e||a()},children:(0,n.jsx)(p,{showCloseButton:!1,"aria-labelledby":l,className:(0,d.cn)("grid-cols-1 max-w-none sm:max-w-none gap-0 rounded-2xl border-line bg-white p-7 shadow-xl ring-0 sm:p-8",null!=(t=f[r])?t:f["max-w-[560px]"]),children:i})})}},35103:(e,t,s)=>{"use strict";s.d(t,{A:()=>g});var n=s(70127),a=s(70567),l=s(9879),r=s(91081),i=s(31975),o=s(93721),d=s(67118),c=s(10895),u=s(43647),x=s(31527),m=s(57088),h=s(6476),p=s(53200),f=s(76773);let b=e=>{let{currentPeriod:t,onPeriodChange:s,isLoading:a}=e;return(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"bg-secondary flex rounded-xl p-1 gap-1",children:[{label:"6개월",value:"6m"},{label:"1년",value:"1y"},{label:"3년",value:"3y"},{label:"전체",value:"all"}].map(e=>(0,n.jsx)("button",{type:"button",onClick:t=>((e,t)=>{e.preventDefault(),e.stopPropagation(),s&&s(t)})(t,e.value),disabled:a,className:"py-1 px-2 sm:py-1.5 sm:px-3 rounded-lg text-xs sm:text-sm font-medium transition-all ".concat(t===e.value?"bg-white text-ink shadow-sm":"text-ink-mute hover:text-ink-soft"," ").concat(a?"opacity-50 cursor-not-allowed":""),children:e.label},e.value))}),a&&(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-brand-700 border-t-transparent roun
1ded-full animate-spin"})]})},v=e=>{let{viewBox:t,value:s}=e;if(!t||!s)return null;let a=t.width||0,l=t.x||0,r=7*s.length+12,i=l+a-r-(a<400?3:5),o=(t.y||0)-10;return(0,n.jsxs)("g",{children:[(0,n.jsx)("defs",{children:(0,n.jsxs)("filter",{id:"shadow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[(0,n.jsx)("feGaussianBlur",{in:"SourceAlpha",stdDeviation:"1"}),(0,n.jsx)("feOffset",{dx:"0",dy:"1",result:"offsetblur"}),(0,n.jsx)("feComponentTransfer",{children:(0,n.jsx)("feFuncA",{type:"linear",slope:"0.3"})}),(0,n.jsxs)("feMerge",{children:[(0,n.jsx)("feMergeNode",{}),(0,n.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),(0,n.jsx)("rect",{x:i,y:o,width:r,height:20,fill:"white",stroke:"#de6262",strokeWidth:1.5,rx:4,filter:"url(#shadow)"}),(0,n.jsx)("text",{x:i+6,y:o+14,fill:"#de6262",fontSize:11,fontWeight:"600",textAnchor:"start",children:s})]})},g=e=>{var t,s,g,j,y,k;let{summaryData:N,calendarData:w=[],distributionChartData:_,returnChartData:S,distributionPeriod:C="1y",returnPeriod:T="1y",onDistributionPeriodChange:E,onReturnPeriodChange:A,distributionLoading:F=!1,returnLoading:D=!1,standardCode:M,isPaidUser:P=!1,isLoggedIn:L=!0,accessToken:R=null,onLoginRequired:z=()=>{}}=e,[B,I]=(0,a.useState)("lump"),[Y,O]=(0,a.useState)(1e5),[W,U]=(0,a.useState)(null),[V,K]=(0,a.useState)(!1),[q,H]=(0,a.useState)(!1),[G,J]=(0,a.useState)({etfPrice:!0,etfTotal:!0,spyPrice:!0,spyTotal:!0});(0,a.useEffect)(()=>{let e=()=>{H(window.innerWidth<768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let $=(0,a.useCallback)(async()=>{if(M&&Y&&!(Y<1e3)&&P)try{var e;K(!0);let t="regular"===B?"dca":"lump_sum",s=(0,f.U)(),{data:{session:n}}=await s.auth.getSession(),a=null!=(e=null==n?void 0:n.access_token)?e:R;if(!a)return;let l=await fetch("/api/v1/dividend/simulation",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a)},body:JSON.stringify({standard_code:M,target_cash:Y,months:12,mode:t})});if(l.ok){let e=await l.json();U(e)}}catch(e){console.error("시뮬레이션 API 오류:",e)}finally{K(!1)}},[M,Y,B,P,R]);(0,a.useEffect)(()=>{if(!P)return;if(Y<1e3)return void U(null);let e=setTimeout(()=>$(),500);return()=>clearTimeout(e)},[$,P]);let X=e=>e?"".concat(e.substring(0,4),".").concat(e.substring(4,6)):"",Z=e=>e&&0!==e?Math.round(e).toLocaleString():"0",Q=(0,a.useMemo)(()=>(null==_?void 0:_.series)?_.series.map(e=>({month:X(e.standard_date),amount:e.dividend_amount})):[],[_]),ee=(0,a.useMemo)(()=>{if(!(null==_?void 0:_.series)||_.series.length<2)return!1;let e=_.series.map(e=>e.dividend_amount).filter(e=>e>0);if(e.length<2)return!1;let t=Math.min(...e),s=Math.max(...e);return 0!==s&&t/s<.5},[_]);return!(0,a.useMemo)(()=>{var e;let t=N&&(N.sum_12m>0||N.avg_12m>0||(null==(e=N.latest_distribution)?void 0:e.dividend_amount)>0),s=w&&w.some(e=>e.dividend_amount>0),n=(null==_?void 0:_.series)&&_.series.some(e=>e.dividend_amount>0);return t||s||n},[N,w,_])&&L?(0,n.jsx)("div",{className:"w-full h-full",children:(0,n.jsxs)("div",{className:"mt-6 p-6 bg-secondary/60 rounded-xl text-center",children:[(0,n.jsx)("div",{className:"w-12 h-12 mx-auto mb-3 bg-white rounded-full flex items-center justify-center",children:(0,n.jsx)("svg",{className:"w-6 h-6 text-ink-mute",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,n.jsx)("p",{className:"text-sm font-medium text-ink mb-1",children:"분배금 정보가 없어요"}),(0,n.jsx)("p",{className:"text-xs text-ink-soft",children:"분배금을 지급하지 않는 상품이거나, 아직 분배금 정보가 제공되지 않았어요."})]})}):(0,n.jsxs)("div",{className:"w-full h-full",children:[(0,n.jsxs)("div",{className:"mb-6 sm:mb-8 relative",children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-3 sm:mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h2",{className:"text-lg sm:text-xl font-bold text-ink tracking-tight mb-4",children:"월별 분배금 추이"}),ee&&(0,n.jsxs)("div",{className:"group relative inline-flex items-center",children:[(0,n.jsx)(p.A,{className:"w-4 h-4 text-amber-500 cursor-help"}),(0,n.jsxs)("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1.5 bg-ink text-white text-xs rounded-md opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-20",children:["들쑥날쑥해요",(0,n.jsx)("div",{className:"absolute top-full left-1/2 -translate-x-1/2 -mt-1 border-4 border-transparent border-t-ink"})]})]})]}),(0,n.jsx)(b,{currentPeriod:C,onPeriodChange:E,isLoading:F})]}),ee&&(0,n.jsxs)("div",{className:"mb-3 p-3 bg-amber-50 border border-amber-200 rounded-lg flex items-start gap-2",children:[(0,n.jsx)(p.A,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-xs sm:text-sm text-amber-800 font-medium mb-0.5",children:"들쑥날쑥해요"}),(0,n.jsx)("p",{className:"text-xs text-amber-700",children:"최근 분배금이 들쑥날쑥하게 변동하고 있습니다."})]})]}),(0,n.jsx)("div",{className:"w-full",children:(0,n.jsx)(l.u,{width:"100%",height:q?200:280,children:(0,n.jsxs)(r.E,{data:Q,margin:{top:20,right:q?10:80,left:q?-20:10,bottom:q?20:60},children:[(0,n.jsx)(i.d,{strokeDasharray:"3 3",stroke:"#e6ebe9",vertical:!1}),(0,n.jsx)(o.W,{dataKey:"month",tick:{fontSize:11,fill:"#4f615c"},angle:-45,textAnchor:"end",tickLine:!1}),(0,n.jsx)(d.h,{tick:{fontSize:11,fill:"#4f615c"},tickFormatter:e=>e>
1=1e4?"".concat((e/1e4).toFixed(1),"만"):e.toLocaleString(),tickLine:!1,axisLine:!1}),(0,n.jsx)(c.m,{formatter:e=>["".concat(e.toLocaleString(),"원"),"분배금"],cursor:{fill:"rgba(22, 122, 92, 0.1)"},contentStyle:{backgroundColor:"#fff",border:"1px solid #e6ebe9",borderRadius:"6px",fontSize:"13px"}}),(0,n.jsx)(u.yP,{dataKey:"amount",fill:"#167a5c",radius:[4,4,0,0]}),(null==_?void 0:_.avg)&&(0,n.jsx)(x.e_,{y:_.avg,stroke:"#de6262",strokeDasharray:"4 4",strokeWidth:1,ifOverflow:"extendDomain",label:e=>{let{viewBox:t}=e;return(0,n.jsx)(v,{viewBox:t,value:"평균 ".concat(Z(_.avg),"원")})}})]})})})]}),(0,n.jsx)("h2",{className:"text-lg sm:text-xl font-bold text-ink tracking-tight mb-4",children:"분배금 시나리오"}),(null==N?void 0:N.sum_12m)&&0!==N.sum_12m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"inline-flex bg-secondary rounded-xl p-1 mb-4",children:[(0,n.jsx)("button",{type:"button",onClick:()=>I("lump"),className:"px-3 py-1.5 rounded-lg text-xs sm:text-sm font-medium transition-all ".concat("lump"===B?"bg-white text-ink shadow-sm":"text-ink-mute hover:text-ink-soft"),children:"거치식"}),(0,n.jsx)("button",{type:"button",onClick:()=>I("regular"),className:"px-3 py-1.5 rounded-lg text-xs sm:text-sm font-medium transition-all ".concat("regular"===B?"bg-white text-ink shadow-sm":"text-ink-mute hover:text-ink-soft"),children:"적립식"})]}),(0,n.jsxs)("div",{className:"border border-line rounded-xl p-4 sm:p-5 mb-6 sm:mb-8 bg-ground relative",children:[(!L||!P)&&(0,n.jsx)("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-[1px] rounded-xl flex flex-col items-center justify-center z-10",children:(0,n.jsxs)("div",{className:"text-center px-4",children:[(0,n.jsx)("div",{className:"w-12 h-12 mx-auto mb-3 bg-secondary rounded-full flex items-center justify-center",children:(0,n.jsx)("svg",{className:"w-6 h-6 text-ink-mute",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,n.jsx)("p",{className:"text-sm font-medium text-ink mb-1",children:"멤버십 전용 기능"}),(0,n.jsx)("p",{className:"text-xs text-ink-soft mb-3",children:"분배금 시뮬레이션은 멤버십 회원만 이용 가능합니다"}),(0,n.jsx)("a",{href:"/subscription",className:"inline-block px-4 py-2 bg-ink text-white text-xs font-semibold rounded-lg hover:bg-ink/90 transition-colors",children:"멤버십 구독하기"})]})}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 mb-4 pb-4 border-b border-line",children:[(0,n.jsx)("span",{className:"text-xs sm:text-sm text-ink-soft",children:"목표 분배금"}),(0,n.jsxs)("div",{className:"flex flex-col gap-1 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("input",{type:"text",value:Y.toLocaleString(),onChange:e=>{let t=e.target.value.replace(/,/g,""),s=parseInt(t)||0;(""===t||s>=0)&&O(s)},disabled:!P,className:"w-32 sm:w-36 px-3 py-2 pr-8 border border-line rounded-lg text-sm font-medium text-ink focus:outline-none focus:border-brand-700/60 transition-colors disabled:bg-secondary disabled:cursor-not-allowed"}),(0,n.jsx)("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-ink-mute",children:"원"})]}),(0,n.jsx)("div",{className:"flex gap-1",children:[1e5,5e5,1e6].map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>O(e),disabled:!P,className:"px-2 py-1.5 text-[10px] sm:text-xs rounded-lg font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed ".concat(Y===e?"bg-ink text-white":"bg-white text-ink-mute border border-line hover:text-ink-soft"),children:[e/1e4,"만"]},e))})]}),Y>0&&Y<1e3&&(0,n.jsx)("p",{className:"text-xs text-debt mt-1",children:"1000원 이상 입력해주세요."})]})]}),V?(0,n.jsxs)("div",{className:"flex items-center justify-center gap-2 py-6 text-sm text-ink-mute",children:[(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-line border-t-brand-700 rounded-full animate-spin"}),(0,n.jsx)("span",{children:"계산 중"})]}):W&&!1===W.is_feasible?(0,n.jsx)("p",{className:"text-xs sm:text-sm text-debt text-center py-4",children:"해당 조건으로는 목표 달성이 어려울 수 있습니다"}):W?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("p",{className:"text-sm text-ink-soft leading-relaxed",children:"regular"===B?(0,n.jsxs)(n.Fragment,{children:["지난 12개월 간 ",(0,n.jsx)("span",{className:"font-medium text-ink",children:"적립식"}),"으로"," ",(0,n.jsxs)("span",{className:"font-semibold text-brand-700",children:[Y.toLocaleStr
1ing(),"원"]}),"의 분배금을 받으려면"]}):(0,n.jsxs)(n.Fragment,{children:["지난 12개월 동안 ",(0,n.jsx)("span",{className:"font-medium text-ink",children:"거치식"}),"으로"," ",(0,n.jsxs)("span",{className:"font-semibold text-brand-700",children:[Y.toLocaleString(),"원"]}),"의 분배금을 받으려면"]})}),(0,n.jsx)("div",{className:"bg-white border border-line rounded-lg p-3",children:"regular"===B?(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[10px] sm:text-xs text-ink-mute block",children:"필요 월 투자금"}),(0,n.jsxs)("span",{className:"text-base sm:text-lg font-bold text-brand-700 tabular-nums",children:[null==(t=W.monthly_investment)?void 0:t.toLocaleString(),"원"]})]}),(0,n.jsx)("div",{className:"hidden sm:block w-px h-8 bg-line"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[10px] sm:text-xs text-ink-mute block",children:"누적 투자금"}),(0,n.jsxs)("span",{className:"text-base sm:text-lg font-bold text-ink tabular-nums",children:[null==(s=W.total_invested)?void 0:s.toLocaleString(),"원"]})]})]}):(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[10px] sm:text-xs text-ink-mute block",children:"필요 보유 수량"}),(0,n.jsxs)("span",{className:"text-base sm:text-lg font-bold text-brand-700 tabular-nums",children:[null==(g=W.required_shares)?void 0:g.toLocaleString(),"주"]})]}),(0,n.jsx)("div",{className:"hidden sm:block w-px h-8 bg-line"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-[10px] sm:text-xs text-ink-mute block",children:"필요 초기 투자금"}),(0,n.jsxs)("span",{className:"text-base sm:text-lg font-bold text-ink tabular-nums",children:[null==(j=W.required_investment)?void 0:j.toLocaleString(),"원"]})]})]})}),(()=>{var e;let t=(null==(e=W.warnings)?void 0:e.filter(e=>"bisection_failed"!==e))||[];return t.length>0&&(0,n.jsx)("p",{className:"text-[10px] sm:text-xs text-amber-600 bg-amber-50 px-2 py-1.5 rounded",children:t.join(", ")})})()]}):(0,n.jsx)("p",{className:"text-xs sm:text-sm text-ink-mute text-center py-4",children:"목표 분배금을 입력해 주세요"})]})]}):(0,n.jsx)("div",{className:"border border-line rounded-xl p-4 sm:p-5 mb-6 sm:mb-8 bg-ground",children:(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-6 text-center",children:[(0,n.jsx)("div",{className:"w-12 h-12 mx-auto mb-3 bg-secondary rounded-full flex items-center justify-center",children:(0,n.jsx)(p.A,{className:"w-6 h-6 text-ink-mute"})}),(0,n.jsx)("p",{className:"text-sm font-medium text-ink mb-1",children:"최근 12개월 내 분배금 지급 내역이 없습니다"})]})}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-3 sm:mb-4",children:[(0,n.jsx)("h2",{className:"text-lg sm:text-xl font-bold text-ink tracking-tight mb-4",children:"ETF 누적 수익률"}),(0,n.jsx)(b,{currentPeriod:T,onPeriodChange:A,isLoading:D})]}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2 mb-3",children:[{key:"etfPrice",label:"ETF 가격수익률",color:"#167a5c",shortLabel:"ETF가격"},{key:"etfTotal",label:"ETF 총수익률(분배금 재투자)",color:"#10b981",shortLabel:"ETF총"},{key:"spyPrice",label:"벤치마크(SPY) 가격수익률",color:"#f59e0b",shortLabel:"SPY가격"},{key:"spyTotal",label:"벤치마크(SPY) 총수익률(분배금 재투자)",color:"#ef4444",shortLabel:"SPY총"}].map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>(e=>{J(t=>({...t,[e]:!t[e]}))})(e.key),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all border ".concat(G[e.key]?"bg-white border-line text-ink shadow-sm":"bg-secondary border-line text-ink-mute"),children:[(0,n.jsx)("span",{className:"w-3 h-0.5 rounded-full transition-opacity ".concat(G[e.key]?"":"opacity-30"),style:{backgroundColor:e.color}}),(0,n.jsx)("span",{className:"hidden sm:inline",children:e.label}),(0,n.jsx)("span",{className:"sm:hidden",children:e.shortLabel})]},e.key))}),(0,n.jsxs)("div",{className:"w-full",children:[(0,n.jsx)(l.u,{width:"100%",height:280,children:(0,n.jsxs)(m.b,{data:(null==S?void 0:S.etf_price_return)?S.etf_price_return.map((e,t)=>{var s,n,a;return{month:X(e.standard_month||e.standard_date),etfPrice:Number(((e.value-1)*100).toFixed(2)),etfTotal:(null==(s=S.etf_total_return)?void 0:s[t])?Number(((S.etf_total_return[t].value-1)*100).toFixed(2)):0,spyPrice:(null==(n=S.spy_price_return)?void 0:n[t])?Number(((S.spy_price_return[t].value-1)*100).toFixed(2)):null,spyTotal:(null==(a=S.spy_total_return)?void 0:a[t])?Number(((S.spy_total_return[t].value-1)*100).toFixed(2)):null}}):[],margin:{top:20,right:q?10:30,left:q?5:20,bottom:q?55:60},children:[(0,n.jsx)(i.d,{strokeDasharray:"3 3",stroke:"#e6ebe9",vertical:!1}),(0,n.jsx)(o.W,{dataKey:"month",tick:{fontSize:11,fill:"#4f615c"},angle:-45,textAnchor:"end",tickLine:!1,height:60,dy:15}),(0,n.jsx)(d.h,{tick:{fontSize:11,fill:"#4f615c"}
1,unit:"%",tickLine:!1,axisLine:!1}),(0,n.jsx)(c.m,{formatter:(e,t)=>["".concat(e,"%"),{etfPrice:"ETF 가격 수익률",etfTotal:"ETF 총수익률(분배금 재투자)",spyPrice:"벤치마크(SPY) 가격 수익률",spyTotal:"벤치마크(SPY) 총수익률(분배금 재투자)"}[t]||t],contentStyle:{backgroundColor:"#fff",border:"1px solid #e6ebe9",borderRadius:"6px",fontSize:"13px"}}),G.etfPrice&&(0,n.jsx)(h.N1,{type:"monotone",dataKey:"etfPrice",stroke:"#167a5c",strokeWidth:2,name:"ETF 가격수익률",dot:{r:2}}),G.etfTotal&&(0,n.jsx)(h.N1,{type:"monotone",dataKey:"etfTotal",stroke:"#10b981",strokeWidth:2,name:"ETF 총수익률 (분배금 재투자)",dot:{r:2}}),G.spyPrice&&(0,n.jsx)(h.N1,{type:"monotone",dataKey:"spyPrice",stroke:"#f59e0b",strokeWidth:2,name:"벤치마크(SPY) 가격수익률",dot:{r:2}}),G.spyTotal&&(0,n.jsx)(h.N1,{type:"monotone",dataKey:"spyTotal",stroke:"#ef4444",strokeWidth:2,name:"벤치마크(SPY) 총수익률 (분배금 재투자)",dot:{r:2}})]})}),(0,n.jsxs)("ul",{className:"text-xs sm:text-sm text-ink-soft py-10 ml-8",children:[(0,n.jsx)("li",{className:"list-disc",children:"가격 기준 수익률은 분배금을 제외한 가격 변동만 반영합니다."}),(0,n.jsx)("li",{className:"list-disc",children:"총수익률(분배금 재투자)은 분배금을 다시 투자했을 때의 성과를 의미합니다."})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:gap-4 mb-6 sm:mb-8 relative",children:[(0,n.jsx)("h2",{className:"text-lg sm:text-xl font-bold text-ink tracking-tight mb-4",children:"분배금 요약"}),(0,n.jsxs)("div",{className:"bg-secondary/60 p-3 sm:p-4 rounded-xl flex justify-between items-center",children:[(0,n.jsx)("h4",{className:"text-xs sm:text-sm text-ink-mute",children:"최근 분배금"}),(0,n.jsxs)("div",{className:"text-right",children:[(0,n.jsxs)("p",{className:"text-base sm:text-xl font-bold text-ink tabular-nums",children:[Z(null==N||null==(y=N.latest_distribution)?void 0:y.dividend_amount),"원"]}),(0,n.jsxs)("p",{className:"text-xs text-ink-mute",children:["기준일 : ",(e=>e?"".concat(e.substring(0,4),".").concat(e.substring(4,6),".").concat(e.substring(6,8)):"-")(null==N||null==(k=N.latest_distribution)?void 0:k.standard_date)]})]})]}),(0,n.jsxs)("div",{className:"bg-secondary/60 p-3 sm:p-4 rounded-xl flex justify-between items-center",children:[(0,n.jsx)("h4",{className:"text-xs sm:text-sm text-ink-mute",children:"12개월 누적"}),(0,n.jsxs)("p",{className:"text-base sm:text-xl font-bold text-ink tabular-nums",children:[Z(null==N?void 0:N.sum_12m),"원"]})]}),(0,n.jsxs)("div",{className:"bg-secondary/60 p-3 sm:p-4 rounded-xl flex justify-between items-center",children:[(0,n.jsx)("h4",{className:"text-xs sm:text-sm text-ink-mute",children:"12개월 평균"}),(0,n.jsxs)("p",{className:"text-base sm:text-xl font-bold text-ink tabular-nums",children:[Z(null==N?void 0:N.avg_12m),"원"]})]})]}),(0,n.jsxs)("div",{className:"mb-6 sm:mb-8 relative",children:[(0,n.jsx)("h3",{className:"text-sm sm:text-base font-bold text-ink mb-3 sm:mb-4",children:"분배금 지급 내역 (최근 12개월)"}),(0,n.jsx)("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-1.5 sm:gap-2",children:w.length>0?w.map((e,t)=>(0,n.jsxs)("div",{className:"p-2 sm:p-3 rounded-lg text-center ".concat(e.dividend_amount>0?"bg-brand-700/10 border border-brand-700/30":"bg-secondary/40 border border-line"),children:[(0,n.jsx)("p",{className:"text-[10px] sm:text-xs text-ink-mute mb-1",children:X(e.standard_date)}),e.dividend_amount>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 rounded-full bg-brand-700 mx-auto mb-1"}),(0,n.jsxs)("p",{className:"text-[10px] sm:text-xs font-medium text-brand-700",children:[Z(e.dividend_amount),"원"]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 rounded-full bg-line mx-auto mb-1"}),(0,n.jsx)("p",{className:"text-xs sm:text-sm font-medium text-ink-mute",children:"분배금 없음"})]})]},t)):["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"].map((e,t)=>(0,n.jsxs)("div",{className:"p-2 sm:p-3 rounded-lg text-center bg-secondary/40 border border-line",children:[(0,n.jsx)("p",{className:"text-[10px] sm:text-xs text-ink-mute mb-1",children:e}),(0,n.jsx)("div",{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 rounded-full bg-line mx-auto mb-1"}),(0,n.jsx)("p",{className:"text-xs sm:text-sm font-medium text-ink-mute",children:"미지급"})]},t))}),(()=>{let e=w.length>0?w.filter(e=>e.dividend_amount>0).length:0,t=w.length>0?w.filter(e=>
10===e.dividend_amount||!e.dividend_amount).length:12*(0===w.length);return(0,n.jsx)("div",{className:"mt-4 p-3 sm:p-4 bg-white border border-line rounded-xl",children:(0,n.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-xs sm:text-sm text-ink-soft",children:"분배금 지급 월수"}),(0,n.jsxs)("span",{className:"text-sm sm:text-base font-medium text-ink tabular-nums",children:[e,"개월"]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-xs sm:text-sm text-ink-soft",children:"분배금 없는 월수"}),(0,n.jsxs)("span",{className:"text-sm sm:text-base font-medium text-debt tabular-nums",children:[t,"개월"]})]})]})})})()]})]})}},38448:(e,t,s)=>{"use strict";s.d(t,{NW:()=>l,YZ:()=>n,a7:()=>d,jH:()=>a,sP:()=>o});let n=1900,a=1,l=1,r="".concat(n,"-01-01");async function i(e,t){let{data:s,error:n}=await e.from("wp_households").select("id, planning_as_couple").eq("auth_user_id",t).eq("soft_deleted",!1).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(n)throw n;return s}async function o(e,t){let s=await i(e,t);return s?{householdId:s.id,planningAsCouple:s.planning_as_couple}:null}async function d(e,t){let s=await i(e,t);if(s)return{householdId:s.id,planningAsCouple:s.planning_as_couple};let{data:a,error:l}=await e.from("wp_households").insert({auth_user_id:t,planning_as_couple:!1}).select("id, planning_as_couple").single();if(l||!a)throw null!=l?l:Error("wp_households insert 실패");let{error:o}=await e.from("wp_persons").upsert({household_id:a.id,role:"self",birth_year:n,birth_date:r},{onConflict:"household_id,role",ignoreDuplicates:!0});if(o)throw o;return{householdId:a.id,planningAsCouple:a.planning_as_couple}}},38848:(e,t,s)=>{"use strict";s.d(t,{A:()=>v,R:()=>b});var n=s(70127),a=s(70567),l=s(9638),r=s(76773),i=s(50440),o=s(12900),d=s(51652),c=s(93374),u=s(1835),x=s(21300);let m=e=>{let{isOpenModal:t,setIsOpenModal:s,onConfirm:r,onCancel:m,previousPath:h=null,modalType:p="navigation"}=e,f=a.useRef(null),b=(0,l.r)(),v=(0,a.useRef)(h||"/"),{user:g}=(0,i.Ay)();null==g||g.subscription,(0,a.useEffect)(()=>{h&&(v.current=h)},[h]);let j=()=>{s(!1),m?m():"navigation"===p&&v.current&&v.current!==b.pathname&&b.push(v.current)},y=()=>{try{(0,x.YT)({event:"ce_generate_lead",lead_type:"subscription_popup_click",user_event_log:{metadata:{lead_type:"subscription_popup_click",modal_type:p,checkout_source:"subscription_popup"}}}),(0,x.ML)(void 0,!1)}catch(e){console.error("Subscription modal analytics failed:",e)}s(!1),r?r():b.push("/subscription")};return(0,n.jsx)(o.e.Root,{show:t,as:a.Fragment,children:(0,n.jsxs)(d.lG,{as:"div",className:"relative z-[999999999]",initialFocus:f,onClose:j,children:[(0,n.jsx)(o.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-[999999999] overflow-y-auto",style:{WebkitOverflowScrolling:"touch"},children:(0,n.jsx)("div",{className:"flex min-h-screen items-start justify-center p-4 sm:p-6 md:p-8",children:(0,n.jsx)(o.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(d.lG.Panel,{className:"relative my-8 w-full max-w-[600px] transform overflow-visible rounded-lg bg-white text-left shadow-xl transition-all",style:{pointerEvents:"auto"},children:[(0,n.jsx)("div",{className:"absolute top-[10px] right-[10px] cursor-pointer z-10",children:"navigation"===p?(0,n.jsx)(n.Fragment,{}):(0,n.jsx)(c.$8F,{onClick:j,className:"text-gray-500 hover:text-gray-700 w-6 h-6"})}),(0,n.jsxs)("div",{className:"flex flex-col items-center w-full p-4 md:p-6",children:[(0,n.jsxs)(d.lG.Title,{children:[(0,n.jsx)("h2",{className:"text-[24px] font-bold text-[#045B62] text-center",children:"이 기능은 멤버십 전용입니다"}),(0,n.jsxs)("div",{className:"text-[20px] text-center flex flex-col items-center justify-center mt-4",children:[(0,n.jsxs)("p",{children:["수익률보다 중요한 건",(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"font-bold",children:"‘이 포트폴리오로 끝까지 갈 수 있느냐’입니다"})]}),(0,n.jsx)(u.default,{src:"/images/subscription-modal-icon.png",alt:"subscription-image",width:100,height:100,className:"mt-5"})]})]}),(0,n.jsx)(d.lG.Description,{className:"mt-4 text-[14px] text-[#303030] whitespace-pre-line text-center",children:(0,n.jsxs)("div",{className:"w-full bg-[#F4F4F4] rounded-lg p-4 flex flex-col gap-2",children:[(0,n.jsxs)("span",{className:"flex items-center text-[#045B62]",children:[(0,n.jsx)(c.KYr,{className:"text-[#045B62] mr-2 flex-shrink-0"}),"내 포트폴리오를 직접 분석해 주는 AI 진단"]}),(0,n.jsxs)("span",{className:"flex items-center text-[#045B62]",children:[(0,n.jsx)(c.KYr,{className:"text-[#045B62] mr-2 flex-shrink-0"}),"ETF 전략 비교\xb7설계"]}),(0,n.jsxs)("span",{className:"flex items-center text-[#045B62]",children:[(0,n.jsx)(c.KYr,{className:"text-[#045B62] mr-2 flex-shrink-0"}),"연금 기준 장기 시뮬레이션"]}),(0,n.jsxs)("span",{className:"flex items-center text-[#045B62]",children:[(0,n.jsx)(c.KYr,{className:"text-[#045B62] mr-2 flex-shrink-0"}),"뉴스 기반 투자 연결"]})]})}),(0,n.jsxs)("div",{className:"w-full mt-6 flex flex-col gap-2 items-center justify-center",children:[(0,n.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),y()},onTouchStart:e=>{e.stopPropagation()},onTouchEnd:e=>{e.preventDefault(),e.stopPropagation(),y()},className:"w-3/4 border-none outline-none bg-[#045B62] hover:opacity-80 active:opacity-70 text-white min-w-[140px] min-h-[44px] h-auto px-3 py-2 text-[16px] rounded-lg transition-opacity",style:{touchAction:"manipulation",WebkitTapHighlightColor:"transparent",pointerEvents:"auto",position:"relative",zIndex:1e4},children:"지금 구조부터 확인하기"}),(0,n.jsx)("button",{type:"button",ref:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),j()},onTouchStart:e=>{e.stopPropagation()},onTouchEnd:e=>{e.preventDefault(),e.stopPropagation(),j()},className:"w-3/4 border-none outline-none bg-[#DEDEDE] hover:opacity-80 active:opacity-70 text-[#666] min-w-[140px] min-h-[44px] h-auto px-3 py-2 text-[16px] rounded-lg transition-opacity",style:{touchAction:"manipulation",WebkitTapHighlightColor:"transparent",pointerEvents:"auto",position:"relative",zIndex:1e4},children:"navigation"===p?"이전 페이지로 돌아가기":"나중에 하기"})]})]})]})})})})]})})};var h=s(30233),p=s(15996);let f=e=>{let{isOpen:t,setIsOpen:s,redirectPath:r,isMembershipRequired:i=!1}=e,c=(0,a.useRef)(null),u=(0,l.r)(),x=()=>{s(!1)};return(0,n.jsx)(o.e.Root,{show:t,as:a.Fragment,children:(0,n.jsxs)(d.lG,{as:"div",className:"relative z-[9999]",initialFocus:c,onClose:x,children:[(0,n.jsx)(o.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,n.jsx)(o.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(d.lG.Panel,{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg",children:[(0,n.jsx)("button",{type:"button",ref:c,className:"absolute right-3 top-3 rounded-md p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-[#045B62] focus:ring-offset-2",onClick:x,"aria-label":"닫기",children:(0,n.jsx)(h.A,{className:"h-5 w-5","aria-hidden":!0})}),(0,n.jsx)("div",{className:"bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4",children:(0,n.jsxs)("div",{className:"flex flex-col items-center",children:[(0,n.jsx)("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-[#045B62] mb-4",children:(0,n.jsx)(p.A,{className:"h-6 w-6 text-white"})}),(0,n.jsx)(d.lG.Title,{as:"h3",className:"text-lg font-semibold leading-6 text-gray-900 text-center mb-2",children:i?"멤버십 구독이 필요한 서비스입니다":"로그인이 필요한 서비스입니다"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)("p",{className:"text-sm text-gray-600 text-center mb-4",children:i?(0,n.jsxs)(n.Fragment,{children:["이 기능을 사용하시려면 멤버십 구독이 필요합니다.",(0,n.jsx)("br",{}),"로그인 후 구독을 진행해주세요."]}):"로그인 페이지로 이동하시겠습니까?"}),(0,n.jsx)("p",{className:"text-xs text-gray-500 text-center",children:i?"회원가입을 먼저 진행하시면 바로 구독하실 수 있어요!":"처음 방문하셨다면 회원가입을 먼저 진행해주세요!"})]})]})}),(0,n.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6 gap-3",children:[(0,n.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-[#045B62] px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-[#045c6282] sm:ml-3 sm:w-auto",onClick:()=>{s(!1);let e=r||u.asPath,t=i?"".concat(e).concat(e.includes("?")?"&":"?","membership=true"):e;u.push("/login?redirect=".concat(encodeURIComponent(t)))},children:"로그인"}),(0,n.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto",onClick:()=>{s(!1);let e=r||u.asPath;i?u.push("/auth/signup-select?redirect=".concat(encodeURIComponent("/subscription"))):u.push("/auth/signup-select?redirect=".concat(encodeURIComponent(e)))},children:"회원가입"}),(0,n.jsx)("button",{type:"button",className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto 
1sm:hidden",onClick:x,children:"취소"})]})]})})})})]})})},b=()=>{let e=(0,l.r)(),t=(0,r.U)(),{user:s,isPaidUser:o,fetchUser:d}=(0,i.Ay)(),[c,u]=(0,a.useState)(!1),[x,h]=(0,a.useState)(!1),[p,b]=(0,a.useState)(null),[v,g]=(0,a.useState)(!1),j=(0,a.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];b(t||e.asPath),g(s),u(!0)},[e.asPath]),y=(0,a.useCallback)(async function(){var s;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=n||e.asPath,{data:{session:l},error:r}=await t.auth.getSession();if(r||!(null==l?void 0:l.access_token))return b(a),g(!0),u(!0),!1;await d();let o=i.Ay.getState().user;return(null==o||null==(s=o.subscription)?void 0:s.is_paid_user)===!0||(b(a),h(!0),!1)},[e.asPath,t,d]),k=(0,a.useCallback)(()=>{h(!1),e.push("/subscription")},[e]);return(0,a.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(t){var s;await d();let t=i.Ay.getState().user;(null==t||null==(s=t.subscription)?void 0:s.is_paid_user)===!0?p&&e.push(p):e.push("/subscription")}},[p,e,d]),{handleLoginRequired:j,handleMembershipRequired:y,fetchUser:d,LoginModal:(0,n.jsx)(f,{isOpen:c,setIsOpen:u,redirectPath:p,isMembershipRequired:v}),SubscriptionModalComponent:(0,n.jsx)(m,{isOpenModal:x,setIsOpenModal:h,onConfirm:k,modalType:"feature",previousPath:p})}},v=b},42309:(e,t,s)=>{"use strict";s.d(t,{A:()=>d,b:()=>o});var n=s(70127),a=s(76003),l=s(99736),r=s(48858),i=s(52481);function o(e){return{id:e,name:"",owner:"본인",balance:0,rate:0,rateType:"변동",repayment:"원리금균등상환",graceMonths:0,termYears:5}}function d(e){let{value:t,onChange:s,onCancel:o,onSave:d,factsReadOnly:c=!1,planningAsCouple:u=!0}=e,x=e=>s({...t,...e}),m=(0,r.tK)(u),{unit:h}=(0,l.UG)();return(0,n.jsxs)(l.um,{title:t.name.trim()||"새 부채",icon:a.ROi,iconBg:"#DE6262",onCancel:o,onSave:d,fieldsDisabled:c,fieldsDisabledNote:"가구 공통 자산 —",editHref:"/today?tab=debt&edit=".concat(t.id),children:[(0,n.jsx)(l.eW,{label:"이름",value:t.name,onChange:e=>x({name:e}),placeholder:"예: 신용대출"}),u&&(0,n.jsx)(l.LS,{label:"소유자",value:t.owner,onChange:e=>x({owner:e}),options:m}),(0,n.jsx)(l.L,{label:"대출 잔액",value:t.balance,onChange:e=>x({balance:e}),unit:h}),(0,n.jsx)(l.vQ,{label:"금리",value:t.rate,onChange:e=>x({rate:e}),suffix:"%"}),(0,n.jsx)(l.LS,{label:"금리유형",value:t.rateType,onChange:e=>x({rateType:e}),options:i.EE}),"만기일시상환"!==t.repayment&&(0,n.jsx)(l.eW,{label:"거치",value:t.graceMonths?String(t.graceMonths):"",onChange:e=>x({graceMonths:Number(e.replace(/\D/g,""))||0}),suffix:"개월"}),(0,n.jsx)(l.eW,{label:"남은 상환기간",value:t.termYears?String(t.termYears):"",onChange:e=>x({termYears:Number(e.replace(/\D/g,""))||0}),suffix:"년"}),(0,n.jsx)(l.LS,{label:"상환방식",value:t.repayment,onChange:e=>x({repayment:e}),options:i.fn})]})}},43774:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var n=s(70567),a=s(74590),l=s(75240);let r=()=>{let[e,t]=(0,n.useState)([]),[s,r]=(0,n.useState)(!0),[i,o]=(0,n.useState)([]),[d,c]=(0,n.useState)("etf"),[u,x]=(0,n.useState)(""),[m,h]=(0,n.useState)({first_filter:[],second_filter:[],third_filter:[],fourth_filter:[],fifth_filter:[],sixth_filter:[],seventh_filter:[],eighth_filter:[]}),[p,f]=(0,n.useState)(null),[b,v]=(0,n.useState)(l.UQ),[g,j]=(0,n.useState)([]),[y,k]=(0,n.useState)(null);return(0,n.useEffect)(()=>{("stock"===d||"etf"===d)&&t([])},[d]),{FilterDetails:async function(e,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;r(!0);let l=void 0!==s?s:u,i=new URLSearchParams;d&&i.set("option",d),l&&i.set("search",l),p&&i.set("sorting_column",p),n&&i.set("category",n),null!==y&&i.set("glide_universe",String(y)),Array.isArray(g)&&g.length>0&&g.forEach(e=>{e&&i.append("glide_classification",e)});let c="/v2/etf_filters?".concat(i.toString());try{let s=await a.A.get(c,{headers:{Authorization:e}});t(s.data),o(s.data.suggested_terms)}catch(e){o(["Something went wrong!"])}finally{r(!1)}},data:e,loading:s,setSelectedOptions:h,selectedOptions:m,setSorting:f,sorting:p,setLoa
1ding:r,setData:t,message:i,option:d,setOption:c,search:u,setSearch:x,facetFilters:b,setFacetFilters:v,glideClassifications:g,setGlideClassifications:j,glideUniverseFlag:y,setGlideUniverseFlag:k}}},45575:(e,t,s)=>{"use strict";s.r(t),s.d(t,{EtfFilter:()=>F});var n=s(70127),a=s(70567);s(61838),s(57905);var l=s(43774),r=s(70746),i=s(99834),o=s(28832),d=s(9638);s(74590);var c=s(86685),u=s(15996),x=s(22794),m=s(28343),h=s(8985),p=s(55038),f=s(94206),b=s(30233),v=s(17665),g=s(83843),j=s(56971),y=s(6612),k=s(35103),N=s(50440),w=s(38848);let _=e=>{var t;let{item:s}=e;(0,d.r)();let{user:l}=(0,N.Ay)(),{SubscriptionModalComponent:i}=(0,w.R)(),o=(null==l||null==(t=l.subscription)?void 0:t.is_paid_user)===!0,c=!!l,[u,x]=(0,a.useState)(!0),[m,h]=(0,a.useState)(null),[p,f]=(0,a.useState)(null),[b,v]=(0,a.useState)([]),[g,j]=(0,a.useState)([]),[y,_]=(0,a.useState)([]),[S,C]=(0,a.useState)("1y"),[T,E]=(0,a.useState)("1y"),[A,F]=(0,a.useState)(!1),[D,M]=(0,a.useState)(!1),[P,L]=(0,a.useState)(null),[R,z]=(0,a.useState)(null),B=(null==s?void 0:s.표준코드)||(null==s?void 0:s.standard_code);return((0,a.useEffect)(()=>{if(!B){h("표준코드가 없습니다."),x(!1);return}if(p)return void x(!1);(async()=>{try{x(!0),h(null);let e={"Content-Type":"application/json"},[t,s]=await Promise.all([fetch("/api/v1/dividend/summary?standard_code=".concat(B,"&months=12"),{headers:e}),fetch("/api/v1/dividend/calendar?standard_code=".concat(B,"&months=12"),{headers:e})]);if(!t.ok||!s.ok)throw Error("API 호출에 실패했습니다.");let n=await t.json(),a=await s.json();f(n),v(a.months||[])}catch(e){console.error("초기 데이터 로딩 실패:",e),h(e.message)}finally{x(!1)}})()},[B]),(0,a.useEffect)(()=>{B&&(P!==S||null==g||!g.series)&&(async()=>{try{F(!0);let e=await fetch("/api/v1/dividend/distributions/chart?standard_code=".concat(B,"&period=").concat(S),{headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("분배금 차트 데이터 로딩 실패");let t=await e.json();j(t),L(S)}catch(e){console.error("분배금 차트 로딩 실패:",e)}finally{F(!1)}})()},[B,S]),(0,a.useEffect)(()=>{B&&(R!==T||null==y||!y.etf_price_return)&&(async()=>{try{M(!0);let e=await fetch("/api/v1/dividend/returns/chart?standard_code=".concat(B,"&period=").concat(T),{headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("수익률 차트 데이터 로딩 실패");let t=await e.json();_(t),z(T)}catch(e){console.error("수익률 차트 로딩 실패:",e)}finally{M(!1)}})()},[B,T]),u)?(0,n.jsx)("div",{className:"w-full h-full p-8 flex items-center justify-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,n.jsx)(r.hn,{}),(0,n.jsx)("p",{className:"text-brand-700 font-medium",children:"데이터를 불러오는 중..."})]})}):m?(0,n.jsx)("div",{className:"w-full h-full p-8 flex items-center justify-center",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"text-debt font-medium mb-2",children:"오류가 발생했습니다"}),(0,n.jsx)("p",{className:"text-ink-soft text-sm",children:m})]})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-full h-full p-4 sm:p-6 md:p-8",children:(0,n.jsx)(k.A,{summaryData:p,calendarData:b,distributionChartData:g,returnChartData:y,distributionPeriod:S,returnPeriod:T,onDistributionPeriodChange:e=>{console.log("분배금 차트 기간 변경:",e),C(e)},onReturnPeriodChange:e=>{console.log("수익률 차트 기간 변경:",e),E(e)},distributionLoading:A,returnLoading:D,standardCode:B,isPaidUser:o,isLoggedIn:c,accessToken:null,onLoginRequired:()=>{}})}),i]})};var S=s(95619),C=s(59317),T=s(3668),E=s(71341);function A(e){var t,s,l,o,k;let{token:N,show_selection:w="false",updateResponse:A,setUpdateResponse:F,handleCloseModal:D,selectedAccountType:M,setSaveRefresh:P,setMainTab:L,glideUniverse:R=!0,onDistributionClick:z,submitButtonLabel:B="포트폴리오에 추가",onSubmitSelection:I,maxSelectionCount:Y,initialSelectedItems:O=null,scrollContainerRef:W=null,floatingBarInsetClassName:U="left-0 right-0",topLeftExtra:V=null,selectedTab:K=null,onSelectedTabChange:q=null}=e,H="boolean"==typeof R?R:"true"===R||"false"!==R&&!!R,{fpEditLocked:G}=(0,T.zO)(),J=("true"===w||!0===w)&&!(G&&!M&&"function"!=typeof I),[$,X]=(0,a.useState)([]),[Z,Q]=(0,a.useState)("위험자산"),[ee,et]=(0,a.useState)(""),[es,en]=(0,a.useState)(!1),[ea,el]=(0,a.useState)(-1),[er,ei]=(0,a.useState)([]),[eo,ed]=(0,a.useState)(!1),[ec,eu]=(0,a.useState)(Z
1),[ex,em]=(0,a.useState)(K),[eh,ep]=(0,a.useState)(!1),[ef,eb]=(0,a.useState)({key:null,direction:"desc"}),[ev,eg]=(0,a.useState)(!1),[ej,ey]=(0,a.useState)({안전자산:[],위험자산:[]}),[ek,eN]=(0,a.useState)({지역:"전체",자산군:"전체",운용방식:"전체"}),ew=Array.isArray($)?$.filter(e=>(0,E.sO)(e,ek)):[],[e_,eS]=(0,a.useState)({}),[eC,eT]=(0,a.useState)(null),[eE,eA]=(0,a.useState)({data:[],loading:!1,message:null}),eF=Number.isFinite(Y),eD=e=>(null==e?void 0:e.표준코드)||(null==e?void 0:e.kr_code)||(null==e?void 0:e.standard_code)||(null==e?void 0:e.한글종목약명)||(null==e?void 0:e.펀드명)||(null==e?void 0:e.종목이름)||(null==e?void 0:e.fund_name),eM=a.useMemo(()=>{if(!Array.isArray(O))return null;let e=new Map;return(O||[]).forEach(t=>{let s=eD(t);s&&e.set(s,t)}),Array.from(e.values())},[O]);(0,a.useEffect)(()=>{Array.isArray(eM)&&eA(e=>({...e,data:eM}))},[eM]),(0,a.useEffect)(()=>{eo&&(eu(Z),em(K))},[eo]);let[eP,eL]=(0,a.useState)(!1),[eR,ez]=(0,a.useState)(!1),[eB,eI]=(0,a.useState)(!1),[eY,eO]=(0,a.useState)([]),[eW,eU]=(0,a.useState)(null),{setProducts:eV}=(0,g.A)(),[eK]=(0,a.useState)(!0),[eq]=(0,a.useState)(!1),eH=(0,d.r)(),eG=!N&&"function"!=typeof I,eJ=Array.isArray(eE.data)&&eE.data.length>0,e$=null!=(k=null==(t=eE.data)?void 0:t.length)?k:0,eX=eF?"선택 ".concat(e$,"/").concat(Y):"선택 ".concat(e$,"개"),eZ=(0,a.useRef)(null),eQ=(0,a.useRef)(null),e0=(0,a.useRef)(null),e1=(0,a.useRef)(null),[e2,e4]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=e=>{eZ.current&&!eZ.current.contains(e.target)&&(ei([]),el(-1))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{if(null==eC)return;let e=e=>{var t,s,n,a;(null==(t=(s=e.target).closest)||!t.call(s,"[data-matching-us-etf-tip]"))&&(null!=(n=(a=e.target).closest)&&n.call(a,"[data-matching-us-etf-mobile-popover]")||eT(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[eC]),(0,a.useEffect)(()=>{if(null==eC)return;let e=()=>eT(null);return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[eC]),(0,a.useEffect)(()=>()=>{eQ.current&&clearTimeout(eQ.current)},[]),(0,a.useEffect)(()=>{let e={};Array.isArray($)&&$.forEach((t,s)=>{e[s]=!1}),eS(e)},[$]);let e3=e=>{let t=ef.key===e&&"desc"===ef.direction?"asc":"desc";eb({key:e,direction:t});let s=Object.keys(e7).find(t=>e7[t]===e);Z&&s&&eK&&!eq&&te(Z,ej[Z]||[],ee,s,t)},e5=e=>ef.key!==e?(0,n.jsx)("span",{className:"text-ink-mute opacity-40 ml-1",children:"↕"}):"desc"===ef.direction?(0,n.jsx)("span",{className:"inline-block ml-1",children:"▼"}):(0,n.jsx)("span",{className:"inline-block ml-1",children:"▲"}),e6=e=>{let t="px-4 py-3 text-left text-xs font-medium border-b border-line text-center bg-secondary text-ink-mute whitespace-nowrap cursor-pointer transition-colors duration-200 sticky top-0 z-20";return ef.key===e?"".concat(t," !text-ink font-semibold"):"".concat(t," hover:text-ink")},e7={name:"한글종목약명",return_1d:"전일 수익률",return_1m:"지난달 수익률",return_ytd:"올해 수익률",return_1y:"1년 수익률",return_2y:"2년 수익률",return_3y:"3년 수익률",return_since_inception:"설정이후",fee:"운용보수",expense_ratio:"총비용비율",risk_grade:"투자위험등급",benchmark_name:"기초지수명",hedged:"헤지여부",distribution:"주당 분배금(원)",distribution_std_dt:"지급 기준일",matching_us_etf:"참고 미국 ETF"},e9={한글종목약명:240,기초지수명:240,"참고 미국 ETF":200},e8=e=>{let t=e9[e];return t?{width:t,minWidth:t,maxWidth:t}:{}},te=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"desc";try{ep(!0);let l=new URLSearchParams({category:e});H&&l.append("glide_universe","true"),t.length>0&&l.append("glide_classification",JSON.stringify(t)),s&&l.append("search",s),n&&(l.append("sort_by",n),l.append("sort_dir",a));let r=await fetch("/api/glide_universe?".concat(l.toString()),{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw Error("API 호출에 실패했습니다");let i=await r.json();X(i.data||[])}catch(e){console.error("글라이드 유니버스 데이터 로딩 실패:",e),X([])}finally{ep(!1)}};(0,a.useEffect)(()=>{Z||Q("안전자산")},[Z]),(0,a.useEffect)(()=>{Z&&eK&&!eq&&(ey(e=>({...e,[Z]:[]})),eb({key:null,direction:"desc"}),te(Z,[],"",null,"desc"))},[Z,eK,eq]),(0,a.useEffect)(()=>
1{if(Z&&eK&&!eq){let e=ef.key?Object.keys(e7).find(e=>e7[e]===ef.key):null;te(Z,ej[Z]||[],ee,e,ef.direction)}},[R,eK,eq]);let tt=e=>{let t=e.target.value;et(t),eQ.current&&clearTimeout(eQ.current),t.trim().length>0&&eK&&!eq?(en(!0),eQ.current=setTimeout(async()=>{try{let e=await fetch("/api/search-suggestions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t,option:"etf",category:Z,glide_classification:ej[Z]||[],safe_asset:Z?"안전자산"===Z:void 0,...H?{glide_universe:!0}:{},universe:"retirement_pension"})}),s=await e.json();ei(s.suggestions||[])}catch(e){console.error("오토컴플리트 요청 실패:",e),ei([])}finally{en(!1)}},300)):(ei([]),en(!1))},ts=e=>{er.length>0?"ArrowDown"===e.key?(e.preventDefault(),el(e=>e<er.length-1?e+1:0)):"ArrowUp"===e.key?(e.preventDefault(),el(e=>e>0?e-1:er.length-1)):"Enter"===e.key?(e.preventDefault(),ea>=0&&ea<er.length?tl(er[ea]):tn(e)):"Escape"===e.key&&(ei([]),el(-1)):"Enter"===e.key&&tn(e)},tn=e=>{if(e.preventDefault(),eK&&!eq){if(!ee.trim())return void i.Ay.error("검색어를 입력해주세요.");if(Z&&ee.trim()){let e=ef.key?Object.keys(e7).find(e=>e7[e]===ef.key):null;te(Z,ej[Z],ee.trim(),e,ef.direction)}else i.Ay.error("자산 유형을 선택하세요.")}},ta=e=>{Q(e.target.value),et(""),X([]),ei([]),el(-1)},tl=e=>{let t="object"==typeof e?e.name:e;if(et(t),ei([]),el(-1),Z&&t.trim()&&eK&&!eq){let e=ef.key?Object.keys(e7).find(e=>e7[e]===ef.key):null;te(Z,ej[Z],t.trim(),e,ef.direction)}},tr=async()=>{var e;if((null==(e=eE.data)?void 0:e.length)===0)return void i.Ay.error("종목을 선택해주세요.");if("function"==typeof I){I(eE.data),eA(e=>({...e,data:[]}));return}if(M)ez(!0);else{let e=eE.data.map(e=>({kr_code:e.표준코드,asset_type:"ETF",fund_name:e.한글종목약명||e.펀드명||e.종목이름||e.fund_name})),t=eE.data.map(e=>({한글종목약명:e.한글종목약명||e.펀드명||e.종목이름||e.fund_name||"-",weight:0}));eV(e),eO(t),eL(!0)}},ti=(e,t)=>{eA(s=>{let n=[...s.data],a=eD(e);if(t){if(!n.some(e=>eD(e)===a)){if(eF&&n.length>=Y)return i.Ay.error("최대 ".concat(Y,"개까지 선택할 수 있습니다.")),s;n.push(e)}}else{let e=n.filter(e=>eD(e)!==a);return{...s,data:e}}return{...s,data:n}})},to=e=>eE.data.some(t=>eD(t)===eD(e)),td=e=>eF&&eE.data.length>=Y&&!to(e),tc=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{valueClassName:a=""}=s,l=(e=>{let t=null==e?void 0:e.comment;if(null==t)return null;let s=String(t).trim();return s.length?s:null})(e),r=(e=>{if(null==e||""===e)return"-";if(Array.isArray(e)){let t=e.map(e=>null==e?"":"object"==typeof e?e.name||e.ticker||e.symbol||e.label||"":String(e)).filter(Boolean);return t.length?t.join(", "):"-"}return"object"==typeof e?e.name||e.ticker||e.symbol||e.label||"-":String(e)})(e.matching_us_etf);if(!l)return a?(0,n.jsx)("span",{className:a,children:r}):r;let i=(null==eC?void 0:eC.rowKey)===t;return(0,n.jsxs)("div",{"data-matching-us-etf-tip":!0,className:"inline-flex items-center justify-center gap-1 relative group align-middle",children:[(0,n.jsx)("span",{className:"break-words ".concat(a).trim(),children:r}),(0,n.jsx)("button",{type:"button","aria-label":"참고 미국 ETF 설명 보기","aria-expanded":i,className:"shrink-0 text-ink-mute hover:text-ink-soft md:cursor-help focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-700 rounded",onClick:e=>{if(e.stopPropagation(),window.matchMedia("(max-width: 767px)").matches){let s=e.currentTarget.getBoundingClientRect();eT(e=>(null==e?void 0:e.rowKey)===t?null:{rowKey:t,top:s.bottom+8,comment:l})}},children:(0,n.jsx)(c.A,{className:"w-4 h-4",strokeWidth:2})}),(0,n.jsx)("div",{className:"pointer-events-none absolute left-1/2 bottom-full z-[35] mb-1 hidden w-max max-w-[min(280px,calc(100vw-2rem))] -translate-x-1/2 rounded-md bg-ink px-3 py-2 text-left text-xs leading-snug text-white shadow-lg opacity-0 transition-opacity duration-150 group-hover:opacity-100 md:block whitespace-pre-wrap",role:"tooltip",children:l}),i&&eC?(0,n.jsx)("div",{role:"dialog","aria-label":"참고 미국 ETF 설명","data-matching-us-etf-mobile-popover":!0,className:"md:hidden fixed z-[100] left-4 right-4 rounded-md border border-line bg-white px-3 py-2 text-left text-xs leading-snug text-ink shadow-lg whitespace-pre-wrap max-h-[min(50vh,320px)] overflow-y-auto overscroll-contain",style:{to
1p:eC.top},children:eC.comment}):null]})},tu=e=>{let t="number"==typeof e?e:parseFloat(e);return Number.isFinite(t)&&0!==t?t>0?"text-debt":"text-[color:var(--chart-2)]":"text-ink"},tx=(e,t)=>{let s=e_[t];return(0,n.jsxs)("div",{className:"px-3 py-3 border-b border-line last:border-b-0 bg-white",children:[(0,n.jsxs)("div",{className:"flex gap-2.5 items-center",children:[J&&(0,n.jsxs)("label",{className:"flex shrink-0 items-center justify-center",children:[(0,n.jsx)("input",{type:"checkbox",className:"input",checked:to(e),disabled:td(e),onChange:t=>ti(e,t.target.checked)}),(0,n.jsx)("span",{className:"custom-checkbox"})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{role:"button",tabIndex:0,className:"text-[15px] leading-snug font-semibold text-ink break-words line-clamp-2 cursor-pointer hover:text-brand-700 text-left min-w-0",onClick:t=>{t.stopPropagation(),e.단축코드&&(0,S.r)(e.단축코드)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),e.단축코드&&(0,S.r)(e.단축코드))},children:e.한글종목약명||"-"}),(0,n.jsx)("button",{type:"button",className:"shrink-0 rounded-lg border border-line bg-white px-2.5 py-1.5 text-[11px] font-medium text-ink shadow-sm active:bg-secondary/60 self-center",onClick:()=>{eS(e=>({...e,[t]:!e[t]}))},"aria-expanded":s,children:s?"닫기":"상세"})]})]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-4 border-t border-line pt-2.5 divide-x divide-line",children:[(0,n.jsxs)("div",{className:"min-w-0 w-full max-w-full flex flex-col items-center px-1.5 py-0.5",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute mb-0.5 leading-none w-full text-center",children:"지난달"}),(0,n.jsx)("span",{className:"text-[13px] font-semibold tabular-nums leading-tight w-full text-center ".concat(tu(e["지난달 수익률"])),children:null!=e["지난달 수익률"]&&""!==e["지난달 수익률"]?"".concat(e["지난달 수익률"],"%"):"-"})]}),(0,n.jsxs)("div",{className:"min-w-0 w-full max-w-full flex flex-col items-center px-1.5 py-0.5",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute mb-0.5 leading-none w-full text-center",children:"올해"}),(0,n.jsx)("span",{className:"text-[13px] font-semibold tabular-nums leading-tight w-full text-center ".concat(tu(e["올해 수익률"])),children:null!=e["올해 수익률"]&&""!==e["올해 수익률"]?"".concat(e["올해 수익률"],"%"):"-"})]}),(0,n.jsxs)("div",{className:"min-w-0 w-full max-w-full flex flex-col items-center px-1.5 py-0.5",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute mb-0.5 leading-none w-full text-center",children:"분배금"}),void 0!==e.distribution&&null!==e.distribution?(0,n.jsxs)("div",{className:"flex w-full items-center justify-center gap-0.5 min-w-0",children:[(0,n.jsxs)("span",{className:"text-[13px] font-semibold text-ink tabular-nums leading-tight text-center break-words [overflow-wrap:anywhere]",children:[e.distribution.toLocaleString(),"원"]}),(0,n.jsx)("span",{className:"inline-flex shrink-0",children:(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),z?z(e):(eU(e),eI(!0))},className:"text-brand-700 hover:text-brand-700/80 transition-colors cursor-pointer flex items-center flex-shrink-0 p-0.5 -mr-0.5",title:"상세 분배금 보기",children:(0,n.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})})]}):(0,n.jsx)("span",{className:"text-[13px] font-semibold text-ink leading-tight w-full text-center",children:"-"})]}),(0,n.jsxs)("div",{className:"min-w-0 w-full max-w-full flex flex-col items-center px-1.5 py-0.5",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute mb-0.5 leading-none w-full text-center",children:"1년"}),(0,n.jsx)("span",{className:"text-[13px] font-semibold tabular-nums leading-tight w-full text-center ".concat(tu(e["1년 수익률"])),children:null!=e["1년 수익률"]&&""!==e["1년 수익률"]?"".concat(e["1년 수익률"],"%"):"-"})]})]}),s&&(0,n.jsxs)("div",{className:"animate-in fade-in slide-in-from-top-1 duration-200 mt-3 border-t border-line pt-1",children:[(0,n.jsx)("p",{className:"text-ink-mute mt-2 mb-1 text-[11px] font-semibold tracking-wide",children:"수익률"}),(0,n.jsxs)("div",{className:"divide-y divide-line",children:[(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"전일 수익률"}),(0,n.jsx)("span",{className:"text-sm font-medium tabular-nums ".concat(tu(e["전일 수익률"])),children:null!=e["전일 수익률"]&&""!==e["전일 수익률"]?"".concat(e["전일 수익률"],"%"):"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"2년 수익률"}),(0,n.jsx)("span",{className:"text-sm font-medium tabular-nums ".concat(tu(e["2년 수익률"])),children:null!=e["2년 수익률"]&&""!==e["2년 수익률"]?"".concat(e["2년 수익률"],"%"):"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"3년 수익률"}),(0,n.jsx)("span",{className:"text-sm font-medium tabular-nums ".concat(tu(e["3년 수익률"])),children:null!=e["3년 수익률"]&&""!==e["3년 수익률"]?"".concat(e["3년 수익률"],"%"):"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"설정이후"}),(0,n.jsx)("span",{className:"text-sm font-medium tabular-nums ".concat(tu(e.설정이후)),children:null!=e.설정이후&&""!==e.설정이후?"".concat(e.설정이후,"%"):"-"})]})]}),(0,n.jsx)("p",{className:"text-ink-mute mt-3 mb-1 text-[11px] font-semibold tracking-wide",children:"비용\xb7속성"}),(0,n.jsxs)("div",{className:"divide-y divide-line",children:[(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"운용보수"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink tabular-nums",children:null!=e.운용보수&&""!==e.운용보수?"".concat(e.운용보수,"%"):"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"총비용비율"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink tabular-nums",children:null!=e.총비용비율&&""!==e.총비용비율?"".concat(e.총비용비율,"%"):"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"투자위험등급"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink text-right break-words",children:e.투자위험등급||"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"헤ì
1§€ì—¬ë¶€"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink",children:e.헤지여부||"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex items-baseline justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"지급 기준일"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink text-right tabular-nums",children:e.distribution_std_dt||"-"})]}),(0,n.jsxs)("div",{className:"py-2.5 flex flex-col gap-1",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute shrink-0",children:"참고 미국 ETF"}),(0,n.jsx)("div",{className:"min-w-0 text-sm text-ink",children:tc(e,"m-".concat(t,"-").concat(eD(e)||""),{valueClassName:"font-medium text-ink"})})]}),(0,n.jsxs)("div",{className:"py-2.5 flex flex-col gap-1",children:[(0,n.jsx)("span",{className:"text-[11px] text-ink-mute",children:"기초지수명"}),(0,n.jsx)("span",{className:"text-sm font-medium text-ink leading-snug break-words",children:e.기초지수명||"-"})]})]})]})]},t)},tm=[{key:"한글종목약명",label:"펀드명"},{key:"전일 수익률",label:"전일 수익률"},{key:"지난달 수익률",label:"지난달 수익률"},{key:"올해 수익률",label:"올해 수익률"},{key:"참고 미국 ETF",label:"참고 미국 ETF"},{key:"1년 수익률",label:"1년 수익률"},{key:"2년 수익률",label:"2년 수익률"},{key:"3년 수익률",label:"3년 수익률"},{key:"설정이후",label:"설정이후"},{key:"운용보수",label:"운용보수"},{key:"총비용비율",label:"총비용비율"},{key:"투자위험등급",label:"투자위험등급"},{key:"헤지여부",label:"헤지여부"},{key:"기초지수명",label:"기초지수명"},{key:"주당 분배금(원)",label:"주당 분배금(원)"},{key:"지급 기준일",label:"지급 기준일"}];return(0,a.useEffect)(()=>{let e=e=>{ev&&!e.target.closest(".mobile-sort-container")&&eg(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[ev]),(0,a.useEffect)(()=>{if(!J||!W)return void e4(!1);let e=!1,t=window.setTimeout(()=>{var t;if(e)return;let s=W.current,n=e0.current;if(!s||!n)return;null==(t=e1.current)||t.disconnect();let a=new IntersectionObserver(e=>{let[t]=e;e4(!t.isIntersecting)},{root:s,rootMargin:"0px",threshold:0});e1.current=a,a.observe(n)},0);return()=>{var s;e=!0,window.clearTimeout(t),null==(s=e1.current)||s.disconnect(),e1.current=null,e4(!1)}},[W,J,Z,eK,eq,H]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"w-full min-w-0 mb-4",children:(0,n.jsxs)("div",{className:"w-full mt-4",children:[(0,n.jsxs)("div",{className:"hidden md:block",children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[V,(0,n.jsx)(C.A,{options:[{value:"안전자산",label:"안전자산"},{value:"위험자산",label:"위험자산"}],value:Z,onChange:e=>ta({target:{value:e}})})]}),J&&(0,n.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[eF&&(0,n.jsxs)("span",{className:"text-xs text-ink-mute text-right whitespace-nowrap",children:["선택 ",(null==(s=eE.data)?void 0:s.length)||0,"/",Y]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{title:eG?"로그인 후 포트폴리오에 추가할 수 있습니다":(null==(l=eE.data)?void 0:l.length)===0?"테이블에서 상품을 선택해주세요":"선택한 상품을 포트폴리오에 추가합니다",onClick:()=>{if(eG){let e=eH.asPath||"/etf";eH.push("/login?redirect=".concat(encodeURIComponent(e)));return}tr()},disabled:eE.loading||!eJ,className:"bg-ink hover:bg-ink/90 px-6 h-[36px] text-white text-sm font-semibold flex items-center justify-center min-w-[160px] rounded-lg disabled:opacity-50",children:eE.loading?"처리중...":B}),eG&&eJ&&(0,n.jsx)("button",{type:"button",onClick:()=>{let e=eH.asPath||"/etf";eH.push("/login?redirect=".concat(encodeURIComponent(e)))},className:"absolute inset-0 rounded-lg bg-black/25 text-white backdrop-blur-[1px] flex items-center justify-center","aria-label":"로그인 필요",children:(0,n.jsx)(u.A,{className:"h-4 w-4"})})]})]})]}),(0,n.jsx)("form",{onSubmit:tn,children:(0,n.jsxs)("div",{ref:eZ,className:"relative w-full",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("input",{type:"search",id:"default-search",className:"block p-4 text-[15px] w-full text-ink placeholder:text-ink-mute bg-white border border-line focus:border-brand-700/60 rounded-xl outline-none",placeholder:"ETF 이름을 입력하세요.",value:ee,name:"search",onChange:tt,onKeyDown:ts,autoComplete:"off"}),(0,n.jsx)("div",{className:"absolute right-4 top-5",children:(0,n.jsx)("button",{type:"submit",className:"w-4 h-4 text-ink-mute",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",className:"w-4 h-4",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"})})})}),es&&(0,n.jsx)("div",{className:"absolute right-12 top-5",children:(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-line border-t-brand-700 rounded-full animate-spin"})})]}),ee&&er.length>0&&(0,n.jsx)("div",{className:"animate-in fade-in slide-in-from-top-2 duration-150 absolute left-0 right-0 mt-1 bg-white rounded-lg shadow-lg z-[9999] border border-line",children:(0,n.jsx)("ul",{className:"py-1 max-h-60 overflow-y-auto",children:er.map((e,t)=>(0,n.jsx)("li",{className:"px-4 py-2 cursor-pointer text-sm ".concat(t===ea?"bg-secondary text-ink":"text-ink-soft hover:bg-secondary/60"),onClick:()=>tl(e),onMouseEnter:()=>el(t),children:(0,n.jsx)("span",{children:"object"==typeof e?e.name:e})},t))})})]})}),(0,n.jsx)(E.Ay,{value:ek,onChange:eN,className:"mt-4"})]}),(0,n.jsxs)("div",{className:"md:hidden",children:[(0,n.jsxs)("form",{onSubmit:tn,className:"flex gap-2",children:[(0,n.jsxs)("div",{ref:eZ,className:"relative min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("input",{type:"search",className:"border-line focus:border-brand-700/60 text-ink placeholder:text-ink-mute block w-full rounded-xl border bg-white p-4 text-[15px] outline-none",placeholder:"ETF 이름을 입력하세요.",value:ee,name:"search",onChange:tt,onKeyDown:ts,autoComplete:"off"}),(0,n.jsx)("div",{className:"absolute top-5 right-4",children:(0,n.jsx)("button",{type:"submit",className:"text-ink-mute h-4 w-4",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",className:"h-4 w-4",children:(0,n.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"})})})}),es&&(0,n.jsx)("div",{className:"absolute top-5 right-12",children:(0,n.jsx)("div",{className:"border-line border-t-brand-700 h-4 w-4 animate-spin rounded-full border-2"})})]}),ee&&er.length>0&&(0,n.jsx)("div",{className:"animate-in fade-in slide-in-from-top-2 duration-150 border-line absolute right-0 left-0 z-[9999] mt-1 rounded-lg border bg-white shadow-lg",children:(0,n.jsx)("ul",{className:"max-h-60 overflow-y-auto py-1",children:er.map((e,t)=>(0,n.jsx)("li",{className:"cursor-pointer px-4 py-2 text-sm ".concat(t===ea?"bg-secondary text-ink":"text-ink-soft hover:bg-secondary/60"),onClick:()=>tl(e),onMouseEnter:()=>el(t),children:(0,n.jsx)("span",{children:"object"==typeof e?e.name:e})},t))})})]}),(0,n.jsx)("button",{type:"button",onClick:()=>ed(!0),"aria-label":"상품 필터 검색",className:"border-brand-700 bg-brand-700 flex h-[52px] w-[52px] shrink-0 cursor-pointer items-center justify-center rounded-xl border text-white",children:(0,n.jsx)(x.A,{className:"h-5 w-5"})})]}),(0,n.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,n.jsxs)("span",{className:"text-ink-soft text-sm",children:["총 ",(0,n.jsx)("b",{className:"text-ink tabular-nums",children:ew.length.toLocaleStr
1ing()}),"건"]}),(0,n.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,n.jsxs)("div",{className:"relative mobile-sort-container",children:[(0,n.jsxs)("button",{onClick:()=>{eg(!ev),ed(!1)},className:"border-line hover:bg-secondary/60 flex items-center gap-1.5 rounded-lg border bg-white px-3 py-2 text-[13px] font-medium text-ink transition-colors",children:[(0,n.jsx)("span",{children:ef.key&&(null==(o=tm.find(e=>e.key===ef.key))?void 0:o.label)||"정렬 기준"}),(0,n.jsx)(m.A,{className:"h-3.5 w-3.5 transition-transform ".concat(ev?"rotate-180":"")})]}),ev&&(0,n.jsx)("div",{className:"animate-in fade-in slide-in-from-top-2 duration-150 border-line absolute top-full right-0 z-50 mt-1 w-[180px] rounded-lg border bg-white shadow-lg",children:tm.map(e=>(0,n.jsx)("button",{onClick:()=>(e=>{let t=ef.key===e?ef.direction:"desc";eb({key:e,direction:t});let s=Object.keys(e7).find(t=>e7[t]===e);Z&&s&&eK&&!eq&&te(Z,ej[Z]||[],ee,s,t),eg(!1)})(e.key),className:"w-full px-4 py-3 text-left text-[14px] transition-colors first:rounded-t-lg last:rounded-b-lg hover:bg-secondary/60 ".concat(ef.key===e.key?"bg-secondary text-ink font-medium":"text-ink-soft"),children:e.label},e.key))})]}),(0,n.jsx)("button",{onClick:()=>{if(!ef.key)return;let e="desc"===ef.direction?"asc":"desc";eb({...ef,direction:e});let t=Object.keys(e7).find(e=>e7[e]===ef.key);Z&&t&&eK&&!eq&&te(Z,ej[Z]||[],ee,t,e)},disabled:!ef.key,className:"border-line flex h-[36px] w-[36px] items-center justify-center rounded-lg border transition-colors ".concat(ef.key?"text-brand-700 border-brand-700 bg-white hover:bg-secondary/60":"bg-secondary text-ink-mute cursor-not-allowed"),title:ef.key?"정렬 방향 변경":"먼저 정렬 기준을 선택하세요",children:"desc"===ef.direction?(0,n.jsx)(h.A,{className:"h-4 w-4"}):(0,n.jsx)(p.A,{className:"h-4 w-4"})})]})]})]})]})}),eo&&(0,n.jsxs)("div",{className:"animate-in fade-in duration-150 fixed inset-0 z-[200] flex flex-col bg-white md:hidden",children:[(0,n.jsxs)("div",{className:"border-line flex shrink-0 items-center justify-between border-b px-4 py-4",children:[(0,n.jsx)("h3",{className:"text-ink text-lg font-bold",children:"상품 필터 검색"}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>eN({지역:"전체",자산군:"전체",운용방식:"전체"}),"aria-label":"필터 초기화",className:"text-ink-mute hover:text-ink cursor-pointer",children:(0,n.jsx)(f.A,{className:"h-5 w-5"})}),(0,n.jsx)("button",{type:"button",onClick:()=>ed(!1),"aria-label":"닫기",className:"text-ink-mute hover:text-ink cursor-pointer",children:(0,n.jsx)(b.A,{className:"h-6 w-6"})})]})]}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-5",children:[null!==K&&(0,n.jsxs)("div",{className:"mb-5",children:[(0,n.jsx)("div",{className:"text-ink mb-3 text-sm font-bold",children:"데이터 범위"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:[{value:"글라이드 데이터",label:"Glide Universe"},{value:"전체 데이터",label:"전체 데이터"}].map(e=>{let t=ex===e.value;return(0,n.jsxs)("button",{type:"button",onClick:()=>em(e.value),className:"cursor-pointer rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ".concat(t?"border-brand-700 bg-secondary text-brand-700":"border-line text-ink-soft hover:bg-secondary/60 bg-white"),children:[t?"✓ ":"",e.label]},e.value)})})]}),(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)("div",{className:"text-ink mb-3 text-sm font-bold",children:"자산유형"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:[{value:"안전자산",label:"안전자산"},{value:"위험자산",label:"위험자산"}].map(e=>{let t=ec===e.value;return(0,n.jsxs)("button",{type:"button",onClick:()=>eu(e.value),className:"cursor-pointer rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ".concat(t?"border-brand-700 bg-secondary text-brand-700":"border-line text-ink-soft hover:bg-secondary/60 bg-white"),children:[t?"✓ ":"",e.label]},e.value)})})]}),(0,n.jsx)(E.Ay,{value:ek,onChange:eN,className:"mt-5"})]}),(0,n.jsx)("div",{className:"border-line shrink-0 border-t p-4",style:{paddingBottom:"max(1rem, env(safe-area-inset-bottom))"},children:(0,n.jsx)("button",{type:"button",onClick:()=>{ec!==Z&&ta({target:{value:ec}}),null!==K&&ex!==K&&(null==q||q(ex)),ed(!1)},className:"bg-brand-700 hover:bg-brand-700/90 w-full cursor-pointer rounded-xl py-3.5 text-[15px] font-semibold text-white transition-colors",children:"검색결과 보기"})})]}),(0,n.jsxs)("div",{className:"text-ink-soft mb-2 hidden text-sm md:block",children:["총 ",(0,n.jsx)("b",{className:"text-ink tabular-nums",children:ew.length.toLocaleStr
1ing()})," ê±´"]}),(0,n.jsxs)("div",{className:"relative w-full min-w-0 max-w-full",children:[(0,n.jsx)("div",{ref:e0,className:"h-px w-full shrink-0","aria-hidden":!0}),eq?(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full fixed top-0 left-0 bg-white/60 z-[9999]",children:(0,n.jsx)(r.Ay,{})}):eK?(0,n.jsxs)(n.Fragment,{children:[eh&&(0,n.jsx)(()=>(0,n.jsx)("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-sm z-[45] flex justify-center items-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,n.jsx)("div",{className:"w-12 h-12 border-4 border-brand-700 border-t-transparent rounded-full animate-spin"}),(0,n.jsx)("p",{className:"text-brand-700 font-medium",children:"데이터를 불러오는 중..."})]})}),{}),"안전자산"===Z?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"hidden min-w-0 w-full max-w-full md:block overflow-x-auto overscroll-x-contain",children:(0,n.jsxs)("table",{className:"min-w-max border-separate border-spacing-0 bg-white border border-line",children:[(0,n.jsx)("thead",{className:"bg-secondary",children:(0,n.jsxs)("tr",{children:[J&&(0,n.jsx)("th",{className:"sticky top-0 z-20 border-b border-line bg-secondary px-4 py-3 text-left text-center text-xs font-medium whitespace-nowrap text-ink-mute",children:"선택"}),(0,n.jsx)("th",{className:e6("한글종목약명"),style:e8("한글종목약명"),onClick:()=>e3("한글종목약명"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["펀드명 ",e5("한글종목약명")]})}),(0,n.jsx)("th",{className:e6("전일 수익률"),onClick:()=>e3("전일 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:[(0,n.jsx)(v.A,{label:"전일 수익률"})," ",e5("전일 수익률")]})}),(0,n.jsx)("th",{className:e6("지난달 수익률"),onClick:()=>e3("지난달 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["지난달 수익률 ",e5("지난달 수익률")]})}),(0,n.jsx)("th",{className:e6("올해 수익률"),onClick:()=>e3("올해 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["올해 수익률 ",e5("올해 수익률")]})}),(0,n.jsx)("th",{className:e6("참고 미국 ETF"),style:e8("참고 미국 ETF"),onClick:()=>e3("참고 미국 ETF"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["참고 미국 ETF ",e5("참고 미국 ETF")]})}),(0,n.jsx)("th",{className:e6("주당 분배금(원)"),onClick:()=>e3("주당 분배금(원)"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["주당 분배금(원) ",e5("주당 분배금(원)")]})}),(0,n.jsx)("th",{className:e6("지급 기준일"),onClick:()=>e3("지급 기준일"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["지급 기준일 ",e5("지급 기준일")]})}),(0,n.jsx)("th",{className:e6("1년 수익률"),onClick:()=>e3("1년 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["1년 수익률 ",e5("1년 수익률")]})}),(0,n.jsx)("th",{className:e6("2년 수익률"),onClick:()=>e3("2년 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["2년 수익률 ",e5("2년 수익률")]})}),(0,n.jsx)("th",{className:e6("3년 수익률"),onClick:()=>e3("3년 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["3년 수익률 ",e5("3년 수익률")]})}),(0,n.jsx)("th",{className:e6("설정이후"),onClick:()=>e3("설정이후"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["설정이후 ",e5("설정이후")]})}),(0,n.jsx)("th",{className:e6("운용보수"),onClick:()=>e3("운용보수"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["운용보수 ",e5("운용보수")]})}),(0,n.jsx)("th",{className:e6("총비용비율"),onClick:()=>e3("총비용비율"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["총비용비율 ",e5("총비용비율")]})}),(0,n.jsx)("th",{className:e6("투자위험등급"),onClick:()=>e3("투자위험등급"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["투자위험등급 ",e5("투자위험등급")]})}),(0,n.jsx)("th",{className:e6("헤지여부"),onClick:()=>e3("헤지여부"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["헤지여부 ",e5("헤ì
1§€ì—¬ë¶€")]})}),(0,n.jsx)("th",{className:e6("기초지수명"),style:e8("기초지수명"),onClick:()=>e3("기초지수명"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["기초지수명 ",e5("기초지수명")]})})]})}),(0,n.jsx)("tbody",{children:ew.length>0?ew.map((e,t)=>(0,n.jsxs)("tr",{className:"border-b hover:bg-secondary/40",children:[J&&(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:(0,n.jsxs)("label",{className:"flex justify-center",children:[(0,n.jsx)("input",{type:"checkbox",className:"input",checked:to(e),disabled:td(e),onChange:t=>ti(e,t.target.checked)}),(0,n.jsx)("span",{className:"custom-checkbox"})]})}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink font-medium cursor-pointer hover:text-brand-700 hover:underline",style:e8("한글종목약명"),onClick:()=>e.단축코드&&(0,S.r)(e.단축코드),children:e.한글종목약명||"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:null!=e["전일 수익률"]&&""!==e["전일 수익률"]?"".concat(e["전일 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["지난달 수익률"]?"".concat(e["지난달 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["올해 수익률"]?"".concat(e["올해 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink break-words max-w-[260px] relative overflow-visible",children:tc(e,"d-safe-".concat(t,"-").concat(eD(e)||""))}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:void 0!==e.distribution&&null!==e.distribution?(0,n.jsxs)("div",{className:"inline-flex items-center justify-center gap-1.5",children:[(0,n.jsx)("span",{className:"font-semibold text-ink",children:e.distribution.toLocaleString()}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),z?z(e):(eU(e),eI(!0))},className:"text-brand-700 hover:text-brand-700/80 transition-colors cursor-pointer flex items-center",title:"상세 분배금 보기",children:(0,n.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]}):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.distribution_std_dt?"".concat(e.distribution_std_dt):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["1년 수익률"]?"".concat(e["1년 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["2년 수익률"]?"".concat(e["2년 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["3년 수익률"]?"".concat(e["3년 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.설정이후?"".concat(e.설정이후,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.운용보수?"".concat(e.운용보수,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.총비용비율?"".concat(e.총비용비율,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.투자위험등급||"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.헤지여부||"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.기초지수명||"-"})]},t)):(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:J?16:15,className:"px-4 py-8 text-center text-ink-mute",children:"데이터가 없습니다"})})})]})}),(0,n.jsxs)("div",{className:"md:hidden",children:[(0,n.jsx)("div",{className:"bg-secondary/60px-4 py-3 border-b border-line",children:(0,n.jsx)("h4",{className:"text-sm font-semibold text-ink",children:"상품별 상세 정보"})}),(0,n.jsx)("div",{className:"divide-y divide-line max-h-[60vh] overflow-auto overscroll-contain",children:ew.length>0?ew.map((e,t)=>tx(e,t)):(0,n.jsx)("div",{className:"p-4 text-center text-ink-mute",children:"데이터가 없습니다"})})]})]}):"위험자산"===Z?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"hidden min-w-0 
1w-full max-w-full md:block overflow-x-auto overscroll-x-contain",children:(0,n.jsxs)("table",{className:"min-w-max border-separate border-spacing-0 bg-white border border-line",children:[(0,n.jsx)("thead",{className:"bg-secondary",children:(0,n.jsxs)("tr",{children:[J&&(0,n.jsx)("th",{className:"sticky top-0 z-20 border-b border-line bg-secondary px-4 py-3 text-left text-center text-xs font-medium whitespace-nowrap text-ink-mute",children:"선택"}),(0,n.jsx)("th",{className:e6("한글종목약명"),style:e8("한글종목약명"),onClick:()=>e3("한글종목약명"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["펀드명 ",e5("한글종목약명")]})}),(0,n.jsx)("th",{className:e6("전일 수익률"),onClick:()=>e3("전일 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:[(0,n.jsx)(v.A,{label:"전일 수익률"})," ",e5("전일 수익률")]})}),(0,n.jsx)("th",{className:e6("지난달 수익률"),onClick:()=>e3("지난달 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["지난달 수익률 ",e5("지난달 수익률")]})}),(0,n.jsx)("th",{className:e6("올해 수익률"),onClick:()=>e3("올해 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["올해 수익률 ",e5("올해 수익률")]})}),(0,n.jsx)("th",{className:e6("참고 미국 ETF"),style:e8("참고 미국 ETF"),onClick:()=>e3("참고 미국 ETF"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["참고 미국 ETF ",e5("참고 미국 ETF")]})}),(0,n.jsx)("th",{className:e6("주당 분배금(원)"),onClick:()=>e3("주당 분배금(원)"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["주당 분배금(원) ",e5("주당 분배금(원)")]})}),(0,n.jsx)("th",{className:e6("지급 기준일"),onClick:()=>e3("지급 기준일"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["지급 기준일 ",e5("지급 기준일")]})}),(0,n.jsx)("th",{className:e6("1년 수익률"),onClick:()=>e3("1년 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["1년 수익률 ",e5("1년 수익률")]})}),(0,n.jsx)("th",{className:e6("2년 수익률"),onClick:()=>e3("2년 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["2년 수익률 ",e5("2년 수익률")]})}),(0,n.jsx)("th",{className:e6("3년 수익률"),onClick:()=>e3("3년 수익률"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["3년 수익률 ",e5("3년 수익률")]})}),(0,n.jsx)("th",{className:e6("설정이후"),onClick:()=>e3("설정이후"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["설정이후 ",e5("설정이후")]})}),(0,n.jsx)("th",{className:e6("운용보수"),onClick:()=>e3("운용보수"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["운용보수 ",e5("운용보수")]})}),(0,n.jsx)("th",{className:e6("총비용비율"),onClick:()=>e3("총비용비율"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["총비용비율 ",e5("총비용비율")]})}),(0,n.jsx)("th",{className:e6("투자위험등급"),onClick:()=>e3("투자위험등급"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["투자위험등급 ",e5("투자위험등급")]})}),(0,n.jsx)("th",{className:e6("헤지여부"),onClick:()=>e3("헤지여부"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["헤지여부 ",e5("헤지여부")]})}),(0,n.jsx)("th",{className:e6("기초지수명"),style:e8("기초지수명"),onClick:()=>e3("기초지수명"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center",children:["기초지수명 ",e5("기초지수명")]})})]})}),(0,n.jsx)("tbody",{children:ew.length>0?ew.map((e,t)=>(0,n.jsxs)("tr",{className:"border-b hover:bg-secondary/40",children:[J&&(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:(0,n.jsxs)("label",{className:"flex justify-center",children:[(0,n.jsx)("input",{type:"checkbox",className:"input",checked:to(e),disabled:td(e),onChange:t=>ti(e,t.target.checked)}),(0,n.jsx)("span",{className:"custom-checkbox"})]})}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink font-medium cursor-pointer hover:text-brand-700 hover:underline",style:e8("한글종목약명"),onClick:()=>e.단축코드&&(0,S.r)(e.단축코드),children:e.한글종목약명||"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:null!=e["전일 수익률"]&&""!==e["전일 수익률"]?"".concat(e["전일 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["지난달 수익률"]?"".concat(e["지난달 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["올해 수익률"]?"".concat(e["올해 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink break-words max-w-[260px] relative overflow-visible",children:tc(e,"d-risk-".concat(t,"-").concat(eD(e)||""))}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:void 0!==e.distribution&&null!==e.distribution?(0,n.jsxs)("div",{className:"inline-flex items-center justify-center gap-1.5",children:[(0,n.jsx)("span",{className:"font-semibold text-ink",children:e.distribution.toLocaleStr
1ing()}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),z?z(e):(eU(e),eI(!0))},className:"text-brand-700 hover:text-brand-700/80 transition-colors cursor-pointer flex items-center",title:"상세 분배금 보기",children:(0,n.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})})]}):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.distribution_std_dt?"".concat(e.distribution_std_dt):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["1년 수익률"]?"".concat(e["1년 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["2년 수익률"]?"".concat(e["2년 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e["3년 수익률"]?"".concat(e["3년 수익률"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.설정이후?"".concat(e.설정이후,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.운용보수?"".concat(e.운용보수,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.총비용비율?"".concat(e.총비용비율,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.투자위험등급||"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.헤지여부||"-"}),(0,n.jsx)("td",{className:"px-4 py-3 text-sm text-center text-ink tabular-nums",children:e.기초지수명||"-"})]},t)):(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:J?16:15,className:"px-4 py-8 text-center text-ink-mute",children:"데이터가 없습니다"})})})]})}),(0,n.jsxs)("div",{className:"md:hidden",children:[(0,n.jsx)("div",{className:"bg-secondary/60px-4 py-3 border-b border-line",children:(0,n.jsx)("h4",{className:"text-sm font-semibold text-ink",children:"상품별 상세 정보"})}),(0,n.jsx)("div",{className:"divide-y divide-line max-h-[60vh] overflow-auto overscroll-contain",children:ew.length>0?ew.map((e,t)=>tx(e,t)):(0,n.jsx)("div",{className:"p-4 text-center text-ink-mute",children:"데이터가 없습니다"})})]})]}):(0,n.jsx)("div",{className:"w-full h-[100px] text-center text-ink-soft bg-secondary flex justify-center items-center border border-line rounded-xl",children:"자산 유형을 선택 하세요"})]}):(0,n.jsxs)("div",{className:"relative w-full min-w-0 max-w-full bg-white border border-line min-h-[600px]",children:[(0,n.jsxs)("div",{className:"blur-sm opacity-30 pointer-events-none select-none",children:[(0,n.jsx)("div",{className:"hidden min-w-0 w-full max-w-full md:block overflow-x-auto overscroll-x-contain",children:(0,n.jsxs)("table",{className:"min-w-max border-separate border-spacing-0 bg-white border border-line",children:[(0,n.jsx)("thead",{className:"bg-secondary",children:(0,n.jsxs)("tr",{children:[J&&(0,n.jsx)("th",{className:"sticky top-0 z-20 h-16 animate-pulse border-b border-line bg-secondary px-4 py-3 text-left text-center text-xs font-medium whitespace-nowrap text-ink-mute",children:(0,n.jsx)("div",{className:"mx-auto h-4 w-12 rounded bg-ink-mute/20"})}),["펀드명","전일 수익률","지난달 수익률","올해 수익률","참고 미국 ETF","주당 분배금(원)","지급 기준일","1년 수익률","2년 수익률","3년 수익률","설정이후","운용보수","총비용비율","투자위험등급","헤지여부","기초지수명"].map(e=>(0,n.jsx)("th",{className:"sticky top-0 z-20 h-16 animate-pulse border-b border-line bg-secondary px-4 py-3 text-left text-center text-xs font-medium whitespace-nowrap text-ink-mute",children:(0,n.jsx)("div",{className:"mx-auto h-4 w-20 rounded bg-ink-mute/20"})},e))]})}),(0,n.jsx)("tbody",{children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,n.jsxs)("tr",{className:"border-b h-20 animate-pulse",children:[J&&(0,n.jsx)("td",{className:"px-4 py-3 text-center",children:(0,n.jsx)("div",{className:"bg-gray-200 rounded w-5 h-5 mx-auto"})}),[...Array(15)].map((e,t)=>(0,n.jsx)("td",{className:"px-4 py-3 text-center",children:(0,n.jsx)("div",{className:"bg-gray-200 rounded h-4 w-16 mx-auto"})},t))]},t))})]})}),(0,n.jsxs)("div",{className:"md:hidden bg-white",children:[(0,n.jsx)("div",{className:"bg-secondary/60px-4 py-3 border-b border-line h-12 animate-pulse",children:(0,n.jsx)("div",{className:"bg-gray-200 rounded h-4 w-32"})}),(0,n.jsx)("div",{className:"divide-y divide-line",children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,n.jsxs)("div",{className:"p-4 border-b border-line animate-pulse",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsx)("div",{className:"h-4 w-1/2 bg-gray-200 rounded"}),(0,n.jsx)("div",{className:"h-6 w-20 bg-gray-200 rounded"})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3",children:[...Array(6)].map((e,t)=>(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("div",{className:"h-4 w-20 bg-gray-200 rounded"}),(0,n.jsx)("div",{className:"h-4 w-16 bg-gray-200 rounded"})]},t))})]},t))})]})]}),(0,n.jsx)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-8 max-w-md w-full mx-4",children:[(0,n.jsxs)("button",{onClick:()=>void eH.asPath,className:"w-full bg-ink hover:bg-ink/90 text-white font-semibold py-3 px-6 rounded-lg flex items-center justify-center gap-3 transition-colors",children:[(0,n.jsx)(u.A,{className:"w-5 h-5"}),(0,n.jsx)("span",{children:"로그인"})]}),(0,n.jsx)("p",{className:"text-center text-ink-soft mt-4 text-sm",children:"로그인 후 해당 기능을 사용해 보세요!"})]})})]})]}),J&&W&&!eE.loading&&(0,n.jsx)("div",{className:"fixed bottom-0 z-[1000000000] pointer-events-none ".concat(e2?"block":"block md:hidden"," ").concat(null!=U?U:"left-0 right-0"),"aria-live":"polite",children:(0,n.jsxs)("div",{className:"pointer-events-auto w-full border-t border-line bg-white px-4 pt-3 shadow-[0_-8px_32px_rgba(15,23,42,0.12)] pb-[max(1rem,env(safe-area-inset-bottom))]",children:[(0,n.jsx)("p",{className:"mb-3 text-center text-xs font-semibold text-ink-soft",children:eX}),(0,n.jsxs)("div",{className:"relative w-full",children:[(0,n.jsx)("button",{type:"button",title:eG?"로그인 후 포트폴리오에 추가할 수 있습니다":eJ?"선택한 상품을 포트폴리오에 추가합니다":"테이블에서 상품을 선택해주세요",onClick:()=>
1{if(eG){let e=eH.asPath||"/etf";eH.push("/login?redirect=".concat(encodeURIComponent(e)));return}tr()},disabled:eE.loading||!eJ,className:"w-full rounded-xl px-4 py-3.5 text-[15px] font-semibold shadow-sm transition-colors bg-ink text-white hover:bg-ink/90 disabled:cursor-not-allowed disabled:bg-gray-300 disabled:text-ink-mute disabled:hover:bg-gray-300",children:eE.loading?"처리중...":B}),eG&&eJ&&(0,n.jsx)("button",{type:"button",onClick:()=>{let e=eH.asPath||"/etf";eH.push("/login?redirect=".concat(encodeURIComponent(e)))},className:"absolute inset-0 flex items-center justify-center rounded-xl bg-black/25 text-white backdrop-blur-[1px]","aria-label":"로그인 필요",children:(0,n.jsx)(u.A,{className:"h-5 w-5"})})]})]})}),eE.loading&&(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full fixed top-0 left-0 bg-white/60 z-[999999999]",children:(0,n.jsx)(r.Ay,{})}),(0,n.jsx)(j.A,{isOpen:eP,onClose:()=>{eL(!1),eO([])},selectedProducts:eY}),(0,n.jsx)(y.A,{isOpen:eR,onConfirm:()=>{eV(eE.data.map(e=>({kr_code:e.표준코드,asset_type:"ETF",fund_name:e.한글종목약명||e.펀드명||e.종목이름||e.fund_name}))),eA(e=>({...e,data:[]})),ez(!1),D&&D()},onCancel:()=>ez(!1)}),!z&&eB&&(0,n.jsx)("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/40 p-2 sm:p-4",onClick:()=>{eI(!1),eU(null)},children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-4xl max-h-[95vh] sm:max-h-[90vh] overflow-hidden flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex-shrink-0 bg-white border-b border-line px-4 sm:px-6 py-3 sm:py-4 flex justify-between items-center",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("h2",{className:"text-base sm:text-xl font-bold text-ink truncate",children:"분배금 상세 정보"}),eW&&(0,n.jsx)("p",{className:"text-xs sm:text-sm text-ink-soft mt-0.5 sm:mt-1 truncate",children:eW.한글종목약명||eW.펀드명||"상품 정보"})]}),(0,n.jsx)("button",{onClick:()=>{eI(!1),eU(null)},className:"text-ink-mute hover:text-ink text-xl sm:text-2xl font-bold ml-2 flex-shrink-0",children:"\xd7"})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,n.jsx)(_,{item:eW})})]})})]})}let F=e=>{let{token:t,show_selection:s,updateResponse:i,setUpdateResponse:c,handleCloseModal:u,selectedAccountType:x,setSaveRefresh:m,setMainTab:h,onDistributionClick:p,submitButtonLabel:f,onSubmitSelection:b,maxSelectionCount:v,initialSelectedItems:k,scrollContainerRef:N=null,floatingBarInsetClassName:w=null}=e,_=(0,d.r)(),S=(0,o.useSearchParams)(),T=(0,a.useRef)(null),E=null!=N?N:T,F=!!N,[D,M]=(0,a.useState)(""),[P,L]=(0,a.useState)(!1),[R,z]=(0,a.useState)(!1),[B,I]=(0,a.useState)(!1),Y=(0,a.useRef)(null),O=(0,a.useRef)(null),[W,U]=(0,a.useState)(null),[V,K]=(0,a.useState)("etf"),[q,H]=(0,a.useState)([]),[G,J]=(0,a.useState)(!1);(0,a.useRef)(null);let[$,X]=(0,a.useState)(-1),Z=(0,a.useRef)(null),[Q,ee]=(0,a.useState)(!1),[et,es]=(0,a.useState)([]),[en,ea]=(0,a.useState)(!1),{setProducts:el}=(0,g.A)(),[er,ei]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)("전체 데이터"),{data:ec,FilterDetails:eu,loading:ex,setSelectedOptions:em,selectedOptions:eh,setSorting:ep,sorting:ef,setLoading:eb,setData:ev,message:eg,option:ej,setOption:ey,search:ek,setSearch:eN}=(0,l.A)(),{suggestions:ew,isLoading:e_,fetchSuggestions:eS,clearSuggestions:eC}=function(){let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!1),l=(0,a.useRef)(null),r=(0,a.useCallback)(async function(e,s){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return void t([]);n(!0);try{let n=await fetch("/api/search-suggestions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e,option:s,...a})}),l=await n.json();n.ok?t(l.suggestions):(console.error("Error:",l.error),t([]))}catch(e){console.error("Error fetching suggestions:",e),t([])}finally{n(!1)}},[]);return{suggestions:e,isLoading:s,fetchSuggestions:(0,a.useCallback)(function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{r(e,t,s)},300)},[r]),clearSuggestions:()=>t([])}}(),[eT,eE]=(0,a.useState)(!1);(0,a.useEffect)(()=>
1{if(_.isReady&&!eT){let e=S.get("searchETF"),s=S.get("searchTicker");if(e){let s=decodeURIComponent(e);M(s),ey("etf"),ed("전체 데이터"),eb(!0),eu(t,s),eE(!0)}else if(s){let e=s.toUpperCase();M(e),ey("stock"),ed("전체 데이터"),eb(!0),eu(t,e),eE(!0)}else M(""),ey("stock"),eb(!0),eu(t,""),eE(!0)}},[_.isReady,S,t,eT,eu]),(0,a.useEffect)(()=>{"etf"!==ej&&eT&&(D.trim()||""===D)&&eu(t,D)},[eh,ef,ej]),(0,a.useEffect)(()=>{let e=e=>{Y.current&&!Y.current.contains(e.target)&&O.current&&!O.current.contains(e.target)&&(z(!1),I(!1))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[eh,ef,R,B]),(0,a.useEffect)(()=>{"etf"!==ej&&eT&&(D.trim()||""===D)&&(ev([]),eu(t,D))},[ej,eT,D,t]);let[eA,eF]=(0,a.useState)({data:[],loading:!1,message:null});(0,a.useEffect)(()=>{let e=e=>{Z.current&&!Z.current.contains(e.target)&&eC()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[eC]);let eD=(0,n.jsx)(C.A,{options:[{value:"글라이드 데이터",label:"Glide Universe"},{value:"전체 데이터",label:"전체 데이터"}],value:eo,onChange:ed});return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex flex-col gap-[10px] w-full min-w-0 max-w-full md:px-4 md:pt-4",children:[ex?(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full absolute top-0 left-0 bg-white/60",children:(0,n.jsx)(r.Ay,{})}):(0,n.jsxs)(n.Fragment,{children:[null,eA.loading&&(0,n.jsx)("div",{className:"flex items-center justify-center w-full h-full fixed top-0 left-0 bg-white/60 z-[999999999]",children:(0,n.jsx)(r.Ay,{})}),(0,n.jsx)("div",{children:F?(0,n.jsx)("div",{className:"relative mx-auto w-full min-w-0 max-w-full py-0 pb-4",children:"전체 데이터"===eo?(0,n.jsx)("div",{className:"w-full min-w-0",children:(0,n.jsx)(A,{token:t,show_selection:s,updateResponse:i,setUpdateResponse:c,handleCloseModal:u,selectedAccountType:x,setSaveRefresh:m,setMainTab:h,glideUniverse:!1,onDistributionClick:p,submitButtonLabel:f,onSubmitSelection:b,maxSelectionCount:v,initialSelectedItems:k,scrollContainerRef:E,floatingBarInsetClassName:w,topLeftExtra:eD,selectedTab:eo,onSelectedTabChange:ed},"etf-table-full")}):(0,n.jsx)("div",{className:"w-full min-w-0",children:(0,n.jsx)(A,{token:t,show_selection:s,updateResponse:i,setUpdateResponse:c,handleCloseModal:u,selectedAccountType:x,setSaveRefresh:m,setMainTab:h,glideUniverse:!0,onDistributionClick:p,submitButtonLabel:f,onSubmitSelection:b,maxSelectionCount:v,initialSelectedItems:k,scrollContainerRef:E,floatingBarInsetClassName:w,topLeftExtra:eD,selectedTab:eo,onSelectedTabChange:ed},"etf-table-glide")})}):(0,n.jsx)("div",{children:(0,n.jsx)("div",{ref:T,className:"scrollbars-visible scroll-container relative mx-auto min-h-[30vh] w-full min-w-0 max-w-full max-h-[80vh] overflow-auto py-0 pb-4",children:"전체 데이터"===eo?(0,n.jsx)("div",{className:"w-full min-w-0",children:(0,n.jsx)(A,{token:t,show_selection:s,updateResponse:i,setUpdateResponse:c,handleCloseModal:u,selectedAccountType:x,setSaveRefresh:m,setMainTab:h,glideUniverse:!1,onDistributionClick:p,submitButtonLabel:f,onSubmitSelection:b,maxSelectionCount:v,initialSelectedItems:k,scrollContainerRef:E,floatingBarInsetClassName:w,topLeftExtra:eD,selectedTab:eo,onSelectedTabChange:ed},"etf-table-full")}):(0,n.jsx)("div",{className:"w-full min-w-0",children:(0,n.jsx)(A,{token:t,show_selection:s,updateResponse:i,setUpdateResponse:c,handleCloseModal:u,selectedAccountType:x,setSaveRefresh:m,setMainTab:h,glideUniverse:!0,onDistributionClick:p,submitButtonLabel:f,onSubmitSelection:b,maxSelectionCount:v,initialSelectedItems:k,scrollContainerRef:E,floatingBarInsetClassName:w,topLeftExtra:eD,selectedTab:eo,onSelectedTabChange:ed},"etf-table-glide")})})})})]}),(0,n.jsx)(j.A,{isOpen:Q,onClose:()=>{ee(!1),es([])},selectedProducts:et}),(0,n.jsx)(y.A,{isOpen:en,onConfirm:()=>{el(eA.data.map(e=>({kr_code:e.표준코드,asset_type:"ETF",fund_name:e.한글종목약명||e.펀드명||e.종목이름||e.fund_name}))),eF(e=>({...e,data:[]})),ea(!1),u&&u()},onCancel:()=>ea(!1)})]})})}},48858:(e,t,s)=>{"use strict";s.d(t,{T9:()=>en,LR:()=>eA,X9:()=>ef,H4:()=>eE,Rx:()=>ex,kz:()=>ek,Fc:()=>e_,T_:()=>ey,Ay:()=>eF,pH:()=>eS,n2:()=>em,Yz:()=>ev,SU:()=>eb,HO:()=>eg,tK:()=>ew,iY:()=>eT});var n=s(70127),a=s(70567),l=s(76003),r=s(21757),i=s(89119),o=s.n(i),d=s(7261),c=s(99736),u=s(61863),x=s(12900),m=s(516
152),h=s(93374),p=s(92987),f=s(54739),b=s(58442),v=s(76773);s(63512),s(13904);let g=e=>{let{open:t,onClose:s}=e,l=a.useRef(null),[r,i]=(0,a.useState)(void 0),[o,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&(0,v.U)().auth.getSession().then(e=>{let{data:{session:t}}=e;i((null==t?void 0:t.access_token)?"Bearer ".concat(t.access_token):null)})},[t]);let g=()=>{d(!1),s()};return(0,n.jsx)(x.e.Root,{show:t,as:a.Fragment,children:(0,n.jsxs)(m.lG,{as:"div",className:"relative z-[999999999]",initialFocus:l,onClose:g,children:[(0,n.jsx)(x.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 w-screen py-2 overflow-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center md:p-2 p-2 text-center",children:(0,n.jsx)(x.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsx)(m.lG.Panel,{className:"relative transform rounded-2xl text-left shadow-xl transition-all w-full max-h-[90vh] flex flex-col bg-white",children:(0,n.jsxs)("div",{className:"w-full h-full flex flex-col rounded-2xl bg-white",children:[(0,n.jsx)("div",{onClick:g,className:"flex w-full justify-end py-4 px-4 flex-shrink-0",children:(0,n.jsx)(h.$8F,{className:"text-[24px] cursor-pointer text-ink-soft hover:text-ink transition-colors"})}),(0,n.jsx)("div",{className:"flex gap-2 border-b border-line px-4 flex-shrink-0",children:(0,n.jsx)("button",{className:"-mb-px px-2 md:px-6 py-3 font-semibold text-sm md:text-base transition-all border-b-2 border-brand-700 text-ink",children:"TDF Dashboard"})}),(0,n.jsx)("div",{className:"w-full flex-1 overflow-y-auto py-4",children:void 0!==r&&(o?(0,n.jsx)(f.default,{type:"tdf",vintage:c,token:r,setShowKeyinformation:d,selectedAccountType:"withdrawal-planner",handleCloseModal:g}):(0,n.jsx)("div",{className:"px-4",children:(0,n.jsx)(p.A,{onSelectCode:e=>{u(e),d(!0)}})}))}),(0,n.jsx)(b.N9,{position:"top-center"})]})})})})})]})})};var j=s(12134);let y=e=>{let{open:t,onClose:s}=e,[l,r]=(0,a.useState)(void 0),[i,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{t&&(0,v.U)().auth.getSession().then(e=>{let{data:{session:t}}=e;r((null==t?void 0:t.access_token)?"Bearer ".concat(t.access_token):null)})},[t]),(0,n.jsx)(j.A,{isModalOpen:t&&void 0!==l,handleCloseModal:s,token:l,show_selection:"true",updateResponse:i,setUpdateResponse:o,selectedAccountType:"withdrawal-planner",hideModelPortfolioTab:!0})};var k=s(77416);let N=e=>{let{open:t,onClose:s,pensionScope:l}=e,[r,i]=(0,a.useState)(void 0);return(0,a.useEffect)(()=>{t&&(0,v.U)().auth.getSession().then(e=>{let{data:{session:t}}=e;i((null==t?void 0:t.access_token)?"Bearer ".concat(t.access_token):null)})},[t]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(k.A,{isOpen:t&&void 0!==r,onClose:s,token:r,pensionScope:l})})};var w=s(83843),_=s(76579),S=s(70746),C=s(3924),T=s(99834),E=s(74590),A=s(12699),F=s(57804),D=s(49661);let M=[".png",".jpg",".jpeg",".heic",".heif",".webp"],P=["image/png","image/jpeg","image/jpg","image/heic","image/heif","image/webp"];function L(e){let t=e.name.toLowerCase(),s=e.type.toLowerCase();return M.some(e=>t.endsWith(e))||P.includes(s)}let R=function(e){var t;let{isOpenModal:s,setIsOpenModal:l,universe:r,onAdd:i}=e,{uploadSnapshot:o,snapShotData:d,setSnapShotData:c,messageModal:u,setMessageModal:p,uploadFailed:f,setUploadFailed:b,showInfoModal:v,setShowInfoModal:g}=(0,_.A)(),[j,y]=(0,a.useState)(null),[k,N]=(0,a.useState)(!1),[w,E]=(0,a.useState)(!0),[A,F]=(0,a.useState)([]),[D,M]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1),[B,O]=(0,a.useState)(!1),[W,U]=(0,a.useState)(0),V=(0,a.useRef)(null),K=(0,a.useRef)(null),q=(0,a.useRef)(null),H=()=>{l(!1),N(!1),E(!0),G()},G=()=>{F([]),y(null),E(!0),K.current&&(K.current.value="")},J=async()=>
1{if(0===A.length)return void y("최소 하나의 파일을 업로드해야 합니다.");N(!0),R(!1);try{let e=await o({files:A,universe:r});(null==e?void 0:e.noMatch)&&E(!1),K.current&&(K.current.value=""),F([])}catch(e){T.Ay.error("An unexpected error occurred."),console.error("스냅샷 업로드 오류:",e)}finally{N(!1)}};return(0,a.useEffect)(()=>{let e=e=>{V.current&&!V.current.contains(e.target)&&M(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,n.jsx)(x.e.Root,{show:s,as:a.Fragment,children:(0,n.jsxs)(m.lG,{as:"div",className:"relative z-[9999]",initialFocus:q,onClose:()=>{l(!0)},children:[(0,n.jsx)(x.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,n.jsx)("div",{className:"flex items-center justify-center min-h-full p-2 md:p-4 text-center",children:(0,n.jsx)(x.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsx)(m.lG.Panel,{className:"relative transform overflow-hidden rounded-[12px] bg-white text-left shadow-xl transition-all w-full max-w-5xl max-h-[95vh] md:max-h-[100vh]",children:(0,n.jsxs)("div",{className:"w-full py-[15px] md:py-[20px] overflow-y-auto max-h-[80vh] md:max-h-[100vh]",children:[(0,n.jsxs)("div",{className:"flex w-full justify-between items-center px-[16px] md:px-[32px] pb-[15px] md:pb-[20px] mb-[15px] md:mb-[20px] border-b border-line",children:[(0,n.jsx)("label",{className:"text-ink font-semibold text-[18px] md:text-[20px]",children:"파일 업로드"}),(0,n.jsx)(h.$8F,{onClick:H,className:"text-[20px] md:text-[24px] cursor-pointer text-ink-mute"})]}),(0,n.jsxs)("div",{className:"flex flex-col justify-center w-full h-full px-[16px] md:px-[32px] min-h-[400px] md:min-h-[480px]",children:[k||d.loading?(0,n.jsx)("div",{className:"relative mt-4 mb-4 flex flex-col justify-center items-center h-[350px] md:h-[480px]",children:(0,n.jsx)("div",{className:"absolute inset-0 bg-white/90 flex flex-col justify-center items-center z-10 rounded-lg",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4 md:space-y-6",children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(S.hn,{}),(0,n.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,n.jsx)("div",{className:"w-6 h-6 md:w-8 md:h-8 bg-brand-700 rounded-full animate-pulse"})})]}),(0,n.jsxs)("div",{className:"text-center space-y-2 md:space-y-3 px-4",children:[(0,n.jsx)("h3",{className:"text-brand-700 text-lg md:text-xl font-semibold",children:"AI가 이미지를 분석 중입니다!"}),(0,n.jsxs)("div",{className:"text-ink-soft text-sm max-w-sm md:max-w-md space-y-2",children:[(0,n.jsxs)("p",{children:["고객님이 업로드하신 스냅샷을 기반으로",(0,n.jsx)("br",{}),"AI가 TDF, ETF 등 투자 상품명을 자동 인식하고,",(0,n.jsx)("br",{}),"자산 구성 정보를 정밀하게 추출 중입니다."]}),(0,n.jsxs)("p",{children:["고도화된 분석 엔진이 상품명, 비중, 유형까지 정확하게 파악하여",(0,n.jsx)("br",{}),"최적의 포트폴리오 진단을 준비하고 있어요."]}),(0,n.jsxs)("p",{className:"font-medium text-brand-700",children:["잠시만 기다려 주세요.",(0,n.jsx)("br",{}),"지금 고객님의 퇴직연금 계좌에 꼭 맞는 인사이트를 생성 중입니다!"]})]})]})]})})}):!w&&((null==d||null==(t=d.data)?void 0:t.length)>0||P||(null==d?void 0:d.noMatch))&&!v?(0,n.jsx)("div",{className:"mt-5 min-h-[350px] md:min-h-[480px]",children:(0,n.jsx)(I,{snapShotData:d,onBackClick:()=>{E(!0),b(!1),y(!1),R(!1)},pensionType:r,setSnapShotData:c,handleClose:H,DropdownOpen:D,setDropdownOpen:M,dropdownRef:V,onAdd:i})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"mb-[20px] md:mb-[24px]",children:(0,n.jsx)("div",{className:"bg-chart-3/1
15 border border-chart-3/40 rounded-lg p-4 md:p-5",children:(0,n.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,n.jsx)("div",{className:"text-chart-3 text-lg md:text-xl",children:"⚠️"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("h4",{className:"text-chart-3 font-semibold text-sm md:text-base mb-2",children:"이런 스냅샷은 분석이 어렵습니다!"}),(0,n.jsxs)("div",{className:"space-y-3 text-sm md:text-base",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,n.jsx)("span",{className:"text-debt",children:"❌"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:"Bad Case 1: 상품명이 제대로 나오지 않은 경우"})]}),(0,n.jsx)("p",{className:"text-ink-soft text-xs md:text-sm ml-6",children:"상품명이 잘려 있거나 일부만 보이면 정확한 분석이 어렵습니다."}),(0,n.jsx)("p",{className:"text-brand-700 text-xs md:text-sm ml-6 mt-1",children:"\uD83D\uDC49 가능하면 전체 상품명이 한눈에 보이도록 화면을 캡쳐해주세요."})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,n.jsx)("span",{className:"text-debt",children:"❌"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:" Bad Case 2: 상품명 없이 자산 종류와 금액만 나오는 경우"})]}),(0,n.jsx)("p",{className:"text-ink-soft text-xs md:text-sm ml-6",children:"자산 유형(예: 국내주식, 채권 등)과 금액만 표시된 화면은 상품을 정확히 파악할 수 없어 분석이 어렵습니다."}),(0,n.jsx)("p",{className:"text-brand-700 text-xs md:text-sm ml-6 mt-1",children:"\uD83D\uDC49 구체적인 상품명이 함께 나오는 화면을 캡쳐해 주세요."})]})]})]})]})})}),(0,n.jsxs)("div",{className:"bg-brand-700/[0.06] border-[2px]\n                             border-dashed rounded-[20px] p-[20px]\n                             md:p-[30px] ".concat(A.length>0?"min-h-[280px]":"h-[280px]"," md:").concat(A.length>0?"min-h-[330px]":"h-[330px]","\n                              w-full flex justify-center items-center flex-col transition-all duration-300 ").concat(B?"border-brand-700 bg-brand-700/[0.12] scale-[1.02] shadow-lg":A.length>0?"border-up":j||f?"border-debt":"border-brand-700/40"),onDrop:e=>{e.preventDefault(),e.stopPropagation(),O(!1),U(0);let t=Array.from(e.dataTransfer.files);if(0===t.length)return;let s=t.filter(L);s.length!==t.length?y("일부 파일이 지원되지 않는 형식입니다. PNG, JPG, JPEG, HEIC, WebP 파일만 업로드 가능합니다."):(y(null),b(!1));let n=[...A];s.forEach(e=>{(n=n.filter(t=>t.name!==e.name)).push(e)}),F(n)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),U(e=>e+1),B||O(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),U(e=>e-1),W<=1&&O(!1)},children:[(0,n.jsx)("label",{htmlFor:"withdrawal-snapshot-file-input",className:"flex flex-col items-center cursor-pointer",children:(0,n.jsx)(C.SNo,{className:"text-[36px] md:text-[48px] transition-all duration-300 ".concat(B?"text-brand-700 scale-110":"text-ink-soft")})}),(0,n.jsxs)("div",{className:"flex flex-col items-center mt-3",children:[(0,n.jsx)("span",{className:"text-[16px] md:text-[20px] font-medium text-center px-4 transition-all duration-300 ".concat(B?"text-brand-700":"text-ink"),children:B?"파일을 여기에 놓으세요":"업로드를 시작하려면 파일을 끌어서 놓으세요"}),(0,n.jsx)("span",{className:"text-[12px] md:text-[14px] text-ink-mute font-normal text-center",children:"지원되는 형식: PNG, JPG, JPEG, HEIC, WebP"}),(0,n.jsx)("label",{htmlFor:"withdrawal-snapshot-file-input",className:"px-[16px] md:px-[20px] mt-3 md:mt-4 h-[45px] md:h-[50px] text-white text-[14px] font-semibold flex items-center justify-center rounded-[8px] cursor-pointer transition-all duration-300 ".concat(B?"bg-brand-700/90 scale-105":"bg-brand-700"),children:j||f?"이미지 다시 업로드":"이미지 선택하기"})]}),(0,n.jsx)("input",{ref:K,type:"file",accept:".png, .jpg, .jpeg, .heic, .heif, .webp, image/png, image/jpeg, image/heic, image/heif, image/webp",id:"withdrawal-snapshot-file-input",n
1ame:"project_file",onChange:e=>{let t=Array.from(e.target.files),s=t.filter(L);s.length!==t.length?y("일부 파일이 지원되지 않는 형식입니다. PNG, JPG, JPEG, HEIC, WebP 파일만 업로드 가능합니다."):(y(null),b(!1));let n=[...A];s.forEach(e=>{(n=n.filter(t=>t.name!==e.name)).push(e)}),F(n),e.target.value=""},multiple:!0,style:{display:"none"}}),A.length>0&&(0,n.jsxs)("div",{className:"mt-6 w-full max-w-md",children:[(0,n.jsxs)("h4",{className:"text-sm font-medium text-ink-soft mb-2 text-center",children:["선택된 파일 (",A.length,"개)"]}),(0,n.jsx)("div",{className:"space-y-2 max-h-28 overflow-y-auto",children:A.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center justify-between bg-white p-2 rounded-lg border border-line shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"w-2 h-2 bg-up rounded-full flex-shrink-0"}),(0,n.jsx)("span",{className:"text-sm text-ink-soft truncate",children:e.name})]}),(0,n.jsx)("button",{type:"button",onClick:()=>(e=>{let t=A.filter((t,s)=>s!==e);F(t),0===t.length&&(y(null),b(!1))})(t),className:"ml-2 p-1 text-debt hover:bg-debt/10 rounded-full transition-colors",children:(0,n.jsx)(h.$8F,{className:"w-4 h-4"})})]},t))})]}),j&&(0,n.jsx)("p",{className:"text-[14px] text-debt mt-3 text-center",children:j}),f&&0===A.length&&(0,n.jsx)("p",{className:"text-[14px] text-debt mt-3 text-center",children:"이미지 업로드 중 오류가 발생했습니다"})]}),(0,n.jsxs)("div",{className:"w-full flex flex-col sm:flex-row items-center justify-end gap-3 mt-4",children:[(0,n.jsx)("button",{className:"w-full sm:w-auto bg-secondary px-4 md:px-5 h-[45px] md:h-[50px] text-ink-soft text-[14px] font-medium flex items-center justify-center rounded-md",onClick:()=>G(),disabled:0===A.length,children:"파일 초기화"}),!f&&(0,n.jsx)("button",{onClick:J,className:"w-full sm:w-auto bg-brand-700 px-4 md:px-5 h-[45px] md:h-[50px] text-white text-[14px] font-medium flex items-center justify-center cursor-pointer rounded-md",children:d.loading?"로딩중...":"업로드"}),f&&(0,n.jsx)("button",{onClick:()=>{R(!0),E(!1)},className:"w-full sm:w-auto bg-brand-700 px-4 md:px-5 h-[45px] md:h-[50px] text-white text-[14px] font-medium flex items-center justify-center cursor-pointer rounded-md",children:"수동으로 추가하기"})]}),u&&(0,n.jsx)(Y,{ModalClose:()=>{p(!1)},message:d.message})]}),v&&(0,n.jsx)(z,{onConfirm:()=>{g(!1),E(!1)}})]})]})})})})})]})})};function z(e){let{onConfirm:t}=e;return(0,n.jsx)("div",{className:"absolute inset-0 bg-black/40 transition-opacity flex items-center justify-center z-50 rounded-[12px]",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg shadow-lg p-8 mx-4 w-full max-w-2xl",children:[(0,n.jsxs)("div",{className:"text-ink-soft text-base leading-relaxed space-y-6 mb-8",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-xl font-semibold text-brand-700 mb-3",children:"\uD83D\uDD0D [안내] 포트폴리오 분석 대상 안내"}),(0,n.jsxs)("p",{children:["현재 분석 서비스는 TDF 및 ETF 상품에 특화되어 제공됩니다.",(0,n.jsx)("br",{}),"일반 펀드는 자동 분석에서 제외될 수 있으며,",(0,n.jsx)("br",{}),"기타 상품에 대한 지원은 추후 확대 예정입니다."]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-xl font-semibold text-brand-700 mb-3",children:"\uD83D\uDD0D [안내] 상품 추가 안내"}),(0,n.jsx)("p",{children:"원하지 않는 상품은 체크 해제, 필요한 상품은 검색 후 추가해 주세요."})]})]}),(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsx)("button",{onClick:t,className:"px-6 py-3 bg-brand-700 text-white text-base font-medium rounded-lg hover:bg-brand-700/90 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-brand-700 focus:ring-opacity-50",children:"확인"})})]})})}function B(e){let{onReupload:t,onSearchClick:s}=e;return(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center text-center h-[380px] border border-line rounded-[12px] px-4",children:[(0,n.jsx)("div",{className:"w-16 h-16 rounded-full bg-secondary flex items-center justify-center mb-5",children:(0,n.jsx)(h.ZYA,{className:"text-ink-mute text-[28px]"})}),(0,n.jsx)("h3",{className:"text-ink text-[15px] md:text-[17px] font-semibold mb-2",children:"업로드하신 화면에서 매칭되는 TDF\xb7ETF 상품을 찾지 못했어요"}),(0,n.jsx)("p",{className:"text-ink-mute text-[13px] md:text-[14px] mb-6",children:"보유하신 TDF\xb7ETF\xb7펀드가 있다면 상품 검색으로 직접 찾아 추가해 주세요."}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{onClick:t,className:"px-4 md:px-5 h-[45px] md:h-[50px] bg-secondary text-ink-soft text-[14px] font-medium rounded-md",children:"다시 업로드하기"}),(0,n.jsx)("button",{onClick:s,className:"px-4 md:px-5 h-[45px] md:h-[50px] bg-brand-700 text-white text-[14px] font-medium rounded-md",children:"상품 검색으로 추가하기"})]})]})}function I(e){var t,s,l;let{snapShotData:r,onBackClick:i,pensionType:o,setSnapShotData:d,handleClose:c,DropdownOpen:u,setDropdownOpen:x,dropdownRef:m,onAdd:h}=e,[p,f]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),[g,j]=(0,a.useState)(null),[y,k]=(0,a.useState)(""),[N,w]=(0,a.useState)(null),[_,C]=(0,a.useState)(!1),[M,P]=(0,a.useState)(null),[L,R]=(0,a.useState)((null==(t=r.data)?void 0:t.map(()=>!0))||[]),[z,I]=(0,a.useState)(null),[O,W]=(0,a.useState)({loading:!0,data:null,message:null}),[U,V]=(0,a.useState)(null),K="https://backend-dashboard.glide-path.org",q=(null==r||null==(s=r.cash)?void 0:s.total_market_value)||0,[H,G]=(0,a.useState)(!0),J=(0,a.useRef)(null),$=async(e,t)=>
1{f(!1),j({query:e,displayName:t||e})},X=async(e,t)=>{var s,n,a,l,r;let i=null==e||null==(s=e.matched_asset)?void 0:s.asset_type,o=null==e||null==(n=e.matched_asset)?void 0:n.standard_code,d=(null==e||null==(a=e.matched_asset)?void 0:a.rep_standard_code)||null;I(i),V(t),W(e=>({...e,loading:!0}));let c="ETF"===i?"".concat(K,"/api/v1/asset-detail/?asset_type=").concat(i,"&standard_code=").concat(o):"".concat(K,"/api/v1/asset-detail/?asset_type=").concat(i,"&standard_code=").concat(o,"&rep_standard_code=").concat(d);try{let e=await E.A.get(c);W({loading:!1,data:e.data||null,message:e.data?null:"No data available"})}catch(e){W({loading:!1,data:null,message:(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.message)||"Something went wrong"})}};return(0,a.useEffect)(()=>{var e;if(null==r||null==(e=r.data)?void 0:e.length){let e=r.data.findIndex(e=>e.matched_asset);-1!==e?X(r.data[e],e):W({loading:!1,data:null,message:null})}else W({loading:!1,data:null,message:null})},[r]),(0,a.useEffect)(()=>{var e;(null==r||null==(e=r.data)?void 0:e.length)>0&&R(e=>[...Array(r.data.length-e.length).fill(!0),...e])},[r.data]),(0,n.jsxs)("div",{className:"w-full h-full",children:[(0,n.jsx)(D.Ay,{handleSubmit:$,setCurrentSearch:j,query:y,setQuery:k,setSnapShotData:d,setLoadingElastic:v,selectedTicker:N,setSelectedTicker:w,DropdownOpen:u,setDropdownOpen:x,dropdownRef:m,handleFinalSubmit:e=>{let t=e.short_name||e.name,s={input_asset_name:t,matched_asset:{asset_type:e.asset_type||"",official_name:e.name||"",rep_standard_code:e.rep_standard_code||"",short_code:e.short_code||"",short_name:e.short_name||"",standard_code:e.standard_code||""}};if((r.data||[]).some(e=>{var t,n;return(null==e||null==(t=e.matched_asset)?void 0:t.standard_code)===(null==s||null==(n=s.matched_asset)?void 0:n.standard_code)})){P(t),C(!0);return}d(e=>{var t;let n=[s,...e.data||[]];return R([!0,...(null==(t=e.data)?void 0:t.map((e,t)=>L[t]))||[]]),{...e,loading:!1,data:n,noMatch:!1,message:null}}),k("")},pensionScope:o,inputRef:J}),b?(0,n.jsx)("div",{className:"mt-4 mb-4 flex justify-center h-[380px] items-center",children:(0,n.jsx)(S.Ay,{})}):(null==r?void 0:r.noMatch)&&!(q>0)?(0,n.jsx)(B,{onReupload:i,onSearchClick:()=>{var e;return null==(e=J.current)?void 0:e.focus()}}):(null==r||null==(l=r.data)?void 0:l.length)||q>0?(0,n.jsxs)("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[(0,n.jsx)(F.A,{snapShotData:{...r,data:r.data||[]},checkedStates:L,toggleCheckbox:e=>{let t=[...L];t[e]=!t[e],R(t)},handleTicketDetails:X,selectedIndex:U,cashAmount:q,includeCash:H,onToggleCash:()=>G(e=>!e)}),(0,n.jsx)("div",{className:"flex items-start justify-start flex-col h-[300px] md:h-[400px] overflow-y-auto rounded-tr-[12px] rounded-br-[12px] border border-line p-3 md:p-4",children:(0,n.jsx)(A.A,{tickerDetail:O,assetType:z})})]}):(0,n.jsx)("div",{className:"mt-4 mb-4 flex justify-center items-center h-[380px] border-line border text-center",children:(0,n.jsx)("div",{className:"bg-secondary/40 border border-line rounded-lg p-3 md:p-4 max-w-sm md:max-w-md mx-4",children:(0,n.jsxs)("div",{className:"flex items-start space-x-2 md:space-x-3",children:[(0,n.jsx)("div",{className:"w-2 h-2 bg-brand-700 rounded-full mt-2 flex-shrink-0"}),(0,n.jsx)("div",{className:"text-sm text-ink-soft",children:"자세한 내용을 보려면 자산을 추가하세요."})]})})}),!((null==r?void 0:r.noMatch)&&!(q>0))&&(0,n.jsxs)("div",{className:"w-full flex flex-col sm:flex-row items-center justify-end gap-3 mt-4",children:[(0,n.jsx)("button",{className:"w-full sm:w-auto bg-secondary px-4 md:px-5 h-[45px] md:h-[50px] text-ink-soft text-[14px] font-medium flex items-center justify-center cursor-pointer rounded-md",onClick:i,children:"뒤로 가기"}),(0,n.jsx)("button",{className:"w-full sm:w-auto bg-brand-700 px-4 md:px-5 h-[45px] md:h-[50px] text-white text-[14px] font-medium flex items-center justify-center cursor-pointer rounded-md",onClick:()=>{let e=new Set,t=(r.data||[]).map((t,s)=>{var n,a,l;let r=null==t||null==(n=t.matched_asset)?void 0:n.standard_code;return!t.matched_asset||!L[s]||e.has(r)?null:(e.add(r),{productC
1ode:t.matched_asset.rep_standard_code||r,productName:t.matched_asset.short_name||t.matched_asset.official_name,assetType:t.matched_asset.asset_type,units:null!=(a=t.units)?a:0,marketValue:null!=(l=t.market_value)?l:0})}).filter(Boolean),s=H&&q>0;if(0===t.length&&!s)return void T.Ay.error("선택한 상품이 없습니다.");s&&t.push({productCode:"",productName:"현금\xb7예수금",assetType:null,units:0,marketValue:q}),h(t),c()},children:"계좌에 추가"})]}),_&&(0,n.jsx)(Y,{name:M,ModalClose:()=>{C(!1),k("")},message:"이미 추가된 종목입니다."})]})}let Y=e=>{let{name:t,ModalClose:s,message:a}=e;return(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity flex items-center justify-center z-50",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg shadow-lg p-6 w-[90%] max-w-md",children:[t&&(0,n.jsxs)("h2",{className:"text-lg font-semibold text-ink mb-4",children:["종목명: ",t]}),(0,n.jsx)("p",{className:"text-ink-soft mb-6",children:a}),(0,n.jsx)("div",{className:"flex justify-end space-x-3",children:(0,n.jsx)("button",{onClick:s,className:"px-4 py-2 bg-secondary text-ink-soft rounded hover:text-ink",children:"취소"})})]})})},O=e=>{let{open:t,onClose:s,universe:a,onAdd:l}=e;return(0,n.jsx)(R,{isOpenModal:t,setIsOpenModal:e=>{e||s()},universe:a,onAdd:l})};var W=s(26896),U=s(29657),V=s(76564),K=s(95619);let q=s(82967).A,H=[{key:"last_day",label:"전일"},{key:"last_month",label:"지난 한달"},{key:"ytd",label:"YTD"},{key:"1_year",label:"1년"},{key:"2_year",label:"2년"},{key:"3_year",label:"3년"}],G=H.filter(e=>["last_day","ytd","1_year"].includes(e.key)),J=e=>(0,W.cn)(e,"border-line rounded-md border bg-white px-2 py-1 text-right text-sm font-semibold tabular-nums","text-ink placeholder:text-ink-mute placeholder:font-normal outline-none transition-colors","hover:border-brand-700/40 focus:border-brand-700"),$="sticky left-0 z-10",X="sticky left-[76px] z-10 border-line border-r",Z=new Set(["cash","deposit","principal_protected"]);function Q(e){return"etf"===e?{label:"ETF",cls:"bg-[#E8EEF2] text-[#06334C]"}:"tdf"===e?{label:"TDF",cls:"bg-[#E6F3ED] text-[#0E4E36]"}:"cash"===e?{label:"현금",cls:"bg-secondary text-ink-soft"}:"deposit"===e||"principal_protected"===e?{label:"원리금보장",cls:"bg-secondary text-ink-soft"}:{label:e.toUpperCase(),cls:"bg-secondary text-ink-soft"}}function ee(e){let{holdings:t,onChange:s,onAddProducts:i}=e,[o,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),h=async e=>{if(!(!e.productCode||Z.has(e.productType)))try{if("etf"===e.productType){let t=await fetch("/api/get_etf_code?kr_code=".concat(e.productCode)),s=await t.json();if(!t.ok||!s.단축코드)throw Error(s.error||"ETF code not found");m(s.단축코드)}else if("tdf"===e.productType){let t=await fetch("/api/get_tdf_rep_code?kr_code=".concat(e.productCode)),s=await t.json();if(!t.ok||!s.대표표준코드)throw Error(s.error||"TDF code not found");window.open("/tdf/key_information/".concat(s.대표표준코드),"_blank")}}catch(e){console.error("[HoldingsTable] 상품 코드 조회 실패:",e)}},p=t.filter(e=>e.productCode&&!Z.has(e.productType)).map(e=>"".concat(e.productCode,":").concat(e.productType)).sort().join(",");(0,a.useEffect)(()=>{if(!p)return void u(!1);let e=p.split(",").map(e=>{let[t,s]=e.split(":");return{kr_code:t,asset_type:s.toUpperCase()}}),t=!0;return u(!0),(0,V.w)(e).then(e=>{t&&d(e)}).catch(e=>console.error("[HoldingsTable] 종목 메타데이터 조회 실패:",e)).finally(()=>{t&&u(!1)}),()=>{t=!1}},[p]);let f=t.reduce((e,t)=>e+t.marketValue,0),b=(e,n)=>s(t.map(t=>{if(t.id!==e)return t;let s={...t,...n};return s.units>0&&s.unitPrice>0&&(s.marketValue=(0,W.iq)(s.productType,s.unitPrice,s.units)),s})),[v,g]=(0,a.useState)(null),j=(e,t)=>(0,n.jsx)("input",{value:e.units>0?String(e.units):"",onChange:t=>b(e.id,{units:Number(t.target.value.replace(/\D/g,""))||0}),placeholder:"수량","aria-label":"".concat(e.productName," 수량"),className:J(t)}),y=(e,t)=>(0,n.jsx)("input",{inputMode:"decimal",value:(null==v?void 0:v.id)===e.id?v.text:e.unitPrice>
10?e.unitPrice.toLocaleString():"",onFocus:()=>g({id:e.id,text:e.unitPrice>0?String(e.unitPrice):""}),onChange:t=>{let s=t.target.value.replace(/[^\d.]/g,"");g({id:e.id,text:s}),b(e.id,{unitPrice:Number(s)||0})},onBlur:()=>g(null),placeholder:(0,W.JS)(e.productType)?"1000좌당 기준가":"단가",title:(0,W.JS)(e.productType)?"TDF는 1000좌당 기준가로 입력합니다.":void 0,"aria-label":"".concat(e.productName," 취득단가"),className:J(t)}),k=(e,t)=>(0,n.jsx)("input",{value:e.marketValue>0?e.marketValue.toLocaleString():"",onChange:t=>b(e.id,{marketValue:Number(t.target.value.replace(/\D/g,""))||0}),placeholder:"금액",readOnly:e.units>0&&e.unitPrice>0,title:e.units>0&&e.unitPrice>0?(0,W.JS)(e.productType)?"수량 \xd7 1000좌당 기준가 \xf7 1000으로 자동계산":"수량 \xd7 취득단가로 자동계산":void 0,"aria-label":"".concat(e.productName," 평가금액"),className:(0,W.cn)(J(t),e.units>0&&e.unitPrice>0&&"border-transparent bg-transparent text-ink-soft")}),N=e=>{let a;return(!Z.has(e.productType)||!(1>=(a=e.productType,t.filter(e=>e.productType===a).length)))&&(0,n.jsx)("button",{type:"button","aria-label":"".concat(e.productName," 삭제"),onClick:()=>s(t.filter(t=>t.id!==e.id)),className:"text-ink-mute hover:text-debt flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent transition-colors",children:(0,n.jsx)(r.V9D,{icon:l.nJE,size:15})})},w=(e,t,s,a)=>{var l;let r;return Z.has(e.productType)?"-":c&&!t?a?(0,n.jsx)("span",{"aria-label":"수익률 조회 중",className:"border-line border-t-brand-700 ml-auto inline-block h-3 w-3 animate-spin rounded-full border-2"}):"":null==(r=null==t||null==(l=t.vintage_data)?void 0:l[s])||""===r?"-":"".concat(r,"%")};return(0,n.jsxs)("div",{className:"border-line overflow-hidden rounded-xl border",children:[(0,n.jsx)("div",{className:"hidden overflow-x-auto sm:block",children:(0,n.jsxs)("table",{className:"w-full min-w-[1220px] table-fixed border-collapse text-sm",children:[(0,n.jsxs)("colgroup",{children:[(0,n.jsx)("col",{className:"w-[76px]"}),(0,n.jsx)("col",{className:"w-[180px]"}),H.map(e=>(0,n.jsx)("col",{className:"w-20"},e.key)),(0,n.jsx)("col",{className:"w-20"}),(0,n.jsx)("col",{className:"w-32"}),(0,n.jsx)("col",{className:"w-32"}),(0,n.jsx)("col",{className:"w-20"}),(0,n.jsx)("col",{className:"w-10"})]}),(0,n.jsx)("thead",{className:"bg-secondary/60",children:(0,n.jsxs)("tr",{className:"text-ink-mute text-xs",children:[(0,n.jsx)("th",{className:(0,W.cn)("w-[76px] px-3 py-2.5 text-left font-medium",$,"bg-secondary"),children:"분류"}),(0,n.jsx)("th",{className:(0,W.cn)("w-[180px] px-3 py-2.5 text-left font-medium",X,"bg-secondary"),children:"상품명"}),H.map(e=>(0,n.jsxs)("th",{className:"w-20 px-3 py-2.5 text-right font-medium whitespace-nowrap",children:[e.label,"(%)"]},e.key)),(0,n.jsx)("th",{className:"w-20 px-3 py-2.5 text-right font-medium whitespace-nowrap",children:"수량"}),(0,n.jsx)("th",{className:"w-32 px-3 py-2.5 text-right font-medium whitespace-nowrap",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["평가단가(원)",t.some(e=>(0,W.JS)(e.productType))&&(0,n.jsx)(U.A,{})]})}),(0,n.jsx)("th",{className:"w-32 px-3 py-2.5 text-right font-medium whitespace-nowrap",children:"평가금액(원)"}),(0,n.jsx)("th",{className:"w-20 px-3 py-2.5 text-right font-medium whitespace-nowrap",children:"비중(%)"}),(0,n.jsx)("th",{className:"w-10 px-2 py-2.5"})]})}),(0,n.jsxs)("tbody",{className:"divide-line divide-y",children:[t.map((e,t)=>{let s=e.productCode?null==o?void 0:o.get(e.productCode):void 0,a=Q(e.productType),l=t%2==1?"bg-secondary":"bg-white";return(0,n.jsxs)("tr",{className:l,children:[(0,n.jsx)("td",{className:(0,W.cn)("w-[76px] px-3 py-3",$,l),children:(0,n.jsx)("span",{className:(0,W.cn)("rounded px-1.5 py-0.5 text-[10px] font-bold whitespace-nowrap",a.cls),children:a.label})}),(0,n.jsx)("td",{className:(0,W.cn)("text-ink w-[180px] truncate px-3 py-3 font-semibold",X,l,!Z.has(e.productType)&&"hover:text-brand-700 cursor-pointer"),onClick:()=>h(e),children:e.productName}),H.map((t,a)=>(0,n.jsx)("td",{className:"text-ink-soft px-3 py-3 text-right tabular-nums whitespace-nowrap",children:w(e,s,t.key,0===a)},t.key)),(0,n.jsx)("td",{className:"px-3 py-3 text-right",children:Z.has(e.productType)?(0,n.jsx)("span",{className:"text-ink-soft text-sm",children:"-"}):j(e,"w-16")}),(0,n.jsx)("td",{className:"px-3 py-3 text-right",children:Z.has(e.productType)?(0,n.jsx)("span",{className:"text-ink-soft text-sm",children:"-"}):y(e,"w-24")}),(0,n.jsx)("td",{className:"px-3 py-3 text-right",children:k(e,"w-24")}),(0,n.jsx)("td",{className:"text-ink px-3 py-3 text-right tabular-nums",children:f>0&&e.marketValue>0?(e.marketValue/f*100).toFixed(1):"-"}),(0,n.jsx)("td",{className:"px-2 py-3 text-center",children:N(e)})]},e.id)}),0===t.length&&(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:H.length+7,className:"text-ink-mute px-4 py-6 text-center text-sm",children:"아직 종목이 없습니다 — 아래에서 추가해 주세요"})})]})]})}),(0,n.jsxs)("ul",{className:"divide-line m-0 list-none divide-y p-0 sm:hidden",children:[t.map(e=>
1{let t=e.productCode?null==o?void 0:o.get(e.productCode):void 0,s=Q(e.productType),a=Z.has(e.productType);return(0,n.jsxs)("li",{className:"px-4 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:(0,W.cn)("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-bold whitespace-nowrap",s.cls),children:s.label}),(0,n.jsx)("span",{className:(0,W.cn)("text-ink min-w-0 flex-1 truncate text-sm font-semibold",!a&&"cursor-pointer"),onClick:()=>h(e),children:e.productName}),N(e)]}),!a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-ink-mute mt-1.5 flex gap-3 text-xs",children:G.map((s,a)=>(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:[s.label,(0,n.jsx)("span",{className:"text-ink-soft tabular-nums",children:w(e,t,s.key,0===a)})]},s.key))}),(0,n.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[(0,n.jsxs)("label",{className:"text-ink-mute flex flex-col gap-1 text-xs",children:["수량",j(e,"w-full")]}),(0,n.jsxs)("label",{className:"text-ink-mute flex flex-col gap-1 text-xs",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["평가단가(원)",(0,W.JS)(e.productType)&&(0,n.jsx)(U.A,{})]}),y(e,"w-full")]})]})]}),(0,n.jsxs)("div",{className:"mt-2 flex items-end gap-2",children:[(0,n.jsxs)("label",{className:"text-ink-mute flex flex-1 flex-col gap-1 text-xs",children:["평가금액(원)",k(e,"w-full")]}),(0,n.jsx)("span",{className:"text-ink w-14 pb-1.5 text-right text-sm tabular-nums",children:f>0&&e.marketValue>0?"".concat((e.marketValue/f*100).toFixed(1),"%"):"-"})]})]},e.id)}),0===t.length&&(0,n.jsx)("li",{className:"text-ink-mute px-4 py-6 text-center text-sm",children:"아직 종목이 없습니다 — 아래에서 추가해 주세요"})]}),(0,n.jsxs)("div",{className:"border-line flex flex-wrap items-center justify-between gap-2 border-t px-4 py-2.5",children:[(0,n.jsx)("div",{className:"flex gap-1",children:(0,n.jsxs)("button",{type:"button",onClick:i,className:"text-brand-700 hover:bg-brand-700/5 flex cursor-pointer items-center gap-1 rounded-md border-0 bg-transparent px-2 py-1.5 text-sm font-semibold transition-colors",children:[(0,n.jsx)(r.V9D,{icon:l.Y$g,size:13}),"종목 추가"]})}),(0,n.jsxs)("span",{className:"text-ink text-sm font-bold tabular-nums",children:["합계 ",(0,W.Xk)(f)]})]}),(0,n.jsx)(q,{isOpen:!!x,onClose:()=>m(null),onConfirm:()=>{x&&(0,K.r)(x),m(null)}})]})}let et=[{value:"securities",label:"증권사"},{value:"bank",label:"은행"},{value:"insurance",label:"보험사"}],es=[{value:"general",label:"일반형 (비과세 200만)"},{value:"preferential",label:"서민\xb7농어민형 (비과세 400만)"}],en=[{value:"national_pension",label:"국민연금"},{value:"occupational_pension",label:"직역연금"},{value:"dc",label:"DC"},{value:"severance",label:"퇴직금"},{value:"irp",label:"IRP"},{value:"pension_savings",label:"연금저축"},{value:"pension_insurance",label:"연금저축보험"},{value:"cma",label:"입출금\xb7CMA"},{value:"general",label:"일반 투자계좌"},{value:"isa",label:"ISA"},{value:"savings",label:"예금\xb7적금"}],ea=[{value:"납입 중",label:"납입 중"},{value:"납입 완료\xb7개시 전",label:"납입 완료\xb7개시 전"},{value:"수령 중",label:"수령 중"}],el=[{value:"종신",label:"종신"},{value:"확정기간",label:"확정기간"}],er=[{value:"공무원",label:"공무원"},{value:"사학",label:"사학"},{value:"군인",label:"군인"},{value:"기타",label:"기타"}],ei=[{value:"고정",label:"고정"},{value:"물가연동",label:"물가연동"}],eo=[{value:"급여 연동",label:"급여 연동"},{value:"직접입력",label:"직접입력"}],ed=[{value:"본인",label:"본인"},{value:"배우자",label:"배우자"}],ec=[{value:"0",label:"미지정 (총급여 기준 자동)"},{value:"0.132",label:"13.2%"},{value:"0.165",label:"16.5%"}],eu=new Set(["pension_savings","irp","dc"]),ex=new Set(["pension_savings","irp"]);function em(e){return!!ex.has(eg(e.accountType))&&"detail"===e.inputMode&&Math.abs(e.taxExempt+e.taxable+e.deferred-ev(e.holdings))>=1e4}let eh=new Set(["severance"]),ep=new Set(["national_pension","occupational_pension"]),ef=new Set(["irp","dc","pension_savings"]);function eb(e){return eu.has(e)}function ev(e){return e.reduce((e,t)=>
1e+t.marketValue,0)}function eg(e){return"db"===e||"severance_pay"===e?"severance":en.some(t=>t.value===e)?e:"general"}let ej={national_pension:"예: 국민연금",occupational_pension:"예: 공무원연금",dc:"예:DC",severance:"예: 퇴직금",irp:"예: OO증권 IRP",pension_savings:"예: OO증권 연금저축",pension_insurance:"예: OO생명 연금저축보험",cma:"예: OO투자증권 CMA",general:"예: OO증권 일반계좌",isa:"예: OO투자증권 ISA",savings:"예: OO은행 정기예금"};function ey(e){var t,s;let n=eg(e);return null!=(s=null==(t=en.find(e=>e.value===n))?void 0:t.label)?s:String(e)}function ek(e){let t=ey(e.accountType);if("irp"===eg(e.accountType)&&e.irpProvider){var s;let n=null==(s=et.find(t=>t.value===e.irpProvider))?void 0:s.label;if(n)return"".concat(t," \xb7 ").concat(n)}return t}function eN(e){var t,s;return null!=(s=null==(t=ed.find(t=>t.value===e))?void 0:t.label)?s:e}function ew(e){return e?ed:ed.filter(e=>"본인"===e.value)}function e_(e){let t=eg(e.accountType);return eh.has(t)||ep.has(t)||"pension_insurance"===t?0:"detail"===e.inputMode?ev(e.holdings):ex.has(t)?e.taxExempt+e.taxable+e.deferred:e.balance}function eS(e){return{id:e,name:"",accountType:"general",irpProvider:"",isaType:"",owner:"본인",balance:0,inputMode:"simple",holdings:[],taxExempt:0,taxable:0,deferred:0,retirementTax:0,monthlyContribution:0,isReceivingPension:!1,receiptYears:0,hireYear:2020,linkedIncomeId:"",severanceEstimateMode:"급여 연동",severanceEstimateAmount:0,monthlyPension:0,nationalClaimAge:0,pensionEscalation:"물가연동",occupationalKind:"공무원",insuranceStatus:"납입 중",monthlyPremium:0,premiumEndYear:2035,insuranceClaimAge:65,monthlyInsuranceBenefit:0,insurancePayoutType:"확정기간",insurancePayoutYears:10,insuranceBenefitStartYear:2035,insuranceEscalation:"고정",insuranceStopMode:"유지",insuranceStopYear:0,taxCreditRate:0,annualReturnRate:0,pensionStartAge:0}}function eC(e){let t=[];return e.some(e=>"cash"===e.productType)||t.push({id:(0,W.gY)("h"),productType:"cash",productCode:"",productName:"현금\xb7예수금",units:0,unitPrice:0,marketValue:0}),e.some(e=>"principal_protected"===e.productType)||t.push({id:(0,W.gY)("h"),productType:"principal_protected",productCode:"principal_protected",productName:"원리금보장",units:0,unitPrice:0,marketValue:0}),t.length>0?[...e,...t]:e}function eT(e){if("detail"===e.inputMode)return e;if(0===e.holdings.length){let t=ex.has(eg(e.accountType))?e.taxExempt+e.taxable+e.deferred:e.balance;return{...e,inputMode:"detail",holdings:eC(t>0?[{id:(0,W.gY)("h"),productType:"cash",productCode:"",productName:"현금\xb7예수금",units:0,unitPrice:0,marketValue:t}]:[])}}return{...e,inputMode:"detail"}}let eE=3,eA=1;function eF(e){var t,s,i,x,m,h,p,f,b;let{value:v,onChange:j,onCancel:k,onSave:_,saveState:S,accountUsageByOwner:C,factsOnly:T=!1,factsReadOnly:E=!1,fpLocked:A=!1,salaryIncomes:F=[],planningAsCouple:D=!0,onGoToIncome:M,hideInputModeToggle:P=!1,saveLabel:L,section:R}=e,z={...v,accountType:eg(v.accountType)},B=ex.has(z.accountType),I=eu.has(z.accountType),Y=A&&eb(z.accountType),U=E||Y,K="irp"===z.accountType,q="isa"===z.accountType,H="dc"===z.accountType,G=eh.has(z.accountType),J=ep.has(z.accountType),$="pension_insurance"===z.accountType,X=ef.has(z.accountType),Q=X&&"detail"===z.inputMode,ed=!R||"basic"===R,ek=!R||"balance"===R,[eS,eF]=(0,a.useState)(!1),[eD,eM]=(0,a.useState)(!1),[eP,eL]=(0,a.useState)(!1),[eR,ez]=(0,a.useState)(!1),[eB,eI]=(0,a.useState)(!1),{unit:eY}=(0,c.UG)(),eO=null==C?void 0:C[z.owner],eW=(null!=(x=null==eO?void 0:eO.irpCount)?x:0)>=eE,eU=(null!=(m=null==eO?void 0:eO.dcCount)?m:0)>=eA,eV=new Set(null!=(h=null==eO?void 0:eO.irpProviders)?h:[]),eK=et.map(e=>e.value&&eV.has(e.value)&&e.value!==z.irpProvider?{...e,disabled:!0,badge:"등록됨"}:e),eq=en.map(e=>"irp"===e.value&&!K&&eW?{...e,disabled:!0,badge:"".concat(eE,"개 등록됨 (최대)")}:"dc"===e.value&&!H&&eU?{...e,disabled:!0,badge:"등록됨 (최대 1개)"}:e),eH=ew(D),eG=F.filter(e=>e.owner===z.owner).map(e=>({value:e.id,label:e.name.trim()||"이름 없음"})),eJ=e=>j({...z,...e}),e$=e=>{let t=[...e.filter(e=>!Z.has(e.productType)),...e.filter(e=>Z.has(e.productType))];eJ({holdings:t,balance:ev(t)})};(0,a.useEffect)(()=>
1{if(!Q)return;let e=eC(z.holdings);e!==z.holdings&&e$(e)},[Q,z.holdings]);let eX=e=>{if(e!==z.inputMode){if("detail"===e)return void j(eT(z));eJ({inputMode:e,balance:ev(z.holdings)})}},eZ=(0,w.A)(e=>e.selectedProducts),eQ=(0,w.A)(e=>e.clearProducts);(0,a.useEffect)(()=>{if(0===eZ.length)return;let e=eZ.map(e=>({code:e.kr_code,name:e.fund_name||e.kr_code,assetType:"TDF"===e.asset_type?"TDF":"ETF"}));eQ(),(0,V.w)(e.map(e=>({kr_code:e.code,asset_type:e.assetType}))).then(t=>{e0(e.map(e=>{var s,n;return{...e,name:e.name!==e.code?e.name:null!=(n=null==(s=t.get(e.code))?void 0:s.fund_name)?n:e.name}}))}).catch(t=>{console.error("[FinancialAssetForm] 종목 메타데이터 조회 실패:",t),e0(e)})},[eZ]);let e0=e=>{let t=new Set(z.holdings.map(e=>e.productCode)),s=e.filter(e=>!t.has(e.code)).map(e=>({id:(0,W.gY)("h"),productType:"TDF"===e.assetType?"tdf":"etf",productCode:e.code,productName:e.name,units:0,unitPrice:0,marketValue:0}));s.length>0&&e$([...z.holdings,...s])},e1=e=>{let t=F.some(t=>t.id===z.linkedIncomeId&&t.owner===e);eJ({owner:e,linkedIncomeId:t?z.linkedIncomeId:""})};return(0,n.jsxs)("div",{children:[(0,n.jsxs)(c.um,{title:v.name.trim()||ey(z.accountType),icon:d.q[z.accountType].icon,iconBg:d.q[z.accountType].bg,onCancel:k,onSave:_,saveState:S,saveLabel:L,hideBottomActions:!0,headerLeft:(0,n.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:X&&!U&&!P&&(0,n.jsx)("div",{className:"bg-secondary flex w-fit rounded-lg p-0.5",children:[{value:"simple",label:"간편입력"},{value:"detail",label:"상세입력"},{value:"snapshot",label:"스냅샷으로 입력"}].map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>{if("snapshot"===e.value){eX("detail"),eI(!0);return}eX(e.value)},"aria-pressed":"snapshot"!==e.value&&z.inputMode===e.value,className:(0,W.cn)("cursor-pointer rounded-md border-0 px-3 py-1.5 text-sm font-medium transition-all","snapshot"!==e.value&&z.inputMode===e.value?"text-ink bg-white shadow-sm":"text-ink-mute hover:text-ink-soft bg-transparent"),children:e.label},e.value))})}),fieldsDisabled:U,fieldsDisabledNote:Y?void 0:"가구 공통 자산 — 이 플랜에서는 아래 계획 옵션만 바꿀 수 있어요.",editHref:Y?void 0:"/today?tab=accounts&edit=".concat(v.id),children:[ed&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.eW,{label:"이름",value:v.name,onChange:e=>eJ({name:e}),placeholder:ej[eg(z.accountType)]}),(0,n.jsx)(c.LS,{label:"유형",value:z.accountType,onChange:e=>eJ({accountType:e,..."severance"!==e?{linkedIncomeId:""}:{},..."irp"!==e?{irpProvider:""}:{},..."isa"!==e?{isaType:""}:{},...ef.has(e)?{}:{inputMode:"simple"}}),options:eq}),K&&(0,n.jsx)(c.LS,{label:"가입 기관",value:z.irpProvider,onChange:e=>eJ({irpProvider:e}),options:eK}),D&&(0,n.jsx)(c.LS,{label:"소유자",value:z.owner,onChange:e=>e1(e),options:eH})]}),q&&(0,n.jsx)(c.LS,{label:"ISA 유형",value:z.isaType,onChange:e=>eJ({isaType:e}),options:[{value:"",label:"미지정 (일반형으로 계산)"},...es]}),D&&(0,n.jsx)(c.LS,{label:"소유자",value:z.owner,onChange:e=>e1(e),options:eH}),ek?$?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.LS,{label:"계약 상태",value:v.insuranceStatus,onChange:e=>eJ({insuranceStatus:e}),options:ea}),"납입 중"===v.insuranceStatus&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.L,{label:"월 보험료",value:v.monthlyPremium,onChange:e=>eJ({monthlyPremium:e}),unit:eY}),(0,n.jsx)(c.eW,{label:"납입 종료연도",value:v.premiumEndYear?String(v.premiumEndYear):"",onChange:e=>eJ({premiumEndYear:Number(e.replace(/\D/g,""))||0}),placeholder:"예: 2035"})]}),"수령 중"!==v.insuranceStatus&&(0,n.jsx)(c.eW,{label:"연금개시 나이 (계약)",value:v.insuranceClaimAge?String(v.insuranceClaimAge):"",onChange:e=>eJ({insuranceClaimAge:Number(e.replace(/\D/g,""))||0}),placeholder:"예: 65"}),"수령 중"===v.insuranceStatus&&(0,n.jsx)(c.eW,{label:"수령 시작연도",value:v.insuranceBenefitStartYear?String(v.insuranceBenefitStartYear):"",onChange:e=>eJ({insuranceBenefitStartYear:Number(e.replace(/\D/g,""))||0}),placeholder:"예: 2035"}),(0,n.jsx)(c.L,{label:"수령 중"===v.insuranceStatus?"월 수령액":"예상 월 연금액",value:v.monthlyInsuranceBenefit,onChange:e=>eJ({monthlyInsuranceBenefit:e}),unit:eY})]}
1):J?(0,n.jsxs)(n.Fragment,{children:["occupational_pension"===z.accountType&&(0,n.jsx)(c.LS,{label:"직역연금 종류",value:v.occupationalKind,onChange:e=>eJ({occupationalKind:e}),options:er}),"national_pension"===z.accountType&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.eW,{label:"수령개시 나이",value:v.nationalClaimAge?String(v.nationalClaimAge):"",onChange:e=>eJ({nationalClaimAge:Number(e.replace(/\D/g,""))||0}),placeholder:"자동 (법정 지급개시연령)"}),(0,n.jsxs)(o(),{href:"/explorer",className:"border-brand-700/20 bg-brand-700/[0.06] hover:bg-brand-700/[0.1] flex items-center gap-3 rounded-xl border p-3.5 transition-colors sm:col-span-2",children:[(0,n.jsx)("span",{className:"bg-brand-700 flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white",children:(0,n.jsx)(r.V9D,{icon:l.si3,size:18})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"국민연금을 수령하는 다른 방법이 있어요."}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-brand-700 font-bold",children:"미리받기와 나중에 받기"})]}),(0,n.jsx)(r.V9D,{icon:l.tX2,size:16,className:"text-brand-700 -rotate-90 shrink-0"})]})]}),(0,n.jsx)(c.L,{label:"월 수령액 (오늘 조회값)",value:v.monthlyPension,onChange:e=>eJ({monthlyPension:e}),unit:eY}),(0,n.jsxs)("div",{className:"border-mint/25 bg-mint/[0.08] rounded-xl border p-3.5 sm:col-span-2",children:[(0,n.jsx)("span",{className:"text-ink mb-3 block text-sm font-bold",children:"내 예상 수령액을 먼저 확인하고 싶다면"}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,n.jsxs)("a",{href:"https://csa.nps.or.kr/ohkd/ntpsidnty/anpninq/UHKD7101M0.do",target:"_blank",rel:"noopener noreferrer",className:"hover:bg-mint/[0.14] flex flex-1 items-center gap-3 rounded-lg p-2 transition-colors",children:[(0,n.jsx)("span",{className:"bg-mint flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white",children:(0,n.jsx)(r.V9D,{icon:l.Q4Z,size:16})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("span",{className:"text-ink font-semibold",children:"국민연금공단"}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-ink-mute",children:"내 연금 예상액 조회"})]})]}),(0,n.jsxs)("a",{href:"https://www.fss.or.kr/fss/lifeplan/anntyLogin/list.do?menuNo=200945",target:"_blank",rel:"noopener noreferrer",className:"hover:bg-mint/[0.14] flex flex-1 items-center gap-3 rounded-lg p-2 transition-colors",children:[(0,n.jsx)("span",{className:"bg-mint flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white",children:(0,n.jsx)(r.V9D,{icon:l.Q4Z,size:16})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("span",{className:"text-ink font-semibold",children:"통합연금포털"}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-ink-mute",children:"금융감독
1원에서 연금 내역 조회"})]})]})]})]})]}):G?(0,n.jsx)(c.eW,{label:"입사연도",value:v.hireYear?String(v.hireYear):"",onChange:e=>eJ({hireYear:Number(e.replace(/\D/g,""))||0}),placeholder:"예: 2001"}):B||Q?(0,n.jsx)(c.DP,{label:Q?"잔액 (".concat(eY,", 자동=종목합)"):"잔액 (".concat(eY,", 자동=재원합)"),children:(0,n.jsxs)("span",{className:"tabular-nums",children:[(0,c.tL)(e_(z),eY)||"0",(0,n.jsx)("span",{className:"text-ink-mute ml-1 text-sm font-medium",children:eY})]})}):(0,n.jsx)(c.L,{label:"잔액",value:v.balance,onChange:e=>eJ({balance:e}),unit:eY}):null,ed&&!$&&!J&&!G&&(0,n.jsx)(c.vQ,{label:"축적기 예상 수익률 (미지정 시 공통값)",value:Math.round(1e3*v.annualReturnRate)/10,onChange:e=>eJ({annualReturnRate:e/100}),suffix:"%"}),(!R||"holdings"===R)&&Q&&(0,n.jsxs)("div",{className:"sm:col-span-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>eI(!0),className:"border-brand-700/20 bg-brand-700/[0.06] hover:bg-brand-700/[0.1] mb-3 flex w-full cursor-pointer items-center gap-3 rounded-xl border p-3.5 text-left transition-colors",children:[(0,n.jsx)("span",{className:"bg-brand-700 flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white",children:(0,n.jsx)(r.V9D,{icon:l.I0v,size:18})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("span",{className:"text-ink font-bold",children:"종목을 하나씩 입력하기 번거로우신가요?"}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-ink-mute",children:"증권사\xb7은행 앱 계좌 화면을 캡처해서 올리면 종목을 자동으로 채워드려요"})]})]}),(0,n.jsx)(ee,{holdings:z.holdings,onChange:e$,onAddProducts:()=>eF(!0)})]}),ek&&I&&!H&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.L,{label:"비과세",value:v.taxExempt,onChange:e=>eJ({taxExempt:e}),unit:eY}),(0,n.jsx)(c.L,{label:"과세대상",value:v.taxable,onChange:e=>eJ({taxable:e}),unit:eY}),K&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.L,{label:"퇴직원천",value:v.deferred,onChange:e=>eJ({deferred:e}),unit:eY}),(0,n.jsx)(c.L,{label:"퇴직세 원세액",value:v.retirementTax,onChange:e=>eJ({retirementTax:e}),unit:eY})]}),!U&&em(z)&&(0,n.jsxs)("div",{className:"border-debt/30 bg-debt/5 rounded-xl border p-4 sm:col-span-2",children:[(0,n.jsx)("p",{className:"text-debt text-sm font-bold",children:"종목 합계와 재원 구분 합계가 달라요 — 일치해야 저장할 수 있어요"}),(0,n.jsxs)("p",{className:"text-ink-soft mt-1.5 text-xs leading-relaxed",children:["종목 합계"," ",(0,n.jsxs)("span",{className:"text-ink font-semibold tabular-nums",children:[(0,c.tL)(ev(z.holdings),eY)||0,eY]})," ","/ 재원 구분 합계"," ",(0,n.jsxs)("span",{className:"text-ink font-semibold tabular-nums",children:[(0,c.tL)(z.taxExempt+z.taxable+z.deferred,eY)||0,eY]})," ","— 비과세\xb7과세대상",K?"\xb7퇴직원천":""," 합이 종목 합계와 같도록 맞춰주세요. 세금 계산은 재원 구분을 기준으로 합니다."]})]})]}),ed&&I&&(0,n.jsx)(c.L,{label:"월 납입액",value:v.monthlyContribution,onChange:e=>eJ({monthlyContribution:e}),unit:eY})]}),!T&&ek&&(I&&!H||G||J||$)?(0,n.jsx)("fieldset",{disabled:Y,className:"m-0 min-w-0 border-0 p-0",children:(0,n.jsxs)(c.Jf,{children:[I&&!H&&(0,n.jsxs)(c.X1,{icon:l.si3,title:"연금 수령 계획",preview:v.isReceivingPension?"수령 ".concat(v.receiptYears||0,"년차"):"수령 전",children:[(0,n.jsx)(c.LS,{label:"연금 수령 여부",value:v.isReceivingPension?"수령 중":"수령 전",onChange:e=>eJ({isReceivingPension:"수령 중"===e,..."수령 중"!==e?{receiptYears:0}:{}}),options:[{value:"수령 전",label:"수령 전"},{value:"수령 중",label:"수령 중"}]}),v.isReceivingPension&&(0,n.jsx)(c.eW,{label:"수령연차",value:v.receiptYears?String(v.receiptYears):"",onChange:e=>eJ({receiptYears:Number(e.replace(/\D/g,""))||0}),placeholder:"예: 3"})]}),I&&!H&&(0,n.jsx)(c.X1,{icon:l.uaR,title:"세액공제율",preview:null!=(p=null==(t=ec.find(e=>e.value===String(v.taxCreditRate)))?void 0:t.label)?p:"미지정 (총급여 기준 자동)",children:(0,n.jsx)(c.LS,{label:"세액공제율",value:String(v.taxCreditRate),onChange:e=>eJ({taxCreditRate:Number(e)}),options:ec})}),G&&(0,n.jsxs)(c.X1,{icon:l.ZN4,title:"퇴직급여 산정",preview:"급여 연동"===z.severanceEstimateMode?null!=(f=null==(s=eG.find(e=>e.value===z.linkedIncomeId))?void 0:s.label)?f:"급여 선택":"직접입력 ".concat((0,c.tL)(z.severanceEstimateAmount,eY)||0).concat(eY),children:[(0,n.jsx)(c.LS,{label:"산정 방식",value:z.severanceEstimateMode,onChange:e=>eJ({severanceEstimateMode:e,..."급여 연동"!==e?{linkedIncomeId:""}:{}}),options:eo}),"급여 연동"===z.severanceEstimateMode?eG.length>0?(0,n.jsx)(c.LS,{label:"연동 급여",value:z.linkedIncomeId,onChange:e=>eJ({linkedIncomeId:e}),options:[{value:"",label:"선택 안 함"},...eG]}):(0,n.jsx)(c.DP,{label:"연동 급여",children:M?(0,n.jsxs)("button",{type:"button",onClick:M,className:"text-brand text-sm font-normal underline underline-offset-2",children:[eN(z.owner)," 소득이 없습니다 — 소득 등록하러 가기"]}):(0,n.jsxs)("span",{className:"text-ink-mute text-sm font-normal",children:[eN(z.owner)," 소득이 없습니다 — 먼저 소득을 등록해 주세요"]})}
1):(0,n.jsx)(c.L,{label:"퇴직 시 예상 퇴직급여",value:z.severanceEstimateAmount,onChange:e=>eJ({severanceEstimateAmount:e}),unit:eY})]}),"occupational_pension"===z.accountType&&(0,n.jsx)(c.X1,{icon:l.Ani,title:"인상 방식",preview:v.pensionEscalation,children:(0,n.jsx)(c.LS,{label:"인상방식",value:v.pensionEscalation,onChange:e=>eJ({pensionEscalation:e}),options:ei})}),$&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(c.X1,{icon:l.uaR,title:"수령형태\xb7인상방식",preview:"확정기간"===v.insurancePayoutType?"확정기간 ".concat(v.insurancePayoutYears||0,"년 \xb7 ").concat(v.insuranceEscalation):"종신 \xb7 ".concat(v.insuranceEscalation),children:[(0,n.jsx)(c.LS,{label:"수령형태",value:v.insurancePayoutType,onChange:e=>eJ({insurancePayoutType:e}),options:el}),"확정기간"===v.insurancePayoutType&&(0,n.jsx)(c.eW,{label:"지급 기간",value:v.insurancePayoutYears?String(v.insurancePayoutYears):"",onChange:e=>eJ({insurancePayoutYears:Number(e.replace(/\D/g,""))||0}),suffix:"년"}),(0,n.jsx)(c.LS,{label:"인상방식",value:v.insuranceEscalation,onChange:e=>eJ({insuranceEscalation:e}),options:ei})]}),(0,n.jsx)(c.X1,{icon:l.uaR,title:"세액공제율",preview:null!=(b=null==(i=ec.find(e=>e.value===String(v.taxCreditRate)))?void 0:i.label)?b:"미지정 (총급여 기준 자동)",children:(0,n.jsx)(c.LS,{label:"세액공제율",value:String(v.taxCreditRate),onChange:e=>eJ({taxCreditRate:Number(e)}),options:ec})})]})]})}):null,(0,n.jsx)("div",{className:"mt-6 flex justify-end",children:Y?(0,n.jsx)("button",{type:"button",onClick:k,className:"border-brand-700 text-brand-700 hover:bg-brand-700/5 cursor-pointer rounded-lg border px-4 py-2 text-sm font-semibold transition-colors",children:"닫기"}):(0,n.jsx)(c.zt,{onCancel:k,onSave:_,saveState:S,saveLabel:L})}),(0,n.jsx)(u._,{open:eS,onClose:()=>eF(!1),onSelect:e=>{"ETF"===e?eL(!0):"TDF"===e?ez(!0):eM(!0)}}),(0,n.jsx)(N,{open:eD,onClose:()=>eM(!1),pensionScope:"pension_savings"===z.accountType?"personal_pension":"retirement_pension"}),(0,n.jsx)(y,{open:eP,onClose:()=>eL(!1)}),(0,n.jsx)(g,{open:eR,onClose:()=>ez(!1)}),(0,n.jsx)(O,{open:eB,onClose:()=>eI(!1),universe:"pension_savings"===z.accountType?"personal_pension":"retirement_pension",onAdd:e=>{let t=new Set(z.holdings.map(e=>
1e.productCode).filter(Boolean)),s=e.filter(e=>!e.productCode||!t.has(e.productCode)).map(e=>{let t="TDF"===e.assetType?"tdf":"ETF"===e.assetType?"etf":"cash";return{id:(0,W.gY)("h"),productType:t,productCode:e.productCode,productName:e.productName,units:e.units,unitPrice:e.marketValue>0?(0,W.hG)(t,e.marketValue,e.units):0,marketValue:e.marketValue}});s.length>0&&e$([...z.holdings,...s])}})]})}},49661:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>u,Rw:()=>c});var n=s(70127),a=s(70567),l=s(86057),r=s(9721),i=s(93374),o=s(19450);let d=e=>{let{dropdownRef:t,setDropdownOpen:s,selectedAccountType:a,DropdownOpen:l,setSelectedAccountType:i}=e;return(0,n.jsxs)("div",{className:"relative w-full md:w-auto",ref:t,children:[(0,n.jsxs)("button",{onClick:()=>s(!l),className:"w-full md:min-w-[170px] h-[45px] md:h-auto border border-line bg-white text-ink text-sm md:text-base py-3 px-4 flex items-center justify-center gap-2 md:gap-4 rounded-lg",children:[a?"TDF"===a&&"TDF"||"ETF"===a&&"ETF":"계정 유형 선택",(0,n.jsx)(r.pte,{})]}),l&&(0,n.jsx)("div",{className:"absolute left-0 md:right-0 top-full mt-1 flex flex-col gap-2 py-2 justify-center items-center w-full md:min-w-[150px] border border-line bg-white z-[9999] rounded-lg shadow-lg",children:["TDF","ETF"].map((e,t)=>(0,n.jsxs)("div",{className:"flex justify-start w-full px-3 cursor-pointer hover:bg-secondary/60",onClick:()=>{s(!1),i(e)},children:[(0,n.jsx)("input",{type:"checkbox",className:"cursor-pointer accent-brand-700",id:"option-".concat(t),checked:a===e,onChange:()=>{s(!1),i(e)}}),(0,n.jsxs)("span",{className:"text-ink-soft text-sm md:text-base font-normal ms-2",children:["TDF"===e&&"TDF","ETF"===e&&"ETF"]})]},t))})]})},c=e=>{let{setShowConfirmModal:t,handleFinalSubmit:s,selectedTicker:a}=e;return(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity flex items-center justify-center z-50",children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-6 w-[90%] max-w-md",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-ink mb-4",children:"종목 추가"}),(0,n.jsx)("p",{className:"text-ink-soft mb-6",children:"추가하시겠습니까?"}),(0,n.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,n.jsx)("button",{onClick:()=>t(!1),className:"px-4 py-2 bg-secondary text-ink-soft hover:text-ink text-sm font-medium rounded-lg",children:"아니오"}),(0,n.jsx)("button",{onClick:()=>{t(!1),s(a)},className:"px-4 py-2 bg-ink hover:bg-ink/90 text-white text-sm font-semibold rounded-lg",children:"네"})]})]})})},u=e=>
1{let{query:t,setQuery:s,setShowConfirmModal:r,selectedTicker:u,setSelectedTicker:x,DropdownOpen:m,setDropdownOpen:h,dropdownRef:p,handleFinalSubmit:f,pensionScope:b}=e,v=(0,a.useRef)(null),g=(0,a.useRef)(null),[j,y]=(0,a.useState)([]),[k,N]=(0,a.useState)(!1),[w,_]=(0,a.useState)(null),[S,C]=(0,a.useState)(!1),[T,E]=(0,a.useState)(null),[A,F]=(0,a.useState)("ETF"),[D,M]=(0,a.useState)(!1),P=async e=>{if(!e.trim()){y([]),N(!1);return}C(!0),E(null);let t=(0,o.o)(b);try{var s;let n=await fetch("/api/search-snapshot-suggestions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e,assetType:A,universe:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||"Failed to fetch suggestions")}let a=await n.json();y(a.suggestions||[]),N((null==(s=a.suggestions)?void 0:s.length)>0),a.message?E(a.message):E(null)}catch(e){E(e.message),y([]),N(!1)}finally{C(!1)}},L=e=>{let t=e.short_name||e.name;x(e),s(t),N(!1)};return(0,a.useEffect)(()=>()=>{w&&clearTimeout(w)},[w]),(0,a.useEffect)(()=>{k&&g.current&&(g.current.scrollTop=0)},[j,k]),(0,n.jsxs)("div",{className:"w-full flex md:flex-row flex-col gap-3 mb-4",children:[(0,n.jsx)(d,{dropdownRef:p,selectedAccountType:A,setSelectedAccountType:F,DropdownOpen:m,setDropdownOpen:h}),(0,n.jsxs)("div",{className:"w-full relative",ref:v,children:[(0,n.jsxs)("div",{className:"px-3 md:px-[10px] py-2 md:py-0 w-full border border-line focus-within:border-brand-700/60 bg-white flex items-center gap-2 ".concat(k?"rounded-tl-[8px] rounded-tr-[8px]":"rounded-[8px]"),children:[(0,n.jsx)(l.Xj1,{className:"text-ink-mute text-[18px] md:text-[20px] flex-shrink-0"}),(0,n.jsx)("input",{type:"text",value:t,onChange:e=>{let t=e.target.value;s(t),x(null),w&&clearTimeout(w),_(setTimeout(()=>P(t),300))},onKeyDown:e=>{"Enter"===e.key&&(u?f?M(!0):r&&r(!0):j.length>0&&L(j[0]))},placeholder:"종목명을 검색하세요",className:"px-2 py-2 md:px-[13px] md:py-[10px] w-full outline-none text-sm md:text-base"}),S?(0,n.jsx)("span",{className:"text-xs md:text-sm text-ink-mute whitespace-nowrap",children:"검색 중..."}):(0,n.jsxs)("button",{onClick:()=>{u&&(f?M(!0):r&&r(!0))},disabled:!u,className:"\n                px-3 py-2 md:px-4 md:py-2\n                rounded-lg\n                text-sm md:text-base\n                font-semibold\n                flex items-center gap-1 md:gap-2\n                transition-all duration-200\n                min-w-[85px] md:min-w-[100px]\n                whitespace-nowrap\n                flex-shrink-0\n                ".concat(u?"bg-ink hover:bg-ink/90 text-white cursor-pointer":"bg-secondary text-ink-mute cursor-not-allowed","\n              "),children:[(0,n.jsx)(i.YHj,{className:"text-lg md:text-xl flex-shrink-0"}),(0,n.jsx)("span",{children:"추가"})]})]}),T&&(0,n.jsxs)("div",{className:"text-debt text-sm mt-1",children:["오류: ",T]}),k&&(0,n.jsx)("ul",{ref:g,className:"absolute top-full left-0 w-full border-b border-l border-r border-line mt-0 shadow-lg max-h-[200px] md:max-h-[250px] bg-white overflow-y-auto z-50 rounded-bl-[8px] rounded-br-[8px]",children:j.length>0?j.map((e,t)=>(0,n.jsx)("li",{className:"\n                    px-4 py-3 cursor-pointer text-[14px] border-b border-line last:border-b-0\n                    transition-all duration-200\n                    ".concat((null==u?void 0:u.standard_code)===e.standard_code?"bg-secondary border-l-4 border-l-brand-700 text-brand-700 font-medium":"hover:bg-secondary/60 text-ink-soft hover:text-ink","\n                  "),onClick:()=>L(e),children:(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("span",{className:"font-medium",children:e.short_name?e.short_name:e.name}),e.asset_type&&(0,n.jsx)("span",{className:"text-xs text-ink-mute mt-1",children:e.asset_type})]})},t)):(0,n.jsx)("li",{className:"px-4 py-4 text-ink-soft text-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("span",{className:"text-sm",children:"검색 결과가 없습니다"}),(0,n.jsx)("span",{className:"text-xs text-ink-mute",children:"다른 키워드로 검색해보세요"})]})})})]}),D&&f&&(0,n.jsx)(c,{setShowConfirmModal:M,handleFinalSubmit:f,selectedTicker:u})]})}},52481:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>m,EE:()=>o,HO:()=>c,Y1:()=>x,fn:()=>d});var n=s(70127),a=s(76003),l=s(21757),r=s(99736),i=s(48858);let o=[{value:"고정",label:"고정"},{value:"변동",label:"변동"}],d=[{value:"원리금균등상환",label:"원리금균등상환"},{value:"원금균등상환",label:"원금균등상환"},{value:"만기일시상환",label:"만기일시상환"},{value:"체증식상환",label:"체증식상환"}];function c(e){return{id:e,name:"",owner:"본인",marketValue:0,purchasePrice:0,propertyTaxBase:0,status:"완전 보유",loanBalance:0,loanRate:0,rateType:"고정",repayment:"원리금균등상환",graceMonths:0,termYears:20}}let u=[{value:"완전 보유",label:"완전 보유"},{value:"대출 있음",label:"대출 있음"}];function x(e){var t,s;return null!=(s=null==(t=u.find(t=>t.value===e))?void 0:t.label)?s:e}function m(e){let{value:t,onChange:s,onCancel:c,onSave:x,factsReadOnly:m=!1,planningAsCouple:h=!0}=e,p="대출 있음"===t.status,f=e=>s({...t,...e}),b=(0,i.tK)(h),{unit:v}=(0,r.UG)("억");return(0,n.jsxs)(r.um,{title:t.name.trim()||"새 부동산",icon:a.L6f,iconBg:"#8B6DB8",onCancel:c,onSave:x,fieldsDisabled:m,fieldsDisabledNote:"가구 공통 자산 —",editHref:"/today?tab=property&edit=".concat(t.id),children:[(0,n.jsx)(r.eW,{label:"이름",value:t.name,onChange:e=>f({name:e}),placeholder:"예: OO 아파트"}),h&&(0,n.jsx)(r.LS,{label:"소유자",value:t.owner,onChange:e=>f({owner:e}),options:b}),(0,n.jsx)(r.L,{label:"시세",value:t.marketValue,onChange:e=>f({marketValue:e}),unit:v}),(0,n.jsxs)("a",{href:"https://fin.land.naver.com/",target:"_blank",rel:"noopener noreferrer",className:"border-mint/25 bg-mint/[0.08] hover:bg-mint/[0.14] flex items-center gap-3 rounded-xl border p-3.5 transition-colors sm:col-span-2",children:[(0,n.jsx)("span",{className:"bg-mint flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white",children:(0,n.jsx)(l.V9D,{icon:a.Q4Z,size:16})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("span",{className:"text-ink font-semibold",children:"보유 중인 부동산의 시세가 궁금하신가요?"}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-ink-mute",children:"내 부동산 시세 확인하기"})]})]}),(0,n.jsx)(r.LS,{label:"보유형태",value:t.status,onChange:e=>f({status:e}),options:u}),(0,n.jsx)(r.L,{label:"재산세 과세표준",value:t.propertyTaxBase,onChange:e=>f({propertyTaxBase:e}),unit:v,placeholder:"재산세 고지서\xb7위택스 확인"}),(0,n.jsxs)("a",{href:"https://www.wetax.go.kr",target:"_blank",rel:"noopener noreferrer",className:"border-brand-700/20 bg-brand-700/[0.06] hover:bg-brand-700/[0.1] flex items-center gap-3 rounded-xl border p-3.5 transition-colors sm:col-span-2",children:[(0,n.jsx)("span",{className:"bg-brand-700 flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white",children:(0,n.jsx)(l.V9D,{icon:a.Q4Z,size:16})}),(0,n.jsxs)("span",{className:"min-w-0 flex-1 text-sm",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"재산세 고지서의 ‘과세표준’ 금액을 입력하세요 — 공시가격\xb7시세\xb7납부세액이 아니에요."}),(0,n.jsx)("br",{}),(0,n.jsx)("span",{className:"text-brand-700 font-bold",children:"고지서가 없다면 위택스에서 확인하기 (간편인증 로그인)"})]})]}),p&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.L,{label:"대출 잔액",value:t.loanBalance,onChange:e=>f({loanBalance:e}),unit:v}),(0,n.jsx)(r.vQ,{label:"금리",value:t.loanRate,onChange:e=>f({loanRate:e}),suffix:"%"}
1),(0,n.jsx)(r.LS,{label:"금리유형",value:t.rateType,onChange:e=>f({rateType:e}),options:o}),"만기일시상환"!==t.repayment&&(0,n.jsx)(r.eW,{label:"거치",value:t.graceMonths?String(t.graceMonths):"",onChange:e=>f({graceMonths:Number(e.replace(/\D/g,""))||0}),suffix:"개월"}),(0,n.jsx)(r.eW,{label:"남은 상환기간",value:t.termYears?String(t.termYears):"",onChange:e=>f({termYears:Number(e.replace(/\D/g,""))||0}),suffix:"년"}),(0,n.jsx)(r.LS,{label:"상환방식",value:t.repayment,onChange:e=>f({repayment:e}),options:d})]})]})}},54739:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>B});var n=s(70127),a=s(70567);let l=e=>{let{children:t}=e;return(0,n.jsx)(n.Fragment,{children:t})};var r=s(9638),i=s(30714),o=s(61249),d=s(20665);o.t1.register(o.PP,o.kc,o.FN,o.No,o.hE,o.m_,o.s$,o.dN);let c=e=>{let{type:t,token:s,vintage:l,sameSeriesId:r,setSameSeriesId:o,color:c="#045B62"}=e,[x,m]=(0,a.useState)(null),[h,p]=(0,a.useState)(!0);(0,a.useEffect)(()=>{(async e=>{try{let s=(await i.A.get("".concat("/backend-api","/").concat(t,"_port_stat_2?key=").concat(l),{headers:{Authorization:e}})).data;if(s&&Object.keys(s).length>0){let e=(e=>{let t=[];return Object.keys(e).sort((e,t)=>{let s=parseInt(e,10);return parseInt(t,10)-s}).forEach(s=>{e[s].forEach(e=>{t.push({year:s,주식:parseFloat(e.주식),SameSeriesId:e.SameSeriesId,표준코드:e.표준코드})})}),t})(s);m(e);let t=e[0],n=(null==t?void 0:t.표준코드)||(null==t?void 0:t.SameSeriesId);null!=n&&o(n)}else m(null);p(!1)}catch(e){p(!1),console.log({error:e})}})(s)},[]);let f=window.innerWidth<768,b=(e=>{let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null})(c)||{r:4,g:91,b:98},v=x?{labels:x.map(e=>e.year),datasets:[{label:"주식 비중",data:x.map(e=>e.주식),borderColor:c,backgroundColor:e=>{if(!e.chart)return"rgba(".concat(b.r,", ").concat(b.g,", ").concat(b.b,", 0.2)");let t=e.chart.ctx.createLinearGradient(0,0,0,400);return t.addColorStop(0,"rgba(".concat(b.r,", ").concat(b.g,", ").concat(b.b,", 0.7)")),t.addColorStop(1,"rgba(".concat(b.r,", ").concat(b.g,", ").concat(b.b,", 0.3)")),t},fill:!0,tension:.4,pointRadius:f?2:3,pointHoverRadius:f?4:5,pointBackgroun
1dColor:c,pointBorderColor:c,pointBorderWidth:2}]}:null,g={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!0,position:"bottom",labels:{font:{size:f?10:12},usePointStyle:!0,padding:15}},tooltip:{backgroundColor:"white",titleColor:"#374151",bodyColor:"#374151",borderColor:"#E5E7EB",borderWidth:1,padding:12,displayColors:!0,callbacks:{title:e=>"연도: ".concat(e[0].label),label:e=>"".concat(e.dataset.label,": ").concat(e.parsed.y.toFixed(1),"%")}},datalabels:{display:!1}},scales:{x:{grid:{display:!0,color:"#E0E0E0",drawBorder:!1},ticks:{font:{size:f?10:12},color:"#666666"}},y:{beginAtZero:!0,min:0,grid:{display:!0,color:"#E0E0E0",drawBorder:!1},ticks:{font:{size:f?10:12},color:"#666666",callback:function(e){return Math.round(e)+"%"}}}}};return(0,n.jsx)("div",{className:"relative",children:h?(0,n.jsx)("div",{className:"flex items-center justify-center w-full absolute top-0",children:(0,n.jsx)(u,{})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex flex-col md:flex-row justify-between w-full px-4 md:px-14 mb-4",children:[(0,n.jsx)("span",{className:"text-[#045B62] font-semibold text-[16px] md:text-[20px] mb-2 md:mb-0",children:"글라이드패스"}),(0,n.jsx)("div",{children:(0,n.jsx)("span",{className:"text-[#045B62] font-semibold text-[14px] md:text-[20px]"})})]}),v?(0,n.jsx)("div",{className:"h-[500px] md:h-[400px]",children:(0,n.jsx)(d.N1,{data:v,options:g})}):(0,n.jsx)("div",{className:"flex items-center justify-center py-12 text-gray-500 text-sm",children:"데이터가 없습니다"})]})})};function u(){return(0,n.jsxs)("div",{role:"status",className:"w-full px-10",children:[(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]})]})}let x=e=>{let{type:t,token:s,vintage:a,sameSeriesId:l,setSameSeriesId:r,color:i="#045B62"}=e;return(0,n.jsx)("div",{className:"w-full h-full",children:(0,n.jsx)(c,{type:t,token:s,vintage:a,sameSeriesId:l,setSameSeriesId:r,color:i})})},m=()=>{let e="/backend-api",[t,s]=(0,a.useState)([]),[n,l]=(0,a.useState)(!0),[r,o]=(0,a.useState)(1),[d,c]=(0,a.useState)(null),[u,x]=(0,a.useState)(!1);return{TableDetails:(0,a.useCallback)(async(t,n,a)=>{await i.A.get("".concat(e,"/").concat(t,"_port_stat_2?key=").concat(a),{headers:{Authorization:n}}).then(e=>{s(function(e,t){if("tdf"===t){let t=[];return Object.keys(e).forEach(s=>
1{e[s].forEach(e=>{var n,a;t.push({year:s,SameSeriesId:e.SameSeriesId,Vintage:e.Vintage,표준코드:e.표준코드,"펀드 공식 이름":e["펀드 공식 이름"],주식:e.주식,채권:e.채권,현금:e.현금,우선주:e.우선주,전환형증권:e.전환형증권,기타:e.기타,포트폴리오날짜:null!=(a=null!=(n=e["포트폴리오날짜"])?n:e["포트폴리오_날짜"])?a:e.portfolio_date})})}),t}if("fund"===t)return e.map(e=>{var t,s;return{SameSeriesId:e.SameSeriesId,Vintage:e.Vintage,표준코드:e.표준코드,"펀드 공식 이름":e["펀드 공식 이름"],주식:e.주식,채권:e.채권,현금:e.현금,우선주:e.우선주,전환형증권:e.전환형증권,기타:e.기타,포트폴리오날짜:null!=(s=null!=(t=e["포트폴리오날짜"])?t:e["포트폴리오_날짜"])?s:e.portfolio_date,운용회사:e.운용회사}})}(e.data,t)),x(!1),l(!1)}).catch(e=>{l(!1),console.error("Error fetching data:",e)})},[e]),data:t,loading:n,dataLoading:u,setDataLoading:x,totalPages:d,setTotalPages:c,currentPage:r,setCurrentPage:o}};s(57905);var h=s(9879),p=s(57088),f=s(31975),b=s(93721),v=s(67118),g=s(10895),j=s(6476);let y=function(e){var t,s;let{graphData:a,type:l}=e,r=e=>{let t=new Date(e),s=t.getMonth()+1,n=t.getDate(),a=t.getFullYear().toString().slice(2);return"".concat(s,"/").concat(n,"/").concat(a)},i=["#0068B9","#00A76D","#FEB019","#775DD0","#FF4560","#A58CFF","#16875E","#FF8F43","#1B1B1B","#FF5733","#045B62","#045B62"];return(0,n.jsxs)(n.Fragment,{children:["tdf"===l&&(0,n.jsx)(h.u,{width:"100%",height:500,className:"mulichart",children:(0,n.jsxs)(p.b,{margin:{top:0,right:50,left:0,bottom:0},children:[(0,n.jsx)(f.d,{strokeDasharray:"3 3"}),(0,n.jsx)(b.W,{dataKey:"date_use",tickFormatter:r,allowDuplicatedCategory:!1}),(0,n.jsx)(v.h,{dataKey:"운용수익률",domain:[a.min_value,a.max_value],type:"number",allowDataOverflow:!0}),(0,n.jsx)(g.m,{}),null==a||null==(t=a.array_data)?void 0:t.map((e,t)=>(0,n.jsx)(j.N1,{data:e,type:"monotone",dataKey:"운용수익률",stroke:i[t%i.length]},t))]})}),"fund"===l&&(0,n.jsx)(h.u,{width:"100%",height:500,className:"mulichart",children:(0,n.jsxs)(p.b,{margin:{top:0,right:50,left:0,bottom:0},children:[(0,n.jsx)(f.d,{strokeDasharray:"3 3"}),(0,n.jsx)(b.W,{dataKey:"기준일",tickFormatter:r,allowDuplicatedCategory:!1}),(0,n.jsx)(v.h,{dataKey:"운용수익률",domain:[a.min_value,a.max_value],type:"number",allowDataOverflow:!0}),(0,n.jsx)(g.m,{}),null==a||null==(s=a.array_data)?void 0:s.map((e,t)=>(0,n.jsx)(j.N1,{data:e,type:"monotone",dataKey:"운용수익률",stroke:i[t%i.length]},t))]})})]})};var k=s(70746);let N=()=>(0,n.jsxs)("div",{className:"animate-pulse",children:[(0,n.jsx)("div",{className:"bg-gray-200 h-12 mb-4 rounded"}),[...Array(10)].map((e,t)=>(0,n.jsx)("div",{className:"bg-gray-100 h-10 mb-2 rounded"},t))]}),w=()=>(0,n.jsx)("div",{className:"animate-pulse space-y-4",children:[void 0,void 0,void 0,void 0,void 0].map((e,t)=>(0,n.jsx)("div",{className:"bg-gray-100 h-32 rounded-lg"},t))}),_=e=>{let{percentage:t,color:s="bg-brand-700/50"}=e;return(0,n.jsx)("div",{className:"w-full bg-secondary rounded-full h-2",children:(0,n.jsx)("div",{className:"".concat(s," h-2 rounded-full transition-all duration-300"),style:{width:"".concat(t,"%")}})})},S=e=>{let{fundData:t,topAssetData:s}=e,[l,r]=(0,a.useState)(!1);return(0,n.jsxs)("div",{className:"bg-white rounded-xl border border-line overflow-hidden",children:[(0,n.jsx)("div",{className:"border-b border-line bg-secondary/60 text-ink p-4 cursor-pointer",onClick:()=>r(!l),children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("h4",{className:"font-semibold text-sm truncate",children:t.Vintage}),(0,n.jsx)("p",{className:"text-xs text-ink-soft mt-1",children:"Top 10 자산 구성"})]}),(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsx)("svg",{className:"w-4 h-4 transition-transform duration-200 ".concat(l?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})}),(0,n.jsx)("div",{className:"transition-all duration-300 ".concat(l?"max-h-96":"max-h-0"," overflow-hidden"),children:(0,n.jsx)("div",{className:"p-4 space-y-3",children:[...Array(10)].map((e,s)=>
1{let a=t["top".concat(s+1)];return(0,n.jsx)("div",{className:"border-b border-line pb-3 last:border-b-0",children:a?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold text-white ".concat(s<3?"bg-brand-700":"bg-brand-700/50"),children:s+1}),(0,n.jsx)("span",{className:"font-medium text-sm text-ink truncate flex-1",children:a.세부종목명})]}),(0,n.jsxs)("span",{className:"text-sm font-semibold text-ink",children:[a.배분율.toFixed(2),"%"]})]}),(0,n.jsx)(_,{percentage:a.배분율,color:s<3?"bg-brand-700":"bg-brand-700/50"})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 text-ink-mute",children:[(0,n.jsx)("div",{className:"w-6 h-6 rounded-full bg-secondary flex items-center justify-center text-xs",children:s+1}),(0,n.jsx)("span",{className:"text-sm",children:"데이터 없음"})]})},s)})})})]})};function C(e){let{type:t,vintage:s,token:l,sameSeriesId:r}=e,[o,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!0),[x,h]=(0,a.useState)({key:null,direction:"asc"}),[p,f]=(0,a.useState)(!1),b=(0,a.useRef)(null),{TableDetails:v,data:g,currentPage:j}=m();return((0,a.useEffect)(()=>{let e=()=>{f(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,a.useEffect)(()=>{r&&"tdf"===t&&v(t,l,r),s&&"fund"===t&&v(t,l,s)},[r,s,j]),(0,a.useEffect)(()=>{if(g&&g.length>0){let e=g.map(e=>e.표준코드);(async()=>{u(!0);try{var t;let s=await i.A.get("".concat("/backend-api","/v2/top_asset?type=key&std_cd=").concat(e.join(",")),{headers:{Authorization:l}});d(null!=(t=s.data)?t:[])}catch(e){console.error("Error fetching top asset data:",e),d([])}finally{u(!1)}})()}else g&&0===g.length&&u(!1)},[g,l]),c)?(0,n.jsxs)("div",{className:"bg-white rounded-xl border border-line p-4 md:p-6 mx-5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-ink",children:"빈티지별 상위 Top10 보유종목 테이블"}),(0,n.jsx)("div",{className:"text-sm text-ink-soft",children:"데이터를 불러오는 중..."})]}),p?(0,n.jsx)(w,{}):(0,n.jsx)(N,{})]}):(0,n.jsxs)("div",{className:" bg-white rounded-xl border border-line overflow-hidden relative z-10",children:[(0,n.jsx)("div",{className:"border-b border-line bg-secondary/60 text-ink p-4",children:(0,n.jsx)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-lg md:text-xl font-bold",children:"빈티지별 상위 Top10 보유종목 테이블"}),(0,n.jsxs)("p",{className:"text-xs md:text-sm text-ink-soft mt-1",children:["각 빈티지별 상위 10개 자산 구성 현황",o&&o.length>0&&(0,n.jsxs)("span",{className:"ml-2 text-xs bg-white border border-line px-2 py-1 rounded",children:["기준일: ",o[0].기준일자]})]})]})})}),o&&o.length>0?(0,n.jsx)(n.Fragment,{children:p?(0,n.jsx)("div",{className:"p-4 space-y-4",children:o.map((e,t)=>(0,n.jsx)(S,{fundData:e,topAssetData:o},t))}):(0,n.jsx)("div",{className:"overflow-auto max-h-[70vh] relative",ref:b,children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{className:"bg-secondary sticky top-0 z-30",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"py-4 px-4 min-w-[80px] sticky left-0 top-0 z-[30] bg-secondary border-r border-line",children:(0,n.jsxs)("button",{onClick:()=>{var e;let t;return e="rank",t="asc",void(x.key===e&&"asc"===x.direction&&(t="desc"),h({key:e,direction:t}))},className:"flex items-center gap-1 hover:text-brand-700 transition-colors",children:["순위","rank"===x.key&&(0,n.jsx)("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"sortConfig.direction === 'asc' ? 'M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z' : 'M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z'",clipRule:"evenodd"})})]})}),o.map((e,t)=>(0,n.jsxs)("th",{className:"py-4 px-4 min-w-[220px] text-left",children:[(0,n.jsx)("div",{className:"font-semibold text-ink",children:e.Vintage}),(0,n.jsx)("div",{className:"text-xs text-ink-soft mt-1",children:"ë¹
1ˆí‹°ì§€"})]},t))]})}),(0,n.jsx)("tbody",{children:[...Array(10)].map((e,t)=>(0,n.jsxs)("tr",{className:"border-b border-line hover:bg-secondary/40 transition-colors duration-150",children:[(0,n.jsx)("td",{className:"py-3 px-4 sticky left-0 bg-white z-[20] border-r border-line",children:(0,n.jsxs)("div",{className:"inline-flex items-center px-3 py-1 rounded-full text-sm font-medium border ".concat((e=>{let t={1:"bg-brand-700/10 text-brand-700 border-brand-700/20",2:"bg-brand-700/10 text-brand-700 border-brand-700/20",3:"bg-brand-700/10 text-brand-700 border-brand-700/20",default:"bg-secondary text-ink-soft border-line"};return t[e]||t.default})(t+1)),children:[(0,n.jsxs)("span",{className:"mr-1",children:["#",t+1]}),t<3&&(0,n.jsx)("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})})]})}),o.map((e,s)=>{let a=e["top".concat(t+1)];return(0,n.jsx)("td",{className:"py-3 px-4",children:a?(0,n.jsxs)("div",{className:"group",children:[(0,n.jsx)("div",{className:"font-medium text-ink mb-2",children:a.세부종목명}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(_,{percentage:a.배분율,color:t<3?"bg-brand-700":"bg-brand-700/50"})}),(0,n.jsxs)("span",{className:"text-sm font-semibold text-ink min-w-[50px]",children:[a.배분율.toFixed(2),"%"]})]})]}):(0,n.jsxs)("div",{className:"text-ink-mute text-center py-2",children:[(0,n.jsx)("svg",{className:"w-6 h-6 mx-auto mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),(0,n.jsx)("span",{className:"text-xs",children:"데이터 없음"})]})},s)})]},t))})]})})}):(0,n.jsxs)("div",{className:"text-center py-12 px-4",children:[(0,n.jsx)("div",{className:"text-ink-mute mb-4",children:(0,n.jsx)("svg",{className:"w-16 h-16 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,n.jsx)("h3",{className:"text-lg font-medium text-ink mb-2",children:"데이터가 없습니다"}),(0,n.jsx)("p",{className:"text-ink-soft",children:"분석할 수 있는 자산 데이터가 존재하지 않습니다."})]})]})}var T=s(80602),E=s(93374),A=s(99834);s(85579);var F=s(8985),D=s(55038),M=s(83843),P=s(56971),L=s(6612),R=s(3668);let z=e=>{let{type:t,token:s,vintage:l,sameSeriesId:o,setSameSeriesId:d,handleBackClick:c,selectedAccountType:u,handleCloseModal:x,hideAddButton:m=!1}=e,h=(0,a.useRef)(null);(0,r.r)();let[p,f]=(0,a.useState)({loading:!1,data:null,message:null}),[b,v]=(0,a.useState)({data:[],loading:!1,message:null}),[g,j]=(0,a.useState)({key:null,direction:"asc"}),[y,k]=(0,a.useState)({}),[N,w]=(0,a.useState)(!1);(0,a.useRef)(null);let _=async()=>{if(!l)return;f(e=>({...e,loading:!0,data:null,message:null}));let e=u||"dc";await i.A.get("".concat("/backend-api","/invest_return_by_vintage?standard_code=").concat(l,"&horizon=").concat(e),{headers:{Authorization:s}}).then(e=>{let t=null==e?void 0:e.data,s=Array.isArray(t)&&0===t.length;f(e=>({...e,loading:!1,data:null!=t?t:null,message:s?"포트폴리오가 없어요. \n\n          픽커와 대시보드를 통해 포트폴리오를 만들어보세요!":null}))}).catch(e=>{var t;let s=null==e||null==(t=e.response)?void 0:t.status;f(t=>{var n,a;return{...t,loading:!1,data:null,message:404===s?"현재 판매되고 있지 않습니다":(null==e||null==(a=e.response)||null==(n=a.data)?void 0:n.error)||"Something went wrong"}})})};return(0,a.useEffect)(()=>{_()},[u,l]),(0,n.jsxs)("div",{className:"w-full px-4 py-10 flex flex-col gap-4 ",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{onClick:c,className:"block md:hidden",children:(0,n.jsx)(E.NPM,{size:"20",color:"#167a5c"})}),(0,n.jsx)("button",{onClick:c,className:"hidden md:block",children:(0,n.jsx)(E.NPM,{size:"40",color:"#167a5c"})}),(0,n.jsx)("h1",{className:"text-brand-700 font-bold text-2xl tracking-tight",children:"주요정보"})]}),(0,n.jsx)("div",{className:"w-full flex items-center justify-between",children:(0,n.jsxs)("span",{className:"text-ink font-semibold text-[20px]",children:["tdf"===t?"TDF":"펀드"," 상품별 주요정보"]})}),(0,n.jsx)(I,{token:s,vintage:l,sameSeriesId:o,setSameSeriesId:d,type:t}),(0,n.jsx)(U,{scrollContainerRef:h,selectedItems:b,handleCheckboxChange:(e,t)=>
1{v(s=>{let n=s.data||[];return t?n.some(t=>t.표준코드===e.표준코드)?s:{...s,data:[...n,e]}:{...s,data:n.filter(t=>t.표준코드!==e.표준코드)}})},tableData:p,setSelectedItems:v,selectedAccountType:u,token:s,handleCloseModal:x,portfolioDateByPortStat2:y,hideAddButton:m}),(0,n.jsx)("h2",{className:"text-brand-700 font-semibold text-xl mb-2",children:"설정 이후 누적 수익률"}),(0,n.jsx)(Y,{token:s,vintage:l,sameSeriesId:o,type:t}),(0,n.jsx)(O,{token:s,vintage:l,setSameSeriesId:d,type:t,onPortStat2PortfolioDateByStdCd:k}),"tdf"===t&&(0,n.jsx)(C,{token:s,vintage:l,sameSeriesId:o,type:t})]})},B=e=>{let{type:t,vintage:s,userInfo:i,token:o,setShowKeyinformation:d,selectedAccountType:c,handleCloseModal:u,hideAddButton:x=!1}=e,m=(0,r.r)();void 0===s&&(s=m.query.vintage);let[h,p]=(0,a.useState)(null),f=()=>{d?d(!1):m.back()},b=c||"/portfolio-builder"===m.pathname||m.pathname.startsWith("/portfolio-builder");return(0,n.jsx)(n.Fragment,{children:b?(0,n.jsx)(z,{type:t,token:o,vintage:s,sameSeriesId:h,setSameSeriesId:p,handleBackClick:f,selectedAccountType:c,handleCloseModal:u,hideAddButton:x}):(0,n.jsx)(l,{userInfo:i,children:(0,n.jsx)(z,{type:t,token:o,vintage:s,sameSeriesId:h,setSameSeriesId:p,handleBackClick:f,hideAddButton:x})})})};function I(e){var t;let{type:s,token:l,vintage:o,sameSeriesId:d,setSameSeriesId:c}=e,{FundDetail:u,data:m,loading:h}=(()=>{let[e,t]=(0,a.useState)([]),[s,n]=(0,a.useState)(!1);return{FundDetail:async(e,s,a)=>{n(!0),await i.A.get("".concat("/backend-api","/").concat(e,"_ind_fund?filter=").concat(a),{headers:{Authorization:s}}).then(e=>{t(e.data),n(!1)}).catch(e=>{n(!1),console.error("Error fetching data:",e)})},data:e,loading:s}})(l),{GetWebsiteUrl:p,url:f}=(()=>{let[e,t]=(0,a.useState)(null);return{GetWebsiteUrl:async(e,s,n)=>{await i.A.get("".concat("/backend-api","/").concat(e,"_website_address?filter=").concat(n),{headers:{Authorization:s}}).then(e=>{t(e.data)}).catch(e=>{console.error("Error fetching data:",e)})},url:e}})(),b=(0,r.r)();return(0,a.useEffect)(()=>{o&&(u(s,l,o),p(s,l,o))},[o]),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"w-full flex flex-col lg:flex-row justify-between min-h-[40vh] space-y-4 lg:space-y-0 gap-2",children:[(0,n.jsx)("div",{className:"flex flex-col lg:w-[50%] 2xl:w-[40%] h-auto gap-2 relative mb-4 lg:mb-0 bg-white rounded-xl border border-line p-4",children:h?(0,n.jsx)("div",{className:"flex items-center justify-center w-full absolute",children:(0,n.jsx)(W,{})}):(0,n.jsx)(n.Fragment,{children:m&&(null==m||null==(t=m.slice(0,1))?void 0:t.map((e,t)=>{var a,l;return(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"flex flex-col gap-3 md:gap-4",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("h1",{className:"text-ink text-[18px] md:text-[20px] font-semibold cursor-pointer hover:text-brand-700 transition-colors",onClick:()=>{},children:"펀드이름"}),(0,n.jsx)("span",{className:"text-[14px] text-ink-soft text-right w-[200px] font-medium",children:e.공시대상})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("h1",{className:"text-ink text-[18px] md:text-[20px] font-semibold hover:text-brand-700 transition-colors",children:"빈티지"}),(0,n.jsx)("span",{className:"text-[14px] text-ink-soft text-right w-[200px] font-medium",children:e.빈티지})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("h1",{className:"text-ink text-[18px] md:text-[20px] font-semibold hover:text-brand-700 transition-colors",children:"위험등급"}),(0,n.jsx)("span",{className:"text-[14px] text-ink-soft text-right w-[200px] font-medium",children:(0,T.$D)(e.위험등급)})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("h1",{className:"text-ink text-[18px] md:text-[20px] font-semibold  hover:text-brand-700 transition-colors",children:"주식비중"}),(0,n.jsx)("span",{className:"text-[14px] text-ink-soft text-right w-[200px] font-medium",children:e.주식비중})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("h1",{onClick:()=>{"tdf"===s&&b.push("/".concat(s,"/product_specific_commission/").concat(e["빈티지"])),"fund"===s&&b.push("/".concat(s,"/commission_per_product/").concat(e["빈티지"]))},className:"text-ink text-[18px] md:text-[20px] font-semibold cursor-pointer hover:text-brand-700 transition-colors",children:"보수"}),(0,n.jsx)("span",{className:"text-[14px] text-ink-soft text-right w-[200px] font-medium",children:e.보수})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("h1",{className:"text-ink text-[18px] md:text-[20px] font-semibold  hover:text-brand-700 transition-colors",children:"헤ì
1§€ì—¬ë¶€"}),(0,n.jsx)("span",{className:"text-[14px] text-ink-soft text-right w-[200px] font-medium",children:(0,T.Tz)(e.환헤지)})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center w-full py-2 px-3 rounded-md hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("a",{href:f?null==(a=f[0])?void 0:a.Website:"#",target:"_blank",className:"text-ink text-[18px] md:text-[20px] font-semibold cursor-pointer hover:text-brand-700 transition-colors",children:"운용사"}),(0,n.jsx)("a",{href:f?null==(l=f[0])?void 0:l.Website:"#",target:"_blank",className:"text-[14px] text-ink-soft text-right w-[200px] font-medium hover:text-ink transition-colors",children:e.운용사})]})]})},t)}))})}),(0,n.jsx)("div",{className:"lg:w-[50%] 2xl:w-[60%] p-4 bg-white rounded-xl border border-line",children:"tdf"===s&&(0,n.jsx)(x,{token:l,vintage:o,setSameSeriesId:c,sameSeriesId:d,type:s})})]})})}function Y(e){let{type:t,token:s,vintage:l,sameSeriesId:r}=e,[o,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(!0),[x,m]=(0,a.useState)({min_value:null,max_value:null,min_date:null,max_date:null,array_data:null}),h=["#0068B9","#00A76D","#FEB019","#775DD0","#FF4560","#A58CFF","#16875E","#FF8F43","#1B1B1B","#FF5733","#045B62","#045B62"],p=async e=>{await i.A.get("".concat("/backend-api","/").concat(t,"_return_analysis?filter=").concat(l),{headers:{Authorization:e}}).then(e=>{let s=e.data;if(u(!1),"tdf"===t){let e=s.map(e=>Math.round((parseFloat(e.perf)-1)*1e4)/100),t=Math.min(...e),n=Math.max(...e),a=s.map(e=>new Date(e.date_use)),l=new Date(Math.min(...a)),r=new Date(Math.max(...a)),i=l.toISOString().split("T")[0],o=r.toISOString().split("T")[0],c=new Map;s.forEach(e=>{e.운용수익률=Math.round((parseFloat(e.perf)-1)*1e4)/100;let t=e.표준코드;c.has(t)||c.set(t,[]),c.get(t).push(e)}),m({min_value:t,max_value:n,min_date:i,max_date:o,array_data:Array.from(c.values())});let u=new Map;s.forEach(e=>{u.has(e["공시대상"])||u.set(e["공시대상"],e)}),d(Array.from(u.values()))}if("fund"===t){let e=s.map(e=>Math.round((parseFloat(e.perf)-1)*1e4)/100),t=Math.min(...e),a=Math.max(...e),l=s.map(e=>new Date(e["기준일"])),r=new Date(Math.min(...l)),i=new Date(Math.max(...l));function n(e){let t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(s,"-").concat(n)}let o=n(r),c=n(i),u=new Map;s.forEach(e=>{e.운용수익률=Math.round((parseFloat(e.perf)-1)*1e4)/100;let t=e.표준코드;u.has(t)||u.set(t,[]),u.get(t).push(e)}),u.forEach(e=>{e.sort((e,t)=>new Date(e.date_use||e["기준일"])-new Date(t.date_use||t["기준일"]))}),m({min_value:t,max_value:a,min_date:o,max_date:c,array_data:Array.from(u.values())});let x=new Map;s.forEach(e=>{x.has(e["표준코드"])||x.set(e["표준코드"],e)}),d(Array.from(x.values()))}}).catch(e=>{u(!1)})};return(0,a.useEffect)(()=>{p(s)},[]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"w-full min-h-[80vh] py-4 px-4 bg-ground rounded-xl border border-line relative",children:c?(0,n.jsx)("div",{className:"flex items-center justify-center w-full absolute top-[40%]",children:(0,n.jsx)(k.Ay,{})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex justify-between w-full px-5",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"text-brand-700 font-semibold text-[16px]",children:r}),(0,n.jsx)("p",{className:"text-brand-700 font-semibold text-[16px]",children:"과거수익률 분석"})]}),(0,n.jsx)("div",{children:(0,n.jsx)("span",{className:"text-brand-700 font-semibold text-[16px]",children:x.min_date&&x.max_date&&(0,n.jsxs)(n.Fragment,{children:[x.min_date," / ",x.max_date]})})})]}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(y,{type:t,graphData:x})}),(0,n.jsx)("div",{className:"w-full mt-4 flex justify-center items-center",children:(0,n.jsx)("div",{className:"w-[100%] flex flex-wrap justify-center items-center gap-2 ",children:null==o?void 0:o.map((e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"w-4 h-2",style:{backgroundColor:h[t%h.length]}}),(0,n.jsx)("p",{className:"text-[12px]",children:e.공시대상||e.표준코드})]},t))})})]})})})}function O(e){let{type:t,token:s,vintage:l,setSameSeriesId:o,onPortStat2PortfolioDateByStdCd:d}=e,c=(0,a.useRef)(null),u=(0,r.r)(),{TableDetails:x,data:h,loading:p}=(()=>{let e="/backend-api",[t,s]=(0,a.useState)([]),[n,l]=(0,a.useState)(!0),[r,o]=(0,a.useState)(1),[d,c]=(0,a.useState)(null),[u,x]=(0,a.useState)(!1);return{TableDetails:(0,a.useCallback)(async(t,n,a)=>{l(!0),x(!0);try{let l=await i.A.get("".concat(e,"/").concat(t,"_anu_stat_series?std_cd=").concat(a),{headers:{Authorization:n}});s(l.data)}catch(e){console.error("Error fetching data:",e)}finally{x(!1),l(!1)}},[e]),data:t,loading:n,dataLoading:u,setDataLoading:x,totalPages:d,setTotalPages:c,currentPage:r,setCurrentPage:o}})(),{TableDetails:f,data:b,loading:v,dataLoading:g,setDataLoading:j,totalPages:y,currentPage:N,setCurrentPage:w}=m(),_=(0,a.useMemo)(()=>{var e,s,n,a;if("tdf"!==t||!h)return null;let l="object"!=typeof h||Array.isArray(h)?Array.isArray(h)&&null!=(a=h[0])?a:null:null!=(n=null==(s=Object.values(h))||null==(e=s[0])?void 0:e[0])?n:null;return(null==l?void 0:l.표준코드)||(null==l?void 0:l.SameSeriesId)||null},[t,h]);(0,a.useEffect)(()=>{"tdf"===t&&o&&_&&o(_)},[t,o,_]),(0,a.useEffect)(()=>{"tdf"===t?_&&f(t,s,_):l&&"fund"===t&&f(t,s,l)},[t,s,l,N,_,f]),(0,a.useEffect)(()=>{l&&x(t,s,l)},[x,t,s,l]),(0,a.useEffect)(()=>
1{if(!d)return;if(!b)return void d({});let e=Array.isArray(b)?b:"object"==typeof b&&null!==b?Object.values(b).flat():[],t={};e.forEach(e=>{let s=null==e?void 0:e.표준코드,n=null==e?void 0:e.포트폴리오날짜;null!=s&&null!=n&&""!==String(n)&&(t[String(s)]=n)}),d(t)},[b,d]);let S=(e,t)=>{var s,n,a;return null!=(a=null!=(n=null!=(s=null==e?void 0:e.표준코드)?s:null==e?void 0:e.Vintage)?n:null==e?void 0:e["공시대상"])?a:t},C="tdf"===t&&h&&"object"==typeof h&&!Array.isArray(h)?Object.fromEntries(Object.keys(h).map(e=>{var t;let s=null==h||null==(t=h[e])?void 0:t[0];return[S(s,e),s]})):Array.isArray(h)?Object.fromEntries(h.map((e,t)=>[S(e,String(t)),e])):{},T=e=>{var t,s,n;let a=null!=(s=null!=(t=null==e?void 0:e.표준코드)?t:null==e?void 0:e.Vintage)?s:null==e?void 0:e["펀드 공식 이름"];return null!=(n=null==C?void 0:C[a])?n:null},[E,A]=(0,a.useState)(()=>new Set),F=e=>{A(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};(0,a.useEffect)(()=>{let e=document.getElementById("productinformation-table"),t=()=>{if(e&&N<=y){let{scrollTop:t,clientHeight:s,scrollHeight:n}=e;t+s>=n-1&&(w(e=>e+1),j(!0))}};return e&&e.addEventListener("scroll",t),()=>{e&&e.removeEventListener("scroll",t)}},[f,N]);let D=e=>{e["표준코드"]&&u.push("/tdf/key_information/".concat(e["표준코드"]))},M=e=>{let t=Number(e);return Number.isFinite(t)?t.toFixed(2):"-"},P=e=>{let t=M(e);return"-"===t?"-":"".concat(t,"%")};return(0,n.jsx)("div",{className:"mt-8 w-full",children:v?(0,n.jsx)("div",{className:"h-[150px] flex justify-center items-center",children:(0,n.jsx)(k.Ay,{})}):b&&("tdf"===t&&Object.keys(b).length>0||"fund"===t&&b.length>0)?(0,n.jsxs)("div",{className:"bg-white rounded-xl border border-line w-full overflow-hidden mb-4",children:[(0,n.jsx)("div",{className:"border-b border-line bg-secondary/60 text-ink p-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"bg-brand-700/10 text-brand-700 rounded-full p-2",children:(0,n.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-xl md:text-2xl font-bold",children:"자산배분 현황"}),(0,n.jsx)("p",{className:"text-sm text-ink-soft",children:"tdf"===t?"TDF별 자산배분 정보":"펀드별 자산배분 정보"})]})]})}),(0,n.jsx)("div",{className:"hidden md:block",children:(0,n.jsx)("div",{ref:c,className:"overflow-auto max-h-[60vh] relative",children:(0,n.jsxs)("table",{className:"w-full text-sm text-left text-ink-soft border-collapse",children:[(0,n.jsx)("thead",{className:"bg-secondary sticky top-0 z-40",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute sticky left-0 top-0 z-50 bg-secondary",children:"펀드 공식 이름"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"주식"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"채권"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"현금"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:(0,n.jsx)("span",{children:"기타"})}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"연수익률"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"연변동성"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"샤프지수"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"포트폴리오날짜"}),"fund"===t&&(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute",children:"운용회사"})]})}),(0,n.jsx)("tbody",{children:"tdf"===t?Object.values(b).flat().map((e,t)=>(0,n.jsx)("tr",{className:"group border-b border-line last:border-b-0 hover:bg-secondary/40 transition-colors cursor-pointer",onClick:()=>D(e),children:(()=>{let t=T(e),s=(Number(null==e?void 0:e.우선주)||0)+(Number(null==e?void 0:e.전환형증권)||0)+(Number(null==e?void 0:e.기타)||0),a=(null==e?void 0:e.우선주)!=null||(null==e?void 0:e.전환형증권)!=null||(null==e?void 0:e.기타)!=null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink sticky left-0 z-20 bg-white transition-colors group-hover:bg-secondary",children:(null==e?void 0:e["펀드 공식 이름"])||"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.주식)!=null?P(e.주식):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.채권)!=null?P(e.채권):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.현금)!=null?P(e.현금):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:a?P(s):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==t?void 0:t["연수익률"])!=null?P(t["연수익률"]):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==t?void 0:t["연변동성"])!=null?P(t["연변동성"]):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==t?void 0:t["샤프지수"])!=null?M(t["샤프지수"]):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.포트폴리오날짜)||"-"})]})})()},t)):b.map((e,s)=>(0,n.jsx)("tr",{className:"group border-b border-line last:border-b-0 hover:bg-secondary/40 transition-colors cursor-pointer",onClick:()=>D(e),children:(()=>{let s=T(e),a=(Number(null==e?void 0:e.우선주)||0)+(Number(null==e?void 0:e.전환형증권)||0)+(Number(null==e?void 0:e.기타)||0),l=(null==e?void 0:e.우선주)!=null||(null==e?void 0:e.전환형증권)!=null||(null==e?void 0:e.기타)!=null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink sticky left-0 z-20 bg-white transition-colors group-hover:bg-secondary",children:(null==e?void 0:e["펀드 공식 이름"])||"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.주식)!=null?P(e.주식):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.채권)!=null?P(e.채권):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.현금)!=null?P(e.현금):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:l?P(a):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==s?void 0:s["연수익률"])!=null?P(s["연수익률"]):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==s?void 0:s["연변동성"])!=null?P(s["연변동성"]):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==s?void 0:s["샤프지수"])!=null?M(s["샤프지수"]):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.포트폴리오날짜)||"-"}),"fund"===t&&(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink",children:(null==e?void 0:e.운용회사)||"-"})]})})()},s))})]})})}),(0,n.jsx)("div",{className:"md:hidden",children:(0,n.jsx)("div",{className:"divide-y divide-line",children:"tdf"===t?Object.values(b).flat().map((e,t)=>(()=>{var s,a;let l=null!=(a=null!=(s=null==e?void 0:e.표준코드)?s:null==e?void 0:e.Vintage)?a:String(t),r=E.has(l),i=T(e),o=(Number(null==e?void 0:e.우선주)||0)+(Number(null==e?void 0:e.전환형증권)||0)+(Number(null==e?void 0:e.기타)||0),d=(null==e?void 0:e.우선주)!=null||(null==e?void 0:e.전환형증권)!=null||(null==e?void 0:e.기타)!=null;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("button",{type:"button",className:"text-left flex-1",onClick:()=>D(e),children:(0,n.jsx)("div",{className:"text-sm font-semibold text-ink line-clamp-2",children:(null==e?void 0:e["펀드 공식 이름"])||"-"})}),(0,n.jsx)("button",{type:"button",className:"shrink-0 text-xs font-semibold text-brand-700 border border-brand-700/30 rounded-full px-3 py-1 hover:bg-brand-700/5",onClick:e=>{e.stopPropagation(),F(l)},"aria-expanded":r,children:r?"접기":"더보기"})]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2 text-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"주식"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:(null==e?void 0:e.주식)!=null?P(e.주식):"-"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"채권"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:(null==e?void 0:e.채권)!=null?P(e.채권):"-"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"현금"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:(null==e?void 0:e.현금)!=null?P(e.현금):"-"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"기타"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:d?P(o):"-"})]})]}),r&&(0,n.jsx)("div",{className:"mt-3 rounded-xl border border-line bg-white p-3",children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-2 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"연수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==i?void 0:i["연수익률"])!=null?P(i["연수익률"]):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"연변동성"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==i?void 0:i["연변동성"])!=null?P(i["연변동성"]):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"샤프지수"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==i?void 0:i["샤프지수"])!=null?M(i["샤프지수"]):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"포트폴리오날짜"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.포트폴리오날짜)||"-"})]})]})})]},l)})()):b.map((e,s)=>(()=>{var a,l;let r=null!=(l=null!=(a=null==e?void 0:e.표준코드)?a:null==e?void 0:e.Vintage)?l:String(s),i=E.has(r),o=T(e),d=(Number(null==e?void 0:e.우선주)||0)+(Number(null==e?void 0:e.전환형증권)||0)+(Number(null==e?void 0:e.기타)||0),c=(null==e?void 0:e.우선주)!=null||(null==e?void 0:e.전환형증권)!=null||(null==e?void 0:e.기타)!=null;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,n.jsx)("button",{type:"button",className:"text-left flex-1",onClick:()=>D(e),children:(0,n.jsx)("div",{className:"text-sm font-semibold text-ink line-clamp-2",children:(null==e?void 0:e["펀드 공식 이름"])||"-"})}),(0,n.jsx)("button",{type:"button",className:"shrink-0 text-xs font-semibold text-brand-700 border border-brand-700/30 rounded-full px-3 py-1 hover:bg-brand-700/5",onClick:e=>{e.stopPropagation(),F(r)},"aria-expanded":i,children:i?"접기":"더보기"})]}),(0,n.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2 text-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"주식"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:(null==e?void 0:e.주식)!=null?P(e.주식):"-"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"채권"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:(null==e?void 0:e.채권)!=null?P(e.채권):"-"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"현금"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:(null==e?void 0:e.현금)!=null?P(e.현금):"-"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-secondary/60 px-3 py-2",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"기타"}),(0,n.jsx)("span",{className:"font-semibold text-ink",children:c?P(d):"-"})]})]}),i&&(0,n.jsx)("div",{className:"mt-3 rounded-xl border border-line bg-white p-3",children:(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-2 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"연수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==o?void 0:o["연수익률"])!=null?P(o["연수익률"]):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"연변동성"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==o?void 0:o["연변동성"])!=null?P(o["연변동성"]):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"샤프지수"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==o?void 0:o["샤프지수"])!=null?M(o["샤프지수"]):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"포트폴리오날짜"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.포트폴리오날짜)||"-"})]}),"fund"===t&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"운용회사"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.운용회사)||"-"})]})]})})]},r)})())})})]}):(0,n.jsx)("div",{className:"h-[150px] flex justify-center items-center",children:(0,n.jsx)("div",{className:"text-center text-ink-soft text-lg",children:"데이터가 없습니다"})})})}function W(){return(0,n.jsxs)("div",{role:"status",className:"w-full px-10",children:[(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]}),(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]})," ",(0,n.jsxs)("div",{cla
1ssName:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]})," ",(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]})," ",(0,n.jsxs)("div",{className:"flex items-center w-[65%] justify-between pt-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-600 w-24 mb-2.5"}),(0,n.jsx)("div",{className:"w-32 h-2 bg-gray-200 rounded-full dark:bg-gray-700"})]}),(0,n.jsx)("div",{className:"h-2.5 bg-gray-300 rounded-full dark:bg-gray-700 w-12"})]})]})}let U=e=>{var t;let{scrollContainerRef:s,selectedItems:l,handleCheckboxChange:r,tableData:i,setSelectedItems:o,selectedAccountType:d,token:c,handleCloseModal:u,portfolioDateByPortStat2:x={},hideAddButton:m=!1}=e,{fpEditLocked:h}=(0,R.zO)(),[p,f]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),[g,j]=(0,a.useState)([]),[y,N]=(0,a.useState)({key:null,direction:"asc"}),[w,_]=(0,a.useState)(!1),{setProducts:S}=(0,M.A)(),C=e=>{let t="asc";y.key===e&&"asc"===y.direction&&(t="desc"),N({key:e,direction:t})},T=[{key:"this_month",label:"이번달 수익률"},{key:"ytd",label:"올해 수익률"},{key:"1yr_before",label:"1년전"},{key:"2yr_before",label:"2년전"},{key:"after_inception",label:"설정이후"},{key:"운용보수",label:"운용보수"},{key:"판매보수",label:"판매보수"},{key:"총비용비율(TER)",label:"총비용비율"}],z=a.useMemo(()=>i.data&&y.key?[...i.data].sort((e,t)=>{let s=e[y.key],n=t[y.key];return("this_month"===y.key||"ytd"===y.key||"1yr_before"===y.key||"2yr_before"===y.key||"after_inception"===y.key||"운용보수"===y.key||"판매보수"===y.key||"총비용비율(TER)"===y.key?(s=s?parseFloat(s):-1/0,n=n?parseFloat(n):-1/0):(s=s||"",n=n||""),s<n)?"asc"===y.direction?-1:1:s>n?"asc"===y.direction?1:-1:0}):i.data||[],[i.data,y]),B=e=>y.key!==e?(0,n.jsx)("span",{className:"text-ink-mute opacity-50 ml-1 text-xs",children:"↕"}):"desc"===y.direction?(0,n.jsx)(E.y1m,{className:"inline-block ml-1 text-brand-700",size:14}):(0,n.jsx)(E.fad,{className:"inline-block ml-1 text-brand-700",size:14}),I=e=>{let t="px-4 py-3 font-medium text-ink-mute cursor-pointer hover:bg-secondary/60 transition-colors select-none";return y.key===e?"".concat(t," bg-secondary text-brand-700"):t};return(0,a.useEffect)(()=>{let e=e=>{w&&!e.target.closest(".mobile-sort-container")&&_(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[w]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{className:"text-brand-700 font-semibold text-xl",children:"판매사별 펀드"}),!(m||h&&!d)&&(0,n.jsx)("div",{className:"w-full flex md:flex-row flex-col gap-2 md:justify-end items-end",children:(0,n.jsx)("button",{className:"bg-ink hover:bg-ink/90 transition-colors rounded-lg w-auto px-6 md:h-[50px] h-[40px] text-white md:text-[16px] text-[12px] font-semibold flex items-center justify-center",onClick:()=>{if(0===l.data.length)return void A.Ay.error("종목을 선택해주세요.");if(d)v(!0);else{let e=l.data.map(e=>({kr_code:e.표준코드,fund_name:e.공시대상||e.펀드명||e.fund_name,asset_type:"TDF"})),t=l.data.map(e=>({종목이름:e.공시대상||e.펀드명||e.fund_name||"-",weight:0}));S(e),j(t),f(!0)}},children:l.loading?(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(k.o1,{}),(0,n.jsx)("p",{children:"저장 중..."})]}):(0,n.jsx)("p",{children:"포트폴리오에 추가"})})}),(0,n.jsx)(P.A,{isOpen:p,onClose:()=>{f(!1),j([])},selectedProducts:g}),(0,n.jsx)(L.A,{isOpen:b,onConfirm:()=>{S(l.data.map(e=>({kr_code:e.표준코드,fund_name:e.공시대상||e.펀드명||e.fund_name,asset_type:"TDF"}))),o(e=>({...e,data:[]})),v(!1),u&&u()},onCancel:()=>v(!1)}),(0,n.jsxs)("div",{className:"mt-3 w-full",children:[!i.loading&&i.data&&(0,n.jsxs)("div",{className:"bg-white rounded-xl border border-line w-full overflow-hidden mb-4",children:[(0,n.jsx)("div",{className:"border-b border-line bg-secondary/60 text-ink p-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"bg-brand-700/10 text-brand-700 rounded-full p-2",children:(0,n.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-xl md:text-2xl font-bold",children:"상품 정보"}),(0,n.jsxs)("p",{className:"text-sm text-ink-soft",children:["총 ",i.data.length,"개 상품"]})]})]})}),(0,n.jsx)("div",{className:"hidden md:block",children:(0,n.jsx)("div",{ref:s,className:"overflow-auto max-h-[60vh] relative",children:(0,n.jsxs)("table",{className:"w-full text-sm text-left text-ink-soft border-collapse",children:[(0,n.jsx)("thead",{className:"bg-secondary sticky top-0 z-10",children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{className:"px-4 py-3 text-center font-medium text-ink-mute w-[70px] break-keep",children:d?"순번":"선택"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute w-[180px] break-keep",children:"펀드명"}),(0,n.jsx)("th",{className:"".concat(I("this_month")," w-[110px] break-keep"),onClick:()=>C("this_month"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["이번달",(0,n.jsx)("br",{}),"수익률",B("this_month")]})}),(0,n.jsx)("th",{className:"".concat(I("ytd")," w-[110px] break-keep"),onClick:()=>C("ytd"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["올해 수익률",B("ytd")]})}),(0,n.jsx)("th",{className:"".concat(I("1yr_before")," w-[95px] break-keep"),onClick:()=>C("1yr_before"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["1년전",B("1yr_before")]})}),(0,n.jsx)("th",{className:"".concat(I("2yr_before")," w-[95px] break-keep"),onClick:()=>C("2yr_before"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["2년전",B("2yr_before")]})}),(0,n.jsx)("th",{className:"".concat(I("after_inception")," w-[95px] break-keep"),onClick:()=>C("after_inception"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["설정이후",B("after_inception")]})}),(0,n.jsx)("th",{className:"".concat(I("운용보수")," w-[95px] break-keep"),onClick:()=>C("운용보수"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["운용보수",B("운용보수")]})}),(0,n.jsx)("th",{className:"".concat(I("판매보수")," w-[95px] break-keep"),onClick:()=>C("판매보수"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["판매보수",B("판매보수")]})}),(0,n.jsx)("th",{className:"".concat(I("총비용비율(TER)")," w-[105px] break-keep"),onClick:()=>C("총비용비율(TER)"),children:(0,n.jsxs)("div",{className:"flex items-center break-keep",children:["총비용비율",B("총비용비율(TER)")]})}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute text-center w-[120px] break-keep",children:"판매회사"}),(0,n.jsx)("th",{className:"px-4 py-3 font-medium text-ink-mute w-[100px] break-keep",children:"기준일"})]})}),(0,n.jsx)("tbody",{children:z.map((e,t)=>{var s,a;return(0,n.jsxs)("tr",{className:"border-b border-line last:border-b-0 hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("td",{className:"px-4 py-4 text-center w-[70px] break-keep",children:(0,n.jsx)("input",{type:"checkbox",className:"cursor-pointer checkbox",checked:l.data.includes(e),onChange:t=>r(e,t.target.checked)})}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[180px] break-keep",children:(null==e?void 0:e.공시대상
1)||"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[110px] break-keep",children:(null==e?void 0:e.this_month)?"".concat(e.this_month,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[110px] break-keep",children:(null==e?void 0:e.ytd)?"".concat(e.ytd,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[95px] break-keep",children:(null==e?void 0:e["1yr_before"])?"".concat(e["1yr_before"].toFixed(2),"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[95px] break-keep",children:(null==e?void 0:e["2yr_before"])?"".concat(e["2yr_before"].toFixed(2),"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[95px] break-keep",children:(null==e?void 0:e.after_inception)?"".concat(e.after_inception,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[95px] break-keep",children:(null==e?void 0:e.운용보수)?"".concat(e.운용보수,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[95px] break-keep",children:(null==e?void 0:e.판매보수)?"".concat(e.판매보수,"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[105px] break-keep",children:(null==e?void 0:e["총비용비율(TER)"])?"".concat(e["총비용비율(TER)"],"%"):"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink text-center w-[120px] break-keep",children:(null==e?void 0:e.판매회사)||"-"}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink w-[100px] break-keep",children:null!=(a=null!=(s=x[null==e?void 0:e.표준코드])?s:null==e?void 0:e.Date)?a:"-"})]},t)})})]})})}),(0,n.jsxs)("div",{className:"md:hidden",children:[(0,n.jsx)("div",{className:"bg-white px-4 py-3 border-b border-line",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"relative mobile-sort-container flex-1",children:[(0,n.jsxs)("button",{onClick:()=>_(!w),className:"w-full bg-white border border-line rounded-lg px-4 py-3 flex items-center justify-between text-[14px] font-medium text-brand-700 hover:bg-secondary/60 transition-colors",children:[(0,n.jsx)("span",{children:y.key&&(null==(t=T.find(e=>e.key===y.key))?void 0:t.label)||"정렬 기준 선택"}),(0,n.jsx)("span",{className:"transform transition-transform ".concat(w?"rotate-180":""),children:"▼"})]}),w&&(0,n.jsx)("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white border border-line rounded-lg shadow-lg z-50 max-h-[300px] overflow-y-auto",children:T.map(e=>(0,n.jsx)("button",{onClick:()=>(e=>{let t=y.key===e?y.direction:"asc";N({key:e,direction:t}),_(!1)})(e.key),className:"w-full px-4 py-3 text-left text-[14px] hover:bg-secondary/60 transition-colors first:rounded-t-lg last:rounded-b-lg ".concat(y.key===e.key?"bg-secondary text-brand-700 font-medium":"text-ink"),children:e.label},e.key))})]}),(0,n.jsx)("button",{onClick:()=>{if(!y.key)return;let e="desc"===y.direction?"asc":"desc";N({...y,direction:e})},disabled:!y.key,className:"px-4 py-3 h-[49px] rounded-lg border transition-colors flex items-center justify-center ".concat(y.key?"bg-white border-line text-brand-700 hover:bg-secondary/60":"bg-secondary border-line text-ink-mute cursor-not-allowed"),title:y.key?"정렬 방향 변경":"먼저 정렬 기준을 선택하세요",children:"desc"===y.direction?(0,n.jsx)(F.A,{className:"w-5 h-5"}):(0,n.jsx)(D.A,{className:"w-5 h-5"})})]})}),(0,n.jsx)("div",{className:"bg-secondary/60 px-4 py-3 border-b border-line",children:(0,n.jsx)("h4",{className:"text-sm font-medium text-ink-mute",children:"상품별 상세 정보"})}),(0,n.jsx)("div",{className:"divide-y divide-line",children:z.map((e,t)=>{var s,a;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("input",{type:"checkbox",className:"cursor-pointer checkbox",checked:l.data.includes(e),onChange:t=>r(e,t.target.checked)}),(0,n.jsx)("span",{className:"text-sm font-semibold text-ink",children:(null==e?void 0:e.공시대상)||"-"})]})}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"이번달 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.this_month)?"".concat(e.this_month,"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"올해 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.ytd)?"".concat(e.ytd,"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"1년전"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e["1yr_before"])?"".concat(e["1yr_before"].toFixed(2),"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"2년전"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e["2yr_before"])?"".concat(e["2yr_before"].toFixed(2),"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"설정이후"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.after_inception)?"".concat(e.after_inception,"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"기준일"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:null!=(a=null!=(s=x[null==e?void 0:e.표준코드])?s:null==e?void 0:e.Date)?a:"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"운용보수"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.운용보수)?"".concat(e.운용보수,"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"판매보수"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.판매보수)?"".concat(e.판매보수,"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"총비용비율"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e["총비용비율(TER)"])?"".concat(e["총비용비율(TER)"],"%"):"-"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-soft",children:"판매회사"}),(0,n.jsx)("span",{className:"font-medium text-ink",children:(null==e?void 0:e.판매회사)||"-"})]})]})]},t)})})]})]}),!i.loading&&i.message&&(0,n.jsx)("div",{className:"h-[150px] flex justify-center items-center",children:i.message}),i.loading&&(0,n.jsx)("div",{className:"h-[150px] flex justify-center items-center",children:(0,n.jsx)(k.Ay,{})})]})]})}},56971:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var n=s(70127);s(70567);var a=s(36870),l=s(9638),r=s(93374);function i(e){let{isOpen:t,onClose:s,selectedProducts:i}=e,o=(0,l.r)();if(!t)return null;let d=((null==i?void 0:i.length)||0)>0;return(0,a.createPortal)((0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-[99999999999] p-4",style:{zIndex:0x174876e7ff},children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl max-w-lg w-full p-8 relative z-[99999999999]",style:{zIndex:0x174876e7ff},children:[(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)("h2",{className:"text-xl font-bold tracking-tight text-ink mb-4 break-keep text-center",children:d?"아래 상품으로 포트폴리오를 만들어 볼까요?":"선택하신 종목을 시작으로, 포트폴리오를 만들어볼까요?"}),(0,n.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-secondary/60 rounded-lg",children:[(0,n.jsx)(r.tEG,{className:"text-brand-700 flex-shrink-0 mt-0.5",size:18}),(0,n.jsx)("p",{className:"text-sm text-ink-soft break-keep",children:"포트폴리오 생성 시 선택하신 상품들이 자동으로 추가됩니다."})]})]}),d&&(0,n.jsx)("div",{className:"mb-6",children:(0,n.jsxs)("div",{className:"border border-line rounded-xl p-4 bg-white",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-brand-700 mb-4",children:"포트폴리오 구성"}),(0,n.jsx)("div",{className:"space-y-3",children:i.map((e,t)=>{let s=e.한글종목약명||e.종목이름||e.name||e.fund_name||e.공시대상||"N/A",a=e.weight||0;return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{className:"flex-1 pr-4",children:(0,n.jsx)("p",{className:"text-sm text-ink break-keep",children:s})}),a>0&&(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,n.jsxs)("span",{className:"text-sm font-medium text-brand-700 tabular-nums",children:[a.toFixed(2),"%"]})})]},t)})})]})}
1),!d&&(0,n.jsx)("div",{className:"mb-6",children:(0,n.jsx)("p",{className:"text-sm text-ink-soft break-keep text-center",children:"기존 포트폴리오의 리밸런싱이 필요한 경우, 개별 포트폴리오 리밸런싱에서 종목을 추가해주세요"})}),(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsx)("button",{onClick:()=>{s()},className:"flex-1 py-3 px-4 bg-secondary text-ink-soft hover:text-ink font-medium rounded-lg transition-colors",children:"나중에 할래요"}),(0,n.jsx)("button",{onClick:()=>{o.push("/portfolio-builder/select-type")},className:"flex-1 py-3 px-4 bg-ink hover:bg-ink/90 text-white font-semibold rounded-lg transition-colors",children:"좋아요"})]})]})}),document.body)}},57804:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var n=s(70127);s(70567);let a=e=>{let{snapShotData:t,checkedStates:s,toggleCheckbox:a,handleTicketDetails:l,selectedIndex:r,cashAmount:i,includeCash:o,onToggleCash:d}=e;return(0,n.jsxs)("div",{className:"flex items-center justify-start flex-col h-[300px] md:h-[400px] overflow-y-auto rounded-tl-[12px] rounded-bl-[12px] border border-line",children:[t.data.map((e,t)=>{var i,o;return(0,n.jsxs)("div",{className:"flex items-center w-full px-3 md:px-4 py-4 md:py-5 border-b border-line hover:bg-secondary/40 cursor-pointer ".concat(t===r?"bg-secondary":""),children:[(0,n.jsx)("input",{type:"checkbox",checked:s[t],onChange:()=>a(t),className:"accent-brand-700 flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-col w-full px-4 md:px-8 min-w-0",onClick:()=>l(e,t),children:[(null==e?void 0:e.input_asset_name)&&(0,n.jsx)("span",{className:"text-ink text-[13px] md:text-[14px] font-[500] truncate",children:null==e?void 0:e.input_asset_name}),(null==e||null==(i=e.matched_asset)?void 0:i.official_name)&&(0,n.jsx)("span",{className:"text-ink-soft text-[11px] md:text-[12px] font-[400] truncate",children:null==e||null==(o=e.matched_asset)?void 0:o.official_name})]}),(0,n.jsx)("span",{onClick:()=>l(e,t),className:"text-ink-mute text-[11px] md:text-[12px] font-[500] hover:text-brand-700 whitespace-nowrap flex-shrink-0",children:"세부정보"})]},t)}),i>0&&(0,n.jsxs)("div",{className:"flex items-center w-full px-3 md:px-4 py-4 md:py-5 border-b border-line hover:bg-secondary/40",children:[(0,n.jsx)("input",{type:"checkbox",checked:o,onChange:d,className:"accent-brand-700 flex-shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-col w-full px-4 md:px-8 min-w-0",children:[(0,n.jsx)("span",{className:"text-ink text-[13px] md:text-[14px] font-[500] truncate",children:"현금"}),(0,n.jsxs)("span",{className:"text-ink-soft text-[11px] md:text-[12px] font-[400] truncate",children:[i.toLocaleString(),"원"]})]})]})]})}},57905:(e,t,s)=>{"use strict";s(70127),s(70567)},58086:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>x,BD:()=>c,Hr:()=>o,Sn:()=>u,YB:()=>d});var n=s(70127),a=s(21757),l=s(76003),r=s(26896),i=s(99736);let o=[{value:"dailyLiving",label:"일상 생활비",icon:l.L6f},{value:"travelLeisure",label:"여행\xb7여가",icon:l.vGh},{value:"medical",label:"의료비",icon:l.oA9}],d={dailyLiving:[{key:"food",label:"식비",subtext:"식재료\xb7외식\xb7배달"},{key:"housing",label:"주거비",subtext:"월세\xb7관리비\xb7수리"},{key:"utilities",label:"공과금",subtext:"전기\xb7가스\xb7수도"},{key:"transport",label:"교통비",subtext:"대중교통\xb7자가용 유지비\xb7주유"},{key:"communication",label:"통신비",subtext:"휴대폰\xb7인터넷\xb7TV"},{key:"clothing",label:"의류\xb7미용",subtext:"옷\xb7미용\xb7세탁"},{key:"household",label:"생활용품",subtext:"생필품\xb7가전\xb7잡화"},{key:"education",label:"교육\xb7자기계발",subtext:"학원\xb7강의\xb7도서"}],travelLeisure:[{key:"domestic_travel",label:"국내 여행",subtext:"국내 숙박\xb7교통\xb7관광"},{key:"overseas_travel",label:"해외 여행",subtext:"항공\xb7숙박\xb7현지비용"},{key:"dining_social",label:"외식\xb7모임",subtext:"모임\xb7회식\xb7카페"},{key:"hobby_sports",label:"취미\xb7스포츠",subtext:"운동\xb7취미\xb7레저"},{key:"family_events",label:"경조사비",subtext:"축하\xb7조의\xb7선물"},{key:"allowance",label:"용돈\xb7가족 지원",subtext:"자녀\xb7부모 지원"}],medical:[{key:"hospital",label:"병원\xb7진료비",subtext:"외래\xb7입원\xb7검사"},{key:"medicine",label:"약제비",subtext:"처방\xb7일반의약품"},{key:"dental_oriental",label:"치과\xb7한의원",subtext:"치과\xb7한방 치료"},{key:"insurance",label:"보험료",subtext:"실손\xb7건강보험"},{key:"care",label:"간병\xb7돌봄",subtext:"간병\xb7요양\xb7돌봄"},{key:"supplements",label:"건강보조식품",subtext:"영양제\xb7건강기능식품"}]};function c(e){var t,s;return null!=(s=null==(t=o.find(t=>t.value===e))?void 0:t.label)?s:e}function u(e){let t=d.dailyLiving[0];return{id:e,category:"dailyLiving",itemKey:t.key,label:t.label,monthly:0}}function x(e){var t;let{value:s,onChange:l,onCancel:c,onSave:u,saveState:x}=e,m=o.find(e=>e.value===s.category),h=d[s.category],p=s.label?"".concat(s.label," — ").concat(m.label):"새 지출",f=e=>l({...s,...e});return(0,n.jsxs)(i.um,{title:p,icon:m.icon,iconBg:"#E0A32E",onCancel:c,onSave:u,saveState:x,children:[(0,n.jsxs)("div",{className:"sm:col-span-2",children:[(0,n.jsx)("div",{className:"text-ink-mute mb-2 text-xs font-medium",children:"1. 분류 선택 - 이 지출 항목 하나가 속할 분류입니다"}),(0,n.jsx)("div",{className:"grid grid-cols-3 gap-3",children:o.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>(e=>{let t=d[e][0];f({category:e,itemKey:t.key,label:t.label})})(e.value),className:(0,r.cn)("flex cursor-pointer flex-col items-center gap-2 rounded-xl border px-3 py-4 transition-colors",s.c
1ategory===e.value?"border-brand-700 bg-brand-700/5":"border-line hover:bg-secondary/40"),children:[(0,n.jsx)("span",{className:(0,r.cn)("flex h-11 w-11 items-center justify-center rounded-full",s.category===e.value?"bg-brand-700 text-white":"bg-secondary text-ink-soft"),children:(0,n.jsx)(a.V9D,{icon:e.icon,size:19})}),(0,n.jsx)("span",{className:"text-ink text-sm font-semibold",children:e.label})]},e.value))})]}),(0,n.jsxs)("div",{className:"sm:col-span-2",children:[(0,n.jsx)("div",{className:"text-ink-mute mb-2 text-xs font-medium",children:"2. 세부 항목 선택 - 하나만 고르세요 (다른 항목은 저장 후 “지출 추가”로 따로 등록)"}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-3",children:h.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>(e=>{var t;let n=h.find(t=>t.key===e);f({itemKey:e,label:null!=(t=null==n?void 0:n.label)?t:s.label})})(e.key),className:(0,r.cn)("cursor-pointer rounded-xl border px-4 py-3 text-left transition-colors",s.itemKey===e.key?"border-brand-700 bg-brand-700/5":"border-line hover:bg-secondary/40"),children:[(0,n.jsx)("div",{className:"text-ink text-sm font-bold",children:e.label}),(0,n.jsx)("div",{className:"text-ink-mute mt-0.5 text-xs",children:e.subtext})]},e.key))})]}),(0,n.jsxs)("div",{className:"sm:col-span-2",children:[(0,n.jsxs)("div",{className:"text-ink-mute mb-2 text-xs font-medium",children:["3. 위에서 고른 “",s.label||"항목","”의 월 예상 금액"]}),(0,n.jsx)(i.eW,{label:"월 예상 금액",value:(t=s.monthly)?String(Math.round(t/1e4)):"",onCh
1ange:e=>f({monthly:function(e){let t=Number(e.replace(/,/g,""));return!Number.isFinite(t)||t<0?0:Math.round(1e4*t)}(e)}),suffix:"만"})]})]})}},59317:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var n=s(70127),a=s(70567);let l=a.useLayoutEffect;function r(e){let{options:t,value:s,onChange:r}=e,i=(0,a.useRef)(null),o=(0,a.useRef)({}),[d,c]=(0,a.useState)(null);return l(()=>{let e=i.current,t=o.current[s];if(!e||!t)return;let n=e.getBoundingClientRect(),a=t.getBoundingClientRect();c({left:a.left-n.left,width:a.width})},[s,t]),(0,n.jsxs)("div",{ref:i,className:"bg-secondary relative inline-flex w-fit gap-1 rounded-2xl p-1.5",children:[d&&(0,n.jsx)("span",{"aria-hidden":!0,className:"border-line absolute top-1.5 bottom-1.5 rounded-xl border bg-white shadow-sm transition-[left,width] duration-[250ms] ease-out",style:{left:d.left,width:d.width}}),t.map(e=>{let t=s===e.value;return(0,n.jsx)("button",{ref:t=>{o.current[e.value]=t},type:"button",onClick:()=>{t||r(e.value)},className:"relative z-10 cursor-pointer rounded-xl px-4 py-2 text-sm transition-colors duration-200 ".concat(t?"text-brand-700 font-semibold":"text-ink-soft hover:text-ink font-medium"),children:e.label},e.value)})]})}},61339:(e,t,s)=>{"use strict";s.d(t,{bq:()=>N,eb:()=>_,gC:()=>w,l6:()=>y,yv:()=>k});var n=s(70127);s(70567);var a=s(66172),l=s(4483),r=s(57895),i=s(2887),o=s(78589),d=s(82841),c=s(95935),u=s(42669),x=s(61531),m=s(65242),h=s(63660),p=s(41743),f=s(22013),b=s(26896),v=s(28343),g=s(32901),j=s(96044);let y=a.H;function k(e){let{className:t,...s}=e;return(0,n.jsx)(l.y,{"data-slot":"select-value",className:(0,b.cn)("flex flex-1 text-left",t),...s})}function N(e){let{className:t,size:s="default",children:a,...l}=e;return(0,n.jsxs)(r.b,{"data-slot":"select-trigger","data-size":s,className:(0,b.cn)("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l,children:[a,(0,n.jsx)(i.w,{render:(0,n.jsx)(v.A,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function w(e){let{className:t,children:s,side:a="bottom",sideOffset:l=6,align:r="start",alignOffset:i=0,alignItemWithTrigger:x=!1,...m}=e;return(0,n.jsx)(o.V,{children:(0,n.jsx)(d.l,{side:a,sideOffset:l,align:r,alignOffset:i,alignItemWithTrigger:x,className:"isolate z-50",children:(0,n.jsxs)(c.t,{"data-slot":"select-content","data-align-trigger":x,className:(0,b.cn)("border-line relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-md outline-none","duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2","data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95","data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-[align-trigger=true]:animate-none",t),...m,children:[(0,n.jsx)(S,{}),(0,n.jsx)(u.B,{children:s}),(0,n.jsx)(C,{})]})})})}function _(e){let{className:t,children:s,...a}=e;return(0,n.jsxs)(x.e,{"data-slot":"select-item",className:(0,b.cn)("relative flex w-full cursor-pointer items-center gap-1.5 rounded-md py-1.5 pr-8 pl-2 text-sm outline-hidden select-none","transition-[background-color,color,transform] duration-150 ease-out","hover:bg-secondary/70 data-highlighted:bg-secondary data-highlighted:text-ink","focus-visible:bg-secondary focus-visible:text-ink","active:scale-[0.99]","data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","*:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[(0,n.jsx)(m.h,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:s}),(0,n.jsx)(h.h,{render:(0,n.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,n.jsx)(g.A,{className:"pointer-events-none"})})]})}function S(e){let{className:t,...s}=e;return(0,n.jsx)(p.w,{"data-slot":"select-scroll-up-button",className:(0,b.cn)("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",t),...s,children:(0,n.jsx)(j.A,{})})}function C(e){let{className:t,...s}=e;return(0,n.jsx)(f.d,{"data-slot":"select-scroll-down-button",className:(0,b.cn)("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",t),...s,children:(0,n.jsx)(v.A,{})})}},61838:(e,t,s)=>{"use strict";s.d(t,{A:()=>
1o});var n=s(70127),a=s(70567),l=s(80602),r=s(95619);s(70746);var i=s(17665);let o=e=>{let{data:t,search:s,message:o,option:d,show_selection:c,selectedItems:u,setSelectedItems:x,loading:m=!1}=e,h=(e,t)=>{x(s=>{let n=t?[...s.data,e]:s.data.filter(t=>t!==e);return{...s,data:n}})},[p]=(0,a.useState)(!0),[f]=(0,a.useState)(!1),[b,v]=(0,a.useState)({});(0,a.useEffect)(()=>{let e={};Array.isArray(t)&&t.forEach((t,s)=>{e[s]=!0}),v(e)},[t]);let g=()=>(0,n.jsx)("div",{className:"absolute inset-0 bg-white/80 backdrop-blur-sm z-30 flex justify-center items-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,n.jsx)("div",{className:"w-12 h-12 border-4 border-brand-700 border-t-transparent rounded-full animate-spin"}),(0,n.jsx)("p",{className:"text-brand-700 font-medium",children:"데이터를 불러오는 중..."})]})});return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"bg-white rounded-xl border border-line w-full",children:[(0,n.jsx)("div",{className:"border-b border-line text-ink p-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"bg-secondary text-brand-700 rounded-full p-2",children:(0,n.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})}),(0,n.jsx)("div",{children:(0,n.jsx)("h3",{className:"text-xl md:text-2xl font-bold tracking-tight",children:"상품 정보"})})]})}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"hidden md:block",children:(0,n.jsxs)("div",{className:"overflow-auto max-h-[60vh] relative",children:[m&&(0,n.jsx)(g,{}),(0,n.jsxs)("table",{className:"w-full table-auto text-sm text-left text-ink-soft border-collapse",children:[(0,n.jsx)("thead",{className:"bg-secondary sticky top-0 z-40 shadow-sm",children:(0,n.jsx)("tr",{children:["펀드명","투자위험등급","stock"===d&&""!==s.trim()?"배분율":null,"전일 수익률","지난달 수익률","올해 수익률","총비용비율","헤지여부","1년 수익률","2년 수익률","3년 수익률","설정이후","수익률대비위험률(3년샤프지수)","기초지수","펀드유형","투자지역","테마","운용실적공시분류","운용회사"].map((e,t)=>e&&(0,n.jsx)("th",{scope:"col",className:"px-4 py-3 text-xs font-medium text-ink-mute min-w-[200px] bg-secondary ".concat(0===t?"sticky left-0 top-0 z-50":""),children:"전일 수익률"===e?(0,n.jsx)(i.A,{label:e}):e},t))})}),t&&(0,n.jsx)("tbody",{children:null==t?void 0:t.map((e,t)=>{var a;let i=u.data.includes(e);return(0,n.jsxs)("tr",{className:"group border-b border-line last:border-b-0 hover:bg-secondary/40 transition-colors",children:[(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink sticky left-0 z-20 bg-white transition-colors group-hover:bg-secondary cursor-pointer",onClick:()=>"true"===c?null:(0,r.r)(e.단축코드),children:"true"===c?(0,n.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,n.jsx)("input",{type:"checkbox",className:"cursor-pointer checkbox",checked:i,onClick:e=>e.stopPropagation(),onChange:t=>h(e,t.target.checked)}),(0,n.jsx)("p",{className:"w-[90%] text-sm whitespace-nowrap",onClick:()=>(0,r.r)(e.단축코드),children:e.한글종목약명})]}):(0,n.jsx)("div",{className:"text-sm whitespace-nowrap",children:e.한글종목약명})}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:(0,l.$D)(e.투자위험등급)}),"stock"===d&&""!==s.trim()&&(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e&&null!==e.percentage&&void 0!==e.percentage?e.percentage.toFixed(2):""}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null!=(a=null==e?void 0:e["전일 수익률"])?a:""}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e&&null!==e["지난달 수익률"]&&void 0!==e["지난달 수익률"]?e["지난달 수익률"].toFixed(2):""}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e["올해 수익률"]}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e.총비용비율}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:(0,l.Tz)(e.헤지여부)}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e["1년 수익률"]}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e["2년 수익률"]}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e["3년 수익률"]}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e.설
1정이후}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e["수익률대비위험률(3년샤프지수)"]}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e.기초지수}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e.펀드유형}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e.투자지역}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:null==e?void 0:e.테마}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e.운용실적공시분류}),(0,n.jsx)("td",{className:"px-4 py-4 font-medium text-ink whitespace-nowrap tabular-nums",children:e.운용회사})]},t)})})]})]})}),(0,n.jsxs)("div",{className:"md:hidden bg-white relative",children:[m&&(0,n.jsx)(g,{}),(0,n.jsx)("div",{className:"bg-secondary/60 px-4 py-3 border-b border-line",children:(0,n.jsx)("h4",{className:"text-xs font-medium text-ink-mute",children:"상품별 상세 정보"})}),(0,n.jsx)("div",{className:"divide-y divide-line max-h-[60vh] overflow-auto overscroll-contain",children:null==t?void 0:t.map((e,t)=>{var a;let i=u.data.includes(e);return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:["true"===c&&(0,n.jsx)("input",{type:"checkbox",className:"cursor-pointer checkbox",checked:i,onChange:t=>h(e,t.target.checked)}),(0,n.jsx)("span",{className:"text-[13px] leading-tight font-semibold text-ink cursor-pointer break-words max-w-[65%] line-clamp-2",onClick:()=>"true"===c?null:(0,r.r)(e.단축코드),children:e.펀드명})]}),(0,n.jsx)("div",{className:"flex items-center gap-2 flex-nowrap",children:(0,n.jsx)("button",{className:"px-3 h-7 text-xs leading-none rounded-lg bg-secondary text-ink-soft hover:text-ink whitespace-nowrap",onClick:()=>(e=>{v(t=>({...t,[e]:!t[e]}))})(t),children:b[t]?"닫기":"상세정보"})})]}),b[t]&&(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"투자위험등급"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(0,l.$D)(e.투자위험등급)})]}),"stock"===d&&""!==s.trim()&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"배분율"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e&&null!==e.percentage&&void 0!==e.percentage?e.percentage.toFixed(2):""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"전일 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:null!=(a=null==e?void 0:e["전일 수익률"])?a:""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"지난달 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e&&null!==e["지난달 수익률"]&&void 0!==e["지난달 수익률"]?e["지난달 수익률"].toFixed(2):""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"올해 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(null==e?void 0:e["올해 수익률"])||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"총비용비율"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.총비용비율||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"헤지여부"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(0,l.Tz)(e.헤지여부)})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"1년 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(null==e?void 0:e["1년 수익률"])||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"2년 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(null==e?void 0:e["2년 수익률"])||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"3년 수익률"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(null==e?void 0:e["3년 수익률"])||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"설정이후"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.설
1정이후||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"샤프지수"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(null==e?void 0:e["수익률대비위험률(3년샤프지수)"])||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"기초지수"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:(null==e?void 0:e.기초지수)||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"펀드유형"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.펀드유형||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"투자지역"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.투자지역||""})]}),(null==e?void 0:e.테마)&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"테마"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.테마})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"운용실적공시분류"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.운용실적공시분류||""})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-ink-mute",children:"운용회사"}),(0,n.jsx)("span",{className:"font-medium text-ink tabular-nums",children:e.운용회사||""})]})]})]},t)})})]})]}),o&&(0,n.jsxs)("div",{className:"text-center text-ink-soft text-base mt-4 flex justify-center items-center w-full",children:["내용을 찾을 수 없습니다 ",o]})]})})}},61863:(e,t,s)=>{"use strict";s.d(t,{_:()=>o});var n=s(70127);s(70567);var a=s(21757),l=s(76003),r=s(35024);s(20451);let i=[{id:"ETF",title:"ETF 추가",desc:"상장지수펀드",icon:l.N$Z,iconBg:"#0F766E"},{id:"TDF",title:"TDF 추가",desc:"타깃데이트펀드",icon:l.Jqh,iconBg:"#3B82F6"},{id:"search",title:"검색으로 추가",desc:"종목명으로 ETF\xb7TDF 전체에서 검색",icon:l.T4K,iconBg:"#7E8F8A"}];function o(e){let{open:t,onClose:s,onSelect:l}=e;return(0,n.jsxs)(r.A,{open:t,onClose:s,labelledBy:"add-product-type-title",maxWidth:"max-w-[480px]",children:[(0,n.jsx)("h2",{id:"add-product-type-title",className:"text-ink mb-6 text-xl font-bold tracking-tight",children:"종목 추가"}),(0,n.jsx)("div",{className:"grid gap-3",children:i.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>{l(e.id),s()},className:"border-line hover:bg-secondary/40 hover:border-brand-700/40 flex cursor-pointer items-center gap-3.5 rounded-xl border bg-white px-5 py-4 text-left transition-colors duration-150",children:[(0,n.jsx)("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-white",style:{background:e.iconBg},children:(0,n.jsx)(a.V9D,{icon:e.icon,size:19})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"text-ink text-[15px] font-bold",children:e.title}),(0,n.jsx)("div",{className:"text-ink-mute mt-1 text-xs leading-relaxed",children:e.desc})]})]},e.id))})]})}},70746:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>l,h4:()=>r,hn:()=>i,o1:()=>o});var n=s(70127);s(70567);let a="animate-spin rounded-full border-brand-700 border-t-transparent",l=()=>(0,n.jsx)("div",{className:"h-10 w-10 border-4 ".concat(a),"aria-label":"로딩 중"}),r=()=>(0,n.jsx)("div",{className:"h-5 w-5 border-2 ".concat(a),"aria-label":"로딩 중"}),i=()=>(0,n.jsx)("div",{className:"h-12 w-12 border-4 ".concat(a),"aria-label":"로딩 중"}),o=()=>(0,n.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-[3px] border-white border-t-transparent","aria-label":"로딩 중"})},71341:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>r,Oj:()=>a,sO:()=>l});var n=s(70127);s(70567);let a={지역:["전체","국내","해외","국내&해외"],자산군:["전체","주식","채권","혼합자산","기타","원자재","부동산"],운용방식:["전체","패시브","액티브"]};function l(e,t){return Object.entries(t).every(t=>{let[s,n]=t;return"전체"===n||(null==e?void 0:e[s])===n})}function r(e){let{value:t,onChange:s,className:l=""}=e;return(0,n.jsxs)("div",{className:"border-line border-t pt-4 ".concat(l).trim(),children:[(0,n.jsx)("div",{className:"text-ink mb-3 text-sm font-bold",children:"테마 필터"}),(0,n.jsx)("div",{className:"divide-line grid grid-cols-1 gap-y-4 md:grid-cols-3 md:gap-y-0 md:divide-x",children:Object.entries(a).map((e,a)=>{let[l,r]=e;return(0,n.jsxs)("div",{className:"flex flex-col gap-2 ".concat(a>0?"md:pl-6":""," ").concat(a<2?"md:pr-6":""),children:[(0,n.jsx)("span",{className:"text-ink-mute text-xs font-medium",children:l}),(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.map(e=>{let a=t[l]===e;return(0,n.jsxs)("button",{type:"button",onClick:()=>s({...t,[l]:e}),className:"cursor-pointer rounded-full border px-3 py-1.5 text-sm font-medium transition-colors ".concat(a?"border-brand-700 bg-secondary text-brand-700":"border-line text-ink-soft hover:bg-secondary/60 bg-white"),children:[a?"✓ ":"",e]},e)})})]},l)})})]})}},75240:(e,t,s)=>{"use strict";s.d(t,{KQ:()=>i,L_:()=>x,SQ:()=>c,Sx:()=>d,UQ:()=>a,aE:()=>l,eH:()=>n,rK:()=>u,u9:()=>o});let n="전체",a={region:[],asset_class:[],management_style:[]},l=[{key:"region",label:"지역",options:[n,"국내","해외","국내&해외"]},{key:"asset_class",label:"자산군",options:[n,"주식","채권","혼합자산","기타","원자재","부동산","통화"]},{key:"management_style",label:"운용방식",options:[n,"패시브","액티브"]}];function r(e){return Array.isArray(e)?e.filter(e=>e&&e!==n):e&&e!==n?[e]:[]}function i(e,t){return t===n?0===r(e).length:r(e).includes(t)}function o(e,t){let s=r(e);return t===n?[]:s.includes(t)?s.filter(e=>e!==t):[...s,t]}function d(e){let t=r(e);return 0===t.length?n:1===t.length?t[0]:"".concat(t[0]," 외 ").concat(t.length-1)}function c(e){let t={};
1return Object.entries(e).forEach(e=>{let[s,n]=e,a=r(n);t[s]=0===a.length?["all"]:a}),t}function u(e){return Object.values(e).some(e=>r(e).length>0)}function x(e,t){let s=r(e),n=r(t);return s.length===n.length&&s.every((e,t)=>e===n[t])}},76564:(e,t,s)=>{"use strict";s.d(t,{w:()=>a});let n=new Map;async function a(e){let t=e.filter(e=>e.kr_code&&!n.has(e.kr_code));if(t.length>0){let e=await fetch("/api/v2/portfolios/assets/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assets:t})});if(!e.ok)throw Error("종목 메타데이터 조회 실패 (".concat(e.status,")"));let s=await e.json();if(Array.isArray(s))for(let e of s)e.kr_code&&n.set(e.kr_code,e)}return new Map(n)}},76579:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var n=s(70567),a=s(74590),l=s(19450);let r=function(){let[e,t]=(0,n.useState)({loading:!1,message:null,data:null,cash:null,noMatch:!1}),[s,r]=(0,n.useState)(!1),[i,o]=(0,n.useState)(!1),[d,c]=(0,n.useState)(!1);return{uploadSnapshot:async e=>{let{files:s,universe:n}=e,i=new FormData;s.forEach(e=>{i.append("files",e)}),i.append("universe",(0,l.o)(n)),t(e=>({...e,loading:!0,data:null,cash:null,noMatch:!1,message:null})),o(!1),c(!1),r(!1);try{var d,u,x;let e=(await a.O.post("/api/v3/withdrawal/analyze-image",i,{headers:{"Content-Type":"multipart/form-data"}})).data,s=null==e||null==(d=e.accounts)?void 0:d[0],n=Array.isArray(null==s?void 0:s.results)?s.results:Array.isArray(null==e?void 0:e.results)?e.results:[],l=null!=(x=null!=(u=null==s?void 0:s.cash)?u:null==e?void 0:e.cash)?x:null,r=n&&Array.isArray(n)?n.filter(e=>e&&e.matched_asset&&e.matched_asset.standard_code):[];if(!r||0===r.length)return t(e=>({...e,loading:!1,data:[],cash:l,noMatch:!0,message:null})),{noMatch:!0,cash:l};return t(e=>({...e,loading:!1,data:r,cash:l,noMatch:!1,message:null})),c(!0),{noMatch:!1,cash:l}}catch(e){return o(!0),t(t=>{var s,n;return{...t,loading:!1,data:null,cash:null,noMatch:!1,message:(null==e||null==(n=e.response)||null==(s=n.data)?void 0:s.message)||"문제가 발생했습니다."}}),console.error("스냅샷 업로드 오류:",e),{noMatch:!1,cash:null,error:!0}}},snapShotData:e,setSnapShotData:t,messageModal:s,setMessageModal:r,uploadFailed:i,setUploadFailed:o,showInfoModal:d,setShowInfoModal:c}}},77416:(e,t,s)=>{"use strict";s.d(t,{A:()=>f});var n=s(70127),a=s(70567),l=s(12900),r=s(51652),i=s(93374);s(70746);var o=s(99834),d=s(74590),c=s(12699),u=s(57804),x=s(49661),m=s(83843),h=s(56971);let p=e=>{let{name:t,ModalClose:s,message:a}=e;return(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity flex items-center justify-center z-[100000001]",children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl p-6 w-[90%] max-w-md",children:[t&&(0,n.jsxs)("h2",{className:"text-lg font-semibold text-ink mb-4",children:["종목명: ",t]}),(0,n.jsx)("p",{className:"text-ink-soft mb-6",children:a}),(0,n.jsx)("div",{className:"flex justify-end space-x-3",children:(0,n.jsx)("button",{onClick:s,className:"px-4 py-2 bg-secondary text-ink-soft hover:text-ink text-sm font-medium rounded-lg",children:"취소"})})]})})},f=function(e){let{isOpen:t,onClose:s,token:f,pensionScope:b}=e,[v,g]=(0,a.useState)(""),[j,y]=(0,a.useState)(null),[k,N]=(0,a.useState)(!1),w=(0,a.useRef)(null),[_,S]=(0,a.useState)(!1),[C,T]=(0,a.useState)(!1),[E,A]=(0,a.useState)(!1),[F,D]=(0,a.useState)(null),[M,P]=(0,a.useState)([]),[L,R]=(0,a.useState)([]),[z,B]=(0,a.useState)(null),[I,Y]=(0,a.useState)({loading:!0,data:null,message:null}),[O,W]=(0,a.useState)(null),{setProducts:U}=(0,m.A)(),V=async(e,t)=>{var s,n,a,l,r;let i=null==e||null==(s=e.matched_asset)?void 0:s.asset_type,o=null==e||null==(n=e.matched_asset)?void 0:n.standard_code,c=(null==e||null==(a=e.matched_asset)?void 0:a.rep_standard_code)||null;B(i),W(t),Y(e=>({...e,loading:!0}));let u="ETF"===i?"".concat("","/api/v1/asset-detail/?asset_type=").concat(i,"&standard_code=").concat(o):"".concat("","/api/v1/asset-detail/?asset_type=").concat(i,"&standard_code=").concat(o,"&rep_standard_code=").concat(c);try{let e=await d.A.get(u);Y({loading:!1,data:e.data||null,message:e.data?null:"No data available"})}catch(e){Y({loading:!1,data:null,message:(null==e||null==(r=e.response)||null==(l=r.data)?void 0:l.message)||"Something went wrong"})}},K=async()=>{let e=new Set,t=null==M?void 0:M.map((t,s)=>{var n;let a=null==t||null==(n=t.matched_asset)?void 0:n.standard_code;return t.matched_asset&&L[s]&&!e.has(a)?(e.add(a),{kr_code:a,asset_type:t.matched_asset.asset_type,fund_name:t.matched_asset.short_name||t.matched_asset.official_name}):null}
1).filter(Boolean);if(!t||0===t.length)return void o.Ay.error("선택한 상품이 없습니다.");U(t,"search"),s()};return(0,a.useEffect)(()=>{if(null==M?void 0:M.length){let e=M.findIndex(e=>e.matched_asset);-1!==e&&V(M[e],e)}},[M]),(0,a.useEffect)(()=>{(null==M?void 0:M.length)>0&&R(e=>[...Array(M.length-e.length).fill(!0),...e])},[M]),(0,a.useEffect)(()=>{t||(P([]),R([]),g(""),y(null),Y({loading:!0,data:null,message:null}),W(null),B(null))},[t]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.e,{appear:!0,show:t,as:a.Fragment,children:(0,n.jsxs)(r.lG,{as:"div",className:"relative z-[100000000]",onClose:s,children:[(0,n.jsx)(l.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40"})}),(0,n.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,n.jsx)(l.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,n.jsxs)(r.lG.Panel,{className:"flex h-[min(90dvh,920px)] max-h-[90vh] w-full max-w-6xl min-h-0 transform flex-col overflow-hidden rounded-2xl bg-white text-left align-middle shadow-xl transition-all",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center px-6 pt-6 pb-4 flex-shrink-0",children:[(0,n.jsx)(r.lG.Title,{as:"h3",className:"text-ink text-xl font-bold tracking-tight",children:"검색하여 상품 추가"}),(0,n.jsx)("button",{onClick:s,className:"text-ink-mute hover:text-ink-soft",children:(0,n.jsx)(i.$8F,{size:24})})]}),(0,n.jsxs)("div",{className:"w-full min-h-0 flex-1 overflow-y-auto px-6 pb-4",children:[(0,n.jsx)(x.Ay,{selectTickers:null,handleSubmit:()=>{},setCurrentSearch:()=>{},query:v,setQuery:g,token:f,setSnapShotData:()=>{},setLoadingElastic:()=>{},setShowConfirmModal:T,selectedTicker:j,setSelectedTicker:y,DropdownOpen:k,setDropdownOpen:N,dropdownRef:w,handleFinalSubmit:e=>{let t=e.short_name||e.name,s={input_asset_name:t,matched_asset:{asset_type:e.asset_type||"",official_name:e.name||"",rep_standard_code:e.rep_standard_code||"",short_code:e.short_code||"",short_name:e.short_name||"",standard_code:e.standard_code||""}};if(M.some(e=>{var t,n;return(null==e||null==(t=e.matched_asset)?void 0:t.standard_code)===(null==s||null==(n=s.matched_asset)?void 0:n.standard_code)})){D(t),A(!0);return}P([s,...M]),R([!0,...L]),g("")},pensionScope:b}),M&&0!==M.length?(0,n.jsxs)("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4 mt-4",children:[(0,n.jsx)(u.A,{snapShotData:{data:M,loading:!1,message:null},checkedStates:L,toggleCheckbox:e=>{let t=[...L];t[e]=!t[e],R(t)},handleTicketDetails:V,selectedIndex:O}),(0,n.jsx)("div",{className:"flex items-start justify-start flex-col h-[300px] md:h-[400px] overflow-y-auto rounded-tr-[12px] rounded-br-[12px] border border-line p-3 md:p-4",children:(0,n.jsx)(c.A,{tickerDetail:I,assetType:z})})]}):(0,n.jsx)("div",{className:"mt-4 mb-4 flex justify-center items-center h-[380px] border-line border rounded-xl text-center",children:(0,n.jsx)("div",{className:"bg-secondary rounded-lg p-3 md:p-4 max-w-sm md:max-w-md mx-4",children:(0,n.jsxs)("div",{className:"flex items-start space-x-2 md:space-x-3",children:[(0,n.jsx)("div",{className:"w-2 h-2 bg-brand-700 rounded-full mt-2 flex-shrink-0"}),(0,n.jsx)("div",{className:"text-sm text-ink-soft",children:"검색하여 상품을 추가해주세요."})]})})})]}),(0,n.jsxs)("div",{className:"w-full flex flex-shrink-0 flex-col sm:flex-row items-center justify-end gap-3 px-6 py-4 border-t border-line",children:[(0,n.jsx)("button",{className:"w-full sm:w-auto bg-secondary px-4 md:px-5 h-[45px] md:h-[50px] text-ink-soft hover:text-ink text-sm font-medium flex items-center justify-center cursor-pointer rounded-lg",onClick:s,children:"취소"}),(0,n.jsx)("button",{className:"w-full sm:w-auto bg-ink hover:bg-ink/90 px-4 md:px-5 h-[45px] md:h-[50px] text-white text-sm font-semibold flex items-center justify-center cursor-pointer rounded-lg",onClick:K,children:_?"로딩 중...":"포트폴리오에 추가"})]})]})})})})]})}),E&&(0,n.jsx)(p,{name:F,ModalClose:()=>{A(!1),g("")},message:"이미 추가된 종목입니다."}),(0,n.jsx)(h.A,{isOpen:C,onClose:()=>T(!1)})]})}},80602:(e,t,s)=>{"use strict";s.d(t,{$D:()=>l,Tz:()=>a});let n={1:"매우 높은 위험",2:"높은 위험",3:"다소 높은 위험",4:"보통 위험",5:"낮은 위험",6:"매우 낮은 위험"},a=e=>{if(null==e)return"-";if("boolean"==typeof e)return e?"O":"X";if("string"==typeof e){let t=e.toLowerCase().trim();if(["true","o","y","yes","환헤지"].includes(t))return"O";if(["false","x","n","no","환헤지안함"].includes(t))return"X"}return"-"},l=e=>{if(null==e)return"-";let t=Number(e);return isNaN(t)?"-":n[t]||"-"}},82967:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var n=s(70127),a=s(70567),l=s(30233);function r(e){let{isOpen:t,onClose:s,onConfirm:r}=e;return((0,a.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset"}),[t]),t)?(0,n.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[9999999999] p-4",children:(0,n.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl max-w-md w-full p-8 relative",children:[(0,n.jsx)("button",{onClick:s,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors",children:(0,n.jsx)(l.A,{size:24})}),(0,n.jsxs)("div",{className:"mb-6 text-center",children:[(0,n.jsx)("h2",{className:"text-2xl font-bold text-[#045B62] mb-3 break-keep",children:"네이버 증권 페이지로 이동"}),(0,n.jsxs)("p",{className:"text-sm text-gray-600 break-keep",children:["네이버 증권 페이지가 새 창에서 열립니다.",(0,n.jsx)("br",{}),"이동하시겠습니까?"]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,n.jsx)("button",{onClick:()=>{r(),s()},className:"w-full py-3 px-4 bg-[#045B62] hover:bg-[#03454A] text-white font-semibold rounded-xl transition-colors",children:"이동하기"}),(0,n.jsx)("button",{onClick:s,className:"w-full py-3 px-4 bg-white border-2 border-gray-300 text-gray-700 font-semibold rounded-xl hover:bg-gray-50 transition-colors",children:"취소"})]})]})}):null}},83843:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(61989).v)(e=>({selectedProducts:[],source:null,addProducts:t=>e(e=>({selectedProducts:[...e.selectedProducts,...t]})),setProducts:function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e({selectedProducts:t,source:s})},clearProducts:()=>e({selectedProducts:[],source:null}),removeProduct:t=>e(e=>({selectedProducts:e.selectedProducts.filter(e=>e.kr_code!==t)}))}))},85579:(e,t,s)=>{"use strict";s.d(t,{A:()=>d});var n=s(70127),a=s(70567),l=s(12900),r=s(51652),i=s(93374),o=s(9638);let d=e=>{let{isModalOpen:t,setIsModalOpen:s,selectedAccountType:d,handleCloseModal:c,setSaveRefresh:u}=e,x=a.useRef(null),m=(0,o.r)(),h=()=>{s(!1),u&&u(!0),c&&c()};return(0,n.jsx)(l.e.Root,{show:t,as:a.Fragment,children:(0,n.jsxs)(r.lG,{as:"div",className:"relative z-[999999999]",initialFocus:x,onClose:h,children:[(0,n.jsx)(l.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-black/40 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 w-screen py-2 overflow-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center md:p-2 text-center sm:items-center p-2",children:(0,n.jsx)(l.e.Child,{as:a.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(r.lG.Panel,{className:"relative transform overflow-hidden rounded-2xl bg-white text-left shadow-xl transition-all 2xl
1:w-[600px] lg:w-[600px] xs:w-full h-auto md:p-6 p-4",children:[(0,n.jsx)("div",{className:"absolute top-[10px] right-[10px] cursor-pointer text-ink-mute hover:text-ink-soft",children:(0,n.jsx)(i.$8F,{onClick:h})}),(0,n.jsxs)("div",{className:"flex flex-col justify-center items-center w-full",children:[(0,n.jsx)("h1",{className:"font-semibold text-ink mt-8 md:text-[18px] text-[16px] text-center",children:"임시 포트폴리오 빌더에서 추가되었습니다. 포트폴리오 빌더 페이지에서 확인하시겠어요?"}),(0,n.jsxs)("div",{className:"w-full mt-6 flex gap-2 items-center justify-center",children:[(0,n.jsx)("button",{onClick:h,className:"border-none outline-none bg-secondary text-ink-soft hover:text-ink min-w-[150px] h-auto px-3 py-2 text-sm font-medium rounded-lg",children:"닫기"}),(0,n.jsx)("button",{onClick:()=>{s(!1),u&&u(!0),c&&c(),"/portfolio-builder"!==m.pathname&&m.push("/portfolio-builder?selectedAccountType=".concat(d,"&data_tab=account&selected_tab=0"))},className:"border-none outline-none bg-ink hover:bg-ink/90 text-white min-w-[150px] h-auto px-3 py-2 text-sm font-semibold rounded-lg",children:"이동"})]})]})]})})})})]})})}},90636:(e,t,s)=>{"use strict";s.d(t,{ZI:()=>x,k$:()=>u,m_:()=>c});var n=s(70127);s(70567);var a=s(38705),l=s(6546),r=s(61226),i=s(34883),o=s(71627),d=s(26896);function c(e){let{...t}=e;return(0,n.jsx)(a.s,{"data-slot":"tooltip",...t})}function u(e){let{...t}=e;return(0,n.jsx)(l.k,{"data-slot":"tooltip-trigger",...t})}function x(e){let{className:t,sideOffset:s=6,children:a,...l}=e;return(0,n.jsx)(r.K,{children:(0,n.jsx)(i.o,{sideOffset:s,className:"isolate z-50",children:(0,n.jsx)(o.o,{"data-slot":"tooltip-content",className:(0,d.cn)("z-50 max-w-[260px] rounded-lg bg-ink px-3 py-2 text-xs leading-relaxed text-white shadow-lg data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...l,children:a})})})}},92987:(e,t,s)=>{"use strict";s.d(t,{A:()=>u});var n=s(70127),a=s(70567),l=s(21757),r=s(76003),i=s(26896);let o=["올해","이번달","지난해","2년전","3년전","설정이후"],d=["수익률","변동성","샤프지수","베타(KOSPI)","베타(SPY)"];function c(e,t,s){let[n,l]=(0,a.useState)({}),[r,i]=(0,a.useState)(1),[o,d]=(0,a.useState)(1),[c,u]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),h=(0,a.useRef)(0);return(0,a.useEffect)(()=>{e&&(l({}),i(1),d(1))},[e,s]),(0,a.useEffect)(()=>{if(!e)return;let n=++h.current;u(!0),(async()=>{try{var e;let a=new URLSearchParams({kind:t,filter:s,page:String(r)}),i=await fetch("/api/tdf?".concat(a.toString()));if(!i.ok)throw Error("TDF 조회 요청이 실패했습니다");let o=await i.json();if(n!==h.current)return;d(null!=(e=o.total_pages)?e:1),l(e=>{var t,s;let n=1===r?{}:{...e};for(let[e,a]of Object.entries(null!=(t=o.data)?t:{})){let t=null!=(s=n[e])?s:[],l=new Set(t.map(e=>e.표준코드));n[e]=[...t,...a.filter(e=>!l.has(e.표준코드))]}return n}),m(null)}catch(e){if(n!==h.current)return;m(e instanceof Error?e.message:"TDF 조회 요청이 실패했습니다")}finally{n===h.current&&u(!1)}})()},[e,t,s,r]),{data:n,loading:c,error:x,page:r,setPage:i,totalPages:o}}function u(e){let{onSelectCode:t}=e,[s,u]=(0,a.useState)("vintage"),[x,m]=(0,a.useState)("올해"),[h,p]=(0,a.useState)("수익률"),[f,b]=(0,a.useState)(null),v=(0,a.useRef)(null),g=e=>{var t;null==(t=v.current)||t.scrollBy({left:360*e,behavior:"smooth"})},j=c("vintage"===s,"vintage",x),y=c("stat"===s,"stat",h);(0,a.useEffect)(()=>{if(f)return;let e=!0;return(async()=>{try{let t=await fetch("/api/tdf?kind=fund_info");if(!t.ok)return;let s=await t.json();if(!e||!Array.isArray(s.data))return;b(new Map(s.data.filter(e=>e.standard_cd).map(e=>[e.standard_cd,e])))}catch(e){}})(),()=>{e=!1}},[f]);let k="vintage"===s?j:y,N=Object.keys(k.data).sort(),w=(e,t)=>(e=>{let t=Number(e);return null!=e&&""!==e&&Number.isFinite(t)?t:null})(e["TDF".concat(t)]);return(0,n.jsxs)("div",{children:[(0,n.jsx)("nav",{className:"border-line flex border-b",children:[{key:"vintage",label:"기간별 수익률"},{key:"stat",label:"변동성\xb7샤프지수 기준"}].map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>u(e.key),className:(0,i.cn)("-mb-px cursor-pointer border-0 border-b-2 bg-transparent px-4 py-2.5 text-sm transition-colors",s===e.key?"border-brand-700 text-ink font-semibold":"border-transparent text-ink-mute hover:text-ink-soft font-normal"),children:e.label},e.key))}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",children:[(0,n.jsxs)("div",{className:"scrollbar-none -mx-4 flex items-center gap-2 overflow-x-auto px-4 sm:mx-0 sm:flex-wrap sm:px-0",children:[(0,n.jsx)("span",{className:"text-ink-mute shrink-0 text-xs font-medium",children:"vintage"===s?"기간별 수익률 기준":"3년 통계 기준"}),("vintage"===s?o:d).map(e=>{let t="vintage"===s?x===e:h===e;return(0,n.jsx)("button",{type:"button",onClick:()=>"vintage"===s?m(e):p(e),className:(0,i.cn)("shrink-0 cursor-pointer rounded-full border-0 px-2.5 py-1 text-xs font-medium whitespace-nowrap transition-colors",t?"bg-ink text-white":"bg-secondary text-ink-soft hover:text-ink"),children:e},e)})]}),k.loading&&(0,n.jsx)("span",{className:"text-ink-mute text-xs",children:"불러오는 중…"})]}),k.error&&(0,n.jsx)("p",{className:"text-debt mt-3 text-xs",children:k.error}),(0,n.jsxs)("div",{className:"mt-5",children:[0===N.length&&!k.loading&&(0,n.jsx)("p",{className:"text-ink-mute py-10 text-center text-sm",children:"불러올 상품이 없습니다"}),0===N.length&&k.loading&&(0,n.jsx)("p",{className:"text-ink-mute py-10 text-center text-sm",children:"상품을 불러오는 중…"}),N.length>0&&(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{type:"button","aria-label":"이전 빈티지",onClick:()=>g(-1),className:"bg-ink text-white fixed top-1/2 left-4 z-10 hidden h-9 w-9 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full shadow-lg transition-opacity hover:opacity-90 sm:left-6 sm:flex",children:(0,n.jsx)(l.V9D,{icon:r.OtJ,size:16})}),(0,n.jsx)("button",{type:"button","aria-label":"다음 빈티지",onClick:()=>g(1),className:"bg-ink text-white fixed top-1/2 right-4 z-10 hidden h-9 w-9 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full shadow-lg transition-opacity hover:opacity-90 sm:right-6 sm:flex",children:(0,n.jsx)(l.V9D,{icon:r.$EX,size:16})}),(0,n.jsx)("div",{ref:v,className:"divide-line scrollbar-none -mx-4 flex snap-x snap-proximity divi
1de-x overflow-x-auto scroll-smooth px-4 pb-2 sm:-mx-1 sm:px-1",children:N.map((e,a)=>{var l;let r=null!=(l=k.data[e])?l:[],o=Math.max(1,...r.filter(e=>"MK-Glide Index"!==e.표준코드).map(t=>w(t,e)).filter(e=>null!==e).map(e=>Math.abs(e)));return(0,n.jsxs)("section",{className:"animate-in fade-in slide-in-from-bottom-2 w-[calc(100vw-2rem)] shrink-0 snap-center px-5 py-5 duration-500 fill-mode-both first:pl-1 last:pr-1 sm:w-[420px] sm:px-10",style:{animationDelay:"".concat(60*Math.min(a,6),"ms")},children:[(0,n.jsxs)("div",{className:"pb-4",children:[(0,n.jsx)("p",{className:"text-ink text-5xl font-black tabular-nums tracking-[-0.04em] sm:text-7xl",children:e}),(0,n.jsxs)("p",{className:"text-ink-mute mt-1.5 text-[11px] font-semibold tracking-wide uppercase",children:["빈티지 \xb7 ",r.length,"개 상품"]})]}),(0,n.jsxs)("div",{className:"border-ink-soft flex items-baseline gap-3 border-t-2 pt-3 pb-2",children:[(0,n.jsx)("span",{className:"text-ink-mute w-5 shrink-0 text-[11px] font-semibold",children:"순위"}),(0,n.jsx)("span",{className:"text-ink-mute flex-1 text-[11px] font-semibold",children:"펀드명"}),(0,n.jsx)("span",{className:"text-ink-mute shrink-0 text-[11px] font-semibold",children:"vintage"===s?"".concat(x," 수익률(%)"):"".concat(h,"(3년)")})]}),(0,n.jsx)("ul",{className:"divide-line divide-y",children:r.map((s,a)=>{var l,r;let d=null!=(l=s.표준코드)?l:"",c="MK-Glide Index"===d,u=w(s,e),x=null!==u?Math.min(100,Math.abs(u)/o*100):0,m=0===a&&!c;return(0,n.jsxs)("li",{className:(0,i.cn)("flex items-start gap-3",m?"py-4":"py-3",c&&"opacity-70"),children:[(0,n.jsx)("span",{className:(0,i.cn)("text-ink-mute shrink-0 font-black tabular-nums",m?"w-6 text-2xl":"mt-0.5 w-6 text-base"),children:c?"—":a+1}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,n.jsx)("p",{className:(0,i.cn)("truncate",m?"text-ink text-base font-bold tracking-tight":"text-sm",!m&&(c?"text-ink-soft font-medium":"text-ink font-semibold")),children:null!=(r=s.공시대상)?r:"-"}),(0,n.jsx)("span",{className:(0,i.cn)("shrink-0 font-black tabular-nums",m?"text-xl":"text-sm",c?"text-ink-mute":null!=u&&u>=0?"text-up":"text-debt"),children:null!==u?"".concat(u>=0?"+":"").concat(u.toFixed(2)):"N/A"})]}),!c&&null!==u&&(0,n.jsx)("div",{className:"bg-secondary mt-1.5 h-1 overflow-hidden rounded-full",children:(0,n.jsx)("div",{className:(0,i.cn)("bar-fill-in h-full rounded-full",u>=0?"bg-up":"bg-debt"),style:{width:"".concat(x,"%"),animationDelay:"".concat(40*Math.min(a,8),"ms")}})}),c?(0,n.jsx)("p",{className:"text-ink-mute mt-1 text-[11px]",children:"벤치마크"}):(null==f?void 0:f.get(d))&&(0,n.jsx)("button",{type:"button",onClick:()=>t(d),className:"text-ink-mute hover:text-ink-soft mt-1 cursor-pointer border-0 bg-transparent p-0 text-[11px] underline decoration-dotted underline-offset-2",children:"상세 보기"})]})]},d||s.공시대상)})})]},e)})})]}),k.page<k.totalPages&&(0,n.jsx)("div",{className:"text-center",children:(0,n.jsx)("button",{type:"button",disabled:k.loading,onClick:()=>k.setPage(k.page+1),className:"text-brand-700 hover:bg-brand-700/5 cursor-pointer rounded-md border-0 bg-transparent px-3 py-1.5 text-sm font-semibold transition-colors disabled:opacity-50",children:k.loading?"불러오는 중…":"더 불러오기"})})]})]})}},95058:(e,t,s)=>{"use strict";s.d(t,{he:()=>l,ry:()=>r,t:()=>a});var n=s(48858);function a(e,t,s){let a=e.filter(e=>"cma"===e.accountType||"savings"===e.accountType).reduce((e,t)=>e+(0,n.Fc)(t),0),l=e.filter(e=>"cma"!==e.accountType&&"savings"!==e.accountType).reduce((e,t)=>e+(0,n.Fc)(t),0),r=t.reduce((e,t)=>e+t.marketValue,0),i=t.reduce((e,t)=>e+("대출 있음"===t.status?t.loanBalance:0),0),o=s.reduce((e,t)=>e+t.balance,0);return{totalAssets:Math.round(a+l),totalLiabilities:Math.round(o),savings:Math.round(a),investments:Math.round(l),realAssetEquity:Math.round(r-i),unsecuredDebt:Math.round(o)}}async function l(e,t,s,n){let{error:a}=await e.from("wp_progress_snapshots").upsert({household_id:t,snapshot_date:s,total_assets:Math.round(n.totalAssets),total_liabilities:Math.round(n.totalLiabilities),savings:Math.round(n.savings),investments:Math.round(n.investments),real_asset_equity:Math.round(n.realAssetEquity),unsecured_debt:Math.round(n.unsecuredDebt)},{onConflict:"household_id,snapshot_date"});if(a)throw a}async function r(e,t){let{data:s,error:n}=await e.from("wp_progress_snapshots").select("*").eq("household_id",t).order("snapshot_date",{ascending:!1});if(n)throw n;return s}},95619:(e,t,s)=>{"use strict";s.d(t,{r:()=>n});let n=e=>{if(!e)return void console.warn("종목 코드가 제공되지 않았습니다.");window.open("https://finance.naver.com/item/main.naver?code=".concat(e),"_blank")}},98240:(e,t,s)=>{"use strict";s.d(t,{FM:()=>g,H:()=>j,I7:()=>l,K:()=>a,LB:()=>x,N_:()=>r,On:()=>i,hS:()=>p,r2:()=>m,s8:()=>h});var n=s(65313);let a=60,l={self:90,spouse:92};function r(e,t){return e+l.self-t}let i=2,o={inflation:.035,accumReturn:.037,returnB1:.02,returnB2:.04,returnB3:.07,strategy:"bucket_mapped_with_pension_track"},d={본인:"self",배우자:"spouse"},c={고정:"fixed",물가연동:"inflation"},u={원리금균등상환:"equal_installment",원금균등상환:"equal_principal",만기일시상환:"bullet",체증식상환:"graduated"};function x(e){return(0,n.z5)({id:e.id,name:e.name,owner:d[e.owner],balance:e.balance,annualRate:e.rate/100,rateType:"고정"===e.rateType?"fixed":"variable",repayment:u[e.repayment],remainingMonths:12*e.termYears,...e.graceMonths>0?{graceMonths:e.graceMonths}:{}})}function m(e){return(0,n.z5)({id:"".concat(e.id,"-loan"),name:"".concat(e.name||"부동산"," 담보대출"),owner:d[e.owner],balance:e.loanBalance,annualRate:e.loanRate/100,rateType:"고정"===e.rateType?"fixed":"variable",repayment:u[e.repayment],remainingMonths:12*e.termYears,...e.graceMonths>0?{graceMonths:e.graceMonths}:{}})}function h(e,t){return t?e:e.filter(e=>"본인"===e.owner)}function p(e,t){return e.filter(e=>"대출 있음"===e.status&&e.loanBalance>0).reduce((e,t)=>
1e+m(t),0)+t.reduce((e,t)=>e+x(t),0)}let f={공무원:"civil_servant",사학:"private_school",군인:"military",기타:void 0},b={"납입 중":"paying","납입 완료\xb7개시 전":"paid_up","수령 중":"receiving"};function v(e,t,s,n){let a=e=>h(e,t.planningAsCouple);e={...e,accounts:a(e.accounts),properties:a(e.properties),debts:a(e.debts),incomes:a(e.incomes)};let l=[],i=[],x=[],m=[],p=[],v=new Set;for(let t of e.accounts){let e=d[t.owner];switch(t.accountType){case"cma":case"savings":case"general":case"dc":l.push({id:t.id,name:t.name,owner:e,accountType:t.accountType,balance:t.balance});break;case"isa":l.push({id:t.id,name:t.name,owner:e,accountType:t.accountType,balance:t.balance,...t.isaType?{isaType:t.isaType}:{}});break;case"irp":case"pension_savings":{let s=function(e){let t={taxExempt:e.taxExempt,taxable:e.taxable,deferred:e.deferred};if("detail"!==e.inputMode)return t;let s=e.holdings.reduce((e,t)=>e+t.marketValue,0),n=e.taxExempt+e.taxable+e.deferred;if(1e4>Math.abs(s-n))return t;if(n<=0)return{taxExempt:0,taxable:s,deferred:0};let a=Math.round(e.taxExempt*s/n),l=Math.round(e.deferred*s/n);return{taxExempt:a,taxable:s-a-l,deferred:l}}(t);l.push({id:t.id,name:t.name,owner:e,accountType:t.accountType,balance:s.taxExempt+s.taxable+s.deferred,...s.taxExempt>0?{taxExemptBalance:s.taxExempt}:{},...s.taxable>0?{taxDeductedContribution:s.taxable}:{},...s.deferred>0?{deferredRetirementBalance:s.deferred}:{},...t.retirementTax>0?{irpRetirementTaxTotal:t.retirementTax}:{},...t.isReceivingPension&&t.receiptYears>0?{pensionReceiptYears:t.receiptYears}:{}});break}case"national_pension":case"occupational_pension":i.push({id:t.id,owner:e,kind:"national_pension"===t.accountType?"n
1ational":"occupational",..."occupational_pension"===t.accountType&&f[t.occupationalKind]?{occupationalKind:f[t.occupationalKind]}:{},amountSnapshot:{monthly:t.monthlyPension,asOf:"today"},escalation:c[t.pensionEscalation]}),"national_pension"===t.accountType&&t.nationalClaimAge>0&&x.push({entitlementId:t.id,claimAge:t.nationalClaimAge,payout:{type:"lifetime"}});break;case"severance":t.linkedIncomeId&&v.add(t.linkedIncomeId);break;case"pension_insurance":{let s=b[t.insuranceStatus];m.push({id:t.id,name:t.name,owner:e,status:s,..."paying"===s?{monthlyPremium:t.monthlyPremium,...t.premiumEndYear>0?{premiumEndYear:t.premiumEndYear}:{}}:{},..."receiving"!==s?{claimAge:t.insuranceClaimAge}:{},monthlyBenefit:t.monthlyInsuranceBenefit,payoutType:"확정기간"===t.insurancePayoutType?"fixed_term":"lifetime",..."확정기간"===t.insurancePayoutType?{payoutYears:t.insurancePayoutYears}:{},..."receiving"===s&&t.insuranceBenefitStartYear>0?{benefitStartYear:t.insuranceBenefitStartYear}:{},escalation:c[t.insuranceEscalation],...t.taxCreditRate>0?{taxCreditRate:t.taxCreditRate}:{}})}}}for(let t of e.debts)p.push({id:t.id,name:t.name,owner:d[t.owner],balance:t.balance,annualRate:t.rate/100,rateType:"고정"===t.rateType?"fixed":"variable",repayment:u[t.repayment],remainingMonths:12*t.termYears,...t.graceMonths>0?{graceMonths:t.graceMonths}:{}});let g=e.properties.map(e=>({id:e.id,name:e.name,owner:d[e.owner],...e.purchasePrice>0?{purchasePrice:e.purchasePrice}:{},marketValue:e.marketValue,...e.propertyTaxBase>0?{propertyTaxBase:e.propertyTaxBase}:{},status:"대출 있음"===e.status?"financed":"fully_owned"}));for(let t of e.properties)"대출 있음"===t.status&&t.loanBalance>0&&p.push({id:"".concat(t.id,"-loan"),name:"".concat(t.name||"부동산"," 담보대출"),owner:d[t.owner],balance:t.loanBalance,annualRate:t.loanRate/100,rateType:"고정"===t.rateType?"fixed":"variable",repayment:u[t.repayment],remainingMonths:12*t.termYears,...t.graceMonths>0?{graceMonths:t.graceMonths}:{},linkedPropertyId:t.id});let j={household:{planningAsCouple:t.planningAsCouple,persons:[{role:"self",birthYear:t.selfBirthYear,retirementAge:t.selfRetirementAge,lifeExpectancy:t.selfLifeExpectancy,...t.selfInsuredType?{insuredType:t.selfInsuredType}:{}},...t.planningAsCouple?[{role:"spouse",birthYear:t.spouseBirthYear,retirementAge:t.spouseRetirementAge,lifeExpectancy:r(t.selfBirthYear,t.spouseBirthYear),...t.spouseInsuredType?{insuredType:t.spouseInsuredType}:{}}]:[]]},accounts:l,deposits:[],installmentSavings:[],displayAssets:[],loans:p,properties:g,pensions:i,pensionInsurances:m},y=e.accounts.filter(e=>e.monthlyContribution>0&&("dc"===e.accountType||"irp"===e.accountType||"pension_savings"===e.accountType)).map(e=>({accountId:e.id,annualAmount:12*e.monthlyContribution})),k=e.accounts.map(e=>({accountId:e.id,...e.taxCreditRate>0?{taxCreditRate:e.taxCreditRate}:{},...e.annualReturnRate>0?{annualReturnRate:e.annualReturnRate}:{},...e.pensionStartAge>0?{pensionStartAge:e.pensionStartAge}:{}})).filter(e=>null!=e.taxCreditRate||null!=e.annualReturnRate||null!=e.pensionStartAge);return{facts:j,plan:{id:s,name:n,pensionElections:x,...y.length>0?{contributionPlans:y}:{},...k.length>0?{accountPlans:k}:{},incomes:e.incomes.map(e=>({id:e.id,name:e.name,owner:d[e.owner],kind:"salary",annualAmount:e.annualAmount,...e.hireYear>0?{hireDate:"".concat(e.hireYear,"-03-01")}:{},growthRate:e.growthRate/100,withholdingRate:0,endsAt:"나이 지정"===e.endsMode?{age:e.endsAge}:"retirement",...e.severanceOn||v.has(e.id)?{severance:{mode:"일시금"===e.severanceMode?"lump_sum":"irp"}}:{}})),spending:{dailyLiving:0,travelLeisure:0,medical:0},expenseItems:e.expenses.filter(e=>e.monthly>0).map(e=>({id:e.id,category:e.category,...e.itemKey?{itemKey:e.itemKey}:{},label:e.label,monthlyAmount:e.monthly})),riskProfile:t.riskProfile,strategy:o.strategy,accumulation:{annualReturnRate:o.accumReturn},market:{inflationRate:o.inflation,returnB1:o.returnB1,returnB2:o.returnB2,returnB3:o.returnB3},...t.financialIncomeYield?{financialIncomeYield:t.financialIncomeYield}:{},...null!=t.comprehensiveTaxBase?{comprehensiveTaxBase:t.comprehensiveTaxBase}:{}}}}function g(e,t){try{let{facts:s,plan:a}=v(e,t,"validate","검사"),l=(0,n.jD)(s,a);return t.selfBirthUnset&&l.push({field:"household.selfBirthYear",code:"self_birth_unset",message:"본인 생년월일을 입력하지 않아 나이 기준 계산을 할 수 없다.",severity:"blocking"}),l}catch(e){return console.error("plan validation failed",e),[]}}function j(e,t,s,a,l){try{let{facts:r,plan:i}=v(e,t,s,a);if(l&&(i.strategy=l),(0,n.jD)(r,i).some(e=>
1"blocking"===e.severity))return null;let o=(0,n.AB)(r,i);return{input:o,result:(0,n.JV)(o)}}catch(e){return console.error("plan simulation failed",e),null}}},99011:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>c,rn:()=>d});var n=s(70127),a=s(76003),l=s(99736),r=s(48858);let i=[{value:"은퇴 시",label:"은퇴 시"},{value:"나이 지정",label:"나이 지정"}],o=[{value:"IRP 이전",label:"IRP 이전 (과세이연)"},{value:"일시금",label:"일시금 (55세 이상 퇴직만)"}];function d(e){return{id:e,name:"",owner:"본인",annualAmount:0,hireYear:2020,growthRate:3,withholdingRate:0,endsMode:"은퇴 시",endsAge:60,severanceOn:!1,severanceMode:"IRP 이전"}}function c(e){let{value:t,onChange:s,onCancel:d,onSave:c,saveState:u,planningAsCouple:x=!0}=e,m=t.name.trim()?"".concat(t.name):"새 소득",h=e=>s({...t,...e}),{unit:p}=(0,l.UG)();return(0,n.jsxs)(l.um,{title:m,icon:a.uEw,iconBg:"var(--brand-700)",onCancel:d,onSave:c,saveState:u,children:[(0,n.jsx)(l.eW,{label:"이름",value:t.name,onChange:e=>h({name:e}),placeholder:"예: 본인 급여"}),x&&(0,n.jsx)(l.LS,{label:"소유자",value:t.owner,onChange:e=>h({owner:e}),options:(0,r.tK)(x)}),(0,n.jsx)(l.L,{label:"연봉",value:t.annualAmount,onChange:e=>h({annualAmount:e}),unit:p}),(0,n.jsx)(l.eW,{label:"입사연도",value:t.hireYear?String(t.hireYear):"",onChange:e=>h({hireYear:Number(e.replace(/\D/g,""))||0}),placeholder:"예: 2015"}),(0,n.jsx)(l.vQ,{label:"상승률",value:t.growthRate,onChange:e=>h({growthRate:e}),suffix:"%"}),(0,n.jsx)(l.LS,{label:"종료",value:t.endsMode,onChange:e=>h({endsMode:e}),options:i}),"나이 지정"===t.endsMode&&(0,n.jsx)(l.eW,{label:"종료 나이",value:t.endsAge?String(t.endsAge):"",onChange:e=>h({endsAge:Number(e.replace(/\D/g,""))||0})}),(0,n.jsx)(l.LS,{label:"퇴직급여 발생",value:t.severanceOn?"있음":"없음",onChange:e=>h({severanceOn:"있음"===e}),options:[{value:"없음",label:"없음"},{value:"있음",label:"있음 (급여 연동 자동 산정)"}]}),t.severanceOn&&(0,n.jsx)(l.LS,{label:"은퇴 시 처리",value:t.severanceMode,onChange:e=>h({severanceMode:e}),options:o})]})}},99736:(e,t,s)=>{"use strict";s.d(t,{DP:()=>u,Jf:()=>N,L:()=>f,LS:()=>g,UG:()=>p,X1:()=>w,eW:()=>x,tL:()=>h,um:()=>k,uy:()=>j,vQ:()=>b,zt:()=>y});var n=s(70127),a=s(70567),l=s(89119),r=s.n(l),i=s(21757),o=s(76003),d=s(61339),c=s(26896);function u(e){let{label:t,children:s,className:a}=e;return(0,n.jsxs)("div",{className:(0,c.cn)("bg-secondary/60 flex min-h-[76px] flex-col justify-center rounded-xl px-4 py-3.5 sm:min-h-[84px] sm:px-5 sm:py-4",a),children:[(0,n.jsx)("div",{className:"text-ink-mute mb-1.5 text-xs font-medium",children:t}),(0,n.jsx)("div",{className:"text-ink text-base font-bold",children:s})]})}function x(e){let{label:t,value:s,onChange:a,onBlur:l,placeholder:r,suffix:i,disabled:o}=e;return(0,n.jsx)(u,{label:t,children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)("input",{value:s,onChange:e=>a(e.target.value),onBlur:l,placeholder:r,disabled:o,className:"text-ink placeholder:text-ink-mute min-w-0 flex-1 border-0 bg-transparent p-0 text-base font-bold outline-none disabled:cursor-not-allowed disabled:opacity-60"}),i&&(0,n.jsx)("span",{className:"text-ink-mute shrink-0 text-sm font-medium",children:i})]})})}let m={만:1e4,억:1e8};function h(e,t){if(!e)return"";let s=e/m[t];return"억"===t?String(Number(s.toFixed(4))):String(Math.round(s))}function p(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"만",[t,s]=(0,a.useState)(e);return{unit:t,setUnit:s}}function f(e){let{label:t,value:s,onChange:a,unit:l,placeholder:r,disabled:i}=e;return(0,n.jsx)(x,{label:t,value:h(s,l),onChange:e=>a(function(e,t){let s=Number(e.replace(/,/g,""));return!Number.isFinite(s)||s<0?0:Math.round(s*m[t])}(e,l)),suffix:l,placeholder:r,disabled:i})}function b(e){let{label:t,value:s,onChange:l,suffix:r}=e,[i,o]=(0,a.useState)(null),d=null!=i?i:s?String(s):"";return(0,n.jsx)(x,{label:t,value:d,suffix:r,onChange:e=>{/^\d*\.?\d*$/.test(e)&&(o(e),l(""===e||"."===e?0:parseFloat(e)))},onBlur:()=>o(null)})}let v={self:"본인",spouse:"배우자",fixed:"고정",variable:"변동",db:"퇴직금",severance_pay:"퇴직금",severance:"퇴직금",financed:"대출 있음",equal_installment:"원리금균등상환",equal_principal:"원금균등상환",bullet:"만기일시상환",graduated:"체증식상환",credit_line:"체증식상환",cma:"입출금\xb7CMA",savings:"예금\xb7적금",general:"일반 투자계좌",isa:"ISA",irp:"IRP",dc:"DC",pension_savings:"연금저축"};function g(e){let{label:t,value:s,onChange:a,options:l}=e,r=function(e,t){var s;if(t.some(t=>t.value===e))return e;let n=v[e];
1if(!n)return e;let a=t.find(e=>e.value===n||e.label===n);return null!=(s=null==a?void 0:a.value)?s:e}(s,l),i=Object.fromEntries(l.map(e=>[e.value,e.label])),o=function(e,t){let s=t.find(t=>t.value===e);if(s)return s.label;let n=v[e];if(n){let e=t.find(e=>e.label===n||e.value===n);return e?e.label:n}return e}(r,l);return(0,n.jsx)(u,{label:t,children:(0,n.jsxs)(d.l6,{value:r,items:i,onValueChange:e=>{null!=e&&a(String(e))},children:[(0,n.jsx)(d.bq,{className:"text-ink h-auto w-full justify-between gap-2 border-0 bg-transparent p-0 text-base font-bold shadow-none transition-colors duration-150 hover:text-brand-700 focus-visible:ring-0 data-[size=default]:h-auto data-popup-open:text-brand-700",children:(0,n.jsx)("span",{className:"flex-1 truncate text-left",children:o})}),(0,n.jsx)(d.gC,{side:"bottom",align:"start",sideOffset:6,children:l.map(e=>(0,n.jsxs)(d.eb,{value:e.value,disabled:e.disabled,children:[e.label,e.badge&&(0,n.jsx)("span",{className:"bg-secondary text-ink-mute rounded px-1.5 py-0.5 text-[11px] font-medium",children:e.badge})]},e.value))})]})})}let j=(0,a.createContext)("idle");function y(e){let{onCancel:t,onSave:s,saveState:l="idle",saveLabel:r="저장"}=e,d=(0,a.useContext)(j);return(0,n.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5",children:["idle"!==d&&(0,n.jsx)("span",{className:"text-ink-mute flex items-center gap-1.5 text-xs whitespace-nowrap",children:"saving"===d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"border-line border-t-brand-700 h-3.5 w-3.5 animate-spin rounded-full border-2"}),"임시저장 중"]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.V9D,{icon:o.$ts,size:14,className:"text-brand-700"}),"임시저장됨"]})}),(0,n.jsx)("button",{type:"button",onClick:t,className:"border-brand-700 text-brand-700 hover:bg-brand-700/5 cursor-pointer rounded-lg border px-4 py-2 text-sm font-semibold transition-colors",children:"취소"}),(0,n.jsx)("button",{type:"button",onClick:s,disabled:"saving"===l,className:(0,c.cn)("cursor-pointer rounded-lg px-5 py-2 text-sm font-semibold text-white transition-colors","saved"===l?"bg-brand-700":"bg-ink hover:bg-ink/90","saving"===l&&"cursor-wait opacity-80"),children:"saving"===l?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-white/40 border-t-white"}),"저장 중"]}):"saved"===l?(0,n.jsx)("span",{className:"inline-flex items-center gap-1.5",children:"✓ 저장됨"}):r})]})}function k(e){let{title:t,icon:s,iconBg:a="var(--brand-700)",onCancel:l,onSave:o,saveState:d="idle",saveLabel:c,headerLeft:u,fieldsDisabled:x=!1,fieldsDisabledNote:m,editHref:h,hideBottomActions:p=!1,children:f}=e,b=!!(t||s||u);return(0,n.jsxs)("div",{className:"fact-editor-in mb-6  py-6",children:[b&&(0,n.jsx)("div",{className:"mb-6 flex flex-wrap items-center gap-4",children:(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[s&&(0,n.jsx)("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full text-white",style:{background:a},children:(0,n.jsx)(i.V9D,{icon:s,size:20})}),t&&(0,n.jsx)("h3",{className:"text-ink truncate text-xl font-bold tracking-tight",children:t}),u]})}),x&&(m||h)&&(0,n.jsxs)("p",{className:"text-ink-mute -mt-3 mb-4 text-xs",children:[m,h&&(0,n.jsx)(r(),{href:h,className:"text-brand-700 ml-1.5 font-semibold underline underline-offset-2",children:"내 정보 입력에서 수정하기"})]}),(0,n.jsx)("fieldset",{disabled:x,className:"fact-editor-fields m-0 grid min-w-0 grid-cols-1 gap-4 border-0 p-0 sm:grid-cols-2",children:f}),!p&&(0,n.jsx)("div",{className:"mt-6 flex justify-end",children:(0,n.jsx)(y,{onCancel:l,onSave:o,saveState:d,saveLabel:c})})]})}function N(e){let{children:t}=e;return(0,n.jsx)("div",{className:"border-line divide-line divide-y rounded-xl border",children:t})}function w(e){let{icon:t,iconBg:s="#0F766E",title:l,preview:r,defaultOpen:d=!1,children:u}=e,[x,m]=(0,a.useState)(d);return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:()=>m(e=>!e),"aria-expanded":x,className:"hover:bg-secondary/40 flex w-full cursor-pointer items-center gap-3.5 px-5 py-4 text-left transition-colors",children:[(0,n.jsx)("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-white",style:{background:s},children:(0,n.jsx)(i.V9D,{icon:t,size:17})}),(0,n.jsx)("span",{className:"text-ink flex-1 truncate text-[15px] font-semibold",children:l}),r&&(0,n.jsx)("span",{className:"text-ink-mute shrink-0 text-sm",children:r}
1),(0,n.jsx)(i.V9D,{icon:o.tX2,size:12,className:(0,c.cn)("text-ink-mute shrink-0 transition-transform duration-150",x&&"rotate-180")})]}),(0,n.jsx)("div",{className:(0,c.cn)("grid transition-[grid-template-rows] duration-200 ease-out",x?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,n.jsx)("div",{className:"overflow-hidden",inert:!x,children:(0,n.jsx)("div",{className:"border-line bg-ground grid gap-4 border-t px-5 py-5 sm:grid-cols-2",children:u})})})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.