1/*! For license information please see portfolio-history.d85bd6c1.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkcalypso=self.webpackChunkcalypso||[]).push([[3198],{1417:(e,t,a)=>{a.r(t),a.d(t,{default:()=>re});var s=a(89379),n=a(65043),i=a(22024),l=a(50516),r=a(41680),o=a(21742),d=a(34793),c=a(80332),u=a(17102),m=a(21266),x=a(70579);const h=Object.freeze([["performance","Performance"],["holdings","Holdings changes"],["trades","Reported trades"],["statements","Statements"]]),p=(0,n.lazy)((()=>a.e(7101).then(a.bind(a,49760)))),b=(0,n.lazy)((()=>a.e(4416).then(a.bind(a,24416)))),v=Object.freeze([["all","All"],["same","Same"],["increased","Increased"],["reduced","Reduced"],["new","New"],["exited","Exited"],["current_only","Current only"],["historical_only","Earlier only"]]),f=Object.freeze({same:{label:"Same",barClass:"bg-slate-400",swatchClass:"bg-slate-400"},increased:{label:"Increased",barClass:"bg-emerald-500",swatchClass:"bg-emerald-500"},reduced:{label:"Reduced",barClass:"bg-rose-500",swatchClass:"bg-rose-500"},new:{label:"New",barClass:"bg-teal-500",swatchClass:"bg-teal-500"},exited:{label:"Exited",barClass:"bg-orange-500",swatchClass:"bg-orange-500"},current_only:{label:"Current only",barClass:"bg-slate-500",swatchClass:"bg-slate-500"},historical_only:{label:"Earlier only",barClass:"bg-slate-700",swatchClass:"bg-slate-700"}}),g=Object.freeze(["increased","new","same","reduced","exited","current_only","historical_only"]),y=Object.freeze({status:"idle",benchmarks:Object.freeze({})});function w(e,t,a){return e?t:a}function j(e){return/^\d{4}-\d{2}-\d{2}$/.test(String(e||""))?new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"numeric",year:"numeric"}).format(new Date(String(e)+"T00:00:00.000Z")):"Date unavailable"}function N(e,t){return Number.isFinite(e)&&0!==e?e>0?w(t,"text-emerald-300","text-emerald-700"):w(t,"text-rose-300","text-rose-700"):w(t,"text-white/65","text-slate-700")}function k(e,t){return(0,d.KS)(e,function(e){return(0,d.pl)(e||{mode:d.Tz.HIDDEN})}(t))}function C(e,t){return"hidden"===e.status?"Hidden":(0,c.gO)(e.value,t)}function P(e){return"hidden"===e.status?"Hidden":(0,c.hd)(e.value)}function M(e){if("hidden"===e.status)return"Hidden";if("visible"!==e.status)return"\u2014";const t=Math.abs(e.value)<1e-8?0:e.value;return(t>0?"+":"")+(0,c.hd)(t)}function A(e,t){const a=[null===e||void 0===e?void 0:e.name,null===e||void 0===e?void 0:e.institution,null!==e&&void 0!==e&&e.mask?"\u2022\u2022\u2022\u2022 "+e.mask:null].filter(Boolean);return a.length?a.join(" \xb7 "):t}function S(e){return"same"===e?"Same shares":"increased"===e?"More shares":"reduced"===e?"Fewer shares":"new"===e?"New position":"exited"===e?"Exited position":"current_only"===e?"Only in current snapshot":"Only in earlier snapshot"}function E(e,t){return N("increased"===e||"new"===e?1:"reduced"===e||"exited"===e?-1:0,t)}function _(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c.d1)(e,a)}function O(e){const t=(0,c.d1)(e);return"\u2014"===t?t:t.replace("%"," pp")}function D(e){let{sales:t,preference:a,darkMode:s,showCoverage:n,activityCoverage:i}=e;if(!t.length)return null;const l=e=>"number"===typeof e&&Number.isFinite(e);return(0,x.jsxs)("section",{role:"group","aria-label":"Reported ".concat(1===t.length?"sale":"sales"),className:w(s,"mt-1 border-t border-white/[0.06] pt-1 text-[9px] leading-4 text-white/45","mt-1 border-t border-slate-200 pt-1 text-[9px] leading-4 text-slate-500"),children:[(0,x.jsx)("p",{className:"font-semibold",children:1===t.length?"Explicit reported sale":"Explicit reported sales"}),(0,x.jsx)("p",{className:"mt-0.5",children:"Separate reported transaction rows do not explain net endpoint share-count or price-mark effects."}),(0,x.jsx)("ul",{className:"mt-0.5 space-y-0.5",children:t.map(((e,t)=>{const s=l(e.quantity)?k(e.quantity,a):null,n=l(e.amount)&&("string"===typeof(i=e.currency)&&/^[A-Z]{3}$/.test(i))?k(e.amount,a):null;var i;return(0,x.jsxs)("li",{className:"min-w-0 break-words",children:[(0,x.jsx)("time",{dateTime:e.date,children:j(e.date)}),s&&(0,x.jsxs)(x.Fragment,{children:[" \xb7 ",P(s)," shares"]}),n&&(0,x.jsxs)(x.Fragment,{children:[" \xb7 reported amount ",C(n,e.currency)]})]},e.id||"".concat(e.date,"-").concat(t))}))}),(0,x.jsx)("p",{className:"mt-1",children:"Displayed sale amounts are reported transaction amounts; realized capital gain/loss is unavailable from the reviewed statements."}),n&&(0,x.jsx)("p",{className:"mt-1",children:"unknown_not_complete"===i?"Explicit rows only \xb7 activity coverage incomplete":"Explicit rows only \xb7 activity coverage is not confirmed complete"})]})}function F(e){var t,a,s;let{row:n,preference:i,currency:l,darkMode:r,visual:o=!0,className:d="",sales:u=[],showSalesCoverage:m=!1,activityCoverage:h=null}=e;const p=n.drivers,b=p&&[p.quantityEffectAtEarlierMark,p.endpointPriceMarkEffect,p.recomposedValueDelta,p.endpointUnitValueChangePct].every(Number.isFinite),v="available"===(null===(t=n.currentReportedBasis)||void 0===t?void 0:t.status),f=Number.isFinite(n.currentQuantity)&&n.currentQuantity>0&&Number.isFinite(n.currentMarketValue)&&n.currentMarketValue>=0;if(!b&&(!f||!n.hasCurrentReportedBasisField)&&!u.length)return null;const g=e=>C(k(e,i),l),y=e=>{const t=k(e,i);return"visible"===t.status?"".concat(e>0?"+":"").concat(C(t,l)):C(t,l)},j=b?Math.max(Math.abs(p.quantityEffectAtEarlierMark),Math.abs(p.endpointPriceMarkEffect),1):1,P=e=>Number.isFinite(e)&&Number.isFinite(j)&&j>0?"".concat(Math.min(100,Math.abs(e)/j*100),"%"):"0%",A=b?Math.abs(p.quantityEffectAtEarlierMark)+Math.abs(p.endpointPriceMarkEffect):0,S=e=>Number.isFinite(e)&&A>0?(0,c.d1)(Math.abs(e)/A*100,{signed:!1}):null,E=b&&Number.isFinite(n.historicalMarketValue)&&Number.isFinite(n.currentMarketValue),_=n.remainingEmbeddedGainLoss,O=null===(a=n.currentReportedBasis)||void 0===a?void 0:a.value,F=n.currentMarketValue,T=v&&Number.isFinite(O)&&O>=0&&Number.isFinite(F)&&F>=0&&"available"===(null===_||void 0===_?void 0:_.status)&&Number.isFinite(_.value),R="available"===(null===_||void 0===_?void 0:_.status)&&Number.isFinite(_.value)&&_.value>0,V="available"===(null===_||void 0===_?void 0:_.status)&&Number.isFinite(_.value)&&0===_.value,q=T&&R,B=q||V,Q=V?"gain/loss":R?"gain":"loss",I=(e,t)=>Number.isFinite(e)&&e>=0&&Number.isFinite(t)&&t>0?(0,c.d1)(e/t*100,{signed:!1}):null,W=B?I(O,F):null,z=B?I(null===_||void 0===_?void 0:_.value,F):I(Math.abs(null===_||void 0===_?void 0:_.value),O),L=B?null:I(F,O),G=T?B?{label:V?"Reported basis and embedded gain/loss shares of current value":"Reported basis and embedded gain shares of current value",ariaLabel:"Current value composition: reported basis ".concat(g(O)).concat(W?" (".concat(W," of current value)"):"","; remaining embedded ").concat(Q," ").concat(y(_.value)).concat(z?" (".concat(z," of current value)"):"","; current value ").concat(g(F)),first:O,second:_.value,total:F}:{label:"Current value and embedded loss relative to reported basis",ariaLabel:"Reported basis composition: current value ".concat(g(F)).concat(L?" (".concat(L," of reported basis)"):"","; remaining embedded loss ").concat(y(_.value)).concat(z?" (".concat(z," of reported basis)"):"","; reported basis ").concat(g(O)),first:F,second:Math.abs(_.value),total:O}:null,H=(e,t)=>Number.isFinite(e)&&e>=0&&Number.isFinite(t)&&t>0?"".concat(Math.min(100,e/t*100),"%"):"0%",U=(0,x.jsxs)(x.Fragment,{children:[n.hasCurrentReportedBasisField&&(0,x.jsxs)("section",{role:"group","aria-label":"Current basis and unrealized result",className:w(r,"border-b border-white/[0.06] pb-1.5","border-b border-slate-200 pb-1.5"),children:[(0,x.jsx)("p",{className:"font-semibold",children:"Current cost basis and unrealized gain/loss"}),(0,x.jsxs)("p",{className:"mt-0.5",children:["Current reported basis ",(0,x.jsx)("span",{className:"font-semibold tabular-nums",children:v?g(O):"Unavailable"}),W?" (".concat(W," of current value)"):"",T&&(0,x.jsxs)(x.Fragment,{children:[" \xb7 Current value ",(0,x.jsx)("span",{className:"font-semibold tabular-nums",children:g(F)}),L?" (".concat(L," of reported basis)"):""]})," \xb7 ","available"===(null===_||void 0===_?void 0:_.status)?(0,x.jsxs)(x.Fragment,{children:["Remaining embedded ",Q," ",(0,x.jsxs)("span",{className:N(_.value,r)+" font-semibold tabular-nums",children:[y(_.value),z?" (".concat(z," of ").concat(B?"current value":"reported basis",")"):""]})]}):"Remaining embedded result unavailable",(Y=n.currentPositionCoverage,!("complete"===Y||"complete_empty"===Y)&&(0,x.jsxs)("span",{children:[" \xb7 ","Current snapshot partial"]}))]}),o&&G&&(0,x.jsxs)("div",{role:"img","aria-label":G.ariaLabel,className:w(r,"mt-1 flex h-2.5 overflow-hidden bg-white/[0.06]","mt-1 flex h-2.5 overflow-hidden bg-slate-100"),title:G.label,children:[(0,x.jsx)("span",{className:w(r,"bg-white/45","bg-slate-500"),style:{width:H(G.first,G.total)}}),(0,x.jsx)("span",{className:q?"bg-emerald-500":V?"bg-slate-400":"bg-rose-500",style:{width:H(G.second,G.total)}})]})]}),b&&(0,x.jsxs)("section",{role:"group","aria-label":"Endpoint value change, not trade attribution",className:w(r,"pt-1.5","pt-1.5"),children:[(0,x.jsx)("p",{className:"font-semibold",children:"Endpoint value change, not trade attribution"}),(0,x.jsx)("p",{className:"mt-0.5",children:"These are endpoint snapshot effects, not trade attribution and not realized P&L."}),(0,x.jsxs)("p",{className:"mt-0.5",children:["Net endpoint share-count change ",(0,x.jsx)("span",{className:"font-semibold tabular-nums",children:M(k(null===(s=n.shareCountChange)||void 0===s?void 0:s.delta,i))})," \xb7 ","unit-value change ",(0,x.jsx)("span",{className:N(p.endpointUnitValueChangePct,r)+" font-semibold tabular-nums",children:(0,c.d1)(p.endpointUnitValueChangePct)})]}),E&&(0,x.jsxs)("p",{children:["Then ",(0,x.jsx)("span",{className:"font-semibold tabular-nums",children:g(n.historicalMarketValue)})," \u2192 ","share-count effect ",(0,x.jsx)("span",{className:N(p.quantityEffectAtEarlierMark,r)+" font-semibold tabular-nums",children:y(p.quantityEffectAtEarlierMark)})," \u2192 ","price-mark effect ",(0,x.jsx)("span",{className:N(p.endpointPriceMarkEffect,r)+" font-semibold tabular-nums",children:y(p.endpointPriceMarkEffect)})," \u2192 ","Now ",(0,x.jsx)("span",{className:"font-semibold tabular-nums",children:g(n.currentMarketValue)})]}),E&&o&&(0,x.jsxs)("div",{role:"img","aria-label":"Endpoint value-change reconciliation, not realized P&L: Then ".concat(g(n.historicalMarketValue),";
2 share-count effect ").concat(y(p.quantityEffectAtEarlierMark)).concat(S(p.quantityEffectAtEarlierMark)?" (".concat(S(p.quantityEffectAtEarlierMark)," of absolute endpoint effects)"):"","; price-mark effect ").concat(y(p.endpointPriceMarkEffect)).concat(S(p.endpointPriceMarkEffect)?" (".concat(S(p.endpointPriceMarkEffect)," of absolute endpoint effects)"):"","; Now ").concat(g(n.currentMarketValue)),className:"mt-1",title:"Endpoint-only math; not transaction or P&L reconstruction",children:[A>0&&(0,x.jsx)("p",{className:"text-right text-[9px]",children:"Share of absolute endpoint effects"}),[["share-count","Share-count effect",p.quantityEffectAtEarlierMark],["price-mark","Price-mark effect",p.endpointPriceMarkEffect]].map((e=>{let[t,a,s]=e;return(0,x.jsxs)("div",{className:"mt-px grid grid-cols-[7rem_minmax(0,1fr)_2.5rem] items-center gap-1",children:[(0,x.jsx)("span",{className:"truncate",title:a,children:a}),(0,x.jsxs)("div",{className:"grid min-w-0 grid-cols-2 gap-px",children:[(0,x.jsx)("div",{className:w(r,"flex h-2.5 justify-end bg-white/[0.06]","flex h-2.5 justify-end bg-slate-100"),children:s<0&&(0,x.jsx)("span",{className:"h-full bg-rose-500",style:{width:P(s)}})}),(0,x.jsx)("div",{className:w(r,"h-2.5 bg-white/[0.06]","h-2.5 bg-slate-100"),children:s>0&&(0,x.jsx)("span",{className:"block h-full bg-emerald-500",style:{width:P(s)}})})]}),S(s)?(0,x.jsx)("span",{"data-testid":"endpoint-effect-share-".concat(t),className:"text-right font-semibold tabular-nums",children:S(s)}):(0,x.jsx)("span",{"aria-hidden":"true"})]},t)}))]})]}),(0,x.jsx)(D,{sales:u,preference:i,darkMode:r,showCoverage:m,activityCoverage:h})]});var Y;return o?(0,x.jsx)("section",{role:"group","aria-label":"".concat(n.ticker," endpoint composition drivers"),className:"".concat(w(r,"rounded-md border border-white/[0.10] bg-white/[0.03] px-2 py-1.5 text-[10px] leading-4 text-white/55","rounded-md border border-slate-200 bg-slate-50 px-2 py-1.5 text-[10px] leading-4 text-slate-600")," ").concat(d),children:U}):(0,x.jsx)("div",{className:w(r,"mt-1.5 text-[10px] leading-4 text-white/55","mt-1.5 text-[10px] leading-4 text-slate-600"),children:U})}function T(e){let{rows:t,preference:a,currency:s,darkMode:i,partialAllocation:l,allocationComparable:r,salesByTicker:d,activityCoverage:u}=e;const m=(0,n.useMemo)((()=>r?t.filter((e=>{const t=Number.isFinite(e.historicalWeightPct)&&e.historicalWeightPct>=0&&("new"===e.classification||e.historicalQuantity>0),a=Number.isFinite(e.currentWeightPct)&&e.currentWeightPct>=0&&("exited"===e.classification||e.currentQuantity>0);return t||a})).sort(((e,t)=>-1*(Math.max(e.historicalWeightPct||0,e.currentWeightPct||0)-Math.max(t.historicalWeightPct||0,t.currentWeightPct||0))||e.ticker.localeCompare(t.ticker))).slice(0,15):t.filter((e=>{var t;return"available"===(null===(t=e.shareCountChange)||void 0===t?void 0:t.status)})).sort(((e,t)=>Math.abs(t.shareCountChange.percent)-Math.abs(e.shareCountChange.percent)||Math.abs(t.shareCountChange.delta)-Math.abs(e.shareCountChange.delta)||e.ticker.localeCompare(t.ticker))).slice(0,15)),[r,t]),h=Math.max(1,...m.map((e=>Math.max(e.historicalWeightPct||0,e.currentWeightPct||0))));if(!r&&!m.length)return(0,x.jsxs)("section",{"data-private":"true",className:w(i,"ph-no-capture border-b border-white/[0.06] px-4 py-4","ph-no-capture border-b border-slate-100 px-4 py-4"),"aria-labelledby":"top-composition-shift-heading",children:[(0,x.jsx)("h3",{id:"top-composition-shift-heading",className:"text-xs font-semibold",children:"Top 15 composition shift"}),(0,x.jsx)("p",{className:w(i,"mt-1 text-[10px] leading-4 text-white/45","mt-1 text-[10px] leading-4 text-slate-500"),children:"Allocation comparison is unavailable, and no valid positive two-endpoint share counts are available."})]});if(!m.length)return null;const p=(e,t)=>{const a="earlier"===t?e.historicalWeightPct:e.currentWeightPct;return"earlier"===t&&"new"===e.classification||"current"===t&&"exited"===e.classification?"0.0% (not held)":Number.isFinite(a)?(0,c.d1)(a,{signed:!1}):"Unknown (not reported)"},b=e=>Number.isFinite(e)?"".concat(Math.max(2,Math.max(0,e)/h*100),"%"):"0%";return(0,x.jsxs)("section",{"data-private":"true",className:w(i,"ph-no-capture border-b border-white/[0.06] px-4 py-4","ph-no-capture border-b border-slate-100 px-4 py-4"),"aria-labelledby":"top-composition-shift
2-heading",children:[(0,x.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1",children:[(0,x.jsx)("h3",{id:"top-composition-shift-heading",className:"text-xs font-semibold",children:"Top 15 composition shift"}),(0,x.jsx)("p",{className:w(i,"text-[10px] text-white/45","text-[10px] text-slate-500"),children:r?"Earlier and current allocations \xb7 shared scale".concat(l?" \xb7 partial allocation reported":""):"Share-count changes \xb7 allocation comparison unavailable"})]}),(0,x.jsx)("ol",{className:w(i,"mt-2 divide-y divide-white/[0.06]","mt-2 divide-y divide-slate-100"),children:m.map(((e,t)=>{var n;const l=f[e.classification]||f.same,h=function(e){let{allocationClassification:t}=e;switch(t){case"entrant":return"bg-teal-500";case"exit":return"bg-orange-500";case"increased":return"bg-emerald-500";case"reduced":return"bg-rose-500";default:return"bg-slate-400"}}(e),v=Number.isFinite(e.historicalWeightPct)&&Number.isFinite(e.currentWeightPct)?O(e.currentWeightPct-e.historicalWeightPct):"Unknown",g="available"===(null===(n=e.shareCountChange)||void 0===n?void 0:n.status)?"Shares ".concat(e.shareCountChange.percent>0?"\u2191":e.shareCountChange.percent<0?"\u2193":"\u2192"," ").concat((0,c.d1)(Math.abs(e.shareCountChange.percent),{signed:!1})," (").concat(M(k(e.shareCountChange.delta,a))," net)"):S(e.classification);return(0,x.jsxs)("li",{className:"py-2.5",children:[(0,x.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[(0,x.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,x.jsx)(o.A,{ticker:e.ticker,logoUrl:e.logoUrl,darkMode:i,imgClassName:"h-6 w-6 rounded-md object-contain",fallbackClassName:w(i,"flex h-6 w-6 items-center justify-center rounded-md bg-white/[0.05] text-[8px] font-bold","flex h-6 w-6 items-center justify-center rounded-md bg-slate-100 text-[8px] font-bold")}),(0,x.jsx)("p",{className:"text-[11px] font-bold",children:e.ticker})]}),(0,x.jsxs)("p",{className:"text-[10px] font-semibold",children:[(0,x.jsxs)("span",{className:E(e.classification,i),children:[(0,x.jsx)("span",{"aria-hidden":"true",className:"mr-1 inline-block h-2 w-2 rounded-sm "+l.swatchClass}),g]})," \xb7 ",r?(0,x.jsxs)("span",{className:N(e.allocationDeltaPct,i),children:["Allocation ",Number.isFinite(e.allocationDeltaPct)?"".concat(e.allocationDeltaPct>0?"\u2191":e.allocationDeltaPct<0?"\u2193":"\u2192"," ").concat(v.replace(/^[-+]/,"")):"Unknown"]}):(0,x.jsx)("span",{className:w(i,"text-white/55","text-slate-600"),children:"Allocation unavailable"})]})]}),(0,x.jsxs)("div",{role:"group","aria-label":"".concat(e.ticker," allocation and endpoint drivers"),className:"mt-2 grid gap-2 lg:grid-cols-[minmax(0,1fr)_minmax(16rem,0.9fr)] lg:items-start",children:[r&&(0,x.jsxs)("div",{className:"grid gap-1 sm:grid-cols-2 sm:gap-3",children:[(0,x.jsxs)("div",{children:[(0,x.jsxs)("p",{className:w(i,"text-[9px] text-white/35","text-[9px] text-slate-500"),children:["Earlier \xb7 ",p(e,"earlier")]}),(0,x.jsx)("div",{"aria-hidden":"true",className:w(i,"mt-1 h-1.5 bg-white/[0.06]","mt-1 h-1.5 bg-slate-100"),children:(0,x.jsx)("span",{className:w(i,"block h-full bg-white/45","block h-full bg-slate-500"),style:{width:b(e.historicalWeightPct)}})})]}),(0,x.jsxs)("div",{children:[(0,x.jsxs)("p",{className:w(i,"text-[9px] text-white/35","text-[9px] text-slate-500"),children:["Current \xb7 ",p(e,"current")]}),(0,x.jsx)("div",{"aria-hidden":"true",className:w(i,"mt-1 h-1.5 bg-white/[0.06]","mt-1 h-1.5 bg-slate-100"),children:(0,x.jsx)("span",{"data-testid":"current-allocation-bar",className:"block h-full "+h,style:{width:b(e.currentWeightPct)}})})]})]}),(0,x.jsx)(F,{row:e,preference:a,currency:s,darkMode:i,className:r?"":"lg:col-start-2",sales:d.get(e.ticker)||[],showSalesCoverage:t===m.findIndex((e=>(d.get(e.ticker)||[]).length>0)),activityCoverage:u})]})]},e.ticker)}))}),(0,x.jsx)("p",{className:w(i,"mt-2 text-[9px] leading-4 text-white/35","mt-2 text-[9px] leading-4 text-slate-500"),children:"A share-count drop is a net endpoint change and is not proof of a sale; use Reported trades for explicitly reported sales."}),(0,x.jsx)("p",{className:w(i,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:"A zero is shown only when the reviewed snapshot can prove the position was not held. \u201cNot reported\u201d is unknown, not zero."})]})}
2function R(e){let{symbol:t,result:a,startValue:s,currency:n,preference:i,darkMode:l}=e;const r="available"===(null===a||void 0===a?void 0:a.status),o="inception_limited"===(null===a||void 0===a?void 0:a.reason),d=function(e,t,a){return"available"===(null===e||void 0===e?void 0:e.status)&&Number.isFinite(e.totalReturnPct)&&Number(t)>0?k(Number(t)*(1+e.totalReturnPct/100),a):{status:"unavailable",value:null}}(a,s,i);return(0,x.jsxs)("tr",{children:[(0,x.jsxs)("th",{scope:"row",className:"px-2 py-2.5 text-left font-semibold",children:[t,(0,x.jsx)("span",{className:w(l,"mt-0.5 block text-[9px] font-normal text-white/30","mt-0.5 block text-[9px] font-normal text-slate-500"),children:r?"".concat((0,c.d1)(a.totalReturnPct)," full-period \xb7 hypothetical"):o?"Began ".concat(j(a.inception)):"Verified range unavailable"})]}),(0,x.jsx)("td",{className:"px-2 py-2.5 text-right font-bold tabular-nums "+N(null===a||void 0===a?void 0:a.valuePct,l),children:r?(0,c.d1)(a.valuePct):"\u2014"}),(0,x.jsx)("td",{className:"px-2 py-2.5 text-right font-bold tabular-nums",children:C(d,n)})]})}function V(e){var t,a,s,n,i,l;let{first:r,last:o,valueCagr:d,benchmarkComparison:c,currency:u,preference:m,darkMode:h}=e;if(!r||!o)return null;const p=null===c||void 0===c||null===(t=c.benchmarks)||void 0===t||null===(a=t.SPY)||void 0===a?void 0:a.priceBasis,b=(null===c||void 0===c?void 0:c.actualStartDate)&&(null===c||void 0===c?void 0:c.actualEndDate),v=["SPY","QQQM"].filter((e=>{var t,a;return"available"===(null===c||void 0===c||null===(t=c.benchmarks)||void 0===t||null===(a=t[e])||void 0===a?void 0:a.status)})),f=2===v.length?"shared SPY/QQQM":v[0]||"benchmark";return(0,x.jsxs)("div",{className:w(h,"mt-4 border-t border-white/[0.06] pt-3","mt-4 border-t border-slate-100 pt-3"),children:[(0,x.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,x.jsx)("p",{className:"text-xs font-semibold",children:"Market comparison"}),(0,x.jsx)("p",{className:w(h,"text-right text-[9px] text-white/30","text-right text-[9px] text-slate-500"),children:"Reviewed statement window"})]}),(0,x.jsxs)("table",{className:"mt-2 w-full table-fixed text-[10px]","aria-label":"Account value, SPY, and QQQM comparison",children:[(0,x.jsx)("caption",{className:"sr-only",children:"Account-value change and public benchmark scenarios over the reviewed statement window"}),(0,x.jsxs)("colgroup",{children:[(0,x.jsx)("col",{className:"w-[46%]"}),(0,x.jsx)("col",{className:"w-[22%]"}),(0,x.jsx)("col",{className:"w-[32%]"})]}),(0,x.jsx)("thead",{className:w(h,"border-y border-white/[0.06] text-white/30","border-y border-slate-100 text-slate-500"),children:(0,x.jsxs)("tr",{children:[(0,x.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Scenario"}),(0,x.jsx)("th",{className:"px-2 py-1.5 text-right font-medium",children:"Annualized"}),(0,x.jsx)("th",{className:"px-2 py-1.5 text-right font-medium",children:"End value"})]})}),(0,x.jsxs)("tbody",{className:w(h,"divide-y divide-white/[0.06]","divide-y divide-slate-100"),children:[(0,x.jsxs)("tr",{children:[(0,x.jsxs)("th",{scope:"row",className:"px-2 py-2.5 text-left font-semibold",children:["Account value",(0,x.jsx)("span",{className:w(h,"mt-0.5 block text-[9px] font-normal text-white/30","mt-0.5 block text-[9px] font-normal text-slate-500"),children:"available"===d.status?"".concat(_(d.totalReturnPct,m)," full-period \xb7 cash flows included"):"Reviewed ending value"})]}),(0,x.jsx)("td",{className:"px-2 py-2.5 text-right font-bold tabular-nums "+N(d.valuePct,h),children:"available"===d.status?_(d.valuePct,m):"\u2014"}),(0,x.jsx)("td",{className:"px-2 py-2.5 text-right font-bold tabular-nums",children:C(k(o.value,m),u)})]}),(0,x.jsx)(R,{symbol:"SPY",result:null===c||void 0===c||null===(s=c.benchmarks)||void 0===s?void 0:s.SPY,startValue:r.value,currency:u,preference:m,darkMode:h}),(0,x.jsx)(R,{symbol:"QQQM",result:null===c||void 0===c||null===(n=c.benchmarks)||void 0===n?void 0:n.QQQM,startValue:r.value,currency:u,preference:m,darkMode:h})]})]}),(0,x.jsxs)("p",{className:w(h,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:[b?"".concat("adjusted_close"===p?"Adjusted-price":"Price"," returns use ").concat(f," trading closes ").concat(j(c.actualStartDate),"\u2013").concat(j(c.actualEndDate),". "):"SPY and QQQM require verified shared trading closes near both statement endpoints. ","Hypothetical values invest the displayed starting statement value once at the shown benchmark start close, with no later cash flows, fees, taxes, or trading. They are ","adjusted_close"===p?"adjusted-price":"price"," scenarios\u2014not cash-flow-adjusted Portfolio returns."]}),"loading"===(null===c||void 0===c?void 0:c.status)&&(0,x.jsx)("p",{role:"status",className:w(h,"mt-1 text-[9px] text-white/28","mt-1 text-[9px] text-slate-400"),children:"Loading verified public benchmark closes\u2026"}),"inception_limited"===(null===c||void 0===c||null===(i=c.benchmarks)||void 0===i||null===(l=i.QQQM)||void 0===l?void 0:l.reason)&&(0,x.jsx)("p",{className:w(h,"mt-1 text-[9px] text-white/28","mt-1 text-[9px] text-slate-400"),children:"QQQM began trading Oct 13, 2020; Calypso does not shorten the statement window."})]})}function q(e){return"calendar_year"===(null===e||void 0===e?void 0:e.periodKind)?String(e.to||"").slice(0,4):j(null===e||void 0===e?void 0:e.from)+"\u2013"+j(null===e||void 0===e?void 0:e.to)}function B(e){return"portfolio_internal_reconciled"===(null===e||void 0===e?void 0:e.transferScope)?"Portfolio-internal transfers reconciled":"External account flows"}function Q(e){let{activity:t,preference:a,darkMode:s}=e;if("available"!==(null===t||void 0===t?void 0:t.status))return(0,x.jsx)("p",{className:w(s,"mt-3 text-[9px] leading-4 text-white/28","mt-3 text-[9px] leading-4 text-slate-400"),children:"Annual turnover is unavailable until a statement reports complete purchase and sale totals with cash sweeps excluded."});const n=t.completeCalendarYears>0;return(0,x.jsxs)("div",{className:w(s,"mt-3 border-t border-white/[0.06] pt-3","mt-3 border-t border-slate-100 pt-3"),children:[(0,x.jsx)("p",{className:"text-[10px] font-semibold",children:"Reported aggregate trading estimates"}),n&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("p",{className:w(s,"mt-0.5 text-[9px] text-white/30","mt-0.5 text-[9px] text-slate-400"),children:["Annual average \xb7 ",t.completeCalendarYears," complete calendar ",1===t.completeCalendarYears?"year":"years"]}),(0,x.jsxs)("div",{className:"mt-2 grid grid-cols-2 gap-3",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:w(s,"text-[9px] text-white/30","text-[9px] text-slate-400"),children:"Estimated portfolio turnover"}),(0,x.jsx)("p",{className:"mt-1 text-xs font-bold tabular-nums",children:_(t.averageAnnualTurnoverPct,a,{signed:!1})})]}),(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:w(s,"text-[9px] text-white/30","text-[9px] text-slate-400"),children:"Gross trading intensity"}),(0,x.jsx)("p",{className:"mt-1 text-xs font-bold tabular-nums",children:_(t.averageAnnualGrossTradingIntensityPct,a,{signed:!1})})]})]})]}),(0,x.jsxs)("div",{className:w(s,"mt-2 max-h-40 divide-y divide-white/[0.06] overflow-auto","mt-2 max-h-40 divide-y divide-slate-100 overflow-auto"),children:[t.periods.map((e=>(0,x.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto] gap-3 py-2 text-[10px]",children:[(0,x.jsx)("p",{className:"font-semibold",children:q(e)}),(0,x.jsxs)("p",{className:"text-right tabular-nums",children:[(0,x.jsx)("span",{className:w(s,"block text-[8px] text-white/25","block text-[8px] text-slate-400"),children:"Turnover"}),_(e.turnoverPct,a,{signed:!1})]}),(0,x.jsxs)("p",{className:"text-right tabular-nums",children:[(0,x.jsx)("span",{className:w(s,"block text-[8px] text-white/25","block text-[8px] text-slate-400"),children:"Gross intensity"}),_(e.grossTradingIntensityPct,a,{signed:!1})]})]},"".concat(e.from,"-").concat(e.to)))),t.latestYtd&&(0,x.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto] gap-3 py-2 text-[10px]",children:[(0,x.jsxs)("p",{className:"font-semibold",children:["YTD through ",j(t.latestYtd.to),(0,x.jsx)("span",{className:w(s,"block text-[8px] font-normal text-white/25","block text-[8px] font-normal text-slate-400"),children:"Partial current year \xb7 excluded from annual average"})]}),(0,x.jsxs)("p",{className:"text-right tabular-nums",children:[(0,x.jsx)("span",{className:w(s,"block text-[8px] text-white/25","block text-[8px] text-slate-400"),children:"Turnover"}),_(t.latestYtd.turnoverPct,a,{signed:!1})]}),(0,x.jsxs)("p",{className:"text-right tabular-nums",children:[(0,x.jsx)("span",{className:w(s,"block text-[8px] text-white/25","block text-[8px] text-slate-400"),children:"Gross intensity"}),_(t.latestYtd.grossTradingIntensityPct,a,{signed:!1})]})]})]}),(0,x.jsxs)("p",{className:w(s,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:["Turnover is min(purchases, sales) \xf7 average endpoint value. Gross intensity is (purchases + sales) \xf7 average endpoint value. Cash sweeps are excluded. ",t.periodsTruncated?"Older complete periods are not shown.":""]})]})}function I(e){let{summary:t,currency:a,preference:s,darkMode:n}=e;const i="available"===(null===t||void 0===t?void 0:t.status),l=k(null===t||void 0===t?void 0:t.basisCoveredMarketValue,s),r=k(null===t||void 0===t?void 0:t.reportedCostBasis,s),o=k(null===t||void 0===t?void 0:t.embeddedGainLoss,s),d=i&&Number.isFinite(t.basisSharePct)&&Number.isFinite(t.embeddedGainSharePct)&&t.basisSharePct>=0&&t.basisSharePct<=100&&t.embeddedGainSharePct>=0&&t.embeddedGainSharePct<=100,u=i&&t.embeddedGainLoss<0&&Number.isFinite(t.returnOnBasisPct)?Math.min(100,Math.abs(t.returnOnBasisPct)):null;return(0,x.jsxs)("section",{className:w(n,"min-w-0 border-white/[0.07] py-3 first:border-b sm:first:border-b-0 sm:first:border-r sm:first:pr-4 sm:last:pl-4","min-w-0 border-slate-200 py-3 first:border-b sm:first:border-b-0 sm:first:border-r sm:first:pr-4 sm:last:pl-4"),children:[(0,x.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,x.jsx)("p",{className:"text-xs font-semibold",children:j(null===t||void 0===t?void 0:t.asOf)}),(0,x.jsx)("p",{className:w(n,"text-[9px] text-white/35","text-[9px] text-slate-500"),children:i?"complete"===t.completeness?"Complete snapshot":"Covered subset":"Basis unavailable"})]}),i?(0,x.jsxs)(x.Fragment,{children:[d&&(0,x.jsxs)("div",{role:"img","aria-label":"Reported basis ".concat((0,c.d1)(t.basisSharePct,{signed:!1}),"; embedded gain ").concat((0,c.d1)(t.embeddedGainSharePct,{signed:!1})),className:w(n,"mt-3 flex h-2 overflow-hidden bg-white/[0.07]","mt-3 flex h-2 overflow-hidden bg-slate-100"),children:[(0,x.jsx)("span",{"aria-hidden":"true",className:w(n,"h-full bg-white/45","h-full bg-slate-500"),style:{width:"".concat(t.basisSharePct,"%")}}),(0,x.jsx)("span",{"aria-hidden":"true",className:w(n,"h-full bg-emerald-400/80","h-full bg-emerald-600"),style:{width:"".concat(t.embeddedGainSharePct,"%")}})]}),null!=u&&(0,x.jsx)("div",{role:"img","aria-label":"Embedded loss ".concat((0,c.d1)(Math.abs(t.returnOnBasisPct),{signed:!1})," of reported basis"),className:w(n,"mt-3 h-2 bg-white/[0.07]","mt-3 h-2 bg-slate-100"),children:(0,x.jsx)("span",{"aria-hidden":"true",className:w(n,"block h-full bg-rose-400/80","block h-full bg-rose-600"),style:{width:"".concat(u,"%")}})}),(0,x.jsxs)("dl",{className:"mt-3 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-2 text-[10px]",children:[(0,x.jsx)("dt",{className:w(n,"text-white/40","text-slate-500"),children:"Covered position value"}),(0,x.jsx)("dd",{className:"text-right font-semibold tabular-nums",children:C(l,a)}),(0,x.jsx)("dt",{className:w(n,"text-white/40","text-slate-500"),children:"Reported cost basis"}),(0,x.jsx)("dd",{className:"text-right font-semibold tabular-nums",children:C(r,a)}),(0,x.jsx)("dt",{className:w(n,"text-white/40","text-slate-500"),children:t.embeddedGainLoss<0?"Embedded loss":"Embedded gain"}),(0,x.jsx)("dd",{className:"text-right font-semibold tabular-nums "+N(t.embeddedGainLoss,n),children:C(o,a)}),(0,x.jsx)("dt",{className:w(n,"text-white/40","text-slate-500"),children:"Basis / covered value"}),(0,x.jsx)("dd",{className:"text-right font-semibold tabular-nums",children:_(t.basisSharePct,s,{signed:!1})}),(0,x.jsx)("dt",{className:w(n,"text-white/40","text-slate-500"),children:t.embeddedGainLoss<0?"Embedded loss / covered value":"Embedded gain / covered value"}),(0,x.jsx)("dd",{className:"text-right font-semibold tabular-nums "+N(t.embeddedGainLoss,n),children:_(t.embeddedGainSharePct,s)})]}),(0,x.jsxs)("p",{className:w(n,"mt-3 text-[9px] leading-4 text-white/30","mt-3 text-[9px] leading-4 text-slate-500"),children:[Number.isFinite(t.basisCoveragePct)?"Basis covers ".concat(_(t.basisCoveragePct,s,{signed:!1})," of eligible reported position value with usable market values."):"Basis-coverage share is unavailable because at least one reported position value is missing.","complete"!==t.completeness?" Missing basis, market values, complex positions, or incomplete snapshot coverage keep this partial.":""]})]}):(0,x.jsx)("p",{className:w(n,"mt-4 text-[10px] leading-4 text-white/35","mt-4 text-[10px] leading-4 text-slate-500"),children:"No printed cost basis is available for covered position values at this endpoint."})]})}
2function W(e){let{comparison:t,currency:a,preference:s,darkMode:n}=e;if(!t)return null;const i=[t.historical,t.current].some((e=>"available"===(null===e||void 0===e?void 0:e.status)));return(0,x.jsxs)("div",{className:w(n,"mt-4 border-t border-white/[0.06] pt-3","mt-4 border-t border-slate-100 pt-3"),children:[(0,x.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,x.jsx)("p",{className:"text-xs font-semibold",children:"Reported basis & embedded gain"}),(0,x.jsx)("p",{className:w(n,"text-right text-[9px] text-white/30","text-right text-[9px] text-slate-500"),children:"Statement values only"})]}),i?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"mt-1 grid sm:grid-cols-2",children:[(0,x.jsx)(I,{summary:t.historical,currency:a,preference:s,darkMode:n}),(0,x.jsx)(I,{summary:t.current,currency:a,preference:s,darkMode:n})]}),t.comparable&&t.change?(0,x.jsxs)("p",{className:w(n,"border-t border-white/[0.06] pt-2 text-[9px] leading-4 text-white/35","border-t border-slate-100 pt-2 text-[9px] leading-4 text-slate-500"),children:["Embedded-gain share changed ",O(t.change.embeddedGainSharePct)," between two complete reviewed position snapshots."]}):(0,x.jsx)("p",{className:w(n,"border-t border-white/[0.06] pt-2 text-[9px] leading-4 text-white/30","border-t border-slate-100 pt-2 text-[9px] leading-4 text-slate-500"),children:"Cross-date basis change is not shown unless both endpoint snapshots have complete position, market-value, and reported-basis coverage."}),(0,x.jsx)("p",{className:w(n,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:"Embedded gain or loss is covered market value minus printed cost basis. It is not realized gain, taxable income, a complete Portfolio liquidation estimate, or an estimate of tax owed. Account cash outside the reported position rows is not added; short positions, negative values, and unsupported rows are excluded. Amounts use the reviewed account currency; no currency or tax conversion is estimated."})]}):(0,x.jsx)("p",{className:w(n,"mt-3 text-[10px] leading-4 text-white/35","mt-3 text-[10px] leading-4 text-slate-500"),children:"Neither endpoint has both a printed position market value and printed cost basis. Missing basis is not treated as zero."}),i&&(0,x.jsx)("p",{className:w(n,"mt-1 text-[9px] leading-4 text-white/25","mt-1 text-[9px] leading-4 text-slate-400"),children:"Account tax treatment and complete tax-lot holding periods are not confirmed, so Calypso does not label these gains taxable, short-term, or long-term."})]})}function z(e){var t,a,s,i,l;let{account:r,marketOverview:o,preference:d,darkMode:c}=e;const m=function(e){const t=null===e||void 0===e?void 0:e.id,a=null===e||void 0===e?void 0:e.loadBenchmark,s=(null===e||void 0===e?void 0:e.benchmarkComparison)||y,[i,l]=(0,n.use
2State)({accountId:null,result:s});return(0,n.useEffect)((()=>{if(!t)return;if("idle"!==s.status||"function"!==typeof a)return void l({accountId:t,result:s});let e=!1;const n=new AbortController;return l({accountId:t,result:{status:"loading",benchmarks:{}}}),Promise.resolve(a({signal:n.signal})).then((a=>{e||l({accountId:t,result:a})})).catch((()=>{e||l({accountId:t,result:{status:"unavailable",benchmarks:{},reason:"market_data_unavailable"}})})),()=>{e=!0,n.abort()}}),[t,a,s]),i.accountId===t?i.result:s}(r),h=Array.isArray(r.values)?r.values:[],v=h[0],f=h.at(-1),g=v&&f?(0,u.w0)(v.value,f.value,v.date,f.date):{status:"unavailable",valuePct:null},P=k(null===v||void 0===v?void 0:v.value,d),M=k(null===f||void 0===f?void 0:f.value,d),A=r.midpointDietz||{status:"unavailable"};return(0,x.jsxs)("div",{className:"px-4 py-4",children:[o&&(0,x.jsx)(n.Suspense,{fallback:null,children:(0,x.jsx)(p,{accountId:r.id,values:h,marketOverview:o,currency:r.currency,preference:d,darkMode:c})}),(0,x.jsx)(n.Suspense,{fallback:(0,x.jsx)("p",{className:"mt-3 text-xs",children:"Loading annual history\u2026"}),children:(0,x.jsx)(b,{annualHistory:r.annualHistory,preference:d,currency:r.currency,loadAnnualBenchmarks:r.loadAnnualBenchmarks,darkMode:c})}),"available"===g.status?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"grid gap-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end",children:[(0,x.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:w(c,"text-[10px] text-white/35","text-[10px] text-slate-500"),children:j(v.date)}),(0,x.jsx)("p",{className:"mt-1 text-sm font-bold tabular-nums",children:C(P,r.currency)})]}),(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:w(c,"text-[10px] text-white/35","text-[10px] text-slate-500"),children:j(f.date)}),(0,x.jsx)("p",{className:"mt-1 text-sm font-bold tabular-nums",children:C(M,r.currency)})]})]}),(0,x.jsxs)("div",{className:"sm:text-right",children:[(0,x.jsx)("p",{className:"text-xl font-bold tabular-nums "+N(g.valuePct,c),children:_(g.valuePct,d)}),(0,x.jsx)("p",{className:w(c,"mt-0.5 text-[10px] font-medium text-white/45","mt-0.5 text-[10px] font-medium text-slate-600"),children:"Account-value CAGR \xb7 includes cash flows"})]})]}),(0,x.jsx)("p",{className:w(c,"mt-3 text-[10px] leading-4 text-white/32","mt-3 text-[10px] leading-4 text-slate-500"),children:"Annualized change between reviewed statement values. Deposits, withdrawals, fees, and trading are included. This is not investment performance."})]}):(0,x.jsx)("p",{className:w(c,"text-xs leading-5 text-white/40","text-xs leading-5 text-slate-500"),children:"At least two positive, dated account values are required for an account-value CAGR."}),(0,x.jsx)(W,{comparison:r.reportedBasis,currency:r.currency,preference:d,darkMode:c}),(0,x.jsx)(V,{first:v,last:f,valueCagr:g,benchmarkComparison:m,currency:r.currency,preference:d,darkMode:c}),(0,x.jsxs)("div",{className:w(c,"mt-4 border-t border-white/[0.06] pt-3","mt-4 border-t border-slate-100 pt-3"),children:[(0,x.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:"text-xs font-semibold",children:"Estimated cash-flow-adjusted return"}),(0,x.jsx)("p",{className:w(c,"mt-0.5 text-[10px] text-white/35","mt-0.5 text-[10px] text-slate-500"),children:"Flows assumed at mid-period \xb7 linked midpoint Dietz estimate"})]}),(0,x.jsx)("p",{className:"text-right text-sm font-bold tabular-nums "+N(A.cumulativeOnly?A.valuePct:A.annualizedPct,c),children:"available"===A.status?A.cumulativeOnly?_(A.valuePct,d)+" cumulative":_(A.annualizedPct,d)+" annualized":"periods_only"===A.status?"Linked range unavailable":"Unavailable"})]}),(0,x.jsx)("p",{className:w(c,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:"available"===A.status?"".concat(j(A.from)," to ").concat(j(A.to)," \xb7 ").concat(String(null!==(t=null!==(a=A.periodCount)&&void 0!==a?a:null===(s=A.intervals)||void 0===s?void 0:s.length)&&void 0!==t?t:0)," linked ").concat(1===Number(null!==(i=A.periodCount)&&void 0!==i?i:null===(l=A.intervals)||void 0===l?void 0:l.length)?"period":"periods"," with reviewed cash-flow totals. This is an estimate, not exact TWR."):"periods_only"===A.status?"Complete periods are shown below, but they cannot be linked across the reviewed statement range, so a whole-range estimate is unavailable. This is not exact TWR.":"Add year-end December statements plus the latest statement. Opening values and external-flow totals (gross or net)
2support an estimate; balances alone are not enough."}),"available"===A.status&&A.includesPartialPeriod&&(0,x.jsxs)("p",{className:w(c,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:["Annualized through ",j(A.to)," \xb7 includes a partial calendar year."]}),Array.isArray(A.periods)&&A.periods.length>0&&(0,x.jsx)("div",{className:w(c,"mt-3 divide-y divide-white/[0.06] border-y border-white/[0.06]","mt-3 divide-y divide-slate-100 border-y border-slate-100"),children:A.periods.map((e=>(0,x.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto] items-center gap-3 py-2 text-[10px]",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:"font-semibold",children:q(e)}),(0,x.jsxs)("p",{className:w(c,"mt-0.5 text-[9px] text-white/30","mt-0.5 text-[9px] text-slate-400"),children:[B(e),e.usesCombinedNet?" \xb7 printed combined net":""," \xb7 midpoint timing"]})]}),(0,x.jsx)("span",{}),(0,x.jsx)("p",{className:"text-right font-bold tabular-nums "+N(e.valuePct,c),children:_(e.valuePct,d)})]},"".concat(e.from,"-").concat(e.to))))}),(0,x.jsx)(Q,{activity:r.tradingActivity,preference:d,darkMode:c})]})]})}function L(e){var t,a;let{account:s,preference:i,darkMode:r}=e;
2const[d,m]=(0,n.useState)("all"),[h,p]=(0,n.useState)(!1),b=s.holdingsComparison,y=Array.isArray(null===b||void 0===b?void 0:b.snapshots)?b.snapshots:[],[A,D]=(0,n.useState)((null===b||void 0===b?void 0:b.historicalAsOf)||""),[R,V]=(0,n.useState)((null===b||void 0===b?void 0:b.currentAsOf)||""),q="portfolio-holdings-details-"+(0,n.useId)().replace(/[^a-zA-Z0-9_-]/g,""),B=y.find((e=>e.asOf===A)),Q=y.find((e=>e.asOf===R)),I=(0,n.useMemo)((()=>"available"!==(null===b||void 0===b?void 0:b.status)?[]:(0,u.pi)((null===B||void 0===B?void 0:B.positions)||b.historicalPositions,(null===Q||void 0===Q?void 0:Q.positions)||b.currentPositions,B&&Q?{historicalCanProveAbsence:B.canProveAbsence,currentCanProveAbsence:Q.canProveAbsence,historicalPositionCoverage:B.positionCoverage,currentPositionCoverage:Q.positionCoverage}:b.coverage)),[b,B,Q]),W=(0,n.useMemo)((()=>{const e=(null===B||void 0===B?void 0:B.asOf)||(null===b||void 0===b?void 0:b.historicalAsOf),t=(null===Q||void 0===Q?void 0:Q.asOf)||(null===b||void 0===b?void 0:b.currentAsOf);return(0,u.HO)(s.reportedTrades,e,t)}),[s.reportedTrades,null===b||void 0===b?void 0:b.currentAsOf,null===b||void 0===b?void 0:b.historicalAsOf,null===B||void 0===B?void 0:B.asOf,null===Q||void 0===Q?void 0:Q.asOf]),z=(0,n.useMemo)((()=>function(e){const t=Object.fromEntries(g.map((e=>[e,0])));return e.forEach((e=>{Object.prototype.hasOwnProperty.call(t,e.classification)&&(t[e.classification]+=1)})),t}(I)),[I]),L=B&&Q?{historical:B.allocationCoverage,current:Q.allocationCoverage}:{historical:null===b||void 0===b||null===(t=b.coverage)||void 0===t?void 0:t.historicalAllocationCoverage,current:null===b||void 0===b||null===(a=b.coverage)||void 0===a?void 0:a.currentAllocationCoverage},G="unavailable"!==L.historical&&"unavailable"!==L.current,H=[L.historical,L.current].includes("reported_positions_only"),U=(0,n.useMemo)((()=>G?(0,u.C7)(I):[]),[G,I]),Y=(0,n.useMemo)((()=>(0,u.VY)(I)),[I]),K="all"===d?I:I.filter((e=>e.classification===d)),Z=K.some((e=>(W.get(e.ticker)||[]).length>0)),$=z.current_only+z.historical_only,X=z.increased+z.reduced+z.new+z.exited,J=I.length-$,ee=Math.max(1,...U.map((e=>Math.abs(e.allocationDeltaPct)))),te=Math.max(1,...Y.map((e=>"current_only"===e.classification?e.currentWeightPct:e.historicalWeightPct))),ae="Holdings outcomes: "+g.map((e=>"".concat(f[e].label," ").concat(z[e]))).join(", ");return"loading"===(null===b||void 0===b?void 0:b.status)?(0,x.jsx)("p",{role:"status",className:w(r,"px-4 py-7 text-xs text-white/40","px-4 py-7 text-xs text-slate-500"),children:"Loading durable position history\u2026"}):"available"!==(null===b||void 0===b?void 0:b.status)?(0,x.jsxs)("div",{className:"px-4 py-6",children:[(0,x.jsx)("p",{className:w(r,"text-xs leading-5 text-white/40","text-xs leading-5 text-slate-500"),children:(null===b||void 0===b?void 0:b.message)||"A durable historical position snapshot is not available for this account."}),(null===b||void 0===b?void 0:b.onRetry)&&(0,x.jsxs)("button",{type:"button",onClick:b.onRetry,className:w(r,"mt-3 inline-flex min-h-11 items-center gap-1.5 rounded-md border border-white/[0.12] px-3 py-2 text-xs font-semibold focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-0","mt-3 inline-flex min-h-11 items-center gap-1.5 rounded-md border border-slate-200 px-3 py-2 text-xs font-semibold focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-0"),children:[(0,x.jsx)(l.A,{className:"h-3.5 w-3.5"})," Retry history"]})]}):(0,x.jsxs)("div",{children:[y.length>2&&(0,x.jsxs)("div",{className:w(r,"grid grid-cols-2 gap-3 border-b border-white/[0.06] px-4 py-3","grid grid-cols-2 gap-3 border-b border-slate-100 px-4 py-3"),children:[(0,x.jsxs)("label",{className:"min-w-0 max-w-full text-[10px] font-medium",children:["From",(0,x.jsx)("select",{"aria-label":"Holdings comparison from",value:A,onChange:e=>{D(e.target.value),m("all")},className:w(r,"mt-1 min-h-11 min-w-0 w-full max-w-full rounded-md border border-white/[0.1] bg-slate-950 px-2 text-base focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9 sm:text-xs","mt-1 min-h-11 min-w-0
2w-full max-w-full rounded-md border border-slate-200 bg-white px-2 text-base focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9 sm:text-xs"),children:y.slice(0,-1).map((e=>(0,x.jsx)("option",{value:e.asOf,disabled:e.asOf>=R,children:j(e.asOf)},e.asOf)))})]}),(0,x.jsxs)("label",{className:"min-w-0 max-w-full text-[10px] font-medium",children:["To",(0,x.jsx)("select",{"aria-label":"Holdings comparison to",value:R,onChange:e=>{V(e.target.value),m("all")},className:w(r,"mt-1 min-h-11 min-w-0 w-full max-w-full rounded-md border border-white/[0.1] bg-slate-950 px-2 text-base focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9 sm:text-xs","mt-1 min-h-11 min-w-0 w-full max-w-full rounded-md border border-slate-200 bg-white px-2 text-base focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9 sm:text-xs"),children:y.slice(1).map((e=>(0,x.jsx)("option",{value:e.asOf,disabled:e.asOf<=A,children:j(e.asOf)},e.asOf)))})]})]}),(0,x.jsx)(T,{rows:I,preference:i,currency:s.currency,darkMode:r,partialAllocation:H,allocationComparable:G,salesByTicker:W,activityCoverage:s.activityCoverage}),(0,x.jsxs)("div",{className:"grid gap-5 px-4 py-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.1fr)]",children:[(0,x.jsxs)("section",{"aria-labelledby":q+"-outcomes",children:[(0,x.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,x.jsx)("p",{id:q+"-outcomes",className:"text-xs font-semibold",children:"Position outcomes"}),(0,x.jsxs)("p",{className:w(r,"text-[9px] text-white/30","text-[9px] text-slate-500"),children:[j((null===B||void 0===B?void 0:B.asOf)||b.historicalAsOf)," \u2192 ",j((null===Q||void 0===Q?void 0:Q.asOf)||b.currentAsOf)]})]}),(0,x.jsxs)("p",{className:w(r,"mt-1 text-[10px] leading-4 text-white/40","mt-1 text-[10px] leading-4 text-slate-600"),children:[(0,x.jsx)("strong",{className:w(r,"text-white/75","text-slate-900"),children:I.length})," positions \xb7 ",(0,x.jsx)("strong",{className:w(r,"text-white/75","text-slate-900"),children:X})," classified changes \xb7 ",(0,x.jsx)("strong",{className:w(r,"text-white/75","text-slate-900"),children:$})," one-sided"]}),(0,x.jsx)("div",{role:"img","aria-label":ae,className:w(r,"mt-3 flex h-3 overflow-hidden rounded-sm bg-white/[0.06]","mt-3 flex h-3 overflow-hidden rounded-sm bg-slate-100"),children:g.map((e=>z[e]>0&&(0,x.jsx)("span",{title:"".concat(f[e].label,": ").concat(z[e]),className:"min-w-[2px] basis-0 "+f[e].barClass,style:{flexGrow:z[e]}},e)))}),(0,x.jsxs)("p",{className:w(r,"mt-2 text-[9px] leading-4 text-white/30","mt-2 text-[9px] leading-4 text-slate-500"),children:[J," outcomes use quantities present at both endpoints or a snapshot that can prove absence.",$>0?" One-sided means the other snapshot could not prove the position was absent.":""]}),(0,x.jsx)("div",{"aria-label":"Holding change filter",className:"mt-3 grid grid-cols-2 gap-x-3 sm:grid-cols-4",children:v.map((e=>{let[t,a]=e;const s="all"===t?I.length:z[t],n=d===t;return(0,x.jsxs)("button",{type:"button","aria-pressed":n,"aria-controls":q,onClick:()=>(e=>{m(e),p(!0)})(t),className:n?w(r,"flex min-h-11 items-center gap-1.5 border-b-2 border-white px-1 text-left text-[10px] font-semibold text-white","flex min-h-11 items-center gap-1.5 border-b-2 border-slate-900 px-1 text-left text-[10px] font-semibold text-slate-950"):w(r,"flex min-h-11 items-center gap-1.5 border-b border-white/[0.08] px-1 text-left text-[10px] font-semibold text-white/45 hover:text-white/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500","flex min-h-11 items-center gap-1.5 border-b border-slate-200 px-1 text-left text-[10px] font-semibold text-slate-500 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500"),children:["all"!==t&&(0,x.jsx)("span",{"aria-hidden":"true",className:"h-2 w-2 flex-none rounded-[2px] "+f[t].swatchClass}),(0,x.jsx)("span",{className:"truncate",children:a}),(0,x.jsx)("span",{className:"ml-auto tabular-nums",children:s})]},t)}))})]}),(0,x.jsxs)("section",{"aria-labelledby":q+"-movers",className:w(r,"border-white/[0.07] lg:border-l lg:pl-5","border-slate-200 lg:border-l lg:pl-5"),children:[(0,x.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,x.jsx)("p",{id:q+"-movers",className:"text-xs font-semibold",children:"Largest reported allocation changes"}),(0,x.jsx)("p",{className:w(r,"text-right text-[9px] text-white/30","text-right text-[9px] text-slate-500"),children:"Percentage points of account value".concat(H?" \xb7 partial snapshot":"")})]}),U.length?(0,x.jsx)("ol",{className:w(r,"mt-2 divide-y divide-white/[0.06]","mt-2 divide-y divide-slate-100"),children:U.map((e=>{const t=k(e.marketValueDelta,i),a=Math.max(4,Math.abs(e.allocationDeltaPct)/ee*100),n=e.allocationDeltaPct>0;return(0,x.jsxs)("li",{className:"py-2",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,x.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,x.jsx)(o.A,{ticker:e.ticker,logoUrl:e.logoUrl,darkMode:r,imgClassName:"h-6 w-6 rounded-md object-contain",fallbackClassName:w(r,"flex h-6 w-6 items-center justify-center rounded-md bg-white/[0.05] text-[8px] font-bold","flex h-6 w-6 items-center justify-center rounded-md bg-slate-100 text-[8px] font-bold")}),(0,x.jsxs)("div",{className:"min-w-0",children:[(0,x.jsx)("p",{className:"truncate text-[10px] font-bold",children:e.ticker}),(0,x.jsxs)("p",{className:w(r,"truncate text-[9px] text-white/30","truncate text-[9px] text-slate-500"),children:[(l=e.allocationClassification,"entrant"===l?"Entered snapshot":"exit"===l?"Exited snapshot":"increased"===l?"Allocation increased":"reduced"===l?"Allocation reduced":"flat"===l?"Allocation unchanged":"One-sided evidence")," \xb7 ",(0,c.d1)(e.historicalWeightPct,{signed:!1})," \u2192 ",(0,c.d1)(e.currentWeightPct,{signed:!1})]})]})]}),(0,x.jsxs)("div",{className:"flex-none text-right tabular-nums",children:[(0,x.jsx)("p",{className:N(e.allocationDeltaPct,r)+" text-[10px] font-bold",children:O(e.allocationDeltaPct)}),(0,x.jsxs)("p",{className:w(r,"text-[9px] text-white/35","text-[9px] text-slate-500"),children:[C(t,s.currency)," value \u0394"]})]})]}),(0,x.jsxs)("div",{"aria-hidden":"true",className:"mt-1.5 grid grid-cols-2 gap-px",children:[(0,x.jsx)("div",{className:w(r,"flex h-1.5 justify-end bg-white/[0.04]","flex h-1.5 justify-end bg-slate-100"),children:!n&&(0,x.jsx)("span",{className:w(r,"h-full bg-white/45","h-full bg-slate-500"),style:{width:"".concat(a,"%")}})}),(0,x.jsx)("div",{className:w(r,"h-1.5 bg-white/[0.04]","h-1.5 bg-slate-100"),children:n&&(0,x.jsx)("span",{className:w(r,"block h-full bg-white/45","block h-full bg-slate-500"),style:{width:"".concat(a,"%")}})})]})]},e.ticker);var l}))}):(0,x.jsx)("p",{className:w(r,"mt-5 text-[10px] leading-4 text-white/35","mt-5 text-[10px] leading-4 text-slate-500"),children:G?"No reported allocation changes are available for this pair of snapshots.":"Allocation changes cannot be ranked unless both endpoints have same-date account values and market values for every reported position."}),Y.length>0&&(0,x.jsxs)("section",{"aria-labelledby":q+"-one-sided",className:w(r,"mt-4 border-t border-white/[0.07] pt-3","mt-4 border-t border-slate-200 pt-3"),children:[(0,x.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,x.jsx)("p",{id:q+"-one-sided",className:"text-[10px] font-semibold",children:"Largest one-sided reported allocations"}),(0,x.jsx)("p",{className:w(r,"text-right text-[9px] text-white/30","text-right text-[9px] text-slate-500"),children:"Known endpoint only"})]}),(0,x.jsx)("ol",{className:w(r,"mt-1 divide-y divide-white/[0.06]","mt-1 divide-y divide-slate-100"),children:Y.map((e=>{const t="current_only"===e.classification,a=t?e.currentWeightPct:e.historicalWeightPct,n=k(t?e.currentMarketValue:e.historicalMarketValue,i),l=Math.max(4,a/te*100);return(0,x.jsxs)("li",{"aria-label":"".concat(e.ticker," one-sided reported allocation"),className:"py-2",children:[(0,x.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,x.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,x.jsx)(o.A,{ticker:e.ticker,logoUrl:e.logoUrl,darkMode:r,imgClassName:"h-6 w-6 rounded-md object-contain",fallbackClassName:w(r,"flex h-6 w-6 items-center justify-center rounded-md bg-white/[0.05] text-[8px] font-bold","flex h-6 w-6 items-center justify-center rounded-md bg-slate-100 text-[8px] font-bold")}),(0,x.jsxs)("div",{className:"min-w-0",children:[(0,x.jsx)("p",{className:"truncate text-[10px] font-bold",children:e.ticker}),(0,x.jsxs)("p",{className:w(r,"truncate text-[9px] text-white/30","truncate text-[9px] text-slate-500"),children:[t?"
2Not reported earlier":"Not reported currently"," \xb7 ",(0,c.d1)(a,{signed:!1})," ",t?"current":"earlier"]})]})]}),(0,x.jsxs)("p",{className:w(r,"flex-none text-right text-[9px] font-semibold tabular-nums text-white/45","flex-none text-right text-[9px] font-semibold tabular-nums text-slate-600"),children:[C(n,s.currency),(0,x.jsx)("span",{className:"block font-normal",children:"known endpoint value"})]})]}),(0,x.jsx)("div",{"aria-hidden":"true",className:w(r,"mt-1.5 h-1.5 bg-white/[0.04]","mt-1.5 h-1.5 bg-slate-100"),children:(0,x.jsx)("span",{className:w(r,"block h-full bg-white/40","block h-full bg-slate-500"),style:{width:"".concat(l,"%")}})})]},e.ticker)}))}),(0,x.jsx)("p",{className:w(r,"mt-1 text-[9px] leading-4 text-white/28","mt-1 text-[9px] leading-4 text-slate-400"),children:"This ranks only the allocation reported at the known endpoint. Not reported is not zero; no percentage-point change, purchase, or sale is inferred."})]}),(0,x.jsx)("p",{className:w(r,"mt-2 text-[9px] leading-4 text-white/28","mt-2 text-[9px] leading-4 text-slate-400"),children:"Weights divide each reported position value by that date\u2019s reviewed account value, including cash. Reported position weights may sum to less than 100% when a snapshot is partial. Rankings require positive reported quantities and non-negative weights. Changes may reflect market performance, cash flows, trades, transfers, splits, reorganizations, or corrections. They do not prove purchases or sales. Entrants and exits require a snapshot that can prove absence."})]})]}),(0,x.jsxs)("div",{className:w(r,"border-t border-white/[0.06]","border-t border-slate-100"),children:[(0,x.jsxs)("button",{type:"button","aria-expanded":h,"aria-controls":q,onClick:()=>p((e=>!e)),className:w(r,"flex min-h-11 w-full items-center justify-between px-4 text-xs font-semibold text-white/70 hover:bg-white/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500","flex min-h-11 w-full items-center justify-between px-4 text-xs font-semibold text-slate-700 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500"),children:[(0,x.jsxs)("span",{children:[h?"Hide":"Show"," detailed positions"]}),(0,x.jsxs)("span",{className:w(r,"text-[10px] font-medium text-white/35","text-[10px] font-medium text-slate-500"),children:[K.length," of ",I.length]})]}),h&&(0,x.jsxs)("div",{id:q,role:"region","aria-label":"Detailed holding changes",tabIndex:"0",className:"max-h-[24rem] overflow-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500",children:[Z&&(0,x.jsx)("p",{className:w(r,"border-b border-white/[0.06] px-4 py-2 text-[9px] leading-4 text-white/35","border-b border-slate-100 px-4 py-2 text-[9px] leading-4 text-slate-500"),children:"unknown_not_complete"===s.activityCoverage?"Explicit rows only \xb7 activity coverage incomplete":"Explicit rows only \xb7 activity coverage is not confirmed complete"}),(0,x.jsxs)("table",{className:"w-full min-w-[940px] border-collapse text-xs",children:[(0,x.jsx)("thead",{className:w(r,"bg-slate-950 text-white/40","bg-white text-slate-500"),children:(0,x.jsxs)("tr",{children:[(0,x.jsx)("th",{className:"border-b px-4 py-2 text-left",children:"Position"}),(0,x.jsx)("th",{className:"border-b px-4 py-2 text-left",children:"Snapshot outcome"}),(0,x.jsx)("th",{className:"border-b px-4 py-2 text-right",children:"Then"}),(0,x.jsx)("th",{className:"border-b px-4 py-2 text-right",children:"Current"}),(0,x.jsx)("th",{className:"border-b px-4 py-2 text-right",children:"Allocation \u0394"}),(0,x.jsx)("th",{className:"border-b px-4 py-2 text-right",children:"Value \u0394"})]})}),(0,x.jsxs)("tbody",{className:w(r,"divide-y divide-white/[0.06]","divide-y divide-slate-100"),children:[K.map((e=>{const t=k(e.historicalQuantity,i),a=k(e.currentQuantity,i),n=k(e.quantityDelta,i),l=k(e.marketValueDelta,i);return(0,x.jsxs)("tr",{children:[(0,x.jsx)("th",{scope:"row",className:"px-4 py-3 text-left font-normal",children:(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[(0,x.jsx)(o.A,{ticker:e.ticker,logoUrl:e.logoUrl,darkMode:r,imgClassName:"h-6 w-6 rounded-md object-contain",fallbackClassName:w(r,"flex h-6 w-6 items-center justify-center rounded-md bg-white/[0.05] text-[8px] font-bold","flex h-6 w-6 items-center justify-center rounded-md bg-slate-100 text-[8px] font-bold")}),(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:"font-bold",children:e.ticker}),(0,x.jsx)("p",{className:w(r,"max-w-[220px] truncate text-[9px] text-white/32","max-w-[220px] truncate text-[9px] text-slate-500"),children:e.name}),(0,x.jsx)(F,{row:e,preference:i,currency:s.currency,darkMode:r,visual:!1,sales:W.get(e.ticker)||[]})]})]})}),(0,x.jsxs)("td",{className:"px-4 py-3 font-semibold "+E(e.classification,r),children:[(0,x.jsx)("p",{children:S(e.classification)}),"unavailable"!==n.status&&(0,x.jsx)("p",{className:"mt-0.5 text-[9px] tabular-nums",children:M(n)})]}),(0,x.jsxs)("td",{className:"px-4 py-3 text-right tabular-nums",children:[(0,x.jsx)("span",{className:"block",children:P(t)}
2),(0,x.jsx)("span",{className:w(r,"mt-0.5 block text-[9px] text-white/35","mt-0.5 block text-[9px] text-slate-500"),children:_(e.historicalWeightPct,i,{signed:!1})})]}),(0,x.jsxs)("td",{className:"px-4 py-3 text-right font-semibold tabular-nums",children:[(0,x.jsx)("span",{className:"block",children:P(a)}),(0,x.jsx)("span",{className:w(r,"mt-0.5 block text-[9px] font-normal text-white/35","mt-0.5 block text-[9px] font-normal text-slate-500"),children:_(e.currentWeightPct,i,{signed:!1})})]}),(0,x.jsx)("td",{className:"px-4 py-3 text-right font-semibold tabular-nums "+N(e.allocationDeltaPct,r),children:(d=e.allocationDeltaPct,O(d))}),(0,x.jsx)("td",{className:"px-4 py-3 text-right font-semibold tabular-nums",children:C(l,s.currency)})]},e.ticker);var d})),!K.length&&(0,x.jsx)("tr",{children:(0,x.jsx)("td",{colSpan:"6",className:w(r,"px-4 py-7 text-center text-xs text-white/40","px-4 py-7 text-center text-xs text-slate-500"),children:"No positions match this outcome."})})]})]})]})]}),(0,x.jsx)("p",{className:w(r,"border-t border-white/[0.06] px-4 py-2 text-[9px] leading-4 text-white/28","border-t border-slate-100 px-4 py-2 text-[9px] leading-4 text-slate-400"),children:"Quantities and allocation weights compare two reviewed endpoints. Market-value and allocation differences can reflect performance, cash flows, trades, stock splits, transfers, reorganizations, or corrections; they do not prove what happened between statements. New and exited appear only when the opposite snapshot can prove absence."})]})}function G(e){let{account:t,preference:a,darkMode:s}=e;const n=Array.isArray(t.reportedTrades)?t.reportedTrades.filter(m.A):[],i=t.reportedTradeCoverage;return(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:w(s,"border-b border-white/[0.06] px-4 py-3","border-b border-slate-100 px-4 py-3"),children:[(0,x.jsx)("p",{className:"text-xs font-semibold",children:"aggregate_only"===i?"Aggregate trade totals available \xb7 row list incomplete":"Reported-trade coverage unknown"}),(0,x.jsxs)("p",{className:w(s,"mt-0.5 text-[9px] leading-4 text-white/30","mt-0.5 text-[9px] leading-4 text-slate-500"),children:[n.length," explicitly reported ",1===n.length?"trade":"trades",". Only canonical bought and sold records appear here; snapshot changes are never converted into trades."]})]}),(0,x.jsx)("div",{role:"region","aria-label":"Reported trade list",className:w(s,"max-h-[28rem] divide-y divide-white/[0.06] overflow-auto","max-h-[28rem] divide-y divide-slate-100 overflow-auto"),children:n.length?n.map((e=>{const n=k(e.quantity,a),i=k(e.amount,a),l=String(e.type).toLowerCase();return(0,x.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[(0,x.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.ticker&&(0,x.jsx)(o.A,{ticker:e.ticker,logoUrl:e.logoUrl||"",darkMode:s,imgClassName:"h-7 w-7 rounded-md object-contain",fallbackClassName:w(s,"flex h-7 w-7 items-center justify-center rounded-md bg-white/[0.05] text-[8px] font-bold","flex h-7 w-7 items-center justify-center rounded-md bg-slate-100 text-[8px] font-bold")}),(0,x.jsxs)("div",{className:"min-w-0",children:[(0,x.jsxs)("p",{className:"truncate text-xs font-semibold "+N("buy"===l?1:-1,s),children:["buy"===l?"Bought":"Sold"," ",e.ticker||e.description||"security"]}),(0,x.jsxs)("p",{className:w(s,"mt-0.5 text-[10px] text-white/35","mt-0.5 text-[10px] text-slate-500"),children:[j(e.date)," \xb7 explicitly reported"]})]})]}),(0,x.jsxs)("div",{className:"text-right text-[10px] tabular-nums",children:[(0,x.jsx)("p",{className:"font-semibold",children:"unavailable"===n.status?"Quantity unavailable":P(n)+" shares"}),(0,x.jsx)("p",{className:w(s,"mt-0.5 text-white/35","mt-0.5 text-slate-500"),children:"unavailable"===i.status?"Amount unavailable":C(i,e.currency||t.currency)})]})]},e.id)})):(0,x.jsx)("p",{className:w(s,"px-4 py-7 text-xs leading-5 text-white/40","px-4 py-7 text-xs leading-5 text-slate-500"),children:"No explicit bought or sold records are available for this linked history. Snapshot changes are not converted into trades."})})]})}function H(e){let{account:t,darkMode:a}=e;const s=Array.isArray(t.statements)?t.statements:[];return(0,x.jsxs)("div",{children:[(0,x.jsxs)("p",{className:w(a,"border-b border-white/[0.06] px-4 py-2 text-[9px] text-white/30","border-b border-slate-100 px-4 py-2 text-[9px] text-slate-500"),children:[s.length," reviewed statement ",1===s.length?"endpoint":"endpoints"]}),(0,x.jsx)("div",{role:"region","aria-label":"Statement reference list",className:w(a,"max-h-[28rem] divide-y divide-white/[0.06] overflow-auto","max-h-[28rem] divide-y divide-slate-100 overflow-auto"),children:s.length?s.map(((e,t)=>(0,x.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[(0,x.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,x.jsx)(r.A,{className:w(a,"h-4 w-4 flex-none text-white/40","h-4 w-4 flex-none text-slate-500")}),(0,x.jsxs)("div",{className:"min-w-0",children:[(0,x.jsx)("p",{className:"truncate text-xs font-semibold",children:e.label||"Account statement"}),(0,x.jsxs)("p",{className:w(a,"mt-0.5 text-[10px] text-white/35","mt-0.5 text-[10px] text-slate-500"),children:[j(e.asOf)," \xb7 ",e.sourceStatus||"Source status unavailable"]})]})]}),e.onOpen&&(0,x.jsx)("button",{type:"button",onClick:e.onOpen,className:w(a,"min-h-11 flex-none rounded-md border border-white/[0.12] px-3 py-2 text-xs font-semibold focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-0","min-h-11 flex-none rounded-md border border-slate-200 px-3 py-2 text-xs font-semibold focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-0"),children:"View statement"})]},e.key||String(t)))):(0,x.jsx)("p",{className:w(a,"px-4 py-7 text-xs text-white/40","px-4 py-7 text-xs text-slate-500"),children:"No statement references are available for this linked history."})})]})}function U(e){var t,a,s,i,l;let{accounts:r=[],marketOverview:o=null,selectedAccountId:c=null,onSelectedAccountChange:u,displayPreferences:m={},darkMode:p=!1}=e;const b=r.filter((e=>
2null===e||void 0===e?void 0:e.id)),[v,f]=(0,n.useState)((null===(t=b[0])||void 0===t?void 0:t.id)||null),g=c?b.some((e=>e.id===c))?c:null:b.some((e=>e.id===v))?v:null===(a=b[0])||void 0===a?void 0:a.id,y=b.find((e=>e.id===g)),[j,N]=(0,n.useState)({accountId:null!==(s=null===y||void 0===y?void 0:y.id)&&void 0!==s?s:null,activeTab:"performance",visitedTabs:["performance"]}),k=(0,n.useId)().replace(/[^a-zA-Z0-9_-]/g,""),C=j.accountId===(null!==(i=null===y||void 0===y?void 0:y.id)&&void 0!==i?i:null)?j:{accountId:null!==(l=null===y||void 0===y?void 0:y.id)&&void 0!==l?l:null,activeTab:"performance",visitedTabs:["performance"]};if(C!==j&&N(C),!y)return(0,x.jsx)("p",{role:"status",className:"px-4 py-5 text-xs opacity-60",children:"Historical comparison is unavailable for the selected account."});const{activeTab:P,visitedTabs:M}=C,S=(0,d.yo)(m,y.id),E=e=>{N((t=>{const a=t.accountId===y.id?t.visitedTabs:["performance"];return{accountId:y.id,activeTab:e,visitedTabs:a.includes(e)?a:[...a,e]}}))},_="portfolio-history-"+k+"-"+b.indexOf(y);return(0,x.jsxs)("section",{"data-private":"true",className:w(p,"ph-no-capture overflow-hidden rounded-xl border border-white/[0.07] bg-white/[0.025]","ph-no-capture overflow-hidden rounded-xl border border-slate-200 bg-white"),children:[(0,x.jsxs)("div",{className:w(p,"border-b border-white/[0.07] px-4 py-3","border-b border-slate-200 px-4 py-3"),children:[(0,x.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("h2",{className:"text-sm font-bold",children:"Historical comparison"}),(0,x.jsxs)("p",{className:w(p,"mt-0.5 text-[10px] text-white/35","mt-0.5 text-[10px] text-slate-500"),children:["Historical: ",A(y.historicalIdentity,"Prior account identity")," \u2192 Current: ",A(y.currentIdentity,"Current account identity")," \xb7 ",(O=y.lineage,"user_confirmed"===(null===O||void 0===O?void 0:O.provenance)?"Linked by you":"reviewed_exact_match"===(null===O||void 0===O?void 0:O.provenance)?"Reviewed account match":"Account link provenance unavailable")]})]}),b.length>1&&(0,x.jsxs)("label",{className:"min-w-0 w-full max-w-full text-[10px] font-medium sm:w-auto sm:max-w-[280px]",children:[(0,x.jsx)("span",{className:"sr-only",children:"Historical comparison account"}),(0,x.jsx)("select",{"aria-label":"Historical comparison account",value:String(b.indexOf(y)),onChange:e=>{const t=b[Number(e.target.value)];if(!t)return;const a=t.id;f(a),N({accountId:a,activeTab:"performance",visitedTabs:["performance"]}),null===u||void 0===u||u(a)},className:w(p,"min-h-11 min-w-0 w-full max-w-full rounded-md border border-white/[0.1] bg-slate-950 px-2 text-base outline-none focus:ring-2 focus:ring-indigo-500 sm:min-h-9 sm:text-xs","min-h-11 min-w-0 w-full max-w-full rounded-md border border-slate-200 bg-white px-2 text-base outline-none focus:ring-2 focus:ring-indigo-500 sm:min-h-9 sm:text-xs"),children:b.map(((e,t)=>(0,x.jsx)("option",{value:String(t),children:A(e.currentIdentity,"Account "+String(t+1))},e.id)))})]})]}),(0,x.jsx)("div",{role:"tablist","aria-label":"Historical comparison",onKeyDown:e=>{var t,a;const s=h.findIndex((e=>{let[t]=e;return t===P}));let n=null;if("ArrowRight"===e.key&&(n=(s+1)%h.length),"ArrowLeft"===e.key&&(n=(s-1+h.length)%h.length),"Home"===e.key&&(n=0),"End"===e.key&&(n=h.length-1),null==n)return;e.preventDefault();const i=h[n][0];E(i),null===(t=(a=window).requestAnimationFrame)||void 0===t||t.call(a,(()=>{var e;null===(e=document.getElementById(_+"-tab-"+i))||void 0===e||e.focus()}))},className:"mt-3 flex max-w-full gap-4 overflow-x-auto",children:h.map((e=>{let[t,a]=e;return(0,x.jsx)("button",{id:_+"-tab-"+t,type:"button",role:"tab","aria-selected":P===t,"aria-controls":_+"-"+t,tabIndex:P===t?0:-1,onClick:()=>E(t),className:P===t?w(p,"min-h-11 flex-none border-b-2 border-indigo-400 text-[10px] font-semibold text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9","min-h-11 flex-none border-b-2 border-indigo-600 text-[10px] font-semibold text-slate-950 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9"):w(p,"min-h-11 flex-none border-b-2 border-transparent text-[10px] font-semibold text-white/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9","min-h-11 flex-none border-b-2 border-transparent text-[10px] font-semibold text-slate-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 sm:min-h-9"),children:a},t)}))})]}),(0,x.jsx)("div",{id:_+"-performance",role:"tabpanel","aria-labelledby":_+"-tab-performance",hidden:"performance"!==P,children:(0,x.jsx)(z,{account:y,marketOverview:o,preference:S,darkMode:p})}),(0,x.jsx)("div",{id:_+"-holdings",role:"tabpanel","aria-labelledby":_+"-tab-holdings",hidden:"holdings"!==P,children:M.includes("holdings")&&(0,x.jsx)(L,{account:y,preference:S,darkMode:p},y.id)}),(0,x.jsx)("div",{id:_+"-trades",role:"tabpanel","aria-labelledby":_+"-tab-trades",hidden:"trades"!==P,children:M.includes("trades")&&(0,x.jsx)(G,{account:y,preference:S,darkMode:p})}),(0,x.jsx)("div",{id:_+"-statements",role:"tabpanel","aria-labelledby":_+"-tab-statements",hidden:"statements"!==P,children:M.includes("statements")&&(0,x.jsx)(H,{account:y,darkMode:p})})]});var O}const Y=(0,a(31212).A)("calendar-plus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);var K=a(939);function Z(e,t,a){return e?a:t}const $={some:["No December","Some statement"],missing:["Missing","No reviewed evidence"],unknown:["Unknown","Index incomplete"]};function X(e,t){return"year_end"===e.status&&"ready"===e.flowStatus?Z(t,"text-emerald-700","text-emerald-300"):"year_end"===e.status?Z(t,"text-sky-700","text-sky-300"):"some"===e.status?Z(t,"text-amber-700","text-amber-300"):Z(t,"text-slate-500","text-white/35")}function J(e){return"year_end"===e.status?"".concat(e.year,": December or full-year statement available; ").concat("ready"===e.flowStatus?"external-flow totals available for estimation":"external-flow totals incomplete for estimation"):"some"===e.status?"".concat(e.year,": some statement available, no December statement"):"missing"===e.status?"".concat(e.year,": statement coverage missing"):"".concat(e.year,": statement coverage unknown because the durable index is incomplete")}function ee(e){let{accounts:t,onAddDecemberStatements:a,darkMode:s=!1}=e;
2const[i,l]=(0,n.useState)(!1),r=t.some((e=>e.years.length>K.j.recentYears));return(0,x.jsxs)("section",{"data-private":"true","aria-labelledby":"portfolio-year-end-coverage-heading",className:Z(s,"ph-no-capture overflow-hidden rounded-xl border border-slate-200 bg-white","ph-no-capture overflow-hidden rounded-xl border border-white/[0.07] bg-white/[0.025]"),children:[(0,x.jsxs)("header",{className:Z(s,"flex flex-col gap-3 border-b border-slate-200 px-4 py-4 sm:flex-row sm:items-start sm:justify-between","flex flex-col gap-3 border-b border-white/[0.07] px-4 py-4 sm:flex-row sm:items-start sm:justify-between"),children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("h2",{id:"portfolio-year-end-coverage-heading",className:"text-sm font-bold",children:"Year-end statement coverage"}),(0,x.jsx)("p",{className:Z(s,"mt-1 max-w-2xl text-xs leading-5 text-slate-500","mt-1 max-w-2xl text-xs leading-5 text-white/40"),children:"See which completed years have a reviewed December or full-year statement."})]}),(0,x.jsxs)("button",{type:"button",onClick:a,className:Z(s,"inline-flex min-h-9 flex-none items-center justify-center gap-1.5 rounded-md border border-slate-200 px-3 text-xs font-semibold text-slate-700 hover:bg-slate-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500","inline-flex min-h-9 flex-none items-center justify-center gap-1.5 rounded-md border border-white/[0.12] px-3 text-xs font-semibold text-white/75 hover:bg-white/[0.05] focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400"),children:[(0,x.jsx)(Y,{"aria-hidden":"true",className:"h-3.5 w-3.5"})," Add December statements"]})]}),(0,x.jsxs)("div",{className:Z(s,"flex items-center justify-between border-b border-slate-200 px-4 py-2","flex items-center justify-between border-b border-white/[0.07] px-4 py-2"),children:[(0,x.jsx)("p",{className:Z(s,"text-[10px] text-slate-500","text-[10px] text-white/35"),children:"Completed calendar years \xb7 reviewed history only"}),(0,x.jsx)("div",{role:"group","aria-label":"Statement coverage range",className:Z(s,"inline-flex rounded-md bg-slate-100 p-0.5","inline-flex rounded-md bg-white/[0.05] p-0.5"),children:[["recent","Last 5"],["all","All"]].map((e=>{let[t,a]=e;const n=i===("all"===t);return(0,x.jsx)("button",{type:"button","aria-pressed":n,disabled:"all"===t&&!r,onClick:()=>l("all"===t),className:Z(s,"rounded px-2 py-1 text-[10px] font-semibold ".concat(n?"bg-white text-slate-900 shadow-sm":"text-slate-500"," disabled:opacity-40"),"rounded px-2 py-1 text-[10px] font-semibold ".concat(n?"bg-white/[0.1] text-white":"text-white/35"," disabled:opacity-40")),children:a},t)}))})]}),(0,x.jsx)("div",{className:Z(s,"divide-y divide-slate-200","divide-y divide-white/[0.07]"),children:t.map((e=>{const t=i?e.years:e.years.slice(0,K.j.recentYears),a=[e.institution,e.mask?"\u2022\u2022\u2022\u2022 ".concat(e.mask):null].filter(Boolean).join(" \xb7 ");return(0,x.jsxs)("article",{className:"grid gap-3 px-4 py-3 md:grid-cols-[minmax(9rem,0.7fr)_minmax(0,2fr)] md:items-center",children:[(0,x.jsxs)("div",{className:"min-w-0",children:[(0,x.jsx)("h3",{className:"truncate text-xs font-semibold",children:e.label}),a&&(0,x.jsx)("p",{className:Z(s,"mt-0.5 truncate text-[10px] text-slate-500","mt-0.5 truncate text-[10px] text-white/35"),children:a})]}),t.length?(0,x.jsx)("ol",{className:"flex min-w-0 gap-px overflow-x-auto","aria-label":"".concat(e.label," statement coverage"),children:t.map((e=>{const[t,a]=function(e){return"year_end"!==e.status?$[e.status]||$.unknown:["Year-end","ready"===e.flowStatus?"Flows ready":"Flows incomplete"]}(e);return(0,x.jsxs)("li",{"aria-label":J(e),className:Z(s,"min-w-[6.5rem] flex-1 bg-slate-50 px-2.5 py-2","min-w-[6.5rem] flex-1 bg-white/[0.025] px-2.5 py-2"),children:[(0,x.jsx)("p",{className:Z(s,"text-[9px] font-semibold tabular-nums text-slate-400","text-[9px] font-semibold tabular-nums text-white/25"),children:e.year}),(0,x.jsx)("p",{className:"mt-0.5 text-[10px] font-bold ".concat(X(e,s)),children:t}),(0,x.jsx)("p",{className:Z(s,"mt-0.5 text-[9px] text-slate-500","mt-0.5 text-[9px] text-white/35"),children:a})]},e.year)}))}):(0,x.jsx)("p",{className:Z(s,"text-[10px] text-slate-500","text-[10px] text-white/35"),children:"No reviewed completed-year evidence yet."})]},e.id)}))}),(0,x.jsx)("footer",{className:Z(s,"border-t border-slate-200 bg-slate-50 px-4 py-3 text-[10px] leading-4 text-slate-600","border-t border-white/[0.07] bg-white/[0.018] px-4 py-3 text-[10px] leading-4 text-white/40"),children:"Annual opening values and net external flows support a midpoint Dietz estimate. Timing is assumed automatically; complete finer statements refine it. Large early or late flows can change the result. It is not an exact time-weighted return (TWR). Missing means no reviewed evidence, never zero statements or zero cash flow."})]})}const te=20,ae=Object.freeze([]);function se(e,t,a){return e?t:a}function ne(e){let{loadHistory:t,enabled:a=!0,scopeKey:i=null}=e;
2const l=String(i||""),r=(0,n.useRef)(0),[o,d]=(0,n.useState)(0),[c,u]=(0,n.useState)({loader:t,scopeKey:l,status:a&&l?"loading":"idle",accounts:[],yearEndCoverage:[]});(0,n.useEffect)((()=>{const e="function"===typeof t?t:null,n=++r.current;if(!a||!l)return void u({loader:t,scopeKey:l,status:"idle",accounts:[],yearEndCoverage:[]});if(!e)return void u({loader:t,scopeKey:l,status:"unavailable",accounts:[],yearEndCoverage:[]});let i=!1;const o=new AbortController;return u({loader:t,scopeKey:l,status:"loading",accounts:[],yearEndCoverage:[]}),Promise.resolve(e({signal:o.signal})).then((e=>{i||n!==r.current||u((0,s.A)({loader:t,scopeKey:l},function(e){if("unavailable"===(null===e||void 0===e?void 0:e.status))return{status:"unavailable",accounts:[],yearEndCoverage:[]};if(!e||!Array.isArray(e.accounts)||e.accounts.length>te)throw new Error("The Portfolio history adapter returned an invalid result.");const t=e.accounts.filter((e=>null===e||void 0===e?void 0:e.id)).map((e=>(0,s.A)((0,s.A)({},e),{},{liveBridge:null}))),a=t.map((e=>e.id));if(t.length!==e.accounts.length||new Set(a).size!==a.length)throw new Error("The Portfolio history adapter returned an invalid result.");const n=void 0===e.yearEndCoverage?[]:e.yearEndCoverage;if(!Array.isArray(n)||n.length>te)throw new Error("The Portfolio history adapter returned an invalid result.");const i=n.map((e=>{const t=Array.isArray(null===e||void 0===e?void 0:e.years)?e.years:[],a="string"===typeof(null===e||void 0===e?void 0:e.id)&&e.id.length>0&&e.id.length<=100&&"string"===typeof e.label&&e.label.length<=100&&(null==e.institution||"string"===typeof e.institution&&e.institution.length<=100)&&(null==e.mask||"string"===typeof e.mask&&e.mask.length<=8),s=t.length<=K.j.years&&t.every(((e,a)=>Number.isInteger(null===e||void 0===e?void 0:e.year)&&e.year>=1900&&e.year<=3e3&&["year_end","some","missing","unknown"].includes(e.status)&&(null==e.flowStatus||["ready","incomplete"].includes(e.flowStatus))&&(0===a||t[a-1].year>e.year)));if(!a||!s)throw new Error("The Portfolio history adapter returned an invalid result.");return{id:e.id,label:e.label,institution:e.institution||null,mask:e.mask||null,years:t.map((e=>({year:e.year,status:e.status,flowStatus:"year_end"===e.status?e.flowStatus||"incomplete":null})))}}));if(new Set(i.map((e=>e.id))).size!==i.length)throw new Error("The Portfolio history adapter returned an invalid result.");return{status:t.length||i.length?"ready":"empty",accounts:t,yearEndCoverage:i}}(e)))})).catch((()=>{i||n!==r.current||u({loader:t,scopeKey:l,status:"error",accounts:[],yearEndCoverage:[]})})),()=>{i=!0,o.abort()}}),[t,a,l,o]);const m=(0,n.useCallback)((()=>d((e=>e+1))),[]);return c.scopeKey===l&&c.loader===t&&a&&l?(0,s.A)((0,s.A)({},c),{},{retry:m}):{status:a&&l?"loading":"idle",accounts:ae,yearEndCoverage:ae,retry:m}}function ie(e){let{status:t,onRetry:a,darkMode:s}=e;const r=(0,n.useMemo)((()=>"loading"===t?"Loading private Portfolio history\u2026":"empty"===t?"Import an older statement for this account to compare reviewed periods.":"unavailable"===t?"Historical comparison is not available for this Portfolio yet.":"Portfolio history could not be loaded."),[t]);return(0,x.jsxs)("section",{"data-private":"true",className:se(s,"ph-no-capture roun
2ded-xl border border-white/[0.07] bg-white/[0.025] px-4 py-6","ph-no-capture rounded-xl border border-slate-200 bg-white px-4 py-6"),children:[(0,x.jsxs)("div",{role:"error"===t?"alert":"status",className:se(s,"flex items-center gap-2 text-xs text-white/40","flex items-center gap-2 text-xs text-slate-500"),children:["loading"===t&&(0,x.jsx)(i.A,{"aria-hidden":"true",className:"h-4 w-4 animate-spin"}),(0,x.jsx)("span",{children:r})]}),"error"===t&&(0,x.jsxs)("button",{type:"button",onClick:a,className:se(s,"mt-3 inline-flex min-h-9 items-center gap-1.5 rounded-md border border-white/[0.12] px-3 text-xs font-semibold","mt-3 inline-flex min-h-9 items-center gap-1.5 rounded-md border border-slate-200 px-3 text-xs font-semibold"),children:[(0,x.jsx)(l.A,{"aria-hidden":"true",className:"h-3.5 w-3.5"})," Retry history"]})]})}function le(e){let{loadHistory:t,enabled:a=!0,scopeKey:s=null,displayPreferences:i={},marketOverview:l=null,darkMode:r=!1,onAddDecemberStatements:o,selectedAccountId:d,onSelectedAccountChange:c,onHistoryStateChange:u}=e;const m=ne({loadHistory:t,enabled:a,scopeKey:s});return(0,n.useEffect)((()=>{null===u||void 0===u||u({scopeKey:String(s||""),status:m.status,accounts:m.accounts||[],retry:m.retry})}),[u,s,m.accounts,m.status,m.retry]),"idle"===m.status?null:"ready"!==m.status?(0,x.jsx)(ie,{status:m.status,onRetry:m.retry,darkMode:r}):(0,x.jsxs)("div",{className:"space-y-4",children:[m.yearEndCoverage.length>0&&(0,x.jsx)(ee,{accounts:m.yearEndCoverage,onAddDecemberStatements:o,darkMode:r}),m.accounts.length>0&&(0,x.jsx)(U,{accounts:m.accounts,marketOverview:l,displayPreferences:i,darkMode:r,selectedAccountId:d,onSelectedAccountChange:c})]})}function re(e){let{overview:t,marketOverview:i,scopeKey:l,displayPreferences:r,darkMode:o,onAddDecemberStatements:d,selectedAccountId:c,onSelectedAccountChange:u,onHistoryStateChange:m}=e;const h=(0,n.useCallback)((async e=>{let{signal:s}=e;const{loadPortfolioHistoryWorkspace:n}=await a.e(4483).then(a.bind(a,94483));return n({overview:t,signal:s})}),[t]),p=(0,n.useCallback)((e=>{null===m||void 0===m||m((0,s.A)((0,s.A)({},e),{},{sourceOverview:t}))}),[m,t]);return(0,x.jsx)(le,{loadHistory:h,enabled:!0,scopeKey:l,displayPreferences:r,marketOverview:i,darkMode:o,onAddDecemberStatements:d,selectedAccountId:c,onSelectedAccountChange:u,onHistoryStateChange:p})}},17102:(e,t,a)=>{a.d(t,{C7:()=>C,HO:()=>x,J5:()=>N,LQ:()=>f,Oh:()=>S,VY:()=>P,_4:()=>l,nA:()=>_,pi:()=>k,v_:()=>y,w0:()=>p,zF:()=>E});var s=a(89379),n=a(83542);const i=Object.freeze(["SPY","QQQM"]),l=Object.freeze({SPY:"1993-01-22",QQQM:"2020-10-13",QQQ:"1999-03-10"}),r=864e5,o=365.2425,d=4;function c(e){if(null===e||void 0===e||""===e)return null;const t=Number(e);return Number.isFinite(t)?t:null}function u(e){const t=String(e||"").match(/^(\d{4}-\d{2}-\d{2})(?:T|$)/);return t?t[1]:null}function m(e){if("string"!==typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;const[t,a,s]=e.split("-").map(Number),n=new Date(Date.UTC(t,a-1,s));return n.getUTCFullYear()===t&&n.getUTCMonth()===a-1&&n.getUTCDate()===s?e:null}function x(e,t,a){const s=m(t),i=m(a);if(!s||!i||s>=i)return new Map;const l=new Map;
2return(Array.isArray(e)?e:[]).forEach(((e,t)=>{if("reported"!==(null===e||void 0===e?void 0:e.status)||"string"!==typeof(null===e||void 0===e?void 0:e.type)||"sell"!==e.type.toLowerCase()||"string"!==typeof(null===e||void 0===e?void 0:e.ticker)||m(null===e||void 0===e?void 0:e.date)!==(null===e||void 0===e?void 0:e.date)||!(e.date>s&&e.date<=i))return;const a=(0,n.WX)(e.ticker);if(!a)return;const r=l.get(a)||[];r.push({row:e,index:t}),l.set(a,r)})),l.forEach((e=>e.sort(((e,t)=>e.row.date.localeCompare(t.row.date)||String(e.row.id||"").localeCompare(String(t.row.id||""))||e.index-t.index)))),new Map([...l].map((e=>{let[t,a]=e;return[t,a.map((e=>{let{row:t}=e;return t}))]})))}function h(e,t){const a=Date.parse(String(e)+"T00:00:00.000Z"),s=Date.parse(String(t)+"T00:00:00.000Z");return!Number.isFinite(a)||!Number.isFinite(s)||s<=a?null:(s-a)/r}function p(e,t,a,s){const n=c(e),i=c(t),l=h(a,s);if(!(n>0)||!(i>=0)||!(l>0))return{status:"unavailable",valuePct:null,totalReturnPct:null,years:null,reason:"invalid_endpoints"};const r=l/o,d=i/n,u=100*(d**(1/r)-1),m=100*(d-1);return Number.isFinite(u)?{status:"available",valuePct:u,totalReturnPct:m,years:r,reason:null}:{status:"unavailable",valuePct:null,totalReturnPct:null,years:r,reason:"invalid_growth_rate"}}function b(e,t){const a=e.map((e=>c(null===e||void 0===e?void 0:e[t])));return a.every((e=>null!=e))?a.reduce(((e,t)=>e+t),0):null}function v(e,t){if(!Number.isFinite(e)||!Number.isFinite(t))return!1;const a=Math.max(Math.abs(e),Math.abs(t),1);return Math.abs(e-t)<=1e-8*a}function f(e,t){const a=(Array.isArray(e)?e:[]).filter((e=>(null===e||void 0===e?void 0:e.accountId)===t));if(!t||!a.length)return{status:"unavailable",asOf:null,positions:[],reason:"missing_account_positions"};const s=new Set(a.map((e=>u(null===e||void 0===e?void 0:e.asOf))));if(1!==s.size||s.has(null))return{status:"unavailable",asOf:null,positions:[],reason:"incoherent_position_dates"};const i=new Map;for(const r of a){const e=(0,n.WX)(null===r||void 0===r?void 0:r.ticker);if(!e)return{status:"unavailable",asOf:[...s][0],positions:[],reason:"unmatched_historical_security"};i.has(e)||i.set(e,[]),i.get(e).push(r)}const l=[...i.entries()].map((e=>{var t;let[a,s]=e;const{valuedRows:n,acquisitionRows:i,costBasis:l,usesTaxLots:r}=function(e){const t=e.filter((e=>"tax_lot"!==(null===e||void 0===e?void 0:e.rowRole))),a=e.filter((e=>"tax_lot"===(null===e||void 0===e?void 0:e.rowRole)));if(!t.length)return{valuedRows:a,acquisitionRows:a,costBasis:b(a,"costBasis"),usesTaxLots:!0};const s=b(t,"quantity"),n=b(a,"quantity"),i=b(t,"marketValue"),l=a.map((e=>c(null===e||void 0===e?void 0:e.marketValue))),r=l.some((e=>null!=e)),o=l.every((e=>null!=e))?l.reduce(((e,t)=>e+t),0):null,d=!r||null!=o&&v(i,o),u=a.length>0&&v(s,n)&&d,m=b(t,"costBasis"),x=u?b(a,"costBasis"):null;return{valuedRows:t,acquisitionRows:u?a:t,costBasis:null!==m&&void 0!==m?m:x,usesTaxLots:!1}}(s),o=i.map((e=>u(null===e||void 0===e?void 0:e.acquiredDate))),d=[...new Set(o)],m=o.length>0&&o.every(Boolean)&&1===d.length;return{ticker:a,name:(null===(t=n.find((e=>null===e||void 0===e?void 0:e.name)))||void 0===t?void 0:t.name)||a,quantity:b(n,"quantity"),marketValue:b(n,"marketValue"),costBasis:l,rowRole:r&&1===n.length?"tax_lot":"position",acquiredDate:m?d[0]:null}}));return l.some((e=>null==e.quantity))?{status:"unavailable",asOf:[...s][0],positions:[],reason:"missing_historical_quantities"}:{status:"available",asOf:[...s][0],positions:l,reason:null}}function g(e,t){if(!Number.isFinite(e)||!(t>0))return null;const a=e/t*100;return Number.isFinite(a)?a:null}function y(e,t){const a=c(t),n=Array.isArray(null===e||void 0===e?void 0:e.positions)?e.positions:[],i=a>0,l=n.every((e=>null!=c(null===e||void 0===e?void 0:e.marketValue)));return(0,s.A)((0,s.A)({},e),{},{accountValue:i?a:null,allocationCoverage:i&&l?null!==e&&void 0!==e&&e.canProveAbsence?"complete":"reported_positions_only":"unavailable",positions:n.map((e=>(0,s.A)((0,s.A)({},e),{},{weightPct:i?g(c(null===e||void 0===e?void 0:e.marketValue),a):null})))})}function w(e,t){return{status:"unavailable",asOf:(null===e||void 0===e?void 0:e.asOf)||null,reason:t,completeness:"unknown",eligibleReportedMarketValue:null,basisCoveredMarketValue:null,reportedCostBasis:null,embeddedGainLoss:null,basisCoveragePct:null,basisSharePct:null,embeddedGainSharePct:null,returnOnBasisPct:null,coveredPositionCount:0,missingBasisPositionCount:0,missingMarketValuePositionCount:0,complexPositionCount:0}}function j(e){const t=Array.isArray(null===e||void 0===e?void 0:e.positions)?e.positions:[];if(null===e||void 0===e||!e.asOf||!t.length)return w(e,"no_reported_positions");let a=0,n=0,i=0,l=0,r=0,o=0,d=0;if(t.forEach((e=>{const t=c(null===e||void 0===e?void 0:e.quantity),s=c(null===e||void 0===e?void 0:e.marketValue),u=c(null===e||void 0===e?void 0:e.costBasis);null!=s?null!=t&&t<0||s<0||null!=u&&u<0?d+=1:(a+=s,null!=u?(n+=s,i+=u,l+=1):r+=1):o+=1})),!l)return(0,s.A)((0,s.A)({},w(e,"no_reported_cost_basis")),{},{eligibleReportedMarketValue:a,missingBasisPositionCount:r,missingMarketValuePositionCount:o,complexPositionCount:d});const u=n-i,m="complete"===(null===e||void 0===e?void 0:e.basisCoverage)&&!0===(null===e||void 0===e?void 0:e.canProveAbsence)&&0===r&&0===o&&0===d;return{status:"available",asOf:e.asOf,reason:null,completeness:m?"complete":"partial",eligibleReportedMarketValue:a,basisCoveredMarketValue:n,reportedCostBasis:i,embeddedGainLoss:u,basisCoveragePct:0===o?g(n,a):null,basisSharePct:g(i,n),embeddedGainSharePct:g(u,n),returnOnBasisPct:g(u,i),coveredPositionCount:l,missingBasisPositionCount:r,missingMarketValuePositionCount:o,complexPositionCount:d}}function N(e){const t=(Array.isArray(e)?e:[]).filter((e=>null===e||void 0===e?void 0:e.asOf)).sort(((e,t)=>e.asOf.localeCompare(t.asOf))),a=j(t[0]),s=j(t.at(-1));if(t.length<2||a.asOf===s.asOf)return{status:"unavailable",historical:a,current:s,comparable:!1,
2change:null};const n=[a,s].filter((e=>"available"===e.status)).length,i=2===n&&"complete"===a.completeness&&"complete"===s.completeness;return{status:2===n?"available":n?"partial":"unavailable",historical:a,current:s,comparable:i,change:i?{reportedCostBasis:s.reportedCostBasis-a.reportedCostBasis,embeddedGainLoss:s.embeddedGainLoss-a.embeddedGainLoss,embeddedGainSharePct:Number.isFinite(s.embeddedGainSharePct)&&Number.isFinite(a.embeddedGainSharePct)?s.embeddedGainSharePct-a.embeddedGainSharePct:null}:null}}function k(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new Map((Array.isArray(e)?e:[]).map((e=>[e.ticker,e]))),i=new Map((Array.isArray(t)?t:[]).map((e=>[e.ticker,e])));return[...new Set([...n.keys(),...i.keys()])].sort().map((e=>{var t,l;const r=n.get(e)||null,o=i.get(e)||null,d=function(e,t,a){if(!e)return null!==a&&void 0!==a&&a.historicalCanProveAbsence?"new":"current_only";if(!t)return null!==a&&void 0!==a&&a.currentCanProveAbsence?"exited":"historical_only";const s=Math.max(Math.abs(e.quantity),Math.abs(t.quantity),1),n=t.quantity-e.quantity;return Math.abs(n)<=1e-8*s?"same":n>0?"increased":"reduced"}(r,o,a),u=c(null===r||void 0===r?void 0:r.weightPct),m=c(null===o||void 0===o?void 0:o.weightPct),x=c(null===r||void 0===r?void 0:r.marketValue),h=c(null===o||void 0===o?void 0:o.marketValue),p=null!==u&&void 0!==u?u:"new"===d?0:null,b=null!==m&&void 0!==m?m:"exited"===d?0:null,v=null!==x&&void 0!==x?x:"new"===d?0:null,f=null!==h&&void 0!==h?h:"exited"===d?0:null,g=null!=p&&null!=b?b-p:null,y=null!=v&&null!=f?f-v:null,w="new"===d?"entrant":"exited"===d?"exit":null==g?"one_sided":Math.abs(g)<=1e-8?"flat":g>0?"increased":"reduced",j=function(e,t,a){if(!e||!t||!["same","increased","reduced"].includes(a))return{status:"unavailable",delta:null,percent:null};const s=c(e.quantity),n=c(t.quantity);if(!(s>0)||!(n>0))return{status:"unavailable",delta:null,percent:null};const i=n-s,l=i/s*100;return Number.isFinite(i)&&Number.isFinite(l)?{status:"available",delta:i,percent:l}:{status:"unavailable",delta:null,percent:null}}(r,o,d),N=function(e,t,a){if("available"!==(null===a||void 0===a?void 0:a.status))return null;const s=c(e.quantity),n=c(t.quantity),i=c(e.marketValue),l=c(t.marketValue);if(!(i>0)||!(l>0))return null;const r=i/s,o=l/n,d=a.delta,u={earlierUnitValue:r,currentUnitValue:o,endpointUnitValueChangePct:(o-r)/r*100,quantityEffectAtEarlierMark:d*r,endpointPriceMarkEffect:n*(o-r),recomposedValueDelta:d*r+n*(o-r)};return Object.values(u).every(Number.isFinite)?u:null}(r,o,j),k=function(e){const t=c(null===e||void 0===e?void 0:e.quantity),a=c(null===e||void 0===e?void 0:e.marketValue),s=c(null===e||void 0===e?void 0:e.costBasis);if(!e||!(t>0)||null==a||a<0||null==s||s<0)return{currentReportedBasis:{status:"unavailable",value:null},remainingEmbeddedGainLoss:{status:"unavailable",value:null,percentOnBasis:null}};const n=a-s,i=s>0?n/s*100:null;return{currentReportedBasis:{status:"available",value:s},remainingEmbeddedGainLoss:{status:"available",value:n,percentOnBasis:Number.isFinite(i)?i:null}}}(o);return(0,s.A)({ticker:e,name:(null===o||void 0===o?void 0:o.name)||(null===r||void 0===r?void 0:r.name)||e,logoUrl:(null===o||void 0===o?void 0:o.logoUrl)||"",classification:d,allocationClassification:w,historicalQuantity:null!==(t=null===r||void 0===r?void 0:r.quantity)&&void 0!==t?t:null,currentQuantity:null!==(l=null===o||void 0===o?void 0:o.quantity)&&void 0!==l?l:null,quantityDelta:r&&o?o.quantity-r.quantity:null,historicalMarketValue:v,currentMarketValue:f,marketValueDelta:y,historicalWeightPct:p,currentWeightPct:b,allocationDeltaPct:g,shareCountChange:j,drivers:N,currentPositionCoverage:(null===a||void 0===a?void 0:a.currentPositionCoverage)||"unknown",hasCurrentReportedBasisField:Boolean(o&&Object.prototype.hasOwnProperty.call(o,"costBasis"))},k)}))}function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;return(Array.isArray(e)?e:[]).filter((e=>Number.isFinite(null===e||void 0===e?void 0:e.allocationDeltaPct)&&"flat"!==e.allocationClassification&&e.historicalWeightPct>=0&&e.currentWeightPct>=0&&("new"===e.classification||e.historicalQuantity>0)&&("exited"===e.classification||e.currentQuantity>0))).sort(((e,t)=>Math.abs(t.allocationDeltaPct)-Math.abs(e.allocationDeltaPct)||Math.abs(t.marketValueDelta||0)-Math.abs(e.marketValueDelta||0)||e.ticker.localeCompare(t.ticker))).slice(0,Math.max(0,t))}function P(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;return(Array.isArray(e)?e:[]).filter((e=>"current_only"===(null===e||void 0===e?void 0:e.classification)?Number.isFinite(e.currentWeightPct)&&e.currentWeightPct>=0&&e.currentQuantity>0:"historical_only"===(null===e||void 0===e?void 0:e.classification)&&(Number.isFinite(e.historicalWeightPct)&&e.historicalWeightPct>=0&&e.historicalQuantity>0))).sort(((e,t)=>{const a="current_only"===e.classification?e.currentWeightPct:e.historicalWeightPct,s="current_only"===t.classification?t.currentWeightPct:t.historicalWeightPct,n="current_only"===e.classification?e.currentMarketValue:e.historicalMarketValue,i="current_only"===t.classification?t.currentMarketValue:t.historicalMarketValue;return s-a||Math.abs(i||0)-Math.abs(n||0)||e.ticker.localeCompare(t.ticker)})).slice(0,Math.max(0,t))}function M(e){const t=new Map;return function(e){return Array.isArray(null===e||void 0===e?void 0:e.historical)?e.historical:[]}(e).forEach((e=>{const a=u(null===e||void 0===e?void 0:e.date),s=c(null===e||void 0===e?void 0:e.adjClose),n=c(null===e||void 0===e?void 0:e.close);a&&(s>0||n>
20)&&t.set(a,{date:a,adjustedClose:s>0?s:null,close:n>0?n:null})})),t}function A(e,t){const a=Date.parse(String(e)+"T00:00:00.000Z");return Number.isFinite(a)?new Date(a+t*r).toISOString().slice(0,10):null}function S(e,t,a){let{edgeToleranceDays:n=d,symbols:r=i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!(h(t,a)>0))return{status:"unavailable",requestedStartDate:t,requestedEndDate:a,actualStartDate:null,actualEndDate:null,edgeToleranceDays:n,benchmarks:{},reason:"invalid_endpoints"};const o=r.filter((e=>l[e])),c=o.filter((e=>t>=l[e])),u=o.filter((e=>!c.includes(e))),m=Object.fromEntries(c.map((t=>[t,M(null===e||void 0===e?void 0:e[t])]))),x=c.length?[...m[c[0]].keys()].filter((e=>c.every((t=>m[t].has(e))))).sort():[],b=A(t,n),v=A(a,-n),f=x.find((e=>e>=t&&e<=b))||null,g=[...x].reverse().find((e=>e<=a&&e>=v))||null,y=Boolean(f&&g&&f<g),w=y?c.flatMap((e=>[m[e].get(f),m[e].get(g)])):[],j=w.length&&w.every((e=>(null===e||void 0===e?void 0:e.adjustedClose)>0))?"adjusted_close":w.length&&w.every((e=>(null===e||void 0===e?void 0:e.close)>0))?"close":null,N={};c.forEach((e=>{if(!y)return void(N[e]={status:"unavailable",symbol:e,reason:"common_endpoint_missing",requestedStartDate:t,requestedEndDate:a});if(!j)return void(N[e]={status:"unavailable",symbol:e,reason:"inconsistent_price_basis",startDate:f,endDate:g});
2const n=m[e].get(f),i=m[e].get(g),l="adjusted_close"===j?n.adjustedClose:n.close,r="adjusted_close"===j?i.adjustedClose:i.close;N[e]=(0,s.A)((0,s.A)({},p(l,r,f,g)),{},{symbol:e,startDate:f,endDate:g,startPrice:l,endPrice:r,priceBasis:j})})),u.forEach((e=>{N[e]={status:"unavailable",symbol:e,reason:"inception_limited",inception:l[e]}}));const k=Object.values(N).filter((e=>"available"===e.status)).length;return{status:k===o.length?"available":k?"partial":"unavailable",requestedStartDate:t,requestedEndDate:a,actualStartDate:y?f:null,actualEndDate:y?g:null,edgeToleranceDays:n,benchmarks:N}}function E(e,t,a){const s=(0,n.WX)(e);if(!l[s]||!u(t)||!u(a)||a<=t)throw new Error("A supported benchmark and exact date range are required.");return{path:"/historical-price-full/"+encodeURIComponent(s),params:{from:t,to:a}}}function _(e,t){if("USD"!==(null===t||void 0===t?void 0:t.currency))return{status:"unavailable",reason:"unsupported_account_currency",years:[]};const a=["SPY","QQQ"],s=Object.fromEntries(a.map((t=>[t,M(null===e||void 0===e?void 0:e[t])]))),n=((null===t||void 0===t?void 0:t.years)||[]).map((e=>{const n="".concat(e.year-1,"-12-31"),i="ytd"===e.kind?t.asOf:"".concat(e.year,"-12-31"),r=(e,t)=>e.filter((e=>e<=t&&e>=A(t,-d))).sort().at(-1),o=a.filter((e=>n>=l[e]&&r([...s[e].keys()],n)&&r([...s[e].keys()],i))),c=o.length?[...s[o[0]].keys()].filter((e=>o.every((t=>s[t].has(e))))):[],u=r(c,n),m=r(c,i),x=u&&m&&u<m,h=x&&o.every((e=>s[e].get(u).adjustedClose>0&&s[e].get(m).adjustedClose>0)),p=Object.fromEntries(a.map((e=>{if(!x||!o.includes(e))return[e,{status:"unavailable",valuePct:null}];const t=s[e].get(u),a=s[e].get(m),n=h?t.adjustedClose:t.close,i=h?a.adjustedClose:a.close,l=n>0&&i>0?100*(i/n-1):null;return[e,Number.isFinite(l)?{status:"available",valuePct:l,startDate:u,endDate:m,priceBasis:h?"adjusted_close":"close"}:{status:"unavailable",valuePct:null}]})));return{year:e.year,kind:e.kind,from:n,to:i,benchmarks:p}})),i=n.flatMap((e=>Object.values(e.benchmarks))),r=i.filter((e=>"available"===e.status)).length;return{status:r===i.length&&r>0?"available":r?"partial":"unavailable",years:n}}},939:(e,t,a)=>{a.d(t,{j:()=>u,v:()=>c});const s=15;function n(e){return/^\d{4}-\d{2}-\d{2}$/.test(String(e||""))?String(e):null}function i(e){const t=n(e);return t?Number(t.slice(0,4)):null}function l(e){return["reported","explicit_zero"].includes(null===e||void 0===e?void 0:e.disclosure)&&"number"===typeof(null===e||void 0===e?void 0:e.amount)&&Number.isFinite(e.amount)}function r(e,t){return"calendar_year"===(null===e||void 0===e?void 0:e.periodKind)||(null===e||void 0===e?void 0:e.periodStart)==="".concat(t,"-01-01")&&(null===e||void 0===e?void 0:e.periodEnd)==="".concat(t,"-12-31")}function o(e,t){return r(e,t)&&["account_external","portfolio_internal_reconciled"].includes(null===e||void 0===e?void 0:e.transferScope)&&l(null===e||void 0===e?void 0:e.deposits)&&l(null===e||void 0===e?void 0:e.withdrawals)}function d(e,t){const a="".concat(t-1,"-12-31"),s="".concat(t,"-12-31");let n=a;for(const l of(null===e||void 0===e||null===(i=e.estimatedPerformance)||void 0===i?void 0:i.periods)||[]){var i;if(!(l.from<a||l.to>s)){if(l.from!==n||!Number.isFinite(l.estimatedReturn)||!["account_external","portfolio_internal_reconciled"].includes(l.transferScope)||l.currency!==e.account.currency)return!1;n=l.to}}return n===s}function c(e){var t,a,l,c;const u=null===e||void 0===e?void 0:e.account,m=null===u||void 0===u?void 0:u.accountId,x=n(null===u||void 0===u?void 0:u.asOf);if(!m||!x)return null;const h=((null===e||void 0===e||null===(t=e.records)||void 0===t?void 0:t.valuations)||[]).filter((e=>(null===e||void 0===e?void 0:e.accountId)===m&&n(null===e||void 0===e?void 0:e.asOf))),p=((null===e||void 0===e||null===(a=e.records)||void 0===a?void 0:a.period_summaries)||[]).filter((e=>(null===e||void 0===e?void 0:e.accountId)===m&&n(null===e||void 0===e?void 0:e.periodEnd))),b=i(x),v=x.endsWith("-12-31")?b:b-1,f=[...h.map((e=>i(e.asOf))),...p.map((e=>i(e.periodEnd)))].filter((e=>Number.isInteger(e)&&e<=v)),g=f.length?Math.max(v-s+1,Math.min(...f)):null,y=!0===(null===e||void 0===e||null===(l=e.indexTruncated)||void 0===l?void 0:l.valuations)||!0===(null===e||void 0===e||null===(c=e.indexTruncated)||void 0===c?void 0:c.periodSummaries),w=[];for(let s=v;null!=g&&s>=g;s-=1){const t=h.filter((e=>i(e.asOf)===s)),a=p.filter((e=>i(e.periodEnd)===s)),n=t.some((e=>
2"12"===e.asOf.slice(5,7)))||a.some((e=>r(e,s)||"12"===e.periodEnd.slice(5,7))),l=t.length>0||a.length>0;w.push({year:s,status:n?"year_end":l?"some":y?"unknown":"missing",flowStatus:n&&(a.some((e=>o(e,s)))||d(e,s))?"ready":n?"incomplete":null})}return{id:m,label:u.name||u.type||"Investment account",institution:u.institution||null,mask:u.mask||null,years:w}}const u=Object.freeze({accounts:20,years:s,recentYears:5})},41680:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(31212).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},50516:(e,t,a)=>{a.d(t,{A:()=>s});const s=(0,a(31212).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])}}]); 3//# sourceMappingURL=portfolio-history.d85bd6c1.chunk.js.map
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.