react-luminus-components 1.4.13 → 1.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -276,4 +276,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
276
276
  L`+r+" "+r+`
277
277
  L0 `+r+`
278
278
  L`+r/2+` 0
279
- `,fill:i,opacity:o,strokeWidth:c,stroke:l===void 0?"transparent":l,style:{pointerEvents:"none"}})})};function gi(){return gi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gi.apply(this,arguments)}var Eq={top:0,right:0,bottom:0,left:0},Qm=function(e){var t,n=e.direction,r=e.itemsSpacing,i=e.padding,a=e.itemCount,o=e.itemWidth,s=e.itemHeight;if(typeof i!="number"&&(typeof(t=i)!="object"||Array.isArray(t)||t===null))throw new Error("Invalid property padding, must be one of: number, object");var c=typeof i=="number"?{top:i,right:i,bottom:i,left:i}:gi({},Eq,i),l=c.left+c.right,u=c.top+c.bottom,d=o+l,f=s+u,h=(a-1)*r;return n==="row"?d=o*a+h+l:n==="column"&&(f=s*a+h+u),{width:d,height:f,padding:c}},qC=function(e){var t=e.anchor,n=e.translateX,r=e.translateY,i=e.containerWidth,a=e.containerHeight,o=e.width,s=e.height,c=n,l=r;switch(t){case"top":c+=(i-o)/2;break;case"top-right":c+=i-o;break;case"right":c+=i-o,l+=(a-s)/2;break;case"bottom-right":c+=i-o,l+=a-s;break;case"bottom":c+=(i-o)/2,l+=a-s;break;case"bottom-left":l+=a-s;break;case"left":l+=(a-s)/2;break;case"center":c+=(i-o)/2,l+=(a-s)/2}return{x:c,y:l}},YC=function(e){var t,n,r,i,a,o,s=e.direction,c=e.justify,l=e.symbolSize,u=e.symbolSpacing,d=e.width,f=e.height;switch(s){case"left-to-right":t=0,n=(f-l)/2,i=f/2,o="central",c?(r=d,a="end"):(r=l+u,a="start");break;case"right-to-left":t=d-l,n=(f-l)/2,i=f/2,o="central",c?(r=0,a="start"):(r=d-l-u,a="end");break;case"top-to-bottom":t=(d-l)/2,n=0,r=d/2,a="middle",c?(i=f,o="alphabetic"):(i=l+u,o="text-before-edge");break;case"bottom-to-top":t=(d-l)/2,n=f-l,r=d/2,a="middle",c?(i=0,o="text-before-edge"):(i=f-l-u,o="alphabetic")}return{symbolX:t,symbolY:n,labelX:r,labelY:i,labelAnchor:a,labelAlignment:o}},Mq={circle:Tq,diamond:kq,square:Sq,triangle:Oq},$q=function(e){var t,n,r,i,a,o,s,c,l,u,d,f=e.x,h=e.y,g=e.width,p=e.height,b=e.data,x=e.direction,_=x===void 0?"left-to-right":x,y=e.justify,C=y!==void 0&&y,w=e.textColor,T=e.background,$=T===void 0?"transparent":T,R=e.opacity,S=R===void 0?1:R,k=e.symbolShape,O=k===void 0?"square":k,D=e.symbolSize,E=D===void 0?16:D,M=e.symbolSpacing,j=M===void 0?8:M,F=e.symbolBorderWidth,W=F===void 0?0:F,B=e.symbolBorderColor,U=B===void 0?"transparent":B,N=e.onClick,V=e.onMouseEnter,X=e.onMouseLeave,ne=e.toggleSerie,K=e.effects,J=m.useState({}),q=J[0],G=J[1],z=ht(),L=m.useCallback(function(Be){if(K){var Ke=K.filter(function(Ye){return Ye.on==="hover"}).reduce(function(Ye,de){return gi({},Ye,de.style)},{});G(Ke)}V==null||V(b,Be)},[V,b,K]),H=m.useCallback(function(Be){if(K){var Ke=K.filter(function(Ye){return Ye.on!=="hover"}).reduce(function(Ye,de){return gi({},Ye,de.style)},{});G(Ke)}X==null||X(b,Be)},[X,b,K]),ee=YC({direction:_,justify:C,symbolSize:(t=q.symbolSize)!=null?t:E,symbolSpacing:j,width:g,height:p}),A=ee.symbolX,se=ee.symbolY,ce=ee.labelX,ue=ee.labelY,we=ee.labelAnchor,Te=ee.labelAlignment,at=[N,V,X,ne].some(function(Be){return Be!==void 0}),tt=typeof O=="function"?O:Mq[O];return v.jsxs("g",{transform:"translate("+f+","+h+")",style:{opacity:(n=q.itemOpacity)!=null?n:S},children:[v.jsx("rect",{width:g,height:p,fill:(r=q.itemBackground)!=null?r:$,style:{cursor:at?"pointer":"auto"},onClick:function(Be){N==null||N(b,Be),ne==null||ne(b.id)},onMouseEnter:L,onMouseLeave:H}),ie.createElement(tt,gi({id:b.id,x:A,y:se,size:(i=q.symbolSize)!=null?i:E,fill:(a=(o=b.fill)!=null?o:b.color)!=null?a:"black",borderWidth:(s=q.symbolBorderWidth)!=null?s:W,borderColor:(c=q.symbolBorderColor)!=null?c:U},b.hidden?z.legends.hidden.symbol:void 0)),v.jsx("text",{textAnchor:we,style:gi({},Zm(z.legends.text),{fill:(l=(u=(d=q.itemTextColor)!=null?d:w)!=null?u:z.legends.text.fill)!=null?l:"black",dominantBaseline:Te,pointerEvents:"none",userSelect:"none"},b.hidden?z.legends.hidden.text:void 0),x:ce,y:ue,children:b.label})]})},Rq=function(e){var t=e.data,n=e.x,r=e.y,i=e.direction,a=e.padding,o=a===void 0?0:a,s=e.justify,c=e.effects,l=e.itemWidth,u=e.itemHeight,d=e.itemDirection,f=d===void 0?"left-to-right":d,h=e.itemsSpacing,g=h===void 0?0:h,p=e.itemTextColor,b=e.itemBackground,x=b===void 0?"transparent":b,_=e.itemOpacity,y=_===void 0?1:_,C=e.symbolShape,w=e.symbolSize,T=e.symbolSpacing,$=e.symbolBorderWidth,R=e.symbolBorderColor,S=e.onClick,k=e.onMouseEnter,O=e.onMouseLeave,D=e.toggleSerie,E=Qm({itemCount:t.length,itemWidth:l,itemHeight:u,itemsSpacing:g,direction:i,padding:o}).padding,M=i==="row"?l+g:0,j=i==="column"?u+g:0;return v.jsx("g",{transform:"translate("+n+","+r+")",children:t.map(function(F,W){return v.jsx($q,{data:F,x:W*M+E.left,y:W*j+E.top,width:l,height:u,direction:f,justify:s,effects:c,textColor:p,background:x,opacity:y,symbolShape:C,symbolSize:w,symbolSpacing:T,symbolBorderWidth:$,symbolBorderColor:R,onClick:S,onMouseEnter:k,onMouseLeave:O,toggleSerie:D},W)})})},Jm=function(e){var t=e.data,n=e.containerWidth,r=e.containerHeight,i=e.translateX,a=i===void 0?0:i,o=e.translateY,s=o===void 0?0:o,c=e.anchor,l=e.direction,u=e.padding,d=u===void 0?0:u,f=e.justify,h=e.itemsSpacing,g=h===void 0?0:h,p=e.itemWidth,b=e.itemHeight,x=e.itemDirection,_=e.itemTextColor,y=e.itemBackground,C=e.itemOpacity,w=e.symbolShape,T=e.symbolSize,$=e.symbolSpacing,R=e.symbolBorderWidth,S=e.symbolBorderColor,k=e.onClick,O=e.onMouseEnter,D=e.onMouseLeave,E=e.toggleSerie,M=e.effects,j=Qm({itemCount:t.length,itemsSpacing:g,itemWidth:p,itemHeight:b,direction:l,padding:d}),F=j.width,W=j.height,B=qC({anchor:c,translateX:a,translateY:s,containerWidth:n,containerHeight:r,width:F,height:W}),U=B.x,N=B.y;return v.jsx(Rq,{data:t,x:U,y:N,direction:l,padding:d,justify:f,effects:M,itemsSpacing:g,itemWidth:p,itemHeight:b,itemDirection:x,itemTextColor:_,itemBackground:y,itemOpacity:C,symbolShape:w,symbolSize:T,symbolSpacing:$,symbolBorderWidth:R,symbolBorderColor:S,onClick:k,onMouseEnter:O,onMouseLeave:D,toggleSerie:typeof E=="boolean"?void 0:E})},Aq={start:"left",middle:"center",end:"right"},GC=function(e,t){var n=t.data,r=t.containerWidth,i=t.containerHeight,a=t.translateX,o=a===void 0?0:a,s=t.translateY,c=s===void 0?0:s,l=t.anchor,u=t.direction,d=t.padding,f=d===void 0?0:d,h=t.justify,g=h!==void 0&&h,p=t.itemsSpacing,b=p===void 0?0:p,x=t.itemWidth,_=t.itemHeight,y=t.itemDirection,C=y===void 0?"left-to-right":y,w=t.itemTextColor,T=t.symbolSize,$=T===void 0?16:T,R=t.symbolSpacing,S=R===void 0?8:R,k=t.theme,O=Qm({itemCount:n.length,itemWidth:x,itemHeight:_,itemsSpacing:b,direction:u,padding:f}),D=O.width,E=O.height,M=O.padding,j=qC({anchor:l,translateX:o,translateY:c,containerWidth:r,containerHeight:i,width:D,height:E}),F=j.x,W=j.y,B=u==="row"?x+b:0,U=u==="column"?_+b:0;e.save(),e.translate(F,W),e.font=k.legends.text.fontSize+"px "+(k.legends.text.fontFamily||"sans-serif"),n.forEach(function(N,V){var X,ne,K=V*B+M.left,J=V*U+M.top,q=YC({direction:C,justify:g,symbolSize:$,symbolSpacing:S,width:x,height:_}),G=q.symbolX,z=q.symbolY,L=q.labelX,H=q.labelY,ee=q.labelAnchor,A=q.labelAlignment;e.fillStyle=(X=N.color)!=null?X:"black",e.fillRect(K+G,J+z,$,$),e.textAlign=Aq[ee],A==="central"&&(e.textBaseline="middle"),e.fillStyle=(ne=w??k.legends.text.fill)!=null?ne:"black",e.fillText(String(N.label),K+L,J+H)}),e.restore()};function Jr(){return Jr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jr.apply(this,arguments)}function ZC(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Lb,jq=function(e){var t=e.width,n=e.height,r=e.legends,i=e.data,a=e.toggleSerie;return v.jsx(v.Fragment,{children:r.map(function(o,s){var c;return v.jsx(Jm,Jr({},o,{containerWidth:t,containerHeight:n,data:(c=o.data)!=null?c:i,toggleSerie:o.toggleSerie?a:void 0}),s)})})},Se={id:"id",value:"value",sortByValue:!1,innerRadius:0,padAngle:0,cornerRadius:0,layers:["arcs","arcLinkLabels","arcLabels","legends"],startAngle:0,endAngle:360,fit:!0,activeInnerRadiusOffset:0,activeOuterRadiusOffset:0,borderWidth:0,borderColor:{from:"color",modifiers:[["darker",1]]},enableArcLabels:!0,arcLabel:"formattedValue",arcLabelsSkipAngle:0,arcLabelsRadiusOffset:.5,arcLabelsTextColor:{theme:"labels.text.fill"},enableArcLinkLabels:!0,arcLinkLabel:"id",arcLinkLabelsSkipAngle:0,arcLinkLabelsOffset:0,arcLinkLabelsDiagonalLength:16,arcLinkLabelsStraightLength:24,arcLinkLabelsThickness:1,arcLinkLabelsTextOffset:6,arcLinkLabelsTextColor:{theme:"labels.text.fill"},arcLinkLabelsColor:{theme:"axis.ticks.line.stroke"},colors:{scheme:"nivo"},defs:[],fill:[],isInteractive:!0,animate:!0,motionConfig:"gentle",transitionMode:"innerRadius",tooltip:function(e){var t=e.datum;return v.jsx(Zp,{id:t.id,value:t.formattedValue,enableChip:!0,color:t.color})},legends:[],role:"img",pixelRatio:typeof window<"u"&&(Lb=window.devicePixelRatio)!=null?Lb:1},Pq=["points"],Iq=function(e){var t=e.data,n=e.id,r=n===void 0?Se.id:n,i=e.value,a=i===void 0?Se.value:i,o=e.valueFormat,s=e.colors,c=s===void 0?Se.colors:s,l=Ti(r),u=Ti(a),d=Ma(o),f=Xm(c,"id");return m.useMemo(function(){return t.map(function(h){var g,p=l(h),b=u(h),x={id:p,label:(g=h.label)!=null?g:p,hidden:!1,value:b,formattedValue:d(b),data:h};return Jr({},x,{color:f(x)})})},[t,l,u,d,f])},Dq=function(e){var t=e.data,n=e.startAngle,r=e.endAngle,i=e.innerRadius,a=e.outerRadius,o=e.padAngle,s=e.sortByValue,c=e.activeId,l=e.activeInnerRadiusOffset,u=e.activeOuterRadiusOffset,d=e.hiddenIds,f=e.forwardLegendData,h=m.useMemo(function(){var x=xU().value(function(_){return _.value}).startAngle(An(n)).endAngle(An(r)).padAngle(An(o));return s||x.sortValues(null),x},[n,r,o,s]),g=m.useMemo(function(){var x=t.filter(function(_){return!d.includes(_.id)});return{dataWithArc:h(x).map(function(_){var y=Math.abs(_.endAngle-_.startAngle);return Jr({},_.data,{arc:{index:_.index,startAngle:_.startAngle,endAngle:_.endAngle,innerRadius:c===_.data.id?i-l:i,outerRadius:c===_.data.id?a+u:a,thickness:a-i,padAngle:_.padAngle,angle:y,angleDeg:cd(y)}})}),legendData:t.map(function(_){return{id:_.id,label:_.label,color:_.color,hidden:d.includes(_.id),data:_}})}},[h,t,d,c,i,l,a,u]),p=g.legendData,b=m.useRef(f);return m.useEffect(function(){typeof b.current=="function"&&b.current(p)},[b,p]),g},Nq=function(e){var t=e.activeId,n=e.onActiveIdChange,r=e.defaultActiveId,i=t!==void 0,a=m.useState(i||r===void 0?null:r),o=a[0],s=a[1];return{activeId:i?t:o,setActiveId:m.useCallback(function(c){n&&n(c),i||s(c)},[i,n,s])}},Fq=function(e){var t=e.data,n=e.width,r=e.height,i=e.innerRadius,a=i===void 0?Se.innerRadius:i,o=e.startAngle,s=o===void 0?Se.startAngle:o,c=e.endAngle,l=c===void 0?Se.endAngle:c,u=e.padAngle,d=u===void 0?Se.padAngle:u,f=e.sortByValue,h=f===void 0?Se.sortByValue:f,g=e.cornerRadius,p=g===void 0?Se.cornerRadius:g,b=e.fit,x=b===void 0?Se.fit:b,_=e.activeInnerRadiusOffset,y=_===void 0?Se.activeInnerRadiusOffset:_,C=e.activeOuterRadiusOffset,w=C===void 0?Se.activeOuterRadiusOffset:C,T=e.activeId,$=e.onActiveIdChange,R=e.defaultActiveId,S=e.forwardLegendData,k=Nq({activeId:T,onActiveIdChange:$,defaultActiveId:R}),O=k.activeId,D=k.setActiveId,E=m.useState([]),M=E[0],j=E[1],F=m.useMemo(function(){var U,N=Math.min(n,r)/2,V=N*Math.min(a,1),X=n/2,ne=r/2;if(x){var K=wq(X,ne,N,s-90,l-90),J=K.points,q=ZC(K,Pq),G=Math.min(n/q.width,r/q.height),z={width:q.width*G,height:q.height*G};z.x=(n-z.width)/2,z.y=(r-z.height)/2,X=(X-q.x)/q.width*q.width*G+z.x,ne=(ne-q.y)/q.height*q.height*G+z.y,U={box:q,ratio:G,points:J},N*=G,V*=G}return{centerX:X,centerY:ne,radius:N,innerRadius:V,debug:U}},[n,r,a,s,l,x]),W=Dq({data:t,startAngle:s,endAngle:l,innerRadius:F.innerRadius,outerRadius:F.radius,padAngle:d,sortByValue:h,activeId:O,activeInnerRadiusOffset:y,activeOuterRadiusOffset:w,hiddenIds:M,forwardLegendData:S}),B=m.useCallback(function(U){j(function(N){return N.indexOf(U)>-1?N.filter(function(V){return V!==U}):[].concat(N,[U])})},[]);return Jr({arcGenerator:Cq({cornerRadius:p,padAngle:An(d)}),activeId:O,setActiveId:D,toggleSerie:B},W,F)},Lq=function(e){var t=e.dataWithArc,n=e.arcGenerator,r=e.centerX,i=e.centerY,a=e.radius,o=e.innerRadius;return m.useMemo(function(){return{dataWithArc:t,arcGenerator:n,centerX:r,centerY:i,radius:a,innerRadius:o}},[t,n,r,i,a,o])},Bq=function(e){var t=e.center,n=e.data,r=e.arcGenerator,i=e.borderWidth,a=e.borderColor,o=e.isInteractive,s=e.onClick,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.setActiveId,f=e.tooltip,h=e.transitionMode,g=Li(),p=g.showTooltipFromEvent,b=g.hideTooltip,x=m.useMemo(function(){if(o)return function(w,T){s==null||s(w,T)}},[o,s]),_=m.useMemo(function(){if(o)return function(w,T){p(m.createElement(f,{datum:w}),T),d(w.id),c==null||c(w,T)}},[o,p,d,c,f]),y=m.useMemo(function(){if(o)return function(w,T){p(m.createElement(f,{datum:w}),T),l==null||l(w,T)}},[o,p,l,f]),C=m.useMemo(function(){if(o)return function(w,T){b(),d(null),u==null||u(w,T)}},[o,b,d,u]);return v.jsx(_q,{center:t,data:n,arcGenerator:r,borderWidth:i,borderColor:a,transitionMode:h,onClick:x,onMouseEnter:_,onMouseMove:y,onMouseLeave:C})},Wq=["isInteractive","animate","motionConfig","theme","renderWrapper"],Uq=function(e){var t=e.data,n=e.id,r=n===void 0?Se.id:n,i=e.value,a=i===void 0?Se.value:i,o=e.valueFormat,s=e.sortByValue,c=s===void 0?Se.sortByValue:s,l=e.layers,u=l===void 0?Se.layers:l,d=e.startAngle,f=d===void 0?Se.startAngle:d,h=e.endAngle,g=h===void 0?Se.endAngle:h,p=e.padAngle,b=p===void 0?Se.padAngle:p,x=e.fit,_=x===void 0?Se.fit:x,y=e.innerRadius,C=y===void 0?Se.innerRadius:y,w=e.cornerRadius,T=w===void 0?Se.cornerRadius:w,$=e.activeInnerRadiusOffset,R=$===void 0?Se.activeInnerRadiusOffset:$,S=e.activeOuterRadiusOffset,k=S===void 0?Se.activeOuterRadiusOffset:S,O=e.width,D=e.height,E=e.margin,M=e.colors,j=M===void 0?Se.colors:M,F=e.borderWidth,W=F===void 0?Se.borderWidth:F,B=e.borderColor,U=B===void 0?Se.borderColor:B,N=e.enableArcLabels,V=N===void 0?Se.enableArcLabels:N,X=e.arcLabel,ne=X===void 0?Se.arcLabel:X,K=e.arcLabelsSkipAngle,J=K===void 0?Se.arcLabelsSkipAngle:K,q=e.arcLabelsTextColor,G=q===void 0?Se.arcLabelsTextColor:q,z=e.arcLabelsRadiusOffset,L=z===void 0?Se.arcLabelsRadiusOffset:z,H=e.arcLabelsComponent,ee=e.enableArcLinkLabels,A=ee===void 0?Se.enableArcLinkLabels:ee,se=e.arcLinkLabel,ce=se===void 0?Se.arcLinkLabel:se,ue=e.arcLinkLabelsSkipAngle,we=ue===void 0?Se.arcLinkLabelsSkipAngle:ue,Te=e.arcLinkLabelsOffset,at=Te===void 0?Se.arcLinkLabelsOffset:Te,tt=e.arcLinkLabelsDiagonalLength,Be=tt===void 0?Se.arcLinkLabelsDiagonalLength:tt,Ke=e.arcLinkLabelsStraightLength,Ye=Ke===void 0?Se.arcLinkLabelsStraightLength:Ke,de=e.arcLinkLabelsThickness,ke=de===void 0?Se.arcLinkLabelsThickness:de,Oe=e.arcLinkLabelsTextOffset,ve=Oe===void 0?Se.arcLinkLabelsTextOffset:Oe,Ie=e.arcLinkLabelsTextColor,Xe=Ie===void 0?Se.arcLinkLabelsTextColor:Ie,It=e.arcLinkLabelsColor,mt=It===void 0?Se.arcLinkLabelsColor:It,Je=e.arcLinkLabelComponent,bt=e.defs,At=bt===void 0?Se.defs:bt,it=e.fill,gt=it===void 0?Se.fill:it,yt=e.isInteractive,Lt=yt===void 0?Se.isInteractive:yt,$e=e.onClick,Pe=e.onMouseEnter,ze=e.onMouseMove,nt=e.onMouseLeave,vt=e.tooltip,kt=vt===void 0?Se.tooltip:vt,Xt=e.activeId,Dt=e.onActiveIdChange,Bt=e.defaultActiveId,Ht=e.transitionMode,Mt=Ht===void 0?Se.transitionMode:Ht,Wt=e.legends,Jt=Wt===void 0?Se.legends:Wt,Vt=e.forwardLegendData,fe=e.role,ye=fe===void 0?Se.role:fe,Ee=Us(O,D,E),qe=Ee.outerWidth,Ge=Ee.outerHeight,ot=Ee.margin,P=Ee.innerWidth,re=Ee.innerHeight,Z=Iq({data:t,id:r,value:a,valueFormat:o,colors:j}),te=Fq({data:Z,width:P,height:re,fit:_,innerRadius:C,startAngle:f,endAngle:g,padAngle:b,sortByValue:c,cornerRadius:T,activeInnerRadiusOffset:R,activeOuterRadiusOffset:k,activeId:Xt,onActiveIdChange:Dt,defaultActiveId:Bt,forwardLegendData:Vt}),ge=te.dataWithArc,Ce=te.legendData,pe=te.arcGenerator,be=te.centerX,Ae=te.centerY,Me=te.radius,et=te.innerRadius,Nt=te.setActiveId,wt=te.toggleSerie,Ut=Km(At,ge,gt),le={arcs:null,arcLinkLabels:null,arcLabels:null,legends:null};u.includes("arcs")&&(le.arcs=v.jsx(Bq,{center:[be,Ae],data:ge,arcGenerator:pe,borderWidth:W,borderColor:U,isInteractive:Lt,onClick:$e,onMouseEnter:Pe,onMouseMove:ze,onMouseLeave:nt,setActiveId:Nt,tooltip:kt,transitionMode:Mt},"arcs")),A&&u.includes("arcLinkLabels")&&(le.arcLinkLabels=v.jsx(vq,{center:[be,Ae],data:ge,label:ce,skipAngle:we,offset:at,diagonalLength:Be,straightLength:Ye,strokeWidth:ke,textOffset:ve,textColor:Xe,linkColor:mt,component:Je},"arcLinkLabels")),V&&u.includes("arcLabels")&&(le.arcLabels=v.jsx(lq,{center:[be,Ae],data:ge,label:ne,radiusOffset:L,skipAngle:J,textColor:G,transitionMode:Mt,component:H},"arcLabels")),Jt.length>0&&u.includes("legends")&&(le.legends=v.jsx(jq,{width:P,height:re,data:Ce,legends:Jt,toggleSerie:wt},"legends"));var cn=Lq({dataWithArc:ge,arcGenerator:pe,centerX:be,centerY:Ae,radius:Me,innerRadius:et});return v.jsx(ld,{width:qe,height:Ge,margin:ot,defs:Ut,role:ye,children:u.map(function(Ft,dr){return le[Ft]!==void 0?le[Ft]:typeof Ft=="function"?v.jsx(m.Fragment,{children:m.createElement(Ft,cn)},dr):null})})},zq=function(e){var t=e.isInteractive,n=t===void 0?Se.isInteractive:t,r=e.animate,i=r===void 0?Se.animate:r,a=e.motionConfig,o=a===void 0?Se.motionConfig:a,s=e.theme,c=e.renderWrapper,l=ZC(e,Wq);return v.jsx(zs,{animate:i,isInteractive:n,motionConfig:o,renderWrapper:c,theme:s,children:v.jsx(Uq,Jr({isInteractive:n},l))})},Hq=function(e){return v.jsx(Ka,{children:function(t){var n=t.width,r=t.height;return v.jsx(zq,Jr({width:n,height:r},e))}})};function Vq(){}var qq=Vq,of=vC,Yq=qq,Gq=Hm,Zq=1/0,Kq=of&&1/Gq(new of([,-0]))[1]==Zq?function(e){return new of(e)}:Yq,Xq=Kq,Qq=Pm,Jq=Vw,eY=qw,tY=Im,nY=Xq,rY=Hm,iY=200;function aY(e,t,n){var r=-1,i=Jq,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=eY;else if(a>=iY){var l=t?null:nY(e);if(l)return rY(l);o=!1,i=tY,c=new Qq}else c=t?[]:s;e:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var KC=aY,oY=KC;function sY(e){return e&&e.length?oY(e):[]}var cY=sY;const Bb=Rt(cY);var lY=pu,uY=qm,dY=1,fY=2;function hY(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new lY;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?uY(u,l,dY|fY,r,d):f))return!1}}return!0}var pY=hY,mY=ur;function gY(e){return e===e&&!mY(e)}var XC=gY,vY=XC,bY=Ws;function yY(e){for(var t=bY(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,vY(i)]}return t}var xY=yY;function _Y(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var QC=_Y,wY=pY,CY=xY,TY=QC;function kY(e){var t=CY(e);return t.length==1&&t[0][2]?TY(t[0][0],t[0][1]):function(n){return n===e||wY(n,e,t)}}var SY=kY,OY=qm,EY=Y_,MY=cC,$Y=lm,RY=XC,AY=QC,jY=Ya,PY=1,IY=2;function DY(e,t){return $Y(e)&&RY(t)?AY(jY(e),t):function(n){var r=EY(n,e);return r===void 0&&r===t?MY(n,e):OY(t,r,PY|IY)}}var NY=DY;function FY(e){return function(t){return t==null?void 0:t[e]}}var LY=FY,BY=Ls;function WY(e){return function(t){return BY(t,e)}}var UY=WY,zY=LY,HY=UY,VY=lm,qY=Ya;function YY(e){return VY(e)?zY(qY(e)):HY(e)}var GY=YY,ZY=SY,KY=NY,XY=yu,QY=Cn,JY=GY;function eG(e){return typeof e=="function"?e:e==null?XY:typeof e=="object"?QY(e)?KY(e[0],e[1]):ZY(e):JY(e)}var eg=eG,tG=eg,nG=KC;function rG(e,t){return e&&e.length?nG(e,tG(t)):[]}var iG=rG;const Oh=Rt(iG);var aG=E_,oG=Ws;function sG(e,t){return e&&aG(e,t,oG)}var cG=sG,lG=za;function uG(e,t){return function(n,r){if(n==null)return n;if(!lG(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var dG=uG,fG=cG,hG=dG,pG=hG(fG),JC=pG,mG=JC,gG=za;function vG(e,t){var n=-1,r=gG(e)?Array(e.length):[];return mG(e,function(i,a,o){r[++n]=t(i,a,o)}),r}var bG=vG;function yG(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var xG=yG,Wb=xu;function _G(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=Wb(e),o=t!==void 0,s=t===null,c=t===t,l=Wb(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}var wG=_G,CG=wG;function TG(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=CG(i[r],a[r]);if(c){if(r>=s)return c;var l=n[r];return c*(l=="desc"?-1:1)}}return e.index-t.index}var kG=TG,sf=_u,SG=Ls,OG=eg,EG=bG,MG=xG,$G=Ha,RG=kG,AG=yu,jG=Cn;function PG(e,t,n){t.length?t=sf(t,function(a){return jG(a)?function(o){return SG(o,a.length===1?a[0]:a)}:a}):t=[AG];var r=-1;t=sf(t,$G(OG));var i=EG(e,function(a,o,s){var c=sf(t,function(l){return l(a)});return{criteria:c,index:++r,value:a}});return MG(i,function(a,o){return RG(a,o,n)})}var IG=PG,DG=uC,NG=IG,FG=cm,Ub=z_,LG=FG(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Ub(e,t[0],t[1])?t=[]:n>2&&Ub(t[0],t[1],t[2])&&(t=[t[0]]),NG(e,DG(t,1),[])}),BG=LG;const WG=Rt(BG);var UG=Or,zG=Nn,HG="[object Date]";function VG(e){return zG(e)&&UG(e)==HG}var qG=VG,YG=qG,GG=Ha,zb=vu,Hb=zb&&zb.isDate,ZG=Hb?GG(Hb):YG,KG=ZG;const XG=Rt(KG);function ui(){return ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ui.apply(this,arguments)}var Ji=[function(e){return e.setMilliseconds(0)},function(e){return e.setSeconds(0)},function(e){return e.setMinutes(0)},function(e){return e.setHours(0)},function(e){return e.setDate(1)},function(e){return e.setMonth(0)}],QG={millisecond:[],second:Ji.slice(0,1),minute:Ji.slice(0,2),hour:Ji.slice(0,3),day:Ji.slice(0,4),month:Ji.slice(0,5),year:Ji.slice(0,6)},JG=function(e){return function(t){return QG[e].forEach(function(n){n(t)}),t}},eT=function(e){var t=e.format,n=t===void 0?"native":t,r=e.precision,i=r===void 0?"millisecond":r,a=e.useUTC,o=a===void 0||a,s=JG(i);return function(c){if(c===void 0)return c;if(n==="native"||c instanceof Date)return s(c);var l=o?Dw(n):Pw(n);return s(l(c))}},eZ=function(e,t,n,r){var i,a,o,s,c=e.min,l=c===void 0?0:c,u=e.max,d=u===void 0?"auto":u,f=e.stacked,h=f!==void 0&&f,g=e.reverse,p=g!==void 0&&g,b=e.clamp,x=b!==void 0&&b,_=e.nice,y=_!==void 0&&_;l==="auto"?i=h===!0?(a=t.minStacked)!=null?a:0:t.min:i=l,d==="auto"?o=h===!0?(s=t.maxStacked)!=null?s:0:t.max:o=d;var C=sw().rangeRound(r==="x"?[0,n]:[n,0]).domain(p?[o,i]:[i,o]).clamp(x);return y===!0?C.nice():typeof y=="number"&&C.nice(y),tZ(C,h)},tZ=function(e,t){t===void 0&&(t=!1);var n=e;return n.type="linear",n.stacked=t,n},nZ=function(e,t,n){var r=zF().range([0,n]).domain(t.all);return r.type="point",r},rZ=function(e,t,n,r){var i=e.round,a=i===void 0||i,o=vm().range(r==="x"?[0,n]:[n,0]).domain(t.all).round(a);return iZ(o)},iZ=function(e){var t=e;return t.type="band",t},aZ=function(e,t,n){var r,i,a=e.format,o=a===void 0?"native":a,s=e.precision,c=s===void 0?"millisecond":s,l=e.min,u=l===void 0?"auto":l,d=e.max,f=d===void 0?"auto":d,h=e.useUTC,g=h===void 0||h,p=e.nice,b=p!==void 0&&p,x=eT({format:o,precision:c,useUTC:g});r=u==="auto"?x(t.min):o!=="native"?x(u):u,i=f==="auto"?x(t.max):o!=="native"?x(f):f;var _=g?PB():jB();_.range([0,n]),r&&i&&_.domain([r,i]),b===!0?_.nice():typeof b!="object"&&typeof b!="number"||_.nice(b);var y=_;return y.type="time",y.useUTC=g,y},oZ=function(e,t,n,r){var i,a=e.base,o=a===void 0?10:a,s=e.min,c=s===void 0?"auto":s,l=e.max,u=l===void 0?"auto":l;if(t.all.some(function(p){return p===0}))throw new Error("a log scale domain must not include or cross zero");var d,f,h=!1;if(t.all.filter(function(p){return p!=null}).forEach(function(p){h||(i===void 0?i=Math.sign(p):Math.sign(p)!==i&&(h=!0))}),h)throw new Error("a log scale domain must be strictly-positive or strictly-negative");d=c==="auto"?t.min:c,f=u==="auto"?t.max:u;var g=lw().domain([d,f]).rangeRound(r==="x"?[0,n]:[n,0]).base(o).nice();return g.type="log",g},sZ=function(e,t,n,r){var i,a,o=e.constant,s=o===void 0?1:o,c=e.min,l=c===void 0?"auto":c,u=e.max,d=u===void 0?"auto":u,f=e.reverse,h=f!==void 0&&f;i=l==="auto"?t.min:l,a=d==="auto"?t.max:d;var g=uw().constant(s).rangeRound(r==="x"?[0,n]:[n,0]).nice();h===!0?g.domain([a,i]):g.domain([i,a]);var p=g;return p.type="symlog",p},cZ=function(e){return e==="x"?"y":"x"},lZ=function(e,t){return e===t},uZ=function(e,t){return e.getTime()===t.getTime()};function ys(e,t,n,r){switch(e.type){case"linear":return eZ(e,t,n,r);case"point":return nZ(e,t,n);case"band":return rZ(e,t,n,r);case"time":return aZ(e,t,n);case"log":return oZ(e,t,n,r);case"symlog":return sZ(e,t,n,r);default:throw new Error("invalid scale spec")}}var Vb=function(e,t,n){var r;if("stacked"in n&&n.stacked){var i=e.data[t==="x"?"xStacked":"yStacked"];return i==null?null:n(i)}return(r=n(e.data[t]))!=null?r:null},dZ=function(e,t,n,r,i){var a=e.map(function(u){return function(d){return ui({},d,{data:d.data.map(function(f){return{data:ui({},f)}})})}(u)}),o=fZ(a,t,n);"stacked"in t&&t.stacked===!0&&hZ(o,a),"stacked"in n&&n.stacked===!0&&pZ(o,a);var s=ys(t,o.x,r,"x"),c=ys(n,o.y,i,"y"),l=a.map(function(u){return ui({},u,{data:u.data.map(function(d){return ui({},d,{position:{x:Vb(d,"x",s),y:Vb(d,"y",c)}})})})});return ui({},o,{series:l,xScale:s,yScale:c})},fZ=function(e,t,n){return{x:qb(e,"x",t),y:qb(e,"y",n)}},qb=function(e,t,n,r){var i={},a=i.getValue,o=a===void 0?function(g){return g.data[t]}:a,s=i.setValue,c=s===void 0?function(g,p){g.data[t]=p}:s;if(n.type==="linear")e.forEach(function(g){g.data.forEach(function(p){var b=o(p);b&&c(p,parseFloat(String(b)))})});else if(n.type==="time"&&n.format!=="native"){var l=eT(n);e.forEach(function(g){g.data.forEach(function(p){var b=o(p);b&&c(p,l(b))})})}var u=[];switch(e.forEach(function(g){g.data.forEach(function(p){u.push(o(p))})}),n.type){case"linear":var d=WG(Bb(u).filter(function(g){return g!==null}),function(g){return g});return{all:d,min:Math.min.apply(Math,d),max:Math.max.apply(Math,d)};case"time":var f=Oh(u,function(g){return g.getTime()}).slice(0).sort(function(g,p){return p.getTime()-g.getTime()}).reverse();return{all:f,min:f[0],max:xe(f)};default:var h=Bb(u);return{all:h,min:h[0],max:xe(h)}}},tT=function(e,t,n){var r=cZ(e),i=[];t[r].all.forEach(function(a){var o=XG(a)?uZ:lZ,s=[];n.forEach(function(c){var l=c.data.find(function(h){return o(h.data[r],a)}),u=null,d=null;if(l!==void 0){if((u=l.data[e])!==null){var f=xe(s);f===void 0?d=u:f!==null&&(d=f+u)}l.data[e==="x"?"xStacked":"yStacked"]=d}s.push(d),d!==null&&i.push(d)})}),t[e].minStacked=Math.min.apply(Math,i),t[e].maxStacked=Math.max.apply(Math,i)},hZ=function(e,t){return tT("x",e,t)},pZ=function(e,t){return tT("y",e,t)},nT=function(e){var t=e.bandwidth();if(t===0)return e;var n=t/2;return e.round()&&(n=Math.round(n)),function(r){var i;return((i=e(r))!=null?i:0)+n}},rT={millisecond:[ms,ms],second:[hh,hh],minute:[gw,Cw],hour:[vw,Tw],day:[zt(function(e){return e.setHours(0,0,0,0)},function(e,t){return e.setDate(e.getDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)}),zt(function(e){return e.setUTCHours(0,0,0,0)},function(e,t){return e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)})],week:[ml,gl],sunday:[ml,gl],monday:[gs,vs],tuesday:[bw,kw],wednesday:[yw,Sw],thursday:[Pi,Ii],friday:[xw,Ow],saturday:[_w,Ew],month:[ww,Mw],year:[Kr,Xr]},mZ=Object.keys(rT),gZ=new RegExp("^every\\s*(\\d+)?\\s*("+mZ.join("|")+")s?$","i"),iT=function(e,t){if(Array.isArray(t))return t;if(typeof t=="string"&&"useUTC"in e){var n=t.match(gZ);if(n){var r=n[1],i=n[2],a=rT[i][e.useUTC?1:0];if(i==="day"){var o,s,c=e.domain(),l=c[0],u=c[1],d=new Date(u);return d.setDate(d.getDate()+1),(o=(s=a.every(Number(r??1)))==null?void 0:s.range(l,d))!=null?o:[]}if(r===void 0)return e.ticks(a);var f=a.every(Number(r));if(f)return e.ticks(f)}throw new Error("Invalid tickValues: "+t)}if("ticks"in e){if(t===void 0)return e.ticks();if(typeof(h=t)=="number"&&isFinite(h)&&Math.floor(h)===h)return e.ticks(t)}var h;return e.domain()};function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}var aT=function(e){var t,n=e.axis,r=e.scale,i=e.ticksPosition,a=e.tickValues,o=e.tickSize,s=e.tickPadding,c=e.tickRotation,l=e.truncateTickAt,u=e.engine,d=u===void 0?"svg":u,f=iT(r,a),h=AV[d],g="bandwidth"in r?nT(r):r,p={lineX:0,lineY:0},b={textX:0,textY:0},x=typeof document=="object"&&document.dir==="rtl",_=h.align.center,y=h.baseline.center;return n==="x"?(t=function(C){var w;return{x:(w=g(C))!=null?w:0,y:0}},p.lineY=o*(i==="after"?1:-1),b.textY=(o+s)*(i==="after"?1:-1),y=i==="after"?h.baseline.top:h.baseline.bottom,c===0?_=h.align.center:i==="after"&&c<0||i==="before"&&c>0?(_=h.align[x?"left":"right"],y=h.baseline.center):(i==="after"&&c>0||i==="before"&&c<0)&&(_=h.align[x?"right":"left"],y=h.baseline.center)):(t=function(C){var w;return{x:0,y:(w=g(C))!=null?w:0}},p.lineX=o*(i==="after"?1:-1),b.textX=(o+s)*(i==="after"?1:-1),_=i==="after"?h.align.left:h.align.right),{ticks:f.map(function(C){var w=typeof C=="string"?function(T){var $=String(T).length;return l&&l>0&&$>l?""+String(T).slice(0,l).concat("..."):""+T}(C):C;return jn({key:C instanceof Date?""+C.valueOf():""+C,value:w},t(C),p,b)}),textAlign:_,textBaseline:y}},oT=function(e,t){if(e===void 0||typeof e=="function")return e;if(t.type==="time"){var n=Eu(e);return function(r){return n(r instanceof Date?r:new Date(r))}}return Bs(e)},Eh=function(e){var t,n=e.width,r=e.height,i=e.scale,a=e.axis,o=e.values,s=(t=o,(Array.isArray(t)?o:void 0)||iT(i,o)),c="bandwidth"in i?nT(i):i,l=a==="x"?s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:(d=c(u))!=null?d:0,x2:(f=c(u))!=null?f:0,y1:0,y2:r}}):s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:0,x2:n,y1:(d=c(u))!=null?d:0,y2:(f=c(u))!=null?f:0}});return l},vZ=m.memo(function(e){var t,n=e.value,r=e.format,i=e.lineX,a=e.lineY,o=e.onClick,s=e.textBaseline,c=e.textAnchor,l=e.animatedProps,u=ht(),d=u.axis.ticks.line,f=u.axis.ticks.text,h=(t=r==null?void 0:r(n))!=null?t:n,g=m.useMemo(function(){var p={opacity:l.opacity};return o?{style:jn({},p,{cursor:"pointer"}),onClick:function(b){return o(b,h)}}:{style:p}},[l.opacity,o,h]);return v.jsxs(ft.g,jn({transform:l.transform},g,{children:[v.jsx("line",{x1:0,x2:i,y1:0,y2:a,style:d}),f.outlineWidth>0&&v.jsx(ft.text,{dominantBaseline:s,textAnchor:c,transform:l.textTransform,style:f,strokeWidth:2*f.outlineWidth,stroke:f.outlineColor,strokeLinejoin:"round",children:""+h}),v.jsx(ft.text,{dominantBaseline:s,textAnchor:c,transform:l.textTransform,style:Zm(f),children:""+h})]}))}),bZ=function(e){var t=e.axis,n=e.scale,r=e.x,i=r===void 0?0:r,a=e.y,o=a===void 0?0:a,s=e.length,c=e.ticksPosition,l=e.tickValues,u=e.tickSize,d=u===void 0?5:u,f=e.tickPadding,h=f===void 0?5:f,g=e.tickRotation,p=g===void 0?0:g,b=e.format,x=e.renderTick,_=x===void 0?vZ:x,y=e.truncateTickAt,C=e.legend,w=e.legendPosition,T=w===void 0?"end":w,$=e.legendOffset,R=$===void 0?0:$,S=e.onClick,k=e.ariaHidden,O=ht(),D=O.axis.legend.text,E=m.useMemo(function(){return oT(b,n)},[b,n]),M=aT({axis:t,scale:n,ticksPosition:c,tickValues:l,tickSize:d,tickPadding:h,tickRotation:p,truncateTickAt:y}),j=M.ticks,F=M.textAlign,W=M.textBaseline,B=null;if(C!==void 0){var U,N=0,V=0,X=0;t==="y"?(X=-90,N=R,T==="start"?(U="start",V=s):T==="middle"?(U="middle",V=s/2):T==="end"&&(U="end")):(V=R,T==="start"?U="start":T==="middle"?(U="middle",N=s/2):T==="end"&&(U="end",N=s)),B=v.jsxs(v.Fragment,{children:[D.outlineWidth>0&&v.jsx("text",{transform:"translate("+N+", "+V+") rotate("+X+")",textAnchor:U,style:jn({dominantBaseline:"central"},D),strokeWidth:2*D.outlineWidth,stroke:D.outlineColor,strokeLinejoin:"round",children:C}),v.jsx("text",{transform:"translate("+N+", "+V+") rotate("+X+")",textAnchor:U,style:jn({dominantBaseline:"central"},D),children:C})]})}var ne=mn(),K=ne.animate,J=ne.config,q=cr({transform:"translate("+i+","+o+")",lineX2:t==="x"?s:0,lineY2:t==="x"?0:s,config:J,immediate:!K}),G=m.useCallback(function(H){return{opacity:1,transform:"translate("+H.x+","+H.y+")",textTransform:"translate("+H.textX+","+H.textY+") rotate("+p+")"}},[p]),z=m.useCallback(function(H){return{opacity:0,transform:"translate("+H.x+","+H.y+")",textTransform:"translate("+H.textX+","+H.textY+") rotate("+p+")"}},[p]),L=Fi(j,{keys:function(H){return H.key},initial:G,from:z,enter:G,update:G,leave:{opacity:0},config:J,immediate:!K});return v.jsxs(ft.g,{transform:q.transform,"aria-hidden":k,children:[L(function(H,ee,A,se){return ie.createElement(_,jn({tickIndex:se,format:E,rotate:p,textBaseline:W,textAnchor:F,truncateTickAt:y,animatedProps:H},ee,S?{onClick:S}:{}))}),v.jsx(ft.line,{style:O.axis.domain.line,x1:0,x2:q.lineX2,y1:0,y2:q.lineY2}),B]})},yZ=m.memo(bZ),sT=["top","right","bottom","left"],cT=m.memo(function(e){var t=e.xScale,n=e.yScale,r=e.width,i=e.height,a={top:e.top,right:e.right,bottom:e.bottom,left:e.left};return v.jsx(v.Fragment,{children:sT.map(function(o){var s=a[o];if(!s)return null;var c=o==="top"||o==="bottom";return v.jsx(yZ,jn({},s,{axis:c?"x":"y",x:o==="right"?r:0,y:o==="bottom"?i:0,scale:c?t:n,length:c?r:i,ticksPosition:o==="top"||o==="left"?"before":"after",truncateTickAt:s.truncateTickAt}),o)})})}),xZ=m.memo(function(e){var t=e.animatedProps,n=ht();return v.jsx(ft.line,jn({},t,n.grid.line))}),Yb=m.memo(function(e){var t=e.lines,n=mn(),r=n.animate,i=n.config,a=Fi(t,{keys:function(o){return o.key},initial:function(o){return{opacity:1,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},from:function(o){return{opacity:0,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},enter:function(o){return{opacity:1,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},update:function(o){return{opacity:1,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},leave:{opacity:0},config:i,immediate:!r});return v.jsx("g",{children:a(function(o,s){return m.createElement(xZ,jn({},s,{key:s.key,animatedProps:o}))})})}),lT=m.memo(function(e){var t=e.width,n=e.height,r=e.xScale,i=e.yScale,a=e.xValues,o=e.yValues,s=m.useMemo(function(){return!!r&&Eh({width:t,height:n,scale:r,axis:"x",values:a})},[r,a,t,n]),c=m.useMemo(function(){return!!i&&Eh({width:t,height:n,scale:i,axis:"y",values:o})},[n,t,i,o]);return v.jsxs(v.Fragment,{children:[s&&v.jsx(Yb,{lines:s}),c&&v.jsx(Yb,{lines:c})]})}),_Z=function(e,t){var n,r=t.axis,i=t.scale,a=t.x,o=a===void 0?0:a,s=t.y,c=s===void 0?0:s,l=t.length,u=t.ticksPosition,d=t.tickValues,f=t.tickSize,h=f===void 0?5:f,g=t.tickPadding,p=g===void 0?5:g,b=t.tickRotation,x=b===void 0?0:b,_=t.format,y=t.legend,C=t.legendPosition,w=C===void 0?"end":C,T=t.legendOffset,$=T===void 0?0:T,R=t.theme,S=aT({axis:r,scale:i,ticksPosition:u,tickValues:d,tickSize:h,tickPadding:p,tickRotation:x,engine:"canvas"}),k=S.ticks,O=S.textAlign,D=S.textBaseline;e.save(),e.translate(o,c),e.textAlign=O,e.textBaseline=D;var E=R.axis.ticks.text;e.font=(E.fontWeight?E.fontWeight+" ":"")+E.fontSize+"px "+E.fontFamily,((n=R.axis.domain.line.strokeWidth)!=null?n:0)>0&&(e.lineWidth=Number(R.axis.domain.line.strokeWidth),e.lineCap="square",R.axis.domain.line.stroke&&(e.strokeStyle=R.axis.domain.line.stroke),e.beginPath(),e.moveTo(0,0),e.lineTo(r==="x"?l:0,r==="x"?0:l),e.stroke());var M=typeof _=="function"?_:function(U){return""+U};if(k.forEach(function(U){var N;((N=R.axis.ticks.line.strokeWidth)!=null?N:0)>0&&(e.lineWidth=Number(R.axis.ticks.line.strokeWidth),e.lineCap="square",R.axis.ticks.line.stroke&&(e.strokeStyle=R.axis.ticks.line.stroke),e.beginPath(),e.moveTo(U.x,U.y),e.lineTo(U.x+U.lineX,U.y+U.lineY),e.stroke());var V=M(U.value);e.save(),e.translate(U.x+U.textX,U.y+U.textY),e.rotate(An(x)),E.outlineWidth>0&&(e.strokeStyle=E.outlineColor,e.lineWidth=2*E.outlineWidth,e.lineJoin="round",e.strokeText(""+V,0,0)),R.axis.ticks.text.fill&&(e.fillStyle=E.fill),e.fillText(""+V,0,0),e.restore()}),y!==void 0){var j=0,F=0,W=0,B="center";r==="y"?(W=-90,j=$,w==="start"?(B="start",F=l):w==="middle"?(B="center",F=l/2):w==="end"&&(B="end")):(F=$,w==="start"?B="start":w==="middle"?(B="center",j=l/2):w==="end"&&(B="end",j=l)),e.translate(j,F),e.rotate(An(W)),e.font=(R.axis.legend.text.fontWeight?R.axis.legend.text.fontWeight+" ":"")+R.axis.legend.text.fontSize+"px "+R.axis.legend.text.fontFamily,R.axis.legend.text.fill&&(e.fillStyle=R.axis.legend.text.fill),e.textAlign=B,e.textBaseline="middle",e.fillText(y,0,0)}e.restore()},uT=function(e,t){var n=t.xScale,r=t.yScale,i=t.width,a=t.height,o=t.top,s=t.right,c=t.bottom,l=t.left,u=t.theme,d={top:o,right:s,bottom:c,left:l};sT.forEach(function(f){var h=d[f];if(!h)return null;var g=f==="top"||f==="bottom",p=f==="top"||f==="left"?"before":"after",b=g?n:r,x=oT(h.format,b);_Z(e,jn({},h,{axis:g?"x":"y",x:f==="right"?i:0,y:f==="bottom"?a:0,scale:b,format:x,length:g?i:a,ticksPosition:p,theme:u}))})},Cl=function(e,t){var n=t.width,r=t.height,i=t.scale,a=t.axis,o=t.values;Eh({width:n,height:r,scale:i,axis:a,values:o}).forEach(function(s){e.beginPath(),e.moveTo(s.x1,s.y1),e.lineTo(s.x2,s.y2),e.stroke()})},wZ=q_,CZ=0;function TZ(e){var t=++CZ;return wZ(e)+t}var kZ=TZ;const SZ=Rt(kZ),xr=11102230246251565e-32,tn=134217729,OZ=(3+8*xr)*xr;function cf(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let h=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[h++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[h++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[h++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[h++]=s);return(a!==0||h===0)&&(i[h++]=a),h}function EZ(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function Hs(e){return new Float64Array(e)}const MZ=(3+16*xr)*xr,$Z=(2+12*xr)*xr,RZ=(9+64*xr)*xr*xr,ea=Hs(4),Gb=Hs(8),Zb=Hs(12),Kb=Hs(16),ln=Hs(4);function AZ(e,t,n,r,i,a,o){let s,c,l,u,d,f,h,g,p,b,x,_,y,C,w,T,$,R;const S=e-i,k=n-i,O=t-a,D=r-a;C=S*D,f=tn*S,h=f-(f-S),g=S-h,f=tn*D,p=f-(f-D),b=D-p,w=g*b-(C-h*p-g*p-h*b),T=O*k,f=tn*O,h=f-(f-O),g=O-h,f=tn*k,p=f-(f-k),b=k-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ea[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ea[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ea[2]=_-(R-d)+(x-d),ea[3]=R;let E=EZ(4,ea),M=$Z*o;if(E>=M||-E>=M||(d=e-S,s=e-(S+d)+(d-i),d=n-k,l=n-(k+d)+(d-i),d=t-O,c=t-(O+d)+(d-a),d=r-D,u=r-(D+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(M=RZ*o+OZ*Math.abs(E),E+=S*u+D*s-(O*l+k*c),E>=M||-E>=M))return E;C=s*D,f=tn*s,h=f-(f-s),g=s-h,f=tn*D,p=f-(f-D),b=D-p,w=g*b-(C-h*p-g*p-h*b),T=c*k,f=tn*c,h=f-(f-c),g=c-h,f=tn*k,p=f-(f-k),b=k-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ln[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ln[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ln[2]=_-(R-d)+(x-d),ln[3]=R;const j=cf(4,ea,4,ln,Gb);C=S*u,f=tn*S,h=f-(f-S),g=S-h,f=tn*u,p=f-(f-u),b=u-p,w=g*b-(C-h*p-g*p-h*b),T=O*l,f=tn*O,h=f-(f-O),g=O-h,f=tn*l,p=f-(f-l),b=l-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ln[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ln[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ln[2]=_-(R-d)+(x-d),ln[3]=R;const F=cf(j,Gb,4,ln,Zb);C=s*u,f=tn*s,h=f-(f-s),g=s-h,f=tn*u,p=f-(f-u),b=u-p,w=g*b-(C-h*p-g*p-h*b),T=c*l,f=tn*c,h=f-(f-c),g=c-h,f=tn*l,p=f-(f-l),b=l-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ln[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ln[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ln[2]=_-(R-d)+(x-d),ln[3]=R;const W=cf(F,Zb,4,ln,Kb);return Kb[W-1]}function fc(e,t,n,r,i,a){const o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=MZ*l?c:-AZ(e,t,n,r,i,a,l)}const Xb=Math.pow(2,-52),hc=new Uint32Array(512);class Tl{static from(t,n=NZ,r=FZ){const i=t.length,a=new Float64Array(i*2);for(let o=0;o<i;o++){const s=t[o];a[2*o]=n(s),a[2*o+1]=r(s)}return new Tl(a)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:a}=this,o=t.length>>1;let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let S=0;S<o;S++){const k=t[2*S],O=t[2*S+1];k<s&&(s=k),O<c&&(c=O),k>l&&(l=k),O>u&&(u=O),this._ids[S]=S}const d=(s+l)/2,f=(c+u)/2;let h,g,p;for(let S=0,k=1/0;S<o;S++){const O=lf(d,f,t[2*S],t[2*S+1]);O<k&&(h=S,k=O)}const b=t[2*h],x=t[2*h+1];for(let S=0,k=1/0;S<o;S++){if(S===h)continue;const O=lf(b,x,t[2*S],t[2*S+1]);O<k&&O>0&&(g=S,k=O)}let _=t[2*g],y=t[2*g+1],C=1/0;for(let S=0;S<o;S++){if(S===h||S===g)continue;const k=IZ(b,x,_,y,t[2*S],t[2*S+1]);k<C&&(p=S,C=k)}let w=t[2*p],T=t[2*p+1];if(C===1/0){for(let O=0;O<o;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];sa(this._ids,this._dists,0,o-1);const S=new Uint32Array(o);let k=0;for(let O=0,D=-1/0;O<o;O++){const E=this._ids[O],M=this._dists[E];M>D&&(S[k++]=E,D=M)}this.hull=S.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(fc(b,x,_,y,w,T)<0){const S=g,k=_,O=y;g=p,_=w,y=T,p=S,w=k,T=O}const $=DZ(b,x,_,y,w,T);this._cx=$.x,this._cy=$.y;for(let S=0;S<o;S++)this._dists[S]=lf(t[2*S],t[2*S+1],$.x,$.y);sa(this._ids,this._dists,0,o-1),this._hullStart=h;let R=3;r[h]=n[p]=g,r[g]=n[h]=p,r[p]=n[g]=h,i[h]=0,i[g]=1,i[p]=2,a.fill(-1),a[this._hashKey(b,x)]=h,a[this._hashKey(_,y)]=g,a[this._hashKey(w,T)]=p,this.trianglesLen=0,this._addTriangle(h,g,p,-1,-1,-1);for(let S=0,k,O;S<this._ids.length;S++){const D=this._ids[S],E=t[2*D],M=t[2*D+1];if(S>0&&Math.abs(E-k)<=Xb&&Math.abs(M-O)<=Xb||(k=E,O=M,D===h||D===g||D===p))continue;let j=0;for(let N=0,V=this._hashKey(E,M);N<this._hashSize&&(j=a[(V+N)%this._hashSize],!(j!==-1&&j!==r[j]));N++);j=n[j];let F=j,W;for(;W=r[F],fc(E,M,t[2*F],t[2*F+1],t[2*W],t[2*W+1])>=0;)if(F=W,F===j){F=-1;break}if(F===-1)continue;let B=this._addTriangle(F,D,r[F],-1,-1,i[F]);i[D]=this._legalize(B+2),i[F]=B,R++;let U=r[F];for(;W=r[U],fc(E,M,t[2*U],t[2*U+1],t[2*W],t[2*W+1])<0;)B=this._addTriangle(U,D,W,i[D],-1,i[U]),i[D]=this._legalize(B+2),r[U]=U,R--,U=W;if(F===j)for(;W=n[F],fc(E,M,t[2*W],t[2*W+1],t[2*F],t[2*F+1])<0;)B=this._addTriangle(W,D,F,-1,i[F],i[W]),this._legalize(B+2),i[W]=B,r[F]=F,R--,F=W;this._hullStart=n[D]=F,r[F]=n[U]=D,r[D]=U,a[this._hashKey(E,M)]=D,a[this._hashKey(t[2*F],t[2*F+1])]=F}this.hull=new Uint32Array(R);for(let S=0,k=this._hullStart;S<R;S++)this.hull[S]=k,k=r[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(jZ(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:r,coords:i}=this;let a=0,o=0;for(;;){const s=r[t],c=t-t%3;if(o=c+(t+2)%3,s===-1){if(a===0)break;t=hc[--a];continue}const l=s-s%3,u=c+(t+1)%3,d=l+(s+2)%3,f=n[o],h=n[t],g=n[u],p=n[d];if(PZ(i[2*f],i[2*f+1],i[2*h],i[2*h+1],i[2*g],i[2*g+1],i[2*p],i[2*p+1])){n[t]=p,n[s]=f;const x=r[d];if(x===-1){let y=this._hullStart;do{if(this._hullTri[y]===d){this._hullTri[y]=t;break}y=this._hullPrev[y]}while(y!==this._hullStart)}this._link(t,x),this._link(s,r[o]),this._link(o,d);const _=l+(s+1)%3;a<hc.length&&(hc[a++]=_)}else{if(a===0)break;t=hc[--a]}}return o}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,a,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=n,this._triangles[s+2]=r,this._link(s,i),this._link(s+1,a),this._link(s+2,o),this.trianglesLen+=3,s}}function jZ(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function lf(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}function PZ(e,t,n,r,i,a,o,s){const c=e-o,l=t-s,u=n-o,d=r-s,f=i-o,h=a-s,g=c*c+l*l,p=u*u+d*d,b=f*f+h*h;return c*(d*b-p*h)-l*(u*b-p*f)+g*(u*h-d*f)<0}function IZ(e,t,n,r,i,a){const o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),h=(l*u-s*d)*f,g=(o*d-c*u)*f;return h*h+g*g}function DZ(e,t,n,r,i,a){const o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),h=e+(l*u-s*d)*f,g=t+(o*d-c*u)*f;return{x:h,y:g}}function sa(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const a=e[i],o=t[a];let s=i-1;for(;s>=n&&t[e[s]]>o;)e[s+1]=e[s--];e[s+1]=a}else{const i=n+r>>1;let a=n+1,o=r;xo(e,i,a),t[e[n]]>t[e[r]]&&xo(e,n,r),t[e[a]]>t[e[r]]&&xo(e,a,r),t[e[n]]>t[e[a]]&&xo(e,n,a);const s=e[a],c=t[s];for(;;){do a++;while(t[e[a]]<c);do o--;while(t[e[o]]>c);if(o<a)break;xo(e,a,o)}e[n+1]=e[o],e[o]=s,r-a+1>=o-n?(sa(e,t,a,r),sa(e,t,n,o-1)):(sa(e,t,n,o-1),sa(e,t,a,r))}}function xo(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function NZ(e){return e[0]}function FZ(e){return e[1]}const Qb=1e-6;class vi{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;const i=t+r,a=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${a}`:(Math.abs(this._x1-i)>Qb||Math.abs(this._y1-a)>Qb)&&(this._+="L"+i+","+a),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=a}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class Mh{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class LZ{constructor(t,[n,r,i,a]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((a=+a)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=a,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this;let a,o;const s=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let p=0,b=0,x=r.length,_,y;p<x;p+=3,b+=2){const C=r[p]*2,w=r[p+1]*2,T=r[p+2]*2,$=t[C],R=t[C+1],S=t[w],k=t[w+1],O=t[T],D=t[T+1],E=S-$,M=k-R,j=O-$,F=D-R,W=(E*F-M*j)*2;if(Math.abs(W)<1e-9){if(a===void 0){a=o=0;for(const U of n)a+=t[U*2],o+=t[U*2+1];a/=n.length,o/=n.length}const B=1e9*Math.sign((a-$)*F-(o-R)*j);_=($+O)/2-B*F,y=(R+D)/2+B*j}else{const B=1/W,U=E*E+M*M,N=j*j+F*F;_=$+(F*U-M*N)*B,y=R+(E*N-j*U)*B}s[b]=_,s[b+1]=y}let c=n[n.length-1],l,u=c*4,d,f=t[2*c],h,g=t[2*c+1];i.fill(0);for(let p=0;p<n.length;++p)c=n[p],l=u,d=f,h=g,u=c*4,f=t[2*c],g=t[2*c+1],i[l+2]=i[u]=h-g,i[l+3]=i[u+1]=f-d}render(t){const n=t==null?t=new vi:void 0,{delaunay:{halfedges:r,inedges:i,hull:a},circumcenters:o,vectors:s}=this;if(a.length<=1)return null;for(let u=0,d=r.length;u<d;++u){const f=r[u];if(f<u)continue;const h=Math.floor(u/3)*2,g=Math.floor(f/3)*2,p=o[h],b=o[h+1],x=o[g],_=o[g+1];this._renderSegment(p,b,x,_,t)}let c,l=a[a.length-1];for(let u=0;u<a.length;++u){c=l,l=a[u];const d=Math.floor(i[l]/3)*2,f=o[d],h=o[d+1],g=c*4,p=this._project(f,h,s[g+2],s[g+3]);p&&this._renderSegment(f,h,p[0],p[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new vi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const r=n==null?n=new vi:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let a=i.length;for(;i[0]===i[a-2]&&i[1]===i[a-1]&&a>1;)a-=2;for(let o=2;o<a;o+=2)(i[o]!==i[o-2]||i[o+1]!==i[o-1])&&n.lineTo(i[o],i[o+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){const n=new Mh;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,a){let o;const s=this._regioncode(t,n),c=this._regioncode(r,i);s===0&&c===0?(a.moveTo(t,n),a.lineTo(r,i)):(o=this._clipSegment(t,n,r,i,s,c))&&(a.moveTo(o[0],o[1]),a.lineTo(o[2],o[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){const n=this._clip(t);if(n)for(const r of this.delaunay.neighbors(t)){const i=this._clip(r);if(i){e:for(let a=0,o=n.length;a<o;a+=2)for(let s=0,c=i.length;s<c;s+=2)if(n[a]===i[s]&&n[a+1]===i[s+1]&&n[(a+2)%o]===i[(s+c-2)%c]&&n[(a+3)%o]===i[(s+c-1)%c]){yield r;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:a}}=this,o=r[t];if(o===-1)return null;const s=[];let c=o;do{const l=Math.floor(c/3);if(s.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,a[c]!==t)break;c=i[c]}while(c!==o&&c!==-1);return s}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){const r=n.length;let i=null,a,o,s=n[r-2],c=n[r-1],l,u=this._regioncode(s,c),d,f=0;for(let h=0;h<r;h+=2)if(a=s,o=c,s=n[h],c=n[h+1],l=u,u=this._regioncode(s,c),l===0&&u===0)d=f,f=0,i?i.push(s,c):i=[s,c];else{let g,p,b,x,_;if(l===0){if((g=this._clipSegment(a,o,s,c,l,u))===null)continue;[p,b,x,_]=g}else{if((g=this._clipSegment(s,c,a,o,u,l))===null)continue;[x,_,p,b]=g,d=f,f=this._edgecode(p,b),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(p,b):i=[p,b]}d=f,f=this._edgecode(x,_),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(x,_):i=[x,_]}if(i)d=f,f=this._edgecode(i[0],i[1]),d&&f&&this._edge(t,d,f,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,a,o){const s=a<o;for(s&&([t,n,r,i,a,o]=[r,i,t,n,o,a]);;){if(a===0&&o===0)return s?[r,i,t,n]:[t,n,r,i];if(a&o)return null;let c,l,u=a||o;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),a?(t=c,n=l,a=this._regioncode(t,n)):(r=c,i=l,o=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,a,o){let s=Array.from(n),c;if((c=this._project(s[0],s[1],r,i))&&s.unshift(c[0],c[1]),(c=this._project(s[s.length-2],s[s.length-1],a,o))&&s.push(c[0],c[1]),s=this._clipFinite(t,s))for(let l=0,u=s.length,d,f=this._edgecode(s[u-2],s[u-1]);l<u;l+=2)d=f,f=this._edgecode(s[l],s[l+1]),d&&f&&(l=this._edge(t,d,f,s,l),u=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,n,r,i,a){for(;n!==r;){let o,s;switch(n){case 5:n=4;continue;case 4:n=6,o=this.xmax,s=this.ymin;break;case 6:n=2;continue;case 2:n=10,o=this.xmax,s=this.ymax;break;case 10:n=8;continue;case 8:n=9,o=this.xmin,s=this.ymax;break;case 9:n=1;continue;case 1:n=5,o=this.xmin,s=this.ymin;break}(i[a]!==o||i[a+1]!==s)&&this.contains(t,o,s)&&(i.splice(a,0,o,s),a+=2)}return a}_project(t,n,r,i){let a=1/0,o,s,c;if(i<0){if(n<=this.ymin)return null;(o=(this.ymin-n)/i)<a&&(c=this.ymin,s=t+(a=o)*r)}else if(i>0){if(n>=this.ymax)return null;(o=(this.ymax-n)/i)<a&&(c=this.ymax,s=t+(a=o)*r)}if(r>0){if(t>=this.xmax)return null;(o=(this.xmax-t)/r)<a&&(s=this.xmax,c=n+(a=o)*i)}else if(r<0){if(t<=this.xmin)return null;(o=(this.xmin-t)/r)<a&&(s=this.xmin,c=n+(a=o)*i)}return[s,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}}const BZ=2*Math.PI,ta=Math.pow;function WZ(e){return e[0]}function UZ(e){return e[1]}function zZ(e){const{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){const i=2*t[r],a=2*t[r+1],o=2*t[r+2];if((n[o]-n[i])*(n[a+1]-n[i+1])-(n[a]-n[i])*(n[o+1]-n[i+1])>1e-10)return!1}return!0}function HZ(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class tg{static from(t,n=WZ,r=UZ,i){return new tg("length"in t?VZ(t,n,r,i):Float64Array.from(qZ(t,n,r,i)))}constructor(t){this._delaunator=new Tl(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&zZ(t)){this.collinear=Int32Array.from({length:n.length/2},(f,h)=>h).sort((f,h)=>n[2*f]-n[2*h]||n[2*f+1]-n[2*h+1]);const c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],d=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let f=0,h=n.length/2;f<h;++f){const g=HZ(n[2*f],n[2*f+1],d);n[2*f]=g[0],n[2*f+1]=g[1]}this._delaunator=new Tl(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,a=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),s=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){const u=a[c%3===2?c-2:c+1];(r[c]===-1||o[u]===-1)&&(o[u]=c)}for(let c=0,l=i.length;c<l;++c)s[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,i.length===2&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new LZ(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:a,triangles:o,collinear:s}=this;if(s){const d=s.indexOf(t);d>0&&(yield s[d-1]),d<s.length-1&&(yield s[d+1]);return}const c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=o[l],l=l%3===2?l-2:l+1,o[l]!==t)return;if(l=a[l],l===-1){const d=r[(i[t]+1)%r.length];d!==u&&(yield d);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const i=r;let a;for(;(a=this._step(r,t,n))>=0&&a!==r&&a!==i;)r=a;return a}_step(t,n,r){const{inedges:i,hull:a,_hullIndex:o,halfedges:s,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,d=ta(n-l[t*2],2)+ta(r-l[t*2+1],2);const f=i[t];let h=f;do{let g=c[h];const p=ta(n-l[g*2],2)+ta(r-l[g*2+1],2);if(p<d&&(d=p,u=g),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=s[h],h===-1){if(h=a[(o[t]+1)%a.length],h!==g&&ta(n-l[h*2],2)+ta(r-l[h*2+1],2)<d)return h;break}}while(h!==f);return u}render(t){const n=t==null?t=new vi:void 0,{points:r,halfedges:i,triangles:a}=this;for(let o=0,s=i.length;o<s;++o){const c=i[o];if(c<o)continue;const l=a[o]*2,u=a[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const r=t==null?t=new vi:void 0,{points:i}=this;for(let a=0,o=i.length;a<o;a+=2){const s=i[a],c=i[a+1];t.moveTo(s+n,c),t.arc(s,c,n,0,BZ)}return r&&r.value()}renderHull(t){const n=t==null?t=new vi:void 0,{hull:r,points:i}=this,a=r[0]*2,o=r.length;t.moveTo(i[a],i[a+1]);for(let s=1;s<o;++s){const c=2*r[s];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new Mh;return this.renderHull(t),t.value()}renderTriangle(t,n){const r=n==null?n=new vi:void 0,{points:i,triangles:a}=this,o=a[t*=3]*2,s=a[t+1]*2,c=a[t+2]*2;return n.moveTo(i[o],i[o+1]),n.lineTo(i[s],i[s+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new Mh;return this.renderTriangle(t,n),n.value()}}function VZ(e,t,n,r){const i=e.length,a=new Float64Array(i*2);for(let o=0;o<i;++o){const s=e[o];a[o*2]=t.call(r,s,o,e),a[o*2+1]=n.call(r,s,o,e)}return a}function*qZ(e,t,n,r){let i=0;for(const a of e)yield t.call(r,a,i,e),yield n.call(r,a,i,e),++i}var ng=function(e){return[e.x,e.y]},Vs=CC,dT="cursor",fT="top",YZ=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?ng:n,i=e.margin,a=i===void 0?Vs:i;return t.map(function(o){var s=r(o),c=s[0],l=s[1];return[c+a.left,l+a.top]})},GZ=function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,a=i===void 0?Vs:i,o=e.debug,s=tg.from(t),c=o?s.voronoi([0,0,a.left+n+a.right,a.top+r+a.bottom]):void 0;return{points:t,delaunay:s,voronoi:c}},hT=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?ng:n,i=e.width,a=e.height,o=e.margin,s=o===void 0?Vs:o,c=e.debug;return m.useMemo(function(){return GZ({points:YZ({points:t,margin:s,getNodePosition:r}),width:i,height:a,margin:s,debug:c})},[t,i,a,s,c])},ZZ=function(e){var t=e.elementRef,n=e.nodes,r=e.getNodePosition,i=r===void 0?ng:r,a=e.delaunay,o=e.setCurrent,s=e.margin,c=s===void 0?Vs:s,l=e.detectionRadius,u=l===void 0?1/0:l,d=e.isInteractive,f=d===void 0||d,h=e.onMouseEnter,g=e.onMouseMove,p=e.onMouseLeave,b=e.onClick,x=e.onTouchStart,_=e.onTouchMove,y=e.onTouchEnd,C=e.enableTouchCrosshair,w=C!==void 0&&C,T=e.tooltip,$=e.tooltipPosition,R=$===void 0?dT:$,S=e.tooltipAnchor,k=S===void 0?fT:S,O=m.useState(null),D=O[0],E=O[1],M=m.useRef(null);m.useEffect(function(){M.current=D},[M,D]);var j=m.useCallback(function(z){if(!t.current)return null;var L=jo(t.current,z),H=L[0],ee=L[1],A=a.find(H,ee),se=A!==void 0?n[A]:null;if(se&&u!==1/0){var ce=i(se),ue=ce[0],we=ce[1];BV(H,ee,ue+c.left,we+c.top)>u&&(A=null,se=null)}return A===null||se===null?null:[A,se]},[t,a,n,i,c,u]),F=Li(),W=F.showTooltipAt,B=F.showTooltipFromEvent,U=F.hideTooltip,N=m.useMemo(function(){if(T)return R==="cursor"?function(z,L){B(T(z),L,k)}:function(z){var L=i(z),H=L[0],ee=L[1];W(T(z),[H+c.left,ee+c.top],k)}},[W,B,T,R,k,i,c]),V=m.useCallback(function(z){var L=j(z);if(E(L),o==null||o(L?L[1]:null),L){var H=L[1];N==null||N(H,z),h==null||h(L[1],z)}},[j,E,o,N,h]),X=m.useCallback(function(z){var L=j(z);if(E(L),L){var H=L[0],ee=L[1];if(o==null||o(ee),N==null||N(ee,z),M.current){var A=M.current,se=A[0],ce=A[1];H!==se?p==null||p(ce,z):g==null||g(ee,z)}else h==null||h(ee,z)}else o==null||o(null),U==null||U(),M.current&&(p==null||p(M.current[1],z))},[j,E,M,h,g,p,N,U]),ne=m.useCallback(function(z){E(null),o==null||o(null),U(),p&&M.current&&p(M.current[1],z)},[E,o,M,U,p]),K=m.useCallback(function(z){var L=j(z);E(L),L&&(b==null||b(L[1],z))},[j,E,b]),J=m.useCallback(function(z){var L=j(z);w&&(E(L),o==null||o(L?L[1]:null)),L&&(x==null||x(L[1],z))},[j,E,o,w,x]),q=m.useCallback(function(z){var L=j(z);w&&(E(L),o==null||o(L?L[1]:null)),L&&(_==null||_(L[1],z))},[j,E,o,w,_]),G=m.useCallback(function(z){w&&(E(null),o==null||o(null)),y&&M.current&&y(M.current[1],z)},[w,E,o,y,M]);return{current:D,handleMouseEnter:f?V:void 0,handleMouseMove:f?X:void 0,handleMouseLeave:f?ne:void 0,handleClick:f?K:void 0,handleTouchStart:f?J:void 0,handleTouchMove:f?q:void 0,handleTouchEnd:f?G:void 0}},KZ=function(e){var t=e.nodes,n=e.width,r=e.height,i=e.margin,a=i===void 0?Vs:i,o=e.getNodePosition,s=e.setCurrent,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,g=e.onTouchEnd,p=e.enableTouchCrosshair,b=p!==void 0&&p,x=e.detectionRadius,_=x===void 0?1/0:x,y=e.tooltip,C=e.tooltipPosition,w=C===void 0?dT:C,T=e.tooltipAnchor,$=T===void 0?fT:T,R=e.debug,S=m.useRef(null),k=hT({points:t,getNodePosition:o,width:n,height:r,margin:a,debug:R}),O=k.delaunay,D=k.voronoi,E=ZZ({elementRef:S,nodes:t,delaunay:O,margin:a,detectionRadius:_,setCurrent:s,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:g,enableTouchCrosshair:b,tooltip:y,tooltipPosition:w,tooltipAnchor:$}),M=E.current,j=E.handleMouseEnter,F=E.handleMouseMove,W=E.handleMouseLeave,B=E.handleClick,U=E.handleTouchStart,N=E.handleTouchMove,V=E.handleTouchEnd,X=m.useMemo(function(){if(R&&D)return D.render()},[R,D]);return v.jsxs("g",{ref:S,transform:"translate("+-a.left+","+-a.top+")",children:[R&&D&&v.jsxs(v.Fragment,{children:[v.jsx("path",{d:X,stroke:"red",strokeWidth:1,opacity:.75}),_<1/0&&v.jsx("path",{stroke:"red",strokeWidth:.35,fill:"none",d:O.renderPoints(void 0,_)}),M&&v.jsx("path",{fill:"pink",opacity:.35,d:D.renderCell(M[0])})]}),v.jsx("rect",{"data-ref":"mesh-interceptor",width:a.left+n+a.right,height:a.top+r+a.bottom,fill:"red",opacity:0,style:{cursor:"auto"},onMouseEnter:j,onMouseMove:F,onMouseLeave:W,onTouchStart:U,onTouchMove:N,onTouchEnd:V,onClick:B})]})},XZ=function(e,t){e.save(),e.globalAlpha=.75,e.beginPath(),t.render(e),e.strokeStyle="red",e.lineWidth=1,e.stroke(),e.restore()},QZ=function(e,t,n){e.save(),e.globalAlpha=.35,e.beginPath(),t.renderCell(n,e),e.fillStyle="pink",e.fill(),e.restore()};function hn(){return hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hn.apply(this,arguments)}var rg=m.memo(function(e){var t=e.point;return v.jsx(Zp,{id:v.jsxs("span",{children:["x: ",v.jsx("strong",{children:t.data.xFormatted}),", y:"," ",v.jsx("strong",{children:t.data.yFormatted})]}),enableChip:!0,color:t.serieColor})}),pT=m.memo(function(e){var t=e.slice,n=e.axis,r=ht(),i=n==="x"?"y":"x";return v.jsx(x_,{rows:t.points.map(function(a){return[v.jsx(y_,{color:a.serieColor,style:r.tooltip.chip},"chip"),a.serieId,v.jsx("span",{style:r.tooltip.tableCellValue,children:a.data[i+"Formatted"]},"value")]})})}),mT={curve:"linear",xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],axisBottom:{},axisLeft:{},enableGridX:!0,enableGridY:!0,enablePoints:!0,pointSize:6,pointColor:{from:"color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enablePointLabel:!1,pointLabel:"yFormatted",colors:{scheme:"nivo"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,areaBlendMode:"normal",lineWidth:2,legends:[],isInteractive:!0,tooltip:rg,enableSlices:!1,debugSlices:!1,sliceTooltip:pT,debugMesh:!1,enableCrosshair:!0,crosshairType:"bottom-left"},Ar=hn({},mT,{enablePointLabel:!1,useMesh:!1,enableTouchCrosshair:!1,animate:!0,motionConfig:"gentle",defs:[],fill:[],role:"img"});hn({},mT,{pixelRatio:typeof window<"u"&&window.devicePixelRatio||1});var JZ=function(e){var t=e.curve;return m.useMemo(function(){return Fm().defined(function(n){return n.x!==null&&n.y!==null}).x(function(n){return n.x}).y(function(n){return n.y}).curve(wC(t))},[t])},eK=function(e){var t=e.curve,n=e.yScale,r=e.areaBaselineValue;return m.useMemo(function(){return vU().defined(function(i){return i.x!==null&&i.y!==null}).x(function(i){return i.x}).y1(function(i){return i.y}).curve(wC(t)).y0(n(r))},[t,n,r])},tK=function(e){var t=e.componentId,n=e.enableSlices,r=e.points,i=e.width,a=e.height;return m.useMemo(function(){if(n===!1)return[];if(n==="x"){var o=new Map;return r.forEach(function(c){c.data.x!==null&&c.data.y!==null&&(o.has(c.x)?o.get(c.x).push(c):o.set(c.x,[c]))}),Array.from(o.entries()).sort(function(c,l){return c[0]-l[0]}).map(function(c,l,u){var d,f,h=c[0],g=c[1],p=u[l-1],b=u[l+1];return d=p?h-(h-p[0])/2:h,f=b?h-d+(b[0]-h)/2:i-d,{id:"slice:"+t+":"+h,x0:d,x:h,y0:0,y:0,width:f,height:a,points:g.reverse()}})}if(n==="y"){var s=new Map;return r.forEach(function(c){c.data.x!==null&&c.data.y!==null&&(s.has(c.y)?s.get(c.y).push(c):s.set(c.y,[c]))}),Array.from(s.entries()).sort(function(c,l){return c[0]-l[0]}).map(function(c,l,u){var d,f,h=c[0],g=c[1],p=u[l-1],b=u[l+1];return d=p?h-(h-p[0])/2:h,f=b?h-d+(b[0]-h)/2:a-d,{id:h,x0:0,x:0,y0:d,y:h,width:i,height:f,points:g.reverse()}})}},[t,n,a,r,i])},nK="line",gT=function(e){var t=e.data,n=e.xScale,r=n===void 0?Ar.xScale:n,i=e.xFormat,a=e.yScale,o=a===void 0?Ar.yScale:a,s=e.yFormat,c=e.width,l=e.height,u=e.colors,d=u===void 0?Ar.colors:u,f=e.curve,h=f===void 0?Ar.curve:f,g=e.areaBaselineValue,p=g===void 0?Ar.areaBaselineValue:g,b=e.pointColor,x=b===void 0?Ar.pointColor:b,_=e.pointBorderColor,y=_===void 0?Ar.pointBorderColor:_,C=e.enableSlices,w=C===void 0?Ar.enableSlicesTooltip:C,T=m.useState(SZ(nK))[0],$=Ma(i),R=Ma(s),S=Xm(d,"id"),k=ht(),O=ar(x,k),D=ar(y,k),E=m.useState([]),M=E[0],j=E[1],F=m.useMemo(function(){return dZ(t.filter(function(q){return M.indexOf(q.id)===-1}),r,o,c,l)},[t,M,r,o,c,l]),W=F.xScale,B=F.yScale,U=F.series,N=m.useMemo(function(){var q=t.map(function(z){return{id:z.id,label:z.id,color:S(z)}}),G=q.map(function(z){return hn({},U.find(function(L){return L.id===z.id}),{color:z.color})}).filter(function(z){return!!z.id});return{legendData:q.map(function(z){return hn({},z,{hidden:!G.find(function(L){return L.id===z.id})})}).reverse(),series:G}},[t,U,S]),V=N.legendData,X=N.series,ne=m.useCallback(function(q){j(function(G){return G.indexOf(q)>-1?G.filter(function(z){return z!==q}):[].concat(G,[q])})},[]),K=function(q){var G=q.series,z=q.getPointColor,L=q.getPointBorderColor,H=q.formatX,ee=q.formatY;return m.useMemo(function(){return G.reduce(function(A,se){return[].concat(A,se.data.filter(function(ce){return ce.position.x!==null&&ce.position.y!==null}).map(function(ce,ue){var we={id:se.id+"."+ue,index:A.length+ue,serieId:se.id,serieColor:se.color,x:ce.position.x,y:ce.position.y};return we.color=z(se),we.borderColor=L(we),we.data=hn({},ce.data,{xFormatted:H(ce.data.x),yFormatted:ee(ce.data.y)}),we}))},[])},[G,z,L,H,ee])}({series:X,getPointColor:O,getPointBorderColor:D,formatX:$,formatY:R}),J=tK({componentId:T,enableSlices:w,points:K,width:c,height:l});return{legendData:V,toggleSerie:ne,lineGenerator:JZ({curve:h}),areaGenerator:eK({curve:h,yScale:B,areaBaselineValue:p}),getColor:S,series:X,xScale:W,yScale:B,slices:J,points:K}},rK=function(e){var t=e.areaBlendMode,n=e.areaOpacity,r=e.color,i=e.fill,a=e.path,o=mn(),s=o.animate,c=o.config,l=Ym(a),u=cr({color:r,config:c,immediate:!s});return v.jsx(ft.path,{d:l,fill:i||u.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:t}})},iK=m.memo(function(e){var t=e.areaGenerator,n=e.areaOpacity,r=e.areaBlendMode,i=e.lines.slice(0).reverse();return v.jsx("g",{children:i.map(function(a){return v.jsx(rK,hn({path:t(a.data.map(function(o){return o.position}))},hn({areaOpacity:n,areaBlendMode:r},a)),a.id)})})}),aK=m.memo(function(e){var t=e.lineGenerator,n=e.points,r=e.color,i=e.thickness,a=m.useMemo(function(){return t(n)},[t,n]),o=Ym(a);return v.jsx(ft.path,{d:o,fill:"none",strokeWidth:i,stroke:r})}),oK=m.memo(function(e){var t=e.lines,n=e.lineGenerator,r=e.lineWidth;return t.slice(0).reverse().map(function(i){var a=i.id,o=i.data,s=i.color;return v.jsx(aK,{id:a,points:o.map(function(c){return c.position}),lineGenerator:n,color:s,thickness:r},a)})}),sK=m.memo(function(e){var t=e.slice,n=e.slices,r=e.axis,i=e.debug,a=e.tooltip,o=e.isCurrent,s=e.setCurrent,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,g=e.onTouchEnd,p=Li(),b=p.showTooltipFromEvent,x=p.hideTooltip,_=m.useCallback(function(S){b(m.createElement(a,{slice:t,axis:r}),S,"right"),s(t),c&&c(t,S)},[b,a,t,r,s,c]),y=m.useCallback(function(S){b(m.createElement(a,{slice:t,axis:r}),S,"right"),l&&l(t,S)},[b,a,t,r,l]),C=m.useCallback(function(S){x(),s(null),u&&u(t,S)},[x,s,u,t]),w=m.useCallback(function(S){d&&d(t,S)},[t,d]),T=m.useCallback(function(S){b(m.createElement(a,{slice:t,axis:r}),S,"right"),s(t),f&&f(t,S)},[r,f,s,b,t,a]),$=m.useCallback(function(S){var k=S.touches[0],O=document.elementFromPoint(k.clientX,k.clientY),D=O==null?void 0:O.getAttribute("data-ref");if(D){var E=n.find(function(M){return M.id===D});E&&(b(m.createElement(a,{slice:E,axis:r}),S,"right"),s(E))}h&&h(t,S)},[r,h,s,b,t,n,a]),R=m.useCallback(function(S){x(),s(null),g&&g(t,S)},[x,s,g,t]);return v.jsx("rect",{x:t.x0,y:t.y0,width:t.width,height:t.height,stroke:"red",strokeWidth:i?1:0,strokeOpacity:.75,fill:"red",fillOpacity:o&&i?.35:0,onMouseEnter:_,onMouseMove:y,onMouseLeave:C,onClick:w,onTouchStart:T,onTouchMove:$,onTouchEnd:R,"data-ref":t.id})}),cK=m.memo(function(e){var t=e.slices,n=e.axis,r=e.debug,i=e.height,a=e.tooltip,o=e.current,s=e.setCurrent,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,g=e.onTouchEnd;return t.map(function(p){return v.jsx(sK,{slice:p,slices:t,axis:n,debug:r,height:i,tooltip:a,setCurrent:s,isCurrent:o!==null&&o.id===p.id,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:g},p.id)})}),lK=m.memo(function(e){var t=e.points,n=e.symbol,r=e.size,i=e.borderWidth,a=e.enableLabel,o=e.label,s=e.labelYOffset,c=ht(),l=LV(o),u=t.slice(0).reverse().map(function(d){return{id:d.id,x:d.x,y:d.y,datum:d.data,fill:d.color,stroke:d.borderColor,label:a?l(d):null}});return v.jsx("g",{children:u.map(function(d){return v.jsx(DV,{x:d.x,y:d.y,datum:d.datum,symbol:n,size:r,color:d.fill,borderWidth:i,borderColor:d.stroke,label:d.label,labelYOffset:s,theme:c},d.id)})})}),uK=m.memo(function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,a=e.setCurrent,o=e.onMouseEnter,s=e.onMouseMove,c=e.onMouseLeave,l=e.onClick,u=e.onTouchStart,d=e.onTouchMove,f=e.onTouchEnd,h=e.tooltip,g=e.debug,p=e.enableTouchCrosshair,b=Li(),x=b.showTooltipAt,_=b.hideTooltip,y=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),o&&o(k,O)},[x,h,o,i]),C=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),s&&s(k,O)},[x,h,i.left,i.top,s]),w=m.useCallback(function(k,O){_(),c&&c(k,O)},[_,c]),T=m.useCallback(function(k,O){l&&l(k,O)},[l]),$=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),u&&u(k,O)},[i.left,i.top,u,x,h]),R=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),d&&d(k,O)},[i.left,i.top,d,x,h]),S=m.useCallback(function(k,O){_(),f&&f(k,O)},[f,_]);return v.jsx(KZ,{nodes:t,width:n,height:r,setCurrent:a,onMouseEnter:y,onMouseMove:C,onMouseLeave:w,onClick:T,onTouchStart:$,onTouchMove:R,onTouchEnd:S,enableTouchCrosshair:p,debug:g})}),dK=NC(function(e){var t=e.data,n=e.xScale,r=n===void 0?{type:"point"}:n,i=e.xFormat,a=e.yScale,o=a===void 0?{type:"linear",min:0,max:"auto"}:a,s=e.yFormat,c=e.layers,l=c===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:c,u=e.curve,d=u===void 0?"linear":u,f=e.areaBaselineValue,h=f===void 0?0:f,g=e.colors,p=g===void 0?{scheme:"nivo"}:g,b=e.margin,x=e.width,_=e.height,y=e.axisTop,C=e.axisRight,w=e.axisBottom,T=w===void 0?{}:w,$=e.axisLeft,R=$===void 0?{}:$,S=e.enableGridX,k=S===void 0||S,O=e.enableGridY,D=O===void 0||O,E=e.gridXValues,M=e.gridYValues,j=e.lineWidth,F=j===void 0?2:j,W=e.enableArea,B=W!==void 0&&W,U=e.areaOpacity,N=U===void 0?.2:U,V=e.areaBlendMode,X=V===void 0?"normal":V,ne=e.enablePoints,K=ne===void 0||ne,J=e.pointSymbol,q=e.pointSize,G=q===void 0?6:q,z=e.pointColor,L=z===void 0?{from:"color"}:z,H=e.pointBorderWidth,ee=H===void 0?0:H,A=e.pointBorderColor,se=A===void 0?{theme:"background"}:A,ce=e.enablePointLabel,ue=ce!==void 0&&ce,we=e.pointLabel,Te=we===void 0?"data.yFormatted":we,at=e.pointLabelYOffset,tt=e.defs,Be=tt===void 0?[]:tt,Ke=e.fill,Ye=Ke===void 0?[]:Ke,de=e.markers,ke=e.legends,Oe=ke===void 0?[]:ke,ve=e.isInteractive,Ie=ve===void 0||ve,Xe=e.useMesh,It=Xe!==void 0&&Xe,mt=e.debugMesh,Je=mt!==void 0&&mt,bt=e.onMouseEnter,At=e.onMouseMove,it=e.onMouseLeave,gt=e.onClick,yt=e.onTouchStart,Lt=e.onTouchMove,$e=e.onTouchEnd,Pe=e.tooltip,ze=Pe===void 0?rg:Pe,nt=e.enableSlices,vt=nt!==void 0&&nt,kt=e.debugSlices,Xt=kt!==void 0&&kt,Dt=e.sliceTooltip,Bt=Dt===void 0?pT:Dt,Ht=e.enableCrosshair,Mt=Ht===void 0||Ht,Wt=e.crosshairType,Jt=Wt===void 0?"bottom-left":Wt,Vt=e.enableTouchCrosshair,fe=Vt!==void 0&&Vt,ye=e.role,Ee=ye===void 0?"img":ye,qe=Us(x,_,b),Ge=qe.margin,ot=qe.innerWidth,P=qe.innerHeight,re=qe.outerWidth,Z=qe.outerHeight,te=gT({data:t,xScale:r,xFormat:i,yScale:o,yFormat:s,width:ot,height:P,colors:p,curve:d,areaBaselineValue:h,pointColor:L,pointBorderColor:se,enableSlices:vt}),ge=te.legendData,Ce=te.toggleSerie,pe=te.lineGenerator,be=te.areaGenerator,Ae=te.series,Me=te.xScale,et=te.yScale,Nt=te.slices,wt=te.points,Ut=ht(),le=ar(L,Ut),cn=ar(se,Ut),Ft=m.useState(null),dr=Ft[0],lg=Ft[1],ug=m.useState(null),Qa=ug[0],dg=ug[1],ni={grid:v.jsx(lT,{theme:Ut,width:ot,height:P,xScale:k?Me:null,yScale:D?et:null,xValues:E,yValues:M},"grid"),markers:v.jsx(DC,{markers:de,width:ot,height:P,xScale:Me,yScale:et,theme:Ut},"markers"),axes:v.jsx(cT,{xScale:Me,yScale:et,width:ot,height:P,theme:Ut,top:y,right:C,bottom:T,left:R},"axes"),areas:null,lines:v.jsx(oK,{lines:Ae,lineGenerator:pe,lineWidth:F},"lines"),slices:null,points:null,crosshair:null,mesh:null,legends:Oe.map(function(ri,hd){return v.jsx(Jm,hn({},ri,{containerWidth:ot,containerHeight:P,data:ri.data||ge,theme:Ut,toggleSerie:ri.toggleSerie?Ce:void 0}),"legend."+hd)})},WT=Km(Be,Ae,Ye);return B&&(ni.areas=v.jsx(iK,{areaGenerator:be,areaOpacity:N,areaBlendMode:X,lines:Ae},"areas")),Ie&&vt!==!1&&(ni.slices=v.jsx(cK,{slices:Nt,axis:vt,debug:Xt,height:P,tooltip:Bt,current:Qa,setCurrent:dg,onMouseEnter:bt,onMouseMove:At,onMouseLeave:it,onClick:gt,onTouchStart:yt,onTouchMove:Lt,onTouchEnd:$e},"slices")),K&&(ni.points=v.jsx(lK,{points:wt,symbol:J,size:G,color:le,borderWidth:ee,borderColor:cn,enableLabel:ue,label:Te,labelYOffset:at},"points")),Ie&&Mt&&(dr!==null&&(ni.crosshair=v.jsx(oh,{width:ot,height:P,x:dr.x,y:dr.y,type:Jt},"crosshair")),Qa!==null&&(ni.crosshair=v.jsx(oh,{width:ot,height:P,x:Qa.x,y:Qa.y,type:vt},"crosshair"))),Ie&&It&&vt===!1&&(ni.mesh=v.jsx(uK,{points:wt,width:ot,height:P,margin:Ge,current:dr,setCurrent:lg,onMouseEnter:bt,onMouseMove:At,onMouseLeave:it,onClick:gt,onTouchStart:yt,onTouchMove:Lt,onTouchEnd:$e,tooltip:ze,enableTouchCrosshair:fe,debug:Je},"mesh")),v.jsx(ld,{defs:WT,width:re,height:Z,margin:Ge,role:Ee,children:l.map(function(ri,hd){return typeof ri=="function"?v.jsx(m.Fragment,{children:ri(hn({},e,{innerWidth:ot,innerHeight:P,series:Ae,slices:Nt,points:wt,xScale:Me,yScale:et,lineGenerator:pe,areaGenerator:be,currentPoint:dr,setCurrentPoint:lg,currentSlice:Qa,setCurrentSlice:dg}))},hd):ni[ri]})})}),fK=function(e){return v.jsx(Ka,{children:function(t){var n=t.width,r=t.height;return v.jsx(dK,hn({width:n,height:r},e))}})},hK=NC(function(e){var t=m.useRef(null),n=e.width,r=e.height,i=e.margin,a=e.pixelRatio,o=a===void 0?typeof window<"u"&&window.devicePixelRatio||1:a,s=e.data,c=e.xScale,l=c===void 0?{type:"point"}:c,u=e.xFormat,d=e.yScale,f=d===void 0?{type:"linear",min:0,max:"auto"}:d,h=e.yFormat,g=e.curve,p=g===void 0?"linear":g,b=e.layers,x=b===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:b,_=e.colors,y=_===void 0?{scheme:"nivo"}:_,C=e.lineWidth,w=C===void 0?2:C,T=e.enableArea,$=T!==void 0&&T,R=e.areaBaselineValue,S=R===void 0?0:R,k=e.areaOpacity,O=k===void 0?.2:k,D=e.enablePoints,E=D===void 0||D,M=e.pointSize,j=M===void 0?6:M,F=e.pointColor,W=F===void 0?{from:"color"}:F,B=e.pointBorderWidth,U=B===void 0?0:B,N=e.pointBorderColor,V=N===void 0?{theme:"background"}:N,X=e.enableGridX,ne=X===void 0||X,K=e.gridXValues,J=e.enableGridY,q=J===void 0||J,G=e.gridYValues,z=e.axisTop,L=e.axisRight,H=e.axisBottom,ee=H===void 0?{}:H,A=e.axisLeft,se=A===void 0?{}:A,ce=e.legends,ue=ce===void 0?[]:ce,we=e.isInteractive,Te=we===void 0||we,at=e.debugMesh,tt=at!==void 0&&at,Be=e.onMouseLeave,Ke=e.onClick,Ye=e.tooltip,de=Ye===void 0?rg:Ye,ke=e.canvasRef,Oe=Us(n,r,i),ve=Oe.margin,Ie=Oe.innerWidth,Xe=Oe.innerHeight,It=Oe.outerWidth,mt=Oe.outerHeight,Je=ht(),bt=m.useState(null),At=bt[0],it=bt[1],gt=gT({data:s,xScale:l,xFormat:u,yScale:f,yFormat:h,width:Ie,height:Xe,colors:y,curve:p,areaBaselineValue:S,pointColor:W,pointBorderColor:V}),yt=gt.lineGenerator,Lt=gt.areaGenerator,$e=gt.series,Pe=gt.xScale,ze=gt.yScale,nt=gt.points,vt=hT({points:nt,width:Ie,height:Xe,debug:tt}),kt=vt.delaunay,Xt=vt.voronoi;m.useEffect(function(){ke&&(ke.current=t.current),t.current.width=It*o,t.current.height=mt*o;var fe=t.current.getContext("2d");fe.scale(o,o),fe.fillStyle=Je.background,fe.fillRect(0,0,It,mt),fe.translate(ve.left,ve.top),x.forEach(function(ye){if(typeof ye=="function"&&ye({ctx:fe,innerWidth:Ie,innerHeight:Xe,series:$e,points:nt,xScale:Pe,yScale:ze,lineWidth:w,lineGenerator:yt,areaGenerator:Lt,currentPoint:At,setCurrentPoint:it}),ye==="grid"&&Je.grid.line.strokeWidth>0&&(fe.lineWidth=Je.grid.line.strokeWidth,fe.strokeStyle=Je.grid.line.stroke,ne&&Cl(fe,{width:Ie,height:Xe,scale:Pe,axis:"x",values:K}),q&&Cl(fe,{width:Ie,height:Xe,scale:ze,axis:"y",values:G})),ye==="axes"&&uT(fe,{xScale:Pe,yScale:ze,width:Ie,height:Xe,top:z,right:L,bottom:ee,left:se,theme:Je}),ye==="areas"&&$===!0){fe.save(),fe.globalAlpha=O,Lt.context(fe);for(var Ee=$e.length-1;Ee>=0;Ee--)fe.fillStyle=$e[Ee].color,fe.beginPath(),Lt($e[Ee].data.map(function(Ge){return Ge.position})),fe.fill();fe.restore()}if(ye==="lines"&&(yt.context(fe),$e.forEach(function(Ge){fe.strokeStyle=Ge.color,fe.lineWidth=w,fe.beginPath(),yt(Ge.data.map(function(ot){return ot.position})),fe.stroke()})),ye==="points"&&E===!0&&j>0&&nt.forEach(function(Ge){fe.fillStyle=Ge.color,fe.beginPath(),fe.arc(Ge.x,Ge.y,j/2,0,2*Math.PI),fe.fill(),U>0&&(fe.strokeStyle=Ge.borderColor,fe.lineWidth=U,fe.stroke())}),ye==="mesh"&&tt===!0&&(XZ(fe,Xt),At&&QZ(fe,Xt,At.index)),ye==="legends"){var qe=$e.map(function(Ge){return{id:Ge.id,label:Ge.id,color:Ge.color}}).reverse();ue.forEach(function(Ge){GC(fe,hn({},Ge,{data:Ge.data||qe,containerWidth:Ie,containerHeight:Xe,theme:Je}))})}})},[t,It,mt,x,Je,yt,$e,Pe,ze,ne,K,q,G,z,L,ee,se,ue,nt,E,j,At]);var Dt=m.useCallback(function(fe){var ye=jo(t.current,fe),Ee=ye[0],qe=ye[1];if(!LC(ve.left,ve.top,Ie,Xe,Ee,qe))return null;var Ge=kt.find(Ee-ve.left,qe-ve.top);return nt[Ge]},[t,ve,Ie,Xe,kt]),Bt=Li(),Ht=Bt.showTooltipFromEvent,Mt=Bt.hideTooltip,Wt=m.useCallback(function(fe){var ye=Dt(fe);it(ye),ye?Ht(m.createElement(de,{point:ye}),fe):Mt()},[Dt,it,Ht,Mt,de]),Jt=m.useCallback(function(fe){Mt(),it(null),At&&Be&&Be(At,fe)},[Mt,it,Be]),Vt=m.useCallback(function(fe){if(Ke){var ye=Dt(fe);ye&&Ke(ye,fe)}},[Dt,Ke]);return v.jsx("canvas",{ref:t,width:It*o,height:mt*o,style:{width:It,height:mt,cursor:Te?"auto":"normal"},onMouseEnter:Te?Wt:void 0,onMouseMove:Te?Wt:void 0,onMouseLeave:Te?Jt:void 0,onClick:Te?Vt:void 0})}),pK=m.forwardRef(function(e,t){return v.jsx(hK,hn({},e,{canvasRef:t}))});m.forwardRef(function(e,t){return v.jsx(Ka,{children:function(n){var r=n.width,i=n.height;return v.jsx(pK,hn({width:r,height:i},e,{ref:t}))}})});var mK=JC;function gK(e,t){var n=[];return mK(e,function(r,i,a){t(r,i,a)&&n.push(r)}),n}var vK=gK,bK=pC,yK=vK,xK=eg,_K=Cn;function wK(e,t){var n=_K(e)?bK:yK;return n(e,xK(t))}var CK=wK;const TK=Rt(CK);var kK=Or,SK=Nn,OK="[object Number]";function EK(e){return typeof e=="number"||SK(e)&&kK(e)==OK}var MK=EK;const Jb=Rt(MK);function $K(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var RK=$K,AK=Va,jK=Ws;function PK(e,t){return e&&AK(t,jK(t),e)}var IK=PK,DK=Va,NK=Fs;function FK(e,t){return e&&DK(t,NK(t),e)}var LK=FK,BK=Va,WK=Vm;function UK(e,t){return BK(e,WK(e),t)}var zK=UK,HK=zm,VK=tm,qK=Vm,YK=mC,GK=Object.getOwnPropertySymbols,ZK=GK?function(e){for(var t=[];e;)HK(t,qK(e)),e=VK(e);return t}:YK,vT=ZK,KK=Va,XK=vT;function QK(e,t){return KK(e,XK(e),t)}var JK=QK,eX=hC,tX=vT,nX=Fs;function rX(e){return eX(e,nX,tX)}var bT=rX,iX=Object.prototype,aX=iX.hasOwnProperty;function oX(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&aX.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var sX=oX,cX=em;function lX(e,t){var n=t?cX(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var uX=lX,dX=/\w*$/;function fX(e){var t=new e.constructor(e.source,dX.exec(e));return t.lastIndex=e.lastIndex,t}var hX=fX,ey=La,ty=ey?ey.prototype:void 0,ny=ty?ty.valueOf:void 0;function pX(e){return ny?Object(ny.call(e)):{}}var mX=pX,gX=em,vX=uX,bX=hX,yX=mX,xX=R_,_X="[object Boolean]",wX="[object Date]",CX="[object Map]",TX="[object Number]",kX="[object RegExp]",SX="[object Set]",OX="[object String]",EX="[object Symbol]",MX="[object ArrayBuffer]",$X="[object DataView]",RX="[object Float32Array]",AX="[object Float64Array]",jX="[object Int8Array]",PX="[object Int16Array]",IX="[object Int32Array]",DX="[object Uint8Array]",NX="[object Uint8ClampedArray]",FX="[object Uint16Array]",LX="[object Uint32Array]";function BX(e,t,n){var r=e.constructor;switch(t){case MX:return gX(e);case _X:case wX:return new r(+e);case $X:return vX(e,n);case RX:case AX:case jX:case PX:case IX:case DX:case NX:case FX:case LX:return xX(e,n);case CX:return new r;case TX:case OX:return new r(e);case kX:return bX(e);case SX:return new r;case EX:return yX(e)}}var WX=BX,UX=od,zX=Nn,HX="[object Map]";function VX(e){return zX(e)&&UX(e)==HX}var qX=VX,YX=qX,GX=Ha,ry=vu,iy=ry&&ry.isMap,ZX=iy?GX(iy):YX,KX=ZX,XX=od,QX=Nn,JX="[object Set]";function eQ(e){return QX(e)&&XX(e)==JX}var tQ=eQ,nQ=tQ,rQ=Ha,ay=vu,oy=ay&&ay.isSet,iQ=oy?rQ(oy):nQ,aQ=iQ,oQ=pu,sQ=RK,cQ=sm,lQ=IK,uQ=LK,dQ=M_,fQ=A_,hQ=zK,pQ=JK,mQ=gC,gQ=bT,vQ=od,bQ=sX,yQ=WX,xQ=P_,_Q=Cn,wQ=gu,CQ=KX,TQ=ur,kQ=aQ,SQ=Ws,OQ=Fs,EQ=1,MQ=2,$Q=4,yT="[object Arguments]",RQ="[object Array]",AQ="[object Boolean]",jQ="[object Date]",PQ="[object Error]",xT="[object Function]",IQ="[object GeneratorFunction]",DQ="[object Map]",NQ="[object Number]",_T="[object Object]",FQ="[object RegExp]",LQ="[object Set]",BQ="[object String]",WQ="[object Symbol]",UQ="[object WeakMap]",zQ="[object ArrayBuffer]",HQ="[object DataView]",VQ="[object Float32Array]",qQ="[object Float64Array]",YQ="[object Int8Array]",GQ="[object Int16Array]",ZQ="[object Int32Array]",KQ="[object Uint8Array]",XQ="[object Uint8ClampedArray]",QQ="[object Uint16Array]",JQ="[object Uint32Array]",Ct={};Ct[yT]=Ct[RQ]=Ct[zQ]=Ct[HQ]=Ct[AQ]=Ct[jQ]=Ct[VQ]=Ct[qQ]=Ct[YQ]=Ct[GQ]=Ct[ZQ]=Ct[DQ]=Ct[NQ]=Ct[_T]=Ct[FQ]=Ct[LQ]=Ct[BQ]=Ct[WQ]=Ct[KQ]=Ct[XQ]=Ct[QQ]=Ct[JQ]=!0;Ct[PQ]=Ct[xT]=Ct[UQ]=!1;function $c(e,t,n,r,i,a){var o,s=t&EQ,c=t&MQ,l=t&$Q;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!TQ(e))return e;var u=_Q(e);if(u){if(o=bQ(e),!s)return fQ(e,o)}else{var d=vQ(e),f=d==xT||d==IQ;if(wQ(e))return dQ(e,s);if(d==_T||d==yT||f&&!i){if(o=c||f?{}:xQ(e),!s)return c?pQ(e,uQ(o,e)):hQ(e,lQ(o,e))}else{if(!Ct[d])return i?e:{};o=yQ(e,d,s)}}a||(a=new oQ);var h=a.get(e);if(h)return h;a.set(e,o),kQ(e)?e.forEach(function(b){o.add($c(b,t,n,b,e,a))}):CQ(e)&&e.forEach(function(b,x){o.set(x,$c(b,t,n,x,e,a))});var g=l?c?gQ:mQ:c?OQ:SQ,p=u?void 0:g(e);return sQ(p||e,function(b,x){p&&(x=b,b=e[x]),cQ(o,x,$c(b,t,n,x,e,a))}),o}var eJ=$c;function tJ(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var nJ=tJ,rJ=Ls,iJ=nJ;function aJ(e,t){return t.length<2?e:rJ(e,iJ(t,0,-1))}var oJ=aJ,sJ=qa,cJ=tw,lJ=oJ,uJ=Ya;function dJ(e,t){return t=sJ(t,e),e=lJ(e,t),e==null||delete e[uJ(cJ(t))]}var fJ=dJ,hJ=im;function pJ(e){return hJ(e)?void 0:e}var mJ=pJ,gJ=_u,vJ=eJ,bJ=fJ,yJ=qa,xJ=Va,_J=mJ,wJ=dC,CJ=bT,TJ=1,kJ=2,SJ=4,OJ=wJ(function(e,t){var n={};if(e==null)return n;var r=!1;t=gJ(t,function(a){return a=yJ(a,e),r||(r=a.length>1),a}),xJ(e,CJ(e),n),r&&(n=vJ(n,TJ|kJ|SJ,_J));for(var i=t.length;i--;)bJ(n,t[i]);return n}),EJ=OJ;const wT=Rt(EJ);function or(){return or=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},or.apply(this,arguments)}var $h={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},MJ=function(e){var t=typeof e;return m.isValidElement(e)||t==="string"||t==="function"||t==="object"},$J=function(e){var t=typeof e;return t==="string"||t==="function"},xs=function(e){return e.type==="circle"},Rh=function(e){return e.type==="dot"},_s=function(e){return e.type==="rect"},RJ=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return n.reduce(function(a,o){var s=o.offset||0;return[].concat(a,TK(t,o.match).map(function(c){var l=r(c),u=i(c);return(xs(o)||_s(o))&&(u.size=u.size+2*s,u.width=u.width+2*s,u.height=u.height+2*s),or({},wT(o,["match","offset"]),l,u,{size:o.size||u.size,datum:c})}))},[])},AJ=function(e,t,n,r){var i=Math.atan2(r-t,n-e);return RV(cd(i))},CT=function(e){var t,n,r=e.x,i=e.y,a=e.noteX,o=e.noteY,s=e.noteWidth,c=s===void 0?$h.noteWidth:s,l=e.noteTextOffset,u=l===void 0?$h.noteTextOffset:l;if(Jb(a))t=r+a;else{if(a.abs===void 0)throw new Error("noteX should be either a number or an object containing an 'abs' property");t=a.abs}if(Jb(o))n=i+o;else{if(o.abs===void 0)throw new Error("noteY should be either a number or an object containing an 'abs' property");n=o.abs}var d=r,f=i,h=AJ(r,i,t,n);if(xs(e)){var g=Ci(An(h),e.size/2);d+=g.x,f+=g.y}if(_s(e)){var p=Math.round((h+90)/45)%8;p===0&&(f-=e.height/2),p===1&&(d+=e.width/2,f-=e.height/2),p===2&&(d+=e.width/2),p===3&&(d+=e.width/2,f+=e.height/2),p===4&&(f+=e.height/2),p===5&&(d-=e.width/2,f+=e.height/2),p===6&&(d-=e.width/2),p===7&&(d-=e.width/2,f-=e.height/2)}var b=t,x=t;return(h+90)%360>180?(b-=c,x-=c):x+=c,{points:[[d,f],[t,n],[x,n]],text:[b,n-u],angle:h+90}},TT=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return m.useMemo(function(){return RJ({data:t,annotations:n,getPosition:r,getDimensions:i})},[t,n,r,i])},jJ=function(e){var t=e.annotations;return m.useMemo(function(){return t.map(function(n){return or({},n,{computed:CT(or({},n))})})},[t])},PJ=function(e){return m.useMemo(function(){return CT(e)},[e])},IJ=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,a=ht(),o=mn(),s=o.animate,c=o.config,l=cr({x:n,y:r,config:c,immediate:!s});return typeof i=="function"?m.createElement(i,{x:n,y:r,datum:t}):v.jsxs(v.Fragment,{children:[a.annotations.text.outlineWidth>0&&v.jsx(ft.text,{x:l.x,y:l.y,style:or({},a.annotations.text,{strokeLinejoin:"round",strokeWidth:2*a.annotations.text.outlineWidth,stroke:a.annotations.text.outlineColor}),children:i}),v.jsx(ft.text,{x:l.x,y:l.y,style:wT(a.annotations.text,["outlineWidth","outlineColor"]),children:i})]})},sy=function(e){var t=e.points,n=e.isOutline,r=n!==void 0&&n,i=ht(),a=m.useMemo(function(){var c=t[0];return t.slice(1).reduce(function(l,u){return l+" L"+u[0]+","+u[1]},"M"+c[0]+","+c[1])},[t]),o=Ym(a);if(r&&i.annotations.link.outlineWidth<=0)return null;var s=or({},i.annotations.link);return r&&(s.strokeLinecap="square",s.strokeWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,s.stroke=i.annotations.link.outlineColor,s.opacity=i.annotations.link.outlineOpacity),v.jsx(ft.path,{fill:"none",d:o,style:s})},DJ=function(e){var t=e.x,n=e.y,r=e.size,i=ht(),a=mn(),o=a.animate,s=a.config,c=cr({x:t,y:n,radius:r/2,config:s,immediate:!o});return v.jsxs(v.Fragment,{children:[i.annotations.outline.outlineWidth>0&&v.jsx(ft.circle,{cx:c.x,cy:c.y,r:c.radius,style:or({},i.annotations.outline,{fill:"none",strokeWidth:i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,stroke:i.annotations.outline.outlineColor,opacity:i.annotations.outline.outlineOpacity})}),v.jsx(ft.circle,{cx:c.x,cy:c.y,r:c.radius,style:i.annotations.outline})]})},NJ=function(e){var t=e.x,n=e.y,r=e.size,i=r===void 0?$h.dotSize:r,a=ht(),o=mn(),s=o.animate,c=o.config,l=cr({x:t,y:n,radius:i/2,config:c,immediate:!s});return v.jsxs(v.Fragment,{children:[a.annotations.outline.outlineWidth>0&&v.jsx(ft.circle,{cx:l.x,cy:l.y,r:l.radius,style:or({},a.annotations.outline,{fill:"none",strokeWidth:2*a.annotations.outline.outlineWidth,stroke:a.annotations.outline.outlineColor,opacity:a.annotations.outline.outlineOpacity})}),v.jsx(ft.circle,{cx:l.x,cy:l.y,r:l.radius,style:a.annotations.symbol})]})},FJ=function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.borderRadius,o=a===void 0?6:a,s=ht(),c=mn(),l=c.animate,u=c.config,d=cr({x:t-r/2,y:n-i/2,width:r,height:i,config:u,immediate:!l});return v.jsxs(v.Fragment,{children:[s.annotations.outline.outlineWidth>0&&v.jsx(ft.rect,{x:d.x,y:d.y,rx:o,ry:o,width:d.width,height:d.height,style:or({},s.annotations.outline,{fill:"none",strokeWidth:s.annotations.outline.strokeWidth+2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),v.jsx(ft.rect,{x:d.x,y:d.y,rx:o,ry:o,width:d.width,height:d.height,style:s.annotations.outline})]})},LJ=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,a=PJ(e);if(!MJ(i))throw new Error("note should be a valid react element");return v.jsxs(v.Fragment,{children:[v.jsx(sy,{points:a.points,isOutline:!0}),xs(e)&&v.jsx(DJ,{x:n,y:r,size:e.size}),Rh(e)&&v.jsx(NJ,{x:n,y:r,size:e.size}),_s(e)&&v.jsx(FJ,{x:n,y:r,width:e.width,height:e.height,borderRadius:e.borderRadius}),v.jsx(sy,{points:a.points}),v.jsx(IJ,{datum:t,x:a.text[0],y:a.text[1],note:i})]})},cy=function(e,t){t.forEach(function(n,r){var i=n[0],a=n[1];r===0?e.moveTo(i,a):e.lineTo(i,a)})},BJ=function(e,t){var n=t.annotations,r=t.theme;n.length!==0&&(e.save(),n.forEach(function(i){if(!$J(i.note))throw new Error("note is invalid for canvas implementation");r.annotations.link.outlineWidth>0&&(e.lineCap="square",e.strokeStyle=r.annotations.link.outlineColor,e.lineWidth=r.annotations.link.strokeWidth+2*r.annotations.link.outlineWidth,e.beginPath(),cy(e,i.computed.points),e.stroke(),e.lineCap="butt"),xs(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),Rh(i)&&r.annotations.symbol.outlineWidth>0&&(e.strokeStyle=r.annotations.symbol.outlineColor,e.lineWidth=2*r.annotations.symbol.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),_s(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),e.strokeStyle=r.annotations.link.stroke,e.lineWidth=r.annotations.link.strokeWidth,e.beginPath(),cy(e,i.computed.points),e.stroke(),xs(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),Rh(i)&&(e.fillStyle=r.annotations.symbol.fill,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.fill()),_s(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),typeof i.note=="function"?i.note(e,{datum:i.datum,x:i.computed.text[0],y:i.computed.text[1],theme:r}):(e.font=r.annotations.text.fontSize+"px "+r.annotations.text.fontFamily,e.textAlign="left",e.textBaseline="alphabetic",e.fillStyle=r.annotations.text.fill,e.strokeStyle=r.annotations.text.outlineColor,e.lineWidth=2*r.annotations.text.outlineWidth,r.annotations.text.outlineWidth>0&&(e.lineJoin="round",e.strokeText(i.note,i.computed.text[0],i.computed.text[1]),e.lineJoin="miter"),e.fillText(i.note,i.computed.text[0],i.computed.text[1]))}),e.restore())};function pt(){return pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pt.apply(this,arguments)}function Xa(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var ly,WJ=function(e){var t=e.bars,n=e.annotations,r=TT({data:t,annotations:n,getPosition:function(i){return{x:i.x+i.width/2,y:i.y+i.height/2}},getDimensions:function(i){var a=i.height,o=i.width;return{width:o,height:a,size:Math.max(o,a)}}});return v.jsx(v.Fragment,{children:r.map(function(i,a){return v.jsx(LJ,pt({},i),a)})})},UJ=function(e){var t=e.width,n=e.height,r=e.legends,i=e.toggleSerie;return v.jsx(v.Fragment,{children:r.map(function(a,o){var s,c=a[0],l=a[1];return v.jsx(Jm,pt({},c,{containerWidth:t,containerHeight:n,data:(s=c.data)!=null?s:l,toggleSerie:c.toggleSerie&&c.dataFrom==="keys"?i:void 0}),o)})})},zJ=["data"],HJ=function(e){var t,n=e.bar,r=n.data,i=Xa(n,zJ),a=e.style,o=a.borderColor,s=a.color,c=a.height,l=a.labelColor,u=a.labelOpacity,d=a.labelX,f=a.labelY,h=a.transform,g=a.width,p=e.borderRadius,b=e.borderWidth,x=e.label,_=e.shouldRenderLabel,y=e.isInteractive,C=e.onClick,w=e.onMouseEnter,T=e.onMouseLeave,$=e.tooltip,R=e.isFocusable,S=e.ariaLabel,k=e.ariaLabelledBy,O=e.ariaDescribedBy,D=ht(),E=Li(),M=E.showTooltipFromEvent,j=E.showTooltipAt,F=E.hideTooltip,W=m.useMemo(function(){return function(){return m.createElement($,pt({},i,r))}},[$,i,r]),B=m.useCallback(function(K){C==null||C(pt({color:i.color},r),K)},[i,r,C]),U=m.useCallback(function(K){return M(W(),K)},[M,W]),N=m.useCallback(function(K){w==null||w(r,K),M(W(),K)},[r,w,M,W]),V=m.useCallback(function(K){T==null||T(r,K),F()},[r,F,T]),X=m.useCallback(function(){j(W(),[i.absX+i.width/2,i.absY])},[j,W,i]),ne=m.useCallback(function(){F()},[F]);return v.jsxs(ft.g,{transform:h,children:[v.jsx(ft.rect,{width:Zr(g,function(K){return Math.max(K,0)}),height:Zr(c,function(K){return Math.max(K,0)}),rx:p,ry:p,fill:(t=r.fill)!=null?t:s,strokeWidth:b,stroke:o,focusable:R,tabIndex:R?0:void 0,"aria-label":S?S(r):void 0,"aria-labelledby":k?k(r):void 0,"aria-describedby":O?O(r):void 0,onMouseEnter:y?N:void 0,onMouseMove:y?U:void 0,onMouseLeave:y?V:void 0,onClick:y?B:void 0,onFocus:y&&R?X:void 0,onBlur:y&&R?ne:void 0}),_&&v.jsx(ft.text,{x:d,y:f,textAnchor:"middle",dominantBaseline:"central",fillOpacity:u,style:pt({},D.labels.text,{pointerEvents:"none",fill:l}),children:x})]})},VJ=["color","label"],qJ=function(e){var t=e.color,n=e.label,r=Xa(e,VJ);return v.jsx(Zp,{id:n,value:r.formattedValue,enableChip:!0,color:t})},xt={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:qJ,tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[],enableTotals:!1,totalsOffset:10},St=pt({},xt,{layers:["grid","axes","bars","totals","markers","legends","annotations"],barComponent:HJ,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),Qt=pt({},xt,{layers:["grid","axes","bars","totals","legends","annotations"],pixelRatio:typeof window<"u"&&(ly=window.devicePixelRatio)!=null?ly:1}),kT=function(e,t,n,r,i,a){return ys(r,{all:e.map(t),min:0,max:0},i,a).padding(n)},ST=function(e,t){return e.map(function(n){return pt({},t.reduce(function(r,i){return r[i]=null,r},{}),n)})},ud=function(e){return Object.keys(e).reduce(function(t,n){return e[n]&&(t[n]=e[n]),t},{})},dd=function(e){return[e,Number(e)]},YJ=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],ig=function(e,t){return e>t},OT=function(e,t){return e<t},ET=function(e,t){return Array.from(" ".repeat(t-e),function(n,r){return e+r})},GJ=function(e){return ig(e,0)?0:e},ZJ=function(e,t,n,r){var i=e.data,a=e.formatValue,o=e.getColor,s=e.getIndex,c=e.getTooltipLabel,l=e.innerPadding,u=l===void 0?0:l,d=e.keys,f=e.xScale,h=e.yScale,g=e.margin,p=n?OT:ig,b=i.map(ud),x=[];return d.forEach(function(_,y){return ET(0,f.domain().length).forEach(function(C){var w,T,$,R=dd(i[C][_]),S=R[0],k=R[1],O=s(i[C]),D=((w=f(O))!=null?w:0)+t*y+u*y,E=p(T=k,0)?($=h(T))!=null?$:0:r,M=function(F,W){var B;return p(F,0)?r-W:((B=h(F))!=null?B:0)-r}(k,E),j={id:_,value:S===null?S:k,formattedValue:a(k),hidden:!1,index:C,indexValue:O,data:b[C]};x.push({key:_+"."+j.indexValue,index:x.length,data:j,x:D,y:E,absX:g.left+D,absY:g.top+E,width:t,height:M,color:o(j),label:c(j)})})}),x},KJ=function(e,t,n,r){var i=e.data,a=e.formatValue,o=e.getIndex,s=e.getColor,c=e.getTooltipLabel,l=e.keys,u=e.innerPadding,d=u===void 0?0:u,f=e.xScale,h=e.yScale,g=e.margin,p=n?OT:ig,b=i.map(ud),x=[];return l.forEach(function(_,y){return ET(0,h.domain().length).forEach(function(C){var w,T,$,R=dd(i[C][_]),S=R[0],k=R[1],O=o(i[C]),D=p(T=k,0)?r:($=f(T))!=null?$:0,E=((w=h(O))!=null?w:0)+t*y+d*y,M=function(F,W){var B;return p(F,0)?((B=f(F))!=null?B:0)-r:r-W}(k,D),j={id:_,value:S===null?S:k,formattedValue:a(k),hidden:!1,index:C,indexValue:O,data:b[C]};x.push({key:_+"."+j.indexValue,index:x.length,data:j,x:D,y:E,absX:g.left+D,absY:g.top+E,width:M,height:t,color:s(j),label:c(j)})})}),x},XJ=function(e){var t,n,r=e.layout,i=e.minValue,a=e.maxValue,o=e.reverse,s=e.width,c=e.height,l=e.padding,u=l===void 0?0:l,d=e.innerPadding,f=d===void 0?0:d,h=e.valueScale,g=e.indexScale,p=e.hiddenIds,b=p===void 0?[]:p,x=Xa(e,YJ),_=x.keys.filter(function(N){return!b.includes(N)}),y=ST(x.data,_),C=r==="vertical"?["y","x",s]:["x","y",c],w=C[0],T=C[1],$=C[2],R=kT(y,x.getIndex,u,g,$,T),S=pt({max:a,min:i,reverse:o},h),k=S.min==="auto"?GJ:function(N){return N},O=y.reduce(function(N,V){return[].concat(N,_.map(function(X){return V[X]}))},[]).filter(Boolean),D=k(Math.min.apply(Math,O)),E=(n=Math.max.apply(Math,O),isFinite(n)?n:0),M=ys(S,{all:O,min:D,max:E},w==="x"?s:c,w),j=r==="vertical"?[R,M]:[M,R],F=j[0],W=j[1],B=(R.bandwidth()-f*(_.length-1))/_.length,U=[pt({},x,{data:y,keys:_,innerPadding:f,xScale:F,yScale:W}),B,S.reverse,(t=M(0))!=null?t:0];return{xScale:F,yScale:W,bars:B>0?r==="vertical"?ZJ.apply(void 0,U):KJ.apply(void 0,U):[]}},QJ=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],JJ=function e(t){var n;return t.some(Array.isArray)?e((n=[]).concat.apply(n,t)):t},eee=function(e,t,n){var r=e.formatValue,i=e.getColor,a=e.getIndex,o=e.getTooltipLabel,s=e.innerPadding,c=e.stackedData,l=e.xScale,u=e.yScale,d=e.margin,f=[];return c.forEach(function(h){return l.domain().forEach(function(g,p){var b,x,_=h[p],y=(b=l(a(_.data)))!=null?b:0,C=((x=function(k){return u(k[n?0:1])}(_))!=null?x:0)+.5*s,w=function(k,O){var D;return((D=u(k[n?1:0]))!=null?D:0)-O}(_,C)-s,T=dd(_.data[h.key]),$=T[0],R=T[1],S={id:h.key,value:$===null?$:R,formattedValue:r(R),hidden:!1,index:p,indexValue:g,data:ud(_.data)};f.push({key:h.key+"."+g,index:f.length,data:S,x:y,y:C,absX:d.left+y,absY:d.top+C,width:t,height:w,color:i(S),label:o(S)})})}),f},tee=function(e,t,n){var r=e.formatValue,i=e.getColor,a=e.getIndex,o=e.getTooltipLabel,s=e.innerPadding,c=e.stackedData,l=e.xScale,u=e.yScale,d=e.margin,f=[];return c.forEach(function(h){return u.domain().forEach(function(g,p){var b,x,_=h[p],y=(b=u(a(_.data)))!=null?b:0,C=((x=function(k){return l(k[n?1:0])}(_))!=null?x:0)+.5*s,w=function(k,O){var D;return((D=l(k[n?0:1]))!=null?D:0)-O}(_,C)-s,T=dd(_.data[h.key]),$=T[0],R=T[1],S={id:h.key,value:$===null?$:R,formattedValue:r(R),hidden:!1,index:p,indexValue:g,data:ud(_.data)};f.push({key:h.key+"."+g,index:f.length,data:S,x:C,y,absX:d.left+C,absY:d.top+y,width:w,height:t,color:i(S),label:o(S)})})}),f},nee=function(e){var t,n=e.data,r=e.layout,i=e.minValue,a=e.maxValue,o=e.reverse,s=e.width,c=e.height,l=e.padding,u=l===void 0?0:l,d=e.valueScale,f=e.indexScale,h=e.hiddenIds,g=h===void 0?[]:h,p=Xa(e,QJ),b=p.keys.filter(function(B){return!g.includes(B)}),x=BU().keys(b).offset(WU)(ST(n,b)),_=r==="vertical"?["y","x",s]:["x","y",c],y=_[0],C=_[1],w=_[2],T=kT(n,p.getIndex,u,f,w,C),$=pt({max:a,min:i,reverse:o},d),R=(t=JJ(x),d.type==="log"?t.filter(function(B){return B!==0}):t),S=Math.min.apply(Math,R),k=Math.max.apply(Math,R),O=ys($,{all:R,min:S,max:k},y==="x"?s:c,y),D=r==="vertical"?[T,O]:[O,T],E=D[0],M=D[1],j=p.innerPadding>0?p.innerPadding:0,F=T.bandwidth(),W=[pt({},p,{innerPadding:j,stackedData:x,xScale:E,yScale:M}),F,$.reverse];return{xScale:E,yScale:M,bars:F>0?r==="vertical"?eee.apply(void 0,W):tee.apply(void 0,W):[]}},ree=function(e){var t=e.bars,n=e.direction,r=e.from,i=e.groupMode,a=e.layout,o=e.legendLabel,s=e.reverse,c=FC(o??(r==="indexes"?"indexValue":"id"));return r==="indexes"?function(l,u,d){var f=Oh(l.map(function(h){var g,p;return{id:(g=h.data.indexValue)!=null?g:"",label:d(h.data),hidden:h.data.hidden,color:(p=h.color)!=null?p:"#000"}}),function(h){return h.id});return u==="horizontal"&&f.reverse(),f}(t,a,c):function(l,u,d,f,h,g){var p=Oh(l.map(function(b){var x;return{id:b.data.id,label:g(b.data),hidden:b.data.hidden,color:(x=b.color)!=null?x:"#000"}}),function(b){return b.id});return(u==="vertical"&&f==="stacked"&&d==="column"&&h!==!0||u==="horizontal"&&f==="stacked"&&h===!0)&&p.reverse(),p}(t,a,n,i,s,c)},uy=function(e,t,n){var r=e.get(t)||0;e.set(t,r+n)},iee=function(e,t,n){var r=e.get(t)||0;e.set(t,r+(n>0?n:0))},aee=function(e,t,n){var r=e.get(t)||0;e.set(t,Math.max(r,Number(n)))},oee=function(e,t){var n=e.get(t)||0;e.set(t,n+1)},MT=function(e){var t=e.indexBy,n=t===void 0?xt.indexBy:t,r=e.keys,i=r===void 0?xt.keys:r,a=e.label,o=a===void 0?xt.label:a,s=e.tooltipLabel,c=s===void 0?xt.tooltipLabel:s,l=e.valueFormat,u=e.colors,d=u===void 0?xt.colors:u,f=e.colorBy,h=f===void 0?xt.colorBy:f,g=e.borderColor,p=g===void 0?xt.borderColor:g,b=e.labelTextColor,x=b===void 0?xt.labelTextColor:b,_=e.groupMode,y=_===void 0?xt.groupMode:_,C=e.layout,w=C===void 0?xt.layout:C,T=e.reverse,$=T===void 0?xt.reverse:T,R=e.data,S=e.minValue,k=S===void 0?xt.minValue:S,O=e.maxValue,D=O===void 0?xt.maxValue:O,E=e.margin,M=e.width,j=e.height,F=e.padding,W=F===void 0?xt.padding:F,B=e.innerPadding,U=B===void 0?xt.innerPadding:B,N=e.valueScale,V=N===void 0?xt.valueScale:N,X=e.indexScale,ne=X===void 0?xt.indexScale:X,K=e.initialHiddenIds,J=K===void 0?xt.initialHiddenIds:K,q=e.enableLabel,G=q===void 0?xt.enableLabel:q,z=e.labelSkipWidth,L=z===void 0?xt.labelSkipWidth:z,H=e.labelSkipHeight,ee=H===void 0?xt.labelSkipHeight:H,A=e.legends,se=A===void 0?xt.legends:A,ce=e.legendLabel,ue=e.totalsOffset,we=ue===void 0?xt.totalsOffset:ue,Te=m.useState(J??[]),at=Te[0],tt=Te[1],Be=m.useCallback(function($e){tt(function(Pe){return Pe.indexOf($e)>-1?Pe.filter(function(ze){return ze!==$e}):[].concat(Pe,[$e])})},[]),Ke=Ti(n),Ye=Ti(o),de=Ti(c),ke=Ma(l),Oe=ht(),ve=Xm(d,h),Ie=ar(p,Oe),Xe=ar(x,Oe),It=(y==="grouped"?XJ:nee)({layout:w,reverse:$,data:R,getIndex:Ke,keys:i,minValue:k,maxValue:D,width:M,height:j,getColor:ve,padding:W,innerPadding:U,valueScale:V,indexScale:ne,hiddenIds:at,formatValue:ke,getTooltipLabel:de,margin:E}),mt=It.bars,Je=It.xScale,bt=It.yScale,At=m.useMemo(function(){return mt.filter(function($e){return $e.data.value!==null}).map(function($e,Pe){return pt({},$e,{index:Pe})})},[mt]),it=m.useCallback(function($e){var Pe=$e.width,ze=$e.height;return!!G&&!(L>0&&Pe<L)&&!(ee>0&&ze<ee)},[G,L,ee]),gt=m.useMemo(function(){return i.map(function($e){var Pe=mt.find(function(ze){return ze.data.id===$e});return pt({},Pe,{data:pt({id:$e},Pe==null?void 0:Pe.data,{hidden:at.includes($e)})})})},[at,i,mt]),yt=m.useMemo(function(){return se.map(function($e){return[$e,ree({bars:$e.dataFrom==="keys"?gt:mt,direction:$e.direction,from:$e.dataFrom,groupMode:y,layout:w,legendLabel:ce,reverse:$})]})},[se,gt,mt,y,w,ce,$]),Lt=m.useMemo(function(){return function($e,Pe,ze,nt,vt,kt,Xt){nt===void 0&&(nt=xt.layout),vt===void 0&&(vt=xt.groupMode);var Dt=[];if($e.length===0)return Dt;var Bt=new Map,Ht=$e[0].width,Mt=$e[0].height;if(vt==="stacked"){var Wt=new Map;$e.forEach(function(fe){var ye=fe.data,Ee=ye.indexValue,qe=ye.value;uy(Bt,Ee,Number(qe)),iee(Wt,Ee,Number(qe))}),Wt.forEach(function(fe,ye){var Ee,qe,Ge,ot=Bt.get(ye)||0;nt==="vertical"?(Ee=Pe(ye),qe=ze(fe),Ge=ze(fe/2)):(Ee=Pe(fe),qe=ze(ye),Ge=Pe(fe/2)),Ee+=nt==="vertical"?Ht/2:kt,qe+=nt==="vertical"?-kt:Mt/2,Dt.push({key:"total_"+ye,x:Ee,y:qe,value:ot,formattedValue:Xt(ot),animationOffset:Ge})})}else if(vt==="grouped"){var Jt=new Map,Vt=new Map;$e.forEach(function(fe){var ye=fe.data,Ee=ye.indexValue,qe=ye.value;uy(Bt,Ee,Number(qe)),aee(Jt,Ee,Number(qe)),oee(Vt,Ee)}),Jt.forEach(function(fe,ye){var Ee,qe,Ge,ot=Bt.get(ye)||0,P=Vt.get(ye);nt==="vertical"?(Ee=Pe(ye),qe=ze(fe),Ge=ze(fe/2)):(Ee=Pe(fe),qe=ze(ye),Ge=Pe(fe/2)),Ee+=nt==="vertical"?P*Ht/2:kt,qe+=nt==="vertical"?-kt:P*Mt/2,Dt.push({key:"total_"+ye,x:Ee,y:qe,value:ot,formattedValue:Xt(ot),animationOffset:Ge})})}return Dt}(mt,Je,bt,w,y,we,ke)},[mt,Je,bt,w,y,we,ke]);return{bars:mt,barsWithValue:At,xScale:Je,yScale:bt,getIndex:Ke,getLabel:Ye,getTooltipLabel:de,formatValue:ke,getColor:ve,getBorderColor:Ie,getLabelColor:Xe,shouldRenderBarLabel:it,hiddenIds:at,toggleSerie:Be,legendsWithData:yt,barTotals:Lt}},see=function(e){var t=e.data,n=e.springConfig,r=e.animate,i=e.layout,a=i===void 0?St.layout:i,o=ht();return Fi(t,{keys:function(s){return s.key},from:function(s){return{x:a==="vertical"?s.x:s.animationOffset,y:a==="vertical"?s.animationOffset:s.y,labelOpacity:0}},enter:function(s){return{x:s.x,y:s.y,labelOpacity:1}},update:function(s){return{x:s.x,y:s.y,labelOpacity:1}},leave:function(s){return{x:a==="vertical"?s.x:s.animationOffset,y:a==="vertical"?s.animationOffset:s.y,labelOpacity:0}},config:n,immediate:!r,initial:r?void 0:null})(function(s,c){return v.jsx(ft.text,{x:s.x,y:s.y,fillOpacity:s.labelOpacity,style:pt({},o.labels.text,{pointerEvents:"none",fill:o.text.fill}),fontWeight:"bold",fontSize:o.labels.text.fontSize,fontFamily:o.labels.text.fontFamily,textAnchor:a==="vertical"?"middle":"start",alignmentBaseline:a==="vertical"?"alphabetic":"middle",children:c.formattedValue},c.key)})},cee=["isInteractive","animate","motionConfig","theme","renderWrapper"],lee=function(e){var t=e.data,n=e.indexBy,r=e.keys,i=e.margin,a=e.width,o=e.height,s=e.groupMode,c=e.layout,l=e.reverse,u=e.minValue,d=e.maxValue,f=e.valueScale,h=e.indexScale,g=e.padding,p=e.innerPadding,b=e.axisTop,x=e.axisRight,_=e.axisBottom,y=_===void 0?St.axisBottom:_,C=e.axisLeft,w=C===void 0?St.axisLeft:C,T=e.enableGridX,$=T===void 0?St.enableGridX:T,R=e.enableGridY,S=R===void 0?St.enableGridY:R,k=e.gridXValues,O=e.gridYValues,D=e.layers,E=D===void 0?St.layers:D,M=e.barComponent,j=M===void 0?St.barComponent:M,F=e.enableLabel,W=F===void 0?St.enableLabel:F,B=e.label,U=e.labelSkipWidth,N=U===void 0?St.labelSkipWidth:U,V=e.labelSkipHeight,X=V===void 0?St.labelSkipHeight:V,ne=e.labelTextColor,K=e.markers,J=K===void 0?St.markers:K,q=e.colorBy,G=e.colors,z=e.defs,L=z===void 0?St.defs:z,H=e.fill,ee=H===void 0?St.fill:H,A=e.borderRadius,se=A===void 0?St.borderRadius:A,ce=e.borderWidth,ue=ce===void 0?St.borderWidth:ce,we=e.borderColor,Te=e.annotations,at=Te===void 0?St.annotations:Te,tt=e.legendLabel,Be=e.tooltipLabel,Ke=e.valueFormat,Ye=e.isInteractive,de=Ye===void 0?St.isInteractive:Ye,ke=e.tooltip,Oe=ke===void 0?St.tooltip:ke,ve=e.onClick,Ie=e.onMouseEnter,Xe=e.onMouseLeave,It=e.legends,mt=e.role,Je=mt===void 0?St.role:mt,bt=e.ariaLabel,At=e.ariaLabelledBy,it=e.ariaDescribedBy,gt=e.isFocusable,yt=gt===void 0?St.isFocusable:gt,Lt=e.barAriaLabel,$e=e.barAriaLabelledBy,Pe=e.barAriaDescribedBy,ze=e.initialHiddenIds,nt=e.enableTotals,vt=nt===void 0?St.enableTotals:nt,kt=e.totalsOffset,Xt=kt===void 0?St.totalsOffset:kt,Dt=mn(),Bt=Dt.animate,Ht=Dt.config,Mt=Us(a,o,i),Wt=Mt.outerWidth,Jt=Mt.outerHeight,Vt=Mt.margin,fe=Mt.innerWidth,ye=Mt.innerHeight,Ee=MT({indexBy:n,label:B,tooltipLabel:Be,valueFormat:Ke,colors:G,colorBy:q,borderColor:we,labelTextColor:ne,groupMode:s,layout:c,reverse:l,data:t,keys:r,minValue:u,maxValue:d,margin:Vt,width:fe,height:ye,padding:g,innerPadding:p,valueScale:f,indexScale:h,enableLabel:W,labelSkipWidth:N,labelSkipHeight:X,legends:It,legendLabel:tt,initialHiddenIds:ze,totalsOffset:Xt}),qe=Ee.bars,Ge=Ee.barsWithValue,ot=Ee.xScale,P=Ee.yScale,re=Ee.getLabel,Z=Ee.getTooltipLabel,te=Ee.getBorderColor,ge=Ee.getLabelColor,Ce=Ee.shouldRenderBarLabel,pe=Ee.toggleSerie,be=Ee.legendsWithData,Ae=Ee.barTotals,Me=Fi(Ge,{keys:function(le){return le.key},from:function(le){return pt({borderColor:te(le),color:le.color,height:0,labelColor:ge(le),labelOpacity:0,labelX:le.width/2,labelY:le.height/2,transform:"translate("+le.x+", "+(le.y+le.height)+")",width:le.width},c==="vertical"?{}:{height:le.height,transform:"translate("+le.x+", "+le.y+")",width:0})},enter:function(le){return{borderColor:te(le),color:le.color,height:le.height,labelColor:ge(le),labelOpacity:1,labelX:le.width/2,labelY:le.height/2,transform:"translate("+le.x+", "+le.y+")",width:le.width}},update:function(le){return{borderColor:te(le),color:le.color,height:le.height,labelColor:ge(le),labelOpacity:1,labelX:le.width/2,labelY:le.height/2,transform:"translate("+le.x+", "+le.y+")",width:le.width}},leave:function(le){return pt({borderColor:te(le),color:le.color,height:0,labelColor:ge(le),labelOpacity:0,labelX:le.width/2,labelY:0,transform:"translate("+le.x+", "+(le.y+le.height)+")",width:le.width},c==="vertical"?{}:{labelX:0,labelY:le.height/2,height:le.height,transform:"translate("+le.x+", "+le.y+")",width:0})},config:Ht,immediate:!Bt,initial:Bt?void 0:null}),et=m.useMemo(function(){return{borderRadius:se,borderWidth:ue,enableLabel:W,isInteractive:de,labelSkipWidth:N,labelSkipHeight:X,onClick:ve,onMouseEnter:Ie,onMouseLeave:Xe,getTooltipLabel:Z,tooltip:Oe,isFocusable:yt,ariaLabel:Lt,ariaLabelledBy:$e,ariaDescribedBy:Pe}},[se,ue,W,Z,de,X,N,ve,Ie,Xe,Oe,yt,Lt,$e,Pe]),Nt=Km(L,qe,ee,{dataKey:"data",targetKey:"data.fill"}),wt={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null,totals:null};E.includes("annotations")&&(wt.annotations=v.jsx(WJ,{bars:qe,annotations:at},"annotations")),E.includes("axes")&&(wt.axes=v.jsx(cT,{xScale:ot,yScale:P,width:fe,height:ye,top:b,right:x,bottom:y,left:w},"axes")),E.includes("bars")&&(wt.bars=v.jsx(m.Fragment,{children:Me(function(le,cn){return m.createElement(j,pt({},et,{bar:cn,style:le,shouldRenderLabel:Ce(cn),label:re(cn.data)}))})},"bars")),E.includes("grid")&&(wt.grid=v.jsx(lT,{width:fe,height:ye,xScale:$?ot:null,yScale:S?P:null,xValues:k,yValues:O},"grid")),E.includes("legends")&&(wt.legends=v.jsx(UJ,{width:fe,height:ye,legends:be,toggleSerie:pe},"legends")),E.includes("markers")&&(wt.markers=v.jsx(DC,{markers:J,width:fe,height:ye,xScale:ot,yScale:P},"markers")),E.includes("totals")&&vt&&(wt.totals=v.jsx(see,{data:Ae,springConfig:Ht,animate:Bt,layout:c},"totals"));var Ut=m.useMemo(function(){return pt({},et,{margin:Vt,width:a,height:o,innerWidth:fe,innerHeight:ye,bars:qe,legendData:be,enableLabel:W,xScale:ot,yScale:P,tooltip:Oe,getTooltipLabel:Z,onClick:ve,onMouseEnter:Ie,onMouseLeave:Xe})},[et,Vt,a,o,fe,ye,qe,be,W,ot,P,Oe,Z,ve,Ie,Xe]);return v.jsx(ld,{width:Wt,height:Jt,margin:Vt,defs:Nt,role:Je,ariaLabel:bt,ariaLabelledBy:At,ariaDescribedBy:it,isFocusable:yt,children:E.map(function(le,cn){var Ft;return typeof le=="function"?v.jsx(m.Fragment,{children:m.createElement(le,Ut)},cn):(Ft=wt==null?void 0:wt[le])!=null?Ft:null})})},uee=function(e){var t=e.isInteractive,n=t===void 0?St.isInteractive:t,r=e.animate,i=r===void 0?St.animate:r,a=e.motionConfig,o=a===void 0?St.motionConfig:a,s=e.theme,c=e.renderWrapper,l=Xa(e,cee);return v.jsx(zs,{animate:i,isInteractive:n,motionConfig:o,renderWrapper:c,theme:s,children:v.jsx(lee,pt({isInteractive:n},l))})},dee=["isInteractive","renderWrapper","theme"],uf=function(e,t,n,r){return e.find(function(i){return LC(i.x+t.left,i.y+t.top,i.width,i.height,n,r)})},fee=function(e){var t=e.data,n=e.indexBy,r=e.keys,i=e.margin,a=e.width,o=e.height,s=e.groupMode,c=e.layout,l=e.reverse,u=e.minValue,d=e.maxValue,f=e.valueScale,h=e.indexScale,g=e.padding,p=e.innerPadding,b=e.axisTop,x=e.axisRight,_=e.axisBottom,y=_===void 0?Qt.axisBottom:_,C=e.axisLeft,w=C===void 0?Qt.axisLeft:C,T=e.enableGridX,$=T===void 0?Qt.enableGridX:T,R=e.enableGridY,S=R===void 0?Qt.enableGridY:R,k=e.gridXValues,O=e.gridYValues,D=e.layers,E=D===void 0?Qt.layers:D,M=e.renderBar,j=M===void 0?function(Z,te){var ge=te.bar,Ce=ge.color,pe=ge.height,be=ge.width,Ae=ge.x,Me=ge.y,et=te.borderColor,Nt=te.borderRadius,wt=te.borderWidth,Ut=te.label,le=te.labelColor,cn=te.shouldRenderLabel;if(Z.fillStyle=Ce,wt>0&&(Z.strokeStyle=et,Z.lineWidth=wt),Z.beginPath(),Nt>0){var Ft=Math.min(Nt,pe);Z.moveTo(Ae+Ft,Me),Z.lineTo(Ae+be-Ft,Me),Z.quadraticCurveTo(Ae+be,Me,Ae+be,Me+Ft),Z.lineTo(Ae+be,Me+pe-Ft),Z.quadraticCurveTo(Ae+be,Me+pe,Ae+be-Ft,Me+pe),Z.lineTo(Ae+Ft,Me+pe),Z.quadraticCurveTo(Ae,Me+pe,Ae,Me+pe-Ft),Z.lineTo(Ae,Me+Ft),Z.quadraticCurveTo(Ae,Me,Ae+Ft,Me),Z.closePath()}else Z.rect(Ae,Me,be,pe);Z.fill(),wt>0&&Z.stroke(),cn&&(Z.textBaseline="middle",Z.textAlign="center",Z.fillStyle=le,Z.fillText(Ut,Ae+be/2,Me+pe/2))}:M,F=e.enableLabel,W=F===void 0?Qt.enableLabel:F,B=e.label,U=e.labelSkipWidth,N=U===void 0?Qt.labelSkipWidth:U,V=e.labelSkipHeight,X=V===void 0?Qt.labelSkipHeight:V,ne=e.labelTextColor,K=e.colorBy,J=e.colors,q=e.borderRadius,G=q===void 0?Qt.borderRadius:q,z=e.borderWidth,L=z===void 0?Qt.borderWidth:z,H=e.borderColor,ee=e.annotations,A=ee===void 0?Qt.annotations:ee,se=e.legendLabel,ce=e.tooltipLabel,ue=e.valueFormat,we=e.isInteractive,Te=we===void 0?Qt.isInteractive:we,at=e.tooltip,tt=at===void 0?Qt.tooltip:at,Be=e.onClick,Ke=e.onMouseEnter,Ye=e.onMouseLeave,de=e.legends,ke=e.pixelRatio,Oe=ke===void 0?Qt.pixelRatio:ke,ve=e.canvasRef,Ie=e.enableTotals,Xe=Ie===void 0?Qt.enableTotals:Ie,It=e.totalsOffset,mt=It===void 0?Qt.totalsOffset:It,Je=m.useRef(null),bt=ht(),At=Us(a,o,i),it=At.margin,gt=At.innerWidth,yt=At.innerHeight,Lt=At.outerWidth,$e=At.outerHeight,Pe=MT({indexBy:n,label:B,tooltipLabel:ce,valueFormat:ue,colors:J,colorBy:K,borderColor:H,labelTextColor:ne,groupMode:s,layout:c,reverse:l,data:t,keys:r,minValue:u,maxValue:d,margin:it,width:gt,height:yt,padding:g,innerPadding:p,valueScale:f,indexScale:h,enableLabel:W,labelSkipWidth:N,labelSkipHeight:X,legends:de,legendLabel:se,totalsOffset:mt}),ze=Pe.bars,nt=Pe.barsWithValue,vt=Pe.xScale,kt=Pe.yScale,Xt=Pe.getLabel,Dt=Pe.getTooltipLabel,Bt=Pe.getBorderColor,Ht=Pe.getLabelColor,Mt=Pe.shouldRenderBarLabel,Wt=Pe.legendsWithData,Jt=Pe.barTotals,Vt=Li(),fe=Vt.showTooltipFromEvent,ye=Vt.hideTooltip,Ee=jJ({annotations:TT({data:ze,annotations:A,getPosition:function(Z){return{x:Z.x,y:Z.y}},getDimensions:function(Z){var te=Z.width,ge=Z.height;return{width:te,height:ge,size:Math.max(te,ge)}}})}),qe=m.useMemo(function(){return{borderRadius:G,borderWidth:L,isInteractive:Te,isFocusable:!1,labelSkipWidth:N,labelSkipHeight:X,margin:it,width:a,height:o,innerWidth:gt,innerHeight:yt,bars:ze,legendData:Wt,enableLabel:W,xScale:vt,yScale:kt,tooltip:tt,getTooltipLabel:Dt,onClick:Be,onMouseEnter:Ke,onMouseLeave:Ye}},[G,L,Te,N,X,it,a,o,gt,yt,ze,Wt,W,vt,kt,tt,Dt,Be,Ke,Ye]),Ge=Ma(ue);m.useEffect(function(){var Z,te=(Z=Je.current)==null?void 0:Z.getContext("2d");Je.current&&te&&(Je.current.width=Lt*Oe,Je.current.height=$e*Oe,te.scale(Oe,Oe),te.fillStyle=bt.background,te.fillRect(0,0,Lt,$e),te.translate(it.left,it.top),E.forEach(function(ge){ge==="grid"?typeof bt.grid.line.strokeWidth=="number"&&bt.grid.line.strokeWidth>0&&(te.lineWidth=bt.grid.line.strokeWidth,te.strokeStyle=bt.grid.line.stroke,$&&Cl(te,{width:gt,height:yt,scale:vt,axis:"x",values:k}),S&&Cl(te,{width:gt,height:yt,scale:kt,axis:"y",values:O})):ge==="axes"?uT(te,{xScale:vt,yScale:kt,width:gt,height:yt,top:b,right:x,bottom:y,left:w,theme:bt}):ge==="bars"?nt.forEach(function(Ce){j(te,{bar:Ce,borderColor:Bt(Ce),borderRadius:G,borderWidth:L,label:Xt(Ce.data),labelColor:Ht(Ce),shouldRenderLabel:Mt(Ce)})}):ge==="legends"?Wt.forEach(function(Ce){var pe=Ce[0],be=Ce[1];GC(te,pt({},pe,{data:be,containerWidth:gt,containerHeight:yt,theme:bt}))}):ge==="annotations"?BJ(te,{annotations:Ee,theme:bt}):ge==="totals"&&Xe?function(Ce,pe,be,Ae){Ae===void 0&&(Ae=Qt.layout),Ce.fillStyle=be.text.fill,Ce.font="bold "+be.labels.text.fontSize+"px "+be.labels.text.fontFamily,Ce.textBaseline=Ae==="vertical"?"alphabetic":"middle",Ce.textAlign=Ae==="vertical"?"center":"start",pe.forEach(function(Me){Ce.fillText(Me.formattedValue,Me.x,Me.y)})}(te,Jt,bt,c):typeof ge=="function"&&ge(te,qe)}),te.save())},[y,w,x,b,nt,G,L,Ee,$,S,Bt,Xt,Ht,k,O,s,o,yt,gt,qe,E,c,Wt,it.left,it.top,$e,Lt,Oe,j,vt,kt,l,Mt,bt,a,Jt,Xe,Ge]);var ot=m.useCallback(function(Z){if(ze&&Je.current){var te=jo(Je.current,Z),ge=te[0],Ce=te[1],pe=uf(ze,it,ge,Ce);pe!==void 0?(fe(m.createElement(tt,pt({},pe.data,{color:pe.color,label:pe.label,value:Number(pe.data.value)})),Z),Z.type==="mouseenter"&&(Ke==null||Ke(pe.data,Z))):ye()}},[ye,it,Ke,ze,fe,tt]),P=m.useCallback(function(Z){if(ze&&Je.current){ye();var te=jo(Je.current,Z),ge=te[0],Ce=te[1],pe=uf(ze,it,ge,Ce);pe&&(Ye==null||Ye(pe.data,Z))}},[ye,it,Ye,ze]),re=m.useCallback(function(Z){if(ze&&Je.current){var te=jo(Je.current,Z),ge=te[0],Ce=te[1],pe=uf(ze,it,ge,Ce);pe!==void 0&&(Be==null||Be(pt({},pe.data,{color:pe.color}),Z))}},[it,Be,ze]);return v.jsx("canvas",{ref:function(Z){Je.current=Z,ve&&"current"in ve&&(ve.current=Z)},width:Lt*Oe,height:$e*Oe,style:{width:Lt,height:$e,cursor:Te?"auto":"normal"},onMouseEnter:Te?ot:void 0,onMouseMove:Te?ot:void 0,onMouseLeave:Te?P:void 0,onClick:Te?re:void 0})},hee=m.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,i=e.theme,a=Xa(e,dee);return v.jsx(zs,{isInteractive:n,renderWrapper:r,theme:i,animate:!1,children:v.jsx(fee,pt({},a,{canvasRef:t}))})}),pee=function(e){return v.jsx(Ka,{children:function(t){var n=t.width,r=t.height;return v.jsx(uee,pt({width:n,height:r},e))}})};m.forwardRef(function(e,t){return v.jsx(Ka,{children:function(n){var r=n.width,i=n.height;return v.jsx(hee,pt({width:r,height:i},e,{ref:t}))}})});const mee="_side-content-bar_7crz7_1",gee="_mobile_7crz7_12",vee="_expanded_7crz7_20",bee="_resizer_7crz7_23",yee="_expander_7crz7_38",xee="_icon_7crz7_57",jr={"side-content-bar":"_side-content-bar_7crz7_1",sideContentBar:mee,mobile:gee,expanded:vee,resizer:bee,expander:yee,icon:xee},$T=({width:e,children:t,isExpandedOnMobileState:[n,r],resizeable:i=!0,onResize:a})=>{const{ProjectIconComponent:o}=m.useContext(Pt),{isMobile:s}=$s(),c=Rp({onSwipedRight:d=>{d.velocity>.8&&r(!1)},delta:100}),[l,u]=m.useState(null);return v.jsxs(v.Fragment,{children:[v.jsxs("section",{className:Q("luminus-side-content-bar shadow",jr.sideContentBar,{[jr.mobile]:s},{[jr.expanded]:n}),style:{width:`${e}px`},...c,children:[i&&!s?v.jsx("div",{role:"button",className:Q(jr.resizer,"luminus-side-content-bar-resizer","shadow"),draggable:!0,onDragStart:d=>u({startX:d.clientX,widthStart:e}),onDrag:d=>a(((l==null?void 0:l.widthStart)??0)+(((l==null?void 0:l.startX)??0)-d.clientX)),onDragEnd:()=>u(null),children:v.jsx(o,{className:jr.icon,icon:"resizer-horizontal"})}):null,t]}),s?v.jsx("div",{role:"button",onClick:()=>r(!n),className:Q(jr.expander,{[jr.expanded]:n},"luminus-side-content-bar-expander","shadow"),children:v.jsx(o,{className:jr.icon,icon:"chevron-left"})}):null]})},_ee=({title:e})=>v.jsx("div",{className:"mb-3",children:typeof e=="string"?v.jsx(dn,{variant:"h3",children:e}):e}),wee="_full-screen-container_1rm4r_1",RT={"full-screen-container":"_full-screen-container_1rm4r_1",fullScreenContainer:wee},Cee=Q("overflow-hidden luminus-full-screen-container",RT.fullScreenContainer),Tee="container-fluid",kee=({title:e,children:t,sideContent:n,sideContentWidth:r=250,sideContentResizeable:i=!0,noPadding:a,className:o,variant:s="main",helmet:c,unavailableOnMobile:l})=>{const{addHelmet:u,removeHelmet:d}=m.useContext(v2),{texts:{container:f}}=m.useContext(Pt),[h,g]=m.useState(r),[p,b]=m.useState(!1),x=m.useMemo(()=>{switch(s){case"fullScreen":return Cee;case"main":return Tee;default:throw new Error(`PageContainer got incorrect variant type: ${s}`)}},[s]);m.useEffect(()=>(c?u(c):typeof e=="string"&&e&&u(e),()=>d()),[c,u,d,e]);const _=Rp({onSwipedLeft:w=>{w.velocity>.8&&b(!0)},delta:100}),{isMobile:y}=$s(),C=m.useMemo(()=>y&&l,[y,l]);return m.useEffect(()=>{g(r)},[r]),v.jsxs(v.Fragment,{children:[v.jsx("div",{className:Q(x,a?"p-0":"p-3",o),style:s==="fullScreen"?{width:n?`calc(100% - ${h}px)`:"100%"}:void 0,..._,children:v.jsx("div",{className:s==="fullScreen"?RT.fullScreenContainer:void 0,style:s==="main"?{paddingRight:n?`${h}px`:void 0}:{height:"100%",width:"100%"},children:C?v.jsx(Ap,{variant:"warning",children:f.unavailableOnMobile}):v.jsxs(v.Fragment,{children:[e?v.jsx(_ee,{title:e}):null,t]})})}),n&&!C?v.jsx($T,{width:h,isExpandedOnMobileState:[p,b],onResize:w=>i?g(w):{},children:n}):null]})},ag=({InputContainer:e=As,formField:t,label:n,resetsFields:r,options:i,isNumber:a,size:o,showClearIcon:s,clearValue:c,noSortOptions:l,required:u,hidden:d,disabled:f,withoutLabel:h,hint:g,className:p})=>{const{register:b,formState:x,getValues:_,setValue:y,watch:C}=rn.useFormContext(),w=Xl({falseIfNotInit:!0});console.log("disabled ",f),console.log("formDisabled ",w);const[T,$]=m.useState(void 0),[R,S]=m.useState(!1),k=m.useMemo(()=>i.toSorted((M,j)=>l?0:(M.name??"").localeCompare(j.name??"")),[i,l]),O=m.useCallback(()=>{const M=c??null;a?y(t,M===null?null:Number(M),{shouldDirty:!0,shouldValidate:R}):y(t,(M==null?void 0:M.toString())??"",{shouldDirty:!0,shouldValidate:R})},[c,a,y,t,R]);m.useEffect(()=>{const M=t.split(".");let j=x.errors;M.forEach(F=>{j!==void 0&&(j=j[F])}),$(j)},[x,t]);const D=m.useMemo(()=>f||w,[f,w]);console.log(D),m.useEffect(()=>{y(t,_(t))},[k,t,_,y]),m.useEffect(()=>{x.isSubmitted&&S(!0)},[x]);const E=T!==void 0;return v.jsx(v.Fragment,{children:v.jsxs(e,{label:n??"",required:u,disabled:D,hidden:d,withoutLabel:h,isInvalid:E,hint:g,className:p,children:[v.jsxs(sr.Select,{size:o,...b(t,{setValueAs:M=>a?M==null||M===""?null:parseInt(M,10):M==null||M===""?null:M,onChange:()=>{r&&r.forEach(M=>y(M,null,{shouldDirty:!0,shouldValidate:R}))}}),isInvalid:E,hidden:d,disabled:D,className:"w-100",children:[v.jsx("option",{value:""}),k.map(M=>v.jsx("option",{value:M.id??"",children:M.name},M.id))]}),s&&C(t)&&v.jsx("div",{className:"luminus-input-remove-icon inset",children:v.jsx(Rs,{color:"secondary",size:"sm",onClick:O,children:v.jsx(ks,{})})}),T&&v.jsx(Jl,{message:T.message})]})})},og=({InputContainer:e=As,formField:t,label:n,resetsFields:r,size:i,showClearIcon:a,clearValue:o,required:s,hidden:c,disabled:l,rows:u,withoutLabel:d,customFormControlProps:f,minLength:h,maxLength:g,hint:p,onChange:b,className:x})=>{const{register:_,formState:y,setValue:C,watch:w}=rn.useFormContext(),T=Xl({falseIfNotInit:!0}),[$,R]=m.useState(void 0),[S,k]=m.useState(!1),O=m.useCallback(()=>{const j=o??null;C(t,(j==null?void 0:j.toString())??"",{shouldDirty:!0,shouldValidate:S})},[o,C,t,S]),D=m.useCallback(()=>{const j=t.split(".");let F=y.errors;j.forEach(W=>{F!==void 0&&(F=F[W])}),R(F)},[y,t]),E=m.useMemo(()=>l||T,[l,T]);m.useEffect(()=>{D()},[D]),m.useEffect(()=>{y.isSubmitted&&k(!0)},[y]);const M=$!==void 0;return v.jsxs(e,{label:n??"",required:s,disabled:E,hidden:c,withoutLabel:d,isInvalid:M,className:x,hint:p,isForTextAreaInput:!0,children:[v.jsx(sr.Control,{as:"textarea",size:i,..._(t,{setValueAs:j=>j==null||j===""?null:j,onChange:j=>{var F;r&&r.forEach(W=>C(W,null,{shouldDirty:!0,shouldValidate:S})),b&&b((F=j.target)!=null&&F.value?j.target.value.toString():null)}}),isInvalid:M,hidden:c,disabled:E,rows:u??2,className:"w-100",minLength:h,maxLength:g,...f}),a&&w(t)&&v.jsx("div",{className:"luminus-input-remove-icon",children:v.jsx(Rs,{color:"secondary",size:"sm",onClick:O,children:v.jsx(ks,{})})}),$&&v.jsx(Jl,{message:$.message})]})},$a=m.forwardRef(({InputContainer:e=As,type:t,formField:n,label:r,placeholder:i,size:a,resetsFields:o,showClearIcon:s,clearValue:c,required:l,hidden:u,disabled:d,withoutLabel:f,list:h,step:g,CustomOnChangeComponent:p,noSelectOnFocus:b,minLength:x,maxLength:_,hint:y,onChange:C,className:w,autoComplete:T},$)=>{const{register:R,formState:S,setValue:k,watch:O}=rn.useFormContext(),D=Xl({falseIfNotInit:!0}),[E,M]=m.useState(void 0),[j,F]=m.useState(!1),W=m.useCallback(()=>{const z=c??null;t==="number"?k(n,z!==null?Number(z):null,{shouldDirty:!0,shouldValidate:j}):k(n,(z==null?void 0:z.toString())??"",{shouldDirty:!0,shouldValidate:j})},[c,t,k,n,j]),B=m.useCallback(()=>{const z=n.split(".");let L=S.errors;z.forEach(H=>{L!==void 0&&(L=L[H])}),M(L)},[S,n]),U=m.useMemo(()=>d||D,[d,D]);m.useEffect(()=>{B()},[B]),m.useEffect(()=>{S.isSubmitted&&F(!0)},[S]);const N=E!==void 0,[V,X]=m.useState(!1),ne=O(n),K=Cp(t,ne??null,V),{ref:J,...q}=R(n,{setValueAs:z=>t==="number"?z==null||z===""?null:Number(z):z==null||z===""?null:z,onChange:z=>{var L;o&&o.forEach(H=>k(H,null,{shouldDirty:!0,shouldValidate:j})),C&&C((L=z.target)!=null&&L.value?t==="number"?Number(z.target.value)??null:z.target.value.toString():null)},onBlur:()=>X(!1)}),G=m.useRef(null);return m.useImperativeHandle($,()=>G.current,[G]),v.jsxs(e,{label:r??"",required:l,disabled:U,hidden:u,withoutLabel:f,isInvalid:N,hint:y,className:w,children:[v.jsxs("div",{className:"luminus-input-container position-relative w-100",children:[v.jsx(sr.Control,{type:K,placeholder:i??r,size:a,onFocus:z=>{X(!0),!b&&z.target.select()},...q,ref:z=>{J(z),G.current=z},isInvalid:N,hidden:u,disabled:U,list:h,className:"w-100",step:g,minLength:x,maxLength:_,autoComplete:T}),p&&v.jsx("div",{className:"custom-picker-button",children:p})]}),s&&O(n)&&v.jsx("div",{className:`luminus-input-remove-icon ${t!=="text"?"inset":""}`,children:v.jsx(Rs,{color:"secondary",size:"sm",onClick:W,children:v.jsx(ks,{})})}),E&&v.jsx(Jl,{message:E.message})]})}),dy=(e,t,n)=>{if(e&&"reportValidity"in e){const r=rn.get(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},AT=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?dy(r.ref,n,e):r.refs&&r.refs.forEach(i=>dy(i,n,e))}},See=(e,t)=>{t.shouldUseNativeValidation&&AT(e,t);const n={};for(const r in e){const i=rn.get(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(Oee(t.names||Object.keys(e),r)){const o=Object.assign({},rn.get(n,r));rn.set(o,"root",a),rn.set(n,r,o)}else rn.set(n,r,a)}return n},Oee=(e,t)=>e.some(n=>n.startsWith(t+"."));var Eee=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return e.push(d)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=rn.appendErrors(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},fd=function(e,t,n){return n===void 0&&(n={}),function(r,i,a){try{return Promise.resolve(function(o,s){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(l){return a.shouldUseNativeValidation&&AT({},a),{errors:{},values:n.raw?r:l}})}catch(l){return s(l)}return c&&c.then?c.then(void 0,s):c}(0,function(o){if(function(s){return Array.isArray(s==null?void 0:s.errors)}(o))return{values:{},errors:See(Eee(o.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw o}))}catch(o){return Promise.reject(o)}}};const Mee="_wrapper_9omw0_1",$ee="_controls_9omw0_16",Ree="_explorerWindow_9omw0_20",Aee="_folderList_9omw0_28",jee="_fileList_9omw0_35",Pee="_dndText_9omw0_61",ai={wrapper:Mee,controls:$ee,explorerWindow:Ree,folderList:Aee,fileList:jee,dndText:Pee},qt=m.createContext({apiActions:{},loadDocuments(){throw new Error("DocumentsContext was not initialized.")},reducer:[{},{}],entityType:"",entityId:-1}),Iee="_folderIcon_vxg2z_1",Dee="_defaultFolder_vxg2z_5",Nee="_names_vxg2z_9",Fee="_folderType_vxg2z_13",pc={folderIcon:Iee,defaultFolder:Dee,names:Nee,folderType:Fee},jT=({isActive:e,isDefault:t,folderName:n,typeName:r})=>{const{ProjectIconComponent:i}=m.useContext(Pt);return v.jsxs("div",{className:"d-flex gap-2 align-items-center",children:[v.jsx(i,{icon:`folder${e?"-filled":""}`,className:Q("d-inline-block",t?pc.defaultFolder:"text-primary"),iconProps:{className:pc.folderIcon}}),v.jsxs("div",{className:Q("d-flex flex-column gap-0 align-items-start",pc.names),children:[v.jsx("span",{className:e?"fw-bold":"",children:n}),r?v.jsxs("span",{className:pc.folderType,children:["(",r,")"]}):null]})]})},Lee=({customText:e})=>{const{reducer:[t,n]}=m.useContext(qt),r=m.useCallback(()=>{n({type:"select-folder",folderId:"root"})},[n]);return v.jsx("li",{children:v.jsx("button",{onClick:r,type:"button",className:Q("border-0 bg-transparent"),children:v.jsx(jT,{folderName:e??"root",isActive:t.activeFolder==="root",typeName:"",isDefault:!0})})})};function Bee(e){if(e.state!=="openned-modal")throw new Error('Not in "openned-modal" state!')}const PT=()=>{const e=Gl(),{startLoading:t,stopLoading:n}=m.useContext(Bl),{reducer:[,r]}=m.useContext(qt),i=m.useCallback(async(o,s)=>{t("documents-renameFolder");try{await e.put("/documents/folder/rename",{folderId:o,name:s}),r({type:"update-folders",folderIds:[o],newProperties:{name:s}})}finally{n("documents-renameFolder")}},[e,r,t,n]),a=m.useCallback(async o=>{t("documentsFolderCreate");try{const s=await e.post("/documents/folder",o);r({type:"create-folder",folderData:o,folderId:s.data.id,isOnlyRead:s.data.onlyRead})}finally{n("documentsFolderCreate")}},[e,r,t,n]);return{renameFolder:i,createFolder:a}},Wee=()=>{const{reducer:[e],entityId:t,entityType:n}=m.useContext(qt),{zNumberRequired:r,zStringRequired:i}=Kl(),{createFolder:a}=PT(),o=Zt.object({name:i(),documentTypeId:r()}),s=rn.useForm({resolver:fd(o)}),c=m.useCallback(async l=>{const u={...l,dbObjectId:t.toString(),entity:n,parentFolderId:e.activeFolder==="root"?null:e.activeFolder};await a(u)},[a,t,n,e.activeFolder]);return{formMethods:s,onSubmit:c}},Uee=({handleClose:e})=>{var o;const{texts:{documents:t}}=m.useContext(Pt),{reducer:[n],entityType:r}=m.useContext(qt);if(Bee(n),n.modalType!=="create-folder")throw new Error("Tried to render CreateFolderModal without create-folder modal type reducer state.");const{onSubmit:i,formMethods:a}=Wee();return v.jsx(v.Fragment,{children:v.jsx(rn.FormProvider,{...a,children:v.jsxs(sr,{onSubmit:a.handleSubmit(i),children:[v.jsx(bn.Header,{closeButton:!0,children:v.jsx(bn.Title,{children:t.createFolderInFolder(((o=n.foldersMap.get(n.chosenFolderId))==null?void 0:o.name)??r)})}),v.jsxs(bn.Body,{children:[v.jsx($a,{formField:"name",type:"text",label:t.name,required:!0}),v.jsx(ag,{options:n.documentTypes,formField:"documentTypeId",label:t.folderType,isNumber:!0,required:!0})]}),v.jsxs(bn.Footer,{children:[v.jsx(Mi,{onClick:e,variant:"outlined",color:"secondary",children:t.cancel}),v.jsx(Mi,{type:"submit",children:t.createFolder})]})]})})})},IT=100,zee=(e,t)=>{const n=Gl(),{startLoading:r,stopLoading:i}=m.useContext(Bl),{loadDocuments:a}=m.useContext(qt),{zStringRequired:o,zString:s,zNumberRequired:c,zDateRequired:l}=Kl(),u=Zt.object({name:o(),description:s(),validToDate:l(),documentTypeId:c()}),d=rn.useForm({resolver:fd(u),defaultValues:{...e,validToDate:Wl(e.validToDate)}}),f=m.useCallback(async h=>{r("documents-updateProperties");try{await n.put(`/documents/${e.id}/update-info`,h),await a(),t()}finally{i("documents-updateProperties")}},[n,e.id,t,a,r,i]);return{formMethods:d,onSubmit:f}},Hee=({handleClose:e,file:t})=>{const{texts:{documents:n}}=m.useContext(Pt),{reducer:[r]}=m.useContext(qt),{formMethods:i,onSubmit:a}=zee(t,e);return v.jsxs(v.Fragment,{children:[v.jsx(bn.Header,{closeButton:!0,children:v.jsx(bn.Title,{children:n.editFileProperties})}),v.jsx(rn.FormProvider,{...i,children:v.jsxs(sr,{onSubmit:i.handleSubmit(a),children:[v.jsxs(bn.Body,{children:[v.jsx($a,{formField:"name",type:"text",label:n.name,required:!0}),v.jsx($a,{formField:"validToDate",type:"date",label:n.validSince,required:!0}),v.jsx(ag,{formField:"documentTypeId",label:n.category,options:r.documentTypes,isNumber:!0,required:!0}),v.jsx(og,{formField:"description",label:n.description,customFormControlProps:{maxLength:IT}})]}),v.jsxs(bn.Footer,{children:[v.jsx(Mi,{onClick:e,color:"secondary",variant:"outlined",children:n.cancel}),v.jsx(Mi,{type:"submit",children:n.save})]})]})})]})},Vee=({handleClose:e})=>{const{reducer:[t]}=m.useContext(qt),n=m.useMemo(()=>{if(t.markedFiles.length===1)return t.constantFiles.find(r=>r.id===t.markedFiles[0])},[t.constantFiles,t.markedFiles]);return n===void 0?(e(),v.jsx(v.Fragment,{})):v.jsx(Hee,{file:n,handleClose:e})},qee=()=>{const{reducer:[e,t]}=m.useContext(qt),n=m.useCallback(()=>{t({type:"close-modal"})},[t]),r=m.useMemo(()=>{if(e.state!=="openned-modal")return null;switch(e.modalType){case"create-folder":return v.jsx(Uee,{handleClose:n});case"edit-file-properties":return v.jsx(Vee,{handleClose:n});default:return null}},[e.state,e.modalType]);return v.jsx(bn,{show:e.state==="openned-modal",onHide:n,children:r})},fy="documents_drag_image_element",mc="drop-container-highlight-class",hy="data-drop-container-id",py="data-draggable-id",Yee=()=>{const e=document.getElementById(fy);if(e!==null)return e;const t=document.createElement("div");return t.id=fy,t.style.position="absolute",t.style.top=`${-window.outerHeight}px`,t.style.left=`${-window.outerWidth}px`,t.style.width="50px",t.style.height="50px",t.style.backgroundColor="rgba(0, 0, 0, 0.5)",t.style.color="white",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.fontSize="16px",t.style.borderRadius="5px",document.body.appendChild(t),t},sg=()=>{const{apiActions:{moveDocuments:e},reducer:[t]}=m.useContext(qt),n=m.useCallback(l=>{var u;if(t.markedFiles.length>0){const d=Yee();d.innerHTML=t.markedFiles.length.toString(),l.dataTransfer.setDragImage(d,0,0),l.dataTransfer.clearData(),l.dataTransfer.setData("application/json",JSON.stringify(t.markedFiles)),l.dataTransfer.dropEffect="none",l.dataTransfer.effectAllowed="move"}else l.dataTransfer.setData("application/json",JSON.stringify([parseInt(((u=l.currentTarget.attributes.getNamedItem(py))==null?void 0:u.nodeValue)??"",10)])),l.dataTransfer.dropEffect="none",l.dataTransfer.effectAllowed="move"},[t.markedFiles]),r=m.useCallback(l=>({[py]:l,draggable:t.markedFiles.length===0||t.markedFiles.includes(l),onDragStart:n}),[n,t.markedFiles]),i=m.useCallback(l=>u=>{var h;u.preventDefault(),u.stopPropagation(),u.currentTarget.classList.remove(mc);const d=u.dataTransfer.files;if(l&&d&&d.length>0){l(d);return}const f=u.dataTransfer.getData("application/json");if(f){const g=JSON.parse(f),p=parseInt(((h=u.currentTarget.attributes.getNamedItem(hy))==null?void 0:h.value)??"",10);e(p,g)}},[e]),a=m.useCallback(()=>l=>{l.preventDefault(),l.stopPropagation()},[]),o=m.useCallback(l=>u=>{u.preventDefault(),u.stopPropagation(),u.dataTransfer.types.includes("Files")?(u.dataTransfer.dropEffect="copy",u.currentTarget.classList.add(mc)):!l&&u.dataTransfer.types.includes("application/json")?(u.dataTransfer.dropEffect="move",u.currentTarget.classList.add(mc)):u.dataTransfer.dropEffect="none"},[]),s=m.useCallback(l=>{l.preventDefault(),l.stopPropagation(),l.target===l.currentTarget&&(l.dataTransfer.dropEffect="none",l.currentTarget.classList.remove(mc))},[]),c=m.useCallback((l,u)=>({onDrop:i(u==null?void 0:u.onFilesDrop),onDragOver:a(),onDragEnter:o(u==null?void 0:u.ignoreInner),onDragLeave:s,[hy]:l}),[i,a,o,s]);return{getDraggableProps:r,getDropProps:c}};function DT(e,t,n){for(let r=0;r<e.childrenIds.length;r++){const i=e.childrenIds[r];if(i===t)return!0;const a=n.get(i);if(a&&DT(a,t,n))return!0}return!1}function Gee(e){if(e.activeFolder==="root")return!1;const t=e.foldersMap.get(e.activeFolder);return!(t!=null&&t.onlyRead)}function NT(e,t){const n=t.get(e);return n===void 0?"":n.parentId===null?n.name:`${NT(n.parentId,t)}/${n.name}`}const Zee=()=>{const{zString:e,zStringRequired:t,zNumberRequired:n}=Kl();return{formSchema:m.useMemo(()=>Zt.object({validTo:t(),description:e(),name:e(),documentTypeId:n()}),[n,e,t])}},cg=({handleClose:e,files:t,targetFolderId:n})=>{var f;const{texts:{documents:r}}=m.useContext(Pt),{reducer:[i],apiActions:{uploadFiles:a}}=m.useContext(qt),o=m.useMemo(()=>[...t],[t]),s=m.useMemo(()=>n??i.activeFolder,[i.activeFolder,n]),c=m.useMemo(()=>s==="root"?void 0:i.foldersMap.get(s),[s,i.foldersMap]),{formSchema:l}=Zee(),u=rn.useForm({resolver:fd(l),defaultValues:{validTo:Wl(new Date().toISOString()),documentTypeId:(f=i.documentTypes.find(h=>{var g;return h.name===((g=i.foldersMap.get(s))==null?void 0:g.defaultDocType)}))==null?void 0:f.id}}),d=m.useCallback(async h=>{s!=="root"&&(await a(t,{folderId:s,...h}),e())},[t,e,s,a]);return v.jsxs(bn,{show:!0,onHide:e,children:[v.jsx(bn.Header,{closeButton:!0,children:v.jsxs("div",{children:[r.uploadFilesPrompt(t.length,c.name),v.jsx("ul",{children:o.map((h,g)=>v.jsxs("li",{children:[h.name," - ",xa(h.size)]},`${h.name}-${g}`))})]})}),v.jsx(rn.FormProvider,{...u,children:v.jsxs(sr,{onSubmit:u.handleSubmit(d),children:[v.jsxs(bn.Body,{children:[v.jsx(ag,{formField:"documentTypeId",label:r.documentType,options:i.documentTypes,isNumber:!0,required:!0}),v.jsx($a,{formField:"validTo",label:r.validSince,type:"date",required:!0}),o.length===1?v.jsx($a,{formField:"name",label:r.name,type:"text"}):null,v.jsx(og,{formField:"description",label:r.description,customFormControlProps:{maxLength:IT}})]}),v.jsxs(bn.Footer,{children:[v.jsx(Mi,{variant:"outlined",color:"secondary",onClick:e,children:r.cancel}),v.jsx(Mi,{type:"submit",children:r.upload})]})]})})]})},Kee="_folder_1cktt_1",Xee="_collapseArrowDiv_1cktt_8",Qee="_button_1cktt_20",Jee="_nestedList_1cktt_24",ete="_numberOfFiles_1cktt_31",tte="_collapseArrow_1cktt_8",oi={folder:Kee,collapseArrowDiv:Xee,button:Qee,nestedList:Jee,numberOfFiles:ete,collapseArrow:tte},FT=({dirId:e,writePermissions:t})=>{const{ProjectIconComponent:n}=m.useContext(Pt),{reducer:[r,i]}=m.useContext(qt),{getDropProps:a}=sg(),[o,s]=m.useState(null),[c,l]=m.useState(!0),u=m.useMemo(()=>{const p=r.foldersMap.get(e);if(p===void 0)throw new Error(`tried to get dir with id ${e}`);return p},[e,r.foldersMap]),d=m.useCallback(()=>{r.activeFolder!=="root"&&DT(u,r.activeFolder,r.foldersMap)&&i({type:"select-folder",folderId:e}),l(!0)},[e,u,i,r.activeFolder,r.foldersMap]),f=m.useMemo(()=>u.childrenIds.length>0,[u.childrenIds.length]),h=m.useCallback(()=>{i({type:"select-folder",folderId:e})},[e,i]),g=m.useMemo(()=>r.filteredFiles.filter(p=>p.folderId===e&&p.archive===!1).length,[e,r.filteredFiles]);return v.jsxs(v.Fragment,{children:[v.jsxs("li",{className:oi.folder,children:[v.jsx("div",{className:oi.collapseArrowDiv,children:f?c?v.jsx("button",{onClick:()=>l(!1),type:"button",children:v.jsx(n,{icon:"chevron-right",iconProps:{className:oi.collapseArrow}})}):v.jsx("button",{onClick:d,type:"button",children:v.jsx(n,{icon:"chevron-down",iconProps:{className:oi.collapseArrow}})}):null}),v.jsx("button",{className:Q(oi.button),onClick:h,type:"button",...t&&!u.onlyRead?a(e,{onFilesDrop:p=>s(p)}):{},children:v.jsxs("div",{className:"d-flex align-items-center gap-2",children:[v.jsx(jT,{isDefault:u.isDefault,folderName:u.name,typeName:u.defaultDocType??"",isActive:e===r.activeFolder}),g>0?v.jsxs("span",{className:oi.numberOfFiles,children:["[",g,"]"]}):void 0]})}),f?c?null:v.jsx("ul",{className:oi.nestedList,children:u==null?void 0:u.childrenIds.map(p=>v.jsx(FT,{dirId:p,writePermissions:t},p))}):void 0]}),o!==null?v.jsx(cg,{files:o,handleClose:()=>s(null),targetFolderId:e}):null]})},nte="_wrapper_1th2u_1",rte="_downloadButton_1th2u_9",LT={wrapper:nte,downloadButton:rte};function ite(e){return Ve({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M320 464c8.8 0 16-7.2 16-16V160H256c-17.7 0-32-14.3-32-32V48H64c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H320zM0 64C0 28.7 28.7 0 64 0H229.5c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64z"},child:[]}]})(e)}function ate(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M448 80c8.8 0 16 7.2 16 16V415.8l-5-6.5-136-176c-4.5-5.9-11.6-9.3-19-9.3s-14.4 3.4-19 9.3L202 340.7l-30.5-42.7C167 291.7 159.8 288 152 288s-15 3.7-19.5 10.1l-80 112L48 416.3l0-.3V96c0-8.8 7.2-16 16-16H448zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm80 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(e)}function ote(e){return Ve({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M23 1.5q.41 0 .7.3.3.29.3.7v19q0 .41-.3.7-.29.3-.7.3H7q-.41 0-.7-.3-.3-.29-.3-.7V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h5V2.5q0-.41.3-.7.29-.3.7-.3zM6 13.28l1.42 2.66h2.14l-2.38-3.87 2.34-3.8H7.46l-1.3 2.4-.05.08-.04.09-.64-1.28-.66-1.29H2.59l2.27 3.82-2.48 3.85h2.16zM14.25 21v-3H7.5v3zm0-4.5v-3.75H12v3.75zm0-5.25V7.5H12v3.75zm0-5.25V3H7.5v3zm8.25 15v-3h-6.75v3zm0-4.5v-3.75h-6.75v3.75zm0-5.25V7.5h-6.75v3.75zm0-5.25V3h-6.75v3Z"},child:[]}]})(e)}function ste(e){return Ve({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M23.004 1.5q.41 0 .703.293t.293.703v19.008q0 .41-.293.703t-.703.293H6.996q-.41 0-.703-.293T6 21.504V18H.996q-.41 0-.703-.293T0 17.004V6.996q0-.41.293-.703T.996 6H6V2.496q0-.41.293-.703t.703-.293zM6.035 11.203l1.442 4.735h1.64l1.57-7.876H9.036l-.937 4.653-1.325-4.5H5.38l-1.406 4.523-.938-4.675H1.312l1.57 7.874h1.641zM22.5 21v-3h-15v3zm0-4.5v-3.75H12v3.75zm0-5.25V7.5H12v3.75zm0-5.25V3h-15v3Z"},child:[]}]})(e)}const cte="_excel_18ggp_1",lte="_word_18ggp_5",ute="_pdf_18ggp_9",dte="_image_18ggp_13",gc={excel:cte,word:lte,pdf:ute,image:dte},BT=({fileExtension:e,className:t,...n})=>{switch(e==null?void 0:e.toUpperCase()){case"JPG":case"JPEG":case"BMP":case"PNG":return v.jsx("span",{className:Q(t,gc.image),children:v.jsx(ate,{...n})});case"XLS":case"XLSX":case"CSV":return v.jsx(ote,{className:Q(t,gc.excel),...n});case"DOC":case"DOCM":case"DOCX":return v.jsx(ste,{className:Q(t,gc.word),...n});case"PDF":return v.jsx(o8,{className:Q(t,gc.pdf),...n});default:return v.jsx(ite,{})}},fte=()=>{const{ProjectIconComponent:e,texts:{documents:t}}=m.useContext(Pt),{apiActions:{downloadFile:n},reducer:[r]}=m.useContext(qt),i=m.useMemo(()=>r.activeFolder==="root",[r.activeFolder]);return{columns:m.useMemo(()=>[{fieldName:"id",caption:"id",type:"number",isVisible:!1},...i?[{fieldName:"folderName",caption:t.folder,type:"string"}]:[],{fieldName:"--icon",caption:"",type:"string",valueFormat:o=>v.jsx(BT,{fileExtension:o.row.original.fileExtension}),width:36,align:"center",filterType:"none",noSort:!0},{fieldName:"name",caption:t.name,type:"string"},{fieldName:"description",caption:t.description,type:"string"},{fieldName:"fileExtension",caption:t.fileExtension,type:"string",filterType:"select",width:50},{fieldName:"--downloadButton",caption:"",type:"number",filterType:"none",width:38,align:"center",noSort:!0,valueFormat:o=>v.jsx(Ql,{className:LT.downloadButton,onClick:()=>n(o.row.original.id,!0),children:v.jsx(e,{icon:"file-download"})})},{fieldName:"documentTypeName",caption:t.documentType,type:"string",filterType:"select"},{fieldName:"validToDate",caption:t.validSince,type:"date"},{fieldName:"size",caption:t.size,type:"number",valueFormat:({cell:{value:o}})=>o!==void 0?xa(o*1024*1024):"",filterType:"none"},{fieldName:"archive",caption:t.archived,type:"boolean",filterType:"select",valueFormat:({cell:{value:o}})=>o?t.yes[0]:t.no[0]}],[e,t.archived,t.description,t.documentType,t.fileExtension,t.folder,t.name,t.no,t.size,t.validSince,t.yes,n,i])}},hte=({BnfTableComponent:e,tableIdentifier:t,writePermissions:n})=>{const{reducer:[r,i]}=m.useContext(qt),{columns:a}=fte(),o=m.useCallback(h=>{i({type:"mark-files-by-action",setStateAction:h})},[i]),s=m.useMemo(()=>r.activeFolder==="root",[r.activeFolder]),c=m.useMemo(()=>{var h;return r.activeFolder==="root"?!1:((h=r.foldersMap.get(r.activeFolder))==null?void 0:h.onlyRead)??!1},[r.activeFolder,r.foldersMap]),l=m.useMemo(()=>({enabled:n&&!s,idField:"id",selectedRows:r.markedFiles,setSelectedRows:o}),[s,o,r.markedFiles,n]),u=m.useMemo(()=>r.activeFolder==="root"?r.filteredFiles:r.filteredFiles.filter(h=>h.folderId===r.activeFolder),[r.activeFolder,r.filteredFiles]),{getDraggableProps:d}=sg(),f=m.useCallback(h=>n===!1||c?{}:d(h.id),[d,c,n]);return v.jsx("div",{className:Q(LT.wrapper),children:v.jsx(e,{data:u,columnsDef:a,rowSelection:l,useScrollableContainer:!0,getRowProps:f,defaultConfig:{defaultFilters:[{id:"archive",value:"false"}]},tableId:t,searchStatePrefix:"docs",useSearchState:!0,hideBottomBar:!0},r.activeFolder)})},pte="_wrapper_1q562_1",mte="_divButtons_1q562_10",df={wrapper:pte,divButtons:mte},gte="_wrapper_1bpdd_1",vte="_fileInput_1bpdd_5",my={wrapper:gte,fileInput:vte},bte=({entityId:e,entityType:t,children:n,disabled:r})=>{const i=m.useRef(null),[a,o]=m.useState(null),{reducer:[s]}=m.useContext(qt),c=f=>{var h;(((h=f.target.files)==null?void 0:h.length)??0)>0&&o(f.target.files)},l=m.useCallback(()=>{o(null),i.current&&(i.current.value="")},[]),u=m.useMemo(()=>`documents-upload-${t}-${e}`,[e,t]),d=m.useMemo(()=>r||s.activeFolder==="root",[r,s.activeFolder]);return v.jsxs("div",{className:my.wrapper,children:[v.jsx("label",{htmlFor:u,className:Q("btn btn-context luminus-context-button",d?"disabled":void 0),children:n}),v.jsx("input",{id:u,type:"file",multiple:!0,onChange:c,className:my.fileInput,ref:i,disabled:d}),a!==null?v.jsx(cg,{handleClose:l,files:a}):void 0]})},Gn=({children:e,onClick:t,className:n,disabled:r=!1})=>v.jsx(Ql,{onClick:t,className:n,disabled:r,children:e}),yte=({className:e,entityId:t,entityType:n})=>{var $,R;const{texts:{documents:r}}=m.useContext(Pt),{prompt:i}=hx(),{confirm:a}=_p(),{apiActions:o,reducer:[s,c]}=m.useContext(qt),{deleteFiles:l,renameFiles:u,downloadAsZip:d,archivateFiles:f,deleteDirectory:h}=o,{renameFolder:g}=PT(),p=m.useMemo(()=>s.markedFiles.length===0,[s.markedFiles.length]),b=m.useMemo(()=>s.markedFiles.length===1,[s.markedFiles.length]),x=m.useCallback(async()=>{if(s.activeFolder==="root")return;const S=await i(r.enterNewFolderName,{input:"input"});S!==null&&g(s.activeFolder,S)},[r.enterNewFolderName,i,g,s.activeFolder]),_=m.useCallback(async()=>{if(s.activeFolder==="root")return;const S=await i(r.enterNewFileName,{input:"input"});S!==null&&u(S)},[r.enterNewFileName,i,u,s.activeFolder]),y=m.useMemo(()=>s.activeFolder==="root",[s.activeFolder]),C=m.useMemo(()=>{var S;return s.activeFolder==="root"?!1:((S=s.foldersMap.get(s.activeFolder))==null?void 0:S.onlyRead)??!1},[s.activeFolder,s.foldersMap]),w=m.useMemo(()=>s.markedFiles.every(S=>{var k;return((k=s.constantFiles.find(O=>O.id===S))==null?void 0:k.archive)===!1}),[s.constantFiles,s.markedFiles]),T=m.useMemo(()=>s.markedFiles.every(S=>{var k;return((k=s.constantFiles.find(O=>O.id===S))==null?void 0:k.archive)===!0}),[s.constantFiles,s.markedFiles]);return v.jsx("div",{className:Q(e,df.wrapper,s.state==="folder-choosing"?"ignore-dim":void 0,"d-flex justify-content-between"),children:s.state!=="folder-choosing"?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:df.divButtons,children:[v.jsx(bte,{entityId:t,entityType:n,disabled:C,children:r.uploadFiles}),v.jsx(Gn,{onClick:()=>{c({type:"open-modal",modalType:"create-folder",chosenFolderId:s.activeFolder??"root"})},disabled:C,children:r.createFolder}),v.jsx(Gn,{disabled:s.activeFolder==="root"||(($=s.foldersMap.get(s.activeFolder))==null?void 0:$.isDefault),onClick:async()=>{var k;await a(`${r.deleteFolder} ${(k=s.foldersMap.get(s.activeFolder))==null?void 0:k.name}?`)&&h(s.activeFolder)},children:r.deleteFolder}),v.jsx(Gn,{disabled:s.activeFolder==="root"||((R=s.foldersMap.get(s.activeFolder))==null?void 0:R.isDefault),onClick:x,children:r.renameFolder})]}),!y&&!C?v.jsxs("div",{className:df.divButtons,children:[v.jsx(Gn,{onClick:()=>{c({type:"open-modal",modalType:"edit-file-properties"})},disabled:!b,children:r.editFileProperties}),v.jsx(Gn,{onClick:async()=>{await a(r.confirmDeleteFile(s.markedFiles.length))&&l(s.markedFiles)},disabled:p,children:r.delete}),T?v.jsx(Gn,{onClick:async()=>{await a(r.confirmDearchiveFile(s.markedFiles.length))&&await f(!0)},disabled:p,children:r.dearchivate}):v.jsx(Gn,{onClick:async()=>{await a(r.confirmArchiveFile(s.markedFiles.length))&&await f()},disabled:p||!w,children:r.archivate}),v.jsx(Gn,{onClick:_,disabled:p,children:r.rename}),v.jsx(Gn,{onClick:d,disabled:p,children:r.downloadZip})]}):null]}):s.state==="folder-choosing"?v.jsx(v.Fragment,{children:v.jsx(Gn,{onClick:()=>c({type:"return-from-folder-choosing"}),className:Q("ignore-dim","body-background-color"),children:r.back})}):void 0})},xte=({file:e})=>{const{confirm:t}=_p(),{reducer:[n],apiActions:{downloadFile:r}}=m.useContext(qt),{texts:{documents:i}}=m.useContext(Pt),a=m.useCallback(async()=>{await t(i.confirmFileDownload(e.name,e.size==null?void 0:xa(e.size*1024*1024)))&&r(e.id)},[t,i,r,e.id,e.name,e.size]);return v.jsxs(Fl,{action:!0,onClick:a,children:[v.jsx(dn,{variant:"body",className:"text-muted",children:NT(e.folderId,n.foldersMap)}),v.jsxs("div",{className:"d-flex justify-content-between gap-2",children:[v.jsx(dn,{variant:"body",children:e.name}),v.jsx(dn,{variant:"body",children:e.size==null?null:xa(e.size*1024*1024)})]})]})},_te="_typeSelect_m3myk_1",wte={typeSelect:_te},Cte=()=>{const{reducer:[e]}=m.useContext(qt),{texts:{documents:t}}=m.useContext(Pt),[n,r]=m.useState(""),[i,a]=m.useState(null),o=m.useMemo(()=>{const c=new Map;return e.filteredFiles.forEach(u=>{c.get(u.documentTypeId)===void 0&&c.set(u.documentTypeId,u.documentTypeName)}),[{id:null,name:t.all},...Array.from(c).map(u=>({id:u[0],name:u[1]}))]},[t.all,e.filteredFiles]),s=m.useMemo(()=>e.filteredFiles.filter(c=>pp(c.name,n)&&(i===null||c.documentTypeId===i)),[n,i,e.filteredFiles]);return v.jsxs("div",{className:"d-flex h-100 flex-column",children:[v.jsxs("div",{className:"d-flex gap-1 mb-1",children:[v.jsx(N2,{options:o,label:t.documentType,value:i,onChange:a,isNumber:!0,size:"sm",className:wte.typeSelect}),v.jsx(I2,{label:t.search,type:"text",value:n,onChange:c=>r(c===null?"":c),className:"flex-grow-1",size:"sm"})]}),v.jsx(B1,{className:"overflow-y-auto",children:s.map(c=>v.jsx(xte,{file:c},c.id))})]})};function Tte(e){return{name:e.name,defaultDocType:e.defaultDocType,childrenIds:[],parentId:e.parentId??null,isDefault:e.isDefault,onlyRead:e.onlyRead}}function kte(e){const t=[],n=new Map,r=new Map;return e.forEach(i=>{n.set(i.id,Tte(i)),i.parentId===null?t.push(i.id):r.set(i.id,i.parentId)}),r.forEach((i,a)=>{const o=n.get(i);if(o===void 0)throw new Error(`Did not get folder with ID ${i}, which is supposed to be parent directory of folder with ID ${a}`);o.childrenIds.push(a)}),{dirsMap:n,rootIds:t}}function gy(e,t){const n=t.toUpperCase();return e.filter(r=>{var a;const i=(a=r.name)==null?void 0:a.toUpperCase();return i==null?void 0:i.includes(n)})}function Ste(e,t){return e.map(n=>{var r;return{...n,folderName:((r=t.get(n.folderId))==null?void 0:r.name)??""}})}const Ote=([e,t],n,r)=>{const{texts:{documents:i}}=m.useContext(Pt),{startLoading:a,stopLoading:o}=m.useContext(Bl),{addNotification:s}=Yl(),c=Gl(),l=m.useCallback(async y=>{a("documentList");try{const w=(await c.get(`/documents/${n}/${r}`)).data,{dirsMap:T,rootIds:$}=kte(w.folders),R=Ste(w.documents,T);t({type:"load-data",files:R,foldersMap:T,rootFolderIds:$,setActiveFolder:y})}finally{o("documentList")}},[c,t,r,n,a,o]);m.useEffect(()=>{l(!0)},[l]);const u=m.useCallback(async()=>{a("documents-types");try{const y=await c.get(`/documents/types/${n}`);if(y.status!==200)throw new Error(`Unexpected status code: ${y.status}`);t({type:"load-document-types",documentTypes:y.data})}finally{o("documents-types")}},[c,t,n,a,o]);m.useEffect(()=>{u()},[u]);const d=m.useCallback(async(y,C)=>{const w=C??e.markedFiles;a("documentsMove");try{await c.put(`/documents/move-to-folder?folderId=${y}`,w),t({type:"update-files",fileIds:w,newProperties:{folderId:y}}),s(i.fileMoveSuccessful(w.length,e.foldersMap.get(y).name),"success")}finally{o("documentsMove")}},[e.markedFiles,e.foldersMap,a,c,t,s,i,o]),f=m.useCallback(async y=>{const C=y??e.markedFiles;a("documentsFilesDelete");try{const w=await c.delete(`/documents/delete?${Af(C,"documentIds")}`);if(w.status!==200)throw new Error(`Unexpected status code: ${w.status}`);t({type:"delete-files",fileIds:C}),s(i.fileDeleteSuccessful(C.length),"success")}finally{o("documentsFilesDelete")}},[e.markedFiles,a,c,t,s,i,o]),h=m.useCallback(async y=>{var C;if(!(y==="root"||(C=e.foldersMap.get(y))!=null&&C.isDefault)){a("documentsFolderDelete");try{const w=await c.delete(`/documents/folder/${y}`);if(w.status!==200)throw new Error(`Unexpected status code: ${w.status}`);t({type:"delete-folder",folderId:y}),s(i.folderDeleteSuccessful(e.foldersMap.get(y).name),"success")}finally{o("documentsFolderDelete")}}},[e.foldersMap,a,c,t,s,i,o]),g=m.useCallback(async y=>{a("documentsRename");try{const C=await c.put("/documents/update-name",{documentIds:e.markedFiles,name:y});if(C.status!==200)throw new Error(`Unexpected status code: ${C.status}`);l()}finally{o("documentsRename")}},[a,c,e.markedFiles,l,o]),p=m.useCallback(async y=>{a("documents-archivate");try{const C=await c.put(`/documents/${y?"dearchive":"archive"}`,e.markedFiles);if(C.status!==200)throw new Error(`Unexpected status code: ${C.status}`);t({type:"update-files",fileIds:e.markedFiles,newProperties:{archive:!y}}),s((y?i.dearchivateSuccessful:i.archivateSuccessful)(e.markedFiles.length),"success")}finally{o("documents-archivate")}},[a,c,e.markedFiles,t,s,i.archivateSuccessful,i.dearchivateSuccessful,o]),b=m.useCallback(async()=>{var C;if(e.activeFolder==="root")return;const y=e.markedFiles.length;s(i.downloadAsZip(y),"info"),a("documents-ZIP_download");try{const w=await c.get(`/documents/download-zip?${Af(e.markedFiles,"documentIds")}`,{responseType:"blob"});Hc(w.data,(((C=e.foldersMap.get(e.activeFolder))==null?void 0:C.name)??"")+"_files")}finally{o("documents-ZIP_download")}},[e.activeFolder,e.markedFiles,e.foldersMap,s,i,a,c,o]),x=m.useCallback(async(y,C)=>{s(i.downloadingFile,"info"),a("documents-downloading_file");try{const w=await c.get(`/documents/${y}?isSmall=true`,{responseType:"blob"}),T=e.constantFiles.find(R=>R.id===y),$=`${(T==null?void 0:T.name)??y.toString()}.${T!=null&&T.fileExtension?T==null?void 0:T.fileExtension.toLowerCase():"unknown"}`;Hc(w.data,$,C)}finally{o("documents-downloading_file")}},[s,i.downloadingFile,a,c,e.constantFiles,o]),_=m.useCallback(async(y,C)=>{a("documents-upload"),s(i.uploadingDocuments,"info");try{await c.postForm("/documents/upload",{files:y,...C}),await l()}finally{o("documents-upload")}},[a,s,i.uploadingDocuments,c,l,o]);return{loadDocuments:l,moveDocuments:d,deleteFiles:f,deleteDirectory:h,renameFiles:g,archivateFiles:p,downloadAsZip:b,downloadFile:x,uploadFiles:_}},Ete=(e,t)=>{var n,r;switch(t.type){case"load-data":{const i={...e,constantFiles:t.files,filteredFiles:gy(t.files,e.searchString),foldersMap:t.foldersMap,rootFolderIds:t.rootFolderIds};if(t.setActiveFolder){const a=t.rootFolderIds.find(o=>t.files.some(s=>s.archive===!1&&s.folderId===o))??"root";i.activeFolder=a}return i}case"load-document-types":return{...e,documentTypes:t.documentTypes};case"select-folder":return{...e,activeFolder:t.folderId,markedFiles:[]};case"mark-file":{const i=e.markedFiles.includes(t.fileId)?[...e.markedFiles.filter(a=>a!==t.fileId)]:[...e.markedFiles,t.fileId];return{...e,state:i.length>0?"selection-file":"explorer",markedFiles:i}}case"mark-files-by-action":{const i=typeof t.setStateAction=="function"?t.setStateAction(e.markedFiles):t.setStateAction;return{...e,state:i.length>0?"selection-file":"explorer",markedFiles:i}}case"mark-all-files":return e.markedFiles.length<e.filteredFiles.filter(i=>i.folderId===e.activeFolder).length?{...e,markedFiles:e.filteredFiles.filter(i=>i.folderId===e.activeFolder).map(i=>i.id),state:"explorer"}:{...e,markedFiles:[],state:"explorer"};case"enter-folder-choosing":return e.state==="folder-choosing"||e.state==="openned-modal"?e:{...e,state:"folder-choosing",canTargetRoot:t.canTargetRoot??!1,previousState:e.state,choosingType:t.choosingType};case"return-from-folder-choosing":return e.state!=="folder-choosing"?e:{...e,state:e.previousState};case"update-files":return{...e,filteredFiles:[...e.filteredFiles.map(i=>t.fileIds.includes(i.id)?{...i,...t.newProperties}:i)],constantFiles:[...e.constantFiles.map(i=>t.fileIds.includes(i.id)?{...i,...t.newProperties}:i)],markedFiles:[],state:"explorer"};case"update-folders":{const i=new Map(e.foldersMap);return t.folderIds.forEach(a=>{i.set(a,{...e.foldersMap.get(a),...t.newProperties})}),{...e,foldersMap:i}}case"delete-files":return{...e,filteredFiles:[...e.filteredFiles.filter(i=>!t.fileIds.includes(i.id))],constantFiles:[...e.constantFiles.filter(i=>!t.fileIds.includes(i.id))],markedFiles:e.markedFiles.filter(i=>!t.fileIds.includes(i)),state:"explorer"};case"open-modal":switch(t.modalType){case"create-folder":return{...e,state:"openned-modal",modalType:t.modalType,chosenFolderId:t.chosenFolderId};default:return{...e,state:"openned-modal",modalType:t.modalType}}case"close-modal":return{...e,state:"explorer"};case"delete-folder":{const i=new Map(e.foldersMap),a=(n=i.get(t.folderId))==null?void 0:n.parentId;let o=[...e.rootFolderIds];if(a){const s=JSON.parse(JSON.stringify(i.get(a)));s.childrenIds=s.childrenIds.filter(c=>c!==t.folderId),i.set(a,s)}else o=o.filter(s=>s!==t.folderId);return i.delete(t.folderId),{...e,rootFolderIds:o,foldersMap:i,activeFolder:"root"}}case"create-folder":{const i=new Map(e.foldersMap);i.set(t.folderId,{name:t.folderData.name,defaultDocType:(r=e.documentTypes.find(o=>o.id===t.folderData.documentTypeId))==null?void 0:r.name,childrenIds:[],parentId:t.folderData.parentFolderId,isDefault:!1,onlyRead:t.isOnlyRead});const a=[...e.rootFolderIds];if(t.folderData.parentFolderId===null)a.push(t.folderId);else{const o=i.get(t.folderData.parentFolderId),s=JSON.parse(JSON.stringify(o));s.childrenIds.push(t.folderId),i.set(t.folderData.parentFolderId,s)}return{...e,state:"explorer",rootFolderIds:a,foldersMap:i}}case"search-files":{const i=gy(e.constantFiles,t.searchString);return{...e,searchString:t.searchString,filteredFiles:i,markedFiles:e.markedFiles.filter(a=>i.map(o=>o.id).includes(a))}}default:throw new Error("Wrong action.type specified.")}},Mte=()=>{const e={state:"explorer",activeFolder:"root",searchString:"",filteredFiles:[],constantFiles:[],foldersMap:new Map,rootFolderIds:[],markedFiles:[],documentTypes:[]},[t,n]=m.useReducer(Ete,e);return[t,n]},$te=m.memo(({entityType:e,entityId:t,className:n,BnfTableComponent:r,tableIdentifier:i,customRootFolderName:a,writePermissions:o=!0,...s})=>{const{isMobile:c}=$s(),{ProjectIconComponent:l,texts:{documents:u}}=m.useContext(Pt),[d,f]=Mte(),[h,g]=m.useState(null),{loadDocuments:p,...b}=Ote([d,f],e,t),x=m.useMemo(()=>({entityId:t,entityType:e,apiActions:b,loadDocuments:p,reducer:[d,f]}),[t,e,b,p,d,f]),{getDropProps:_}=sg();return c?v.jsx(qt.Provider,{value:x,children:v.jsx(Cte,{})}):v.jsx("div",{...s,className:Q(ai.wrapper,n),onDragOver:y=>{y.dataTransfer.dropEffect="none",y.stopPropagation(),y.preventDefault()},onDragEnter:y=>{y.dataTransfer.dropEffect="none",y.stopPropagation(),y.preventDefault()},children:v.jsxs(qt.Provider,{value:x,children:[v.jsx("div",{className:Q(d.state==="folder-choosing"?"dim-others":void 0,ai.explorerWindow),children:v.jsxs("ul",{className:ai.folderList,children:[v.jsx(Lee,{customText:a??e}),d.rootFolderIds.map(y=>v.jsx(FT,{dirId:y,writePermissions:o},y))]})}),v.jsxs("div",{className:Q(ai.explorerWindow,ai.fileList),...o&&Gee(d)?_(d.activeFolder,{onFilesDrop:y=>g(y),ignoreInner:!0}):{},children:[v.jsxs("div",{className:ai.dndText,children:[v.jsx(l,{icon:"file-upload",iconProps:{style:{marginRight:0}}}),v.jsx("span",{children:u.dropToUpload})]}),v.jsx(hte,{tableIdentifier:i,BnfTableComponent:r,writePermissions:o},(d.activeFolder==="root").toString())]}),o?v.jsx(yte,{className:ai.controls,entityType:e,entityId:t}):null,v.jsx(qee,{}),h!==null?v.jsx(cg,{files:h,handleClose:()=>g(null),targetFolderId:d.activeFolder==="root"?void 0:d.activeFolder}):null]})})}),Rte=m.createContext(void 0);exports.AbstractModalHeader=Y1;exports.Alert=Ap;exports.ApprovalState=VE;exports.AuthContext=Tp;exports.AvatarIcon=x2;exports.Backdrop=A2;exports.BaseModal=U1;exports.BootstrapModalManager=z1;exports.Button=qh;exports.Col=Gh;exports.ConfirmContext=dx;exports.ContextButton=Ql;exports.CustomSelectInput=N2;exports.DelegationContext=g2;exports.Documents=$te;exports.Dropdown=Op;exports.DropdownDivider=_2;exports.DropdownItem=la;exports.DropdownToggle=Sp;exports.ENTERED=Ir;exports.ENTERING=mr;exports.EXITED=Pr;exports.EXITING=jc;exports.FaMinus=r8;exports.FaPlus=i8;exports.FaSearch=a8;exports.Fade=zr;exports.FileExtensionIcon=BT;exports.FileUploadContextButton=w5;exports.FloatingLabelInput=eu;exports.Form=sr;exports.FormCheckInput=Nl;exports.FormControl=M1;exports.FormDisabledContext=b2;exports.FormSelect=ip;exports.FromToDatePickerDropdownToggle=u7;exports.HelmetContext=v2;exports.HookFormTextAreaInput=og;exports.HookFormTextInput=$a;exports.HtmlTooltip=wx;exports.IconButton=Rs;exports.Ie=HE;exports.InputAnchorContainer=P2;exports.InvalidFeedback=Jl;exports.ListGroup=B1;exports.ListGroupItem=Fl;exports.LoadingContext=Bl;exports.LoginState=vx;exports.LuminusComponentsContext=Pt;exports.MdArrowRight=jO;exports.MdCheck=PO;exports.MdCircle=AO;exports.MdClear=ks;exports.MdOutlineAddCircleOutline=WO;exports.MdOutlineArrowOutward=IO;exports.MdOutlineCameraAlt=YO;exports.MdOutlineChevronRight=XO;exports.MdOutlineClose=lx;exports.MdOutlineDelete=sx;exports.MdOutlineEdit=GO;exports.MdOutlineExpand=NO;exports.MdOutlineFileUpload=cx;exports.MdOutlineKeyboardArrowLeft=HO;exports.MdOutlineKeyboardArrowRight=VO;exports.MdOutlineKeyboardDoubleArrowLeft=qO;exports.MdOutlineMenu=QO;exports.MdOutlinePhotoLibrary=ZO;exports.MdOutlineStar=eE;exports.MdSave=RO;exports.MdSaveAs=$O;exports.MdSearch=MO;exports.MiniDetailWrapper=D2;exports.Modal=bn;exports.ModalContext=cp;exports.NoInputContainer=j2;exports.Oe=I;exports.PageContainer=kee;exports.PrimaryButton=Mi;exports.PromptContext=fx;exports.Re=pee;exports.ResponsiveContextDropdown=R2;exports.ResponsiveContextDropdownItem=$p;exports.RowLabelInput=As;exports.ShortcutLinksContext=Rte;exports.SideContentBar=$T;exports.SimpleDropdownToggle=kp;exports.SimplePicker=C2;exports.SimpleTooltip=hp;exports.Spinner=dp;exports.TextInput=I2;exports.TransitionWrapper=Fy;exports.Typography=dn;exports.UserAvatarToggle=P5;exports.UserContext=bx;exports._=Hq;exports._extends=Ac;exports._inheritsLoose=$y;exports._objectWithoutPropertiesLoose=Dh;exports.a=w2;exports.addLeadingZeros=dt;exports.addMonths=by;exports.addYears=ky;exports.atobUtf8=Tx;exports.buildEmployeeNameString=cM;exports.buildOrgUnitString=lM;exports.buildVehicleNameString=sM;exports.cancelToken=h$;exports.capitalizeFirstLetter=oM;exports.classNames=Q;exports.classes=y2;exports.compareDate=fM;exports.compareDateTime=hM;exports.constructFrom=zn;exports.context=Il;exports.differenceInCalendarDays=Ty;exports.divWithClassName=Wh;exports.extractErrorsFromResponse=fp;exports.extractFilename=Ex;exports.extractPermissionsFromResponse=_x;exports.fixNameIdNulls=yx;exports.format=Ih;exports.formatDate=iM;exports.formatDateTime=aM;exports.formatFileSize=xa;exports.getDateString=yM;exports.getDaysDifference=pM;exports.getDefaultExportFromCjs=Rt;exports.getFirstDayOfMonth=Sx;exports.getFirstDayOfOffsetMonth=mM;exports.getFirstDayOfYear=vM;exports.getLastDayOfMonth=Ox;exports.getLastDayOfOffsetMonth=gM;exports.getLastDayOfYear=bM;exports.getSharedManager=H1;exports.getTimezoneOffsetInMilliseconds=pf;exports.hasOnlyNullValues=xx;exports.hookFormSetServerErrors=YE;exports.invariant=mf;exports.isISODate=kx;exports.isPrimitive=zc;exports.isValidDate=dM;exports.joinStrings=Bo;exports.jsxRuntimeExports=v;exports.millisecondsInHour=kl;exports.millisecondsInMinute=jh;exports.millisecondsInWeek=Ah;exports.msToStartOfNextDay=uM;exports.openFileFromResponse=_M;exports.parseISO=Ol;exports.pe=fK;exports.replaceNullValuesOnlyObjectsWithNulls=qE;exports.requireReactIs=Fh;exports.saveFile=Hc;exports.saveFileFromResponse=xM;exports.secondsInDay=Ph;exports.secondsInHour=yy;exports.secondsInMinute=ZT;exports.secondsInMonth=_y;exports.secondsInQuarter=XT;exports.secondsInWeek=KT;exports.secondsInYear=xy;exports.shortenText=rM;exports.startOfDay=hf;exports.startOfWeek=pa;exports.stringContains=Mx;exports.stringSearchWithin=pp;exports.stringStartsWith=$x;exports.style=Wr;exports.t=fd;exports.toDate=sn;exports.transitionEndListener=Dy;exports.triggerBrowserReflow=Ny;exports.trimIsoDate=Wl;exports.truncateText=Cx;exports.urlfyArray=Af;exports.useAuth=t2;exports.useAxios=Gl;exports.useBootstrapBreakpoints=Ry;exports.useBootstrapMinBreakpoint=Ay;exports.useBootstrapPrefix=He;exports.useClickOutside=f2;exports.useClipboard=m2;exports.useCol=Yy;exports.useConfirm=_p;exports.useCookies=xp;exports.useEventCallback=Et;exports.useFormControlType=Cp;exports.useFormDisabledContext=Xl;exports.useIsomorphicEffect=Po;exports.useKeyPress=p2;exports.useNotifications=Yl;exports.usePermissions=h2;exports.usePrompt=hx;exports.useSwipeable=Rp;exports.useWindowSize=$s;exports.useZodSchemaTypes=Kl;exports.z=Zt;
279
+ `,fill:i,opacity:o,strokeWidth:c,stroke:l===void 0?"transparent":l,style:{pointerEvents:"none"}})})};function gi(){return gi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gi.apply(this,arguments)}var Eq={top:0,right:0,bottom:0,left:0},Qm=function(e){var t,n=e.direction,r=e.itemsSpacing,i=e.padding,a=e.itemCount,o=e.itemWidth,s=e.itemHeight;if(typeof i!="number"&&(typeof(t=i)!="object"||Array.isArray(t)||t===null))throw new Error("Invalid property padding, must be one of: number, object");var c=typeof i=="number"?{top:i,right:i,bottom:i,left:i}:gi({},Eq,i),l=c.left+c.right,u=c.top+c.bottom,d=o+l,f=s+u,h=(a-1)*r;return n==="row"?d=o*a+h+l:n==="column"&&(f=s*a+h+u),{width:d,height:f,padding:c}},qC=function(e){var t=e.anchor,n=e.translateX,r=e.translateY,i=e.containerWidth,a=e.containerHeight,o=e.width,s=e.height,c=n,l=r;switch(t){case"top":c+=(i-o)/2;break;case"top-right":c+=i-o;break;case"right":c+=i-o,l+=(a-s)/2;break;case"bottom-right":c+=i-o,l+=a-s;break;case"bottom":c+=(i-o)/2,l+=a-s;break;case"bottom-left":l+=a-s;break;case"left":l+=(a-s)/2;break;case"center":c+=(i-o)/2,l+=(a-s)/2}return{x:c,y:l}},YC=function(e){var t,n,r,i,a,o,s=e.direction,c=e.justify,l=e.symbolSize,u=e.symbolSpacing,d=e.width,f=e.height;switch(s){case"left-to-right":t=0,n=(f-l)/2,i=f/2,o="central",c?(r=d,a="end"):(r=l+u,a="start");break;case"right-to-left":t=d-l,n=(f-l)/2,i=f/2,o="central",c?(r=0,a="start"):(r=d-l-u,a="end");break;case"top-to-bottom":t=(d-l)/2,n=0,r=d/2,a="middle",c?(i=f,o="alphabetic"):(i=l+u,o="text-before-edge");break;case"bottom-to-top":t=(d-l)/2,n=f-l,r=d/2,a="middle",c?(i=0,o="text-before-edge"):(i=f-l-u,o="alphabetic")}return{symbolX:t,symbolY:n,labelX:r,labelY:i,labelAnchor:a,labelAlignment:o}},Mq={circle:Tq,diamond:kq,square:Sq,triangle:Oq},$q=function(e){var t,n,r,i,a,o,s,c,l,u,d,f=e.x,h=e.y,g=e.width,p=e.height,b=e.data,x=e.direction,_=x===void 0?"left-to-right":x,y=e.justify,C=y!==void 0&&y,w=e.textColor,T=e.background,$=T===void 0?"transparent":T,R=e.opacity,S=R===void 0?1:R,k=e.symbolShape,O=k===void 0?"square":k,D=e.symbolSize,E=D===void 0?16:D,M=e.symbolSpacing,j=M===void 0?8:M,F=e.symbolBorderWidth,W=F===void 0?0:F,B=e.symbolBorderColor,U=B===void 0?"transparent":B,N=e.onClick,V=e.onMouseEnter,X=e.onMouseLeave,ne=e.toggleSerie,K=e.effects,J=m.useState({}),q=J[0],G=J[1],z=ht(),L=m.useCallback(function(Be){if(K){var Ke=K.filter(function(Ye){return Ye.on==="hover"}).reduce(function(Ye,de){return gi({},Ye,de.style)},{});G(Ke)}V==null||V(b,Be)},[V,b,K]),H=m.useCallback(function(Be){if(K){var Ke=K.filter(function(Ye){return Ye.on!=="hover"}).reduce(function(Ye,de){return gi({},Ye,de.style)},{});G(Ke)}X==null||X(b,Be)},[X,b,K]),ee=YC({direction:_,justify:C,symbolSize:(t=q.symbolSize)!=null?t:E,symbolSpacing:j,width:g,height:p}),A=ee.symbolX,se=ee.symbolY,ce=ee.labelX,ue=ee.labelY,we=ee.labelAnchor,Te=ee.labelAlignment,at=[N,V,X,ne].some(function(Be){return Be!==void 0}),tt=typeof O=="function"?O:Mq[O];return v.jsxs("g",{transform:"translate("+f+","+h+")",style:{opacity:(n=q.itemOpacity)!=null?n:S},children:[v.jsx("rect",{width:g,height:p,fill:(r=q.itemBackground)!=null?r:$,style:{cursor:at?"pointer":"auto"},onClick:function(Be){N==null||N(b,Be),ne==null||ne(b.id)},onMouseEnter:L,onMouseLeave:H}),ie.createElement(tt,gi({id:b.id,x:A,y:se,size:(i=q.symbolSize)!=null?i:E,fill:(a=(o=b.fill)!=null?o:b.color)!=null?a:"black",borderWidth:(s=q.symbolBorderWidth)!=null?s:W,borderColor:(c=q.symbolBorderColor)!=null?c:U},b.hidden?z.legends.hidden.symbol:void 0)),v.jsx("text",{textAnchor:we,style:gi({},Zm(z.legends.text),{fill:(l=(u=(d=q.itemTextColor)!=null?d:w)!=null?u:z.legends.text.fill)!=null?l:"black",dominantBaseline:Te,pointerEvents:"none",userSelect:"none"},b.hidden?z.legends.hidden.text:void 0),x:ce,y:ue,children:b.label})]})},Rq=function(e){var t=e.data,n=e.x,r=e.y,i=e.direction,a=e.padding,o=a===void 0?0:a,s=e.justify,c=e.effects,l=e.itemWidth,u=e.itemHeight,d=e.itemDirection,f=d===void 0?"left-to-right":d,h=e.itemsSpacing,g=h===void 0?0:h,p=e.itemTextColor,b=e.itemBackground,x=b===void 0?"transparent":b,_=e.itemOpacity,y=_===void 0?1:_,C=e.symbolShape,w=e.symbolSize,T=e.symbolSpacing,$=e.symbolBorderWidth,R=e.symbolBorderColor,S=e.onClick,k=e.onMouseEnter,O=e.onMouseLeave,D=e.toggleSerie,E=Qm({itemCount:t.length,itemWidth:l,itemHeight:u,itemsSpacing:g,direction:i,padding:o}).padding,M=i==="row"?l+g:0,j=i==="column"?u+g:0;return v.jsx("g",{transform:"translate("+n+","+r+")",children:t.map(function(F,W){return v.jsx($q,{data:F,x:W*M+E.left,y:W*j+E.top,width:l,height:u,direction:f,justify:s,effects:c,textColor:p,background:x,opacity:y,symbolShape:C,symbolSize:w,symbolSpacing:T,symbolBorderWidth:$,symbolBorderColor:R,onClick:S,onMouseEnter:k,onMouseLeave:O,toggleSerie:D},W)})})},Jm=function(e){var t=e.data,n=e.containerWidth,r=e.containerHeight,i=e.translateX,a=i===void 0?0:i,o=e.translateY,s=o===void 0?0:o,c=e.anchor,l=e.direction,u=e.padding,d=u===void 0?0:u,f=e.justify,h=e.itemsSpacing,g=h===void 0?0:h,p=e.itemWidth,b=e.itemHeight,x=e.itemDirection,_=e.itemTextColor,y=e.itemBackground,C=e.itemOpacity,w=e.symbolShape,T=e.symbolSize,$=e.symbolSpacing,R=e.symbolBorderWidth,S=e.symbolBorderColor,k=e.onClick,O=e.onMouseEnter,D=e.onMouseLeave,E=e.toggleSerie,M=e.effects,j=Qm({itemCount:t.length,itemsSpacing:g,itemWidth:p,itemHeight:b,direction:l,padding:d}),F=j.width,W=j.height,B=qC({anchor:c,translateX:a,translateY:s,containerWidth:n,containerHeight:r,width:F,height:W}),U=B.x,N=B.y;return v.jsx(Rq,{data:t,x:U,y:N,direction:l,padding:d,justify:f,effects:M,itemsSpacing:g,itemWidth:p,itemHeight:b,itemDirection:x,itemTextColor:_,itemBackground:y,itemOpacity:C,symbolShape:w,symbolSize:T,symbolSpacing:$,symbolBorderWidth:R,symbolBorderColor:S,onClick:k,onMouseEnter:O,onMouseLeave:D,toggleSerie:typeof E=="boolean"?void 0:E})},Aq={start:"left",middle:"center",end:"right"},GC=function(e,t){var n=t.data,r=t.containerWidth,i=t.containerHeight,a=t.translateX,o=a===void 0?0:a,s=t.translateY,c=s===void 0?0:s,l=t.anchor,u=t.direction,d=t.padding,f=d===void 0?0:d,h=t.justify,g=h!==void 0&&h,p=t.itemsSpacing,b=p===void 0?0:p,x=t.itemWidth,_=t.itemHeight,y=t.itemDirection,C=y===void 0?"left-to-right":y,w=t.itemTextColor,T=t.symbolSize,$=T===void 0?16:T,R=t.symbolSpacing,S=R===void 0?8:R,k=t.theme,O=Qm({itemCount:n.length,itemWidth:x,itemHeight:_,itemsSpacing:b,direction:u,padding:f}),D=O.width,E=O.height,M=O.padding,j=qC({anchor:l,translateX:o,translateY:c,containerWidth:r,containerHeight:i,width:D,height:E}),F=j.x,W=j.y,B=u==="row"?x+b:0,U=u==="column"?_+b:0;e.save(),e.translate(F,W),e.font=k.legends.text.fontSize+"px "+(k.legends.text.fontFamily||"sans-serif"),n.forEach(function(N,V){var X,ne,K=V*B+M.left,J=V*U+M.top,q=YC({direction:C,justify:g,symbolSize:$,symbolSpacing:S,width:x,height:_}),G=q.symbolX,z=q.symbolY,L=q.labelX,H=q.labelY,ee=q.labelAnchor,A=q.labelAlignment;e.fillStyle=(X=N.color)!=null?X:"black",e.fillRect(K+G,J+z,$,$),e.textAlign=Aq[ee],A==="central"&&(e.textBaseline="middle"),e.fillStyle=(ne=w??k.legends.text.fill)!=null?ne:"black",e.fillText(String(N.label),K+L,J+H)}),e.restore()};function Jr(){return Jr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jr.apply(this,arguments)}function ZC(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Lb,jq=function(e){var t=e.width,n=e.height,r=e.legends,i=e.data,a=e.toggleSerie;return v.jsx(v.Fragment,{children:r.map(function(o,s){var c;return v.jsx(Jm,Jr({},o,{containerWidth:t,containerHeight:n,data:(c=o.data)!=null?c:i,toggleSerie:o.toggleSerie?a:void 0}),s)})})},Se={id:"id",value:"value",sortByValue:!1,innerRadius:0,padAngle:0,cornerRadius:0,layers:["arcs","arcLinkLabels","arcLabels","legends"],startAngle:0,endAngle:360,fit:!0,activeInnerRadiusOffset:0,activeOuterRadiusOffset:0,borderWidth:0,borderColor:{from:"color",modifiers:[["darker",1]]},enableArcLabels:!0,arcLabel:"formattedValue",arcLabelsSkipAngle:0,arcLabelsRadiusOffset:.5,arcLabelsTextColor:{theme:"labels.text.fill"},enableArcLinkLabels:!0,arcLinkLabel:"id",arcLinkLabelsSkipAngle:0,arcLinkLabelsOffset:0,arcLinkLabelsDiagonalLength:16,arcLinkLabelsStraightLength:24,arcLinkLabelsThickness:1,arcLinkLabelsTextOffset:6,arcLinkLabelsTextColor:{theme:"labels.text.fill"},arcLinkLabelsColor:{theme:"axis.ticks.line.stroke"},colors:{scheme:"nivo"},defs:[],fill:[],isInteractive:!0,animate:!0,motionConfig:"gentle",transitionMode:"innerRadius",tooltip:function(e){var t=e.datum;return v.jsx(Zp,{id:t.id,value:t.formattedValue,enableChip:!0,color:t.color})},legends:[],role:"img",pixelRatio:typeof window<"u"&&(Lb=window.devicePixelRatio)!=null?Lb:1},Pq=["points"],Iq=function(e){var t=e.data,n=e.id,r=n===void 0?Se.id:n,i=e.value,a=i===void 0?Se.value:i,o=e.valueFormat,s=e.colors,c=s===void 0?Se.colors:s,l=Ti(r),u=Ti(a),d=Ma(o),f=Xm(c,"id");return m.useMemo(function(){return t.map(function(h){var g,p=l(h),b=u(h),x={id:p,label:(g=h.label)!=null?g:p,hidden:!1,value:b,formattedValue:d(b),data:h};return Jr({},x,{color:f(x)})})},[t,l,u,d,f])},Dq=function(e){var t=e.data,n=e.startAngle,r=e.endAngle,i=e.innerRadius,a=e.outerRadius,o=e.padAngle,s=e.sortByValue,c=e.activeId,l=e.activeInnerRadiusOffset,u=e.activeOuterRadiusOffset,d=e.hiddenIds,f=e.forwardLegendData,h=m.useMemo(function(){var x=xU().value(function(_){return _.value}).startAngle(An(n)).endAngle(An(r)).padAngle(An(o));return s||x.sortValues(null),x},[n,r,o,s]),g=m.useMemo(function(){var x=t.filter(function(_){return!d.includes(_.id)});return{dataWithArc:h(x).map(function(_){var y=Math.abs(_.endAngle-_.startAngle);return Jr({},_.data,{arc:{index:_.index,startAngle:_.startAngle,endAngle:_.endAngle,innerRadius:c===_.data.id?i-l:i,outerRadius:c===_.data.id?a+u:a,thickness:a-i,padAngle:_.padAngle,angle:y,angleDeg:cd(y)}})}),legendData:t.map(function(_){return{id:_.id,label:_.label,color:_.color,hidden:d.includes(_.id),data:_}})}},[h,t,d,c,i,l,a,u]),p=g.legendData,b=m.useRef(f);return m.useEffect(function(){typeof b.current=="function"&&b.current(p)},[b,p]),g},Nq=function(e){var t=e.activeId,n=e.onActiveIdChange,r=e.defaultActiveId,i=t!==void 0,a=m.useState(i||r===void 0?null:r),o=a[0],s=a[1];return{activeId:i?t:o,setActiveId:m.useCallback(function(c){n&&n(c),i||s(c)},[i,n,s])}},Fq=function(e){var t=e.data,n=e.width,r=e.height,i=e.innerRadius,a=i===void 0?Se.innerRadius:i,o=e.startAngle,s=o===void 0?Se.startAngle:o,c=e.endAngle,l=c===void 0?Se.endAngle:c,u=e.padAngle,d=u===void 0?Se.padAngle:u,f=e.sortByValue,h=f===void 0?Se.sortByValue:f,g=e.cornerRadius,p=g===void 0?Se.cornerRadius:g,b=e.fit,x=b===void 0?Se.fit:b,_=e.activeInnerRadiusOffset,y=_===void 0?Se.activeInnerRadiusOffset:_,C=e.activeOuterRadiusOffset,w=C===void 0?Se.activeOuterRadiusOffset:C,T=e.activeId,$=e.onActiveIdChange,R=e.defaultActiveId,S=e.forwardLegendData,k=Nq({activeId:T,onActiveIdChange:$,defaultActiveId:R}),O=k.activeId,D=k.setActiveId,E=m.useState([]),M=E[0],j=E[1],F=m.useMemo(function(){var U,N=Math.min(n,r)/2,V=N*Math.min(a,1),X=n/2,ne=r/2;if(x){var K=wq(X,ne,N,s-90,l-90),J=K.points,q=ZC(K,Pq),G=Math.min(n/q.width,r/q.height),z={width:q.width*G,height:q.height*G};z.x=(n-z.width)/2,z.y=(r-z.height)/2,X=(X-q.x)/q.width*q.width*G+z.x,ne=(ne-q.y)/q.height*q.height*G+z.y,U={box:q,ratio:G,points:J},N*=G,V*=G}return{centerX:X,centerY:ne,radius:N,innerRadius:V,debug:U}},[n,r,a,s,l,x]),W=Dq({data:t,startAngle:s,endAngle:l,innerRadius:F.innerRadius,outerRadius:F.radius,padAngle:d,sortByValue:h,activeId:O,activeInnerRadiusOffset:y,activeOuterRadiusOffset:w,hiddenIds:M,forwardLegendData:S}),B=m.useCallback(function(U){j(function(N){return N.indexOf(U)>-1?N.filter(function(V){return V!==U}):[].concat(N,[U])})},[]);return Jr({arcGenerator:Cq({cornerRadius:p,padAngle:An(d)}),activeId:O,setActiveId:D,toggleSerie:B},W,F)},Lq=function(e){var t=e.dataWithArc,n=e.arcGenerator,r=e.centerX,i=e.centerY,a=e.radius,o=e.innerRadius;return m.useMemo(function(){return{dataWithArc:t,arcGenerator:n,centerX:r,centerY:i,radius:a,innerRadius:o}},[t,n,r,i,a,o])},Bq=function(e){var t=e.center,n=e.data,r=e.arcGenerator,i=e.borderWidth,a=e.borderColor,o=e.isInteractive,s=e.onClick,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.setActiveId,f=e.tooltip,h=e.transitionMode,g=Li(),p=g.showTooltipFromEvent,b=g.hideTooltip,x=m.useMemo(function(){if(o)return function(w,T){s==null||s(w,T)}},[o,s]),_=m.useMemo(function(){if(o)return function(w,T){p(m.createElement(f,{datum:w}),T),d(w.id),c==null||c(w,T)}},[o,p,d,c,f]),y=m.useMemo(function(){if(o)return function(w,T){p(m.createElement(f,{datum:w}),T),l==null||l(w,T)}},[o,p,l,f]),C=m.useMemo(function(){if(o)return function(w,T){b(),d(null),u==null||u(w,T)}},[o,b,d,u]);return v.jsx(_q,{center:t,data:n,arcGenerator:r,borderWidth:i,borderColor:a,transitionMode:h,onClick:x,onMouseEnter:_,onMouseMove:y,onMouseLeave:C})},Wq=["isInteractive","animate","motionConfig","theme","renderWrapper"],Uq=function(e){var t=e.data,n=e.id,r=n===void 0?Se.id:n,i=e.value,a=i===void 0?Se.value:i,o=e.valueFormat,s=e.sortByValue,c=s===void 0?Se.sortByValue:s,l=e.layers,u=l===void 0?Se.layers:l,d=e.startAngle,f=d===void 0?Se.startAngle:d,h=e.endAngle,g=h===void 0?Se.endAngle:h,p=e.padAngle,b=p===void 0?Se.padAngle:p,x=e.fit,_=x===void 0?Se.fit:x,y=e.innerRadius,C=y===void 0?Se.innerRadius:y,w=e.cornerRadius,T=w===void 0?Se.cornerRadius:w,$=e.activeInnerRadiusOffset,R=$===void 0?Se.activeInnerRadiusOffset:$,S=e.activeOuterRadiusOffset,k=S===void 0?Se.activeOuterRadiusOffset:S,O=e.width,D=e.height,E=e.margin,M=e.colors,j=M===void 0?Se.colors:M,F=e.borderWidth,W=F===void 0?Se.borderWidth:F,B=e.borderColor,U=B===void 0?Se.borderColor:B,N=e.enableArcLabels,V=N===void 0?Se.enableArcLabels:N,X=e.arcLabel,ne=X===void 0?Se.arcLabel:X,K=e.arcLabelsSkipAngle,J=K===void 0?Se.arcLabelsSkipAngle:K,q=e.arcLabelsTextColor,G=q===void 0?Se.arcLabelsTextColor:q,z=e.arcLabelsRadiusOffset,L=z===void 0?Se.arcLabelsRadiusOffset:z,H=e.arcLabelsComponent,ee=e.enableArcLinkLabels,A=ee===void 0?Se.enableArcLinkLabels:ee,se=e.arcLinkLabel,ce=se===void 0?Se.arcLinkLabel:se,ue=e.arcLinkLabelsSkipAngle,we=ue===void 0?Se.arcLinkLabelsSkipAngle:ue,Te=e.arcLinkLabelsOffset,at=Te===void 0?Se.arcLinkLabelsOffset:Te,tt=e.arcLinkLabelsDiagonalLength,Be=tt===void 0?Se.arcLinkLabelsDiagonalLength:tt,Ke=e.arcLinkLabelsStraightLength,Ye=Ke===void 0?Se.arcLinkLabelsStraightLength:Ke,de=e.arcLinkLabelsThickness,ke=de===void 0?Se.arcLinkLabelsThickness:de,Oe=e.arcLinkLabelsTextOffset,ve=Oe===void 0?Se.arcLinkLabelsTextOffset:Oe,Ie=e.arcLinkLabelsTextColor,Xe=Ie===void 0?Se.arcLinkLabelsTextColor:Ie,It=e.arcLinkLabelsColor,mt=It===void 0?Se.arcLinkLabelsColor:It,Je=e.arcLinkLabelComponent,bt=e.defs,At=bt===void 0?Se.defs:bt,it=e.fill,gt=it===void 0?Se.fill:it,yt=e.isInteractive,Lt=yt===void 0?Se.isInteractive:yt,$e=e.onClick,Pe=e.onMouseEnter,ze=e.onMouseMove,nt=e.onMouseLeave,vt=e.tooltip,kt=vt===void 0?Se.tooltip:vt,Xt=e.activeId,Dt=e.onActiveIdChange,Bt=e.defaultActiveId,Ht=e.transitionMode,Mt=Ht===void 0?Se.transitionMode:Ht,Wt=e.legends,Jt=Wt===void 0?Se.legends:Wt,Vt=e.forwardLegendData,fe=e.role,ye=fe===void 0?Se.role:fe,Ee=Us(O,D,E),qe=Ee.outerWidth,Ge=Ee.outerHeight,ot=Ee.margin,P=Ee.innerWidth,re=Ee.innerHeight,Z=Iq({data:t,id:r,value:a,valueFormat:o,colors:j}),te=Fq({data:Z,width:P,height:re,fit:_,innerRadius:C,startAngle:f,endAngle:g,padAngle:b,sortByValue:c,cornerRadius:T,activeInnerRadiusOffset:R,activeOuterRadiusOffset:k,activeId:Xt,onActiveIdChange:Dt,defaultActiveId:Bt,forwardLegendData:Vt}),ge=te.dataWithArc,Ce=te.legendData,pe=te.arcGenerator,be=te.centerX,Ae=te.centerY,Me=te.radius,et=te.innerRadius,Nt=te.setActiveId,wt=te.toggleSerie,Ut=Km(At,ge,gt),le={arcs:null,arcLinkLabels:null,arcLabels:null,legends:null};u.includes("arcs")&&(le.arcs=v.jsx(Bq,{center:[be,Ae],data:ge,arcGenerator:pe,borderWidth:W,borderColor:U,isInteractive:Lt,onClick:$e,onMouseEnter:Pe,onMouseMove:ze,onMouseLeave:nt,setActiveId:Nt,tooltip:kt,transitionMode:Mt},"arcs")),A&&u.includes("arcLinkLabels")&&(le.arcLinkLabels=v.jsx(vq,{center:[be,Ae],data:ge,label:ce,skipAngle:we,offset:at,diagonalLength:Be,straightLength:Ye,strokeWidth:ke,textOffset:ve,textColor:Xe,linkColor:mt,component:Je},"arcLinkLabels")),V&&u.includes("arcLabels")&&(le.arcLabels=v.jsx(lq,{center:[be,Ae],data:ge,label:ne,radiusOffset:L,skipAngle:J,textColor:G,transitionMode:Mt,component:H},"arcLabels")),Jt.length>0&&u.includes("legends")&&(le.legends=v.jsx(jq,{width:P,height:re,data:Ce,legends:Jt,toggleSerie:wt},"legends"));var cn=Lq({dataWithArc:ge,arcGenerator:pe,centerX:be,centerY:Ae,radius:Me,innerRadius:et});return v.jsx(ld,{width:qe,height:Ge,margin:ot,defs:Ut,role:ye,children:u.map(function(Ft,dr){return le[Ft]!==void 0?le[Ft]:typeof Ft=="function"?v.jsx(m.Fragment,{children:m.createElement(Ft,cn)},dr):null})})},zq=function(e){var t=e.isInteractive,n=t===void 0?Se.isInteractive:t,r=e.animate,i=r===void 0?Se.animate:r,a=e.motionConfig,o=a===void 0?Se.motionConfig:a,s=e.theme,c=e.renderWrapper,l=ZC(e,Wq);return v.jsx(zs,{animate:i,isInteractive:n,motionConfig:o,renderWrapper:c,theme:s,children:v.jsx(Uq,Jr({isInteractive:n},l))})},Hq=function(e){return v.jsx(Ka,{children:function(t){var n=t.width,r=t.height;return v.jsx(zq,Jr({width:n,height:r},e))}})};function Vq(){}var qq=Vq,of=vC,Yq=qq,Gq=Hm,Zq=1/0,Kq=of&&1/Gq(new of([,-0]))[1]==Zq?function(e){return new of(e)}:Yq,Xq=Kq,Qq=Pm,Jq=Vw,eY=qw,tY=Im,nY=Xq,rY=Hm,iY=200;function aY(e,t,n){var r=-1,i=Jq,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=eY;else if(a>=iY){var l=t?null:nY(e);if(l)return rY(l);o=!1,i=tY,c=new Qq}else c=t?[]:s;e:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue e;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}var KC=aY,oY=KC;function sY(e){return e&&e.length?oY(e):[]}var cY=sY;const Bb=Rt(cY);var lY=pu,uY=qm,dY=1,fY=2;function hY(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new lY;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?uY(u,l,dY|fY,r,d):f))return!1}}return!0}var pY=hY,mY=ur;function gY(e){return e===e&&!mY(e)}var XC=gY,vY=XC,bY=Ws;function yY(e){for(var t=bY(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,vY(i)]}return t}var xY=yY;function _Y(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var QC=_Y,wY=pY,CY=xY,TY=QC;function kY(e){var t=CY(e);return t.length==1&&t[0][2]?TY(t[0][0],t[0][1]):function(n){return n===e||wY(n,e,t)}}var SY=kY,OY=qm,EY=Y_,MY=cC,$Y=lm,RY=XC,AY=QC,jY=Ya,PY=1,IY=2;function DY(e,t){return $Y(e)&&RY(t)?AY(jY(e),t):function(n){var r=EY(n,e);return r===void 0&&r===t?MY(n,e):OY(t,r,PY|IY)}}var NY=DY;function FY(e){return function(t){return t==null?void 0:t[e]}}var LY=FY,BY=Ls;function WY(e){return function(t){return BY(t,e)}}var UY=WY,zY=LY,HY=UY,VY=lm,qY=Ya;function YY(e){return VY(e)?zY(qY(e)):HY(e)}var GY=YY,ZY=SY,KY=NY,XY=yu,QY=Cn,JY=GY;function eG(e){return typeof e=="function"?e:e==null?XY:typeof e=="object"?QY(e)?KY(e[0],e[1]):ZY(e):JY(e)}var eg=eG,tG=eg,nG=KC;function rG(e,t){return e&&e.length?nG(e,tG(t)):[]}var iG=rG;const Oh=Rt(iG);var aG=E_,oG=Ws;function sG(e,t){return e&&aG(e,t,oG)}var cG=sG,lG=za;function uG(e,t){return function(n,r){if(n==null)return n;if(!lG(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var dG=uG,fG=cG,hG=dG,pG=hG(fG),JC=pG,mG=JC,gG=za;function vG(e,t){var n=-1,r=gG(e)?Array(e.length):[];return mG(e,function(i,a,o){r[++n]=t(i,a,o)}),r}var bG=vG;function yG(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var xG=yG,Wb=xu;function _G(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=Wb(e),o=t!==void 0,s=t===null,c=t===t,l=Wb(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}var wG=_G,CG=wG;function TG(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=CG(i[r],a[r]);if(c){if(r>=s)return c;var l=n[r];return c*(l=="desc"?-1:1)}}return e.index-t.index}var kG=TG,sf=_u,SG=Ls,OG=eg,EG=bG,MG=xG,$G=Ha,RG=kG,AG=yu,jG=Cn;function PG(e,t,n){t.length?t=sf(t,function(a){return jG(a)?function(o){return SG(o,a.length===1?a[0]:a)}:a}):t=[AG];var r=-1;t=sf(t,$G(OG));var i=EG(e,function(a,o,s){var c=sf(t,function(l){return l(a)});return{criteria:c,index:++r,value:a}});return MG(i,function(a,o){return RG(a,o,n)})}var IG=PG,DG=uC,NG=IG,FG=cm,Ub=z_,LG=FG(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Ub(e,t[0],t[1])?t=[]:n>2&&Ub(t[0],t[1],t[2])&&(t=[t[0]]),NG(e,DG(t,1),[])}),BG=LG;const WG=Rt(BG);var UG=Or,zG=Nn,HG="[object Date]";function VG(e){return zG(e)&&UG(e)==HG}var qG=VG,YG=qG,GG=Ha,zb=vu,Hb=zb&&zb.isDate,ZG=Hb?GG(Hb):YG,KG=ZG;const XG=Rt(KG);function ui(){return ui=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ui.apply(this,arguments)}var Ji=[function(e){return e.setMilliseconds(0)},function(e){return e.setSeconds(0)},function(e){return e.setMinutes(0)},function(e){return e.setHours(0)},function(e){return e.setDate(1)},function(e){return e.setMonth(0)}],QG={millisecond:[],second:Ji.slice(0,1),minute:Ji.slice(0,2),hour:Ji.slice(0,3),day:Ji.slice(0,4),month:Ji.slice(0,5),year:Ji.slice(0,6)},JG=function(e){return function(t){return QG[e].forEach(function(n){n(t)}),t}},eT=function(e){var t=e.format,n=t===void 0?"native":t,r=e.precision,i=r===void 0?"millisecond":r,a=e.useUTC,o=a===void 0||a,s=JG(i);return function(c){if(c===void 0)return c;if(n==="native"||c instanceof Date)return s(c);var l=o?Dw(n):Pw(n);return s(l(c))}},eZ=function(e,t,n,r){var i,a,o,s,c=e.min,l=c===void 0?0:c,u=e.max,d=u===void 0?"auto":u,f=e.stacked,h=f!==void 0&&f,g=e.reverse,p=g!==void 0&&g,b=e.clamp,x=b!==void 0&&b,_=e.nice,y=_!==void 0&&_;l==="auto"?i=h===!0?(a=t.minStacked)!=null?a:0:t.min:i=l,d==="auto"?o=h===!0?(s=t.maxStacked)!=null?s:0:t.max:o=d;var C=sw().rangeRound(r==="x"?[0,n]:[n,0]).domain(p?[o,i]:[i,o]).clamp(x);return y===!0?C.nice():typeof y=="number"&&C.nice(y),tZ(C,h)},tZ=function(e,t){t===void 0&&(t=!1);var n=e;return n.type="linear",n.stacked=t,n},nZ=function(e,t,n){var r=zF().range([0,n]).domain(t.all);return r.type="point",r},rZ=function(e,t,n,r){var i=e.round,a=i===void 0||i,o=vm().range(r==="x"?[0,n]:[n,0]).domain(t.all).round(a);return iZ(o)},iZ=function(e){var t=e;return t.type="band",t},aZ=function(e,t,n){var r,i,a=e.format,o=a===void 0?"native":a,s=e.precision,c=s===void 0?"millisecond":s,l=e.min,u=l===void 0?"auto":l,d=e.max,f=d===void 0?"auto":d,h=e.useUTC,g=h===void 0||h,p=e.nice,b=p!==void 0&&p,x=eT({format:o,precision:c,useUTC:g});r=u==="auto"?x(t.min):o!=="native"?x(u):u,i=f==="auto"?x(t.max):o!=="native"?x(f):f;var _=g?PB():jB();_.range([0,n]),r&&i&&_.domain([r,i]),b===!0?_.nice():typeof b!="object"&&typeof b!="number"||_.nice(b);var y=_;return y.type="time",y.useUTC=g,y},oZ=function(e,t,n,r){var i,a=e.base,o=a===void 0?10:a,s=e.min,c=s===void 0?"auto":s,l=e.max,u=l===void 0?"auto":l;if(t.all.some(function(p){return p===0}))throw new Error("a log scale domain must not include or cross zero");var d,f,h=!1;if(t.all.filter(function(p){return p!=null}).forEach(function(p){h||(i===void 0?i=Math.sign(p):Math.sign(p)!==i&&(h=!0))}),h)throw new Error("a log scale domain must be strictly-positive or strictly-negative");d=c==="auto"?t.min:c,f=u==="auto"?t.max:u;var g=lw().domain([d,f]).rangeRound(r==="x"?[0,n]:[n,0]).base(o).nice();return g.type="log",g},sZ=function(e,t,n,r){var i,a,o=e.constant,s=o===void 0?1:o,c=e.min,l=c===void 0?"auto":c,u=e.max,d=u===void 0?"auto":u,f=e.reverse,h=f!==void 0&&f;i=l==="auto"?t.min:l,a=d==="auto"?t.max:d;var g=uw().constant(s).rangeRound(r==="x"?[0,n]:[n,0]).nice();h===!0?g.domain([a,i]):g.domain([i,a]);var p=g;return p.type="symlog",p},cZ=function(e){return e==="x"?"y":"x"},lZ=function(e,t){return e===t},uZ=function(e,t){return e.getTime()===t.getTime()};function ys(e,t,n,r){switch(e.type){case"linear":return eZ(e,t,n,r);case"point":return nZ(e,t,n);case"band":return rZ(e,t,n,r);case"time":return aZ(e,t,n);case"log":return oZ(e,t,n,r);case"symlog":return sZ(e,t,n,r);default:throw new Error("invalid scale spec")}}var Vb=function(e,t,n){var r;if("stacked"in n&&n.stacked){var i=e.data[t==="x"?"xStacked":"yStacked"];return i==null?null:n(i)}return(r=n(e.data[t]))!=null?r:null},dZ=function(e,t,n,r,i){var a=e.map(function(u){return function(d){return ui({},d,{data:d.data.map(function(f){return{data:ui({},f)}})})}(u)}),o=fZ(a,t,n);"stacked"in t&&t.stacked===!0&&hZ(o,a),"stacked"in n&&n.stacked===!0&&pZ(o,a);var s=ys(t,o.x,r,"x"),c=ys(n,o.y,i,"y"),l=a.map(function(u){return ui({},u,{data:u.data.map(function(d){return ui({},d,{position:{x:Vb(d,"x",s),y:Vb(d,"y",c)}})})})});return ui({},o,{series:l,xScale:s,yScale:c})},fZ=function(e,t,n){return{x:qb(e,"x",t),y:qb(e,"y",n)}},qb=function(e,t,n,r){var i={},a=i.getValue,o=a===void 0?function(g){return g.data[t]}:a,s=i.setValue,c=s===void 0?function(g,p){g.data[t]=p}:s;if(n.type==="linear")e.forEach(function(g){g.data.forEach(function(p){var b=o(p);b&&c(p,parseFloat(String(b)))})});else if(n.type==="time"&&n.format!=="native"){var l=eT(n);e.forEach(function(g){g.data.forEach(function(p){var b=o(p);b&&c(p,l(b))})})}var u=[];switch(e.forEach(function(g){g.data.forEach(function(p){u.push(o(p))})}),n.type){case"linear":var d=WG(Bb(u).filter(function(g){return g!==null}),function(g){return g});return{all:d,min:Math.min.apply(Math,d),max:Math.max.apply(Math,d)};case"time":var f=Oh(u,function(g){return g.getTime()}).slice(0).sort(function(g,p){return p.getTime()-g.getTime()}).reverse();return{all:f,min:f[0],max:xe(f)};default:var h=Bb(u);return{all:h,min:h[0],max:xe(h)}}},tT=function(e,t,n){var r=cZ(e),i=[];t[r].all.forEach(function(a){var o=XG(a)?uZ:lZ,s=[];n.forEach(function(c){var l=c.data.find(function(h){return o(h.data[r],a)}),u=null,d=null;if(l!==void 0){if((u=l.data[e])!==null){var f=xe(s);f===void 0?d=u:f!==null&&(d=f+u)}l.data[e==="x"?"xStacked":"yStacked"]=d}s.push(d),d!==null&&i.push(d)})}),t[e].minStacked=Math.min.apply(Math,i),t[e].maxStacked=Math.max.apply(Math,i)},hZ=function(e,t){return tT("x",e,t)},pZ=function(e,t){return tT("y",e,t)},nT=function(e){var t=e.bandwidth();if(t===0)return e;var n=t/2;return e.round()&&(n=Math.round(n)),function(r){var i;return((i=e(r))!=null?i:0)+n}},rT={millisecond:[ms,ms],second:[hh,hh],minute:[gw,Cw],hour:[vw,Tw],day:[zt(function(e){return e.setHours(0,0,0,0)},function(e,t){return e.setDate(e.getDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)}),zt(function(e){return e.setUTCHours(0,0,0,0)},function(e,t){return e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)})],week:[ml,gl],sunday:[ml,gl],monday:[gs,vs],tuesday:[bw,kw],wednesday:[yw,Sw],thursday:[Pi,Ii],friday:[xw,Ow],saturday:[_w,Ew],month:[ww,Mw],year:[Kr,Xr]},mZ=Object.keys(rT),gZ=new RegExp("^every\\s*(\\d+)?\\s*("+mZ.join("|")+")s?$","i"),iT=function(e,t){if(Array.isArray(t))return t;if(typeof t=="string"&&"useUTC"in e){var n=t.match(gZ);if(n){var r=n[1],i=n[2],a=rT[i][e.useUTC?1:0];if(i==="day"){var o,s,c=e.domain(),l=c[0],u=c[1],d=new Date(u);return d.setDate(d.getDate()+1),(o=(s=a.every(Number(r??1)))==null?void 0:s.range(l,d))!=null?o:[]}if(r===void 0)return e.ticks(a);var f=a.every(Number(r));if(f)return e.ticks(f)}throw new Error("Invalid tickValues: "+t)}if("ticks"in e){if(t===void 0)return e.ticks();if(typeof(h=t)=="number"&&isFinite(h)&&Math.floor(h)===h)return e.ticks(t)}var h;return e.domain()};function jn(){return jn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jn.apply(this,arguments)}var aT=function(e){var t,n=e.axis,r=e.scale,i=e.ticksPosition,a=e.tickValues,o=e.tickSize,s=e.tickPadding,c=e.tickRotation,l=e.truncateTickAt,u=e.engine,d=u===void 0?"svg":u,f=iT(r,a),h=AV[d],g="bandwidth"in r?nT(r):r,p={lineX:0,lineY:0},b={textX:0,textY:0},x=typeof document=="object"&&document.dir==="rtl",_=h.align.center,y=h.baseline.center;return n==="x"?(t=function(C){var w;return{x:(w=g(C))!=null?w:0,y:0}},p.lineY=o*(i==="after"?1:-1),b.textY=(o+s)*(i==="after"?1:-1),y=i==="after"?h.baseline.top:h.baseline.bottom,c===0?_=h.align.center:i==="after"&&c<0||i==="before"&&c>0?(_=h.align[x?"left":"right"],y=h.baseline.center):(i==="after"&&c>0||i==="before"&&c<0)&&(_=h.align[x?"right":"left"],y=h.baseline.center)):(t=function(C){var w;return{x:0,y:(w=g(C))!=null?w:0}},p.lineX=o*(i==="after"?1:-1),b.textX=(o+s)*(i==="after"?1:-1),_=i==="after"?h.align.left:h.align.right),{ticks:f.map(function(C){var w=typeof C=="string"?function(T){var $=String(T).length;return l&&l>0&&$>l?""+String(T).slice(0,l).concat("..."):""+T}(C):C;return jn({key:C instanceof Date?""+C.valueOf():""+C,value:w},t(C),p,b)}),textAlign:_,textBaseline:y}},oT=function(e,t){if(e===void 0||typeof e=="function")return e;if(t.type==="time"){var n=Eu(e);return function(r){return n(r instanceof Date?r:new Date(r))}}return Bs(e)},Eh=function(e){var t,n=e.width,r=e.height,i=e.scale,a=e.axis,o=e.values,s=(t=o,(Array.isArray(t)?o:void 0)||iT(i,o)),c="bandwidth"in i?nT(i):i,l=a==="x"?s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:(d=c(u))!=null?d:0,x2:(f=c(u))!=null?f:0,y1:0,y2:r}}):s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:0,x2:n,y1:(d=c(u))!=null?d:0,y2:(f=c(u))!=null?f:0}});return l},vZ=m.memo(function(e){var t,n=e.value,r=e.format,i=e.lineX,a=e.lineY,o=e.onClick,s=e.textBaseline,c=e.textAnchor,l=e.animatedProps,u=ht(),d=u.axis.ticks.line,f=u.axis.ticks.text,h=(t=r==null?void 0:r(n))!=null?t:n,g=m.useMemo(function(){var p={opacity:l.opacity};return o?{style:jn({},p,{cursor:"pointer"}),onClick:function(b){return o(b,h)}}:{style:p}},[l.opacity,o,h]);return v.jsxs(ft.g,jn({transform:l.transform},g,{children:[v.jsx("line",{x1:0,x2:i,y1:0,y2:a,style:d}),f.outlineWidth>0&&v.jsx(ft.text,{dominantBaseline:s,textAnchor:c,transform:l.textTransform,style:f,strokeWidth:2*f.outlineWidth,stroke:f.outlineColor,strokeLinejoin:"round",children:""+h}),v.jsx(ft.text,{dominantBaseline:s,textAnchor:c,transform:l.textTransform,style:Zm(f),children:""+h})]}))}),bZ=function(e){var t=e.axis,n=e.scale,r=e.x,i=r===void 0?0:r,a=e.y,o=a===void 0?0:a,s=e.length,c=e.ticksPosition,l=e.tickValues,u=e.tickSize,d=u===void 0?5:u,f=e.tickPadding,h=f===void 0?5:f,g=e.tickRotation,p=g===void 0?0:g,b=e.format,x=e.renderTick,_=x===void 0?vZ:x,y=e.truncateTickAt,C=e.legend,w=e.legendPosition,T=w===void 0?"end":w,$=e.legendOffset,R=$===void 0?0:$,S=e.onClick,k=e.ariaHidden,O=ht(),D=O.axis.legend.text,E=m.useMemo(function(){return oT(b,n)},[b,n]),M=aT({axis:t,scale:n,ticksPosition:c,tickValues:l,tickSize:d,tickPadding:h,tickRotation:p,truncateTickAt:y}),j=M.ticks,F=M.textAlign,W=M.textBaseline,B=null;if(C!==void 0){var U,N=0,V=0,X=0;t==="y"?(X=-90,N=R,T==="start"?(U="start",V=s):T==="middle"?(U="middle",V=s/2):T==="end"&&(U="end")):(V=R,T==="start"?U="start":T==="middle"?(U="middle",N=s/2):T==="end"&&(U="end",N=s)),B=v.jsxs(v.Fragment,{children:[D.outlineWidth>0&&v.jsx("text",{transform:"translate("+N+", "+V+") rotate("+X+")",textAnchor:U,style:jn({dominantBaseline:"central"},D),strokeWidth:2*D.outlineWidth,stroke:D.outlineColor,strokeLinejoin:"round",children:C}),v.jsx("text",{transform:"translate("+N+", "+V+") rotate("+X+")",textAnchor:U,style:jn({dominantBaseline:"central"},D),children:C})]})}var ne=mn(),K=ne.animate,J=ne.config,q=cr({transform:"translate("+i+","+o+")",lineX2:t==="x"?s:0,lineY2:t==="x"?0:s,config:J,immediate:!K}),G=m.useCallback(function(H){return{opacity:1,transform:"translate("+H.x+","+H.y+")",textTransform:"translate("+H.textX+","+H.textY+") rotate("+p+")"}},[p]),z=m.useCallback(function(H){return{opacity:0,transform:"translate("+H.x+","+H.y+")",textTransform:"translate("+H.textX+","+H.textY+") rotate("+p+")"}},[p]),L=Fi(j,{keys:function(H){return H.key},initial:G,from:z,enter:G,update:G,leave:{opacity:0},config:J,immediate:!K});return v.jsxs(ft.g,{transform:q.transform,"aria-hidden":k,children:[L(function(H,ee,A,se){return ie.createElement(_,jn({tickIndex:se,format:E,rotate:p,textBaseline:W,textAnchor:F,truncateTickAt:y,animatedProps:H},ee,S?{onClick:S}:{}))}),v.jsx(ft.line,{style:O.axis.domain.line,x1:0,x2:q.lineX2,y1:0,y2:q.lineY2}),B]})},yZ=m.memo(bZ),sT=["top","right","bottom","left"],cT=m.memo(function(e){var t=e.xScale,n=e.yScale,r=e.width,i=e.height,a={top:e.top,right:e.right,bottom:e.bottom,left:e.left};return v.jsx(v.Fragment,{children:sT.map(function(o){var s=a[o];if(!s)return null;var c=o==="top"||o==="bottom";return v.jsx(yZ,jn({},s,{axis:c?"x":"y",x:o==="right"?r:0,y:o==="bottom"?i:0,scale:c?t:n,length:c?r:i,ticksPosition:o==="top"||o==="left"?"before":"after",truncateTickAt:s.truncateTickAt}),o)})})}),xZ=m.memo(function(e){var t=e.animatedProps,n=ht();return v.jsx(ft.line,jn({},t,n.grid.line))}),Yb=m.memo(function(e){var t=e.lines,n=mn(),r=n.animate,i=n.config,a=Fi(t,{keys:function(o){return o.key},initial:function(o){return{opacity:1,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},from:function(o){return{opacity:0,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},enter:function(o){return{opacity:1,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},update:function(o){return{opacity:1,x1:o.x1,x2:o.x2,y1:o.y1,y2:o.y2}},leave:{opacity:0},config:i,immediate:!r});return v.jsx("g",{children:a(function(o,s){return m.createElement(xZ,jn({},s,{key:s.key,animatedProps:o}))})})}),lT=m.memo(function(e){var t=e.width,n=e.height,r=e.xScale,i=e.yScale,a=e.xValues,o=e.yValues,s=m.useMemo(function(){return!!r&&Eh({width:t,height:n,scale:r,axis:"x",values:a})},[r,a,t,n]),c=m.useMemo(function(){return!!i&&Eh({width:t,height:n,scale:i,axis:"y",values:o})},[n,t,i,o]);return v.jsxs(v.Fragment,{children:[s&&v.jsx(Yb,{lines:s}),c&&v.jsx(Yb,{lines:c})]})}),_Z=function(e,t){var n,r=t.axis,i=t.scale,a=t.x,o=a===void 0?0:a,s=t.y,c=s===void 0?0:s,l=t.length,u=t.ticksPosition,d=t.tickValues,f=t.tickSize,h=f===void 0?5:f,g=t.tickPadding,p=g===void 0?5:g,b=t.tickRotation,x=b===void 0?0:b,_=t.format,y=t.legend,C=t.legendPosition,w=C===void 0?"end":C,T=t.legendOffset,$=T===void 0?0:T,R=t.theme,S=aT({axis:r,scale:i,ticksPosition:u,tickValues:d,tickSize:h,tickPadding:p,tickRotation:x,engine:"canvas"}),k=S.ticks,O=S.textAlign,D=S.textBaseline;e.save(),e.translate(o,c),e.textAlign=O,e.textBaseline=D;var E=R.axis.ticks.text;e.font=(E.fontWeight?E.fontWeight+" ":"")+E.fontSize+"px "+E.fontFamily,((n=R.axis.domain.line.strokeWidth)!=null?n:0)>0&&(e.lineWidth=Number(R.axis.domain.line.strokeWidth),e.lineCap="square",R.axis.domain.line.stroke&&(e.strokeStyle=R.axis.domain.line.stroke),e.beginPath(),e.moveTo(0,0),e.lineTo(r==="x"?l:0,r==="x"?0:l),e.stroke());var M=typeof _=="function"?_:function(U){return""+U};if(k.forEach(function(U){var N;((N=R.axis.ticks.line.strokeWidth)!=null?N:0)>0&&(e.lineWidth=Number(R.axis.ticks.line.strokeWidth),e.lineCap="square",R.axis.ticks.line.stroke&&(e.strokeStyle=R.axis.ticks.line.stroke),e.beginPath(),e.moveTo(U.x,U.y),e.lineTo(U.x+U.lineX,U.y+U.lineY),e.stroke());var V=M(U.value);e.save(),e.translate(U.x+U.textX,U.y+U.textY),e.rotate(An(x)),E.outlineWidth>0&&(e.strokeStyle=E.outlineColor,e.lineWidth=2*E.outlineWidth,e.lineJoin="round",e.strokeText(""+V,0,0)),R.axis.ticks.text.fill&&(e.fillStyle=E.fill),e.fillText(""+V,0,0),e.restore()}),y!==void 0){var j=0,F=0,W=0,B="center";r==="y"?(W=-90,j=$,w==="start"?(B="start",F=l):w==="middle"?(B="center",F=l/2):w==="end"&&(B="end")):(F=$,w==="start"?B="start":w==="middle"?(B="center",j=l/2):w==="end"&&(B="end",j=l)),e.translate(j,F),e.rotate(An(W)),e.font=(R.axis.legend.text.fontWeight?R.axis.legend.text.fontWeight+" ":"")+R.axis.legend.text.fontSize+"px "+R.axis.legend.text.fontFamily,R.axis.legend.text.fill&&(e.fillStyle=R.axis.legend.text.fill),e.textAlign=B,e.textBaseline="middle",e.fillText(y,0,0)}e.restore()},uT=function(e,t){var n=t.xScale,r=t.yScale,i=t.width,a=t.height,o=t.top,s=t.right,c=t.bottom,l=t.left,u=t.theme,d={top:o,right:s,bottom:c,left:l};sT.forEach(function(f){var h=d[f];if(!h)return null;var g=f==="top"||f==="bottom",p=f==="top"||f==="left"?"before":"after",b=g?n:r,x=oT(h.format,b);_Z(e,jn({},h,{axis:g?"x":"y",x:f==="right"?i:0,y:f==="bottom"?a:0,scale:b,format:x,length:g?i:a,ticksPosition:p,theme:u}))})},Cl=function(e,t){var n=t.width,r=t.height,i=t.scale,a=t.axis,o=t.values;Eh({width:n,height:r,scale:i,axis:a,values:o}).forEach(function(s){e.beginPath(),e.moveTo(s.x1,s.y1),e.lineTo(s.x2,s.y2),e.stroke()})},wZ=q_,CZ=0;function TZ(e){var t=++CZ;return wZ(e)+t}var kZ=TZ;const SZ=Rt(kZ),xr=11102230246251565e-32,tn=134217729,OZ=(3+8*xr)*xr;function cf(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let h=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[h++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[h++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[h++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[h++]=s);return(a!==0||h===0)&&(i[h++]=a),h}function EZ(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function Hs(e){return new Float64Array(e)}const MZ=(3+16*xr)*xr,$Z=(2+12*xr)*xr,RZ=(9+64*xr)*xr*xr,ea=Hs(4),Gb=Hs(8),Zb=Hs(12),Kb=Hs(16),ln=Hs(4);function AZ(e,t,n,r,i,a,o){let s,c,l,u,d,f,h,g,p,b,x,_,y,C,w,T,$,R;const S=e-i,k=n-i,O=t-a,D=r-a;C=S*D,f=tn*S,h=f-(f-S),g=S-h,f=tn*D,p=f-(f-D),b=D-p,w=g*b-(C-h*p-g*p-h*b),T=O*k,f=tn*O,h=f-(f-O),g=O-h,f=tn*k,p=f-(f-k),b=k-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ea[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ea[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ea[2]=_-(R-d)+(x-d),ea[3]=R;let E=EZ(4,ea),M=$Z*o;if(E>=M||-E>=M||(d=e-S,s=e-(S+d)+(d-i),d=n-k,l=n-(k+d)+(d-i),d=t-O,c=t-(O+d)+(d-a),d=r-D,u=r-(D+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(M=RZ*o+OZ*Math.abs(E),E+=S*u+D*s-(O*l+k*c),E>=M||-E>=M))return E;C=s*D,f=tn*s,h=f-(f-s),g=s-h,f=tn*D,p=f-(f-D),b=D-p,w=g*b-(C-h*p-g*p-h*b),T=c*k,f=tn*c,h=f-(f-c),g=c-h,f=tn*k,p=f-(f-k),b=k-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ln[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ln[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ln[2]=_-(R-d)+(x-d),ln[3]=R;const j=cf(4,ea,4,ln,Gb);C=S*u,f=tn*S,h=f-(f-S),g=S-h,f=tn*u,p=f-(f-u),b=u-p,w=g*b-(C-h*p-g*p-h*b),T=O*l,f=tn*O,h=f-(f-O),g=O-h,f=tn*l,p=f-(f-l),b=l-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ln[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ln[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ln[2]=_-(R-d)+(x-d),ln[3]=R;const F=cf(j,Gb,4,ln,Zb);C=s*u,f=tn*s,h=f-(f-s),g=s-h,f=tn*u,p=f-(f-u),b=u-p,w=g*b-(C-h*p-g*p-h*b),T=c*l,f=tn*c,h=f-(f-c),g=c-h,f=tn*l,p=f-(f-l),b=l-p,$=g*b-(T-h*p-g*p-h*b),x=w-$,d=w-x,ln[0]=w-(x+d)+(d-$),_=C+x,d=_-C,y=C-(_-d)+(x-d),x=y-T,d=y-x,ln[1]=y-(x+d)+(d-T),R=_+x,d=R-_,ln[2]=_-(R-d)+(x-d),ln[3]=R;const W=cf(F,Zb,4,ln,Kb);return Kb[W-1]}function fc(e,t,n,r,i,a){const o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=MZ*l?c:-AZ(e,t,n,r,i,a,l)}const Xb=Math.pow(2,-52),hc=new Uint32Array(512);class Tl{static from(t,n=NZ,r=FZ){const i=t.length,a=new Float64Array(i*2);for(let o=0;o<i;o++){const s=t[o];a[2*o]=n(s),a[2*o+1]=r(s)}return new Tl(a)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:a}=this,o=t.length>>1;let s=1/0,c=1/0,l=-1/0,u=-1/0;for(let S=0;S<o;S++){const k=t[2*S],O=t[2*S+1];k<s&&(s=k),O<c&&(c=O),k>l&&(l=k),O>u&&(u=O),this._ids[S]=S}const d=(s+l)/2,f=(c+u)/2;let h,g,p;for(let S=0,k=1/0;S<o;S++){const O=lf(d,f,t[2*S],t[2*S+1]);O<k&&(h=S,k=O)}const b=t[2*h],x=t[2*h+1];for(let S=0,k=1/0;S<o;S++){if(S===h)continue;const O=lf(b,x,t[2*S],t[2*S+1]);O<k&&O>0&&(g=S,k=O)}let _=t[2*g],y=t[2*g+1],C=1/0;for(let S=0;S<o;S++){if(S===h||S===g)continue;const k=IZ(b,x,_,y,t[2*S],t[2*S+1]);k<C&&(p=S,C=k)}let w=t[2*p],T=t[2*p+1];if(C===1/0){for(let O=0;O<o;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];sa(this._ids,this._dists,0,o-1);const S=new Uint32Array(o);let k=0;for(let O=0,D=-1/0;O<o;O++){const E=this._ids[O],M=this._dists[E];M>D&&(S[k++]=E,D=M)}this.hull=S.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(fc(b,x,_,y,w,T)<0){const S=g,k=_,O=y;g=p,_=w,y=T,p=S,w=k,T=O}const $=DZ(b,x,_,y,w,T);this._cx=$.x,this._cy=$.y;for(let S=0;S<o;S++)this._dists[S]=lf(t[2*S],t[2*S+1],$.x,$.y);sa(this._ids,this._dists,0,o-1),this._hullStart=h;let R=3;r[h]=n[p]=g,r[g]=n[h]=p,r[p]=n[g]=h,i[h]=0,i[g]=1,i[p]=2,a.fill(-1),a[this._hashKey(b,x)]=h,a[this._hashKey(_,y)]=g,a[this._hashKey(w,T)]=p,this.trianglesLen=0,this._addTriangle(h,g,p,-1,-1,-1);for(let S=0,k,O;S<this._ids.length;S++){const D=this._ids[S],E=t[2*D],M=t[2*D+1];if(S>0&&Math.abs(E-k)<=Xb&&Math.abs(M-O)<=Xb||(k=E,O=M,D===h||D===g||D===p))continue;let j=0;for(let N=0,V=this._hashKey(E,M);N<this._hashSize&&(j=a[(V+N)%this._hashSize],!(j!==-1&&j!==r[j]));N++);j=n[j];let F=j,W;for(;W=r[F],fc(E,M,t[2*F],t[2*F+1],t[2*W],t[2*W+1])>=0;)if(F=W,F===j){F=-1;break}if(F===-1)continue;let B=this._addTriangle(F,D,r[F],-1,-1,i[F]);i[D]=this._legalize(B+2),i[F]=B,R++;let U=r[F];for(;W=r[U],fc(E,M,t[2*U],t[2*U+1],t[2*W],t[2*W+1])<0;)B=this._addTriangle(U,D,W,i[D],-1,i[U]),i[D]=this._legalize(B+2),r[U]=U,R--,U=W;if(F===j)for(;W=n[F],fc(E,M,t[2*W],t[2*W+1],t[2*F],t[2*F+1])<0;)B=this._addTriangle(W,D,F,-1,i[F],i[W]),this._legalize(B+2),i[W]=B,r[F]=F,R--,F=W;this._hullStart=n[D]=F,r[F]=n[U]=D,r[D]=U,a[this._hashKey(E,M)]=D,a[this._hashKey(t[2*F],t[2*F+1])]=F}this.hull=new Uint32Array(R);for(let S=0,k=this._hullStart;S<R;S++)this.hull[S]=k,k=r[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(jZ(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:r,coords:i}=this;let a=0,o=0;for(;;){const s=r[t],c=t-t%3;if(o=c+(t+2)%3,s===-1){if(a===0)break;t=hc[--a];continue}const l=s-s%3,u=c+(t+1)%3,d=l+(s+2)%3,f=n[o],h=n[t],g=n[u],p=n[d];if(PZ(i[2*f],i[2*f+1],i[2*h],i[2*h+1],i[2*g],i[2*g+1],i[2*p],i[2*p+1])){n[t]=p,n[s]=f;const x=r[d];if(x===-1){let y=this._hullStart;do{if(this._hullTri[y]===d){this._hullTri[y]=t;break}y=this._hullPrev[y]}while(y!==this._hullStart)}this._link(t,x),this._link(s,r[o]),this._link(o,d);const _=l+(s+1)%3;a<hc.length&&(hc[a++]=_)}else{if(a===0)break;t=hc[--a]}}return o}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,a,o){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=n,this._triangles[s+2]=r,this._link(s,i),this._link(s+1,a),this._link(s+2,o),this.trianglesLen+=3,s}}function jZ(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function lf(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}function PZ(e,t,n,r,i,a,o,s){const c=e-o,l=t-s,u=n-o,d=r-s,f=i-o,h=a-s,g=c*c+l*l,p=u*u+d*d,b=f*f+h*h;return c*(d*b-p*h)-l*(u*b-p*f)+g*(u*h-d*f)<0}function IZ(e,t,n,r,i,a){const o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),h=(l*u-s*d)*f,g=(o*d-c*u)*f;return h*h+g*g}function DZ(e,t,n,r,i,a){const o=n-e,s=r-t,c=i-e,l=a-t,u=o*o+s*s,d=c*c+l*l,f=.5/(o*l-s*c),h=e+(l*u-s*d)*f,g=t+(o*d-c*u)*f;return{x:h,y:g}}function sa(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const a=e[i],o=t[a];let s=i-1;for(;s>=n&&t[e[s]]>o;)e[s+1]=e[s--];e[s+1]=a}else{const i=n+r>>1;let a=n+1,o=r;xo(e,i,a),t[e[n]]>t[e[r]]&&xo(e,n,r),t[e[a]]>t[e[r]]&&xo(e,a,r),t[e[n]]>t[e[a]]&&xo(e,n,a);const s=e[a],c=t[s];for(;;){do a++;while(t[e[a]]<c);do o--;while(t[e[o]]>c);if(o<a)break;xo(e,a,o)}e[n+1]=e[o],e[o]=s,r-a+1>=o-n?(sa(e,t,a,r),sa(e,t,n,o-1)):(sa(e,t,n,o-1),sa(e,t,a,r))}}function xo(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function NZ(e){return e[0]}function FZ(e){return e[1]}const Qb=1e-6;class vi{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;const i=t+r,a=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${a}`:(Math.abs(this._x1-i)>Qb||Math.abs(this._y1-a)>Qb)&&(this._+="L"+i+","+a),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=a}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class Mh{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class LZ{constructor(t,[n,r,i,a]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((a=+a)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=a,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this;let a,o;const s=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let p=0,b=0,x=r.length,_,y;p<x;p+=3,b+=2){const C=r[p]*2,w=r[p+1]*2,T=r[p+2]*2,$=t[C],R=t[C+1],S=t[w],k=t[w+1],O=t[T],D=t[T+1],E=S-$,M=k-R,j=O-$,F=D-R,W=(E*F-M*j)*2;if(Math.abs(W)<1e-9){if(a===void 0){a=o=0;for(const U of n)a+=t[U*2],o+=t[U*2+1];a/=n.length,o/=n.length}const B=1e9*Math.sign((a-$)*F-(o-R)*j);_=($+O)/2-B*F,y=(R+D)/2+B*j}else{const B=1/W,U=E*E+M*M,N=j*j+F*F;_=$+(F*U-M*N)*B,y=R+(E*N-j*U)*B}s[b]=_,s[b+1]=y}let c=n[n.length-1],l,u=c*4,d,f=t[2*c],h,g=t[2*c+1];i.fill(0);for(let p=0;p<n.length;++p)c=n[p],l=u,d=f,h=g,u=c*4,f=t[2*c],g=t[2*c+1],i[l+2]=i[u]=h-g,i[l+3]=i[u+1]=f-d}render(t){const n=t==null?t=new vi:void 0,{delaunay:{halfedges:r,inedges:i,hull:a},circumcenters:o,vectors:s}=this;if(a.length<=1)return null;for(let u=0,d=r.length;u<d;++u){const f=r[u];if(f<u)continue;const h=Math.floor(u/3)*2,g=Math.floor(f/3)*2,p=o[h],b=o[h+1],x=o[g],_=o[g+1];this._renderSegment(p,b,x,_,t)}let c,l=a[a.length-1];for(let u=0;u<a.length;++u){c=l,l=a[u];const d=Math.floor(i[l]/3)*2,f=o[d],h=o[d+1],g=c*4,p=this._project(f,h,s[g+2],s[g+3]);p&&this._renderSegment(f,h,p[0],p[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new vi:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const r=n==null?n=new vi:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let a=i.length;for(;i[0]===i[a-2]&&i[1]===i[a-1]&&a>1;)a-=2;for(let o=2;o<a;o+=2)(i[o]!==i[o-2]||i[o+1]!==i[o-1])&&n.lineTo(i[o],i[o+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){const n=new Mh;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,a){let o;const s=this._regioncode(t,n),c=this._regioncode(r,i);s===0&&c===0?(a.moveTo(t,n),a.lineTo(r,i)):(o=this._clipSegment(t,n,r,i,s,c))&&(a.moveTo(o[0],o[1]),a.lineTo(o[2],o[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){const n=this._clip(t);if(n)for(const r of this.delaunay.neighbors(t)){const i=this._clip(r);if(i){e:for(let a=0,o=n.length;a<o;a+=2)for(let s=0,c=i.length;s<c;s+=2)if(n[a]===i[s]&&n[a+1]===i[s+1]&&n[(a+2)%o]===i[(s+c-2)%c]&&n[(a+3)%o]===i[(s+c-1)%c]){yield r;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:a}}=this,o=r[t];if(o===-1)return null;const s=[];let c=o;do{const l=Math.floor(c/3);if(s.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,a[c]!==t)break;c=i[c]}while(c!==o&&c!==-1);return s}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){const r=n.length;let i=null,a,o,s=n[r-2],c=n[r-1],l,u=this._regioncode(s,c),d,f=0;for(let h=0;h<r;h+=2)if(a=s,o=c,s=n[h],c=n[h+1],l=u,u=this._regioncode(s,c),l===0&&u===0)d=f,f=0,i?i.push(s,c):i=[s,c];else{let g,p,b,x,_;if(l===0){if((g=this._clipSegment(a,o,s,c,l,u))===null)continue;[p,b,x,_]=g}else{if((g=this._clipSegment(s,c,a,o,u,l))===null)continue;[x,_,p,b]=g,d=f,f=this._edgecode(p,b),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(p,b):i=[p,b]}d=f,f=this._edgecode(x,_),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(x,_):i=[x,_]}if(i)d=f,f=this._edgecode(i[0],i[1]),d&&f&&this._edge(t,d,f,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,a,o){const s=a<o;for(s&&([t,n,r,i,a,o]=[r,i,t,n,o,a]);;){if(a===0&&o===0)return s?[r,i,t,n]:[t,n,r,i];if(a&o)return null;let c,l,u=a||o;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),a?(t=c,n=l,a=this._regioncode(t,n)):(r=c,i=l,o=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,a,o){let s=Array.from(n),c;if((c=this._project(s[0],s[1],r,i))&&s.unshift(c[0],c[1]),(c=this._project(s[s.length-2],s[s.length-1],a,o))&&s.push(c[0],c[1]),s=this._clipFinite(t,s))for(let l=0,u=s.length,d,f=this._edgecode(s[u-2],s[u-1]);l<u;l+=2)d=f,f=this._edgecode(s[l],s[l+1]),d&&f&&(l=this._edge(t,d,f,s,l),u=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,n,r,i,a){for(;n!==r;){let o,s;switch(n){case 5:n=4;continue;case 4:n=6,o=this.xmax,s=this.ymin;break;case 6:n=2;continue;case 2:n=10,o=this.xmax,s=this.ymax;break;case 10:n=8;continue;case 8:n=9,o=this.xmin,s=this.ymax;break;case 9:n=1;continue;case 1:n=5,o=this.xmin,s=this.ymin;break}(i[a]!==o||i[a+1]!==s)&&this.contains(t,o,s)&&(i.splice(a,0,o,s),a+=2)}return a}_project(t,n,r,i){let a=1/0,o,s,c;if(i<0){if(n<=this.ymin)return null;(o=(this.ymin-n)/i)<a&&(c=this.ymin,s=t+(a=o)*r)}else if(i>0){if(n>=this.ymax)return null;(o=(this.ymax-n)/i)<a&&(c=this.ymax,s=t+(a=o)*r)}if(r>0){if(t>=this.xmax)return null;(o=(this.xmax-t)/r)<a&&(s=this.xmax,c=n+(a=o)*i)}else if(r<0){if(t<=this.xmin)return null;(o=(this.xmin-t)/r)<a&&(s=this.xmin,c=n+(a=o)*i)}return[s,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}}const BZ=2*Math.PI,ta=Math.pow;function WZ(e){return e[0]}function UZ(e){return e[1]}function zZ(e){const{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){const i=2*t[r],a=2*t[r+1],o=2*t[r+2];if((n[o]-n[i])*(n[a+1]-n[i+1])-(n[a]-n[i])*(n[o+1]-n[i+1])>1e-10)return!1}return!0}function HZ(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class tg{static from(t,n=WZ,r=UZ,i){return new tg("length"in t?VZ(t,n,r,i):Float64Array.from(qZ(t,n,r,i)))}constructor(t){this._delaunator=new Tl(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&zZ(t)){this.collinear=Int32Array.from({length:n.length/2},(f,h)=>h).sort((f,h)=>n[2*f]-n[2*h]||n[2*f+1]-n[2*h+1]);const c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],d=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let f=0,h=n.length/2;f<h;++f){const g=HZ(n[2*f],n[2*f+1],d);n[2*f]=g[0],n[2*f+1]=g[1]}this._delaunator=new Tl(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,a=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),s=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){const u=a[c%3===2?c-2:c+1];(r[c]===-1||o[u]===-1)&&(o[u]=c)}for(let c=0,l=i.length;c<l;++c)s[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,i.length===2&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new LZ(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:a,triangles:o,collinear:s}=this;if(s){const d=s.indexOf(t);d>0&&(yield s[d-1]),d<s.length-1&&(yield s[d+1]);return}const c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=o[l],l=l%3===2?l-2:l+1,o[l]!==t)return;if(l=a[l],l===-1){const d=r[(i[t]+1)%r.length];d!==u&&(yield d);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const i=r;let a;for(;(a=this._step(r,t,n))>=0&&a!==r&&a!==i;)r=a;return a}_step(t,n,r){const{inedges:i,hull:a,_hullIndex:o,halfedges:s,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,d=ta(n-l[t*2],2)+ta(r-l[t*2+1],2);const f=i[t];let h=f;do{let g=c[h];const p=ta(n-l[g*2],2)+ta(r-l[g*2+1],2);if(p<d&&(d=p,u=g),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=s[h],h===-1){if(h=a[(o[t]+1)%a.length],h!==g&&ta(n-l[h*2],2)+ta(r-l[h*2+1],2)<d)return h;break}}while(h!==f);return u}render(t){const n=t==null?t=new vi:void 0,{points:r,halfedges:i,triangles:a}=this;for(let o=0,s=i.length;o<s;++o){const c=i[o];if(c<o)continue;const l=a[o]*2,u=a[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const r=t==null?t=new vi:void 0,{points:i}=this;for(let a=0,o=i.length;a<o;a+=2){const s=i[a],c=i[a+1];t.moveTo(s+n,c),t.arc(s,c,n,0,BZ)}return r&&r.value()}renderHull(t){const n=t==null?t=new vi:void 0,{hull:r,points:i}=this,a=r[0]*2,o=r.length;t.moveTo(i[a],i[a+1]);for(let s=1;s<o;++s){const c=2*r[s];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new Mh;return this.renderHull(t),t.value()}renderTriangle(t,n){const r=n==null?n=new vi:void 0,{points:i,triangles:a}=this,o=a[t*=3]*2,s=a[t+1]*2,c=a[t+2]*2;return n.moveTo(i[o],i[o+1]),n.lineTo(i[s],i[s+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new Mh;return this.renderTriangle(t,n),n.value()}}function VZ(e,t,n,r){const i=e.length,a=new Float64Array(i*2);for(let o=0;o<i;++o){const s=e[o];a[o*2]=t.call(r,s,o,e),a[o*2+1]=n.call(r,s,o,e)}return a}function*qZ(e,t,n,r){let i=0;for(const a of e)yield t.call(r,a,i,e),yield n.call(r,a,i,e),++i}var ng=function(e){return[e.x,e.y]},Vs=CC,dT="cursor",fT="top",YZ=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?ng:n,i=e.margin,a=i===void 0?Vs:i;return t.map(function(o){var s=r(o),c=s[0],l=s[1];return[c+a.left,l+a.top]})},GZ=function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,a=i===void 0?Vs:i,o=e.debug,s=tg.from(t),c=o?s.voronoi([0,0,a.left+n+a.right,a.top+r+a.bottom]):void 0;return{points:t,delaunay:s,voronoi:c}},hT=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?ng:n,i=e.width,a=e.height,o=e.margin,s=o===void 0?Vs:o,c=e.debug;return m.useMemo(function(){return GZ({points:YZ({points:t,margin:s,getNodePosition:r}),width:i,height:a,margin:s,debug:c})},[t,i,a,s,c])},ZZ=function(e){var t=e.elementRef,n=e.nodes,r=e.getNodePosition,i=r===void 0?ng:r,a=e.delaunay,o=e.setCurrent,s=e.margin,c=s===void 0?Vs:s,l=e.detectionRadius,u=l===void 0?1/0:l,d=e.isInteractive,f=d===void 0||d,h=e.onMouseEnter,g=e.onMouseMove,p=e.onMouseLeave,b=e.onClick,x=e.onTouchStart,_=e.onTouchMove,y=e.onTouchEnd,C=e.enableTouchCrosshair,w=C!==void 0&&C,T=e.tooltip,$=e.tooltipPosition,R=$===void 0?dT:$,S=e.tooltipAnchor,k=S===void 0?fT:S,O=m.useState(null),D=O[0],E=O[1],M=m.useRef(null);m.useEffect(function(){M.current=D},[M,D]);var j=m.useCallback(function(z){if(!t.current)return null;var L=jo(t.current,z),H=L[0],ee=L[1],A=a.find(H,ee),se=A!==void 0?n[A]:null;if(se&&u!==1/0){var ce=i(se),ue=ce[0],we=ce[1];BV(H,ee,ue+c.left,we+c.top)>u&&(A=null,se=null)}return A===null||se===null?null:[A,se]},[t,a,n,i,c,u]),F=Li(),W=F.showTooltipAt,B=F.showTooltipFromEvent,U=F.hideTooltip,N=m.useMemo(function(){if(T)return R==="cursor"?function(z,L){B(T(z),L,k)}:function(z){var L=i(z),H=L[0],ee=L[1];W(T(z),[H+c.left,ee+c.top],k)}},[W,B,T,R,k,i,c]),V=m.useCallback(function(z){var L=j(z);if(E(L),o==null||o(L?L[1]:null),L){var H=L[1];N==null||N(H,z),h==null||h(L[1],z)}},[j,E,o,N,h]),X=m.useCallback(function(z){var L=j(z);if(E(L),L){var H=L[0],ee=L[1];if(o==null||o(ee),N==null||N(ee,z),M.current){var A=M.current,se=A[0],ce=A[1];H!==se?p==null||p(ce,z):g==null||g(ee,z)}else h==null||h(ee,z)}else o==null||o(null),U==null||U(),M.current&&(p==null||p(M.current[1],z))},[j,E,M,h,g,p,N,U]),ne=m.useCallback(function(z){E(null),o==null||o(null),U(),p&&M.current&&p(M.current[1],z)},[E,o,M,U,p]),K=m.useCallback(function(z){var L=j(z);E(L),L&&(b==null||b(L[1],z))},[j,E,b]),J=m.useCallback(function(z){var L=j(z);w&&(E(L),o==null||o(L?L[1]:null)),L&&(x==null||x(L[1],z))},[j,E,o,w,x]),q=m.useCallback(function(z){var L=j(z);w&&(E(L),o==null||o(L?L[1]:null)),L&&(_==null||_(L[1],z))},[j,E,o,w,_]),G=m.useCallback(function(z){w&&(E(null),o==null||o(null)),y&&M.current&&y(M.current[1],z)},[w,E,o,y,M]);return{current:D,handleMouseEnter:f?V:void 0,handleMouseMove:f?X:void 0,handleMouseLeave:f?ne:void 0,handleClick:f?K:void 0,handleTouchStart:f?J:void 0,handleTouchMove:f?q:void 0,handleTouchEnd:f?G:void 0}},KZ=function(e){var t=e.nodes,n=e.width,r=e.height,i=e.margin,a=i===void 0?Vs:i,o=e.getNodePosition,s=e.setCurrent,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,g=e.onTouchEnd,p=e.enableTouchCrosshair,b=p!==void 0&&p,x=e.detectionRadius,_=x===void 0?1/0:x,y=e.tooltip,C=e.tooltipPosition,w=C===void 0?dT:C,T=e.tooltipAnchor,$=T===void 0?fT:T,R=e.debug,S=m.useRef(null),k=hT({points:t,getNodePosition:o,width:n,height:r,margin:a,debug:R}),O=k.delaunay,D=k.voronoi,E=ZZ({elementRef:S,nodes:t,delaunay:O,margin:a,detectionRadius:_,setCurrent:s,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:g,enableTouchCrosshair:b,tooltip:y,tooltipPosition:w,tooltipAnchor:$}),M=E.current,j=E.handleMouseEnter,F=E.handleMouseMove,W=E.handleMouseLeave,B=E.handleClick,U=E.handleTouchStart,N=E.handleTouchMove,V=E.handleTouchEnd,X=m.useMemo(function(){if(R&&D)return D.render()},[R,D]);return v.jsxs("g",{ref:S,transform:"translate("+-a.left+","+-a.top+")",children:[R&&D&&v.jsxs(v.Fragment,{children:[v.jsx("path",{d:X,stroke:"red",strokeWidth:1,opacity:.75}),_<1/0&&v.jsx("path",{stroke:"red",strokeWidth:.35,fill:"none",d:O.renderPoints(void 0,_)}),M&&v.jsx("path",{fill:"pink",opacity:.35,d:D.renderCell(M[0])})]}),v.jsx("rect",{"data-ref":"mesh-interceptor",width:a.left+n+a.right,height:a.top+r+a.bottom,fill:"red",opacity:0,style:{cursor:"auto"},onMouseEnter:j,onMouseMove:F,onMouseLeave:W,onTouchStart:U,onTouchMove:N,onTouchEnd:V,onClick:B})]})},XZ=function(e,t){e.save(),e.globalAlpha=.75,e.beginPath(),t.render(e),e.strokeStyle="red",e.lineWidth=1,e.stroke(),e.restore()},QZ=function(e,t,n){e.save(),e.globalAlpha=.35,e.beginPath(),t.renderCell(n,e),e.fillStyle="pink",e.fill(),e.restore()};function hn(){return hn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hn.apply(this,arguments)}var rg=m.memo(function(e){var t=e.point;return v.jsx(Zp,{id:v.jsxs("span",{children:["x: ",v.jsx("strong",{children:t.data.xFormatted}),", y:"," ",v.jsx("strong",{children:t.data.yFormatted})]}),enableChip:!0,color:t.serieColor})}),pT=m.memo(function(e){var t=e.slice,n=e.axis,r=ht(),i=n==="x"?"y":"x";return v.jsx(x_,{rows:t.points.map(function(a){return[v.jsx(y_,{color:a.serieColor,style:r.tooltip.chip},"chip"),a.serieId,v.jsx("span",{style:r.tooltip.tableCellValue,children:a.data[i+"Formatted"]},"value")]})})}),mT={curve:"linear",xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],axisBottom:{},axisLeft:{},enableGridX:!0,enableGridY:!0,enablePoints:!0,pointSize:6,pointColor:{from:"color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enablePointLabel:!1,pointLabel:"yFormatted",colors:{scheme:"nivo"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,areaBlendMode:"normal",lineWidth:2,legends:[],isInteractive:!0,tooltip:rg,enableSlices:!1,debugSlices:!1,sliceTooltip:pT,debugMesh:!1,enableCrosshair:!0,crosshairType:"bottom-left"},Ar=hn({},mT,{enablePointLabel:!1,useMesh:!1,enableTouchCrosshair:!1,animate:!0,motionConfig:"gentle",defs:[],fill:[],role:"img"});hn({},mT,{pixelRatio:typeof window<"u"&&window.devicePixelRatio||1});var JZ=function(e){var t=e.curve;return m.useMemo(function(){return Fm().defined(function(n){return n.x!==null&&n.y!==null}).x(function(n){return n.x}).y(function(n){return n.y}).curve(wC(t))},[t])},eK=function(e){var t=e.curve,n=e.yScale,r=e.areaBaselineValue;return m.useMemo(function(){return vU().defined(function(i){return i.x!==null&&i.y!==null}).x(function(i){return i.x}).y1(function(i){return i.y}).curve(wC(t)).y0(n(r))},[t,n,r])},tK=function(e){var t=e.componentId,n=e.enableSlices,r=e.points,i=e.width,a=e.height;return m.useMemo(function(){if(n===!1)return[];if(n==="x"){var o=new Map;return r.forEach(function(c){c.data.x!==null&&c.data.y!==null&&(o.has(c.x)?o.get(c.x).push(c):o.set(c.x,[c]))}),Array.from(o.entries()).sort(function(c,l){return c[0]-l[0]}).map(function(c,l,u){var d,f,h=c[0],g=c[1],p=u[l-1],b=u[l+1];return d=p?h-(h-p[0])/2:h,f=b?h-d+(b[0]-h)/2:i-d,{id:"slice:"+t+":"+h,x0:d,x:h,y0:0,y:0,width:f,height:a,points:g.reverse()}})}if(n==="y"){var s=new Map;return r.forEach(function(c){c.data.x!==null&&c.data.y!==null&&(s.has(c.y)?s.get(c.y).push(c):s.set(c.y,[c]))}),Array.from(s.entries()).sort(function(c,l){return c[0]-l[0]}).map(function(c,l,u){var d,f,h=c[0],g=c[1],p=u[l-1],b=u[l+1];return d=p?h-(h-p[0])/2:h,f=b?h-d+(b[0]-h)/2:a-d,{id:h,x0:0,x:0,y0:d,y:h,width:i,height:f,points:g.reverse()}})}},[t,n,a,r,i])},nK="line",gT=function(e){var t=e.data,n=e.xScale,r=n===void 0?Ar.xScale:n,i=e.xFormat,a=e.yScale,o=a===void 0?Ar.yScale:a,s=e.yFormat,c=e.width,l=e.height,u=e.colors,d=u===void 0?Ar.colors:u,f=e.curve,h=f===void 0?Ar.curve:f,g=e.areaBaselineValue,p=g===void 0?Ar.areaBaselineValue:g,b=e.pointColor,x=b===void 0?Ar.pointColor:b,_=e.pointBorderColor,y=_===void 0?Ar.pointBorderColor:_,C=e.enableSlices,w=C===void 0?Ar.enableSlicesTooltip:C,T=m.useState(SZ(nK))[0],$=Ma(i),R=Ma(s),S=Xm(d,"id"),k=ht(),O=ar(x,k),D=ar(y,k),E=m.useState([]),M=E[0],j=E[1],F=m.useMemo(function(){return dZ(t.filter(function(q){return M.indexOf(q.id)===-1}),r,o,c,l)},[t,M,r,o,c,l]),W=F.xScale,B=F.yScale,U=F.series,N=m.useMemo(function(){var q=t.map(function(z){return{id:z.id,label:z.id,color:S(z)}}),G=q.map(function(z){return hn({},U.find(function(L){return L.id===z.id}),{color:z.color})}).filter(function(z){return!!z.id});return{legendData:q.map(function(z){return hn({},z,{hidden:!G.find(function(L){return L.id===z.id})})}).reverse(),series:G}},[t,U,S]),V=N.legendData,X=N.series,ne=m.useCallback(function(q){j(function(G){return G.indexOf(q)>-1?G.filter(function(z){return z!==q}):[].concat(G,[q])})},[]),K=function(q){var G=q.series,z=q.getPointColor,L=q.getPointBorderColor,H=q.formatX,ee=q.formatY;return m.useMemo(function(){return G.reduce(function(A,se){return[].concat(A,se.data.filter(function(ce){return ce.position.x!==null&&ce.position.y!==null}).map(function(ce,ue){var we={id:se.id+"."+ue,index:A.length+ue,serieId:se.id,serieColor:se.color,x:ce.position.x,y:ce.position.y};return we.color=z(se),we.borderColor=L(we),we.data=hn({},ce.data,{xFormatted:H(ce.data.x),yFormatted:ee(ce.data.y)}),we}))},[])},[G,z,L,H,ee])}({series:X,getPointColor:O,getPointBorderColor:D,formatX:$,formatY:R}),J=tK({componentId:T,enableSlices:w,points:K,width:c,height:l});return{legendData:V,toggleSerie:ne,lineGenerator:JZ({curve:h}),areaGenerator:eK({curve:h,yScale:B,areaBaselineValue:p}),getColor:S,series:X,xScale:W,yScale:B,slices:J,points:K}},rK=function(e){var t=e.areaBlendMode,n=e.areaOpacity,r=e.color,i=e.fill,a=e.path,o=mn(),s=o.animate,c=o.config,l=Ym(a),u=cr({color:r,config:c,immediate:!s});return v.jsx(ft.path,{d:l,fill:i||u.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:t}})},iK=m.memo(function(e){var t=e.areaGenerator,n=e.areaOpacity,r=e.areaBlendMode,i=e.lines.slice(0).reverse();return v.jsx("g",{children:i.map(function(a){return v.jsx(rK,hn({path:t(a.data.map(function(o){return o.position}))},hn({areaOpacity:n,areaBlendMode:r},a)),a.id)})})}),aK=m.memo(function(e){var t=e.lineGenerator,n=e.points,r=e.color,i=e.thickness,a=m.useMemo(function(){return t(n)},[t,n]),o=Ym(a);return v.jsx(ft.path,{d:o,fill:"none",strokeWidth:i,stroke:r})}),oK=m.memo(function(e){var t=e.lines,n=e.lineGenerator,r=e.lineWidth;return t.slice(0).reverse().map(function(i){var a=i.id,o=i.data,s=i.color;return v.jsx(aK,{id:a,points:o.map(function(c){return c.position}),lineGenerator:n,color:s,thickness:r},a)})}),sK=m.memo(function(e){var t=e.slice,n=e.slices,r=e.axis,i=e.debug,a=e.tooltip,o=e.isCurrent,s=e.setCurrent,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,g=e.onTouchEnd,p=Li(),b=p.showTooltipFromEvent,x=p.hideTooltip,_=m.useCallback(function(S){b(m.createElement(a,{slice:t,axis:r}),S,"right"),s(t),c&&c(t,S)},[b,a,t,r,s,c]),y=m.useCallback(function(S){b(m.createElement(a,{slice:t,axis:r}),S,"right"),l&&l(t,S)},[b,a,t,r,l]),C=m.useCallback(function(S){x(),s(null),u&&u(t,S)},[x,s,u,t]),w=m.useCallback(function(S){d&&d(t,S)},[t,d]),T=m.useCallback(function(S){b(m.createElement(a,{slice:t,axis:r}),S,"right"),s(t),f&&f(t,S)},[r,f,s,b,t,a]),$=m.useCallback(function(S){var k=S.touches[0],O=document.elementFromPoint(k.clientX,k.clientY),D=O==null?void 0:O.getAttribute("data-ref");if(D){var E=n.find(function(M){return M.id===D});E&&(b(m.createElement(a,{slice:E,axis:r}),S,"right"),s(E))}h&&h(t,S)},[r,h,s,b,t,n,a]),R=m.useCallback(function(S){x(),s(null),g&&g(t,S)},[x,s,g,t]);return v.jsx("rect",{x:t.x0,y:t.y0,width:t.width,height:t.height,stroke:"red",strokeWidth:i?1:0,strokeOpacity:.75,fill:"red",fillOpacity:o&&i?.35:0,onMouseEnter:_,onMouseMove:y,onMouseLeave:C,onClick:w,onTouchStart:T,onTouchMove:$,onTouchEnd:R,"data-ref":t.id})}),cK=m.memo(function(e){var t=e.slices,n=e.axis,r=e.debug,i=e.height,a=e.tooltip,o=e.current,s=e.setCurrent,c=e.onMouseEnter,l=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,g=e.onTouchEnd;return t.map(function(p){return v.jsx(sK,{slice:p,slices:t,axis:n,debug:r,height:i,tooltip:a,setCurrent:s,isCurrent:o!==null&&o.id===p.id,onMouseEnter:c,onMouseMove:l,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:g},p.id)})}),lK=m.memo(function(e){var t=e.points,n=e.symbol,r=e.size,i=e.borderWidth,a=e.enableLabel,o=e.label,s=e.labelYOffset,c=ht(),l=LV(o),u=t.slice(0).reverse().map(function(d){return{id:d.id,x:d.x,y:d.y,datum:d.data,fill:d.color,stroke:d.borderColor,label:a?l(d):null}});return v.jsx("g",{children:u.map(function(d){return v.jsx(DV,{x:d.x,y:d.y,datum:d.datum,symbol:n,size:r,color:d.fill,borderWidth:i,borderColor:d.stroke,label:d.label,labelYOffset:s,theme:c},d.id)})})}),uK=m.memo(function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,a=e.setCurrent,o=e.onMouseEnter,s=e.onMouseMove,c=e.onMouseLeave,l=e.onClick,u=e.onTouchStart,d=e.onTouchMove,f=e.onTouchEnd,h=e.tooltip,g=e.debug,p=e.enableTouchCrosshair,b=Li(),x=b.showTooltipAt,_=b.hideTooltip,y=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),o&&o(k,O)},[x,h,o,i]),C=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),s&&s(k,O)},[x,h,i.left,i.top,s]),w=m.useCallback(function(k,O){_(),c&&c(k,O)},[_,c]),T=m.useCallback(function(k,O){l&&l(k,O)},[l]),$=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),u&&u(k,O)},[i.left,i.top,u,x,h]),R=m.useCallback(function(k,O){x(m.createElement(h,{point:k}),[k.x+i.left,k.y+i.top],"top"),d&&d(k,O)},[i.left,i.top,d,x,h]),S=m.useCallback(function(k,O){_(),f&&f(k,O)},[f,_]);return v.jsx(KZ,{nodes:t,width:n,height:r,setCurrent:a,onMouseEnter:y,onMouseMove:C,onMouseLeave:w,onClick:T,onTouchStart:$,onTouchMove:R,onTouchEnd:S,enableTouchCrosshair:p,debug:g})}),dK=NC(function(e){var t=e.data,n=e.xScale,r=n===void 0?{type:"point"}:n,i=e.xFormat,a=e.yScale,o=a===void 0?{type:"linear",min:0,max:"auto"}:a,s=e.yFormat,c=e.layers,l=c===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:c,u=e.curve,d=u===void 0?"linear":u,f=e.areaBaselineValue,h=f===void 0?0:f,g=e.colors,p=g===void 0?{scheme:"nivo"}:g,b=e.margin,x=e.width,_=e.height,y=e.axisTop,C=e.axisRight,w=e.axisBottom,T=w===void 0?{}:w,$=e.axisLeft,R=$===void 0?{}:$,S=e.enableGridX,k=S===void 0||S,O=e.enableGridY,D=O===void 0||O,E=e.gridXValues,M=e.gridYValues,j=e.lineWidth,F=j===void 0?2:j,W=e.enableArea,B=W!==void 0&&W,U=e.areaOpacity,N=U===void 0?.2:U,V=e.areaBlendMode,X=V===void 0?"normal":V,ne=e.enablePoints,K=ne===void 0||ne,J=e.pointSymbol,q=e.pointSize,G=q===void 0?6:q,z=e.pointColor,L=z===void 0?{from:"color"}:z,H=e.pointBorderWidth,ee=H===void 0?0:H,A=e.pointBorderColor,se=A===void 0?{theme:"background"}:A,ce=e.enablePointLabel,ue=ce!==void 0&&ce,we=e.pointLabel,Te=we===void 0?"data.yFormatted":we,at=e.pointLabelYOffset,tt=e.defs,Be=tt===void 0?[]:tt,Ke=e.fill,Ye=Ke===void 0?[]:Ke,de=e.markers,ke=e.legends,Oe=ke===void 0?[]:ke,ve=e.isInteractive,Ie=ve===void 0||ve,Xe=e.useMesh,It=Xe!==void 0&&Xe,mt=e.debugMesh,Je=mt!==void 0&&mt,bt=e.onMouseEnter,At=e.onMouseMove,it=e.onMouseLeave,gt=e.onClick,yt=e.onTouchStart,Lt=e.onTouchMove,$e=e.onTouchEnd,Pe=e.tooltip,ze=Pe===void 0?rg:Pe,nt=e.enableSlices,vt=nt!==void 0&&nt,kt=e.debugSlices,Xt=kt!==void 0&&kt,Dt=e.sliceTooltip,Bt=Dt===void 0?pT:Dt,Ht=e.enableCrosshair,Mt=Ht===void 0||Ht,Wt=e.crosshairType,Jt=Wt===void 0?"bottom-left":Wt,Vt=e.enableTouchCrosshair,fe=Vt!==void 0&&Vt,ye=e.role,Ee=ye===void 0?"img":ye,qe=Us(x,_,b),Ge=qe.margin,ot=qe.innerWidth,P=qe.innerHeight,re=qe.outerWidth,Z=qe.outerHeight,te=gT({data:t,xScale:r,xFormat:i,yScale:o,yFormat:s,width:ot,height:P,colors:p,curve:d,areaBaselineValue:h,pointColor:L,pointBorderColor:se,enableSlices:vt}),ge=te.legendData,Ce=te.toggleSerie,pe=te.lineGenerator,be=te.areaGenerator,Ae=te.series,Me=te.xScale,et=te.yScale,Nt=te.slices,wt=te.points,Ut=ht(),le=ar(L,Ut),cn=ar(se,Ut),Ft=m.useState(null),dr=Ft[0],lg=Ft[1],ug=m.useState(null),Qa=ug[0],dg=ug[1],ni={grid:v.jsx(lT,{theme:Ut,width:ot,height:P,xScale:k?Me:null,yScale:D?et:null,xValues:E,yValues:M},"grid"),markers:v.jsx(DC,{markers:de,width:ot,height:P,xScale:Me,yScale:et,theme:Ut},"markers"),axes:v.jsx(cT,{xScale:Me,yScale:et,width:ot,height:P,theme:Ut,top:y,right:C,bottom:T,left:R},"axes"),areas:null,lines:v.jsx(oK,{lines:Ae,lineGenerator:pe,lineWidth:F},"lines"),slices:null,points:null,crosshair:null,mesh:null,legends:Oe.map(function(ri,hd){return v.jsx(Jm,hn({},ri,{containerWidth:ot,containerHeight:P,data:ri.data||ge,theme:Ut,toggleSerie:ri.toggleSerie?Ce:void 0}),"legend."+hd)})},WT=Km(Be,Ae,Ye);return B&&(ni.areas=v.jsx(iK,{areaGenerator:be,areaOpacity:N,areaBlendMode:X,lines:Ae},"areas")),Ie&&vt!==!1&&(ni.slices=v.jsx(cK,{slices:Nt,axis:vt,debug:Xt,height:P,tooltip:Bt,current:Qa,setCurrent:dg,onMouseEnter:bt,onMouseMove:At,onMouseLeave:it,onClick:gt,onTouchStart:yt,onTouchMove:Lt,onTouchEnd:$e},"slices")),K&&(ni.points=v.jsx(lK,{points:wt,symbol:J,size:G,color:le,borderWidth:ee,borderColor:cn,enableLabel:ue,label:Te,labelYOffset:at},"points")),Ie&&Mt&&(dr!==null&&(ni.crosshair=v.jsx(oh,{width:ot,height:P,x:dr.x,y:dr.y,type:Jt},"crosshair")),Qa!==null&&(ni.crosshair=v.jsx(oh,{width:ot,height:P,x:Qa.x,y:Qa.y,type:vt},"crosshair"))),Ie&&It&&vt===!1&&(ni.mesh=v.jsx(uK,{points:wt,width:ot,height:P,margin:Ge,current:dr,setCurrent:lg,onMouseEnter:bt,onMouseMove:At,onMouseLeave:it,onClick:gt,onTouchStart:yt,onTouchMove:Lt,onTouchEnd:$e,tooltip:ze,enableTouchCrosshair:fe,debug:Je},"mesh")),v.jsx(ld,{defs:WT,width:re,height:Z,margin:Ge,role:Ee,children:l.map(function(ri,hd){return typeof ri=="function"?v.jsx(m.Fragment,{children:ri(hn({},e,{innerWidth:ot,innerHeight:P,series:Ae,slices:Nt,points:wt,xScale:Me,yScale:et,lineGenerator:pe,areaGenerator:be,currentPoint:dr,setCurrentPoint:lg,currentSlice:Qa,setCurrentSlice:dg}))},hd):ni[ri]})})}),fK=function(e){return v.jsx(Ka,{children:function(t){var n=t.width,r=t.height;return v.jsx(dK,hn({width:n,height:r},e))}})},hK=NC(function(e){var t=m.useRef(null),n=e.width,r=e.height,i=e.margin,a=e.pixelRatio,o=a===void 0?typeof window<"u"&&window.devicePixelRatio||1:a,s=e.data,c=e.xScale,l=c===void 0?{type:"point"}:c,u=e.xFormat,d=e.yScale,f=d===void 0?{type:"linear",min:0,max:"auto"}:d,h=e.yFormat,g=e.curve,p=g===void 0?"linear":g,b=e.layers,x=b===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:b,_=e.colors,y=_===void 0?{scheme:"nivo"}:_,C=e.lineWidth,w=C===void 0?2:C,T=e.enableArea,$=T!==void 0&&T,R=e.areaBaselineValue,S=R===void 0?0:R,k=e.areaOpacity,O=k===void 0?.2:k,D=e.enablePoints,E=D===void 0||D,M=e.pointSize,j=M===void 0?6:M,F=e.pointColor,W=F===void 0?{from:"color"}:F,B=e.pointBorderWidth,U=B===void 0?0:B,N=e.pointBorderColor,V=N===void 0?{theme:"background"}:N,X=e.enableGridX,ne=X===void 0||X,K=e.gridXValues,J=e.enableGridY,q=J===void 0||J,G=e.gridYValues,z=e.axisTop,L=e.axisRight,H=e.axisBottom,ee=H===void 0?{}:H,A=e.axisLeft,se=A===void 0?{}:A,ce=e.legends,ue=ce===void 0?[]:ce,we=e.isInteractive,Te=we===void 0||we,at=e.debugMesh,tt=at!==void 0&&at,Be=e.onMouseLeave,Ke=e.onClick,Ye=e.tooltip,de=Ye===void 0?rg:Ye,ke=e.canvasRef,Oe=Us(n,r,i),ve=Oe.margin,Ie=Oe.innerWidth,Xe=Oe.innerHeight,It=Oe.outerWidth,mt=Oe.outerHeight,Je=ht(),bt=m.useState(null),At=bt[0],it=bt[1],gt=gT({data:s,xScale:l,xFormat:u,yScale:f,yFormat:h,width:Ie,height:Xe,colors:y,curve:p,areaBaselineValue:S,pointColor:W,pointBorderColor:V}),yt=gt.lineGenerator,Lt=gt.areaGenerator,$e=gt.series,Pe=gt.xScale,ze=gt.yScale,nt=gt.points,vt=hT({points:nt,width:Ie,height:Xe,debug:tt}),kt=vt.delaunay,Xt=vt.voronoi;m.useEffect(function(){ke&&(ke.current=t.current),t.current.width=It*o,t.current.height=mt*o;var fe=t.current.getContext("2d");fe.scale(o,o),fe.fillStyle=Je.background,fe.fillRect(0,0,It,mt),fe.translate(ve.left,ve.top),x.forEach(function(ye){if(typeof ye=="function"&&ye({ctx:fe,innerWidth:Ie,innerHeight:Xe,series:$e,points:nt,xScale:Pe,yScale:ze,lineWidth:w,lineGenerator:yt,areaGenerator:Lt,currentPoint:At,setCurrentPoint:it}),ye==="grid"&&Je.grid.line.strokeWidth>0&&(fe.lineWidth=Je.grid.line.strokeWidth,fe.strokeStyle=Je.grid.line.stroke,ne&&Cl(fe,{width:Ie,height:Xe,scale:Pe,axis:"x",values:K}),q&&Cl(fe,{width:Ie,height:Xe,scale:ze,axis:"y",values:G})),ye==="axes"&&uT(fe,{xScale:Pe,yScale:ze,width:Ie,height:Xe,top:z,right:L,bottom:ee,left:se,theme:Je}),ye==="areas"&&$===!0){fe.save(),fe.globalAlpha=O,Lt.context(fe);for(var Ee=$e.length-1;Ee>=0;Ee--)fe.fillStyle=$e[Ee].color,fe.beginPath(),Lt($e[Ee].data.map(function(Ge){return Ge.position})),fe.fill();fe.restore()}if(ye==="lines"&&(yt.context(fe),$e.forEach(function(Ge){fe.strokeStyle=Ge.color,fe.lineWidth=w,fe.beginPath(),yt(Ge.data.map(function(ot){return ot.position})),fe.stroke()})),ye==="points"&&E===!0&&j>0&&nt.forEach(function(Ge){fe.fillStyle=Ge.color,fe.beginPath(),fe.arc(Ge.x,Ge.y,j/2,0,2*Math.PI),fe.fill(),U>0&&(fe.strokeStyle=Ge.borderColor,fe.lineWidth=U,fe.stroke())}),ye==="mesh"&&tt===!0&&(XZ(fe,Xt),At&&QZ(fe,Xt,At.index)),ye==="legends"){var qe=$e.map(function(Ge){return{id:Ge.id,label:Ge.id,color:Ge.color}}).reverse();ue.forEach(function(Ge){GC(fe,hn({},Ge,{data:Ge.data||qe,containerWidth:Ie,containerHeight:Xe,theme:Je}))})}})},[t,It,mt,x,Je,yt,$e,Pe,ze,ne,K,q,G,z,L,ee,se,ue,nt,E,j,At]);var Dt=m.useCallback(function(fe){var ye=jo(t.current,fe),Ee=ye[0],qe=ye[1];if(!LC(ve.left,ve.top,Ie,Xe,Ee,qe))return null;var Ge=kt.find(Ee-ve.left,qe-ve.top);return nt[Ge]},[t,ve,Ie,Xe,kt]),Bt=Li(),Ht=Bt.showTooltipFromEvent,Mt=Bt.hideTooltip,Wt=m.useCallback(function(fe){var ye=Dt(fe);it(ye),ye?Ht(m.createElement(de,{point:ye}),fe):Mt()},[Dt,it,Ht,Mt,de]),Jt=m.useCallback(function(fe){Mt(),it(null),At&&Be&&Be(At,fe)},[Mt,it,Be]),Vt=m.useCallback(function(fe){if(Ke){var ye=Dt(fe);ye&&Ke(ye,fe)}},[Dt,Ke]);return v.jsx("canvas",{ref:t,width:It*o,height:mt*o,style:{width:It,height:mt,cursor:Te?"auto":"normal"},onMouseEnter:Te?Wt:void 0,onMouseMove:Te?Wt:void 0,onMouseLeave:Te?Jt:void 0,onClick:Te?Vt:void 0})}),pK=m.forwardRef(function(e,t){return v.jsx(hK,hn({},e,{canvasRef:t}))});m.forwardRef(function(e,t){return v.jsx(Ka,{children:function(n){var r=n.width,i=n.height;return v.jsx(pK,hn({width:r,height:i},e,{ref:t}))}})});var mK=JC;function gK(e,t){var n=[];return mK(e,function(r,i,a){t(r,i,a)&&n.push(r)}),n}var vK=gK,bK=pC,yK=vK,xK=eg,_K=Cn;function wK(e,t){var n=_K(e)?bK:yK;return n(e,xK(t))}var CK=wK;const TK=Rt(CK);var kK=Or,SK=Nn,OK="[object Number]";function EK(e){return typeof e=="number"||SK(e)&&kK(e)==OK}var MK=EK;const Jb=Rt(MK);function $K(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var RK=$K,AK=Va,jK=Ws;function PK(e,t){return e&&AK(t,jK(t),e)}var IK=PK,DK=Va,NK=Fs;function FK(e,t){return e&&DK(t,NK(t),e)}var LK=FK,BK=Va,WK=Vm;function UK(e,t){return BK(e,WK(e),t)}var zK=UK,HK=zm,VK=tm,qK=Vm,YK=mC,GK=Object.getOwnPropertySymbols,ZK=GK?function(e){for(var t=[];e;)HK(t,qK(e)),e=VK(e);return t}:YK,vT=ZK,KK=Va,XK=vT;function QK(e,t){return KK(e,XK(e),t)}var JK=QK,eX=hC,tX=vT,nX=Fs;function rX(e){return eX(e,nX,tX)}var bT=rX,iX=Object.prototype,aX=iX.hasOwnProperty;function oX(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&aX.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var sX=oX,cX=em;function lX(e,t){var n=t?cX(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var uX=lX,dX=/\w*$/;function fX(e){var t=new e.constructor(e.source,dX.exec(e));return t.lastIndex=e.lastIndex,t}var hX=fX,ey=La,ty=ey?ey.prototype:void 0,ny=ty?ty.valueOf:void 0;function pX(e){return ny?Object(ny.call(e)):{}}var mX=pX,gX=em,vX=uX,bX=hX,yX=mX,xX=R_,_X="[object Boolean]",wX="[object Date]",CX="[object Map]",TX="[object Number]",kX="[object RegExp]",SX="[object Set]",OX="[object String]",EX="[object Symbol]",MX="[object ArrayBuffer]",$X="[object DataView]",RX="[object Float32Array]",AX="[object Float64Array]",jX="[object Int8Array]",PX="[object Int16Array]",IX="[object Int32Array]",DX="[object Uint8Array]",NX="[object Uint8ClampedArray]",FX="[object Uint16Array]",LX="[object Uint32Array]";function BX(e,t,n){var r=e.constructor;switch(t){case MX:return gX(e);case _X:case wX:return new r(+e);case $X:return vX(e,n);case RX:case AX:case jX:case PX:case IX:case DX:case NX:case FX:case LX:return xX(e,n);case CX:return new r;case TX:case OX:return new r(e);case kX:return bX(e);case SX:return new r;case EX:return yX(e)}}var WX=BX,UX=od,zX=Nn,HX="[object Map]";function VX(e){return zX(e)&&UX(e)==HX}var qX=VX,YX=qX,GX=Ha,ry=vu,iy=ry&&ry.isMap,ZX=iy?GX(iy):YX,KX=ZX,XX=od,QX=Nn,JX="[object Set]";function eQ(e){return QX(e)&&XX(e)==JX}var tQ=eQ,nQ=tQ,rQ=Ha,ay=vu,oy=ay&&ay.isSet,iQ=oy?rQ(oy):nQ,aQ=iQ,oQ=pu,sQ=RK,cQ=sm,lQ=IK,uQ=LK,dQ=M_,fQ=A_,hQ=zK,pQ=JK,mQ=gC,gQ=bT,vQ=od,bQ=sX,yQ=WX,xQ=P_,_Q=Cn,wQ=gu,CQ=KX,TQ=ur,kQ=aQ,SQ=Ws,OQ=Fs,EQ=1,MQ=2,$Q=4,yT="[object Arguments]",RQ="[object Array]",AQ="[object Boolean]",jQ="[object Date]",PQ="[object Error]",xT="[object Function]",IQ="[object GeneratorFunction]",DQ="[object Map]",NQ="[object Number]",_T="[object Object]",FQ="[object RegExp]",LQ="[object Set]",BQ="[object String]",WQ="[object Symbol]",UQ="[object WeakMap]",zQ="[object ArrayBuffer]",HQ="[object DataView]",VQ="[object Float32Array]",qQ="[object Float64Array]",YQ="[object Int8Array]",GQ="[object Int16Array]",ZQ="[object Int32Array]",KQ="[object Uint8Array]",XQ="[object Uint8ClampedArray]",QQ="[object Uint16Array]",JQ="[object Uint32Array]",Ct={};Ct[yT]=Ct[RQ]=Ct[zQ]=Ct[HQ]=Ct[AQ]=Ct[jQ]=Ct[VQ]=Ct[qQ]=Ct[YQ]=Ct[GQ]=Ct[ZQ]=Ct[DQ]=Ct[NQ]=Ct[_T]=Ct[FQ]=Ct[LQ]=Ct[BQ]=Ct[WQ]=Ct[KQ]=Ct[XQ]=Ct[QQ]=Ct[JQ]=!0;Ct[PQ]=Ct[xT]=Ct[UQ]=!1;function $c(e,t,n,r,i,a){var o,s=t&EQ,c=t&MQ,l=t&$Q;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!TQ(e))return e;var u=_Q(e);if(u){if(o=bQ(e),!s)return fQ(e,o)}else{var d=vQ(e),f=d==xT||d==IQ;if(wQ(e))return dQ(e,s);if(d==_T||d==yT||f&&!i){if(o=c||f?{}:xQ(e),!s)return c?pQ(e,uQ(o,e)):hQ(e,lQ(o,e))}else{if(!Ct[d])return i?e:{};o=yQ(e,d,s)}}a||(a=new oQ);var h=a.get(e);if(h)return h;a.set(e,o),kQ(e)?e.forEach(function(b){o.add($c(b,t,n,b,e,a))}):CQ(e)&&e.forEach(function(b,x){o.set(x,$c(b,t,n,x,e,a))});var g=l?c?gQ:mQ:c?OQ:SQ,p=u?void 0:g(e);return sQ(p||e,function(b,x){p&&(x=b,b=e[x]),cQ(o,x,$c(b,t,n,x,e,a))}),o}var eJ=$c;function tJ(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}var nJ=tJ,rJ=Ls,iJ=nJ;function aJ(e,t){return t.length<2?e:rJ(e,iJ(t,0,-1))}var oJ=aJ,sJ=qa,cJ=tw,lJ=oJ,uJ=Ya;function dJ(e,t){return t=sJ(t,e),e=lJ(e,t),e==null||delete e[uJ(cJ(t))]}var fJ=dJ,hJ=im;function pJ(e){return hJ(e)?void 0:e}var mJ=pJ,gJ=_u,vJ=eJ,bJ=fJ,yJ=qa,xJ=Va,_J=mJ,wJ=dC,CJ=bT,TJ=1,kJ=2,SJ=4,OJ=wJ(function(e,t){var n={};if(e==null)return n;var r=!1;t=gJ(t,function(a){return a=yJ(a,e),r||(r=a.length>1),a}),xJ(e,CJ(e),n),r&&(n=vJ(n,TJ|kJ|SJ,_J));for(var i=t.length;i--;)bJ(n,t[i]);return n}),EJ=OJ;const wT=Rt(EJ);function or(){return or=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},or.apply(this,arguments)}var $h={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},MJ=function(e){var t=typeof e;return m.isValidElement(e)||t==="string"||t==="function"||t==="object"},$J=function(e){var t=typeof e;return t==="string"||t==="function"},xs=function(e){return e.type==="circle"},Rh=function(e){return e.type==="dot"},_s=function(e){return e.type==="rect"},RJ=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return n.reduce(function(a,o){var s=o.offset||0;return[].concat(a,TK(t,o.match).map(function(c){var l=r(c),u=i(c);return(xs(o)||_s(o))&&(u.size=u.size+2*s,u.width=u.width+2*s,u.height=u.height+2*s),or({},wT(o,["match","offset"]),l,u,{size:o.size||u.size,datum:c})}))},[])},AJ=function(e,t,n,r){var i=Math.atan2(r-t,n-e);return RV(cd(i))},CT=function(e){var t,n,r=e.x,i=e.y,a=e.noteX,o=e.noteY,s=e.noteWidth,c=s===void 0?$h.noteWidth:s,l=e.noteTextOffset,u=l===void 0?$h.noteTextOffset:l;if(Jb(a))t=r+a;else{if(a.abs===void 0)throw new Error("noteX should be either a number or an object containing an 'abs' property");t=a.abs}if(Jb(o))n=i+o;else{if(o.abs===void 0)throw new Error("noteY should be either a number or an object containing an 'abs' property");n=o.abs}var d=r,f=i,h=AJ(r,i,t,n);if(xs(e)){var g=Ci(An(h),e.size/2);d+=g.x,f+=g.y}if(_s(e)){var p=Math.round((h+90)/45)%8;p===0&&(f-=e.height/2),p===1&&(d+=e.width/2,f-=e.height/2),p===2&&(d+=e.width/2),p===3&&(d+=e.width/2,f+=e.height/2),p===4&&(f+=e.height/2),p===5&&(d-=e.width/2,f+=e.height/2),p===6&&(d-=e.width/2),p===7&&(d-=e.width/2,f-=e.height/2)}var b=t,x=t;return(h+90)%360>180?(b-=c,x-=c):x+=c,{points:[[d,f],[t,n],[x,n]],text:[b,n-u],angle:h+90}},TT=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return m.useMemo(function(){return RJ({data:t,annotations:n,getPosition:r,getDimensions:i})},[t,n,r,i])},jJ=function(e){var t=e.annotations;return m.useMemo(function(){return t.map(function(n){return or({},n,{computed:CT(or({},n))})})},[t])},PJ=function(e){return m.useMemo(function(){return CT(e)},[e])},IJ=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,a=ht(),o=mn(),s=o.animate,c=o.config,l=cr({x:n,y:r,config:c,immediate:!s});return typeof i=="function"?m.createElement(i,{x:n,y:r,datum:t}):v.jsxs(v.Fragment,{children:[a.annotations.text.outlineWidth>0&&v.jsx(ft.text,{x:l.x,y:l.y,style:or({},a.annotations.text,{strokeLinejoin:"round",strokeWidth:2*a.annotations.text.outlineWidth,stroke:a.annotations.text.outlineColor}),children:i}),v.jsx(ft.text,{x:l.x,y:l.y,style:wT(a.annotations.text,["outlineWidth","outlineColor"]),children:i})]})},sy=function(e){var t=e.points,n=e.isOutline,r=n!==void 0&&n,i=ht(),a=m.useMemo(function(){var c=t[0];return t.slice(1).reduce(function(l,u){return l+" L"+u[0]+","+u[1]},"M"+c[0]+","+c[1])},[t]),o=Ym(a);if(r&&i.annotations.link.outlineWidth<=0)return null;var s=or({},i.annotations.link);return r&&(s.strokeLinecap="square",s.strokeWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,s.stroke=i.annotations.link.outlineColor,s.opacity=i.annotations.link.outlineOpacity),v.jsx(ft.path,{fill:"none",d:o,style:s})},DJ=function(e){var t=e.x,n=e.y,r=e.size,i=ht(),a=mn(),o=a.animate,s=a.config,c=cr({x:t,y:n,radius:r/2,config:s,immediate:!o});return v.jsxs(v.Fragment,{children:[i.annotations.outline.outlineWidth>0&&v.jsx(ft.circle,{cx:c.x,cy:c.y,r:c.radius,style:or({},i.annotations.outline,{fill:"none",strokeWidth:i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,stroke:i.annotations.outline.outlineColor,opacity:i.annotations.outline.outlineOpacity})}),v.jsx(ft.circle,{cx:c.x,cy:c.y,r:c.radius,style:i.annotations.outline})]})},NJ=function(e){var t=e.x,n=e.y,r=e.size,i=r===void 0?$h.dotSize:r,a=ht(),o=mn(),s=o.animate,c=o.config,l=cr({x:t,y:n,radius:i/2,config:c,immediate:!s});return v.jsxs(v.Fragment,{children:[a.annotations.outline.outlineWidth>0&&v.jsx(ft.circle,{cx:l.x,cy:l.y,r:l.radius,style:or({},a.annotations.outline,{fill:"none",strokeWidth:2*a.annotations.outline.outlineWidth,stroke:a.annotations.outline.outlineColor,opacity:a.annotations.outline.outlineOpacity})}),v.jsx(ft.circle,{cx:l.x,cy:l.y,r:l.radius,style:a.annotations.symbol})]})},FJ=function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.borderRadius,o=a===void 0?6:a,s=ht(),c=mn(),l=c.animate,u=c.config,d=cr({x:t-r/2,y:n-i/2,width:r,height:i,config:u,immediate:!l});return v.jsxs(v.Fragment,{children:[s.annotations.outline.outlineWidth>0&&v.jsx(ft.rect,{x:d.x,y:d.y,rx:o,ry:o,width:d.width,height:d.height,style:or({},s.annotations.outline,{fill:"none",strokeWidth:s.annotations.outline.strokeWidth+2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),v.jsx(ft.rect,{x:d.x,y:d.y,rx:o,ry:o,width:d.width,height:d.height,style:s.annotations.outline})]})},LJ=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,a=PJ(e);if(!MJ(i))throw new Error("note should be a valid react element");return v.jsxs(v.Fragment,{children:[v.jsx(sy,{points:a.points,isOutline:!0}),xs(e)&&v.jsx(DJ,{x:n,y:r,size:e.size}),Rh(e)&&v.jsx(NJ,{x:n,y:r,size:e.size}),_s(e)&&v.jsx(FJ,{x:n,y:r,width:e.width,height:e.height,borderRadius:e.borderRadius}),v.jsx(sy,{points:a.points}),v.jsx(IJ,{datum:t,x:a.text[0],y:a.text[1],note:i})]})},cy=function(e,t){t.forEach(function(n,r){var i=n[0],a=n[1];r===0?e.moveTo(i,a):e.lineTo(i,a)})},BJ=function(e,t){var n=t.annotations,r=t.theme;n.length!==0&&(e.save(),n.forEach(function(i){if(!$J(i.note))throw new Error("note is invalid for canvas implementation");r.annotations.link.outlineWidth>0&&(e.lineCap="square",e.strokeStyle=r.annotations.link.outlineColor,e.lineWidth=r.annotations.link.strokeWidth+2*r.annotations.link.outlineWidth,e.beginPath(),cy(e,i.computed.points),e.stroke(),e.lineCap="butt"),xs(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),Rh(i)&&r.annotations.symbol.outlineWidth>0&&(e.strokeStyle=r.annotations.symbol.outlineColor,e.lineWidth=2*r.annotations.symbol.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),_s(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),e.strokeStyle=r.annotations.link.stroke,e.lineWidth=r.annotations.link.strokeWidth,e.beginPath(),cy(e,i.computed.points),e.stroke(),xs(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),Rh(i)&&(e.fillStyle=r.annotations.symbol.fill,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.fill()),_s(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),typeof i.note=="function"?i.note(e,{datum:i.datum,x:i.computed.text[0],y:i.computed.text[1],theme:r}):(e.font=r.annotations.text.fontSize+"px "+r.annotations.text.fontFamily,e.textAlign="left",e.textBaseline="alphabetic",e.fillStyle=r.annotations.text.fill,e.strokeStyle=r.annotations.text.outlineColor,e.lineWidth=2*r.annotations.text.outlineWidth,r.annotations.text.outlineWidth>0&&(e.lineJoin="round",e.strokeText(i.note,i.computed.text[0],i.computed.text[1]),e.lineJoin="miter"),e.fillText(i.note,i.computed.text[0],i.computed.text[1]))}),e.restore())};function pt(){return pt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pt.apply(this,arguments)}function Xa(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var ly,WJ=function(e){var t=e.bars,n=e.annotations,r=TT({data:t,annotations:n,getPosition:function(i){return{x:i.x+i.width/2,y:i.y+i.height/2}},getDimensions:function(i){var a=i.height,o=i.width;return{width:o,height:a,size:Math.max(o,a)}}});return v.jsx(v.Fragment,{children:r.map(function(i,a){return v.jsx(LJ,pt({},i),a)})})},UJ=function(e){var t=e.width,n=e.height,r=e.legends,i=e.toggleSerie;return v.jsx(v.Fragment,{children:r.map(function(a,o){var s,c=a[0],l=a[1];return v.jsx(Jm,pt({},c,{containerWidth:t,containerHeight:n,data:(s=c.data)!=null?s:l,toggleSerie:c.toggleSerie&&c.dataFrom==="keys"?i:void 0}),o)})})},zJ=["data"],HJ=function(e){var t,n=e.bar,r=n.data,i=Xa(n,zJ),a=e.style,o=a.borderColor,s=a.color,c=a.height,l=a.labelColor,u=a.labelOpacity,d=a.labelX,f=a.labelY,h=a.transform,g=a.width,p=e.borderRadius,b=e.borderWidth,x=e.label,_=e.shouldRenderLabel,y=e.isInteractive,C=e.onClick,w=e.onMouseEnter,T=e.onMouseLeave,$=e.tooltip,R=e.isFocusable,S=e.ariaLabel,k=e.ariaLabelledBy,O=e.ariaDescribedBy,D=ht(),E=Li(),M=E.showTooltipFromEvent,j=E.showTooltipAt,F=E.hideTooltip,W=m.useMemo(function(){return function(){return m.createElement($,pt({},i,r))}},[$,i,r]),B=m.useCallback(function(K){C==null||C(pt({color:i.color},r),K)},[i,r,C]),U=m.useCallback(function(K){return M(W(),K)},[M,W]),N=m.useCallback(function(K){w==null||w(r,K),M(W(),K)},[r,w,M,W]),V=m.useCallback(function(K){T==null||T(r,K),F()},[r,F,T]),X=m.useCallback(function(){j(W(),[i.absX+i.width/2,i.absY])},[j,W,i]),ne=m.useCallback(function(){F()},[F]);return v.jsxs(ft.g,{transform:h,children:[v.jsx(ft.rect,{width:Zr(g,function(K){return Math.max(K,0)}),height:Zr(c,function(K){return Math.max(K,0)}),rx:p,ry:p,fill:(t=r.fill)!=null?t:s,strokeWidth:b,stroke:o,focusable:R,tabIndex:R?0:void 0,"aria-label":S?S(r):void 0,"aria-labelledby":k?k(r):void 0,"aria-describedby":O?O(r):void 0,onMouseEnter:y?N:void 0,onMouseMove:y?U:void 0,onMouseLeave:y?V:void 0,onClick:y?B:void 0,onFocus:y&&R?X:void 0,onBlur:y&&R?ne:void 0}),_&&v.jsx(ft.text,{x:d,y:f,textAnchor:"middle",dominantBaseline:"central",fillOpacity:u,style:pt({},D.labels.text,{pointerEvents:"none",fill:l}),children:x})]})},VJ=["color","label"],qJ=function(e){var t=e.color,n=e.label,r=Xa(e,VJ);return v.jsx(Zp,{id:n,value:r.formattedValue,enableChip:!0,color:t})},xt={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",reverse:!1,minValue:"auto",maxValue:"auto",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},padding:.1,innerPadding:0,axisBottom:{},axisLeft:{},enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{from:"theme",theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:qJ,tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],markers:[],enableTotals:!1,totalsOffset:10},St=pt({},xt,{layers:["grid","axes","bars","totals","markers","legends","annotations"],barComponent:HJ,defs:[],fill:[],animate:!0,motionConfig:"default",role:"img",isFocusable:!1}),Qt=pt({},xt,{layers:["grid","axes","bars","totals","legends","annotations"],pixelRatio:typeof window<"u"&&(ly=window.devicePixelRatio)!=null?ly:1}),kT=function(e,t,n,r,i,a){return ys(r,{all:e.map(t),min:0,max:0},i,a).padding(n)},ST=function(e,t){return e.map(function(n){return pt({},t.reduce(function(r,i){return r[i]=null,r},{}),n)})},ud=function(e){return Object.keys(e).reduce(function(t,n){return e[n]&&(t[n]=e[n]),t},{})},dd=function(e){return[e,Number(e)]},YJ=["layout","minValue","maxValue","reverse","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],ig=function(e,t){return e>t},OT=function(e,t){return e<t},ET=function(e,t){return Array.from(" ".repeat(t-e),function(n,r){return e+r})},GJ=function(e){return ig(e,0)?0:e},ZJ=function(e,t,n,r){var i=e.data,a=e.formatValue,o=e.getColor,s=e.getIndex,c=e.getTooltipLabel,l=e.innerPadding,u=l===void 0?0:l,d=e.keys,f=e.xScale,h=e.yScale,g=e.margin,p=n?OT:ig,b=i.map(ud),x=[];return d.forEach(function(_,y){return ET(0,f.domain().length).forEach(function(C){var w,T,$,R=dd(i[C][_]),S=R[0],k=R[1],O=s(i[C]),D=((w=f(O))!=null?w:0)+t*y+u*y,E=p(T=k,0)?($=h(T))!=null?$:0:r,M=function(F,W){var B;return p(F,0)?r-W:((B=h(F))!=null?B:0)-r}(k,E),j={id:_,value:S===null?S:k,formattedValue:a(k),hidden:!1,index:C,indexValue:O,data:b[C]};x.push({key:_+"."+j.indexValue,index:x.length,data:j,x:D,y:E,absX:g.left+D,absY:g.top+E,width:t,height:M,color:o(j),label:c(j)})})}),x},KJ=function(e,t,n,r){var i=e.data,a=e.formatValue,o=e.getIndex,s=e.getColor,c=e.getTooltipLabel,l=e.keys,u=e.innerPadding,d=u===void 0?0:u,f=e.xScale,h=e.yScale,g=e.margin,p=n?OT:ig,b=i.map(ud),x=[];return l.forEach(function(_,y){return ET(0,h.domain().length).forEach(function(C){var w,T,$,R=dd(i[C][_]),S=R[0],k=R[1],O=o(i[C]),D=p(T=k,0)?r:($=f(T))!=null?$:0,E=((w=h(O))!=null?w:0)+t*y+d*y,M=function(F,W){var B;return p(F,0)?((B=f(F))!=null?B:0)-r:r-W}(k,D),j={id:_,value:S===null?S:k,formattedValue:a(k),hidden:!1,index:C,indexValue:O,data:b[C]};x.push({key:_+"."+j.indexValue,index:x.length,data:j,x:D,y:E,absX:g.left+D,absY:g.top+E,width:M,height:t,color:s(j),label:c(j)})})}),x},XJ=function(e){var t,n,r=e.layout,i=e.minValue,a=e.maxValue,o=e.reverse,s=e.width,c=e.height,l=e.padding,u=l===void 0?0:l,d=e.innerPadding,f=d===void 0?0:d,h=e.valueScale,g=e.indexScale,p=e.hiddenIds,b=p===void 0?[]:p,x=Xa(e,YJ),_=x.keys.filter(function(N){return!b.includes(N)}),y=ST(x.data,_),C=r==="vertical"?["y","x",s]:["x","y",c],w=C[0],T=C[1],$=C[2],R=kT(y,x.getIndex,u,g,$,T),S=pt({max:a,min:i,reverse:o},h),k=S.min==="auto"?GJ:function(N){return N},O=y.reduce(function(N,V){return[].concat(N,_.map(function(X){return V[X]}))},[]).filter(Boolean),D=k(Math.min.apply(Math,O)),E=(n=Math.max.apply(Math,O),isFinite(n)?n:0),M=ys(S,{all:O,min:D,max:E},w==="x"?s:c,w),j=r==="vertical"?[R,M]:[M,R],F=j[0],W=j[1],B=(R.bandwidth()-f*(_.length-1))/_.length,U=[pt({},x,{data:y,keys:_,innerPadding:f,xScale:F,yScale:W}),B,S.reverse,(t=M(0))!=null?t:0];return{xScale:F,yScale:W,bars:B>0?r==="vertical"?ZJ.apply(void 0,U):KJ.apply(void 0,U):[]}},QJ=["data","layout","minValue","maxValue","reverse","width","height","padding","valueScale","indexScale","hiddenIds"],JJ=function e(t){var n;return t.some(Array.isArray)?e((n=[]).concat.apply(n,t)):t},eee=function(e,t,n){var r=e.formatValue,i=e.getColor,a=e.getIndex,o=e.getTooltipLabel,s=e.innerPadding,c=e.stackedData,l=e.xScale,u=e.yScale,d=e.margin,f=[];return c.forEach(function(h){return l.domain().forEach(function(g,p){var b,x,_=h[p],y=(b=l(a(_.data)))!=null?b:0,C=((x=function(k){return u(k[n?0:1])}(_))!=null?x:0)+.5*s,w=function(k,O){var D;return((D=u(k[n?1:0]))!=null?D:0)-O}(_,C)-s,T=dd(_.data[h.key]),$=T[0],R=T[1],S={id:h.key,value:$===null?$:R,formattedValue:r(R),hidden:!1,index:p,indexValue:g,data:ud(_.data)};f.push({key:h.key+"."+g,index:f.length,data:S,x:y,y:C,absX:d.left+y,absY:d.top+C,width:t,height:w,color:i(S),label:o(S)})})}),f},tee=function(e,t,n){var r=e.formatValue,i=e.getColor,a=e.getIndex,o=e.getTooltipLabel,s=e.innerPadding,c=e.stackedData,l=e.xScale,u=e.yScale,d=e.margin,f=[];return c.forEach(function(h){return u.domain().forEach(function(g,p){var b,x,_=h[p],y=(b=u(a(_.data)))!=null?b:0,C=((x=function(k){return l(k[n?1:0])}(_))!=null?x:0)+.5*s,w=function(k,O){var D;return((D=l(k[n?0:1]))!=null?D:0)-O}(_,C)-s,T=dd(_.data[h.key]),$=T[0],R=T[1],S={id:h.key,value:$===null?$:R,formattedValue:r(R),hidden:!1,index:p,indexValue:g,data:ud(_.data)};f.push({key:h.key+"."+g,index:f.length,data:S,x:C,y,absX:d.left+C,absY:d.top+y,width:w,height:t,color:i(S),label:o(S)})})}),f},nee=function(e){var t,n=e.data,r=e.layout,i=e.minValue,a=e.maxValue,o=e.reverse,s=e.width,c=e.height,l=e.padding,u=l===void 0?0:l,d=e.valueScale,f=e.indexScale,h=e.hiddenIds,g=h===void 0?[]:h,p=Xa(e,QJ),b=p.keys.filter(function(B){return!g.includes(B)}),x=BU().keys(b).offset(WU)(ST(n,b)),_=r==="vertical"?["y","x",s]:["x","y",c],y=_[0],C=_[1],w=_[2],T=kT(n,p.getIndex,u,f,w,C),$=pt({max:a,min:i,reverse:o},d),R=(t=JJ(x),d.type==="log"?t.filter(function(B){return B!==0}):t),S=Math.min.apply(Math,R),k=Math.max.apply(Math,R),O=ys($,{all:R,min:S,max:k},y==="x"?s:c,y),D=r==="vertical"?[T,O]:[O,T],E=D[0],M=D[1],j=p.innerPadding>0?p.innerPadding:0,F=T.bandwidth(),W=[pt({},p,{innerPadding:j,stackedData:x,xScale:E,yScale:M}),F,$.reverse];return{xScale:E,yScale:M,bars:F>0?r==="vertical"?eee.apply(void 0,W):tee.apply(void 0,W):[]}},ree=function(e){var t=e.bars,n=e.direction,r=e.from,i=e.groupMode,a=e.layout,o=e.legendLabel,s=e.reverse,c=FC(o??(r==="indexes"?"indexValue":"id"));return r==="indexes"?function(l,u,d){var f=Oh(l.map(function(h){var g,p;return{id:(g=h.data.indexValue)!=null?g:"",label:d(h.data),hidden:h.data.hidden,color:(p=h.color)!=null?p:"#000"}}),function(h){return h.id});return u==="horizontal"&&f.reverse(),f}(t,a,c):function(l,u,d,f,h,g){var p=Oh(l.map(function(b){var x;return{id:b.data.id,label:g(b.data),hidden:b.data.hidden,color:(x=b.color)!=null?x:"#000"}}),function(b){return b.id});return(u==="vertical"&&f==="stacked"&&d==="column"&&h!==!0||u==="horizontal"&&f==="stacked"&&h===!0)&&p.reverse(),p}(t,a,n,i,s,c)},uy=function(e,t,n){var r=e.get(t)||0;e.set(t,r+n)},iee=function(e,t,n){var r=e.get(t)||0;e.set(t,r+(n>0?n:0))},aee=function(e,t,n){var r=e.get(t)||0;e.set(t,Math.max(r,Number(n)))},oee=function(e,t){var n=e.get(t)||0;e.set(t,n+1)},MT=function(e){var t=e.indexBy,n=t===void 0?xt.indexBy:t,r=e.keys,i=r===void 0?xt.keys:r,a=e.label,o=a===void 0?xt.label:a,s=e.tooltipLabel,c=s===void 0?xt.tooltipLabel:s,l=e.valueFormat,u=e.colors,d=u===void 0?xt.colors:u,f=e.colorBy,h=f===void 0?xt.colorBy:f,g=e.borderColor,p=g===void 0?xt.borderColor:g,b=e.labelTextColor,x=b===void 0?xt.labelTextColor:b,_=e.groupMode,y=_===void 0?xt.groupMode:_,C=e.layout,w=C===void 0?xt.layout:C,T=e.reverse,$=T===void 0?xt.reverse:T,R=e.data,S=e.minValue,k=S===void 0?xt.minValue:S,O=e.maxValue,D=O===void 0?xt.maxValue:O,E=e.margin,M=e.width,j=e.height,F=e.padding,W=F===void 0?xt.padding:F,B=e.innerPadding,U=B===void 0?xt.innerPadding:B,N=e.valueScale,V=N===void 0?xt.valueScale:N,X=e.indexScale,ne=X===void 0?xt.indexScale:X,K=e.initialHiddenIds,J=K===void 0?xt.initialHiddenIds:K,q=e.enableLabel,G=q===void 0?xt.enableLabel:q,z=e.labelSkipWidth,L=z===void 0?xt.labelSkipWidth:z,H=e.labelSkipHeight,ee=H===void 0?xt.labelSkipHeight:H,A=e.legends,se=A===void 0?xt.legends:A,ce=e.legendLabel,ue=e.totalsOffset,we=ue===void 0?xt.totalsOffset:ue,Te=m.useState(J??[]),at=Te[0],tt=Te[1],Be=m.useCallback(function($e){tt(function(Pe){return Pe.indexOf($e)>-1?Pe.filter(function(ze){return ze!==$e}):[].concat(Pe,[$e])})},[]),Ke=Ti(n),Ye=Ti(o),de=Ti(c),ke=Ma(l),Oe=ht(),ve=Xm(d,h),Ie=ar(p,Oe),Xe=ar(x,Oe),It=(y==="grouped"?XJ:nee)({layout:w,reverse:$,data:R,getIndex:Ke,keys:i,minValue:k,maxValue:D,width:M,height:j,getColor:ve,padding:W,innerPadding:U,valueScale:V,indexScale:ne,hiddenIds:at,formatValue:ke,getTooltipLabel:de,margin:E}),mt=It.bars,Je=It.xScale,bt=It.yScale,At=m.useMemo(function(){return mt.filter(function($e){return $e.data.value!==null}).map(function($e,Pe){return pt({},$e,{index:Pe})})},[mt]),it=m.useCallback(function($e){var Pe=$e.width,ze=$e.height;return!!G&&!(L>0&&Pe<L)&&!(ee>0&&ze<ee)},[G,L,ee]),gt=m.useMemo(function(){return i.map(function($e){var Pe=mt.find(function(ze){return ze.data.id===$e});return pt({},Pe,{data:pt({id:$e},Pe==null?void 0:Pe.data,{hidden:at.includes($e)})})})},[at,i,mt]),yt=m.useMemo(function(){return se.map(function($e){return[$e,ree({bars:$e.dataFrom==="keys"?gt:mt,direction:$e.direction,from:$e.dataFrom,groupMode:y,layout:w,legendLabel:ce,reverse:$})]})},[se,gt,mt,y,w,ce,$]),Lt=m.useMemo(function(){return function($e,Pe,ze,nt,vt,kt,Xt){nt===void 0&&(nt=xt.layout),vt===void 0&&(vt=xt.groupMode);var Dt=[];if($e.length===0)return Dt;var Bt=new Map,Ht=$e[0].width,Mt=$e[0].height;if(vt==="stacked"){var Wt=new Map;$e.forEach(function(fe){var ye=fe.data,Ee=ye.indexValue,qe=ye.value;uy(Bt,Ee,Number(qe)),iee(Wt,Ee,Number(qe))}),Wt.forEach(function(fe,ye){var Ee,qe,Ge,ot=Bt.get(ye)||0;nt==="vertical"?(Ee=Pe(ye),qe=ze(fe),Ge=ze(fe/2)):(Ee=Pe(fe),qe=ze(ye),Ge=Pe(fe/2)),Ee+=nt==="vertical"?Ht/2:kt,qe+=nt==="vertical"?-kt:Mt/2,Dt.push({key:"total_"+ye,x:Ee,y:qe,value:ot,formattedValue:Xt(ot),animationOffset:Ge})})}else if(vt==="grouped"){var Jt=new Map,Vt=new Map;$e.forEach(function(fe){var ye=fe.data,Ee=ye.indexValue,qe=ye.value;uy(Bt,Ee,Number(qe)),aee(Jt,Ee,Number(qe)),oee(Vt,Ee)}),Jt.forEach(function(fe,ye){var Ee,qe,Ge,ot=Bt.get(ye)||0,P=Vt.get(ye);nt==="vertical"?(Ee=Pe(ye),qe=ze(fe),Ge=ze(fe/2)):(Ee=Pe(fe),qe=ze(ye),Ge=Pe(fe/2)),Ee+=nt==="vertical"?P*Ht/2:kt,qe+=nt==="vertical"?-kt:P*Mt/2,Dt.push({key:"total_"+ye,x:Ee,y:qe,value:ot,formattedValue:Xt(ot),animationOffset:Ge})})}return Dt}(mt,Je,bt,w,y,we,ke)},[mt,Je,bt,w,y,we,ke]);return{bars:mt,barsWithValue:At,xScale:Je,yScale:bt,getIndex:Ke,getLabel:Ye,getTooltipLabel:de,formatValue:ke,getColor:ve,getBorderColor:Ie,getLabelColor:Xe,shouldRenderBarLabel:it,hiddenIds:at,toggleSerie:Be,legendsWithData:yt,barTotals:Lt}},see=function(e){var t=e.data,n=e.springConfig,r=e.animate,i=e.layout,a=i===void 0?St.layout:i,o=ht();return Fi(t,{keys:function(s){return s.key},from:function(s){return{x:a==="vertical"?s.x:s.animationOffset,y:a==="vertical"?s.animationOffset:s.y,labelOpacity:0}},enter:function(s){return{x:s.x,y:s.y,labelOpacity:1}},update:function(s){return{x:s.x,y:s.y,labelOpacity:1}},leave:function(s){return{x:a==="vertical"?s.x:s.animationOffset,y:a==="vertical"?s.animationOffset:s.y,labelOpacity:0}},config:n,immediate:!r,initial:r?void 0:null})(function(s,c){return v.jsx(ft.text,{x:s.x,y:s.y,fillOpacity:s.labelOpacity,style:pt({},o.labels.text,{pointerEvents:"none",fill:o.text.fill}),fontWeight:"bold",fontSize:o.labels.text.fontSize,fontFamily:o.labels.text.fontFamily,textAnchor:a==="vertical"?"middle":"start",alignmentBaseline:a==="vertical"?"alphabetic":"middle",children:c.formattedValue},c.key)})},cee=["isInteractive","animate","motionConfig","theme","renderWrapper"],lee=function(e){var t=e.data,n=e.indexBy,r=e.keys,i=e.margin,a=e.width,o=e.height,s=e.groupMode,c=e.layout,l=e.reverse,u=e.minValue,d=e.maxValue,f=e.valueScale,h=e.indexScale,g=e.padding,p=e.innerPadding,b=e.axisTop,x=e.axisRight,_=e.axisBottom,y=_===void 0?St.axisBottom:_,C=e.axisLeft,w=C===void 0?St.axisLeft:C,T=e.enableGridX,$=T===void 0?St.enableGridX:T,R=e.enableGridY,S=R===void 0?St.enableGridY:R,k=e.gridXValues,O=e.gridYValues,D=e.layers,E=D===void 0?St.layers:D,M=e.barComponent,j=M===void 0?St.barComponent:M,F=e.enableLabel,W=F===void 0?St.enableLabel:F,B=e.label,U=e.labelSkipWidth,N=U===void 0?St.labelSkipWidth:U,V=e.labelSkipHeight,X=V===void 0?St.labelSkipHeight:V,ne=e.labelTextColor,K=e.markers,J=K===void 0?St.markers:K,q=e.colorBy,G=e.colors,z=e.defs,L=z===void 0?St.defs:z,H=e.fill,ee=H===void 0?St.fill:H,A=e.borderRadius,se=A===void 0?St.borderRadius:A,ce=e.borderWidth,ue=ce===void 0?St.borderWidth:ce,we=e.borderColor,Te=e.annotations,at=Te===void 0?St.annotations:Te,tt=e.legendLabel,Be=e.tooltipLabel,Ke=e.valueFormat,Ye=e.isInteractive,de=Ye===void 0?St.isInteractive:Ye,ke=e.tooltip,Oe=ke===void 0?St.tooltip:ke,ve=e.onClick,Ie=e.onMouseEnter,Xe=e.onMouseLeave,It=e.legends,mt=e.role,Je=mt===void 0?St.role:mt,bt=e.ariaLabel,At=e.ariaLabelledBy,it=e.ariaDescribedBy,gt=e.isFocusable,yt=gt===void 0?St.isFocusable:gt,Lt=e.barAriaLabel,$e=e.barAriaLabelledBy,Pe=e.barAriaDescribedBy,ze=e.initialHiddenIds,nt=e.enableTotals,vt=nt===void 0?St.enableTotals:nt,kt=e.totalsOffset,Xt=kt===void 0?St.totalsOffset:kt,Dt=mn(),Bt=Dt.animate,Ht=Dt.config,Mt=Us(a,o,i),Wt=Mt.outerWidth,Jt=Mt.outerHeight,Vt=Mt.margin,fe=Mt.innerWidth,ye=Mt.innerHeight,Ee=MT({indexBy:n,label:B,tooltipLabel:Be,valueFormat:Ke,colors:G,colorBy:q,borderColor:we,labelTextColor:ne,groupMode:s,layout:c,reverse:l,data:t,keys:r,minValue:u,maxValue:d,margin:Vt,width:fe,height:ye,padding:g,innerPadding:p,valueScale:f,indexScale:h,enableLabel:W,labelSkipWidth:N,labelSkipHeight:X,legends:It,legendLabel:tt,initialHiddenIds:ze,totalsOffset:Xt}),qe=Ee.bars,Ge=Ee.barsWithValue,ot=Ee.xScale,P=Ee.yScale,re=Ee.getLabel,Z=Ee.getTooltipLabel,te=Ee.getBorderColor,ge=Ee.getLabelColor,Ce=Ee.shouldRenderBarLabel,pe=Ee.toggleSerie,be=Ee.legendsWithData,Ae=Ee.barTotals,Me=Fi(Ge,{keys:function(le){return le.key},from:function(le){return pt({borderColor:te(le),color:le.color,height:0,labelColor:ge(le),labelOpacity:0,labelX:le.width/2,labelY:le.height/2,transform:"translate("+le.x+", "+(le.y+le.height)+")",width:le.width},c==="vertical"?{}:{height:le.height,transform:"translate("+le.x+", "+le.y+")",width:0})},enter:function(le){return{borderColor:te(le),color:le.color,height:le.height,labelColor:ge(le),labelOpacity:1,labelX:le.width/2,labelY:le.height/2,transform:"translate("+le.x+", "+le.y+")",width:le.width}},update:function(le){return{borderColor:te(le),color:le.color,height:le.height,labelColor:ge(le),labelOpacity:1,labelX:le.width/2,labelY:le.height/2,transform:"translate("+le.x+", "+le.y+")",width:le.width}},leave:function(le){return pt({borderColor:te(le),color:le.color,height:0,labelColor:ge(le),labelOpacity:0,labelX:le.width/2,labelY:0,transform:"translate("+le.x+", "+(le.y+le.height)+")",width:le.width},c==="vertical"?{}:{labelX:0,labelY:le.height/2,height:le.height,transform:"translate("+le.x+", "+le.y+")",width:0})},config:Ht,immediate:!Bt,initial:Bt?void 0:null}),et=m.useMemo(function(){return{borderRadius:se,borderWidth:ue,enableLabel:W,isInteractive:de,labelSkipWidth:N,labelSkipHeight:X,onClick:ve,onMouseEnter:Ie,onMouseLeave:Xe,getTooltipLabel:Z,tooltip:Oe,isFocusable:yt,ariaLabel:Lt,ariaLabelledBy:$e,ariaDescribedBy:Pe}},[se,ue,W,Z,de,X,N,ve,Ie,Xe,Oe,yt,Lt,$e,Pe]),Nt=Km(L,qe,ee,{dataKey:"data",targetKey:"data.fill"}),wt={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null,totals:null};E.includes("annotations")&&(wt.annotations=v.jsx(WJ,{bars:qe,annotations:at},"annotations")),E.includes("axes")&&(wt.axes=v.jsx(cT,{xScale:ot,yScale:P,width:fe,height:ye,top:b,right:x,bottom:y,left:w},"axes")),E.includes("bars")&&(wt.bars=v.jsx(m.Fragment,{children:Me(function(le,cn){return m.createElement(j,pt({},et,{bar:cn,style:le,shouldRenderLabel:Ce(cn),label:re(cn.data)}))})},"bars")),E.includes("grid")&&(wt.grid=v.jsx(lT,{width:fe,height:ye,xScale:$?ot:null,yScale:S?P:null,xValues:k,yValues:O},"grid")),E.includes("legends")&&(wt.legends=v.jsx(UJ,{width:fe,height:ye,legends:be,toggleSerie:pe},"legends")),E.includes("markers")&&(wt.markers=v.jsx(DC,{markers:J,width:fe,height:ye,xScale:ot,yScale:P},"markers")),E.includes("totals")&&vt&&(wt.totals=v.jsx(see,{data:Ae,springConfig:Ht,animate:Bt,layout:c},"totals"));var Ut=m.useMemo(function(){return pt({},et,{margin:Vt,width:a,height:o,innerWidth:fe,innerHeight:ye,bars:qe,legendData:be,enableLabel:W,xScale:ot,yScale:P,tooltip:Oe,getTooltipLabel:Z,onClick:ve,onMouseEnter:Ie,onMouseLeave:Xe})},[et,Vt,a,o,fe,ye,qe,be,W,ot,P,Oe,Z,ve,Ie,Xe]);return v.jsx(ld,{width:Wt,height:Jt,margin:Vt,defs:Nt,role:Je,ariaLabel:bt,ariaLabelledBy:At,ariaDescribedBy:it,isFocusable:yt,children:E.map(function(le,cn){var Ft;return typeof le=="function"?v.jsx(m.Fragment,{children:m.createElement(le,Ut)},cn):(Ft=wt==null?void 0:wt[le])!=null?Ft:null})})},uee=function(e){var t=e.isInteractive,n=t===void 0?St.isInteractive:t,r=e.animate,i=r===void 0?St.animate:r,a=e.motionConfig,o=a===void 0?St.motionConfig:a,s=e.theme,c=e.renderWrapper,l=Xa(e,cee);return v.jsx(zs,{animate:i,isInteractive:n,motionConfig:o,renderWrapper:c,theme:s,children:v.jsx(lee,pt({isInteractive:n},l))})},dee=["isInteractive","renderWrapper","theme"],uf=function(e,t,n,r){return e.find(function(i){return LC(i.x+t.left,i.y+t.top,i.width,i.height,n,r)})},fee=function(e){var t=e.data,n=e.indexBy,r=e.keys,i=e.margin,a=e.width,o=e.height,s=e.groupMode,c=e.layout,l=e.reverse,u=e.minValue,d=e.maxValue,f=e.valueScale,h=e.indexScale,g=e.padding,p=e.innerPadding,b=e.axisTop,x=e.axisRight,_=e.axisBottom,y=_===void 0?Qt.axisBottom:_,C=e.axisLeft,w=C===void 0?Qt.axisLeft:C,T=e.enableGridX,$=T===void 0?Qt.enableGridX:T,R=e.enableGridY,S=R===void 0?Qt.enableGridY:R,k=e.gridXValues,O=e.gridYValues,D=e.layers,E=D===void 0?Qt.layers:D,M=e.renderBar,j=M===void 0?function(Z,te){var ge=te.bar,Ce=ge.color,pe=ge.height,be=ge.width,Ae=ge.x,Me=ge.y,et=te.borderColor,Nt=te.borderRadius,wt=te.borderWidth,Ut=te.label,le=te.labelColor,cn=te.shouldRenderLabel;if(Z.fillStyle=Ce,wt>0&&(Z.strokeStyle=et,Z.lineWidth=wt),Z.beginPath(),Nt>0){var Ft=Math.min(Nt,pe);Z.moveTo(Ae+Ft,Me),Z.lineTo(Ae+be-Ft,Me),Z.quadraticCurveTo(Ae+be,Me,Ae+be,Me+Ft),Z.lineTo(Ae+be,Me+pe-Ft),Z.quadraticCurveTo(Ae+be,Me+pe,Ae+be-Ft,Me+pe),Z.lineTo(Ae+Ft,Me+pe),Z.quadraticCurveTo(Ae,Me+pe,Ae,Me+pe-Ft),Z.lineTo(Ae,Me+Ft),Z.quadraticCurveTo(Ae,Me,Ae+Ft,Me),Z.closePath()}else Z.rect(Ae,Me,be,pe);Z.fill(),wt>0&&Z.stroke(),cn&&(Z.textBaseline="middle",Z.textAlign="center",Z.fillStyle=le,Z.fillText(Ut,Ae+be/2,Me+pe/2))}:M,F=e.enableLabel,W=F===void 0?Qt.enableLabel:F,B=e.label,U=e.labelSkipWidth,N=U===void 0?Qt.labelSkipWidth:U,V=e.labelSkipHeight,X=V===void 0?Qt.labelSkipHeight:V,ne=e.labelTextColor,K=e.colorBy,J=e.colors,q=e.borderRadius,G=q===void 0?Qt.borderRadius:q,z=e.borderWidth,L=z===void 0?Qt.borderWidth:z,H=e.borderColor,ee=e.annotations,A=ee===void 0?Qt.annotations:ee,se=e.legendLabel,ce=e.tooltipLabel,ue=e.valueFormat,we=e.isInteractive,Te=we===void 0?Qt.isInteractive:we,at=e.tooltip,tt=at===void 0?Qt.tooltip:at,Be=e.onClick,Ke=e.onMouseEnter,Ye=e.onMouseLeave,de=e.legends,ke=e.pixelRatio,Oe=ke===void 0?Qt.pixelRatio:ke,ve=e.canvasRef,Ie=e.enableTotals,Xe=Ie===void 0?Qt.enableTotals:Ie,It=e.totalsOffset,mt=It===void 0?Qt.totalsOffset:It,Je=m.useRef(null),bt=ht(),At=Us(a,o,i),it=At.margin,gt=At.innerWidth,yt=At.innerHeight,Lt=At.outerWidth,$e=At.outerHeight,Pe=MT({indexBy:n,label:B,tooltipLabel:ce,valueFormat:ue,colors:J,colorBy:K,borderColor:H,labelTextColor:ne,groupMode:s,layout:c,reverse:l,data:t,keys:r,minValue:u,maxValue:d,margin:it,width:gt,height:yt,padding:g,innerPadding:p,valueScale:f,indexScale:h,enableLabel:W,labelSkipWidth:N,labelSkipHeight:X,legends:de,legendLabel:se,totalsOffset:mt}),ze=Pe.bars,nt=Pe.barsWithValue,vt=Pe.xScale,kt=Pe.yScale,Xt=Pe.getLabel,Dt=Pe.getTooltipLabel,Bt=Pe.getBorderColor,Ht=Pe.getLabelColor,Mt=Pe.shouldRenderBarLabel,Wt=Pe.legendsWithData,Jt=Pe.barTotals,Vt=Li(),fe=Vt.showTooltipFromEvent,ye=Vt.hideTooltip,Ee=jJ({annotations:TT({data:ze,annotations:A,getPosition:function(Z){return{x:Z.x,y:Z.y}},getDimensions:function(Z){var te=Z.width,ge=Z.height;return{width:te,height:ge,size:Math.max(te,ge)}}})}),qe=m.useMemo(function(){return{borderRadius:G,borderWidth:L,isInteractive:Te,isFocusable:!1,labelSkipWidth:N,labelSkipHeight:X,margin:it,width:a,height:o,innerWidth:gt,innerHeight:yt,bars:ze,legendData:Wt,enableLabel:W,xScale:vt,yScale:kt,tooltip:tt,getTooltipLabel:Dt,onClick:Be,onMouseEnter:Ke,onMouseLeave:Ye}},[G,L,Te,N,X,it,a,o,gt,yt,ze,Wt,W,vt,kt,tt,Dt,Be,Ke,Ye]),Ge=Ma(ue);m.useEffect(function(){var Z,te=(Z=Je.current)==null?void 0:Z.getContext("2d");Je.current&&te&&(Je.current.width=Lt*Oe,Je.current.height=$e*Oe,te.scale(Oe,Oe),te.fillStyle=bt.background,te.fillRect(0,0,Lt,$e),te.translate(it.left,it.top),E.forEach(function(ge){ge==="grid"?typeof bt.grid.line.strokeWidth=="number"&&bt.grid.line.strokeWidth>0&&(te.lineWidth=bt.grid.line.strokeWidth,te.strokeStyle=bt.grid.line.stroke,$&&Cl(te,{width:gt,height:yt,scale:vt,axis:"x",values:k}),S&&Cl(te,{width:gt,height:yt,scale:kt,axis:"y",values:O})):ge==="axes"?uT(te,{xScale:vt,yScale:kt,width:gt,height:yt,top:b,right:x,bottom:y,left:w,theme:bt}):ge==="bars"?nt.forEach(function(Ce){j(te,{bar:Ce,borderColor:Bt(Ce),borderRadius:G,borderWidth:L,label:Xt(Ce.data),labelColor:Ht(Ce),shouldRenderLabel:Mt(Ce)})}):ge==="legends"?Wt.forEach(function(Ce){var pe=Ce[0],be=Ce[1];GC(te,pt({},pe,{data:be,containerWidth:gt,containerHeight:yt,theme:bt}))}):ge==="annotations"?BJ(te,{annotations:Ee,theme:bt}):ge==="totals"&&Xe?function(Ce,pe,be,Ae){Ae===void 0&&(Ae=Qt.layout),Ce.fillStyle=be.text.fill,Ce.font="bold "+be.labels.text.fontSize+"px "+be.labels.text.fontFamily,Ce.textBaseline=Ae==="vertical"?"alphabetic":"middle",Ce.textAlign=Ae==="vertical"?"center":"start",pe.forEach(function(Me){Ce.fillText(Me.formattedValue,Me.x,Me.y)})}(te,Jt,bt,c):typeof ge=="function"&&ge(te,qe)}),te.save())},[y,w,x,b,nt,G,L,Ee,$,S,Bt,Xt,Ht,k,O,s,o,yt,gt,qe,E,c,Wt,it.left,it.top,$e,Lt,Oe,j,vt,kt,l,Mt,bt,a,Jt,Xe,Ge]);var ot=m.useCallback(function(Z){if(ze&&Je.current){var te=jo(Je.current,Z),ge=te[0],Ce=te[1],pe=uf(ze,it,ge,Ce);pe!==void 0?(fe(m.createElement(tt,pt({},pe.data,{color:pe.color,label:pe.label,value:Number(pe.data.value)})),Z),Z.type==="mouseenter"&&(Ke==null||Ke(pe.data,Z))):ye()}},[ye,it,Ke,ze,fe,tt]),P=m.useCallback(function(Z){if(ze&&Je.current){ye();var te=jo(Je.current,Z),ge=te[0],Ce=te[1],pe=uf(ze,it,ge,Ce);pe&&(Ye==null||Ye(pe.data,Z))}},[ye,it,Ye,ze]),re=m.useCallback(function(Z){if(ze&&Je.current){var te=jo(Je.current,Z),ge=te[0],Ce=te[1],pe=uf(ze,it,ge,Ce);pe!==void 0&&(Be==null||Be(pt({},pe.data,{color:pe.color}),Z))}},[it,Be,ze]);return v.jsx("canvas",{ref:function(Z){Je.current=Z,ve&&"current"in ve&&(ve.current=Z)},width:Lt*Oe,height:$e*Oe,style:{width:Lt,height:$e,cursor:Te?"auto":"normal"},onMouseEnter:Te?ot:void 0,onMouseMove:Te?ot:void 0,onMouseLeave:Te?P:void 0,onClick:Te?re:void 0})},hee=m.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,i=e.theme,a=Xa(e,dee);return v.jsx(zs,{isInteractive:n,renderWrapper:r,theme:i,animate:!1,children:v.jsx(fee,pt({},a,{canvasRef:t}))})}),pee=function(e){return v.jsx(Ka,{children:function(t){var n=t.width,r=t.height;return v.jsx(uee,pt({width:n,height:r},e))}})};m.forwardRef(function(e,t){return v.jsx(Ka,{children:function(n){var r=n.width,i=n.height;return v.jsx(hee,pt({width:r,height:i},e,{ref:t}))}})});const mee="_side-content-bar_7crz7_1",gee="_mobile_7crz7_12",vee="_expanded_7crz7_20",bee="_resizer_7crz7_23",yee="_expander_7crz7_38",xee="_icon_7crz7_57",jr={"side-content-bar":"_side-content-bar_7crz7_1",sideContentBar:mee,mobile:gee,expanded:vee,resizer:bee,expander:yee,icon:xee},$T=({width:e,children:t,isExpandedOnMobileState:[n,r],resizeable:i=!0,onResize:a})=>{const{ProjectIconComponent:o}=m.useContext(Pt),{isMobile:s}=$s(),c=Rp({onSwipedRight:d=>{d.velocity>.8&&r(!1)},delta:100}),[l,u]=m.useState(null);return v.jsxs(v.Fragment,{children:[v.jsxs("section",{className:Q("luminus-side-content-bar shadow",jr.sideContentBar,{[jr.mobile]:s},{[jr.expanded]:n}),style:{width:`${e}px`},...c,children:[i&&!s?v.jsx("div",{role:"button",className:Q(jr.resizer,"luminus-side-content-bar-resizer","shadow"),draggable:!0,onDragStart:d=>u({startX:d.clientX,widthStart:e}),onDrag:d=>a(((l==null?void 0:l.widthStart)??0)+(((l==null?void 0:l.startX)??0)-d.clientX)),onDragEnd:()=>u(null),children:v.jsx(o,{className:jr.icon,icon:"resizer-horizontal"})}):null,t]}),s?v.jsx("div",{role:"button",onClick:()=>r(!n),className:Q(jr.expander,{[jr.expanded]:n},"luminus-side-content-bar-expander","shadow"),children:v.jsx(o,{className:jr.icon,icon:"chevron-left"})}):null]})},_ee=({title:e})=>v.jsx("div",{className:"mb-3",children:typeof e=="string"?v.jsx(dn,{variant:"h3",children:e}):e}),wee="_full-screen-container_1rm4r_1",RT={"full-screen-container":"_full-screen-container_1rm4r_1",fullScreenContainer:wee},Cee=Q("overflow-hidden luminus-full-screen-container",RT.fullScreenContainer),Tee="container-fluid",kee=({title:e,children:t,sideContent:n,sideContentWidth:r=250,sideContentResizeable:i=!0,noPadding:a,className:o,variant:s="main",helmet:c,unavailableOnMobile:l})=>{const{addHelmet:u,removeHelmet:d}=m.useContext(v2),{texts:{container:f}}=m.useContext(Pt),[h,g]=m.useState(r),[p,b]=m.useState(!1),x=m.useMemo(()=>{switch(s){case"fullScreen":return Cee;case"main":return Tee;default:throw new Error(`PageContainer got incorrect variant type: ${s}`)}},[s]);m.useEffect(()=>(c?u(c):typeof e=="string"&&e&&u(e),()=>d()),[c,u,d,e]);const _=Rp({onSwipedLeft:w=>{w.velocity>.8&&b(!0)},delta:100}),{isMobile:y}=$s(),C=m.useMemo(()=>y&&l,[y,l]);return m.useEffect(()=>{g(r)},[r]),v.jsxs(v.Fragment,{children:[v.jsx("div",{className:Q(x,a?"p-0":"p-3",o),style:s==="fullScreen"?{width:n?`calc(100% - ${h}px)`:"100%"}:void 0,..._,children:v.jsx("div",{className:s==="fullScreen"?RT.fullScreenContainer:void 0,style:s==="main"?{paddingRight:n?`${h}px`:void 0}:{height:"100%",width:"100%"},children:C?v.jsx(Ap,{variant:"warning",children:f.unavailableOnMobile}):v.jsxs(v.Fragment,{children:[e?v.jsx(_ee,{title:e}):null,t]})})}),n&&!C?v.jsx($T,{width:h,isExpandedOnMobileState:[p,b],resizeable:i,onResize:w=>i?g(w):{},children:n}):null]})},ag=({InputContainer:e=As,formField:t,label:n,resetsFields:r,options:i,isNumber:a,size:o,showClearIcon:s,clearValue:c,noSortOptions:l,required:u,hidden:d,disabled:f,withoutLabel:h,hint:g,className:p})=>{const{register:b,formState:x,getValues:_,setValue:y,watch:C}=rn.useFormContext(),w=Xl({falseIfNotInit:!0});console.log("disabled ",f),console.log("formDisabled ",w);const[T,$]=m.useState(void 0),[R,S]=m.useState(!1),k=m.useMemo(()=>i.toSorted((M,j)=>l?0:(M.name??"").localeCompare(j.name??"")),[i,l]),O=m.useCallback(()=>{const M=c??null;a?y(t,M===null?null:Number(M),{shouldDirty:!0,shouldValidate:R}):y(t,(M==null?void 0:M.toString())??"",{shouldDirty:!0,shouldValidate:R})},[c,a,y,t,R]);m.useEffect(()=>{const M=t.split(".");let j=x.errors;M.forEach(F=>{j!==void 0&&(j=j[F])}),$(j)},[x,t]);const D=m.useMemo(()=>f||w,[f,w]);console.log(D),m.useEffect(()=>{y(t,_(t))},[k,t,_,y]),m.useEffect(()=>{x.isSubmitted&&S(!0)},[x]);const E=T!==void 0;return v.jsx(v.Fragment,{children:v.jsxs(e,{label:n??"",required:u,disabled:D,hidden:d,withoutLabel:h,isInvalid:E,hint:g,className:p,children:[v.jsxs(sr.Select,{size:o,...b(t,{setValueAs:M=>a?M==null||M===""?null:parseInt(M,10):M==null||M===""?null:M,onChange:()=>{r&&r.forEach(M=>y(M,null,{shouldDirty:!0,shouldValidate:R}))}}),isInvalid:E,hidden:d,disabled:D,className:"w-100",children:[v.jsx("option",{value:""}),k.map(M=>v.jsx("option",{value:M.id??"",children:M.name},M.id))]}),s&&C(t)&&v.jsx("div",{className:"luminus-input-remove-icon inset",children:v.jsx(Rs,{color:"secondary",size:"sm",onClick:O,children:v.jsx(ks,{})})}),T&&v.jsx(Jl,{message:T.message})]})})},og=({InputContainer:e=As,formField:t,label:n,resetsFields:r,size:i,showClearIcon:a,clearValue:o,required:s,hidden:c,disabled:l,rows:u,withoutLabel:d,customFormControlProps:f,minLength:h,maxLength:g,hint:p,onChange:b,className:x})=>{const{register:_,formState:y,setValue:C,watch:w}=rn.useFormContext(),T=Xl({falseIfNotInit:!0}),[$,R]=m.useState(void 0),[S,k]=m.useState(!1),O=m.useCallback(()=>{const j=o??null;C(t,(j==null?void 0:j.toString())??"",{shouldDirty:!0,shouldValidate:S})},[o,C,t,S]),D=m.useCallback(()=>{const j=t.split(".");let F=y.errors;j.forEach(W=>{F!==void 0&&(F=F[W])}),R(F)},[y,t]),E=m.useMemo(()=>l||T,[l,T]);m.useEffect(()=>{D()},[D]),m.useEffect(()=>{y.isSubmitted&&k(!0)},[y]);const M=$!==void 0;return v.jsxs(e,{label:n??"",required:s,disabled:E,hidden:c,withoutLabel:d,isInvalid:M,className:x,hint:p,isForTextAreaInput:!0,children:[v.jsx(sr.Control,{as:"textarea",size:i,..._(t,{setValueAs:j=>j==null||j===""?null:j,onChange:j=>{var F;r&&r.forEach(W=>C(W,null,{shouldDirty:!0,shouldValidate:S})),b&&b((F=j.target)!=null&&F.value?j.target.value.toString():null)}}),isInvalid:M,hidden:c,disabled:E,rows:u??2,className:"w-100",minLength:h,maxLength:g,...f}),a&&w(t)&&v.jsx("div",{className:"luminus-input-remove-icon",children:v.jsx(Rs,{color:"secondary",size:"sm",onClick:O,children:v.jsx(ks,{})})}),$&&v.jsx(Jl,{message:$.message})]})},$a=m.forwardRef(({InputContainer:e=As,type:t,formField:n,label:r,placeholder:i,size:a,resetsFields:o,showClearIcon:s,clearValue:c,required:l,hidden:u,disabled:d,withoutLabel:f,list:h,step:g,CustomOnChangeComponent:p,noSelectOnFocus:b,minLength:x,maxLength:_,hint:y,onChange:C,className:w,autoComplete:T},$)=>{const{register:R,formState:S,setValue:k,watch:O}=rn.useFormContext(),D=Xl({falseIfNotInit:!0}),[E,M]=m.useState(void 0),[j,F]=m.useState(!1),W=m.useCallback(()=>{const z=c??null;t==="number"?k(n,z!==null?Number(z):null,{shouldDirty:!0,shouldValidate:j}):k(n,(z==null?void 0:z.toString())??"",{shouldDirty:!0,shouldValidate:j})},[c,t,k,n,j]),B=m.useCallback(()=>{const z=n.split(".");let L=S.errors;z.forEach(H=>{L!==void 0&&(L=L[H])}),M(L)},[S,n]),U=m.useMemo(()=>d||D,[d,D]);m.useEffect(()=>{B()},[B]),m.useEffect(()=>{S.isSubmitted&&F(!0)},[S]);const N=E!==void 0,[V,X]=m.useState(!1),ne=O(n),K=Cp(t,ne??null,V),{ref:J,...q}=R(n,{setValueAs:z=>t==="number"?z==null||z===""?null:Number(z):z==null||z===""?null:z,onChange:z=>{var L;o&&o.forEach(H=>k(H,null,{shouldDirty:!0,shouldValidate:j})),C&&C((L=z.target)!=null&&L.value?t==="number"?Number(z.target.value)??null:z.target.value.toString():null)},onBlur:()=>X(!1)}),G=m.useRef(null);return m.useImperativeHandle($,()=>G.current,[G]),v.jsxs(e,{label:r??"",required:l,disabled:U,hidden:u,withoutLabel:f,isInvalid:N,hint:y,className:w,children:[v.jsxs("div",{className:"luminus-input-container position-relative w-100",children:[v.jsx(sr.Control,{type:K,placeholder:i??r,size:a,onFocus:z=>{X(!0),!b&&z.target.select()},...q,ref:z=>{J(z),G.current=z},isInvalid:N,hidden:u,disabled:U,list:h,className:"w-100",step:g,minLength:x,maxLength:_,autoComplete:T}),p&&v.jsx("div",{className:"custom-picker-button",children:p})]}),s&&O(n)&&v.jsx("div",{className:`luminus-input-remove-icon ${t!=="text"?"inset":""}`,children:v.jsx(Rs,{color:"secondary",size:"sm",onClick:W,children:v.jsx(ks,{})})}),E&&v.jsx(Jl,{message:E.message})]})}),dy=(e,t,n)=>{if(e&&"reportValidity"in e){const r=rn.get(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},AT=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?dy(r.ref,n,e):r.refs&&r.refs.forEach(i=>dy(i,n,e))}},See=(e,t)=>{t.shouldUseNativeValidation&&AT(e,t);const n={};for(const r in e){const i=rn.get(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(Oee(t.names||Object.keys(e),r)){const o=Object.assign({},rn.get(n,r));rn.set(o,"root",a),rn.set(n,r,o)}else rn.set(n,r,a)}return n},Oee=(e,t)=>e.some(n=>n.startsWith(t+"."));var Eee=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return e.push(d)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=rn.appendErrors(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},fd=function(e,t,n){return n===void 0&&(n={}),function(r,i,a){try{return Promise.resolve(function(o,s){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(l){return a.shouldUseNativeValidation&&AT({},a),{errors:{},values:n.raw?r:l}})}catch(l){return s(l)}return c&&c.then?c.then(void 0,s):c}(0,function(o){if(function(s){return Array.isArray(s==null?void 0:s.errors)}(o))return{values:{},errors:See(Eee(o.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw o}))}catch(o){return Promise.reject(o)}}};const Mee="_wrapper_9omw0_1",$ee="_controls_9omw0_16",Ree="_explorerWindow_9omw0_20",Aee="_folderList_9omw0_28",jee="_fileList_9omw0_35",Pee="_dndText_9omw0_61",ai={wrapper:Mee,controls:$ee,explorerWindow:Ree,folderList:Aee,fileList:jee,dndText:Pee},qt=m.createContext({apiActions:{},loadDocuments(){throw new Error("DocumentsContext was not initialized.")},reducer:[{},{}],entityType:"",entityId:-1}),Iee="_folderIcon_vxg2z_1",Dee="_defaultFolder_vxg2z_5",Nee="_names_vxg2z_9",Fee="_folderType_vxg2z_13",pc={folderIcon:Iee,defaultFolder:Dee,names:Nee,folderType:Fee},jT=({isActive:e,isDefault:t,folderName:n,typeName:r})=>{const{ProjectIconComponent:i}=m.useContext(Pt);return v.jsxs("div",{className:"d-flex gap-2 align-items-center",children:[v.jsx(i,{icon:`folder${e?"-filled":""}`,className:Q("d-inline-block",t?pc.defaultFolder:"text-primary"),iconProps:{className:pc.folderIcon}}),v.jsxs("div",{className:Q("d-flex flex-column gap-0 align-items-start",pc.names),children:[v.jsx("span",{className:e?"fw-bold":"",children:n}),r?v.jsxs("span",{className:pc.folderType,children:["(",r,")"]}):null]})]})},Lee=({customText:e})=>{const{reducer:[t,n]}=m.useContext(qt),r=m.useCallback(()=>{n({type:"select-folder",folderId:"root"})},[n]);return v.jsx("li",{children:v.jsx("button",{onClick:r,type:"button",className:Q("border-0 bg-transparent"),children:v.jsx(jT,{folderName:e??"root",isActive:t.activeFolder==="root",typeName:"",isDefault:!0})})})};function Bee(e){if(e.state!=="openned-modal")throw new Error('Not in "openned-modal" state!')}const PT=()=>{const e=Gl(),{startLoading:t,stopLoading:n}=m.useContext(Bl),{reducer:[,r]}=m.useContext(qt),i=m.useCallback(async(o,s)=>{t("documents-renameFolder");try{await e.put("/documents/folder/rename",{folderId:o,name:s}),r({type:"update-folders",folderIds:[o],newProperties:{name:s}})}finally{n("documents-renameFolder")}},[e,r,t,n]),a=m.useCallback(async o=>{t("documentsFolderCreate");try{const s=await e.post("/documents/folder",o);r({type:"create-folder",folderData:o,folderId:s.data.id,isOnlyRead:s.data.onlyRead})}finally{n("documentsFolderCreate")}},[e,r,t,n]);return{renameFolder:i,createFolder:a}},Wee=()=>{const{reducer:[e],entityId:t,entityType:n}=m.useContext(qt),{zNumberRequired:r,zStringRequired:i}=Kl(),{createFolder:a}=PT(),o=Zt.object({name:i(),documentTypeId:r()}),s=rn.useForm({resolver:fd(o)}),c=m.useCallback(async l=>{const u={...l,dbObjectId:t.toString(),entity:n,parentFolderId:e.activeFolder==="root"?null:e.activeFolder};await a(u)},[a,t,n,e.activeFolder]);return{formMethods:s,onSubmit:c}},Uee=({handleClose:e})=>{var o;const{texts:{documents:t}}=m.useContext(Pt),{reducer:[n],entityType:r}=m.useContext(qt);if(Bee(n),n.modalType!=="create-folder")throw new Error("Tried to render CreateFolderModal without create-folder modal type reducer state.");const{onSubmit:i,formMethods:a}=Wee();return v.jsx(v.Fragment,{children:v.jsx(rn.FormProvider,{...a,children:v.jsxs(sr,{onSubmit:a.handleSubmit(i),children:[v.jsx(bn.Header,{closeButton:!0,children:v.jsx(bn.Title,{children:t.createFolderInFolder(((o=n.foldersMap.get(n.chosenFolderId))==null?void 0:o.name)??r)})}),v.jsxs(bn.Body,{children:[v.jsx($a,{formField:"name",type:"text",label:t.name,required:!0}),v.jsx(ag,{options:n.documentTypes,formField:"documentTypeId",label:t.folderType,isNumber:!0,required:!0})]}),v.jsxs(bn.Footer,{children:[v.jsx(Mi,{onClick:e,variant:"outlined",color:"secondary",children:t.cancel}),v.jsx(Mi,{type:"submit",children:t.createFolder})]})]})})})},IT=100,zee=(e,t)=>{const n=Gl(),{startLoading:r,stopLoading:i}=m.useContext(Bl),{loadDocuments:a}=m.useContext(qt),{zStringRequired:o,zString:s,zNumberRequired:c,zDateRequired:l}=Kl(),u=Zt.object({name:o(),description:s(),validToDate:l(),documentTypeId:c()}),d=rn.useForm({resolver:fd(u),defaultValues:{...e,validToDate:Wl(e.validToDate)}}),f=m.useCallback(async h=>{r("documents-updateProperties");try{await n.put(`/documents/${e.id}/update-info`,h),await a(),t()}finally{i("documents-updateProperties")}},[n,e.id,t,a,r,i]);return{formMethods:d,onSubmit:f}},Hee=({handleClose:e,file:t})=>{const{texts:{documents:n}}=m.useContext(Pt),{reducer:[r]}=m.useContext(qt),{formMethods:i,onSubmit:a}=zee(t,e);return v.jsxs(v.Fragment,{children:[v.jsx(bn.Header,{closeButton:!0,children:v.jsx(bn.Title,{children:n.editFileProperties})}),v.jsx(rn.FormProvider,{...i,children:v.jsxs(sr,{onSubmit:i.handleSubmit(a),children:[v.jsxs(bn.Body,{children:[v.jsx($a,{formField:"name",type:"text",label:n.name,required:!0}),v.jsx($a,{formField:"validToDate",type:"date",label:n.validSince,required:!0}),v.jsx(ag,{formField:"documentTypeId",label:n.category,options:r.documentTypes,isNumber:!0,required:!0}),v.jsx(og,{formField:"description",label:n.description,customFormControlProps:{maxLength:IT}})]}),v.jsxs(bn.Footer,{children:[v.jsx(Mi,{onClick:e,color:"secondary",variant:"outlined",children:n.cancel}),v.jsx(Mi,{type:"submit",children:n.save})]})]})})]})},Vee=({handleClose:e})=>{const{reducer:[t]}=m.useContext(qt),n=m.useMemo(()=>{if(t.markedFiles.length===1)return t.constantFiles.find(r=>r.id===t.markedFiles[0])},[t.constantFiles,t.markedFiles]);return n===void 0?(e(),v.jsx(v.Fragment,{})):v.jsx(Hee,{file:n,handleClose:e})},qee=()=>{const{reducer:[e,t]}=m.useContext(qt),n=m.useCallback(()=>{t({type:"close-modal"})},[t]),r=m.useMemo(()=>{if(e.state!=="openned-modal")return null;switch(e.modalType){case"create-folder":return v.jsx(Uee,{handleClose:n});case"edit-file-properties":return v.jsx(Vee,{handleClose:n});default:return null}},[e.state,e.modalType]);return v.jsx(bn,{show:e.state==="openned-modal",onHide:n,children:r})},fy="documents_drag_image_element",mc="drop-container-highlight-class",hy="data-drop-container-id",py="data-draggable-id",Yee=()=>{const e=document.getElementById(fy);if(e!==null)return e;const t=document.createElement("div");return t.id=fy,t.style.position="absolute",t.style.top=`${-window.outerHeight}px`,t.style.left=`${-window.outerWidth}px`,t.style.width="50px",t.style.height="50px",t.style.backgroundColor="rgba(0, 0, 0, 0.5)",t.style.color="white",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.fontSize="16px",t.style.borderRadius="5px",document.body.appendChild(t),t},sg=()=>{const{apiActions:{moveDocuments:e},reducer:[t]}=m.useContext(qt),n=m.useCallback(l=>{var u;if(t.markedFiles.length>0){const d=Yee();d.innerHTML=t.markedFiles.length.toString(),l.dataTransfer.setDragImage(d,0,0),l.dataTransfer.clearData(),l.dataTransfer.setData("application/json",JSON.stringify(t.markedFiles)),l.dataTransfer.dropEffect="none",l.dataTransfer.effectAllowed="move"}else l.dataTransfer.setData("application/json",JSON.stringify([parseInt(((u=l.currentTarget.attributes.getNamedItem(py))==null?void 0:u.nodeValue)??"",10)])),l.dataTransfer.dropEffect="none",l.dataTransfer.effectAllowed="move"},[t.markedFiles]),r=m.useCallback(l=>({[py]:l,draggable:t.markedFiles.length===0||t.markedFiles.includes(l),onDragStart:n}),[n,t.markedFiles]),i=m.useCallback(l=>u=>{var h;u.preventDefault(),u.stopPropagation(),u.currentTarget.classList.remove(mc);const d=u.dataTransfer.files;if(l&&d&&d.length>0){l(d);return}const f=u.dataTransfer.getData("application/json");if(f){const g=JSON.parse(f),p=parseInt(((h=u.currentTarget.attributes.getNamedItem(hy))==null?void 0:h.value)??"",10);e(p,g)}},[e]),a=m.useCallback(()=>l=>{l.preventDefault(),l.stopPropagation()},[]),o=m.useCallback(l=>u=>{u.preventDefault(),u.stopPropagation(),u.dataTransfer.types.includes("Files")?(u.dataTransfer.dropEffect="copy",u.currentTarget.classList.add(mc)):!l&&u.dataTransfer.types.includes("application/json")?(u.dataTransfer.dropEffect="move",u.currentTarget.classList.add(mc)):u.dataTransfer.dropEffect="none"},[]),s=m.useCallback(l=>{l.preventDefault(),l.stopPropagation(),l.target===l.currentTarget&&(l.dataTransfer.dropEffect="none",l.currentTarget.classList.remove(mc))},[]),c=m.useCallback((l,u)=>({onDrop:i(u==null?void 0:u.onFilesDrop),onDragOver:a(),onDragEnter:o(u==null?void 0:u.ignoreInner),onDragLeave:s,[hy]:l}),[i,a,o,s]);return{getDraggableProps:r,getDropProps:c}};function DT(e,t,n){for(let r=0;r<e.childrenIds.length;r++){const i=e.childrenIds[r];if(i===t)return!0;const a=n.get(i);if(a&&DT(a,t,n))return!0}return!1}function Gee(e){if(e.activeFolder==="root")return!1;const t=e.foldersMap.get(e.activeFolder);return!(t!=null&&t.onlyRead)}function NT(e,t){const n=t.get(e);return n===void 0?"":n.parentId===null?n.name:`${NT(n.parentId,t)}/${n.name}`}const Zee=()=>{const{zString:e,zStringRequired:t,zNumberRequired:n}=Kl();return{formSchema:m.useMemo(()=>Zt.object({validTo:t(),description:e(),name:e(),documentTypeId:n()}),[n,e,t])}},cg=({handleClose:e,files:t,targetFolderId:n})=>{var f;const{texts:{documents:r}}=m.useContext(Pt),{reducer:[i],apiActions:{uploadFiles:a}}=m.useContext(qt),o=m.useMemo(()=>[...t],[t]),s=m.useMemo(()=>n??i.activeFolder,[i.activeFolder,n]),c=m.useMemo(()=>s==="root"?void 0:i.foldersMap.get(s),[s,i.foldersMap]),{formSchema:l}=Zee(),u=rn.useForm({resolver:fd(l),defaultValues:{validTo:Wl(new Date().toISOString()),documentTypeId:(f=i.documentTypes.find(h=>{var g;return h.name===((g=i.foldersMap.get(s))==null?void 0:g.defaultDocType)}))==null?void 0:f.id}}),d=m.useCallback(async h=>{s!=="root"&&(await a(t,{folderId:s,...h}),e())},[t,e,s,a]);return v.jsxs(bn,{show:!0,onHide:e,children:[v.jsx(bn.Header,{closeButton:!0,children:v.jsxs("div",{children:[r.uploadFilesPrompt(t.length,c.name),v.jsx("ul",{children:o.map((h,g)=>v.jsxs("li",{children:[h.name," - ",xa(h.size)]},`${h.name}-${g}`))})]})}),v.jsx(rn.FormProvider,{...u,children:v.jsxs(sr,{onSubmit:u.handleSubmit(d),children:[v.jsxs(bn.Body,{children:[v.jsx(ag,{formField:"documentTypeId",label:r.documentType,options:i.documentTypes,isNumber:!0,required:!0}),v.jsx($a,{formField:"validTo",label:r.validSince,type:"date",required:!0}),o.length===1?v.jsx($a,{formField:"name",label:r.name,type:"text"}):null,v.jsx(og,{formField:"description",label:r.description,customFormControlProps:{maxLength:IT}})]}),v.jsxs(bn.Footer,{children:[v.jsx(Mi,{variant:"outlined",color:"secondary",onClick:e,children:r.cancel}),v.jsx(Mi,{type:"submit",children:r.upload})]})]})})]})},Kee="_folder_1cktt_1",Xee="_collapseArrowDiv_1cktt_8",Qee="_button_1cktt_20",Jee="_nestedList_1cktt_24",ete="_numberOfFiles_1cktt_31",tte="_collapseArrow_1cktt_8",oi={folder:Kee,collapseArrowDiv:Xee,button:Qee,nestedList:Jee,numberOfFiles:ete,collapseArrow:tte},FT=({dirId:e,writePermissions:t})=>{const{ProjectIconComponent:n}=m.useContext(Pt),{reducer:[r,i]}=m.useContext(qt),{getDropProps:a}=sg(),[o,s]=m.useState(null),[c,l]=m.useState(!0),u=m.useMemo(()=>{const p=r.foldersMap.get(e);if(p===void 0)throw new Error(`tried to get dir with id ${e}`);return p},[e,r.foldersMap]),d=m.useCallback(()=>{r.activeFolder!=="root"&&DT(u,r.activeFolder,r.foldersMap)&&i({type:"select-folder",folderId:e}),l(!0)},[e,u,i,r.activeFolder,r.foldersMap]),f=m.useMemo(()=>u.childrenIds.length>0,[u.childrenIds.length]),h=m.useCallback(()=>{i({type:"select-folder",folderId:e})},[e,i]),g=m.useMemo(()=>r.filteredFiles.filter(p=>p.folderId===e&&p.archive===!1).length,[e,r.filteredFiles]);return v.jsxs(v.Fragment,{children:[v.jsxs("li",{className:oi.folder,children:[v.jsx("div",{className:oi.collapseArrowDiv,children:f?c?v.jsx("button",{onClick:()=>l(!1),type:"button",children:v.jsx(n,{icon:"chevron-right",iconProps:{className:oi.collapseArrow}})}):v.jsx("button",{onClick:d,type:"button",children:v.jsx(n,{icon:"chevron-down",iconProps:{className:oi.collapseArrow}})}):null}),v.jsx("button",{className:Q(oi.button),onClick:h,type:"button",...t&&!u.onlyRead?a(e,{onFilesDrop:p=>s(p)}):{},children:v.jsxs("div",{className:"d-flex align-items-center gap-2",children:[v.jsx(jT,{isDefault:u.isDefault,folderName:u.name,typeName:u.defaultDocType??"",isActive:e===r.activeFolder}),g>0?v.jsxs("span",{className:oi.numberOfFiles,children:["[",g,"]"]}):void 0]})}),f?c?null:v.jsx("ul",{className:oi.nestedList,children:u==null?void 0:u.childrenIds.map(p=>v.jsx(FT,{dirId:p,writePermissions:t},p))}):void 0]}),o!==null?v.jsx(cg,{files:o,handleClose:()=>s(null),targetFolderId:e}):null]})},nte="_wrapper_1th2u_1",rte="_downloadButton_1th2u_9",LT={wrapper:nte,downloadButton:rte};function ite(e){return Ve({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M320 464c8.8 0 16-7.2 16-16V160H256c-17.7 0-32-14.3-32-32V48H64c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H320zM0 64C0 28.7 28.7 0 64 0H229.5c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64z"},child:[]}]})(e)}function ate(e){return Ve({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M448 80c8.8 0 16 7.2 16 16V415.8l-5-6.5-136-176c-4.5-5.9-11.6-9.3-19-9.3s-14.4 3.4-19 9.3L202 340.7l-30.5-42.7C167 291.7 159.8 288 152 288s-15 3.7-19.5 10.1l-80 112L48 416.3l0-.3V96c0-8.8 7.2-16 16-16H448zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm80 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(e)}function ote(e){return Ve({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M23 1.5q.41 0 .7.3.3.29.3.7v19q0 .41-.3.7-.29.3-.7.3H7q-.41 0-.7-.3-.3-.29-.3-.7V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h5V2.5q0-.41.3-.7.29-.3.7-.3zM6 13.28l1.42 2.66h2.14l-2.38-3.87 2.34-3.8H7.46l-1.3 2.4-.05.08-.04.09-.64-1.28-.66-1.29H2.59l2.27 3.82-2.48 3.85h2.16zM14.25 21v-3H7.5v3zm0-4.5v-3.75H12v3.75zm0-5.25V7.5H12v3.75zm0-5.25V3H7.5v3zm8.25 15v-3h-6.75v3zm0-4.5v-3.75h-6.75v3.75zm0-5.25V7.5h-6.75v3.75zm0-5.25V3h-6.75v3Z"},child:[]}]})(e)}function ste(e){return Ve({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M23.004 1.5q.41 0 .703.293t.293.703v19.008q0 .41-.293.703t-.703.293H6.996q-.41 0-.703-.293T6 21.504V18H.996q-.41 0-.703-.293T0 17.004V6.996q0-.41.293-.703T.996 6H6V2.496q0-.41.293-.703t.703-.293zM6.035 11.203l1.442 4.735h1.64l1.57-7.876H9.036l-.937 4.653-1.325-4.5H5.38l-1.406 4.523-.938-4.675H1.312l1.57 7.874h1.641zM22.5 21v-3h-15v3zm0-4.5v-3.75H12v3.75zm0-5.25V7.5H12v3.75zm0-5.25V3h-15v3Z"},child:[]}]})(e)}const cte="_excel_18ggp_1",lte="_word_18ggp_5",ute="_pdf_18ggp_9",dte="_image_18ggp_13",gc={excel:cte,word:lte,pdf:ute,image:dte},BT=({fileExtension:e,className:t,...n})=>{switch(e==null?void 0:e.toUpperCase()){case"JPG":case"JPEG":case"BMP":case"PNG":return v.jsx("span",{className:Q(t,gc.image),children:v.jsx(ate,{...n})});case"XLS":case"XLSX":case"CSV":return v.jsx(ote,{className:Q(t,gc.excel),...n});case"DOC":case"DOCM":case"DOCX":return v.jsx(ste,{className:Q(t,gc.word),...n});case"PDF":return v.jsx(o8,{className:Q(t,gc.pdf),...n});default:return v.jsx(ite,{})}},fte=()=>{const{ProjectIconComponent:e,texts:{documents:t}}=m.useContext(Pt),{apiActions:{downloadFile:n},reducer:[r]}=m.useContext(qt),i=m.useMemo(()=>r.activeFolder==="root",[r.activeFolder]);return{columns:m.useMemo(()=>[{fieldName:"id",caption:"id",type:"number",isVisible:!1},...i?[{fieldName:"folderName",caption:t.folder,type:"string"}]:[],{fieldName:"--icon",caption:"",type:"string",valueFormat:o=>v.jsx(BT,{fileExtension:o.row.original.fileExtension}),width:36,align:"center",filterType:"none",noSort:!0},{fieldName:"name",caption:t.name,type:"string"},{fieldName:"description",caption:t.description,type:"string"},{fieldName:"fileExtension",caption:t.fileExtension,type:"string",filterType:"select",width:50},{fieldName:"--downloadButton",caption:"",type:"number",filterType:"none",width:38,align:"center",noSort:!0,valueFormat:o=>v.jsx(Ql,{className:LT.downloadButton,onClick:()=>n(o.row.original.id,!0),children:v.jsx(e,{icon:"file-download"})})},{fieldName:"documentTypeName",caption:t.documentType,type:"string",filterType:"select"},{fieldName:"validToDate",caption:t.validSince,type:"date"},{fieldName:"size",caption:t.size,type:"number",valueFormat:({cell:{value:o}})=>o!==void 0?xa(o*1024*1024):"",filterType:"none"},{fieldName:"archive",caption:t.archived,type:"boolean",filterType:"select",valueFormat:({cell:{value:o}})=>o?t.yes[0]:t.no[0]}],[e,t.archived,t.description,t.documentType,t.fileExtension,t.folder,t.name,t.no,t.size,t.validSince,t.yes,n,i])}},hte=({BnfTableComponent:e,tableIdentifier:t,writePermissions:n})=>{const{reducer:[r,i]}=m.useContext(qt),{columns:a}=fte(),o=m.useCallback(h=>{i({type:"mark-files-by-action",setStateAction:h})},[i]),s=m.useMemo(()=>r.activeFolder==="root",[r.activeFolder]),c=m.useMemo(()=>{var h;return r.activeFolder==="root"?!1:((h=r.foldersMap.get(r.activeFolder))==null?void 0:h.onlyRead)??!1},[r.activeFolder,r.foldersMap]),l=m.useMemo(()=>({enabled:n&&!s,idField:"id",selectedRows:r.markedFiles,setSelectedRows:o}),[s,o,r.markedFiles,n]),u=m.useMemo(()=>r.activeFolder==="root"?r.filteredFiles:r.filteredFiles.filter(h=>h.folderId===r.activeFolder),[r.activeFolder,r.filteredFiles]),{getDraggableProps:d}=sg(),f=m.useCallback(h=>n===!1||c?{}:d(h.id),[d,c,n]);return v.jsx("div",{className:Q(LT.wrapper),children:v.jsx(e,{data:u,columnsDef:a,rowSelection:l,useScrollableContainer:!0,getRowProps:f,defaultConfig:{defaultFilters:[{id:"archive",value:"false"}]},tableId:t,searchStatePrefix:"docs",useSearchState:!0,hideBottomBar:!0},r.activeFolder)})},pte="_wrapper_1q562_1",mte="_divButtons_1q562_10",df={wrapper:pte,divButtons:mte},gte="_wrapper_1bpdd_1",vte="_fileInput_1bpdd_5",my={wrapper:gte,fileInput:vte},bte=({entityId:e,entityType:t,children:n,disabled:r})=>{const i=m.useRef(null),[a,o]=m.useState(null),{reducer:[s]}=m.useContext(qt),c=f=>{var h;(((h=f.target.files)==null?void 0:h.length)??0)>0&&o(f.target.files)},l=m.useCallback(()=>{o(null),i.current&&(i.current.value="")},[]),u=m.useMemo(()=>`documents-upload-${t}-${e}`,[e,t]),d=m.useMemo(()=>r||s.activeFolder==="root",[r,s.activeFolder]);return v.jsxs("div",{className:my.wrapper,children:[v.jsx("label",{htmlFor:u,className:Q("btn btn-context luminus-context-button",d?"disabled":void 0),children:n}),v.jsx("input",{id:u,type:"file",multiple:!0,onChange:c,className:my.fileInput,ref:i,disabled:d}),a!==null?v.jsx(cg,{handleClose:l,files:a}):void 0]})},Gn=({children:e,onClick:t,className:n,disabled:r=!1})=>v.jsx(Ql,{onClick:t,className:n,disabled:r,children:e}),yte=({className:e,entityId:t,entityType:n})=>{var $,R;const{texts:{documents:r}}=m.useContext(Pt),{prompt:i}=hx(),{confirm:a}=_p(),{apiActions:o,reducer:[s,c]}=m.useContext(qt),{deleteFiles:l,renameFiles:u,downloadAsZip:d,archivateFiles:f,deleteDirectory:h}=o,{renameFolder:g}=PT(),p=m.useMemo(()=>s.markedFiles.length===0,[s.markedFiles.length]),b=m.useMemo(()=>s.markedFiles.length===1,[s.markedFiles.length]),x=m.useCallback(async()=>{if(s.activeFolder==="root")return;const S=await i(r.enterNewFolderName,{input:"input"});S!==null&&g(s.activeFolder,S)},[r.enterNewFolderName,i,g,s.activeFolder]),_=m.useCallback(async()=>{if(s.activeFolder==="root")return;const S=await i(r.enterNewFileName,{input:"input"});S!==null&&u(S)},[r.enterNewFileName,i,u,s.activeFolder]),y=m.useMemo(()=>s.activeFolder==="root",[s.activeFolder]),C=m.useMemo(()=>{var S;return s.activeFolder==="root"?!1:((S=s.foldersMap.get(s.activeFolder))==null?void 0:S.onlyRead)??!1},[s.activeFolder,s.foldersMap]),w=m.useMemo(()=>s.markedFiles.every(S=>{var k;return((k=s.constantFiles.find(O=>O.id===S))==null?void 0:k.archive)===!1}),[s.constantFiles,s.markedFiles]),T=m.useMemo(()=>s.markedFiles.every(S=>{var k;return((k=s.constantFiles.find(O=>O.id===S))==null?void 0:k.archive)===!0}),[s.constantFiles,s.markedFiles]);return v.jsx("div",{className:Q(e,df.wrapper,s.state==="folder-choosing"?"ignore-dim":void 0,"d-flex justify-content-between"),children:s.state!=="folder-choosing"?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:df.divButtons,children:[v.jsx(bte,{entityId:t,entityType:n,disabled:C,children:r.uploadFiles}),v.jsx(Gn,{onClick:()=>{c({type:"open-modal",modalType:"create-folder",chosenFolderId:s.activeFolder??"root"})},disabled:C,children:r.createFolder}),v.jsx(Gn,{disabled:s.activeFolder==="root"||(($=s.foldersMap.get(s.activeFolder))==null?void 0:$.isDefault),onClick:async()=>{var k;await a(`${r.deleteFolder} ${(k=s.foldersMap.get(s.activeFolder))==null?void 0:k.name}?`)&&h(s.activeFolder)},children:r.deleteFolder}),v.jsx(Gn,{disabled:s.activeFolder==="root"||((R=s.foldersMap.get(s.activeFolder))==null?void 0:R.isDefault),onClick:x,children:r.renameFolder})]}),!y&&!C?v.jsxs("div",{className:df.divButtons,children:[v.jsx(Gn,{onClick:()=>{c({type:"open-modal",modalType:"edit-file-properties"})},disabled:!b,children:r.editFileProperties}),v.jsx(Gn,{onClick:async()=>{await a(r.confirmDeleteFile(s.markedFiles.length))&&l(s.markedFiles)},disabled:p,children:r.delete}),T?v.jsx(Gn,{onClick:async()=>{await a(r.confirmDearchiveFile(s.markedFiles.length))&&await f(!0)},disabled:p,children:r.dearchivate}):v.jsx(Gn,{onClick:async()=>{await a(r.confirmArchiveFile(s.markedFiles.length))&&await f()},disabled:p||!w,children:r.archivate}),v.jsx(Gn,{onClick:_,disabled:p,children:r.rename}),v.jsx(Gn,{onClick:d,disabled:p,children:r.downloadZip})]}):null]}):s.state==="folder-choosing"?v.jsx(v.Fragment,{children:v.jsx(Gn,{onClick:()=>c({type:"return-from-folder-choosing"}),className:Q("ignore-dim","body-background-color"),children:r.back})}):void 0})},xte=({file:e})=>{const{confirm:t}=_p(),{reducer:[n],apiActions:{downloadFile:r}}=m.useContext(qt),{texts:{documents:i}}=m.useContext(Pt),a=m.useCallback(async()=>{await t(i.confirmFileDownload(e.name,e.size==null?void 0:xa(e.size*1024*1024)))&&r(e.id)},[t,i,r,e.id,e.name,e.size]);return v.jsxs(Fl,{action:!0,onClick:a,children:[v.jsx(dn,{variant:"body",className:"text-muted",children:NT(e.folderId,n.foldersMap)}),v.jsxs("div",{className:"d-flex justify-content-between gap-2",children:[v.jsx(dn,{variant:"body",children:e.name}),v.jsx(dn,{variant:"body",children:e.size==null?null:xa(e.size*1024*1024)})]})]})},_te="_typeSelect_m3myk_1",wte={typeSelect:_te},Cte=()=>{const{reducer:[e]}=m.useContext(qt),{texts:{documents:t}}=m.useContext(Pt),[n,r]=m.useState(""),[i,a]=m.useState(null),o=m.useMemo(()=>{const c=new Map;return e.filteredFiles.forEach(u=>{c.get(u.documentTypeId)===void 0&&c.set(u.documentTypeId,u.documentTypeName)}),[{id:null,name:t.all},...Array.from(c).map(u=>({id:u[0],name:u[1]}))]},[t.all,e.filteredFiles]),s=m.useMemo(()=>e.filteredFiles.filter(c=>pp(c.name,n)&&(i===null||c.documentTypeId===i)),[n,i,e.filteredFiles]);return v.jsxs("div",{className:"d-flex h-100 flex-column",children:[v.jsxs("div",{className:"d-flex gap-1 mb-1",children:[v.jsx(N2,{options:o,label:t.documentType,value:i,onChange:a,isNumber:!0,size:"sm",className:wte.typeSelect}),v.jsx(I2,{label:t.search,type:"text",value:n,onChange:c=>r(c===null?"":c),className:"flex-grow-1",size:"sm"})]}),v.jsx(B1,{className:"overflow-y-auto",children:s.map(c=>v.jsx(xte,{file:c},c.id))})]})};function Tte(e){return{name:e.name,defaultDocType:e.defaultDocType,childrenIds:[],parentId:e.parentId??null,isDefault:e.isDefault,onlyRead:e.onlyRead}}function kte(e){const t=[],n=new Map,r=new Map;return e.forEach(i=>{n.set(i.id,Tte(i)),i.parentId===null?t.push(i.id):r.set(i.id,i.parentId)}),r.forEach((i,a)=>{const o=n.get(i);if(o===void 0)throw new Error(`Did not get folder with ID ${i}, which is supposed to be parent directory of folder with ID ${a}`);o.childrenIds.push(a)}),{dirsMap:n,rootIds:t}}function gy(e,t){const n=t.toUpperCase();return e.filter(r=>{var a;const i=(a=r.name)==null?void 0:a.toUpperCase();return i==null?void 0:i.includes(n)})}function Ste(e,t){return e.map(n=>{var r;return{...n,folderName:((r=t.get(n.folderId))==null?void 0:r.name)??""}})}const Ote=([e,t],n,r)=>{const{texts:{documents:i}}=m.useContext(Pt),{startLoading:a,stopLoading:o}=m.useContext(Bl),{addNotification:s}=Yl(),c=Gl(),l=m.useCallback(async y=>{a("documentList");try{const w=(await c.get(`/documents/${n}/${r}`)).data,{dirsMap:T,rootIds:$}=kte(w.folders),R=Ste(w.documents,T);t({type:"load-data",files:R,foldersMap:T,rootFolderIds:$,setActiveFolder:y})}finally{o("documentList")}},[c,t,r,n,a,o]);m.useEffect(()=>{l(!0)},[l]);const u=m.useCallback(async()=>{a("documents-types");try{const y=await c.get(`/documents/types/${n}`);if(y.status!==200)throw new Error(`Unexpected status code: ${y.status}`);t({type:"load-document-types",documentTypes:y.data})}finally{o("documents-types")}},[c,t,n,a,o]);m.useEffect(()=>{u()},[u]);const d=m.useCallback(async(y,C)=>{const w=C??e.markedFiles;a("documentsMove");try{await c.put(`/documents/move-to-folder?folderId=${y}`,w),t({type:"update-files",fileIds:w,newProperties:{folderId:y}}),s(i.fileMoveSuccessful(w.length,e.foldersMap.get(y).name),"success")}finally{o("documentsMove")}},[e.markedFiles,e.foldersMap,a,c,t,s,i,o]),f=m.useCallback(async y=>{const C=y??e.markedFiles;a("documentsFilesDelete");try{const w=await c.delete(`/documents/delete?${Af(C,"documentIds")}`);if(w.status!==200)throw new Error(`Unexpected status code: ${w.status}`);t({type:"delete-files",fileIds:C}),s(i.fileDeleteSuccessful(C.length),"success")}finally{o("documentsFilesDelete")}},[e.markedFiles,a,c,t,s,i,o]),h=m.useCallback(async y=>{var C;if(!(y==="root"||(C=e.foldersMap.get(y))!=null&&C.isDefault)){a("documentsFolderDelete");try{const w=await c.delete(`/documents/folder/${y}`);if(w.status!==200)throw new Error(`Unexpected status code: ${w.status}`);t({type:"delete-folder",folderId:y}),s(i.folderDeleteSuccessful(e.foldersMap.get(y).name),"success")}finally{o("documentsFolderDelete")}}},[e.foldersMap,a,c,t,s,i,o]),g=m.useCallback(async y=>{a("documentsRename");try{const C=await c.put("/documents/update-name",{documentIds:e.markedFiles,name:y});if(C.status!==200)throw new Error(`Unexpected status code: ${C.status}`);l()}finally{o("documentsRename")}},[a,c,e.markedFiles,l,o]),p=m.useCallback(async y=>{a("documents-archivate");try{const C=await c.put(`/documents/${y?"dearchive":"archive"}`,e.markedFiles);if(C.status!==200)throw new Error(`Unexpected status code: ${C.status}`);t({type:"update-files",fileIds:e.markedFiles,newProperties:{archive:!y}}),s((y?i.dearchivateSuccessful:i.archivateSuccessful)(e.markedFiles.length),"success")}finally{o("documents-archivate")}},[a,c,e.markedFiles,t,s,i.archivateSuccessful,i.dearchivateSuccessful,o]),b=m.useCallback(async()=>{var C;if(e.activeFolder==="root")return;const y=e.markedFiles.length;s(i.downloadAsZip(y),"info"),a("documents-ZIP_download");try{const w=await c.get(`/documents/download-zip?${Af(e.markedFiles,"documentIds")}`,{responseType:"blob"});Hc(w.data,(((C=e.foldersMap.get(e.activeFolder))==null?void 0:C.name)??"")+"_files")}finally{o("documents-ZIP_download")}},[e.activeFolder,e.markedFiles,e.foldersMap,s,i,a,c,o]),x=m.useCallback(async(y,C)=>{s(i.downloadingFile,"info"),a("documents-downloading_file");try{const w=await c.get(`/documents/${y}?isSmall=true`,{responseType:"blob"}),T=e.constantFiles.find(R=>R.id===y),$=`${(T==null?void 0:T.name)??y.toString()}.${T!=null&&T.fileExtension?T==null?void 0:T.fileExtension.toLowerCase():"unknown"}`;Hc(w.data,$,C)}finally{o("documents-downloading_file")}},[s,i.downloadingFile,a,c,e.constantFiles,o]),_=m.useCallback(async(y,C)=>{a("documents-upload"),s(i.uploadingDocuments,"info");try{await c.postForm("/documents/upload",{files:y,...C}),await l()}finally{o("documents-upload")}},[a,s,i.uploadingDocuments,c,l,o]);return{loadDocuments:l,moveDocuments:d,deleteFiles:f,deleteDirectory:h,renameFiles:g,archivateFiles:p,downloadAsZip:b,downloadFile:x,uploadFiles:_}},Ete=(e,t)=>{var n,r;switch(t.type){case"load-data":{const i={...e,constantFiles:t.files,filteredFiles:gy(t.files,e.searchString),foldersMap:t.foldersMap,rootFolderIds:t.rootFolderIds};if(t.setActiveFolder){const a=t.rootFolderIds.find(o=>t.files.some(s=>s.archive===!1&&s.folderId===o))??"root";i.activeFolder=a}return i}case"load-document-types":return{...e,documentTypes:t.documentTypes};case"select-folder":return{...e,activeFolder:t.folderId,markedFiles:[]};case"mark-file":{const i=e.markedFiles.includes(t.fileId)?[...e.markedFiles.filter(a=>a!==t.fileId)]:[...e.markedFiles,t.fileId];return{...e,state:i.length>0?"selection-file":"explorer",markedFiles:i}}case"mark-files-by-action":{const i=typeof t.setStateAction=="function"?t.setStateAction(e.markedFiles):t.setStateAction;return{...e,state:i.length>0?"selection-file":"explorer",markedFiles:i}}case"mark-all-files":return e.markedFiles.length<e.filteredFiles.filter(i=>i.folderId===e.activeFolder).length?{...e,markedFiles:e.filteredFiles.filter(i=>i.folderId===e.activeFolder).map(i=>i.id),state:"explorer"}:{...e,markedFiles:[],state:"explorer"};case"enter-folder-choosing":return e.state==="folder-choosing"||e.state==="openned-modal"?e:{...e,state:"folder-choosing",canTargetRoot:t.canTargetRoot??!1,previousState:e.state,choosingType:t.choosingType};case"return-from-folder-choosing":return e.state!=="folder-choosing"?e:{...e,state:e.previousState};case"update-files":return{...e,filteredFiles:[...e.filteredFiles.map(i=>t.fileIds.includes(i.id)?{...i,...t.newProperties}:i)],constantFiles:[...e.constantFiles.map(i=>t.fileIds.includes(i.id)?{...i,...t.newProperties}:i)],markedFiles:[],state:"explorer"};case"update-folders":{const i=new Map(e.foldersMap);return t.folderIds.forEach(a=>{i.set(a,{...e.foldersMap.get(a),...t.newProperties})}),{...e,foldersMap:i}}case"delete-files":return{...e,filteredFiles:[...e.filteredFiles.filter(i=>!t.fileIds.includes(i.id))],constantFiles:[...e.constantFiles.filter(i=>!t.fileIds.includes(i.id))],markedFiles:e.markedFiles.filter(i=>!t.fileIds.includes(i)),state:"explorer"};case"open-modal":switch(t.modalType){case"create-folder":return{...e,state:"openned-modal",modalType:t.modalType,chosenFolderId:t.chosenFolderId};default:return{...e,state:"openned-modal",modalType:t.modalType}}case"close-modal":return{...e,state:"explorer"};case"delete-folder":{const i=new Map(e.foldersMap),a=(n=i.get(t.folderId))==null?void 0:n.parentId;let o=[...e.rootFolderIds];if(a){const s=JSON.parse(JSON.stringify(i.get(a)));s.childrenIds=s.childrenIds.filter(c=>c!==t.folderId),i.set(a,s)}else o=o.filter(s=>s!==t.folderId);return i.delete(t.folderId),{...e,rootFolderIds:o,foldersMap:i,activeFolder:"root"}}case"create-folder":{const i=new Map(e.foldersMap);i.set(t.folderId,{name:t.folderData.name,defaultDocType:(r=e.documentTypes.find(o=>o.id===t.folderData.documentTypeId))==null?void 0:r.name,childrenIds:[],parentId:t.folderData.parentFolderId,isDefault:!1,onlyRead:t.isOnlyRead});const a=[...e.rootFolderIds];if(t.folderData.parentFolderId===null)a.push(t.folderId);else{const o=i.get(t.folderData.parentFolderId),s=JSON.parse(JSON.stringify(o));s.childrenIds.push(t.folderId),i.set(t.folderData.parentFolderId,s)}return{...e,state:"explorer",rootFolderIds:a,foldersMap:i}}case"search-files":{const i=gy(e.constantFiles,t.searchString);return{...e,searchString:t.searchString,filteredFiles:i,markedFiles:e.markedFiles.filter(a=>i.map(o=>o.id).includes(a))}}default:throw new Error("Wrong action.type specified.")}},Mte=()=>{const e={state:"explorer",activeFolder:"root",searchString:"",filteredFiles:[],constantFiles:[],foldersMap:new Map,rootFolderIds:[],markedFiles:[],documentTypes:[]},[t,n]=m.useReducer(Ete,e);return[t,n]},$te=m.memo(({entityType:e,entityId:t,className:n,BnfTableComponent:r,tableIdentifier:i,customRootFolderName:a,writePermissions:o=!0,...s})=>{const{isMobile:c}=$s(),{ProjectIconComponent:l,texts:{documents:u}}=m.useContext(Pt),[d,f]=Mte(),[h,g]=m.useState(null),{loadDocuments:p,...b}=Ote([d,f],e,t),x=m.useMemo(()=>({entityId:t,entityType:e,apiActions:b,loadDocuments:p,reducer:[d,f]}),[t,e,b,p,d,f]),{getDropProps:_}=sg();return c?v.jsx(qt.Provider,{value:x,children:v.jsx(Cte,{})}):v.jsx("div",{...s,className:Q(ai.wrapper,n),onDragOver:y=>{y.dataTransfer.dropEffect="none",y.stopPropagation(),y.preventDefault()},onDragEnter:y=>{y.dataTransfer.dropEffect="none",y.stopPropagation(),y.preventDefault()},children:v.jsxs(qt.Provider,{value:x,children:[v.jsx("div",{className:Q(d.state==="folder-choosing"?"dim-others":void 0,ai.explorerWindow),children:v.jsxs("ul",{className:ai.folderList,children:[v.jsx(Lee,{customText:a??e}),d.rootFolderIds.map(y=>v.jsx(FT,{dirId:y,writePermissions:o},y))]})}),v.jsxs("div",{className:Q(ai.explorerWindow,ai.fileList),...o&&Gee(d)?_(d.activeFolder,{onFilesDrop:y=>g(y),ignoreInner:!0}):{},children:[v.jsxs("div",{className:ai.dndText,children:[v.jsx(l,{icon:"file-upload",iconProps:{style:{marginRight:0}}}),v.jsx("span",{children:u.dropToUpload})]}),v.jsx(hte,{tableIdentifier:i,BnfTableComponent:r,writePermissions:o},(d.activeFolder==="root").toString())]}),o?v.jsx(yte,{className:ai.controls,entityType:e,entityId:t}):null,v.jsx(qee,{}),h!==null?v.jsx(cg,{files:h,handleClose:()=>g(null),targetFolderId:d.activeFolder==="root"?void 0:d.activeFolder}):null]})})}),Rte=m.createContext(void 0);exports.AbstractModalHeader=Y1;exports.Alert=Ap;exports.ApprovalState=VE;exports.AuthContext=Tp;exports.AvatarIcon=x2;exports.Backdrop=A2;exports.BaseModal=U1;exports.BootstrapModalManager=z1;exports.Button=qh;exports.Col=Gh;exports.ConfirmContext=dx;exports.ContextButton=Ql;exports.CustomSelectInput=N2;exports.DelegationContext=g2;exports.Documents=$te;exports.Dropdown=Op;exports.DropdownDivider=_2;exports.DropdownItem=la;exports.DropdownToggle=Sp;exports.ENTERED=Ir;exports.ENTERING=mr;exports.EXITED=Pr;exports.EXITING=jc;exports.FaMinus=r8;exports.FaPlus=i8;exports.FaSearch=a8;exports.Fade=zr;exports.FileExtensionIcon=BT;exports.FileUploadContextButton=w5;exports.FloatingLabelInput=eu;exports.Form=sr;exports.FormCheckInput=Nl;exports.FormControl=M1;exports.FormDisabledContext=b2;exports.FormSelect=ip;exports.FromToDatePickerDropdownToggle=u7;exports.HelmetContext=v2;exports.HookFormTextAreaInput=og;exports.HookFormTextInput=$a;exports.HtmlTooltip=wx;exports.IconButton=Rs;exports.Ie=HE;exports.InputAnchorContainer=P2;exports.InvalidFeedback=Jl;exports.ListGroup=B1;exports.ListGroupItem=Fl;exports.LoadingContext=Bl;exports.LoginState=vx;exports.LuminusComponentsContext=Pt;exports.MdArrowRight=jO;exports.MdCheck=PO;exports.MdCircle=AO;exports.MdClear=ks;exports.MdOutlineAddCircleOutline=WO;exports.MdOutlineArrowOutward=IO;exports.MdOutlineCameraAlt=YO;exports.MdOutlineChevronRight=XO;exports.MdOutlineClose=lx;exports.MdOutlineDelete=sx;exports.MdOutlineEdit=GO;exports.MdOutlineExpand=NO;exports.MdOutlineFileUpload=cx;exports.MdOutlineKeyboardArrowLeft=HO;exports.MdOutlineKeyboardArrowRight=VO;exports.MdOutlineKeyboardDoubleArrowLeft=qO;exports.MdOutlineMenu=QO;exports.MdOutlinePhotoLibrary=ZO;exports.MdOutlineStar=eE;exports.MdSave=RO;exports.MdSaveAs=$O;exports.MdSearch=MO;exports.MiniDetailWrapper=D2;exports.Modal=bn;exports.ModalContext=cp;exports.NoInputContainer=j2;exports.Oe=I;exports.PageContainer=kee;exports.PrimaryButton=Mi;exports.PromptContext=fx;exports.Re=pee;exports.ResponsiveContextDropdown=R2;exports.ResponsiveContextDropdownItem=$p;exports.RowLabelInput=As;exports.ShortcutLinksContext=Rte;exports.SideContentBar=$T;exports.SimpleDropdownToggle=kp;exports.SimplePicker=C2;exports.SimpleTooltip=hp;exports.Spinner=dp;exports.TextInput=I2;exports.TransitionWrapper=Fy;exports.Typography=dn;exports.UserAvatarToggle=P5;exports.UserContext=bx;exports._=Hq;exports._extends=Ac;exports._inheritsLoose=$y;exports._objectWithoutPropertiesLoose=Dh;exports.a=w2;exports.addLeadingZeros=dt;exports.addMonths=by;exports.addYears=ky;exports.atobUtf8=Tx;exports.buildEmployeeNameString=cM;exports.buildOrgUnitString=lM;exports.buildVehicleNameString=sM;exports.cancelToken=h$;exports.capitalizeFirstLetter=oM;exports.classNames=Q;exports.classes=y2;exports.compareDate=fM;exports.compareDateTime=hM;exports.constructFrom=zn;exports.context=Il;exports.differenceInCalendarDays=Ty;exports.divWithClassName=Wh;exports.extractErrorsFromResponse=fp;exports.extractFilename=Ex;exports.extractPermissionsFromResponse=_x;exports.fixNameIdNulls=yx;exports.format=Ih;exports.formatDate=iM;exports.formatDateTime=aM;exports.formatFileSize=xa;exports.getDateString=yM;exports.getDaysDifference=pM;exports.getDefaultExportFromCjs=Rt;exports.getFirstDayOfMonth=Sx;exports.getFirstDayOfOffsetMonth=mM;exports.getFirstDayOfYear=vM;exports.getLastDayOfMonth=Ox;exports.getLastDayOfOffsetMonth=gM;exports.getLastDayOfYear=bM;exports.getSharedManager=H1;exports.getTimezoneOffsetInMilliseconds=pf;exports.hasOnlyNullValues=xx;exports.hookFormSetServerErrors=YE;exports.invariant=mf;exports.isISODate=kx;exports.isPrimitive=zc;exports.isValidDate=dM;exports.joinStrings=Bo;exports.jsxRuntimeExports=v;exports.millisecondsInHour=kl;exports.millisecondsInMinute=jh;exports.millisecondsInWeek=Ah;exports.msToStartOfNextDay=uM;exports.openFileFromResponse=_M;exports.parseISO=Ol;exports.pe=fK;exports.replaceNullValuesOnlyObjectsWithNulls=qE;exports.requireReactIs=Fh;exports.saveFile=Hc;exports.saveFileFromResponse=xM;exports.secondsInDay=Ph;exports.secondsInHour=yy;exports.secondsInMinute=ZT;exports.secondsInMonth=_y;exports.secondsInQuarter=XT;exports.secondsInWeek=KT;exports.secondsInYear=xy;exports.shortenText=rM;exports.startOfDay=hf;exports.startOfWeek=pa;exports.stringContains=Mx;exports.stringSearchWithin=pp;exports.stringStartsWith=$x;exports.style=Wr;exports.t=fd;exports.toDate=sn;exports.transitionEndListener=Dy;exports.triggerBrowserReflow=Ny;exports.trimIsoDate=Wl;exports.truncateText=Cx;exports.urlfyArray=Af;exports.useAuth=t2;exports.useAxios=Gl;exports.useBootstrapBreakpoints=Ry;exports.useBootstrapMinBreakpoint=Ay;exports.useBootstrapPrefix=He;exports.useClickOutside=f2;exports.useClipboard=m2;exports.useCol=Yy;exports.useConfirm=_p;exports.useCookies=xp;exports.useEventCallback=Et;exports.useFormControlType=Cp;exports.useFormDisabledContext=Xl;exports.useIsomorphicEffect=Po;exports.useKeyPress=p2;exports.useNotifications=Yl;exports.usePermissions=h2;exports.usePrompt=hx;exports.useSwipeable=Rp;exports.useWindowSize=$s;exports.useZodSchemaTypes=Kl;exports.z=Zt;