fansunited-widget-poll 2.20.0 → 2.20.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-widget-poll",
3
- "version": "2.20.0",
3
+ "version": "2.20.1",
4
4
  "main": "poll-manager.es.js",
5
5
  "author": "Fans United",
6
6
  "description": "",
@@ -97215,7 +97215,7 @@ const Xze = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors",
97215
97215
  const Q = c5e.finalizeNewRequestBody(K, E), Z = H ? E.languageConfig.default_language : "en";
97216
97216
  Q.language = Z;
97217
97217
  const re = E.languageConfig.translation_rules && ((te = E.languageConfig.translation_rules[Z]) == null ? void 0 : te.game_status) || "INACTIVE";
97218
- Q.status = re, G.push(R.createPoll(ce({}, Q)));
97218
+ Q.status = re, Q.branding = null, G.push(R.createPoll(ce({}, Q)));
97219
97219
  });
97220
97220
  try {
97221
97221
  const K = yield Promise.all(G), Q = [], Z = K.filter((re) => !re.ok).length;
@@ -3696,4 +3696,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3696
3696
  `));if(g!==null&&!u[g])throw new Error([`MUI X: id used for right axis "${g}" is not defined.`,`Available ids are: ${h.join(", ")}.`].join(`
3697
3697
  `));if(p!==null&&!s[p])throw new Error([`MUI X: id used for bottom axis "${p}" is not defined.`,`Available ids are: ${c.join(", ")}.`].join(`
3698
3698
  `));const m=xy(e,a,o),v=xy(i,a,o),y=xy(r,a,o),x=xy(n,a,o);return R.jsxs(D.Fragment,{children:[f&&R.jsx(fU,N({},m,{position:"top",axisId:f})),p&&R.jsx(fU,N({},v,{position:"bottom",axisId:p})),d&&R.jsx(mU,N({},y,{position:"left",axisId:d})),g&&R.jsx(mU,N({},x,{position:"right",axisId:g}))]})}function $je(t){return Ki("MuiChartsGrid",t)}const l_=ka("MuiChartsGrid",["root","line","horizontalLine","verticalLine"]),Lje=Or("g",{name:"MuiChartsGrid",slot:"Root",overridesResolver:(t,e)=>[{[`&.${l_.verticalLine}`]:e.verticalLine},{[`&.${l_.horizontalLine}`]:e.horizontalLine},e.root]})({}),gU=Or("line",{name:"MuiChartsGrid",slot:"Line",overridesResolver:(t,e)=>e.line})(({theme:t})=>({stroke:(t.vars||t).palette.divider,shapeRendering:"crispEdges",strokeWidth:1}));function jje(t){const{axis:e,drawingArea:r,classes:n}=t,{scale:i,tickNumber:a,tickInterval:o}=e,s=vy({scale:i,tickNumber:a,tickInterval:o});return R.jsx(D.Fragment,{children:s.map(({value:c,offset:u})=>R.jsx(gU,{y1:r.top,y2:r.top+r.height,x1:u,x2:u,className:n.verticalLine},`vertical-${c}`))})}function Fje(t){const{axis:e,drawingArea:r,classes:n}=t,{scale:i,tickNumber:a,tickInterval:o}=e,s=vy({scale:i,tickNumber:a,tickInterval:o});return R.jsx(D.Fragment,{children:s.map(({value:c,offset:u})=>R.jsx(gU,{y1:u,y2:u,x1:r.left,x2:r.left+r.width,className:n.horizontalLine},`horizontal-${c}`))})}const Nje=["vertical","horizontal"],Bje=({classes:t})=>Yi({root:["root"],verticalLine:["line","verticalLine"],horizontalLine:["line","horizontalLine"]},$je,t);function zje(t){const e=ws({props:t,name:"MuiChartsGrid"}),r=aa(),{vertical:n,horizontal:i}=e,a=Fe(e,Nje),{xAxis:o,xAxisIds:s,yAxis:c,yAxisIds:u}=oa(),h=Bje(e),d=c[u[0]],p=o[s[0]];return R.jsxs(Lje,N({},a,{className:h.root,children:[n&&R.jsx(jje,{axis:p,drawingArea:r,classes:h}),i&&R.jsx(Fje,{axis:d,drawingArea:r,classes:h})]}))}function Uje(t){return typeof t=="function"?t():t}const Hje=D.forwardRef(function(e,r){const{children:n,container:i,disablePortal:a=!1}=e,[o,s]=D.useState(null),c=_d(D.isValidElement(n)?goe(n):null,r);if(Qo(()=>{a||s(Uje(i)||document.body)},[i,a]),Qo(()=>{if(o&&!a)return Fw(r,o),()=>{Fw(r,null)}},[r,o,a]),a){if(D.isValidElement(n)){const u={ref:c};return D.cloneElement(n,u)}return n}return o&&_p.createPortal(n,o)});function Vje(t){return Ki("MuiPopper",t)}ka("MuiPopper",["root"]);function Wje(t,e){if(e==="ltr")return t;switch(t){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return t}}function c_(t){return typeof t=="function"?t():t}function qje(t){return t.nodeType!==void 0}const Gje=t=>{const{classes:e}=t;return Yi({root:["root"]},Vje,e)},Yje={},Kje=D.forwardRef(function(e,r){var F;const M=e,{anchorEl:n,children:i,direction:a,disablePortal:o,modifiers:s,open:c,placement:u,popperOptions:h,popperRef:d,slotProps:p={},slots:f={},TransitionProps:g,ownerState:m}=M,v=er(M,["anchorEl","children","direction","disablePortal","modifiers","open","placement","popperOptions","popperRef","slotProps","slots","TransitionProps","ownerState"]),y=D.useRef(null),x=_d(y,r),b=D.useRef(null),C=_d(b,d),w=D.useRef(C);Qo(()=>{w.current=C},[C]),D.useImperativeHandle(d,()=>b.current,[]);const S=Wje(u,a),[T,k]=D.useState(S),[O,P]=D.useState(c_(n));D.useEffect(()=>{b.current&&b.current.forceUpdate()}),D.useEffect(()=>{n&&P(c_(n))},[n]),Qo(()=>{if(!O||!c)return;const z=W=>{k(W.placement)};let q=[{name:"preventOverflow",options:{altBoundary:o}},{name:"flip",options:{altBoundary:o}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:W})=>{z(W)}}];s!=null&&(q=q.concat(s)),h&&h.modifiers!=null&&(q=q.concat(h.modifiers));const H=HO(O,y.current,ze(ce({placement:S},h),{modifiers:q}));return w.current(H),()=>{H.destroy(),w.current(null)}},[O,o,s,c,h,S]);const A={placement:T};g!==null&&(A.TransitionProps=g);const _=Gje(e),E=(F=f.root)!=null?F:"div",L=wi({elementType:E,externalSlotProps:p.root,externalForwardedProps:v,additionalProps:{role:"tooltip",ref:x},ownerState:e,className:_.root});return R.jsx(E,ze(ce({},L),{children:typeof i=="function"?i(A):i}))}),Jje=Or(D.forwardRef(function(e,r){const P=e,{anchorEl:n,children:i,container:a,direction:o="ltr",disablePortal:s=!1,keepMounted:c=!1,modifiers:u,open:h,placement:d="bottom",popperOptions:p=Yje,popperRef:f,style:g,transition:m=!1,slotProps:v={},slots:y={}}=P,x=er(P,["anchorEl","children","container","direction","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","style","transition","slotProps","slots"]),[b,C]=D.useState(!0),w=()=>{C(!1)},S=()=>{C(!0)};if(!c&&!h&&(!m||b))return null;let T;if(a)T=a;else if(n){const A=c_(n);T=A&&qje(A)?jw(A).body:jw(null).body}const k=!h&&c&&(!m||b)?"none":void 0,O=m?{in:h,onEnter:w,onExited:S}:void 0;return R.jsx(Hje,{disablePortal:s,container:T,children:R.jsx(Kje,ze(ce({anchorEl:n,direction:o,disablePortal:s,modifiers:u,ref:r,open:m?!b:h,placement:d,popperOptions:p,popperRef:f,slotProps:v,slots:y},x),{style:ce({position:"fixed",top:0,left:0,display:k},g),TransitionProps:O,children:i}))})}),{name:"MuiPopper",slot:"Root",overridesResolver:(t,e)=>e.root})({}),Qje=D.forwardRef(function(e,r){var k;const n=Lse(),T=tC({props:e,name:"MuiPopper"}),{anchorEl:a,component:o,components:s,componentsProps:c,container:u,disablePortal:h,keepMounted:d,modifiers:p,open:f,placement:g,popperOptions:m,popperRef:v,transition:y,slots:x,slotProps:b}=T,C=er(T,["anchorEl","component","components","componentsProps","container","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","transition","slots","slotProps"]),w=(k=x==null?void 0:x.root)!=null?k:s==null?void 0:s.Root,S=ce({anchorEl:a,container:u,disablePortal:h,keepMounted:d,modifiers:p,open:f,placement:g,popperOptions:m,popperRef:v,transition:y},C);return R.jsx(Jje,ze(ce({as:o,direction:n?"rtl":"ltr",slots:{root:w},slotProps:b!=null?b:c},S),{ref:r}))});function vU(t){const{children:e,defer:r=!1,fallback:n=null}=t,[i,a]=D.useState(!1);return Qo(()=>{r||a(!0)},[r]),D.useEffect(()=>{r&&a(!0)},[r]),i?e:n}const vu=D.createContext({item:null,axis:{x:null,y:null},useVoronoiInteraction:!1,dispatch:()=>null}),Xje=(t,e)=>{switch(e.type){case"enterItem":return N({},t,{item:e.data});case"exitChart":return t.item===null&&t.axis.x===null&&t.axis.y===null?t:N({},t,{axis:{x:null,y:null},item:null});case"updateVoronoiUsage":return N({},t,{useVoronoiInteraction:e.useVoronoiInteraction});case"leaveItem":return t.item===null||Object.keys(e.data).some(r=>e.data[r]!==t.item[r])?t:N({},t,{item:null});case"updateAxis":return e.data.x===t.axis.x&&e.data.y===t.axis.y?t:N({},t,{axis:e.data});default:return t}};function Zje(t){const{children:e}=t,[r,n]=D.useReducer(Xje,{item:null,axis:{x:null,y:null},useVoronoiInteraction:!1}),i=D.useMemo(()=>N({},r,{dispatch:n}),[r]);return R.jsx(vu.Provider,{value:i,children:e})}function eFe(t){if(t===null)return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,right:0,bottom:0,left:0,toJSON:()=>""})};const{x:e,y:r}=t,n={width:0,height:0,x:e,y:r,top:r,right:e,bottom:r,left:e};return{getBoundingClientRect:()=>N({},n,{toJSON:()=>JSON.stringify(n)})}}function tFe(){const t=a_(),[e,r]=D.useState(null);return D.useEffect(()=>{const n=t.current;if(n===null)return()=>{};const i=o=>{o.pointerType!=="mouse"&&r(null)},a=o=>{r({x:o.clientX,y:o.clientY,height:o.height,pointerType:o.pointerType})};return n.addEventListener("pointerdown",a),n.addEventListener("pointermove",a),n.addEventListener("pointerup",i),()=>{n.removeEventListener("pointerdown",a),n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",i)}},[t]),e}function rFe(t,e){if(t==="item")return e!==null;const r=e.x!==null,n=e.y!==null;return r||n}function nFe(t){return t instanceof Date?t.toUTCString():t.toLocaleString()}function iFe(t){return Ki("MuiChartsTooltip",t)}const yU=ka("MuiChartsTooltip",["root","paper","table","row","cell","mark","markCell","labelCell","valueCell"]),bU=Or("div",{name:"MuiChartsTooltip",slot:"Container",overridesResolver:(t,e)=>e.paper})(({theme:t})=>({boxShadow:t.shadows[1],backgroundColor:(t.vars||t).palette.background.paper,color:(t.vars||t).palette.text.primary,transition:t.transitions.create("box-shadow"),borderRadius:t.shape.borderRadius})),xU=Or("table",{name:"MuiChartsTooltip",slot:"Table",overridesResolver:(t,e)=>e.table})(({theme:t})=>({borderSpacing:0,"& thead td":{borderBottom:`solid ${(t.vars||t).palette.divider} 1px`}})),u_=Or("tr",{name:"MuiChartsTooltip",slot:"Row",overridesResolver:(t,e)=>e.row})(({theme:t})=>({"tr:first-of-type& td":{paddingTop:t.spacing(1)},"tr:last-of-type& td":{paddingBottom:t.spacing(1)}})),Tl=Or("td",{name:"MuiChartsTooltip",slot:"Cell",overridesResolver:(t,e)=>e.cell})(({theme:t})=>({verticalAlign:"middle",color:(t.vars||t).palette.text.secondary,[`&.${yU.labelCell}`]:{paddingLeft:t.spacing(1)},[`&.${yU.valueCell}`]:{paddingLeft:t.spacing(4),color:(t.vars||t).palette.text.primary},"td:first-of-type&":{paddingLeft:t.spacing(2)},"td:last-of-type&":{paddingRight:t.spacing(2)}})),wU=Or("div",{name:"MuiChartsTooltip",slot:"Mark",overridesResolver:(t,e)=>e.mark,shouldForwardProp:t=>vf(t)&&t!=="color"})(({theme:t,color:e})=>({width:t.spacing(1),height:t.spacing(1),borderRadius:"50%",boxShadow:t.shadows[1],background:e,borderColor:(t.vars||t).palette.background.paper,border:`solid ${(t.vars||t).palette.background.paper} ${t.spacing(.25)}`,boxSizing:"content-box"}));function aFe(t){var h;const{series:e,itemData:r,sx:n,classes:i,getColor:a}=t;if(r.dataIndex===void 0||!e.data[r.dataIndex])return null;const{displayedLabel:o,color:s}=e.type==="pie"?{color:a(r.dataIndex),displayedLabel:ko(e.data[r.dataIndex].label,"tooltip")}:{color:a(r.dataIndex),displayedLabel:ko(e.label,"tooltip")},c=e.type==="pie"?N({},e.data[r.dataIndex],{label:ko(e.data[r.dataIndex].label,"tooltip")}):e.data[r.dataIndex],u=(h=e.valueFormatter)==null?void 0:h.call(e,c,{dataIndex:r.dataIndex});return R.jsx(bU,{sx:n,className:i.paper,children:R.jsx(xU,{className:i.table,children:R.jsx("tbody",{children:R.jsxs(u_,{className:i.row,children:[R.jsx(Tl,{className:bt(i.markCell,i.cell),children:R.jsx(wU,{color:s,className:i.mark})}),R.jsx(Tl,{className:bt(i.labelCell,i.cell),children:o}),R.jsx(Tl,{className:bt(i.valueCell,i.cell),children:u})]})})})})}function oFe(t){var C,w,S,T,k,O,P,A;const{content:e,itemData:r,sx:n,classes:i,contentProps:a}=t,o=Cs()[r.type].series[r.seriesId],{xAxis:s,yAxis:c,xAxisIds:u,yAxisIds:h}=oa(),{zAxis:d,zAxisIds:p}=D.useContext(e_),f=Kz(),g=(w=(C=o.xAxisId)!=null?C:o.xAxisKey)!=null?w:u[0],m=(T=(S=o.yAxisId)!=null?S:o.yAxisKey)!=null?T:h[0],v=(O=(k=o.zAxisId)!=null?k:o.zAxisKey)!=null?O:p[0],y=(A=(P=f[o.type])==null?void 0:P.call(f,o,g&&s[g],m&&c[m],v&&d[v]))!=null?A:()=>"",x=e!=null?e:aFe,b=wi({elementType:x,externalSlotProps:a,additionalProps:{itemData:r,series:o,sx:n,classes:i,getColor:y},ownerState:{}});return R.jsx(x,N({},b))}function sFe(t){return typeof t.main=="string"}function lFe(t,e=[]){if(!sFe(t))return!1;for(const r of e)if(!t.hasOwnProperty(r)||typeof t[r]!="string")return!1;return!0}function cFe(t=[]){return([,e])=>e&&lFe(e,t)}function uFe(t){return Ki("MuiTypography",t)}ka("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const dFe={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},hFe=Tle(),pFe=t=>{const{align:e,gutterBottom:r,noWrap:n,paragraph:i,variant:a,classes:o}=t,s={root:["root",a,t.align!=="inherit"&&`align${Xa(e)}`,r&&"gutterBottom",n&&"noWrap",i&&"paragraph"]};return Yi(s,uFe,o)},fFe=Or("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,r.variant&&e[r.variant],r.align!=="inherit"&&e[`align${Xa(r.align)}`],r.noWrap&&e.noWrap,r.gutterBottom&&e.gutterBottom,r.paragraph&&e.paragraph]}})(kM(({theme:t})=>{var e;return{margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(t.typography).filter(([r,n])=>r!=="inherit"&&n&&typeof n=="object").map(([r,n])=>({props:{variant:r},style:n})),...Object.entries(t.palette).filter(cFe()).map(([r])=>({props:{color:r},style:{color:(t.vars||t).palette[r].main}})),...Object.entries(((e=t.palette)==null?void 0:e.text)||{}).filter(([,r])=>typeof r=="string").map(([r])=>({props:{color:`text${Xa(r)}`},style:{color:(t.vars||t).palette.text[r]}})),{props:({ownerState:r})=>r.align!=="inherit",style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:r})=>r.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:r})=>r.gutterBottom,style:{marginBottom:"0.35em"}},{props:({ownerState:r})=>r.paragraph,style:{marginBottom:16}}]}})),CU={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},d_=D.forwardRef(function(e,r){const b=tC({props:e,name:"MuiTypography"}),{color:n}=b,i=er(b,["color"]),a=!dFe[n],o=hFe(ce(ce({},i),a&&{color:n})),C=o,{align:s="inherit",className:c,component:u,gutterBottom:h=!1,noWrap:d=!1,paragraph:p=!1,variant:f="body1",variantMapping:g=CU}=C,m=er(C,["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"]),v=ze(ce({},o),{align:s,color:n,className:c,component:u,gutterBottom:h,noWrap:d,paragraph:p,variant:f,variantMapping:g}),y=u||(p?"p":g[f]||CU[f])||"span",x=pFe(v);return R.jsx(fFe,ze(ce({as:y,ref:r,className:bt(x.root,c)},m),{ownerState:v,style:ce(ce({},s!=="inherit"&&{"--Typography-textAlign":s}),m.style)}))});let IU;class mFe{constructor(){if(this.types=new Set,IU)throw new Error("You can only create one instance!");IU=this.types}addType(e){this.types.add(e)}getTypes(){return this.types}}const wy=new mFe;wy.addType("bar"),wy.addType("line"),wy.addType("scatter");function SU(t){return wy.getTypes().has(t)}function gFe(t){return SU(t.type)}function vFe(t){var c;const{series:e,axis:r,dataIndex:n,axisValue:i,sx:a,classes:o}=t;if(n==null)return null;const s=(c=r.valueFormatter)!=null?c:u=>r.scaleType==="utc"?nFe(u):u.toLocaleString();return R.jsx(bU,{sx:a,className:o.paper,children:R.jsxs(xU,{className:o.table,children:[i!=null&&!r.hideTooltip&&R.jsx("thead",{children:R.jsx(u_,{children:R.jsx(Tl,{colSpan:3,children:R.jsx(d_,{children:s(i,{location:"tooltip"})})})})}),R.jsx("tbody",{children:e.filter(gFe).map(({id:u,label:h,valueFormatter:d,data:p,getColor:f})=>{var y;const g=d((y=p[n])!=null?y:null,{dataIndex:n});if(g==null)return null;const m=ko(h,"tooltip"),v=f(n);return R.jsxs(u_,{className:o.row,children:[R.jsx(Tl,{className:bt(o.markCell,o.cell),children:v&&R.jsx(wU,{color:v,className:o.mark})}),R.jsx(Tl,{className:bt(o.labelCell,o.cell),children:m?R.jsx(d_,{children:m}):null}),R.jsx(Tl,{className:bt(o.valueCell,o.cell),children:R.jsx(d_,{children:g})})]},u)})})]})})}function yFe(t){const{content:e,contentProps:r,axisData:n,sx:i,classes:a}=t,o=n.x&&n.x.index!==-1,s=o?n.x&&n.x.index:n.y&&n.y.index,c=o?n.x&&n.x.value:n.y&&n.y.value,{xAxisIds:u,xAxis:h,yAxisIds:d,yAxis:p}=oa(),{zAxisIds:f,zAxis:g}=D.useContext(e_),m=Cs(),v=Kz(),y=o?u[0]:d[0],x=D.useMemo(()=>{const S=[];return Object.keys(m).filter(SU).forEach(T=>{m[T].seriesOrder.forEach(k=>{var E,L,M,F,z,q;const O=m[T].series[k],P=(E=O.xAxisId)!=null?E:O.xAxisKey,A=(L=O.yAxisId)!=null?L:O.yAxisKey,_=o?P:A;if(_===void 0||_===y){const H=m[T].series[k],W=P!=null?P:u[0],j=A!=null?A:d[0],B=(F=(M=H.zAxisId)!=null?M:H.zAxisKey)!=null?F:f[0],V=(q=(z=v[T])==null?void 0:z.call(v,H,h[W],p[j],B&&g[B]))!=null?q:()=>"";S.push(N({},H,{getColor:V}))}})}),S},[y,v,o,m,h,u,p,d,g,f]),b=D.useMemo(()=>o?h[y]:p[y],[y,o,h,p]),C=e!=null?e:vFe,w=wi({elementType:C,externalSlotProps:r,additionalProps:{axisData:n,series:x,axis:b,dataIndex:s,axisValue:c,sx:i,classes:a},ownerState:{}});return R.jsx(C,N({},w))}const bFe=t=>{const{classes:e}=t;return Yi({root:["root"],paper:["paper"],table:["table"],row:["row"],cell:["cell"],mark:["mark"],markCell:["markCell"],labelCell:["labelCell"],valueCell:["valueCell"]},iFe,e)},xFe=Or(Qje,{name:"MuiChartsTooltip",slot:"Root",overridesResolver:(t,e)=>e.root})(({theme:t})=>({pointerEvents:"none",zIndex:t.zIndex.modal}));function wFe(t){var v,y,x;const e=ws({props:t,name:"MuiChartsTooltip"}),{trigger:r="axis",itemContent:n,axisContent:i,slots:a,slotProps:o}=e,s=tFe(),{item:c,axis:u}=D.useContext(vu),h=r==="item"?c:u,d=rFe(r,h),p=s!==null&&d,f=bFe({classes:e.classes}),g=(v=a==null?void 0:a.popper)!=null?v:xFe,m=wi({elementType:g,externalSlotProps:o==null?void 0:o.popper,additionalProps:{open:p,placement:(s==null?void 0:s.pointerType)==="mouse"?"right-start":"top",anchorEl:eFe(s),modifiers:[{name:"offset",options:{offset:[0,(s==null?void 0:s.pointerType)==="touch"?40-s.height:0]}}]},ownerState:{}});return r==="none"?null:R.jsx(vU,{children:p&&R.jsx(g,N({},m,{className:f.root,children:r==="item"?R.jsx(oFe,{itemData:h,content:(y=a==null?void 0:a.itemContent)!=null?y:n,contentProps:o==null?void 0:o.itemContent,sx:{mx:2},classes:f}):R.jsx(yFe,{axisData:h,content:(x=a==null?void 0:a.axisContent)!=null?x:i,contentProps:o==null?void 0:o.axisContent,sx:{mx:2},classes:f})}))})}const CFe={bar:t=>{const{seriesOrder:e,series:r}=t;return e.reduce((n,i)=>{const a=ko(r[i].label,"legend");return a===void 0||n.push({id:i,seriesId:i,color:r[i].color,label:a}),n},[])},scatter:t=>{const{seriesOrder:e,series:r}=t;return e.reduce((n,i)=>{const a=ko(r[i].label,"legend");return a===void 0||n.push({id:i,seriesId:i,color:r[i].color,label:a}),n},[])},line:t=>{const{seriesOrder:e,series:r}=t;return e.reduce((n,i)=>{const a=ko(r[i].label,"legend");return a===void 0||n.push({id:i,seriesId:i,color:r[i].color,label:a}),n},[])},pie:t=>{const{seriesOrder:e,series:r}=t;return e.reduce((n,i)=>(r[i].data.forEach(a=>{const o=ko(a.label,"legend");o!==void 0&&n.push({id:a.id,seriesId:i,color:a.color,label:o,itemId:a.id})}),n),[])}};function IFe(t){return Object.keys(t).flatMap(e=>{const r=CFe[e];return r===void 0?[]:r(t[e])})}function SFe(t){return Ki("MuiChartsLegend",t)}ka("MuiChartsLegend",["root","series","itemBackground","mark","label","column","row"]);const _Fe=["label"];function TFe(t,e,r,n,i,a,o){let s=0,c=0,u=0,h=0,d=0;const p=[0];return[t.map(g=>{let{label:m}=g,v=Fe(g,_Fe);const y=e(m,r),x=N({},v,{label:m,positionX:s,positionY:c,innerHeight:y.innerHeight,innerWidth:y.innerWidth,outerHeight:y.outerHeight,outerWidth:y.outerWidth,rowIndex:d});return n==="row"&&(s+y.innerWidth>i&&(s=0,c+=p[d],d+=1,p.length<=d&&p.push(0),x.positionX=s,x.positionY=c,x.rowIndex=d),u=Math.max(u,s+y.outerWidth),h=Math.max(h,c+y.outerHeight),p[d]=Math.max(p[d],y.outerHeight),s+=y.outerWidth),n==="column"&&(c+y.innerHeight>a&&(s=u+o,c=0,d=0,x.positionX=s,x.positionY=c,x.rowIndex=d),p.length<=d&&p.push(0),u=Math.max(u,s+y.outerWidth),h=Math.max(h,c+y.outerHeight),d+=1,c+=y.outerHeight),x}).map(g=>N({},g,{positionY:g.positionY+(n==="row"?p[g.rowIndex]/2:g.outerHeight/2)})),u,h]}function kFe(t){const e=VE(),{id:r,positionY:n,label:i,positionX:a,innerHeight:o,innerWidth:s,legendWidth:c,color:u,gapX:h,gapY:d,itemMarkHeight:p,itemMarkWidth:f,markGap:g,labelStyle:m,classes:v,onClick:y}=t;return R.jsxs("g",{className:bt(v==null?void 0:v.series,`${v==null?void 0:v.series}-${r}`),transform:`translate(${h+(e?c-a:a)} ${d+n})`,children:[R.jsx("rect",{x:e?-(s+2):-2,y:-p/2-2,width:s+4,height:o+4,fill:"transparent",className:v==null?void 0:v.itemBackground,onClick:y,style:{pointerEvents:y?"all":"none",cursor:y?"pointer":"unset"}}),R.jsx("rect",{className:v==null?void 0:v.mark,x:e?-f:0,y:-p/2,width:f,height:p,fill:u,style:{pointerEvents:"none"}}),R.jsx(np,{style:N({pointerEvents:"none"},m),text:i,x:(e?-1:1)*(f+g),y:0})]})}const AFe=["rotate","dominantBaseline"],PFe=Or("g",{name:"MuiChartsLegend",slot:"Root",overridesResolver:(t,e)=>e.root})({}),EFe=t=>typeof t=="number"?{left:t,right:t,top:t,bottom:t}:N({left:0,right:0,top:0,bottom:0},t);function OFe(t){const{position:e,direction:r,itemsToDisplay:n,classes:i,itemMarkWidth:a=20,itemMarkHeight:o=20,markGap:s=5,itemGap:c=10,padding:u=10,labelStyle:h,onItemClick:d}=t,p=Dd(),f=aa(),g=D.useMemo(()=>N({},p.typography.subtitle1,{color:"inherit",dominantBaseline:"central",textAnchor:"start",fill:(p.vars||p).palette.text.primary,lineHeight:1},h),[h,p]),m=D.useMemo(()=>EFe(u),[u]),v=D.useCallback((P,A={})=>{const _=Fe(A,AFe),E=s_({style:_,needsComputation:!0,text:P}),L={innerWidth:a+s+Math.max(...E.map(M=>M.width)),innerHeight:Math.max(o,E.length*E[0].height)};return N({},L,{outerWidth:L.innerWidth+c,outerHeight:L.innerHeight+c})},[c,o,a,s]),y=f.left+f.width+f.right,x=f.top+f.height+f.bottom,b=y-m.left-m.right,C=x-m.top-m.bottom,[w,S,T]=D.useMemo(()=>TFe(n,v,g,r,b,C,c),[n,v,g,r,b,C,c]),k=D.useMemo(()=>{switch(e.horizontal){case"left":return m.left;case"right":return y-m.right-S;default:return(y-S)/2}},[e.horizontal,m.left,m.right,y,S]),O=D.useMemo(()=>{switch(e.vertical){case"top":return m.top;case"bottom":return x-m.bottom-T;default:return(x-T)/2}},[e.vertical,m.top,m.bottom,x,T]);return R.jsx(vU,{children:R.jsx(PFe,{className:i==null?void 0:i.root,children:w.map((P,A)=>U.createElement(kFe,N({},P,{key:P.id,gapX:k,gapY:O,legendWidth:S,itemMarkHeight:o,itemMarkWidth:a,markGap:s,labelStyle:g,classes:i,onClick:d?_=>d(_,A):void 0})))})})}const RFe=["drawingArea","seriesToDisplay","hidden","onItemClick"],MFe=t=>({type:"series",color:t.color,label:t.label,seriesId:t.seriesId,itemId:t.itemId});function DFe(t){const{seriesToDisplay:e,hidden:r,onItemClick:n}=t,i=Fe(t,RFe);return r?null:R.jsx(OFe,N({},i,{itemsToDisplay:e,onItemClick:n?(a,o)=>n(a,MFe(e[o]),o):void 0}))}const $Fe=["slots","slotProps"],LFe=t=>{const{classes:e,direction:r}=t;return Yi({root:["root",r],mark:["mark"],label:["label"],series:["series"],itemBackground:["itemBackground"]},SFe,e)};function jFe(t){var f;const e=ws({props:t,name:"MuiChartsLegend"}),r=N({direction:"row"},e,{position:N({horizontal:"middle",vertical:"top"},e.position)}),{slots:n,slotProps:i}=r,a=Fe(r,$Fe),o=Dd(),s=LFe(N({},r,{theme:o})),c=aa(),u=Cs(),h=IFe(u),d=(f=n==null?void 0:n.legend)!=null?f:DFe,p=wi({elementType:d,externalSlotProps:i==null?void 0:i.legend,additionalProps:N({},a,{classes:s,drawingArea:c,series:u,seriesToDisplay:h}),ownerState:{}});return R.jsx(d,N({},p))}const FFe=10;function _U(t){var g,m;const{gradientUnits:e,isReversed:r,gradientId:n,size:i,direction:a,scale:o,colorScale:s,colorMap:c}=t,u=[(g=c.min)!=null?g:0,(m=c.max)!=null?m:100],h=u.map(o).filter(v=>v!==void 0);if(h.length!==2)return null;const d=typeof u[0]=="number"?Qh(u[0],u[1]):m5(u[0],u[1]),p=Math.round((Math.max(...h)-Math.min(...h))/FFe),f=`${u[0]}-${u[1]}-`;return R.jsx("linearGradient",{id:n,x1:"0",x2:"0",y1:"0",y2:"0",[`${a}${r?1:2}`]:e==="objectBoundingBox"?1:`${i}px`,gradientUnits:e!=null?e:"userSpaceOnUse",children:Array.from({length:p+1},(v,y)=>{const x=d(y/p);if(x===void 0)return null;const b=o(x);if(b===void 0)return null;const C=r?1-b/i:b/i,w=s(x);return w===null?null:R.jsx("stop",{offset:C,stopColor:w,stopOpacity:1},f+y)})})}function NFe(t){return Ki("MuiChartsAxisHighlight",t)}ka("MuiChartsAxisHighlight",["root"]);const BFe=()=>Yi({root:["root"]},NFe),Cy=Or("path",{name:"MuiChartsAxisHighlight",slot:"Root",overridesResolver:(t,e)=>e.root})(({theme:t})=>({pointerEvents:"none",variants:[{props:{axisHighlight:"band"},style:N({fill:"white",fillOpacity:.1},t.applyStyles("light",{fill:"gray"}))},{props:{axisHighlight:"line"},style:N({strokeDasharray:"5 2",stroke:"#ffffff"},t.applyStyles("light",{stroke:"#000000"}))}]}));function zFe(t){const{x:e,y:r}=t,{xAxisIds:n,xAxis:i,yAxisIds:a,yAxis:o}=oa(),s=BFe(),c=n[0],u=a[0],h=i[c].scale,d=o[u].scale,{axis:p}=D.useContext(vu),f=sU(h),g=sU(d),m=p.x,v=p.y,y=e==="band"&&m!==null&&Sl(h),x=r==="band"&&v!==null&&Sl(d);return R.jsxs(D.Fragment,{children:[y&&h(m.value)!==void 0&&R.jsx(Cy,{d:`M ${h(m.value)-(h.step()-h.bandwidth())/2} ${d.range()[0]} l ${h.step()} 0 l 0 ${d.range()[1]-d.range()[0]} l ${-h.step()} 0 Z`,className:s.root,ownerState:{axisHighlight:"band"}}),x&&d(v.value)!==void 0&&R.jsx(Cy,{d:`M ${h.range()[0]} ${d(v.value)-(d.step()-d.bandwidth())/2} l 0 ${d.step()} l ${h.range()[1]-h.range()[0]} 0 l 0 ${-d.step()} Z`,className:s.root,ownerState:{axisHighlight:"band"}}),e==="line"&&p.x!==null&&R.jsx(Cy,{d:`M ${f(p.x.value)} ${d.range()[0]} L ${f(p.x.value)} ${d.range()[1]}`,className:s.root,ownerState:{axisHighlight:"line"}}),r==="line"&&p.y!==null&&R.jsx(Cy,{d:`M ${h.range()[0]} ${g(p.y.value)} L ${h.range()[1]} ${g(p.y.value)}`,className:s.root,ownerState:{axisHighlight:"line"}})]})}function UFe(t,e){const r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r.matrixTransform(t.getScreenCTM().inverse())}function HFe(t){const{onAxisClick:e}=t,r=a_(),n=Cs(),{axis:i}=D.useContext(vu),{xAxisIds:a,xAxis:o,yAxisIds:s,yAxis:c}=oa();return D.useEffect(()=>{const u=r.current;if(u===null||!e)return()=>{};const h=d=>{var y;d.preventDefault();const p=i.x&&i.x.index!==-1,f=p?a[0]:s[0],g=p?i.x&&i.x.index:i.y&&i.y.index;if(g==null)return;const m={};Object.keys(n).filter(x=>["bar","line"].includes(x)).forEach(x=>{var b;(b=n[x])==null||b.seriesOrder.forEach(C=>{var O,P;const w=n[x].series[C],S=(O=w.xAxisId)!=null?O:w.xAxisKey,T=(P=w.yAxisId)!=null?P:w.yAxisKey,k=p?S:T;(k===void 0||k===f)&&(m[C]=w.data[g])})});const v=(y=(p?o:c)[f].data)==null?void 0:y[g];e(d,{dataIndex:g,axisValue:v,seriesValues:m})};return u.addEventListener("click",h),()=>{u.removeEventListener("click",h)}},[i.x,i.y,e,n,r,o,a,c,s]),R.jsx(D.Fragment,{})}var h_=ap(),Ct=t=>ip(t,h_),p_=ap();Ct.write=t=>ip(t,p_);var Iy=ap();Ct.onStart=t=>ip(t,Iy);var f_=ap();Ct.onFrame=t=>ip(t,f_);var m_=ap();Ct.onFinish=t=>ip(t,m_);var yu=[];Ct.setTimeout=(t,e)=>{const r=Ct.now()+e,n=()=>{const a=yu.findIndex(o=>o.cancel==n);~a&&yu.splice(a,1),_s-=~a?1:0},i={time:r,handler:t,cancel:n};return yu.splice(TU(r),0,i),_s+=1,kU(),i};var TU=t=>~(~yu.findIndex(e=>e.time>t)||~yu.length);Ct.cancel=t=>{Iy.delete(t),f_.delete(t),m_.delete(t),h_.delete(t),p_.delete(t)},Ct.sync=t=>{v_=!0,Ct.batchedUpdates(t),v_=!1},Ct.throttle=t=>{let e;function r(){try{t(...e)}finally{e=null}}function n(...i){e=i,Ct.onStart(r)}return n.handler=t,n.cancel=()=>{Iy.delete(r),e=null},n};var g_=typeof window!="undefined"?window.requestAnimationFrame:()=>{};Ct.use=t=>g_=t,Ct.now=typeof performance!="undefined"?()=>performance.now():Date.now,Ct.batchedUpdates=t=>t(),Ct.catch=console.error,Ct.frameLoop="always",Ct.advance=()=>{Ct.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):PU()};var Ss=-1,_s=0,v_=!1;function ip(t,e){v_?(e.delete(t),t(0)):(e.add(t),kU())}function kU(){Ss<0&&(Ss=0,Ct.frameLoop!=="demand"&&g_(AU))}function VFe(){Ss=-1}function AU(){~Ss&&(g_(AU),Ct.batchedUpdates(PU))}function PU(){const t=Ss;Ss=Ct.now();const e=TU(Ss);if(e&&(EU(yu.splice(0,e),r=>r.handler()),_s-=e),!_s){VFe();return}Iy.flush(),h_.flush(t?Math.min(64,Ss-t):16.667),f_.flush(),p_.flush(),m_.flush()}function ap(){let t=new Set,e=t;return{add(r){_s+=e==t&&!t.has(r)?1:0,t.add(r)},delete(r){return _s-=e==t&&t.has(r)?1:0,t.delete(r)},flush(r){e.size&&(t=new Set,_s-=e.size,EU(e,n=>n(r)&&t.add(n)),_s+=t.size,e=t)}}}function EU(t,e){t.forEach(r=>{try{e(r)}catch(n){Ct.catch(n)}})}var WFe=Object.defineProperty,qFe=(t,e)=>{for(var r in e)WFe(t,r,{get:e[r],enumerable:!0})},ji={};qFe(ji,{assign:()=>YFe,colors:()=>Ts,createStringInterpolator:()=>x_,skipAnimation:()=>RU,to:()=>OU,willAdvance:()=>w_});function y_(){}var GFe=(t,e,r)=>Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0}),He={arr:Array.isArray,obj:t=>!!t&&t.constructor.name==="Object",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",und:t=>t===void 0};function Mo(t,e){if(He.arr(t)){if(!He.arr(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return t===e}var At=(t,e)=>t.forEach(e);function Fa(t,e,r){if(He.arr(t)){for(let n=0;n<t.length;n++)e.call(r,t[n],`${n}`);return}for(const n in t)t.hasOwnProperty(n)&&e.call(r,t[n],n)}var Ln=t=>He.und(t)?[]:He.arr(t)?t:[t];function op(t,e){if(t.size){const r=Array.from(t);t.clear(),At(r,e)}}var sp=(t,...e)=>op(t,r=>r(...e)),b_=()=>typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),x_,OU,Ts=null,RU=!1,w_=y_,YFe=t=>{t.to&&(OU=t.to),t.now&&(Ct.now=t.now),t.colors!==void 0&&(Ts=t.colors),t.skipAnimation!=null&&(RU=t.skipAnimation),t.createStringInterpolator&&(x_=t.createStringInterpolator),t.requestAnimationFrame&&Ct.use(t.requestAnimationFrame),t.batchedUpdates&&(Ct.batchedUpdates=t.batchedUpdates),t.willAdvance&&(w_=t.willAdvance),t.frameLoop&&(Ct.frameLoop=t.frameLoop)},lp=new Set,Fi=[],C_=[],Sy=0,_y={get idle(){return!lp.size&&!Fi.length},start(t){Sy>t.priority?(lp.add(t),Ct.onStart(KFe)):(MU(t),Ct(I_))},advance:I_,sort(t){if(Sy)Ct.onFrame(()=>_y.sort(t));else{const e=Fi.indexOf(t);~e&&(Fi.splice(e,1),DU(t))}},clear(){Fi=[],lp.clear()}};function KFe(){lp.forEach(MU),lp.clear(),Ct(I_)}function MU(t){Fi.includes(t)||DU(t)}function DU(t){Fi.splice(JFe(Fi,e=>e.priority>t.priority),0,t)}function I_(t){const e=C_;for(let r=0;r<Fi.length;r++){const n=Fi[r];Sy=n.priority,n.idle||(w_(n),n.advance(t),n.idle||e.push(n))}return Sy=0,C_=Fi,C_.length=0,Fi=e,Fi.length>0}function JFe(t,e){const r=t.findIndex(e);return r<0?t.length:r}var QFe={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},sa="[-+]?\\d*\\.?\\d+",Ty=sa+"%";function ky(...t){return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var XFe=new RegExp("rgb"+ky(sa,sa,sa)),ZFe=new RegExp("rgba"+ky(sa,sa,sa,sa)),eNe=new RegExp("hsl"+ky(sa,Ty,Ty)),tNe=new RegExp("hsla"+ky(sa,Ty,Ty,sa)),rNe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,nNe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,iNe=/^#([0-9a-fA-F]{6})$/,aNe=/^#([0-9a-fA-F]{8})$/;function oNe(t){let e;return typeof t=="number"?t>>>0===t&&t>=0&&t<=4294967295?t:null:(e=iNe.exec(t))?parseInt(e[1]+"ff",16)>>>0:Ts&&Ts[t]!==void 0?Ts[t]:(e=XFe.exec(t))?(bu(e[1])<<24|bu(e[2])<<16|bu(e[3])<<8|255)>>>0:(e=ZFe.exec(t))?(bu(e[1])<<24|bu(e[2])<<16|bu(e[3])<<8|jU(e[4]))>>>0:(e=rNe.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=aNe.exec(t))?parseInt(e[1],16)>>>0:(e=nNe.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=eNe.exec(t))?($U(LU(e[1]),Ay(e[2]),Ay(e[3]))|255)>>>0:(e=tNe.exec(t))?($U(LU(e[1]),Ay(e[2]),Ay(e[3]))|jU(e[4]))>>>0:null}function S_(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function $U(t,e,r){const n=r<.5?r*(1+e):r+e-r*e,i=2*r-n,a=S_(i,n,t+1/3),o=S_(i,n,t),s=S_(i,n,t-1/3);return Math.round(a*255)<<24|Math.round(o*255)<<16|Math.round(s*255)<<8}function bu(t){const e=parseInt(t,10);return e<0?0:e>255?255:e}function LU(t){return(parseFloat(t)%360+360)%360/360}function jU(t){const e=parseFloat(t);return e<0?0:e>1?255:Math.round(e*255)}function Ay(t){const e=parseFloat(t);return e<0?0:e>100?1:e/100}function FU(t){let e=oNe(t);if(e===null)return t;e=e||0;const r=(e&4278190080)>>>24,n=(e&16711680)>>>16,i=(e&65280)>>>8,a=(e&255)/255;return`rgba(${r}, ${n}, ${i}, ${a})`}var cp=(t,e,r)=>{if(He.fun(t))return t;if(He.arr(t))return cp({range:t,output:e,extrapolate:r});if(He.str(t.output[0]))return x_(t);const n=t,i=n.output,a=n.range||[0,1],o=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",c=n.easing||(u=>u);return u=>{const h=lNe(u,a);return sNe(u,a[h],a[h+1],i[h],i[h+1],c,o,s,n.map)}};function sNe(t,e,r,n,i,a,o,s,c){let u=c?c(t):t;if(u<e){if(o==="identity")return u;o==="clamp"&&(u=e)}if(u>r){if(s==="identity")return u;s==="clamp"&&(u=r)}return n===i?n:e===r?t<=e?n:i:(e===-1/0?u=-u:r===1/0?u=u-e:u=(u-e)/(r-e),u=a(u),n===-1/0?u=-u:i===1/0?u=u+n:u=u*(i-n)+n,u)}function lNe(t,e){for(var r=1;r<e.length-1&&!(e[r]>=t);++r);return r-1}var cNe={linear:t=>t},up=Symbol.for("FluidValue.get"),xu=Symbol.for("FluidValue.observers"),Ni=t=>!!(t&&t[up]),Qn=t=>t&&t[up]?t[up]():t,NU=t=>t[xu]||null;function uNe(t,e){t.eventObserved?t.eventObserved(e):t(e)}function dp(t,e){const r=t[xu];r&&r.forEach(n=>{uNe(n,e)})}var BU=class{constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");dNe(this,t)}},dNe=(t,e)=>zU(t,up,e);function wu(t,e){if(t[up]){let r=t[xu];r||zU(t,xu,r=new Set),r.has(e)||(r.add(e),t.observerAdded&&t.observerAdded(r.size,e))}return e}function hp(t,e){const r=t[xu];if(r&&r.has(e)){const n=r.size-1;n?r.delete(e):t[xu]=null,t.observerRemoved&&t.observerRemoved(n,e)}}var zU=(t,e,r)=>Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0}),Py=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,hNe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,UU=new RegExp(`(${Py.source})(%|[a-z]+)`,"i"),pNe=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Ey=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,HU=t=>{const[e,r]=fNe(t);if(!e||b_())return t;const n=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(n)return n.trim();if(r&&r.startsWith("--")){const i=window.getComputedStyle(document.documentElement).getPropertyValue(r);return i||t}else{if(r&&Ey.test(r))return HU(r);if(r)return r}return t},fNe=t=>{const e=Ey.exec(t);if(!e)return[,];const[,r,n]=e;return[r,n]},__,mNe=(t,e,r,n,i)=>`rgba(${Math.round(e)}, ${Math.round(r)}, ${Math.round(n)}, ${i})`,VU=t=>{__||(__=Ts?new RegExp(`(${Object.keys(Ts).join("|")})(?!\\w)`,"g"):/^\b$/);const e=t.output.map(a=>Qn(a).replace(Ey,HU).replace(hNe,FU).replace(__,FU)),r=e.map(a=>a.match(Py).map(Number)),i=r[0].map((a,o)=>r.map(s=>{if(!(o in s))throw Error('The arity of each "output" value must be equal');return s[o]})).map(a=>cp(ze(ce({},t),{output:a})));return a=>{var c;const o=!UU.test(e[0])&&((c=e.find(u=>UU.test(u)))==null?void 0:c.replace(Py,""));let s=0;return e[0].replace(Py,()=>`${i[s++](a)}${o||""}`).replace(pNe,mNe)}},T_="react-spring: ",WU=t=>{const e=t;let r=!1;if(typeof e!="function")throw new TypeError(`${T_}once requires a function parameter`);return(...n)=>{r||(e(...n),r=!0)}},gNe=WU(console.warn);function vNe(){gNe(`${T_}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var yNe=WU(console.warn);function bNe(){yNe(`${T_}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function Oy(t){return He.str(t)&&(t[0]=="#"||/\d/.test(t)||!b_()&&Ey.test(t)||t in(Ts||{}))}var kl=b_()?U.useEffect:U.useLayoutEffect,xNe=()=>{const t=U.useRef(!1);return kl(()=>(t.current=!0,()=>{t.current=!1}),[]),t};function qU(){const t=U.useState()[1],e=xNe();return()=>{e.current&&t(Math.random())}}function wNe(t,e){const[r]=U.useState(()=>({inputs:e,result:t()})),n=U.useRef(),i=n.current;let a=i;return a?e&&a.inputs&&CNe(e,a.inputs)||(a={inputs:e,result:t()}):a=r,U.useEffect(()=>{n.current=a,i==r&&(r.inputs=r.result=void 0)},[a]),a.result}function CNe(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}var GU=t=>U.useEffect(t,INe),INe=[];function SNe(t){const e=U.useRef();return U.useEffect(()=>{e.current=t}),e.current}var pp=Symbol.for("Animated:node"),_Ne=t=>!!t&&t[pp]===t,Na=t=>t&&t[pp],k_=(t,e)=>GFe(t,pp,e),Ry=t=>t&&t[pp]&&t[pp].getPayload(),YU=class{constructor(){k_(this,this)}getPayload(){return this.payload||[]}},fp=class extends YU{constructor(t){super(),this._value=t,this.done=!0,this.durationProgress=0,He.num(this._value)&&(this.lastPosition=this._value)}static create(t){return new fp(t)}getPayload(){return[this]}getValue(){return this._value}setValue(t,e){return He.num(t)&&(this.lastPosition=t,e&&(t=Math.round(t/e)*e,this.done&&(this.lastPosition=t))),this._value===t?!1:(this._value=t,!0)}reset(){const{done:t}=this;this.done=!1,He.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,t&&(this.lastVelocity=null),this.v0=null)}},mp=class extends fp{constructor(t){super(0),this._string=null,this._toString=cp({output:[t,t]})}static create(t){return new mp(t)}getValue(){const t=this._string;return t==null?this._string=this._toString(this._value):t}setValue(t){if(He.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=cp({output:[this.getValue(),t]})),this._value=0,super.reset()}},My={dependencies:null},Dy=class extends YU{constructor(t){super(),this.source=t,this.setValue(t)}getValue(t){const e={};return Fa(this.source,(r,n)=>{_Ne(r)?e[n]=r.getValue(t):Ni(r)?e[n]=Qn(r):t||(e[n]=r)}),e}setValue(t){this.source=t,this.payload=this._makePayload(t)}reset(){this.payload&&At(this.payload,t=>t.reset())}_makePayload(t){if(t){const e=new Set;return Fa(t,this._addToPayload,e),Array.from(e)}}_addToPayload(t){My.dependencies&&Ni(t)&&My.dependencies.add(t);const e=Ry(t);e&&At(e,r=>this.add(r))}},KU=class extends Dy{constructor(t){super(t)}static create(t){return new KU(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){const e=this.getPayload();return t.length==e.length?e.map((r,n)=>r.setValue(t[n])).some(Boolean):(super.setValue(t.map(TNe)),!0)}};function TNe(t){return(Oy(t)?mp:fp).create(t)}function A_(t){const e=Na(t);return e?e.constructor:He.arr(t)?KU:Oy(t)?mp:fp}var JU=(t,e)=>{const r=!He.fun(t)||t.prototype&&t.prototype.isReactComponent;return U.forwardRef((n,i)=>{const a=U.useRef(null),o=r&&U.useCallback(g=>{a.current=PNe(i,g)},[i]),[s,c]=ANe(n,e),u=qU(),h=()=>{const g=a.current;if(r&&!g)return;(g?e.applyAnimatedValues(g,s.getValue(!0)):!1)===!1&&u()},d=new kNe(h,c),p=U.useRef();kl(()=>(p.current=d,At(c,g=>wu(g,d)),()=>{p.current&&(At(p.current.deps,g=>hp(g,p.current)),Ct.cancel(p.current.update))})),U.useEffect(h,[]),GU(()=>()=>{const g=p.current;At(g.deps,m=>hp(m,g))});const f=e.getComponentProps(s.getValue());return D.createElement(t,ze(ce({},f),{ref:o}))})},kNe=class{constructor(t,e){this.update=t,this.deps=e}eventObserved(t){t.type=="change"&&Ct.write(this.update)}};function ANe(t,e){const r=new Set;return My.dependencies=r,t.style&&(t=ze(ce({},t),{style:e.createAnimatedStyle(t.style)})),t=new Dy(t),My.dependencies=null,[t,r]}function PNe(t,e){return t&&(He.fun(t)?t(e):t.current=e),e}var QU=Symbol.for("AnimatedComponent"),ENe=(t,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:r=i=>new Dy(i),getComponentProps:n=i=>i}={})=>{const i={applyAnimatedValues:e,createAnimatedStyle:r,getComponentProps:n},a=o=>{const s=XU(o)||"Anonymous";return He.str(o)?o=a[o]||(a[o]=JU(o,i)):o=o[QU]||(o[QU]=JU(o,i)),o.displayName=`Animated(${s})`,o};return Fa(t,(o,s)=>{He.arr(t)&&(s=XU(o)),a[s]=a(o)}),{animated:a}},XU=t=>He.str(t)?t:t&&He.str(t.displayName)?t.displayName:He.fun(t)&&t.name||null;function Xn(t,...e){return He.fun(t)?t(...e):t}var gp=(t,e)=>t===!0||!!(e&&t&&(He.fun(t)?t(e):Ln(t).includes(e))),ZU=(t,e)=>He.obj(t)?e&&t[e]:t,eH=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,ONe=t=>t,P_=(t,e=ONe)=>{let r=RNe;t.default&&t.default!==!0&&(t=t.default,r=Object.keys(t));const n={};for(const i of r){const a=e(t[i],i);He.und(a)||(n[i]=a)}return n},RNe=["config","onProps","onStart","onChange","onPause","onResume","onRest"],MNe={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function DNe(t){const e={};let r=0;if(Fa(t,(n,i)=>{MNe[i]||(e[i]=n,r++)}),r)return e}function E_(t){const e=DNe(t);if(e){const r={to:e};return Fa(t,(n,i)=>i in e||(r[i]=n)),r}return ce({},t)}function vp(t){return t=Qn(t),He.arr(t)?t.map(vp):Oy(t)?ji.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function $Ne(t){for(const e in t)return!0;return!1}function O_(t){return He.fun(t)||He.arr(t)&&He.obj(t[0])}function tH(t,e){var r;(r=t.ref)==null||r.delete(t),e==null||e.delete(t)}function LNe(t,e){var r;e&&t.ref!==e&&((r=t.ref)==null||r.delete(t),e.add(t),t.ref=e)}var jNe={default:{tension:170,friction:26}},R_=ze(ce({},jNe.default),{mass:1,damping:1,easing:cNe.linear,clamp:!1}),FNe=class{constructor(){this.velocity=0,Object.assign(this,R_)}};function NNe(t,e,r){r&&(r=ce({},r),rH(r,e),e=ce(ce({},r),e)),rH(t,e),Object.assign(t,e);for(const o in R_)t[o]==null&&(t[o]=R_[o]);let{frequency:n,damping:i}=t;const{mass:a}=t;return He.und(n)||(n<.01&&(n=.01),i<0&&(i=0),t.tension=Math.pow(2*Math.PI/n,2)*a,t.friction=4*Math.PI*i*a/n),t}function rH(t,e){if(!He.und(e.decay))t.duration=void 0;else{const r=!He.und(e.tension)||!He.und(e.friction);(r||!He.und(e.frequency)||!He.und(e.damping)||!He.und(e.mass))&&(t.duration=void 0,t.decay=void 0),r&&(t.frequency=void 0)}}var nH=[],BNe=class{constructor(){this.changed=!1,this.values=nH,this.toValues=null,this.fromValues=nH,this.config=new FNe,this.immediate=!1}};function iH(t,{key:e,props:r,defaultProps:n,state:i,actions:a}){return new Promise((o,s)=>{var g;let c,u,h=gp((g=r.cancel)!=null?g:n==null?void 0:n.cancel,e);if(h)f();else{He.und(r.pause)||(i.paused=gp(r.pause,e));let m=n==null?void 0:n.pause;m!==!0&&(m=i.paused||gp(m,e)),c=Xn(r.delay||0,e),m?(i.resumeQueue.add(p),a.pause()):(a.resume(),p())}function d(){i.resumeQueue.add(p),i.timeouts.delete(u),u.cancel(),c=u.time-Ct.now()}function p(){c>0&&!ji.skipAnimation?(i.delayed=!0,u=Ct.setTimeout(f,c),i.pauseQueue.add(d),i.timeouts.add(u)):f()}function f(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(d),i.timeouts.delete(u),t<=(i.cancelId||0)&&(h=!0);try{a.start(ze(ce({},r),{callId:t,cancel:h}),o)}catch(m){s(m)}}})}var M_=(t,e)=>e.length==1?e[0]:e.some(r=>r.cancelled)?Cu(t.get()):e.every(r=>r.noop)?aH(t.get()):la(t.get(),e.every(r=>r.finished)),aH=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),la=(t,e,r=!1)=>({value:t,finished:e,cancelled:r}),Cu=t=>({value:t,cancelled:!0,finished:!1});function oH(t,e,r,n){const{callId:i,parentId:a,onRest:o}=e,{asyncTo:s,promise:c}=r;return!a&&t===s&&!e.reset?c:r.promise=$(this,null,function*(){r.asyncId=i,r.asyncTo=t;const u=P_(e,(v,y)=>y==="onRest"?void 0:v);let h,d;const p=new Promise((v,y)=>(h=v,d=y)),f=v=>{const y=i<=(r.cancelId||0)&&Cu(n)||i!==r.asyncId&&la(n,!1);if(y)throw v.result=y,d(v),v},g=(v,y)=>{const x=new sH,b=new lH;return $(this,null,function*(){if(ji.skipAnimation)throw yp(r),b.result=la(n,!1),d(b),b;f(x);const C=He.obj(v)?ce({},v):ze(ce({},y),{to:v});C.parentId=i,Fa(u,(S,T)=>{He.und(C[T])&&(C[T]=S)});const w=yield n.start(C);return f(x),r.paused&&(yield new Promise(S=>{r.resumeQueue.add(S)})),w})};let m;if(ji.skipAnimation)return yp(r),la(n,!1);try{let v;He.arr(t)?v=(y=>$(this,null,function*(){for(const x of y)yield g(x)}))(t):v=Promise.resolve(t(g,n.stop.bind(n))),yield Promise.all([v.then(h),p]),m=la(n.get(),!0,!1)}catch(v){if(v instanceof sH)m=v.result;else if(v instanceof lH)m=v.result;else throw v}finally{i==r.asyncId&&(r.asyncId=a,r.asyncTo=a?s:void 0,r.promise=a?c:void 0)}return He.fun(o)&&Ct.batchedUpdates(()=>{o(m,n,n.item)}),m})}function yp(t,e){op(t.timeouts,r=>r.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var sH=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},lH=class extends Error{constructor(){super("SkipAnimationSignal")}},D_=t=>t instanceof $_,zNe=1,$_=class extends BU{constructor(){super(...arguments),this.id=zNe++,this._priority=0}get priority(){return this._priority}set priority(t){this._priority!=t&&(this._priority=t,this._onPriorityChange(t))}get(){const t=Na(this);return t&&t.getValue()}to(...t){return ji.to(this,t)}interpolate(...t){return vNe(),ji.to(this,t)}toJSON(){return this.get()}observerAdded(t){t==1&&this._attach()}observerRemoved(t){t==0&&this._detach()}_attach(){}_detach(){}_onChange(t,e=!1){dp(this,{type:"change",parent:this,value:t,idle:e})}_onPriorityChange(t){this.idle||_y.sort(this),dp(this,{type:"priority",parent:this,priority:t})}},Al=Symbol.for("SpringPhase"),cH=1,uH=2,dH=4,L_=t=>(t[Al]&cH)>0,ks=t=>(t[Al]&uH)>0,bp=t=>(t[Al]&dH)>0,hH=(t,e)=>e?t[Al]|=uH|cH:t[Al]&=-3,pH=(t,e)=>e?t[Al]|=dH:t[Al]&=-5,UNe=class extends $_{constructor(t,e){if(super(),this.animation=new BNe,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!He.und(t)||!He.und(e)){const r=He.obj(t)?ce({},t):ze(ce({},e),{from:t});He.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(ks(this)||this._state.asyncTo)||bp(this)}get goal(){return Qn(this.animation.to)}get velocity(){const t=Na(this);return t instanceof fp?t.lastVelocity||0:t.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return L_(this)}get isAnimating(){return ks(this)}get isPaused(){return bp(this)}get isDelayed(){return this._state.delayed}advance(t){let e=!0,r=!1;const n=this.animation;let{toValues:i}=n;const{config:a}=n,o=Ry(n.to);!o&&Ni(n.to)&&(i=Ln(Qn(n.to))),n.values.forEach((u,h)=>{if(u.done)return;const d=u.constructor==mp?1:o?o[h].lastPosition:i[h];let p=n.immediate,f=d;if(!p){if(f=u.lastPosition,a.tension<=0){u.done=!0;return}let g=u.elapsedTime+=t;const m=n.fromValues[h],v=u.v0!=null?u.v0:u.v0=He.arr(a.velocity)?a.velocity[h]:a.velocity;let y;const x=a.precision||(m==d?.005:Math.min(1,Math.abs(d-m)*.001));if(He.und(a.duration))if(a.decay){const b=a.decay===!0?.998:a.decay,C=Math.exp(-(1-b)*g);f=m+v/(1-b)*(1-C),p=Math.abs(u.lastPosition-f)<=x,y=v*C}else{y=u.lastVelocity==null?v:u.lastVelocity;const b=a.restVelocity||x/10,C=a.clamp?0:a.bounce,w=!He.und(C),S=m==d?u.v0>0:m<d;let T,k=!1;const O=1,P=Math.ceil(t/O);for(let A=0;A<P&&(T=Math.abs(y)>b,!(!T&&(p=Math.abs(d-f)<=x,p)));++A){w&&(k=f==d||f>d==S,k&&(y=-y*C,f=d));const _=-a.tension*1e-6*(f-d),E=-a.friction*.001*y,L=(_+E)/a.mass;y=y+L*O,f=f+y*O}}else{let b=1;a.duration>0&&(this._memoizedDuration!==a.duration&&(this._memoizedDuration=a.duration,u.durationProgress>0&&(u.elapsedTime=a.duration*u.durationProgress,g=u.elapsedTime+=t)),b=(a.progress||0)+g/this._memoizedDuration,b=b>1?1:b<0?0:b,u.durationProgress=b),f=m+a.easing(b)*(d-m),y=(f-u.lastPosition)/t,p=b==1}u.lastVelocity=y,Number.isNaN(f)&&(console.warn("Got NaN while animating:",this),p=!0)}o&&!o[h].done&&(p=!1),p?u.done=!0:e=!1,u.setValue(f,a.round)&&(r=!0)});const s=Na(this),c=s.getValue();if(e){const u=Qn(n.to);(c!==u||r)&&!a.decay?(s.setValue(u),this._onChange(u)):r&&a.decay&&this._onChange(c),this._stop()}else r&&this._onChange(c)}set(t){return Ct.batchedUpdates(()=>{this._stop(),this._focus(t),this._set(t)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(ks(this)){const{to:t,config:e}=this.animation;Ct.batchedUpdates(()=>{this._onStart(),e.decay||this._set(t,!1),this._stop()})}return this}update(t){return(this.queue||(this.queue=[])).push(t),this}start(t,e){let r;return He.und(t)?(r=this.queue||[],this.queue=[]):r=[He.obj(t)?t:ze(ce({},e),{to:t})],Promise.all(r.map(n=>this._update(n))).then(n=>M_(this,n))}stop(t){const{to:e}=this.animation;return this._focus(this.get()),yp(this._state,t&&this._lastCallId),Ct.batchedUpdates(()=>this._stop(e,t)),this}reset(){this._update({reset:!0})}eventObserved(t){t.type=="change"?this._start():t.type=="priority"&&(this.priority=t.priority+1)}_prepareNode(t){const e=this.key||"";let{to:r,from:n}=t;r=He.obj(r)?r[e]:r,(r==null||O_(r))&&(r=void 0),n=He.obj(n)?n[e]:n,n==null&&(n=void 0);const i={to:r,from:n};return L_(this)||(t.reverse&&([r,n]=[n,r]),n=Qn(n),He.und(n)?Na(this)||this._set(r):this._set(n)),i}_update(r,e){var t=er(r,[]);const{key:n,defaultProps:i}=this;t.default&&Object.assign(i,P_(t,(s,c)=>/^on/.test(c)?ZU(s,n):s)),gH(this,t,"onProps"),wp(this,"onProps",t,this);const a=this._prepareNode(t);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const o=this._state;return iH(++this._lastCallId,{key:n,props:t,defaultProps:i,state:o,actions:{pause:()=>{bp(this)||(pH(this,!0),sp(o.pauseQueue),wp(this,"onPause",la(this,xp(this,this.animation.to)),this))},resume:()=>{bp(this)&&(pH(this,!1),ks(this)&&this._resume(),sp(o.resumeQueue),wp(this,"onResume",la(this,xp(this,this.animation.to)),this))},start:this._merge.bind(this,a)}}).then(s=>{if(t.loop&&s.finished&&!(e&&s.noop)){const c=fH(t);if(c)return this._update(c,!0)}return s})}_merge(t,e,r){if(e.cancel)return this.stop(!0),r(Cu(this));const n=!He.und(t.to),i=!He.und(t.from);if(n||i)if(e.callId>this._lastToId)this._lastToId=e.callId;else return r(Cu(this));const{key:a,defaultProps:o,animation:s}=this,{to:c,from:u}=s;let{to:h=c,from:d=u}=t;i&&!n&&(!e.default||He.und(h))&&(h=d),e.reverse&&([h,d]=[d,h]);const p=!Mo(d,u);p&&(s.from=d),d=Qn(d);const f=!Mo(h,c);f&&this._focus(h);const g=O_(e.to),{config:m}=s,{decay:v,velocity:y}=m;(n||i)&&(m.velocity=0),e.config&&!g&&NNe(m,Xn(e.config,a),e.config!==o.config?Xn(o.config,a):void 0);let x=Na(this);if(!x||He.und(h))return r(la(this,!0));const b=He.und(e.reset)?i&&!e.default:!He.und(d)&&gp(e.reset,a),C=b?d:this.get(),w=vp(h),S=He.num(w)||He.arr(w)||Oy(w),T=!g&&(!S||gp(o.immediate||e.immediate,a));if(f){const A=A_(h);if(A!==x.constructor)if(T)x=this._set(w);else throw Error(`Cannot animate between ${x.constructor.name} and ${A.name}, as the "to" prop suggests`)}const k=x.constructor;let O=Ni(h),P=!1;if(!O){const A=b||!L_(this)&&p;(f||A)&&(P=Mo(vp(C),w),O=!P),(!Mo(s.immediate,T)&&!T||!Mo(m.decay,v)||!Mo(m.velocity,y))&&(O=!0)}if(P&&ks(this)&&(s.changed&&!b?O=!0:O||this._stop(c)),!g&&((O||Ni(c))&&(s.values=x.getPayload(),s.toValues=Ni(h)?null:k==mp?[1]:Ln(w)),s.immediate!=T&&(s.immediate=T,!T&&!b&&this._set(c)),O)){const{onRest:A}=s;At(HNe,E=>gH(this,e,E));const _=la(this,xp(this,c));sp(this._pendingCalls,_),this._pendingCalls.add(r),s.changed&&Ct.batchedUpdates(()=>{var E;s.changed=!b,A==null||A(_,this),b?Xn(o.onRest,_):(E=s.onStart)==null||E.call(s,_,this)})}b&&this._set(C),g?r(oH(e.to,e,this._state,this)):O?this._start():ks(this)&&!f?this._pendingCalls.add(r):r(aH(C))}_focus(t){const e=this.animation;t!==e.to&&(NU(this)&&this._detach(),e.to=t,NU(this)&&this._attach())}_attach(){let t=0;const{to:e}=this.animation;Ni(e)&&(wu(e,this),D_(e)&&(t=e.priority+1)),this.priority=t}_detach(){const{to:t}=this.animation;Ni(t)&&hp(t,this)}_set(t,e=!0){const r=Qn(t);if(!He.und(r)){const n=Na(this);if(!n||!Mo(r,n.getValue())){const i=A_(r);!n||n.constructor!=i?k_(this,i.create(r)):n.setValue(r),n&&Ct.batchedUpdates(()=>{this._onChange(r,e)})}}return Na(this)}_onStart(){const t=this.animation;t.changed||(t.changed=!0,wp(this,"onStart",la(this,xp(this,t.to)),this))}_onChange(t,e){e||(this._onStart(),Xn(this.animation.onChange,t,this)),Xn(this.defaultProps.onChange,t,this),super._onChange(t,e)}_start(){const t=this.animation;Na(this).reset(Qn(t.to)),t.immediate||(t.fromValues=t.values.map(e=>e.lastPosition)),ks(this)||(hH(this,!0),bp(this)||this._resume())}_resume(){ji.skipAnimation?this.finish():_y.start(this)}_stop(t,e){if(ks(this)){hH(this,!1);const r=this.animation;At(r.values,i=>{i.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),dp(this,{type:"idle",parent:this});const n=e?Cu(this.get()):la(this.get(),xp(this,t!=null?t:r.to));sp(this._pendingCalls,n),r.changed&&(r.changed=!1,wp(this,"onRest",n,this))}}};function xp(t,e){const r=vp(e),n=vp(t.get());return Mo(n,r)}function fH(t,e=t.loop,r=t.to){const n=Xn(e);if(n){const i=n!==!0&&E_(n),a=(i||t).reverse,o=!i||i.reset;return $y(ce(ze(ce({},t),{loop:e,default:!1,pause:void 0,to:!a||O_(r)?r:void 0,from:o?t.from:void 0,reset:o}),i))}}function $y(t){const{to:e,from:r}=t=E_(t),n=new Set;return He.obj(e)&&mH(e,n),He.obj(r)&&mH(r,n),t.keys=n.size?Array.from(n):null,t}function mH(t,e){Fa(t,(r,n)=>r!=null&&e.add(n))}var HNe=["onStart","onRest","onChange","onPause","onResume"];function gH(t,e,r){t.animation[r]=e[r]!==eH(e,r)?ZU(e[r],t.key):void 0}function wp(t,e,...r){var n,i,a,o;(i=(n=t.animation)[e])==null||i.call(n,...r),(o=(a=t.defaultProps)[e])==null||o.call(a,...r)}var VNe=["onStart","onChange","onRest"],WNe=1,qNe=class{constructor(t,e){this.id=WNe++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),e&&(this._flush=e),t&&this.start(ce({default:!0},t))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(t=>t.idle&&!t.isDelayed&&!t.isPaused)}get item(){return this._item}set item(t){this._item=t}get(){const t={};return this.each((e,r)=>t[r]=e.get()),t}set(t){for(const e in t){const r=t[e];He.und(r)||this.springs[e].set(r)}}update(t){return t&&this.queue.push($y(t)),this}start(t){let{queue:e}=this;return t?e=Ln(t).map($y):this.queue=[],this._flush?this._flush(this,e):(xH(this,e),GNe(this,e))}stop(t,e){if(t!==!!t&&(e=t),e){const r=this.springs;At(Ln(e),n=>r[n].stop(!!t))}else yp(this._state,this._lastAsyncId),this.each(r=>r.stop(!!t));return this}pause(t){if(He.und(t))this.start({pause:!0});else{const e=this.springs;At(Ln(t),r=>e[r].pause())}return this}resume(t){if(He.und(t))this.start({pause:!1});else{const e=this.springs;At(Ln(t),r=>e[r].resume())}return this}each(t){Fa(this.springs,t)}_onFrame(){const{onStart:t,onChange:e,onRest:r}=this._events,n=this._active.size>0,i=this._changed.size>0;(n&&!this._started||i&&!this._started)&&(this._started=!0,op(t,([s,c])=>{c.value=this.get(),s(c,this,this._item)}));const a=!n&&this._started,o=i||a&&r.size?this.get():null;i&&e.size&&op(e,([s,c])=>{c.value=o,s(c,this,this._item)}),a&&(this._started=!1,op(r,([s,c])=>{c.value=o,s(c,this,this._item)}))}eventObserved(t){if(t.type=="change")this._changed.add(t.parent),t.idle||this._active.add(t.parent);else if(t.type=="idle")this._active.delete(t.parent);else return;Ct.onFrame(this._onFrame)}};function GNe(t,e){return Promise.all(e.map(r=>vH(t,r))).then(r=>M_(t,r))}function vH(t,e,r){return $(this,null,function*(){const{keys:n,to:i,from:a,loop:o,onRest:s,onResolve:c}=e,u=He.obj(e.default)&&e.default;o&&(e.loop=!1),i===!1&&(e.to=null),a===!1&&(e.from=null);const h=He.arr(i)||He.fun(i)?i:void 0;h?(e.to=void 0,e.onRest=void 0,u&&(u.onRest=void 0)):At(VNe,m=>{const v=e[m];if(He.fun(v)){const y=t._events[m];e[m]=({finished:x,cancelled:b})=>{const C=y.get(v);C?(x||(C.finished=!1),b&&(C.cancelled=!0)):y.set(v,{value:null,finished:x||!1,cancelled:b||!1})},u&&(u[m]=e[m])}});const d=t._state;e.pause===!d.paused?(d.paused=e.pause,sp(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);const p=(n||Object.keys(t.springs)).map(m=>t.springs[m].start(e)),f=e.cancel===!0||eH(e,"cancel")===!0;(h||f&&d.asyncId)&&p.push(iH(++t._lastAsyncId,{props:e,state:d,actions:{pause:y_,resume:y_,start(m,v){f?(yp(d,t._lastAsyncId),v(Cu(t))):(m.onRest=s,v(oH(h,m,d,t)))}}})),d.paused&&(yield new Promise(m=>{d.resumeQueue.add(m)}));const g=M_(t,yield Promise.all(p));if(o&&g.finished&&!(r&&g.noop)){const m=fH(e,o,i);if(m)return xH(t,[m]),vH(t,m,!0)}return c&&Ct.batchedUpdates(()=>c(g,t,t.item)),g})}function YNe(t,e){const r=ce({},t.springs);return e&&At(Ln(e),n=>{He.und(n.keys)&&(n=$y(n)),He.obj(n.to)||(n=ze(ce({},n),{to:void 0})),bH(r,n,i=>yH(i))}),KNe(t,r),r}function KNe(t,e){Fa(e,(r,n)=>{t.springs[n]||(t.springs[n]=r,wu(r,t))})}function yH(t,e){const r=new UNe;return r.key=t,e&&wu(r,e),r}function bH(t,e,r){e.keys&&At(e.keys,n=>{(t[n]||(t[n]=r(n)))._prepareNode(e)})}function xH(t,e){At(e,r=>{bH(t.springs,r,n=>yH(n,t))})}var Ly=r=>{var n=r,{children:t}=n,e=er(n,["children"]);const i=U.useContext(jy),a=e.pause||!!i.pause,o=e.immediate||!!i.immediate;e=wNe(()=>({pause:a,immediate:o}),[a,o]);const{Provider:s}=jy;return D.createElement(s,{value:e},t)},jy=JNe(Ly,{});Ly.Provider=jy.Provider,Ly.Consumer=jy.Consumer;function JNe(t,e){return Object.assign(t,D.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var QNe=()=>{const t=[],e=function(n){bNe();const i=[];return At(t,(a,o)=>{if(He.und(n))i.push(a.start());else{const s=r(n,a,o);s&&i.push(a.start(s))}}),i};e.current=t,e.add=function(n){t.includes(n)||t.push(n)},e.delete=function(n){const i=t.indexOf(n);~i&&t.splice(i,1)},e.pause=function(){return At(t,n=>n.pause(...arguments)),this},e.resume=function(){return At(t,n=>n.resume(...arguments)),this},e.set=function(n){At(t,(i,a)=>{const o=He.fun(n)?n(a,i):n;o&&i.set(o)})},e.start=function(n){const i=[];return At(t,(a,o)=>{if(He.und(n))i.push(a.start());else{const s=this._getProps(n,a,o);s&&i.push(a.start(s))}}),i},e.stop=function(){return At(t,n=>n.stop(...arguments)),this},e.update=function(n){return At(t,(i,a)=>i.update(this._getProps(n,i,a))),this};const r=function(n,i,a){return He.fun(n)?n(a,i):n};return e._getProps=r,e};function j_(t,e,r){const n=He.fun(e)&&e,{reset:i,sort:a,trail:o=0,expires:s=!0,exitBeforeEnter:c=!1,onDestroyed:u,ref:h,config:d}=n?n():e,p=U.useMemo(()=>n||arguments.length==3?QNe():void 0,[]),f=Ln(t),g=[],m=U.useRef(null),v=i?null:m.current;kl(()=>{m.current=g}),GU(()=>(At(g,L=>{p==null||p.add(L.ctrl),L.ctrl.ref=p}),()=>{At(m.current,L=>{L.expired&&clearTimeout(L.expirationId),tH(L.ctrl,p),L.ctrl.stop(!0)})}));const y=ZNe(f,n?n():e,v),x=i&&m.current||[];kl(()=>At(x,({ctrl:L,item:M,key:F})=>{tH(L,p),Xn(u,M,F)}));const b=[];if(v&&At(v,(L,M)=>{L.expired?(clearTimeout(L.expirationId),x.push(L)):(M=b[M]=y.indexOf(L.key),~M&&(g[M]=L))}),At(f,(L,M)=>{g[M]||(g[M]={key:y[M],item:L,phase:"mount",ctrl:new qNe},g[M].ctrl.item=L)}),b.length){let L=-1;const{leave:M}=n?n():e;At(b,(F,z)=>{const q=v[z];~F?(L=g.indexOf(q),g[L]=ze(ce({},q),{item:f[F]})):M&&g.splice(++L,0,q)})}He.fun(a)&&g.sort((L,M)=>a(L.item,M.item));let C=-o;const w=qU(),S=P_(e),T=new Map,k=U.useRef(new Map),O=U.useRef(!1);At(g,(L,M)=>{const F=L.key,z=L.phase,q=n?n():e;let H,W;const j=Xn(q.delay||0,F);if(z=="mount")H=q.enter,W="enter";else{const Z=y.indexOf(F)<0;if(z!="leave")if(Z)H=q.leave,W="leave";else if(H=q.update)W="update";else return;else if(!Z)H=q.enter,W="enter";else return}if(H=Xn(H,L.item,M),H=He.obj(H)?E_(H):{to:H},!H.config){const Z=d||S.config;H.config=Xn(Z,L.item,M,W)}C+=o;const B=ce(ze(ce({},S),{delay:j+C,ref:h,immediate:q.immediate,reset:!1}),H);if(W=="enter"&&He.und(B.from)){const Z=n?n():e,Y=He.und(Z.initial)||v?Z.from:Z.initial;B.from=Xn(Y,L.item,M)}const{onResolve:V}=B;B.onResolve=Z=>{Xn(V,Z);const Y=m.current,Q=Y.find(J=>J.key===F);if(Q&&!(Z.cancelled&&Q.phase!="update")&&Q.ctrl.idle){const J=Y.every(X=>X.ctrl.idle);if(Q.phase=="leave"){const X=Xn(s,Q.item);if(X!==!1){const ee=X===!0?0:X;if(Q.expired=!0,!J&&ee>0){ee<=2147483647&&(Q.expirationId=setTimeout(w,ee));return}}}J&&Y.some(X=>X.expired)&&(k.current.delete(Q),c&&(O.current=!0),w())}};const G=YNe(L.ctrl,B);W==="leave"&&c?k.current.set(L,{phase:W,springs:G,payload:B}):T.set(L,{phase:W,springs:G,payload:B})});const P=U.useContext(Ly),A=SNe(P),_=P!==A&&$Ne(P);kl(()=>{_&&At(g,L=>{L.ctrl.start({default:P})})},[P]),At(T,(L,M)=>{if(k.current.size){const F=g.findIndex(z=>z.key===M.key);g.splice(F,1)}}),kl(()=>{At(k.current.size?k.current:T,({phase:L,payload:M},F)=>{const{ctrl:z}=F;F.phase=L,p==null||p.add(z),_&&L=="enter"&&z.start({default:P}),M&&(LNe(z,M.ref),(z.ref||p)&&!O.current?z.update(M):(z.start(M),O.current&&(O.current=!1)))})},i?void 0:r);const E=L=>D.createElement(D.Fragment,null,g.map((M,F)=>{const{springs:z}=T.get(M)||M.ctrl,q=L(ce({},z),M.item,M,F);return q&&q.type?D.createElement(q.type,ze(ce({},q.props),{key:He.str(M.key)||He.num(M.key)?M.key:M.ctrl.id,ref:q.ref})):q}));return p?[E,p]:E}var XNe=1;function ZNe(t,{key:e,keys:r=e},n){if(r===null){const i=new Set;return t.map(a=>{const o=n&&n.find(s=>s.item===a&&s.phase!=="leave"&&!i.has(s));return o?(i.add(o),o.key):XNe++})}return He.und(r)?t:He.fun(r)?t.map(r):Ln(r)}var eBe=class extends $_{constructor(t,e){super(),this.source=t,this.idle=!0,this._active=new Set,this.calc=cp(...e);const r=this._get(),n=A_(r);k_(this,n.create(r))}advance(t){const e=this._get(),r=this.get();Mo(e,r)||(Na(this).setValue(e),this._onChange(e,this.idle)),!this.idle&&wH(this._active)&&F_(this)}_get(){const t=He.arr(this.source)?this.source.map(Qn):Ln(Qn(this.source));return this.calc(...t)}_start(){this.idle&&!wH(this._active)&&(this.idle=!1,At(Ry(this),t=>{t.done=!1}),ji.skipAnimation?(Ct.batchedUpdates(()=>this.advance()),F_(this)):_y.start(this))}_attach(){let t=1;At(Ln(this.source),e=>{Ni(e)&&wu(e,this),D_(e)&&(e.idle||this._active.add(e),t=Math.max(t,e.priority+1))}),this.priority=t,this._start()}_detach(){At(Ln(this.source),t=>{Ni(t)&&hp(t,this)}),this._active.clear(),F_(this)}eventObserved(t){t.type=="change"?t.idle?this.advance():(this._active.add(t.parent),this._start()):t.type=="idle"?this._active.delete(t.parent):t.type=="priority"&&(this.priority=Ln(this.source).reduce((e,r)=>Math.max(e,(D_(r)?r.priority:0)+1),0))}};function tBe(t){return t.idle!==!1}function wH(t){return!t.size||Array.from(t).every(tBe)}function F_(t){t.idle||(t.idle=!0,At(Ry(t),e=>{e.done=!0}),dp(t,{type:"idle",parent:t}))}ji.assign({createStringInterpolator:VU,to:(t,e)=>new eBe(t,e)});var CH=/^--/;function rBe(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!CH.test(t)&&!(Cp.hasOwnProperty(t)&&Cp[t])?e+"px":(""+e).trim()}var IH={};function nBe(t,e){if(!t.nodeType||!t.setAttribute)return!1;const r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",p=e,{className:n,style:i,children:a,scrollTop:o,scrollLeft:s,viewBox:c}=p,u=er(p,["className","style","children","scrollTop","scrollLeft","viewBox"]),h=Object.values(u),d=Object.keys(u).map(f=>r||t.hasAttribute(f)?f:IH[f]||(IH[f]=f.replace(/([A-Z])/g,g=>"-"+g.toLowerCase())));a!==void 0&&(t.textContent=a);for(const f in i)if(i.hasOwnProperty(f)){const g=rBe(f,i[f]);CH.test(f)?t.style.setProperty(f,g):t.style[f]=g}d.forEach((f,g)=>{t.setAttribute(f,h[g])}),n!==void 0&&(t.className=n),o!==void 0&&(t.scrollTop=o),s!==void 0&&(t.scrollLeft=s),c!==void 0&&t.setAttribute("viewBox",c)}var Cp={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},iBe=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),aBe=["Webkit","Ms","Moz","O"];Cp=Object.keys(Cp).reduce((t,e)=>(aBe.forEach(r=>t[iBe(r,e)]=t[e]),t),Cp);var oBe=/^(matrix|translate|scale|rotate|skew)/,sBe=/^(translate)/,lBe=/^(rotate|skew)/,N_=(t,e)=>He.num(t)&&t!==0?t+e:t,Fy=(t,e)=>He.arr(t)?t.every(r=>Fy(r,e)):He.num(t)?t===e:parseFloat(t)===e,cBe=class extends Dy{constructor(i){var a=i,{x:t,y:e,z:r}=a,n=er(a,["x","y","z"]);const o=[],s=[];(t||e||r)&&(o.push([t||0,e||0,r||0]),s.push(c=>[`translate3d(${c.map(u=>N_(u,"px")).join(",")})`,Fy(c,0)])),Fa(n,(c,u)=>{if(u==="transform")o.push([c||""]),s.push(h=>[h,h===""]);else if(oBe.test(u)){if(delete n[u],He.und(c))return;const h=sBe.test(u)?"px":lBe.test(u)?"deg":"";o.push(Ln(c)),s.push(u==="rotate3d"?([d,p,f,g])=>[`rotate3d(${d},${p},${f},${N_(g,h)})`,Fy(g,0)]:d=>[`${u}(${d.map(p=>N_(p,h)).join(",")})`,Fy(d,u.startsWith("scale")?1:0)])}}),o.length&&(n.transform=new uBe(o,s)),super(n)}},uBe=class extends BU{constructor(t,e){super(),this.inputs=t,this.transforms=e,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let t="",e=!0;return At(this.inputs,(r,n)=>{const i=Qn(r[0]),[a,o]=this.transforms[n](He.arr(i)?i:r.map(Qn));t+=" "+a,e=e&&o}),e?"none":t}observerAdded(t){t==1&&At(this.inputs,e=>At(e,r=>Ni(r)&&wu(r,this)))}observerRemoved(t){t==0&&At(this.inputs,e=>At(e,r=>Ni(r)&&hp(r,this)))}eventObserved(t){t.type=="change"&&(this._value=null),dp(this,t)}},dBe=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];ji.assign({batchedUpdates:qt.unstable_batchedUpdates,createStringInterpolator:VU,colors:QFe});var hBe=ENe(dBe,{applyAnimatedValues:nBe,createAnimatedStyle:t=>new cBe(t),getComponentProps:n=>{var i=n,{scrollTop:t,scrollLeft:e}=i,r=er(i,["scrollTop","scrollLeft"]);return r}}),B_=hBe.animated;const pBe=t=>{const{dispatch:e}=D.useContext(vu),{setHighlighted:r,clearHighlighted:n}=Jz();return a=>({onPointerEnter:()=>{e({type:"enterItem",data:a}),r({seriesId:a.seriesId,dataIndex:a.dataIndex})},onPointerLeave:u=>{u.currentTarget.hasPointerCapture(u.pointerId)&&u.currentTarget.releasePointerCapture(u.pointerId),e({type:"leaveItem",data:a}),n()},onPointerDown:u=>{u.currentTarget.hasPointerCapture(u.pointerId)&&u.currentTarget.releasePointerCapture(u.pointerId)}})},fBe=["id","dataIndex","classes","color","slots","slotProps","style","onClick"];function mBe(t){return Ki("MuiBarElement",t)}ka("MuiBarElement",["root"]);const gBe=t=>{const{classes:e,id:r}=t,n={root:["root",`series-${r}`]};return Yi(n,mBe,e)},vBe=Or(B_.rect,{name:"MuiBarElement",slot:"Root",overridesResolver:(t,e)=>e.root})(({ownerState:t})=>({stroke:"none",fill:t.isHighlighted?hu(t.color).brighter(.5).formatHex():t.color,transition:"opacity 0.2s ease-in, fill 0.2s ease-in",opacity:t.isFaded&&.3||1}));function yBe(t){var y;const{id:e,dataIndex:r,classes:n,color:i,slots:a,slotProps:o,style:s,onClick:c}=t,u=Fe(t,fBe),h=pBe(),{isFaded:d,isHighlighted:p}=Qz({seriesId:e,dataIndex:r}),f={id:e,dataIndex:r,classes:n,color:i,isFaded:d,isHighlighted:p},g=gBe(f),m=(y=a==null?void 0:a.bar)!=null?y:vBe,v=wi({elementType:m,externalSlotProps:o==null?void 0:o.bar,externalForwardedProps:u,additionalProps:N({},h({type:"bar",seriesId:e,dataIndex:r}),{style:s,onClick:c,cursor:c?"pointer":"unset"}),className:g.root,ownerState:f});return R.jsx(m,N({},v))}const Ny=(t,{hasNegative:e,hasPositive:r,borderRadius:n,layout:i})=>{if(!n)return 0;const a=i==="vertical";return t==="top-left"&&(a&&r||!a&&e)||t==="top-right"&&(a&&r||!a&&r)||t==="bottom-right"&&(a&&e||!a&&r)||t==="bottom-left"&&(a&&e||!a&&e)?n:0},bBe=["style","maskId"],xBe=t=>`inset(0px round ${t.topLeft}px ${t.topRight}px ${t.bottomRight}px ${t.bottomLeft}px)`;function wBe(t){var r,n;const e=t.ownerState;return R.jsx(B_.rect,{style:N({},t.style,{clipPath:(t.ownerState.layout==="vertical"?(r=t.style)==null?void 0:r.height:(n=t.style)==null?void 0:n.width).to(i=>xBe({topLeft:Math.min(i,Ny("top-left",e)),topRight:Math.min(i,Ny("top-right",e)),bottomRight:Math.min(i,Ny("bottom-right",e)),bottomLeft:Math.min(i,Ny("bottom-left",e))}))})})}function CBe(t){const{style:e,maskId:r}=t,n=Fe(t,bBe);return!t.borderRadius||t.borderRadius<=0?null:R.jsx("clipPath",{id:r,children:R.jsx(wBe,{ownerState:n,style:e})})}function IBe(t){return Ki("MuiBarLabel",t)}const z_=ka("MuiBarLabel",["root","highlighted","faded"]),SBe=t=>{const{classes:e,seriesId:r,isFaded:n,isHighlighted:i}=t,a={root:["root",`series-${r}`,i&&"highlighted",n&&"faded"]};return Yi(a,IBe,e)},_Be=t=>{const{barLabel:e,value:r,dataIndex:n,seriesId:i,height:a,width:o}=t;return e==="value"?r?r==null?void 0:r.toString():null:e({seriesId:i,dataIndex:n,value:r},{bar:{height:a,width:o}})},TBe=["seriesId","dataIndex","color","isFaded","isHighlighted","classes"],kBe=Or(B_.text,{name:"MuiBarLabel",slot:"Root",overridesResolver:(t,e)=>[{[`&.${z_.faded}`]:e.faded},{[`&.${z_.highlighted}`]:e.highlighted},e.root]})(({theme:t})=>{var e,r,n,i;return N({},(e=t==null?void 0:t.typography)==null?void 0:e.body2,{stroke:"none",fill:(i=(n=(r=t.vars||t)==null?void 0:r.palette)==null?void 0:n.text)==null?void 0:i.primary,transition:"opacity 0.2s ease-in, fill 0.2s ease-in",textAnchor:"middle",dominantBaseline:"central",pointerEvents:"none",opacity:1,[`&.${z_.faded}`]:{opacity:.3}})});function ABe(t){const e=ws({props:t,name:"MuiBarLabel"}),r=Fe(e,TBe);return R.jsx(kBe,N({},r))}const PBe=["seriesId","classes","color","style","dataIndex","barLabel","slots","slotProps","height","width","value"],EBe=["ownerState"];function OBe(t){var S;const{seriesId:e,classes:r,color:n,style:i,dataIndex:a,barLabel:o,slots:s,slotProps:c,height:u,width:h,value:d}=t,p=Fe(t,PBe),{isFaded:f,isHighlighted:g}=Qz({seriesId:e,dataIndex:a}),m={seriesId:e,classes:r,color:n,isFaded:f,isHighlighted:g,dataIndex:a},v=SBe(m),y=(S=s==null?void 0:s.barLabel)!=null?S:ABe,x=wi({elementType:y,externalSlotProps:c==null?void 0:c.barLabel,additionalProps:N({},p,{style:i,className:v.root}),ownerState:m}),{ownerState:b}=x,C=Fe(x,EBe);if(!o)return null;const w=_Be({barLabel:o,value:d,dataIndex:a,seriesId:e,height:u,width:h});return w?R.jsx(y,N({},C,b,{children:w})):null}const RBe=["bars","skipAnimation"],MBe=({layout:t,yOrigin:e,x:r,width:n,y:i,xOrigin:a,height:o})=>N({},t==="vertical"?{y:e,x:r+n/2,height:0,width:n}:{y:i+o/2,x:a,height:o,width:0}),SH=({x:t,width:e,y:r,height:n})=>({x:t+e/2,y:r+n/2,height:n,width:e});function DBe(t){const{bars:e,skipAnimation:r}=t,n=Fe(t,RBe),i=j_(e,{keys:a=>`${a.seriesId}-${a.dataIndex}`,from:MBe,leave:null,enter:SH,update:SH,immediate:r});return R.jsx(D.Fragment,{children:i((a,{seriesId:o,dataIndex:s,color:c,value:u,width:h,height:d})=>R.jsx(OBe,N({seriesId:o,dataIndex:s,value:u,color:c,width:h,height:d},n,{style:a})))})}const U_=(t,e)=>{const r=`${t}-axis`,n=`${t}Axis`;return e===(t==="x"?bS:xS)?`The first \`${n}\``:`The ${r} with id "${e}"`};function $Be(t,e,r,n,i,a){const o=n[r],s=a[i],c=t?o:s,u=t?s:o,h=t?r:i,d=t?i:r,p=t?"x":"y",f=t?"y":"x";if(!t_(c))throw new Error(`MUI X: ${U_(p,h)} should be of type "band" to display the bar series of id "${e}".`);if(c.data===void 0)throw new Error(`MUI X: ${U_(p,h)} should have data property.`);if(t_(u)||rU(u))throw new Error(`MUI X: ${U_(f,d)} should be a continuous type to display the bar series of id "${e}".`)}const _H=D.createContext({isInitialized:!1,data:{skipAnimation:void 0}});function LBe(t){const{children:e,skipAnimation:r}=t,n=typeof window=="undefined"||!(window!=null&&window.matchMedia),[i,a]=D.useState(n||void 0);kl(()=>{var u;if(n)return;const s=h=>{const d=h.matches||void 0;a(d),ji.assign({skipAnimation:d})},c=window.matchMedia("(prefers-reduced-motion)");return s(c),(u=c==null?void 0:c.addEventListener)==null||u.call(c,"change",s),()=>{var h;(h=c==null?void 0:c.removeEventListener)==null||h.call(c,"change",s)}},[]);const o=D.useMemo(()=>({isInitialized:!0,data:{skipAnimation:r||i}}),[i,r]);return R.jsx(_H.Provider,{value:o,children:e})}function jBe(t){const{isInitialized:e,data:r}=D.useContext(_H);if(!e)throw new Error(["MUI X: Could not find the animation ref context.","It looks like you rendered your component outside of a ChartsContainer parent component."].join(`
3699
- `));return t||r.skipAnimation}const FBe=["skipAnimation","onItemClick","borderRadius","barLabel"];function NBe({bandWidth:t,numberOfGroups:e,gapRatio:r}){if(r===0)return{barWidth:t/e,offset:0};const n=t/(e+(e-1)*r),i=r*n;return{barWidth:n,offset:i}}const BBe=()=>{var f;const t=(f=T$e())!=null?f:{series:{},stackingGroups:[]},e=oa(),r=aje(),{series:n,stackingGroups:i}=t,{xAxis:a,yAxis:o,xAxisIds:s,yAxisIds:c}=e,u=s[0],h=c[0],d={};return{completedData:i.flatMap(({ids:g},m)=>g.flatMap(v=>{var M,F,z,q;const y=(F=(M=n[v].xAxisId)!=null?M:n[v].xAxisKey)!=null?F:u,x=(q=(z=n[v].yAxisId)!=null?z:n[v].yAxisKey)!=null?q:h,b=a[y],C=o[x],w=n[v].layout==="vertical";$Be(w,v,y,a,x,o);const S=w?b:C,T=b.scale,k=C.scale,O=Yz(n[v],a[y],o[x]),P=S.scale.bandwidth(),{barWidth:A,offset:_}=NBe({bandWidth:P,numberOfGroups:i.length,gapRatio:S.barGapRatio}),E=m*(A+_),{stackedData:L}=n[v];return L.map((H,W)=>{var Q,J,X,ee;const j=H.map(ne=>w?k(ne):T(ne)),B=Math.round(Math.min(...j)),V=Math.round(Math.max(...j)),G=n[v].stack,Z={seriesId:v,dataIndex:W,layout:n[v].layout,x:w?T((Q=a[y].data)==null?void 0:Q[W])+E:B,y:w?B:k((J=o[x].data)==null?void 0:J[W])+E,xOrigin:T(0),yOrigin:k(0),height:w?V-B:A,width:w?A:V-B,color:O(W),value:n[v].data[W],maskId:`${r}_${G||v}_${m}_${W}`};d[Z.maskId]||(d[Z.maskId]={id:Z.maskId,width:0,height:0,hasNegative:!1,hasPositive:!1,layout:Z.layout,xOrigin:T(0),yOrigin:k(0),x:0,y:0});const Y=d[Z.maskId];return Y.width=Z.layout==="vertical"?Z.width:Y.width+Z.width,Y.height=Z.layout==="vertical"?Y.height+Z.height:Z.height,Y.x=Math.min(Y.x===0?1/0:Y.x,Z.x),Y.y=Math.min(Y.y===0?1/0:Y.y,Z.y),Y.hasNegative=Y.hasNegative||((X=Z.value)!=null?X:0)<0,Y.hasPositive=Y.hasPositive||((ee=Z.value)!=null?ee:0)>0,Z})})),masksData:Object.values(d)}},By=({layout:t,yOrigin:e,x:r,width:n,y:i,xOrigin:a,height:o})=>N({},t==="vertical"?{y:e,x:r,height:0,width:n}:{y:i,x:a,height:o,width:0}),zy=({x:t,width:e,y:r,height:n})=>({y:r,x:t,height:n,width:e});function zBe(t){const{completedData:e,masksData:r}=BBe(),{skipAnimation:n,onItemClick:i,borderRadius:a,barLabel:o}=t,s=Fe(t,FBe),c=jBe(n),u=!a||a<=0,h=j_(e,{keys:p=>`${p.seriesId}-${p.dataIndex}`,from:By,leave:By,enter:zy,update:zy,immediate:c}),d=j_(u?[]:r,{keys:p=>p.id,from:By,leave:By,enter:zy,update:zy,immediate:c});return R.jsxs(D.Fragment,{children:[!u&&d((p,{id:f,hasPositive:g,hasNegative:m,layout:v})=>R.jsx(CBe,{maskId:f,borderRadius:a,hasNegative:m,hasPositive:g,layout:v,style:p})),h((p,{seriesId:f,dataIndex:g,color:m,maskId:v})=>{const y=R.jsx(yBe,N({id:f,dataIndex:g,color:m},s,{onClick:i&&(x=>{i(x,{type:"bar",seriesId:f,dataIndex:g})}),style:p}));return u?y:R.jsx("g",{clipPath:`url(#${v})`,children:y})}),o&&R.jsx(DBe,N({bars:e,skipAnimation:c,barLabel:o},s))]})}function Iu(t){return t instanceof Date?t.getTime():t}const UBe=t=>{const e=a_(),r=aa(),{xAxis:n,yAxis:i,xAxisIds:a,yAxisIds:o}=oa(),{dispatch:s}=D.useContext(vu),c=a[0],u=o[0],h=D.useRef({isInChart:!1,x:-1,y:-1});D.useEffect(()=>{const d=e.current;if(d===null||t)return()=>{};function p(v,y){const{scale:x,data:b,reverse:C}=v;if(!Sl(x)){const S=x.invert(y);if(b===void 0)return{value:S,index:-1};const T=Iu(S),k=b==null?void 0:b.findIndex((O,P)=>{const A=Iu(O);return A>T&&(P===0||Math.abs(T-A)<=Math.abs(T-Iu(b[P-1])))||A<=T&&(P===b.length-1||Math.abs(Iu(S)-A)<Math.abs(Iu(S)-Iu(b[P+1])))});return{value:k!==void 0&&k>=0?b[k]:S,index:k}}const w=x.bandwidth()===0?Math.floor((y-Math.min(...x.range())+x.step()/2)/x.step()):Math.floor((y-Math.min(...x.range()))/x.step());if(w<0||w>=b.length)return null;if(C){const S=b.length-1-w;return{index:S,value:b[S]}}return{index:w,value:b[w]}}const f=()=>{h.current={isInChart:!1,x:-1,y:-1},s({type:"exitChart"})},g=v=>{const y="targetTouches"in v?v.targetTouches[0]:v,x=UFe(d,y);if(h.current.x=x.x,h.current.y=x.y,!r.isPointInside(x,{targetElement:v.target})){h.current.isInChart&&(s({type:"exitChart"}),h.current.isInChart=!1);return}h.current.isInChart=!0;const b=p(n[c],x.x),C=p(i[u],x.y);s({type:"updateAxis",data:{x:b,y:C}})},m=v=>{const y=v.currentTarget;y&&y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId)};return d.addEventListener("pointerdown",m),d.addEventListener("pointermove",g),d.addEventListener("pointerout",f),d.addEventListener("pointercancel",f),d.addEventListener("pointerleave",f),()=>{d.removeEventListener("pointerdown",m),d.removeEventListener("pointermove",g),d.removeEventListener("pointerout",f),d.removeEventListener("pointercancel",f),d.removeEventListener("pointerleave",f)}},[e,s,u,i,c,n,t,r])},HBe=["children","width","height","viewBox","disableAxisListener","className","title","desc"],VBe=Or("svg",{name:"MuiChartsSurface",slot:"Root"})(()=>({touchAction:"none"})),WBe=D.forwardRef(function(e,r){const n=ws({props:e,name:"MuiChartsSurface"}),{children:i,width:a,height:o,viewBox:s,disableAxisListener:c=!1,className:u,title:h,desc:d}=n,p=Fe(n,HBe),f=N({width:a,height:o,x:0,y:0},s);return UBe(c),R.jsxs(VBe,N({width:a,height:o,viewBox:`${f.x} ${f.y} ${f.width} ${f.height}`,ref:r,className:u},p,{children:[R.jsx("title",{children:h}),R.jsx("desc",{children:d}),i]}))});function TH(t){const{isReversed:e,gradientId:r,size:n,direction:i,scale:a,colorMap:o}=t;return n<=0?null:R.jsx("linearGradient",{id:r,x1:"0",x2:"0",y1:"0",y2:"0",[`${i}${e?1:2}`]:`${n}px`,gradientUnits:"userSpaceOnUse",children:o.thresholds.map((s,c)=>{const u=a(s);if(u===void 0)return null;const h=e?1-u/n:u/n;return R.jsxs(D.Fragment,{children:[R.jsx("stop",{offset:h,stopColor:o.colors[c],stopOpacity:1}),R.jsx("stop",{offset:h,stopColor:o.colors[c+1],stopOpacity:1})]},s.toString()+c)})})}function qBe(){const{chartId:t}=D.useContext(gy);return D.useCallback((e,r)=>`${t}-gradient-${r}-${e}`,[t])}function GBe(){const{top:t,height:e,bottom:r,left:n,width:i,right:a}=aa(),o=t+e+r,s=n+i+a,c=qBe(),{xAxisIds:u,xAxis:h,yAxisIds:d,yAxis:p}=oa();return R.jsxs("defs",{children:[d.filter(f=>p[f].colorMap!==void 0).map(f=>{const g=c(f,"y"),{colorMap:m,scale:v,colorScale:y,reverse:x}=p[f];return(m==null?void 0:m.type)==="piecewise"?R.jsx(TH,{isReversed:!x,scale:v,colorMap:m,size:o,gradientId:g,direction:"y"},g):(m==null?void 0:m.type)==="continuous"?R.jsx(_U,{isReversed:!x,scale:v,colorScale:y,colorMap:m,size:o,gradientId:g,direction:"y"},g):null}),u.filter(f=>h[f].colorMap!==void 0).map(f=>{const g=c(f,"x"),{colorMap:m,scale:v,reverse:y,colorScale:x}=h[f];return(m==null?void 0:m.type)==="piecewise"?R.jsx(TH,{isReversed:y,scale:v,colorMap:m,size:s,gradientId:g,direction:"x"},g):(m==null?void 0:m.type)==="continuous"?R.jsx(_U,{isReversed:y,scale:v,colorScale:x,colorMap:m,size:s,gradientId:g,direction:"x"},g):null})]})}const kH=(t,e,r)=>{var i;const n=r==="x"?bS:xS;return[...(i=t==null?void 0:t.map((a,o)=>N({id:`defaultized-${r}-axis-${o}`},a)))!=null?i:[],...t===void 0||t.findIndex(({id:a})=>a===n)===-1?[{id:n,scaleType:"linear"}]:[]].map(a=>{const o=a.dataKey;if(o===void 0||a.data!==void 0)return a;if(e===void 0)throw new Error(`MUI X: ${r}-axis uses \`dataKey\` but no \`dataset\` is provided.`);return N({},a,{data:e.map(s=>s[o])})})},YBe=(t,e,r)=>{const n=D.useMemo(()=>kH(t,r,"x"),[t,r]),i=D.useMemo(()=>kH(e,r,"y"),[e,r]);return[n,i]},KBe=["width","height","series","margin","xAxis","yAxis","zAxis","colors","dataset","sx","title","desc","disableAxisListener","highlightedItem","onHighlightChange","plugins","children","skipAnimation"],JBe=(t,e)=>{const{width:r,height:n,series:i,margin:a,xAxis:o,yAxis:s,zAxis:c,colors:u,dataset:h,sx:d,title:p,desc:f,disableAxisListener:g,highlightedItem:m,onHighlightChange:v,plugins:y,children:x,skipAnimation:b}=t,C=Fe(t,KBe),w=D.useRef(null),S=_d(e,w),[T,k]=YBe(o,s,h),O={width:r,height:n,margin:a,svgRef:w},P={skipAnimation:b},A={plugins:y},_={series:i,colors:u,dataset:h},E={xAxis:T,yAxis:k,dataset:h},L={zAxis:c,dataset:h},M={highlightedItem:m,onHighlightChange:v},F=N({},C,{width:r,height:n,ref:S,sx:d,title:p,desc:f,disableAxisListener:g});return{children:x,drawingProviderProps:O,seriesProviderProps:_,cartesianProviderProps:E,zAxisContextProps:L,highlightedProviderProps:M,chartsSurfaceProps:F,pluginProviderProps:A,animationProviderProps:P,xAxis:T,yAxis:k}},QBe=D.forwardRef(function(e,r){const{children:n,drawingProviderProps:i,seriesProviderProps:a,cartesianProviderProps:o,zAxisContextProps:s,highlightedProviderProps:c,chartsSurfaceProps:u,pluginProviderProps:h,animationProviderProps:d}=JBe(e,r);return R.jsx(ije,N({},i,{children:R.jsx(w$e,N({},h,{children:R.jsx(_$e,N({},a,{children:R.jsx(pje,N({},o,{children:R.jsx(rje,N({},s,{children:R.jsx(Zje,{children:R.jsx(P$e,N({},c,{children:R.jsxs(WBe,N({},u,{children:[R.jsx(GBe,{}),R.jsx(LBe,N({},d,{children:n}))]}))}))})}))}))}))}))}))}),XBe=Or("div",{name:"MuiResponsiveChart",slot:"Container"})(({ownerState:t})=>{var e,r;return{width:(e=t.width)!=null?e:"100%",height:(r=t.height)!=null?r:"100%",display:"flex",position:"relative",flexGrow:1,flexDirection:"column",alignItems:"center",justifyContent:"center",overflow:"hidden","&>svg":{width:"100%",height:"100%"}}}),ZBe=(t,e,r)=>{const n=D.useRef({displayError:!1,initialCompute:!0,computeRun:0}),i=D.useRef(null),[a,o]=D.useState(0),[s,c]=D.useState(0),u=D.useCallback(()=>{const h=i==null?void 0:i.current;if(!h)return{};const p=aoe(h).getComputedStyle(h),f=Math.floor(parseFloat(p.height))||0,g=Math.floor(parseFloat(p.width))||0;return o(g),c(f),{width:g,height:f}},[]);return D.useEffect(()=>{n.current.displayError=!0},[]),Qo(()=>{if(!r||!n.current.initialCompute||n.current.computeRun>20)return;const h=u();h.width!==a||h.height!==s?n.current.computeRun+=1:n.current.initialCompute&&(n.current.initialCompute=!1)},[a,s,u,r]),Qo(()=>{if(t!==void 0&&e!==void 0)return()=>{};u();const h=i.current;if(typeof ResizeObserver=="undefined")return()=>{};let d;const p=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{u()})});return h&&p.observe(h),()=>{d&&cancelAnimationFrame(d),h&&p.unobserve(h)}},[u,e,t]),{containerRef:i,width:t!=null?t:a,height:e!=null?e:s}},eze=["width","height","resolveSizeBeforeRender","margin","children","series","colors","dataset","desc","disableAxisListener","highlightedItem","onHighlightChange","plugins","sx","title","viewBox","xAxis","yAxis","zAxis","skipAnimation"],tze=(t,e)=>{const{width:r,height:n,resolveSizeBeforeRender:i,margin:a,children:o,series:s,colors:c,dataset:u,desc:h,disableAxisListener:d,highlightedItem:p,onHighlightChange:f,plugins:g,sx:m,title:v,viewBox:y,xAxis:x,yAxis:b,zAxis:C,skipAnimation:w}=t,S=Fe(t,eze),{containerRef:T,width:k,height:O}=ZBe(r,n,i),P=N({},S,{ownerState:{width:r,height:n},ref:T});return{hasIntrinsicSize:k&&O,chartContainerProps:{margin:a,children:o,series:s,colors:c,dataset:u,desc:h,disableAxisListener:d,highlightedItem:p,onHighlightChange:f,plugins:g,sx:m,title:v,viewBox:y,xAxis:x,yAxis:b,zAxis:C,skipAnimation:w,width:k,height:O,ref:e},resizableChartContainerProps:P}},rze=D.forwardRef(function(e,r){const{hasIntrinsicSize:n,chartContainerProps:i,resizableChartContainerProps:a}=tze(e,r);return R.jsx(XBe,N({},a,{children:n?R.jsx(QBe,N({},i)):null}))}),nze=["message"],ize=Or("text")(({theme:t})=>N({},t.typography.body2,{stroke:"none",fill:t.palette.text.primary,shapeRendering:"crispEdges",textAnchor:"middle",dominantBaseline:"middle"}));function aze(t){const{message:e}=t,r=Fe(t,nze),{top:n,left:i,height:a,width:o}=aa();return R.jsx(ize,N({x:i+o/2,y:n+a/2},r,{children:e!=null?e:"Loading data…"}))}const oze=["message"],sze=Or("text")(({theme:t})=>N({},t.typography.body2,{stroke:"none",fill:t.palette.text.primary,shapeRendering:"crispEdges",textAnchor:"middle",dominantBaseline:"middle"}));function lze(t){const{message:e}=t,r=Fe(t,oze),{top:n,left:i,height:a,width:o}=aa();return R.jsx(sze,N({x:i+o/2,y:n+a/2},r,{children:e!=null?e:"No data to display"}))}function cze(){const t=Cs();return Object.values(t).every(e=>{if(!e)return!0;const{series:r,seriesOrder:n}=e;return n.every(i=>r[i].data.length===0)})}function uze(t){var r,n,i,a,o,s;const e=cze();if(t.loading){const c=(n=(r=t.slots)==null?void 0:r.loadingOverlay)!=null?n:aze;return R.jsx(c,N({},(i=t.slotProps)==null?void 0:i.loadingOverlay))}if(e){const c=(o=(a=t.slots)==null?void 0:a.noDataOverlay)!=null?o:lze;return R.jsx(c,N({},(s=t.slotProps)==null?void 0:s.noDataOverlay))}return null}const dze=["xAxis","yAxis","series","width","height","margin","colors","dataset","sx","tooltip","onAxisClick","axisHighlight","legend","grid","topAxis","leftAxis","rightAxis","bottomAxis","children","slots","slotProps","skipAnimation","loading","layout","onItemClick","highlightedItem","onHighlightChange","borderRadius","barLabel","className"],hze=t=>{const{xAxis:e,yAxis:r,series:n,width:i,height:a,margin:o,colors:s,dataset:c,sx:u,tooltip:h,onAxisClick:d,axisHighlight:p,legend:f,grid:g,topAxis:m,leftAxis:v,rightAxis:y,bottomAxis:x,children:b,slots:C,slotProps:w,skipAnimation:S,loading:T,layout:k,onItemClick:O,highlightedItem:P,onHighlightChange:A,borderRadius:_,barLabel:E,className:L}=t,M=Fe(t,dze),z=`${tM()}-clip-path`,q=k==="horizontal"||k===void 0&&n.some(ne=>ne.layout==="horizontal"),H={scaleType:"band",data:Array.from({length:Math.max(...n.map(ne=>{var re,me;return((me=(re=ne.data)!=null?re:c)!=null?me:[]).length}))},(ne,re)=>re)},W=N({},M,{series:n.map(ne=>N({type:"bar"},ne,{layout:q?"horizontal":"vertical"})),width:i,height:a,margin:o,colors:s,dataset:c,xAxis:e!=null?e:q?void 0:[N({id:bS},H)],yAxis:r!=null?r:q?[N({id:xS},H)]:void 0,sx:u,highlightedItem:P,onHighlightChange:A,disableAxisListener:(h==null?void 0:h.trigger)!=="axis"&&(p==null?void 0:p.x)==="none"&&(p==null?void 0:p.y)==="none"&&!d,className:L,skipAnimation:S}),j={onItemClick:O,slots:C,slotProps:w,borderRadius:_,barLabel:E},B={onAxisClick:d},V={vertical:g==null?void 0:g.vertical,horizontal:g==null?void 0:g.horizontal},G={clipPath:`url(#${z})`},Z={id:z},Y={slots:C,slotProps:w,loading:T},Q={topAxis:m,leftAxis:v,rightAxis:y,bottomAxis:x,slots:C,slotProps:w},J=N({},q?{y:"band"}:{x:"band"},p),X=N({},f,{slots:C,slotProps:w}),ee=N({},h,{slots:C,slotProps:w});return{chartContainerProps:W,barPlotProps:j,axisClickHandlerProps:B,gridProps:V,clipPathProps:Z,clipPathGroupProps:G,overlayProps:Y,chartsAxisProps:Q,axisHighlightProps:J,legendProps:X,tooltipProps:ee,children:b}},pze=D.forwardRef(function(e,r){const n=ws({props:e,name:"MuiBarChart"}),{chartContainerProps:i,barPlotProps:a,axisClickHandlerProps:o,gridProps:s,clipPathProps:c,clipPathGroupProps:u,overlayProps:h,chartsAxisProps:d,axisHighlightProps:p,legendProps:f,tooltipProps:g,children:m}=hze(n);return R.jsxs(rze,N({ref:r},i,{children:[n.onAxisClick&&R.jsx(HFe,N({},o)),R.jsx(zje,N({},s)),R.jsxs("g",N({},u,{children:[R.jsx(zBe,N({},a)),R.jsx(uze,N({},h)),R.jsx(zFe,N({},p))]})),R.jsx(Dje,N({},d)),R.jsx(jFe,N({},f)),!n.loading&&R.jsx(wFe,N({},g)),R.jsx(fje,N({},c)),m]}))}),fze=t=>{const{Spinner:e}=jt.useComponentContext(),r=Tt(Zt);if(!t.chartData)return R.jsx(e,{my:10});const n=()=>R.jsx(pze,{borderRadius:5,sx:{[`& .${l_.line}`]:{strokeDasharray:"5 3",strokeWidth:1},"& .MuiChartsLegend-series tspan":{fontSize:"18px"}},margin:{bottom:80,top:60},height:375,grid:{vertical:!1,horizontal:!0},bottomAxis:{tickLabelStyle:{angle:-45,textAnchor:"end"},disableTicks:!0},xAxis:[{scaleType:"band",data:t.chartData.map(i=>i.date)}],yAxis:[{disableTicks:!0}],series:[{data:t.chartData.map(i=>i.participations||0),color:"#2a63c5",label:r.participations,valueFormatter:i=>`${i}`}],slotProps:{popper:{sx:{"& .MuiChartsTooltip-paper":{backgroundColor:"white",opacity:.9},"& .MuiChartsTooltip-row":{backgroundColor:"#FFF",height:50},"& .MuiChartsTooltip-table":{backgroundColor:"#F0F4F8",textAlign:"center"}}}}});return R.jsx(be,{textAlign:"center",bgcolor:"white",children:n()})},mze=(t,e)=>yl(t).format("DD MMM YYYY"),gze=t=>{const[e,r]=U.useState(!1),[n,i]=U.useState(""),[a,o]=U.useState("success"),[s,c]=U.useState(null),u=Tt(Zt),{https:h}=jt.useAPIContext(),{Toast:d}=jt.useComponentContext();U.useEffect(()=>{if(!((s==null?void 0:s.length)>0))return f(),()=>{c(null)}},[]);const p=(g,m)=>{i(m),o(g),r(!e)},f=()=>$(this,null,function*(){var y;const g=yl(t.poll.createdAt).format("YYYY-MM-DD"),m=yl(new Date).format("YYYY-MM-DD"),v=yield h.getEntityParticipations(t.poll.id,g,m);if(v.ok){const b=(y=(yield v.json()).data)==null?void 0:y.breakdown.map(C=>({date:mze(new Date(C.date)),participations:C.count}));c(b);return}console.error(yield v.json()),p("warning",u.pollChartErrorMessage)});return R.jsxs(Qr,{variant:"soft",sx:{borderRadius:0,boxShadow:"inset 0 3px 6px 0 rgba(0 0 0 / 0.08)"},children:[R.jsx(Gi,{children:R.jsxs(be,{mb:1,children:[R.jsx(be,{display:"flex",alignItems:"center",mb:1,children:R.jsx(De,{level:"body-lg",sx:{mx:"auto"},children:u.performanceByDay})}),R.jsx(fze,{chartData:s})]})}),R.jsx(d,{showToast:e,color:a,message:n,hideToast:()=>r(!1)})]})},vze=t=>{const e=Tt(Zt);return R.jsxs(Lw,{defaultValue:0,sx:{p:0,bgcolor:"transparent"},children:[R.jsxs($w,{sx:{borderRadius:0,cursor:"default",fontSize:"0.875rem",[`& .${GR.root}`]:{'&[aria-selected="true"]':{bgcolor:"#fff",py:1,borderColor:"transparent","&::before":{content:'""',display:"block",position:"absolute",height:2,bottom:-2,left:0,right:0},"&::after":{bgcolor:"primary.500"}}}},tabFlex:"auto",children:[R.jsx(sc,{children:e.voting}),R.jsx(sc,{children:e.reports}),R.jsx(sc,{children:e.exports})]}),R.jsx(Id,{value:0,sx:{p:0},children:R.jsx(zDe,{poll:t.poll})}),R.jsx(Id,{value:1,sx:{p:0,cursor:"default"},children:R.jsx(gze,{poll:t.poll})}),R.jsx(Id,{value:2,sx:{p:0,cursor:"default"},children:R.jsx(BDe,{poll:t.poll})})]})},yze=t=>!yl(t).isBefore(yl("2025-05-21")),bze=({row:t,onClickEdit:e,handleGamesChange:r})=>{var p,f;const[n,i]=U.useState(!1),{isMobile:a}=jt.useIsMobile(),{constants:o}=jt,s=Tt(Zt),c=Tt(Kn),u=g=>{g.stopPropagation(),i(!n)},h=g=>{switch(g){case"INACTIVE":return"danger";case"ACTIVE":return"success";case"EXPIRED":return"neutral";default:return"neutral"}},d=()=>{var g;return R.jsx(R.Fragment,{children:!a&&R.jsxs(R.Fragment,{children:[R.jsx("td",{children:((g=c.types.find(m=>m.id===t.type))==null?void 0:g.label)||"No type"}),R.jsx("td",{children:t.totalVotes}),R.jsx("td",{children:yze(t.createdAt)?t.participationCount:t.totalVotes}),R.jsx("td",{children:yl(t.createdAt).format(s.timeFormat)})]})})};return R.jsxs(R.Fragment,{children:[R.jsxs("tr",{onClick:e,children:[R.jsx("td",{children:R.jsx(ut,{title:s.additionalInformation,children:R.jsx(Ht,{"aria-label":"expand row",variant:"plain",color:"neutral",size:"sm",onClick:u,children:n?R.jsx(MM,{}):R.jsx(RM,{})})})}),R.jsx("td",{scope:"row",children:t.title}),R.jsx("td",{children:R.jsx(fr,{color:h(t.status),variant:"solid",size:"sm",children:t.status})}),R.jsx("td",{children:a?((p=o.supportedLanguages[t.language])==null?void 0:p.key)||"N/A":((f=o.supportedLanguages[t.language])==null?void 0:f.name)||"N/A"}),d(),R.jsx("td",{children:R.jsx(FDe,{poll:t,onClickEdit:e,handleGamesChange:r})})]}),R.jsx("tr",{children:R.jsx("td",{style:{height:0,padding:0},colSpan:9,children:n?R.jsx(vze,{poll:t}):R.jsx(R.Fragment,{})})})]})},xze=({row:t,isSelected:e,onRowSelect:r})=>{const[n,i]=U.useState(!1),a=Tt(Zt),o=u=>{u.stopPropagation(),i(!n)},s=()=>{r(t)},c=()=>R.jsxs(Qa,{variant:"outlined",size:"sm",sx:{"& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[R.jsx("thead",{children:R.jsx("tr",{children:R.jsx("th",{children:R.jsx(De,{level:"body-sm",children:a.options})})})}),R.jsx("tbody",{children:t.options.map(u=>R.jsx("tr",{children:R.jsx("td",{children:R.jsxs(De,{level:"body-sm",children:[u.title," "]})})},`option-${u.id}`))})]});return R.jsxs(R.Fragment,{children:[R.jsxs("tr",{onClick:s,children:[R.jsx("td",{children:R.jsx(Gs,{checked:e,onChange:s})}),R.jsx("td",{scope:"row",children:t.title}),R.jsx("td",{children:yl(t.createdAt).format(a.timeFormat)}),R.jsx("td",{children:R.jsx(ut,{title:n?"":a.expand,children:R.jsx(Ht,{"aria-label":"expand row",variant:"plain",color:"neutral",size:"sm",onClick:o,children:n?R.jsx(MM,{}):R.jsx(RM,{})})})})]}),R.jsx("tr",{children:R.jsx("td",{style:{height:0,padding:n?10:0},colSpan:9,children:n?c():R.jsx(R.Fragment,{})})})]})},AH=t=>{const{isMobile:e}=jt.useIsMobile(),r=Tt(Zt),n=t.pagePolls.get(t.pageCount),i=t.pageCount===1,a=t.pagePolls.get(t.pageCount).length<t.pollsPerPage,o=[r.type,r.votes,r.participations,r.creationDate],s=()=>{const u=h=>[r.votes,r.participations].includes(h)?R.jsx("th",{style:{paddingRight:0},children:R.jsx(De,{component:"span",justifyContent:"flex-end",endDecorator:R.jsx(ut,{title:h===r.votes?r.votesTooltipContent:r.participationsTooltipContent,arrow:!0,placement:"top",children:R.jsx(OM,{color:"primary",fontSize:"small"})}),children:h})},h):R.jsx("th",{children:h},h);return R.jsxs("tr",{children:[R.jsx("th",{style:{width:40},"aria-label":"empty"}),R.jsx("th",{style:{width:e?"60%":"40%"},children:r.title}),R.jsx("th",{style:{width:e?"20%":100},children:r.status}),R.jsx("th",{style:{width:e?"20%":100},children:r.language}),!e&&o.map(h=>u(h)),R.jsx("th",{style:{width:e?"20%":100},children:r.actions})]})},c=()=>R.jsxs("tr",{children:[R.jsx("th",{style:{width:40},"aria-label":"empty"}),R.jsx("th",{style:{width:"70%"},children:r.title}),R.jsx("th",{style:{width:"30%"},children:r.creationDate}),R.jsx("th",{style:{width:40},"aria-label":"empty"})]});return R.jsx(be,{sx:ze(ce({},t.sx),{overflowX:"auto",width:"100%"}),children:R.jsxs(Qa,{hoverRow:!0,"aria-label":"collapsible table",sx:{"& > thead > tr > th:nth-of-type(n + 3), & > tbody > tr > td:nth-of-type(n + 3)":{textAlign:t.isGameTemplate?"left":"right"},"& > tbody > tr":{cursor:"pointer"},"& > tbody > tr:nth-of-type(even)":{"&:hover":{backgroundColor:"transparent"}},'& > tbody > tr:nth-of-type(odd) > td, & > tbody > tr:nth-of-type(odd) > th[scope="row"]':{borderBottom:0},"& > tfoot > tr > *":{backgroundColor:"white"}},children:[R.jsx("thead",{children:t.isGameTemplate?c():s()}),R.jsx("tbody",{children:n.map(u=>t.isGameTemplate?R.jsx(xze,{row:u,isSelected:t.selectedGames.includes(u.id),onRowSelect:()=>t.onRowSelect(u.id)},u.id):R.jsx(bze,{row:u,onClickEdit:()=>t.onClickEdit(u.id),handleGamesChange:t.handleGamesChange},u.id))}),R.jsx(RDe,{pageCount:t.pageCount,disablePreviousPage:i,disableNextPage:a,goToPreviousPage:t.getPreviousPage,goToNextPage:t.getNextPage})]})})},wze={apiKey:"AIzaSyB6JILBJiJ0Z2pxw0-nudOpRAzqFk6D6Lw",clientId:"content",environment:"prod",lang:"en",errorHandlingMode:"standard",authProvider:{getIdToken:()=>"",logout:()=>{}}},Cze=new qh,Ize=({isOpen:t,onImport:e,onClose:r})=>{const[n,i]=U.useState(1),[a,o]=U.useState(null),[s,c]=U.useState(new Map),[u,h]=U.useState(new Rz),[d,p]=U.useState(!1),[f,g]=U.useState(""),[m,v]=U.useState([]),[y,x]=U.useState([]),[b,C]=U.useState(!1),[w,S]=U.useState(!1),{Spinner:T,Toast:k}=jt.useComponentContext(),{https:O}=jt.useAPIContext(),{constants:P,helpers:A}=jt,_=Tt(Zt),E=Tt(Kn),L=iA(wze);U.useEffect(()=>(t&&F(!0),()=>{o(""),c(null),i(1),x([])}),[u,t]),U.useEffect(()=>{n!==1&&s&&Array.from(s.keys()).length>0&&!Array.from(s.keys()).includes(n)&&F(!1)},[n]);const M=V=>{p(!0),g(V)},F=V=>$(this,null,function*(){const G=V?ce({},u):ze(ce({},u),{startAfter:a});try{const Z=yield L.voting.getPolls(G,!0);o(Z.meta.pagination.nextPageStartsAfter);const Y=V?new Map:new Map(s);Y.set(V?1:n,Z.data),c(Y),V&&i(1)}catch(Z){M(_.getPollsErrorMessage)}}),z=()=>i(V=>V-1),q=()=>i(V=>V+1),H=V=>{if(!y.includes(V))x([...y,V]);else{const G=y.filter(Z=>Z!==V);x(G)}},W=()=>{i(1),c(new Map),x([])},j=(V=!1)=>$(this,null,function*(){var Q;V?S(!0):C(!0);let Z=Array.from(s.values()).reduce((J,X)=>J.concat(X),[]).filter(J=>y.includes(J.id)).map(J=>A.remapKeysToSpecificCase(J,"snake"));if(V)try{Z=yield Yv(Z,E.languageConfig.default_language,"en")}catch(J){M(_.pollTranslationErrorMessage),S(!1);return}const Y=[];Z.forEach(J=>{var re;const X=Cze.finalizeNewRequestBody(J,E),ee=V?E.languageConfig.default_language:"en";X.language=ee;const ne=E.languageConfig.translation_rules&&((re=E.languageConfig.translation_rules[ee])==null?void 0:re.game_status)||"INACTIVE";X.status=ne,Y.push(O.createPoll(ce({},X)))});try{const J=yield Promise.all(Y),X=[],ee=J.filter(ne=>!ne.ok).length;for(const ne of J)if(ne.ok)try{const re=yield ne.json();(Q=re==null?void 0:re.data)!=null&&Q.id&&X.push(re.data.id)}catch(re){console.error("Error parsing response:",re)}if(ee>0){if(console.warn(`Import failed: ${ee} of ${J.length} polls failed to import. Rolling back...`),X.length>0){const ne=X.map(re=>O.deletePoll(re).catch(me=>{console.error(`Failed to delete poll ${re} during rollback:`,me)}));yield Promise.all(ne),console.log(`Rolled back ${X.length} successfully created polls`)}M(_.createPollErrorMessage),V?S(!1):C(!1)}else V?S(!1):C(!1),r(),e()}catch(J){console.error("Error importing polls:",J),M(_.createPollErrorMessage),V?S(!1):C(!1)}}),B=()=>R.jsx(AH,{pagePolls:s,pageCount:n,pollsPerPage:u.limit,getPreviousPage:z,getNextPage:q,isGameTemplate:!0,selectedGames:y,onRowSelect:H,sx:{backgroundColor:"white"}});return R.jsx(Ia,{open:t,onClose:r,children:R.jsxs(R.Fragment,{children:[R.jsxs(Sa,{sx:{backgroundColor:"white",minWidth:"50%",height:900},children:[R.jsx(Ca,{children:_.browsePolls}),R.jsx(_n,{}),R.jsx(wa,{sx:{overflowX:"hidden"},children:R.jsxs(R.Fragment,{children:[R.jsx(Mz,{filters:u,options:m,setOptions:v,setFilters:h,handleResetData:W,showStatusFilter:!1}),(!s||!s.get(n))&&u.flags.length===0&&u.entityIds.length===0?R.jsx(T,{my:10}):R.jsx(R.Fragment,{}),s&&s.size>0&&s.get(n)&&s.get(n).length>0?B():R.jsx(R.Fragment,{}),s&&s.size>0&&s.get(n)&&s.get(n).length===0?R.jsx(De,{level:"h2",textAlign:"center",fontWeight:"bold",fontSize:"xl",my:20,children:_.noTemplatePollsFound}):R.jsx(R.Fragment,{})]})}),R.jsxs(Ja,{children:[E.languageConfig.default_language&&!E.languageConfig.default_language.startsWith("en")&&R.jsx(ct,{variant:"outlined",color:"primary",loading:w,disabled:y.length===0,onClick:()=>j(!0),children:_.translateAndImport.replace("_language_",P.languagesMap[E.languageConfig.default_language].name)}),R.jsx(ct,{variant:"solid",color:"primary",loading:b,disabled:y.length===0,onClick:()=>j(),children:_.import}),R.jsx(ct,{variant:"plain",color:"neutral",onClick:V=>{V.stopPropagation(),r()},children:_.close})]})]}),R.jsx(k,{showToast:d,color:"danger",message:f,hideToast:()=>p(!d)})]})})},Sze=({fansUnitedEnvironment:t,hideSignOutButton:e})=>{var ae;const[r,n]=U.useState(new Rz),[i,a]=U.useState(1),[o,s]=U.useState(null),[c,u]=U.useState(new Map),[h,d]=U.useState(null),[p,f]=U.useState(null),[g,m]=U.useState(null),[v,y]=U.useState(!1),[x,b]=U.useState(!1),[C,w]=U.useState(!1),[S,T]=U.useState(!1),[k,O]=U.useState(!1),[P,A]=U.useState(!1),[_,E]=U.useState(""),[L,M]=U.useState("danger"),[F,z]=U.useState([]),{sdk:q}=jt.useAPIContext(),{HeaderButtons:H,Spinner:W,Toast:j,GenerateFootballMatchModal:B}=jt.useComponentContext(),{remapKeysToSpecificCase:V}=jt.helpers,G=Tt(Zt),Z=Tt(Kn),Y=(le,he)=>{A(!0),E(he),M(le)};U.useEffect(()=>(Q(),()=>{s(null),u(null)}),[r]),U.useEffect(()=>{J()},[i]);const Q=()=>$(this,null,function*(){b(!0);try{const le=yield q.voting.getPolls(r,!0);s(le.meta.pagination.nextPageStartsAfter);const he=new Map;he.set(1,le.data),u(he),a(1)}catch(le){console.error(le),Y("danger",G.getPollsErrorMessage)}b(!1)}),J=()=>$(this,null,function*(){if(i!==1&&c&&Array.from(c.keys()).length>0&&!Array.from(c.keys()).includes(i)){b(!0);try{const le=yield q.voting.getPolls(ze(ce({},r),{startAfter:o}),!0);if(le.data.length>0){const he=new Map(c);he.set(i,le.data),u(he),s(le.meta.pagination.nextPageStartsAfter)}}catch(le){console.error(le),Y("danger",G.getPollsErrorMessage)}b(!1)}}),X=()=>a(le=>le-1),ee=()=>a(le=>le+1),ne=le=>$(this,null,function*(){try{const he=yield q.voting.getPollById(le,!0);return V(he,"snake")}catch(he){return}}),re=le=>$(this,null,function*(){var he;w(!0);try{const Ce=yield q.voting.getPollById(le,!0),de=V(Ce,"snake");if((((he=de.related)==null?void 0:he.filter($e=>$e.entity_relationship==="translatedFrom"||$e.entity_relationship==="translatedTo"))||[]).length>0){const $e=new Set,Be=de.related.filter(Je=>(Je.entity_relationship==="translatedFrom"||Je.entity_relationship==="translatedTo")&&!$e.has(Je.entity_id)?($e.add(Je.entity_id),!0):!1);Promise.all(Be.map(Je=>Je.entity_id).map(ne)).then(Je=>{var xe;const Ze=(xe=de.related.find(Pe=>Pe.entity_relationship==="translatedFrom"))==null?void 0:xe.entity_id;Ze&&Ze!==de.id&&m(Je.find(Pe=>(Pe==null?void 0:Pe.id)===Ze)),f(Je.filter(Pe=>Pe!==void 0&&Pe.id!==Ze))})}d(de),y(!0)}catch(Ce){console.error(Ce),Y("danger",G.getPollErrorMessage)}w(!1)}),me=()=>{a(1),s(null),u(null)},_e=()=>{d(null),f(null),m(null),y(!v),Q()},Ie=()=>{k?(O(le=>!le),Q()):O(le=>!le)},Ae=le=>{switch(le){case"football_post_match":Ie();break;default:return R.jsx(R.Fragment,{})}},we=le=>{let he="";switch(le){case"create":he=G.createPollMessage;break;case"clone":he=G.clonePollMessage;break;case"delete":he=G.deletePollMessage;break}me(),Q(),Y("success",he)};return C?R.jsx(W,{my:40}):v?R.jsx(EDe,{pollById:h,setPollById:d,relatedPolls:p,relatedParentTitle:g==null?void 0:g.title,onClickBack:_e,loadParent:()=>{_e(),re(g.id)}}):R.jsxs(R.Fragment,{children:[R.jsx(H,{createLabel:G.create,createFromTemplateLabel:G.createFromTemplate,signOutLabel:e?"":G.signOut,environment:t,onClickCreate:()=>y(!0),onClickCreateFromTemplate:()=>T(!0),entityType:"poll",generateLabels:{generateAIEntityLabel:G.createWithAi,generateFootballPostMatchLabel:G.generateFootballPostMatchLabel},onClickGenerate:Ae}),R.jsxs(ODe,{children:[R.jsx(Mz,{filters:r,options:F,setOptions:z,setFilters:n,handleResetData:me}),x?R.jsx(W,{my:40}):R.jsx(R.Fragment,{}),!x&&c&&c.size>0&&c.get(i)&&c.get(i).length>0?R.jsx(AH,{pagePolls:c,pageCount:i,pollsPerPage:r.limit,getPreviousPage:X,getNextPage:ee,onClickEdit:re,handleGamesChange:we}):R.jsx(R.Fragment,{}),!x&&c&&c.size>0&&c.get(i)&&c.get(i).length===0?R.jsx(De,{level:"h2",textAlign:"center",fontWeight:"bold",fontSize:"xl",my:40,children:G.noPollsFound}):R.jsx(R.Fragment,{})]}),R.jsx(j,{showToast:P,color:L,message:_,hideToast:()=>A(!P)}),R.jsx(Ize,{isOpen:S,onImport:()=>we("create"),onClose:()=>T(!1)}),R.jsx(B,{generateId:"football_post_match",entityType:"poll",defaultLanguage:((ae=Z.languageConfig)==null?void 0:ae.default_language)||"en",competitionsScope:Z.fullCoverageCompetitions,isOpen:k,toggleModal:Ie,fetchEntityById:re,labels:ze(ce({},G),{onEntityCreateMessage:G.createPollMessage,onEntityCreateErrorMessage:G.createPollErrorMessage,modalTitle:G.generateFootballPostMatchModalTitle})})]})},_ze=({hideSignOutButton:t,fansUnitedEnvironment:e})=>{const[r,n]=U.useState(null),[i,a]=U.useState(!1),[o,s]=U.useState(!1),[c,u]=U.useState(new Tz),{AuthContext:h,useComponentContext:d,useAPIContext:p}=jt,f=U.useContext(h),g=U.useContext(Zt),{Login:m,Spinner:v,NoPermissionCard:y,Toast:x}=d(),{https:b}=p(),C=()=>$(this,null,function*(){if(f){a(!0);const w=yield b.getClientFeatures(!0),S=yield w.json();if(w.ok){const T=S.data.poll.types,k=S.data.poll.auth_requirement,O=S.data.profile_preferences,P=S.data.predictor.full_coverage_competitions,A=yield b.getLanguageConfig(),_=yield A.json();let E=null;A.ok?E=_.data:console.warn("There was a problem with fetching client language configuration. API error: ",_),n(!S.data.poll.enabled),u({types:T,authRequirement:k,languageConfig:E,preferences:O,fullCoverageCompetitions:P}),a(!1);return}console.error(S),n(!0),a(!1),s(!0)}});return U.useEffect(()=>(C(),()=>{n(null),u(new Tz)}),[f]),i?R.jsx(v,{my:60}):f?f&&r===!0?R.jsx(y,{labels:g,environment:e,setNoPermission:n}):R.jsxs(R.Fragment,{children:[f&&r===!1?R.jsx(sDe,{features:c,children:R.jsx(lDe,{children:R.jsx(Sze,{hideSignOutButton:t,fansUnitedEnvironment:e})})}):R.jsx(R.Fragment,{}),R.jsx(x,{showToast:o,color:"danger",message:g.clientFeaturesNotFoundMessage,hideToast:()=>s(!1)})]}):R.jsx(m,{environment:e,userNotFound:g.userNotFound})},Tze=t=>{const e={apiKey:t.fansUnitedApiKey,clientId:t.fansUnitedClientId,environment:t.fansUnitedEnvironment,language:t.fansUnitedLanguage,sportal365Project:t.sportal365Project,sportal365Infrastructure:t.sportal365Infrastructure},{AuthProvider:r,APIProvider:n,ComponentProvider:i}=jt;return R.jsx(r,{environment:t.fansUnitedEnvironment,children:R.jsx(oDe,{labels:t.labels,children:R.jsx(n,{config:e,children:R.jsx(i,{children:R.jsx(_ze,{fansUnitedEnvironment:t.fansUnitedEnvironment,hideSignOutButton:t.hideSignOutButton})})})})})};Bt.PollManager=Tze,Object.defineProperty(Bt,Symbol.toStringTag,{value:"Module"})});
3699
+ `));return t||r.skipAnimation}const FBe=["skipAnimation","onItemClick","borderRadius","barLabel"];function NBe({bandWidth:t,numberOfGroups:e,gapRatio:r}){if(r===0)return{barWidth:t/e,offset:0};const n=t/(e+(e-1)*r),i=r*n;return{barWidth:n,offset:i}}const BBe=()=>{var f;const t=(f=T$e())!=null?f:{series:{},stackingGroups:[]},e=oa(),r=aje(),{series:n,stackingGroups:i}=t,{xAxis:a,yAxis:o,xAxisIds:s,yAxisIds:c}=e,u=s[0],h=c[0],d={};return{completedData:i.flatMap(({ids:g},m)=>g.flatMap(v=>{var M,F,z,q;const y=(F=(M=n[v].xAxisId)!=null?M:n[v].xAxisKey)!=null?F:u,x=(q=(z=n[v].yAxisId)!=null?z:n[v].yAxisKey)!=null?q:h,b=a[y],C=o[x],w=n[v].layout==="vertical";$Be(w,v,y,a,x,o);const S=w?b:C,T=b.scale,k=C.scale,O=Yz(n[v],a[y],o[x]),P=S.scale.bandwidth(),{barWidth:A,offset:_}=NBe({bandWidth:P,numberOfGroups:i.length,gapRatio:S.barGapRatio}),E=m*(A+_),{stackedData:L}=n[v];return L.map((H,W)=>{var Q,J,X,ee;const j=H.map(ne=>w?k(ne):T(ne)),B=Math.round(Math.min(...j)),V=Math.round(Math.max(...j)),G=n[v].stack,Z={seriesId:v,dataIndex:W,layout:n[v].layout,x:w?T((Q=a[y].data)==null?void 0:Q[W])+E:B,y:w?B:k((J=o[x].data)==null?void 0:J[W])+E,xOrigin:T(0),yOrigin:k(0),height:w?V-B:A,width:w?A:V-B,color:O(W),value:n[v].data[W],maskId:`${r}_${G||v}_${m}_${W}`};d[Z.maskId]||(d[Z.maskId]={id:Z.maskId,width:0,height:0,hasNegative:!1,hasPositive:!1,layout:Z.layout,xOrigin:T(0),yOrigin:k(0),x:0,y:0});const Y=d[Z.maskId];return Y.width=Z.layout==="vertical"?Z.width:Y.width+Z.width,Y.height=Z.layout==="vertical"?Y.height+Z.height:Z.height,Y.x=Math.min(Y.x===0?1/0:Y.x,Z.x),Y.y=Math.min(Y.y===0?1/0:Y.y,Z.y),Y.hasNegative=Y.hasNegative||((X=Z.value)!=null?X:0)<0,Y.hasPositive=Y.hasPositive||((ee=Z.value)!=null?ee:0)>0,Z})})),masksData:Object.values(d)}},By=({layout:t,yOrigin:e,x:r,width:n,y:i,xOrigin:a,height:o})=>N({},t==="vertical"?{y:e,x:r,height:0,width:n}:{y:i,x:a,height:o,width:0}),zy=({x:t,width:e,y:r,height:n})=>({y:r,x:t,height:n,width:e});function zBe(t){const{completedData:e,masksData:r}=BBe(),{skipAnimation:n,onItemClick:i,borderRadius:a,barLabel:o}=t,s=Fe(t,FBe),c=jBe(n),u=!a||a<=0,h=j_(e,{keys:p=>`${p.seriesId}-${p.dataIndex}`,from:By,leave:By,enter:zy,update:zy,immediate:c}),d=j_(u?[]:r,{keys:p=>p.id,from:By,leave:By,enter:zy,update:zy,immediate:c});return R.jsxs(D.Fragment,{children:[!u&&d((p,{id:f,hasPositive:g,hasNegative:m,layout:v})=>R.jsx(CBe,{maskId:f,borderRadius:a,hasNegative:m,hasPositive:g,layout:v,style:p})),h((p,{seriesId:f,dataIndex:g,color:m,maskId:v})=>{const y=R.jsx(yBe,N({id:f,dataIndex:g,color:m},s,{onClick:i&&(x=>{i(x,{type:"bar",seriesId:f,dataIndex:g})}),style:p}));return u?y:R.jsx("g",{clipPath:`url(#${v})`,children:y})}),o&&R.jsx(DBe,N({bars:e,skipAnimation:c,barLabel:o},s))]})}function Iu(t){return t instanceof Date?t.getTime():t}const UBe=t=>{const e=a_(),r=aa(),{xAxis:n,yAxis:i,xAxisIds:a,yAxisIds:o}=oa(),{dispatch:s}=D.useContext(vu),c=a[0],u=o[0],h=D.useRef({isInChart:!1,x:-1,y:-1});D.useEffect(()=>{const d=e.current;if(d===null||t)return()=>{};function p(v,y){const{scale:x,data:b,reverse:C}=v;if(!Sl(x)){const S=x.invert(y);if(b===void 0)return{value:S,index:-1};const T=Iu(S),k=b==null?void 0:b.findIndex((O,P)=>{const A=Iu(O);return A>T&&(P===0||Math.abs(T-A)<=Math.abs(T-Iu(b[P-1])))||A<=T&&(P===b.length-1||Math.abs(Iu(S)-A)<Math.abs(Iu(S)-Iu(b[P+1])))});return{value:k!==void 0&&k>=0?b[k]:S,index:k}}const w=x.bandwidth()===0?Math.floor((y-Math.min(...x.range())+x.step()/2)/x.step()):Math.floor((y-Math.min(...x.range()))/x.step());if(w<0||w>=b.length)return null;if(C){const S=b.length-1-w;return{index:S,value:b[S]}}return{index:w,value:b[w]}}const f=()=>{h.current={isInChart:!1,x:-1,y:-1},s({type:"exitChart"})},g=v=>{const y="targetTouches"in v?v.targetTouches[0]:v,x=UFe(d,y);if(h.current.x=x.x,h.current.y=x.y,!r.isPointInside(x,{targetElement:v.target})){h.current.isInChart&&(s({type:"exitChart"}),h.current.isInChart=!1);return}h.current.isInChart=!0;const b=p(n[c],x.x),C=p(i[u],x.y);s({type:"updateAxis",data:{x:b,y:C}})},m=v=>{const y=v.currentTarget;y&&y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId)};return d.addEventListener("pointerdown",m),d.addEventListener("pointermove",g),d.addEventListener("pointerout",f),d.addEventListener("pointercancel",f),d.addEventListener("pointerleave",f),()=>{d.removeEventListener("pointerdown",m),d.removeEventListener("pointermove",g),d.removeEventListener("pointerout",f),d.removeEventListener("pointercancel",f),d.removeEventListener("pointerleave",f)}},[e,s,u,i,c,n,t,r])},HBe=["children","width","height","viewBox","disableAxisListener","className","title","desc"],VBe=Or("svg",{name:"MuiChartsSurface",slot:"Root"})(()=>({touchAction:"none"})),WBe=D.forwardRef(function(e,r){const n=ws({props:e,name:"MuiChartsSurface"}),{children:i,width:a,height:o,viewBox:s,disableAxisListener:c=!1,className:u,title:h,desc:d}=n,p=Fe(n,HBe),f=N({width:a,height:o,x:0,y:0},s);return UBe(c),R.jsxs(VBe,N({width:a,height:o,viewBox:`${f.x} ${f.y} ${f.width} ${f.height}`,ref:r,className:u},p,{children:[R.jsx("title",{children:h}),R.jsx("desc",{children:d}),i]}))});function TH(t){const{isReversed:e,gradientId:r,size:n,direction:i,scale:a,colorMap:o}=t;return n<=0?null:R.jsx("linearGradient",{id:r,x1:"0",x2:"0",y1:"0",y2:"0",[`${i}${e?1:2}`]:`${n}px`,gradientUnits:"userSpaceOnUse",children:o.thresholds.map((s,c)=>{const u=a(s);if(u===void 0)return null;const h=e?1-u/n:u/n;return R.jsxs(D.Fragment,{children:[R.jsx("stop",{offset:h,stopColor:o.colors[c],stopOpacity:1}),R.jsx("stop",{offset:h,stopColor:o.colors[c+1],stopOpacity:1})]},s.toString()+c)})})}function qBe(){const{chartId:t}=D.useContext(gy);return D.useCallback((e,r)=>`${t}-gradient-${r}-${e}`,[t])}function GBe(){const{top:t,height:e,bottom:r,left:n,width:i,right:a}=aa(),o=t+e+r,s=n+i+a,c=qBe(),{xAxisIds:u,xAxis:h,yAxisIds:d,yAxis:p}=oa();return R.jsxs("defs",{children:[d.filter(f=>p[f].colorMap!==void 0).map(f=>{const g=c(f,"y"),{colorMap:m,scale:v,colorScale:y,reverse:x}=p[f];return(m==null?void 0:m.type)==="piecewise"?R.jsx(TH,{isReversed:!x,scale:v,colorMap:m,size:o,gradientId:g,direction:"y"},g):(m==null?void 0:m.type)==="continuous"?R.jsx(_U,{isReversed:!x,scale:v,colorScale:y,colorMap:m,size:o,gradientId:g,direction:"y"},g):null}),u.filter(f=>h[f].colorMap!==void 0).map(f=>{const g=c(f,"x"),{colorMap:m,scale:v,reverse:y,colorScale:x}=h[f];return(m==null?void 0:m.type)==="piecewise"?R.jsx(TH,{isReversed:y,scale:v,colorMap:m,size:s,gradientId:g,direction:"x"},g):(m==null?void 0:m.type)==="continuous"?R.jsx(_U,{isReversed:y,scale:v,colorScale:x,colorMap:m,size:s,gradientId:g,direction:"x"},g):null})]})}const kH=(t,e,r)=>{var i;const n=r==="x"?bS:xS;return[...(i=t==null?void 0:t.map((a,o)=>N({id:`defaultized-${r}-axis-${o}`},a)))!=null?i:[],...t===void 0||t.findIndex(({id:a})=>a===n)===-1?[{id:n,scaleType:"linear"}]:[]].map(a=>{const o=a.dataKey;if(o===void 0||a.data!==void 0)return a;if(e===void 0)throw new Error(`MUI X: ${r}-axis uses \`dataKey\` but no \`dataset\` is provided.`);return N({},a,{data:e.map(s=>s[o])})})},YBe=(t,e,r)=>{const n=D.useMemo(()=>kH(t,r,"x"),[t,r]),i=D.useMemo(()=>kH(e,r,"y"),[e,r]);return[n,i]},KBe=["width","height","series","margin","xAxis","yAxis","zAxis","colors","dataset","sx","title","desc","disableAxisListener","highlightedItem","onHighlightChange","plugins","children","skipAnimation"],JBe=(t,e)=>{const{width:r,height:n,series:i,margin:a,xAxis:o,yAxis:s,zAxis:c,colors:u,dataset:h,sx:d,title:p,desc:f,disableAxisListener:g,highlightedItem:m,onHighlightChange:v,plugins:y,children:x,skipAnimation:b}=t,C=Fe(t,KBe),w=D.useRef(null),S=_d(e,w),[T,k]=YBe(o,s,h),O={width:r,height:n,margin:a,svgRef:w},P={skipAnimation:b},A={plugins:y},_={series:i,colors:u,dataset:h},E={xAxis:T,yAxis:k,dataset:h},L={zAxis:c,dataset:h},M={highlightedItem:m,onHighlightChange:v},F=N({},C,{width:r,height:n,ref:S,sx:d,title:p,desc:f,disableAxisListener:g});return{children:x,drawingProviderProps:O,seriesProviderProps:_,cartesianProviderProps:E,zAxisContextProps:L,highlightedProviderProps:M,chartsSurfaceProps:F,pluginProviderProps:A,animationProviderProps:P,xAxis:T,yAxis:k}},QBe=D.forwardRef(function(e,r){const{children:n,drawingProviderProps:i,seriesProviderProps:a,cartesianProviderProps:o,zAxisContextProps:s,highlightedProviderProps:c,chartsSurfaceProps:u,pluginProviderProps:h,animationProviderProps:d}=JBe(e,r);return R.jsx(ije,N({},i,{children:R.jsx(w$e,N({},h,{children:R.jsx(_$e,N({},a,{children:R.jsx(pje,N({},o,{children:R.jsx(rje,N({},s,{children:R.jsx(Zje,{children:R.jsx(P$e,N({},c,{children:R.jsxs(WBe,N({},u,{children:[R.jsx(GBe,{}),R.jsx(LBe,N({},d,{children:n}))]}))}))})}))}))}))}))}))}),XBe=Or("div",{name:"MuiResponsiveChart",slot:"Container"})(({ownerState:t})=>{var e,r;return{width:(e=t.width)!=null?e:"100%",height:(r=t.height)!=null?r:"100%",display:"flex",position:"relative",flexGrow:1,flexDirection:"column",alignItems:"center",justifyContent:"center",overflow:"hidden","&>svg":{width:"100%",height:"100%"}}}),ZBe=(t,e,r)=>{const n=D.useRef({displayError:!1,initialCompute:!0,computeRun:0}),i=D.useRef(null),[a,o]=D.useState(0),[s,c]=D.useState(0),u=D.useCallback(()=>{const h=i==null?void 0:i.current;if(!h)return{};const p=aoe(h).getComputedStyle(h),f=Math.floor(parseFloat(p.height))||0,g=Math.floor(parseFloat(p.width))||0;return o(g),c(f),{width:g,height:f}},[]);return D.useEffect(()=>{n.current.displayError=!0},[]),Qo(()=>{if(!r||!n.current.initialCompute||n.current.computeRun>20)return;const h=u();h.width!==a||h.height!==s?n.current.computeRun+=1:n.current.initialCompute&&(n.current.initialCompute=!1)},[a,s,u,r]),Qo(()=>{if(t!==void 0&&e!==void 0)return()=>{};u();const h=i.current;if(typeof ResizeObserver=="undefined")return()=>{};let d;const p=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{u()})});return h&&p.observe(h),()=>{d&&cancelAnimationFrame(d),h&&p.unobserve(h)}},[u,e,t]),{containerRef:i,width:t!=null?t:a,height:e!=null?e:s}},eze=["width","height","resolveSizeBeforeRender","margin","children","series","colors","dataset","desc","disableAxisListener","highlightedItem","onHighlightChange","plugins","sx","title","viewBox","xAxis","yAxis","zAxis","skipAnimation"],tze=(t,e)=>{const{width:r,height:n,resolveSizeBeforeRender:i,margin:a,children:o,series:s,colors:c,dataset:u,desc:h,disableAxisListener:d,highlightedItem:p,onHighlightChange:f,plugins:g,sx:m,title:v,viewBox:y,xAxis:x,yAxis:b,zAxis:C,skipAnimation:w}=t,S=Fe(t,eze),{containerRef:T,width:k,height:O}=ZBe(r,n,i),P=N({},S,{ownerState:{width:r,height:n},ref:T});return{hasIntrinsicSize:k&&O,chartContainerProps:{margin:a,children:o,series:s,colors:c,dataset:u,desc:h,disableAxisListener:d,highlightedItem:p,onHighlightChange:f,plugins:g,sx:m,title:v,viewBox:y,xAxis:x,yAxis:b,zAxis:C,skipAnimation:w,width:k,height:O,ref:e},resizableChartContainerProps:P}},rze=D.forwardRef(function(e,r){const{hasIntrinsicSize:n,chartContainerProps:i,resizableChartContainerProps:a}=tze(e,r);return R.jsx(XBe,N({},a,{children:n?R.jsx(QBe,N({},i)):null}))}),nze=["message"],ize=Or("text")(({theme:t})=>N({},t.typography.body2,{stroke:"none",fill:t.palette.text.primary,shapeRendering:"crispEdges",textAnchor:"middle",dominantBaseline:"middle"}));function aze(t){const{message:e}=t,r=Fe(t,nze),{top:n,left:i,height:a,width:o}=aa();return R.jsx(ize,N({x:i+o/2,y:n+a/2},r,{children:e!=null?e:"Loading data…"}))}const oze=["message"],sze=Or("text")(({theme:t})=>N({},t.typography.body2,{stroke:"none",fill:t.palette.text.primary,shapeRendering:"crispEdges",textAnchor:"middle",dominantBaseline:"middle"}));function lze(t){const{message:e}=t,r=Fe(t,oze),{top:n,left:i,height:a,width:o}=aa();return R.jsx(sze,N({x:i+o/2,y:n+a/2},r,{children:e!=null?e:"No data to display"}))}function cze(){const t=Cs();return Object.values(t).every(e=>{if(!e)return!0;const{series:r,seriesOrder:n}=e;return n.every(i=>r[i].data.length===0)})}function uze(t){var r,n,i,a,o,s;const e=cze();if(t.loading){const c=(n=(r=t.slots)==null?void 0:r.loadingOverlay)!=null?n:aze;return R.jsx(c,N({},(i=t.slotProps)==null?void 0:i.loadingOverlay))}if(e){const c=(o=(a=t.slots)==null?void 0:a.noDataOverlay)!=null?o:lze;return R.jsx(c,N({},(s=t.slotProps)==null?void 0:s.noDataOverlay))}return null}const dze=["xAxis","yAxis","series","width","height","margin","colors","dataset","sx","tooltip","onAxisClick","axisHighlight","legend","grid","topAxis","leftAxis","rightAxis","bottomAxis","children","slots","slotProps","skipAnimation","loading","layout","onItemClick","highlightedItem","onHighlightChange","borderRadius","barLabel","className"],hze=t=>{const{xAxis:e,yAxis:r,series:n,width:i,height:a,margin:o,colors:s,dataset:c,sx:u,tooltip:h,onAxisClick:d,axisHighlight:p,legend:f,grid:g,topAxis:m,leftAxis:v,rightAxis:y,bottomAxis:x,children:b,slots:C,slotProps:w,skipAnimation:S,loading:T,layout:k,onItemClick:O,highlightedItem:P,onHighlightChange:A,borderRadius:_,barLabel:E,className:L}=t,M=Fe(t,dze),z=`${tM()}-clip-path`,q=k==="horizontal"||k===void 0&&n.some(ne=>ne.layout==="horizontal"),H={scaleType:"band",data:Array.from({length:Math.max(...n.map(ne=>{var re,me;return((me=(re=ne.data)!=null?re:c)!=null?me:[]).length}))},(ne,re)=>re)},W=N({},M,{series:n.map(ne=>N({type:"bar"},ne,{layout:q?"horizontal":"vertical"})),width:i,height:a,margin:o,colors:s,dataset:c,xAxis:e!=null?e:q?void 0:[N({id:bS},H)],yAxis:r!=null?r:q?[N({id:xS},H)]:void 0,sx:u,highlightedItem:P,onHighlightChange:A,disableAxisListener:(h==null?void 0:h.trigger)!=="axis"&&(p==null?void 0:p.x)==="none"&&(p==null?void 0:p.y)==="none"&&!d,className:L,skipAnimation:S}),j={onItemClick:O,slots:C,slotProps:w,borderRadius:_,barLabel:E},B={onAxisClick:d},V={vertical:g==null?void 0:g.vertical,horizontal:g==null?void 0:g.horizontal},G={clipPath:`url(#${z})`},Z={id:z},Y={slots:C,slotProps:w,loading:T},Q={topAxis:m,leftAxis:v,rightAxis:y,bottomAxis:x,slots:C,slotProps:w},J=N({},q?{y:"band"}:{x:"band"},p),X=N({},f,{slots:C,slotProps:w}),ee=N({},h,{slots:C,slotProps:w});return{chartContainerProps:W,barPlotProps:j,axisClickHandlerProps:B,gridProps:V,clipPathProps:Z,clipPathGroupProps:G,overlayProps:Y,chartsAxisProps:Q,axisHighlightProps:J,legendProps:X,tooltipProps:ee,children:b}},pze=D.forwardRef(function(e,r){const n=ws({props:e,name:"MuiBarChart"}),{chartContainerProps:i,barPlotProps:a,axisClickHandlerProps:o,gridProps:s,clipPathProps:c,clipPathGroupProps:u,overlayProps:h,chartsAxisProps:d,axisHighlightProps:p,legendProps:f,tooltipProps:g,children:m}=hze(n);return R.jsxs(rze,N({ref:r},i,{children:[n.onAxisClick&&R.jsx(HFe,N({},o)),R.jsx(zje,N({},s)),R.jsxs("g",N({},u,{children:[R.jsx(zBe,N({},a)),R.jsx(uze,N({},h)),R.jsx(zFe,N({},p))]})),R.jsx(Dje,N({},d)),R.jsx(jFe,N({},f)),!n.loading&&R.jsx(wFe,N({},g)),R.jsx(fje,N({},c)),m]}))}),fze=t=>{const{Spinner:e}=jt.useComponentContext(),r=Tt(Zt);if(!t.chartData)return R.jsx(e,{my:10});const n=()=>R.jsx(pze,{borderRadius:5,sx:{[`& .${l_.line}`]:{strokeDasharray:"5 3",strokeWidth:1},"& .MuiChartsLegend-series tspan":{fontSize:"18px"}},margin:{bottom:80,top:60},height:375,grid:{vertical:!1,horizontal:!0},bottomAxis:{tickLabelStyle:{angle:-45,textAnchor:"end"},disableTicks:!0},xAxis:[{scaleType:"band",data:t.chartData.map(i=>i.date)}],yAxis:[{disableTicks:!0}],series:[{data:t.chartData.map(i=>i.participations||0),color:"#2a63c5",label:r.participations,valueFormatter:i=>`${i}`}],slotProps:{popper:{sx:{"& .MuiChartsTooltip-paper":{backgroundColor:"white",opacity:.9},"& .MuiChartsTooltip-row":{backgroundColor:"#FFF",height:50},"& .MuiChartsTooltip-table":{backgroundColor:"#F0F4F8",textAlign:"center"}}}}});return R.jsx(be,{textAlign:"center",bgcolor:"white",children:n()})},mze=(t,e)=>yl(t).format("DD MMM YYYY"),gze=t=>{const[e,r]=U.useState(!1),[n,i]=U.useState(""),[a,o]=U.useState("success"),[s,c]=U.useState(null),u=Tt(Zt),{https:h}=jt.useAPIContext(),{Toast:d}=jt.useComponentContext();U.useEffect(()=>{if(!((s==null?void 0:s.length)>0))return f(),()=>{c(null)}},[]);const p=(g,m)=>{i(m),o(g),r(!e)},f=()=>$(this,null,function*(){var y;const g=yl(t.poll.createdAt).format("YYYY-MM-DD"),m=yl(new Date).format("YYYY-MM-DD"),v=yield h.getEntityParticipations(t.poll.id,g,m);if(v.ok){const b=(y=(yield v.json()).data)==null?void 0:y.breakdown.map(C=>({date:mze(new Date(C.date)),participations:C.count}));c(b);return}console.error(yield v.json()),p("warning",u.pollChartErrorMessage)});return R.jsxs(Qr,{variant:"soft",sx:{borderRadius:0,boxShadow:"inset 0 3px 6px 0 rgba(0 0 0 / 0.08)"},children:[R.jsx(Gi,{children:R.jsxs(be,{mb:1,children:[R.jsx(be,{display:"flex",alignItems:"center",mb:1,children:R.jsx(De,{level:"body-lg",sx:{mx:"auto"},children:u.performanceByDay})}),R.jsx(fze,{chartData:s})]})}),R.jsx(d,{showToast:e,color:a,message:n,hideToast:()=>r(!1)})]})},vze=t=>{const e=Tt(Zt);return R.jsxs(Lw,{defaultValue:0,sx:{p:0,bgcolor:"transparent"},children:[R.jsxs($w,{sx:{borderRadius:0,cursor:"default",fontSize:"0.875rem",[`& .${GR.root}`]:{'&[aria-selected="true"]':{bgcolor:"#fff",py:1,borderColor:"transparent","&::before":{content:'""',display:"block",position:"absolute",height:2,bottom:-2,left:0,right:0},"&::after":{bgcolor:"primary.500"}}}},tabFlex:"auto",children:[R.jsx(sc,{children:e.voting}),R.jsx(sc,{children:e.reports}),R.jsx(sc,{children:e.exports})]}),R.jsx(Id,{value:0,sx:{p:0},children:R.jsx(zDe,{poll:t.poll})}),R.jsx(Id,{value:1,sx:{p:0,cursor:"default"},children:R.jsx(gze,{poll:t.poll})}),R.jsx(Id,{value:2,sx:{p:0,cursor:"default"},children:R.jsx(BDe,{poll:t.poll})})]})},yze=t=>!yl(t).isBefore(yl("2025-05-21")),bze=({row:t,onClickEdit:e,handleGamesChange:r})=>{var p,f;const[n,i]=U.useState(!1),{isMobile:a}=jt.useIsMobile(),{constants:o}=jt,s=Tt(Zt),c=Tt(Kn),u=g=>{g.stopPropagation(),i(!n)},h=g=>{switch(g){case"INACTIVE":return"danger";case"ACTIVE":return"success";case"EXPIRED":return"neutral";default:return"neutral"}},d=()=>{var g;return R.jsx(R.Fragment,{children:!a&&R.jsxs(R.Fragment,{children:[R.jsx("td",{children:((g=c.types.find(m=>m.id===t.type))==null?void 0:g.label)||"No type"}),R.jsx("td",{children:t.totalVotes}),R.jsx("td",{children:yze(t.createdAt)?t.participationCount:t.totalVotes}),R.jsx("td",{children:yl(t.createdAt).format(s.timeFormat)})]})})};return R.jsxs(R.Fragment,{children:[R.jsxs("tr",{onClick:e,children:[R.jsx("td",{children:R.jsx(ut,{title:s.additionalInformation,children:R.jsx(Ht,{"aria-label":"expand row",variant:"plain",color:"neutral",size:"sm",onClick:u,children:n?R.jsx(MM,{}):R.jsx(RM,{})})})}),R.jsx("td",{scope:"row",children:t.title}),R.jsx("td",{children:R.jsx(fr,{color:h(t.status),variant:"solid",size:"sm",children:t.status})}),R.jsx("td",{children:a?((p=o.supportedLanguages[t.language])==null?void 0:p.key)||"N/A":((f=o.supportedLanguages[t.language])==null?void 0:f.name)||"N/A"}),d(),R.jsx("td",{children:R.jsx(FDe,{poll:t,onClickEdit:e,handleGamesChange:r})})]}),R.jsx("tr",{children:R.jsx("td",{style:{height:0,padding:0},colSpan:9,children:n?R.jsx(vze,{poll:t}):R.jsx(R.Fragment,{})})})]})},xze=({row:t,isSelected:e,onRowSelect:r})=>{const[n,i]=U.useState(!1),a=Tt(Zt),o=u=>{u.stopPropagation(),i(!n)},s=()=>{r(t)},c=()=>R.jsxs(Qa,{variant:"outlined",size:"sm",sx:{"& > thead > tr > th:first-child, & > tbody > tr > td:first-child":{textAlign:"left",width:"50%"},"--TableCell-paddingX":"0.5rem",cursor:"default","& > tbody > tr:hover":{backgroundColor:"transparent"},"& > thead > tr > th":{backgroundColor:"#fff",verticalAlign:"middle"},"& > thead > tr > th, & > tbody > tr > td":{textAlign:"right"}},children:[R.jsx("thead",{children:R.jsx("tr",{children:R.jsx("th",{children:R.jsx(De,{level:"body-sm",children:a.options})})})}),R.jsx("tbody",{children:t.options.map(u=>R.jsx("tr",{children:R.jsx("td",{children:R.jsxs(De,{level:"body-sm",children:[u.title," "]})})},`option-${u.id}`))})]});return R.jsxs(R.Fragment,{children:[R.jsxs("tr",{onClick:s,children:[R.jsx("td",{children:R.jsx(Gs,{checked:e,onChange:s})}),R.jsx("td",{scope:"row",children:t.title}),R.jsx("td",{children:yl(t.createdAt).format(a.timeFormat)}),R.jsx("td",{children:R.jsx(ut,{title:n?"":a.expand,children:R.jsx(Ht,{"aria-label":"expand row",variant:"plain",color:"neutral",size:"sm",onClick:o,children:n?R.jsx(MM,{}):R.jsx(RM,{})})})})]}),R.jsx("tr",{children:R.jsx("td",{style:{height:0,padding:n?10:0},colSpan:9,children:n?c():R.jsx(R.Fragment,{})})})]})},AH=t=>{const{isMobile:e}=jt.useIsMobile(),r=Tt(Zt),n=t.pagePolls.get(t.pageCount),i=t.pageCount===1,a=t.pagePolls.get(t.pageCount).length<t.pollsPerPage,o=[r.type,r.votes,r.participations,r.creationDate],s=()=>{const u=h=>[r.votes,r.participations].includes(h)?R.jsx("th",{style:{paddingRight:0},children:R.jsx(De,{component:"span",justifyContent:"flex-end",endDecorator:R.jsx(ut,{title:h===r.votes?r.votesTooltipContent:r.participationsTooltipContent,arrow:!0,placement:"top",children:R.jsx(OM,{color:"primary",fontSize:"small"})}),children:h})},h):R.jsx("th",{children:h},h);return R.jsxs("tr",{children:[R.jsx("th",{style:{width:40},"aria-label":"empty"}),R.jsx("th",{style:{width:e?"60%":"40%"},children:r.title}),R.jsx("th",{style:{width:e?"20%":100},children:r.status}),R.jsx("th",{style:{width:e?"20%":100},children:r.language}),!e&&o.map(h=>u(h)),R.jsx("th",{style:{width:e?"20%":100},children:r.actions})]})},c=()=>R.jsxs("tr",{children:[R.jsx("th",{style:{width:40},"aria-label":"empty"}),R.jsx("th",{style:{width:"70%"},children:r.title}),R.jsx("th",{style:{width:"30%"},children:r.creationDate}),R.jsx("th",{style:{width:40},"aria-label":"empty"})]});return R.jsx(be,{sx:ze(ce({},t.sx),{overflowX:"auto",width:"100%"}),children:R.jsxs(Qa,{hoverRow:!0,"aria-label":"collapsible table",sx:{"& > thead > tr > th:nth-of-type(n + 3), & > tbody > tr > td:nth-of-type(n + 3)":{textAlign:t.isGameTemplate?"left":"right"},"& > tbody > tr":{cursor:"pointer"},"& > tbody > tr:nth-of-type(even)":{"&:hover":{backgroundColor:"transparent"}},'& > tbody > tr:nth-of-type(odd) > td, & > tbody > tr:nth-of-type(odd) > th[scope="row"]':{borderBottom:0},"& > tfoot > tr > *":{backgroundColor:"white"}},children:[R.jsx("thead",{children:t.isGameTemplate?c():s()}),R.jsx("tbody",{children:n.map(u=>t.isGameTemplate?R.jsx(xze,{row:u,isSelected:t.selectedGames.includes(u.id),onRowSelect:()=>t.onRowSelect(u.id)},u.id):R.jsx(bze,{row:u,onClickEdit:()=>t.onClickEdit(u.id),handleGamesChange:t.handleGamesChange},u.id))}),R.jsx(RDe,{pageCount:t.pageCount,disablePreviousPage:i,disableNextPage:a,goToPreviousPage:t.getPreviousPage,goToNextPage:t.getNextPage})]})})},wze={apiKey:"AIzaSyB6JILBJiJ0Z2pxw0-nudOpRAzqFk6D6Lw",clientId:"content",environment:"prod",lang:"en",errorHandlingMode:"standard",authProvider:{getIdToken:()=>"",logout:()=>{}}},Cze=new qh,Ize=({isOpen:t,onImport:e,onClose:r})=>{const[n,i]=U.useState(1),[a,o]=U.useState(null),[s,c]=U.useState(new Map),[u,h]=U.useState(new Rz),[d,p]=U.useState(!1),[f,g]=U.useState(""),[m,v]=U.useState([]),[y,x]=U.useState([]),[b,C]=U.useState(!1),[w,S]=U.useState(!1),{Spinner:T,Toast:k}=jt.useComponentContext(),{https:O}=jt.useAPIContext(),{constants:P,helpers:A}=jt,_=Tt(Zt),E=Tt(Kn),L=iA(wze);U.useEffect(()=>(t&&F(!0),()=>{o(""),c(null),i(1),x([])}),[u,t]),U.useEffect(()=>{n!==1&&s&&Array.from(s.keys()).length>0&&!Array.from(s.keys()).includes(n)&&F(!1)},[n]);const M=V=>{p(!0),g(V)},F=V=>$(this,null,function*(){const G=V?ce({},u):ze(ce({},u),{startAfter:a});try{const Z=yield L.voting.getPolls(G,!0);o(Z.meta.pagination.nextPageStartsAfter);const Y=V?new Map:new Map(s);Y.set(V?1:n,Z.data),c(Y),V&&i(1)}catch(Z){M(_.getPollsErrorMessage)}}),z=()=>i(V=>V-1),q=()=>i(V=>V+1),H=V=>{if(!y.includes(V))x([...y,V]);else{const G=y.filter(Z=>Z!==V);x(G)}},W=()=>{i(1),c(new Map),x([])},j=(V=!1)=>$(this,null,function*(){var Q;V?S(!0):C(!0);let Z=Array.from(s.values()).reduce((J,X)=>J.concat(X),[]).filter(J=>y.includes(J.id)).map(J=>A.remapKeysToSpecificCase(J,"snake"));if(V)try{Z=yield Yv(Z,E.languageConfig.default_language,"en")}catch(J){M(_.pollTranslationErrorMessage),S(!1);return}const Y=[];Z.forEach(J=>{var re;const X=Cze.finalizeNewRequestBody(J,E),ee=V?E.languageConfig.default_language:"en";X.language=ee;const ne=E.languageConfig.translation_rules&&((re=E.languageConfig.translation_rules[ee])==null?void 0:re.game_status)||"INACTIVE";X.status=ne,X.branding=null,Y.push(O.createPoll(ce({},X)))});try{const J=yield Promise.all(Y),X=[],ee=J.filter(ne=>!ne.ok).length;for(const ne of J)if(ne.ok)try{const re=yield ne.json();(Q=re==null?void 0:re.data)!=null&&Q.id&&X.push(re.data.id)}catch(re){console.error("Error parsing response:",re)}if(ee>0){if(console.warn(`Import failed: ${ee} of ${J.length} polls failed to import. Rolling back...`),X.length>0){const ne=X.map(re=>O.deletePoll(re).catch(me=>{console.error(`Failed to delete poll ${re} during rollback:`,me)}));yield Promise.all(ne),console.log(`Rolled back ${X.length} successfully created polls`)}M(_.createPollErrorMessage),V?S(!1):C(!1)}else V?S(!1):C(!1),r(),e()}catch(J){console.error("Error importing polls:",J),M(_.createPollErrorMessage),V?S(!1):C(!1)}}),B=()=>R.jsx(AH,{pagePolls:s,pageCount:n,pollsPerPage:u.limit,getPreviousPage:z,getNextPage:q,isGameTemplate:!0,selectedGames:y,onRowSelect:H,sx:{backgroundColor:"white"}});return R.jsx(Ia,{open:t,onClose:r,children:R.jsxs(R.Fragment,{children:[R.jsxs(Sa,{sx:{backgroundColor:"white",minWidth:"50%",height:900},children:[R.jsx(Ca,{children:_.browsePolls}),R.jsx(_n,{}),R.jsx(wa,{sx:{overflowX:"hidden"},children:R.jsxs(R.Fragment,{children:[R.jsx(Mz,{filters:u,options:m,setOptions:v,setFilters:h,handleResetData:W,showStatusFilter:!1}),(!s||!s.get(n))&&u.flags.length===0&&u.entityIds.length===0?R.jsx(T,{my:10}):R.jsx(R.Fragment,{}),s&&s.size>0&&s.get(n)&&s.get(n).length>0?B():R.jsx(R.Fragment,{}),s&&s.size>0&&s.get(n)&&s.get(n).length===0?R.jsx(De,{level:"h2",textAlign:"center",fontWeight:"bold",fontSize:"xl",my:20,children:_.noTemplatePollsFound}):R.jsx(R.Fragment,{})]})}),R.jsxs(Ja,{children:[E.languageConfig.default_language&&!E.languageConfig.default_language.startsWith("en")&&R.jsx(ct,{variant:"outlined",color:"primary",loading:w,disabled:y.length===0,onClick:()=>j(!0),children:_.translateAndImport.replace("_language_",P.languagesMap[E.languageConfig.default_language].name)}),R.jsx(ct,{variant:"solid",color:"primary",loading:b,disabled:y.length===0,onClick:()=>j(),children:_.import}),R.jsx(ct,{variant:"plain",color:"neutral",onClick:V=>{V.stopPropagation(),r()},children:_.close})]})]}),R.jsx(k,{showToast:d,color:"danger",message:f,hideToast:()=>p(!d)})]})})},Sze=({fansUnitedEnvironment:t,hideSignOutButton:e})=>{var ae;const[r,n]=U.useState(new Rz),[i,a]=U.useState(1),[o,s]=U.useState(null),[c,u]=U.useState(new Map),[h,d]=U.useState(null),[p,f]=U.useState(null),[g,m]=U.useState(null),[v,y]=U.useState(!1),[x,b]=U.useState(!1),[C,w]=U.useState(!1),[S,T]=U.useState(!1),[k,O]=U.useState(!1),[P,A]=U.useState(!1),[_,E]=U.useState(""),[L,M]=U.useState("danger"),[F,z]=U.useState([]),{sdk:q}=jt.useAPIContext(),{HeaderButtons:H,Spinner:W,Toast:j,GenerateFootballMatchModal:B}=jt.useComponentContext(),{remapKeysToSpecificCase:V}=jt.helpers,G=Tt(Zt),Z=Tt(Kn),Y=(le,he)=>{A(!0),E(he),M(le)};U.useEffect(()=>(Q(),()=>{s(null),u(null)}),[r]),U.useEffect(()=>{J()},[i]);const Q=()=>$(this,null,function*(){b(!0);try{const le=yield q.voting.getPolls(r,!0);s(le.meta.pagination.nextPageStartsAfter);const he=new Map;he.set(1,le.data),u(he),a(1)}catch(le){console.error(le),Y("danger",G.getPollsErrorMessage)}b(!1)}),J=()=>$(this,null,function*(){if(i!==1&&c&&Array.from(c.keys()).length>0&&!Array.from(c.keys()).includes(i)){b(!0);try{const le=yield q.voting.getPolls(ze(ce({},r),{startAfter:o}),!0);if(le.data.length>0){const he=new Map(c);he.set(i,le.data),u(he),s(le.meta.pagination.nextPageStartsAfter)}}catch(le){console.error(le),Y("danger",G.getPollsErrorMessage)}b(!1)}}),X=()=>a(le=>le-1),ee=()=>a(le=>le+1),ne=le=>$(this,null,function*(){try{const he=yield q.voting.getPollById(le,!0);return V(he,"snake")}catch(he){return}}),re=le=>$(this,null,function*(){var he;w(!0);try{const Ce=yield q.voting.getPollById(le,!0),de=V(Ce,"snake");if((((he=de.related)==null?void 0:he.filter($e=>$e.entity_relationship==="translatedFrom"||$e.entity_relationship==="translatedTo"))||[]).length>0){const $e=new Set,Be=de.related.filter(Je=>(Je.entity_relationship==="translatedFrom"||Je.entity_relationship==="translatedTo")&&!$e.has(Je.entity_id)?($e.add(Je.entity_id),!0):!1);Promise.all(Be.map(Je=>Je.entity_id).map(ne)).then(Je=>{var xe;const Ze=(xe=de.related.find(Pe=>Pe.entity_relationship==="translatedFrom"))==null?void 0:xe.entity_id;Ze&&Ze!==de.id&&m(Je.find(Pe=>(Pe==null?void 0:Pe.id)===Ze)),f(Je.filter(Pe=>Pe!==void 0&&Pe.id!==Ze))})}d(de),y(!0)}catch(Ce){console.error(Ce),Y("danger",G.getPollErrorMessage)}w(!1)}),me=()=>{a(1),s(null),u(null)},_e=()=>{d(null),f(null),m(null),y(!v),Q()},Ie=()=>{k?(O(le=>!le),Q()):O(le=>!le)},Ae=le=>{switch(le){case"football_post_match":Ie();break;default:return R.jsx(R.Fragment,{})}},we=le=>{let he="";switch(le){case"create":he=G.createPollMessage;break;case"clone":he=G.clonePollMessage;break;case"delete":he=G.deletePollMessage;break}me(),Q(),Y("success",he)};return C?R.jsx(W,{my:40}):v?R.jsx(EDe,{pollById:h,setPollById:d,relatedPolls:p,relatedParentTitle:g==null?void 0:g.title,onClickBack:_e,loadParent:()=>{_e(),re(g.id)}}):R.jsxs(R.Fragment,{children:[R.jsx(H,{createLabel:G.create,createFromTemplateLabel:G.createFromTemplate,signOutLabel:e?"":G.signOut,environment:t,onClickCreate:()=>y(!0),onClickCreateFromTemplate:()=>T(!0),entityType:"poll",generateLabels:{generateAIEntityLabel:G.createWithAi,generateFootballPostMatchLabel:G.generateFootballPostMatchLabel},onClickGenerate:Ae}),R.jsxs(ODe,{children:[R.jsx(Mz,{filters:r,options:F,setOptions:z,setFilters:n,handleResetData:me}),x?R.jsx(W,{my:40}):R.jsx(R.Fragment,{}),!x&&c&&c.size>0&&c.get(i)&&c.get(i).length>0?R.jsx(AH,{pagePolls:c,pageCount:i,pollsPerPage:r.limit,getPreviousPage:X,getNextPage:ee,onClickEdit:re,handleGamesChange:we}):R.jsx(R.Fragment,{}),!x&&c&&c.size>0&&c.get(i)&&c.get(i).length===0?R.jsx(De,{level:"h2",textAlign:"center",fontWeight:"bold",fontSize:"xl",my:40,children:G.noPollsFound}):R.jsx(R.Fragment,{})]}),R.jsx(j,{showToast:P,color:L,message:_,hideToast:()=>A(!P)}),R.jsx(Ize,{isOpen:S,onImport:()=>we("create"),onClose:()=>T(!1)}),R.jsx(B,{generateId:"football_post_match",entityType:"poll",defaultLanguage:((ae=Z.languageConfig)==null?void 0:ae.default_language)||"en",competitionsScope:Z.fullCoverageCompetitions,isOpen:k,toggleModal:Ie,fetchEntityById:re,labels:ze(ce({},G),{onEntityCreateMessage:G.createPollMessage,onEntityCreateErrorMessage:G.createPollErrorMessage,modalTitle:G.generateFootballPostMatchModalTitle})})]})},_ze=({hideSignOutButton:t,fansUnitedEnvironment:e})=>{const[r,n]=U.useState(null),[i,a]=U.useState(!1),[o,s]=U.useState(!1),[c,u]=U.useState(new Tz),{AuthContext:h,useComponentContext:d,useAPIContext:p}=jt,f=U.useContext(h),g=U.useContext(Zt),{Login:m,Spinner:v,NoPermissionCard:y,Toast:x}=d(),{https:b}=p(),C=()=>$(this,null,function*(){if(f){a(!0);const w=yield b.getClientFeatures(!0),S=yield w.json();if(w.ok){const T=S.data.poll.types,k=S.data.poll.auth_requirement,O=S.data.profile_preferences,P=S.data.predictor.full_coverage_competitions,A=yield b.getLanguageConfig(),_=yield A.json();let E=null;A.ok?E=_.data:console.warn("There was a problem with fetching client language configuration. API error: ",_),n(!S.data.poll.enabled),u({types:T,authRequirement:k,languageConfig:E,preferences:O,fullCoverageCompetitions:P}),a(!1);return}console.error(S),n(!0),a(!1),s(!0)}});return U.useEffect(()=>(C(),()=>{n(null),u(new Tz)}),[f]),i?R.jsx(v,{my:60}):f?f&&r===!0?R.jsx(y,{labels:g,environment:e,setNoPermission:n}):R.jsxs(R.Fragment,{children:[f&&r===!1?R.jsx(sDe,{features:c,children:R.jsx(lDe,{children:R.jsx(Sze,{hideSignOutButton:t,fansUnitedEnvironment:e})})}):R.jsx(R.Fragment,{}),R.jsx(x,{showToast:o,color:"danger",message:g.clientFeaturesNotFoundMessage,hideToast:()=>s(!1)})]}):R.jsx(m,{environment:e,userNotFound:g.userNotFound})},Tze=t=>{const e={apiKey:t.fansUnitedApiKey,clientId:t.fansUnitedClientId,environment:t.fansUnitedEnvironment,language:t.fansUnitedLanguage,sportal365Project:t.sportal365Project,sportal365Infrastructure:t.sportal365Infrastructure},{AuthProvider:r,APIProvider:n,ComponentProvider:i}=jt;return R.jsx(r,{environment:t.fansUnitedEnvironment,children:R.jsx(oDe,{labels:t.labels,children:R.jsx(n,{config:e,children:R.jsx(i,{children:R.jsx(_ze,{fansUnitedEnvironment:t.fansUnitedEnvironment,hideSignOutButton:t.hideSignOutButton})})})})})};Bt.PollManager=Tze,Object.defineProperty(Bt,Symbol.toStringTag,{value:"Module"})});