1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[969],{70969:(e,r,t)=>{t.r(r),t.d(r,{PremiumProjectionChart:()=>j});var l=t(85047),s=t(31615),a=t(60996),n=t(87884),o=t(99922),i=t(91595),c=t(82520),d=t(21582),u=t(73521),h=t(21016),x=t(54306);let m=[10,20,30],p=[{value:"productCode",label:"ä¾åå代碼"},{value:"company",label:"ä¾å
¬å¸"},{value:"category",label:"ä¾å¤§åé¡"}];function j(){let{auth:e}=(0,u.A)(),{theme:r}=(0,o.D)(),t=(0,i.py)(),j=(0,i.OY)(),[y,b]=(0,s.useState)(20),[g,f]=(0,s.useState)("productCode"),[v,C]=(0,s.useState)([]),[N,S]=(0,s.useState)(!0),[k,w]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(!e?.currentUser){S(!1),C([]);return}S(!0),w(null),e.currentUser.getIdToken().then(e=>fetch(`/api/insurance/premium-projections?years=${y}&excludeProperty=1`,{headers:{Authorization:`Bearer ${e}`}})).then(e=>e.ok?e.json():e.json().then(e=>{throw Error(e.error||"è¼å
¥å¤±æ")})).then(e=>{C(Array.isArray(e.projections)?e.projections:[])}).catch(e=>{w(e instanceof Error?e.message:"è¼å
¥å¤±æ"),C([])}).finally(()=>S(!1))},[e?.currentUser,y]);let F=(0,s.useMemo)(()=>{if(0===v.length)return null;let e=v.map(e=>String(e.year)),r="company"===g?"byCompany":"category"===g?"byCategory":"byProductCode",l=new Set;v.forEach(e=>Object.keys(e[r]||{}).forEach(e=>l.add(e)));let s=Array.from(l).sort().map((e,t)=>({name:e,data:v.map(t=>{let l=(t[r]??{})[e]??0;return{y:l,custom:{formattedPremium:l>=1e6?`${(l/1e6).toFixed(1)}ç¾è¬`:l>=1e4?`${Math.round(l/1e4)}è¬`:Math.round(l).toLocaleString()}}}),color:j[t%j.length]}));return s.some(e=>e.data.some(e=>e.y>0))?(0,i.dt)("line",{chart:{type:"line",backgroundColor:"transparent",height:400},title:{text:"æªä¾ä¿è²»èµ°å¢",style:{color:t.text,fontSize:"18px",fontWeight:"bold"}},xAxis:{categories:e,title:{text:"年度",style:{color:t.mutedForeground}},labels:{style:{color:t.text,fontSize:"12px"}}},yAxis:{title:{text:"å¹´ç¹³ä¿è²»ï¼å
ï¼",style:{color:t.mutedForeground}},labels:{format:"{value:,.0f}",style:{color:t.mutedForeground,fontSize:"11px"}}},plotOptions:{line:{marker:{enabled:!1},lineWidth:2,dataLabels:{enabled:!1}}},tooltip:{shared:!0,useHTML:!0,headerFormat:"",pointFormat:'<span style="color:{series.color}">â</span> {series.name}: <b>{point.custom.formattedPremium}</b><br/>',backgroundColor:t.background,borderColor:t.border,style:{color:t.text}},series:s,credits:{enabled:!1}}):null},[v,g,t,j]),A=!N&&!k&&v.length>0&&!F,P=!N&&!k&&v.length>0&&v.every(e=>0===e.totalPremium);return(0,l.jsxs)(c.Zp,{children:[(0,l.jsx)(c.aR,{children:(0,l.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)(c.ZB,{children:"æªä¾ä¿è²»èµ°å¢"}),(0,l.jsx)(c.BT,{children:"å
顯示è¦ä¿äººçºæ¬äººçä¿å®ï¼é ä¼°è³è¢«ä¿éªäºº 90 æ²çºæ¢"})]}),(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsxs)(d.l6,{value:String(y),onValueChange:e=>b(Number(e)),children:[(0,l.jsx)(d.bq,{className:"w-[100px]",children:(0,l.jsx)(d.yv,{})}),(0,l.jsx)(d.gC,{children:m.map(e=>(0,l.jsxs)(d.eb,{value:String(e),children:[e," å¹´"]},e))})]}),(0,l.jsxs)(d.l6,{value:g,onValueChange:e=>f(e),children:[(0,l.jsx)(d.bq,{className:"w-[120px]",children:(0,l.jsx)(d.yv,{})}),(0,l.jsx)(d.gC,{children:p.map(e=>(0,l.jsx)(d.eb,{value:e.value,children:e.label},e.value))})]})]})]})}),(0,l.jsxs)(c.Wu,{children:[k&&(0,l.jsx)(h.Fc,{variant:"destructive",children:(0,l.jsx)(h.TN,{children:k})}),N&&(0,l.jsx)(x.default,{className:"h-[320px]",size:64}),!N&&!k&&0===v.length&&(0,l.jsx)(h.Fc,{children:(0,l.jsx)(h.TN,{children:"å°ç¡è¦ä¿äººçºæ¬äººçä¿å®ï¼æç¡å¯é ä¼°ä¿è²»çä¿å®ã"})}),P&&(0,l.jsx)(h.Fc,{children:(0,l.jsx)(h.TN,{children:"ç®åç¡å¯é ä¼°çæªä¾ä¿è²»ï¼è«ç¢ºèªä¿å®å·²é£çµååä¸ååæè²»ç表ï¼ã"})}),A&&!P&&(0,l.jsx)(h.Fc,{children:(0,l.jsx)(h.TN,{children:"æ¤åéå
§ç¡ä¿è²»è³æã"})}),F&&!N&&!k&&(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(a.A,{highcharts:n.A,options:F,containerProps:{style:{width:"100%",height:"400px"}}})})]})]})}}}]);
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.