1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="f1894510-5c93-a362-fd0a-841ad44a8914")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,44552,(t,e,i)=>{let s="/app/statistics";(window.__NEXT_P=window.__NEXT_P||[]).push([s,()=>t.r(92890)]),e.hot&&e.hot.dispose(function(){window.__NEXT_P.push([s])})},79828,t=>{t.v({categoryCol:"_6ifL2G_categoryCol",categoryColWide:"_6ifL2G_categoryColWide",headerText:"_6ifL2G_headerText",mainRow:"_6ifL2G_mainRow",mobileTable:"_6ifL2G_mobileTable",mobileWrapper:"_6ifL2G_mobileWrapper",scrollContainer:"_6ifL2G_scrollContainer",subcategoryRow:"_6ifL2G_subcategoryRow",valueCell:"_6ifL2G_valueCell",valueCol:"_6ifL2G_valueCol",valuePrimary:"_6ifL2G_valuePrimary",valueSecondary:"_6ifL2G_valueSecondary",valueStack:"_6ifL2G_valueStack"})},73504,t=>{t.v({categoryText:"iCAZCG_categoryText",expandCol:"iCAZCG_expandCol",granularityControl:"iCAZCG_granularityControl",headerText:"iCAZCG_headerText",mobileTable:"iCAZCG_mobileTable",mobileWrapper:"iCAZCG_mobileWrapper",nestedTable:"iCAZCG_nestedTable",periodCol:"iCAZCG_periodCol",periodColWide:"iCAZCG_periodColWide",periodText:"iCAZCG_periodText",scopeLabel:"iCAZCG_scopeLabel",scrollContainer:"iCAZCG_scrollContainer",valueCell:"iCAZCG_valueCell",valueCol:"iCAZCG_valueCol"})},69949,t=>{t.v({controls:"izURRq_controls",periodBlock:"izURRq_periodBlock",periodLabel:"izURRq_periodLabel",periodSelect:"izURRq_periodSelect",periodSelectInput:"izURRq_periodSelectInput",periodSelectOption:"izURRq_periodSelectOption",periodSelectRoot:"izURRq_periodSelectRoot",periodSelectWrapper:"izURRq_periodSelectWrapper",pickerRow:"izURRq_pickerRow",toolbar:"izURRq_toolbar"})},27277,t=>{t.v({scopeButton:"MQZUuW_scopeButton",scopeButtonFull:"MQZUuW_scopeButtonFull",scopeButtonLabel:"MQZUuW_scopeButtonLabel",scopeButtonShort:"MQZUuW_scopeButtonShort"})},30440,t=>{t.v({chartShell:"d345Ia_chartShell",headerPad:"d345Ia_headerPad",scopeLabel:"d345Ia_scopeLabel"})},63456,t=>{t.v({excludedTable:"MkiVtG_excludedTable",labelCol:"MkiVtG_labelCol"})},92890,t=>{"use strict";let e,i;var s=t.i(91398);t.i(20743);var a=t.i(38385),r=t.i(58160),n=t.i(74310),o=t.i(29740),l=t.i(91788),h=t.i(66661),d=t.i(38248),c=t.
2i(51351),u=t.i(88399),f=t.i(78593),g=t.i(57312),p=t.i(78992),m=t.i(65221),x=t.i(107),b=t.i(79828);let _={titleIndicator:{marginRight:"var(--mantine-spacing-xs)",width:(0,f.t)(18),height:(0,f.t)(18),flexShrink:0},categoryGroup:{display:"flex",alignItems:"center",width:"100%"},categoryText:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",fontWeight:600},subcategoryText:{paddingLeft:(0,f.t)(30),overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}};function y({primary:t,secondary:e,size:i,color:a}){return(0,s.jsxs)("div",{className:b.default.valueStack,children:[(0,s.jsx)(d.f,{size:i,className:b.default.valuePrimary,c:a,children:t}),e?(0,s.jsxs)(d.f,{size:i,className:b.default.valueSecondary,children:[e,"%"]}):null]})}let v=t=>0===t?"â":`${t>0?"+":"â"}${(0,m.w)(Math.abs(t))}`,w=({data:t,hideTargetColumn:e=!1,hideCategoryTargetColumns:i=!1,asOfMode:a="today"})=>{let r=(0,p.f)("Statistics"),n=r("endOfPeriod"===a?"targetTotalEndOfPeriod":"targetTotal"),o=(0,u.f)(),f=(0,x.a)(),w=f?e?b.default.categoryColWide:b.default.categoryCol:void 0,k=f?b.default.valueCol:void 0,M=e?"calc(100% - 125px)":"calc(100% - 375px)",T="125px",C=e||i,j=f?"xs":"sm",S={className:w,style:f?void 0:{width:M}},D={className:[b.default.valueCell,k].filter(Boolean).join(" "),style:f?void 0:{width:T}},P=(0,s.jsxs)(h.f,{withTableBorder:!0,withColumnBorders:!0,striped:!0,highlightOnHover:!0,className:f?b.default.mobileTable:void 0,layout:f?"fixed":void 0,children:[(0,s.jsx)(h.f.Thead,{children:(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Th,{className:w,style:f?void 0:{width:M},children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:b.default.headerText,children:r("category")})}),(0,s.jsx)(h.f.Th,{className:k,style:f?void 0:{width:T},children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:b.default.headerText,children:r("effectiveTotal")})}),!e&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Th,{className:k,style:f?void 0:{width:T},children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:b.default.headerText,children:n})}),(0,s.jsx)(h.f.Th,{className:k,style:f?void 0:{width:T},children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:b.default.headerText,children:r("delta")})})]})]})}),(0,s.jsxs)(h.f.Tbody,{children:[(t.rows||[]).map(t=>{let e=t.effectiveDuration-t.targetDuration;return(0,s.jsxs)(l.default.Fragment,{children:[(0,s.jsxs)(h.f.Tr,{className:b.default.mainRow,children:[(0,s.jsx)(h.f.Td,{...S,children:(0,s.jsxs)(c.f,{wrap:"nowrap",style:_.categoryGroup,children:[(0,s.jsx)(g.f,{style:{..._.titleIndicator,color:((t,e)=>{if(!t||"string"!=typeof t||!/^rgb\(\d+,\s*\d+,\s*\d+\)$/i.test(t))return;let i=t.match(/\d+/g)?.map(Number);if(!i||3!==i.length)return;let s="dark"===e?10:-50,a=i.map(t=>Math.min(255,Math.max(0,t+s)));return`rgb(${a.join(", ")})`})(t.color,o)}}),(0,s.jsx)(d.f,{style:_.categoryText,size:j,children:t.title})]})}),(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:(0,m.w)(t.effectiveDuration),secondary:"effectiveWorkload"in t&&!i?t.effectiveWorkload:void 0,size:j})}),!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:(0,m.w)(t.targetDuration),secondary:"targetWorkload"in t&&""!==t.targetWorkload?t.targetWorkload:void 0,size:j})}),(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:v(e),size:j,color:e>0?"teal":e<0?"orange":void 0})})]})]}),"subcategories"in t&&(t.subcategories||[])?.map(t=>(0,s.jsxs)(h.f.Tr,{className:b.default.subcategoryRow,children:[(0,s.jsx)(h.f.Td,{...S,children:(0,s.jsx)(d.f,{style:_.subcategoryText,size:j,children:t.title})}),(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:(0,m.w)(t.duration),size:j})}),!C&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Td,{...D}),(0,s.jsx)(h.f.Td,{...D})]})]},t.title))]},t.title)}),"totalEffectiveDuration"in t&&(0,s.jsxs)(h.f.Tr,{fw:600,className:b.default.mainRow,children:[(0,s.jsx)(h.f.Td,{...S,children:(0,s.jsx)(d.f,{size:j,children:r("total")})}),(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:(0,m.w)(t.totalEffectiveDuration),size:j})}),!e&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:(0,m.w)(t.totalTargetDuration),size:j})}),(0,s.jsx)(h.f.Td,{...D,children:(0,s.jsx)(y,{primary:v(t.totalEffectiveDuration-t.totalTargetDuration),size:j,color:t.totalEffectiveDuration-t.totalTargetDuration>0?"teal":t.totalEffectiveDuration-t.totalTargetDuration<0?"orange":void 0})})]})]})]})]});return f?(0,s.jsx)("div",{className:b.default.mobileWrapper,children:P}
2):(0,s.jsx)(h.f.ScrollContainer,{minWidth:600,style:{margin:0},className:b.default.scrollContainer,children:P})};var k=t.i(43331),M=t.i(86343),T=t.i(34249),C=t.i(68003),j=t.i(81654),S=t.i(69311),D=t.i(51458),P=t.i(62232),O=t.i(67324),L=t.i(51068),A=t.i(71835),z=t.i(29063),E=t.i(25415),R=t.i(8383),I=t.i(59729),F=t.i(35399),B=t.i(32833),W=t.i(42700),H=t.i(61807),V=t.i(6367);t.i(50316);var $=t.i(57330),N=t.i(46845),U=t.i(36359);t.i(74903);var Y=t.i(39200),G=t.i(17587),q=t.i(1859),X=t.i(76830),Z=t.i(58003),K=t.i(12457),Q=t.i(21809);let J=U.f,tt=t=>0===t?"â":`${t>0?"+":"-"}${(0,m.w)(Math.abs(t))}`;function te({entries:t,title:e}){return(0,s.jsxs)($.View,{style:{marginTop:8,marginBottom:18,paddingTop:10,borderTopWidth:1,borderTopColor:J.border},id:"section-toc",children:[(0,s.jsx)($.Text,{style:{fontSize:14,fontWeight:700,marginBottom:8},children:e}),t.map((t,e)=>(0,s.jsx)($.Link,{src:`#${t.id}`,children:(0,s.jsxs)($.Text,{style:[Q.s.linkText,{marginBottom:3}],children:[e+1,". ",t.title]})},t.id))]})}function ti({effectiveMinutes:t,targetMinutes:e,deltaMinutes:i,labels:a,hideTarget:r}){let n=r?[{label:a.effective,value:(0,m.w)(t),color:J.primary}]:[{label:a.effective,value:(0,m.w)(t),color:J.primary},{label:a.target,value:(0,m.w)(e),color:J.text},{label:a.delta,value:tt(i),color:i>0?J.successText:i<0?J.dangerText:J.text}];return(0,s.jsx)($.View,{style:{flexDirection:"row",gap:10,marginBottom:20},children:n.map(t=>(0,s.jsxs)($.View,{style:{flex:1,borderWidth:1,borderColor:J.border,borderTopWidth:3,borderTopColor:t.color===J.text?J.border:t.color,borderRadius:8,paddingVertical:12,paddingHorizontal:14,backgroundColor:J.surfaceMuted},children:[(0,s.jsx)($.Text,{style:Q.s.metaLabel,children:t.label}),(0,s.jsx)($.Text,{style:{fontSize:18,fontWeight:700,color:t.color,marginTop:2},children:t.value})]},t.label))})}function ts({items:t}){let e=Math.ceil(t.length/2),i=[t.slice(0,e),t.slice(e)];return(0,s.jsx)($.View,{style:{flexDirection:"row",gap:24},children:i.map((t,e)=>(0,s.jsx)($.View,{style:{flex:1},children:t.map((t,e)=>(0,s.jsxs)($.View,{style:{marginBottom:8},children:[(0,s.jsx)($.Text,{style:Q.s.metaLabel,children:t.label}),(0,s.jsx)($.Text,{style:Q.s.metaValue,children:t.value})]},e))},e))})}function ta({title:t,items:e}){return 0===e.length?null:(0,s.jsxs)($.View,{style:{borderWidth:1,borderColor:J.border,borderLeftWidth:3,borderLeftColor:J.primary,borderRadius:8,backgroundColor:J.surfaceMuted,paddingVertical:12,paddingHorizontal:14,marginTop:16},children:[(0,s.jsx)($.Text,{style:[Q.s.sectionLabel,{color:J.primaryDark,marginBottom:8}],children:t}),(0,s.jsx)(ts,{items:e})]})}function tr({headers:t,hideTargetColumn:e}){let i=e?[t.period,t.effective]:[t.period,t.effective,t.target,t.delta];return(0,s.jsx)(K.T,{children:i.map((t,e)=>(0,s.jsx)(K.m,{flex:0===e?2:1,align:0===e?"left":"right",children:t},t))})}function tn({headers:t,hideTargetColumn:e}){let i=e?[t.category,t.effective]:[t.category,t.effective,t.target];return(0,s.jsx)(K.T,{children:i.map((t,e)=>(0,s.jsx)(K.m,{flex:0===e?2:1,align:0===e?"left":"right",children:t},t))})}let to={headerRow:{flexDirection:"row",backgroundColor:J.primary,paddingVertical:5,paddingHorizontal:8},headerCell:{fontSize:8,fontWeight:700,color:J.white,letterSpacing:.3},row:{flexDirection:"row",paddingVertical:3,paddingHorizontal:8,borderBottomWidth:.5,borderBottomColor:J.border,alignItems:"flex-start"},cell:{fontSize:8,color:J.text,lineHeight:1.3},totalRow:{flexDirection:"row",paddingVertical:5,paddingHorizontal:8,backgroundColor:J.primaryLight,borderTopWidth:1.5,borderTopColor:J.primary},totalCell:{fontSize:8,fontWeight:700,color:J.text}};function tl({records:t,categories:e,reportTranslations:i,t_cat:a,dateLocale:r}){let n=i.tableHeaders,o=t.reduce((t,e)=>t+(e.duration??0),0);return(0,s.jsxs)(X.f,{title:i.individualEntriesTitle,id:"section-records",caption:i.asOfPeriodCaption,children:[(0,s.jsx)($.Text,{style:[Q.s.mutedText,{marginBottom:8}],children:i.entriesCountLabel}),(0,s.jsxs)($.View,{style:Q.s.tableWrapper,children:[(0,s.jsxs)($.View,{style:to.headerRow,fixed:!0,minPresenceAhead:60,children:[(0,s.jsx)($.Text,{style:[to.headerCell,{flex:.9}],children:n.date}),(0,s.jsx)($.Text,{style:[to.headerCell,{flex:1.3}],children:n.category}),(0,s.jsx)($.Text,{style:[to.headerCell,{flex:2.8}],children:n.description}),(0,s.jsx)($.Text,{style:[to.headerCell,{flex:.6,textAlign:"right"}],children:n.duration})]}),t.map((t,n)=>(0,s.jsxs)($.View,{style:[to.row,n%2==1?{backgroundColor:J.tableZebra}:{}],wrap:!1,children:[(0,s.jsx)($.Text,{style:[to.cell,{flex:.9}],children:(0,R.C)(t.date).toLocaleDateString(r)}),(0,s.jsx)($.Text,{style:[to.cell,{flex:1.3}],children:(0,N.X)(t,e,a,{noCategory:i.tableHeaders.noCategory,otherCanton:i.tableHeaders.otherCanton})}),(0,s.jsx)($.Text,{style:[to.cell,{flex:2.8}],children:t.description??""}),(0,s.jsx)($.Text,{style:[to.cell,{flex:.6,textAlign:"right"}],children:(0,m.w)(t.duration??0)})]},t.id??n)),(0,s.jsxs)($.View,{style:to.totalRow,wrap:!1,children:[(0,s.jsx)($.Text,{style:[to.totalCell,{flex:5}],children:n.total}),(0,s.jsx)($.Text,{style:[to.totalCell,{flex:.6,textAlign:"right"}],children:(0,m.w)(o)})]})]})]})}function th(t){let e,{records:i,categories:a,categoryStatistics:r,semester1Series:n,semester2Series:o,monthSeries:h,reportTranslations:d,t_cat:c,hideTargetColumn:u=!1,hideCategoryTargetColumns:f=!1,userData:g,locale:p="de-CH",personItems:x,employmentItems:b,includeRecords:_=!0}=t,y="fr"===p?"fr-CH":"en"===p?"en-CH":"de-CH",v=u||f,w=new Date,k=(e=[{id:"section-semester",title:d.semesterOverviewTitle},{id:"section-month",title:d.monthOverviewTitle},{id:"section-main",title:d.mainEmploymentTitle}],_&&e.push({id:"section-records",title:d.individualEntriesTitle}
2),e),M=[g.first_name,g.last_name].filter(Boolean).join(" ")||"EduTime",T=r.totalEffectiveDuration,C=r.totalTargetDuration,j=w.toLocaleDateString(y,{day:"numeric",month:"short",year:"numeric"});return(0,s.jsxs)(G.f,{title:d.reportTitle,author:M,subject:d.reportSubtitle,keywords:"Arbeitszeit, Bericht",creationDate:w,language:y,children:[(0,s.jsxs)(q.f,{variant:"cover",footerGeneratedAt:j,showFooter:!1,children:[(0,s.jsxs)($.View,{style:{paddingTop:48,minHeight:520},children:[(0,s.jsx)(Y.f,{large:!0}),(0,s.jsxs)($.View,{style:Q.s.violetRule,children:[(0,s.jsx)($.Text,{style:Q.s.docTitleCover,children:d.reportTitle}),(0,s.jsx)($.Text,{style:[Q.s.sectionLabel,{color:J.primary,marginBottom:6,marginTop:0}],children:d.reportScope}),(0,s.jsx)($.Text,{style:{fontSize:14,fontWeight:700,color:J.text,marginBottom:8},children:d.reportSubtitle}),d.standTodayBadge?(0,s.jsx)($.View,{style:{alignSelf:"flex-start",marginBottom:8},children:(0,s.jsx)(Z.f,{label:d.standTodayBadge,variant:"info"})}):null,(0,s.jsxs)($.Text,{style:Q.s.mutedText,children:[d.schoolYearHeader," · ",d.standDate]})]}),(0,s.jsx)(ti,{effectiveMinutes:T,targetMinutes:C,deltaMinutes:T-C,labels:{effective:d.combinedEffective,target:d.combinedTarget,delta:d.combinedDelta},hideTarget:u}),x.length>0&&(0,s.jsx)(ts,{items:x}),(0,s.jsx)(ta,{title:d.employmentDetailsTitle,items:b}),(0,s.jsx)($.Text,{style:[Q.s.mutedText,{marginTop:24}],children:d.footerText})]}),(0,s.jsx)(td,{generatedAt:j})]}),(0,s.jsxs)(q.f,{footerGeneratedAt:j,showImprint:!1,children:[(0,s.jsx)(Y.f,{}),(0,s.jsx)(te,{entries:k,title:d.tableOfContentsTitle}),(0,s.jsx)(X.f,{title:d.semesterOverviewTitle,id:"section-semester",caption:d.asOfPeriodCaption,children:(0,s.jsxs)(K.Y,{children:[(0,s.jsx)(tr,{headers:d.tableHeaders,hideTargetColumn:u}),[n,o].map((t,e)=>(0,s.jsxs)(K.p,{alt:e%2==1,children:[(0,s.jsx)(K.c,{flex:2,children:0===e?d.semester1Label:d.semester2Label}),(0,s.jsx)(K.c,{align:"right",children:(0,m.w)(t.totals.istMinutes)}),!u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(K.c,{align:"right",children:(0,m.w)(t.totals.sollMinutes)}),(0,s.jsx)(K.c,{align:"right",children:tt(t.totals.deltaMinutes)})]})]},e))]})}),(0,s.jsx)(X.f,{title:d.monthOverviewTitle,id:"section-month",caption:d.asOfPeriodCaption,children:(0,s.jsxs)(K.Y,{children:[(0,s.jsx)(tr,{headers:d.tableHeaders,hideTargetColumn:u}),h.buckets.map((t,e)=>(0,s.jsxs)(K.p,{alt:e%2==1,children:[(0,s.jsx)(K.c,{flex:2,children:t.start.toLocaleDateString(y,{month:"long",year:"numeric"})}),(0,s.jsx)(K.c,{align:"right",children:(0,m.w)(t.istMinutes)}),!u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(K.c,{align:"right",children:(0,m.w)(t.sollMinutes)}),(0,s.jsx)(K.c,{align:"right",children:tt(t.deltaMinutes)})]})]},t.key))]})}),(0,s.jsx)(X.f,{title:d.mainEmploymentTitle,id:"section-main",caption:d.asOfPeriodCaption,children:(0,s.jsxs)(K.Y,{children:[(0,s.jsx)(tn,{headers:d.tableHeaders,hideTargetColumn:u}),r.rows.map((t,e)=>(0,s.jsxs)(l.default.Fragment,{children:[(0,s.jsxs)(K.p,{alt:e%2==1,children:[(0,s.jsx)(K.c,{flex:2,children:t.title}),(0,s.jsxs)(K.c,{align:"right",children:[(0,m.w)(t.effectiveDuration),!f&&` (${t.effectiveWorkload}%)`]}),!v&&(0,s.jsxs)(K.c,{align:"right",children:[(0,m.w)(t.targetDuration),""!==t.targetWorkload?` (${t.targetWorkload}%)`:""]})]}),t.subcategories?.map((t,i)=>(0,s.jsxs)(K.p,{alt:i%2==1,children:[(0,s.jsxs)(K.c,{flex:2,children:["  â¢Â ",t.title]}),(0,s.jsx)(K.c,{align:"right",children:(0,m.w)(t.duration)}),!v&&(0,s.jsx)(K.c,{children:""})]},`${e}-${i}`))]},e)),(0,s.jsxs)($.View,{style:Q.s.totalRow,wrap:!1,children:[(0,s.jsx)($.Text,{style:[Q.s.totalLabel,{flex:2}],children:d.tableHeaders.total}),(0,s.jsx)($.Text,{style:[Q.s.totalLabel,{flex:1,textAlign:"right"}],children:(0,m.w)(r.totalEffectiveDuration)}),!u&&(0,s.jsx)($.Text,{style:[Q.s.totalLabel,{flex:1,textAlign:"right"}],children:(0,m.w)(r.totalTargetDuration)})]})]})})]}),_&&(0,s.jsxs)(q.f,{footerGeneratedAt:j,showImprint:!1,children:[(0,s.jsx)(Y.f,{}),(0,s.jsx)(tl,{records:i,categories:a,reportTranslations:d,t_cat:c,dateLocale:y})]})]})}function td({generatedAt:t}){return(0,s.jsx)($.Text,{style:{position:"absolute",bottom:24,left:36,right:36,fontSize:8,color:Q.s.mutedText.color,textAlign:"center"},children:t})}var tc=t.i(78610);let tu=({startDate:t,endDate:e,schoolYearStart:i,schoolYearEnd:h,userData:u,categoryStatistics:f,categories:g,hideTargetColumn:x=!1,hideCategoryTargetColumns:b=!1,cantonData:_,configMode:y,configProfile:v,profileCategories:w,selectedPeriod:k=null})=>{let M=(0,p.f)("Report"),T=(0,p.f)("Categories"),j=(0,p.f)("Statistics"),$=(0,p.f)("Index"),N=(0,E.X)(),[U,Y]=(0,l.useState)([]),[G,q]=(0,l.useState)(!1),[X,Z]=(0,l.useState)(!0),K="fr"===N?"fr-CH":"en"===N?"en-CH":"de-CH",Q=(0,R.v)((0,R.Y)(new Date,t,e)),J=Q.getTime()===(0,R.v)(new Date).getTime(),tt=t=>t.toLocaleDateString(K,{day:"numeric",month:"long",year:"numeric"});(0,l.useEffect)(()=>{let i=!1;return(async()=>{let s=await (0,A.w)(t,e,u.user_id);i||Y(s)})(),()=>{i=!0}},[t,e,u.user_id]);
2let te=new Date,ti=(0,m.F)(te),ts=te.toTimeString().split(" ")[0].replace(/:/g,"-"),ta=t.toLocaleDateString(),tr=e.toLocaleDateString(),tn=(0,r.U)((0,r.f)(i)),to={userData:u,categories:g,cantonData:_??null,configMode:y,configProfile:v,profileCategories:w,hideTarget:x,translateCategory:T},tl=t=>new Date(`${t}T00:00:00`).toLocaleDateString(K),td=async()=>{q(!0);try{let n,l,d,c={start:i,end:h},p=(0,m.F)(Q),S=tt(t),D=tt(e),P=tt(Q),[O,L,A,z]=await Promise.all([(0,F.b)({...to,startDate:(0,r.V)(c,"semester1").start,endDate:(0,r.V)(c,"semester1").end,granularity:"month",asOfDate:Q}),(0,F.b)({...to,startDate:(0,r.V)(c,"semester2").start,endDate:(0,r.V)(c,"semester2").end,granularity:"month",asOfDate:Q}),(0,F.b)({...to,startDate:t,endDate:e,granularity:"month",asOfDate:Q}),"custom"===y&&v&&w.length>0?(0,o.d)(t,e,u.user_id,w,v,u,T,Q):_?(0,o.y)(t,e,u.user_id,g,_,u,T,Q):Promise.resolve(f)]);if(!O||!L||!A)throw Error("Failed to load report data");let E=(0,I.J)(O,["professionalMission"]),R=(0,I.J)(L,["professionalMission"]),W=(0,I.J)(A,["professionalMission"]),H=U.filter(t=>t.date.slice(0,10)<=p&&function(t,e){if(t.is_user_category)return!1;if(t.profile_category_id)return!0;if(!t.category_id)return!1;let i=e.find(e=>e.id===t.category_id);return!!i&&"furtherEmployment"!==i.category_set_title}(t,g));try{let i=await (0,C.Q)(),s=(await (0,B.T)(i,_??null,u)).filter(i=>(0,a.G)(i,{start:t,end:e})),r=(0,a.O)(s);r.length>1?n=r.map(t=>`${t}%`).join(" / "):1===r.length&&(n=`${r[0]}%`)}catch(t){console.error("Failed to resolve employment workloads for PDF:",t)}let V={reportTitle:M("workTimeReport"),reportSubtitle:M("reportPeriodRange",{startDate:S,asOfDate:P}),reportScope:M("reportScope"),standTodayBadge:J?M("standTodayBadge"):"",asOfPeriodCaption:M("asOfPeriodCaption",{startDate:S,asOfDate:P}
2),fullPeriodCaption:M("fullPeriodCaption",{startDate:S,endDate:D}),schoolYearHeader:M("schoolYearHeader",{year:tn}),standDate:M("standDate",{date:P}),footerText:M("reportFooter"),mainEmploymentTitle:M("mainEmployment"),individualEntriesTitle:M("appendixEntriesTitle"),semesterOverviewTitle:M("semesterOverviewTitle"),monthOverviewTitle:M("monthOverviewTitle"),employmentDetailsTitle:M("employmentDetails"),entriesCountLabel:M("entriesCount",{count:H.length}),tableHeaders:{category:M("category"),effective:M("effective"),target:M("target"),date:M("date"),description:M("description"),duration:M("duration"),total:M("total"),noCategory:M("noCategory"),otherCanton:M("otherCanton"),period:j("period"),delta:j("delta")},combinedWorkloadTitle:M("combinedWorkloadTitle"),combinedEffective:M("combinedEffective"),combinedTarget:M("combinedTarget"),combinedDelta:M("combinedDelta"),semester1Label:j("viewSemester1"),semester2Label:j("viewSemester2"),tableOfContentsTitle:M("tableOfContentsTitle")},Y=await (0,tc.z)((0,s.jsx)(th,{records:H,categories:g,categoryStatistics:z,semester1Series:E,semester2Series:R,monthSeries:W,reportTranslations:V,t_cat:T,hideTargetColumn:x,hideCategoryTargetColumns:b,userData:u,locale:N,personItems:(l=[],(d=[u.first_name,u.last_name].filter(Boolean).join(" "))&&l.push({label:M("userInfo.name"),value:d}),u.email&&l.push({label:M("userInfo.email"),value:u.email}),l),employmentItems:(t=>{let e=[];
2if(k){let t=tl(k.valid_from),i=k.valid_to?`${t} â ${tl(k.valid_to)}`:M("userInfo.sinceDate",{date:t});e.push({label:M("userInfo.employmentPeriod"),value:i})}"custom"===y?v?.title&&e.push({label:M("userInfo.profile"),value:v.title}):_?.title&&e.push({label:M("userInfo.canton"),value:_.title});let i=t??`${(k?k.workload:u.workload)??100}%`;if(e.push({label:M("userInfo.workload"),value:i}),"custom"===y)v?.annual_work_hours&&e.push({label:M("userInfo.annualWorkHours"),value:`${v.annual_work_hours} ${M("userInfo.hours")}`});else if(_&&!_.is_working_hours_disabled){!_.use_custom_work_hours&&_.annual_work_hours>0&&e.push({label:M("userInfo.annualWorkHours"),value:`${_.annual_work_hours} ${M("userInfo.hours")}`});let t=k?k.custom_work_hours:u.custom_work_hours;_.use_custom_work_hours&&t&&e.push({label:M("userInfo.customWorkHours"),value:`${t} ${M("userInfo.hours")}`})}let s=k?k.canton_code:u.canton_code;if("custom"!==y&&"TG_S"===s){let t=k?k.class_size:u.class_size;t&&e.push({label:M("userInfo.classSize"),value:`${t}`});let i=k?k.education_level:u.education_level;i&&e.push({label:M("userInfo.educationLevel"),value:$(i)})}let a=k?k.teacher_relief:u.teacher_relief;if(a&&e.push({label:M("userInfo.teacherRelief"),value:`${a}%`}),"custom"!==y&&_?.is_configurable&&_.category_sets)for(let t of _.category_sets){let i=t.user_percentage??t.percentage??0;i>0&&e.push({label:T(t.title),value:`${i}%`})}return e})(n),includeRecords:X})),G=ti.replace(/-/g,"")+"_"+ts.replace(/-/g,""),q=`Arbeitszeitbericht_${G}.pdf`;(0,tc.k)(Y,q)}catch(t){console.error("PDF export failed:",t)}finally{q(!1)}};return(0,s.jsx)(W.C,{title:j("sectionExport"),helpArticleId:"statistics-export",helpStepId:"export",testId:n.f.statisticsExportSection,children:(0,s.jsxs)(L.f,{cols:{base:1,sm:2},spacing:"md",children:[(0,s.jsx)(S.f,{className:H.default.card,padding:"md",withBorder:!0,children:(0,s.jsxs)(P.f,{gap:"sm",h:"100%",justify:"space-between",children:[(0,s.jsxs)(P.f,{gap:"xs",children:[(0,s.jsxs)(c.f,{gap:"xs",children:[(0,s.jsx)("span",{className:H.default.icon,children:(0,s.jsx)(z.f,{size:20,stroke:1.5})}),(0,s.jsx)(d.f,{fw:600,children:M("pdfReportTitle")})]}),(0,s.jsx)(d.f,{size:"sm",c:"dimmed",children:M("reportDescription")}),(0,s.jsx)(D.f,{size:"sm",checked:X,onChange:t=>Z(t.currentTarget.checked),label:M("includeEntriesAppendix"),"data-testid":"statistics-export-pdf-include-entries"})]}),(0,s.jsx)(O.f,{variant:"filled",fullWidth:!0,leftSection:(0,s.jsx)(z.f,{size:16}),loading:G,onClick:td,mt:"xs","data-testid":"statistics-export-pdf",children:G?M("generating"):M("downloadPdf")})]})}),(0,s.jsx)(V.f,{userData:u,categories:g,fromDate:t,toDate:e,variant:"section",excelTitle:M("workTimeReport"),excelSubtitle:M("reportSubtitle",{startDate:ta,endDate:tr}),csvTestId:"statistics-export-csv",excelTestId:"statistics-export-excel"})]})})};var tf=t.i(8725),tg=t.i(69156),tp=t.i(1281),tm=t.i(63456);let tx=({segmentedTotals:t,asOfMode:e="today"})=>{let i=(0,p.f)("Statistics"),{professionalMission:a,furtherEmploymentTasks:r,noCategory:o,otherCanton:c}=t,u="endOfPeriod"===e?i("targetTotalEndOfPeriod"):i("targetTotal"),f=(0,l.useMemo)(()=>{let t=[];for(let e of r)t.push({key:e.key,title:e.title,kind:"full",totals:e});return o&&t.push({key:"noCategory",title:i("no_category"),kind:"istOnly",istMinutes:o.istMinutes}),c&&t.push({key:"otherCanton",title:i("other_canton"),kind:"istOnly",istMinutes:c.istMinutes}),t},[r,o,c,i]),g=f.some(t=>"full"===t.kind&&!t.totals.hideTarget);return(0,s.jsxs)(P.f,{gap:"md","data-testid":n.f.statisticsWorkloadHero,children:[(0,s.jsx)(ty,{title:i("workloadOverview"),helpArticleId:"statistics-workload-status",helpStepId:"workload-status",totals:a,targetLabel:u}),f.length>0?(0,s.jsx)(W.C,{title:i("excludedFromWorkloadOverview"),headingLevel:"subsection",padding:"md",children:(0,s.jsxs)(h.f,{className:tm.default.excludedTable,verticalSpacing:"xs",horizontalSpacing:"sm",children:[(0,s.jsx)(h.f.Thead,{children:(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Th,{className:tm.default.labelCol,children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,children:i("excludedScopeColumn")})}),(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,children:i("effectiveTotal")})}),g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,children:u})}),(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,children:i("delta")})})]}):null]})}),(0,s.jsx)(h.f.Tbody,{children:f.map(t=>"full"===t.kind?(0,s.jsx)(tb,{title:t.title,totals:t.totals,showTargetColumns:g},t.key):(0,s.jsx)(t_,{title:t.title,istMinutes:t.istMinutes,showTargetColumns:g},t.key))})]})}):null]})};function tb({title:t,totals:e,showTargetColumns:i}){let{deltaValue:a,deltaColor:r}=tv(e,(0,p.f)("Statistics"));return(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Td,{className:tm.default.labelCol,children:(0,s.jsx)(d.f,{size:"sm",fw:500,children:t})}),(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(d.f,{size:"sm",fw:600,children:(0,m.w)(e.istMinutes)})}),i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(d.f,{size:"sm",fw:600,children:e.hideTarget?"â":(0,m.w)(e.sollMinutes)})}),(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(d.f,{size:"sm",fw:600,c:e.hideTarget?void 0:r,children:e.hideTarget?"â":a})})]}):null]})}function t_({title:t,istMinutes:e,showTargetColumns:i}){return(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Td,{className:tm.default.labelCol,children:(0,s.jsx)(d.f,{size:"sm",fw:500,children:t})}),(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(d.f,{size:"sm",fw:600,children:(0,m.w)(e)})}),i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(d.f,{size:"sm",c:"dimmed",children:"â"})}),(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(d.f,{size:"sm",c:"dimmed",children:"â"})})]}):null]})}function ty({title:t,totals:e,targetLabel:i,helpArticleId:a,helpStepId:r}){let o=(0,p.f)("Statistics"),{deltaLabel:l,deltaValue:h,deltaColor:d}=tv(e,o);return(0,s.jsx)(W.C,{title:t,padding:"lg",helpArticleId:a,helpStepId:r,testId:n.f.statisticsWorkloadOverview,children:(0,s.jsxs)(L.f,{cols:{base:1,sm:e.hideTarget?1:3},spacing:"md",children:[(0,s.jsx)(tw,{label:o("effectiveTotal"),value:(0,m.w)(e.istMinutes)}),e.hideTarget?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tw,{label:i,value:(0,m.w)(e.sollMinutes)}),(0,s.jsx)(tw,{label:l,value:h,valueColor:d})]})]})})}function tv(t,e){let i=t.deltaMinutes>
20?`+${(0,m.w)(t.deltaMinutes)}`:t.deltaMinutes<0?`â${(0,m.w)(Math.abs(t.deltaMinutes))}`:(0,m.w)(0),s=t.deltaMinutes>0?"teal":t.deltaMinutes<0?"orange":void 0;return{deltaLabel:e(t.deltaMinutes>0?"overtimeLabel":t.deltaMinutes<0?"deficitLabel":"balancedLabel"),deltaValue:i,deltaColor:s}}function tw({label:t,value:e,valueColor:i}){return(0,s.jsx)(tp.f,{withBorder:!0,radius:"md",p:"md",children:(0,s.jsxs)(P.f,{gap:4,children:[(0,s.jsx)(d.f,{size:"sm",c:"dimmed",fw:500,children:t}),(0,s.jsx)(d.f,{size:"xl",fw:700,c:i,children:e})]})})}function tk(t){return t+.5|0}let tM=(t,e,i)=>Math.max(Math.min(t,i),e);function tT(t){return tM(tk(2.55*t),0,255)}function tC(t){return tM(tk(255*t),0,255)}function tj(t){return tM(tk(t/2.55)/100,0,1)}function tS(t){return tM(tk(100*t),0,100)}let tD={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},tP=[..."0123456789ABCDEF"],tO=t=>tP[15&t],tL=t=>tP[(240&t)>>4]+tP[15&t],tA=t=>(240&t)>>4==(15&t),tz=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function tE(t,e,i){let s=e*Math.min(i,1-i),a=(e,a=(e+t/30)%12)=>i-s*Math.max(Math.min(a-3,9-a,1),-1);return[a(0),a(8),a(4)]}function tR(t,e,i){let s=(s,a=(s+t/60)%6)=>i-i*e*Math.max(Math.min(a,4-a,1),0);return[s(5),s(3),s(1)]}function tI(t,e,i){let s,a=tE(t,1,.5);for(e+i>1&&(s=1/(e+i),e*=s,i*=s),s=0;s<3;s++)a[s]*=1-e-i,a[s]+=e;return a}function tF(t){let e,i,s,a=t.r/255,r=t.g/255,n=t.b/255,o=Math.max(a,r,n),l=Math.min(a,r,n),h=(o+l)/2;o!==l&&(s=o-l,i=h>.5?s/(2-o-l):s/(o+l),e=60*(e=a===o?(r-n)/s+6*(r<n):r===o?(n-a)/s+2:(a-r)/s+4)+.5);return[0|e,i||0,h]}function tB(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(tC)}function tW(t){return(t%360+360)%360}let tH={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},tV={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"},t$=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,tN=t=>
2t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,tU=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function tY(t,e,i){if(t){let s=tF(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),t.r=(s=tB(tE,s,void 0,void 0))[0],t.g=s[1],t.b=s[2]}}function tG(t,e){return t?Object.assign(e||{},t):t}function tq(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=tC(t[3]))):(e=tG(t,{r:0,g:0,b:0,a:1})).a=tC(e.a),e}class tX{constructor(t){let i;if(t instanceof tX)return t;let s=typeof t;if("object"===s)i=tq(t);else{var a,r;let n;"string"===s&&(r=t.length,"#"===t[0]&&(4===r||5===r?a={r:255&17*tD[t[1]],g:255&17*tD[t[2]],b:255&17*tD[t[3]],a:5===r?17*tD[t[4]]:255}:(7===r||9===r)&&(a={r:tD[t[1]]<<4|tD[t[2]],g:tD[t[3]]<<4|tD[t[4]],b:tD[t[5]]<<4|tD[t[6]],a:9===r?tD[t[7]]<<4|tD[t[8]]:255})),i=a||(e||((e=function(){let t,e,i,s,a,r={},n=Object.keys(tV),o=Object.keys(tH);for(t=0;t<n.length;t++){for(s=a=n[t],e=0;e<o.length;e++)i=o[e],a=a.replace(i,tH[i]);i=parseInt(tV[s],16),r[a]=[i>>16&255,i>>8&255,255&i]}return r}()).transparent=[0,0,0,0]),(n=e[t.toLowerCase()])&&{r:n[0],g:n[1],b:n[2],a:4===n.length?n[3]:255})||("r"===t.charAt(0)?function(t){let e,i,s,a=t$.exec(t),r=255;if(a){if(a[7]!==e){let t=+a[7];r=a[8]?tT(t):tM(255*t,0,255)}return e=+a[1],i=+a[3],s=+a[5],e=255&(a[2]?tT(e):tM(e,0,255)),{r:e,g:i=255&(a[4]?tT(i):tM(i,0,255)),b:s=255&(a[6]?tT(s):tM(s,0,255)),a:r}}}(t):function(t){let e,i=tz.exec(t),s=255;if(!i)return;i[5]!==e&&(s=i[6]?tT(+i[5]):tC(+i[5]));let a=tW(+i[2]),r=i[3]/100,n=i[4]/100;return{r:(e="hwb"===i[1]?tB(tI,a,r,n):"hsv"===i[1]?tB(tR,a,r,n):tB(tE,a,r,n))[0],g:e[1],b:e[2],a:s}}(t)))}this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=tG(this._rgb);return t&&(t.a=tj(t.a)),t}set rgb(t){this._rgb=tq(t)}rgbString(){var t;return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${tj(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0}hexString(){var t,e;let i,s;return this._valid?(e=tA((i=t=this._rgb).r)&&tA(i.g)&&tA(i.b)&&tA(i.a)?tO:tL,t?"#"+e(t.r)+e(t.g)+e(t.b)+(s=t.a,s<255?e(s):""):void 0):void 0}hslString(){return this._valid?function(t){if(!t)return;let e=tF(t),i=e[0],s=tS(e[1]),a=tS(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${a}%, ${tj(t.a)})`:`hsl(${i}, ${s}%, ${a}%)`}(this._rgb):void 0}mix(t,e){if(t){let i,s=this.rgb,a=t.rgb,r=e===i?.5:e,n=2*r-1,o=s.a-a.a,l=((n*o==-1?n:(n+o)/(1+n*o))+1)/2;i=1-l,s.r=255&l*s.r+i*a.r+.5,s.g=255&l*s.g+i*a.g+.5,s.b=255&l*s.b+i*a.b+.5,s.a=r*s.a+(1-r)*a.a,this.rgb=s}return this}interpolate(t,e){var i,s;let a,r,n;return t&&(this._rgb=(i=this._rgb,s=t._rgb,a=tU(tj(i.r)),r=tU(tj(i.g)),n=tU(tj(i.b)),{r:tC(tN(a+e*(tU(tj(s.r))-a))),g:tC(tN(r+e*(tU(tj(s.g))-r))),b:tC(tN(n+e*(tU(tj(s.b))-n))),a:i.a+e*(s.a-i.a)})),this}clone(){return new tX(this.rgb)}alpha(t){return this._rgb.a=tC(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=tk(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return tY(this._rgb,2,t),this}darken(t){return tY(this._rgb,2,-t),this}saturate(t){return tY(this._rgb,1,t),this}desaturate(t){return tY(this._rgb,1,-t),this}rotate(t){var e=this._rgb,i=tF(e);return i[0]=tW(i[0]+t),e.r=(i=tB(tE,i,void 0,void 0))[0],e.g=i[1],e.b=i[2],this}}function tZ(){}let tK=(i=0,()=>i++);function tQ(t){return null==t}function tJ(t){if(Array.isArray&&Array.isArray(t))return!0;let e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function t0(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function t1(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function t2(t,e){return t1(t)?t:e}function t5(t,e){return void 0===t?e:t}let t6=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function t3(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function t8(t,e,i,s){let a,r,n;if(tJ(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(t0(t))for(r=(n=Object.keys(t)).length,a=0;a<r;a++)e.call(i,t[n[a]],n[a])}function t4(t,e){let i,s,a,r;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(a=t[i],r=e[i],a.datasetIndex!==r.datasetIndex||a.index!==r.index)return!1;return!0}function t9(t){if(tJ(t))return t.map(t9);if(t0(t)){let e=Object.create(null),i=Object.keys(t),s=i.length,a=0;for(;a<s;++a)e[i[a]]=t9(t[i[a]]);return e}return t}function t7(t){return -1===["__proto__","prototype","constructor"].indexOf(t)}function et(t,e,i,s){if(!t7(t))return;let a=e[t],r=i[t];t0(a)&&t0(r)?ee(a,r,s):e[t]=t9(r)}function ee(t,e,i){let s,a=tJ(e)?e:[e],r=a.length;if(!t0(t))return t;let n=(i=i||{}).merger||et;for(let e=0;e<r;++e){if(!t0(s=a[e]))continue;let r=Object.keys(s);for(let e=0,a=r.length;e<a;++e)n(r[e],t,s,i)}return t}function ei(t,e){return ee(t,e,{merger:es})}function es(t,e,i){if(!t7(t))return;let s=e[t],a=i[t];t0(s)&&t0(a)?ei(s,a):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=t9(a))}let ea={"":t=>t,x:t=>t.x,y:t=>t.y};function er(t,e){let i;return(ea[e]||(ea[e]=(i=function(t){let e=t.split("."),i=[],s="";for(let t of e)(s+=t).endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}(e),t=>{for(let e of i){if(""===e)break;t=t&&t[e]}return t})))(t)}function en(t){return t.charAt(0).toUpperCase()+t.slice(1)}let eo=t=>void 0!==t,el=t=>"function"==typeof t,eh=(t,e)=>{if(t.size!==e.size)return!1;for(let i of t)if(!e.has(i))return!1;return!0},ed=Math.PI,ec=2*ed,eu=ec+ed,ef=ed/180,eg=ed/2,ep=ed/4,em=2*ed/3,ex=Math.log10,eb=Math.sign;function e_(t,e,i){return Math.abs(t-e)<i}function ey(t){let e=Math.round(t),i=Math.pow(10,Math.floor(ex(t=e_(t,e,t/1e3)?e:t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function ev(t){return"symbol"!=typeof t&&("object"!=typeof t||null===t||!!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t))&&!isNaN(parseFloat(t))&&isFinite(t)}
2function ew(t){return ed/180*t}function ek(t){if(!t1(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function eM(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function eT(t,e){return(t-e+eu)%ec-ed}function eC(t){return(t%ec+ec)%ec}function ej(t,e,i,s){let a=eC(t),r=eC(e),n=eC(i),o=eC(r-a),l=eC(n-a),h=eC(a-r),d=eC(a-n);return a===r||a===n||s&&r===n||o>l&&h<d}function eS(t,e,i){return Math.max(e,Math.min(i,t))}function eD(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function eP(t,e,i){let s;i=i||(i=>t[i]<e);let a=t.length-1,r=0;for(;a-r>1;)i(s=r+a>>1)?r=s:a=s;return{lo:r,hi:a}}let eO=(t,e,i,s)=>eP(t,i,s?s=>{let a=t[s][e];return a<i||a===i&&t[s+1][e]===i}:s=>t[s][e]<i),eL=(t,e,i)=>eP(t,i,s=>t[s][e]>=i),eA=["push","pop","shift","splice","unshift"];function ez(t,e){let i=t._chartjs;if(!i)return;let s=i.listeners,a=s.indexOf(e);-1!==a&&s.splice(a,1),s.length>0||(eA.forEach(e=>{delete t[e]}),delete t._chartjs)}function eE(t){let e=new Set(t);return e.size===t.length?t:Array.from(e)}let eR="u"<typeof window?function(t){return t()}:window.requestAnimationFrame;function eI(t,e){let i=[],s=!1;return function(...a){i=a,s||(s=!0,eR.call(window,()=>{s=!1,t.apply(e,i)}))}}let eF=t=>"start"===t?"left":"end"===t?"right":"center",eB=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,eW=t=>0===t||1===t,eH=(t,e,i)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*ec/i)),eV=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*ec/i)+1,e$={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*eg)+1,easeOutSine:t=>Math.sin(t*eg),easeInOutSine:t=>-.5*(Math.cos(ed*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>eW(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(-Math.pow(2,-10*(2*t-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>eW(t)?t:eH(t,.075,.3),easeOutElastic:t=>eW(t)?t:eV(t,.075,.3),easeInOutElastic:t=>eW(t)?t:t<.5?.5*eH(2*t,.1125,.45):.5+.5*eV(2*t-1,.1125,.45),easeInBack:t=>t*t*(2.70158*t-1.70158),easeOutBack:t=>(t-=1)*t*(2.70158*t+1.70158)+1,easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-e$.easeOutBounce(1-t),easeOutBounce:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,easeInOutBounce:t=>t<.5?.5*e$.easeInBounce(2*t):.5*e$.easeOutBounce(2*t-1)+.5};function eN(t){if(t&&"object"==typeof t){let e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function eU(t){return eN(t)?t:new tX(t)}function eY(t){return eN(t)?t:new tX(t).saturate(.5).darken(.1).hexString()}let eG=["x","y","borderWidth","radius","tension"],eq=["color","borderColor","backgroundColor"],eX=new Map;function eZ(t,e,i){var s;let a,r;return(a=e+JSON.stringify(s=(s=i)||{}),!(r=eX.get(a))&&(r=new Intl.NumberFormat(e,s),eX.set(a,r)),r).format(t)}let eK={values:t=>tJ(t)?t:""+t,numeric(t,e,i){let s;if(0===t)return"0";let a=this.chart.options.locale,r=t;if(i.length>1){var n,o;let e,a=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(a<1e-4||a>1e15)&&(s="scientific"),n=t,Math.abs(e=(o=i).length>3?o[2].value-o[1].value:o[1].value-o[0].value)>
2=1&&n!==Math.floor(n)&&(e=n-Math.floor(n)),r=e}let l=ex(Math.abs(r)),h=isNaN(l)?1:Math.max(Math.min(-1*Math.floor(l),20),0),d={notation:s,minimumFractionDigits:h,maximumFractionDigits:h};return Object.assign(d,this.options.ticks.format),eZ(t,a,d)},logarithmic(t,e,i){return 0===t?"0":[1,2,3,5,10,15].includes(i[e].significand||t/Math.pow(10,Math.floor(ex(t))))||e>.8*i.length?eK.numeric.call(this,t,e,i):""}},eQ=Object.create(null),eJ=Object.create(null);function e0(t,e){if(!e)return t;let i=e.split(".");for(let e=0,s=i.length;e<s;++e){let s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function e1(t,e,i){return"string"==typeof e?ee(e0(t,e),i):ee(e0(t,""),e)}var e2=new class{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>eY(e.backgroundColor),this.hoverBorderColor=(t,e)=>eY(e.borderColor),this.hoverColor=(t,e)=>eY(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={}
vendor: 4,983 bytes, line 2
2,this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return e1(this,t,e)}get(t){return e0(this,t)}describe(t,e){return e1(eJ,t,e)}override(t,e){return e1(eQ,t,e)}route(t,e,i,s){let a=e0(this,t),r=e0(this,i),n="_"+e;Object.defineProperties(a,{[n]:{value:a[e],writable:!0},[e]:{enumerable:!0,get(){let t=this[n],e=r[s];return t0(t)?Object.assign({},e,t):t5(t,e)},set(t){this[n]=t}}})}apply(t){t.forEach(t=>t(this))}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:eq},numbers:{type:"number",properties:eG}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:eK.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function e5(t,e,i,s,a){let r=e[a];return r||(r=e[a]=t.measureText(a).width,i.push(a)),r>s&&(s=r),s}function e6(t,e,i){let s=t.currentDevicePixelRatio,a=0!==i?Math.max(i/2,.5):0;return Math.round((e-a)*s)/s+a}function e3(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function e8(t,e,i,s){e4(t,e,i,s,null)}function e4(t,e,i,s,a){let r,n,o,l,h,d,c,u,f=e.pointStyle,g=e.rotation,p=e.radius,m=(g||0)*ef;if(f&&"object"==typeof f&&("[object HTMLImageElement]"===(r=f.toString())||"[object HTMLCanvasElement]"===r)){t.save(),t.translate(i,s),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),t.restore();return}if(!isNaN(p)&&!(p<=0)){switch(t.beginPath(),f){default:a?t.ellipse(i,s,a/2,p,0,0,ec):t.arc(i,s,p,0,ec),t.closePath();break;case"triangle":d=a?a/2:p,t.moveTo(i+Math.sin(m)*d,s-Math.cos(m)*p),m+=em,t.lineTo(i+Math.sin(m)*d,s-Math.cos(m)*p),m+=em,t.lineTo(i+Math.sin(m)*d,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":h=.516*p,n=Math.cos(m+ep)*(l=p-h),c=Math.cos(m+ep)*(a?a/2-h:l),o=Math.sin(m+ep)*l,u=Math.sin(m+ep)*(a?a/2-h:l),t.arc(i-c,s-o,h,m-ed,m-eg),t.arc(i+u,s-n,h,m-eg,m),t.arc(i+c,s+o,h,m,m+eg),t.arc(i-u,s+n,h,m+eg,m+ed),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,d=a?a/2:l,t.rect(i-d,s-l,2*d,2*l);break}m+=ep;case"rectRot":c=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-c,s-o),t.lineTo(i+u,s-n),t.lineTo(i+c,s+o),t.lineTo(i-u,s+n),t.closePath();break;case"crossRot":m+=ep;case"cross":c=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-c,s-o),t.lineTo(i+c,s+o),t.moveTo(i+u,s-n),t.lineTo(i-u,s+n);break;case"star":c=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-c,s-o),t.lineTo(i+c,s+o),t.moveTo(i+u,s-n),t.lineTo(i-u,s+n),m+=ep,c=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-c,s-o),t.lineTo(i+c,s+o),t.moveTo(i+u,s-n),t.lineTo(i-u,s+n);break;case"line":n=a?a/2:Math.cos(m)*p,o=Math.sin(m)*p,t.moveTo(i-n,s-o),t.lineTo(i+n,s+o);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(a?a/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function e9(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function e7(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}
2function it(t){t.restore()}function ie(t,e,i,s,a){if(!e)return t.lineTo(i.x,i.y);if("middle"===a){let s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===a!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function ii(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function is(t,e,i,s,a,r={}){let n,o,l=tJ(e)?e:[e],h=r.strokeWidth>0&&""!==r.strokeColor;for(t.save(),t.font=a.string,r.translation&&t.translate(r.translation[0],r.translation[1]),tQ(r.rotation)||t.rotate(r.rotation),r.color&&(t.fillStyle=r.color),r.textAlign&&(t.textAlign=r.textAlign),r.textBaseline&&(t.textBaseline=r.textBaseline),n=0;n<l.length;++n)o=l[n],r.backdrop&&function(t,e){let i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}(t,r.backdrop),h&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),tQ(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(o,i,s,r.maxWidth)),t.fillText(o,i,s,r.maxWidth),function(t,e,i,s,a){if(a.strikethrough||a.underline){let r=t.measureText(s),n=e-r.actualBoundingBoxLeft,o=e+r.actualBoundingBoxRight,l=i-r.actualBoundingBoxAscent,h=i+r.actualBoundingBoxDescent,d=a.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=a.decorationWidth||2,t.moveTo(n,d),t.lineTo(o,d),t.stroke()}}(t,i,s,o,r),s+=Number(a.lineHeight);t.restore()}function ia(t,e){let{x:i,y:s,w:a,h:r,radius:n}=e;t.arc(i+n.topLeft,s+n.topLeft,n.topLeft,1.5*ed,ed,!0),t.lineTo(i,s+r-n.bottomLeft),t.arc(i+n.bottomLeft,s+r-n.bottomLeft,n.bottomLeft,ed,eg,!0),t.lineTo(i+a-n.bottomRight,s+r),t.arc(i+a-n.bottomRight,s+r-n.bottomRight,n.bottomRight,eg,0,!0),t.lineTo(i+a,s+n.topRight),t.arc(i+a-n.topRight,s+n.topRight,n.topRight,0,-eg,!0),t.lineTo(i+n.topLeft,s)}let ir=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,io=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/,il=t=>+t||0;function ih(t,e){let i={},s=t0(e),a=s?Object.keys(e):e,r=t0(t)?s?i=>t5(t[i],t[e[i]]):e=>t[e]:()=>t;for(let t of a)i[t]=il(r(t));return i}function id(t){return ih(t,{top:"y",right:"x",bottom:"y",left:"x"})}function ic(t){return ih(t,["topLeft","topRight","bottomLeft","bottomRight"])}function iu(t){let e=id(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ig(t,e){t=t||{},e=e||e2.font;let i=t5(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=t5(t.style,e.style);s&&!(""+s).match(io)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);let a={family:t5(t.family,e.family),lineHeight:function(t,e){let i=(""+t).match(ir);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}(t5(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:t5(t.weight,e.weight),string:""};return a.string=!a||tQ(a.size)||tQ(a.family)?null:(a.style?a.style+" ":"")+(a.weight?a.weight+" ":"")+a.size+"px "+a.family,a}function ip(t,e,i,s){let a,r,n,o=!0;for(a=0,r=t.length;a<r;++a)if(void 0!==(n=t[a])&&(void 0!==e&&"function"==typeof n&&(n=n(e),o=!1),void 0!==i&&tJ(n)&&(n=n[i%n.length],o=!1),void 0!==n))return s&&!o&&(s.cacheable=!1),n}function im(t,e){return Object.assign(Object.create(t),e)}function ix(t,e=[""],i,s,a=()=>t[0]){let r=i||t;return void 0===s&&(s=iC("_fallback",t)),new Proxy({[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:r,_fallback:s,_getTarget:a,override:i=>ix([i,...t],e,r,s)},{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>iw(i,s,()=>(function(t,e,i,s){let a;for(let r of e)if(void 0!==(a=iC(iy(r,t),i)))return iv(t,a)?iM(i,s,t,a):a})(s,e,t,i)),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>ij(t).includes(e),ownKeys:t=>ij(t),set(t,e,i){let s=t._storage||(t._storage=a());return t[e]=s[e]=i,delete t._keys,!0}})}function ib(t,e,i,s){return new Proxy({_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:i_(t,s),setContext:e=>ib(t,e,i,s),override:a=>ib(t.override(a),e,i,s)},{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>iw(t,e,()=>
2(function(t,e,i){let{_proxy:s,_context:a,_subProxy:r,_descriptors:n}=t,o=s[e];return el(o)&&n.isScriptable(e)&&(o=function(t,e,i,s){let{_proxy:a,_context:r,_subProxy:n,_stack:o}=i;if(o.has(t))throw Error("Recursion detected: "+Array.from(o).join("->")+"->"+t);o.add(t);let l=e(r,n||s);return o.delete(t),iv(t,l)&&(l=iM(a._scopes,a,t,l)),l}(e,o,t,i)),tJ(o)&&o.length&&(o=function(t,e,i,s){let{_proxy:a,_context:r,_subProxy:n,_descriptors:o}=i;if(void 0!==r.index&&s(t))return e[r.index%e.length];if(t0(e[0])){let i=e,s=a._scopes.filter(t=>t!==i);for(let l of(e=[],i)){let i=iM(s,a,t,l);e.push(ib(i,r,n&&n[t],o))}}return e}(e,o,t,n.isIndexable)),iv(e,o)&&(o=ib(o,a,r&&r[e],n)),o})(t,e,i)),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function i_(t,e={scriptable:!0,indexable:!0}){let{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:a=e.allKeys}=t;return{allKeys:a,scriptable:i,indexable:s,isScriptable:el(i)?i:()=>i,isIndexable:el(s)?s:()=>s}}let iy=(t,e)=>t?t+en(e):e,iv=(t,e)=>t0(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function iw(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];let s=i();return t[e]=s,s}let ik=(t,e)=>!0===t?e:"string"==typeof t?er(e,t):void 0;function iM(t,e,i,s){var a;let r=e._rootScopes,n=(a=e._fallback,el(a)?a(i,s):a),o=[...t,...r],l=new Set;l.add(s);let h=iT(l,o,i,n||i,s);return null!==h&&(void 0===n||n===i||null!==(h=iT(l,o,n,h,s)))&&ix(Array.from(l),[""],r,n,()=>{var t,a,r;let n,o;return t=e,a=i,r=s,a in(n=t._getTarget())||(n[a]={}),tJ(o=n[a])&&t0(r)?r:o||{}})}function iT(t,e,i,s,a){for(;i;)i=function(t,e,i,s,a){for(let n of e){let e=ik(i,n);if(e){var r;t.add(e);let n=(r=e._fallback,el(r)?r(i,a):r);if(void 0!==n&&n!==i&&n!==s)return n}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}(t,e,i,s,a);return i}function iC(t,e){for(let i of e){if(!i)continue;let e=i[t];if(void 0!==e)return e}}function ij(t){let e=t._keys;return e||(e=t._keys=function(t){let e=new Set;for(let i of t)for(let t of Object.keys(i).filter(t=>!t.startsWith("_")))e.add(t);return Array.from(e)}(t._scopes)),e}let iS=Number.EPSILON||1e-14,iD=(t,e)=>e<t.length&&!t[e].skip&&t[e],iP=t=>"x"===t?"y":"x";function iO(t,e,i){return Math.max(Math.min(t,i),e)}function iL(){return"u">typeof window&&"u">typeof document}function iA(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function iz(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}let iE=t=>t.ownerDocument.defaultView.getComputedStyle(t,null),iR=["top","right","bottom","left"];function iI(t,e,i){let s={};i=i?"-"+i:"";for(let a=0;a<4;a++){let r=iR[a];s[r]=parseFloat(t[e+"-"+r+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function iF(t,e){if("native"in t)return t;let{canvas:i,currentDevicePixelRatio:s}=e,a=iE(i),r="border-box"===a.boxSizing,n=iI(a,"padding"),o=iI(a,"border","width"),{x:l,y:h,box:d}=function(t,e){let i,s,a,r=t.touches,n=r&&r.length?r[0]:t,{offsetX:o,offsetY:l}=n,h=!1;if(a=t.target,(o>0||l>0)&&(!a||!a.shadowRoot))i=o,s=l;else{let t=e.getBoundingClientRect();i=n.clientX-t.left,s=n.clientY-t.top,h=!0}return{x:i,y:s,box:h}}(t,i),c=n.left+(d&&o.left),u=n.top+(d&&o.top),{width:f,height:g}=e;return r&&(f-=n.width+o.width,g-=n.height+o.height),{x:Math.round((l-c)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}let iB=t=>Math.round(10*t)/10;function iW(t,e,i){let s=e||1,a=iB(t.height*s),r=iB(t.width*s);t.height=iB(t.height),t.width=iB(t.width);let n=t.canvas;return n.style&&(i||!n.style.height&&!n.style.width)&&(n.style.height=`${t.height}px`,n.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||n.height!==a||n.width!==r)&&(t.currentDevicePixelRatio=s,n.height=a,n.width=r,t.ctx.setTransform(s,0,0,s,0,0),!0)}let iH=function(){let t=!1;
2try{let e={get passive(){return t=!0,!1}};iL()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function iV(t,e){let i=iE(t).getPropertyValue(e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function i$(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function iN(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function iU(t,e,i,s){let a={x:t.cp2x,y:t.cp2y},r={x:e.cp1x,y:e.cp1y},n=i$(t,a,i),o=i$(a,r,i),l=i$(r,e,i),h=i$(n,o,i),d=i$(o,l,i);return i$(h,d,i)}function iY(t,e,i){var s;return t?(s=i,{x:t=>e+e+s-t,setWidth(t){s=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function iG(t,e){let i,s;("ltr"===e||"rtl"===e)&&(s=[(i=t.canvas.style).getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function iq(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function iX(t){return"angle"===t?{between:ej,compare:eT,normalize:eC}:{between:eD,compare:(t,e)=>t-e,normalize:t=>t}}function iZ({start:t,end:e,count:i,loop:s,style:a}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:a}}function iK(t,e,i){let s,a,r;if(!i)return[t];let{property:n,start:o,end:l}=i,h=e.length,{compare:d,between:c,normalize:u}=iX(n),{start:f,end:g,loop:p,style:m}=function(t,e,i){let s,{property:a,start:r,end:n}=i,{between:o,normalize:l}=iX(a),h=e.length,{start:d,end:c,loop:u}=t;if(u){for(d+=h,c+=h,s=0;s<h&&o(l(e[d%h][a]),r,n);++s)d--,c--;d%=h,c%=h}return c<d&&(c+=h),{start:d,end:c,loop:u,style:t.style}}(t,e,i),x=[],b=!1,_=null,y=()=>b||c(o,r,s)&&0!==d(o,r),v=()=>!b||0===d(l,s)||c(l,r,s);for(let t=f,i=f;t<=g;++t)(a=e[t%h]).skip||(s=u(a[n]))!==r&&(b=c(s,o,l),null===_&&y()&&(_=0===d(s,o)?t:i),null!==_&&v()&&(x.push(iZ({start:_,end:t,loop:p,count:h,style:m})),_=null),i=t,r=s);return null!==_&&x.push(iZ({start:_,end:g,loop:p,count:h,style:m})),x}function iQ(t,e){let i=[],s=t.segments;for(let a=0;a<s.length;a++){let r=iK(s[a],t.points,e);r.length&&i.push(...r)}return i}function iJ(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){let a=t._chart.getContext(),r=i0(t.options),{_datasetIndex:n,options:{spanGaps:o}}=t,l=i.length,h=[],d=r,c=e[0].start,u=c;function f(t,e,s,a){let r=o?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=r;for(;i[e%l].skip;)e+=r;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:s,style:a}),d=a,c=e%l)}}for(let t of e){let e,r=i[(c=o?c:t.start)%l];for(u=c+1;u<=t.end;u++){let o=i[u%l];(function(t,e){if(!e)return!1;let i=[],s=function(t,e){return eN(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,s)!==JSON.stringify(e,s)})(e=i0(s.setContext(im(a,{type:"segment",p0:r,p1:o,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:n}))),d)&&f(c,u-1,t.loop,d),r=o,d=e}c<u-1&&f(c,u-1,t.loop,d)}return h}(t,e,i,s):e}function i0(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function i1(t,e,i){return t.options.clip?t[i]:e[i]}function i2(t,e){let i=e._clip;if(i.disabled)return!1;let s=function(t,e){let{xScale:i,yScale:s}=t;return i&&s?{left:i1(i,e,"left"),right:i1(i,e,"right"),top:i1(s,e,"top"),bottom:i1(s,e,"bottom")}:e}(e,t.chartArea);return{left:!1===i.left?0:s.left-(!0===i.left?0:i.left),right:!1===i.right?t.width:s.right+(!0===i.right?0:i.right),top:!1===i.top?0:s.top-(!0===i.top?0:i.top),bottom:!1===i.bottom?t.height:s.bottom+(!0===i.bottom?0:i.bottom)}}var i5=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let a=e.listeners[s],r=e.duration;a.forEach(s=>s({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=eR.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;
2this._charts.forEach((i,s)=>{let a;if(!i.running||!i.items.length)return;let r=i.items,n=r.length-1,o=!1;for(;n>=0;--n)(a=r[n])._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),o=!0):(r[n]=r[r.length-1],r.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),r.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=r.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!!e&&!!e.running&&!!e.items.length}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};let i6="transparent",i3={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){let s=eU(t||i6),a=s.valid&&eU(e||i6);return a&&a.valid?a.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class i8{constructor(t,e,i,s){let a=e[i];s=ip([t.to,s,a,t.from]);let r=ip([t.from,a,s]);this._active=!0,this._fn=t.fn||i3[t.type||typeof r],this._easing=e$[t.easing]||e$.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],a=i-this._start,r=this._duration-a;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=a,this._loop=!!t.loop,this._to=ip([t.to,e,s,t.from]),this._from=ip([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e,i=t-this._start,s=this._duration,a=this._prop,r=this._from,n=this._loop,o=this._to;if(this._active=r!==o&&(n||i<s),!this._active){this._target[a]=o,this._notify(!0);return}if(i<0){this._target[a]=r;return}e=i/s%2,e=n&&e>1?2-e:e,e=this._easing(Math.min(1,Math.max(0,e))),this._target[a]=this._fn(r,o,e)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class i4{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!t0(t))return;let e=Object.keys(e2.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{let a=t[s];if(!t0(a))return;let r={};for(let t of e)r[t]=a[t];(tJ(a.properties)&&a.properties||[s]).forEach(t=>{t!==s&&i.has(t)||i.set(t,r)})})}_animateOptions(t,e){let i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i){t.options=e;return}return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}(t,i);if(!s)return[];let a=this._createAnimations(s,i);return i.$shared&&(function(t,e){let i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){let a=t[s[e]];a&&a.active()&&i.push(a.wait())}return Promise.all(i)})(t.options.$animations,i).then(()=>{t.options=i},()=>{}),a}_createAnimations(t,e){let i,s=this._properties,a=[],r=t.$animations||(t.$animations={}),n=Object.keys(e),o=Date.now();for(i=n.length-1;i>=0;--i){let l=n[i];if("$"===l.charAt(0))continue;if("options"===l){a.push(...this._animateOptions(t,e));continue}let h=e[l],d=r[l],c=s.get(l);if(d)if(c&&d.active()){d.update(c,h,o);continue}else d.cancel();if(!c||!c.duration){t[l]=h;continue}r[l]=d=new i8(c,t,l,h),a.push(d)}return a}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);let i=this._createAnimations(t,e);if(i.length)return i5.add(this._chart,i),!0}}function i9(t,e){let i=t&&t.options||{},s=i.reverse,a=void 0===i.min?e:0,r=void 0===i.max?e:0;return{start:s?r:a,end:s?a:r}}function i7(t,e){let i,s,a=[],r=t._getSortedDatasetMetas(e);for(i=0,s=r.length;i<s;++i)a.push(r[i].index);return a}function st(t,e,i,s={}){let a,r,n,o,l=t.keys,h="single"===s.mode;if(null===e)return;let d=!1;for(a=0,r=l.length;a<r;++a){if((n=+l[a])===i){if(d=!0,s.all)continue;break}
2t1(o=t.values[n])&&(h||0===e||eb(e)===eb(o))&&(e+=o)}return d||s.all?e:0}function se(t,e){let i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function si(t,e,i,s){for(let a of e.getMatchingVisibleMetas(s).reverse()){let e=t[a.index];if(i&&e>0||!i&&e<0)return a.index}return null}function ss(t,e){let i,{chart:s,_cachedMeta:a}=t,r=s._stacks||(s._stacks={}),{iScale:n,vScale:o,index:l}=a,h=n.axis,d=o.axis,c=`${n.id}.${o.id}.${a.stack||a.type}`,u=e.length;for(let t=0;t<u;++t){let s=e[t],{[h]:n,[d]:u}=s;(i=(s._stacks||(s._stacks={}))[d]=function(t,e,i){let s=t[e]||(t[e]={});return s[i]||(s[i]={})}(r,c,n))[l]=u,i._top=si(i,o,!0,a.type),i._bottom=si(i,o,!1,a.type),(i._visualValues||(i._visualValues={}))[l]=u}}function sa(t,e){let i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function sr(t,e){let i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s)for(let a of e=e||t._parsed){let t=a._stacks;if(!t||void 0===t[s]||void 0===t[s][i])return;delete t[s][i],void 0!==t[s]._visualValues&&void 0!==t[s]._visualValues[i]&&delete t[s]._visualValues[i]}}let sn=t=>"reset"===t||"none"===t,so=(t,e)=>e?t:Object.assign({},t);class sl{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=se(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&sr(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,a=e.xAxisID=t5(i.xAxisID,sa(t,"x")),r=e.yAxisID=t5(i.yAxisID,sa(t,"y")),n=e.rAxisID=t5(i.rAxisID,sa(t,"r")),o=e.indexAxis,l=e.iAxisID=s(o,a,r,n),h=e.vAxisID=s(o,r,a,n);e.xScale=this.getScaleForId(a),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(n),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&ez(this._data,this),t._stacked&&sr(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(t0(e)){let t=this._cachedMeta;this._data=function(t,e){let i,s,a,{iScale:r,vScale:n}=e,o="x"===r.axis?"x":"y",l="x"===n.axis?"x":"y",h=Object.keys(t),d=Array(h.length);for(i=0,s=h.length;i<s;++i)a=h[i],d[i]={[o]:a,[l]:t[a]};return d}(e,t)}else if(i!==e){if(i){ez(i,this);let t=this._cachedMeta;sr(t),t._parsed=[]}e&&Object.isExtensible(e)&&(e._chartjs?e._chartjs.listeners.push(this):(Object.defineProperty(e,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),eA.forEach(t=>{let i="_onData"+en(t),s=e[t];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value(...t){let a=s.apply(this,t);return e._chartjs.listeners.forEach(e=>{"function"==typeof e[i]&&e[i](...t)}),a}})}))),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let a=e._stacked;e._stacked=se(e.vScale,e),e.stack!==i.stack&&(s=!0,sr(e),e.stack=i.stack),this._resyncElements(t),(s||a!==e._stacked)&&(ss(this,e._parsed),e._stacked=se(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let i,s,a,{_cachedMeta:r,_data:n}=this,{iScale:o,_stacked:l}=r,h=o.axis,d=0===t&&e===n.length||r._sorted,c=t>0&&r._parsed[t-1];if(!1===this._parsing)r._parsed=n,r._sorted=!0,a=n;else{a=tJ(n[t])?this.parseArrayData(r,n,t,e):t0(n[t])?this.parseObjectData(r,n,t,e):this.parsePrimitiveData(r,n,t,e);let o=()=>null===s[h]||c&&s[h]<c[h];for(i=0;i<e;++i)r._parsed[i+t]=s=a[i],d&&(o()&&(d=!1),c=s);r._sorted=d}l&&ss(this,a)}
2parsePrimitiveData(t,e,i,s){let a,r,{iScale:n,vScale:o}=t,l=n.axis,h=o.axis,d=n.getLabels(),c=n===o,u=Array(s);for(a=0;a<s;++a)r=a+i,u[a]={[l]:c||n.parse(d[r],r),[h]:o.parse(e[r],r)};return u}parseArrayData(t,e,i,s){let a,r,n,{xScale:o,yScale:l}=t,h=Array(s);for(a=0;a<s;++a)n=e[r=a+i],h[a]={x:o.parse(n[0],r),y:l.parse(n[1],r)};return h}parseObjectData(t,e,i,s){let a,r,n,{xScale:o,yScale:l}=t,{xAxisKey:h="x",yAxisKey:d="y"}=this._parsing,c=Array(s);for(a=0;a<s;++a)n=e[r=a+i],c[a]={x:o.parse(er(n,h),r),y:l.parse(er(n,d),r)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,a=this._cachedMeta,r=e[t.axis];return st({keys:i7(s,!0),values:e._stacks[t.axis]._visualValues},r,a.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let a=i[e.axis],r=null===a?0/0:a,n=s&&i._stacks[e.axis];s&&n&&(s.values=n,r=st(s,a,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){let i,s,a,r=this._cachedMeta,n=r._parsed,o=r._sorted&&t===r.iScale,l=n.length,h=this._getOtherScale(t),d=(a=this.chart,e&&!r.hidden&&r._stacked&&{keys:i7(a,!0),values:null}),c={min:1/0,max:-1/0},{min:u,max:f}=function(t){let{min:e,max:i,minDefined:s,maxDefined:a}=t.getUserBounds();return{min:s?e:-1/0,max:a?i:1/0}}(h);function g(){let e=(s=n[i])[h.axis];return!t1(s[t.axis])||u>e||f<e}for(i=0;i<l&&(g()||(this.updateRangeFromParsed(c,t,s,d),!o));++i);if(o){for(i=l-1;i>=0;--i)if(!g()){this.updateRangeFromParsed(c,t,s,d);break}}return c}getAllParsedValues(t){let e,i,s,a=this._cachedMeta._parsed,r=[];for(e=0,i=a.length;e<i;++e)t1(s=a[e][t.axis])&&r.push(s);return r}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,a=this.getParsed(t);return{label:i?""+i.getLabelForValue(a[i.axis]):"",value:s?""+s.getLabelForValue(a[s.axis]):""}}_update(t){var e;let i,s,a,r,n=this._cachedMeta;this.update(t||"default"),t0(e=t5(this.options.clip,function(t,e,i){if(!1===i)return!1;let s=i9(t,i),a=i9(e,i);return{top:a.end,right:s.end,bottom:a.start,left:s.start}}(n.xScale,n.yScale,this.getMaxOverflow())))?(i=e.top,s=e.right,a=e.bottom,r=e.left):i=s=a=r=e,n._clip={top:i,right:s,bottom:a,left:r,disabled:!1===e}}update(t){}draw(){let t,e=this._ctx,i=this.chart,s=this._cachedMeta,a=s.data||[],r=i.chartArea,n=[],o=this._drawStart||0,l=this._drawCount||a.length-o,h=this.options.drawActiveElementsOnTop;for(s.dataset&&s.dataset.draw(e,r,o,l),t=o;t<o+l;++t){let i=a[t];i.hidden||(i.active&&h?n.push(i):i.draw(e,r))}for(t=0;t<n.length;++t)n[t].draw(e,r)}getStyle(t,e){let i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){var s,a;let r,n=this.getDataset();if(t>=0&&t<this._cachedMeta.data.length){let e=this._cachedMeta.data[t];(r=e.$context||(s=this.getContext(),e.$context=im(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"}))).parsed=this.getParsed(t),r.raw=n.data[t],r.index=r.dataIndex=t}else(r=this.$context||(this.$context=im(this.chart.getContext(),{active:!1,dataset:void 0,datasetIndex:a=this.index,index:a,mode:"default",type:"dataset"}))).dataset=n,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){let s="active"===e,a=this._cachedDataOpts,r=t+"-"+e,n=a[r],o=this.enableOptionSharing&&eo(i);if(n)return so(n,o);let l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],c=l.getOptionScopes(this.getDataset(),h),u=Object.keys(e2.elements[t]),f=()=>this.getContext(i,s,e),g=l.resolveNamedOptions(c,u,f,d);return g.$shared&&(g.$shared=o,a[r]=Object.freeze(so(g,o))),g}_resolveAnimations(t,e,i){let s,a=this.chart,r=this._cachedDataOpts,n=`animation-${e}`,o=r[n];if(o)return o;if(!1!==a.options.animation){let a=this.chart.config,r=a.datasetAnimationScopeKeys(this._type,e),n=a.getOptionScopes(this.getDataset(),r);s=a.createResolver(n,this.getContext(t,i,e))}let l=new i4(a,s&&s.animations);return s&&s._cacheable&&(r[n]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||sn(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,a=this.getSharedOptions(i),r=this.includeOptions(e,a)||a!==s;return this.updateSharedOptions(a,e,i),{sharedOptions:a,includeOptions:r}}updateElement(t,e,i,s){sn(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!sn(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let a=this.getStyle(e,s);
2this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];let s=i.length,a=e.length,r=Math.min(a,s);r&&this.parse(0,r),a>s?this._insertElements(s,a-s,t):a<s&&this._removeElements(a,s-a)}_insertElements(t,e,i=!0){let s,a=this._cachedMeta,r=a.data,n=t+e,o=t=>{for(t.length+=e,s=t.length-1;s>=n;s--)t[s]=t[s-e]};for(o(r),s=t;s<n;++s)r[s]=new this.dataElementType;this._parsing&&o(a._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&sr(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function sh(t,e,i,s){if(tJ(t)){let a,r,n,o,l,h;a=i.parse(t[0],s),n=Math.min(a,r=i.parse(t[1],s)),o=Math.max(a,r),l=n,h=o,Math.abs(n)>Math.abs(o)&&(l=o,h=n),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:a,end:r,min:n,max:o}}else e[i.axis]=i.parse(t,s);return e}function sd(t,e,i,s){let a,r,n,o,l=t.iScale,h=t.vScale,d=l.getLabels(),c=l===h,u=[];for(a=i,r=i+s;a<r;++a)o=e[a],(n={})[l.axis]=c||l.parse(d[a],a),u.push(sh(o,n,h,a));return u}function sc(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function su(t,e,i,s){var a,r,n;return s?sf((a=t,r=e,n=i,t=a===r?n:a===n?r:a),i,e):sf(t,e,i)}function sf(t,e,i){return"start"===t?e:"end"===t?i:t}function sg(){throw Error("This method is not implemented: Check that a complete date adapter is provided.")}var sp=class t{static override(e){Object.assign(t.prototype,e)}options;constructor(t){this.options=t||{}}init(){}formats(){return sg()}parse(){return sg()}format(){return sg()}add(){return sg()}diff(){return sg()}startOf(){return sg()}endOf(){return sg()}};function sm(t,e,i,s,a){let r=t.getSortedVisibleDatasetMetas(),n=i[e];for(let t=0,i=r.length;t<i;++t){let{index:i,data:o}=r[t],{lo:l,hi:h}=function(t,e,i,s){let{controller:a,data:r,_sorted:n}=t,o=a._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(o&&e===o.axis&&"r"!==e&&n&&r.length){let n=o._reversePixels?eL:eO;if(s){if(a._sharedOptions){let t=r[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){let t=n(r,e,i-s),a=n(r,e,i+s);return{lo:t.lo,hi:a.hi}}}}else{let s=n(r,e,i);if(l){let{vScale:e}=a._cachedMeta,{_parsed:i}=t,r=i.slice(0,s.lo+1).reverse().findIndex(t=>!tQ(t[e.axis]));s.lo-=Math.max(0,r);let n=i.slice(s.hi).findIndex(t=>!tQ(t[e.axis]));s.hi+=Math.max(0,n)}return s}}return{lo:0,hi:r.length-1}}(r[t],e,n,a);for(let t=l;t<=h;++t){let e=o[t];e.skip||s(e,i,t)}}}function sx(t,e,i,s,a){let r=[];return(a||t.isPointInArea(e))&&sm(t,i,e,function(i,n,o){(a||e9(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&r.push({element:i,datasetIndex:n,index:o})},!0),r}function sb(t,e,i,s,a,r){let n,o,l,h,d,c;return r||t.isPointInArea(e)?"r"!==i||s?(n=[],o=-1!==i.indexOf("x"),l=-1!==i.indexOf("y"),h=function(t,e){return Math.sqrt(Math.pow(o?Math.abs(t.x-e.x):0,2)+Math.pow(l?Math.abs(t.y-e.y):0,2))},d=1/0,sm(t,i,e,function(i,o,l){let c=i.inRange(e.x,e.y,a);if(s&&!c)return;let u=i.getCenterPoint(a);if(!(r||t.isPointInArea(u))&&!c)return;let f=h(e,u);f<d?(n=[{element:i,datasetIndex:o,index:l}],d=f):f===d&&n.push({element:i,datasetIndex:o,index:l})}),n):(c=[],sm(t,i,e,function(t,i,s){var r,n;let o,l,h,d,{startAngle:u,endAngle:f}=t.getProps(["startAngle","endAngle"],a),{angle:g}=(r=t,o=(n={x:e.x,y:e.y}).x-r.x,h=Math.sqrt(o*o+(l=n.y-r.y)*l),(d=Math.atan2(l,o))<-.5*ed&&(d+=ec),{angle:d,distance:h});ej(g,u,f)&&c.push({element:t,datasetIndex:i,index:s})}),c):[]}function s_(t,e,i,s,a){let r=[],n="x"===i?"inXRange":"inYRange",o=!1;return(sm(t,i,e,(t,s,l)=>{t[n]&&t[n](e[i],a)&&(r.push({element:t,datasetIndex:s,index:l}),o=o||t.inRange(e.x,e.y,a))}),s&&!o)?[]:r}var sy={modes:{index(t,e,i,s){let a=iF(e,t),r=i.axis||"x",n=i.includeInvisible||!1,o=i.intersect?sx(t,a,r,s,n):sb(t,a,r,!1,s,n),l=[];
2return o.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{let e=o[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,i,s){let a=iF(e,t),r=i.axis||"xy",n=i.includeInvisible||!1,o=i.intersect?sx(t,a,r,s,n):sb(t,a,r,!1,s,n);if(o.length>0){let e=o[0].datasetIndex,i=t.getDatasetMeta(e).data;o=[];for(let t=0;t<i.length;++t)o.push({element:i[t],datasetIndex:e,index:t})}return o},point(t,e,i,s){let a=iF(e,t);return sx(t,a,i.axis||"xy",s,i.includeInvisible||!1)},nearest(t,e,i,s){let a=iF(e,t),r=i.axis||"xy",n=i.includeInvisible||!1;return sb(t,a,r,i.intersect,s,n)},x(t,e,i,s){let a=iF(e,t);return s_(t,a,"x",i.intersect,s)},y(t,e,i,s){let a=iF(e,t);return s_(t,a,"y",i.intersect,s)}}};let sv=["left","top","right","bottom"];function sw(t,e){return t.filter(t=>t.pos===e)}function sk(t,e){return t.filter(t=>-1===sv.indexOf(t.pos)&&t.box.axis===e)}function sM(t,e){return t.sort((t,i)=>{let s=e?i:t,a=e?t:i;return s.weight===a.weight?s.index-a.index:s.weight-a.weight})}function sT(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function sC(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function sj(t,e,i,s){let a,r,n,o,l,h,d=[];for(a=0,r=t.length,l=0;a<r;++a){(o=(n=t[a]).box).update(n.width||e.w,n.height||e.h,function(t,e){let i=e.maxPadding;return function(t){let s={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}(t?["left","right"]:["top","bottom"])}(n.horizontal,e));let{same:r,other:c}=function(t,e,i,s){let{pos:a,box:r}=i,n=t.maxPadding;if(!t0(a)){i.size&&(t[a]-=i.size);let e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[a]+=i.size}r.getPadding&&sC(n,r.getPadding());let o=Math.max(0,e.outerWidth-sT(n,t,"left","right")),l=Math.max(0,e.outerHeight-sT(n,t,"top","bottom")),h=o!==t.w,d=l!==t.h;return t.w=o,t.h=l,i.horizontal?{same:h,other:d}:{same:d,other:h}}(e,i,n,s);l|=r&&d.length,h=h||c,o.fullSize||d.push(n)}return l&&sj(d,e,i,s)||h}function sS(t,e,i,s,a){t.top=i,t.left=e,t.right=e+s,t.bottom=i+a,t.width=s,t.height=a}function sD(t,e,i,s){let a=i.padding,{x:r,y:n}=e;for(let o of t){let t=o.box,l=s[o.stack]||{count:1,placed:0,weight:1},h=o.stackWeight/l.weight||1;if(o.horizontal){let s=e.w*h,r=l.size||t.height;eo(l.start)&&(n=l.start),t.fullSize?sS(t,a.left,n,i.outerWidth-a.right-a.left,r):sS(t,e.left+l.placed,n,s,r),l.start=n,l.placed+=s,n=t.bottom}else{let s=e.h*h,n=l.size||t.width;eo(l.start)&&(r=l.start),t.fullSize?sS(t,r,a.top,n,i.outerHeight-a.bottom-a.top):sS(t,r,e.top+l.placed,n,s),l.start=r,l.placed+=s,r=t.right}}e.x=r,e.y=n}var sP={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){let i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){let a,r,n,o,l,h,d,c;if(!t)return;let u=iu(t.options.layout.padding),f=Math.max(e-u.width,0),g=Math.max(i-u.height,0),p=(r=sM((a=function(t){let e,i,s,a,r,n,o=[];for(e=0,i=(t||[]).length;e<i;++e)s=t[e],({position:a,options:{stack:r,stackWeight:n=1}}=s),o.push({index:e,box:s,pos:a,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&a+r,stackWeight:n});return o}(t.boxes)).filter(t=>t.box.fullSize),!0),n=sM(sw(a,"left"),!0),o=sM(sw(a,"right")),l=sM(sw(a,"top"),!0),h=sM(sw(a,"bottom")),d=sk(a,"x"),c=sk(a,"y"),{fullSize:r,leftAndTop:n.concat(l),rightAndBottom:o.concat(c).concat(h).concat(d),chartArea:sw(a,"chartArea"),vertical:n.concat(o).concat(c),horizontal:l.concat(h).concat(d)}),m=p.vertical,x=p.horizontal;t8(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});let b=Object.freeze({outerWidth:e,outerHeight:i,padding:u,availableWidth:f,availableHeight:g,vBoxMaxWidth:f/2/(m.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1),hBoxMaxHeight:g/2}),_=Object.assign({},u);sC(_,iu(s));let y=Object.assign({maxPadding:_,w:f,h:g,x:u.left,y:u.top},u),v=function(t,e){let i,s,a,r=function(t){let e={};for(let i of t){let{stack:t,pos:s,stackWeight:a}=i;if(!t||!sv.includes(s))continue;let r=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=a}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;for(i=0,s=t.length;i<s;++i){let{fullSize:s}=(a=t[i]).box,l=r[a.stack],h=l&&a.stackWeight/l.weight;
2a.horizontal?(a.width=h?h*n:s&&e.availableWidth,a.height=o):(a.width=n,a.height=h?h*o:s&&e.availableHeight)}return r}(m.concat(x),b);sj(p.fullSize,y,b,v),sj(m,y,b,v),sj(x,y,b,v)&&sj(m,y,b,v);let w=y.maxPadding;function k(t){let e=Math.max(w[t]-y[t],0);return y[t]+=e,e}y.y+=k("top"),y.x+=k("left"),k("right"),k("bottom"),sD(p.leftAndTop,y,b,v),y.x+=y.w,y.y+=y.h,sD(p.rightAndBottom,y,b,v),t.chartArea={left:y.left,top:y.top,right:y.left+y.w,bottom:y.top+y.h,height:y.h,width:y.w},t8(p.chartArea,e=>{let i=e.box;Object.assign(i,t.chartArea),i.update(y.w,y.h,{left:0,top:0,right:0,bottom:0})})}};class sO{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class sL extends sO{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}let sA="$chartjs",sz={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},sE=t=>null===t||""===t,sR=!!iH&&{passive:!0};function sI(t,e){for(let i of t)if(i===e||i.contains(e))return!0}function sF(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||sI(i.addedNodes,s))&&!sI(i.removedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function sB(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||sI(i.removedNodes,s))&&!sI(i.addedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}let sW=new Map,sH=0;function sV(){let t=window.devicePixelRatio;t!==sH&&(sH=t,sW.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function s$(t,e,i){let s=t.canvas,a=s&&iA(s);if(!a)return;let r=eI((t,e)=>{let s=a.clientWidth;i(t,e),s<a.clientWidth&&i()},window),n=new ResizeObserver(t=>{let e=t[0],i=e.contentRect.width,s=e.contentRect.height;(0!==i||0!==s)&&r(i,s)});return n.observe(a),sW.size||window.addEventListener("resize",sV),sW.set(t,r),n}function sN(t,e,i){i&&i.disconnect(),"resize"===e&&(sW.delete(t),sW.size||window.removeEventListener("resize",sV))}function sU(t,e,i){let s=t.canvas,a=eI(e=>{null!==t.ctx&&i(function(t,e){let i=sz[t.type]||t.type,{x:s,y:a}=iF(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==a?a:null}}(e,t))},t);return s&&s.addEventListener(e,a,sR),a}class sY extends sO{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(!function(t,e){let i=t.style,s=t.getAttribute("height"),a=t.getAttribute("width");if(t[sA]={initial:{height:s,width:a,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",sE(a)){let e=iV(t,"width");void 0!==e&&(t.width=e)}if(sE(s))if(""===t.style.height)t.height=t.width/(e||2);else{let e=iV(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[sA])return!1;let i=e[sA].initial;["height","width"].forEach(t=>{let s=i[t];tQ(s)?e.removeAttribute(t):e.setAttribute(t,s)});let s=i.style||{};return Object.keys(s).forEach(t=>{e.style[t]=s[t]}),e.width=e.width,delete e[sA],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:sF,detach:sB,resize:s$}[e]||sU;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];s&&((({attach:sN,detach:sN,resize:sN})[e]||function(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,sR)})(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return function(t,e,i,s){let a=iE(t),r=iI(a,"margin"),n=iz(a.maxWidth,t,"clientWidth")||1/0,o=iz(a.maxHeight,t,"clientHeight")||1/0,l=function(t,e,i){let s,a;if(void 0===e||void 0===i){let r=t&&iA(t);if(r){let t=r.getBoundingClientRect(),n=iE(r),o=iI(n,"border","width"),l=iI(n,"padding");e=t.width-l.width-o.width,i=t.height-l.height-o.height,s=iz(n.maxWidth,r,"clientWidth"),a=iz(n.maxHeight,r,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||1/0,maxHeight:a||1/0}}(t,e,i),{width:h,height:d}=l;if("content-box"===a.boxSizing){let t=iI(a,"border","width"),e=iI(a,"padding");h-=e.width+t.width,d-=e.height+t.height}return h=Math.max(0,h-r.width),d=Math.max(0,s?h/s:d-r.height),h=iB(Math.min(h,n,l.maxWidth)),d=iB(Math.min(d,o,l.maxHeight)),h&&!d&&(d=iB(h/2)),(void 0!==e||void 0!==i)&&s&&l.height&&d>
2l.height&&(h=iB(Math.floor((d=l.height)*s))),{width:h,height:d}}(t,e,i,s)}isAttached(t){let e=t&&iA(t);return!!(e&&e.isConnected)}}class sG{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return ev(this.x)&&ev(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}}function sq(t,e,i,s,a){let r,n,o,l=t5(s,0),h=Math.min(t5(a,t.length),t.length),d=0;for(i=Math.ceil(i),a&&(i=(r=a-s)/Math.floor(r/i)),o=l;o<0;)o=Math.round(l+ ++d*i);for(n=Math.max(l,0);n<h;n++)n===o&&(e.push(t[n]),o=Math.round(l+ ++d*i))}let sX=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,sZ=(t,e)=>Math.min(e||t,t);function sK(t,e){let i=[],s=t.length/e,a=t.length,r=0;for(;r<a;r+=s)i.push(t[Math.floor(r)]);return i}function sQ(t){return t.drawTicks?t.tickLength:0}function sJ(t,e){if(!t.display)return 0;let i=ig(t.font,e),s=iu(t.padding);return(tJ(t.text)?t.text.length:1)*i.lineHeight+s.height}class s0 extends sG{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=t2(t,1/0),e=t2(e,-1/0),i=t2(i,1/0),s=t2(s,-1/0),{min:t2(t,i),max:t2(e,s),minDefined:t1(t),maxDefined:t1(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:a,maxDefined:r}=this.getUserBounds();if(a&&r)return{min:i,max:s};let n=this.getMatchingVisibleMetas();for(let o=0,l=n.length;o<l;++o)e=n[o].controller.getMinMax(this,t),a||(i=Math.min(i,e.min)),r||(s=Math.max(s,e.max));return i=r&&i>s?s:i,s=a&&i>s?i:s,{min:t2(i,t2(s,i)),max:t2(s,t2(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){t3(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:s,grace:a,ticks:r}=this.options,n=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){let{min:s,max:a}=t,r=t6(e,(a-s)/2),n=(t,e)=>i&&0===t?0:t+e;return{min:n(s,-Math.abs(r)),max:n(a,r)}}(this,a,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let o=n<this.ticks.length;this._convertTicksToLabels(o?sK(this.ticks,n):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.source)&&(this.ticks=function(t,e){var i;let s,a,r=t.options.ticks,n=(s=(i=t).options.offset,a=i._tickSize(),Math.floor(Math.min(i._length/a+ +!s,i._maxLength/a))),o=Math.min(r.maxTicksLimit||n,n),l=r.major.enabled?function(t){let e,i,s=[];for(e=0,i=t.length;e<i;e++)t[e].major&&s.push(e);return s}(e):[],h=l.length,d=l[0],c=l[h-1],u=[];
2if(h>o)return function(t,e,i,s){let a,r=0,n=i[0];for(s=Math.ceil(s),a=0;a<t.length;a++)a===n&&(e.push(t[a]),n=i[++r*s])}(e,u,l,h/o),u;let f=function(t,e,i){let s=function(t){let e,i,s=t.length;if(s<2)return!1;for(i=t[0],e=1;e<s;++e)if(t[e]-t[e-1]!==i)return!1;return i}(t),a=e.length/i;if(!s)return Math.max(a,1);let r=function(t){let e,i=[],s=Math.sqrt(t);for(e=1;e<s;e++)t%e==0&&(i.push(e),i.push(t/e));return s===(0|s)&&i.push(s),i.sort((t,e)=>t-e).pop(),i}(s);for(let t=0,e=r.length-1;t<e;t++){let e=r[t];if(e>a)return e}return Math.max(a,1)}(l,e,o);if(h>0){let t,i,s=h>1?Math.round((c-d)/(h-1)):null;for(sq(e,u,f,tQ(s)?0:d-s,d),t=0,i=h-1;t<i;t++)sq(e,u,f,l[t],l[t+1]);return sq(e,u,f,c,tQ(s)?e.length:c+s),u}return sq(e,u,f),u}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),o&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){t3(this.options.afterUpdate,[this])}beforeSetDimensions(){t3(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){t3(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),t3(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){t3(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e,i,s,a=this.options.ticks;for(e=0,i=t.length;e<i;e++)(s=t[e]).label=t3(a.callback,[s.value,e,t],this)}afterTickToLabelConversion(){t3(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){t3(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t,e,i,s=this.options,a=s.ticks,r=sZ(this.ticks.length,s.ticks.maxTicksLimit),n=a.minRotation||0,o=a.maxRotation,l=n;if(!this._isVisible()||!a.display||n>=o||r<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),d=h.widest.width,c=h.highest.height,u=eS(this.chart.width-d,0,this.maxWidth);d+6>(t=s.offset?this.maxWidth/r:u/(r-1))&&(t=u/(r-(s.offset?.5:1)),e=this.maxHeight-sQ(s.grid)-a.padding-sJ(s.title,this.chart.options.font),i=Math.sqrt(d*d+c*c),l=Math.max(n,Math.min(o,l=180/ed*Math.min(Math.asin(eS((h.highest.height+6)/t,-1,1)),Math.asin(eS(e/i,-1,1))-Math.asin(eS(c/i,-1,1)))))),this.labelRotation=l}afterCalculateLabelRotation(){t3(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){t3(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:a}}=this,r=this._isVisible(),n=this.isHorizontal();if(r){let r=sJ(s,e.options.font);if(n?(t.width=this.maxWidth,t.height=sQ(a)+r):(t.height=this.maxHeight,t.width=sQ(a)+r),i.display&&this.ticks.length){let{first:e,last:s,widest:a,highest:r}=this._getLabelSizes(),o=2*i.padding,l=ew(this.labelRotation),h=Math.cos(l),d=Math.sin(l);if(n){let e=i.mirror?0:d*a.width+h*r.height;t.height=Math.min(this.maxHeight,t.height+e+o)}else{let e=i.mirror?0:h*a.width+d*r.height;t.width=Math.min(this.maxWidth,t.width+e+o)}this._calculatePadding(e,s,d,h)}}this._handleMargins(),n?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:a,padding:r},position:n}=this.options,o=0!==this.labelRotation,l="top"!==n&&"x"===this.axis;if(this.isHorizontal()){let n=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,c=0;o?l?(d=s*t.width,c=i*e.height):(d=i*t.height,c=s*e.width):"start"===a?c=e.width:"end"===a?d=t.width:"inner"!==a&&(d=t.width/2,c=e.width/2),this.paddingLeft=Math.max((d-n+r)*this.width/(this.width-n),0),this.paddingRight=Math.max((c-h+r)*this.width/(this.width-h),0)}
2else{let i=e.height/2,s=t.height/2;"start"===a?(i=0,s=t.height):"end"===a&&(i=e.height,s=0),this.paddingTop=i+r,this.paddingBottom=s+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){t3(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)tQ(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=sK(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let s,a,r,n,o,l,h,d,c,u,f,{ctx:g,_longestTextCache:p}=this,m=[],x=[],b=Math.floor(e/sZ(e,i)),_=0,y=0;for(s=0;s<e;s+=b){if(n=t[s].label,g.font=l=(o=this._resolveTickFontOptions(s)).string,h=p[l]=p[l]||{data:{},gc:[]},d=o.lineHeight,c=u=0,tQ(n)||tJ(n)){if(tJ(n))for(a=0,r=n.length;a<r;++a)tQ(f=n[a])||tJ(f)||(c=e5(g,h.data,h.gc,c,f),u+=d)}else c=e5(g,h.data,h.gc,c,n),u=d;m.push(c),x.push(u),_=Math.max(c,_),y=Math.max(u,y)}t8(p,t=>{let i,s=t.gc,a=s.length/2;if(a>e){for(i=0;i<a;++i)delete t.data[s[i]];s.splice(0,a)}});let v=m.indexOf(_),w=x.indexOf(y),k=t=>({width:m[t]||0,height:x[t]||0});return{first:k(0),last:k(e-1),widest:k(v),highest:k(w),widths:m,heights:x}}getLabelForValue(t){return t}getPixelForValue(t,e){return 0/0}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return eS(this._alignToPixels?e6(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){var e,i;let s=this.ticks||[];if(t>=0&&t<s.length){let i=s[t];return i.$context||(e=this.getContext(),i.$context=im(e,{tick:i,index:t,type:"tick"}))}return this.$context||(this.$context=(i=this.chart.getContext(),im(i,{scale:this,type:"scale"})))}_tickSize(){let t=this.options.ticks,e=ew(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),a=this._getLabelSizes(),r=t.autoSkipPadding||0,n=a?a.widest.width+r:0,o=a?a.highest.height+r:0;return this.isHorizontal()?o*i>n*s?n/i:o/s:o*s<n*i?o/i:n/s}_isVisible(){let t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e,i,s,a,r,n,o,l,h,d,c,u,f=this.axis,g=this.chart,p=this.options,{grid:m,position:x,border:b}=p,_=m.offset,y=this.isHorizontal(),v=this.ticks.length+ +!!_,w=sQ(m),k=[],M=b.setContext(this.getContext()),T=M.display?M.width:0,C=T/2,j=function(t){return e6(g,t,T)};if("top"===x)e=j(this.bottom),n=this.bottom-w,l=e-C,d=j(t.top)+C,u=t.bottom;else if("bottom"===x)e=j(this.top),d=t.top,u=j(t.bottom)-C,n=e+C,l=this.top+w;else if("left"===x)e=j(this.right),r=this.right-w,o=e-C,h=j(t.left)+C,c=t.right;else if("right"===x)e=j(this.left),h=t.left,c=j(t.right)-C,r=e+C,o=this.left+w;else if("x"===f){if("center"===x)e=j((t.top+t.bottom)/2+.5);else if(t0(x)){let t=Object.keys(x)[0],i=x[t];e=j(this.chart.scales[t].getPixelForValue(i))}d=t.top,u=t.bottom,l=(n=e+C)+w}else if("y"===f){if("center"===x)e=j((t.left+t.right)/2);else if(t0(x)){let t=Object.keys(x)[0],i=x[t];e=j(this.chart.scales[t].getPixelForValue(i))}o=(r=e-C)-w,h=t.left,c=t.right}let S=t5(p.ticks.maxTicksLimit,v),D=Math.max(1,Math.ceil(v/S));for(i=0;i<v;i+=D){let t=this.getContext(i),e=m.setContext(t),f=b.setContext(t),p=e.lineWidth,x=e.color,v=f.dash||[],w=f.dashOffset,M=e.tickWidth,T=e.tickColor,C=e.tickBorderDash||[],j=e.tickBorderDashOffset;
2void 0!==(s=function(t,e,i){let s,a=t.ticks.length,r=Math.min(e,a-1),n=t._startPixel,o=t._endPixel,l=t.getPixelForTick(r);if(!i||(s=1===a?Math.max(l-n,o-l):0===e?(t.getPixelForTick(1)-l)/2:(l-t.getPixelForTick(r-1))/2,!((l+=r<e?s:-s)<n-1e-6)&&!(l>o+1e-6)))return l}(this,i,_))&&(a=e6(g,s,p),y?r=o=h=c=a:n=l=d=u=a,k.push({tx1:r,ty1:n,tx2:o,ty2:l,x1:h,y1:d,x2:c,y2:u,width:p,color:x,borderDash:v,borderDashOffset:w,tickWidth:M,tickColor:T,tickBorderDash:C,tickBorderDashOffset:j}))}return this._ticksLength=v,this._borderValue=e,k}_computeLabelItems(t){let e,i,s,a,r,n,o,l,h,d,c,u=this.axis,f=this.options,{position:g,ticks:p}=f,m=this.isHorizontal(),x=this.ticks,{align:b,crossAlign:_,padding:y,mirror:v}=p,w=sQ(f.grid),k=w+y,M=v?-y:k,T=-ew(this.labelRotation),C=[],j="middle";if("top"===g)r=this.bottom-M,n=this._getXAxisLabelAlignment();else if("bottom"===g)r=this.top+M,n=this._getXAxisLabelAlignment();else if("left"===g){let t=this._getYAxisLabelAlignment(w);n=t.textAlign,a=t.x}else if("right"===g){let t=this._getYAxisLabelAlignment(w);n=t.textAlign,a=t.x}
2else if("x"===u){if("center"===g)r=(t.top+t.bottom)/2+k;else if(t0(g)){let t=Object.keys(g)[0],e=g[t];r=this.chart.scales[t].getPixelForValue(e)+k}n=this._getXAxisLabelAlignment()}else if("y"===u){if("center"===g)a=(t.left+t.right)/2-k;else if(t0(g)){let t=Object.keys(g)[0],e=g[t];a=this.chart.scales[t].getPixelForValue(e)}n=this._getYAxisLabelAlignment(w).textAlign}"y"===u&&("start"===b?j="top":"end"===b&&(j="bottom"));let S=this._getLabelSizes();for(e=0,i=x.length;e<i;++e){let t;s=x[e].label;let u=p.setContext(this.getContext(e));o=this.getPixelForTick(e)+p.labelOffset,h=(l=this._resolveTickFontOptions(e)).lineHeight;let f=(d=tJ(s)?s.length:1)/2,b=u.color,y=u.textStrokeColor,w=u.textStrokeWidth,k=n;if(m?(a=o,"inner"===n&&(k=e===i-1?this.options.reverse?"left":"right":0===e?this.options.reverse?"right":"left":"center"),c="top"===g?"near"===_||0!==T?-d*h+h/2:"center"===_?-S.highest.height/2-f*h+h:-S.highest.height+h/2:"near"===_||0!==T?h/2:"center"===_?S.highest.height/2-f*h:S.highest.height-d*h,v&&(c*=-1),0===T||u.showLabelBackdrop||(a+=h/2*Math.sin(T))):(r=o,c=(1-d)*h/2),u.showLabelBackdrop){let s=iu(u.backdropPadding),a=S.heights[e],r=S.widths[e],o=c-s.top,l=0-s.left;switch(j){case"middle":o-=a/2;break;case"bottom":o-=a}switch(n){case"center":l-=r/2;break;case"right":l-=r;break;case"inner":e===i-1?l-=r:e>0&&(l-=r/2)}t={left:l,top:o,width:r+s.width,height:a+s.height,color:u.backdropColor}}C.push({label:s,font:l,textOffset:c,options:{rotation:T,color:b,strokeColor:y,strokeWidth:w,textAlign:k,textBaseline:j,translation:[a,r],backdrop:t}})}return C}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-ew(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){let e,i,{position:s,ticks:{crossAlign:a,mirror:r,padding:n}}=this.options,o=this._getLabelSizes(),l=t+n,h=o.widest.width;return"left"===s?r?(i=this.right+n,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i+=h)):(i=this.right-l,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i=this.left)):"right"===s?r?(i=this.left+n,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i-=h)):(i=this.left+l,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i=this.right)):e="right",{textAlign:e,x:i}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}
2:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:a,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,a,r),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let i=this.ticks.findIndex(e=>e.value===t);return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){let e,i,s=this.options.grid,a=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),n=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(s.display)for(e=0,i=r.length;e<i;++e){let t=r[e];s.drawOnChartArea&&n({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),s.drawTicks&&n({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){let t,e,i,s,{chart:a,ctx:r,options:{border:n,grid:o}}=this,l=n.setContext(this.getContext()),h=n.display?l.width:0;
2if(!h)return;let d=o.setContext(this.getContext(0)).lineWidth,c=this._borderValue;this.isHorizontal()?(t=e6(a,this.left,h)-h/2,e=e6(a,this.right,d)+d/2,i=s=c):(i=e6(a,this.top,h)-h/2,s=e6(a,this.bottom,d)+d/2,t=e=c),r.save(),r.lineWidth=l.width,r.strokeStyle=l.color,r.beginPath(),r.moveTo(t,i),r.lineTo(e,s),r.stroke(),r.restore()}drawLabels(t){if(!this.options.ticks.display)return;let e=this.ctx,i=this._computeLabelArea();for(let s of(i&&e7(e,i),this.getLabelItems(t))){let t=s.options,i=s.font;is(e,s.label,0,s.textOffset,i,t)}i&&it(e)}drawTitle(){let t,e,{ctx:i,options:{position:s,title:a,reverse:r}}=this;if(!a.display)return;let n=ig(a.font),o=iu(a.padding),l=a.align,h=n.lineHeight/2;"bottom"===s||"center"===s||t0(s)?(h+=o.bottom,tJ(a.text)&&(h+=n.lineHeight*(a.text.length-1))):h+=o.top;let{titleX:d,titleY:c,maxWidth:u,rotation:f}=function(t,e,i,s){let a,r,n,{top:o,left:l,bottom:h,right:d,chart:c}=t,{chartArea:u,scales:f}=c,g=0,p=h-o,m=d-l;if(t.isHorizontal()){if(r=eB(s,l,d),t0(i)){let t=Object.keys(i)[0],s=i[t];n=f[t].getPixelForValue(s)+p-e}else n="center"===i?(u.bottom+u.top)/2+p-e:sX(t,i,e);a=d-l}else{if(t0(i)){let t=Object.keys(i)[0],s=i[t];r=f[t].getPixelForValue(s)-m+e}else r="center"===i?(u.left+u.right)/2-m+e:sX(t,i,e);n=eB(s,h,o),g="left"===i?-eg:eg}return{titleX:r,titleY:n,maxWidth:a,rotation:g}}(this,h,s,l);is(i,a.text,0,0,n,{color:a.color,maxWidth:u,rotation:f,textAlign:(t=eF(l),(r&&"right"!==s||!r&&"right"===s)&&(t="left"===(e=t)?"right":"right"===e?"left":e),t),textBaseline:"middle",translation:[d,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=t5(t.grid&&t.grid.z,-1),s=t5(t.border&&t.border.z,0);return this._isVisible()&&this.draw===s0.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){let e,i,s=this.chart.getSortedVisibleDatasetMetas(),a=this.axis+"AxisID",r=[];for(e=0,i=s.length;e<i;++e){let i=s[e];i[a]!==this.id||t&&i.type!==t||r.push(i)}return r}_resolveTickFontOptions(t){return ig(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class s1{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){var e,i,s,a,r,n;let o,l,h=Object.getPrototypeOf(t);"id"in(e=h)&&"defaults"in e&&(l=this.register(h));let d=this.items,c=t.id,u=this.scope+"."+c;if(!c)throw Error("class does not have id: "+t);return c in d||(d[c]=t,i=t,s=u,a=l,o=ee(Object.create(null),[a?e2.get(a):{},e2.get(s),i.defaults]),e2.set(s,o),i.defaultRoutes&&(r=s,Object.keys(n=i.defaultRoutes).forEach(t=>{let e=t.split("."),i=e.pop(),s=[r].concat(e).join("."),a=n[t].split("."),o=a.pop(),l=a.join(".");e2.route(s,i,l,o)})),i.descriptors&&e2.describe(s,i.descriptors),this.override&&e2.override(t.id,t.overrides)),u}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in e2[s]&&(delete e2[s][i],this.override&&delete eQ[i])}}var s2=new class{constructor(){this.controllers=new s1(sl,"datasets",!0),this.elements=new s1(sG,"elements"),this.plugins=new s1(Object,"plugins"),this.scales=new s1(s0,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}
2removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{let s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):t8(e,e=>{let s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){let s=en(t);t3(i["before"+s],[],i),e[t](i),t3(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(void 0===s)throw Error('"'+t+'" is not a registered '+i+".");return s}};class s5{constructor(){this._init=void 0}notify(t,e,i,s){if("beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;let a=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(a,t,e,i);return"afterDestroy"===e&&(this._notify(a,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,e,i,s){for(let a of(s=s||{},t)){let t=a.plugin;if(!1===t3(t[i],[e,s,a.options],t)&&s.cancelable)return!1}return!0}invalidate(){tQ(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,s=t5(i.options&&i.options.plugins,{}),a=function(t){let e={},i=[],s=Object.keys(s2.plugins.items);for(let t=0;t<s.length;t++)i.push(s2.getPlugin(s[t]));let a=t.plugins||[];for(let t=0;t<a.length;t++){let s=a[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==s||e?function(t,{plugins:e,localIds:i},s,a){let r=[],n=t.getContext();for(let l of e){var o;let e=l.id,h=(o=s[e],a||!1!==o?!0===o?{}:o:null);null!==h&&r.push({plugin:l,options:function(t,{plugin:e,local:i},s,a){let r=t.pluginScopeKeys(e),n=t.getOptionScopes(s,r);return i&&e.defaults&&n.push(e.defaults),t.createResolver(n,a,[""],{scriptable:!1,indexable:!1,allKeys:!0})}(t.config,{plugin:l,local:i[e]},h,n)})}return r}(t,a,s,e):[]}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function s6(t,e){let i=e2.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function s3(t){if("x"===t||"y"===t||"r"===t)return t}function s8(t,...e){if(s3(t))return t;for(let s of e){var i;let e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&s3(t[0].toLowerCase());if(e)return e}throw Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function s4(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function s9(t){let e,i,s,a,r=t.options||(t.options={});r.plugins=t5(r.plugins,{}),e=eQ[t.type]||{scales:{}},i=r.scales||{}
2,s=s6(t.type,r),a=Object.create(null),Object.keys(i).forEach(r=>{let n=i[r];if(!t0(n))return console.error(`Invalid scale configuration for scale: ${r}`);if(n._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let o=s8(r,n,function(t,e){if(e.data&&e.data.datasets){let i=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(i.length)return s4(t,"x",i[0])||s4(t,"y",i[0])}return{}}(r,t),e2.scales[n.type]),l=o===s?"_index_":"_value_",h=e.scales||{};a[r]=ei(Object.create(null),[{axis:o},n,h[o],h[l]])}),t.data.datasets.forEach(e=>{let s=e.type||t.type,n=e.indexAxis||s6(s,r),o=(eQ[s]||{}).scales||{};Object.keys(o).forEach(t=>{let s,r=(s=t,"_index_"===t?s=n:"_value_"===t&&(s="x"===n?"y":"x"),s),l=e[r+"AxisID"]||r;a[l]=a[l]||Object.create(null),ei(a[l],[{axis:r},i[l],o[t]])})}),Object.keys(a).forEach(t=>{let e=a[t];ei(e,[e2.scales[e.type],e2.scale])}),r.scales=a}function s7(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}let at=new Map,ae=new Set;function ai(t,e){let i=at.get(t);return i||(i=e(),at.set(t,i),ae.add(i)),i}let as=(t,e,i)=>{let s=er(e,i);void 0!==s&&t.add(s)};class aa{constructor(t){var e;this._config=((e=(e=t)||{}).data=s7(e.data),s9(e),e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=s7(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),s9(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ai(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ai(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ai(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return ai(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:a}=this,r=this._cachedScopes(t,i),n=r.get(e);if(n)return n;let o=new Set;e.forEach(e=>
2{t&&(o.add(t),e.forEach(e=>as(o,t,e))),e.forEach(t=>as(o,s,t)),e.forEach(t=>as(o,eQ[a]||{},t)),e.forEach(t=>as(o,e2,t)),e.forEach(t=>as(o,eJ,t))});let l=Array.from(o);return 0===l.length&&l.push(Object.create(null)),ae.has(e)&&r.set(e,l),l}chartOptionScopes(){let{options:t,type:e}=this;return[t,eQ[e]||{},e2.datasets[e]||{},{type:e},e2,eJ]}resolveNamedOptions(t,e,i,s=[""]){let a={$shared:!0},{resolver:r,subPrefixes:n}=ar(this._resolverCache,t,s),o=r;if(function(t,e){let{isScriptable:i,isIndexable:s}=i_(t);for(let a of e){let e=i(a),r=s(a),n=(r||e)&&t[a];if(e&&(el(n)||an(n))||r&&tJ(n))return!0}return!1}(r,e)){a.$shared=!1,i=el(i)?i():i;let e=this.createResolver(t,i,n);o=ib(r,i,e)}for(let t of e)a[t]=o[t];return a}createResolver(t,e,i=[""],s){let{resolver:a}=ar(this._resolverCache,t,i);return t0(e)?ib(a,e,void 0,s):a}}function ar(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));let a=i.join(),r=s.get(a);return r||(r={resolver:ix(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},s.set(a,r)),r}let an=t=>t0(t)&&Object.getOwnPropertyNames(t).some(e=>el(t[e])),ao=["top","bottom","left","right","chartArea"];function al(t,e){return"top"===t||"bottom"===t||-1===ao.indexOf(t)&&"x"===e}function ah(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function ad(t){let e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),t3(i&&i.onComplete,[t],e)}function ac(t){let e=t.chart,i=e.options.animation;t3(i&&i.onProgress,[t],e)}function au(t){return iL()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}let af={},ag=t=>{let e=au(t);return Object.values(af).filter(t=>t.canvas===e).pop()};class ap{static defaults=e2;static instances=af;static overrides=eQ;static registry=s2;static version="4.5.1";static getChart=ag;static register(...t){s2.add(...t),am()}static unregister(...t){s2.remove(...t),am()}constructor(t,e){var i,s;let a,r=this.config=new aa(e),n=au(t),o=ag(n);if(o)throw Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let l=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||(!iL()||"u">typeof OffscreenCanvas&&n instanceof OffscreenCanvas?sL:sY)),this.platform.updateConfig(r);let h=this.platform.acquireContext(n,l.aspectRatio),d=h&&h.canvas,c=d&&d.height,u=d&&d.width;if(this.id=tK(),this.ctx=h,this.canvas=d,this.width=u,this.height=c,this._options=l,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new s5,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=(i=t=>this.update(t),s=l.resizeDelay||0,function(...t){return s?(clearTimeout(a),a=setTimeout(i,s,t)):i.apply(this,t),s}),this._dataChanges=[],af[this.id]=this,!h||!d)return void console.error("Failed to create chart: can't acquire context from the given item");i5.listen(this,"complete",ad),i5.listen(this,"progress",ac),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:a}=this;return tQ(t)?e&&a?a:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return s2}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():iW(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return e3(this.canvas,this.ctx),this}stop(){return i5.stop(this),this}resize(t,e){i5.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,s=this.canvas,a=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(s,t,e,a),n=i.devicePixelRatio||this.platform.getDevicePixelRatio(),o=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,iW(this,n,!0)&&(this.notifyPlugins("resize",{size:r}),t3(i.onResize,[this,r],this),this.attached&&this._doResize(o)&&this.render())}ensureScalesHaveIDs(){t8(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{}),a=[];e&&(a=a.concat(Object.keys(e).map(t=>{let i=e[t],s=s8(t,i),a="r"===s,r="x"===s;return{options:i,dposition:a?"chartArea":r?"bottom":"left",dtype:a?"radialLinear":r?"category":"linear"}}))),t8(a,e=>{let a=e.options,r=a.id,n=s8(r,a),o=t5(a.type,e.dtype);(void 0===a.position||al(a.position,n)!==al(e.dposition))&&(a.position=e.dposition),s[r]=!0;let l=null;r in i&&i[r].type===o?l=i[r]:i[(l=new(s2.getScale(o))({id:r,type:o,ctx:this.ctx,
2chart:this})).id]=l,l.init(a,t)}),t8(s,(t,e)=>{t||delete i[e]}),t8(i,t=>{sP.configure(this,t,t.options),sP.addBox(this,t)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(ah("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t,e,i=[],s=this.data.datasets;for(this._removeUnreferencedMetasets(),t=0,e=s.length;t<e;t++){let e=s[t],a=this.getDatasetMeta(t),r=e.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(t),a=this.getDatasetMeta(t)),a.type=r,a.indexAxis=e.indexAxis||s6(r,this.options),a.order=e.order||0,a.index=t,a.label=""+e.label,a.visible=this.isDatasetVisible(t),a.controller)a.controller.updateIndex(t),a.controller.linkScales();else{let e=s2.getController(r),{datasetElementType:s,dataElementType:n}=e2.datasets[r];Object.assign(e,{dataElementType:s2.getElement(n),datasetElementType:s&&s2.getElement(s)}),a.controller=new e(this,t),i.push(a.controller)}}return this._updateMetasets(),i}_resetElements(){t8(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;let a=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,e=this.data.datasets.length;t<e;t++){let{controller:e}=this.getDatasetMeta(t),i=!s&&-1===a.indexOf(e);e.buildOrUpdateElements(i),r=Math.max(+e.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),s||t8(a,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ah("z","_idx"));let{_active:n,_lastEvent:o}=this;o?this._eventHandler(o,!0):n.length&&this._updateHoverStyles(n,n,!0),this.render()}_updateScales(){t8(this.scales,t=>{sP.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options;eh(new Set(Object.keys(this._listeners)),new Set(t.events))&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this;for(let{method:i,start:s,count:a}of this._getUniformDataChanges()||[]){var e="_removeElements"===i?-a:a;for(let i of Object.keys(t)){let a=+i;if(a>=s){let r=t[i];delete t[i],(e>0||a>s)&&(t[a+e]=r)}}}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),s=i(0);for(let t=1;t<e;t++)if(!eh(s,i(t)))return;return Array.from(s).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;sP.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],t8(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,el(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(i5.has(this)?this.attached&&!i5.running(this)&&i5.start(this):(this.draw(),ad({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0||!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e,i,s=this._sortedMetasets,a=[];for(e=0,i=s.length;e<i;++e){let i=s[e];(!t||i.visible)&&a.push(i)}return a}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=i2(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&e7(e,s),t.controller.draw(),s&&it(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return e9(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let a=sy.modes[e];return"function"==typeof a?a(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=im(null,{chart:this,type:"chart"}))}
2getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",a=this.getDatasetMeta(t),r=a.controller._resolveAnimations(void 0,s);eo(e)?(a.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(a,{visible:i}),this.update(e=>e.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),i5.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),e3(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete af[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};t8(this.options.events,t=>i(t,s))}bindResponsiveEvents(){let t;this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,i=this.platform,s=(t,s)=>{i.addEventListener(this,t,s),e[t]=s},a=(t,s)=>{e[t]&&(i.removeEventListener(this,t,s),delete e[t])},r=(t,e)=>{this.canvas&&this.resize(t,e)},n=()=>{a("attach",n),this.attached=!0,this.resize(),s("resize",r),s("detach",t)};t=()=>{this.attached=!1,a("resize",r),this._stop(),this._resize(0,0),s("attach",n)},i.isAttached(this.canvas)?n():t()}unbindEvents(){t8(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},t8(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s,a,r,n=i?"set":"remove";for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+n+"DatasetHoverStyle"](),a=0,r=t.length;a<r;++a){let e=(s=t[a])&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:t,index:e})=>{let i=this.getDatasetMeta(t);if(!i)throw Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}});t4(i,e)||(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,i){let s=this.options.hover,a=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),r=a(e,t),n=i?t:a(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),n.length&&s.mode&&this.updateHoverStyle(n,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;let a=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(a||i.changed)&&this.render(),this}_handleEvent(t,e,i){var s;let{_active:a=[],options:r}=this,n=this._getActiveElements(t,a,i,e),o="mouseup"===t.type||"click"===t.type||"contextmenu"===t.type,l=(s=this._lastEvent,i&&"mouseout"!==t.type?o?s:t:null);i&&(this._lastEvent=null,t3(r.onHover,[t,n,this],this),o&&t3(r.onClick,[t,n,this],this));let h=!t4(n,a);return(h||e)&&(this._active=n,this._updateHoverStyles(n,a,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;let a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,s)}}function am(){return t8(ap.instances,t=>t._plugins.invalidate())}function ax(t,e,i=e){t.lineCap=t5(i.borderCapStyle,e.borderCapStyle),t.setLineDash(t5(i.borderDash,e.borderDash)),t.lineDashOffset=t5(i.borderDashOffset,e.borderDashOffset),t.lineJoin=t5(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=t5(i.borderWidth,e.borderWidth),t.strokeStyle=t5(i.borderColor,e.borderColor)}function ab(t,e,i){t.lineTo(i.x,i.y)}function a_(t,e,i={}){let s=t.length,{start:a=0,end:r=s-1}=i,{start:n,end:o}=e,l=Math.max(a,n),h=Math.min(r,o);return{count:s,start:l,loop:e.loop,ilen:h<l&&!(a<n&&r<n||a>o&&r>o)?s+h-l:h-l}}function ay(t,e,i,s){let a,r,n,{points:o,options:l}=e,{count:h,start:d,loop:c,ilen:u}=a_(o,i,s),f=l.stepped?ie:l.tension||"monotone"===l.cubicInterpolationMode?ii:ab,{move:g=!0,reverse:p}=s||{};for(a=0;a<=u;++a)(r=o[(d+(p?u-a:a))%h]).skip||(g?(t.moveTo(r.x,r.y),g=!1):f(t,n,r,p,l.stepped),n=r);return c&&f(t,n,r=o[(d+(p?u:0))%h],p,l.stepped),!!c}function av(t,e,i,s){let a,r,n,o,l,h,d=e.points,{count:c,start:u,ilen:f}=a_(d,i,s),{move:g=!0,reverse:p}=s||{},m=0,x=0,b=t=>(u+(p?f-t:t))%c,_=()=>{o!==l&&(t.lineTo(m,l),t.lineTo(m,o),t.lineTo(m,h))};for(g&&(r=d[b(0)],t.moveTo(r.x,r.y)),a=0;a<=f;++a){if((r=d[b(a)]).skip)continue;let e=r.x,i=r.y,s=0|e;s===n?(i<o?o=i:i>l&&(l=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),n=s,x=0,o=l=i),h=i}_()}function aw(t){let e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?ay:av}let ak="function"==typeof Path2D;class aM extends sG{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;
2!function(t,e,i,s,a){let r,n,o,l;if(e.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)!function(t,e="x"){let i,s,a,r=iP(e),n=t.length,o=Array(n).fill(0),l=Array(n),h=iD(t,0);for(i=0;i<n;++i)if(s=a,a=h,h=iD(t,i+1),a){if(h){let t=h[e]-a[e];o[i]=0!==t?(h[r]-a[r])/t:0}l[i]=s?h?eb(o[i-1])!==eb(o[i])?0:(o[i-1]+o[i])/2:o[i-1]:o[i]}!function(t,e,i){let s,a,r,n,o,l=t.length,h=iD(t,0);for(let d=0;d<l-1;++d)if(o=h,h=iD(t,d+1),o&&h){if(e_(e[d],0,iS)){i[d]=i[d+1]=0;continue}(n=Math.pow(s=i[d]/e[d],2)+Math.pow(a=i[d+1]/e[d],2))<=9||(r=3/Math.sqrt(n),i[d]=s*r*e[d],i[d+1]=a*r*e[d])}}(t,o,l),function(t,e,i="x"){let s,a,r,n=iP(i),o=t.length,l=iD(t,0);for(let h=0;h<o;++h){if(a=r,r=l,l=iD(t,h+1),!r)continue;let o=r[i],d=r[n];a&&(s=(o-a[i])/3,r[`cp1${i}`]=o-s,r[`cp1${n}`]=d-s*e[h]),l&&(s=(l[i]-o)/3,r[`cp2${i}`]=o+s,r[`cp2${n}`]=d+s*e[h])}}(t,l,e)}(t,a);else{let i=s?t[t.length-1]:t[0];for(r=0,n=t.length;r<n;++r)l=function(t,e,i,s){let a=t.skip?e:t,r=i.skip?e:i,n=eM(e,a),o=eM(r,e),l=n/(n+o),h=o/(n+o);l=isNaN(l)?0:l,h=isNaN(h)?0:h;let d=s*l,c=s*h;return{previous:{x:e.x-d*(r.x-a.x),y:e.y-d*(r.y-a.y)},next:{x:e.x+c*(r.x-a.x),y:e.y+c*(r.y-a.y)}}}(i,o=t[r],t[Math.min(r+1,n-!s)%n],e.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,i=o}e.capBezierPoints&&function(t,e){let i,s,a,r,n,o=e9(t[0],e);for(i=0,s=t.length;i<s;++i)n=r,r=o,o=i<s-1&&e9(t[i+1],e),r&&(a=t[i],n&&(a.cp1x=iO(a.cp1x,e.left,e.right),a.cp1y=iO(a.cp1y,e.top,e.bottom)),o&&(a.cp2x=iO(a.cp2x,e.left,e.right),a.cp2y=iO(a.cp2y,e.top,e.bottom)))}(t,i)}(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){let i=t.points,s=t.options.spanGaps,a=i.length;if(!a)return[];let r=!!t._loop,{start:n,end:o}=function(t,e,i,s){let a=0,r=e-1;if(i&&!s)for(;a<e&&!t[a].skip;)a++;for(;a<e&&t[a].skip;)a++;for(a%=e,i&&(r+=a);r>a&&t[r%e].skip;)r--;return{start:a,end:r%=e}}(i,a,r,s);if(!0===s)return iJ(t,[{start:n,end:o,loop:r}],i,e);let l=o<n?o+a:o,h=!!t._fullLoop&&0===n&&o===a-1;return iJ(t,function(t,e,i,s){let a,r=t.length,n=[],o=e,l=t[e];for(a=e+1;a<=i;++a){let i=t[a%r];i.skip||i.stop?l.skip||(s=!1,n.push({start:e%r,end:(a-1)%r,loop:s}),e=o=i.stop?a:null):(o=a,l.skip&&(e=a)),l=i}return null!==o&&n.push({start:e%r,end:o%r,loop:s}),n}(i,n,l,h),i,e)}(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i,s,a=this.options,r=t[e],n=this.points,o=iQ(this,{property:e,start:r,end:r});if(!o.length)return;let l=[],h=a.stepped?iN:a.tension||"monotone"===a.cubicInterpolationMode?iU:i$;for(i=0,s=o.length;i<s;++i){let{start:s,end:d}=o[i],c=n[s],u=n[d];if(c===u){l.push(c);continue}let f=Math.abs((r-c[e])/(u[e]-c[e])),g=h(c,u,f,a.stepped);g[e]=t[e],l.push(g)}return 1===l.length?l[0]:l}pathSegment(t,e,i){return aw(this)(t,this,e,i)}path(t,e,i){let s=this.segments,a=aw(this),r=this._loop;for(let n of(e=e||0,i=i||this.points.length-e,s))r&=a(t,this,n,{start:e,end:e+i-1});return!!r}draw(t,e,i,s){let a=this.options||{};(this.points||[]).length&&a.borderWidth&&(t.save(),function(t,e,i,s){if(ak&&!e.options.segment){let a;(a=e._path)||(a=e._path=new Path2D,e.path(a,i,s)&&a.closePath()),ax(t,e.options),t.stroke(a)}else!function(t,e,i,s){let{segments:a,options:r}=e,n=aw(e);for(let o of a)ax(t,r,o.style),t.beginPath(),n(t,e,o,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function aT(t,e,i,s){let a=t.options,{[i]:r}=t.getProps([i],s);return Math.abs(e-r)<a.radius+a.hitRadius}function aC(t,e){let i,s,a,r,n,{x:o,y:l,base:h,width:d,height:c}=t.getProps(["x","y","base","width","height"],e);return t.horizontal?(n=c/2,i=Math.min(o,h),s=Math.max(o,h),a=l-n,r=l+n):(i=o-(n=d/2),s=o+n,a=Math.min(l,h),r=Math.max(l,h)),{left:i,top:a,right:s,bottom:r}}function aj(t,e,i,s){return t?0:eS(e,i,s)}function aS(t,e,i,s){let a=null===e,r=null===i,n=t&&!(a&&r)&&aC(t,s);return n&&(a||eD(e,n.left,n.right))&&(r||eD(i,n.top,n.bottom))}function aD(t,e){t.rect(e.x,e.y,e.w,e.h)}function aP(t,e,i={}){let s=t.x!==i.x?-e:0,a=t.y!==i.y?-e:0,r=(t.x+t.w!==i.x+i.w?e:0)-s,n=(t.y+t.h!==i.y+i.h?e:0)-a;
2return{x:t.x+s,y:t.y+a,w:t.w+r,h:t.h+n,radius:t.radius}}let aO=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],aL=aO.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")),aA=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class az extends sG{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=t3(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let t,e,{options:i,ctx:s}=this;if(!i.display){this.width=this.height=0;return}let a=i.labels,r=ig(a.font),n=r.size,o=this._computeTitleHeight(),{boxWidth:l,itemHeight:h}=aA(a,n);s.font=r.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(o,n,l,h)+10):(e=this.maxHeight,t=this._fitCols(o,r,l,h)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){let{ctx:a,maxWidth:r,options:{labels:{padding:n}}}=this,o=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+n,d=t;a.textAlign="left",a.textBaseline="middle";let c=-1,u=-h;return this.legendItems.forEach((t,f)=>{let g=i+e/2+a.measureText(t.text).width;(0===f||l[l.length-1]+g+2*n>r)&&(d+=h,l[l.length-(f>0?0:1)]=0,u+=h,c++),o[f]={left:0,top:u,row:c,width:g,height:s},l[l.length-1]+=g+n}),d}_fitCols(t,e,i,s){let{ctx:a,maxHeight:r,options:{labels:{padding:n}}}=this,o=this.legendHitBoxes=[],l=this.columnSizes=[],h=r-t,d=n,c=0,u=0,f=0,g=0;return this.legendItems.forEach((t,r)=>{var p,m,x,b,_,y,v,w,k,M,T,C;let j,S,{itemWidth:D,itemHeight:P}=(p=i,m=e,x=a,b=t,_=s,{itemWidth:(y=b,v=p,w=m,k=x,(j=y.text)&&"string"!=typeof j&&(j=j.reduce((t,e)=>t.length>e.length?t:e)),v+w.size/2+k.measureText(j).width),itemHeight:(M=_,T=b,C=m.lineHeight,S=M,"string"!=typeof T.text&&(S=aE(T,C)),S)});r>0&&u+P+2*n>h&&(d+=c+n,l.push({width:c,height:u}),f+=c+n,g++,c=u=0),o[r]={left:f,top:u,col:g,width:D,height:P},c=Math.max(c,D),u+=P+n}),d+=c,l.push({width:c,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:a}}=this,r=iY(a,this.left,this.width);if(this.isHorizontal()){let a=0,n=eB(i,this.left+s,this.right-this.lineWidths[a]);for(let o of e)a!==o.row&&(a=o.row,n=eB(i,this.left+s,this.right-this.lineWidths[a])),o.top+=this.top+t+s,o.left=r.leftForLtr(r.x(n),o.width),n+=o.width+s}else{let a=0,n=eB(i,this.top+t+s,this.bottom-this.columnSizes[a].height);
2for(let o of e)o.col!==a&&(a=o.col,n=eB(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),o.top=n,o.left+=this.left+s,o.left=r.leftForLtr(r.x(o.left),o.width),n+=o.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){let t=this.ctx;e7(t,this),this._draw(),it(t)}}_draw(){let t,{options:e,columnSizes:i,lineWidths:s,ctx:a}=this,{align:r,labels:n}=e,o=e2.color,l=iY(e.rtl,this.left,this.width),h=ig(n.font),{padding:d}=n,c=h.size,u=c/2;this.drawTitle(),a.textAlign=l.textAlign("left"),a.textBaseline="middle",a.lineWidth=.5,a.font=h.string;let{boxWidth:f,boxHeight:g,itemHeight:p}=aA(n,c),m=function(t,e,i){if(isNaN(f)||f<=0||isNaN(g)||g<0)return;a.save();let s=t5(i.lineWidth,1);if(a.fillStyle=t5(i.fillStyle,o),a.lineCap=t5(i.lineCap,"butt"),a.lineDashOffset=t5(i.lineDashOffset,0),a.lineJoin=t5(i.lineJoin,"miter"),a.lineWidth=s,a.strokeStyle=t5(i.strokeStyle,o),a.setLineDash(t5(i.lineDash,[])),n.usePointStyle)e4(a,{radius:g*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:s},l.xPlus(t,f/2),e+u,n.pointStyleWidth&&f);else{let r=e+Math.max((c-g)/2,0),n=l.leftForLtr(t,f),o=ic(i.borderRadius);a.beginPath(),Object.values(o).some(t=>0!==t)?ia(a,{x:n,y:r,w:f,h:g,radius:o}):a.rect(n,r,f,g),a.fill(),0!==s&&a.stroke()}a.restore()},x=function(t,e,i){is(a,i.text,t,e+p/2,h,{strikethrough:i.hidden,textAlign:l.textAlign(i.textAlign)})},b=this.isHorizontal(),_=this._computeTitleHeight();t=b?{x:eB(r,this.left+d,this.right-s[0]),y:this.top+d+_,line:0}:{x:this.left+d,y:eB(r,this.top+_+d,this.bottom-i[0].height),line:0},iG(this.ctx,e.textDirection);let y=p+d;this.legendItems.forEach((o,c)=>{var g,p;a.strokeStyle=o.fontColor,a.fillStyle=o.fontColor;let v=a.measureText(o.text).width,w=l.textAlign(o.textAlign||(o.textAlign=n.textAlign)),k=f+u+v,M=t.x,T=t.y;if(l.setWidth(this.width),b?c>0&&M+k+d>this.right&&(T=t.y+=y,t.line++,M=t.x=eB(r,this.left+d,this.right-s[t.line])):c>0&&T+y>this.bottom&&(M=t.x=M+i[t.line].width+d,t.line++,T=t.y=eB(r,this.top+_+d,this.bottom-i[t.line].height)),m(l.x(M),T,o),g=M+f+u,p=b?M+k:this.right,M=w===(e.rtl?"left":"right")?p:"center"===w?(g+p)/2:g,x(l.x(M),T,o),b)t.x+=k+d;else if("string"!=typeof o.text){let e=h.lineHeight;t.y+=aE(o,e)+d}else t.y+=y}),iq(this.ctx,e.textDirection)}drawTitle(){let t,e=this.options,i=e.title,s=ig(i.font),a=iu(i.padding);if(!i.display)return;let r=iY(e.rtl,this.left,this.width),n=this.ctx,o=i.position,l=s.size/2,h=a.top+l,d=this.left,c=this.width;if(this.isHorizontal())c=Math.max(...this.lineWidths),t=this.top+h,d=eB(e.align,d,this.right-c);else{let i=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);t=h+eB(e.align,this.top,this.bottom-i-e.labels.padding-this._computeTitleHeight())}let u=eB(o,d,d+c);n.textAlign=r.textAlign(eF(o)),n.textBaseline="middle",n.strokeStyle=i.color,n.fillStyle=i.color,n.font=s.string,is(n,i.text,u,t,s)}_computeTitleHeight(){let t=this.options.title,e=ig(t.font),i=iu(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,a;if(eD(t,this.left,this.right)&&eD(e,this.top,this.bottom)){for(a=this.legendHitBoxes,i=0;i<a.length;++i)if(eD(t,(s=a[i]).left,s.left+s.width)&&eD(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){var e,i;let s=this.options;if(e=t.type,i=s,("mousemove"!==e&&"mouseout"!==e||!i.onHover&&!i.onLeave)&&(!i.onClick||"click"!==e&&"mouseup"!==e))return;let a=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){let e=this._hoveredItem,i=null!==e&&null!==a&&e.datasetIndex===a.datasetIndex&&e.index===a.index;e&&!i&&t3(s.onLeave,[t,e,this],this),this._hoveredItem=a,a&&!i&&t3(s.onHover,[t,a,this],this)}else a&&t3(s.onClick,[t,a,this],this)}}function aE(t,e){return e*(t.text?t.text.length:0)}new WeakMap;let aR={average(t){let e,i;if(!t.length)return!1;let s=new Set,a=0,r=0;for(e=0,i=t.length;e<i;++e){let i=t[e].element;if(i&&i.hasValue()){let t=i.tooltipPosition();s.add(t.x),a+=t.y,++r}}return 0!==r&&0!==s.size&&{x:[...s].reduce((t,e)=>t+e)/s.size,y:a/r}},nearest(t,e){let i,s,a;if(!t.length)return!1;let r=e.x,n=e.y,o=1/0;for(i=0,s=t.length;i<s;++i){let s=t[i].element;if(s&&s.hasValue()){let t=eM(e,s.getCenterPoint());t<o&&(o=t,a=s)}}if(a){let t=a.tooltipPosition();r=t.x,n=t.y}return{x:r,y:n}}};function aI(t,e){return e&&(tJ(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function aF(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function aB(t,e){let i=t.chart.ctx,{body:s,footer:a,title:r}=t,{boxWidth:n,boxHeight:o}=e,l=ig(e.bodyFont),h=ig(e.titleFont),d=ig(e.footerFont),c=r.length,u=a.length,f=s.length,g=iu(e.padding),p=g.height,m=0,x=s.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);x+=t.beforeBody.length+t.afterBody.length,c&&(p+=c*h.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),x&&(p+=f*(e.displayColors?Math.max(o,l.lineHeight):l.lineHeight)+(x-f)*l.lineHeight+(x-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*d.lineHeight+(u-1)*e.footerSpacing);let b=0,_=function(t){m=Math.max(m,i.measureText(t).width+b)};return i.save(),i.font=h.string,t8(t.title,_),i.font=l.string,t8(t.beforeBody.concat(t.afterBody),_),b=e.dis
2playColors?n+2+e.boxPadding:0,t8(s,t=>{t8(t.before,_),t8(t.lines,_),t8(t.after,_)}),b=0,i.font=d.string,t8(t.footer,_),i.restore(),{width:m+=g.width,height:p}}function aW(t,e,i){let s=i.yAlign||e.yAlign||function(t,e){let{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||function(t,e,i,s){let{x:a,width:r}=i,{width:n,chartArea:{left:o,right:l}}=t,h="center";return"center"===s?h=a<=(o+l)/2?"left":"right":a<=r/2?h="left":a>=n-r/2&&(h="right"),function(t,e,i,s){let{x:a,width:r}=s,n=i.caretSize+i.caretPadding;if("left"===t&&a+r+n>e.width||"right"===t&&a-r-n<0)return!0}(h,t,e,i)&&(h="center"),h}(t,e,i,s),yAlign:s}}function aH(t,e,i,s){let{caretSize:a,caretPadding:r,cornerRadius:n}=t,{xAlign:o,yAlign:l}=i,h=a+r,{topLeft:d,topRight:c,bottomLeft:u,bottomRight:f}=ic(n),g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,o),p=function(t,e,i){let{y:s,height:a}=t;return"top"===e?s+=i:"bottom"===e?s-=a+i:s-=a/2,s}(e,l,h);return"center"===l?"left"===o?g+=h:"right"===o&&(g-=h):"left"===o?g-=Math.max(d,u)+a:"right"===o&&(g+=Math.max(c,f)+a),{x:eS(g,0,s.width-e.width),y:eS(p,0,s.height-e.height)}}function aV(t,e,i){let s=iu(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function a$(t,e){let i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}let aN={beforeTitle:tZ,title(t){if(t.length>0){let e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:tZ,beforeBody:tZ,beforeLabel:tZ,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");let i=t.formattedValue;return tQ(i)||(e+=i),e},labelColor(t){let e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){let e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:tZ,afterBody:tZ,beforeFooter:tZ,footer:tZ,afterFooter:tZ};function aU(t,e,i,s){let a=t[e].call(i,s);return void 0===a?aN[e].call(i,s):a}class aY extends sG{static positioners=aR;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,a=new i4(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){var t;return this.$context||(this.$context=(t=this.chart.getContext(),im(t,{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"})))}getTitle(t,e){let{callbacks:i}=e,s=aU(i,"beforeTitle",this,t),a=aU(i,"title",this,t),r=aU(i,"afterTitle",this,t),n=[];return n=aI(n,aF(s)),n=aI(n,aF(a)),n=aI(n,aF(r))}getBeforeBody(t,e){return aI([],aF(aU(e.callbacks,"beforeBody",this,t)))}getBody(t,e){let{callbacks:i}=e,s=[];return t8(t,t=>{let e={before:[],lines:[],after:[]},a=a$(i,t);aI(e.before,aF(aU(a,"beforeLabel",this,t))),aI(e.lines,aU(a,"label",this,t)),aI(e.after,aF(aU(a,"afterLabel",this,t))),s.push(e)}),s}getAfterBody(t,e){return aI([],aF(aU(e.callbacks,"afterBody",this,t)))}getFooter(t,e){let{callbacks:i}=e,s=aU(i,"beforeFooter",this,t),a=aU(i,"footer",this,t),r=aU(i,"afterFooter",this,t),n=[];return n=aI(n,aF(s)),n=aI(n,aF(a)),n=aI(n,aF(r))}_createItems(t){let e,i,s=this._active,a=this.chart.data,r=[],n=[],o=[],l=[];for(e=0,i=s.length;e<i;++e)l.push(function(t,e){let{element:i,datasetIndex:s,index:a}=e,r=t.getDatasetMeta(s).controller,{label:n,value:o}=r.getLabelAndValue(a);return{chart:t,label:n,parsed:r.getParsed(a),raw:t.data.datasets[s].data[a],formattedValue:o,dataset:r.getDataset(),dataIndex:a,datasetIndex:s,element:i}}(this.chart,s[e]));return t.filter&&(l=l.filter((e,i,s)=>t.filter(e,i,s,a))),t.itemSort&&(l=l.sort((e,i)=>t.itemSort(e,i,a))),t8(l,e=>{let i=a$(t.callbacks,e);r.push(aU(i,"labelColor",this,e)),n.push(aU(i,"labelPointStyle",this,e)),o.push(aU(i,"labelTextColor",this,e))}),this.labelColors=r,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){let i,s=this.options.setContext(this.getContext()),a=this._active,r=[];if(a.length){let t=aR[s.position].call(this,a,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);let e=this._size=aB(this,s),n=Object.assign({},t,e),o=aW(this.chart,s,n),l=aH(s,n,o,this.chart);this.xAlign=o.xAlign,this.yAlign=o.yAlign,i={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(i={opacity:0}
2);this._tooltipItems=r,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let a=this.getCaretPosition(t,i,s);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){let s,a,r,n,o,l,{xAlign:h,yAlign:d}=this,{caretSize:c,cornerRadius:u}=i,{topLeft:f,topRight:g,bottomLeft:p,bottomRight:m}=ic(u),{x:x,y:b}=t,{width:_,height:y}=e;return"center"===d?(o=b+y/2,"left"===h?(a=(s=x)-c,n=o+c,l=o-c):(a=(s=x+_)+c,n=o-c,l=o+c),r=s):(a="left"===h?x+Math.max(f,p)+c:"right"===h?x+_-Math.max(g,m)-c:this.caretX,"top"===d?(o=(n=b)-c,s=a-c,r=a+c):(o=(n=b+y)+c,s=a+c,r=a-c),l=n),{x1:s,x2:a,x3:r,y1:n,y2:o,y3:l}}drawTitle(t,e,i){let s,a,r,n=this.title,o=n.length;if(o){let l=iY(i.rtl,this.x,this.width);for(t.x=aV(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=ig(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+a,r+1===o&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,a){let r=this.labelColors[i],n=this.labelPointStyles[i],{boxHeight:o,boxWidth:l}=a,h=ig(a.bodyFont),d=aV(this,"left",a),c=s.x(d),u=o<h.lineHeight?(h.lineHeight-o)/2:0,f=e.y+u;if(a.usePointStyle){let e={radius:Math.min(l,o)/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:1},i=s.leftForLtr(c,l)+l/2,h=f+o/2;t.strokeStyle=a.multiKeyBackground,t.fillStyle=a.multiKeyBackground,e8(t,e,i,h),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,e8(t,e,i,h)}else{t.lineWidth=t0(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let e=s.leftForLtr(c,l),i=s.leftForLtr(s.xPlus(c,1),l-2),n=ic(r.borderRadius);Object.values(n).some(t=>0!==t)?(t.beginPath(),t.fillStyle=a.multiKeyBackground,ia(t,{x:e,y:f,w:l,h:o,radius:n}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),ia(t,{x:i,y:f+1,w:l-2,h:o-2,radius:n}),t.fill()):(t.fillStyle=a.multiKeyBackground,t.fillRect(e,f,l,o),t.strokeRect(e,f,l,o),t.fillStyle=r.backgroundColor,t.fillRect(i,f+1,l-2,o-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let s,a,r,n,o,l,{body:h}=this,{bodySpacing:d,bodyAlign:c,displayColors:u,boxHeight:f,boxWidth:g,boxPadding:p}=i,m=ig(i.bodyFont),x=m.lineHeight,b=0,_=iY(i.rtl,this.x,this.width),y=function(i){e.fillText(i,_.x(t.x+b),t.y+x/2),t.y+=x+d},v=_.textAlign(c);for(e.textAlign=c,e.textBaseline="middle",e.font=m.string,t.x=aV(this,v,i),e.fillStyle=i.bodyColor,t8(this.beforeBody,y),b=u&&"right"!==v?"center"===c?g/2+p:g+2+p:0,r=0,o=h.length;r<o;++r){for(s=h[r],e.fillStyle=this.labelTextColors[r],t8(s.before,y),a=s.lines,u&&a.length&&(this._drawColorBox(e,t,r,_,i),x=Math.max(m.lineHeight,f)),n=0,l=a.length;n<l;++n)y(a[n]),x=m.lineHeight;t8(s.after,y)}b=0,x=m.lineHeight,t8(this.afterBody,y),t.y-=d}drawFooter(t,e,i){let s,a,r=this.footer,n=r.length;if(n){let o=iY(i.rtl,this.x,this.width);for(t.x=aV(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=o.textAlign(i.footerAlign),e.textBaseline="middle",s=ig(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,a=0;a<n;++a)e.fillText(r[a],o.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){let{xAlign:a,yAlign:r}=this,{x:n,y:o}=t,{width:l,height:h}=i,{topLeft:d,topRight:c,bottomLeft:u,bottomRight:f}=ic(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(n+d,o),"top"===r&&this.drawCaret(t,e,i,s),e.lineTo(n+l-c,o),e.quadraticCurveTo(n+l,o,n+l,o+c),"center"===r&&"right"===a&&this.drawCaret(t,e,i,s),e.lineTo(n+l,o+h-f),e.quadraticCurveTo(n+l,o+h,n+l-f,o+h),"bottom"===r&&this.drawCaret(t,e,i,s),e.lineTo(n+u,o+h),e.quadraticCurveTo(n,o+h,n,o+h-u),"center"===r&&"left"===a&&this.drawCaret(t,e,i,s),e.lineTo(n,o+d),e.quadraticCurveTo(n,o,n+d,o),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){let i=aR[t.position].call(this,this._active,this._eventPosition);if(!i)return;let r=this._size=aB(this,t),n=Object.assign({},i,this._size),o=aW(e,t,n),l=aH(t,n,o,e);
2(s._to!==l.x||a._to!==l.y)&&(this.xAlign=o.xAlign,this.yAlign=o.yAlign,this.width=r.width,this.height=r.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},a={x:this.x,y:this.y};i=.001>Math.abs(i)?0:i;let r=iu(e.padding),n=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&n&&(t.save(),t.globalAlpha=i,this.drawBackground(a,t,s,e),iG(t,e.textDirection),a.y+=r.top,this.drawTitle(a,t,e),this.drawBody(a,t,e),this.drawFooter(a,t,e),iq(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,s=t.map(({datasetIndex:t,index:e})=>{let i=this.chart.getDatasetMeta(t);if(!i)throw Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),a=!t4(i,s),r=this._positionChanged(s,e);(a||r)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,a=this._active||[],r=this._getActiveElements(t,a,e,i),n=this._positionChanged(r,t),o=e||!t4(r,a)||n;return o&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),o}_getActiveElements(t,e,i,s){let a=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));let r=this.chart.getElementsAtEventForMode(t,a.mode,a,i);return a.reverse&&r.reverse(),r}_positionChanged(t,e){let{caretX:i,caretY:s,options:a}=this,r=aR[a.position].call(this,t,e);return!1!==r&&(i!==r.x||s!==r.y)}}function aG(t){let e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function aq(t,e,{horizontal:i,minRotation:s}){let a=ew(s),r=(i?Math.sin(a):Math.cos(a))||.001,n=.75*e*(""+t).length;return Math.min(e/r,n)}class aX extends s0{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return tQ(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:a}=this,r=t=>s=e?s:t,n=t=>a=i?a:t;if(t){let t=eb(s),e=eb(a);t<0&&e<0?n(0):t>0&&e>0&&r(0)}if(s===a){let e=0===a?1:Math.abs(.05*a);n(a+e),t||r(s-e)}this.min=s,this.max=a}getTickLimit(){let t,{maxTicksLimit:e,stepSize:i}=this.options.ticks;return i?(t=Math.ceil(this.max/i)-Math.floor(this.min/i)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3):(t=this.computeTickLimit(),e=e||11),e&&(t=Math.min(e,t)),t}computeTickLimit(){return 1/0}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit(),s=function(t,e){var i,s;let a,r,n,o,l,h=[],{bounds:d,step:c,min:u,max:f,precision:g,count:p,maxTicks:m,maxDigits:x,includeBounds:b}=t,_=c||1,y=m-1,{min:v,max:w}=e,k=!tQ(u),M=!tQ(f),T=!tQ(p),C=(w-v)/(x+1),j=ey((w-v)/y/_)*_;if(j<1e-14&&!k&&!M)return[{value:v},{value:w}];(o=Math.ceil(w/j)-Math.floor(v/j))>y&&(j=ey(o*j/y/_)*_),tQ(g)||(j=Math.ceil(j*(a=Math.pow(10,g)))/a),"ticks"===d?(r=Math.floor(v/j)*j,n=Math.ceil(w/j)*j):(r=v,n=w),k&&M&&c&&(i=(f-u)/c,s=j/1e3,(l=Math.round(i))-s<=i&&l+s>=i)?(o=Math.round(Math.min((f-u)/j,m)),j=(f-u)/o,r=u,n=f):T?(r=k?u:r,j=((n=M?f:n)-r)/(o=p-1)):o=e_(o=(n-r)/j,Math.round(o),j/1e3)?Math.round(o):Math.ceil(o);let S=Math.max(ek(j),ek(r));r=Math.round(r*(a=Math.pow(10,tQ(g)?S:g)))/a,n=Math.round(n*a)/a;let D=0;for(k&&(b&&r!==u?(h.push({value:u}),r<u&&D++,e_(Math.round((r+D*j)*a)/a,u,aq(u,C,t))&&D++):r<u&&D++);D<o;++D){let t=Math.round((r+D*j)*a)/a;if(M&&t>f)break;h.push({value:t})}return M&&b&&n!==f?h.length&&e_(h[h.length-1].value,f,aq(f,C,t))?h[h.length-1].value=f:h.push({value:f}):M&&n!==f||h.push({value:n}),h}({maxTicks:i=Math.max(2,i),bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);
2return"ticks"===t.bounds&&function(t,e,i){let s,a,r;for(s=0,a=t.length;s<a;s++)isNaN(r=t[s][i])||(e.min=Math.min(e.min,r),e.max=Math.max(e.max,r))}(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return eZ(t,this.chart.options.locale,this.options.ticks.format)}}class aZ extends aX{static id="linear";static defaults={ticks:{callback:eK.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=t1(t)?t:0,this.max=t1(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=ew(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001;return Math.ceil(e/Math.min(40,this._resolveTickFontOptions(0).lineHeight/s))}getPixelForValue(t){return null===t?0/0:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}eK.logarithmic;eK.numeric;let aK={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},aQ=Object.keys(aK);function aJ(t,e){return t-e}function a0(t,e){if(tQ(e))return null;let i=t._adapter,{parser:s,round:a,isoWeekday:r}=t._parseOpts,n=e;return("function"==typeof s&&(n=s(n)),t1(n)||(n="string"==typeof s?i.parse(n,s):i.parse(n)),null===n)?null:(a&&(n="week"===a&&(ev(r)||!0===r)?i.startOf(n,"isoWeek",r):i.startOf(n,a)),+n)}function a1(t,e,i,s){let a=aQ.length;for(let r=aQ.indexOf(t);r<a-1;++r){let t=aK[aQ[r]],a=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(a*t.size))<=s)return aQ[r]}return aQ[a-1]}function a2(t,e,i){if(i){if(i.length){let{lo:s,hi:a}=eP(i,e);t[i[s]>=e?i[s]:i[a]]=!0}}else t[e]=!0}function a5(t,e,i){let s,a,r=[],n={},o=e.length;for(s=0;s<o;++s)n[a=e[s]]=s,r.push({value:a,major:!1});return 0!==o&&i?function(t,e,i,s){let a,r,n=t._adapter,o=+n.startOf(e[0].value,s),l=e[e.length-1].value;for(a=o;a<=l;a=+n.add(a,1,s))(r=i[a])>=0&&(e[r].major=!0);return e}(t,r,n,i):r}(class t extends s0{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),s=this._adapter=new sp(t.adapters.date);s.init(e),ei(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:a0(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:s,max:a,minDefined:r,maxDefined:n}=this.getUserBounds();function o(t){r||isNaN(t.min)||(s=Math.min(s,t.min)),n||isNaN(t.max)||(a=Math.max(a,t.max))}r&&n||(o(this._getLabelBounds()),("ticks"!==t.bounds||"labels"!==t.ticks.source)&&o(this.getMinMax(!1))),s=t1(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),a=t1(a)&&!isNaN(a)?a:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,a-1),this.max=Math.max(s+1,a)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=1/0,i=-1/0;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let a=this.min,r=function(t,e,i){let s=0,a=t.length;for(;s<a&&t[s]<e;)s++;for(;a>s&&t[a-1]>i;)a--;return s>0||a<t.length?t.slice(s,a):t}(s,a,this.max);return this._unit=e.unit||(i.autoSkip?a1(e.minUnit,this.min,this.max,this._getLabelCapacity(a)):function(t,e,
2i,s,a){for(let r=aQ.length-1;r>=aQ.indexOf(i);r--){let i=aQ[r];if(aK[i].common&&t._adapter.diff(a,s,i)>=e-1)return i}return aQ[i?aQ.indexOf(i):0]}(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=aQ.indexOf(t)+1,i=aQ.length;e<i;++e)if(aK[aQ[e]].common)return aQ[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&r.reverse(),a5(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e,i,s=0,a=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),a=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;s=eS(s,0,r),a=eS(a,0,r),this._offsets={start:s,end:a,factor:1/(s+1+a)}}_generate(){let t,e,i=this._adapter,s=this.min,a=this.max,r=this.options,n=r.time,o=n.unit||a1(n.minUnit,s,a,this._getLabelCapacity(s)),l=t5(r.ticks.stepSize,1),h="week"===o&&n.isoWeekday,d=ev(h)||!0===h,c={},u=s;if(d&&(u=+i.startOf(u,"isoWeek",h)),u=+i.startOf(u,d?"day":o),i.diff(a,s,o)>1e5*l)throw Error(s+" and "+a+" are too far apart with stepSize of "+l+" "+o);let f="data"===r.ticks.source&&this.getDataTimestamps();for(t=u,e=0;t<a;t=+i.add(t,l,o),e++)a2(c,t,f);return(t===a||"ticks"===r.bounds||1===e)&&a2(c,t,f),Object.keys(c).sort(aJ).map(t=>+t)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let i=this.options.time.displayFormats,s=this._unit,a=e||i[s];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){let a=this.options,r=a.ticks.callback;if(r)return t3(r,[t,e,i],this);let n=a.time.displayFormats,o=this._unit,l=this._majorUnit,h=o&&n[o],d=l&&n[l],c=i[e],u=l&&d&&c&&c.major;return this._adapter.format(t,s||(u?d:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)(s=t[e]).label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?0/0:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,s=ew(this.isHorizontal()?e.maxRotation:e.minRotation),a=Math.cos(s),r=Math.sin(s),n=this._resolveTickFontOptions(0).size;return{w:i*a+n*r,h:i*r+n*a}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,a=this._tickFormatFunction(t,0,a5(this,[t],this._majorUnit),s),r=this._getLabelSize(a),n=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return n>0?n:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){let t,e,i=this._cache.labels||[];if(i.length)return i;let s=this.getLabels();for(t=0,e=s.length;t<e;++t)i.push(a0(this,s[t]));return this._cache.labels=this._normalized?i:this.normalize(i)}normalize(t){return eE(t.sort(aJ))}}).defaults;let a6="label";function a3(t,e){"function"==typeof t?t(e):t&&(t.current=e)}function a8(t,e,i=a6){let s=[];t.datasets=e.map(e=>{let a=t.datasets.find(t=>t[i]===e[i]);return!a||!e.data||s.includes(a)?{...e}:(s.push(a),Object.assign(a,e),a)})}let a4=(0,l.forwardRef)(function(t,e){let{height:i=150,width:a=300,redraw:r=!1,datasetIdKey:n,type:o,data:h,options:d,plugins:c=[],fallbackContent:u,updateMode:f,...g}=t,p=(0,l.useRef)(null),m=(0,l.useRef)(null),x=()=>{p.current&&(m.current=new ap(p.current,{type:o,data:function(t,e=a6){let i={labels:[],datasets:[]};return i.labels=t.labels,a8(i,t.datasets,e),i}(h,n),options:d&&{...d},plugins:c}),a3(e,m.current))},b=()=>{a3(e,null),m.current&&(m.current.destroy(),m.current=null)};return(0,l.useEffect)(()=>{var t;let e;!r&&m.current&&d&&(t=m.current,(e=t.options)&&d&&Object.assign(e,d))},[r,d]),(0,l.useEffect)(()=>{!r&&m.current&&(m.current.config.data.labels=h.labels)},[r,h.labels]),(0,l.useEffect)(()=>{!r&&m.current&&h.datasets&&a8(m.current.config.data,h.datasets,n)},[r,h.datasets]),(0,l.useEffect)(()=>{m.current&&(r?(b(),setTimeout(x)):m.current.update(f))},[r,d,h.labels,h.datasets,f]),(0,l.useEffect)(()=>{m.current&&(b(),setTimeout(x))}
2,[o]),(0,l.useEffect)(()=>(x(),()=>b()),[]),(0,s.jsx)("canvas",{ref:p,role:"img",height:i,width:a,...g,children:u})});var a9=t.i(30440);ap.register(class extends s0{static id="category";static defaults={ticks:{callback:aG}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let t=this.getLabels();for(let{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){let i,s;if(tQ(t))return null;let a=this.getLabels();return i=e=isFinite(e)&&a[e]===t?e:function(t,e,i,s){let a=t.indexOf(e);if(-1===a){var r;return r=i,"string"==typeof e?(r=t.push(e)-1,s.unshift({index:r,label:e})):isNaN(e)&&(r=null),r}return a!==t.lastIndexOf(e)?i:a}(a,t,t5(e,t),this._addedLabels),s=a.length-1,null===i?null:eS(Math.round(i),0,s)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,s=[],a=this.getLabels();a=0===t&&e===a.length-1?a:a.slice(t,e+1),this._valueRange=Math.max(a.length-!i,1),this._startValue=this.min-.5*!!i;for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return aG.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?0/0:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},aZ,class extends sl{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return sd(t,e,i,s)}parseArrayData(t,e,i,s){return sd(t,e,i,s)}parseObjectData(t,e,i,s){let a,r,n,o,{iScale:l,vScale:h}=t,{xAxisKey:d="x",yAxisKey:c="y"}=this._parsing,u="x"===l.axis?d:c,f="x"===h.axis?d:c,g=[];for(a=i,r=i+s;a<r;++a)o=e[a],(n={})[l.axis]=l.parse(er(o,u),a),g.push(sh(er(o,f),n,h,a));return g}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let a=i._custom;a&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,a.min),t.max=Math.max(t.max,a.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let{iScale:e,vScale:i}=this._cachedMeta,s=this.getParsed(t),a=s._custom,r=sc(a)?"["+a.start+", "+a.end+"]":""+i.getLabelForValue(s[i.axis]);return{label:""+e.getLabelForValue(s[e.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){let a="reset"===s,{index:r,_cachedMeta:{vScale:n}}=this,o=n.getBasePixel(),l=n.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:c}=this._getSharedOptions(e,s);for(let u=e;u<e+i;u++){let e=this.getParsed(u),i=a||tQ(e[n.axis])?{base:o,head:o}:this._calculateBarValuePixels(u),f=this._calculateBarIndexPixels(u,h),g=(e._stacks||{})[n.axis],p={horizontal:l,base:i.base,enableBorderRadius:!g||sc(e._custom)||r===g._top||r===g._bottom,x:l?i.head:f.center,y:l?f.center:i.head,height:l?f.size:Math.abs(i.size),width:l?Math.abs(i.size):f.size};c&&(p.options=d||this.resolveDataElementOptions(u,t[u].active?"active":s));let m=p.options||t[u].options;!function(t,e,i,s){let a,r,n,o,l,h=e.borderSkipped,d={};if(!h){t.borderSkipped=d;return}if(!0===h){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:c,end:u,reverse:f,top:g,bottom:p}=(t.horizontal?(a=t.base>t.x,r="left",n="right"):(a=t.base<t.y,r="bottom",n="top"),a?(o="end",l="start"):(o="start",l="end"),{start:r,end:n,reverse:a,top:o,bottom:l});"middle"===h&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?h=g:(i._bottom||0)===s?h=p:(d[su(p,c,u,f)]=!0,h=g)),d[su(h,c,u,f)]=!0,t.borderSkipped=d}
2(p,m,g,r),function(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?.33*(1===i):e}(p,m,h.ratio),this.updateElement(t[u],u,p,s)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),a=i.options.stacked,r=[],n=this._cachedMeta.controller.getParsed(e),o=n&&n[i.axis],l=t=>{let e=t._parsed.find(t=>t[i.axis]===o),s=e&&e[t.vScale.axis];if(tQ(s)||isNaN(s))return!0};for(let i of s)if(!(void 0!==e&&l(i))&&((!1===a||-1===r.indexOf(i.stack)||void 0===a&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[t5("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let s=this._getStacks(t,i),a=void 0!==e?s.indexOf(e):-1;return -1===a?s.length-1:a}_getRuler(){let t,e,i=this.options,s=this._cachedMeta,a=s.iScale,r=[];for(t=0,e=s.data.length;t<e;++t)r.push(a.getPixelForValue(this.getParsed(t)[a.axis],t));let n=i.barThickness;return{min:n||function(t){let e,i,s,a,r=t.iScale,n=function(t,e){if(!t._cache.$bar){let i=t.getMatchingVisibleMetas(e),s=[];for(let e=0,a=i.length;e<a;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=eE(s.sort((t,e)=>t-e))}return t._cache.$bar}(r,t.type),o=r._length,l=()=>{32767!==s&&-32768!==s&&(eo(a)&&(o=Math.min(o,Math.abs(s-a)||o)),a=s)};for(e=0,i=n.length;e<i;++e)s=r.getPixelForValue(n[e]),l();for(e=0,a=void 0,i=r.ticks.length;e<i;++e)s=r.getPixelForTick(e),l();return o}(s),pixels:r,start:a._startPixel,end:a._endPixel,stackCount:this._getStackCount(),scale:a,grouped:i.grouped,ratio:n?1:i.categoryPercentage*i.barPercentage}}_calculateBarValuePixels(t){let e,i,{_cachedMeta:{vScale:s,_stacked:a,index:r},options:{base:n,minBarLength:o}}=this,l=n||0,h=this.getParsed(t),d=h._custom,c=sc(d),u=h[s.axis],f=0,g=a?this.applyStack(s,h,a):u;g!==u&&(f=g-u,g=u),c&&(u=d.barStart,g=d.barEnd-d.barStart,0!==u&&eb(u)!==eb(d.barEnd)&&(f=0),f+=u);let p=tQ(n)||c?f:n,m=s.getPixelForValue(p);if(Math.abs(i=(e=this.chart.getDataVisibility(t)?s.getPixelForValue(f+g):m)-m)<o){var x;i=(0!==(x=i)?eb(x):(s.isHorizontal()?1:-1)*(s.min>=l?1:-1))*o,u===l&&(m-=i/2);let t=s.getPixelForDecimal(0),n=s.getPixelForDecimal(1),d=Math.min(t,n);e=(m=Math.max(Math.min(m,Math.max(t,n)),d))+i,a&&!c&&(h._stacks[s.axis]._visualValues[r]=s.getValueForPixel(e)-s.getValueForPixel(m))}if(m===s.getPixelForValue(l)){let t=eb(i)*s.getLineWidthForValue(l)/2;m+=t,i-=t}return{size:i,base:m,head:e,center:e+i/2}}_calculateBarIndexPixels(t,e){let i,s,a=e.scale,r=this.options,n=r.skipNull,o=t5(r.maxBarThickness,1/0),l=this._getAxisCount();if(e.grouped){var h,d;let a,c,u,f,g,p,m,x,b,_=n?this._getStackCount(t):e.stackCount,y="flex"===r.barThickness?(h=_*l,c=(a=e.pixels)[t],u=t>0?a[t-1]:null,f=t<a.length-1?a[t+1]:null,g=r.categoryPercentage,null===u&&(u=c-(null===f?e.end-e.start:f-c)),null===f&&(f=c+c-u),p=c-(c-Math.min(u,f))/2*g,{chunk:Math.abs(f-u)/2*g/h,ratio:r.barPercentage,start:p}):(d=_*l,tQ(b=r.barThickness)?(m=e.min*r.categoryPercentage,x=r.barPercentage):(m=b*d,x=1),{chunk:m/d,ratio:x,start:e.pixels[t]-m/2}),v="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,w=this._getAxis().indexOf(t5(v,this.getFirstScaleIdForIndexAxis())),k=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0)+w;i=y.start+y.chunk*k+y.chunk/2,s=Math.min(o,y.chunk*y.ratio)}else i=a.getPixelForValue(this.getParsed(t)[a.axis],t),s=Math.min(o,e.min*e.ratio);return{base:i-s/2,head:i+s/2,center:i,size:s}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length,a=0;for(;a<s;++a)null===this.getParsed(a)[e.axis]||i[a].hidden||i[a].draw(this._ctx)}},class extends sG{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmou
2nt:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){var e,i,s;let a,r,n,o,l,h,d,c,{inflateAmount:u,options:{borderColor:f,backgroundColor:g}}=this,{inner:p,outer:m}=(r=(a=aC(this)).right-a.left,n=a.bottom-a.top,e=r/2,i=n/2,o=this.options.borderWidth,l=this.borderSkipped,h=id(o),d={t:aj(l.top,h.top,0,i),r:aj(l.right,h.right,0,e),b:aj(l.bottom,h.bottom,0,i),l:aj(l.left,h.left,0,e)},c=function(t,e,i){let{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),a=t.options.borderRadius,r=ic(a),n=Math.min(e,i),o=t.borderSkipped,l=s||t0(a);return{topLeft:aj(!l||o.top||o.left,r.topLeft,0,n),topRight:aj(!l||o.top||o.right,r.topRight,0,n),bottomLeft:aj(!l||o.bottom||o.left,r.bottomLeft,0,n),bottomRight:aj(!l||o.bottom||o.right,r.bottomRight,0,n)}}(this,r/2,n/2),{outer:{x:a.left,y:a.top,w:r,h:n,radius:c},inner:{x:a.left+d.l,y:a.top+d.t,w:r-d.l-d.r,h:n-d.t-d.b,radius:{topLeft:Math.max(0,c.topLeft-Math.max(d.t,d.l)),topRight:Math.max(0,c.topRight-Math.max(d.t,d.r)),bottomLeft:Math.max(0,c.bottomLeft-Math.max(d.b,d.l)),bottomRight:Math.max(0,c.bottomRight-Math.max(d.b,d.r))}}}),x=(s=m.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?ia:aD;t.save(),(m.w!==p.w||m.h!==p.h)&&(t.beginPath(),x(t,aP(m,u,p)),t.clip(),x(t,aP(p,-u,m)),t.fillStyle=f,t.fill("evenodd")),t.beginPath(),x(t,aP(p,u)),t.fillStyle=g,t.fill(),t.restore()}inRange(t,e,i){return aS(this,t,e,i)}inXRange(t,e){return aS(this,t,null,e)}inYRange(t,e){return aS(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:a}=this.getProps(["x","y","base","horizontal"],t);return{x:a?(e+s)/2:e,y:a?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},class extends sl{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:s=[],_dataset:a}=e,r=this.chart._animationsDisabled,{start:n,count:o}=function(t,e,i){let s=e.length,a=0,r=s;if(t._sorted){let{iScale:n,vScale:o,_parsed:l}=t,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,d=n.axis,{min:c,max:u,minDefined:f,maxDefined:g}=n.getUserBounds();if(f){if(a=Math.min(eO(l,d,c).lo,i?s:eO(e,d,n.getPixelForValue(c)).lo),h){let t=l.slice(0,a+1).reverse().findIndex(t=>!tQ(t[o.axis]));a-=Math.max(0,t)}a=eS(a,0,s-1)}if(g){let t=Math.max(eO(l,n.axis,u,!0).hi+1,i?0:eO(e,d,n.getPixelForValue(u),!0).hi+1);if(h){let e=l.slice(t-1).findIndex(t=>!tQ(t[o.axis]));t+=Math.max(0,e)}r=eS(t,a,s)-a}else r=s-a}return{start:a,count:r}}(e,s,r);this._drawStart=n,this._drawCount=o,function(t){let{xScale:e,yScale:i,_scaleRanges:s}=t,a={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=a,!0;let r=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,a),r}(e)&&(n=0,o=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=s;let l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:l},t),this.updateElements(s,n,o,t)}updateElements(t,e,i,s){let a="reset"===s,{iScale:r,vScale:n,_stacked:o,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,s),c=r.axis,u=n.axis,{spanGaps:f,segment:g}=this.options,p=ev(f)?f:1/0,m=this.chart._animationsDisabled||a||"none"===s,x=e+i,b=t.length,_=e>0&&this.getParsed(e-1);for(let i=0;i<b;++i){let f=t[i],b=m?f:{};if(i<e||i>=x){b.skip=!0;continue}let y=this.getParsed(i),v=tQ(y[u]),w=b[c]=r.getPixelForValue(y[c],i),k=b[u]=a||v?n.getBasePixel():n.getPixelForValue(o?this.applyStack(n,y,o):y[u],i);b.skip=isNaN(w)||isNaN(k)||v,b.stop=i>0&&Math.abs(y[c]-_[c])>p,g&&(b.parsed=y,b.raw=l.data[i]),d&&(b.options=h||this.resolveDataElementOptions(i,f.active?"active":s)),m||this.updateElement(f,i,b,s),_=y}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];return s.length?Math.max(i,s[0].size(this.resolveDataElementOptions(0)),s[s.length-1].size(this.resolveDataElementOptions(s.length-1)))/2:i}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},aM,class extends sG{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.options,{x:a,y:r}=this.getProps(["x","y"],i);return Math.pow(t-a,2)+Math.pow(e-r,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return aT(this,t,"x",e)}inYRange(t,e){return aT(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0,i=(e=Math.max(e,e&&t.hoverRadius||0))&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;!this.skip&&!(i.radius<.1)&&e9(this,e,this.size(i)/2)&&(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,e8(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}},{id:"tooltip",_element:aY,positioners:aR,afterInit(t,e,i){i&&(t.tooltip=new aY({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){let e=t.tooltip;if(e&&e._willRender()){let i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){let i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>
2e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:aN},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},{id:"legend",_element:az,start(t,e,i){let s=t.legend=new az({ctx:t.ctx,options:i,chart:t});sP.configure(t,s,i),sP.addBox(t,s)},stop(t){sP.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){let s=t.legend;sP.configure(t,s,i),s.options=i},afterUpdate(t){let e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){let s=e.datasetIndex,a=i.chart;a.isDatasetVisible(s)?(a.hide(s),e.hidden=!0):(a.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){let e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:a,color:r,useBorderRadius:n,borderRadius:o}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{let l=t.controller.getStyle(i?0:void 0),h=iu(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:r,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:a||l.textAlign,borderRadius:n&&(o||l.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}});let a7=({series:t,scopeLabel:e,headerActions:i})=>{let a=(0,p.f)("Statistics"),r="dark"===(0,u.f)("light"),o=(0,x.a)(),h="u">typeof navigator?navigator.language:"de-CH",c=(0,l.useMemo)(()=>t.buckets.map(t=>t.start.toLocaleDateString(h,{month:"short",year:"2-digit"})),[t.buckets,h]),f=(0,l.useMemo)(()=>({labels:c,datasets:[{type:"bar",label:a("effectivePerPeriod"),data:t.buckets.map(t=>t.istMinutes/60),backgroundColor:r?"rgba(132, 94, 247, 0.55)":"rgba(132, 94, 247, 0.35)",borderColor:"rgba(132, 94, 247, 1)",borderWidth:1,yAxisID:"y",order:2},{type:"line",label:a("cumulativeEffective"),data:t.buckets.map(t=>t.cumulativeIstMinutes/60),borderColor:r?"#91a7ff":"#5c7cfa",backgroundColor:"transparent",tension:.25,yAxisID:"y1",order:1},...t.totals.hideTarget?[]:[{type:"line",label:a("cumulativeTarget"),data:t.buckets.map(t=>t.cumulativeSollMinutes/60),borderColor:r?"#ffd43b":"#fab005",borderDash:[6,4],backgroundColor:"transparent",tension:.25,yAxisID:"y1",order:0}]]}),[c,t,a,r]),g=(0,l.useMemo)(()=>({responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},layout:{padding:o?{top:4,right:2,bottom:0,left:2}:{top:0,right:0,bottom:0,left:0}},plugins:{legend:{position:o?"bottom":"top",align:o?"start":"center",labels:{color:r?"#ced4da":"#495057",boxWidth:o?12:40,padding:o?10:16,font:{size:o?11:12},generateLabels:t=>ap.defaults.plugins.legend.labels.generateLabels(t).map(e=>{let i=t.data.datasets[e.datasetIndex??0];return"line"!==i.type?e:{...e,fillStyle:"transparent",strokeStyle:i.borderColor??e.strokeStyle,lineWidth:3,lineDash:i.borderDash??[]}})}},tooltip:{callbacks:{label:t=>{let e=t.parsed.y??0;return`${t.dataset.label??""}: ${e.toFixed(1)} h`}}}},scales:{x:{ticks:{color:r?"#adb5bd":"#868e96",maxRotation:o?50:45,minRotation:40*!!o,autoSkipPadding:o?2:void 0,padding:o?2:4},grid:{color:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)"}},y:{position:"left",title:{display:!o,text:a("hoursPerPeriod"),color:r?"#ced4da":"#495057"},ticks:{color:r?"#adb5bd":"#868e96",maxTicksLimit:o?5:void 0,padding:o?2:4},grid:{color:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)"}},y1:{position:"right",title:{display:!o,text:a("cumulativeHours"),color:r?"#ced4da":"#495057"},ticks:{color:r?"#adb5bd":"#868e96",maxTicksLimit:o?5:void 0,padding:o?2:4},grid:{drawOnChartArea:!1}}}}),[r,o,a]);return(0,s.jsxs)(W.C,{title:a("workloadCurve"),headerActions:i,helpArticleId:"statistics-wor
2kload-chart",helpStepId:"chart-overview",testId:n.f.statisticsWorkloadChart,padding:"none",headerClassName:a9.default.headerPad,children:[e?(0,s.jsx)(d.f,{size:"xs",c:"dimmed",className:a9.default.scopeLabel,children:a("periodBreakdownScope",{scope:e})}):null,(0,s.jsx)("div",{className:a9.default.chartShell,"data-testid":n.f.statisticsWorkloadChartPlot,children:(0,s.jsx)(a4,{type:"bar",data:f,options:g})})]})};var rt=t.i(74),re=t.i(22046),ri=t.i(74982),rs=t.i(95629),ra=t.i(21539),rr=t.i(73504);let rn=t=>0===t?"â":`${t>0?"+":"â"}${(0,m.w)(Math.abs(t))}`,ro=({series:t,weekSeries:e,hideTargetColumn:i=!1,scopeLabel:a,headerActions:r})=>{let o=(0,p.f)("Statistics"),u="u">typeof navigator?navigator.language:"de-CH",f=(0,x.a)(),[g,b]=(0,l.useState)(null),[_,y]=(0,l.useState)("month"),v="week"===_&&e?"week":"month",w=(0,l.useMemo)(()=>"week"===v?o("granularityWeek"):o("period"),[v,o]),k=e?(0,s.jsx)(rt.f,{className:rr.default.granularityControl,value:v,onChange:t=>y(t),data:[{label:o("granularityMonth"),value:"month"},{label:o("granularityWeek"),value:"week"}],size:"xs"}):null,M=(0,s.jsxs)(s.Fragment,{children:[r,k]}),T=f?"xs":"sm",C=f?i?rr.default.periodColWide:rr.default.periodCol:void 0,j=f?rr.default.valueCol:void 0,S=f?rr.default.expandCol:void 0,D=[rr.default.valueCell,j].filter(Boolean).join(" "),P=(0,s.jsxs)(h.f,{striped:!0,highlightOnHover:!0,withTableBorder:!1,className:f?rr.default.mobileTable:void 0,layout:f?"fixed":void 0,children:[(0,s.jsx)(h.f.Thead,{children:(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Th,{className:C,children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:rr.default.headerText,children:w})}),(0,s.jsx)(h.f.Th,{className:j,children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:rr.default.headerText,children:o("effective")})}),!i&&(0,s.jsx)(h.f.Th,{className:j,children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:rr.default.headerText,children:o("target")})}),!i&&(0,s.jsx)(h.f.Th,{className:j,children:(0,s.jsx)(d.f,{size:"xs",c:"dimmed",fw:500,className:rr.default.headerText,children:o("delta")})}),(0,s.jsx)(h.f.Th,{className:S,style:f?void 0:{width:40}})]})}),(0,s.jsx)(h.f.Tbody,{children:("week"===_&&e?e:t).buckets.map(t=>{let e=g===t.key,a=t.byCategory.length>0;return(0,s.jsxs)(l.default.Fragment,{children:[(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Td,{className:C,children:(0,s.jsxs)(d.f,{size:T,fw:t.includesAsOfDate?700:500,className:f?rr.default.periodText:void 0,children:[((t,e,i)=>{if("month"===e)return t.start.toLocaleDateString(i,{month:"long",year:"numeric"});let s=t.key.split("-W")[1],a=i.startsWith("de")?"KW":"W";return`${a} ${s}`})(t,v,u),t.includesAsOfDate?` (${o("currentPeriod")})`:""]})}),(0,s.jsx)(h.f.Td,{className:D,children:(0,m.w)(t.istMinutes)}),!i&&(0,s.jsx)(h.f.Td,{className:D,children:(0,m.w)(t.sollMinutes)}),!i&&(0,s.jsx)(h.f.Td,{className:D,c:t.deltaMinutes>0?"teal":t.deltaMinutes<0?"orange":void 0,children:rn(t.deltaMinutes)}),(0,s.jsx)(h.f.Td,{className:S,children:a?(0,s.jsx)(re.f,{"aria-label":o("toggleCategories"),onClick:()=>b(e?null:t.key),children:e?(0,s.jsx)(ri.f,{size:16}):(0,s.jsx)(rs.f,{size:16})}):null})]}),a&&e&&(0,s.jsx)(h.f.Tr,{children:(0,s.jsx)(h.f.Td,{colSpan:i?3:5,p:0,children:(0,s.jsx)(h.f,{withColumnBorders:!0,className:f?rr.default.nestedTable:void 0,layout:f?"fixed":void 0,children:(0,s.jsx)(h.f.Tbody,{children:t.byCategory.map(e=>(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Td,{className:C,pl:f?"sm":"xl",children:(0,s.jsxs)(c.f,{gap:"xs",wrap:"nowrap",children:[e.color?(0,s.jsx)("span",{style:{width:10,height:10,borderRadius:999,backgroundColor:e.color,display:"inline-block",flexShrink:0}}):null,(0,s.jsx)(d.f,{size:T,className:f?rr.default.categoryText:void 0,children:e.title})]})}),(0,s.jsx)(h.f.Td,{className:D,children:(0,m.w)(e.istMinutes)}),!i&&(0,s.jsx)(h.f.Td,{className:D,children:(0,m.w)(e.sollMinutes)}),!i&&(0,s.jsx)(h.f.Td,{className:D,children:rn(e.deltaMinutes)}),(0,s.jsx)(h.f.Td,{className:S})]},`${t.key}-${e.key}`))})})})})]},t.key)})})]});return(0,s.jsxs)(W.C,{title:o("periodBreakdown"),headerActions:M,helpArticleId:"statistics-period-breakdown",helpStepId:"monthly-table",testId:n.f.statisticsPeriodTableCapture,padding:"none",headerClassName:ra.default.headerPad,children:[a?(0,s.jsx)(d.f,{size:"xs",c:"dimmed",className:rr.default.scopeLabel,children:o("periodBreakdownScope",{scope:a})}):null,f?(0,s.jsx)("div",{className:rr.default.mobileWrapper,children:P}
2):(0,s.jsx)(h.f.ScrollContainer,{minWidth:600,className:rr.default.scrollContainer,children:P})]})};var rl=t.i(61549),rh=t.i(91139),rd=t.i(55332);let rc={professionalMission:"scopeProfessionalMission",furtherEmployment:"scopeFurtherEmployment",noCategory:"scopeNoCategory",otherCanton:"scopeOtherCanton"},ru=(t,e,i)=>t.length===e.length&&e.every(e=>t.includes(e))?i("scopeAll"):1===t.length?i(rc[t[0]]):i("scopeFilterCount",{count:t.length}),rf=t=>(0,I.q)(t);var rg=t.i(27277);let rp=["professionalMission"];function rm({segmentedTotals:t,value:e,onChange:i}){let a=(0,p.f)("Statistics"),[r,{toggle:n,close:o}]=(0,rd.f)(!1),h=(0,l.useMemo)(()=>rf(t),[t]);if((0,l.useEffect)(()=>{let t=e.filter(t=>h.includes(t));0===t.length?i(rp):t.length!==e.length&&i(t)},[h,i,e]),h.length<=1)return null;let d=ru(e,h,a);return(0,s.jsxs)(rl.f,{opened:r,onClose:o,position:"bottom-end",withArrow:!0,shadow:"md",withinPortal:!0,children:[(0,s.jsx)(rl.f.Target,{children:(0,s.jsxs)(O.f,{variant:"default",size:"xs",className:rg.default.scopeButton,leftSection:(0,s.jsx)(rh.f,{size:16}),onClick:n,children:[(0,s.jsxs)("span",{className:rg.default.scopeButtonFull,children:[a("workloadScopeFilter"),": ",d]}),(0,s.jsx)("span",{className:`${rg.default.scopeButtonShort} ${rg.default.scopeButtonLabel}`,children:d})]})}),(0,s.jsx)(rl.f.Dropdown,{children:(0,s.jsx)(D.f.Group,{value:e,onChange:t=>{0!==t.length&&i(t)},children:(0,s.jsx)(P.f,{gap:"sm",children:h.map(t=>(0,s.jsx)(D.f,{value:t,label:a("professionalMission"===t?"scopeProfessionalMission":"furtherEmployment"===t?"scopeFurtherEmployment":"noCategory"===t?"scopeNoCategory":"scopeOtherCanton")},t))})})})]})}let rx=({startDate:t,endDate:e,userData:i,categories:a,cantonData:r,configMode:n,configProfile:o,profileCategories:h,hideTarget:c,translateCategory:u,asOfDate:f,asOfMode:g="today"})=>{let m=(0,p.f)("Statistics"),[x,b]=(0,l.useState)(["professionalMission"]),{data:_,isPending:y,isError:v}=(0,F.C)({startDate:t,endDate:e,userData:i,categories:a,cantonData:r,configMode:n,configProfile:o,profileCategories:h,hideTarget:c,granularity:"month",translateCategory:u,asOfDate:f}),{data:w}=(0,F.C)({startDate:t,endDate:e,userData:i,categories:a,cantonData:r,configMode:n,configProfile:o,profileCategories:h,hideTarget:c,granularity:"week",translateCategory:u,asOfDate:f,enabled:!!_}),k=(0,l.useMemo)(()=>_?(0,I.J)(_,x):null,[_,x]),M=(0,l.useMemo)(()=>w?(0,I.J)(w,x):null,[w,x]),T=(0,l.useMemo)(()=>_?rf(_.segmentedTotals):["professionalMission"],[_]),C=(0,l.useMemo)(()=>ru(x,T,m),[x,T,m]);if(v)return(0,s.jsx)(W.t,{children:(0,s.jsx)(d.f,{c:"dimmed",size:"sm",children:m("loadFailed")})});if(y||!_||!k)return(0,s.jsxs)(W.t,{children:[(0,s.jsx)(tg.f,{height:140,radius:"md"}),(0,s.jsx)(tg.f,{height:360,radius:"md"}),(0,s.jsx)(tg.f,{height:280,radius:"md"})]});let j=c||k.totals.hideTarget;return(0,s.jsxs)(W.t,{children:[(0,s.jsx)(tx,{segmentedTotals:_.segmentedTotals,asOfMode:g}),(0,s.jsx)(a7,{series:k,scopeLabel:C,headerActions:(0,s.jsx)(rm,{segmentedTotals:_.segmentedTotals,value:x,onChange:b})}),(0,s.jsx)(ro,{series:k,weekSeries:M,hideTargetColumn:j,scopeLabel:C,headerActions:(0,s.jsx)(rm,{segmentedTotals:_.segmentedTotals,value:x,onChange:b})})]})};var rb=t.i(24669),r_=t.i(54839),ry=t.i(49564),rv=t.i(39346),rw=t.i(39680),rk=t.i(69949);let rM=t=>new Date(`${t}T00:00:00`),rT=t=>("string"==typeof t?rM(t):t).toLocaleDateString(void 0,{day:"2-digit",month:"2-digit",year:"numeric"});function rC({schoolYearStart:t,onSchoolYearChange:e,periods:i,selectedPeriodId:o,onSelectPeriodId:h}){let c=(0,p.f)("Statistics"),u=(0,p.f)("Index"),f=(0,p.f)("EmploymentPeriods"),g=(0,l.useMemo)(()=>(0,r.D)(t),[t]),m=(0,l.useMemo)(()=>i.filter(t=>(0,a.G)({validFrom:rM(t.valid_from),validTo:t.valid_to?rM(t.valid_to):null},g)).sort((t,e)=>t.valid_from.localeCompare(e.valid_from)),[i,g]),x=(0,l.useMemo)(()=>m.map(t=>{let e=(0,a.Z)(t,g)??g;return{value:t.id,label:`${rT(e.start)} - ${rT(e.end)}`}}),[m,g]),b=m.length>1;return(0,s.jsxs)(P.f,{gap:"xs",className:rk.default.toolbar,"data-testid":n.f.statisticsPeriodToolbar,children:[(0,s.jsx)(ry.f,{order:2,children:c("pageTitle")}),(0,s.jsxs)("div",{className:rk.default.controls,children:[(0,s.jsxs)("div",{className:rk.default.pickerRow,children:[(0,s.jsx)(rv.f,{startDate:g.start,endDate:g.end,onRangeChange:t=>e((0,r.f)(t))}
2),b&&(0,s.jsxs)("div",{className:rk.default.periodBlock,children:[(0,s.jsx)(d.f,{size:"xs",c:"dimmed",className:rk.default.periodLabel,children:f("entryCount",{count:m.length})}),(0,s.jsx)(r_.f,{"aria-label":c("employmentPeriodLabel"),data:x,value:o,onChange:t=>{t&&h(t)},allowDeselect:!1,searchable:x.length>6,size:"sm",radius:"xl",className:rk.default.periodSelect,classNames:{root:rk.default.periodSelectRoot,input:rk.default.periodSelectInput,option:rk.default.periodSelectOption,wrapper:rk.default.periodSelectWrapper}})]})]}),(0,s.jsx)(rw.f,{href:"/app/settings/employment",label:u("adjustProfessionalMission"),size:"xs"})]})]})}function rj({startDate:t,endDate:e,asOfDate:i}){let a=(0,p.f)("Statistics"),r=(0,E.X)(),o=(0,l.useMemo)(()=>(0,R.v)((0,R.Y)(i??new Date,t,e)).toLocaleDateString(r,{day:"numeric",month:"long",year:"numeric"}),[t,e,i,r]);return(0,s.jsx)(d.f,{size:"sm",c:"dimmed","data-testid":n.f.statisticsAsOfDate,children:a("asOfDate",{date:o})})}var rS=t.i(41067);let rD=({userData:t,reloadUserData:e})=>{let{configMode:i,configProfile:u,profileCategories:f}=(0,tf.V)(),g=(0,p.f)("Categories"),m=(0,p.f)("Statistics"),x=(0,p.f)("Index"),[b,_]=(0,l.useState)(null),[y,v]=(0,l.useState)(null),[S,D]=(0,l.useState)(null),[O,L]=(0,l.useState)([]),A=(0,l.useRef)(0),[z,E]=(0,l.useState)(()=>(0,r.G)(t.stat_start_date,t.stat_end_date)),[R,I]=(0,l.useState)([]),[F,B]=(0,l.useState)(null),H=(0,r.Q)(t.stat_start_date,t.stat_end_date)?(0,r.G)(t.stat_start_date,t.stat_end_date):null,V=(0,l.useMemo)(()=>null!=H&&z===H?(0,r.M)(t.stat_start_date,t.stat_end_date):(0,r.D)(z),[H,z,t.stat_start_date,t.stat_end_date]),$=(0,l.useMemo)(()=>R.filter(t=>(0,a.G)({validFrom:new Date(`${t.valid_from}T00:00:00`),validTo:t.valid_to?new Date(`${t.valid_to}T00:00:00`):null},V)).sort((t,e)=>t.valid_from.localeCompare(e.valid_from)),[R,V]),N=(0,l.useMemo)(()=>$.find(t=>t.id===F)??null,[$,F]),U=(0,l.useMemo)(()=>N?(0,a.Z)(N,V)??V:V,[N,V]),Y=U.start,G=U.end,[q,X]=(0,l.useState)("today"),Z=(0,l.useMemo)(()=>"endOfPeriod"===q?G:new Date,[q,G]),K=(0,l.useCallback)(async()=>{try{let t=await (0,C.Q)();I(t)}catch(t){(0,j.n)("Failed to load employment periods for statistics:",t)}},[]);(0,l.useEffect)(()=>{K()},[K]),(0,l.useEffect)(()=>{B(t=>{if(t&&$.some(e=>e.id===t))return t;let e=$.map(t=>({...t,validFrom:new Date(`${t.valid_from}T00:00:00`),validTo:t.valid_to?new Date(`${t.valid_to}T00:00:00`):null})),i=(0,a.J)(e,new Date);if(i)return i.id;let s=(0,a.J)(e,V.start);if(s)return s.id;let r=$.find(t=>"current"===(0,a.U)(t));return r?.id??$[0]?.id??null})},[$,V.start]);let Q=(0,l.useCallback)(async i=>{try{let{start:s,end:a}=(0,r.j)(i);if(s===t.stat_start_date&&a===t.stat_end_date)return;await (0,T.U)(t.user_id,s,a),await e()}catch(t){(0,j.n)("Error saving school year dates:",t)}},[t.user_id,t.stat_start_date,t.stat_end_date,e]);(0,l.useEffect)(()=>{if(!(0,r.k)(t.stat_start_date,t.stat_end_date))return;let e=(0,r.G)(t.stat_start_date,t.stat_end_date);z===e&&Q(e)},[t.stat_start_date,t.stat_end_date,z,Q]);let J=N?.canton_code??t.canton_code,tt=N?.mode??i,te=N?.mode==="custom"?N.config_profile??null:u,ti=N?.mode==="custom"?N.profile_categories??[]:f;(0,l.useEffect)(()=>{if("custom"===tt||!J||!t.user_id){D(null),L([]);return}let e=++A.current,i=!1;return D(null),L([]),_(null),v(null),(async()=>{try{var s;let a,[r,n]=await Promise.all([(0,k.M)(J,t.user_id),(0,M.n)({...t,canton_code:J})]);if(i||e!==A.current)return;let o=r?(s=N?.targets,a=new Map((s??[]).map(t=>[t.category_set_id,t.target_percentage])),{...r,category_sets:r.category_sets.map(t=>({...t,user_percentage:a.has(t.id)?a.get(t.id):null,user_percentage_id:null}))}):null;D(o),L(n??[])}catch(t){(0,j.n)("Error fetching period canton/categories for statistics:",t),i||e!==A.current||(D(null),L([]))}})(),()=>{i=!0}},[tt,J,N?.id,N?.targets,t]);let ts="custom"===tt?ti.length>0:O.length>0,ta=(0,l.useMemo)(()=>ti.reduce((t,e)=>t+e.weight,0),[ti]),tr="custom"===tt&&(0===ti.length||Math.abs(ta-100)>.01);(0,l.useEffect)(()=>{(async()=>{if(!ts){_(null),v(null);return}if("custom"===tt&&te&&ti.length>0){try{let e=await (0,o.d)(Y,G,t.user_id,ti,te,t,g,Z);_(e)}catch(t){(0,j.n)("Error fetching custom category statistics:",t)}try{let e=await (0,o.k)(Y,G,t.user_id,ti,te,t,g,Z);v(e)}catch(t){(0,j.n)("Error fetching custom remaining statistics:",t)}}else{if(!S||0===O.length)return;try{let e=await (0,o.y)(Y,G,t.user_id,O,S,t,g,Z);_(e)}catch(t){(0,j.n)("Error fetching category statistics:",t)}try{let e=await (0,o.e)(Y,G,t.user_id,O,S,t,g,Z);v(e)}catch(t){(0,j.n)("Error fetching remaining category statistics:",t)}}})()},[S,Y,G,Z,t,O,g,tt,te,ti,ts]);let tn="default"===tt&&S?.is_working_hours_disabled===!0,to="default"===tt&&S?.has_category_targets===!1,tl=(0,s.jsx)(h.f.ScrollC
2ontainer,{minWidth:600,children:(0,s.jsxs)(h.f,{withTableBorder:!0,withColumnBorders:!0,children:[(0,s.jsx)(h.f.Thead,{children:(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(tg.f,{height:20})}),(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(tg.f,{height:20})}),!tn&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(tg.f,{height:20})}),(0,s.jsx)(h.f.Th,{children:(0,s.jsx)(tg.f,{height:20})})]})]})}),(0,s.jsx)(h.f.Tbody,{children:Array.from({length:5}).map((t,e)=>(0,s.jsxs)(h.f.Tr,{children:[(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(tg.f,{height:16})}),(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(tg.f,{height:16})}),!tn&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(tg.f,{height:16})}),(0,s.jsx)(h.f.Td,{children:(0,s.jsx)(tg.f,{height:16})})]})]},e))})]})});return(0,s.jsx)(rb.f,{helpCategoryId:"statistics",children:(0,s.jsxs)(P.f,{gap:"xl",children:[(0,s.jsx)(rC,{schoolYearStart:z,onSchoolYearChange:t=>{E(t),Q(t)},periods:R,selectedPeriodId:F,onSelectPeriodId:B}),(0,s.jsxs)(c.f,{justify:"space-between",align:"center",wrap:"wrap",gap:"sm","data-testid":n.f.statisticsAsOfControls,children:[(0,s.jsx)(rj,{startDate:Y,endDate:G,asOfDate:Z}),(0,s.jsx)(rt.f,{size:"xs",value:q,onChange:t=>X(t),data:[{label:m("asOfToday"),value:"today"},{label:m("asOfEndOfPeriod"),value:"endOfPeriod"}]})]}),tn&&(0,s.jsx)(rS.f,{c:"violet",variant:"light",children:(0,s.jsx)(d.f,{size:"sm",children:m("tgNoAnnualWorkTime")})}),tr&&(0,s.jsx)(rS.f,{c:"violet",variant:"light",children:(0,s.jsxs)(P.f,{gap:"xs",children:[(0,s.jsx)(d.f,{size:"sm",children:x(0===ti.length?"customCategoriesWarningNoCategories":"customCategoriesWarningTotal")}),(0,s.jsx)(rw.f,{href:"/app/settings/employment",label:x("employment"),size:"xs"})]})}),"custom"!==tt&&!ts&&(0,s.jsx)(rS.f,{c:"violet",variant:"light",children:(0,s.jsx)(d.f,{size:"sm",children:m("missingCategoriesForStatistics")})}),ts&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(rx,{startDate:Y,endDate:G,userData:t,categories:O,cantonData:S,configMode:tt,configProfile:te,profileCategories:ti,hideTarget:tn,translateCategory:g,asOfDate:Z,asOfMode:q}),(0,s.jsx)(W.C,{title:m("sectionCategories"),helpArticleId:"statistics-categories",helpStepId:"category-tables",testId:n.f.statisticsCategorySectionCapture,padding:"none",headerClassName:ra.default.headerPad,children:(0,s.jsxs)(P.f,{gap:"xl",className:ra.default.contentPad,children:[(0,s.jsx)(rj,{startDate:Y,endDate:G,asOfDate:Z}),(0,s.jsxs)("div",{children:[(0,s.jsx)(W.s,{children:m("sectionMainEmployment")}),b?(0,s.jsx)(w,{data:b,hideTargetColumn:tn,hideCategoryTargetColumns:to,asOfMode:q}):tl]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(W.s,{children:m("sectionAdditionalEmployment")}),y?(0,s.jsx)(w,{data:y,hideTargetColumn:tn,asOfMode:q}):tl]})]})}),y&&b?(0,s.jsx)(tu,{startDate:Y,endDate:G,schoolYearStart:V.start,schoolYearEnd:V.end,userData:t,categoryStatistics:b,categories:O,hideTargetColumn:tn,hideCategoryTargetColumns:to,cantonData:S,configMode:tt,configProfile:te,profileCategories:ti,selectedPeriod:N}):(0,s.jsx)(W.C,{title:m("sectionExport"),children:(0,s.jsxs)(P.f,{gap:"md",children:[(0,s.jsx)(tg.f,{height:40,radius:"md"}),(0,s.jsx)(tg.f,{height:20,radius:"sm"}),(0,s.jsx)(tg.f,{height:20,radius:"sm"})]})})]})]})})};t.s(["__N_SSP",0,!0,"default",0,function(){let{user:t,categories:e,refreshUserData:i}=(0,tf.V)();return t&&e?(0,s.jsx)(rD,{userData:t,categories:e,reloadUserData:i}):null}],92890)}]); 3 4//# debugId=f1894510-5c93-a362-fd0a-841ad44a8914
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.