@bygd/nc-report-ui 0.1.22 → 0.1.23
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.
|
@@ -254,4 +254,4 @@ var _BYGD_NC_REPORT_UI=function(){"use strict";function e(e,t){return t.forEach(
|
|
|
254
254
|
animation-direction: reverse;
|
|
255
255
|
animation-range: calc(100% - 4px) 100%;
|
|
256
256
|
}
|
|
257
|
-
`,Lz=TR(function(e,t){const{children:n}=e,r=d(e,Iz);return Xp.jsx(Fz,f({},r,{ref:t,children:n}))}),Az=new Intl.Collator;const Nz=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagement"})({display:"flex",flexDirection:"column",padding:bP.spacing(.5,1.5)}),$z=pg(Lz,{name:"MuiDataGrid",slot:"ColumnsManagementScrollArea"})({maxHeight:300}),zz=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagementHeader"})({padding:bP.spacing(1.5,2),borderBottom:`1px solid ${bP.colors.border.base}`}),jz=pg(gI,{name:"MuiDataGrid",slot:"ColumnsManagementSearchInput"})({[`& .${Yy.input}::-webkit-search-decoration,\n & .${Yy.input}::-webkit-search-cancel-button,\n & .${Yy.input}::-webkit-search-results-button,\n & .${Yy.input}::-webkit-search-results-decoration`]:{display:"none"}}),Bz=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagementFooter"})({padding:bP.spacing(1,1,1,1.5),display:"flex",justifyContent:"space-between",borderTop:`1px solid ${bP.colors.border.base}`}),_z=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagementEmptyText"})({padding:bP.spacing(1,0),alignSelf:"center",font:bP.typography.font.body}),Hz=pg(gI,{name:"MuiDataGrid",slot:"ColumnsManagementRow"})({}),Vz=TR(function(e,t){const{children:n,slotProps:r={}}=e,o=r.button||{},i=r.tooltip||{},a=lP(),l=rP(),c=mm(),u=mm(),[d,p]=s.useState(!1),h=s.useRef(null),m=Tg(t,h),g=()=>p(!1);return null==n?null:Xp.jsxs(s.Fragment,{children:[Xp.jsx(l.slots.baseTooltip,f({title:a.current.getLocaleText("toolbarExportLabel"),enterDelay:1e3},l.slotProps?.baseTooltip,i,{children:Xp.jsx(l.slots.baseButton,f({size:"small",startIcon:Xp.jsx(l.slots.exportIcon,{}),"aria-expanded":d,"aria-label":a.current.getLocaleText("toolbarExportLabel"),"aria-haspopup":"menu","aria-controls":d?u:void 0,id:c},l.slotProps?.baseButton,o,{onClick:e=>{p(e=>!e),o.onClick?.(e)},ref:m,children:a.current.getLocaleText("toolbarExport")}))})),Xp.jsx(UO,{open:d,target:h.current,onClose:g,position:"bottom-end",children:Xp.jsx(l.slots.baseMenuList,{id:u,className:XT.menuList,"aria-labelledby":c,autoFocusItem:d,children:s.Children.map(n,e=>s.isValidElement(e)?s.cloneElement(e,{hideMenu:g}):e)})})]})}),Wz=["hideMenu","options"],Uz=["hideMenu","options"],Gz=["csvOptions","printOptions","excelOptions"];function Kz(e){const t=lP(),n=rP(),{hideMenu:r,options:o}=e,i=d(e,Wz);return Xp.jsx(n.slots.baseMenuItem,f({onClick:()=>{t.current.exportDataAsCsv(o),r?.()}},i,{children:t.current.getLocaleText("toolbarExportCSV")}))}function qz(e){const t=lP(),n=rP(),{hideMenu:r,options:o}=e,i=d(e,Uz);return Xp.jsx(n.slots.baseMenuItem,f({onClick:()=>{t.current.exportDataAsPrint(o),r?.()}},i,{children:t.current.getLocaleText("toolbarExportPrint")}))}TR(function(e,t){const n=e,{csvOptions:r={},printOptions:o={},excelOptions:i}=n,a=d(n,Gz),l=lP().current.unstable_applyPipeProcessors("exportMenu",[],{excelOptions:i,csvOptions:r,printOptions:o}).sort((e,t)=>e.componentName>t.componentName?1:-1);return 0===l.length?null:Xp.jsx(Vz,f({},a,{ref:t,children:l.map((e,t)=>s.cloneElement(e.component,{key:t}))}))});const Yz=s.createContext(void 0);function Xz(){const e=s.useContext(Yz);if(void 0===e)throw new Error("MUI X: Missing context. Quick Filter subcomponents must be placed within a <QuickFilter /> component.");return e}const Qz=["render","className","parser","formatter","debounceMs","defaultExpanded","expanded","onExpandedChange"],Zz=e=>e.split(" ").filter(e=>""!==e),Jz=e=>e.join(" ");function ej(e){const t=rP(),{render:n,className:r,parser:o=Zz,formatter:i=Jz,debounceMs:a=t.filterDebounceMs,defaultExpanded:l,expanded:c,onExpandedChange:u}=e,p=d(e,Qz),h=lP(),m=s.useRef(null),g=s.useRef(null),v=pI(h,wD),[b,y]=s.useState(i(v??[])),[w,x]=s.useState(l??b.length>0),S=c??w,C=s.useMemo(()=>({value:b,expanded:S}),[b,S]),k="function"==typeof r?r(C):r,E=s.useRef(null),R=mm(),P=s.useCallback(e=>{u&&u(e),void 0===c&&x(e)},[u,c]),M=s.useRef(v);s.useEffect(()=>{JL(M.current,v)||(M.current=v,y(e=>JL(o(e),v)?e:i(v??[])))},[v,i,o]);const T=s.useRef(!0),I=s.useRef(S);s.useEffect(()=>{T.current?T.current=!1:I.current!==S&&(S?requestAnimationFrame(()=>{m.current?.focus({preventScroll:!0})}):g.current?.focus({preventScroll:!0}),I.current=S)},[S]);const O=s.useMemo(()=>Cg(e=>{const t=o(e);M.current=t,h.current.setQuickFilterValues(t)},a),[h,a,o]);s.useEffect(()=>O.clear,[O]);const D=s.useCallback(e=>{const t=e.target.value;y(t),O(t)},[O]),F=s.useCallback(()=>{y(""),h.current.setQuickFilterValues([]),m.current?.focus()},[h,m]),L=s.useMemo(()=>({controlRef:m,triggerRef:g,state:C,controlId:R,clearValue:F,onValueChange:D,onExpandedChange:P}),[R,C,D,F,P]);Wh(()=>{E.current&&g.current&&E.current.style.setProperty("--trigger-width",`${g.current?.offsetWidth}px`)},[]);const A=o$("div",n,f({className:k},p,{ref:E}),C);return Xp.jsx(Yz.Provider,{value:L,children:A})}const tj=["render","className","slotProps","onKeyDown","onChange"],nj=TR(function(e,t){const{render:n,className:r,slotProps:o,onKeyDown:i,onChange:a}=e,l=d(e,tj),c=rP(),{state:u,controlId:p,controlRef:h,onValueChange:m,onExpandedChange:g,clearValue:v}=Xz(),b="function"==typeof r?r(u):r,y=Tg(h,t),w=o$(c.slots.baseTextField,n,f({},c.slotProps?.baseTextField,{slotProps:f({htmlInput:f({role:"searchbox",id:p,tabIndex:u.expanded?void 0:-1},o?.htmlInput,{onBlur:e=>{""===u.value&&g(!1),o?.htmlInput?.onBlur?.(e)}})},o),value:u.value,className:b},l,{onChange:e=>{u.expanded||g(!0),m(e),a?.(e)},onKeyDown:e=>{"Escape"===e.key&&(""===u.value?g(!1):v()),i?.(e)},ref:y}),u);return Xp.jsx(s.Fragment,{children:w})}),rj=["render","className","onClick"],oj=TR(function(e,t){const{render:n,className:r,onClick:o}=e,i=d(e,rj),a=rP(),{state:l,clearValue:c}=Xz(),u="function"==typeof r?r(l):r,p=o$(a.slots.baseIconButton,n,f({},a.slotProps?.baseIconButton,{className:u,tabIndex:-1},i,{onClick:e=>{c(),o?.(e)},ref:t}),l);return Xp.jsx(s.Fragment,{children:p})}),ij=["render","className","onClick"],aj=TR(function(e,t){const{render:n,className:r,onClick:o}=e,i=d(e,ij),a=rP(),{state:l,controlId:c,onExpandedChange:u,triggerRef:p}=Xz(),h="function"==typeof r?r(l):r,m=Tg(p,t),g=o$(a.slots.baseButton,n,f({},a.slotProps?.baseButton,{className:h,"aria-controls":c,"aria-expanded":l.expanded},i,{onClick:e=>{u(!l.expanded),o?.(e)},ref:m}),l);return Xp.jsx(s.Fragment,{children:g})}),lj=["quickFilterParser","quickFilterFormatter","debounceMs","className","slotProps"],sj=["ref","slotProps"],cj=jh("div",{name:"MuiDataGrid",slot:"ToolbarQuickFilter"})({display:"grid",alignItems:"center"}),uj=jh(d$,{name:"MuiDataGrid",slot:"ToolbarQuickFilterTrigger"})(({ownerState:e})=>({gridArea:"1 / 1",width:"min-content",height:"min-content",zIndex:1,opacity:e.expanded?0:1,pointerEvents:e.expanded?"none":"auto",transition:bP.transition(["opacity"])})),dj=jh(e=>{throw new Error("Failed assertion: should not be rendered")},{name:"MuiDataGrid",slot:"ToolbarQuickFilterControl"})(({ownerState:e})=>({gridArea:"1 / 1",overflowX:"clip",width:e.expanded?260:"var(--trigger-width)",opacity:e.expanded?1:0,transition:bP.transition(["width","opacity"])}));function pj(e){const t=lP(),n=rP(),r={classes:n.classes,expanded:!1},o=(e=>{const{classes:t}=e;return wm({root:["toolbarQuickFilter"],trigger:["toolbarQuickFilterTrigger"],control:["toolbarQuickFilterControl"]},YT,t)})(r),{quickFilterParser:i,quickFilterFormatter:a,debounceMs:l,className:s,slotProps:c}=e,u=d(e,lj);return Xp.jsx(ej,{parser:i,formatter:a,debounceMs:l,render:(e,i)=>{const a=f({},r,{expanded:i.expanded});return Xp.jsxs(cj,f({},e,{className:PR(o.root,s),children:[Xp.jsx(aj,{render:e=>Xp.jsx(n.slots.baseTooltip,{title:t.current.getLocaleText("toolbarQuickFilterLabel"),enterDelay:0,children:Xp.jsx(uj,f({className:o.trigger},e,{ownerState:a,color:"default","aria-disabled":i.expanded,children:Xp.jsx(n.slots.quickFilterIcon,{fontSize:"small"})}))})}),Xp.jsx(nj,{render:e=>{let{ref:r,slotProps:i}=e,l=d(e,sj);return Xp.jsx(dj,f({as:n.slots.baseTextField,className:o.control,ownerState:a,inputRef:r,"aria-label":t.current.getLocaleText("toolbarQuickFilterLabel"),placeholder:t.current.getLocaleText("toolbarQuickFilterPlaceholder"),size:"small",slotProps:f({input:f({startAdornment:Xp.jsx(n.slots.quickFilterIcon,{fontSize:"small"}),endAdornment:l.value?Xp.jsx(oj,{render:Xp.jsx(n.slots.baseIconButton,{size:"small",edge:"end","aria-label":t.current.getLocaleText("toolbarQuickFilterDeleteIconLabel"),children:Xp.jsx(n.slots.quickFilterClearIcon,{fontSize:"small"})})}):null},i?.input)},i)},n.slotProps?.baseTextField,l,c?.root,u))}})]}))}})}const fj=["render","className","onClick","onPointerUp"],hj=TR(function(e,t){const{render:n,className:r,onClick:o,onPointerUp:i}=e,a=d(e,fj),l=rP(),c=mm(),u=mm(),p=lP(),h=pI(p,KL),m=h.open&&h.openedPanelValue===YL.filters,g=pI(p,OD).length,v={open:m,filterCount:g},b="function"==typeof r?r(v):r,{filterPanelTriggerRef:y}=UN(),w=Tg(t,y),x=o$(l.slots.baseButton,n,f({},l.slotProps?.baseButton,{id:c,"aria-haspopup":"true","aria-expanded":m?"true":void 0,"aria-controls":m?u:void 0,onClick:e=>{m?p.current.hidePreferences():p.current.showPreferences(YL.filters,u,c),o?.(e)},onPointerUp:e=>{m&&e.stopPropagation(),i?.(e)},className:b},a,{ref:w}),v);return Xp.jsx(s.Fragment,{children:x})}),mj=["render","className","onClick","onPointerUp"],gj=TR(function(e,t){const{render:n,className:r,onClick:o,onPointerUp:i}=e,a=d(e,mj),l=rP(),c=mm(),u=mm(),p=lP(),h=pI(p,KL),m=h.open&&h.openedPanelValue===YL.columns,g={open:m},v="function"==typeof r?r(g):r,{columnsPanelTriggerRef:b}=UN(),y=Tg(t,b),w=o$(l.slots.baseButton,n,f({},l.slotProps?.baseButton,{id:c,"aria-haspopup":"true","aria-expanded":m?"true":void 0,"aria-controls":m?u:void 0,className:v},a,{onPointerUp:e=>{m&&e.stopPropagation(),i?.(e)},onClick:e=>{m?p.current.hidePreferences():p.current.showPreferences(YL.columns,u,c),o?.(e)},ref:y}),g);return Xp.jsx(s.Fragment,{children:w})}),vj=["render","options","onClick"],bj=TR(function(e,t){const{render:n,options:r,onClick:o}=e,i=d(e,vj),a=rP(),l=lP(),c=o$(a.slots.baseButton,n,f({},a.slotProps?.baseButton,{onClick:e=>{l.current.exportDataAsCsv(r),o?.(e)}},i,{ref:t}));return Xp.jsx(s.Fragment,{children:c})}),yj=["render","options","onClick"],wj=TR(function(e,t){const{render:n,options:r,onClick:o}=e,i=d(e,yj),a=rP(),l=lP(),c=o$(a.slots.baseButton,n,f({},a.slotProps?.baseButton,{onClick:e=>{l.current.exportDataAsPrint(r),o?.(e)}},i,{ref:t}));return Xp.jsx(s.Fragment,{children:c})}),xj=["className"],Sj=["className"],Cj=["showQuickFilter","quickFilterProps","csvOptions","printOptions","additionalItems","additionalExportMenuItems"],kj=e=>{const{classes:t}=e;return wm({divider:["toolbarDivider"],label:["toolbarLabel"]},YT,t)},Ej=jh(gI,{name:"MuiDataGrid",slot:"ToolbarDivider"})({height:"50%",margin:bP.spacing(0,.5)}),Rj=jh("span",{name:"MuiDataGrid",slot:"ToolbarLabel"})({flex:1,font:bP.typography.font.large,fontWeight:bP.typography.fontWeight.medium,margin:bP.spacing(0,.5),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"});function Pj(e){const t=d(e,xj),n=rP(),r=kj(n);return Xp.jsx(Ej,f({as:n.slots.baseDivider,orientation:"vertical",className:r.divider},t))}function Mj(e){const t=d(e,Sj),n=rP(),r=kj(n);return Xp.jsx(Rj,f({className:r.label},t))}const Tj=["className","selectedRowCount"],Ij=jh("div",{name:"MuiDataGrid",slot:"SelectedRowCount"})({alignItems:"center",display:"flex",margin:bP.spacing(0,2),visibility:"hidden",width:0,height:0,[bP.breakpoints.up("sm")]:{visibility:"visible",width:"auto",height:"auto"}}),Oj=TR(function(e,t){const{className:n,selectedRowCount:r}=e,o=d(e,Tj),i=lP(),a=rP(),l=(e=>{const{classes:t}=e;return wm({root:["selectedRowCount"]},YT,t)})(a),s=i.current.getLocaleText("footerRowSelected")(r);return Xp.jsx(Ij,f({className:PR(l.root,n),ownerState:a},o,{ref:t,children:s}))}),Dj=TR(function(e,t){const n=lP(),r=rP(),o=pI(n,yT),i=pI(n,ND),a=pI(n,TD),l=!r.hideFooterSelectedRowCount&&i>0?Xp.jsx(Oj,{selectedRowCount:i}):Xp.jsx("div",{}),s=r.hideFooterRowCount||r.pagination?null:Xp.jsx(r.slots.footerRowCount,f({},r.slotProps?.footerRowCount,{rowCount:o,visibleRowCount:a})),c=r.pagination&&!r.hideFooterPagination&&r.slots.pagination&&Xp.jsx(r.slots.pagination,f({},r.slotProps?.pagination));return Xp.jsxs(e$,f({},e,{ref:t,children:[l,s,c]}))}),Fj=(e,t,n,r,o,i)=>{let a;switch(e){case nD.LEFT:a=r[n];break;case nD.RIGHT:a=o-r[n]-t+i;break;default:a=void 0}return Number.isNaN(a)&&(a=void 0),a},Lj=(e,t,n,r,o,i)=>{const a=t===n-1;return!(!i?.startsWith("border")||e!==nD.LEFT||!a)||!!r&&(e===nD.LEFT||(e===nD.RIGHT?!a:!a||o))},Aj=(e,t,n,r)=>r?.startsWith("border")?e===nD.RIGHT&&0===t:n&&e===nD.RIGHT&&0===t,Nj=["skeletonRowsCount","visibleColumns","showFirstRowBorder"],$j=jh("div",{name:"MuiDataGrid",slot:"SkeletonLoadingOverlay"})({minWidth:"100%",width:"max-content",height:"100%",overflow:"clip"}),zj=e=>parseInt(e.getAttribute("data-colindex"),10),jj=TR(function(e,t){const n=rP(),{slots:r}=n,o=um(),i=(e=>{const{classes:t}=e;return wm({root:["skeletonLoadingOverlay"]},YT,t)})({classes:n.classes}),a=s.useRef(null),l=Tg(a,t),c=lP(),u=pI(c,oT),p=pI(c,iT),h=pI(c,hO),m=s.useMemo(()=>h.filter(e=>e<=p).length,[p,h]),{skeletonRowsCount:g,visibleColumns:v,showFirstRowBorder:b}=e,y=d(e,Nj),w=pI(c,cO),x=s.useMemo(()=>w.slice(0,m),[w,m]),S=pI(c,pO),C=s.useCallback(e=>-1!==S.left.findIndex(t=>t.field===e)?nD.LEFT:-1!==S.right.findIndex(t=>t.field===e)?nD.RIGHT:void 0,[S.left,S.right]),k=s.useMemo(()=>{const e=[];for(let t=0;t<g;t+=1){const i=[];for(let e=0;e<x.length;e+=1){const a=x[e],l=C(a.field),s=l===nD.LEFT,c=l===nD.RIGHT,d=kN(l,o),p=d?S[d].length:x.length-S.left.length-S.right.length,m=d?S[d].findIndex(e=>e.field===a.field):e-S.left.length,g=u.hasScrollY?u.scrollbarSize:0,b=EN({},o,l,Fj(l,a.computedWidth,e,h,u.columnsTotalWidth,g)),y=u.columnsTotalWidth<u.viewportOuterSize.width,w=Lj(l,m,p,n.showCellVerticalBorder,y,n.pinnedColumnsSectionSeparator),k=Aj(l,m,n.showCellVerticalBorder,n.pinnedColumnsSectionSeparator),E=c&&0===m,R=E&&y,P=e===x.length-1&&!E&&y,M=u.viewportOuterSize.width-u.columnsTotalWidth,T=Math.max(0,M),I=Xp.jsx(r.skeletonCell,{width:T,empty:!0},`skeleton-filler-column-${t}`);R&&i.push(I),i.push(Xp.jsx(r.skeletonCell,{field:a.field,type:a.type,align:a.align,width:"var(--width)",height:u.rowHeight,"data-colindex":e,empty:v&&!v.has(a.field),className:PR(s&&XT["cell--pinnedLeft"],c&&XT["cell--pinnedRight"],w&&XT["cell--withRightBorder"],k&&XT["cell--withLeftBorder"]),style:f({"--width":`${a.computedWidth}px`},b)},`skeleton-column-${t}-${a.field}`)),P&&i.push(I)}e.push(Xp.jsx("div",{className:PR(XT.row,XT.rowSkeleton,0===t&&!b&&XT["row--firstVisible"]),children:i},`skeleton-row-${t}`))}return e},[g,x,C,o,S,u.hasScrollY,u.scrollbarSize,u.columnsTotalWidth,u.viewportOuterSize.width,u.rowHeight,h,n.showCellVerticalBorder,n.pinnedColumnsSectionSeparator,r,v,b]);return rI(c,"columnResize",e=>{const{colDef:t,width:n}=e,r=a.current?.querySelectorAll(`[data-field="${m$(t.field)}"]`);if(!r)throw new Error("MUI X: Expected skeleton cells to be defined with `data-field` attribute.");const o=x.findIndex(e=>e.field===t.field),i=C(t.field),l=i===nD.LEFT,s=i===nD.RIGHT,c=getComputedStyle(r[0]).getPropertyValue("--width"),u=parseInt(c,10)-n;if(r&&r.forEach(e=>{e.style.setProperty("--width",`${n}px`)}),l){const e=a.current?.querySelectorAll(`.${XT["cell--pinnedLeft"]}`);e?.forEach(e=>{zj(e)>o&&(e.style.left=parseInt(getComputedStyle(e).left,10)-u+"px")})}if(s){const e=a.current?.querySelectorAll(`.${XT["cell--pinnedRight"]}`);e?.forEach(e=>{zj(e)<o&&(e.style.right=`${parseInt(getComputedStyle(e).right,10)+u}px`)})}}),Xp.jsx($j,f({className:i.root},y,{ref:l,children:k}))}),Bj=TR(function(e,t){const n=pI(lP(),oT),r=n?.viewportInnerSize.height??0,o=Math.ceil(r/n.rowHeight);return Xp.jsx(jj,f({},e,{skeletonRowsCount:o,ref:t}))}),_j=["variant","noRowsVariant","style"],Hj={"circular-progress":{component:e=>e.slots.baseCircularProgress,style:{}},"linear-progress":{component:e=>e.slots.baseLinearProgress,style:{display:"block"}},skeleton:{component:()=>Bj,style:{display:"block"}}},Vj=TR(function(e,t){const{variant:n="linear-progress",noRowsVariant:r="skeleton",style:o}=e,i=d(e,_j),a=lP(),l=rP(),s=pI(a,vT),c=Hj[0===s?r:n],u=c.component(l);return Xp.jsx(r$,f({style:f({},c.style,o)},i,{ref:t,children:Xp.jsx(u,{})}))}),Wj=TR(function(e,t){const n=lP().current.getLocaleText("noRowsLabel");return Xp.jsx(r$,f({},e,{ref:t,children:n}))}),Uj=TR(function(e,t){const n=rP(),r=lP(),o=pI(r,oO),i=!n.disableColumnSelector&&o.length>0;return Xp.jsxs(r$,f({},e,{ref:t,children:[r.current.getLocaleText("noColumnsOverlayLabel"),i&&Xp.jsx(n.slots.baseButton,f({size:"small"},n.slotProps?.baseButton,{onClick:()=>{r.current.showPreferences(YL.columns)},children:r.current.getLocaleText("noColumnsOverlayManageColumns")}))]}))}),Gj=pg(gI)({maxHeight:"calc(100% + 1px)",flexGrow:1});const Kj=["className","rowCount","visibleRowCount"],qj=jh("div",{name:"MuiDataGrid",slot:"RowCount"})({alignItems:"center",display:"flex",margin:bP.spacing(0,2)}),Yj=TR(function(e,t){const{className:n,rowCount:r,visibleRowCount:o}=e,i=d(e,Kj),a=lP(),l=rP(),s=(e=>{const{classes:t}=e;return wm({root:["rowCount"]},YT,t)})(l);if(0===r)return null;const c=o<r?a.current.getLocaleText("footerTotalVisibleRows")(o,r):r.toLocaleString();return Xp.jsxs(qj,f({className:PR(s.root,n),ownerState:l},i,{ref:t,children:[a.current.getLocaleText("footerTotalRows")," ",c]}))});const Xj=nT(e=>e.rowReorder),Qj=eT(Xj,e=>e?.isActive??!1),Zj=eT(Xj,e=>e?.dropTarget??{rowId:null,position:null});eT(Zj,e=>e.rowId??null);const Jj=eT(Zj,(e,t)=>e.rowId===t?e.position:null);eT(Xj,e=>e?.draggedRowId??null);const eB=pg("div",{name:"MuiDataGrid",slot:"RowDragOverlay",shouldForwardProp:e=>Oh(e)&&"action"!==e})(({theme:e,action:t})=>f({position:"absolute",left:0,right:0,top:0,bottom:0,pointerEvents:"none",zIndex:1},"above"===t&&{"&::before":{pointerEvents:"none",content:'""',position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:(e.vars||e).palette.primary.main}},"below"===t&&{"&::after":{pointerEvents:"none",content:'""',position:"absolute",bottom:"-2px",left:0,right:0,height:"2px",backgroundColor:(e.vars||e).palette.primary.main}},"inside"===t&&{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / 0.1)`:tm(e.palette.primary.main,.1)})),tB=s.memo(function(e){const{rowId:t,className:n}=e,r=pI(mL(),Jj,t);return r?Xp.jsx(eB,{action:r,className:n}):null}),nB=["selected","rowId","row","index","style","rowHeight","className","visibleColumns","pinnedColumns","offsetLeft","columnsTotalWidth","firstColumnIndex","lastColumnIndex","focusedColumnIndex","isFirstVisible","isLastVisible","isNotVisible","showBottomBorder","scrollbarWidth","gridHasFiller","onClick","onDoubleClick","onMouseEnter","onMouseLeave","onMouseOut","onMouseOver"],rB=eT(WL,(e,{rowReordering:t,treeData:n})=>{if(!t||n)return!1;return!!pD(e)}),oB=TR(function(e,t){const{selected:n,rowId:r,row:o,index:i,style:a,rowHeight:l,className:c,visibleColumns:u,pinnedColumns:p,offsetLeft:h,columnsTotalWidth:m,firstColumnIndex:g,lastColumnIndex:v,focusedColumnIndex:b,isFirstVisible:y,isLastVisible:w,isNotVisible:x,showBottomBorder:S,scrollbarWidth:C,gridHasFiller:k,onClick:E,onDoubleClick:R,onMouseEnter:P,onMouseLeave:M,onMouseOut:T,onMouseOver:I}=e,O=d(e,nB),D=mL(),F=jO(),L=s.useRef(null),A=rP(),N=sN(D),$=pI(D,gD),z=pI(D,hO),j=A.rowReordering,B=A.treeData,_=pI(D,rB,{rowReordering:j,treeData:B}),H=pI(D,Qj),V=Tg(L,t),W=ST(D,r),U=pI(D,UL,{rowId:r,editMode:A.editMode}),G=A.editMode===$I.Row,K=void 0!==b,q=K&&b>=p.left.length&&b<g,Y=K&&b<u.length-p.right.length&&b>=v,X=function(e,t){return wm(t,YT,e)}(A.classes,{root:["row",n&&"selected",G&&"row--editable",U&&"row--editing",y&&"row--firstVisible",w&&"row--lastVisible",S&&"row--borderBottom","auto"===l&&"row--dynamicHeight"]}),Q=F.hooks.useGridRowAriaAttributes();s.useLayoutEffect(()=>{if(N.range){const e=D.current.getRowIndexRelativeToVisibleRows(r);void 0!==e&&D.current.unstable_setLastMeasuredRowIndex(e)}if(L.current&&"auto"===l)return D.current.observeRowHeight(L.current,r)},[D,N.range,l,r]);const Z=s.useCallback((e,t)=>n=>{v$(n)||D.current.getRow(r)&&(D.current.publishEvent(e,D.current.getRowParams(r),n),t&&t(n))},[D,r]),J=s.useCallback(e=>{const t=h$(e.target,XT.cell),n=t?.getAttribute("data-field");if(n){if(n===wF.field)return;if(n===tD)return;if("__reorder__"===n)return;if(D.current.getCellMode(r,n)===zI.Edit)return;const e=D.current.getColumn(n);if(e?.type===ZO)return}Z("rowClick",E)(e)},[D,E,Z,r]),{slots:ee,slotProps:te,disableColumnReorder:ne}=A,re=pI(D,()=>f({},D.current.getRowHeightEntry(r)),void 0,lI),oe=s.useMemo(()=>{if(x)return{opacity:0,width:0,height:0};const e=f({},a,{maxHeight:"auto"===l?"none":l,minHeight:l,"--height":"number"==typeof l?`${l}px`:l});if(re.spacingTop){e["border"===A.rowSpacingType?"borderTopWidth":"marginTop"]=re.spacingTop}if(re.spacingBottom){const t="border"===A.rowSpacingType?"borderBottomWidth":"marginBottom";let n=e[t];"number"!=typeof n&&(n=parseInt(n||"0",10)),n+=re.spacingBottom,e[t]=n}return e},[x,l,a,re.spacingTop,re.spacingBottom,A.rowSpacingType]);if(!W)return null;const ie=D.current.unstable_applyPipeProcessors("rowClassName",[],r),ae=Q(W,i);if("function"==typeof A.getRowClassName){const e=i-(N.range?.firstRowIndex||0),t=f({},D.current.getRowParams(r),{isFirstVisible:0===e,isLastVisible:e===N.rows.length-1,indexRelativeToCurrentPage:e});ie.push(A.getRowClassName(t))}const le=(e,t,n,i,a=nD.NONE)=>{const s=D.current.unstable_getCellColSpanInfo(r,n);if(s?.spannedByColSpan)return null;const c=s?.cellProps.width??e.computedWidth,u=s?.cellProps.colSpan??1,d=Fj(a,e.computedWidth,n,z,m,C);if("skeletonRow"===W.type)return Xp.jsx(ee.skeletonCell,{type:e.type,width:c,height:l,field:e.field,align:e.align},e.field);const p="__reorder__"===e.field,h=!(ne||e.disableReorder),g=_&&!$.length,v=!(h||p&&g||H),b=a===nD.VIRTUAL,y=Aj(a,t,A.showCellVerticalBorder,A.pinnedColumnsSectionSeparator),w=Lj(a,t,i,A.showCellVerticalBorder,k,A.pinnedColumnsSectionSeparator);return Xp.jsx(ee.cell,f({column:e,width:c,rowId:r,align:e.align||"left",colIndex:n,colSpan:u,disableDragEvents:v,isNotVisible:b,pinnedOffset:d,pinnedPosition:a,showLeftBorder:y,showRightBorder:w,row:o,rowNode:W},te?.cell),e.field)},se=p.left.map((e,t)=>le(e,t,t,p.left.length,nD.LEFT)),ce=p.right.map((e,t)=>{const n=u.length-p.right.length+t;return le(e,t,n,p.right.length,nD.RIGHT)}),ue=u.length-p.left.length-p.right.length,de=[];q&&de.push(le(u[b],b-p.left.length,b,ue,nD.VIRTUAL));for(let e=g;e<v;e+=1){const t=u[e],n=e-p.left.length;t&&de.push(le(t,n,e,ue))}Y&&de.push(le(u[b],b-p.left.length,b,ue,nD.VIRTUAL));const pe=o?{onClick:J,onDoubleClick:Z("rowDoubleClick",R),onMouseEnter:Z("rowMouseEnter",P),onMouseLeave:Z("rowMouseLeave",M),onMouseOut:Z("rowMouseOut",T),onMouseOver:Z("rowMouseOver",I)}:null;return Xp.jsxs("div",f({"data-id":r,"data-rowindex":i,role:"row",className:PR(...ie,X.root,c),style:oe},ae,pe,O,{ref:V,children:[se,Xp.jsx("div",{role:"presentation",className:XT.cellOffsetLeft,style:{width:h}}),de,Xp.jsx("div",{role:"presentation",className:PR(XT.cell,XT.cellEmpty)}),ce,Xp.jsx(tB,{rowId:r})]}))}),iB=KT(oB);function aB({privateApiRef:e,configuration:t,props:n,children:r}){const o=s.useRef(e.current.getPublicApi());return Xp.jsx(zO.Provider,{value:t,children:Xp.jsx(nP.Provider,{value:n,children:Xp.jsx(hL.Provider,{value:e,children:Xp.jsx(aP.Provider,{value:o,children:Xp.jsx(GN,{children:Xp.jsx(HO,{children:r})})})})})})}const lB=function(){try{const e="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}()&&null!=window.localStorage.getItem("DEBUG"),sB=()=>{},cB={debug:sB,info:sB,warn:sB,error:sB},uB=["debug","info","warn","error"];function dB(e,t,n=console){const r=uB.indexOf(t);if(-1===r)throw new Error(`MUI X: Log level ${t} not recognized.`);return uB.reduce((t,o,i)=>(t[o]=i>=r?(...t)=>{const[r,...i]=t;n[o](`MUI X: ${e} - ${r}`,...i)}:sB,t),{})}let pB=function(e){return e.DataSource="dataSource",e.RowTree="rowTree",e}({});const fB=(e,t,n,r)=>{const o=s.useCallback(()=>{e.current.registerStrategyProcessor(t,n,r)},[e,r,n,t]);wL(()=>{o()});const i=s.useRef(!0);s.useEffect(()=>{i.current?i.current=!1:o()},[o])},hB="none",mB={dataSourceRowsUpdate:pB.DataSource,rowTreeCreation:pB.RowTree,filtering:pB.RowTree,sorting:pB.RowTree,visibleRowsLookupCreation:pB.RowTree},gB=(e,t)=>f({},e,{props:{listView:t.listView,getRowId:t.getRowId,isCellEditable:t.isCellEditable}}),vB=(e,t)=>{(e=>{const t=s.useRef(null),n=s.useRef(null),r=s.useRef(null),o=s.useRef(null),i=s.useRef(null),a=s.useRef(null);e.current.register("public",{rootElementRef:t}),e.current.register("private",{mainElementRef:n,virtualScrollerRef:r,virtualScrollbarVerticalRef:o,virtualScrollbarHorizontalRef:i,columnHeadersContainerRef:a})})(e),((e,t)=>{const n=s.useRef(!0);s.useEffect(()=>{n.current?n.current=!1:e.current.setState(e=>f({},e,{props:{listView:t.listView,getRowId:t.getRowId,isCellEditable:t.isCellEditable,isRowSelectable:t.isRowSelectable}}))},[e,t.listView,t.getRowId,t.isCellEditable,t.isRowSelectable])})(e,t),(e=>{const t=um();void 0===e.current.state.isRtl&&(e.current.state.isRtl=t);const n=s.useRef(!0);s.useEffect(()=>{n.current?n.current=!1:e.current.setState(e=>f({},e,{isRtl:t}))},[e,t])})(e),((e,t)=>{vL(e,{getLogger:s.useCallback(e=>lB?dB(e,"debug",t.logger):t.logLevel?dB(e,t.logLevel.toString(),t.logger):cB,[t.logLevel,t.logger])},"private")})(e,t),(e=>{const t=s.useRef({}),n=s.useCallback(e=>{t.current[e.stateId]=e},[]),r=s.useCallback((n,r)=>{let o;if(o="function"==typeof n?n(e.current.state):n,e.current.state===o)return!1;const i={current:{state:o}};let a=!1;const l=[];if(Object.keys(t.current).forEach(n=>{const r=t.current[n],o=r.stateSelector(e),s=r.stateSelector(i);s!==o&&(l.push({stateId:r.stateId,hasPropChanged:s!==r.propModel}),void 0!==r.propModel&&s!==r.propModel&&(a=!0))}),l.length>1)throw new Error(`You're not allowed to update several sub-state in one transaction. You already updated ${l[0].stateId}, therefore, you're not allowed to update ${l.map(e=>e.stateId).join(", ")} in the same transaction.`);if(a||(e.current.state=o,e.current.publishEvent("stateChange",o),e.current.store.update(o)),1===l.length){const{stateId:n,hasPropChanged:o}=l[0],s=t.current[n],c=s.stateSelector(i);s.propOnChange&&o&&s.propOnChange(c,{reason:r,api:e.current}),a||e.current.publishEvent(s.changeEvent,c,{reason:r})}return!a},[e]),o=s.useCallback((t,n,r)=>e.current.setState(e=>f({},e,{[t]:n(e[t])}),r),[e]),i={updateControlState:o,registerControlState:n};vL(e,{setState:r},"public"),vL(e,i,"private")})(e),(e=>{const t=s.useRef({}),n=s.useRef(!1),r=s.useCallback(e=>{!n.current&&e&&(n.current=!0,Object.values(e.appliers).forEach(e=>{e()}),n.current=!1)},[]),o=s.useCallback((e,n,r)=>{t.current[e]||(t.current[e]={processors:new Map,processorsAsArray:[],appliers:{},processorsUpdated:!1});const o=t.current[e];return o.processors.get(n)!==r&&(o.processors.set(n,r),o.processorsAsArray=Array.from(t.current[e].processors.values()).filter(e=>null!==e),o.processorsUpdated=!0),()=>{t.current[e].processors.set(n,null),t.current[e].processorsAsArray=Array.from(t.current[e].processors.values()).filter(e=>null!==e)}},[]),i=s.useCallback((e,n,r)=>(t.current[e]||(t.current[e]={processors:new Map,processorsAsArray:[],appliers:{},processorsUpdated:!1}),t.current[e].appliers[n]=r,()=>{const r=d(t.current[e].appliers,[n].map(T));t.current[e].appliers=r}),[]),a=s.useCallback(e=>{r(t.current[e])},[r]),l=s.useCallback(()=>{for(const e in t.current){if(!Object.prototype.hasOwnProperty.call(t.current,e))continue;const n=t.current[e];n.processorsUpdated&&(n.processorsUpdated=!1,r(n))}},[r]),c={unstable_applyPipeProcessors:s.useCallback((...e)=>{const[n,r,o]=e;if(!t.current[n])return r;const i=t.current[n].processorsAsArray;let a=r;for(let e=0;e<i.length;e+=1)a=i[e](a,o);return a},[])};vL(e,{registerPipeProcessor:o,registerPipeApplier:i,requestPipeProcessorsApplication:a,runAppliersForPendingProcessors:l},"private"),vL(e,c,"public")})(e),(e=>{const t=s.useRef(new Map),n=s.useRef({}),r=s.useCallback((t,r,o)=>{const i=()=>{const e=d(n.current[r],[t].map(T));n.current[r]=e};n.current[r]||(n.current[r]={});const a=n.current[r],l=a[t];return a[t]=o,l&&l!==o?(t===e.current.getActiveStrategy(mB[r])&&e.current.publishEvent("activeStrategyProcessorChange",r),i):i},[e]),o=s.useCallback((t,r)=>{const o=e.current.getActiveStrategy(mB[t]);if(null==o)throw new Error("Can't apply a strategy processor before defining an active strategy");const i=n.current[t];if(!i||!i[o])throw new Error(`No processor found for processor "${t}" on strategy "${o}"`);return(0,i[o])(r)},[e]),i=s.useCallback(e=>{const n=Array.from(t.current.entries()).find(([,t])=>t.group===e&&t.isAvailable());return n?.[0]??hB},[]),a=s.useCallback((n,r,o)=>{t.current.set(r,{group:n,isAvailable:o}),e.current.publishEvent("strategyAvailabilityChange")},[e]);vL(e,{registerStrategyProcessor:r,applyStrategyProcessor:o,getActiveStrategy:i,setStrategyAvailability:a},"private")})(e),((e,t)=>{const n=s.useCallback(e=>{if(null==t.localeText[e])throw new Error(`Missing translation for key ${e}.`);return t.localeText[e]},[t.localeText]);e.current.register("public",{getLocaleText:n})})(e,t),e.current.register("private",{rootProps:t})},bB=(e,t,n,r)=>{const o=s.useRef(r),i=s.useRef(!1);r!==o.current&&(i.current=!1,o.current=r),i.current||(t.current.state=e(t.current.state,n,t),i.current=!0)};function yB(e,t){if(null==e)return"";const n="string"==typeof e?e:`${e}`;if(t.shouldAppendQuotes||t.escapeFormulas){const e=n.replace(/"/g,'""');return t.escapeFormulas&&["=","+","-","@","\t","\r"].includes(e[0])?`"'${e}"`:[t.delimiter,"\n","\r",'"'].some(e=>n.includes(e))?`"${e}"`:e}return n}const wB=(e,t)=>{const{csvOptions:n,ignoreValueFormatter:r}=t;let o;if(r){const t=e.colDef.type;o="number"===t?String(e.value):"date"===t||"dateTime"===t?e.value?.toISOString():"function"==typeof e.value?.toString?e.value.toString():e.value}else o=e.formattedValue;return yB(o,n)};class xB{rowString="";isEmpty=!0;constructor(e){this.options=e}addValue(e){this.isEmpty||(this.rowString+=this.options.csvOptions.delimiter),"function"==typeof this.options.sanitizeCellValue?this.rowString+=this.options.sanitizeCellValue(e,this.options.csvOptions):this.rowString+=e,this.isEmpty=!1}getRowString(){return this.rowString}}function SB(e){const{columns:t,rowIds:n,csvOptions:r,ignoreValueFormatter:o,apiRef:i}=e,a=n.reduce((e,n)=>`${e}${(({id:e,columns:t,getCellParams:n,csvOptions:r,ignoreValueFormatter:o})=>{const i=new xB({csvOptions:r});return t.forEach(t=>{const a=n(e,t.field);String(a.formattedValue),i.addValue(wB(a,{ignoreValueFormatter:o,csvOptions:r}))}),i.getRowString()})({id:n,columns:t,getCellParams:i.current.getCellParams,ignoreValueFormatter:o,csvOptions:r})}\r\n`,"").trim();if(!r.includeHeaders)return a;const l=t.filter(e=>e.field!==wF.field),s=[];if(r.includeColumnGroupsHeaders){const e=i.current.getAllGroupDetails();let t=0;const n=l.reduce((e,n)=>{const r=i.current.getColumnGroupPath(n.field);return e[n.field]=r,t=Math.max(t,r.length),e},{});for(let o=0;o<t;o+=1){const t=new xB({csvOptions:r,sanitizeCellValue:yB});s.push(t),l.forEach(r=>{const i=(n[r.field]||[])[o],a=e[i];t.addValue(a?a.headerName||a.groupId:"")})}}const c=new xB({csvOptions:r,sanitizeCellValue:yB});l.forEach(e=>{c.addValue(e.headerName||e.field)}),s.push(c);return`${`${s.map(e=>e.getRowString()).join("\r\n")}\r\n`}${a}`.trim()}function CB(e){const t=document.createElement("span");t.style.whiteSpace="pre",t.style.userSelect="all",t.style.opacity="0px",t.textContent=e,document.body.appendChild(t);const n=document.createRange();n.selectNode(t);const r=window.getSelection();r.removeAllRanges(),r.addRange(n);try{document.execCommand("copy")}finally{document.body.removeChild(t)}}const kB=(e,t)=>{const n=t.ignoreValueFormatterDuringExport,r=("object"==typeof n?n?.clipboardExport:n)||!1,o=t.clipboardCopyCellDelimiter,i=s.useCallback(t=>{if(!function(e){return(e.ctrlKey||e.metaKey)&&"C"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey}(t))return;if(n=t.target,window.getSelection()?.toString()||n&&(n.selectionEnd||0)-(n.selectionStart||0)>0)return;var n;let i="";if(ND(e)>0)i=e.current.getDataAsCsv({includeHeaders:!1,delimiter:o,shouldAppendQuotes:!1,escapeFormulas:!1});else{const t=YD(e);if(t){const n=e.current.getCellParams(t.id,t.field);i=wB(n,{csvOptions:{delimiter:o,shouldAppendQuotes:!1,escapeFormulas:!1},ignoreValueFormatter:r})}}var a;i=e.current.unstable_applyPipeProcessors("clipboardCopy",i),i&&(a=i,navigator.clipboard?navigator.clipboard.writeText(a).catch(()=>{CB(a)}):CB(a),e.current.publishEvent("clipboardCopy",i))},[e,r,o]);yL(e,()=>e.current.rootElementRef.current,"keydown",i),iI(e,"clipboardCopy",t.onClipboardCopy)},EB=e=>f({},e,{columnMenu:{open:!1}}),RB=(e,t,n)=>{n.current.caches.columns={lastColumnsProp:t.columns};return f({},e,{columns:aL({apiRef:n,columnsToUpsert:t.columns,initialState:t.initialState?.columns,columnVisibilityModel:t.columnVisibilityModel??t.initialState?.columns?.columnVisibilityModel??{},keepOnlyColumnsToUpsert:!0}),pinnedColumns:e.pinnedColumns??JI})};function PB(e,t){const n=bL(e,"useGridColumns");e.current.registerControlState({stateId:"visibleColumns",propModel:t.columnVisibilityModel,propOnChange:t.onColumnVisibilityModelChange,stateSelector:lO,changeEvent:"columnVisibilityModelChange"});const r=s.useCallback(t=>{n.debug("Updating columns state."),e.current.setState(function(e){return t=>f({},t,{columns:e})}(t)),e.current.publishEvent("columnsChange",t.orderedFields)},[n,e]),o=s.useCallback(t=>iO(e)[t],[e]),i=s.useCallback(()=>aO(e),[e]),a=s.useCallback(()=>cO(e),[e]),l=s.useCallback((t,n=!0)=>(n?cO(e):aO(e)).findIndex(e=>e.field===t),[e]),c=s.useCallback(t=>{const n=l(t);return hO(e)[n]},[e,l]),u=s.useCallback(t=>{lO(e)!==t&&(e.current.setState(n=>f({},n,{columns:aL({apiRef:e,columnsToUpsert:[],initialState:void 0,columnVisibilityModel:t,keepOnlyColumnsToUpsert:!1})})),e.current.updateRenderContext?.())},[e]),d=s.useCallback(t=>{let n=t;if(SL(e)){const r=[],o=[],i=kL(e);if(t.forEach(e=>{i.has(e.field)?r.push(e):o.push(e)}),r.length>0&&e.current.updateNonPivotColumns(r),0===o.length)return;n=o}const o=aL({apiRef:e,columnsToUpsert:n,initialState:void 0,keepOnlyColumnsToUpsert:!1,updateInitialVisibilityModel:!0});r(o)},[e,r]),p=s.useCallback((t,n)=>{const r=lO(e);if(n!==(r[t]??!0)){const o=f({},r,{[t]:n});e.current.setColumnVisibilityModel(o)}},[e]),h=s.useCallback(t=>oO(e).findIndex(e=>e===t),[e]),m=s.useCallback((t,o)=>{const i=oO(e),a=h(t);if(a===o)return;n.debug(`Moving column ${t} to index ${o}`);const l=[...i],s=l.splice(a,1)[0];l.splice(o,0,s),r(f({},rO(e),{orderedFields:l}));const c={column:e.current.getColumn(t),targetIndex:e.current.getColumnIndexRelativeToVisibleColumns(t),oldIndex:a};e.current.publishEvent("columnIndexChange",c)},[e,n,r,h]),g=s.useCallback((t,o)=>{n.debug(`Updating column ${t} width to ${o}`);const i=rO(e),a=f({},i.lookup[t],{width:o,hasBeenResized:!0});r(oL(f({},i,{lookup:f({},i.lookup,{[t]:a})}),e.current.getRootDimensions())),e.current.publishEvent("columnWidthChange",{element:e.current.getColumnHeaderElement(t),colDef:a,width:o})},[e,n,r]),v={setColumnIndex:m};vL(e,{getColumn:o,getAllColumns:i,getColumnIndex:l,getColumnPosition:c,getVisibleColumns:a,getColumnIndexRelativeToVisibleColumns:h,updateColumns:d,setColumnVisibilityModel:u,setColumnVisibility:p,setColumnWidth:g},"public"),vL(e,v,t.signature===QT.DataGrid?"private":"public");const b=s.useCallback((n,r)=>{const o={},i=lO(e);(!r.exportOnlyDirtyModels||null!=t.columnVisibilityModel||Object.keys(t.initialState?.columns?.columnVisibilityModel??{}).length>0||Object.keys(i).length>0)&&(o.columnVisibilityModel=i),o.orderedFields=oO(e);const a=aO(e),l={};return a.forEach(e=>{if(e.hasBeenResized){const t={};nL.forEach(n=>{let r=e[n];r===1/0&&(r=-1),t[n]=r}),l[e.field]=t}}),Object.keys(l).length>0&&(o.dimensions=l),f({},n,{columns:o})},[e,t.columnVisibilityModel,t.initialState?.columns]),y=s.useCallback((t,n)=>{const r=n.stateToRestore.columns,o=r?.columnVisibilityModel;if(null==r)return t;const i=aL({apiRef:e,columnsToUpsert:[],initialState:r,columnVisibilityModel:o,keepOnlyColumnsToUpsert:!1});return null!=r&&e.current.setState(e=>f({},e,{columns:f({},e.columns,{lookup:i.lookup,orderedFields:i.orderedFields,initialColumnVisibilityModel:i.initialColumnVisibilityModel})})),null!=o&&e.current.setState(e=>f({},e,{columns:f({},e.columns,{columnVisibilityModel:o})})),null!=r&&e.current.publishEvent("columnsChange",i.orderedFields),t},[e]),w=s.useCallback((e,n)=>{if(n===YL.columns){const e=t.slots.columnsPanel;return Xp.jsx(e,f({},t.slotProps?.columnsPanel))}return e},[t.slots.columnsPanel,t.slotProps?.columnsPanel]),x=s.useCallback(n=>{const r=SL(e);return t.disableColumnSelector||r?n:[...n,"columnMenuColumnsItem"]},[t.disableColumnSelector,e]);pN(e,"columnMenu",x),pN(e,"exportState",b),pN(e,"restoreState",y),pN(e,"preferencePanel",w);const S=s.useRef(null);rI(e,"viewportInnerSizeChange",t=>{if(S.current!==t.width){S.current=t.width;if(!cO(e).some(e=>e.flex&&e.flex>0))return;r(oL(rO(e),e.current.getRootDimensions()))}});const C=s.useCallback(()=>{n.info("Columns pipe processing have changed, regenerating the columns");const t=aL({apiRef:e,columnsToUpsert:[],initialState:void 0,keepOnlyColumnsToUpsert:!1});r(t)},[e,n,r]);fN(e,"hydrateColumns",C),s.useEffect(()=>{if(e.current.caches.columns.lastColumnsProp===t.columns)return;e.current.caches.columns.lastColumnsProp=t.columns,n.info(`GridColumns have changed, new length ${t.columns.length}`);const o=aL({apiRef:e,initialState:void 0,columnsToUpsert:t.columns,keepOnlyColumnsToUpsert:!0,updateInitialVisibilityModel:!0,columnVisibilityModel:t.columnVisibilityModel});r(o)},[n,e,r,t.columns,t.columnVisibilityModel]),s.useEffect(()=>{void 0!==t.columnVisibilityModel&&e.current.setColumnVisibilityModel(t.columnVisibilityModel)},[e,n,t.columnVisibilityModel])}const MB=(e,t)=>f({},e,{density:t.initialState?.density??t.density??"standard"});const TB=({apiRef:e,options:t})=>{const n=aO(e);if(t.fields)return t.fields.reduce((e,t)=>{const r=n.find(e=>e.field===t);return r&&e.push(r),e},[]);return(t.allColumns?n:cO(e)).filter(e=>!0!==e.disableExport)},IB=({apiRef:e})=>{const t=RD(e),n=xT(e),r=ND(e),o=t.filter(e=>"footer"!==n[e].type),i=TT(e),a=i?.top?.map(e=>e.id)||[],l=i?.bottom?.map(e=>e.id)||[];if(o.unshift(...a),o.push(...l),r>0){const t=$D(e);return o.filter(e=>t.has(e))}return o},OB=(e,t)=>{const n=bL(e,"useGridCsvExport"),r=t.ignoreValueFormatterDuringExport,o=("object"==typeof r?r?.csvExport:r)||!1,i=s.useCallback((t={})=>{n.debug("Get data as CSV");return SB({columns:TB({apiRef:e,options:t}),rowIds:(t.getRowsToExport??IB)({apiRef:e}),csvOptions:{delimiter:t.delimiter||",",shouldAppendQuotes:t.shouldAppendQuotes??!0,includeHeaders:t.includeHeaders??!0,includeColumnGroupsHeaders:t.includeColumnGroupsHeaders??!0,escapeFormulas:t.escapeFormulas??!0},ignoreValueFormatter:o,apiRef:e})},[n,e,o]),a=s.useCallback(e=>{n.debug("Export data as CSV");const t=i(e);!function(e,t="csv",n=document.title||"untitled"){const r=`${n}.${t}`;if("download"in HTMLAnchorElement.prototype){const t=URL.createObjectURL(e),n=document.createElement("a");return n.href=t,n.download=r,n.click(),void setTimeout(()=>{URL.revokeObjectURL(t)})}throw new Error("MUI X: exportAs not supported.")}(new Blob([e?.utf8WithBom?new Uint8Array([239,187,191]):"",t],{type:"text/csv"}),"csv",e?.fileName)},[n,i]);vL(e,{getDataAsCsv:i,exportDataAsCsv:a},"public");const l=s.useCallback((e,t)=>t.csvOptions?.disableToolbarButton?e:[...e,{component:Xp.jsx(Kz,{options:t.csvOptions}),componentName:"csvExport"}],[]);pN(e,"exportMenu",l)};const DB=(e,t,n)=>{let r=e.paginationModel;const o=e.rowCount,i=n?.pageSize??r.pageSize,a=n?.page??r.page,l=nF(o,i,a);!n||n?.page===r.page&&n?.pageSize===r.pageSize||(r=n);const s=-1===i?0:((e,t=0)=>0===t?e:Math.max(Math.min(e,t-1),0))(r.page,l);return s!==r.page&&(r=f({},r,{page:s})),oF(r.pageSize,t),r};const FB=(e,t)=>{const n=null!==e.current.rootElementRef.current,r=bL(e,"useGridPrintExport"),o=s.useRef(null),i=s.useRef(null),a=s.useRef({}),l=s.useRef([]),c=s.useRef(null);s.useEffect(()=>{o.current=kg(e.current.rootElementRef.current)},[e,n]);const u=s.useCallback((t,n,r)=>new Promise(o=>{const i=TB({apiRef:e,options:{fields:t,allColumns:n}}).map(e=>e.field),a=aO(e),l={};a.forEach(e=>{l[e.field]=i.includes(e.field)}),r&&(l[wF.field]=!0),e.current.setColumnVisibilityModel(l),o()}),[e]),d=s.useCallback(t=>{const n=t({apiRef:e}).reduce((t,n)=>{const r=e.current.getRow(n);return r[DT]||t.push(r),t},[]);e.current.setRows(n)},[e]),p=s.useCallback((t,n)=>{const r=f({copyStyles:!0,hideToolbar:!1,hideFooter:!1,includeCheckboxes:!1},n),i=t.contentDocument;if(!i)return;const a=e.current.rootElementRef.current,l=a.cloneNode(!0),s=l.querySelector(`.${XT.virtualScrollerContent}`);if(l.querySelector(`.${XT.main}`).style.overflow="visible",l.querySelector(`.${XT.virtualScrollerRenderZone}`).style.position="static",s.style.flexBasis="auto",l.querySelector(`.${XT["scrollbar--vertical"]}`)?.remove(),!(s.nextSibling instanceof HTMLElement&&s.nextSibling.classList.contains(XT.filler))){const e=document.createElement("div");e.style.height=XA,s.insertAdjacentElement("afterend",e)}const c=l.querySelector(`.${XT.footerContainer}`);r.hideToolbar&&l.querySelector(`.${XT.toolbar}`)?.remove(),r.hideFooter&&c&&c.remove(),l.style.height="auto",l.style.boxSizing="content-box",!r.hideFooter&&c&&(c.style.width="100%");const u=document.createElement("div");u.appendChild(l),i.body.style.marginTop="0px",i.body.innerHTML=u.innerHTML;const d="function"==typeof r.pageStyle?r.pageStyle():r.pageStyle;if("string"==typeof d){const e=i.createElement("style");e.appendChild(i.createTextNode(d)),i.head.appendChild(e)}r.bodyClassName&&i.body.classList.add(...r.bodyClassName.split(" "));let p=[];if(r.copyStyles){const e=a.getRootNode();p=function(e,t){const n=[],r=t.querySelectorAll("style, link[rel='stylesheet']");for(let t=0;t<r.length;t+=1){const o=r[t],i=e.createElement(o.tagName);if("STYLE"===o.tagName){const t=o.sheet;if(t){let n="";for(let e=0;e<t.cssRules.length;e+=1)"string"==typeof t.cssRules[e].cssText&&(n+=`${t.cssRules[e].cssText}\r\n`);i.appendChild(e.createTextNode(n))}}else if(o.getAttribute("href")){for(let e=0;e<o.attributes.length;e+=1){const t=o.attributes[e];t&&i.setAttribute(t.nodeName,t.nodeValue||"")}n.push(new Promise(e=>{i.addEventListener("load",()=>e())}))}e.head.appendChild(i)}return n}(i,"ShadowRoot"===e.constructor.name?e:o.current)}Promise.all(p).then(()=>{t.contentWindow.print()})},[e,o]),h=s.useCallback(t=>{o.current.body.removeChild(t),e.current.restoreState(i.current||{}),i.current?.columns?.columnVisibilityModel||e.current.setColumnVisibilityModel(a.current),e.current.setState(e=>f({},e,{virtualization:c.current})),e.current.setRows(l.current),i.current=null,a.current={},l.current=[]},[e]),m=s.useCallback(async n=>{if(r.debug("Export data as Print"),!e.current.rootElementRef.current)throw new Error("MUI X: No grid root element available.");if(i.current=e.current.exportState(),a.current=lO(e),l.current=e.current.getSortedRows().filter(e=>!e[DT]),t.pagination){const t={page:0,pageSize:MD(e)};e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,"DataGridPro",t)})}))}c.current=e.current.state.virtualization,e.current.unstable_setVirtualization(!1),await u(n?.fields,n?.allColumns,n?.includeCheckboxes),d(n?.getRowsToExport??IB),await new Promise(e=>{requestAnimationFrame(()=>{e()})});const s=function(e){const t=document.createElement("iframe");return t.style.position="absolute",t.style.width="0px",t.style.height="0px",t.title=e||document.title,t}(n?.fileName);s.onload=()=>{p(s,n);s.contentWindow.matchMedia("print").addEventListener("change",e=>{!1===e.matches&&h(s)})},o.current.body.appendChild(s)},[t,r,e,p,h,u,d]);vL(e,{exportDataAsPrint:m},"public");const g=s.useCallback((e,t)=>t.printOptions?.disableToolbarButton?e:[...e,{component:Xp.jsx(qz,{options:t.printOptions}),componentName:"printExport"}],[]);pN(e,"exportMenu",g)},LB=(e,t,n)=>{const r=t.filterModel??t.initialState?.filter?.filterModel??XI();return f({},e,{filter:f({filterModel:wO(r,t.disableMultipleColumnsFiltering,n)},YI),visibleRowsLookup:{}})},AB=e=>e.filteredRowsLookup;function NB(e,t){return e.current.applyStrategyProcessor("visibleRowsLookupCreation",{tree:t.rows.tree,filteredRowsLookup:t.filter.filteredRowsLookup})}function $B(){return PM(Object.values)}const zB=e=>f({},e,{focus:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null},tabIndex:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}}),jB=({currentColIndex:e,firstColIndex:t,lastColIndex:n,isRtl:r})=>{if(r){if(e<n)return e+1}else if(!r&&e>t)return e-1;return null},BB=({currentColIndex:e,firstColIndex:t,lastColIndex:n,isRtl:r})=>{if(r){if(e>t)return e-1}else if(!r&&e<n)return e+1;return null};const _B=tT(gF,TT,(e,t)=>(t.top||[]).concat(e.rows,t.bottom||[])),HB=(e,t)=>{const n=bL(e,"useGridKeyboardNavigation"),r=um(),o=s.useCallback(()=>_B(e),[e]),i="DataGrid"!==t.signature&&t.headerFilters,a=s.useCallback((t,r,o="left",i="up")=>{const a=CD(e),l=e.current.unstable_getCellColSpanInfo(r,t);l&&l.spannedByColSpan&&("left"===o?t=l.leftVisibleCellIndex:"right"===o&&(t=l.rightVisibleCellIndex));const s=uO(e)[t],c=function(e,t,n,r){const o=AA.selectors.hiddenCells(e.current.virtualizer.store.state);if(!o[t]?.[n])return t;const i=RD(e);let a=i.indexOf(t)+("down"===r?1:-1);for(;a>=0&&a<i.length;){const e=i[a];if(!o[e]?.[n])return e;a+="down"===r?1:-1}return t}(e,r,t,i),u=a.findIndex(e=>e.id===c);n.debug(`Navigating to cell row ${u}, col ${t}`),e.current.scrollToIndexes({colIndex:t,rowIndex:u}),e.current.setCellFocus(c,s)},[e,n]),l=s.useCallback((t,r)=>{n.debug(`Navigating to header col ${t}`),e.current.scrollToIndexes({colIndex:t});const o=e.current.getVisibleColumns()[t].field;e.current.setColumnHeaderFocus(o,r)},[e,n]),c=s.useCallback((t,r)=>{n.debug(`Navigating to header filter col ${t}`),e.current.scrollToIndexes({colIndex:t});const o=e.current.getVisibleColumns()[t].field;e.current.setColumnHeaderFilterFocus(o,r)},[e,n]),u=s.useCallback((t,r,o)=>{n.debug(`Navigating to header col ${t}`),e.current.scrollToIndexes({colIndex:t});const{field:i}=e.current.getVisibleColumns()[t];e.current.setColumnGroupHeaderFocus(i,r,o)},[e,n]),d=s.useCallback(e=>o()[e]?.id,[o]),p=s.useCallback((n,s)=>{const p=s.currentTarget.querySelector(`.${XT.columnHeaderTitleContainerContent}`);if(!!p&&p.contains(s.target)&&n.field!==wF.field)return;if(!AO(s.key)&&"Tab"!==s.key)return;if("Tab"===s.key&&("none"===t.tabNavigation||"content"===t.tabNavigation&&s.shiftKey))return;const f=o(),h=e.current.getViewportPageSize(),m=n.field?e.current.getColumnIndex(n.field):0,g=f.length>0?0:null,v=f.length>0?f.length-1:null,b=Math.max(0,cO(e).length-1),y=tL(e);let w=!0;if("Tab"!==s.key||"content"!==t.tabNavigation||s.shiftKey){switch(s.key){case"ArrowDown":i?c(m,s):null!==g&&a(m,d(g));break;case"ArrowRight":{const e=BB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&l(e,s);break}case"ArrowLeft":{const e=jB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&l(e,s);break}case"ArrowUp":y>0&&u(m,y-1,s);break;case"PageDown":null!==g&&null!==v&&a(m,d(Math.min(g+h,v)));break;case"Home":l(0,s);break;case"End":l(b,s);break;case"Enter":(s.ctrlKey||s.metaKey)&&e.current.toggleColumnMenu(n.field);break;case"Tab":s.shiftKey?0===m?y>0?u(b,y-1,s):w=!1:l(m-1,s):m===b?i?c(0,s):"all"===t.tabNavigation&&null!==g?a(0,d(g)):w=!1:l(m+1,s);break;case" ":break;default:w=!1}w&&s.preventDefault()}else null!==g&&(a(0,d(g)),s.preventDefault())},[e,t.tabNavigation,o,i,c,a,d,r,l,u]),f=s.useCallback((n,i)=>{const s=YF(e)===n.field;if(XF(e)===n.field||s&&"Tab"!==i.key)return;if(!AO(i.key)&&"Tab"!==i.key)return;if("Tab"===i.key&&("none"===t.tabNavigation||"content"===t.tabNavigation&&i.shiftKey))return;const u=o(),p=e.current.getViewportPageSize(),f=n.field?e.current.getColumnIndex(n.field):0,h=u.length>0?0:null,m=u.length>0?u.length-1:null,g=Math.max(0,cO(e).length-1);let v=!0;if("Tab"!==i.key||"content"!==t.tabNavigation||i.shiftKey){switch(i.key){case"ArrowDown":null!==h&&a(f,d(h));break;case"ArrowRight":{const e=BB({currentColIndex:f,firstColIndex:0,lastColIndex:g,isRtl:r});null!==e&&c(e,i);break}case"ArrowLeft":{const t=jB({currentColIndex:f,firstColIndex:0,lastColIndex:g,isRtl:r});null!==t?c(t,i):e.current.setColumnHeaderFilterFocus(n.field,i);break}case"ArrowUp":l(f,i);break;case"PageDown":null!==h&&null!==m&&a(f,d(Math.min(h+p,m)));break;case"Home":c(0,i);break;case"End":c(g,i);break;case"Tab":i.shiftKey?0===f?l(g,i):c(f-1,i):f===g?"all"===t.tabNavigation&&null!==h?a(0,d(h)):v=!1:c(f+1,i);break;case" ":break;default:v=!1}v&&i.preventDefault()}else null!==h&&(a(0,d(h)),i.preventDefault())},[e,t.tabNavigation,o,c,r,l,a,d]),h=s.useCallback((n,r)=>{const i=QD(e);if(null===i)return;const{field:s,depth:c}=i,{fields:p,depth:f,maxDepth:h}=n;if(!AO(r.key)&&"Tab"!==r.key)return;if("Tab"===r.key&&("none"===t.tabNavigation||"content"===t.tabNavigation&&r.shiftKey))return;const m=o(),g=e.current.getViewportPageSize(),v=e.current.getColumnIndex(s),b=s?e.current.getColumnIndex(s):0,y=m.length>0?0:null,w=m.length>0?m.length-1:null,x=Math.max(0,cO(e).length-1);let S=!0;if("Tab"!==r.key||"content"!==t.tabNavigation||r.shiftKey){switch(r.key){case"ArrowDown":f===h-1?l(v,r):u(v,c+1,r);break;case"ArrowUp":f>0&&u(v,c-1,r);break;case"ArrowRight":{const e=p.length-p.indexOf(s)-1;v+e+1<=x&&u(v+e+1,c,r);break}case"ArrowLeft":{const e=p.indexOf(s);v-e-1>=0&&u(v-e-1,c,r);break}case"PageDown":null!==y&&null!==w&&a(b,d(Math.min(y+g,w)));break;case"Home":u(0,c,r);break;case"End":u(x,c,r);break;case"Tab":if(r.shiftKey){const e=v-p.indexOf(s)-1;e<0?0===f?S=!1:u(x,c-1,r):u(e,c,r)}else{const e=v+(p.length-p.indexOf(s)-1)+1;e>x&&f===h-1?l(0,r):e>x?u(0,c+1,r):u(e,c,r)}break;case" ":break;default:S=!1}S&&r.preventDefault()}else null!==y&&(a(0,d(y)),r.preventDefault())},[e,t.tabNavigation,o,l,u,a,d]),m=s.useCallback((n,s)=>{if(v$(s))return;const u=e.current.getCellParams(n.id,n.field);if(u.cellMode===zI.Edit||!AO(s.key)&&"Tab"!==s.key)return;if("Tab"===s.key&&("none"===t.tabNavigation||"header"===t.tabNavigation&&!s.shiftKey))return;if(!e.current.unstable_applyPipeProcessors("canUpdateFocus",!0,{event:s,cell:u}))return;const p=o();if(0===p.length)return;const f=i?c:l,h=e.current.getViewportPageSize(),m=n.field?e.current.getColumnIndex(n.field):0,g=p.findIndex(e=>e.id===n.id),v=p.length-1,b=Math.max(0,cO(e).length-1);let y=!0;if("Tab"===s.key&&"header"===t.tabNavigation&&s.shiftKey)return f(b,s),void s.preventDefault();switch(s.key){case"ArrowDown":g<v&&a(m,d(g+1),r?"right":"left","down");break;case"ArrowUp":g>0?a(m,d(g-1)):f(m,s);break;case"ArrowRight":{const e=BB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&a(e,d(g),r?"left":"right");break}case"ArrowLeft":{const e=jB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&a(e,d(g),r?"right":"left");break}case"Tab":s.shiftKey?0===m&&0===g?"all"===t.tabNavigation?f(b,s):y=!1:0===m?a(b,d(g-1)):a(m-1,d(g),"left"):m===b?g!==v?a(0,d(g+1)):y=!1:a(m+1,d(g),"right");break;case" ":{if(n.field===tD)break;const e=n.colDef;if(e&&("__tree_data_group__"===e.field||(e=>e===eD||null!==(e=>{const t=e.match(/^__row_group_by_columns_group_(.*)__$/);return t?t[1]:null})(e))(e.field)))break;!s.shiftKey&&g<v&&a(m,d(Math.min(g+h,v)));break}case"PageDown":g<v&&a(m,d(Math.min(g+h,v)));break;case"PageUp":{const e=Math.max(g-h,0);e!==g&&e>=0?a(m,d(e)):l(m,s);break}case"Home":s.ctrlKey||s.metaKey||s.shiftKey?a(0,d(0)):a(0,d(g));break;case"End":s.ctrlKey||s.metaKey||s.shiftKey?a(b,d(v)):a(b,d(g));break;default:y=!1}y&&s.preventDefault()},[e,t.tabNavigation,o,r,a,d,i,c,l]),g=s.useCallback((e,{event:t})=>" "!==t.key&&e,[]);pN(e,"canStartEditing",g),rI(e,"columnHeaderKeyDown",p),rI(e,"headerFilterKeyDown",f),rI(e,"columnGroupHeaderKeyDown",h),rI(e,"cellKeyDown",m)},VB=(e,t)=>{const n=f({},rF(t.autoPageSize),t.paginationModel??t.initialState?.pagination?.paginationModel);oF(n.pageSize,t.signature);const r=t.rowCount??t.initialState?.pagination?.rowCount??("client"===t.paginationMode?e.rows?.totalRowCount:void 0),o=t.paginationMeta??t.initialState?.pagination?.meta??{};return f({},e,{pagination:f({},e.pagination,{paginationModel:n,rowCount:r,meta:o,enabled:!0===t.pagination,paginationMode:t.paginationMode})})},WB=(e,t)=>{((e,t)=>{const n=bL(e,"useGridPaginationMeta");e.current.registerControlState({stateId:"paginationMeta",propModel:t.paginationMeta,propOnChange:t.onPaginationMetaChange,stateSelector:cF,changeEvent:"paginationMetaChange"});const r=s.useCallback(t=>{cF(e)!==t&&(n.debug("Setting 'paginationMeta' to",t),e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{meta:t})})))},[e,n]);vL(e,{setPaginationMeta:r},"public");const o=s.useCallback((n,r)=>{const o=cF(e);return r.exportOnlyDirtyModels&&null==t.paginationMeta&&null==t.initialState?.pagination?.meta?n:f({},n,{pagination:f({},n.pagination,{meta:o})})},[e,t.paginationMeta,t.initialState?.pagination?.meta]),i=s.useCallback((t,n)=>{const r=n.stateToRestore.pagination?.meta?n.stateToRestore.pagination.meta:cF(e);return e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{meta:r})})),t},[e]);pN(e,"exportState",o),pN(e,"restoreState",i),s.useEffect(()=>{t.paginationMeta&&e.current.setPaginationMeta(t.paginationMeta)},[e,t.paginationMeta])})(e,t),((e,t)=>{const n=bL(e,"useGridPaginationModel"),r=pI(e,mI),o=s.useRef(yD(e)),i=Math.floor(t.rowHeight*r);e.current.registerControlState({stateId:"paginationModel",propModel:t.paginationModel,propOnChange:t.onPaginationModelChange,stateSelector:lF,changeEvent:"paginationModelChange"});const a=s.useCallback(t=>{const r=lF(e);t!==r.page&&(n.debug(`Setting page to ${t}`),e.current.setPaginationModel({page:t,pageSize:r.pageSize}))},[e,n]),l=s.useMemo(()=>Cg(a,0),[a]),c=s.useCallback(t=>{const r=lF(e);t!==r.pageSize&&(n.debug(`Setting page size to ${t}`),e.current.setPaginationModel({pageSize:t,page:r.page}))},[e,n]),u=s.useCallback(r=>{const o=lF(e);r!==o&&(n.debug("Setting 'paginationModel' to",r),e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,t.signature,r)})}),"setPaginationModel"))},[e,n,t.signature]);vL(e,{setPage:a,setPageSize:c,setPaginationModel:u},"public");const d=s.useCallback((n,r)=>{const o=lF(e);return!r.exportOnlyDirtyModels||null!=t.paginationModel||null!=t.initialState?.pagination?.paginationModel||0!==o.page&&o.pageSize!==(t.autoPageSize?0:100)?f({},n,{pagination:f({},n.pagination,{paginationModel:o})}):n},[e,t.paginationModel,t.initialState?.pagination?.paginationModel,t.autoPageSize]),p=s.useCallback((n,r)=>{const o=r.stateToRestore.pagination?.paginationModel?f({},rF(t.autoPageSize),r.stateToRestore.pagination?.paginationModel):lF(e);return e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,t.signature,o)})}),"stateRestorePreProcessing"),n},[e,t.autoPageSize,t.signature]);pN(e,"exportState",d),pN(e,"restoreState",p);const h=s.useCallback(()=>{if(!t.autoPageSize)return;const n=e.current.getRootDimensions(),r=Math.max(1,Math.floor(n.viewportInnerSize.height/i));e.current.setPageSize(r)},[e,t.autoPageSize,i]),m=s.useCallback(t=>{if(null==t)return;const n=lF(e);if(0===n.page)return;const r=pF(e);n.page>r-1&&queueMicrotask(()=>{l(Math.max(0,r-1))})},[e,l]),g=s.useCallback(()=>{0!==lF(e).page&&l(0),0!==e.current.getScrollPosition().top&&e.current.scroll({top:0})},[e,l]),v=s.useMemo(()=>Cg(g,0),[g]),b=s.useCallback(t=>{const n=f({},t,{items:OD(e)});JL(n,o.current)||(o.current=n,v())},[e,v]);rI(e,"viewportInnerSizeChange",h),rI(e,"paginationModelChange",()=>{const t=lF(e);e.current.virtualScrollerRef?.current&&e.current.scrollToIndexes({rowIndex:t.page*t.pageSize})}),rI(e,"rowCountChange",m),rI(e,"sortModelChange",v),rI(e,"filterModelChange",b);const y=s.useRef(!0);s.useEffect(()=>{y.current?y.current=!1:t.pagination&&e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,t.signature,t.paginationModel)})}))},[e,t.paginationModel,t.signature,t.pagination]),s.useEffect(()=>{e.current.setState(e=>{const n=!0===t.pagination;return e.pagination.paginationMode===t.paginationMode&&e.pagination.enabled===n?e:f({},e,{pagination:f({},e.pagination,{paginationMode:t.paginationMode,enabled:n})})})},[e,t.paginationMode,t.pagination]),s.useEffect(h,[h])})(e,t),((e,t)=>{const n=bL(e,"useGridRowCount"),r=Dg(()=>lF(e).pageSize);e.current.registerControlState({stateId:"paginationRowCount",propModel:t.rowCount,propOnChange:t.onRowCountChange,stateSelector:sF,changeEvent:"rowCountChange"});const o=s.useCallback(t=>{sF(e)!==t&&(n.debug("Setting 'rowCount' to",t),e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{rowCount:t})})))},[e,n]);vL(e,{setRowCount:o},"public");const i=s.useCallback((n,r)=>{const o=sF(e);return r.exportOnlyDirtyModels&&null==t.rowCount&&null==t.initialState?.pagination?.rowCount?n:f({},n,{pagination:f({},n.pagination,{rowCount:o})})},[e,t.rowCount,t.initialState?.pagination?.rowCount]),a=s.useCallback((t,n)=>{const r=n.stateToRestore.pagination?.rowCount?n.stateToRestore.pagination.rowCount:sF(e);return e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{rowCount:r})})),t},[e]);pN(e,"exportState",i),pN(e,"restoreState",a);const l=s.useCallback(n=>{"client"!==t.paginationMode&&r.current&&n.pageSize!==r.current&&(r.current=n.pageSize,-1===sF(e)&&e.current.setPage(0))},[t.paginationMode,r,e]);rI(e,"paginationModelChange",l),s.useEffect(()=>{"server"===t.paginationMode&&null!=t.rowCount&&e.current.setRowCount(t.rowCount)},[e,t.paginationMode,t.rowCount]),QM(e.current.store,()=>!(!1!==cF(e).hasNextPage)||("client"===t.paginationMode?TD(e):void 0),(t,n)=>{if(!0===n&&-1!==sF(e)){const t=TD(e),n=lF(e);e.current.setRowCount(n.pageSize*n.page+t)}else"number"==typeof n&&e.current.setRowCount(n)}),s.useEffect(()=>{"client"===t.paginationMode&&e.current.setRowCount(TD(e))},[e,t.paginationMode])})(e,t)},UB=(e,t)=>f({},e,{preferencePanel:t.initialState?.preferencePanel??{open:!1}}),GB=e=>{switch(e.type){case"boolean":return!1;case"date":case"dateTime":case"number":return;case"singleSelect":return null;default:return""}},KB=["id","field"],qB=["id","field"],YB=["id"],XB=["id"],QB=e=>f({},e,{editRows:{}}),ZB=(e,t,n)=>{((e,t)=>{const[n,r]=s.useState({}),o=s.useRef(n),i=s.useRef({}),{processRowUpdate:a,onProcessRowUpdateError:l,cellModesModel:c,onCellModesModelChange:u}=t,p=e=>(...n)=>{t.editMode===$I.Cell&&e(...n)},h=s.useCallback((t,n)=>{const r=e.current.getCellParams(t,n);if(!e.current.isCellEditable(r))throw new Error(`MUI X: The cell with id=${t} and field=${n} is not editable.`)},[e]),m=s.useCallback((t,n,r)=>{if(e.current.getCellMode(t,n)!==r)throw new Error(`MUI X: The cell with id=${t} and field=${n} is not in ${r} mode.`)},[e]),g=s.useCallback((t,n)=>{if(!t.isEditable)return;if(t.cellMode===zI.Edit)return;const r=f({},t,{reason:WI.cellDoubleClick});e.current.publishEvent("cellEditStart",r,n)},[e]),v=s.useCallback((t,n)=>{if(t.cellMode===zI.View)return;if(e.current.getCellMode(t.id,t.field)===zI.View)return;const r=f({},t,{reason:UI.cellFocusOut});e.current.publishEvent("cellEditStop",r,n)},[e]),b=s.useCallback((t,n)=>{if(t.cellMode===zI.Edit){if(229===n.which)return;let r;if("Escape"===n.key?r=UI.escapeKeyDown:"Enter"===n.key?r=UI.enterKeyDown:"Tab"===n.key&&(r=n.shiftKey?UI.shiftTabKeyDown:UI.tabKeyDown,n.preventDefault()),r){const o=f({},t,{reason:r});e.current.publishEvent("cellEditStop",o,n)}}else if(t.isEditable){let r;if(!e.current.unstable_applyPipeProcessors("canStartEditing",!0,{event:n,cellParams:t,editMode:"cell"}))return;if(LO(n)?r=WI.printableKeyDown:$O(n)?r=WI.pasteKeyDown:"Enter"===n.key?r=WI.enterKeyDown:"Backspace"!==n.key&&"Delete"!==n.key||(r=WI.deleteKeyDown),r){const o=f({},t,{reason:r,key:n.key});e.current.publishEvent("cellEditStart",o,n)}}},[e]),y=s.useCallback(t=>{const{id:n,field:r,reason:o}=t,i={id:n,field:r};o!==WI.printableKeyDown&&o!==WI.deleteKeyDown&&o!==WI.pasteKeyDown||(i.deleteValue=!0),e.current.startCellEditMode(i)},[e]),w=s.useCallback(t=>{const{id:n,field:r,reason:o}=t;let i;e.current.runPendingEditCellValueMutation(n,r),o===UI.enterKeyDown?i="below":o===UI.tabKeyDown?i="right":o===UI.shiftTabKeyDown&&(i="left");const a="escapeKeyDown"===o;e.current.stopCellEditMode({id:n,field:r,ignoreModifications:a,cellToFocusAfter:i})},[e]);var x;rI(e,"cellDoubleClick",p(g)),rI(e,"cellFocusOut",p(v)),rI(e,"cellKeyDown",p(b)),rI(e,"cellEditStart",p(y)),rI(e,"cellEditStop",p(w)),iI(e,"cellEditStart",t.onCellEditStart),iI(e,"cellEditStop",(x=t.onCellEditStop,async(...t)=>{if(x){const{id:n,field:r}=t[0],o=e.current.state.editRows,i=o[n][r]?.error;i||x(...t)}}));const S=s.useCallback((t,n)=>{const r=WL(e);return r[t]&&r[t][n]?zI.Edit:zI.View},[e]),C=Mg(n=>{const i=n!==t.cellModesModel;u&&i&&u(n,{api:e.current}),t.cellModesModel&&i||(r(n),o.current=n,e.current.publishEvent("cellModesModelChange",n))}),k=s.useCallback((e,t,n)=>{const r=f({},o.current);if(null!==n)r[e]=f({},r[e],{[t]:f({},n)});else{const n=d(r[e],[t].map(T));r[e]=n,0===Object.keys(r[e]).length&&delete r[e]}C(r)},[C]),E=s.useCallback((t,n,r)=>{e.current.setState(e=>{const o=f({},e.editRows);return null!==r?o[t]=f({},o[t],{[n]:f({},r)}):(delete o[t][n],0===Object.keys(o[t]).length&&delete o[t]),f({},e,{editRows:o})})},[e]),R=s.useCallback(e=>{const{id:t,field:n}=e,r=d(e,KB);h(t,n),m(t,n,zI.View),k(t,n,f({mode:zI.Edit},r))},[h,m,k]),P=Mg(async t=>{const{id:n,field:r,deleteValue:o,initialValue:i}=t,a=e.current.getCellValue(n,r);let l=a;o?l=GB(e.current.getColumn(r)):i&&(l=i);const s=e.current.getColumn(r),c=!!s.preProcessEditCellProps&&o;let u={value:l,error:!1,isProcessingProps:c};if(E(n,r,u),e.current.setCellFocus(n,r),c&&(u=await Promise.resolve(s.preProcessEditCellProps({id:n,row:e.current.getRow(n),props:u,hasChanged:l!==a})),e.current.getCellMode(n,r)===zI.Edit)){const t=WL(e);E(n,r,f({},u,{value:t[n][r].value,isProcessingProps:!1}))}}),M=s.useCallback(e=>{const{id:t,field:n}=e,r=d(e,qB);m(t,n,zI.Edit),k(t,n,f({mode:zI.View},r))},[m,k]),I=Mg(async n=>{const{id:r,field:o,ignoreModifications:s,cellToFocusAfter:c="none"}=n;m(r,o,zI.Edit),e.current.runPendingEditCellValueMutation(r,o);const u=()=>{E(r,o,null),k(r,o,null),"none"!==c&&e.current.moveFocusToRelativeCell(r,o,c)};if(s)return void u();const d=WL(e),{error:p,isProcessingProps:f}=d[r][o],h=e.current.getRow(r);if(p||f)return i.current[r][o].mode=zI.Edit,void k(r,o,{mode:zI.Edit});const g=e.current.getRowWithUpdatedValuesFromCellEditing(r,o);if(t.dataSource?.updateRow){if(JL(h,g))return void u();const t=()=>{i.current[r][o].mode=zI.Edit,k(r,o,{mode:zI.Edit})},n={rowId:r,updatedRow:g,previousRow:h};try{await e.current.dataSource.editRow(n),u()}catch{t()}}else if(a){const t=e=>{i.current[r][o].mode=zI.Edit,k(r,o,{mode:zI.Edit}),l&&l(e)};try{Promise.resolve(a(g,h,{rowId:r})).then(t=>{e.current.updateRows([t]),u()}).catch(t)}catch(e){t(e)}}else e.current.updateRows([g]),u()}),O=s.useCallback(async t=>{const{id:n,field:r,value:o,debounceMs:i,unstable_skipValueParser:a}=t;h(n,r),m(n,r,zI.Edit);const l=e.current.getColumn(r),s=e.current.getRow(n);let c=o;l.valueParser&&!a&&(c=l.valueParser(o,s,l,e));let u=WL(e),d=f({},u[n][r],{value:c,changeReason:i?"debouncedSetEditCellValue":"setEditCellValue"});if(l.preProcessEditCellProps){const e=o!==u[n][r].value;d=f({},d,{isProcessingProps:!0}),E(n,r,d),d=await Promise.resolve(l.preProcessEditCellProps({id:n,row:s,props:d,hasChanged:e}))}return e.current.getCellMode(n,r)!==zI.View&&(u=WL(e),d=f({},d,{isProcessingProps:!1}),d.value=l.preProcessEditCellProps?u[n][r].value:c,E(n,r,d),u=WL(e),!u[n]?.[r]?.error)},[e,h,m,E]),D=s.useCallback((t,n)=>{const r=e.current.getColumn(n),o=WL(e),i=e.current.getRow(t);if(!o[t]||!o[t][n])return e.current.getRow(t);const{value:a}=o[t][n];return r.valueSetter?r.valueSetter(a,i,r,e):f({},i,{[n]:a})},[e]),F={setCellEditingEditCellValue:O,getRowWithUpdatedValuesFromCellEditing:D};vL(e,{getCellMode:S,startCellEditMode:R,stopCellEditMode:M},"public"),vL(e,F,"private"),s.useEffect(()=>{c&&C(c)},[c,C]),Wh(()=>{const t=wT(e),r=i.current;i.current=LI(n),Object.entries(n).forEach(([n,o])=>{Object.entries(o).forEach(([o,i])=>{const a=r[n]?.[o]?.mode||zI.View,l=t[n]?e.current.getRowId(t[n]):n;i.mode===zI.Edit&&a===zI.View?P(f({id:l,field:o},i)):i.mode===zI.View&&a===zI.Edit&&I(f({id:l,field:o},i))})})},[e,n,P,I])})(e,t),((e,t)=>{const[n,r]=s.useState({}),o=s.useRef(n),i=s.useRef({}),a=s.useRef({}),l=s.useRef(void 0),c=s.useRef(null),{processRowUpdate:u,onProcessRowUpdateError:p,rowModesModel:h,onRowModesModelChange:m}=t,g=e=>(...n)=>{t.editMode===$I.Row&&e(...n)},v=s.useCallback((t,n)=>{const r=e.current.getCellParams(t,n);if(!e.current.isCellEditable(r))throw new Error(`MUI X: The cell with id=${t} and field=${n} is not editable.`)},[e]),b=s.useCallback((t,n)=>{if(e.current.getRowMode(t)!==n)throw new Error(`MUI X: The row with id=${t} is not in ${n} mode.`)},[e]),y=s.useCallback(t=>{const n=WL(e);return Object.values(n[t]).some(e=>e.error)},[e]),w=s.useCallback((t,n)=>{if(!t.isEditable)return;if(e.current.getRowMode(t.id)===jI.Edit)return;const r=f({},e.current.getRowParams(t.id),{field:t.field,reason:GI.cellDoubleClick});e.current.publishEvent("rowEditStart",r,n)},[e]),x=s.useCallback(e=>{c.current=e},[]),S=s.useCallback((t,n)=>{t.isEditable&&e.current.getRowMode(t.id)!==jI.View&&(c.current=null,l.current=setTimeout(()=>{if(c.current?.id!==t.id){if(!e.current.getRow(t.id))return;if(e.current.getRowMode(t.id)===jI.View)return;if(y(t.id))return;const r=f({},e.current.getRowParams(t.id),{field:t.field,reason:KI.rowFocusOut});e.current.publishEvent("rowEditStop",r,n)}}))},[e,y]);s.useEffect(()=>()=>{clearTimeout(l.current)},[]);const C=s.useCallback((t,n)=>{if(t.cellMode===jI.Edit){if(229===n.which)return;let r;if("Escape"===n.key)r=KI.escapeKeyDown;else if("Enter"===n.key)r=KI.enterKeyDown;else if("Tab"===n.key){const o=uO(e).filter(n=>e.current.getColumn(n).type===ZO||e.current.isCellEditable(e.current.getCellParams(t.id,n)));if(n.shiftKey?t.field===o[0]&&(r=KI.shiftTabKeyDown):t.field===o[o.length-1]&&(r=KI.tabKeyDown),n.preventDefault(),!r){const r=o.findIndex(e=>e===t.field),i=o[n.shiftKey?r-1:r+1];e.current.setCellFocus(t.id,i)}}if(r){if(r!==KI.escapeKeyDown&&y(t.id))return;const o=f({},e.current.getRowParams(t.id),{reason:r,field:t.field});e.current.publishEvent("rowEditStop",o,n)}}else if(t.isEditable){let r;if(!e.current.unstable_applyPipeProcessors("canStartEditing",!0,{event:n,cellParams:t,editMode:"row"}))return;if(LO(n)||$O(n)?r=GI.printableKeyDown:"Enter"===n.key?r=GI.enterKeyDown:"Backspace"!==n.key&&"Delete"!==n.key||(r=GI.deleteKeyDown),r){const o=f({},e.current.getRowParams(t.id),{field:t.field,reason:r});e.current.publishEvent("rowEditStart",o,n)}}},[e,y]),k=s.useCallback(t=>{const{id:n,field:r,reason:o}=t,i={id:n,fieldToFocus:r};o!==GI.printableKeyDown&&o!==GI.deleteKeyDown||(i.deleteValue=!!r),e.current.startRowEditMode(i)},[e]),E=s.useCallback(t=>{const{id:n,reason:r,field:o}=t;let i;e.current.runPendingEditCellValueMutation(n),r===KI.enterKeyDown?i="below":r===KI.tabKeyDown?i="right":r===KI.shiftTabKeyDown&&(i="left");const a="escapeKeyDown"===r;e.current.stopRowEditMode({id:n,ignoreModifications:a,field:o,cellToFocusAfter:i})},[e]);rI(e,"cellDoubleClick",g(w)),rI(e,"cellFocusIn",g(x)),rI(e,"cellFocusOut",g(S)),rI(e,"cellKeyDown",g(C)),rI(e,"rowEditStart",g(k)),rI(e,"rowEditStop",g(E)),iI(e,"rowEditStart",t.onRowEditStart),iI(e,"rowEditStop",t.onRowEditStop);const R=s.useCallback(n=>UL(e,{rowId:n,editMode:t.editMode})?jI.Edit:jI.View,[e,t.editMode]),P=Mg(n=>{const i=n!==t.rowModesModel;m&&i&&m(n,{api:e.current}),t.rowModesModel&&i||(r(n),o.current=n,e.current.publishEvent("rowModesModelChange",n))}),M=s.useCallback((e,t)=>{const n=f({},o.current);null!==t?n[e]=f({},t):delete n[e],P(n)},[P]),I=s.useCallback((t,n)=>{e.current.setState(e=>{const r=f({},e.editRows);return null!==n?r[t]=n:delete r[t],f({},e,{editRows:r})})},[e]),O=s.useCallback((t,n,r)=>{e.current.setState(e=>{const o=f({},e.editRows);return null!==r?o[t]=f({},o[t],{[n]:f({},r)}):(delete o[t][n],0===Object.keys(o[t]).length&&delete o[t]),f({},e,{editRows:o})})},[e]),D=s.useCallback(e=>{const{id:t}=e,n=d(e,YB);b(t,jI.View),M(t,f({mode:jI.Edit},n))},[b,M]),F=Mg(t=>{const{id:n,fieldToFocus:r,deleteValue:o,initialValue:i}=t,l=e.current.getRow(n),s=aO(e),c=s.reduce((t,a)=>{const l=a.field;if(!e.current.getCellParams(n,l).isEditable)return t;const s=e.current.getColumn(l);let c=e.current.getCellValue(n,l);return r===l&&(o||i)&&(o?c=GB(s):i&&(c=i)),t[l]={value:c,error:!1,isProcessingProps:s.editable&&!!s.preProcessEditCellProps&&o},t},{});a.current[n]=l,I(n,c),r&&e.current.setCellFocus(n,r),s.filter(t=>e.current.getCellParams(n,t.field).isEditable&&t.editable&&!!t.preProcessEditCellProps&&o).forEach(t=>{const r=t.field,a=e.current.getCellValue(n,r),s=o?GB(t):i??a;Promise.resolve(t.preProcessEditCellProps({id:n,row:l,props:c[r],hasChanged:s!==a})).then(t=>{if(e.current.getRowMode(n)===jI.Edit){const o=WL(e);O(n,r,f({},t,{value:o[n][r].value,isProcessingProps:!1}))}})})}),L=s.useCallback(e=>{const{id:t}=e,n=d(e,XB);b(t,jI.Edit),M(t,f({mode:jI.View},n))},[b,M]),A=Mg(async n=>{const{id:r,ignoreModifications:o,field:l,cellToFocusAfter:s="none"}=n;e.current.runPendingEditCellValueMutation(r);const c=()=>{"none"!==s&&l&&e.current.moveFocusToRelativeCell(r,l,s),I(r,null),M(r,null),delete a.current[r]};if(o)return void c();const d=WL(e),f=a.current[r];if(Object.values(d[r]).some(e=>e.isProcessingProps))return void(i.current[r].mode=jI.Edit);if(y(r))return i.current[r].mode=jI.Edit,void M(r,{mode:jI.Edit});const h=e.current.getRowWithUpdatedValuesFromRowEditing(r);if(t.dataSource?.updateRow){if(JL(f,h))return void c();const t=()=>{i.current[r].mode=jI.Edit,M(r,{mode:jI.Edit})},n={rowId:r,updatedRow:h,previousRow:f};try{await e.current.dataSource.editRow(n),c()}catch{t()}}else if(u){const t=e=>{i.current[r]&&(i.current[r].mode=jI.Edit,M(r,{mode:jI.Edit})),p&&p(e)};try{Promise.resolve(u(h,f,{rowId:r})).then(t=>{e.current.updateRows([t]),c()}).catch(t)}catch(e){t(e)}}else e.current.updateRows([h]),c()}),N=s.useCallback(t=>{const{id:n,field:r,value:o,debounceMs:i,unstable_skipValueParser:a}=t;v(n,r);const l=e.current.getColumn(r),s=e.current.getRow(n);let c=o;l.valueParser&&!a&&(c=l.valueParser(o,s,l,e));let u=WL(e),p=f({},u[n][r],{value:c,changeReason:i?"debouncedSetEditCellValue":"setEditCellValue"});return l.preProcessEditCellProps||O(n,r,p),new Promise(t=>{const o=[];if(l.preProcessEditCellProps){const i=p.value!==u[n][r].value;p=f({},p,{isProcessingProps:!0}),O(n,r,p);const a=d(u[n],[r].map(T)),h=Promise.resolve(l.preProcessEditCellProps({id:n,row:s,props:p,hasChanged:i,otherFieldsProps:a})).then(o=>{e.current.getRowMode(n)!==jI.View?(u=WL(e),(o=f({},o,{isProcessingProps:!1})).value=l.preProcessEditCellProps?u[n][r].value:c,O(n,r,o)):t(!1)});o.push(h)}Object.entries(u[n]).forEach(([i,a])=>{if(i===r)return;const l=e.current.getColumn(i);if(!l.preProcessEditCellProps)return;a=f({},a,{isProcessingProps:!0}),O(n,i,a),u=WL(e);const c=d(u[n],[i].map(T)),p=Promise.resolve(l.preProcessEditCellProps({id:n,row:s,props:a,hasChanged:!1,otherFieldsProps:c})).then(r=>{e.current.getRowMode(n)!==jI.View?(r=f({},r,{isProcessingProps:!1}),O(n,i,r)):t(!1)});o.push(p)}),Promise.all(o).then(()=>{e.current.getRowMode(n)===jI.Edit?(u=WL(e),t(!u[n][r].error)):t(!1)})})},[e,v,O]),$=s.useCallback(t=>{const n=WL(e),r=e.current.getRow(t);if(!n[t])return e.current.getRow(t);let o=f({},a.current[t],r);return Object.entries(n[t]).forEach(([t,n])=>{const r=e.current.getColumn(t);r?.valueSetter?o=r.valueSetter(n.value,o,r,e):o[t]=n.value}),o},[e]),z={setRowEditingEditCellValue:N,getRowWithUpdatedValuesFromRowEditing:$};vL(e,{getRowMode:R,startRowEditMode:D,stopRowEditMode:L},"public"),vL(e,z,"private"),s.useEffect(()=>{h&&P(h)},[h,P]),Wh(()=>{const t=wT(e),r=i.current;i.current=LI(n);const o=new Set([...Object.keys(n),...Object.keys(r)]);Array.from(o).forEach(o=>{const i=n[o]??{mode:jI.View},a=r[o]?.mode||jI.View,l=t[o]?e.current.getRowId(t[o]):o;i.mode===jI.Edit&&a===jI.View?F(f({id:l},i)):i.mode===jI.View&&a===jI.Edit&&A(f({id:l},i))})},[e,n,F,A])})(e,t);const r=s.useRef({}),{isCellEditable:o}=t,i=n.hooks.useIsCellEditable(e,t),a=s.useCallback(e=>!!i(e)&&(!!e.colDef.editable&&(!!e.colDef.renderEditCell&&(!o||o(e)))),[o,i]);s.useEffect(()=>{const e=r.current;return()=>{Object.entries(e).forEach(([t,n])=>{Object.keys(n).forEach(n=>{const[r]=e[t][n];clearTimeout(r),delete e[t][n]})})}},[]);const l=s.useCallback((e,t)=>{if(r.current[e])if(t){if(r.current[e][t]){const[,n]=r.current[e][t];n()}}else Object.keys(r.current[e]).forEach(t=>{const[,n]=r.current[e][t];n()})},[]),c=s.useCallback(n=>{const{id:o,field:i,debounceMs:a}=n;return new Promise(l=>{((e,t,n,o)=>{if(!n)return void o();if(r.current[e]||(r.current[e]={}),r.current[e][t]){const[n]=r.current[e][t];clearTimeout(n)}const i=setTimeout(()=>{o(),delete r.current[e][t]},n);r.current[e][t]=[i,()=>{const[n]=r.current[e][t];clearTimeout(n),o(),delete r.current[e][t]}]})(o,i,a,async()=>{const r=t.editMode===$I.Row?e.current.setRowEditingEditCellValue:e.current.setCellEditingEditCellValue;if(e.current.getCellMode(o,i)===zI.Edit){const e=await r(n);l(e)}})})},[e,t.editMode]),u=s.useCallback((n,r)=>t.editMode===$I.Cell?e.current.getRowWithUpdatedValuesFromCellEditing(n,r):e.current.getRowWithUpdatedValuesFromRowEditing(n),[e,t.editMode]),p=s.useCallback((t,n)=>{const r=WL(e);return r[t]?.[n]??null},[e]),h={runPendingEditCellValueMutation:l};vL(e,{isCellEditable:a,setEditCellValue:c,getRowWithUpdatedValues:u,unstable_getEditCellMeta:p},"public"),vL(e,h,"private")},JB=(e,t,n)=>{const r=!!t.dataSource;return n.current.caches.rows=AT({rows:r?[]:t.rows,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),f({},e,{rows:$T({apiRef:n,rowCountProp:t.rowCount,loadingProp:!!r||t.loading,previousTree:null,previousTreeDepths:null})})},e_=e=>"full"===e.updates.type?(e=>{const t={[OT]:f({},{type:"group",id:OT,depth:-1,groupingField:null,groupingKey:null,isAutoGenerated:!0,children:[],childrenFromPath:{},childrenExpanded:!0,parent:null},{children:e})};for(let n=0;n<e.length;n+=1){const r=e[n];t[r]={id:r,depth:0,parent:OT,type:"leaf",groupingKey:null}}return{groupingName:hB,tree:t,treeDepths:{0:e.length},dataRowIds:e}})(e.updates.rows):(({previousTree:e,actions:t})=>{const n=f({},e),r={};for(let e=0;e<t.remove.length;e+=1){const o=t.remove[e];r[o]=!0,delete n[o]}for(let e=0;e<t.insert.length;e+=1){const r=t.insert[e];n[r]={id:r,depth:0,parent:OT,type:"leaf",groupingKey:null}}const o=n[OT];let i=[...o.children,...t.insert];return Object.values(r).length&&(i=i.filter(e=>!r[e])),n[OT]=f({},o,{children:i}),{groupingName:hB,tree:n,treeDepths:{0:i.length},dataRowIds:i}})({previousTree:e.previousTree,actions:e.updates.actions});class t_ extends Error{}function n_(e,t,n){const r=s.useCallback(t=>({field:t,colDef:e.current.getColumn(t)}),[e]),o=s.useCallback(t=>{const n=e.current.getRow(t);if(!n)throw new t_(`No row with id #${t} found`);return{id:t,columns:e.current.getAllColumns(),row:n}},[e]),i=s.useCallback((t,n,r,{cellMode:o,colDef:i,hasFocus:a,rowNode:l,tabIndex:s,value:c,formattedValue:u})=>{const d={id:t,field:n,row:r,rowNode:l,colDef:i,cellMode:o,hasFocus:a,tabIndex:s,value:void 0!==c?c:e.current.getRowValue(r,i),formattedValue:void 0!==u?u:e.current.getRowFormattedValue(r,i),isEditable:!1,api:e.current};return d.isEditable=i&&e.current.isCellEditable(d),d},[e]),a=s.useCallback((n,r)=>{const o=e.current.getRow(n),i=ST(e,n);if(!o||!i)throw new t_(`No row with id #${n} found`);const a=YD(e),l=JD(e),s=e.current.getCellMode(n,r);return e.current.getCellParamsForRow(n,r,o,{colDef:t.listView&&t.listViewColumn?.field===r?nO(e):e.current.getColumn(r),rowNode:i,hasFocus:null!==a&&a.field===r&&a.id===n,tabIndex:l&&l.field===r&&l.id===n?0:-1,cellMode:s})},[e,t.listView,t.listViewColumn?.field]),l=s.useCallback(t=>e.current.rootElementRef.current?function(e,t){return e.querySelector(`[role="columnheader"][data-field="${m$(t)}"]`)}(e.current.rootElementRef.current,t):null,[e]),c=s.useCallback(t=>e.current.rootElementRef.current?function(e,t){return e.querySelector(g$(t))}(e.current.rootElementRef.current,t):null,[e]),u=s.useCallback((t,n)=>e.current.rootElementRef.current?function(e,{id:t,field:n}){const r=`${g$(t)} .${XT.cell}[data-field="${m$(n)}"]`;return e.querySelector(r)}(e.current.rootElementRef.current,{id:t,field:n}):null,[e]),d=n.hooks.useGridParamsOverridableMethods(e),p={getCellValue:d.getCellValue,getCellParams:a,getCellElement:u,getRowValue:d.getRowValue,getRowFormattedValue:d.getRowFormattedValue,getRowParams:o,getRowElement:c,getColumnHeaderParams:r,getColumnHeaderElement:l},f={getCellParamsForRow:i};vL(e,p,"public"),vL(e,f,"private")}const r_={type:"include",ids:new Set},o_=(e,t)=>f({},e,{rowSelection:t.rowSelection?t.rowSelectionModel??r_:r_}),i_=(e,t)=>{const n=(e=>{const{classes:t}=e;return s.useMemo(()=>wm({cellCheckbox:["cellCheckbox"],columnHeaderCheckbox:["columnHeaderCheckbox"]},YT,t),[t])})({classes:t.classes}),r=s.useCallback(r=>{const o=f({},wF,{cellClassName:n.cellCheckbox,headerClassName:n.columnHeaderCheckbox,headerName:e.current.getLocaleText("checkboxSelectionHeaderName")}),i=t.checkboxSelection,a=null!=r.lookup[yF];return i&&!a?(r.lookup[yF]=o,r.orderedFields=[yF,...r.orderedFields]):!i&&a?(delete r.lookup[yF],r.orderedFields=r.orderedFields.filter(e=>e!==yF)):i&&a&&(r.lookup[yF]=f({},o,r.lookup[yF]),t.columns.some(e=>e.field===yF)||(r.orderedFields=[yF,...r.orderedFields.filter(e=>e!==yF)])),r},[e,n,t.columns,t.checkboxSelection]);pN(e,"hydrateColumns",r)},a_=(e,t)=>{const n=t.sortModel??t.initialState?.sorting?.sortModel??[];return f({},e,{sorting:{sortModel:wI(n,t.disableMultipleColumnsSorting),sortedRows:[]}})};function l_(e){const{containerSize:t,scrollPosition:n,elementSize:r,elementOffset:o}=e,i=o+r;return r>t?o:i-t>n?i-t:o<n?o:void 0}const s_={width:0,height:0},c_={isReady:!1,root:s_,viewportOuterSize:s_,viewportInnerSize:s_,contentSize:s_,minimumSize:s_,hasScrollX:!1,hasScrollY:!1,scrollbarSize:0,headerHeight:0,groupHeaderHeight:0,headerFilterHeight:0,rowWidth:0,rowHeight:0,columnsTotalWidth:0,leftPinnedWidth:0,rightPinnedWidth:0,headersTotalHeight:0,topContainerHeight:0,bottomContainerHeight:0,autoHeight:!1,minimalContentHeight:void 0},u_=(e,t,n)=>{const r=f({},c_,function(e,t,n,r){const o=WT(e.rowHeight,dN.rowHeight);return{rowHeight:Math.floor(o*n),headerHeight:Math.floor(e.columnHeaderHeight*n),groupHeaderHeight:Math.floor((e.columnGroupHeaderHeight??e.columnHeaderHeight)*n),headerFilterHeight:Math.floor((e.headerFilterHeight??e.columnHeaderHeight)*n),columnsTotalWidth:d_(t),headersTotalHeight:lL(t,e),leftPinnedWidth:r.left.reduce((e,t)=>e+t.computedWidth,0),rightPinnedWidth:r.right.reduce((e,t)=>e+t.computedWidth,0)}}(t,n,mI(n),pO(n)));return n.current.store.state.dimensions=r,f({},e,{dimensions:r})},d_=eT(cO,hO,(e,t)=>{const n=e.length;return 0===n?0:eA(t[n-1]+e[n-1].computedWidth,1)});function p_(e,t){const n=(t,n)=>e.style.setProperty(t,n);n("--DataGrid-hasScrollX",`${Number(t.hasScrollX)}`),n("--DataGrid-hasScrollY",`${Number(t.hasScrollY)}`),n("--DataGrid-scrollbarSize",`${t.scrollbarSize}px`),n("--DataGrid-rowWidth",`${t.rowWidth}px`),n("--DataGrid-columnsTotalWidth",`${t.columnsTotalWidth}px`),n("--DataGrid-leftPinnedWidth",`${t.leftPinnedWidth}px`),n("--DataGrid-rightPinnedWidth",`${t.rightPinnedWidth}px`),n("--DataGrid-headerHeight",`${t.headerHeight}px`),n("--DataGrid-headersTotalHeight",`${t.headersTotalHeight}px`),n("--DataGrid-topContainerHeight",`${t.topContainerHeight}px`),n("--DataGrid-bottomContainerHeight",`${t.bottomContainerHeight}px`),n("--height",`${t.rowHeight}px`)}const f_=["groupId","children"],h_=e=>{const t={};for(let n=0;n<e.length;n+=1){const r=e[n];if(qI(r))continue;const{groupId:o,children:i}=r,a=d(r,f_);if(!o)throw new Error("MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.");const l=f({},a,{groupId:o}),s=h_(i);if(void 0!==s[o]||void 0!==t[o])throw new Error(`MUI X: The groupId ${o} is used multiple times in the columnGroupingModel.`);Object.assign(t,s),t[o]=l}return t},m_=(e,t,n)=>{if(qI(e)){if(void 0!==n[e.field])throw new Error(["MUI X: columnGroupingModel contains duplicated field",`column field ${e.field} occurs two times in the grouping model:`,`- ${n[e.field].join(" > ")}`,`- ${t.join(" > ")}`].join("\n"));return void(n[e.field]=t)}const{groupId:r,children:o}=e;o.forEach(e=>{m_(e,[...t,r],n)})},g_=e=>{if(!e)return{};const t={};return e.forEach(e=>{m_(e,[],t)}),t},v_=(e,t,n)=>{const r=e=>t[e]??[],o=[],i=Math.max(0,...e.map(e=>r(e).length)),a=(e,t,n)=>{const o=r(e),i=r(t);for(let e=0;e<=n;e+=1)if(o[e]!==i[e])return!1;return!0},l=(e,t)=>{const r=n?.left,o=n?.right,i=!!r?.includes(e),a=!!r?.includes(t),l=!!o?.includes(e),s=!!o?.includes(t);return i!==a||l!==s};for(let t=0;t<i;t+=1){const n=[];for(let o=0;o<e.length;o+=1){const i=e[o],s=r(i)[t]??null;if(0===n.length){n.push({columnFields:[i],groupId:s});continue}const c=n[n.length-1],u=c.columnFields[c.columnFields.length-1];c.groupId!==s||!a(u,i,t)||l(u,i)?n.push({columnFields:[i],groupId:s}):c.columnFields.push(i)}o.push(n)}return o},b_=(e,t,n)=>{if(n.current.caches.columnGrouping={lastColumnGroupingModel:t.columnGroupingModel},!t.columnGroupingModel)return f({},e,{columnGrouping:void 0});const r=oO(n),o=uO(n),i=h_(t.columnGroupingModel??[]),a=g_(t.columnGroupingModel??[]),l=v_(r,a,n.current.state.pinnedColumns??{}),s=0===o.length?0:Math.max(...o.map(e=>a[e]?.length??0));return f({},e,{columnGrouping:{lookup:i,unwrappedGroupingModel:a,headerStructure:l,maxDepth:s}})};function y_(e,t){if(void 0!==t&&e.changedTouches){for(let n=0;n<e.changedTouches.length;n+=1){const r=e.changedTouches[n];if(r.identifier===t)return{x:r.clientX,y:r.clientY}}return!1}return{x:e.clientX,y:e.clientY}}function w_(e,t,n,r){let o=e;return o+="Right"===r?t-n.left:n.right-t,Math.round(o)}function x_(e,t){return t===ZI.LEFT?e?"--DataGrid-rightPinnedWidth":"--DataGrid-leftPinnedWidth":e?"--DataGrid-leftPinnedWidth":"--DataGrid-rightPinnedWidth"}function S_(e,t,n){return n===ZI.LEFT?t?e.rightPinnedWidth:e.leftPinnedWidth:t?e.leftPinnedWidth:e.rightPinnedWidth}function C_(e){e.preventDefault(),e.stopImmediatePropagation()}function k_(e){const t=s.useRef(void 0),n=()=>VA(e),r=pI(e,n);s.useEffect(()=>{t.current&&!1===r&&(t.current.resolve(),t.current=void 0)});return()=>{if(!t.current){if(!1===n())return Promise.resolve();t.current=function(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}()}return t.current}}function E_(e,t,n){const r={},o=e.current.rootElementRef.current;return o.classList.add(XT.autosizing),n.forEach(n=>{const o=function(e,t){const n=e.virtualScrollerRef.current;return Array.from(n.querySelectorAll(`:scope > div > div > div > [data-field="${m$(t)}"][role="gridcell"]`))}(e.current,n.field),i=o.map(e=>e.getBoundingClientRect().width??0),a=t.includeOutliers?i:function(e,t){if(e.length<4)return e;const n=e.slice();n.sort((e,t)=>e-t);const r=n[Math.floor(.25*n.length)],o=n[Math.floor(.75*n.length)-1],i=o-r,a=i<5?5:i*t;return n.filter(e=>e>r-a&&e<o+a)}(i,t.outliersFactor);if(t.includeHeaders){const t=(l=e.current,s=n.field,l.columnHeadersContainerRef.current.querySelector(`:scope > div > [data-field="${m$(s)}"][role="columnheader"]`));if(t){const e=t.querySelector(`.${XT.columnHeaderTitleContainer}`),n=Array.from(e.children),r=t.querySelector(`.${XT.menuIcon}`),o=window.getComputedStyle(e,null),i=parseInt(o.gap,10)||0,l=window.getComputedStyle(t,null),s=parseInt(l.paddingLeft,10)+parseInt(l.paddingRight,10);let c=0,u=0;for(let e=0;e<n.length;e+=1){const t=n[e];t.clientWidth>0&&(c+=1,u+=t.scrollWidth)}u+=1;const d=u+i*(c-1)+s+(r?.clientWidth??0);a.push(d)}}var l,s;const c=n.minWidth!==-1/0&&void 0!==n.minWidth,u=n.maxWidth!==1/0&&void 0!==n.maxWidth,d=c?n.minWidth:0,p=u?n.maxWidth:1/0,f=0===a.length?0:Math.max(...a);r[n.field]=FI(f,d,p)}),o.classList.remove(XT.autosizing),r}const R_=e=>f({},e,{columnResize:{resizingColumnField:""}});function P_(){return{colDef:void 0,initialColWidth:0,initialTotalWidth:0,previousMouseClickEvent:void 0,columnHeaderElement:void 0,headerFilterElement:void 0,groupHeaderElements:[],cellElements:[],leftPinnedCellsAfter:[],rightPinnedCellsBefore:[],fillerLeft:void 0,fillerRight:void 0,leftPinnedHeadersAfter:[],rightPinnedHeadersBefore:[]}}const M_=(e,t)=>{const n=um(),r=bL(e,"useGridColumnResize"),o=Dg(P_).current,i=s.useRef(null),a=s.useRef(null),l=Ng(),c=s.useRef(void 0),u=t=>{r.debug(`Updating width to ${t} for col ${o.colDef.field}`);const i=o.columnHeaderElement.offsetWidth,a=t-i,l=t-o.initialColWidth;if(l>0){const t=o.initialTotalWidth+l;e.current.rootElementRef?.current?.style.setProperty("--DataGrid-rowWidth",`${t}px`)}o.colDef.computedWidth=t,o.colDef.width=t,o.colDef.flex=0,o.columnHeaderElement.style.width=`${t}px`;const s=o.headerFilterElement;s&&(s.style.width=`${t}px`),o.groupHeaderElements.forEach(e=>{const n=e;let r;r="1"===n.getAttribute("aria-colspan")?`${t}px`:`${n.offsetWidth+a}px`,n.style.width=r}),o.cellElements.forEach(e=>{const n=e;let r;r="1"===n.getAttribute("aria-colspan")?`${t}px`:`${n.offsetWidth+a}px`,n.style.setProperty("--width",r)});const c=oT(e),u=e.current.unstable_applyPipeProcessors("isColumnPinned",!1,o.colDef.field);u===ZI.LEFT&&(T_(o.fillerLeft,"width",a),o.leftPinnedCellsAfter.forEach(e=>{T_(e,"left",a)}),o.leftPinnedHeadersAfter.forEach(e=>{T_(e,"left",a)}),e.current.rootElementRef?.current?.style.setProperty(x_(n,u),`${S_(c,n,u)+l}px`)),u===ZI.RIGHT&&(T_(o.fillerRight,"width",a),o.rightPinnedCellsBefore.forEach(e=>{T_(e,"right",a)}),o.rightPinnedHeadersBefore.forEach(e=>{T_(e,"right",a)}),e.current.rootElementRef?.current?.style.setProperty(x_(n,u),`${S_(c,n,u)+l}px`))},d=t=>{if(y(),o.previousMouseClickEvent){const n=o.previousMouseClickEvent,r=n.timeStamp,i=n.clientX,a=n.clientY;if(t.timeStamp-r<300&&t.clientX===i&&t.clientY===a)return o.previousMouseClickEvent=void 0,void e.current.publishEvent("columnResizeStop",null,t)}if(o.colDef){e.current.setColumnWidth(o.colDef.field,o.colDef.width),r.debug(`Updating col ${o.colDef.field} with new width: ${o.colDef.width}`);const t=rO(e);o.groupHeaderElements.forEach(e=>{const n=e,r=`${e.getAttribute("data-fields").slice(2,-2).split("-|-").reduce((e,n)=>!1!==t.columnVisibilityModel[n]?e+t.lookup[n].computedWidth:e,0)}px`;n.style.width=r})}l.start(0,()=>{e.current.publishEvent("columnResizeStop",null,t)})},p=(t,r,l)=>{const s=e.current.rootElementRef.current;var c,u;o.initialColWidth=t.computedWidth,o.initialTotalWidth=e.current.getRootDimensions().rowWidth,o.colDef=t,o.columnHeaderElement=(c=e.current.columnHeadersContainerRef.current,u=t.field,c.querySelector(`[data-field="${m$(u)}"]`));const d=s.querySelector(`.${XT.headerFilterRow} [data-field="${m$(t.field)}"]`);d&&(o.headerFilterElement=d),o.groupHeaderElements=function(e,t){return Array.from(e.querySelectorAll(`[data-fields*="|-${m$(t)}-|"]`)??[])}(e.current.columnHeadersContainerRef?.current,t.field),o.cellElements=function(e,t){if(!h$(e,XT.root))throw new Error("MUI X: The root element is not found.");const n=e.getAttribute("aria-colindex");if(!n)return[];const r=Number(n)-1,o=[];return t.virtualScrollerRef?.current?(x$(t).forEach(e=>{const n=e.getAttribute("data-id");if(!n)return;let i=r;const a=t.unstable_getCellColSpanInfo(n,r);a&&a.spannedByColSpan&&(i=a.leftVisibleCellIndex);const l=e.querySelector(`[data-colindex="${i}"]`);l&&o.push(l)}),o):[]}(o.columnHeaderElement,e.current),o.fillerLeft=b$(e.current,n?"filler--pinnedRight":"filler--pinnedLeft"),o.fillerRight=b$(e.current,n?"filler--pinnedLeft":"filler--pinnedRight");const p=e.current.unstable_applyPipeProcessors("isColumnPinned",!1,o.colDef.field);o.leftPinnedCellsAfter=p!==ZI.LEFT?[]:function(e,t,n){const r=S$(t);return y$({api:e,colIndex:r,position:n?"right":"left",filterFn:e=>n?e<r:e>r})}(e.current,o.columnHeaderElement,n),o.rightPinnedCellsBefore=p!==ZI.RIGHT?[]:function(e,t,n){const r=S$(t);return y$({api:e,colIndex:r,position:n?"left":"right",filterFn:e=>n?e>r:e<r})}(e.current,o.columnHeaderElement,n),o.leftPinnedHeadersAfter=p!==ZI.LEFT?[]:function(e,t,n){const r=S$(t);return w$({api:e,position:n?"right":"left",colIndex:r,filterFn:e=>n?e<r:e>r})}(e.current,o.columnHeaderElement,n),o.rightPinnedHeadersBefore=p!==ZI.RIGHT?[]:function(e,t,n){const r=S$(t);return w$({api:e,position:n?"left":"right",colIndex:r,filterFn:(e,t)=>!t.classList.contains(XT["columnHeader--last"])&&(n?e>r:e<r)})}(e.current,o.columnHeaderElement,n),a.current=function(e,t){const n=e.classList.contains(XT["columnSeparator--sideRight"])?"Right":"Left";return t?function(e){return"Right"===e?"Left":"Right"}(n):n}(r,n),i.current=function(e,t,n){return"Left"===n?e-t.left:t.right-e}(l,o.columnHeaderElement.getBoundingClientRect(),a.current)},h=Mg(d),m=Mg(t=>{if(0===t.buttons)return void h(t);let n=w_(i.current,t.clientX,o.columnHeaderElement.getBoundingClientRect(),a.current);n=FI(n,o.colDef.minWidth,o.colDef.maxWidth),u(n);const r={element:o.columnHeaderElement,colDef:o.colDef,width:n};e.current.publishEvent("columnResize",r,t)}),g=Mg(e=>{y_(e,c.current)&&d(e)}),v=Mg(t=>{const n=y_(t,c.current);if(!n)return;if("mousemove"===t.type&&0===t.buttons)return void g(t);let r=w_(i.current,n.x,o.columnHeaderElement.getBoundingClientRect(),a.current);r=FI(r,o.colDef.minWidth,o.colDef.maxWidth),u(r);const l={element:o.columnHeaderElement,colDef:o.colDef,width:r};e.current.publishEvent("columnResize",l,t)}),b=Mg(t=>{const n=h$(t.target,XT["columnSeparator--resizable"]);if(!n)return;const o=t.changedTouches[0];null!=o&&(c.current=o.identifier);const i=h$(t.target,XT.columnHeader),a=i.getAttribute("data-field");const l=e.current.getColumn(a);r.debug(`Start Resize on col ${l.field}`),e.current.publishEvent("columnResizeStart",{field:a},t),p(l,n,o.clientX);const s=kg(t.currentTarget);s.addEventListener("touchmove",v),s.addEventListener("touchend",g)}),y=s.useCallback(()=>{const t=kg(e.current.rootElementRef.current);t.body.style.removeProperty("cursor"),t.removeEventListener("mousemove",m),t.removeEventListener("mouseup",h),t.removeEventListener("touchmove",v),t.removeEventListener("touchend",g),setTimeout(()=>{t.removeEventListener("click",C_,!0)},100),o.columnHeaderElement&&(o.columnHeaderElement.style.pointerEvents="unset")},[e,o,m,h,v,g]),w=s.useCallback(({field:t})=>{e.current.setState(e=>f({},e,{columnResize:f({},e.columnResize,{resizingColumnField:t})}))},[e]),x=s.useCallback(()=>{e.current.setState(e=>f({},e,{columnResize:f({},e.columnResize,{resizingColumnField:""})}))},[e]),S=Mg(({colDef:t},n)=>{if(0!==n.button)return;if(!n.currentTarget.classList.contains(XT["columnSeparator--resizable"]))return;n.preventDefault(),r.debug(`Start Resize on col ${t.field}`),e.current.publishEvent("columnResizeStart",{field:t.field},n),p(t,n.currentTarget,n.clientX);const i=kg(e.current.rootElementRef.current);i.body.style.cursor="col-resize",o.previousMouseClickEvent=n.nativeEvent,i.addEventListener("mousemove",m),i.addEventListener("mouseup",h),i.addEventListener("click",C_,!0)}),C=Mg((n,r)=>{if(t.disableAutosize)return;if(0!==r.button)return;const o=e.current.state.columns.lookup[n.field];!1!==o.resizable&&e.current.autosizeColumns(f({},t.autosizeOptions,{disableColumnVirtualization:!1,columns:[o.field]}))}),k=k_(e),E=s.useRef(!1),R=s.useCallback(async n=>{const r=e.current.rootElementRef?.current;if(!r)return;if(E.current)return;E.current=!0;const o=rO(e),i=f({},VL,n,{columns:n?.columns??o.orderedFields});i.columns=i.columns.filter(e=>!1!==o.columnVisibilityModel[e]);const a=i.columns.map(t=>e.current.state.columns.lookup[t]);try{!t.disableVirtualization&&i.disableColumnVirtualization&&(e.current.unstable_setColumnVirtualization(!1),await k());const n=E_(e,i,a),r=a.map(e=>f({},e,{width:n[e.field],computedWidth:n[e.field],flex:0}));if(i.expand){const t=o.orderedFields.map(e=>o.lookup[e]).filter(e=>!1!==o.columnVisibilityModel[e.field]).reduce((e,t)=>e+(n[t.field]??t.computedWidth??t.width),0),i=e.current.getRootDimensions(),a=i.viewportInnerSize.width-t;if(a>0){const e=a/(r.length||1);r.forEach(t=>{t.width+=e,t.computedWidth+=e})}}e.current.updateColumns(r),r.forEach((t,n)=>{if(t.width!==a[n].width){const n=t.width;e.current.publishEvent("columnWidthChange",{element:e.current.getColumnHeaderElement(t.field),colDef:t,width:n})}})}finally{t.disableVirtualization||e.current.unstable_setColumnVirtualization(!0),E.current=!1}},[e,k,t.disableVirtualization]);s.useEffect(()=>y,[y]),Lg(()=>{t.autosizeOnMount&&Promise.resolve().then(()=>{e.current.autosizeColumns(t.autosizeOptions)})}),yL(e,()=>e.current.columnHeadersContainerRef?.current,"touchstart",b,{passive:!0}),vL(e,{autosizeColumns:R},"public"),rI(e,"columnResizeStop",x),rI(e,"columnResizeStart",w),rI(e,"columnSeparatorMouseDown",S),rI(e,"columnSeparatorDoubleClick",C),iI(e,"columnResize",t.onColumnResize),iI(e,"columnWidthChange",t.onColumnWidthChange)};function T_(e,t,n){e&&(e.style[t]=`${Math.round(parseFloat(e.style[t]))+n}px`)}function I_(e){return 0!==e.firstRowIndex||0!==e.lastRowIndex}const O_=(e,t,n)=>{if(!e)return null;const r=e[t.field];return t.rowSpanValueGetter?t.rowSpanValueGetter(r,e,t,n):LT(e,t,n)},D_={caches:{spannedCells:{},hiddenCells:{},hiddenCellOriginMap:{}},processedRange:{firstRowIndex:0,lastRowIndex:0}},F_=e=>f({},e,{rowSpanning:D_}),L_=(e,t)=>{const n=s.useCallback((t,n=!1)=>{const r=e.current.virtualizer.store,{range:o,rows:i}=lN(e);if(n&&r.set("rowSpanning",D_),null===o||!I_(t))return;const a=n?D_:AA.selectors.state(r.state),l=(s={firstRowIndex:t.firstRowIndex,lastRowIndex:Math.min(t.lastRowIndex,o.lastRowIndex-o.firstRowIndex+1)},c=a.processedRange,s.firstRowIndex>=c.firstRowIndex&&s.lastRowIndex<=c.lastRowIndex?null:s.firstRowIndex>=c.firstRowIndex&&s.lastRowIndex>c.lastRowIndex?{firstRowIndex:c.lastRowIndex,lastRowIndex:s.lastRowIndex}:s.firstRowIndex<c.firstRowIndex&&s.lastRowIndex<=c.lastRowIndex?{firstRowIndex:s.firstRowIndex,lastRowIndex:c.firstRowIndex-1}:s);var s,c;if(null===l)return;const u=cO(e),d=((e,t,n,r,o,i)=>{const a=e.current.virtualizer,l=i?D_:AA.selectors.state(a.store.state),s=f({},l.caches.spannedCells),c=f({},l.caches.hiddenCells),u=f({},l.caches.hiddenCellOriginMap),d={firstRowIndex:Math.min(l.processedRange.firstRowIndex,o.firstRowIndex),lastRowIndex:Math.max(l.processedRange.lastRowIndex,o.lastRowIndex)};return t.forEach((t,i)=>{for(let a=o.firstRowIndex;a<o.lastRowIndex;a+=1){const l=n[a];if(c[l.id]?.[i])continue;const d=O_(l.model,t,e);if(null==d)continue;let p=l.id,f=a,h=0;const m=[];if(a===o.firstRowIndex){let o=a-1,l=n[o];for(;o>=r.firstRowIndex&&l&&O_(l.model,t,e)===d;){const e=n[o+1];c[e.id]?c[e.id][i]=!0:c[e.id]={[i]:!0},m.push(a),h+=1,p=l.id,f=o,o-=1,l=n[o]}}m.forEach(e=>{u[e]?u[e][i]=f:u[e]={[i]:f}});let g=a+1;for(;g<=r.lastRowIndex&&n[g]&&O_(n[g].model,t,e)===d;){const e=n[g];c[e.id]?c[e.id][i]=!0:c[e.id]={[i]:!0},u[g]?u[g][i]=f:u[g]={[i]:f},g+=1,h+=1}h>0&&(s[p]?s[p][i]=h+1:s[p]={[i]:h+1})}}),{caches:{spannedCells:s,hiddenCells:c,hiddenCellOriginMap:u},processedRange:d}})(e,u,i,o,l,n),p=Object.keys(d.caches.spannedCells).length,h=Object.keys(d.caches.hiddenCells).length,m=Object.keys(a.caches.spannedCells).length,g=Object.keys(a.caches.hiddenCells).length;(n||p!==m||h!==g)&&!(0===p&&0===m)&&r.set("rowSpanning",d)},[e]),{schedule:r,cancel:o}=function(e){const t=s.useRef(null),n=s.useCallback((...n)=>{t.current||queueMicrotask(()=>{t.current&&t.current()}),t.current=()=>{t.current=null,e(...n)}},[e]);return s.useLayoutEffect(()=>{t.current&&t.current()}),{schedule:n,cancel:()=>!!t.current&&(t.current=null,!0)}}(n),i=s.useCallback(()=>{const t=WA(e);I_(t)&&r(t,!0)},[e,r]);rI(e,"renderedRowsIntervalChange",AI(t.rowSpanning,e=>{const t=o();n(e,t)})),rI(e,"sortedRowsSet",AI(t.rowSpanning,i)),rI(e,"paginationModelChange",AI(t.rowSpanning,i)),rI(e,"filteredRowsSet",AI(t.rowSpanning,i)),rI(e,"columnsChange",AI(t.rowSpanning,i)),s.useEffect(()=>{const r=e.current.virtualizer?.store;r&&(t.rowSpanning?r.state.rowSpanning===D_&&n(WA(e)):r.state.rowSpanning!==D_&&r.set("rowSpanning",D_))},[e,t.rowSpanning,n])},A_=(e,t,n)=>f({},e,{listViewColumn:t.listViewColumn?f({},t.listViewColumn,{computedWidth:N_(n)}):void 0});function N_(e){return oT(e).viewportInnerSize.width}const $_=eT(yD,gD,lF,(e,t,n)=>({groupKeys:[],paginationModel:n,sortModel:t,filterModel:e,start:n.page*n.pageSize,end:n.page*n.pageSize+n.pageSize-1}));let z_=function(e){return e.Default="set-flat-rows",e.LazyLoading="replace-row-range",e.GroupedData="set-grouped-rows",e}({});class j_{constructor(e){this.chunkSize=e}getCacheKeys=e=>{if(this.chunkSize<1||"number"!=typeof e.start)return[e];const t=[];for(let n=e.start;n<=e.end;n+=this.chunkSize){const r=Math.min(n+this.chunkSize-1,e.end);t.push(f({},e,{start:n,end:r}))}return t};splitResponse=(e,t)=>{const n=this.getCacheKeys(e);if(1===n.length)return new Map([[e,t]]);const r=new Map;return n.forEach(n=>{const o=n.end===e.end,i=f({},t,{pageInfo:f({},t.pageInfo,{hasNextPage:void 0!==t.pageInfo?.hasNextPage&&!o||t.pageInfo?.hasNextPage,nextCursor:void 0===t.pageInfo?.nextCursor||o?t.pageInfo?.nextCursor:t.rows[n.end+1].id}),rows:"number"!=typeof n.start||"number"!=typeof e.start?t.rows:t.rows.slice(n.start-e.start,n.end-e.start+1)});r.set(n,i)}),r};static mergeResponses=e=>1===e.length?e[0]:e.reduce((e,t)=>f({},t,{rows:[...e.rows,...t.rows]}),{rows:[],rowCount:0,pageInfo:{}})}const B_=["skipCache","keepChildrenExpanded"],__={clear:()=>{},get:()=>{},set:()=>{}};function H_(e,t={}){return null===e?__:e??new KA(t)}const V_=(e,t)=>{const{api:n,strategyProcessor:r,events:o,setStrategyAvailability:i}=((e,t,n={})=>{const r=s.useCallback(()=>{e.current.setStrategyAvailability(pB.DataSource,z_.Default,t.dataSource?()=>!0:()=>!1)},[e,t.dataSource]),[o,i]=s.useState(e.current.getActiveStrategy(pB.DataSource)),a=s.useMemo(()=>o===z_.Default||o===z_.GroupedData,[o]),l=pI(e,lF),c=s.useRef(0),u=t.onDataSourceError,p=Dg(()=>{if(!t.pagination)return new j_(l.pageSize);const e=t.pageSizeOptions.map(e=>"number"==typeof e?e:e.value).sort((e,t)=>e-t),n=Math.min(l.pageSize,e[0]);return new j_(n)}).current,[h,m]=s.useState(()=>H_(t.dataSourceCache,n.cacheOptions)),g=s.useCallback(async(r,o)=>{const i=t.dataSource?.getRows;if(!i)return;if(r&&r!==OT&&"DataGrid"!==t.signature)return void n.fetchRowChildren?.([r]);n.clearDataSourceState?.();const l=o||{},{skipCache:s,keepChildrenExpanded:m}=l,g=d(l,B_),v=f({},$_(e),e.current.unstable_applyPipeProcessors("getRowsParams",{}),g),b=p.getCacheKeys(v).map(e=>h.get(e));if(!s&&b.every(e=>void 0!==e))return void e.current.applyStrategyProcessor("dataSourceRowsUpdate",{response:j_.mergeResponses(b),fetchParams:v,options:{skipCache:s,keepChildrenExpanded:m}});(a||0===e.current.getRowsCount())&&e.current.setLoading(!0);const y=c.current+1;c.current=y;try{const t=await i(v);p.splitResponse(v,t).forEach((e,t)=>h.set(t,e)),c.current===y&&e.current.applyStrategyProcessor("dataSourceRowsUpdate",{response:t,fetchParams:v,options:{skipCache:s,keepChildrenExpanded:m}})}catch(t){c.current===y&&(e.current.applyStrategyProcessor("dataSourceRowsUpdate",{error:t,fetchParams:v,options:{skipCache:s,keepChildrenExpanded:m}}),"function"==typeof u&&u(new qA({message:t?.message,params:v,cause:t})))}finally{a&&c.current===y&&e.current.setLoading(!1)}},[p,h,e,a,t.dataSource?.getRows,u,n,t.signature]),v=s.useCallback(()=>{i(e.current.getActiveStrategy(pB.DataSource))},[e]),b=s.useCallback(t=>{if("error"in t)return void e.current.setRows([]);const{response:n}=t;void 0!==n.rowCount&&e.current.setRowCount(n.rowCount),e.current.setRows(n.rows),e.current.unstable_applyPipeProcessors("processDataSourceRows",{params:t.fetchParams,response:n},!0)},[e]),y=t.dataSource?.updateRow,w=n.handleEditRow,x=s.useCallback(async t=>{if(y)try{const n=await y(t);return"function"==typeof w?(w(t,n),n):(n&&!JL(n,t.previousRow)&&e.current.dataSource.cache.clear(),e.current.updateNestedRows([n],[]),n)}catch(e){throw"function"==typeof u&&u(new YA({message:e?.message,params:t,cause:e})),e}},[e,y,u,w]),S={dataSource:{fetchRows:g,cache:h,editRow:x}},C=s.useMemo(()=>Cg(g,0),[g]),k=s.useRef(!0);return s.useEffect(()=>{if(k.current)return void(k.current=!1);if(void 0===t.dataSourceCache)return;const e=H_(t.dataSourceCache,n.cacheOptions);m(t=>t!==e?e:t)},[t.dataSourceCache,n.cacheOptions]),s.useEffect(()=>{if(o===z_.Default||o===z_.LazyLoading||o===z_.GroupedData)return t.dataSource&&(e.current.dataSource.cache.clear(),e.current.dataSource.fetchRows()),()=>{c.current+=1}},[e,t.dataSource,o]),{api:{public:S},debouncedFetchRows:C,strategyProcessor:{strategyName:z_.Default,group:"dataSourceRowsUpdate",processor:b},setStrategyAvailability:r,cacheChunkManager:p,cache:h,events:{strategyAvailabilityChange:v,sortModelChange:AI(a,()=>C()),filterModelChange:AI(a,()=>C()),paginationModelChange:AI(a,()=>C())}}})(e,t);vL(e,n.public,"public"),fB(e,r.strategyName,r.group,r.processor),Object.entries(o).forEach(([t,n])=>{rI(e,t,n)}),s.useEffect(()=>{i()},[i])},W_=(e,t,n)=>{vB(e,t),i_(e,t),(e=>{fB(e,hB,"rowTreeCreation",e_)})(e),bB(gB,e,t),bB(o_,e,t),bB(RB,e,t),bB(JB,e,t),bB(VB,e,t),bB(QB,e,t),bB(zB,e,t),bB(a_,e,t),bB(UB,e,t),bB(LB,e,t),bB(F_,e,t),bB(MB,e,t),bB(R_,e,t),bB(EB,e,t),bB(b_,e,t),bB(_A,e,t),bB(u_,e,t),bB(hN,e,t),bB(A_,e,t),HB(e,t),((e,t)=>{const n=bL(e,"useGridSelection"),r=s.useCallback(e=>(...n)=>{t.rowSelection&&e(...n)},[t.rowSelection]),o=pI(e,RT)>1,i=t.signature!==QT.DataGrid&&(t.rowSelectionPropagation?.parents||t.rowSelectionPropagation?.descendants)&&o,a=s.useMemo(()=>t.rowSelectionModel,[t.rowSelectionModel]),l=s.useRef(null);e.current.registerControlState({stateId:"rowSelection",propModel:a,propOnChange:t.onRowSelectionModelChange,stateSelector:LD,changeEvent:"rowSelectionChange"});const{checkboxSelection:c,disableRowSelectionOnClick:u,isRowSelectable:d}=t,p=HD(t),h=s.useCallback(t=>{let n=t;const r=l.current??t,o=e.current.isRowSelected(t);if(o){const t=kD(e),o=t.findIndex(e=>e===r),i=t.findIndex(e=>e===n);if(o===i)return;n=o>i?t[i+1]:t[i-1]}l.current=t,e.current.selectRowRange({startId:r,endId:n},!o)},[e]),m=Mg(()=>t.pagination&&t.checkboxSelectionVisibleOnly&&"client"===t.paginationMode?mF(e):kD(e)),g=s.useCallback((r,o)=>{if(t.signature===QT.DataGrid&&!p&&("include"!==r.type||r.ids.size>1))throw new Error(["MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.","You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection."].join("\n"));if(LD(e)!==r){if(n.debug("Setting selection model"),null!==l.current){const e=r.ids.has(l.current);("include"===r.type&&!e||"exclude"===r.type&&e)&&(l.current=null)}e.current.setState(e=>f({},e,{rowSelection:t.rowSelection?r:r_}),o)}},[e,n,t.rowSelection,t.signature,p]),v=s.useCallback(t=>AD(e).has(t),[e]),b=s.useCallback(n=>{if(!1===t.rowSelection)return!1;if(d&&!d(e.current.getRowParams(n)))return!1;const r=ST(e,n);return"footer"!==r?.type&&"pinnedRow"!==r?.type},[e,t.rowSelection,d]),y=s.useCallback(()=>$D(e),[e]),w=s.useCallback((r,o=!0,a=!1)=>{if(!e.current.isRowSelectable(r))return;const s=xT(e);if(l.current=o?r:null,a){n.debug(`Setting selection for row ${r}`);const a={type:"include",ids:new Set},l=e=>{a.ids.add(e)};o&&(l(r),i&&VD(e,s,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,l)),e.current.setRowSelectionModel(a,"singleRowSelection")}else{n.debug(`Toggling selection for row ${r}`);const a=LD(e),l={type:a.type,ids:new Set(a.ids)},c=VI(l);c.unselect(r);const u=e=>{c.select(e)},d=e=>{c.unselect(e)};o?(u(r),i&&VD(e,s,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,u)):i&&WD(e,s,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,d),("include"===l.type&&l.ids.size<2||p)&&e.current.setRowSelectionModel(l,"singleRowSelection")}},[e,n,i,t.rowSelectionPropagation?.descendants,t.rowSelectionPropagation?.parents,p]),x=s.useCallback((r,o=!0,a=!1)=>{if(n.debug("Setting selection for several rows"),!1===t.rowSelection)return;const l=xT(e),s=new Set;for(let t=0;t<r.length;t+=1){const n=r[t];e.current.isRowSelectable(n)&&s.add(n)}const c=LD(e);let u;if(a){if(u={type:"include",ids:s},o){const n=VI(u);if(i){const r=e=>{n.select(e)};for(const n of s)VD(e,l,n,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,r)}}else u.ids=new Set;if(c.type===u.type&&u.ids.size===c.ids.size&&Array.from(u.ids).every(e=>c.ids.has(e)))return}else{u={type:c.type,ids:new Set(c.ids)};const n=VI(u),r=e=>{n.select(e)},a=e=>{n.unselect(e)};for(const c of s)o?(n.select(c),i&&VD(e,l,c,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,r)):(a(c),i&&WD(e,l,c,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,a))}("include"===u.type&&u.ids.size<2||p)&&e.current.setRowSelectionModel(u,"multipleRowsSelection")},[n,i,p,e,t.rowSelectionPropagation?.descendants,t.rowSelectionPropagation?.parents,t.rowSelection]),S=s.useCallback(n=>{if(!o||!i||"exclude"===n.type||0===n.ids.size&&"include"===n.type)return n;const r={type:n.type,ids:new Set(n.ids)},a=xT(e),l=VI(r),s=e=>{l.select(e)};for(const r of n.ids)VD(e,a,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,s,l);return r},[e,t.rowSelectionPropagation?.descendants,t.rowSelectionPropagation?.parents,o,i]),C=s.useCallback(({startId:t,endId:r},o=!0,i=!1)=>{if(!e.current.getRow(t)||!e.current.getRow(r))return;n.debug(`Expanding selection from row ${t} to row ${r}`);const a=kD(e),l=a.indexOf(t),s=a.indexOf(r),[c,u]=l>s?[s,l]:[l,s],d=a.slice(c,u+1);e.current.selectRows(d,o,i)},[e,n]),k={selectRows:x,selectRowRange:C,getPropagatedRowSelectionModel:S};vL(e,{selectRow:w,setRowSelectionModel:g,getSelectedRows:y,isRowSelected:v,isRowSelectable:b},"public"),vL(e,k,t.signature===QT.DataGrid?"private":"public");const E=s.useRef(!0),R=s.useCallback((n=!1)=>{if(E.current)return;const r=LD(e),i=wT(e),a=xT(e),l=SD(e),s=e=>"server"===t.filterMode?!i[e]:!a[e]||!1===l[e],c={type:r.type,ids:new Set(r.ids)},u=VI(c);let d=!1;for(const e of r.ids){if(s(e)){if(t.keepNonExistentRowsSelected)continue;u.unselect(e),d=!0;continue}if(!t.rowSelectionPropagation?.parents)continue;const n=a[e];if("group"===n?.type){if(n.isAutoGenerated){u.unselect(e),d=!0;continue}n.children.every(e=>!1===l[e])||(u.unselect(e),d=!0)}}const p=o&&t.rowSelectionPropagation?.parents&&(c.ids.size>0||"exclude"===c.type);if(d||p&&!n)if(p)if("exclude"===c.type){const n=m(),r=[];for(let e=0;e<n.length;e+=1){const o=n[e];!t.keepNonExistentRowsSelected&&s(o)||!u.has(o)||r.push(o)}e.current.selectRows(r,!0,!0)}else e.current.selectRows(Array.from(c.ids),!0,!0);else e.current.setRowSelectionModel(c,"multipleRowsSelection")},[e,o,t.rowSelectionPropagation?.parents,t.keepNonExistentRowsSelected,t.filterMode,m]),P=s.useCallback((t,n)=>{const r=n.metaKey||n.ctrlKey,o=!c&&!r&&!(e=>!!e.key)(n),i=!p||o,a=e.current.isRowSelected(t),l=ND(e)>1&&i||!a;e.current.selectRow(t,l,i)},[e,p,c]),M=s.useCallback((t,n)=>{if(u)return;const r=n.target.closest(`.${XT.cell}`)?.getAttribute("data-field");if(r!==wF.field&&r!==tD){if(r){const t=e.current.getColumn(r);if(t?.type===ZO)return}"pinnedRow"!==ST(e,t.id).type&&(n.shiftKey&&p?h(t.id):P(t.id,n))}},[u,p,e,h,P]),T=s.useCallback((e,t)=>{p&&t.shiftKey&&window.getSelection()?.removeAllRanges()},[p]),I=s.useCallback((t,n)=>{p&&n.nativeEvent.shiftKey?h(t.id):e.current.selectRow(t.id,t.value,!p)},[e,h,p]),O=s.useCallback(n=>{const r=yD(e),i=wD(e),a=r.items.length>0||i?.some(e=>e.length);t.isRowSelectable||t.checkboxSelectionVisibleOnly||o&&!t.rowSelectionPropagation?.descendants||a||t.disableRowSelectionExcludeModel?e.current.selectRows(m(),n):e.current.setRowSelectionModel({type:n?"exclude":"include",ids:new Set},"multipleRowsSelection")},[e,m,t.checkboxSelectionVisibleOnly,t.isRowSelectable,t.rowSelectionPropagation?.descendants,t.disableRowSelectionExcludeModel,o]),D=s.useCallback(e=>{O(e.value)},[O]),F=s.useCallback((t,n)=>{if(e.current.getCellMode(t.id,t.field)!==zI.Edit&&!v$(n)){if(AO(n.key)&&n.shiftKey){const r=YD(e);if(r&&r.id!==t.id){n.preventDefault();const o=e.current.isRowSelected(r.id);if(!p)return void e.current.selectRow(r.id,!o,!0);const i=e.current.getRowIndexRelativeToVisibleRows(r.id),a=e.current.getRowIndexRelativeToVisibleRows(t.id);let l,s;i>a?o?(l=a,s=i-1):(l=a,s=i):o?(l=i+1,s=a):(l=i,s=a);const c=lN(e),u=[];for(let e=l;e<=s;e+=1)u.push(c.rows[e].id);return void e.current.selectRows(u,!o)}}if(" "===n.key&&n.shiftKey)return n.preventDefault(),void P(t.id,n);"A"===String.fromCharCode(n.keyCode)&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),p&&O(!0))}},[e,p,P,O]),L=Mg(()=>{if(!t.rowSelection)return void e.current.setRowSelectionModel(r_);if(void 0===a)return;if(!i||!o||"include"===a.type&&0===a.ids.size)return void e.current.setRowSelectionModel(a);const n=e.current.getPropagatedRowSelectionModel(a);n.type===a.type&&n.ids.size===a.ids.size&&Array.from(a.ids).every(e=>n.ids.has(e))?e.current.setRowSelectionModel(a):e.current.setRowSelectionModel(n)});rI(e,"filteredRowsSet",r(()=>R())),rI(e,"rowClick",r(M)),rI(e,"rowSelectionCheckboxChange",r(I)),rI(e,"headerSelectionCheckboxChange",D),rI(e,"cellMouseDown",r(T)),rI(e,"cellKeyDown",r(F)),s.useEffect(()=>{L()},[e,a,t.rowSelection,L]);const A=null!=a;s.useEffect(()=>{if(A||!t.rowSelection||"function"!=typeof b)return;const n=LD(e);if("include"!==n.type)return;const r=new Set;for(const e of n.ids)b(e)&&r.add(e);r.size<n.ids.size&&e.current.setRowSelectionModel({type:n.type,ids:r})},[e,b,A,t.rowSelection]),s.useEffect(()=>{if(!t.rowSelection||A)return;const n=LD(e);!p&&("include"===n.type&&n.ids.size>1||"exclude"===n.type)&&e.current.setRowSelectionModel(r_)},[e,p,c,A,t.rowSelection]),s.useEffect(()=>{r(R)},[R,r]),s.useEffect(()=>{E.current&&(E.current=!1)},[])})(e,t),PB(e,t),((e,t,n)=>{const r=bL(e,"useGridRows"),o=s.useRef(Date.now()),i=s.useRef(t.rowCount),a=Ng(),{setRowIndex:l,setRowPosition:c}=n.hooks.useGridRowsOverridableMethods(e,t),u=s.useCallback(t=>{const n=wT(e)[t];if(n)return n;const r=ST(e,t);return r&&jT(r)?{[DT]:t}:null},[e]),d=s.useCallback(t=>zD(e,t),[e]),p=s.useCallback(({cache:n,throttle:r})=>{const i=()=>{o.current=Date.now(),e.current.setState(n=>f({},n,{rows:$T({apiRef:e,rowCountProp:t.rowCount,loadingProp:t.loading,previousTree:xT(e),previousTreeDepths:ET(e),previousGroupsToFetch:CT(e)})})),e.current.publishEvent("rowsSet")};if(a.clear(),e.current.caches.rows=n,!r)return void i();const l=t.throttleRowsMs-(Date.now()-o.current);l>0?a.start(l,i):i()},[t.throttleRowsMs,t.rowCount,t.loading,e,a]),h=s.useCallback(n=>{if(r.debug(`Updating all rows, new length ${n.length}`),!t.dataSource&&SL(e))return void e.current.updateNonPivotRows(n,!1);const o=AT({rows:n,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),i=e.current.caches.rows;o.rowsBeforePartialUpdates=i.rowsBeforePartialUpdates,p({cache:o,throttle:!0})},[r,t.getRowId,t.dataSource,t.loading,t.rowCount,p,e]),m=s.useCallback(n=>{if(t.signature===QT.DataGrid&&n.length>1)throw new Error(["MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.","You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature."].join("\n"));if(!t.dataSource&&SL(e))return void e.current.updateNonPivotRows(n);const r=VT(e,n,t.getRowId),o=_T({updates:r,getRowId:t.getRowId,previousCache:e.current.caches.rows});p({cache:o,throttle:!0})},[t.signature,t.dataSource,t.getRowId,p,e]),g=s.useCallback((n,r)=>{const o=VT(e,n,t.getRowId),i=_T({updates:o,getRowId:t.getRowId,previousCache:e.current.caches.rows,groupKeys:r??[]});p({cache:i,throttle:!1})},[t.getRowId,p,e]),v=s.useCallback(t=>{r.debug(`Setting loading to ${t}`),e.current.setState(e=>f({},e,{rows:f({},e.rows,{loading:t})})),e.current.caches.rows.loadingPropBeforePartialUpdates=t},[e,r]),b=s.useCallback(()=>{const t=PT(e),n=wT(e);return new Map(t.map(e=>[e,n[e]??{}]))},[e]),y=s.useCallback(()=>vT(e),[e]),w=s.useCallback(()=>PT(e),[e]),x=s.useCallback(t=>{const{rowIdToIndexMap:n}=lN(e);return n.get(t)},[e]),S=s.useCallback((t,n)=>{const r=ST(e,t);if(!r)throw new Error(`MUI X: No row with id #${t} found.`);if("group"!==r.type)throw new Error("MUI X: Only group nodes can be expanded or collapsed.");const o=f({},r,{childrenExpanded:n});e.current.setState(e=>f({},e,{rows:f({},e.rows,{tree:f({},e.rows.tree,{[t]:o})})})),e.current.publishEvent("rowExpansionChange",o)},[e]),C=s.useCallback(()=>{const t=f({},xT(e)),n=e=>{const r=t[e];"group"===r?.type&&(t[e]=f({},r,{childrenExpanded:!0}),r.children.forEach(n))};n(OT),e.current.setState(e=>f({},e,{rows:f({},e.rows,{tree:t})})),e.current.publishEvent("rowExpansionChange",t[OT])},[e]),k=s.useCallback(()=>{const t=f({},xT(e)),n=e=>{const r=t[e];"group"===r?.type&&(t[e]=f({},r,{childrenExpanded:!1}),r.children.forEach(n))};n(OT),e.current.setState(e=>f({},e,{rows:f({},e.rows,{tree:t})})),e.current.publishEvent("rowExpansionChange",t[OT])},[e]),E=s.useCallback(t=>ST(e,t)??null,[e]),R=s.useCallback(({skipAutoGeneratedRows:t=!0,groupId:n,applySorting:r,applyFiltering:o,directChildrenOnly:i=!1})=>{const a=xT(e);let l;if(r){const r=a[n];if(!r)return[];const o=hD(e);l=[];for(let e=o.findIndex(e=>e===n)+1;e<o.length&&(i?a[o[e]].depth===r.depth+1:a[o[e]].depth>r.depth);e+=1){const n=o[e];t&&jT(a[n])||l.push(n)}}else l=BT(a,n,t,i);if(o){const t=SD(e);l=pD(t)?l:l.filter(e=>!1!==t[e])}return l},[e]),P={getRow:u,setLoading:v,getRowId:d,getRowModels:b,getRowsCount:y,getAllRowIds:w,setRows:h,updateRows:m,getRowNode:E,getRowIndexRelativeToVisibleRows:x,unstable_replaceRows:s.useCallback((n,r)=>{if(t.signature===QT.DataGrid&&r.length>1)throw new Error(["MUI X: You cannot replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.","You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature."].join("\n"));if(0===r.length)return;if(RT(e)>1)throw new Error("`apiRef.current.unstable_replaceRows` is not compatible with tree data and row grouping");const o=f({},xT(e)),i=f({},wT(e)),a=o[OT],l=[...a.children],s=new Set;for(let e=0;e<r.length;e+=1){const a=r[e],c=FT(a,t.getRowId,"A row was provided without id when calling replaceRows()."),[u]=l.splice(n+e,1,c);s.has(u)||(delete i[u],delete o[u]);const d={id:c,depth:0,parent:OT,type:"leaf",groupingKey:null};i[c]=a,o[c]=d,s.add(c)}o[OT]=f({},a,{children:l});const c=l.filter(e=>"leaf"===o[e]?.type);e.current.caches.rows.dataRowIdToModelLookup=i,e.current.setState(e=>f({},e,{rows:f({},e.rows,{loading:t.loading,totalRowCount:Math.max(t.rowCount||0,l.length),dataRowIdToModelLookup:i,dataRowIds:c,tree:o})})),e.current.publishEvent("rowsSet")},[e,t.signature,t.getRowId,t.loading,t.rowCount])},M={setRowIndex:l,setRowPosition:c,setRowChildrenExpansion:S,getRowGroupChildren:R,expandAllRows:C,collapseAllRows:k},T={updateNestedRows:g},I=s.useCallback(()=>{let n;r.info("Row grouping pre-processing have changed, regenerating the row tree"),n=e.current.caches.rows.rowsBeforePartialUpdates===t.rows?f({},e.current.caches.rows,{updates:{type:"full",rows:PT(e)}}):AT({rows:t.rows,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),p({cache:n,throttle:!1})},[r,e,t.rows,t.getRowId,t.loading,t.rowCount,p]),O=Dg(()=>t.dataSource),D=s.useCallback(e=>{t.dataSource&&t.dataSource!==O.current?O.current=t.dataSource:"rowTreeCreation"===e&&I()},[I,O,t.dataSource]),F=s.useCallback(()=>{e.current.getActiveStrategy(pB.RowTree)!==kT(e)&&I()},[e,I]);rI(e,"activeStrategyProcessorChange",D),rI(e,"strategyAvailabilityChange",F);const L=s.useCallback(()=>{e.current.setState(n=>{const r=e.current.unstable_applyPipeProcessors("hydrateRows",{tree:xT(e),treeDepths:ET(e),dataRowIds:PT(e),dataRowIdToModelLookup:wT(e)});return f({},n,{rows:f({},n.rows,r,{totalTopLevelRowCount:NT({tree:r.tree,rowCountProp:t.rowCount})})})}),e.current.publishEvent("rowsSet")},[e,t.rowCount]);fN(e,"hydrateRows",L),vL(e,P,"public"),vL(e,M,t.signature===QT.DataGrid?"private":"public"),vL(e,T,"private");const A=s.useRef(!0);s.useEffect(()=>{if(A.current)return void(A.current=!1);let n=!1;t.rowCount!==i.current&&(n=!0,i.current=t.rowCount);const o=t.dataSource?MT(e):t.rows,a=e.current.caches.rows.rowsBeforePartialUpdates===o,l=e.current.caches.rows.loadingPropBeforePartialUpdates===t.loading,s=e.current.caches.rows.rowCountPropBeforePartialUpdates===t.rowCount;a&&(l||(e.current.setState(e=>f({},e,{rows:f({},e.rows,{loading:t.loading})})),e.current.caches.rows.loadingPropBeforePartialUpdates=t.loading),s||(e.current.setState(e=>f({},e,{rows:f({},e.rows,{totalRowCount:Math.max(t.rowCount||0,e.rows.totalRowCount),totalTopLevelRowCount:Math.max(t.rowCount||0,e.rows.totalTopLevelRowCount)})})),e.current.caches.rows.rowCountPropBeforePartialUpdates=t.rowCount),!n)||(r.debug(`Updating all rows, new length ${o?.length}`),p({cache:AT({rows:o,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),throttle:!1}))},[t.rows,t.rowCount,t.getRowId,t.loading,t.dataSource,r,p,e])})(e,t,n),L_(e,t),n_(e,t,n),(e=>{const t=()=>e.current.virtualizer.api.resetColSpan(),n={unstable_getCellColSpanInfo:(...t)=>e.current.virtualizer.api.getCellColSpanInfo(...t)},r={resetColSpan:t,calculateColSpan:(...t)=>{e.current.virtualizer.api.calculateColSpan(...t)}};vL(e,n,"public"),vL(e,r,"private"),rI(e,"columnOrderChange",t)})(e),((e,t)=>{const n=s.useCallback(t=>ZF(e)[t]??[],[e]),r=s.useCallback(()=>JF(e),[e]);vL(e,{getColumnGroupPath:n,getAllGroupDetails:r},"public");const o=s.useCallback(()=>{const n=g_(t.columnGroupingModel??[]);e.current.setState(e=>{const t=e.columns?.orderedFields??[],r=e.pinnedColumns??{},o=v_(t,n,r);return f({},e,{columnGrouping:f({},e.columnGrouping,{headerStructure:o})})})},[e,t.columnGroupingModel]),i=s.useCallback(t=>{if(!t&&!e.current.caches.columnGrouping.lastColumnGroupingModel)return;e.current.caches.columnGrouping.lastColumnGroupingModel=t;const n=e.current.getPinnedColumns?.()??{},r=oO(e),o=uO(e),i=h_(t??[]),a=g_(t??[]),l=v_(r,a,n),s=0===o.length?0:Math.max(...o.map(e=>a[e]?.length??0));e.current.setState(e=>f({},e,{columnGrouping:{lookup:i,unwrappedGroupingModel:a,headerStructure:l,maxDepth:s}}))},[e]);rI(e,"columnIndexChange",o),rI(e,"columnsChange",()=>{i(t.columnGroupingModel)}),rI(e,"columnVisibilityModelChange",()=>{i(t.columnGroupingModel)}),s.useEffect(()=>{t.columnGroupingModel!==e.current.caches.columnGrouping.lastColumnGroupingModel&&i(t.columnGroupingModel)},[e,i,t.columnGroupingModel])})(e,t),ZB(e,t,n),((e,t)=>{const n=bL(e,"useGridFocus"),r=s.useRef(null),o=null!==e.current.rootElementRef.current,i=s.useCallback((t,n)=>{t&&e.current.getRow(t.id)&&e.current.publishEvent("cellFocusOut",e.current.getCellParams(t.id,t.field),n)},[e]),a=s.useCallback((t,r)=>{const o=YD(e);o?.id===t&&o?.field===r||(e.current.setState(e=>(n.debug(`Focusing on cell with id=${t} and field=${r}`),f({},e,{tabIndex:{cell:{id:t,field:r},columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null},focus:{cell:{id:t,field:r},columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}}))),e.current.getRow(t)&&(o&&i(o,{}),e.current.publishEvent("cellFocusIn",e.current.getCellParams(t,r))))},[e,n,i]),l=s.useCallback((t,r={})=>{const o=YD(e);i(o,r),e.current.setState(e=>(n.debug(`Focusing on column header with colIndex=${t}`),f({},e,{tabIndex:{columnHeader:{field:t},columnHeaderFilter:null,cell:null,columnGroupHeader:null},focus:{columnHeader:{field:t},columnHeaderFilter:null,cell:null,columnGroupHeader:null}})))},[e,n,i]),c=s.useCallback((t,r={})=>{const o=YD(e);i(o,r),e.current.setState(e=>(n.debug(`Focusing on column header filter with colIndex=${t}`),f({},e,{tabIndex:{columnHeader:null,columnHeaderFilter:{field:t},cell:null,columnGroupHeader:null},focus:{columnHeader:null,columnHeaderFilter:{field:t},cell:null,columnGroupHeader:null}})))},[e,n,i]),u=s.useCallback((t,n,r={})=>{const o=YD(e);o&&e.current.publishEvent("cellFocusOut",e.current.getCellParams(o.id,o.field),r),e.current.setState(e=>f({},e,{tabIndex:{columnGroupHeader:{field:t,depth:n},columnHeader:null,columnHeaderFilter:null,cell:null},focus:{columnGroupHeader:{field:t,depth:n},columnHeader:null,columnHeaderFilter:null,cell:null}}))},[e]),d=s.useCallback(()=>QD(e),[e]),p=s.useCallback((n,r,o)=>{let i=e.current.getColumnIndex(r);const a=cO(e),l=lN(e,(t.pagination,t.paginationMode)),s=TT(e),c=[].concat(s.top||[],l.rows,s.bottom||[]);let u=c.findIndex(e=>e.id===n);"right"===o?i+=1:"left"===o?i-=1:u+=1,i>=a.length?(u+=1,u<c.length&&(i=0)):i<0&&(u-=1,u>=0&&(i=a.length-1)),u=FI(u,0,c.length-1);const d=c[u];if(!d)return;const p=e.current.unstable_getCellColSpanInfo(d.id,i);p&&p.spannedByColSpan&&("left"===o||"below"===o?i=p.leftVisibleCellIndex:"right"===o&&(i=p.rightVisibleCellIndex)),i=FI(i,0,a.length-1);const f=a[i];e.current.setCellFocus(d.id,f.field)},[e,t.pagination,t.paginationMode]),h=s.useCallback(({id:t,field:n})=>{e.current.setCellFocus(t,n)},[e]),m=s.useCallback((t,n)=>{"Enter"===n.key||"Tab"===n.key||"Shift"===n.key||AO(n.key)||e.current.setCellFocus(t.id,t.field)},[e]),g=s.useCallback(({field:t},n)=>{n.target===n.currentTarget&&e.current.setColumnHeaderFocus(t,n)},[e]),v=s.useCallback(({fields:t,depth:n},r)=>{if(r.target!==r.currentTarget)return;const o=QD(e);null!==o&&o.depth===n&&t.includes(o.field)||e.current.setColumnGroupHeaderFocus(t[0],n,r)},[e]),b=s.useCallback((t,r)=>{r.relatedTarget?.getAttribute("class")?.includes(XT.columnHeader)||(n.debug("Clearing focus"),e.current.setState(e=>f({},e,{focus:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}})))},[n,e]),y=s.useCallback(e=>{r.current=e},[]),w=s.useCallback(t=>{const n=r.current;r.current=null;const o=YD(e);if(!e.current.unstable_applyPipeProcessors("canUpdateFocus",!0,{event:t,cell:n}))return;if(!o)return void(n&&e.current.setCellFocus(n.id,n.field));if(n?.id===o.id&&n?.field===o.field)return;const a=e.current.getCellElement(o.id,o.field);a?.contains(t.target)||(n?e.current.setCellFocus(n.id,n.field):(e.current.setState(e=>f({},e,{focus:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}})),i(o,t)))},[e,i]),x=s.useCallback(t=>{if("view"===t.cellMode)return;const n=YD(e);n?.id===t.id&&n?.field===t.field||e.current.setCellFocus(t.id,t.field)},[e]),S=s.useCallback(()=>{const n=YD(e);if(n&&!e.current.getRow(n.id)){const r=n.id;let o=null;if(void 0!==r){const n=e.current.getRowElement(r),i=n?.dataset.rowindex?Number(n?.dataset.rowindex):0,a=lN(e,(t.pagination,t.paginationMode)),l=a.rows[FI(i,0,a.rows.length-1)];o=l?.id??null}e.current.setState(e=>f({},e,{focus:{cell:null===o?null:{id:o,field:n.field},columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}}))}},[e,t.pagination,t.paginationMode]),C=s.useMemo(()=>Cg(S,0),[S]),k=Mg(()=>{const n=YD(e);if(!n)return;const r=lN(e,(t.pagination,t.paginationMode));if(r.rows.find(e=>e.id===n.id)||0===r.rows.length)return;const o=cO(e);e.current.setState(e=>f({},e,{tabIndex:{cell:{id:r.rows[0].id,field:o[0].field},columnGroupHeader:null,columnHeader:null,columnHeaderFilter:null}}))}),E={moveFocusToRelativeCell:p,setColumnGroupHeaderFocus:u,getColumnGroupHeaderFocus:d};vL(e,{setCellFocus:a,setColumnHeaderFocus:l,setColumnHeaderFilterFocus:c},"public"),vL(e,E,"private"),s.useEffect(()=>{const t=kg(e.current.rootElementRef.current);return t.addEventListener("mouseup",w),()=>{t.removeEventListener("mouseup",w)}},[e,o,w]),rI(e,"columnHeaderBlur",b),rI(e,"cellDoubleClick",h),rI(e,"cellMouseDown",y),rI(e,"cellKeyDown",m),rI(e,"cellModeChange",x),rI(e,"columnHeaderFocus",g),rI(e,"columnGroupHeaderFocus",v),rI(e,"rowsSet",C),rI(e,"paginationModelChange",k)})(e,t),((e,t)=>{const n=bL(e,"useGridPreferencesPanel"),r=s.useCallback(()=>{e.current.setState(t=>{if(!t.preferencePanel.open)return t;n.debug("Hiding Preferences Panel");const r=KL(e);return e.current.publishEvent("preferencePanelClose",{openedPanelValue:r.openedPanelValue}),f({},t,{preferencePanel:{open:!1}})})},[e,n]),o=s.useCallback((t,r,o)=>{n.debug("Opening Preferences Panel"),e.current.setState(e=>f({},e,{preferencePanel:f({},e.preferencePanel,{open:!0,openedPanelValue:t,panelId:r,labelId:o})})),e.current.publishEvent("preferencePanelOpen",{openedPanelValue:t})},[n,e]);vL(e,{showPreferences:o,hidePreferences:r},"public");const i=s.useCallback((n,r)=>{const o=KL(e);return!r.exportOnlyDirtyModels||null!=t.initialState?.preferencePanel||o.open?f({},n,{preferencePanel:o}):n},[e,t.initialState?.preferencePanel]),a=s.useCallback((t,n)=>{const r=n.stateToRestore.preferencePanel;return null!=r&&e.current.setState(e=>f({},e,{preferencePanel:r})),t},[e]);pN(e,"exportState",i),pN(e,"restoreState",a)})(e,t),((e,t,n)=>{const r=bL(e,"useGridFilter");e.current.registerControlState({stateId:"filter",propModel:t.filterModel,propOnChange:t.onFilterModelChange,stateSelector:yD,changeEvent:"filterModelChange"});const o=s.useCallback(()=>{e.current.setState(t=>{const n=yD(e),r=e.current.getFilterState(n),o=f({},t,{filter:f({},t.filter,r)});return f({},o,{visibleRowsLookup:NB(e,o)})}),e.current.publishEvent("filteredRowsSet")},[e]),i=s.useCallback((e,n)=>null==n||!1===n.filterable||t.disableColumnFilter?e:[...e,"columnMenuFilterItem"],[t.disableColumnFilter]),a=s.useCallback(t=>{const n=yD(e),r=[...n.items],o=r.findIndex(e=>e.id===t.id);-1===o?r.push(t):r[o]=t,e.current.setFilterModel(f({},n,{items:r}),"upsertFilterItem")},[e]),l=s.useCallback(t=>{const n=yD(e),r=[...n.items];t.forEach(e=>{const t=r.findIndex(t=>t.id===e.id);-1===t?r.push(e):r[t]=e}),e.current.setFilterModel(f({},n,{items:r}),"upsertFilterItems")},[e]),c=s.useCallback(t=>{const n=yD(e),r=n.items.filter(e=>e.id!==t.id);r.length!==n.items.length&&e.current.setFilterModel(f({},n,{items:r}),"deleteFilterItem")},[e]),u=s.useCallback((n,o,i)=>{if(r.debug("Displaying filter panel"),n){const r=yD(e),o=r.items.filter(t=>{if(void 0!==t.value)return!Array.isArray(t.value)||0!==t.value.length;const n=e.current.getColumn(t.field),r=n.filterOperators?.find(e=>e.value===t.operator);return!(void 0===r?.requiresFilterValue||r?.requiresFilterValue)});let i;const a=o.find(e=>e.field===n),l=e.current.getColumn(n);i=a?o:t.disableMultipleColumnsFiltering?[yO({field:n,operator:l.filterOperators[0].value},e)]:[...o,yO({field:n,operator:l.filterOperators[0].value},e)],e.current.setFilterModel(f({},r,{items:i}))}e.current.showPreferences(YL.filters,o,i)},[e,r,t.disableMultipleColumnsFiltering]),d=s.useCallback(()=>{r.debug("Hiding filter panel"),e.current.hidePreferences()},[e,r]),p=s.useCallback(t=>{const n=yD(e);n.logicOperator!==t&&e.current.setFilterModel(f({},n,{logicOperator:t}),"changeLogicOperator")},[e]),h=s.useCallback(t=>{const n=yD(e);JL(n.quickFilterValues,t)||e.current.setFilterModel(f({},n,{quickFilterValues:[...t]}))},[e]),m=s.useCallback((n,o)=>{yD(e)!==n&&(r.debug("Setting filter model"),e.current.updateControlState("filter",xO(n,t.disableMultipleColumnsFiltering,e),o),e.current.unstable_applyFilters())},[e,r,t.disableMultipleColumnsFiltering]),g=s.useCallback(r=>{const o=wO(r,t.disableMultipleColumnsFiltering,e),i=n.hooks.useFilterValueGetter(e,t),a="client"===t.filterMode?PO(o,i,e,t.disableEval):null;return f({},e.current.applyStrategyProcessor("filtering",{isRowMatchingFilters:a,filterModel:o??XI(),filterValueGetter:i}),{filterModel:o})},[e,n.hooks,t]),v={setFilterLogicOperator:p,unstable_applyFilters:o,deleteFilterItem:c,upsertFilterItem:a,upsertFilterItems:l,setFilterModel:m,showFilterPanel:u,hideFilterPanel:d,setQuickFilterValues:h,ignoreDiacritics:t.ignoreDiacritics,getFilterState:g};vL(e,v,"public");const b=s.useCallback((n,r)=>{const o=yD(e);return o.items.forEach(e=>{delete e.fromInput}),r.exportOnlyDirtyModels&&null==t.filterModel&&null==t.initialState?.filter?.filterModel&&JL(o,XI())?n:f({},n,{filter:{filterModel:o}})},[e,t.filterModel,t.initialState?.filter?.filterModel]),y=s.useCallback((n,r)=>{const o=r.stateToRestore.filter?.filterModel;return null==o?n:(e.current.updateControlState("filter",xO(o,t.disableMultipleColumnsFiltering,e),"restoreState"),f({},n,{callbacks:[...n.callbacks,e.current.unstable_applyFilters]}))},[e,t.disableMultipleColumnsFiltering]),w=s.useCallback((e,n)=>{if(n===YL.filters){const e=t.slots.filterPanel;return Xp.jsx(e,f({},t.slotProps?.filterPanel))}return e},[t.slots.filterPanel,t.slotProps?.filterPanel]),{getRowId:x}=t,S=Dg($B),C=s.useCallback(n=>{if("client"!==t.filterMode||!n.isRowMatchingFilters||!n.filterModel.items.length&&!n.filterModel.quickFilterValues?.length)return YI;const r=wT(e),o={},{isRowMatchingFilters:i}=n,a={},l={passingFilterItems:null,passingQuickFilterValues:null},s=S.current(e.current.state.rows.dataRowIdToModelLookup);for(let t=0;t<s.length;t+=1){const r=s[t],c=x?x(r):r.id;i(r,void 0,l);const u=TO([l.passingFilterItems],[l.passingQuickFilterValues],n.filterModel,n.filterValueGetter,e,a);u||(o[c]=u)}const c="auto-generated-group-footer-root";return r[c]&&(o[c]=!0),{filteredRowsLookup:o,filteredChildrenCountLookup:{},filteredDescendantCountLookup:{}}},[e,t.filterMode,x,S]);pN(e,"columnMenu",i),pN(e,"exportState",b),pN(e,"restoreState",y),pN(e,"preferencePanel",w),fB(e,hB,"filtering",C),fB(e,hB,"visibleRowsLookupCreation",AB);const k=s.useCallback(()=>{r.debug("onColUpdated - GridColumns changed, applying filters");const t=yD(e),n=iO(e),o=t.items.filter(e=>e.field&&n[e.field]);o.length<t.items.length&&e.current.setFilterModel(f({},t,{items:o}))},[e,r]),E=s.useCallback(t=>{"filtering"===t&&e.current.unstable_applyFilters()},[e]),R=s.useCallback(()=>{e.current.setState(t=>f({},t,{visibleRowsLookup:NB(e,t)}))},[e]);rI(e,"rowsSet",o),rI(e,"columnsChange",k),rI(e,"activeStrategyProcessorChange",E),rI(e,"rowExpansionChange",R),rI(e,"columnVisibilityModelChange",()=>{const t=yD(e);t.quickFilterValues?.length&&RO(t)&&o()}),wL(()=>{"DataGrid"===t.signature&&o()}),Wh(()=>{void 0!==t.filterModel&&e.current.setFilterModel(t.filterModel)},[e,r,t.filterModel])})(e,t,n),((e,t)=>{const n=bL(e,"useGridSorting");e.current.registerControlState({stateId:"sortModel",propModel:t.sortModel,propOnChange:t.onSortModelChange,stateSelector:gD,changeEvent:"sortModelChange"});const r=s.useCallback((t,n)=>{const r=gD(e),o=r.findIndex(e=>e.field===t);let i=[...r];return o>-1?null==n?.sort?i.splice(o,1):i.splice(o,1,n):i=[...r,n],i},[e]),o=s.useCallback((n,r)=>{const o=gD(e).find(e=>e.field===n.field);if(o){const e=void 0===r?CI(n.sortingOrder??t.sortingOrder,o.sort):r;return void 0===e?void 0:f({},o,{sort:e})}return{field:n.field,sort:void 0===r?CI(n.sortingOrder??t.sortingOrder):r}},[e,t.sortingOrder]),i=s.useCallback((e,n)=>null==n||!1===n.sortable||t.disableColumnSorting?e:(n.sortingOrder||t.sortingOrder).some(e=>!!e)?[...e,"columnMenuSortItem"]:e,[t.sortingOrder,t.disableColumnSorting]),a=s.useCallback(()=>{e.current.setState(r=>{if("server"===t.sortingMode)return n.debug("Skipping sorting rows as sortingMode = server"),f({},r,{sorting:f({},r.sorting,{sortedRows:BT(xT(e),OT,!1)})});const o=gD(e),i=SI(o,e),a=e.current.applyStrategyProcessor("sorting",{sortRowList:i});return f({},r,{sorting:f({},r.sorting,{sortedRows:a})})}),e.current.publishEvent("sortedRowsSet")},[e,n,t.sortingMode]),l=s.useCallback(r=>{gD(e)!==r&&(n.debug("Setting sort model"),e.current.setState(xI(r,t.disableMultipleColumnsSorting)),e.current.applySorting())},[e,n,t.disableMultipleColumnsSorting]),c=s.useCallback((n,i,a)=>{const l=e.current.getColumn(n),s=o(l,i);let c;c=!a||t.disableMultipleColumnsSorting?null==s?.sort?[]:[s]:r(l.field,s),e.current.setSortModel(c)},[e,r,o,t.disableMultipleColumnsSorting]),u=s.useCallback(()=>gD(e),[e]),d=s.useCallback(()=>mD(e).map(e=>e.model),[e]),p=s.useCallback(()=>hD(e),[e]),h=s.useCallback(t=>e.current.getSortedRowIds()[t],[e]);vL(e,{getSortModel:u,getSortedRows:d,getSortedRowIds:p,getRowIdFromRowIndex:h,setSortModel:l,sortColumn:c,applySorting:a},"public");const m=s.useCallback((n,r)=>{const o=gD(e);return!r.exportOnlyDirtyModels||null!=t.sortModel||null!=t.initialState?.sorting?.sortModel||o.length>0?f({},n,{sorting:{sortModel:o}}):n},[e,t.sortModel,t.initialState?.sorting?.sortModel]),g=s.useCallback((n,r)=>{const o=r.stateToRestore.sorting?.sortModel;return null==o?n:(e.current.setState(xI(o,t.disableMultipleColumnsSorting)),f({},n,{callbacks:[...n.callbacks,e.current.applySorting]}))},[e,t.disableMultipleColumnsSorting]),v=s.useCallback(t=>{const n=xT(e),r=n[OT],o=t.sortRowList?t.sortRowList(r.children.map(e=>n[e])):[...r.children];return null!=r.footerId&&o.push(r.footerId),o},[e]);pN(e,"exportState",m),pN(e,"restoreState",g),fB(e,hB,"sorting",v);const b=s.useCallback(({field:e,colDef:n},r)=>{if(!n.sortable||t.disableColumnSorting)return;const o="always"===t.multipleColumnsSortingMode||r.shiftKey||r.metaKey||r.ctrlKey;c(e,void 0,o)},[c,t.disableColumnSorting,t.multipleColumnsSortingMode]),y=s.useCallback(({field:e,colDef:n},r)=>{n.sortable&&!t.disableColumnSorting&&("Enter"!==r.key||r.ctrlKey||r.metaKey||c(e,void 0,"always"===t.multipleColumnsSortingMode||r.shiftKey))},[c,t.disableColumnSorting,t.multipleColumnsSortingMode]),w=s.useCallback(()=>{const t=gD(e),n=iO(e);if(t.length>0){const r=t.filter(e=>n[e.field]);r.length<t.length&&e.current.setSortModel(r)}},[e]),x=s.useCallback(t=>{"sorting"===t&&e.current.applySorting()},[e]);pN(e,"columnMenu",i),rI(e,"columnHeaderClick",b),rI(e,"columnHeaderKeyDown",y),rI(e,"rowsSet",e.current.applySorting),rI(e,"columnsChange",w),rI(e,"activeStrategyProcessorChange",x),wL(()=>{"DataGrid"===t.signature&&e.current.applySorting()}),Wh(()=>{void 0!==t.sortModel&&e.current.setSortModel(t.sortModel)},[e,t.sortModel])})(e,t),((e,t)=>{const n=bL(e,"useDensity");e.current.registerControlState({stateId:"density",propModel:t.density,propOnChange:t.onDensityChange,stateSelector:hI,changeEvent:"densityChange"});const r=Mg(t=>{hI(e)!==t&&(n.debug(`Set grid density to ${t}`),e.current.setState(e=>f({},e,{density:t})))});vL(e,{setDensity:r},"public");const o=s.useCallback((n,r)=>{const o=hI(e);return r.exportOnlyDirtyModels&&null==t.density&&null==t.initialState?.density?n:f({},n,{density:o})},[e,t.density,t.initialState?.density]),i=s.useCallback((t,n)=>{const r=n.stateToRestore?.density?n.stateToRestore.density:hI(e);return e.current.setState(e=>f({},e,{density:r})),t},[e]);pN(e,"exportState",o),pN(e,"restoreState",i),s.useEffect(()=>{t.density&&e.current.setDensity(t.density)},[e,t.density])})(e,t),M_(e,t),WB(e,t),((e,t)=>{const n=um(),r=bL(e,"useGridScroll"),o=e.current.columnHeadersContainerRef,i=e.current.virtualScrollerRef,a=s.useCallback(n=>{const o=oT(e),a=vT(e),l=cO(e);if(null!=n.rowIndex&&0===a||0===l.length)return!1;r.debug(`Scrolling to cell at row ${n.rowIndex}, col: ${n.colIndex} `);let s={};if(void 0!==n.colIndex){const t=hO(e);let r;if(void 0!==n.rowIndex){const t=CD(e),o=t[n.rowIndex]?.id,i=e.current.unstable_getCellColSpanInfo(o,n.colIndex);i&&!i.spannedByColSpan&&(r=i.cellProps.width)}void 0===r&&(r=l[n.colIndex].computedWidth),s.left=l_({containerSize:o.viewportOuterSize.width,scrollPosition:Math.abs(i.current.scrollLeft),elementSize:r,elementOffset:t[n.colIndex]})}if(void 0!==n.rowIndex){const r=mT(e),a=uF(e),l=dF(e),c=t.pagination?n.rowIndex-a*l:n.rowIndex,u=r.positions[c+1]?r.positions[c+1]-r.positions[c]:r.currentPageTotalHeight-r.positions[c];s.top=l_({containerSize:o.viewportInnerSize.height,scrollPosition:i.current.scrollTop,elementSize:u,elementOffset:r.positions[c]})}return s=e.current.unstable_applyPipeProcessors("scrollToIndexes",s,n),(void 0!==s.left||void 0!==s.top)&&(e.current.scroll(s),!0)},[r,e,i,t.pagination]),l=s.useCallback(e=>{if(i.current&&void 0!==e.left&&o.current){const t=n?-1:1;o.current.scrollLeft=e.left,i.current.scrollLeft=t*e.left,r.debug(`Scrolling left: ${e.left}`)}i.current&&void 0!==e.top&&(i.current.scrollTop=e.top,r.debug(`Scrolling top: ${e.top}`)),r.debug("Scrolling, updating container, and viewport")},[i,n,o,r]),c=s.useCallback(()=>i?.current?{top:i.current.scrollTop,left:i.current.scrollLeft}:{top:0,left:0},[i]);vL(e,{scroll:l,scrollToIndexes:a,getScrollPosition:c},"public")})(e,t),(e=>{const t=bL(e,"useGridColumnMenu"),n=s.useRef({}),r=s.useCallback(()=>{n.current.wheel?.(),n.current.touchMove?.()},[]),o=s.useCallback(()=>{r(),n.current.wheel=e.current.subscribeEvent("virtualScrollerWheel",e.current.hideColumnMenu),n.current.touchMove=e.current.subscribeEvent("virtualScrollerTouchMove",e.current.hideColumnMenu)},[e,r]),i=s.useCallback(n=>{const r=RL(e),i=n;(!0!==r.open||i!==r.field)&&(e.current.setState(e=>e.columnMenu.open&&e.columnMenu.field===n?e:(t.debug("Opening Column Menu"),o(),f({},e,{columnMenu:{open:!0,field:n}}))),e.current.hidePreferences())},[e,t,o]),a=s.useCallback(()=>{const n=RL(e);if(n.field){const t=iO(e),r=lO(e),o=oO(e);let i=n.field;if(t[i]||(i=o[0]),!1===r[i]){const e=o.filter(e=>e===i||!1!==r[e]),t=e.indexOf(i);i=e[t+1]||e[t-1]}e.current.setColumnHeaderFocus(i)}const o={open:!1,field:void 0};(o.open!==n.open||o.field!==n.field)&&e.current.setState(e=>(t.debug("Hiding Column Menu"),r(),f({},e,{columnMenu:o})))},[e,t,r]),l=s.useCallback(n=>{t.debug("Toggle Column Menu");const r=RL(e);r.open&&r.field===n?a():i(n)},[e,t,i,a]);vL(e,{showColumnMenu:i,hideColumnMenu:a,toggleColumnMenu:l},"public"),rI(e,"columnResizeStart",a)})(e),OB(e,t),FB(e,t),kB(e,t),function(e,t){const n=s.useCallback(()=>oT(e),[e]),r={updateDimensions:()=>e.current.virtualizer.api.updateDimensions(),getViewportPageSize:()=>e.current.virtualizer.api.getViewportPageSize()};vL(e,{getRootDimensions:n},"public"),vL(e,r,"private"),iI(e,"rootMount",t=>{p_(t,oT(e))}),iI(e,"debouncedResize",t.onResize),QM(e.current.store,e=>e.dimensions,(t,n)=>{var r,o;n.isReady&&(e.current.rootElementRef.current&&p_(e.current.rootElementRef.current,n),r=n.viewportInnerSize,o=t.viewportInnerSize,(r.width!==o.width||r.height!==o.height)&&e.current.publishEvent("viewportInnerSizeChange",n.viewportInnerSize),e.current.publishEvent("debouncedResize",n.root))})}(e,t),function(e,t){iI(e,"columnHeaderClick",t.onColumnHeaderClick),iI(e,"columnHeaderContextMenu",t.onColumnHeaderContextMenu),iI(e,"columnHeaderDoubleClick",t.onColumnHeaderDoubleClick),iI(e,"columnHeaderOver",t.onColumnHeaderOver),iI(e,"columnHeaderOut",t.onColumnHeaderOut),iI(e,"columnHeaderEnter",t.onColumnHeaderEnter),iI(e,"columnHeaderLeave",t.onColumnHeaderLeave),iI(e,"cellClick",t.onCellClick),iI(e,"cellDoubleClick",t.onCellDoubleClick),iI(e,"cellKeyDown",t.onCellKeyDown),iI(e,"preferencePanelClose",t.onPreferencePanelClose),iI(e,"preferencePanelOpen",t.onPreferencePanelOpen),iI(e,"menuOpen",t.onMenuOpen),iI(e,"menuClose",t.onMenuClose),iI(e,"rowDoubleClick",t.onRowDoubleClick),iI(e,"rowClick",t.onRowClick),iI(e,"stateChange",t.onStateChange)}(e,t),(e=>{const t=s.useCallback((t={})=>e.current.unstable_applyPipeProcessors("exportState",{},t),[e]),n=s.useCallback(t=>{e.current.unstable_applyPipeProcessors("restoreState",{callbacks:[]},{stateToRestore:t}).callbacks.forEach(e=>{e()})},[e]);vL(e,{exportState:t,restoreState:n},"public")})(e),function(e,t){const{autoHeight:n,disableVirtualization:r}=t,o=t=>{const{virtualizer:r}=e.current;t&&=BA;const o=r.store.getSnapshot();o.virtualization.enabled===t&&o.virtualization.enabledForRows===t&&o.virtualization.enabledForColumns===t||r.store.set("virtualization",f({},r.store.state.virtualization,{enabled:t,enabledForColumns:t,enabledForRows:t&&!n}))};vL(e,{unstable_setVirtualization:o,unstable_setColumnVirtualization:t=>{const{virtualizer:n}=e.current;t&&=BA,n.store.getSnapshot().virtualization.enabledForColumns!==t&&n.store.set("virtualization",f({},n.store.state.virtualization,{enabledForColumns:t}))}},"public");const i=()=>{const{virtualizer:t}=e.current;t?.api.scheduleUpdateRenderContext()};e.current.register("private",{updateRenderContext:i}),iI(e,"sortedRowsSet",i),iI(e,"paginationModelChange",i),iI(e,"columnsChange",i),s.useEffect(()=>{e.current.virtualizer&&o(!t.disableVirtualization)},[e,r,n])}(e,t),function(e,t){const n=()=>{e.current.setState(t=>t.listViewColumn?f({},t,{listViewColumn:f({},t.listViewColumn,{computedWidth:N_(e)})}):t)},r=s.useRef(null);rI(e,"viewportInnerSizeChange",e=>{r.current!==e.width&&(r.current=e.width,n())}),rI(e,"columnVisibilityModelChange",n),Wh(()=>{const n=t.listViewColumn;n&&e.current.setState(t=>f({},t,{listViewColumn:f({},n,{computedWidth:N_(e)})}))},[e,t.listViewColumn]),s.useEffect(()=>{t.listView&&t.listViewColumn},[t.listView,t.listViewColumn])}(e,t),V_(e,t),wL(()=>{e.current.runAppliersForPendingProcessors()}),s.useEffect(()=>{e.current.runAppliersForPendingProcessors()})};function U_(e){const{groupId:t,width:n,depth:r,maxDepth:o,fields:i,height:a,colIndex:l,hasFocus:c,tabIndex:u,isLastColumn:d,pinnedPosition:p,pinnedOffset:h}=e,m=rP(),g=um(),v=s.useRef(null),b=lP(),y=pI(b,JF),w=t?y[t]:{},{headerName:x=t??"",description:S="",headerAlign:C}=w;let k;const E=t&&y[t]?.renderHeaderGroup,R=s.useMemo(()=>({groupId:t,headerName:x,description:S,depth:r,maxDepth:o,fields:i,colIndex:l,isLastColumn:d}),[t,x,S,r,o,i,l,d]);t&&E&&(k=E(R));const P=f({},e,{classes:m.classes,headerAlign:C,depth:r,isDragging:!1}),M=x??t,T=mm(),I=null===t?`empty-group-cell-${T}`:t,O=(e=>{const{classes:t,headerAlign:n,isDragging:r,isLastColumn:o,showLeftBorder:i,showRightBorder:a,groupId:l,pinnedPosition:s}=e;return wm({root:["columnHeader","left"===n&&"columnHeader--alignLeft","center"===n&&"columnHeader--alignCenter","right"===n&&"columnHeader--alignRight",r&&"columnHeader--moving",a&&"columnHeader--withRightBorder",i&&"columnHeader--withLeftBorder","withBorderColor",null===l?"columnHeader--emptyGroup":"columnHeader--filledGroup",s===nD.LEFT&&"columnHeader--pinnedLeft",s===nD.RIGHT&&"columnHeader--pinnedRight",o&&"columnHeader--last"],draggableContainer:["columnHeaderDraggableContainer"],titleContainer:["columnHeaderTitleContainer","withBorderColor"],titleContainerContent:["columnHeaderTitleContainerContent"]},YT,t)})(P);s.useLayoutEffect(()=>{if(c){const e=v.current.querySelector('[tabindex="0"]')||v.current;if(!e)return;if(CN())e.focus({preventScroll:!0});else{const t=b.current.getScrollPosition();e.focus(),b.current.scroll(t)}}},[b,c]);const D=s.useCallback(e=>t=>{v$(t)||b.current.publishEvent(e,R,t)},[b,R]),F=s.useMemo(()=>({onKeyDown:D("columnGroupHeaderKeyDown"),onFocus:D("columnGroupHeaderFocus"),onBlur:D("columnGroupHeaderBlur")}),[D]),L="function"==typeof w.headerClassName?w.headerClassName(R):w.headerClassName,A=s.useMemo(()=>EN(f({},e.style),g,p,h),[p,h,e.style,g]);return Xp.jsx(D$,f({ref:v,classes:O,columnMenuOpen:!1,colIndex:l,height:a,isResizing:!1,sortDirection:null,hasFocus:!1,tabIndex:u,isDraggable:!1,headerComponent:k,headerClassName:L,description:S,elementId:I,width:n,columnMenuIconButton:null,columnTitleIconButtons:null,resizable:!1,label:M,"aria-colspan":i.length,"data-fields":`|-${i.join("-|-")}-|`,style:A},F))}const G_={root:XT.scrollbarFiller,pinnedRight:XT["scrollbarFiller--pinnedRight"]};function K_({pinnedRight:e}){return Xp.jsx("div",{role:"presentation",className:PR(G_.root,e&&G_.pinnedRight)})}const q_=pg("div",{name:"MuiDataGrid",slot:"ColumnHeaderRow"})({display:"flex"}),Y_=["className"],X_=jh("div",{name:"MuiDataGrid",slot:"ColumnHeaders"})({display:"flex",flexDirection:"column",borderTopLeftRadius:"var(--unstable_DataGrid-radius)",borderTopRightRadius:"var(--unstable_DataGrid-radius)"}),Q_=TR(function(e,t){const{className:n}=e,r=d(e,Y_),o=rP(),i=(e=>{const{classes:t}=e;return wm({root:["columnHeaders"]},YT,t)})(o);return Xp.jsx(X_,f({className:PR(i.root,n),ownerState:o},r,{role:"presentation",ref:t}))}),Z_=["className","visibleColumns","sortColumnLookup","filterColumnLookup","columnHeaderTabIndexState","columnGroupHeaderTabIndexState","columnHeaderFocus","columnGroupHeaderFocus","headerGroupingMaxDepth","columnMenuState","columnVisibility","columnGroupsHeaderStructure","hasOtherElementInTabSequence"],J_=TR(function(e,t){const{visibleColumns:n,sortColumnLookup:r,filterColumnLookup:o,columnHeaderTabIndexState:i,columnGroupHeaderTabIndexState:a,columnHeaderFocus:l,columnGroupHeaderFocus:c,headerGroupingMaxDepth:u,columnMenuState:p,columnVisibility:h,columnGroupsHeaderStructure:m,hasOtherElementInTabSequence:g}=e,v=d(e,Z_),{getInnerProps:b,getColumnHeadersRow:y,getColumnGroupHeadersRows:w}=(e=>{const{visibleColumns:t,sortColumnLookup:n,filterColumnLookup:r,columnHeaderTabIndexState:o,columnGroupHeaderTabIndexState:i,columnHeaderFocus:a,columnGroupHeaderFocus:l,headerGroupingMaxDepth:c,columnMenuState:u,columnVisibility:d,columnGroupsHeaderStructure:p,hasOtherElementInTabSequence:h}=e,[m,g]=s.useState(""),[v,b]=s.useState(""),y=mL(),w=rP(),x=pI(y,ZF),S=pI(y,hO),C=pI(y,UA),k=pI(y,pO),E=pI(y,iO),R=EA(S,C,k.left.length),P=pI(y,iT),M=pI(y,cT),T=pI(y,uT),I=pI(y,dT),O=pI(y,fT),D=s.useCallback(e=>b(e.field),[]),F=s.useCallback(()=>b(""),[]),L=s.useCallback(e=>g(e.field),[]),A=s.useCallback(()=>g(""),[]),N=s.useMemo(()=>k.left.length?{firstColumnIndex:0,lastColumnIndex:k.left.length}:null,[k.left.length]),$=s.useMemo(()=>k.right.length?{firstColumnIndex:t.length-k.right.length,lastColumnIndex:t.length}:null,[k.right.length,t.length]);rI(y,"columnResizeStart",D),rI(y,"columnResizeStop",F),rI(y,"columnHeaderDragStart",L),rI(y,"columnHeaderDragEndNative",A);const z=e=>{const{renderContext:n=C}=e||{},r=n.firstColumnIndex,o=Math.min(n.lastColumnIndex,t.length);return{renderedColumns:t.slice(r,o),firstColumnToRender:r,lastColumnToRender:o}},j=(e,t,n,r=!1)=>{const o=e?.position===nD.RIGHT,i=void 0===e?.position,a=k.right.length>0&&o||0===k.right.length&&i,l=R-n;return Xp.jsxs(s.Fragment,{children:[i&&Xp.jsx("div",{role:"presentation",style:{width:l}}),t,i&&Xp.jsx("div",{role:"presentation",className:PR(XT.filler,r&&XT["filler--borderBottom"])}),a&&Xp.jsx(K_,{pinnedRight:o})]})},B=(e,t={})=>{const{renderedColumns:i,firstColumnToRender:l}=z(e),s=[];for(let c=0;c<i.length;c+=1){const d=i[c],p=l+c,g=0===p,b=null!==o&&o.field===d.field||g&&!h?0:-1,y=null!==a&&a.field===d.field,x=u.open&&u.field===d.field,C=e?.position,k=Fj(C,d.computedWidth,p,S,P,O),E=C===nD.RIGHT?i[c-1]:i[c+1],R=!!E&&null!==a&&a.field===E.field,I=c,D=i.length,F=Aj(C,I,w.showColumnVerticalBorder,w.pinnedColumnsSectionSeparator),L=Lj(C,I,D,w.showColumnVerticalBorder,M,w.pinnedColumnsSectionSeparator);s.push(Xp.jsx(F$,f({},n[d.field],{columnMenuOpen:x,filterItemsCounter:r[d.field]&&r[d.field].length,headerHeight:T,isDragging:d.field===m,colDef:d,colIndex:p,isResizing:v===d.field,isLast:p===S.length-1,hasFocus:y,tabIndex:b,pinnedPosition:C,pinnedOffset:k,isSiblingFocused:R,showLeftBorder:F,showRightBorder:L},t),d.field))}return j(e,s,0)},_=({depth:e,params:n})=>{const r=z(n);if(0===r.renderedColumns.length)return null;const{firstColumnToRender:o,lastColumnToRender:a}=r,s=p[e],u=t[o].field,h=x[u]?.[e]??null,m=s.findIndex(({groupId:e,columnFields:t})=>e===h&&t.includes(u)),g=t[a-1].field,v=x[g]?.[e]??null,b=s.findIndex(({groupId:e,columnFields:t})=>e===v&&t.includes(g)),y=s.slice(m,b+1).map(e=>f({},e,{columnFields:e.columnFields.filter(e=>!1!==d[e])})).filter(e=>e.columnFields.length>0),C=y[0].columnFields.indexOf(u),k=y[0].columnFields.slice(0,C).reduce((e,t)=>e+(E[t].computedWidth??0),0);let R=o;const T=y.map(({groupId:t,columnFields:r},o)=>{const a=null!==l&&l.depth===e&&r.includes(l.field),s=null!==i&&i.depth===e&&r.includes(i.field)?0:-1,u={width:r.reduce((e,t)=>e+E[t].computedWidth,0),fields:r,colIndex:R},d=n.position,p=Fj(d,u.width,R,S,P,O);R+=r.length;let f=o;return d===nD.LEFT&&(f=R-1),Xp.jsx(U_,{groupId:t,width:u.width,fields:u.fields,colIndex:u.colIndex,depth:e,isLastColumn:o===y.length-1,maxDepth:c,height:I,hasFocus:a,tabIndex:s,pinnedPosition:d,pinnedOffset:p,showLeftBorder:Aj(d,f,w.showColumnVerticalBorder,w.pinnedColumnsSectionSeparator),showRightBorder:Lj(d,f,y.length,w.showColumnVerticalBorder,M,w.pinnedColumnsSectionSeparator)},o)});return j(n,T,k)};return{renderContext:C,leftRenderContext:N,rightRenderContext:$,pinnedColumns:k,visibleColumns:t,columnPositions:S,getFillers:j,getColumnHeadersRow:()=>Xp.jsxs(q_,{role:"row","aria-rowindex":c+1,ownerState:w,className:XT["row--borderBottom"],style:{height:T},children:[N&&B({position:nD.LEFT,renderContext:N},{disableReorder:!0}),B({renderContext:C}),$&&B({position:nD.RIGHT,renderContext:$},{disableReorder:!0,separatorSide:M$.Left})]}),getColumnsToRender:z,getColumnGroupHeadersRows:()=>{if(0===c)return null;const e=[];for(let t=0;t<c;t+=1)e.push(Xp.jsxs(q_,{role:"row","aria-rowindex":t+1,ownerState:w,style:{height:I},children:[N&&_({depth:t,params:{position:nD.LEFT,renderContext:N,maxLastColumn:N.lastColumnIndex}}),_({depth:t,params:{renderContext:C}}),$&&_({depth:t,params:{position:nD.RIGHT,renderContext:$,maxLastColumn:$.lastColumnIndex}})]},t));return e},getPinnedCellOffset:Fj,isDragging:!!m,getInnerProps:()=>({role:"rowgroup"})}})({visibleColumns:n,sortColumnLookup:r,filterColumnLookup:o,columnHeaderTabIndexState:i,columnGroupHeaderTabIndexState:a,columnHeaderFocus:l,columnGroupHeaderFocus:c,headerGroupingMaxDepth:u,columnMenuState:p,columnVisibility:h,columnGroupsHeaderStructure:m,hasOtherElementInTabSequence:g});return Xp.jsxs(Q_,f({},v,b(),{ref:t,children:[w(),y()]}))}),eH=KT(J_);const tH=TR(function(e,t){const n=lP().current.getLocaleText("noResultsOverlayLabel");return Xp.jsx(r$,f({},e,{ref:t,children:n}))}),nH=jh("div")({position:"sticky",zIndex:40,bottom:"calc(var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize))"});const rH=f({},SM,{cell:TN,skeletonCell:AN,columnHeaderFilterIconButton:function(e){return e.counter?Xp.jsx(H$,f({},e)):null},columnHeaderSortIcon:_$,columnMenu:ez,columnHeaders:eH,detailPanels:function(e){return null},bottomContainer:function(e){const t=wm({root:["bottomContainer"]},YT,{});return Xp.jsx(nH,f({},e,{className:PR(t.root,XT["container--bottom"]),role:"presentation"}))},footer:Dj,footerRowCount:Yj,toolbar:function(e){const{showQuickFilter:t=!0,quickFilterProps:n,csvOptions:r,printOptions:o,additionalItems:i,additionalExportMenuItems:a}=e,l=d(e,Cj),c=lP(),u=rP(),[p,h]=s.useState(!1),m=s.useRef(null),g=mm(),v=mm(),b=!r?.disableToolbarButton||!o?.disableToolbarButton||a,y=()=>h(!1);return Xp.jsxs(c$,f({},l,{children:[u.label&&Xp.jsx(Mj,{children:u.label}),!u.disableColumnSelector&&Xp.jsx(u.slots.baseTooltip,{title:c.current.getLocaleText("toolbarColumns"),children:Xp.jsx(gj,{render:Xp.jsx(d$,{}),children:Xp.jsx(u.slots.columnSelectorIcon,{fontSize:"small"})})}),!u.disableColumnFilter&&Xp.jsx(u.slots.baseTooltip,{title:c.current.getLocaleText("toolbarFilters"),children:Xp.jsx(hj,{render:(e,t)=>Xp.jsx(d$,f({},e,{color:t.filterCount>0?"primary":"default",children:Xp.jsx(u.slots.baseBadge,{badgeContent:t.filterCount,color:"primary",variant:"dot",children:Xp.jsx(u.slots.openFilterButtonIcon,{fontSize:"small"})})}))})}),i,b&&(!u.disableColumnFilter||!u.disableColumnSelector)&&Xp.jsx(Pj,{}),b&&Xp.jsxs(s.Fragment,{children:[Xp.jsx(u.slots.baseTooltip,{title:c.current.getLocaleText("toolbarExport"),disableInteractive:p,children:Xp.jsx(d$,{ref:m,id:v,"aria-controls":g,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:()=>h(!p),children:Xp.jsx(u.slots.exportIcon,{fontSize:"small"})})}),Xp.jsx(UO,{target:m.current,open:p,onClose:y,position:"bottom-end",children:Xp.jsxs(u.slots.baseMenuList,f({id:g,"aria-labelledby":v,autoFocusItem:!0},u.slotProps?.baseMenuList,{children:[!o?.disableToolbarButton&&Xp.jsx(wj,{render:Xp.jsx(u.slots.baseMenuItem,f({},u.slotProps?.baseMenuItem)),options:o,onClick:y,children:c.current.getLocaleText("toolbarExportPrint")}),!r?.disableToolbarButton&&Xp.jsx(bj,{render:Xp.jsx(u.slots.baseMenuItem,f({},u.slotProps?.baseMenuItem)),options:r,onClick:y,children:c.current.getLocaleText("toolbarExportCSV")}),a?.(y)]}))})]}),t&&Xp.jsxs(s.Fragment,{children:[Xp.jsx(Pj,{}),Xp.jsx(pj,f({},n))]})]}))},pinnedRows:function(e){return null},loadingOverlay:Vj,noResultsOverlay:tH,noRowsOverlay:Wj,noColumnsOverlay:Uj,pagination:function(){const e=lP(),t=rP(),n=pI(e,lF),r=pI(e,sF),o=pI(e,pF),{paginationMode:i,loading:a}=t,l=-1===r&&"server"===i&&a,c=s.useMemo(()=>Math.max(0,o-1),[o]),u=s.useMemo(()=>-1===r||n.page<=c?n.page:c,[c,n.page,r]),d=s.useCallback(t=>{e.current.setPageSize(t)},[e]),p=s.useCallback((t,n)=>{e.current.setPage(n)},[e]),h=(e=>{for(let n=0;n<t.pageSizeOptions.length;n+=1){const r=t.pageSizeOptions[n];if("number"==typeof r){if(r===e)return!0}else if(r.value===e)return!0}return!1})(n.pageSize)?t.pageSizeOptions:[];return Xp.jsx(Gj,f({as:t.slots.basePagination,count:r,page:u,rowsPerPageOptions:h,rowsPerPage:n.pageSize,onPageChange:p,onRowsPerPageChange:d,disabled:l},t.slotProps?.basePagination))},filterPanel:Mz,columnsPanel:function(e){const t=rP();return Xp.jsx(rz,f({},e,{children:Xp.jsx(t.slots.columnsManagement,f({},t.slotProps?.columnsManagement))}))},columnsManagement:function(e){const t=lP(),n=s.useRef(null),r=pI(t,sO),o=pI(t,lO),i=rP(),[a,l]=s.useState(""),c=(e=>{const{classes:t}=e;return wm({root:["columnsManagement"],header:["columnsManagementHeader"],searchInput:["columnsManagementSearchInput"],footer:["columnsManagementFooter"],row:["columnsManagementRow"]},YT,t)})(i),u=pI(t,aO),d=pI(t,SL),p=pI(t,kL),h=s.useMemo(()=>d?Array.from(p.values()):u,[d,p,u]),{sort:m,searchPredicate:g=Tz,autoFocusSearchField:v=!0,disableShowHideToggle:b=!1,disableResetButton:y=!1,toggleAllMode:w="all",getTogglableColumns:x,searchInputProps:S,searchDebounceMs:C=i.columnFilterDebounceMs}=e,k=s.useMemo(()=>Cg(e=>{l(e)},C??150),[C]),E=s.useMemo(()=>((e,t)=>{const n=new Set(Object.keys(e).filter(t=>!1===e[t])),r=new Set(Object.keys(t).filter(e=>!1===t[e]));if(n.size!==r.size)return!1;let o=!0;return n.forEach(e=>{r.has(e)||(o=!1)}),o})(o,r),[o,r]),R=s.useMemo(()=>{switch(m){case"asc":return[...h].sort((e,t)=>Az.compare(e.headerName||e.field,t.headerName||t.field));case"desc":return[...h].sort((e,t)=>-Az.compare(e.headerName||e.field,t.headerName||t.field));default:return h}},[h,m]),P=e=>{const{name:n}=e.target;t.current.setColumnVisibility(n,!1===o[n])},M=s.useMemo(()=>{const e=x?x(R):null,t=e?R.filter(({field:t})=>e.includes(t)):R;return a?t.filter(e=>g(e,a.toLowerCase())):t},[R,a,g,x]),T=s.useCallback(e=>{const n=f({},lO(t)),r=x?x(h):null;return("filteredOnly"===w?M:h).forEach(t=>{t.hideable&&(null==r||r.includes(t.field))&&(e?delete n[t.field]:n[t.field]=!1)}),t.current.setColumnVisibilityModel(n)},[t,h,x,w,M]),I=s.useCallback(e=>{k(e.target.value)},[k]),O=s.useMemo(()=>M.filter(e=>e.hideable),[M]),D=s.useMemo(()=>O.every(e=>null==o[e.field]||!1!==o[e.field]),[o,O]),F=s.useMemo(()=>O.every(e=>!1===o[e.field]),[o,O]),L=s.useRef(null);s.useEffect(()=>{v?n.current?.focus():L.current&&"function"==typeof L.current.focus&&L.current.focus()},[v]);let A=!1;const N=e=>!1===A&&!1!==e.hideable&&(A=!0,!0),$=s.useCallback(()=>{l(""),n.current&&(n.current.value="",n.current.focus())},[]);return Xp.jsxs(s.Fragment,{children:[Xp.jsx(zz,{className:c.header,ownerState:i,children:Xp.jsx(jz,f({as:i.slots.baseTextField,ownerState:i,placeholder:t.current.getLocaleText("columnsManagementSearchTitle"),inputRef:n,className:c.searchInput,onChange:I,size:"small",type:"search",slotProps:{input:{startAdornment:Xp.jsx(i.slots.quickFilterIcon,{fontSize:"small"}),endAdornment:Xp.jsx(i.slots.baseIconButton,f({size:"small","aria-label":t.current.getLocaleText("columnsManagementDeleteIconLabel"),style:a?{visibility:"visible"}:{visibility:"hidden"},tabIndex:-1,onClick:$,edge:"end"},i.slotProps?.baseIconButton,{children:Xp.jsx(i.slots.quickFilterClearIcon,{fontSize:"small"})}))},htmlInput:{"aria-label":t.current.getLocaleText("columnsManagementSearchTitle")}},autoComplete:"off",fullWidth:!0},i.slotProps?.baseTextField,S))}),Xp.jsx($z,{ownerState:i,children:Xp.jsxs(Nz,{className:c.root,ownerState:i,children:[M.map(e=>Xp.jsx(Hz,f({as:i.slots.baseCheckbox,className:c.row,disabled:!1===e.hideable||d,checked:!1!==o[e.field],onChange:P,name:e.field,inputRef:N(e)?L:void 0,label:e.headerName||e.field,density:"compact",fullWidth:!0},i.slotProps?.baseCheckbox),e.field)),0===M.length&&Xp.jsx(_z,{ownerState:i,children:t.current.getLocaleText("columnsManagementNoColumns")})]})}),b&&y?null:Xp.jsxs(Bz,{ownerState:i,className:c.footer,children:[b?Xp.jsx("span",{}):Xp.jsx(i.slots.baseCheckbox,f({disabled:0===O.length||d,checked:D,indeterminate:!D&&!F,onChange:()=>T(!D),name:t.current.getLocaleText("columnsManagementShowHideAllText"),label:t.current.getLocaleText("columnsManagementShowHideAllText"),density:"compact"},i.slotProps?.baseCheckbox)),y?null:Xp.jsx(i.slots.baseButton,f({onClick:()=>t.current.setColumnVisibilityModel(r),disabled:E||d},i.slotProps?.baseButton,{children:t.current.getLocaleText("columnsManagementReset")}))]})]})},panel:sz,row:iB}),oH={disableMultipleColumnsFiltering:!0,disableMultipleColumnsSorting:!0,throttleRowsMs:void 0,hideFooterRowCount:!1,pagination:!0,checkboxSelectionVisibleOnly:!1,disableColumnReorder:!0,keepColumnPositionIfDraggedOutside:!1,signature:"DataGrid",listView:!1},iH=rH,aH=e=>{const t=sg(),n=s.useMemo(()=>Vh({props:e,theme:t,name:"MuiDataGrid"}),[t,e]),r=s.useMemo(()=>f({},qT,n.localeText),[n.localeText]),o=s.useMemo(()=>function({defaultSlots:e,slots:t}){const n=t;if(!n||0===Object.keys(n).length)return e;const r=f({},e);return Object.keys(n).forEach(e=>{const t=e;void 0!==n[t]&&(r[t]=n[t])}),r}({defaultSlots:iH,slots:n.slots}),[n.slots]),i=s.useMemo(()=>Object.keys(dN).reduce((e,t)=>(e[t]=n[t]??dN[t],e),{}),[n]);return s.useMemo(()=>f({},n,i,{localeText:r,slots:o},(e=>f({},oH,e.dataSource?{filterMode:"server",sortingMode:"server",paginationMode:"server"}:{}))(n)),[n,r,o,i])};class lH{maxListeners=20;warnOnce=!1;events={};on(e,t,n={}){let r=this.events[e];r||(r={highPriority:new Map,regular:new Map},this.events[e]=r),n.isFirst?r.highPriority.set(t,!0):r.regular.set(t,!0)}removeListener(e,t){this.events[e]&&(this.events[e].regular.delete(t),this.events[e].highPriority.delete(t))}removeAllListeners(){this.events={}}emit(e,...t){const n=this.events[e];if(!n)return;const r=Array.from(n.highPriority.keys()),o=Array.from(n.regular.keys());for(let e=r.length-1;e>=0;e-=1){const o=r[e];n.highPriority.has(o)&&o.apply(this,t)}for(let e=0;e<o.length;e+=1){const r=o[e];n.regular.has(r)&&r.apply(this,t)}}once(e,t){const n=this;this.on(e,function r(...o){n.removeListener(e,r),t.apply(n,o)})}}const sH=Symbol("mui.api_private");let cH=0;function uH(e,t){const n=s.useRef(null),r=s.useRef(null);r.current||(r.current=function(e){const t=e.current?.[sH];if(t)return t;const n={},r={state:n,store:JM.create(n),instanceId:{id:cH}};return cH+=1,r.getPublicApi=()=>e.current,r.register=(t,n)=>{Object.keys(n).forEach(o=>{const i=n[o],a=r[o];if(!0===a?.spying?a.target=i:r[o]=i,"public"===t){const t=e.current,n=t[o];!0===n?.spying?n.target=i:t[o]=i}})},r.register("private",{caches:{},eventManager:new lH}),r}(n)),n.current||(n.current=function(e){return{get state(){return e.current.state},get store(){return e.current.store},get instanceId(){return e.current.instanceId},[sH]:e.current}}(r));const o=s.useCallback((...e)=>{const[n,o,i={}]=e;if(i.defaultMuiPrevented=!1,(e=>void 0!==e.isPropagationStopped)(i)&&i.isPropagationStopped())return;const a=t.signature===QT.DataGridPro||t.signature===QT.DataGridPremium?{api:r.current.getPublicApi()}:{};r.current.eventManager.emit(n,o,i,a)},[r,t.signature]),i=s.useCallback((e,t,n)=>{r.current.eventManager.on(e,t,n);const o=r.current;return()=>{o.eventManager.removeListener(e,t)}},[r]);return vL(r,{subscribeEvent:i,publishEvent:o},"public"),e&&!e.current?.state&&(e.current=n.current),s.useImperativeHandle(e,()=>n.current,[n]),s.useEffect(()=>{const e=r.current;return()=>{e.publishEvent("unmount")}},[r]),r}const dH={hooks:{useCSSVariables:function(){const e=sg();return s.useMemo(()=>{const t=fP(function(e){const t=new WeakSet;return JSON.stringify(e,(e,n)=>{if("undefined"!=typeof window&&n===window||"undefined"!=typeof document&&n===document)return n.toString();if(null!==n&&"object"==typeof n){if(s.isValidElement(n))return null;if(t.has(n))return null;t.add(n)}return n})}(e)),n=function(e){const t=function(e){if(e.vars)return e.vars.palette.TableCell.border;if("light"===e.palette.mode)return im(tm(e.palette.divider,1),.88);return rm(tm(e.palette.divider,1),.68)}(e),n=(e.vars||e).palette.DataGrid,r=n?.bg??("dark"===e.palette.mode?`color-mix(in srgb, ${(e.vars||e).palette.background.paper} 95%, #fff)`:(e.vars||e).palette.background.paper),o=n?.headerBg??r,i=n?.pinnedBg??r,a=e.vars?`rgba(${e.vars.palette.background.defaultChannel} / ${e.vars.palette.action.disabledOpacity})`:tm(e.palette.background.default,e.palette.action.disabledOpacity),l="dark"===e.palette.mode?`color-mix(in srgb, ${(e.vars||e).palette.background.paper} 90%, #fff)`:(e.vars||e).palette.background.paper,s=e.vars?`rgb(${e.vars.palette.primary.mainChannel})`:e.palette.primary.main,c=function(e){if(e.vars)return e.vars.shape.borderRadius;return"number"==typeof e.shape.borderRadius?`${e.shape.borderRadius}px`:e.shape.borderRadius}(e),u=e.vars?.font?.body2??xP(e.typography.body2),d=e.vars?.font?.caption??xP(e.typography.caption),p=e.vars?.font?.body1??xP(e.typography.body1),f=bP.keys;return{[f.spacingUnit]:e.vars?e.vars.spacing??e.spacing(1):e.spacing(1),[f.colors.border.base]:t,[f.colors.background.base]:r,[f.colors.background.overlay]:l,[f.colors.background.backdrop]:a,[f.colors.foreground.base]:(e.vars||e).palette.text.primary,[f.colors.foreground.muted]:(e.vars||e).palette.text.secondary,[f.colors.foreground.accent]:(e.vars||e).palette.primary.dark,[f.colors.foreground.disabled]:(e.vars||e).palette.text.disabled,[f.colors.foreground.error]:(e.vars||e).palette.error.dark,[f.colors.interactive.hover]:(e.vars||e).palette.action.hover,[f.colors.interactive.hoverOpacity]:(e.vars||e).palette.action.hoverOpacity,[f.colors.interactive.focus]:wP((e.vars||e).palette.primary.main),[f.colors.interactive.focusOpacity]:(e.vars||e).palette.action.focusOpacity,[f.colors.interactive.disabled]:wP((e.vars||e).palette.action.disabled),[f.colors.interactive.disabledOpacity]:(e.vars||e).palette.action.disabledOpacity,[f.colors.interactive.selected]:s,[f.colors.interactive.selectedOpacity]:(e.vars||e).palette.action.selectedOpacity,[f.header.background.base]:o,[f.cell.background.pinned]:i,[f.radius.base]:c,[f.typography.fontFamily.base]:e.typography.fontFamily,[f.typography.fontWeight.light]:e.typography.fontWeightLight,[f.typography.fontWeight.regular]:e.typography.fontWeightRegular,[f.typography.fontWeight.medium]:e.typography.fontWeightMedium,[f.typography.fontWeight.bold]:e.typography.fontWeightBold,[f.typography.font.body]:u,[f.typography.font.small]:d,[f.typography.font.large]:p,[f.transitions.easing.easeIn]:e.transitions.easing.easeIn,[f.transitions.easing.easeOut]:e.transitions.easing.easeOut,[f.transitions.easing.easeInOut]:e.transitions.easing.easeInOut,[f.transitions.duration.short]:`${e.transitions.duration.shorter}ms`,[f.transitions.duration.base]:`${e.transitions.duration.short}ms`,[f.transitions.duration.long]:`${e.transitions.duration.standard}ms`,[f.shadows.base]:(e.vars||e).shadows[2],[f.shadows.overlay]:(e.vars||e).shadows[8],[f.zIndex.panel]:(e.vars||e).zIndex.modal,[f.zIndex.menu]:(e.vars||e).zIndex.modal}}(e);return{id:t,variables:n}},[e])},useGridAriaAttributes:()=>{const e=mL(),t=rP(),n=pI(e,cO),r=pI(e,MD),o=pI(e,tL),i=pI(e,IT),a=t["aria-label"],l=t["aria-labelledby"];return{role:"grid","aria-label":!a&&!l&&t.label?t.label:a,"aria-labelledby":l,"aria-colcount":n.length,"aria-rowcount":o+1+i+r,"aria-multiselectable":HD(t)}},useGridRowAriaAttributes:()=>{const e=mL(),t=pI(e,tL);return s.useCallback((n,r)=>{const o={},i=r+t+2;return o["aria-rowindex"]=i,n&&e.current.isRowSelectable(n.id)&&(o["aria-selected"]=e.current.isRowSelected(n.id)),o},[e,t])},useGridRowsOverridableMethods:e=>{const t=s.useCallback((t,n,r)=>{const o=ST(e,t),i=ST(e,n);if(!o)throw new Error(`MUI X: No row with id #${t} found.`);if(!i)throw new Error(`MUI X: No row with id #${n} found.`);if("leaf"!==o.type)throw new Error("MUI X: The row reordering does not support reordering of footer or grouping rows.");if("inside"===r)throw new Error("MUI X: The 'inside' position is only supported for tree data. Use 'above' or 'below' for flat data.");const a=FD(e),l=a[n];if(void 0===l)throw new Error(`MUI X: Target row with id #${n} not found in current view.`);const s=a[t];if(void 0===s)throw new Error(`MUI X: Source row with id #${t} not found in current view.`);let c;c="up"===(l<s?"up":"down")?"above"===r?l:l+1:"above"===r?l-1:l,c!==s&&(e.current.setState(t=>{const n=xT(e)[OT],r=[...n.children];return r.splice(c,0,r.splice(s,1)[0]),f({},t,{rows:f({},t.rows,{tree:f({},t.rows.tree,{[OT]:f({},n,{children:r})})})})}),e.current.publishEvent("rowsSet"))},[e]),n=s.useCallback((t,n)=>{const r=ST(e,t);if(!r)throw new Error(`MUI X: No row with id #${t} found.`);if("leaf"!==r.type)throw new Error("MUI X: The row reordering does not support reordering of footer or grouping rows.");e.current.setState(r=>{const o=xT(e)[OT],i=o.children,a=i.findIndex(e=>e===t);if(-1===a||a===n)return r;const l=[...i];return l.splice(n,0,l.splice(a,1)[0]),f({},r,{rows:f({},r.rows,{tree:f({},r.rows.tree,{[OT]:f({},o,{children:l})})})})}),e.current.publishEvent("rowsSet")},[e]);return{setRowIndex:n,setRowPosition:t}},useGridParamsOverridableMethods:e=>{const t=s.useCallback((t,n)=>{const r=e.current.getColumn(n),o=e.current.getRow(t);if(!o)throw new Error(`No row with id #${t} found`);return r&&r.valueGetter?r.valueGetter(o[r.field],o,r,e):o[n]},[e]),n=s.useCallback((t,n)=>LT(t,n,e),[e]),r=s.useCallback((t,r)=>{const o=n(t,r);return r&&r.valueFormatter?r.valueFormatter(o,t,r,e):o},[e,n]);return{getCellValue:t,getRowValue:n,getRowFormattedValue:r}},useIsCellEditable:()=>s.useCallback(e=>!jT(e.rowNode),[]),useCellAggregationResult:()=>null,useFilterValueGetter:e=>e.current.getRowValue}},pH=function(e,t){const n=aH(e),r=uH(n.apiRef,n);return W_(r,n,dH),Xp.jsx(aB,{privateApiRef:r,configuration:dH,props:n,children:Xp.jsx(QN,f({className:n.className,style:n.style,sx:n.sx},n.slotProps?.root,{ref:t}))})},fH=s.memo(TR(pH));pH.propTypes={apiRef:C.shape({current:C.object}),"aria-label":C.string,"aria-labelledby":C.string,autoHeight:C.bool,autoPageSize:C.bool,autosizeOnMount:C.bool,autosizeOptions:C.shape({columns:C.arrayOf(C.string),disableColumnVirtualization:C.bool,expand:C.bool,includeHeaders:C.bool,includeOutliers:C.bool,outliersFactor:C.number}),cellModesModel:C.object,checkboxSelection:C.bool,classes:C.object,className:C.string,clipboardCopyCellDelimiter:C.string,columnBufferPx:C.number,columnFilterDebounceMs:C.number,columnGroupHeaderHeight:C.number,columnGroupingModel:C.arrayOf(C.object),columnHeaderHeight:C.number,columns:C.arrayOf(C.object).isRequired,columnVisibilityModel:C.object,dataSource:C.shape({getRows:C.func.isRequired,updateRow:C.func}),dataSourceCache:C.shape({clear:C.func.isRequired,get:C.func.isRequired,set:C.func.isRequired}),density:C.oneOf(["comfortable","compact","standard"]),disableAutosize:C.bool,disableColumnFilter:C.bool,disableColumnMenu:C.bool,disableColumnResize:C.bool,disableColumnSelector:C.bool,disableColumnSorting:C.bool,disableDensitySelector:C.bool,disableEval:C.bool,disableMultipleRowSelection:C.bool,disableRowSelectionExcludeModel:C.bool,disableRowSelectionOnClick:C.bool,disableVirtualization:C.bool,editMode:C.oneOf(["cell","row"]),estimatedRowCount:C.number,experimentalFeatures:C.shape({warnIfFocusStateIsNotSynced:C.bool}),filterDebounceMs:C.number,filterMode:C.oneOf(["client","server"]),filterModel:C.shape({items:C.arrayOf(C.shape({field:C.string.isRequired,id:C.oneOfType([C.number,C.string]),operator:C.string.isRequired,value:C.any})).isRequired,logicOperator:C.oneOf(["and","or"]),quickFilterExcludeHiddenColumns:C.bool,quickFilterLogicOperator:C.oneOf(["and","or"]),quickFilterValues:C.array}),getCellClassName:C.func,getDetailPanelContent:C.func,getEstimatedRowHeight:C.func,getRowClassName:C.func,getRowHeight:C.func,getRowId:C.func,getRowSpacing:C.func,hideFooter:C.bool,hideFooterPagination:C.bool,hideFooterSelectedRowCount:C.bool,ignoreDiacritics:C.bool,ignoreValueFormatterDuringExport:C.oneOfType([C.shape({clipboardExport:C.bool,csvExport:C.bool}),C.bool]),initialState:C.object,isCellEditable:C.func,isRowSelectable:C.func,keepNonExistentRowsSelected:C.bool,label:C.string,loading:C.bool,localeText:C.object,logger:C.shape({debug:C.func.isRequired,error:C.func.isRequired,info:C.func.isRequired,warn:C.func.isRequired}),logLevel:C.oneOf(["debug","error","info","warn",!1]),nonce:C.string,onCellClick:C.func,onCellDoubleClick:C.func,onCellEditStart:C.func,onCellEditStop:C.func,onCellKeyDown:C.func,onCellModesModelChange:C.func,onClipboardCopy:C.func,onColumnHeaderClick:C.func,onColumnHeaderContextMenu:C.func,onColumnHeaderDoubleClick:C.func,onColumnHeaderEnter:C.func,onColumnHeaderLeave:C.func,onColumnHeaderOut:C.func,onColumnHeaderOver:C.func,onColumnOrderChange:C.func,onColumnResize:C.func,onColumnVisibilityModelChange:C.func,onColumnWidthChange:C.func,onDataSourceError:C.func,onDensityChange:C.func,onFilterModelChange:C.func,onMenuClose:C.func,onMenuOpen:C.func,onPaginationMetaChange:C.func,onPaginationModelChange:C.func,onPreferencePanelClose:C.func,onPreferencePanelOpen:C.func,onProcessRowUpdateError:C.func,onResize:C.func,onRowClick:C.func,onRowCountChange:C.func,onRowDoubleClick:C.func,onRowEditStart:C.func,onRowEditStop:C.func,onRowModesModelChange:C.func,onRowSelectionModelChange:C.func,onSortModelChange:C.func,onStateChange:C.func,pageSizeOptions:C.arrayOf(C.oneOfType([C.number,C.shape({label:C.string.isRequired,value:C.number.isRequired})]).isRequired),pagination:C.oneOf([!0]),paginationMeta:C.shape({hasNextPage:C.bool}),paginationMode:C.oneOf(["client","server"]),paginationModel:C.shape({page:C.number.isRequired,pageSize:C.number.isRequired}),processRowUpdate:C.func,resizeThrottleMs:C.number,rowBufferPx:C.number,rowCount:C.number,rowHeight:C.number,rowModesModel:C.object,rows:C.arrayOf(C.object),rowSelection:C.bool,rowSelectionModel:C.shape({ids:C.instanceOf(Set).isRequired,type:C.oneOf(["exclude","include"]).isRequired}),rowSpacingType:C.oneOf(["border","margin"]),rowSpanning:C.bool,scrollbarSize:C.number,showCellVerticalBorder:C.bool,showColumnVerticalBorder:C.bool,showToolbar:C.bool,slotProps:C.object,slots:C.object,sortingMode:C.oneOf(["client","server"]),sortingOrder:C.arrayOf(C.oneOf(["asc","desc"])),sortModel:C.arrayOf(C.shape({field:C.string.isRequired,sort:C.oneOf(["asc","desc"])})),style:C.object,sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),virtualizeColumnsWithAutoRowHeight:C.bool};var hH=Sg(Xp.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),mH=Sg(Xp.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"})),gH=Sg(Xp.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"})),vH=Sg(Xp.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),bH=Sg(Xp.jsx("path",{d:"M8 5v14l11-7z"}));const yH=({open:e,title:t="Confirm Action",message:n,onConfirm:r,onCancel:o,confirmText:i="Confirm",cancelText:a="Cancel",confirmColor:l="error"})=>c.createElement(zx,{open:e,onClose:o,"aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-description"},c.createElement(Qx,{id:"confirm-dialog-title"},t),c.createElement(Gx,null,c.createElement(Yx,{id:"confirm-dialog-description"},n)),c.createElement(_x,null,c.createElement(Xw,{onClick:o,variant:"outlined"},a),c.createElement(Xw,{onClick:r,variant:"contained",color:l,autoFocus:!0},i))),wH=({onSelectReport:e,onAddNew:t,onCloneReport:n,onRunReport:r,refreshTrigger:o})=>{const i=ER(),[a,l]=s.useState([]),[u,d]=s.useState(!0),[p,f]=s.useState(null),[h,m]=s.useState(!1),[g,v]=s.useState(null);s.useEffect(()=>{b()},[o]);const b=async()=>{try{d(!0),f(null);const e=await jc.getReportDefinitions();l(e)}catch(e){console.error("Error loading report definitions:",e);const t="Failed to load report definitions: "+(e.message||"Unknown error");f(t),i.error(t)}finally{d(!1)}},y=[{field:"title",headerName:"Title",flex:1,minWidth:200},{field:"provider",headerName:"Provider",flex:1,minWidth:200},{field:"actions",headerName:"Actions",width:200,sortable:!1,filterable:!1,disableColumnMenu:!0,renderCell:t=>c.createElement(jw,{sx:{display:"flex",gap:1}},c.createElement(Hk,{title:"Run"},c.createElement(Mv,{size:"small",color:"success",onClick:e=>{return n=t.row.id,e.stopPropagation(),void r(n);var n}},c.createElement(bH,{fontSize:"small"}))),c.createElement(Hk,{title:"Edit"},c.createElement(Mv,{size:"small",color:"primary",onClick:n=>{return r=t.row.id,n.stopPropagation(),void e(r);var r}},c.createElement(mH,{fontSize:"small"}))),c.createElement(Hk,{title:"Clone"},c.createElement(Mv,{size:"small",onClick:e=>(async(e,t)=>{t.stopPropagation();try{const t=await jc.getReportDefinition({id:e}),r={...t,title:`${t.title} (Copy)`};n(r)}catch(e){console.error("Error cloning report:",e),i.error("Failed to clone report: "+(e.message||"Unknown error"))}})(t.row.id,e)},c.createElement(gH,{fontSize:"small"}))),c.createElement(Hk,{title:"Delete"},c.createElement(Mv,{size:"small",color:"error",onClick:e=>((e,t)=>{t.stopPropagation();const n=a.find(t=>t.id===e);v(n),m(!0)})(t.row.id,e)},c.createElement(vH,{fontSize:"small"}))))}],w=a.map(e=>({id:e.id,title:e.title,provider:e.provider}));return u?c.createElement(jw,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400},c.createElement(Cv,null)):p?c.createElement(jw,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:400,gap:2},c.createElement(Gv,{variant:"body1",color:"error"},p),c.createElement(Xw,{variant:"contained",onClick:b},"Retry")):c.createElement(jw,{sx:{p:3}},c.createElement(jw,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3}},c.createElement(Gv,{variant:"h4",component:"h1"},"Report Definitions"),c.createElement(Xw,{variant:"contained",color:"primary",startIcon:c.createElement(hH,null),onClick:t},"Add New Report")),c.createElement(jw,{sx:{height:600,width:"100%"}},c.createElement(fH,{rows:w,columns:y,pageSize:10,rowsPerPageOptions:[10,25,50],disableSelectionOnClick:!0,onRowClick:t=>{e(t.row.id)},sx:{"& .MuiDataGrid-row":{cursor:"pointer"},"& .MuiDataGrid-row:hover":{backgroundColor:"#f5f5f5"},"& .MuiDataGrid-columnHeader":{backgroundColor:"#f5f5f5",fontWeight:"bold"}}})),c.createElement(yH,{open:h,title:"Delete Report Definition",message:g?`Are you sure you want to delete "${g.title}"? This action cannot be undone.`:"",onConfirm:async()=>{if(g)try{await jc.deleteReportDefinition({id:g.id}),i.success(`Report "${g.title}" deleted successfully!`),m(!1),v(null),b()}catch(e){console.error("Error deleting report:",e),i.error("Failed to delete report: "+(e.response?.data?.message||e.message||"Unknown error")),m(!1),v(null)}},onCancel:()=>{m(!1),v(null)},confirmText:"Delete",cancelText:"Cancel",confirmColor:"error"}))};var xH=Sg(Xp.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),SH=Sg(Xp.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),CH=Sg(Xp.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}));const kH=({providersData:e,rootProvider:t,onSelectionChange:n,existingDimensions:r=[],existingMetrics:o=[],existingFilters:i={}})=>{const[a,l]=s.useState([]);s.useEffect(()=>{l([]),n&&n([])},[t]);const u=t=>{if(!e||!t)return[];const n=e[t];if(!n||!n.relations||0===n.relations.length)return[];const a=(()=>{const e=new Map,t=t=>{if(t.relations&&t.providerPath)for(let n=0;n<t.relations.length;n++){const r=t.relations[n],o=t.providerPath[n];r.type&&(e.has(o)||e.set(o,new Set),e.get(o).add(r.name))}};return r.forEach(t),o.forEach(t),Object.values(i).forEach(t),e})().get(t);return n.relations.filter(t=>e[t.target]).map(e=>{let t=!1,n=null;if(!!e.type&&a&&a.size>0){if(!a.has(e.name)&&a.size>0){t=!0;n=`Cannot select: '${Array.from(a)[0]}' is already in use`}}return{key:e.name,value:e.name,targetKey:e.target,disabled:t,disabledReason:n}})},d=(e,r)=>{const o=r.target.value,i=0===e?t:a[e-1].targetKey,s=u(i).find(e=>e.key===o);if(!s)return;const c=a.slice(0,e);c.push({providerKey:o,relationName:o,targetKey:s.targetKey}),l(c),console.log("Selection chain:",c),n&&n(c)};return c.createElement(jw,null,a.length>0&&c.createElement(jw,{sx:{marginBottom:2}},c.createElement(Gv,{variant:"subtitle2",sx:{marginBottom:1,color:"text.secondary"}},"Selected Path:"),c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"}},c.createElement(zy,{label:t,size:"small",color:"primary",variant:"outlined"}),a.map((e,t)=>c.createElement(c.Fragment,{key:t},c.createElement(Gv,{variant:"body2",sx:{color:"text.secondary"}},"→"),c.createElement(zy,{label:e.targetKey,size:"small",color:"primary",onDelete:()=>(e=>{const t=a.slice(0,e);l(t),n&&n(t)})(t),sx:{fontWeight:500}}))))),c.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",gap:"8px"}},(()=>{if(!e||!t)return null;const n=[],r=u(t);r.length>0&&n.push(c.createElement("div",{key:"level-0",style:{marginRight:"16px"}},c.createElement(uR,{items:r,value:a[0]?.providerKey||"",label:`Related to ${t}`,onChange:e=>d(0,e),sx:{width:"300px"}})));for(let e=0;e<a.length;e++){const t=a[e],r=u(t.targetKey);if(r.length>0){const o=a[e+1];n.push(c.createElement("div",{key:`level-${e+1}`,style:{marginRight:"16px"}},c.createElement(uR,{items:r,value:o?.providerKey||"",label:`Related to ${t.targetKey}`,onChange:t=>d(e+1,t),sx:{width:"300px"}})))}}return n})()))};const EH="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function RH(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function PH(e){return"nodeType"in e}function MH(e){var t,n;return e?RH(e)?e:PH(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function TH(e){const{Document:t}=MH(e);return e instanceof t}function IH(e){return!RH(e)&&e instanceof MH(e).HTMLElement}function OH(e){return e instanceof MH(e).SVGElement}function DH(e){return e?RH(e)?e.document:PH(e)?TH(e)?e:IH(e)||OH(e)?e.ownerDocument:document:document:document}const FH=EH?s.useLayoutEffect:s.useEffect;function LH(e){const t=s.useRef(e);return FH(()=>{t.current=e}),s.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function AH(e,t){void 0===t&&(t=[e]);const n=s.useRef(e);return FH(()=>{n.current!==e&&(n.current=e)},t),n}function NH(e,t){const n=s.useRef();return s.useMemo(()=>{const t=e(n.current);return n.current=t,t},[...t])}function $H(e){const t=LH(e),n=s.useRef(null),r=s.useCallback(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function zH(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let jH={};function BH(e,t){return s.useMemo(()=>{if(t)return t;const n=null==jH[e]?0:jH[e]+1;return jH[e]=n,e+"-"+n},[e,t])}function _H(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t},{...t})}}const HH=_H(1),VH=_H(-1);function WH(e){if(!e)return!1;const{KeyboardEvent:t}=MH(e.target);return t&&e instanceof t}function UH(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=MH(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const GH=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[GH.Translate.toString(e),GH.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),KH="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qH(e){return e.matches(KH)?e:e.querySelector(KH)}const YH={display:"none"};function XH(e){let{id:t,value:n}=e;return c.createElement("div",{id:t,style:YH},n)}function QH(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return c.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const ZH=s.createContext(null);const JH={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},eV={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tV(e){let{announcements:t=eV,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=JH}=e;const{announce:i,announcement:a}=function(){const[e,t]=s.useState("");return{announce:s.useCallback(e=>{null!=e&&t(e)},[]),announcement:e}}(),l=BH("DndLiveRegion"),[u,d]=s.useState(!1);if(s.useEffect(()=>{d(!0)},[]),function(e){const t=s.useContext(ZH);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(s.useMemo(()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}}),[i,t])),!u)return null;const p=c.createElement(c.Fragment,null,c.createElement(XH,{id:r,value:o.draggable}),c.createElement(QH,{id:l,announcement:a}));return n?So.createPortal(p,n):p}var nV;function rV(){}function oV(e,t){return s.useMemo(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}function iV(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>[...t].filter(e=>null!=e),[...t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(nV||(nV={}));const aV=Object.freeze({x:0,y:0});function lV(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sV(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function cV(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function uV(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function dV(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}function pV(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const fV=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=pV(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=lV(pV(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(sV)};function hV(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const mV=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=hV(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(cV)};function gV(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:aV}function vV(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const bV=vV(1);const yV={ignoreTransform:!1};function wV(e,t){void 0===t&&(t=yV);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=MH(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,s=e.left-a-(1-o)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:s+u,bottom:c+d,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:s}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:s}}function xV(e){return wV(e,{ignoreTransform:!0})}function SV(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(TH(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!IH(o)||OH(o))return n;if(n.includes(o))return n;const i=MH(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=MH(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=MH(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function CV(e){const[t]=SV(e,1);return null!=t?t:null}function kV(e){return EH&&e?RH(e)?e:PH(e)?TH(e)||e===DH(e).scrollingElement?window:IH(e)?e:null:null:null}function EV(e){return RH(e)?e.scrollX:e.scrollLeft}function RV(e){return RH(e)?e.scrollY:e.scrollTop}function PV(e){return{x:EV(e),y:RV(e)}}var MV;function TV(e){return!(!EH||!e)&&e===document.scrollingElement}function IV(e){const t={x:0,y:0},n=TV(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(MV||(MV={}));const OV={x:.2,y:.2};function DV(e,t,n,r,o){let{top:i,left:a,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=OV);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=IV(e),f={x:0,y:0},h={x:0,y:0},m=t.height*o.y,g=t.width*o.x;return!c&&i<=t.top+m?(f.y=MV.Backward,h.y=r*Math.abs((t.top+m-i)/m)):!u&&s>=t.bottom-m&&(f.y=MV.Forward,h.y=r*Math.abs((t.bottom-m-s)/m)),!p&&l>=t.right-g?(f.x=MV.Forward,h.x=r*Math.abs((t.right-g-l)/g)):!d&&a<=t.left+g&&(f.x=MV.Backward,h.x=r*Math.abs((t.left+g-a)/g)),{direction:f,speed:h}}function FV(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function LV(e){return e.reduce((e,t)=>HH(e,PV(t)),aV)}const AV=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+EV(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+RV(t),0)}]];class NV{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=SV(t),r=LV(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of AV)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $V{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function zV(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var jV,BV;function _V(e){e.preventDefault()}function HV(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(jV||(jV={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(BV||(BV={}));const VV={start:[BV.Space,BV.Enter],cancel:[BV.Esc],end:[BV.Space,BV.Enter,BV.Tab]},WV=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case BV.Right:return{...n,x:n.x+25};case BV.Left:return{...n,x:n.x-25};case BV.Down:return{...n,y:n.y+25};case BV.Up:return{...n,y:n.y-25}}};class UV{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new $V(DH(t)),this.windowListeners=new $V(MH(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(jV.Resize,this.handleCancel),this.windowListeners.add(jV.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(jV.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=wV),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);CV(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(aV)}handleKeyDown(e){if(WH(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=VV,coordinateGetter:i=WV,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:aV;this.referenceCoordinates||(this.referenceCoordinates=c);const u=i(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=VH(u,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:s,isBottom:c,maxScroll:d,minScroll:p}=IV(n),f=FV(n),h={x:Math.min(o===BV.Right?f.right-f.width/2:f.right,Math.max(o===BV.Right?f.left:f.left+f.width/2,u.x)),y:Math.min(o===BV.Down?f.bottom-f.height/2:f.bottom,Math.max(o===BV.Down?f.top:f.top+f.height/2,u.y))},m=o===BV.Right&&!l||o===BV.Left&&!s,g=o===BV.Down&&!c||o===BV.Up&&!i;if(m&&h.x!==u.x){const e=n.scrollLeft+t.x,i=o===BV.Right&&e<=d.x||o===BV.Left&&e>=p.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===BV.Right?n.scrollLeft-d.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(g&&h.y!==u.y){const e=n.scrollTop+t.y,i=o===BV.Down&&e<=d.y||o===BV.Up&&e>=p.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===BV.Down?n.scrollTop-d.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,HH(VH(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function GV(e){return Boolean(e&&"distance"in e)}function KV(e){return Boolean(e&&"delay"in e)}UV.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=VV,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class qV{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=MH(e);return e instanceof t?e:DH(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=DH(i),this.documentListeners=new $V(this.document),this.listeners=new $V(n),this.windowListeners=new $V(MH(i)),this.initialCoordinates=null!=(r=UH(o))?r:aV,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(jV.Resize,this.handleCancel),this.windowListeners.add(jV.DragStart,_V),this.windowListeners.add(jV.VisibilityChange,this.handleCancel),this.windowListeners.add(jV.ContextMenu,_V),this.documentListeners.add(jV.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(KV(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(GV(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(jV.Click,HV,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(jV.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=UH(e))?t:aV,s=VH(r,l);if(!n&&a){if(GV(a)){if(null!=a.tolerance&&zV(s,a.tolerance))return this.handleCancel();if(zV(s,a.distance))return this.handleStart()}return KV(a)&&zV(s,a.tolerance)?this.handleCancel():void this.handlePending(a,s)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===BV.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const YV={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class XV extends qV{constructor(e){const{event:t}=e,n=DH(t.target);super(e,YV,n)}}XV.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const QV={move:{name:"mousemove"},end:{name:"mouseup"}};var ZV;!function(e){e[e.RightClick=2]="RightClick"}(ZV||(ZV={}));(class extends qV{constructor(e){super(e,QV,DH(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==ZV.RightClick&&(null==r||r({event:n}),!0)}}];const JV={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var eW,tW;function nW(e){let{acceleration:t,activator:n=eW.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=tW.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:p,threshold:f}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=zH(t);return NH(e=>{if(n||!r||!e)return rW;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[MV.Backward]:e.x[MV.Backward]||-1===o.x,[MV.Forward]:e.x[MV.Forward]||1===o.x},y:{[MV.Backward]:e.y[MV.Backward]||-1===o.y,[MV.Forward]:e.y[MV.Forward]||1===o.y}}},[n,t,r])}({delta:p,disabled:!i}),[m,g]=function(){const e=s.useRef(null),t=s.useCallback((t,n)=>{e.current=setInterval(t,n)},[]);return[t,s.useCallback(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),v=s.useRef({x:0,y:0}),b=s.useRef({x:0,y:0}),y=s.useMemo(()=>{switch(n){case eW.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case eW.DraggableRect:return o}},[n,o,c]),w=s.useRef(null),x=s.useCallback(()=>{const e=w.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)},[]),S=s.useMemo(()=>l===tW.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(i&&u.length&&y){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),o=d[n];if(!o)continue;const{direction:i,speed:l}=DV(e,o,y,t,f);for(const e of["x","y"])h[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0)return g(),w.current=e,m(x,a),v.current=l,void(b.current=i)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[t,x,r,g,i,a,JSON.stringify(y),JSON.stringify(h),m,u,S,d,JSON.stringify(f)])}(class extends qV{constructor(e){super(e,JV)}static setup(){return window.addEventListener(JV.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(JV.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(eW||(eW={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(tW||(tW={}));const rW={x:{[MV.Backward]:!1,[MV.Forward]:!1},y:{[MV.Backward]:!1,[MV.Forward]:!1}};var oW,iW;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(oW||(oW={})),function(e){e.Optimized="optimized"}(iW||(iW={}));const aW=new Map;function lW(e,t){return NH(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function sW(e){let{callback:t,disabled:n}=e;const r=LH(t),o=s.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return s.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}function cW(e){return new NV(wV(e),e)}function uW(e,t,n){void 0===t&&(t=cW);const[r,o]=s.useState(null);function i(){o(r=>{if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}const a=function(e){let{callback:t,disabled:n}=e;const r=LH(t),o=s.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return s.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),l=sW({callback:i});return FH(()=>{i(),e?(null==l||l.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==a||a.disconnect())},[e]),r}const dW=[];function pW(e,t){void 0===t&&(t=[]);const n=s.useRef(null);return s.useEffect(()=>{n.current=null},t),s.useEffect(()=>{const t=e!==aV;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?VH(e,n.current):aV}function fW(e){return s.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const hW=[];function mW(e){let{measure:t}=e;const[n,r]=s.useState(null),o=s.useCallback(e=>{for(const{target:n}of e)if(IH(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t]),i=sW({callback:o}),a=s.useCallback(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return IH(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)},[t,i]),[l,c]=$H(a);return s.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const gW=[{sensor:XV,options:{}},{sensor:UV,options:{}}],vW={current:{}},bW={draggable:{measure:xV},droppable:{measure:xV,strategy:oW.WhileDragging,frequency:iW.Optimized},dragOverlay:{measure:wV}};class yW extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const wW={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yW,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rV},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bW,measureDroppableContainers:rV,windowRect:null,measuringScheduled:!1},xW={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:rV,draggableNodes:new Map,over:null,measureDroppableContainers:rV},SW=s.createContext(xW),CW=s.createContext(wW);function kW(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yW}}}function EW(e,t){switch(t.type){case nV.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nV.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case nV.DragEnd:case nV.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nV.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new yW(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case nV.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new yW(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case nV.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new yW(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function RW(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=s.useContext(SW),i=zH(r),a=zH(null==n?void 0:n.id);return s.useEffect(()=>{if(!t&&!r&&i&&null!=a){if(!WH(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=qH(e);if(t){t.focus();break}}})}},[r,t,o,a,i]),null}const PW=s.createContext({...aV,scaleX:1,scaleY:1});var MW;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(MW||(MW={}));const TW=s.memo(function(e){var t,n,r,o;let{id:i,accessibility:a,autoScroll:l=!0,children:u,sensors:d=gW,collisionDetection:p=mV,measuring:f,modifiers:h,...m}=e;const g=s.useReducer(EW,void 0,kW),[v,b]=g,[y,w]=function(){const[e]=s.useState(()=>new Set),t=s.useCallback(t=>(e.add(t),()=>e.delete(t)),[e]),n=s.useCallback(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]);return[n,t]}(),[x,S]=s.useState(MW.Uninitialized),C=x===MW.Initialized,{draggable:{active:k,nodes:E,translate:R},droppable:{containers:P}}=v,M=null!=k?E.get(k):null,T=s.useRef({initial:null,translated:null}),I=s.useMemo(()=>{var e;return null!=k?{id:k,data:null!=(e=null==M?void 0:M.data)?e:vW,rect:T}:null},[k,M]),O=s.useRef(null),[D,F]=s.useState(null),[L,A]=s.useState(null),N=AH(m,Object.values(m)),$=BH("DndDescribedBy",i),z=s.useMemo(()=>P.getEnabled(),[P]),j=function(e){return s.useMemo(()=>({draggable:{...bW.draggable,...null==e?void 0:e.draggable},droppable:{...bW.droppable,...null==e?void 0:e.droppable},dragOverlay:{...bW.dragOverlay,...null==e?void 0:e.dragOverlay}}),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}(f),{droppableRects:B,measureDroppableContainers:_,measuringScheduled:H}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=s.useState(null),{frequency:l,measure:c,strategy:u}=o,d=s.useRef(e),p=function(){switch(u){case oW.Always:return!1;case oW.BeforeDragging:return n;default:return!n}}(),f=AH(p),h=s.useCallback(function(e){void 0===e&&(e=[]),f.current||a(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=s.useRef(null),g=NH(t=>{if(p&&!n)return aW;if(!t||t===aW||d.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new NV(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,p,c]);return s.useEffect(()=>{d.current=e},[e]),s.useEffect(()=>{p||h()},[n,p]),s.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),s.useEffect(()=>{p||"number"!=typeof l||null!==m.current||(m.current=setTimeout(()=>{h(),m.current=null},l))},[l,p,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:null!=i}}(z,{dragging:C,dependencies:[R.x,R.y],config:j.droppable}),V=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return NH(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(E,k),W=s.useMemo(()=>L?UH(L):null,[L]),U=function(){const e=!1===(null==D?void 0:D.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=C&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),G=function(e,t){return lW(e,t)}(V,j.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=s.useRef(!1),{x:a,y:l}="boolean"==typeof o?{x:o,y:o}:o;FH(()=>{if(!a&&!l||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=gV(n(e),r);if(a||(o.x=0),l||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=CV(e);t&&t.scrollBy({top:o.y,left:o.x})}},[t,a,l,r,n])}({activeNode:null!=k?E.get(k):null,config:U.layoutShiftCompensation,initialRect:G,measure:j.draggable.measure});const K=uW(V,j.draggable.measure,G),q=uW(V?V.parentElement:null),Y=s.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X=P.getNodeFor(null==(t=Y.current.over)?void 0:t.id),Q=mW({measure:j.dragOverlay.measure}),Z=null!=(n=Q.nodeRef.current)?n:V,J=C?null!=(r=Q.rect)?r:K:null,ee=Boolean(Q.nodeRef.current&&Q.rect),te=gV(ne=ee?null:K,lW(ne));var ne;const re=fW(Z?MH(Z):null),oe=function(e){const t=s.useRef(e),n=NH(n=>e?n&&n!==dW&&e&&t.current&&e.parentNode===t.current.parentNode?n:SV(e):dW,[e]);return s.useEffect(()=>{t.current=e},[e]),n}(C?null!=X?X:V:null),ie=function(e,t){void 0===t&&(t=wV);const[n]=e,r=fW(n?MH(n):null),[o,i]=s.useState(hW);function a(){i(()=>e.length?e.map(e=>TV(e)?r:new NV(t(e),e)):hW)}const l=sW({callback:a});return FH(()=>{null==l||l.disconnect(),a(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),o}(oe),ae=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(h,{transform:{x:R.x-te.x,y:R.y-te.y,scaleX:1,scaleY:1},activatorEvent:L,active:I,activeNodeRect:K,containerNodeRect:q,draggingNodeRect:J,over:Y.current.over,overlayNodeRect:Q.rect,scrollableAncestors:oe,scrollableAncestorRects:ie,windowRect:re}),le=W?HH(W,R):null,se=function(e){const[t,n]=s.useState(null),r=s.useRef(e),o=s.useCallback(e=>{const t=kV(e.target);t&&n(e=>e?(e.set(t,PV(t)),new Map(e)):null)},[]);return s.useEffect(()=>{const t=r.current;if(e!==t){i(t);const a=e.map(e=>{const t=kV(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,PV(t)]):null}).filter(e=>null!=e);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{const t=kV(e);null==t||t.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>HH(e,t),aV):LV(e):aV,[e,t])}(oe),ce=pW(se),ue=pW(se,[K]),de=HH(ae,ce),pe=J?bV(J,ae):null,fe=I&&pe?p({active:I,collisionRect:pe,droppableRects:B,droppableContainers:z,pointerCoordinates:le}):null,he=dV(fe,"id"),[me,ge]=s.useState(null),ve=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ee?ae:HH(ae,ue),null!=(o=null==me?void 0:me.rect)?o:null,K),be=s.useRef(null),ye=s.useCallback((e,t)=>{let{sensor:n,options:r}=t;if(null==O.current)return;const o=E.get(O.current);if(!o)return;const i=e.nativeEvent,a=new n({active:O.current,activeNode:o,event:i,options:r,context:Y,onAbort(e){if(!E.get(e))return;const{onDragAbort:t}=N.current,n={id:e};null==t||t(n),y({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!E.get(e))return;const{onDragPending:o}=N.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==o||o(i),y({type:"onDragPending",event:i})},onStart(e){const t=O.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:r}=N.current,o={activatorEvent:i,active:{id:t,data:n.data,rect:T}};So.unstable_batchedUpdates(()=>{null==r||r(o),S(MW.Initializing),b({type:nV.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:o}),F(be.current),A(i)})},onMove(e){b({type:nV.DragMove,coordinates:e})},onEnd:l(nV.DragEnd),onCancel:l(nV.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=Y.current;let a=null;if(t&&o){const{cancelDrop:l}=N.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===nV.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=nV.DragCancel)}}O.current=null,So.unstable_batchedUpdates(()=>{b({type:e}),S(MW.Uninitialized),ge(null),F(null),A(null),be.current=null;const t=e===nV.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=N.current[t];null==e||e(a),y({type:t,event:a})}})}}be.current=a},[E]),we=s.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent,i=E.get(r);if(null!==O.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},O.current=r,ye(n,t))},[E,ye]),xe=function(e,t){return s.useMemo(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(d,we);!function(e){s.useEffect(()=>{if(!EH)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(d),FH(()=>{K&&x===MW.Initializing&&S(MW.Initialized)},[K,x]),s.useEffect(()=>{const{onDragMove:e}=N.current,{active:t,activatorEvent:n,collisions:r,over:o}=Y.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:de.x,y:de.y},over:o};So.unstable_batchedUpdates(()=>{null==e||e(i),y({type:"onDragMove",event:i})})},[de.x,de.y]),s.useEffect(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=Y.current;if(!e||null==O.current||!t||!o)return;const{onDragOver:i}=N.current,a=r.get(he),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};So.unstable_batchedUpdates(()=>{ge(l),null==i||i(s),y({type:"onDragOver",event:s})})},[he]),FH(()=>{Y.current={activatorEvent:L,active:I,activeNode:V,collisionRect:pe,collisions:fe,droppableRects:B,draggableNodes:E,draggingNode:Z,draggingNodeRect:J,droppableContainers:P,over:me,scrollableAncestors:oe,scrollAdjustedTranslate:de},T.current={initial:J,translated:pe}},[I,V,fe,pe,E,Z,J,B,P,me,oe,de]),nW({...U,delta:R,draggingRect:pe,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:ie});const Se=s.useMemo(()=>({active:I,activeNode:V,activeNodeRect:K,activatorEvent:L,collisions:fe,containerNodeRect:q,dragOverlay:Q,draggableNodes:E,droppableContainers:P,droppableRects:B,over:me,measureDroppableContainers:_,scrollableAncestors:oe,scrollableAncestorRects:ie,measuringConfiguration:j,measuringScheduled:H,windowRect:re}),[I,V,K,L,fe,q,Q,E,P,B,me,_,oe,ie,j,H,re]),Ce=s.useMemo(()=>({activatorEvent:L,activators:xe,active:I,activeNodeRect:K,ariaDescribedById:{draggable:$},dispatch:b,draggableNodes:E,over:me,measureDroppableContainers:_}),[L,xe,I,K,b,$,E,me,_]);return c.createElement(ZH.Provider,{value:w},c.createElement(SW.Provider,{value:Ce},c.createElement(CW.Provider,{value:Se},c.createElement(PW.Provider,{value:ve},u)),c.createElement(RW,{disabled:!1===(null==a?void 0:a.restoreFocus)})),c.createElement(tV,{...a,hiddenTextDescribedById:$}))}),IW=s.createContext(null),OW="button";function DW(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=BH("Draggable"),{activators:a,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:p,over:f}=s.useContext(SW),{role:h=OW,roleDescription:m="draggable",tabIndex:g=0}=null!=o?o:{},v=(null==c?void 0:c.id)===t,b=s.useContext(v?PW:IW),[y,w]=$H(),[x,S]=$H(),C=function(e,t){return s.useMemo(()=>e.reduce((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e},{}),[e,t])}(a,t),k=AH(n);FH(()=>(p.set(t,{id:t,key:i,node:y,activatorNode:x,data:k}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)}),[p,t]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:s.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":!(!v||h!==OW)||void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,h,g,v,m,d.draggable]),isDragging:v,listeners:r?void 0:C,node:y,over:f,setNodeRef:w,setActivatorNodeRef:S,transform:b}}const FW={timeout:25};function LW(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function AW(e,t){return e.reduce((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e},Array(e.length))}function NW(e){return null!==e&&e>=0}const $W=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=LW(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},zW={scaleX:1,scaleY:1},jW=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...zW}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-s,...zW}:o<n&&o>=a?{x:0,y:l.height+s,...zW}:{x:0,y:0,...zW}};const BW="Sortable",_W=c.createContext({activeIndex:-1,containerId:BW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$W,disabled:{draggable:!1,droppable:!1}});function HW(e){let{children:t,id:n,items:r,strategy:o=$W,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:p}=s.useContext(CW),f=BH(BW,n),h=Boolean(null!==l.rect),m=s.useMemo(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),g=null!=a,v=a?m.indexOf(a.id):-1,b=d?m.indexOf(d.id):-1,y=s.useRef(m),w=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,y.current),x=-1!==b&&-1===v||w,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(i);FH(()=>{w&&g&&p(m)},[w,m,g,p]),s.useEffect(()=>{y.current=m},[m]);const C=s.useMemo(()=>({activeIndex:v,containerId:f,disabled:S,disableTransforms:x,items:m,overIndex:b,useDragOverlay:h,sortedRects:AW(m,u),strategy:o}),[v,f,S.draggable,S.droppable,x,m,b,u,h,o]);return c.createElement(_W.Provider,{value:C},t)}const VW=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return LW(n,r,o).indexOf(t)},WW=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===s))},UW={duration:200,easing:"ease"},GW="transform",KW=GH.Transition.toString({property:GW,duration:0,easing:"linear"}),qW={roleDescription:"sortable"};function YW(e){let{animateLayoutChanges:t=WW,attributes:n,disabled:r,data:o,getNewIndex:i=VW,id:a,strategy:l,resizeObserverConfig:c,transition:u=UW}=e;const{items:d,containerId:p,activeIndex:f,disabled:h,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:b,strategy:y}=s.useContext(_W),w=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,h),x=d.indexOf(a),S=s.useMemo(()=>({sortable:{containerId:p,index:x,items:d},...o}),[p,o,x,d]),C=s.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:k,node:E,isOver:R,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=BH("Droppable"),{active:a,dispatch:l,over:c,measureDroppableContainers:u}=s.useContext(SW),d=s.useRef({disabled:n}),p=s.useRef(!1),f=s.useRef(null),h=s.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...FW,...o},b=AH(null!=g?g:r),y=sW({callback:s.useCallback(()=>{p.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},v)):p.current=!0},[v]),disabled:m||!a}),w=s.useCallback((e,t)=>{y&&(t&&(y.unobserve(t),p.current=!1),e&&y.observe(e))},[y]),[x,S]=$H(w),C=AH(t);return s.useEffect(()=>{y&&x.current&&(y.disconnect(),p.current=!1,y.observe(x.current))},[x,y]),s.useEffect(()=>(l({type:nV.RegisterDroppable,element:{id:r,key:i,disabled:n,node:x,rect:f,data:C}}),()=>l({type:nV.UnregisterDroppable,key:i,id:r})),[r]),s.useEffect(()=>{n!==d.current.disabled&&(l({type:nV.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:a,rect:f,isOver:(null==c?void 0:c.id)===r,node:x,over:c,setNodeRef:S}}({id:a,data:S,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:M,activatorEvent:T,activeNodeRect:I,attributes:O,setNodeRef:D,listeners:F,isDragging:L,over:A,setActivatorNodeRef:N,transform:$}=DW({id:a,data:S,attributes:{...qW,...n},disabled:w.draggable}),z=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>e=>{t.forEach(t=>t(e))},t)}(P,D),j=Boolean(M),B=j&&!m&&NW(f)&&NW(v),_=!b&&L,H=_&&B?$:null,V=B?null!=H?H:(null!=l?l:y)({rects:g,activeNodeRect:I,activeIndex:f,overIndex:v,index:x}):null,W=NW(f)&&NW(v)?i({id:a,items:d,activeIndex:f,overIndex:v}):x,U=null==M?void 0:M.id,G=s.useRef({activeId:U,items:d,newIndex:W,containerId:p}),K=d!==G.current.items,q=t({active:M,containerId:p,isDragging:L,isSorting:j,id:a,index:x,items:d,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:u,wasDragging:null!=G.current.activeId}),Y=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=s.useState(null),l=s.useRef(n);return FH(()=>{if(!t&&n!==l.current&&r.current){const e=o.current;if(e){const t=wV(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}n!==l.current&&(l.current=n)},[t,n,r,o]),s.useEffect(()=>{i&&a(null)},[i]),i}({disabled:!q,index:x,node:E,rect:k});return s.useEffect(()=>{j&&G.current.newIndex!==W&&(G.current.newIndex=W),p!==G.current.containerId&&(G.current.containerId=p),d!==G.current.items&&(G.current.items=d)},[j,W,p,d]),s.useEffect(()=>{if(U===G.current.activeId)return;if(null!=U&&null==G.current.activeId)return void(G.current.activeId=U);const e=setTimeout(()=>{G.current.activeId=U},50);return()=>clearTimeout(e)},[U]),{active:M,activeIndex:f,attributes:O,data:S,rect:k,index:x,newIndex:W,items:d,isOver:R,isSorting:j,isDragging:L,listeners:F,node:E,overIndex:v,over:A,setNodeRef:z,setActivatorNodeRef:N,setDroppableNodeRef:P,setDraggableNodeRef:D,transform:null!=Y?Y:V,transition:function(){if(Y||K&&G.current.newIndex===x)return KW;if(_&&!WH(T)||!u)return;if(j||q)return GH.Transition.toString({...u,property:GW});return}()}}function XW(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const QW=[BV.Down,BV.Right,BV.Up,BV.Left],ZW=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(QW.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case BV.Down:r.top<i.top&&t.push(n);break;case BV.Up:r.top>i.top&&t.push(n);break;case BV.Left:r.left>i.left&&t.push(n);break;case BV.Right:r.left<i.left&&t.push(n)}});const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=uV(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=uV(r),a=o.reduce((e,t,r)=>e+lV(n[r],t),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(sV)})({collisionRect:r,droppableRects:o,droppableContainers:t});let c=dV(s,"id");if(c===(null==a?void 0:a.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),a=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&a&&e&&t){const n=SV(s).some((e,t)=>l[t]!==e),o=JW(e,t),i=function(e,t){if(!XW(e)||!XW(t))return!1;if(!JW(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},u={x:a.left,y:a.top};return c.x&&c.y?u:VH(u,c)}}}};function JW(e,t){return!(!XW(e)||!XW(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var eU=Sg(Xp.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),tU=Sg(Xp.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),nU=Sg(Xp.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),rU=Sg(Xp.jsx("path",{d:"M3 18h6v-2H3zM3 6v2h18V6zm0 7h12v-2H3z"})),oU=Sg(Xp.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),iU=Sg(Xp.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),aU=Sg(Xp.jsx("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"})),lU=Sg(Xp.jsx("path",{d:"M14 10H3v2h11zm0-4H3v2h11zm4 8v-4h-2v4h-4v2h4v4h2v-4h4v-2zM3 16h7v-2H3z"}));const sU=({id:e,label:t,fullLabel:n,onDelete:r,onMoveUp:o,onMoveDown:i,isFirst:a,isLast:l,sortOrder:u,onSortOrderChange:d,fullPath:p,defaultTitle:f,customTitle:h,onUpdateTitle:m,onResetTitle:g})=>{const[v,b]=s.useState(!1),[y,w]=s.useState(""),x=s.useRef(null),S=s.useRef(null),{attributes:C,listeners:k,setNodeRef:E,transform:R,transition:P,isDragging:M}=YW({id:e}),T={transform:GH.Transform.toString(R),transition:P,opacity:M?.5:1,display:"flex",alignItems:"center",width:"100%"};s.useEffect(()=>{v&&x.current&&(x.current.focus(),x.current.select())},[v]),s.useEffect(()=>{const e=e=>{v&&S.current&&!S.current.contains(e.target)&&O()};if(v)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[v]);const I=()=>{const e=y.trim();""!==e?(m(p,e),b(!1)):O()},O=()=>{b(!1),w("")},D=h||t,F=!!h;return c.createElement("div",Xr({ref:E,style:T},C),c.createElement(jw,{ref:S,sx:{display:"flex",alignItems:"center",width:"100%",gap:1}},c.createElement(jw,Xr({},k,{sx:{display:"flex",alignItems:"center",cursor:"grab","&:active":{cursor:"grabbing"}}}),c.createElement(eU,{sx:{cursor:"grab"}})),v?c.createElement(c.Fragment,null,c.createElement(qE,{inputRef:x,value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key?I():"Escape"===e.key&&O()},size:"small",sx:{width:"200px"}}),c.createElement(Hk,{title:"Save",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:I,color:"primary","aria-label":"save title"},c.createElement(oU,{fontSize:"small"}))),c.createElement(Hk,{title:"Cancel",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:O,"aria-label":"cancel edit"},c.createElement(iU,{fontSize:"small"}))),F&&c.createElement(Hk,{title:"Reset to default",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{g(p),b(!1),w("")},color:"warning","aria-label":"reset title"},c.createElement(aU,{fontSize:"small"})))):c.createElement(c.Fragment,null,c.createElement(Hk,{title:n,arrow:!0,placement:"top"},c.createElement(zy,{label:D,onDelete:r,color:"primary",variant:"outlined",sx:{fontWeight:F?"bold":"normal",fontStyle:F?"italic":"normal"}})),c.createElement(Hk,{title:"Edit title",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{w(h||f),b(!0)},"aria-label":"edit title"},c.createElement(mH,{fontSize:"small"})))),!v&&c.createElement(c.Fragment,null,c.createElement(Hk,{title:null===u?"No sort":"asc"===u?"Ascending":"Descending",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{d(null===u?"asc":"asc"===u?"desc":null)},"aria-label":"toggle sort order",color:u?"primary":"default"},"asc"===u?c.createElement(tU,{fontSize:"small"}):"desc"===u?c.createElement(nU,{fontSize:"small"}):c.createElement(rU,{fontSize:"small",sx:{opacity:.3}}))),c.createElement(jw,{sx:{flex:1}}),c.createElement(jw,{sx:{display:"flex",gap:.5}},c.createElement(Mv,{size:"small",onClick:o,disabled:a,"aria-label":"move up"},c.createElement(tU,{fontSize:"small"})),c.createElement(Mv,{size:"small",onClick:i,disabled:l,"aria-label":"move down"},c.createElement(nU,{fontSize:"small"}))))))},cU=({providersData:e,rootProvider:t,savedDimensions:n=[],onSaveDimension:r,onRemoveDimension:o,onReorderDimensions:i,titleOverrides:a={},onUpdateTitle:l,onResetTitle:u,existingMetrics:d=[],existingFilters:p={}})=>{const[f,h]=s.useState(!1),[m,g]=s.useState([]),[v,b]=s.useState(""),y=iV(oV(XV),oV(UV,{coordinateGetter:ZW})),w=()=>{const r=t?0===m.length?t:m[m.length-1].targetKey:null;if(!r||!e||!e[r])return[];const o=e[r];if(!o.dimensions)return[];const i=[e[t].default_alias];let a=t;m.forEach(t=>{const n=e[a];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&i.push(e.alias)}a=t.targetKey});const l=new Set(n.map(e=>e.fullPath)),s=[];return Object.keys(o.dimensions).forEach(e=>{const t=o.dimensions[e];Object.keys(t).forEach(n=>{const o=t[n],a=`${i.join("_")}.${n}`,c=l.has(a);s.push({key:`${r}_${e}.${n}`,value:o.title||n,dimensionKey:n,alias:e,dimension:o,disabled:c})})}),s},x=()=>{h(!1),g([]),b("")},S=e=>{const n=[t];return e.relationNames&&e.relationNames.length>0&&n.push(...e.relationNames),n.join(" → ")};return c.createElement("div",null,c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:2,marginBottom:2}},f?c.createElement(c.Fragment,null,c.createElement(Xw,{variant:"outlined",onClick:x},"Cancel"),c.createElement(Xw,{variant:"contained",onClick:()=>{if(!v)return;const n=w().find(e=>e.key===v);if(!n)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)});const c=`${s.join("_")}.${n.dimensionKey}`,u={dimension:n.dimension,relations:o,providerPath:i,relationNames:a,dimensionKey:n.dimensionKey,dimensionTitle:n.value,fullPath:c};r(u),x()},disabled:!v},"Save Dimension")):c.createElement(Xw,{variant:"contained",onClick:()=>{h(!0),g([]),b("")}},"Add Dimension")),f&&c.createElement(qg,{sx:{padding:3,marginBottom:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Select Provider Path"),c.createElement(kH,{providersData:e,rootProvider:t,onSelectionChange:g,existingDimensions:n,existingMetrics:d,existingFilters:p}),c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},"Select Dimension"),c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1}},c.createElement(uR,{items:w(),value:v,label:"Choose Dimension",onChange:e=>{b(e.target.value)},sx:{width:"400px"}}),c.createElement(Hk,{title:"Add all available dimensions",arrow:!0,placement:"top"},c.createElement("span",null,c.createElement(Mv,{color:"primary",onClick:()=>{const n=w().filter(e=>!e.disabled);if(0===n.length)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)}),n.forEach(e=>{const t=`${s.join("_")}.${e.dimensionKey}`,n={dimension:e.dimension,relations:o,providerPath:i,relationNames:a,dimensionKey:e.dimensionKey,dimensionTitle:e.value,fullPath:t};r(n)}),x()},disabled:0===w().filter(e=>!e.disabled).length,"aria-label":"add all dimensions"},c.createElement(lU,null)))))),n.length>0&&c.createElement(jw,{sx:{marginTop:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Saved Dimensions (Drag to reorder or use arrows)"),c.createElement(TW,{sensors:y,collisionDetection:fV,onDragEnd:e=>{const{active:t,over:r}=e;if(r&&t.id!==r.id){const e=n.findIndex((e,n)=>n===t.id),o=n.findIndex((e,t)=>t===r.id),a=LW(n,e,o);i(a)}}},c.createElement(HW,{items:n.map((e,t)=>t),strategy:jW},c.createElement(jw,{sx:{display:"flex",flexDirection:"column",gap:1}},n.map((e,t)=>c.createElement(sU,{key:t,id:t,label:e.dimensionTitle,fullLabel:`${S(e)} → ${e.dimensionTitle} (${e.fullPath})`,onDelete:()=>o(t),onMoveUp:()=>(e=>{if(e>0){const t=LW(n,e,e-1);i(t)}})(t),onMoveDown:()=>(e=>{if(e<n.length-1){const t=LW(n,e,e+1);i(t)}})(t),isFirst:0===t,isLast:t===n.length-1,sortOrder:e.sortOrder||null,onSortOrderChange:e=>((e,t)=>{const r=[...n];r[e]={...r[e],sortOrder:t},i(r)})(t,e),fullPath:e.fullPath,defaultTitle:e.dimensionTitle,customTitle:a[e.fullPath],onUpdateTitle:l,onResetTitle:u})))))))},uU=({id:e,label:t,fullLabel:n,onDelete:r,onMoveUp:o,onMoveDown:i,isFirst:a,isLast:l,fullPath:u,defaultTitle:d,customTitle:p,onUpdateTitle:f,onResetTitle:h})=>{const[m,g]=s.useState(!1),[v,b]=s.useState(""),y=s.useRef(null),w=s.useRef(null),{attributes:x,listeners:S,setNodeRef:C,transform:k,transition:E,isDragging:R}=YW({id:e}),P={transform:GH.Transform.toString(k),transition:E,opacity:R?.5:1,display:"flex",alignItems:"center",width:"100%"};s.useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select())},[m]),s.useEffect(()=>{const e=e=>{m&&w.current&&!w.current.contains(e.target)&&T()};if(m)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[m]);const M=()=>{const e=v.trim();""!==e?(f(u,e),g(!1)):T()},T=()=>{g(!1),b("")},I=p||t,O=!!p;return c.createElement("div",Xr({ref:C,style:P},x),c.createElement(jw,{ref:w,sx:{display:"flex",alignItems:"center",width:"100%",gap:1}},c.createElement(jw,Xr({},S,{sx:{display:"flex",alignItems:"center",cursor:"grab","&:active":{cursor:"grabbing"}}}),c.createElement(eU,{sx:{cursor:"grab"}})),m?c.createElement(c.Fragment,null,c.createElement(qE,{inputRef:y,value:v,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key?M():"Escape"===e.key&&T()},size:"small",sx:{width:"200px"}}),c.createElement(Hk,{title:"Save",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:M,color:"primary","aria-label":"save title"},c.createElement(oU,{fontSize:"small"}))),c.createElement(Hk,{title:"Cancel",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:T,"aria-label":"cancel edit"},c.createElement(iU,{fontSize:"small"}))),O&&c.createElement(Hk,{title:"Reset to default",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{h(u),g(!1),b("")},color:"warning","aria-label":"reset title"},c.createElement(aU,{fontSize:"small"})))):c.createElement(c.Fragment,null,c.createElement(Hk,{title:n,arrow:!0,placement:"top"},c.createElement(zy,{label:I,onDelete:r,color:"secondary",variant:"outlined",sx:{fontWeight:O?"bold":"normal",fontStyle:O?"italic":"normal"}})),c.createElement(Hk,{title:"Edit title",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{b(p||d),g(!0)},"aria-label":"edit title"},c.createElement(mH,{fontSize:"small"})))),!m&&c.createElement(c.Fragment,null,c.createElement(jw,{sx:{flex:1}}),c.createElement(jw,{sx:{display:"flex",gap:.5}},c.createElement(Mv,{size:"small",onClick:o,disabled:a,"aria-label":"move up"},c.createElement(tU,{fontSize:"small"})),c.createElement(Mv,{size:"small",onClick:i,disabled:l,"aria-label":"move down"},c.createElement(nU,{fontSize:"small"}))))))},dU=({providersData:e,rootProvider:t,savedMetrics:n=[],onSaveMetric:r,onRemoveMetric:o,onReorderMetrics:i,titleOverrides:a={},onUpdateTitle:l,onResetTitle:u,existingDimensions:d=[],existingFilters:p={}})=>{const[f,h]=s.useState(!1),[m,g]=s.useState([]),[v,b]=s.useState(""),y=iV(oV(XV),oV(UV,{coordinateGetter:ZW})),w=()=>{const r=t?0===m.length?t:m[m.length-1].targetKey:null;if(!r||!e||!e[r])return[];const o=e[r];if(!o.metrics)return[];const i=[e[t].default_alias];let a=t;m.forEach(t=>{const n=e[a];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&i.push(e.alias)}a=t.targetKey});const l=new Set(n.map(e=>e.fullPath)),s=o.metrics.map((e,t)=>{const n=`${i.join("_")}.${e.name}`,o=l.has(n);return{key:`${r}_${e.name}_${t}`,value:e.title||e.name,metricName:e.name,metric:e,disabled:o}});return s},x=()=>{h(!1),g([]),b("")},S=e=>{const n=[t];return e.relationNames&&e.relationNames.length>0&&n.push(...e.relationNames),n.join(" → ")};return c.createElement("div",null,c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:2,marginBottom:2}},f?c.createElement(c.Fragment,null,c.createElement(Xw,{variant:"outlined",onClick:x},"Cancel"),c.createElement(Xw,{variant:"contained",onClick:()=>{if(!v)return;const n=w().find(e=>e.key===v);if(!n)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)});const c=`${s.join("_")}.${n.metricName}`,u={metric:n.metric,relations:o,providerPath:i,relationNames:a,metricName:n.metricName,metricTitle:n.value,fullPath:c};r(u),x()},disabled:!v},"Save Metric")):c.createElement(Xw,{variant:"contained",onClick:()=>{h(!0),g([]),b("")}},"Add Metric")),f&&c.createElement(qg,{sx:{padding:3,marginBottom:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Select Provider Path"),c.createElement(kH,{providersData:e,rootProvider:t,onSelectionChange:g,existingDimensions:d,existingMetrics:n,existingFilters:p}),c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},"Select Metric"),c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1}},c.createElement(uR,{items:w(),value:v,label:"Choose Metric",onChange:e=>{b(e.target.value)},sx:{width:"400px"}}),c.createElement(Hk,{title:"Add all available metrics",arrow:!0,placement:"top"},c.createElement("span",null,c.createElement(Mv,{color:"primary",onClick:()=>{const n=w().filter(e=>!e.disabled);if(0===n.length)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)}),n.forEach(e=>{const t=`${s.join("_")}.${e.metricName}`,n={metric:e.metric,relations:o,providerPath:i,relationNames:a,metricName:e.metricName,metricTitle:e.value,fullPath:t};r(n)}),x()},disabled:0===w().filter(e=>!e.disabled).length,"aria-label":"add all metrics"},c.createElement(lU,null)))))),n.length>0&&c.createElement(jw,{sx:{marginTop:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Saved Metrics (Drag to reorder or use arrows)"),c.createElement(TW,{sensors:y,collisionDetection:fV,onDragEnd:e=>{const{active:t,over:r}=e;if(r&&t.id!==r.id){const e=n.findIndex((e,n)=>n===t.id),o=n.findIndex((e,t)=>t===r.id),a=LW(n,e,o);i(a)}}},c.createElement(HW,{items:n.map((e,t)=>t),strategy:jW},c.createElement(jw,{sx:{display:"flex",flexDirection:"column",gap:1}},n.map((e,t)=>c.createElement(uU,{key:t,id:t,label:e.metricTitle,fullLabel:`${S(e)} → ${e.metricTitle} (${e.fullPath})`,onDelete:()=>o(t),onMoveUp:()=>(e=>{if(e>0){const t=LW(n,e,e-1);i(t)}})(t),onMoveDown:()=>(e=>{if(e<n.length-1){const t=LW(n,e,e+1);i(t)}})(t),isFirst:0===t,isLast:t===n.length-1,fullPath:e.fullPath,defaultTitle:e.metricTitle,customTitle:a[e.fullPath],onUpdateTitle:l,onResetTitle:u})))))))};var pU=Sg(Xp.jsx("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}));const fU=["localeText"],hU=s.createContext(null),mU=function(e){const{localeText:t}=e,n=d(e,fU),{adapter:r,localeText:o}=s.useContext(hU)??{adapter:void 0,localeText:void 0},i=cg({props:n,name:"MuiLocalizationProvider"}),{children:a,dateAdapter:l,dateFormats:c,dateLibInstance:u,adapterLocale:p,localeText:h}=i,m=s.useMemo(()=>f({},h,o,t),[h,o,t]),g=s.useMemo(()=>{if(!l)return r||null;const e=new l({locale:p,formats:c,instance:u});if(!e.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join("\n"));return e},[l,p,c,u,r]),v=s.useMemo(()=>g?{minDate:g.date("1900-01-01T00:00:00.000"),maxDate:g.date("2099-12-31T00:00:00.000")}:null,[g]),b=s.useMemo(()=>({utils:g,adapter:g,defaultDates:v,localeText:m}),[v,g,m]);return Xp.jsx(hU.Provider,{value:b,children:a})},gU=(e,t)=>e.length===t.length&&t.every(t=>e.includes(t)),vU=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n)),r},bU=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:i,adapter:a,timezone:l})=>{const s=vU(a,a.date(void 0,l),e);n&&a.isBefore(o,s)&&(o=s),t&&a.isAfter(r,s)&&(r=s);let c=e,u=e;for(a.isBefore(e,o)&&(c=o,u=null),a.isAfter(e,r)&&(u&&(u=r),c=null);c||u;){if(c&&a.isAfter(c,r)&&(c=null),u&&a.isBefore(u,o)&&(u=null),c){if(!i(c))return c;c=a.addDays(c,1)}if(u){if(!i(u))return u;u=a.addDays(u,-1)}}return null},yU=(e,t,n)=>null!=t&&e.isValid(t)?t:n,wU=(e,t)=>{const n=[e.startOfYear(t)];for(;n.length<12;){const t=n[n.length-1];n.push(e.addMonths(t,1))}return n},xU=(e,t,n)=>"date"===n?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),SU=["year","month","day"],CU=e=>SU.includes(e),kU=(e,{format:t,views:n},r)=>{if(null!=t)return t;const o=e.formats;return gU(n,["year"])?o.year:gU(n,["month"])?o.month:gU(n,["day"])?o.dayOfMonth:gU(n,["month","year"])?`${o.month} ${o.year}`:gU(n,["day","month"])?`${o.month} ${o.dayOfMonth}`:r?/en/.test(e.getCurrentLocaleCode())?o.normalDateWithWeekday:o.normalDate:o.keyboardDate},EU=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(t=>e.addDays(n,t))},RU=["hours","minutes","seconds"],PU=(e,t)=>3600*t.getHours(e)+60*t.getMinutes(e)+t.getSeconds(e),MU={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},TU=(e,t,n)=>{if(t===MU.year)return e.startOfYear(n);if(t===MU.month)return e.startOfMonth(n);if(t===MU.day)return e.startOfDay(n);let r=n;return t<MU.minutes&&(r=e.setMinutes(r,0)),t<MU.seconds&&(r=e.setSeconds(r,0)),t<MU.milliseconds&&(r=e.setMilliseconds(r,0)),r},IU=({props:e,adapter:t,granularity:n,timezone:r,getTodayDate:o})=>{let i=o?o():TU(t,n,xU(t,r));null!=e.minDate&&t.isAfterDay(e.minDate,i)&&(i=TU(t,n,e.minDate)),null!=e.maxDate&&t.isBeforeDay(e.maxDate,i)&&(i=TU(t,n,e.maxDate));const a=((e,t)=>(n,r)=>e?t.isAfter(n,r):PU(n,t)>PU(r,t))(e.disableIgnoringDatePartForTimeValidation??!1,t);return null!=e.minTime&&a(e.minTime,i)&&(i=TU(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:vU(t,i,e.minTime))),null!=e.maxTime&&a(i,e.maxTime)&&(i=TU(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:vU(t,i,e.maxTime))),i},OU=(e,t)=>{const n=e.formatTokenMap[t];if(null==n)throw new Error([`MUI X: The token "${t}" is not supported by the Date and Time Pickers.`,"Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported."].join("\n"));return"string"==typeof n?{type:n,contentType:"meridiem"===n?"letter":"digit",maxLength:void 0}:{type:n.sectionType,contentType:n.contentType,maxLength:n.maxLength}},DU=(e,t)=>{const n=[],r=e.date(void 0,"default"),o=e.startOfWeek(r),i=e.endOfWeek(r);let a=o;for(;e.isBefore(a,i);)n.push(a),a=e.addDays(a,1);return n.map(n=>e.formatByString(n,t))},FU=(e,t,n,r)=>{switch(n){case"month":return wU(e,e.date(void 0,t)).map(t=>e.formatByString(t,r));case"weekDay":return DU(e,r);case"meridiem":{const n=e.date(void 0,t);return[e.startOfDay(n),e.endOfDay(n)].map(t=>e.formatByString(t,r))}default:return[]}},LU=["0","1","2","3","4","5","6","7","8","9"],AU=(e,t)=>{if("0"===t[0])return e;const n=[];let r="";for(let o=0;o<e.length;o+=1){r+=e[o];const i=t.indexOf(r);i>-1&&(n.push(i.toString()),r="")}return n.join("")},NU=(e,t)=>"0"===t[0]?e:e.split("").map(e=>t[Number(e)]).join(""),$U=(e,t)=>{const n=AU(e,t);return" "!==n&&!Number.isNaN(Number(n))},zU=(e,t)=>Number(e).toString().padStart(t,"0"),jU=(e,t,n,r,o)=>{if("day"===o.type&&"digit-with-letter"===o.contentType){const r=e.setDate(n.longestMonth,t);return e.formatByString(r,o.format)}let i=t.toString();return o.hasLeadingZerosInInput&&(i=zU(i,o.maxLength)),NU(i,r)},BU=(e,t,n)=>{let r=e.value||e.placeholder;const o="non-input"===t?e.hasLeadingZerosInFormat:e.hasLeadingZerosInInput;"non-input"===t&&e.hasLeadingZerosInInput&&!e.hasLeadingZerosInFormat&&(r=Number(AU(r,n)).toString());return["input-rtl","input-ltr"].includes(t)&&"digit"===e.contentType&&!o&&1===r.length&&(r=`${r}`),"input-rtl"===t&&(r=`${r}`),r},_U=(e,t,n,r)=>e.formatByString(e.parse(t,n),r),HU=(e,t)=>4===e.formatByString(e.date(void 0,"system"),t).length,VU=(e,t,n,r)=>{if("digit"!==t)return!1;const o=e.date(void 0,"default");switch(n){case"year":return"dayjs"===e.lib&&"YY"===r||e.formatByString(e.setYear(o,1),r).startsWith("0");case"month":return e.formatByString(e.startOfYear(o),r).length>1;case"day":return e.formatByString(e.startOfMonth(o),r).length>1;case"weekDay":return e.formatByString(e.startOfWeek(o),r).length>1;case"hours":return e.formatByString(e.setHours(o,1),r).length>1;case"minutes":return e.formatByString(e.setMinutes(o,1),r).length>1;case"seconds":return e.formatByString(e.setSeconds(o,1),r).length>1;default:throw new Error("Invalid section type")}},WU={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},UU=(e,t,n,r,o)=>[...n].sort((e,t)=>WU[e.type]-WU[t.type]).reduce((n,r)=>!o||r.modified?((e,t,n,r)=>{switch(t.type){case"year":return e.setYear(r,e.getYear(n));case"month":return e.setMonth(r,e.getMonth(n));case"weekDay":{let r=e.formatByString(n,t.format);t.hasLeadingZerosInInput&&(r=zU(r,t.maxLength));const o=DU(e,t.format),i=o.indexOf(r),a=o.indexOf(t.value)-i;return e.addDays(n,a)}case"day":return e.setDate(r,e.getDate(n));case"meridiem":{const t=e.getHours(n)<12,o=e.getHours(r);return t&&o>=12?e.addHours(r,-12):!t&&o<12?e.addHours(r,12):r}case"hours":return e.setHours(r,e.getHours(n));case"minutes":return e.setMinutes(r,e.getMinutes(n));case"seconds":return e.setSeconds(r,e.getSeconds(n));default:return r}})(e,r,t,n):n,r),GU=(e,t)=>{if(null==e)return null;if("all"===e)return"all";if("string"==typeof e){const n=t.findIndex(t=>t.type===e);return-1===n?null:n}return e},KU=["value","referenceDate"],qU={emptyValue:null,getTodayValue:xU,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=d(e,KU);return r.adapter.isValid(t)?t:null!=n?n:IU(r)},cleanValue:(e,t)=>e.isValid(t)?t:null,areValuesEqual:(e,t,n)=>!e.isValid(t)&&null!=t&&!e.isValid(n)&&null!=n||e.isEqual(t,n),isSameError:(e,t)=>e===t,hasError:e=>null!=e,defaultErrorState:null,getTimezone:(e,t)=>e.isValid(t)?e.getTimezone(t):null,setTimezone:(e,t,n)=>null==n?null:e.setTimezone(n,t)},YU={updateReferenceValue:(e,t,n)=>e.isValid(t)?t:n,getSectionsFromValue:(e,t)=>t(e),getV7HiddenInputValueFromSections:e=>e.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),getV6InputValueFromSections:(e,t,n)=>{const r=e.map(e=>{const r=BU(e,n?"input-rtl":"input-ltr",t);return`${e.startSeparator}${r}${e.endSeparator}`}).join("");return n?`${r}`:r},parseValueStr:(e,t,n)=>n(e.trim(),t),getDateFromSection:e=>e,getDateSectionsFromValue:e=>e,updateDateInValue:(e,t,n)=>n,clearDateSections:e=>e.map(e=>f({},e,{value:""}))};function XU(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=XU(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function QU(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=XU(e))&&(r&&(r+=" "),r+=t);return r}function ZU(e){return Ph("MuiPickersToolbar",e)}Mh("MuiPickersToolbar",["root","title","content"]);const JU=s.createContext(()=>!0);const eG=s.createContext(null);function tG(){return s.useContext(eG)}const nG=s.createContext(null),rG=()=>{const e=s.useContext(nG);if(null==e)throw new Error("MUI X: The `usePickerContext` hook can only be called inside the context of a Picker component");return e},oG=s.createContext(null),iG=s.createContext({ownerState:{isPickerDisabled:!1,isPickerReadOnly:!1,isPickerValueEmpty:!1,isPickerOpen:!1,pickerVariant:"desktop",pickerOrientation:"portrait"},rootRefObject:{current:null},labelId:void 0,dismissViews:()=>{},hasUIView:!0,getCurrentViewMode:()=>"UI",triggerElement:null,viewContainerRole:null,defaultActionBarActions:[],onPopperExited:void 0});function aG(e){const{contextValue:t,actionsContextValue:n,privateContextValue:r,fieldPrivateContextValue:o,isValidContextValue:i,localeText:a,children:l}=e;return Xp.jsx(nG.Provider,{value:t,children:Xp.jsx(oG.Provider,{value:n,children:Xp.jsx(iG.Provider,{value:r,children:Xp.jsx(eG.Provider,{value:o,children:Xp.jsx(JU.Provider,{value:i,children:Xp.jsx(mU,{localeText:a,children:l})})})})})})}const lG=()=>s.useContext(iG);function sG(){const{ownerState:e}=lG(),t=um();return s.useMemo(()=>f({},e,{toolbarDirection:t?"rtl":"ltr"}),[e,t])}const cG=["children","className","classes","toolbarTitle","hidden","titleId","classes","landscapeDirection"],uG=pg("div",{name:"MuiPickersToolbar",slot:"Root"})(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"space-between",padding:e.spacing(2,3),variants:[{props:{pickerOrientation:"landscape"},style:{height:"auto",maxWidth:160,padding:16,justifyContent:"flex-start",flexWrap:"wrap"}}]})),dG=pg("div",{name:"MuiPickersToolbar",slot:"Content",shouldForwardProp:e=>Oh(e)&&"landscapeDirection"!==e})({display:"flex",flexWrap:"wrap",width:"100%",flex:1,justifyContent:"space-between",alignItems:"center",flexDirection:"row",variants:[{props:{pickerOrientation:"landscape"},style:{justifyContent:"flex-start",alignItems:"flex-start",flexDirection:"column"}},{props:{pickerOrientation:"landscape",landscapeDirection:"row"},style:{flexDirection:"row"}}]}),pG=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersToolbar"}),{children:r,className:o,classes:i,toolbarTitle:a,hidden:l,titleId:s,landscapeDirection:c}=n,u=d(n,cG),p=sG(),h=(e=>wm({root:["root"],title:["title"],content:["content"]},ZU,e))(i);return l?null:Xp.jsxs(uG,f({ref:t,className:QU(h.root,o),ownerState:p},u,{children:[Xp.jsx(Gv,{color:"text.secondary",variant:"overline",id:s,className:h.title,children:a}),Xp.jsx(dG,{className:h.content,ownerState:p,landscapeDirection:c,children:r})]}))}),fG={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:e=>"year"===e?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",nextStepButtonLabel:"Next",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",timeRangePickerToolbarTitle:"Select time range",clockLabelText:(e,t)=>`Select ${e}. ${t?`Selected time is ${t}`:"No time selected"}`,hoursClockNumberText:e=>`${e} hours`,minutesClockNumberText:e=>`${e} minutes`,secondsClockNumberText:e=>`${e} seconds`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:e=>e?`Choose date, selected date is ${e}`:"Choose date",openTimePickerDialogue:e=>e?`Choose time, selected time is ${e}`:"Choose time",openRangePickerDialogue:e=>e?`Choose range, selected range is ${e}`:"Choose range",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:e=>"Y".repeat(e.digitAmount),fieldMonthPlaceholder:e=>"letter"===e.contentType?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:e=>"letter"===e.contentType?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"},hG=fG;f({},fG);const mG=()=>{const e=s.useContext(hU);if(null===e)throw new Error(["MUI X: Can not find the date and time pickers localization context.","It looks like you forgot to wrap your component in LocalizationProvider.","This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package"].join("\n"));if(null===e.adapter)throw new Error(["MUI X: Can not find the date and time pickers adapter from its localization context.","It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider."].join("\n"));const t=s.useMemo(()=>f({},hG,e.localeText),[e.localeText]);return s.useMemo(()=>f({},e,{localeText:t}),[e,t])},gG=()=>mG().adapter,vG=()=>mG().localeText,bG=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],yG=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],wG=["minDateTime","maxDateTime"],xG=[...bG,...yG,...wG],SG=e=>xG.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{}),CG=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","unstableStartFieldRef","unstableEndFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator","autoFocus","focused"],kG=(e,t)=>s.useMemo(()=>{const n=f({},e),r={},o=e=>{n.hasOwnProperty(e)&&(r[e]=n[e],delete n[e])};return CG.forEach(o),"date"===t?bG.forEach(o):"time"===t?yG.forEach(o):"date-time"===t&&(bG.forEach(o),yG.forEach(o),wG.forEach(o)),{forwardedProps:n,internalProps:r}},[e,t]),EG=(e,t,n,r)=>{switch(n.type){case"year":return t.fieldYearPlaceholder({digitAmount:e.formatByString(e.date(void 0,"default"),r).length,format:r});case"month":return t.fieldMonthPlaceholder({contentType:n.contentType,format:r});case"day":return t.fieldDayPlaceholder({format:r});case"weekDay":return t.fieldWeekDayPlaceholder({contentType:n.contentType,format:r});case"hours":return t.fieldHoursPlaceholder({format:r});case"minutes":return t.fieldMinutesPlaceholder({format:r});case"seconds":return t.fieldSecondsPlaceholder({format:r});case"meridiem":return t.fieldMeridiemPlaceholder({format:r});default:return r}},RG=({adapter:e,date:t,shouldRespectLeadingZeros:n,localeText:r,localizedDigits:o,now:i,token:a,startSeparator:l})=>{if(""===a)throw new Error("MUI X: Should not call `commitToken` with an empty token");const s=OU(e,a),c=VU(e,s.contentType,s.type,a),u=n?c:"digit"===s.contentType,d=e.isValid(t);let p=d?e.formatByString(t,a):"",h=null;if(u)if(c)h=""===p?e.formatByString(i,a).length:p.length;else{if(null==s.maxLength)throw new Error(`MUI X: The token ${a} should have a 'maxLength' property on it's adapter`);h=s.maxLength,d&&(p=NU(zU(AU(p,o),h),o))}return f({},s,{format:a,maxLength:h,value:p,placeholder:EG(e,r,s,a),hasLeadingZerosInFormat:c,hasLeadingZerosInInput:u,startSeparator:l,endSeparator:"",modified:!1})},PG=e=>{let t=(({adapter:e,format:t})=>{let n=10,r=t,o=e.expandFormat(t);for(;o!==r;)if(r=o,o=e.expandFormat(r),n-=1,n<0)throw new Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the component.");return o})(e);e.isRtl&&e.enableAccessibleFieldDOMStructure&&(t=t.split(" ").reverse().join(" "));const n=(({adapter:e,expandedFormat:t})=>{const n=[],{start:r,end:o}=e.escapedCharacters,i=new RegExp(`(\\${r}[^\\${o}]*\\${o})+`,"g");let a=null;for(;a=i.exec(t);)n.push({start:a.index,end:i.lastIndex-1});return n})(f({},e,{expandedFormat:t})),r=(e=>{const{adapter:t,expandedFormat:n,escapedParts:r}=e,o=t.date(void 0),i=[];let a="";const l=Object.keys(t.formatTokenMap).sort((e,t)=>t.length-e.length),s=/^([a-zA-Z]+)/,c=new RegExp(`^(${l.join("|")})*$`),u=new RegExp(`^(${l.join("|")})`),d=e=>r.find(t=>t.start<=e&&t.end>=e);let p=0;for(;p<n.length;){const t=d(p),r=null!=t,l=s.exec(n.slice(p))?.[1];if(!r&&null!=l&&c.test(l)){let t=l;for(;t.length>0;){const n=u.exec(t)[1];t=t.slice(n.length),i.push(RG(f({},e,{now:o,token:n,startSeparator:a}))),a=""}p+=l.length}else{const e=n[p];r&&t?.start===p||t?.end===p||(0===i.length?a+=e:(i[i.length-1].endSeparator+=e,i[i.length-1].isEndFormatSeparator=!0)),p+=1}}return 0===i.length&&a.length>0&&i.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:a,endSeparator:"",modified:!1}),i})(f({},e,{expandedFormat:t,escapedParts:n}));return(({isRtl:e,formatDensity:t,sections:n})=>n.map(n=>{const r=n=>{let r=n;return e&&null!==r&&r.includes(" ")&&(r=`${r}`),"spacious"===t&&["/",".","-"].includes(r)&&(r=` ${r} `),r};return n.startSeparator=r(n.startSeparator),n.endSeparator=r(n.endSeparator),n}))(f({},e,{sections:r}))},MG=()=>s.useContext(nG);function TG(e){return Ph("MuiDatePickerToolbar",e)}Mh("MuiDatePickerToolbar",["root","title"]);const IG=["toolbarFormat","toolbarPlaceholder","className","classes"],OG=pg(pG,{name:"MuiDatePickerToolbar",slot:"Root"})({}),DG=pg(Gv,{name:"MuiDatePickerToolbar",slot:"Title"})({variants:[{props:{pickerOrientation:"landscape"},style:{margin:"auto 16px auto auto"}}]}),FG=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiDatePickerToolbar"}),{toolbarFormat:r,toolbarPlaceholder:o="––",className:i,classes:a}=n,l=d(n,IG),c=gG(),{value:u,views:p,orientation:h}=rG(),m=vG(),g=sG(),v=(e=>wm({root:["root"],title:["title"]},TG,e))(a),b=s.useMemo(()=>{if(!c.isValid(u))return o;const e=kU(c,{format:r,views:p},!0);return c.formatByString(u,e)},[u,r,o,c,p]);return Xp.jsx(OG,f({ref:t,toolbarTitle:m.datePickerToolbarTitle,className:QU(v.root,i)},l,{children:Xp.jsx(DG,{variant:"h4",align:"landscape"===h?"left":"center",ownerState:g,className:v.title,children:b})}))}),LG=({props:e,value:t,timezone:n,adapter:r})=>{if(null===t)return null;const{shouldDisableDate:o,shouldDisableMonth:i,shouldDisableYear:a,disablePast:l,disableFuture:s,minDate:c,maxDate:u}=e,d=r.date(void 0,n);switch(!0){case!r.isValid(t):return"invalidDate";case Boolean(o&&o(t)):return"shouldDisableDate";case Boolean(i&&i(t)):return"shouldDisableMonth";case Boolean(a&&a(t)):return"shouldDisableYear";case Boolean(s&&r.isAfterDay(t,d)):return"disableFuture";case Boolean(l&&r.isBeforeDay(t,d)):return"disablePast";case Boolean(c&&r.isBeforeDay(t,c)):return"minDate";case Boolean(u&&r.isAfterDay(t,u)):return"maxDate";default:return null}};function AG(e){const{props:t,validator:n,value:r,timezone:o,onError:i}=e,a=gG(),l=s.useRef(n.valueManager.defaultErrorState),c=n({adapter:a,value:r,timezone:o,props:t}),u=n.valueManager.hasError(c);s.useEffect(()=>{i&&!n.valueManager.isSameError(c,l.current)&&i(c,r),l.current=c},[n,i,c,r]);const d=Mg(e=>n({adapter:a,value:e,timezone:o,props:t}));return{validationError:c,hasValidationError:u,getValidationErrorForNewValue:d}}LG.valueManager=qU;const NG=e=>{const t=gG(),n=s.useRef(void 0);return void 0===n.current&&(n.current=t.date(void 0,e)),n.current};function $G(e){const t=gG(),n=vG();return s.useMemo(()=>{const r=t.isValid(e)?t.format(e,"fullDate"):null;return n.openDatePickerDialogue(r)},[e,n,t])}function zG(e){const t=gG(),n=jG(e);return s.useMemo(()=>f({},e,n,{format:e.format??t.formats.keyboardDate}),[e,n,t])}function jG(e){const t=gG(),n=mG().defaultDates;return s.useMemo(()=>({disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,minDate:yU(t,e.minDate,n.minDate),maxDate:yU(t,e.maxDate,n.maxDate)}),[e.minDate,e.maxDate,e.disableFuture,e.disablePast,t,n])}function BG(e,t){const n=cg({props:e,name:t}),r=jG(n),o=s.useMemo(()=>null==n.localeText?.toolbarTitle?n.localeText:f({},n.localeText,{datePickerToolbarTitle:n.localeText.toolbarTitle}),[n.localeText]);return f({},n,r,{localeText:o},(({openTo:e,defaultOpenTo:t,views:n,defaultViews:r})=>{const o=n??r;let i;if(null!=e)i=e;else if(o.includes(t))i=t;else{if(!(o.length>0))throw new Error("MUI X: The `views` prop must contain at least one view.");i=o[0]}return{views:o,openTo:i}})({views:n.views,openTo:n.openTo,defaultViews:["year","day"],defaultOpenTo:"day"}),{slots:f({toolbar:FG},n.slots)})}function _G(e){return Ph("MuiPickerPopper",e)}Mh("MuiPickerPopper",["root","paper"]);const HG=(e=document)=>{const t=e.activeElement;return t?t.shadowRoot?HG(t.shadowRoot):t:null},VG=e=>HG(kg(e)),WG="@media (pointer: fine)",UG=["PaperComponent","ownerState","children","paperSlotProps","paperClasses","onPaperClick","onPaperTouchStart"],GG=pg(My,{name:"MuiPickerPopper",slot:"Root"})(({theme:e})=>({zIndex:e.zIndex.modal})),KG=pg(qg,{name:"MuiPickerPopper",slot:"Paper"})({outline:0,transformOrigin:"top center",variants:[{props:({popperPlacement:e})=>new Set(["top","top-start","top-end"]).has(e),style:{transformOrigin:"bottom center"}}]});const qG=s.forwardRef((e,t)=>{const{PaperComponent:n,ownerState:r,children:o,paperSlotProps:i,paperClasses:a,onPaperClick:l,onPaperTouchStart:s}=e,c=d(e,UG),u=yy({elementType:n,externalSlotProps:i,additionalProps:{tabIndex:-1,elevation:8,ref:t},className:a,ownerState:r});return Xp.jsx(n,f({},c,u,{onClick:e=>{l(e),u.onClick?.(e)},onTouchStart:e=>{s(e),u.onTouchStart?.(e)},ownerState:r,children:o}))});function YG(e){const t=cg({props:e,name:"MuiPickerPopper"}),{children:n,placement:r="bottom-start",slots:o,slotProps:i,classes:a}=t,{open:l,popupRef:c,reduceAnimations:u}=rG(),{ownerState:d,rootRefObject:p}=lG(),{dismissViews:h,getCurrentViewMode:m,onPopperExited:g,triggerElement:v,viewContainerRole:b}=lG();s.useEffect(()=>{function e(e){l&&"Escape"===e.key&&h()}return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[h,l]);const y=s.useRef(null);s.useEffect(()=>{"tooltip"!==b&&"field"!==m()&&(l?y.current=VG(p.current):y.current&&y.current instanceof HTMLElement&&setTimeout(()=>{y.current instanceof HTMLElement&&y.current.focus()}))},[l,b,m,p]);const w=(e=>wm({root:["root"],paper:["paper"]},_G,e))(a),x=Mg(()=>{"tooltip"===b?setTimeout(()=>{p.current?.contains(VG(p.current))||c.current?.contains(VG(c.current))||h()},0):h()}),[S,C,k]=function(e,t){const n=s.useRef(!1),r=s.useRef(!1),o=s.useRef(null),i=s.useRef(!1);s.useEffect(()=>{if(e)return document.addEventListener("mousedown",t,!0),document.addEventListener("touchstart",t,!0),()=>{document.removeEventListener("mousedown",t,!0),document.removeEventListener("touchstart",t,!0),i.current=!1};function t(){i.current=!0}},[e]);const a=Mg(e=>{if(!i.current)return;const a=r.current;r.current=!1;const l=kg(o.current);if(!o.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,l))return;if(n.current)return void(n.current=!1);let s;s=e.composedPath?e.composedPath().indexOf(o.current)>-1:!l.documentElement.contains(e.target)||o.current.contains(e.target),s||a||t(e)}),l=e=>{e.defaultMuiPrevented||(r.current=!0)};return s.useEffect(()=>{if(e){const e=kg(o.current),t=()=>{n.current=!0};return e.addEventListener("touchstart",a),e.addEventListener("touchmove",t),()=>{e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",t)}}},[e,a]),s.useEffect(()=>{if(e){const e=kg(o.current);return e.addEventListener("click",a),()=>{e.removeEventListener("click",a),r.current=!1}}},[e,a]),[o,l,l]}(l,x),E=Tg(s.useRef(null),c),R=Tg(E,S),P=o?.desktopTransition??u?Pw:PS,M=o?.desktopTrapFocus??Cx,T=o?.desktopPaper??KG,I=o?.popper??GG,O=yy({elementType:I,externalSlotProps:i?.popper,additionalProps:{transition:!0,role:null==b?void 0:b,open:l,placement:r,anchorEl:v,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),h())}},className:w.root,ownerState:d}),D=s.useMemo(()=>f({},d,{popperPlacement:O.placement}),[d,O.placement]);return Xp.jsx(I,f({},O,{children:({TransitionProps:e})=>Xp.jsx(M,f({open:l,disableAutoFocus:!0,disableRestoreFocus:!0,disableEnforceFocus:"tooltip"===b,isEnabled:()=>!0},i?.desktopTrapFocus,{children:Xp.jsx(P,f({},e,i?.desktopTransition,{onExited:t=>{g?.(),i?.desktopTransition?.onExited?.(t),e?.onExited?.()},children:Xp.jsx(qG,{PaperComponent:T,ownerState:D,ref:R,onPaperClick:C,onPaperTouchStart:k,paperClasses:w.paper,paperSlotProps:i?.desktopPaper,children:n})}))}))}))}const XG="undefined"!=typeof navigator&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),QG=XG&&XG[1]?parseInt(XG[1],10):null,ZG=XG&&XG[2]?parseInt(XG[2],10):null,JG=QG&&QG<10||ZG&&ZG<13||!1;function eK(e){const t=nR("@media (prefers-reduced-motion: reduce)",{defaultMatches:!1});return null!=e?e:t||JG}const tK={hasNextStep:!1,hasSeveralSteps:!1,goToNextStep:()=>{},areViewsInSameStep:()=>!0};function nK({onChange:e,onViewChange:t,openTo:n,view:r,views:o,autoFocus:i,focusedView:a,onFocusedViewChange:l,getStepNavigation:c}){const u=s.useRef(n),d=s.useRef(o),p=s.useRef(o.includes(n)?n:o[0]),[h,m]=Pg({name:"useViews",state:"view",controlled:r,default:p.current}),g=s.useRef(i?h:null),[v,b]=Pg({name:"useViews",state:"focusedView",controlled:a,default:g.current}),y=c?c({setView:m,view:h,defaultView:p.current,views:o}):tK;s.useEffect(()=>{(u.current&&u.current!==n||d.current&&d.current.some(e=>!o.includes(e)))&&(m(o.includes(n)?n:o[0]),d.current=o,u.current=n)},[n,m,h,o]);const w=o.indexOf(h),x=o[w-1]??null,S=o[w+1]??null,C=Mg((e,t)=>{b(t?e:t=>e===t?null:t),l?.(e,t)}),k=Mg(e=>{C(e,!0),e!==h&&(m(e),t&&t(e))}),E=Mg(()=>{S&&k(S)}),R=Mg((t,n,r)=>{const i="finish"===n,a=r?o.indexOf(r)<o.length-1:Boolean(S);e(t,i&&a?"partial":n,r);let l=null;if(null!=r&&r!==h?l=r:i&&(l=h),null==l)return;const s=o[o.indexOf(l)+1];null!=s&&y.areViewsInSameStep(l,s)&&k(s)});return f({},y,{view:h,setView:k,focusedView:v,setFocusedView:C,nextView:S,previousView:x,defaultView:o.includes(n)?n:o[0],goToNextView:E,setValueAndGoToNextView:R})}function rK(){return"undefined"==typeof window?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?90===Math.abs(window.screen.orientation.angle)?"landscape":"portrait":window.orientation&&90===Math.abs(Number(window.orientation))?"landscape":"portrait"}function oK(e,t){const[n,r]=s.useState(rK);return Wh(()=>{const e=()=>{r(rK())};return window.addEventListener("orientationchange",e),()=>{window.removeEventListener("orientationchange",e)}},[]),o=e,i=["hours","minutes","seconds"],(Array.isArray(i)?i.every(e=>-1!==o.indexOf(e)):-1!==o.indexOf(i))?"portrait":t??n;var o,i}const iK=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:o,onChange:i,valueManager:a})=>{const l=gG(),[c,u]=Pg({name:e,state:"value",controlled:n,default:r??a.emptyValue}),d=s.useMemo(()=>a.getTimezone(l,c),[l,a,c]),p=Mg(e=>null==d?e:a.setTimezone(l,d,e)),f=s.useMemo(()=>t||(d||(o?l.getTimezone(Array.isArray(o)?o[0]:o):"default")),[t,d,o,l]);return{value:s.useMemo(()=>a.setTimezone(l,f,c),[a,l,f,c]),handleValueChange:Mg((e,...t)=>{const n=p(e);u(n),i?.(n,...t)}),timezone:f}};const aK=["className","sx"],lK=({ref:e,props:t,valueManager:n,valueType:r,variant:o,validator:i,onPopperExited:a,autoFocusView:l,rendererInterceptor:c,localeText:u,viewContainerRole:p,getStepNavigation:h})=>{const{views:m,view:g,openTo:v,onViewChange:b,viewRenderers:y,reduceAnimations:w,orientation:x,disableOpenPicker:S,closeOnSelect:C,disabled:k,readOnly:E,formatDensity:R,enableAccessibleFieldDOMStructure:P,selectedSections:M,onSelectedSectionsChange:T,format:I,label:O,autoFocus:D,name:F}=t,{className:L,sx:A}=t,N=d(t,aK),$=mm(),z=gG(),j=eK(w),B=oK(m,x),{current:_}=s.useRef(v??null),[H,V]=s.useState(null),W=s.useRef(null),U=s.useRef(null),G=s.useRef(null),K=Tg(e,G),{timezone:q,state:Y,setOpen:X,setValue:Q,setValueFromView:Z,value:J,viewValue:ee}=function(e){const{props:t,valueManager:n,validator:r}=e,{value:o,defaultValue:i,onChange:a,referenceDate:l,timezone:c,onAccept:u,closeOnSelect:d,open:p,onOpen:h,onClose:m}=t,{current:g}=s.useRef(i),{current:v}=s.useRef(void 0!==o),{current:b}=s.useRef(void 0!==p),y=gG(),{timezone:w,value:x,handleValueChange:S}=iK({name:"a picker component",timezone:c,value:o,defaultValue:g,referenceDate:l,onChange:a,valueManager:n}),[C,k]=s.useState(()=>({open:!1,lastExternalValue:x,clockShallowValue:void 0,lastCommittedValue:x,hasBeenModifiedSinceMount:!1})),{getValidationErrorForNewValue:E}=AG({props:t,validator:r,timezone:w,value:x,onError:t.onError}),R=Mg(e=>{const t="function"==typeof e?e(C.open):e;b||k(e=>f({},e,{open:t})),t&&h&&h(),t||m?.()}),P=Mg((e,t)=>{const{changeImportance:r="accept",skipPublicationIfPristine:o=!1,validationError:i,shortcut:a,source:l,shouldClose:s="accept"===r}=t??{};let c,d;o||v||C.hasBeenModifiedSinceMount?(c=!n.areValuesEqual(y,e,x),d="accept"===r&&!n.areValuesEqual(y,e,C.lastCommittedValue)):(c=!0,d="accept"===r),k(t=>f({},t,{clockShallowValue:c?void 0:t.clockShallowValue,lastCommittedValue:d?e:t.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let p=null;const h=()=>{if(!p){let t;t=l||(a?"view":"unknown"),p={validationError:null==i?E(e):i,source:t},a&&(p.shortcut=a)}return p};c&&S(e,h()),d&&u&&u(e,h()),s&&R(!1)});x!==C.lastExternalValue&&k(e=>f({},e,{lastExternalValue:x,clockShallowValue:void 0,hasBeenModifiedSinceMount:!0}));const M=Mg((e,t="partial")=>{"shallow"!==t?P(e,{changeImportance:"finish"===t&&d?"accept":"set",source:"view"}):k(t=>f({},t,{clockShallowValue:e,hasBeenModifiedSinceMount:!0}))});s.useEffect(()=>{if(b){if(void 0===p)throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");k(e=>f({},e,{open:p}))}},[b,p]);const T=s.useMemo(()=>n.cleanValue(y,void 0===C.clockShallowValue?x:C.clockShallowValue),[y,n,C.clockShallowValue,x]);return{timezone:w,state:C,setValue:P,setValueFromView:M,setOpen:R,value:x,viewValue:T}}({props:t,valueManager:n,validator:i}),{view:te,setView:ne,defaultView:re,focusedView:oe,setFocusedView:ie,setValueAndGoToNextView:ae,goToNextStep:le,hasNextStep:se,hasSeveralSteps:ce}=nK({view:g,views:m,openTo:v,onChange:Z,onViewChange:b,autoFocus:l,getStepNavigation:h}),ue=Mg(()=>Q(n.emptyValue,{source:"view"})),de=Mg(()=>Q(n.getTodayValue(z,q,r),{source:"view"})),pe=Mg(()=>Q(J,{source:"view"})),fe=Mg(()=>Q(Y.lastCommittedValue,{skipPublicationIfPristine:!0,source:"view"})),he=Mg(()=>{Q(J,{skipPublicationIfPristine:!0,source:"view"})}),{hasUIView:me,viewModeLookup:ge,timeViewsCount:ve}=s.useMemo(()=>m.reduce((e,t)=>{const n=null==y[t]?"field":"UI";return e.viewModeLookup[t]=n,"UI"===n&&(e.hasUIView=!0,(e=>RU.includes(e))(t)&&(e.timeViewsCount+=1)),e},{hasUIView:!1,viewModeLookup:{},timeViewsCount:0}),[y,m]),be=ge[te],ye=Mg(()=>be),[we,xe]=s.useState("UI"===be?te:null);we!==te&&"UI"===ge[te]&&xe(te),Wh(()=>{"field"===be&&Y.open&&(X(!1),setTimeout(()=>{U?.current?.setSelectedSections(te),U?.current?.focusField(te)}))},[te]),Wh(()=>{if(!Y.open)return;let e=te;"field"===be&&null!=we&&(e=we),e!==re&&"UI"===ge[e]&&"UI"===ge[re]&&(e=re),e!==te&&ne(e),ie(e,!0)},[Y.open]);const Se=s.useMemo(()=>({isPickerValueEmpty:n.areValuesEqual(z,J,n.emptyValue),isPickerOpen:Y.open,isPickerDisabled:t.disabled??!1,isPickerReadOnly:t.readOnly??!1,pickerOrientation:B,pickerVariant:o}),[z,n,J,Y.open,B,o,t.disabled,t.readOnly]),Ce=s.useMemo(()=>S||!me?"hidden":k||E?"disabled":"enabled",[S,me,k,E]),ke=Mg(le),Ee=s.useMemo(()=>C&&!ce?[]:["cancel","nextOrAccept"],[C,ce]),Re=s.useMemo(()=>({setValue:Q,setOpen:X,clearValue:ue,setValueToToday:de,acceptValueChanges:pe,cancelValueChanges:fe,setView:ne,goToNextStep:ke}),[Q,X,ue,de,pe,fe,ne,ke]),Pe=s.useMemo(()=>f({},Re,{value:J,timezone:q,open:Y.open,views:m,view:we,initialView:_,disabled:k??!1,readOnly:E??!1,autoFocus:D??!1,variant:o,orientation:B,popupRef:W,reduceAnimations:j,triggerRef:V,triggerStatus:Ce,hasNextStep:se,fieldFormat:I??"",name:F,label:O,rootSx:A,rootRef:K,rootClassName:L}),[Re,J,K,o,B,j,k,E,I,L,F,O,A,Ce,se,q,Y.open,we,m,_,D]),Me=s.useMemo(()=>({dismissViews:he,ownerState:Se,hasUIView:me,getCurrentViewMode:ye,rootRefObject:G,labelId:$,triggerElement:H,viewContainerRole:p,defaultActionBarActions:Ee,onPopperExited:a}),[he,Se,me,ye,$,H,p,Ee,a]),Te=s.useMemo(()=>({formatDensity:R,enableAccessibleFieldDOMStructure:P,selectedSections:M,onSelectedSectionsChange:T,fieldRef:U}),[R,P,M,T,U]);return{providerProps:{localeText:u,contextValue:Pe,privateContextValue:Me,actionsContextValue:Re,fieldPrivateContextValue:Te,isValidContextValue:e=>{const r=i({adapter:z,value:e,timezone:q,props:t});return!n.hasError(r)}},renderCurrentView:()=>{if(null==we)return null;const e=y[we];if(null==e)return null;const t=f({},N,{views:m,timezone:q,value:ee,onChange:ae,view:we,onViewChange:ne,showViewSwitcher:ve>1,timeViewsCount:ve},"tooltip"===p?{focusedView:null,onFocusedViewChange:()=>{}}:{focusedView:oe,onFocusedViewChange:ie});return c?Xp.jsx(c,{viewRenderers:y,popperView:we,rendererProps:t}):e(t)},ownerState:Se}};function sK(e){return Ph("MuiPickersLayout",e)}const cK=Mh("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),uK=["actions"],dK=pg(_x,{name:"MuiPickersLayout",slot:"ActionBar"})({});function pK(e){const{actions:t}=e,n=d(e,uK),r=vG(),{clearValue:o,setValueToToday:i,acceptValueChanges:a,cancelValueChanges:l,goToNextStep:s,hasNextStep:c}=rG();if(null==t||0===t.length)return null;const u=t?.map(e=>{switch(e){case"clear":return Xp.jsx(Xw,{onClick:o,children:r.clearButtonLabel},e);case"cancel":return Xp.jsx(Xw,{onClick:l,children:r.cancelButtonLabel},e);case"accept":return Xp.jsx(Xw,{onClick:a,children:r.okButtonLabel},e);case"today":return Xp.jsx(Xw,{onClick:i,children:r.todayButtonLabel},e);case"next":return Xp.jsx(Xw,{onClick:s,children:r.nextStepButtonLabel},e);case"nextOrAccept":return c?Xp.jsx(Xw,{onClick:s,children:r.nextStepButtonLabel},e):Xp.jsx(Xw,{onClick:a,children:r.okButtonLabel},e);default:return null}});return Xp.jsx(dK,f({},n,{children:u}))}const fK=s.memo(pK),hK=320,mK=["items","changeImportance"],gK=["getValue"],vK=pg(tC,{name:"MuiPickersLayout",slot:"Shortcuts"})({});function bK(e){const{items:t,changeImportance:n="accept"}=e,r=d(e,mK),{setValue:o}=(()=>{const e=s.useContext(oG);if(null==e)throw new Error(["MUI X: The `usePickerActionsContext` can only be called in fields that are used as a slot of a Picker component"].join("\n"));return e})(),i=s.useContext(JU);if(null==t||0===t.length)return null;const a=t.map(e=>{let{getValue:t}=e,r=d(e,gK);const a=t({isValid:i});return f({},r,{label:r.label,onClick:()=>{o(a,{changeImportance:n,shortcut:r,source:"view"})},disabled:!i(a)})});return Xp.jsx(vK,f({dense:!0,sx:[{maxHeight:336,maxWidth:200,overflow:"auto"},...Array.isArray(r.sx)?r.sx:[r.sx]]},r,{children:a.map(e=>Xp.jsx(cC,{children:Xp.jsx(zy,f({},e))},e.id??e.label))}))}const yK=["ownerState"];const wK=e=>{const{ownerState:t,defaultActionBarActions:n}=lG(),{view:r}=rG(),o=um(),{children:i,slots:a,slotProps:l,classes:c}=e,u=s.useMemo(()=>f({},t,{layoutDirection:o?"rtl":"ltr",hasShortcuts:!1}),[t,o]),p=((e,t)=>{const{pickerOrientation:n}=t;return wm({root:["root","landscape"===n&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},sK,e)})(c,u),h=a?.actionBar??fK,m=d(yy({elementType:h,externalSlotProps:l?.actionBar,additionalProps:{actions:n},className:p.actionBar,ownerState:u}),yK),g=Xp.jsx(h,f({},m)),v=a?.toolbar,b=yy({elementType:v,externalSlotProps:l?.toolbar,className:p.toolbar,ownerState:u}),y=function(e){return null!==e.view}(b)&&v?Xp.jsx(v,f({},b)):null,w=i,x=a?.tabs,S=r&&x?Xp.jsx(x,f({className:p.tabs},l?.tabs)):null,C=a?.shortcuts??bK,k=yy({elementType:C,externalSlotProps:l?.shortcuts,className:p.shortcuts,ownerState:u}),E=Array.isArray(k?.items)&&k.items.length>0;return{toolbar:y,content:w,tabs:S,actionBar:g,shortcuts:r&&C?Xp.jsx(C,f({},k)):null,ownerState:f({},u,{hasShortcuts:E})}},xK=pg("div",{name:"MuiPickersLayout",slot:"Root"})({display:"grid",gridAutoColumns:"max-content auto max-content",gridAutoRows:"max-content auto max-content",[`& .${cK.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{pickerOrientation:"landscape",hasShortcuts:!1},style:{[`& .${cK.toolbar}`]:{gridColumn:1,gridRow:"1 / 3"}}},{props:{pickerOrientation:"landscape",hasShortcuts:!0},style:{[`& .${cK.toolbar}`]:{gridColumn:"2 / 4",gridRow:1,maxWidth:"max-content"},[`& .${cK.shortcuts}`]:{gridColumn:1,gridRow:2}}},{props:{pickerOrientation:"portrait"},style:{[`& .${cK.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${cK.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{hasShortcuts:!0,layoutDirection:"rtl"},style:{[`& .${cK.shortcuts}`]:{gridColumn:4}}}]}),SK=pg("div",{name:"MuiPickersLayout",slot:"ContentWrapper"})({gridColumn:"2 / 4",gridRow:2,display:"flex",flexDirection:"column"}),CK=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersLayout"}),{toolbar:r,content:o,tabs:i,actionBar:a,shortcuts:l,ownerState:c}=wK(n),{orientation:u,variant:d}=rG(),{sx:p,className:f,classes:h}=n,m=((e,t)=>{const{pickerOrientation:n}=t;return wm({root:["root","landscape"===n&&"landscape"],contentWrapper:["contentWrapper"]},sK,e)})(h,c);return Xp.jsxs(xK,{ref:t,sx:p,className:QU(m.root,f),ownerState:c,children:["landscape"===u?l:r,"landscape"===u?r:l,Xp.jsx(SK,{className:m.contentWrapper,ownerState:c,children:"desktop"===d?Xp.jsxs(s.Fragment,{children:[o,i]}):Xp.jsxs(s.Fragment,{children:[i,o]})}),a]})});function kK(e){const{steps:t}=e;return function(e){const{steps:t,isViewMatchingStep:n,onStepChange:r}=e;return e=>{if(null==t)return tK;const o=t.findIndex(t=>n(e.view,t)),i=-1===o||o===t.length-1?null:t[o+1];return{hasNextStep:null!=i,hasSeveralSteps:t.length>1,goToNextStep:()=>{null!=i&&r(f({},e,{step:i}))},areViewsInSameStep:(e,r)=>t.find(t=>n(e,t))===t.find(e=>n(r,e))}}}({steps:t,isViewMatchingStep:(e,t)=>null==t.views||t.views.includes(e),onStepChange:({step:e,defaultView:t,setView:n,view:r,views:o})=>{const i=null==e.views?t:e.views.find(e=>o.includes(e));i!==r&&n(i)}})}const EK=["props","steps"],RK=["ownerState"],PK=e=>null!=e.saveQuery,MK=({stateResponse:{localizedDigits:e,sectionsValueBoundaries:t,state:n,timezone:r,setCharacterQuery:o,setTempAndroidValueStr:i,updateSectionValue:a}})=>{const l=gG(),s=({keyPressed:e,sectionIndex:t},r,i)=>{const a=e.toLowerCase(),l=n.sections[t];if(null!=n.characterQuery&&(!i||i(n.characterQuery.value))&&n.characterQuery.sectionIndex===t){const e=`${n.characterQuery.value}${a}`,i=r(e,l);if(!PK(i))return o({sectionIndex:t,value:e,sectionType:l.type}),i}const s=r(a,l);return PK(s)&&!s.saveQuery?(o(null),null):(o({sectionIndex:t,value:a,sectionType:l.type}),PK(s)?null:s)};return Mg(o=>{const c=n.sections[o.sectionIndex],u=$U(o.keyPressed,e)?(n=>{const r=({queryValue:n,skipIfBelowMinimum:r,section:o})=>{const i=AU(n,e),a=Number(i),s=t[o.type]({currentDate:null,format:o.format,contentType:o.contentType});if(a>s.maximum)return{saveQuery:!1};if(r&&a<s.minimum)return{saveQuery:!0};const c=10*a>s.maximum||i.length===s.maximum.toString().length;return{sectionValue:jU(l,a,s,e,o),shouldGoToNextSection:c}};return s(n,(e,t)=>{if("digit"===t.contentType||"digit-with-letter"===t.contentType)return r({queryValue:e,skipIfBelowMinimum:!1,section:t});if("month"===t.type){VU(l,"digit","month","MM");const n=r({queryValue:e,skipIfBelowMinimum:!0,section:{type:t.type,format:"MM",hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2}});return PK(n)?n:f({},n,{sectionValue:_U(l,n.sectionValue,"MM",t.format)})}if("weekDay"===t.type){const n=r({queryValue:e,skipIfBelowMinimum:!0,section:t});return PK(n)?n:f({},n,{sectionValue:DU(l,t.format)[Number(n.sectionValue)-1]})}return{saveQuery:!1}},t=>$U(t,e))})(f({},o,{keyPressed:NU(o.keyPressed,e)})):(e=>{const t=(e,t,n)=>{const r=t.filter(e=>e.toLowerCase().startsWith(n));return 0===r.length?{saveQuery:!1}:{sectionValue:r[0],shouldGoToNextSection:1===r.length}},n=(e,n,o,i)=>{const a=e=>FU(l,r,n.type,e);if("letter"===n.contentType)return t(n.format,a(n.format),e);if(o&&null!=i&&"letter"===OU(l,o).contentType){const n=a(o),r=t(0,n,e);return PK(r)?{saveQuery:!1}:f({},r,{sectionValue:i(r.sectionValue,n)})}return{saveQuery:!1}};return s(e,(e,t)=>{switch(t.type){case"month":{const r=e=>_U(l,e,l.formats.month,t.format);return n(e,t,l.formats.month,r)}case"weekDay":{const r=(e,t)=>t.indexOf(e).toString();return n(e,t,l.formats.weekday,r)}case"meridiem":return n(e,t);default:return{saveQuery:!1}}})})(o);null!=u?a({section:c,newSectionValue:u.sectionValue,shouldGoToNextSection:u.shouldGoToNextSection}):i(null)})},TK=e=>{const t=gG(),n=vG(),r=um(),{manager:{validator:o,valueType:i,internal_valueManager:a,internal_fieldValueManager:l},internalPropsWithDefaults:c,internalPropsWithDefaults:{value:u,defaultValue:d,referenceDate:p,onChange:h,format:m,formatDensity:g="dense",selectedSections:v,onSelectedSectionsChange:b,shouldRespectLeadingZeros:y=!1,timezone:w,enableAccessibleFieldDOMStructure:x=!0},forwardedProps:{error:S}}=e,{value:C,handleValueChange:k,timezone:E}=iK({name:"a field component",timezone:w,value:u,defaultValue:d,referenceDate:p,onChange:h,valueManager:a}),R=s.useRef(C);s.useEffect(()=>{R.current=C},[C]);const{hasValidationError:P}=AG({props:c,validator:o,timezone:E,value:C,onError:c.onError}),M=s.useMemo(()=>(e=>{const t=e.date(void 0);return"0"===e.formatByString(e.setSeconds(t,0),"s")?LU:Array.from({length:10}).map((n,r)=>e.formatByString(e.setSeconds(t,r),"s"))})(t),[t]),T=s.useMemo(()=>((e,t,n)=>{const r=e.date(void 0,n),o=e.endOfYear(r),i=e.endOfDay(r),{maxDaysInMonth:a,longestMonth:l}=wU(e,r).reduce((t,n)=>{const r=e.getDaysInMonth(n);return r>t.maxDaysInMonth?{maxDaysInMonth:r,longestMonth:n}:t},{maxDaysInMonth:0,longestMonth:null});return{year:({format:t})=>({minimum:0,maximum:HU(e,t)?9999:99}),month:()=>({minimum:1,maximum:e.getMonth(o)+1}),day:({currentDate:t})=>({minimum:1,maximum:e.isValid(t)?e.getDaysInMonth(t):a,longestMonth:l}),weekDay:({format:t,contentType:n})=>{if("digit"===n){const n=DU(e,t).map(Number);return{minimum:Math.min(...n),maximum:Math.max(...n)}}return{minimum:1,maximum:7}},hours:({format:n})=>{const o=e.getHours(i);return AU(e.formatByString(e.endOfDay(r),n),t)!==o.toString()?{minimum:1,maximum:Number(AU(e.formatByString(e.startOfDay(r),n),t))}:{minimum:0,maximum:o}},minutes:()=>({minimum:0,maximum:e.getMinutes(i)}),seconds:()=>({minimum:0,maximum:e.getSeconds(i)}),meridiem:()=>({minimum:0,maximum:1}),empty:()=>({minimum:0,maximum:0})}})(t,M,E),[t,M,E]),I=s.useCallback(e=>l.getSectionsFromValue(e,e=>PG({adapter:t,localeText:n,localizedDigits:M,format:m,date:e,formatDensity:g,shouldRespectLeadingZeros:y,enableAccessibleFieldDOMStructure:x,isRtl:r})),[l,m,n,M,r,y,t,g,x]),[O,D]=s.useState(()=>{const e=I(C),n={sections:e,lastExternalValue:C,lastSectionsDependencies:{format:m,isRtl:r,locale:t.locale},tempValueStrAndroid:null,characterQuery:null},o=(e=>Math.max(...e.map(e=>MU[e.type]??1)))(e);return f({},n,{referenceValue:a.getInitialReferenceValue({referenceDate:p,value:C,adapter:t,props:c,granularity:o,timezone:E})})}),[F,L]=Pg({controlled:v,default:null,name:"useField",state:"selectedSections"}),A=e=>{L(e),b?.(e)},N=s.useMemo(()=>GU(F,O.sections),[F,O.sections]),$="all"===N?0:N,z=s.useMemo(()=>((e,t)=>{const n={};if(!t)return e.forEach((t,r)=>{const o=0===r?null:r-1,i=r===e.length-1?null:r+1;n[r]={leftIndex:o,rightIndex:i}}),{neighbors:n,startIndex:0,endIndex:e.length-1};const r={},o={};let i=0,a=0,l=e.length-1;for(;l>=0;){a=e.findIndex((e,t)=>t>=i&&e.endSeparator?.includes(" ")&&" / "!==e.endSeparator),-1===a&&(a=e.length-1);for(let e=a;e>=i;e-=1)o[e]=l,r[l]=e,l-=1;i=a+1}return e.forEach((t,i)=>{const a=o[i],l=0===a?null:r[a-1],s=a===e.length-1?null:r[a+1];n[i]={leftIndex:l,rightIndex:s}}),{neighbors:n,startIndex:r[0],endIndex:r[e.length-1]}})(O.sections,r&&!x),[O.sections,r,x]),j=s.useMemo(()=>O.sections.every(e=>""===e.value),[O.sections]),B=s.useMemo(()=>{if(null!=$)return!1;const e=O.sections.filter(e=>""!==e.value);return e.length>0&&O.sections.length-e.length>0},[O.sections,$]),_=s.useMemo(()=>void 0!==S?S:P||B,[P,B,S]),H=e=>{const n={validationError:o({adapter:t,value:e,timezone:E,props:c})};k(e,n)},V=(e,t)=>{const n=[...O.sections];return n[e]=f({},n[e],{value:t,modified:!0}),n},W=s.useRef(null),U=Ng(),G=e=>{null!=$&&(W.current={sectionIndex:$,value:e},U.start(0,()=>{W.current=null}))},K=()=>{if(null==$)return;const e=O.sections[$];""!==e.value&&(G(""),null===l.getDateFromSection(C,e)?D(e=>f({},e,{sections:V($,""),tempValueStrAndroid:null,characterQuery:null})):(D(e=>f({},e,{characterQuery:null})),H(l.updateDateInValue(C,e,null))))},q=Ng(),Y=Mg(e=>{D(t=>f({},t,{characterQuery:e}))});if(C!==O.lastExternalValue){const e=null!=W.current&&!t.isValid(l.getDateFromSection(C,O.sections[W.current.sectionIndex]));let n;n=e?V(W.current.sectionIndex,W.current.value):I(C),D(o=>f({},o,{lastExternalValue:C,sections:n,sectionsDependencies:{format:m,isRtl:r,locale:t.locale},referenceValue:e?o.referenceValue:l.updateReferenceValue(t,C,o.referenceValue),tempValueStrAndroid:null}))}if(r!==O.lastSectionsDependencies.isRtl||m!==O.lastSectionsDependencies.format||t.locale!==O.lastSectionsDependencies.locale){const e=I(C);D(n=>f({},n,{lastSectionsDependencies:{format:m,isRtl:r,locale:t.locale},sections:e,tempValueStrAndroid:null,characterQuery:null}))}null==O.characterQuery||_||null!=$||Y(null),null!=O.characterQuery&&O.sections[O.characterQuery.sectionIndex]?.type!==O.characterQuery.sectionType&&Y(null),s.useEffect(()=>{null!=W.current&&(W.current=null)});const X=Ng();return s.useEffect(()=>(null!=O.characterQuery&&X.start(5e3,()=>Y(null)),()=>{}),[O.characterQuery,Y,X]),s.useEffect(()=>{null!=O.tempValueStrAndroid&&null!=$&&K()},[O.sections]),{activeSectionIndex:$,areAllSectionsEmpty:j,error:_,localizedDigits:M,parsedSelectedSections:N,sectionOrder:z,sectionsValueBoundaries:T,state:O,timezone:E,value:C,clearValue:()=>{a.areValuesEqual(t,C,a.emptyValue)?D(e=>f({},e,{sections:e.sections.map(e=>f({},e,{value:""})),tempValueStrAndroid:null,characterQuery:null})):(D(e=>f({},e,{characterQuery:null})),H(a.emptyValue))},clearActiveSection:K,setCharacterQuery:Y,setSelectedSections:A,setTempAndroidValueStr:e=>D(t=>f({},t,{tempValueStrAndroid:e})),updateSectionValue:({section:e,newSectionValue:n,shouldGoToNextSection:r})=>{U.clear(),q.clear();const o=l.getDateFromSection(C,e);r&&$<O.sections.length-1&&A($+1);const i=V($,n),a=l.getDateSectionsFromValue(i,e),s=((e,t,n)=>{const r=t.some(e=>"day"===e.type),o=[],i=[];for(let e=0;e<t.length;e+=1){const a=t[e];r&&"weekDay"===a.type||(o.push(a.format),i.push(BU(a,"non-input",n)))}const a=o.join(" "),l=i.join(" ");return e.parse(l,a)})(t,a,M);if(t.isValid(s)){const n=UU(t,s,a,l.getDateFromSection(O.referenceValue,e),!0);return null==o&&q.start(0,()=>{R.current===C&&D(t=>f({},t,{sections:l.clearDateSections(O.sections,e),tempValueStrAndroid:null}))}),H(l.updateDateInValue(C,e,n))}return a.every(e=>""!==e.value)&&(null==o||t.isValid(o))?(G(n),H(l.updateDateInValue(C,e,s))):(null!=o&&(G(n),H(l.updateDateInValue(C,e,s))),D(e=>f({},e,{sections:i,tempValueStrAndroid:null})))},updateValueFromValueStr:e=>{const o=l.parseValueStr(e,O.referenceValue,(e,o)=>{const i=t.parse(e,m);if(!t.isValid(i))return null;const a=PG({adapter:t,localeText:n,localizedDigits:M,format:m,date:i,formatDensity:g,shouldRespectLeadingZeros:y,enableAccessibleFieldDOMStructure:x,isRtl:r});return UU(t,i,a,o,!1)});H(o)},getSectionsFromValue:I}};function IK(e){const{manager:{internal_useApplyDefaultValuesToFieldInternalProps:t},internalProps:n,skipContextFieldRefAssignment:r}=e,o=MG(),i=tG(),a=Tg(n.unstableFieldRef,r?null:i?.fieldRef),l=o?.setValue,c=s.useCallback((e,t)=>l?.(e,{validationError:t.validationError,shouldClose:!1}),[l]);return t(s.useMemo(()=>null!=i&&null!=o?f({value:o.value,onChange:c,timezone:o.timezone,disabled:o.disabled,readOnly:o.readOnly,autoFocus:o.autoFocus&&!o.open,focused:!!o.open||void 0,format:o.fieldFormat,formatDensity:i.formatDensity,enableAccessibleFieldDOMStructure:i.enableAccessibleFieldDOMStructure,selectedSections:i.selectedSections,onSelectedSectionsChange:i.onSelectedSectionsChange,unstableFieldRef:a},n):n,[o,i,n,c,a]))}function OK(e){const{focused:t,domGetters:n,stateResponse:{parsedSelectedSections:r,state:o}}=e;if(!n.isReady())return;const i=kg(n.getRoot()).getSelection();if(!i)return;if(null==r)return i.rangeCount>0&&i.getRangeAt(0).startContainer instanceof Node&&n.getRoot().contains(i.getRangeAt(0).startContainer)&&i.removeAllRanges(),void(t&&n.getRoot().blur());if(!n.getRoot().contains(VG(n.getRoot())))return;const a=new window.Range;let l;if("all"===r)l=n.getRoot();else{l="empty"===o.sections[r].type?n.getSectionContainer(r):n.getSectionContent(r)}a.selectNodeContents(l),l.focus(),i.removeAllRanges(),i.addRange(a)}function DK(e){const t=gG(),{manager:{internal_fieldValueManager:n},internalPropsWithDefaults:{minutesStep:r,disabled:o,readOnly:i},stateResponse:{state:a,value:l,activeSectionIndex:s,parsedSelectedSections:c,sectionsValueBoundaries:u,localizedDigits:d,timezone:p,sectionOrder:f,clearValue:h,clearActiveSection:m,setSelectedSections:g,updateSectionValue:v}}=e;return Mg(e=>{if(!o)switch(!0){case(e.ctrlKey||e.metaKey)&&"A"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey:e.preventDefault(),g("all");break;case"ArrowRight"===e.key:if(e.preventDefault(),null==c)g(f.startIndex);else if("all"===c)g(f.endIndex);else{const e=f.neighbors[c].rightIndex;null!==e&&g(e)}break;case"ArrowLeft"===e.key:if(e.preventDefault(),null==c)g(f.endIndex);else if("all"===c)g(f.startIndex);else{const e=f.neighbors[c].leftIndex;null!==e&&g(e)}break;case"Delete"===e.key:if(e.preventDefault(),i)break;null==c||"all"===c?h():m();break;case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key):{if(e.preventDefault(),i||null==s)break;"all"===c&&g(s);const o=a.sections[s],f=function(e,t,n,r,o,i,a,l){const s=function(e){switch(e){case"ArrowUp":return 1;case"ArrowDown":return-1;case"PageUp":return 5;case"PageDown":return-5;default:return 0}}(r),c="Home"===r,u="End"===r,d=""===n.value||c||u,p=()=>{const r=o[n.type]({currentDate:a,format:n.format,contentType:n.contentType}),p=t=>jU(e,t,r,i,n),f="minutes"===n.type&&l?.minutesStep?l.minutesStep:1;let h;if(d){if("year"===n.type&&!u&&!c)return e.formatByString(e.date(void 0,t),n.format);h=s>0||c?r.minimum:r.maximum}else{h=parseInt(AU(n.value,i),10)+s*f}return h%f!==0&&((s<0||c)&&(h+=f-(f+h)%f),(s>0||u)&&(h-=h%f)),h>r.maximum?p(r.minimum+(h-r.maximum-1)%(r.maximum-r.minimum+1)):h<r.minimum?p(r.maximum-(r.minimum-h-1)%(r.maximum-r.minimum+1)):p(h)},f=()=>{const r=FU(e,t,n.type,n.format);if(0===r.length)return n.value;if(d)return s>0||c?r[0]:r[r.length-1];const o=r.indexOf(n.value);return r[((o+s)%r.length+r.length)%r.length]};if("digit"===n.contentType||"digit-with-letter"===n.contentType)return p();return f()}(t,p,o,e.key,u,d,n.getDateFromSection(l,o),{minutesStep:r});v({section:o,newSectionValue:f,shouldGoToNextSection:!1});break}}})}function FK(e,t){if(e.value)switch(e.type){case"month":{if("digit"===e.contentType){const n=t.setMonth(t.date(),Number(e.value)-1);return t.isValid(n)?t.format(n,"month"):""}const n=t.parse(e.value,e.format);return n&&t.isValid(n)?t.format(n,"month"):void 0}case"day":if("digit"===e.contentType){const n=t.setDate(t.startOfYear(t.date()),Number(e.value));return t.isValid(n)?t.format(n,"dayOfMonthFull"):""}return e.value;default:return}}function LK(e,t){if(e.value)switch(e.type){case"weekDay":if("letter"===e.contentType)return;return Number(e.value);case"meridiem":{const n=t.parse(`01:00 ${e.value}`,`${t.formats.hours12h}:${t.formats.minutes} ${e.format}`);return n?t.getHours(n)>=12?1:0:void 0}case"day":return"digit-with-letter"===e.contentType?parseInt(e.value,10):Number(e.value);case"month":{if("digit"===e.contentType)return Number(e.value);const n=t.parse(e.value,e.format);return n?t.getMonth(n)+1:void 0}default:return"letter"!==e.contentType?Number(e.value):void 0}}const AK=e=>{const{props:t,manager:n,skipContextFieldRefAssignment:r,manager:{valueType:o,internal_useOpenPickerButtonAriaLabel:i}}=e,{internalProps:a,forwardedProps:l}=kG(t,o),c=IK({manager:n,internalProps:a,skipContextFieldRefAssignment:r}),{sectionListRef:u,onBlur:d,onClick:p,onFocus:h,onInput:m,onPaste:g,onKeyDown:v,onClear:b,clearable:y}=l,{disabled:w=!1,readOnly:x=!1,autoFocus:S=!1,focused:C,unstableFieldRef:k}=c,E=s.useRef(null),R=Tg(u,E),P=s.useMemo(()=>({isReady:()=>null!=E.current,getRoot:()=>E.current.getRoot(),getSectionContainer:e=>E.current.getSectionContainer(e),getSectionContent:e=>E.current.getSectionContent(e),getSectionIndexFromDOMElement:e=>E.current.getSectionIndexFromDOMElement(e)}),[E]),M=TK({manager:n,internalPropsWithDefaults:c,forwardedProps:l}),{areAllSectionsEmpty:T,error:I,parsedSelectedSections:O,sectionOrder:D,state:F,value:L,clearValue:A,setSelectedSections:N}=M,$=MK({stateResponse:M}),z=i(L),[j,B]=s.useState(!1);function _(e=0){if(w||!E.current||null!=NK(E))return;const t=GU(e,F.sections);B(!0),E.current.getSectionContent(t).focus()}const H=function(e){const{manager:t,focused:n,setFocused:r,domGetters:o,stateResponse:i,applyCharacterEditing:a,internalPropsWithDefaults:l,stateResponse:{parsedSelectedSections:s,sectionOrder:c,state:u,clearValue:d,setCharacterQuery:p,setSelectedSections:f,updateValueFromValueStr:h},internalPropsWithDefaults:{disabled:m=!1,readOnly:g=!1}}=e,v=DK({manager:t,internalPropsWithDefaults:l,stateResponse:i}),b=Ng(),y=Mg(e=>{!m&&o.isReady()&&(r(!0),"all"===s?b.start(0,()=>{const e=document.getSelection().getRangeAt(0).startOffset;if(0===e)return void f(c.startIndex);let t=0,n=0;for(;n<e&&t<u.sections.length;){const e=u.sections[t];t+=1,n+=`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`.length}f(t-1)}):n?o.getRoot().contains(e.target)||f(c.startIndex):(r(!0),f(c.startIndex)))}),w=Mg(e=>{if(!o.isReady()||"all"!==s)return;const t=e.target.textContent??"";o.getRoot().innerHTML=u.sections.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),OK({focused:n,domGetters:o,stateResponse:i}),0===t.length||10===t.charCodeAt(0)?(d(),f("all")):t.length>1?h(t):("all"===s&&f(0),a({keyPressed:t,sectionIndex:0}))}),x=Mg(e=>{if(g||"all"!==s)return void e.preventDefault();const t=e.clipboardData.getData("text");e.preventDefault(),p(null),h(t)}),S=Mg(()=>{if(n||m||!o.isReady())return;const e=VG(o.getRoot());r(!0),null!=o.getSectionIndexFromDOMElement(e)||f(c.startIndex)}),C=Mg(()=>{setTimeout(()=>{if(!o.isReady())return;const e=VG(o.getRoot());!o.getRoot().contains(e)&&(r(!1),f(null))})});return{onKeyDown:v,onBlur:C,onFocus:S,onClick:y,onPaste:x,onInput:w,contentEditable:"all"===s,tabIndex:l.disabled||0===s?-1:0}}({manager:n,internalPropsWithDefaults:c,stateResponse:M,applyCharacterEditing:$,focused:j,setFocused:B,domGetters:P}),V=function(e){const{manager:{internal_fieldValueManager:t},stateResponse:{areAllSectionsEmpty:n,state:r,updateValueFromValueStr:o}}=e,i=Mg(e=>{o(e.target.value)});return{value:s.useMemo(()=>n?"":t.getV7HiddenInputValueFromSections(r.sections),[n,r.sections,t]),onChange:i}}({manager:n,stateResponse:M}),W=function(e){const{stateResponse:{setSelectedSections:t},internalPropsWithDefaults:{disabled:n=!1}}=e,r=s.useCallback(e=>r=>{n||r.isDefaultPrevented()||t(e)},[n,t]);return s.useCallback(e=>({"data-sectionindex":e,onClick:r(e)}),[r])}({stateResponse:M,internalPropsWithDefaults:c}),U=function(e){const t=gG(),n=vG(),{focused:r,domGetters:o,stateResponse:i,applyCharacterEditing:a,manager:{internal_fieldValueManager:l},stateResponse:{parsedSelectedSections:c,sectionsValueBoundaries:u,state:d,value:p,clearActiveSection:f,setCharacterQuery:h,setSelectedSections:m,updateSectionValue:g,updateValueFromValueStr:v},internalPropsWithDefaults:{disabled:b=!1,readOnly:y=!1}}=e,w="all"===c,x=!w&&!b&&!y,S=Mg(e=>{if(!o.isReady())return;const t=d.sections[e];o.getSectionContent(e).innerHTML=t.value||t.placeholder,OK({focused:r,domGetters:o,stateResponse:i})}),C=Mg(e=>{if(!o.isReady())return;const t=e.target,n=t.textContent??"",r=o.getSectionIndexFromDOMElement(t),i=d.sections[r];if(y)S(r);else{if(0===n.length){if(""===i.value)return void S(r);const t=e.nativeEvent.inputType;return"insertParagraph"===t||"insertLineBreak"===t?void S(r):(S(r),void f())}a({keyPressed:n,sectionIndex:r}),S(r)}}),k=Mg(e=>{e.preventDefault()}),E=Mg(e=>{if(e.preventDefault(),y||b||"number"!=typeof c)return;const t=d.sections[c],n=e.clipboardData.getData("text"),r=/^[a-zA-Z]+$/.test(n),o=/^[0-9]+$/.test(n),i=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(n);"letter"===t.contentType&&r||"digit"===t.contentType&&o||"digit-with-letter"===t.contentType&&i?(h(null),g({section:t,newSectionValue:n,shouldGoToNextSection:!0})):r||o||(h(null),v(n))}),R=Mg(e=>{e.preventDefault(),e.dataTransfer.dropEffect="none"}),P=s.useCallback(e=>()=>{b||m(e)},[b,m]);return s.useCallback((e,r)=>{const o=u[e.type]({currentDate:l.getDateFromSection(p,e),contentType:e.contentType,format:e.format});return{onInput:C,onPaste:E,onMouseUp:k,onDragOver:R,onFocus:P(r),"aria-readonly":y,"aria-valuenow":LK(e,t),"aria-valuemin":o.minimum,"aria-valuemax":o.maximum,"aria-valuetext":e.value?FK(e,t):n.empty,"aria-label":n[e.type],"aria-disabled":b,tabIndex:!x||w||r>0?-1:0,contentEditable:!w&&!b&&!y,role:"spinbutton","data-range-position":e.dateName||void 0,spellCheck:!x&&void 0,autoCapitalize:x?"none":void 0,autoCorrect:x?"off":void 0,children:e.value||e.placeholder,inputMode:"letter"===e.contentType?"text":"numeric"}},[u,w,b,y,x,n,t,C,E,k,R,P,l,p])}({manager:n,stateResponse:M,applyCharacterEditing:$,internalPropsWithDefaults:c,domGetters:P,focused:j}),G=Mg(e=>{v?.(e),H.onKeyDown(e)}),K=Mg(e=>{d?.(e),H.onBlur(e)}),q=Mg(e=>{h?.(e),H.onFocus(e)}),Y=Mg(e=>{e.isDefaultPrevented()||(p?.(e),H.onClick(e))}),X=Mg(e=>{g?.(e),H.onPaste(e)}),Q=Mg(e=>{m?.(e),H.onInput(e)}),Z=Mg((e,...t)=>{e.preventDefault(),b?.(e,...t),A(),$K(E)?N(D.startIndex):_(0)}),J=s.useMemo(()=>F.sections.map((e,t)=>{const n=U(e,t);return{container:W(t),content:U(e,t),before:{children:e.startSeparator},after:{children:e.endSeparator,"data-range-position":e.isEndFormatSeparator?n["data-range-position"]:void 0}}}),[F.sections,W,U]);return s.useEffect(()=>{if(null==E.current)throw new Error(["MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`","You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.","","If you want to keep using an `<input />` HTML element for the editing, please add the `enableAccessibleFieldDOMStructure={false}` prop to your Picker or Field component:","","<DatePicker enableAccessibleFieldDOMStructure={false} slots={{ textField: MyCustomTextField }} />","","Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element"].join("\n"));S&&!w&&E.current&&E.current.getSectionContent(D.startIndex).focus()},[]),Wh(()=>{if(j&&E.current)if("all"===O)E.current.getRoot().focus();else if("number"==typeof O){const e=E.current.getSectionContent(O);e&&e.focus()}},[O,j]),Wh(()=>{OK({focused:j,domGetters:P,stateResponse:M})}),s.useImperativeHandle(k,()=>({getSections:()=>F.sections,getActiveSectionIndex:()=>NK(E),setSelectedSections:e=>{if(w||!E.current)return;const t=GU(e,F.sections);B(null!==("all"===t?0:t)),N(e)},focusField:_,isFieldFocused:()=>$K(E)})),f({},l,H,{onBlur:K,onClick:Y,onFocus:q,onInput:Q,onPaste:X,onKeyDown:G,onClear:Z},V,{error:I,clearable:Boolean(y&&!T&&!x&&!w),focused:C??j,sectionListRef:R,enableAccessibleFieldDOMStructure:!0,elements:J,areAllSectionsEmpty:T,disabled:w,readOnly:x,autoFocus:S,openPickerAriaLabel:z})};function NK(e){const t=VG(e.current?.getRoot());return t&&e.current&&e.current.getRoot().contains(t)?e.current.getSectionIndexFromDOMElement(t):null}function $K(e){const t=VG(e.current?.getRoot());return!!e.current&&e.current.getRoot().contains(t)}const zK=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),jK=e=>{const t=um(),n=Ng(),r=Ng(),{props:o,manager:i,skipContextFieldRefAssignment:a,manager:{valueType:l,internal_valueManager:c,internal_fieldValueManager:u,internal_useOpenPickerButtonAriaLabel:d}}=e,{internalProps:p,forwardedProps:h}=kG(o,l),m=IK({manager:i,internalProps:p,skipContextFieldRefAssignment:a}),{onFocus:g,onClick:v,onPaste:b,onBlur:y,onKeyDown:w,onClear:x,clearable:S,inputRef:C,placeholder:k}=h,{readOnly:E=!1,disabled:R=!1,autoFocus:P=!1,focused:M,unstableFieldRef:T}=m,I=s.useRef(null),O=Tg(C,I),D=TK({manager:i,internalPropsWithDefaults:m,forwardedProps:h}),{activeSectionIndex:F,areAllSectionsEmpty:L,error:A,localizedDigits:N,parsedSelectedSections:$,sectionOrder:z,state:j,value:B,clearValue:_,clearActiveSection:H,setCharacterQuery:V,setSelectedSections:W,setTempAndroidValueStr:U,updateSectionValue:G,updateValueFromValueStr:K,getSectionsFromValue:q}=D,Y=MK({stateResponse:D}),X=d(B),Q=s.useMemo(()=>((e,t,n)=>{let r=0,o=n?1:0;const i=[];for(let a=0;a<e.length;a+=1){const l=e[a],s=BU(l,n?"input-rtl":"input-ltr",t),c=`${l.startSeparator}${s}${l.endSeparator}`,u=zK(c).length,d=c.length,p=zK(s),h=o+(""===p?0:s.indexOf(p[0]))+l.startSeparator.length,m=h+p.length;i.push(f({},l,{start:r,end:r+u,startInInput:h,endInInput:m})),r+=u,o+=d}return i})(j.sections,N,t),[j.sections,N,t]);function Z(){const e=I.current.selectionStart??0;let t;t=e<=Q[0].startInInput||e>=Q[Q.length-1].endInInput?1:Q.findIndex(t=>t.startInInput-t.startSeparator.length>e);const n=-1===t?Q.length-1:t-1;W(n)}function J(e=0){VG(I.current)!==I.current&&(I.current?.focus(),W(e))}const ee=Mg(e=>{g?.(e);const t=I.current;n.start(0,()=>{t&&t===I.current&&null==F&&(t.value.length&&Number(t.selectionEnd)-Number(t.selectionStart)===t.value.length?W("all"):Z())})}),te=Mg((e,...t)=>{e.isDefaultPrevented()||(v?.(e,...t),Z())}),ne=Mg(e=>{if(b?.(e),e.preventDefault(),E||R)return;const t=e.clipboardData.getData("text");if("number"==typeof $){const e=j.sections[$],n=/^[a-zA-Z]+$/.test(t),r=/^[0-9]+$/.test(t),o=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(t);if("letter"===e.contentType&&n||"digit"===e.contentType&&r||"digit-with-letter"===e.contentType&&o)return V(null),void G({section:e,newSectionValue:t,shouldGoToNextSection:!0});if(n||r)return}V(null),K(t)}),re=Mg(e=>{y?.(e),W(null)}),oe=Mg(e=>{if(E)return;const n=e.target.value;if(""===n)return void _();const r=e.nativeEvent.data,o=r&&r.length>1,i=o?r:n,a=zK(i);if("all"===$&&W(F),null==F||o)return void K(o?r:a);let l;if("all"===$&&1===a.length)l=a;else{const e=zK(u.getV6InputValueFromSections(Q,N,t));let n=-1,r=-1;for(let t=0;t<e.length;t+=1)-1===n&&e[t]!==a[t]&&(n=t),-1===r&&e[e.length-t-1]!==a[a.length-t-1]&&(r=t);const o=Q[F];if(n<o.start||e.length-r-1>o.end)return;const i=a.length-e.length+o.end-zK(o.endSeparator||"").length;l=a.slice(o.start+zK(o.startSeparator||"").length,i)}if(0===l.length)return navigator.userAgent.toLowerCase().includes("android")&&U(i),void H();Y({keyPressed:l,sectionIndex:F})}),ie=Mg((e,...t)=>{e.preventDefault(),x?.(e,...t),_(),BK(I)?W(z.startIndex):J(0)}),ae=DK({manager:i,internalPropsWithDefaults:m,stateResponse:D}),le=Mg(e=>{w?.(e),ae(e)}),se=s.useMemo(()=>void 0!==k?k:u.getV6InputValueFromSections(q(c.emptyValue),N,t),[k,u,q,c.emptyValue,N,t]),ce=s.useMemo(()=>j.tempValueStrAndroid??u.getV6InputValueFromSections(j.sections,N,t),[j.sections,u,j.tempValueStrAndroid,N,t]);s.useEffect(()=>{I.current&&I.current===VG(I.current)&&W("all")},[]),Wh(()=>{!function e(){if(!I.current)return;if(null==$)return void(I.current.scrollLeft&&(I.current.scrollLeft=0));if(I.current!==VG(I.current))return;const t=I.current.scrollTop;if("all"===$)I.current.select();else{const t=Q[$],n="empty"===t.type?t.startInInput-t.startSeparator.length:t.startInInput,o="empty"===t.type?t.endInInput+t.endSeparator.length:t.endInInput;n===I.current.selectionStart&&o===I.current.selectionEnd||I.current===VG(I.current)&&I.current.setSelectionRange(n,o),r.start(0,()=>{!I.current||I.current!==VG(I.current)||I.current.selectionStart!==I.current.selectionEnd||I.current.selectionStart===n&&I.current.selectionEnd===o||e()})}I.current.scrollTop=t}()});const ue=s.useMemo(()=>null==F||"letter"===j.sections[F].contentType?"text":"numeric",[F,j.sections]),de=!(I.current&&I.current===VG(I.current))&&L;return s.useImperativeHandle(T,()=>({getSections:()=>j.sections,getActiveSectionIndex:()=>{const e=I.current.selectionStart??0,t=I.current.selectionEnd??0;if(0===e&&0===t)return null;const n=e<=Q[0].startInInput?1:Q.findIndex(t=>t.startInInput-t.startSeparator.length>e);return-1===n?Q.length-1:n-1},setSelectedSections:e=>W(e),focusField:J,isFieldFocused:()=>BK(I)})),f({},h,{error:A,"aria-invalid":A,clearable:Boolean(S&&!L&&!E&&!R),onBlur:re,onClick:te,onFocus:ee,onPaste:ne,onKeyDown:le,onClear:ie,inputRef:O,enableAccessibleFieldDOMStructure:!1,placeholder:se,inputMode:ue,autoComplete:"off",value:de?"":ce,onChange:oe,focused:M,disabled:R,readOnly:E,autoFocus:P,openPickerAriaLabel:X})};function BK(e){return e.current===VG(e.current)}const _K=e=>(e=>{const t=tG();return(e.props.enableAccessibleFieldDOMStructure??t?.enableAccessibleFieldDOMStructure??1?AK:jK)(e)})({manager:function(e={}){const{enableAccessibleFieldDOMStructure:t=!0}=e;return s.useMemo(()=>({valueType:"date",validator:LG,internal_valueManager:qU,internal_fieldValueManager:YU,internal_enableAccessibleFieldDOMStructure:t,internal_useApplyDefaultValuesToFieldInternalProps:zG,internal_useOpenPickerButtonAriaLabel:$G}),[t])}(e),props:e});function HK(e){const{ownerState:t}=lG(),n=um();return s.useMemo(()=>f({},t,{isFieldDisabled:e.disabled??!1,isFieldReadOnly:e.readOnly??!1,isFieldRequired:e.required??!1,fieldDirection:n?"rtl":"ltr"}),[t,e.disabled,e.readOnly,e.required,n])}const VK=Sg(Xp.jsx("path",{d:"M7 10l5 5 5-5z"})),WK=Sg(Xp.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"})),UK=Sg(Xp.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"})),GK=Sg(Xp.jsx("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}));Sg(Xp.jsxs(s.Fragment,{children:[Xp.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),Xp.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]})),Sg(Xp.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"})),Sg(Xp.jsxs(s.Fragment,{children:[Xp.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),Xp.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}));const KK=Sg(Xp.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function qK(e){return Ph("MuiPickersTextField",e)}function YK(e){return Ph("MuiPickersInputBase",e)}Mh("MuiPickersTextField",["root","focused","disabled","error","required"]);const XK=Mh("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input","inputSizeSmall","activeBar"]);function QK(e){return Ph("MuiPickersSectionList",e)}const ZK=Mh("MuiPickersSectionList",["root","section","sectionContent"]),JK=["slots","slotProps","elements","sectionListRef","classes"],eq=pg("div",{name:"MuiPickersSectionList",slot:"Root"})({direction:"ltr /*! @noflip */",outline:"none"}),tq=pg("span",{name:"MuiPickersSectionList",slot:"Section"})({}),nq=pg("span",{name:"MuiPickersSectionList",slot:"SectionSeparator"})({whiteSpace:"pre"}),rq=pg("span",{name:"MuiPickersSectionList",slot:"SectionContent"})({outline:"none"});function oq(e){const{slots:t,slotProps:n,element:r,classes:o}=e,{ownerState:i}=lG(),a=t?.section??tq,l=yy({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:i}),c=t?.sectionContent??rq,u=yy({elementType:c,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:i}),d=t?.sectionSeparator??nq,p=yy({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:f({},i,{separatorPosition:"before"})}),h=yy({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:f({},i,{separatorPosition:"after"})}),m=s.useRef(null),g=Tg(u.ref,m);return Xp.jsxs(a,f({},l,{children:[Xp.jsx(d,f({},p)),Xp.jsx(c,f({},u,{ref:g,onBlur:e=>{const t=e.relatedTarget,n=e.currentTarget.closest(`.${ZK.root}`);n&&t instanceof Node&&n.contains(t)&&e.stopPropagation()}})),Xp.jsx(d,f({},h))]}))}const iq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:i,sectionListRef:a,classes:l}=n,c=d(n,JK),u=(e=>wm({root:["root"],section:["section"],sectionContent:["sectionContent"]},QK,e))(l),{ownerState:p}=lG(),h=s.useRef(null),m=Tg(t,h),g=e=>{if(!h.current)throw new Error(`MUI X: Cannot call sectionListRef.${e} before the mount of the component.`);return h.current};s.useImperativeHandle(a,()=>({getRoot:()=>g("getRoot"),getSectionContainer:e=>g("getSectionContainer").querySelector(`.${ZK.section}[data-sectionindex="${e}"]`),getSectionContent:e=>g("getSectionContent").querySelector(`.${ZK.section}[data-sectionindex="${e}"] .${ZK.sectionContent}`),getSectionIndexFromDOMElement(e){const t=g("getSectionIndexFromDOMElement");if(null==e||!t.contains(e))return null;let n=null;return e.classList.contains(ZK.section)?n=e:e.classList.contains(ZK.sectionContent)&&(n=e.parentElement),null==n?null:Number(n.dataset.sectionindex)}}));const v=r?.root??eq,b=yy({elementType:v,externalSlotProps:o?.root,externalForwardedProps:c,additionalProps:{ref:m,suppressContentEditableWarning:!0},className:u.root,ownerState:p});return Xp.jsx(v,f({},b,{children:b.contentEditable?i.map(({content:e,before:t,after:n})=>`${t.children}${e.children}${n.children}`).join(""):Xp.jsx(s.Fragment,{children:i.map((e,t)=>Xp.jsx(oq,{slots:r,slotProps:o,element:e,classes:u},t))})}))}),aq=s.createContext(null),lq=()=>{const e=s.useContext(aq);if(null==e)throw new Error(["MUI X: The `usePickerTextFieldOwnerState` can only be called in components that are used inside a PickerTextField component"].join("\n"));return e},sq=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef","onFocus","onBlur","classes","ownerState"],cq=pg("div",{name:"MuiPickersInputBase",slot:"Root"})(({theme:e})=>{return f({},e.typography.body1,{color:(e.vars||e).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:(t=.15/16,Math.round(1e5*t)/1e5)+"em",variants:[{props:{isInputInFullWidth:!0},style:{width:"100%"}}]});var t}),uq=pg(eq,{name:"MuiPickersInputBase",slot:"SectionsContainer"})(({theme:e})=>({padding:"4px 0 5px",fontFamily:e.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{fieldDirection:"rtl"},style:{justifyContent:"end"}},{props:{inputSize:"small"},style:{paddingTop:1}},{props:{hasStartAdornment:!1,isFieldFocused:!1,isFieldValueEmpty:!0},style:{color:"currentColor",opacity:0}},{props:{hasStartAdornment:!1,isFieldFocused:!1,isFieldValueEmpty:!0,inputHasLabel:!1},style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:"light"===e.palette.mode?.42:.5}},{props:{hasStartAdornment:!1,isFieldFocused:!1,isFieldValueEmpty:!0,inputHasLabel:!0,isLabelShrunk:!0},style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:"light"===e.palette.mode?.42:.5}}]})),dq=pg(tq,{name:"MuiPickersInputBase",slot:"Section"})(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),pq=pg(rq,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(e,t)=>t.content})(({theme:e})=>({fontFamily:e.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),fq=pg(nq,{name:"MuiPickersInputBase",slot:"Separator"})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),hq=pg("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(f({},{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"})),mq=pg("div",{name:"MuiPickersInputBase",slot:"ActiveBar"})(({theme:e,ownerState:t})=>({display:"none",position:"absolute",height:2,bottom:2,borderTopLeftRadius:2,borderTopRightRadius:2,transition:e.transitions.create(["width","left"],{duration:e.transitions.duration.shortest}),backgroundColor:(e.vars||e).palette.primary.main,'[data-active-range-position="start"] &, [data-active-range-position="end"] &':{display:"block"},'[data-active-range-position="start"] &':{left:t.sectionOffsets[0]},'[data-active-range-position="end"] &':{left:t.sectionOffsets[1]}}));function gq(e,t,n,r){if(e.content.id){const e=t.current?.querySelectorAll(`[data-sectionindex="${n}"] [data-range-position="${r}"]`);if(e)return Array.from(e).reduce((e,t)=>e+t.offsetWidth,0)}return 0}const vq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:i,onChange:a,id:l,endAdornment:c,startAdornment:u,renderSuffix:p,slots:h,slotProps:m,contentEditable:g,tabIndex:v,onInput:b,onPaste:y,onKeyDown:w,name:x,readOnly:S,inputProps:C,inputRef:k,sectionListRef:E,onFocus:R,onBlur:P,classes:M,ownerState:T}=n,I=d(n,sq),O=lq(),D=s.useRef(null),F=s.useRef(null),L=s.useRef([]),A=Tg(t,D),N=Tg(C?.ref,k),$=Uy();if(!$)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const z=T??O,j=e=>{$.onFocus?.(e),R?.(e)};s.useEffect(()=>{$&&$.setAdornedStart(Boolean(u))},[$,u]),s.useEffect(()=>{$&&(o?$.onEmpty():$.onFilled())},[$,o]);const B=((e,t)=>{const{isFieldFocused:n,isFieldDisabled:r,isFieldReadOnly:o,hasFieldError:i,inputSize:a,isInputInFullWidth:l,inputColor:s,hasStartAdornment:c,hasEndAdornment:u}=t;return wm({root:["root",n&&!r&&"focused",r&&"disabled",o&&"readOnly",i&&"error",l&&"fullWidth",`color${xf(s)}`,"small"===a&&"inputSizeSmall",c&&"adornedStart",u&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"],activeBar:["activeBar"]},YK,e)})(M,z),_=h?.root||cq,H=yy({elementType:_,externalSlotProps:m?.root,externalForwardedProps:I,additionalProps:{"aria-invalid":$.error,ref:A},className:B.root,ownerState:z}),V=h?.input||uq,W=r.some(e=>void 0!==e.content["data-range-position"]);return s.useEffect(()=>{if(!W||!z.isPickerOpen)return;const{activeBarWidth:e,sectionOffsets:t}=function(e,t){let n=0;const r=t.current?.getAttribute("data-active-range-position");if("end"===r)for(let r=e.length-1;r>=e.length/2;r-=1)n+=gq(e[r],t,r,"end");else for(let r=0;r<e.length/2;r+=1)n+=gq(e[r],t,r,"start");return{activeBarWidth:n,sectionOffsets:[t.current?.querySelector('[data-sectionindex="0"]')?.offsetLeft||0,t.current?.querySelector(`[data-sectionindex="${e.length/2}"]`)?.offsetLeft||0]}}(r,D);L.current=[t[0],t[1]],F.current&&(F.current.style.width=`${e}px`)},[r,W,z.isPickerOpen]),Xp.jsxs(_,f({},H,{children:[u,Xp.jsx(iq,{sectionListRef:E,elements:r,contentEditable:g,tabIndex:v,className:B.sectionsContainer,onFocus:j,onBlur:e=>{$.onBlur?.(e),P?.(e)},onInput:b,onPaste:y,onKeyDown:e=>{if(w?.(e),"Enter"===e.key&&!e.defaultMuiPrevented){if(D.current?.dataset.multiInput)return;const t=D.current?.closest("form"),n=t?.querySelector('[type="submit"]');if(!t||!n)return;e.preventDefault(),t.requestSubmit(n)}},slots:{root:V,section:dq,sectionContent:pq,sectionSeparator:fq},slotProps:{root:f({},m?.input,{ownerState:z}),sectionContent:{className:XK.sectionContent},sectionSeparator:({separatorPosition:e})=>({className:"before"===e?XK.sectionBefore:XK.sectionAfter})}}),c,p?p(f({},$)):null,Xp.jsx(hq,f({name:x,className:B.input,value:i,onChange:a,id:l,"aria-hidden":"true",tabIndex:-1,readOnly:S,required:$.required,disabled:$.disabled,onFocus:e=>{j(e)}},C,{ref:N})),W&&Xp.jsx(mq,{className:B.activeBar,ref:F,ownerState:{sectionOffsets:L.current}})]}))});function bq(e){return Ph("MuiPickersOutlinedInput",e)}const yq=f({},XK,Mh("MuiPickersOutlinedInput",["root","notchedOutline","input"])),wq=["children","className","label","notched","shrink"],xq=pg("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline"})(({theme:e})=>{const t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}}),Sq=pg("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),Cq=pg("legend",{shouldForwardProp:e=>Oh(e)&&"notched"!==e})(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{inputHasLabel:!1},style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:{inputHasLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{inputHasLabel:!0,notched:!0},style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]}));function kq(e){const{className:t,label:n,notched:r}=e,o=d(e,wq),i=lq();return Xp.jsx(xq,f({"aria-hidden":!0,className:t},o,{ownerState:i,children:Xp.jsx(Cq,{ownerState:i,notched:r,children:n?Xp.jsx(Sq,{children:n}):Xp.jsx(Sq,{className:"notranslate",children:""})})}))}const Eq=["label","autoFocus","ownerState","classes","notched"],Rq=pg(cq,{name:"MuiPickersOutlinedInput",slot:"Root"})(({theme:e})=>{const t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${yq.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${yq.focused} .${yq.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${yq.disabled}`]:{[`& .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${yq.error} .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},variants:Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t]?.main??!1).map(t=>({props:{inputColor:t},style:{[`&.${yq.focused}:not(.${yq.error}) .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}}))}}),Pq=pg(uq,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer"})({padding:"16.5px 0",variants:[{props:{inputSize:"small"},style:{padding:"8.5px 0"}}]}),Mq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersOutlinedInput"}),{label:r,classes:o,notched:i}=n,a=d(n,Eq),l=Uy(),c=(e=>f({},e,wm({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},bq,e)))(o);return Xp.jsx(vq,f({slots:{root:Rq,input:Pq},renderSuffix:e=>Xp.jsx(kq,{shrink:Boolean(i||e.adornedStart||e.focused||e.filled),notched:Boolean(i||e.adornedStart||e.focused||e.filled),className:c.notchedOutline,label:null!=r&&""!==r&&l?.required?Xp.jsxs(s.Fragment,{children:[r," ","*"]}):r})},a,{label:r,classes:c,ref:t}))});function Tq(e){return Ph("MuiPickersFilledInput",e)}Mq.muiName="Input";const Iq=f({},XK,Mh("MuiPickersFilledInput",["root","underline","input"])),Oq=["label","autoFocus","disableUnderline","hiddenLabel","classes"],Dq=pg(cq,{name:"MuiPickersFilledInput",slot:"Root",shouldForwardProp:e=>Oh(e)&&"disableUnderline"!==e})(({theme:e})=>{const t="light"===e.palette.mode,n=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",r=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",o=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",i=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:o,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${Iq.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${Iq.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:i},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{inputColor:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Iq.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Iq.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`:n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Iq.disabled}, .${Iq.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${Iq.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:{hasStartAdornment:!0},style:{paddingLeft:12}},{props:{hasEndAdornment:!0},style:{paddingRight:12}}]}}),Fq=pg(uq,{name:"MuiPickersFilledInput",slot:"sectionsContainer",shouldForwardProp:e=>Oh(e)&&"hiddenLabel"!==e})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{inputSize:"small"},style:{paddingTop:21,paddingBottom:4}},{props:{hasStartAdornment:!0},style:{paddingLeft:0}},{props:{hasEndAdornment:!0},style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,inputSize:"small"},style:{paddingTop:8,paddingBottom:9}}]}),Lq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,hiddenLabel:i=!1,classes:a}=n,l=d(n,Oq),s=f({},lq(),{inputHasUnderline:!o}),c=((e,t)=>{const{inputHasUnderline:n}=t;return f({},e,wm({root:["root",n&&"underline"],input:["input"]},Tq,e))})(a,s);return Xp.jsx(vq,f({slots:{root:Dq,input:Fq},slotProps:{root:{disableUnderline:o},input:{hiddenLabel:i}}},l,{label:r,classes:c,ref:t,ownerState:s}))});function Aq(e){return Ph("MuiPickersFilledInput",e)}Lq.muiName="Input";const Nq=f({},XK,Mh("MuiPickersInput",["root","underline","input"])),$q=["label","autoFocus","disableUnderline","ownerState","classes"],zq=pg(cq,{name:"MuiPickersInput",slot:"Root",shouldForwardProp:e=>Oh(e)&&"disableUnderline"!==e})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{inputColor:t,inputHasUnderline:!0},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}})),{props:{inputHasUnderline:!0},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Nq.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Nq.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Nq.disabled}, .${Nq.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${Nq.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),jq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,classes:i}=n,a=d(n,$q),l=f({},lq(),{inputHasUnderline:!o}),s=((e,t)=>{const{inputHasUnderline:n}=t;return f({},e,wm({root:["root",!n&&"underline"],input:["input"]},Aq,e))})(i,l);return Xp.jsx(vq,f({slots:{root:zq},slotProps:{root:{disableUnderline:o}}},a,{ownerState:l,label:r,classes:s,ref:t}))});jq.muiName="Input";const Bq=["onFocus","onBlur","className","classes","color","disabled","error","variant","required","hiddenLabel","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps","data-active-range-position"],_q={standard:jq,filled:Lq,outlined:Mq},Hq=pg(sS,{name:"MuiPickersTextField",slot:"Root"})({maxWidth:"100%"}),Vq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:i,classes:a,color:l="primary",disabled:c=!1,error:u=!1,variant:p="outlined",required:h=!1,hiddenLabel:m=!1,InputProps:g,inputProps:v,inputRef:b,sectionListRef:y,elements:w,areAllSectionsEmpty:x,onClick:S,onKeyDown:C,onKeyUp:k,onPaste:E,onInput:R,endAdornment:P,startAdornment:M,tabIndex:T,contentEditable:I,focused:O,value:D,onChange:F,fullWidth:L,id:A,name:N,helperText:$,FormHelperTextProps:z,label:j,InputLabelProps:B,"data-active-range-position":_}=n,H=d(n,Bq),V=Tg(t,s.useRef(null)),W=mm(A),U=$&&W?`${W}-helper-text`:void 0,G=j&&W?`${W}-label`:void 0,K=HK({disabled:n.disabled,required:n.required,readOnly:g?.readOnly}),q=s.useMemo(()=>f({},K,{isFieldValueEmpty:x,isFieldFocused:O??!1,hasFieldError:u??!1,inputSize:n.size??"medium",inputColor:l??"primary",isInputInFullWidth:L??!1,hasStartAdornment:Boolean(M??g?.startAdornment),hasEndAdornment:Boolean(P??g?.endAdornment),inputHasLabel:!!j,isLabelShrunk:Boolean(B?.shrink)}),[K,x,O,u,n.size,l,L,M,P,g?.startAdornment,g?.endAdornment,j,B?.shrink]),Y=((e,t)=>{const{isFieldFocused:n,isFieldDisabled:r,isFieldRequired:o}=t;return wm({root:["root",n&&!r&&"focused",r&&"disabled",o&&"required"]},qK,e)})(a,q),X=_q[p],Q={};return"outlined"===p?(B&&void 0!==B.shrink&&(Q.notched=B.shrink),Q.label=j):"filled"===p&&(Q.hiddenLabel=m),Xp.jsx(aq.Provider,{value:q,children:Xp.jsxs(Hq,f({className:QU(Y.root,i),ref:V,focused:O,disabled:c,variant:p,error:u,color:l,fullWidth:L,required:h,ownerState:q},H,{children:[null!=j&&""!==j&&Xp.jsx(zS,f({htmlFor:W,id:G},B,{children:j})),Xp.jsx(X,f({elements:w,areAllSectionsEmpty:x,onClick:S,onKeyDown:C,onKeyUp:k,onInput:R,onPaste:E,onFocus:r,onBlur:o,endAdornment:P,startAdornment:M,tabIndex:T,contentEditable:I,value:D,onChange:F,id:W,fullWidth:L,inputProps:v,inputRef:b,sectionListRef:y,label:j,name:N,role:"group","aria-labelledby":G,"aria-describedby":U,"aria-live":U?"polite":void 0,"data-active-range-position":_},Q,g)),$&&Xp.jsx(bS,f({id:U},z,{children:$}))]}))})}),Wq=["enableAccessibleFieldDOMStructure"],Uq=["InputProps","readOnly","onClear","clearable","clearButtonPosition","openPickerButtonPosition","openPickerAriaLabel"],Gq=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef","onClear","clearable","clearButtonPosition","openPickerButtonPosition","openPickerAriaLabel"],Kq=["ownerState"],qq=["ownerState"],Yq=["ownerState"],Xq=["ownerState"],Qq=["InputProps","inputProps"],Zq=()=>{},Jq=s.createContext({slots:{},slotProps:{},inputRef:void 0});function eY(e){const{fieldResponse:t,defaultOpenPickerIcon:n}=e,r=vG(),o=MG(),i=s.useContext(Jq),{textFieldProps:a,onClear:l,clearable:c,openPickerAriaLabel:u,clearButtonPosition:p="end",openPickerButtonPosition:h="end"}=(e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=d(e,Wq);if(t){const{InputProps:e,readOnly:t,onClear:r,clearable:o,clearButtonPosition:i,openPickerButtonPosition:a,openPickerAriaLabel:l}=n,s=d(n,Uq),c=rR>=6&&s?.slotProps?.input?tY(s?.slotProps?.input,e):Zq;return{clearable:o,onClear:r,clearButtonPosition:i,openPickerButtonPosition:a,openPickerAriaLabel:l,textFieldProps:f({},s,rR>=6&&s?.slotProps?.input?{slotProps:f({},s?.slotProps,{input:e=>f({},_g(c,e),{readOnly:t})})}:{InputProps:f({},e??{},{readOnly:t})})}}const{onPaste:r,onKeyDown:o,inputMode:i,readOnly:a,InputProps:l,inputProps:s,inputRef:c,onClear:u,clearable:p,clearButtonPosition:h,openPickerButtonPosition:m,openPickerAriaLabel:g}=n,v=d(n,Gq),b=rR>=6&&v?.slotProps?.input?tY(v?.slotProps?.input,l):Zq,y=rR>=6&&v?.slotProps?.htmlInput?tY(v?.slotProps?.htmlInput,s):Zq;return{clearable:p,onClear:u,clearButtonPosition:h,openPickerButtonPosition:m,openPickerAriaLabel:g,textFieldProps:f({},v,rR>=6&&(v?.slotProps?.input||v?.slotProps?.htmlInput)?{slotProps:f({},v?.slotProps,{input:e=>f({},_g(b,e),{readOnly:a}),htmlInput:e=>f({},_g(y,e),{inputMode:i,onPaste:r,onKeyDown:o,ref:c})})}:{InputProps:f({},l??{},{readOnly:a}),inputProps:f({},s??{},{inputMode:i,onPaste:r,onKeyDown:o,ref:c})})}})(t),m=HK(a),g=Mg(e=>{e.preventDefault(),o?.setOpen(e=>!e)}),v=o?o.triggerStatus:"hidden",b=c?p:null,y="hidden"!==v?h:null,w=i.slots.textField??(!1===t.enableAccessibleFieldDOMStructure?qE:Vq),x=i.slots.inputAdornment??AS,S=d(yy({elementType:x,externalSlotProps:i.slotProps.inputAdornment,additionalProps:{position:"start"},ownerState:f({},m,{position:"start"})}),Kq),C=d(yy({elementType:x,externalSlotProps:i.slotProps.inputAdornment,additionalProps:{position:"end"},ownerState:f({},m,{position:"end"})}),qq),k=i.slots.openPickerButton??Mv,E=d(yy({elementType:k,externalSlotProps:i.slotProps.openPickerButton,additionalProps:{disabled:"disabled"===v,onClick:g,"aria-label":u,edge:"standard"!==a.variant&&y},ownerState:m}),Yq),R=i.slots.openPickerIcon??n,P=yy({elementType:R,externalSlotProps:i.slotProps.openPickerIcon,ownerState:m}),M=i.slots.clearButton??Mv,T=d(yy({elementType:M,externalSlotProps:i.slotProps.clearButton,className:"clearButton",additionalProps:{title:r.fieldClearLabel,tabIndex:-1,onClick:l,disabled:t.disabled||t.readOnly,edge:"standard"!==a.variant&&b!==y&&b},ownerState:m}),Xq),I=i.slots.clearIcon??KK,O=yy({elementType:I,externalSlotProps:i.slotProps.clearIcon,additionalProps:{fontSize:"small"},ownerState:m});a.ref=Tg(a.ref,o?.rootRef);const D={},F=_g((rR>=6&&a?.slotProps?.input)??a.InputProps,m);o&&(D.ref=o.triggerRef),F?.startAdornment||"start"!==b&&"start"!==y||(D.startAdornment=Xp.jsxs(x,f({},S,{children:["start"===y&&Xp.jsx(k,f({},E,{children:Xp.jsx(R,f({},P))})),"start"===b&&Xp.jsx(M,f({},T,{children:Xp.jsx(I,f({},O))}))]}))),F?.endAdornment||"end"!==b&&"end"!==y||(D.endAdornment=Xp.jsxs(x,f({},C,{children:["end"===b&&Xp.jsx(M,f({},T,{children:Xp.jsx(I,f({},O))})),"end"===y&&Xp.jsx(k,f({},E,{children:Xp.jsx(R,f({},P))}))]}))),D?.endAdornment||D?.startAdornment||!i.slots.inputAdornment||(D.endAdornment=Xp.jsx(x,f({},C))),null!=b&&(a.sx=[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(a.sx)?a.sx:[a.sx]]);const L=rR>=6&&a?.slotProps?.input?_g(tY(F,D),m):f({},F,D);return a.inputProps=rR>=6&&a?.slotProps?.htmlInput?_g(a.slotProps.htmlInput,m):a.inputProps,delete a?.slotProps?.input,t.enableAccessibleFieldDOMStructure&&delete a?.slotProps,Xp.jsx(w,f({},a,{InputProps:L}))}function tY(e,t){return e?t?n=>f({},_g(t,n),_g(e,n)):e:t}function nY(e){const{slots:t={},slotProps:n={},inputRef:r,children:o}=e,i=s.useMemo(()=>({inputRef:r,slots:{openPickerButton:t.openPickerButton,openPickerIcon:t.openPickerIcon,textField:t.textField,inputAdornment:t.inputAdornment,clearIcon:t.clearIcon,clearButton:t.clearButton},slotProps:{openPickerButton:n.openPickerButton,openPickerIcon:n.openPickerIcon,textField:n.textField,inputAdornment:n.inputAdornment,clearIcon:n.clearIcon,clearButton:n.clearButton}}),[r,t.openPickerButton,t.openPickerIcon,t.textField,t.inputAdornment,t.clearIcon,t.clearButton,n.openPickerButton,n.openPickerIcon,n.textField,n.inputAdornment,n.clearIcon,n.clearButton]);return Xp.jsx(Jq.Provider,{value:i,children:o})}const rY=["slots","slotProps"],oY=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiDateField"}),{slots:r,slotProps:o}=n,i=d(n,rY),a=function(e){const{ref:t,externalForwardedProps:n,slotProps:r}=e,o=s.useContext(Jq),i=MG(),a=HK(n),{InputProps:l,inputProps:c}=n,u=d(n,Qq),p=yy({elementType:Vq,externalSlotProps:tY(o.slotProps.textField,r?.textField),externalForwardedProps:u,additionalProps:{ref:t,sx:i?.rootSx,label:i?.label,name:i?.name,className:i?.rootClassName,inputRef:o.inputRef},ownerState:a});return p.inputProps=f({},c,p.inputProps),p.InputProps=f({},l,p.InputProps),p}({slotProps:o,ref:t,externalForwardedProps:i}),l=_K(a);return Xp.jsx(nY,{slots:r,slotProps:o,inputRef:i.inputRef,children:Xp.jsx(eY,{fieldResponse:l,defaultOpenPickerIcon:GK})})}),iY=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a,timezone:l})=>{const c=gG();return s.useCallback(s=>null!==LG({adapter:c,value:s,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a}}),[c,e,t,n,r,o,i,a,l])},aY=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,maxDate:i,minDate:a,onMonthChange:l,onYearChange:c,reduceAnimations:u,shouldDisableDate:d,timezone:p,getCurrentMonthFromVisibleDate:h}=e,m=gG(),g=s.useRef(((e,t)=>(n,r)=>{switch(r.type){case"setVisibleDate":return f({},n,{slideDirection:r.direction,currentMonth:r.month,isMonthSwitchingAnimating:!t.isSameMonth(r.month,n.currentMonth)&&!e&&!r.skipAnimation,focusedDay:r.focusedDay});case"changeMonthTimezone":{const e=r.newTimezone;if(t.getTimezone(n.currentMonth)===e)return n;let o=t.setTimezone(n.currentMonth,e);return t.getMonth(o)!==t.getMonth(n.currentMonth)&&(o=t.setMonth(o,t.getMonth(n.currentMonth))),f({},n,{currentMonth:o})}case"finishMonthSwitchingAnimation":return f({},n,{isMonthSwitchingAnimating:!1});default:throw new Error("missing support")}})(Boolean(u),m)).current,v=s.useMemo(()=>qU.getInitialReferenceValue({value:t,adapter:m,timezone:p,props:e,referenceDate:n,granularity:MU.day}),[n,p]),[b,y]=s.useReducer(g,{isMonthSwitchingAnimating:!1,focusedDay:v,currentMonth:m.startOfMonth(v),slideDirection:"left"}),w=iY({shouldDisableDate:d,minDate:a,maxDate:i,disableFuture:r,disablePast:o,timezone:p});s.useEffect(()=>{y({type:"changeMonthTimezone",newTimezone:m.getTimezone(v)})},[v,m]);const x=Mg(({target:e,reason:t})=>{if("cell-interaction"===t&&null!=b.focusedDay&&m.isSameDay(e,b.focusedDay))return;const n="cell-interaction"===t;let s,u;if("cell-interaction"===t)s=h(e,b.currentMonth),u=e;else if(s=m.isSameMonth(e,b.currentMonth)?b.currentMonth:m.startOfMonth(e),u=e,w(u)){const t=m.startOfMonth(e),n=m.endOfMonth(e);u=bU({adapter:m,date:u,minDate:m.isBefore(a,t)?t:a,maxDate:m.isAfter(i,n)?n:i,disablePast:o,disableFuture:r,isDateDisabled:w,timezone:p})}const d=!m.isSameMonth(b.currentMonth,s),f=!m.isSameYear(b.currentMonth,s);d&&l?.(s),f&&c?.(m.startOfYear(s)),y({type:"setVisibleDate",month:s,direction:m.isAfterDay(s,b.currentMonth)?"left":"right",focusedDay:null!=b.focusedDay&&null!=u&&m.isSameDay(u,b.focusedDay)?b.focusedDay:u,skipAnimation:n})}),S=s.useCallback(()=>{y({type:"finishMonthSwitchingAnimation"})},[]);return{referenceDate:v,calendarState:b,setVisibleDate:x,isDateDisabled:w,onMonthSwitchingAnimationEnd:S}},lY=e=>Ph("MuiPickersFadeTransitionGroup",e);Mh("MuiPickersFadeTransitionGroup",["root"]);const sY=["children"],cY=pg(Zo,{name:"MuiPickersFadeTransitionGroup",slot:"Root"})({display:"block",position:"relative"});function uY(e){const t=cg({props:e,name:"MuiPickersFadeTransitionGroup"}),{className:n,reduceAnimations:r,transKey:o,classes:i}=t,{children:a}=t,l=d(t,sY),s=(e=>wm({root:["root"]},lY,e))(i),c=sg();return r?a:Xp.jsx(cY,{className:QU(s.root,n),ownerState:l,children:Xp.jsx(Pw,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:c.transitions.duration.enteringScreen,enter:c.transitions.duration.enteringScreen,exit:0},children:a},o)})}function dY(e){return Ph("MuiPickersDay",e)}const pY=Mh("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]);function fY(e){const{disabled:t,selected:n,today:r,outsideCurrentMonth:o,day:i,disableMargin:a,disableHighlightToday:l,showDaysOutsideCurrentMonth:c}=e,u=gG(),{ownerState:d}=lG();return s.useMemo(()=>f({},d,{day:i,isDaySelected:n??!1,isDayDisabled:t??!1,isDayCurrent:r??!1,isDayOutsideMonth:o??!1,isDayStartOfWeek:u.isSameDay(i,u.startOfWeek(i)),isDayEndOfWeek:u.isSameDay(i,u.endOfWeek(i)),disableMargin:a??!1,disableHighlightToday:l??!1,showDaysOutsideCurrentMonth:c??!1}),[u,d,i,n,t,r,o,a,l,c])}const hY=["autoFocus","className","classes","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","children","isFirstVisibleCell","isLastVisibleCell","day","selected","disabled","today","outsideCurrentMonth","disableMargin","disableHighlightToday","showDaysOutsideCurrentMonth"],mY=({theme:e})=>f({},e.typography.caption,{width:36,height:36,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:tm(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${pY.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${pY.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${pY.disabled}:not(.${pY.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${pY.disabled}&.${pY.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:"0 2px"}},{props:{isDayOutsideMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,isDayCurrent:!0},style:{[`&:not(.${pY.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),gY=(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.isDayCurrent&&t.today,!n.isDayOutsideMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.isDayOutsideMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},vY=pg(sv,{name:"MuiPickersDay",slot:"Root",overridesResolver:gY})(mY),bY=pg("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:gY})(({theme:e})=>f({},mY({theme:e}),{opacity:0,pointerEvents:"none"})),yY=()=>{},wY=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,classes:i,isAnimating:a,onClick:l,onDaySelect:c,onFocus:u=yY,onBlur:p=yY,onKeyDown:h=yY,onMouseDown:m=yY,onMouseEnter:g=yY,children:v,day:b,selected:y,disabled:w,today:x,outsideCurrentMonth:S,disableMargin:C,disableHighlightToday:k,showDaysOutsideCurrentMonth:E}=n,R=d(n,hY),P=fY({day:b,selected:y,disabled:w,today:x,outsideCurrentMonth:S,disableMargin:C,disableHighlightToday:k,showDaysOutsideCurrentMonth:E}),M=((e,t)=>{const{isDaySelected:n,isDayDisabled:r,isDayCurrent:o,isDayOutsideMonth:i,disableMargin:a,disableHighlightToday:l,showDaysOutsideCurrentMonth:s}=t,c=i&&!s;return wm({root:["root",n&&!c&&"selected",r&&"disabled",!a&&"dayWithMargin",!l&&o&&"today",i&&s&&"dayOutsideMonth",c&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},dY,e)})(i,P),T=gG(),I=s.useRef(null),O=Tg(I,t);Wh(()=>{!r||w||a||S||I.current.focus()},[r,w,a,S]);return S&&!E?Xp.jsx(bY,{className:QU(M.root,M.hiddenDaySpacingFiller,o),ownerState:P,role:R.role}):Xp.jsx(vY,f({className:QU(M.root,o),ref:O,centerRipple:!0,disabled:w,tabIndex:y?0:-1,onKeyDown:e=>h(e,b),onFocus:e=>u(e,b),onBlur:e=>p(e,b),onMouseEnter:e=>g(e,b),onClick:e=>{e.defaultMuiPrevented=!0,w||c(b),S&&e.currentTarget.focus(),l&&l(e)},onMouseDown:e=>{m(e),S&&e.preventDefault()}},R,{ownerState:P,children:v??T.format(b,"dayOfMonth")}))}),xY=s.memo(wY),SY=e=>Ph("MuiPickersSlideTransition",e),CY=Mh("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),kY=["children","className","reduceAnimations","slideDirection","transKey","classes"],EY=pg(Zo,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${CY["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${CY["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${CY.slideEnterActive}`]:t.slideEnterActive},{[`.${CY.slideExit}`]:t.slideExit},{[`.${CY["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${CY["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{const t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${CY["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${CY["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${CY.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${CY.slideExit}`]:{transform:"translate(0%)"},[`& .${CY["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${CY["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});const RY=e=>Ph("MuiDayCalendar",e);Mh("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const PY=["parentProps","day","focusedDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],MY=["ownerState"],TY=pg("div",{name:"MuiDayCalendar",slot:"Root"})({}),IY=pg("div",{name:"MuiDayCalendar",slot:"Header"})({display:"flex",justifyContent:"center",alignItems:"center"}),OY=pg(Gv,{name:"MuiDayCalendar",slot:"WeekDayLabel"})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),DY=pg(Gv,{name:"MuiDayCalendar",slot:"WeekNumberLabel"})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.disabled})),FY=pg(Gv,{name:"MuiDayCalendar",slot:"WeekNumber"})(({theme:e})=>f({},e.typography.caption,{width:36,height:36,padding:0,margin:"0 2px",color:(e.vars||e).palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),LY=pg("div",{name:"MuiDayCalendar",slot:"LoadingContainer"})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:240}),AY=pg(function(e){const t=cg({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,slideDirection:i,transKey:a,classes:l}=t,c=d(t,kY),{ownerState:u}=lG(),p=f({},u,{slideDirection:i}),h=((e,t)=>{const{slideDirection:n}=t;return wm({root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]},SY,e)})(l,p),m=sg();if(o)return Xp.jsx("div",{className:QU(h.root,r),children:n});const g={exit:h.exit,enterActive:h.enterActive,enter:h.enter,exitActive:h.exitActive};return Xp.jsx(EY,{className:QU(h.root,r),childFactory:e=>s.cloneElement(e,{classNames:g}),role:"presentation",ownerState:p,children:Xp.jsx(Ko,f({mountOnEnter:!0,unmountOnExit:!0,timeout:m.transitions.duration.complex,classNames:g},c,{children:n}),a)})},{name:"MuiDayCalendar",slot:"SlideTransition"})({minHeight:240}),NY=pg("div",{name:"MuiDayCalendar",slot:"MonthContainer"})({overflow:"hidden"}),$Y=pg("div",{name:"MuiDayCalendar",slot:"WeekContainer"})({margin:"2px 0",display:"flex",justifyContent:"center"});function zY(e){let{parentProps:t,day:n,focusedDay:r,selectedDays:o,isDateDisabled:i,currentMonthNumber:a,isViewFocused:l}=e,c=d(e,PY);const{disabled:u,disableHighlightToday:p,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:m,slots:g,slotProps:v,timezone:b}=t,y=gG(),w=NG(b),x=null!=r&&y.isSameDay(n,r),S=l&&x,C=o.some(e=>y.isSameDay(e,n)),k=y.isSameDay(n,w),E=s.useMemo(()=>u||i(n),[u,i,n]),R=s.useMemo(()=>y.getMonth(n)!==a,[y,n,a]),P=fY({day:n,selected:C,disabled:E,today:k,outsideCurrentMonth:R,disableMargin:void 0,disableHighlightToday:p,showDaysOutsideCurrentMonth:m}),M=g?.day??xY,T=d(yy({elementType:M,externalSlotProps:v?.day,additionalProps:f({disableHighlightToday:p,showDaysOutsideCurrentMonth:m,role:"gridcell",isAnimating:h,"data-timestamp":y.toJsDate(n).valueOf()},c),ownerState:f({},P,{day:n,isDayDisabled:E,isDaySelected:C})}),MY),I=s.useMemo(()=>{const e=y.startOfMonth(y.setMonth(n,a));return m?y.isSameDay(n,y.startOfWeek(e)):y.isSameDay(n,e)},[a,n,m,y]),O=s.useMemo(()=>{const e=y.endOfMonth(y.setMonth(n,a));return m?y.isSameDay(n,y.endOfWeek(e)):y.isSameDay(n,e)},[a,n,m,y]);return Xp.jsx(M,f({},T,{day:n,disabled:E,autoFocus:!R&&S,today:k,outsideCurrentMonth:R,isFirstVisibleCell:I,isLastVisibleCell:O,selected:C,tabIndex:x?0:-1,"aria-selected":C,"aria-current":k?"date":void 0}))}function jY(e){const t=cg({props:e,name:"MuiDayCalendar"}),n=gG(),{onFocusedDayChange:r,className:o,classes:i,currentMonth:a,selectedDays:l,focusedDay:c,loading:u,onSelectedDaysChange:d,onMonthSwitchingAnimationEnd:p,readOnly:h,reduceAnimations:m,renderLoading:g=()=>Xp.jsx("span",{children:"..."}),slideDirection:v,TransitionProps:b,disablePast:y,disableFuture:w,minDate:x,maxDate:S,shouldDisableDate:C,shouldDisableMonth:k,shouldDisableYear:E,dayOfWeekFormatter:R=e=>n.format(e,"weekdayShort").charAt(0).toUpperCase(),hasFocus:P,onFocusedViewChange:M,gridLabelId:T,displayWeekNumber:I,fixedWeekNumber:O,timezone:D}=t,F=NG(D),L=(e=>wm({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},RY,e))(i),A=um(),N=iY({shouldDisableDate:C,shouldDisableMonth:k,shouldDisableYear:E,minDate:x,maxDate:S,disablePast:y,disableFuture:w,timezone:D}),$=vG(),z=Mg(e=>{h||d(e)}),j=e=>{N(e)||(r(e),M?.(!0))},B=Mg((e,t)=>{switch(e.key){case"ArrowUp":j(n.addDays(t,-7)),e.preventDefault();break;case"ArrowDown":j(n.addDays(t,7)),e.preventDefault();break;case"ArrowLeft":{const r=n.addDays(t,A?1:-1),o=n.addMonths(t,A?1:-1),i=bU({adapter:n,date:r,minDate:A?r:n.startOfMonth(o),maxDate:A?n.endOfMonth(o):r,isDateDisabled:N,timezone:D});j(i||r),e.preventDefault();break}case"ArrowRight":{const r=n.addDays(t,A?-1:1),o=n.addMonths(t,A?-1:1),i=bU({adapter:n,date:r,minDate:A?n.startOfMonth(o):r,maxDate:A?r:n.endOfMonth(o),isDateDisabled:N,timezone:D});j(i||r),e.preventDefault();break}case"Home":j(n.startOfWeek(t)),e.preventDefault();break;case"End":j(n.endOfWeek(t)),e.preventDefault();break;case"PageUp":j(n.addMonths(t,1)),e.preventDefault();break;case"PageDown":j(n.addMonths(t,-1)),e.preventDefault()}}),_=Mg((e,t)=>j(t)),H=Mg((e,t)=>{null!=c&&n.isSameDay(c,t)&&M?.(!1)}),V=n.getMonth(a),W=n.getYear(a),U=s.useMemo(()=>l.filter(e=>!!e).map(e=>n.startOfDay(e)),[n,l]),G=`${W}-${V}`,K=s.useMemo(()=>s.createRef(),[G]),q=s.useMemo(()=>{const e=n.getWeekArray(a);let t=n.addMonths(a,1);for(;O&&e.length<O;){const r=n.getWeekArray(t),o=n.isSameDay(e[e.length-1][0],r[0][0]);r.slice(o?1:0).forEach(t=>{e.length<O&&e.push(t)}),t=n.addMonths(t,1)}return e},[a,O,n]);return Xp.jsxs(TY,{role:"grid","aria-labelledby":T,className:L.root,children:[Xp.jsxs(IY,{role:"row",className:L.header,children:[I&&Xp.jsx(DY,{variant:"caption",role:"columnheader","aria-label":$.calendarWeekNumberHeaderLabel,className:L.weekNumberLabel,children:$.calendarWeekNumberHeaderText}),EU(n,F).map((e,t)=>Xp.jsx(OY,{variant:"caption",role:"columnheader","aria-label":n.format(e,"weekday"),className:L.weekDayLabel,children:R(e)},t.toString()))]}),u?Xp.jsx(LY,{className:L.loadingContainer,children:g()}):Xp.jsx(AY,f({transKey:G,onExited:p,reduceAnimations:m,slideDirection:v,className:QU(o,L.slideTransition)},b,{nodeRef:K,children:Xp.jsx(NY,{ref:K,role:"rowgroup",className:L.monthContainer,children:q.map((e,r)=>Xp.jsxs($Y,{role:"row",className:L.weekContainer,"aria-rowindex":r+1,children:[I&&Xp.jsx(FY,{className:L.weekNumber,role:"rowheader","aria-label":$.calendarWeekNumberAriaLabelText(n.getWeekNumber(e[0])),children:$.calendarWeekNumberText(n.getWeekNumber(e[0]))}),e.map((e,n)=>Xp.jsx(zY,{parentProps:t,day:e,selectedDays:U,isViewFocused:P,focusedDay:c,onKeyDown:B,onFocus:_,onBlur:H,onDaySelect:z,isDateDisabled:N,currentMonthNumber:V,"aria-colindex":n+1},e.toString()))]},`week-${e[0]}`))})}))]})}function BY(e){return Ph("MuiMonthCalendar",e)}const _Y=Mh("MuiMonthCalendar",["root","button","disabled","selected"]),HY=["autoFocus","classes","disabled","selected","value","onClick","onKeyDown","onFocus","onBlur","slots","slotProps"],VY=pg("button",{name:"MuiMonthCalendar",slot:"Button",overridesResolver:(e,t)=>[t.button,{[`&.${_Y.disabled}`]:t.disabled},{[`&.${_Y.selected}`]:t.selected}]})(({theme:e})=>f({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${_Y.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${_Y.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),WY=s.memo(function(e){const{autoFocus:t,classes:n,disabled:r,selected:o,value:i,onClick:a,onKeyDown:l,onFocus:c,onBlur:u,slots:p,slotProps:h}=e,m=d(e,HY),g=s.useRef(null),{ownerState:v}=lG(),b=f({},v,{isMonthDisabled:r,isMonthSelected:o}),y=((e,t)=>wm({button:["button",t.isMonthDisabled&&"disabled",t.isMonthSelected&&"selected"]},BY,e))(n,b);Wh(()=>{t&&g.current?.focus()},[t]);const w=p?.monthButton??VY,x=yy({elementType:w,externalSlotProps:h?.monthButton,externalForwardedProps:m,additionalProps:{disabled:r,ref:g,type:"button",role:"radio","aria-checked":o,onClick:e=>a(e,i),onKeyDown:e=>l(e,i),onFocus:e=>c(e,i),onBlur:e=>u(e,i)},ownerState:b,className:y.button});return Xp.jsx(w,f({},x))}),UY=["autoFocus","className","currentMonth","classes","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"];const GY=(e,t,n,r,o)=>Boolean(e===t&&r&&o.isSameYear(n,r)),KY=pg("div",{name:"MuiMonthCalendar",slot:"Root",shouldForwardProp:e=>Oh(e)&&"monthsPerRow"!==e})({display:"flex",flexWrap:"wrap",justifyContent:"space-evenly",rowGap:16,padding:"8px 0",width:hK,boxSizing:"border-box",variants:[{props:{monthsPerRow:3},style:{columnGap:24}},{props:{monthsPerRow:4},style:{columnGap:0}}]}),qY=s.forwardRef(function(e,t){const n=function(e,t){const n=cg({props:e,name:t});return f({},n,jG(n),{monthsPerRow:n.monthsPerRow??3})}(e,"MuiMonthCalendar"),{autoFocus:r,className:o,currentMonth:i,classes:a,value:l,defaultValue:c,referenceDate:u,disabled:p,disableFuture:h,disablePast:m,maxDate:g,minDate:v,onChange:b,shouldDisableMonth:y,readOnly:w,onMonthFocus:x,hasFocus:S,onFocusedViewChange:C,monthsPerRow:k,timezone:E,gridLabelId:R,slots:P,slotProps:M}=n,T=d(n,UY),{value:I,handleValueChange:O,timezone:D}=iK({name:"MonthCalendar",timezone:E,value:l,defaultValue:c,referenceDate:u,onChange:b,valueManager:qU}),F=NG(D),L=um(),A=gG(),{ownerState:N}=lG(),$=s.useMemo(()=>qU.getInitialReferenceValue({value:I,adapter:A,props:n,timezone:D,referenceDate:u,granularity:MU.month}),[]),z=(e=>wm({root:["root"]},BY,e))(a),j=s.useMemo(()=>A.getMonth(F),[A,F]),B=s.useMemo(()=>null!=I?A.getMonth(I):null,[I,A]),[_,H]=s.useState(()=>B||A.getMonth($)),[V,W]=Pg({name:"MonthCalendar",state:"hasFocus",controlled:S,default:r??!1}),U=Mg(e=>{W(e),C&&C(e)}),G=s.useCallback(e=>{const t=A.startOfMonth(m&&A.isAfter(F,v)?F:v),n=A.startOfMonth(h&&A.isBefore(F,g)?F:g),r=A.startOfMonth(e);return!!A.isBefore(r,t)||(!!A.isAfter(r,n)||!!y&&y(r))},[h,m,g,v,F,y,A]),K=Mg((e,t)=>{if(w)return;const n=I&&i&&!A.isSameYear(I,i)?A.setYear(I,A.getYear(i)):I,r=A.setMonth(n??$,t);O(r)}),q=Mg(e=>{G(A.setMonth(I??i??$,e))||(H(e),U(!0),x&&x(e))});s.useEffect(()=>{H(e=>null!==B&&e!==B?B:e)},[B]);const Y=Mg((e,t)=>{const n=12;switch(e.key){case"ArrowUp":q((n+t-3)%n),e.preventDefault();break;case"ArrowDown":q((n+t+3)%n),e.preventDefault();break;case"ArrowLeft":q((n+t+(L?1:-1))%n),e.preventDefault();break;case"ArrowRight":q((n+t+(L?-1:1))%n),e.preventDefault()}}),X=Mg((e,t)=>{q(t)}),Q=Mg((e,t)=>{_===t&&U(!1)});return Xp.jsx(KY,f({ref:t,className:QU(z.root,o),ownerState:N,role:"radiogroup","aria-labelledby":R,monthsPerRow:k},T,{children:wU(A,i??I??$).map(e=>{const t=A.getMonth(e),n=A.format(e,"monthShort"),r=A.format(e,"month"),o=GY(t,B,e,I,A),i=p||G(e);return Xp.jsx(WY,{selected:o,value:t,onClick:K,onKeyDown:Y,autoFocus:V&&t===_,disabled:i,tabIndex:t!==_||i?-1:0,onFocus:X,onBlur:Q,"aria-current":GY(t,j,e,F,A)?"date":void 0,"aria-label":r,slots:P,slotProps:M,classes:a,children:n},n)})}))});function YY(e){return Ph("MuiYearCalendar",e)}const XY=Mh("MuiYearCalendar",["root","button","disabled","selected"]),QY=["autoFocus","classes","disabled","selected","value","onClick","onKeyDown","onFocus","onBlur","slots","slotProps"],ZY=pg("button",{name:"MuiYearCalendar",slot:"Button",overridesResolver:(e,t)=>[t.button,{[`&.${XY.disabled}`]:t.disabled},{[`&.${XY.selected}`]:t.selected}]})(({theme:e})=>f({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:tm(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${XY.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${XY.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),JY=s.memo(function(e){const{autoFocus:t,classes:n,disabled:r,selected:o,value:i,onClick:a,onKeyDown:l,onFocus:c,onBlur:u,slots:p,slotProps:h}=e,m=d(e,QY),g=s.useRef(null),{ownerState:v}=lG(),b=f({},v,{isYearDisabled:r,isYearSelected:o}),y=((e,t)=>wm({button:["button",t.isYearDisabled&&"disabled",t.isYearSelected&&"selected"]},YY,e))(n,b);Wh(()=>{t&&g.current?.focus()},[t]);const w=p?.yearButton??ZY,x=yy({elementType:w,externalSlotProps:h?.yearButton,externalForwardedProps:m,additionalProps:{disabled:r,ref:g,type:"button",role:"radio","aria-checked":o,onClick:e=>a(e,i),onKeyDown:e=>l(e,i),onFocus:e=>c(e,i),onBlur:e=>u(e,i)},ownerState:b,className:y.button});return Xp.jsx(w,f({},x))}),eX=["autoFocus","className","classes","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"];const tX=pg("div",{name:"MuiYearCalendar",slot:"Root",shouldForwardProp:e=>Oh(e)&&"yearsPerRow"!==e})({display:"flex",flexWrap:"wrap",justifyContent:"space-evenly",rowGap:12,padding:"6px 0",overflowY:"auto",height:"100%",width:hK,maxHeight:280,boxSizing:"border-box",position:"relative",variants:[{props:{yearsPerRow:3},style:{columnGap:24}},{props:{yearsPerRow:4},style:{columnGap:0,padding:"0 2px"}}]}),nX=pg("div",{name:"MuiYearCalendar",slot:"ButtonFiller"})({height:36,width:72}),rX=s.forwardRef(function(e,t){const n=function(e,t){const n=cg({props:e,name:t});return f({},n,jG(n),{yearsPerRow:n.yearsPerRow??3,yearsOrder:n.yearsOrder??"asc"})}(e,"MuiYearCalendar"),{autoFocus:r,className:o,classes:i,value:a,defaultValue:l,referenceDate:c,disabled:u,disableFuture:p,disablePast:h,maxDate:m,minDate:g,onChange:v,readOnly:b,shouldDisableYear:y,onYearFocus:w,hasFocus:x,onFocusedViewChange:S,yearsOrder:C,yearsPerRow:k,timezone:E,gridLabelId:R,slots:P,slotProps:M}=n,T=d(n,eX),{value:I,handleValueChange:O,timezone:D}=iK({name:"YearCalendar",timezone:E,value:a,defaultValue:l,referenceDate:c,onChange:v,valueManager:qU}),F=NG(D),L=um(),A=gG(),{ownerState:N}=lG(),$=s.useMemo(()=>qU.getInitialReferenceValue({value:I,adapter:A,props:n,timezone:D,referenceDate:c,granularity:MU.year}),[]),z=(e=>wm({root:["root"]},YY,e))(i),j=s.useMemo(()=>A.getYear(F),[A,F]),B=s.useMemo(()=>null!=I?A.getYear(I):null,[I,A]),[_,H]=s.useState(()=>B||A.getYear($)),[V,W]=Pg({name:"YearCalendar",state:"hasFocus",controlled:x,default:r??!1}),U=Mg(e=>{W(e),S&&S(e)}),G=s.useCallback(e=>{if(h&&A.isBeforeYear(e,F))return!0;if(p&&A.isAfterYear(e,F))return!0;if(g&&A.isBeforeYear(e,g))return!0;if(m&&A.isAfterYear(e,m))return!0;if(!y)return!1;const t=A.startOfYear(e);return y(t)},[p,h,m,g,F,y,A]),K=Mg((e,t)=>{if(b)return;const n=A.setYear(I??$,t);O(n)}),q=Mg(e=>{G(A.setYear(I??$,e))||(H(e),U(!0),w?.(e))});s.useEffect(()=>{H(e=>null!==B&&e!==B?B:e)},[B]);const Y="desc"!==C?1*k:-1*k,X=L&&"asc"===C||!L&&"desc"===C?-1:1,Q=Mg((e,t)=>{switch(e.key){case"ArrowUp":q(t-Y),e.preventDefault();break;case"ArrowDown":q(t+Y),e.preventDefault();break;case"ArrowLeft":q(t-X),e.preventDefault();break;case"ArrowRight":q(t+X),e.preventDefault()}}),Z=Mg((e,t)=>{q(t)}),J=Mg((e,t)=>{_===t&&U(!1)}),ee=s.useRef(null),te=Tg(t,ee);s.useEffect(()=>{if(r||null===ee.current)return;const e=ee.current.querySelector('[tabindex="0"]');if(!e)return;const t=e.offsetHeight,n=e.offsetTop,o=ee.current.clientHeight,i=ee.current.scrollTop,a=n+t;t>o||n<i||(ee.current.scrollTop=a-o/2-t/2)},[r]);const ne=A.getYearRange([g,m]);"desc"===C&&ne.reverse();let re=k-ne.length%k;return re===k&&(re=0),Xp.jsxs(tX,f({ref:te,className:QU(z.root,o),ownerState:N,role:"radiogroup","aria-labelledby":R,yearsPerRow:k},T,{children:[ne.map(e=>{const t=A.getYear(e),n=t===B,r=u||G(e);return Xp.jsx(JY,{selected:n,value:t,onClick:K,onKeyDown:Q,autoFocus:V&&t===_,disabled:r,tabIndex:t!==_||r?-1:0,onFocus:Z,onBlur:J,"aria-current":j===t?"date":void 0,slots:P,slotProps:M,classes:i,children:A.format(e,"year")},A.format(e,"year"))}),Array.from({length:re},(e,t)=>Xp.jsx(nX,{},t))]}))}),oX=e=>Ph("MuiPickersCalendarHeader",e),iX=Mh("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function aX(e){return Ph("MuiPickersArrowSwitcher",e)}Mh("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const lX=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId","classes"],sX=["ownerState"],cX=["ownerState"],uX=pg("div",{name:"MuiPickersArrowSwitcher",slot:"Root"})({display:"flex"}),dX=pg("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer"})(({theme:e})=>({width:e.spacing(3)})),pX=pg(Mv,{name:"MuiPickersArrowSwitcher",slot:"Button"})({variants:[{props:{isButtonHidden:!0},style:{visibility:"hidden"}}]}),fX=s.forwardRef(function(e,t){const n=um(),r=cg({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:i,slots:a,slotProps:l,isNextDisabled:s,isNextHidden:c,onGoToNext:u,nextLabel:p,isPreviousDisabled:h,isPreviousHidden:m,onGoToPrevious:g,previousLabel:v,labelId:b,classes:y}=r,w=d(r,lX),{ownerState:x}=lG(),S=(e=>wm({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},aX,e))(y),C={isDisabled:s,isHidden:c,goTo:u,label:p},k={isDisabled:h,isHidden:m,goTo:g,label:v},E=a?.previousIconButton??pX,R=yy({elementType:E,externalSlotProps:l?.previousIconButton,additionalProps:{size:"medium",title:k.label,"aria-label":k.label,disabled:k.isDisabled,edge:"end",onClick:k.goTo},ownerState:f({},x,{isButtonHidden:k.isHidden??!1}),className:QU(S.button,S.previousIconButton)}),P=a?.nextIconButton??pX,M=yy({elementType:P,externalSlotProps:l?.nextIconButton,additionalProps:{size:"medium",title:C.label,"aria-label":C.label,disabled:C.isDisabled,edge:"start",onClick:C.goTo},ownerState:f({},x,{isButtonHidden:C.isHidden??!1}),className:QU(S.button,S.nextIconButton)}),T=a?.leftArrowIcon??WK,I=d(yy({elementType:T,externalSlotProps:l?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:x,className:S.leftArrowIcon}),sX),O=a?.rightArrowIcon??UK,D=d(yy({elementType:O,externalSlotProps:l?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:x,className:S.rightArrowIcon}),cX);return Xp.jsxs(uX,f({ref:t,className:QU(S.root,i),ownerState:x},w,{children:[Xp.jsx(E,f({},R,{children:n?Xp.jsx(O,f({},D)):Xp.jsx(T,f({},I))})),o?Xp.jsx(Gv,{variant:"subtitle1",component:"span",id:b,children:o}):Xp.jsx(dX,{className:S.spacer,ownerState:x}),Xp.jsx(P,f({},M,{children:n?Xp.jsx(T,f({},I)):Xp.jsx(O,f({},D))}))]}))});const hX=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","classes","timezone","format"],mX=["ownerState"],gX=pg("div",{name:"MuiPickersCalendarHeader",slot:"Root"})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),vX=pg("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer"})(({theme:e})=>f({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),bX=pg("div",{name:"MuiPickersCalendarHeader",slot:"Label"})({marginRight:6}),yX=pg(Mv,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton"})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${iX.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),wX=pg(VK,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon"})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),xX=s.forwardRef(function(e,t){const n=vG(),r=gG(),o=cg({props:e,name:"MuiPickersCalendarHeader"}),{slots:i,slotProps:a,currentMonth:l,disabled:c,disableFuture:u,disablePast:p,maxDate:h,minDate:m,onMonthChange:g,onViewChange:v,view:b,reduceAnimations:y,views:w,labelId:x,className:S,classes:C,timezone:k,format:E=`${r.formats.month} ${r.formats.year}`}=o,R=d(o,hX),{ownerState:P}=lG(),M=(e=>wm({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},oX,e))(C),T=i?.switchViewButton??yX,I=yy({elementType:T,externalSlotProps:a?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(b)},ownerState:f({},P,{view:b}),className:M.switchViewButton}),O=i?.switchViewIcon??wX,D=d(yy({elementType:O,externalSlotProps:a?.switchViewIcon,ownerState:P,className:M.switchViewIcon}),mX),F=function(e,{disableFuture:t,maxDate:n,timezone:r}){const o=gG();return s.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isBefore(i,n)?i:n);return!o.isAfter(a,e)},[t,n,e,o,r])}(l,{disableFuture:u,maxDate:h,timezone:k}),L=function(e,{disablePast:t,minDate:n,timezone:r}){const o=gG();return s.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isAfter(i,n)?i:n);return!o.isBefore(a,e)},[t,n,e,o,r])}(l,{disablePast:p,minDate:m,timezone:k});if(1===w.length&&"year"===w[0])return null;const A=r.formatByString(l,E);return Xp.jsxs(gX,f({},R,{ownerState:P,className:QU(M.root,S),ref:t,children:[Xp.jsxs(vX,{role:"presentation",onClick:()=>{if(1!==w.length&&v&&!c)if(2===w.length)v(w.find(e=>e!==b)||w[0]);else{const e=0!==w.indexOf(b)?0:1;v(w[e])}},ownerState:P,"aria-live":"polite",className:M.labelContainer,children:[Xp.jsx(uY,{reduceAnimations:y,transKey:A,children:Xp.jsx(bX,{id:x,ownerState:P,className:M.label,children:A})}),w.length>1&&!c&&Xp.jsx(T,f({},I,{children:Xp.jsx(O,f({},D))}))]}),Xp.jsx(Pw,{in:"day"===b,appear:!y,enter:!y,children:Xp.jsx(fX,{slots:i,slotProps:a,onGoToPrevious:()=>g(r.addMonths(l,-1)),isPreviousDisabled:L,previousLabel:n.previousMonth,onGoToNext:()=>g(r.addMonths(l,1)),isNextDisabled:F,nextLabel:n.nextMonth})})]}))}),SX=pg("div")({overflow:"hidden",width:hK,maxHeight:336,display:"flex",flexDirection:"column",margin:"0 auto"}),CX=e=>Ph("MuiDateCalendar",e);Mh("MuiDateCalendar",["root","viewTransitionContainer"]);const kX=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","classes","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"];const EX=pg(SX,{name:"MuiDateCalendar",slot:"Root"})({display:"flex",flexDirection:"column",height:336}),RX=pg(uY,{name:"MuiDateCalendar",slot:"ViewTransitionContainer"})({}),PX=s.forwardRef(function(e,t){const n=gG(),{ownerState:r}=lG(),o=mm(),i=function(e,t){const n=cg({props:e,name:t}),r=eK(n.reduceAnimations);return f({},n,jG(n),{loading:n.loading??!1,openTo:n.openTo??"day",views:n.views??["year","day"],reduceAnimations:r,renderLoading:n.renderLoading??(()=>Xp.jsx("span",{children:"..."}))})}(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:l,value:c,defaultValue:u,referenceDate:p,disableFuture:h,disablePast:m,onChange:g,onMonthChange:v,reduceAnimations:b,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:x,view:S,views:C,openTo:k,className:E,classes:R,disabled:P,readOnly:M,minDate:T,maxDate:I,disableHighlightToday:O,focusedView:D,onFocusedViewChange:F,showDaysOutsideCurrentMonth:L,fixedWeekNumber:A,dayOfWeekFormatter:N,slots:$,slotProps:z,loading:j,renderLoading:B,displayWeekNumber:_,yearsOrder:H,yearsPerRow:V,monthsPerRow:W,timezone:U}=i,G=d(i,kX),{value:K,handleValueChange:q,timezone:Y}=iK({name:"DateCalendar",timezone:U,value:c,defaultValue:u,referenceDate:p,onChange:g,valueManager:qU}),{view:X,setView:Q,focusedView:Z,setFocusedView:J,goToNextView:ee,setValueAndGoToNextView:te}=nK({view:S,views:C,openTo:k,onChange:q,onViewChange:l,autoFocus:a,focusedView:D,onFocusedViewChange:F}),{referenceDate:ne,calendarState:re,setVisibleDate:oe,isDateDisabled:ie,onMonthSwitchingAnimationEnd:ae}=aY({value:K,referenceDate:p,reduceAnimations:b,onMonthChange:v,minDate:T,maxDate:I,shouldDisableDate:y,disablePast:m,disableFuture:h,timezone:Y,getCurrentMonthFromVisibleDate:(e,t)=>n.isSameMonth(e,t)?t:n.startOfMonth(e)}),le=P&&K||T,se=P&&K||I,ce=`${o}-grid-label`,ue=null!==Z,de=$?.calendarHeader??xX,pe=yy({elementType:de,externalSlotProps:z?.calendarHeader,additionalProps:{views:C,view:X,currentMonth:re.currentMonth,onViewChange:Q,onMonthChange:e=>oe({target:e,reason:"header-navigation"}),minDate:le,maxDate:se,disabled:P,disablePast:m,disableFuture:h,reduceAnimations:b,timezone:Y,labelId:ce},ownerState:r}),fe=Mg(e=>{const t=n.startOfMonth(e),r=n.endOfMonth(e),o=ie(e)?bU({adapter:n,date:e,minDate:n.isBefore(T,t)?t:T,maxDate:n.isAfter(I,r)?r:I,disablePast:m,disableFuture:h,isDateDisabled:ie,timezone:Y}):e;o?(te(o,"finish"),oe({target:o,reason:"cell-interaction"})):(ee(),oe({target:t,reason:"cell-interaction"}))}),he=Mg(e=>{const t=n.startOfYear(e),r=n.endOfYear(e),o=ie(e)?bU({adapter:n,date:e,minDate:n.isBefore(T,t)?t:T,maxDate:n.isAfter(I,r)?r:I,disablePast:m,disableFuture:h,isDateDisabled:ie,timezone:Y}):e;o?(te(o,"finish"),oe({target:o,reason:"cell-interaction"})):(ee(),oe({target:t,reason:"cell-interaction"}))}),me=Mg(e=>q(e?vU(n,e,K??ne):e,"finish",X));s.useEffect(()=>{n.isValid(K)&&oe({target:K,reason:"controlled-value-change"})},[K]);const ge=(e=>wm({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},CX,e))(R),ve={disablePast:m,disableFuture:h,maxDate:I,minDate:T},be={disableHighlightToday:O,readOnly:M,disabled:P,timezone:Y,gridLabelId:ce,slots:$,slotProps:z},ye=s.useRef(X);s.useEffect(()=>{ye.current!==X&&(Z===ye.current&&J(X,!0),ye.current=X)},[Z,J,X]);const we=s.useMemo(()=>[K],[K]);return Xp.jsxs(EX,f({ref:t,className:QU(ge.root,E),ownerState:r},G,{children:[Xp.jsx(de,f({},pe,{slots:$,slotProps:z})),Xp.jsx(RX,{reduceAnimations:b,className:ge.viewTransitionContainer,transKey:X,ownerState:r,children:Xp.jsxs("div",{children:["year"===X&&Xp.jsx(rX,f({},ve,be,{value:K,onChange:he,shouldDisableYear:x,hasFocus:ue,onFocusedViewChange:e=>J("year",e),yearsOrder:H,yearsPerRow:V,referenceDate:ne})),"month"===X&&Xp.jsx(qY,f({},ve,be,{currentMonth:re.currentMonth,hasFocus:ue,className:E,value:K,onChange:fe,shouldDisableMonth:w,onFocusedViewChange:e=>J("month",e),monthsPerRow:W,referenceDate:ne})),"day"===X&&Xp.jsx(jY,f({},re,ve,be,{onMonthSwitchingAnimationEnd:ae,hasFocus:ue,onFocusedDayChange:e=>oe({target:e,reason:"cell-interaction"}),reduceAnimations:b,selectedDays:we,onSelectedDaysChange:me,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:x,onFocusedViewChange:e=>J("day",e),showDaysOutsideCurrentMonth:L,fixedWeekNumber:A,dayOfWeekFormatter:N,displayWeekNumber:_,loading:j,renderLoading:B}))]})})]}))}),MX=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:i,defaultValue:a,referenceDate:l,onChange:s,className:c,classes:u,disableFuture:d,disablePast:p,minDate:f,maxDate:h,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:y,monthsPerRow:w,onYearChange:x,yearsOrder:S,yearsPerRow:C,slots:k,slotProps:E,loading:R,renderLoading:P,disableHighlightToday:M,readOnly:T,disabled:I,showDaysOutsideCurrentMonth:O,dayOfWeekFormatter:D,sx:F,autoFocus:L,fixedWeekNumber:A,displayWeekNumber:N,timezone:$})=>Xp.jsx(PX,{view:e,onViewChange:t,views:n.filter(CU),focusedView:r&&CU(r)?r:null,onFocusedViewChange:o,value:i,defaultValue:a,referenceDate:l,onChange:s,className:c,classes:u,disableFuture:d,disablePast:p,minDate:f,maxDate:h,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:y,monthsPerRow:w,onYearChange:x,yearsOrder:S,yearsPerRow:C,slots:k,slotProps:E,loading:R,renderLoading:P,disableHighlightToday:M,readOnly:T,disabled:I,showDaysOutsideCurrentMonth:O,dayOfWeekFormatter:D,sx:F,autoFocus:L,fixedWeekNumber:A,displayWeekNumber:N,timezone:$}),TX=s.forwardRef(function(e,t){const n=gG(),r=BG(e,"MuiDesktopDatePicker"),o=f({day:MX,month:MX,year:MX},r.viewRenderers),i=f({},r,{closeOnSelect:r.closeOnSelect??!0,viewRenderers:o,format:kU(n,r,!1),yearsPerRow:r.yearsPerRow??4,slots:f({field:oY},r.slots),slotProps:f({},r.slotProps,{field:e=>f({},_g(r.slotProps?.field,e),SG(r)),toolbar:f({hidden:!0},r.slotProps?.toolbar)})}),{renderPicker:a}=(e=>{let{props:t,steps:n}=e,r=d(e,EK);const{slots:o,slotProps:i,label:a,inputRef:l,localeText:s}=t,c=kK({steps:n}),{providerProps:u,renderCurrentView:p,ownerState:h}=lK(f({},r,{props:t,localeText:s,autoFocusView:!0,viewContainerRole:"dialog",variant:"desktop",getStepNavigation:c})),m=u.privateContextValue.labelId,g=i?.toolbar?.hidden??!1,v=o.field,b=d(yy({elementType:v,externalSlotProps:i?.field,additionalProps:f({},g&&{id:m}),ownerState:h}),RK),y=o.layout??CK;let w=m;g&&(w=a?`${m}-label`:void 0);const x=f({},i,{toolbar:f({},i?.toolbar,{titleId:m}),popper:f({"aria-labelledby":w},i?.popper)});return{renderPicker:()=>Xp.jsxs(aG,f({},u,{children:[Xp.jsx(v,f({},b,{slots:f({},o,b.slots),slotProps:f({},x,b.slotProps),inputRef:l})),Xp.jsx(YG,{slots:o,slotProps:x,children:Xp.jsx(y,f({},x?.layout,{slots:o,slotProps:x,children:p()}))})]}))}})({ref:t,props:i,valueManager:qU,valueType:"date",validator:LG,steps:null});return a()});TX.propTypes={autoFocus:C.bool,className:C.string,closeOnSelect:C.bool,dayOfWeekFormatter:C.func,defaultValue:C.object,disabled:C.bool,disableFuture:C.bool,disableHighlightToday:C.bool,disableOpenPicker:C.bool,disablePast:C.bool,displayWeekNumber:C.bool,enableAccessibleFieldDOMStructure:C.any,fixedWeekNumber:C.number,format:C.string,formatDensity:C.oneOf(["dense","spacious"]),inputRef:Yg,label:C.node,loading:C.bool,localeText:C.object,maxDate:C.object,minDate:C.object,monthsPerRow:C.oneOf([3,4]),name:C.string,onAccept:C.func,onChange:C.func,onClose:C.func,onError:C.func,onMonthChange:C.func,onOpen:C.func,onSelectedSectionsChange:C.func,onViewChange:C.func,onYearChange:C.func,open:C.bool,openTo:C.oneOf(["day","month","year"]),orientation:C.oneOf(["landscape","portrait"]),readOnly:C.bool,reduceAnimations:C.bool,referenceDate:C.object,renderLoading:C.func,selectedSections:C.oneOfType([C.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),C.number]),shouldDisableDate:C.func,shouldDisableMonth:C.func,shouldDisableYear:C.func,showDaysOutsideCurrentMonth:C.bool,slotProps:C.object,slots:C.object,sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),timezone:C.string,value:C.object,view:C.oneOf(["day","month","year"]),viewRenderers:C.shape({day:C.func,month:C.func,year:C.func}),views:C.arrayOf(C.oneOf(["day","month","year"]).isRequired),yearsOrder:C.oneOf(["asc","desc"]),yearsPerRow:C.oneOf([3,4])};const IX=pg(zx)({[`& .${Dx.container}`]:{outline:0},[`& .${Dx.paper}`]:{outline:0,minWidth:hK}}),OX=pg(Gx)({"&:first-of-type":{padding:0}});function DX(e){const{children:t,slots:n,slotProps:r}=e,{open:o}=rG(),{dismissViews:i,onPopperExited:a}=lG(),l=n?.dialog??IX,s=n?.mobileTransition??Pw;return Xp.jsx(l,f({open:o,onClose:()=>{i(),a?.()}},r?.dialog,{TransitionComponent:s,TransitionProps:r?.mobileTransition,PaperComponent:n?.mobilePaper,PaperProps:r?.mobilePaper,children:Xp.jsx(OX,{children:t})}))}const FX=["props","steps"],LX=["ownerState"],AX=s.forwardRef(function(e,t){const n=gG(),r=BG(e,"MuiMobileDatePicker"),o=f({day:MX,month:MX,year:MX},r.viewRenderers),i=f({},r,{viewRenderers:o,format:kU(n,r,!1),slots:f({field:oY},r.slots),slotProps:f({},r.slotProps,{field:e=>f({},_g(r.slotProps?.field,e),SG(r)),toolbar:f({hidden:!1},r.slotProps?.toolbar)})}),{renderPicker:a}=(e=>{let{props:t,steps:n}=e,r=d(e,FX);const{slots:o,slotProps:i,label:a,inputRef:l,localeText:s}=t,c=kK({steps:n}),{providerProps:u,renderCurrentView:p,ownerState:h}=lK(f({},r,{props:t,localeText:s,autoFocusView:!0,viewContainerRole:"dialog",variant:"mobile",getStepNavigation:c})),m=u.privateContextValue.labelId,g=i?.toolbar?.hidden??!1,v=o.field,b=d(yy({elementType:v,externalSlotProps:i?.field,additionalProps:f({},g&&{id:m}),ownerState:h}),LX),y=o.layout??CK;let w=m;g&&(w=a?`${m}-label`:void 0);const x=f({},i,{toolbar:f({},i?.toolbar,{titleId:m}),mobilePaper:f({"aria-labelledby":w},i?.mobilePaper)});return{renderPicker:()=>Xp.jsxs(aG,f({},u,{children:[Xp.jsx(v,f({},b,{slots:f({},o,b.slots),slotProps:f({},x,b.slotProps),inputRef:l})),Xp.jsx(DX,{slots:o,slotProps:x,children:Xp.jsx(y,f({},x?.layout,{slots:o,slotProps:x,children:p()}))})]}))}})({ref:t,props:i,valueManager:qU,valueType:"date",validator:LG,steps:null});return a()});AX.propTypes={autoFocus:C.bool,className:C.string,closeOnSelect:C.bool,dayOfWeekFormatter:C.func,defaultValue:C.object,disabled:C.bool,disableFuture:C.bool,disableHighlightToday:C.bool,disableOpenPicker:C.bool,disablePast:C.bool,displayWeekNumber:C.bool,enableAccessibleFieldDOMStructure:C.any,fixedWeekNumber:C.number,format:C.string,formatDensity:C.oneOf(["dense","spacious"]),inputRef:Yg,label:C.node,loading:C.bool,localeText:C.object,maxDate:C.object,minDate:C.object,monthsPerRow:C.oneOf([3,4]),name:C.string,onAccept:C.func,onChange:C.func,onClose:C.func,onError:C.func,onMonthChange:C.func,onOpen:C.func,onSelectedSectionsChange:C.func,onViewChange:C.func,onYearChange:C.func,open:C.bool,openTo:C.oneOf(["day","month","year"]),orientation:C.oneOf(["landscape","portrait"]),readOnly:C.bool,reduceAnimations:C.bool,referenceDate:C.object,renderLoading:C.func,selectedSections:C.oneOfType([C.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),C.number]),shouldDisableDate:C.func,shouldDisableMonth:C.func,shouldDisableYear:C.func,showDaysOutsideCurrentMonth:C.bool,slotProps:C.object,slots:C.object,sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),timezone:C.string,value:C.object,view:C.oneOf(["day","month","year"]),viewRenderers:C.shape({day:C.func,month:C.func,year:C.func}),views:C.arrayOf(C.oneOf(["day","month","year"]).isRequired),yearsOrder:C.oneOf(["asc","desc"]),yearsPerRow:C.oneOf([3,4])};const NX=["desktopModeMediaQuery"],$X=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=WG}=n,o=d(n,NX);return nR(r,{defaultMatches:!0})?Xp.jsx(TX,f({ref:t},o)):Xp.jsx(AX,f({ref:t},o))});var zX,jX={exports:{}};var BX,_X=(zX||(zX=1,function(e){e.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",a="hour",l="day",s="week",c="month",u="quarter",d="year",p="date",f="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},v=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:v,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+v(r,2,"0")+":"+v(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,a=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-a:a-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:s,d:l,D:p,h:a,m:i,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",w={};w[y]=g;var x="$isDayjsObject",S=function(e){return e instanceof R||!(!e||!e[x])},C=function e(t,n,r){var o;if(!t)return y;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var a=t.split("-");if(!o&&a.length>1)return e(a[0])}else{var l=t.name;w[l]=t,o=l}return!r&&o&&(y=o),o||!r&&y},k=function(e,t){if(S(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new R(n)},E=b;E.l=C,E.i=S,E.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var R=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var v=g.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(E.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return E},v.isValid=function(){return!(this.$d.toString()===f)},v.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},v.isAfter=function(e,t){return k(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<k(e)},v.$g=function(e,t,n){return E.u(e)?this[t]:this.set(n,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var n=this,r=!!E.u(t)||t,u=E.p(e),f=function(e,t){var o=E.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(l)},h=function(e,t){return E.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case d:return r?f(1,0):f(31,11);case c:return r?f(1,g):f(0,g+1);case s:var y=this.$locale().weekStart||0,w=(m<y?m+7:m)-y;return f(r?v-w:v+(6-w),g);case l:case p:return h(b+"Hours",0);case a:return h(b+"Minutes",1);case i:return h(b+"Seconds",2);case o:return h(b+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var n,s=E.p(e),u="set"+(this.$u?"UTC":""),f=(n={},n[l]=u+"Date",n[p]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[a]=u+"Hours",n[i]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[s],h=s===l?this.$D+(t-this.$W):t;if(s===c||s===d){var m=this.clone().set(p,1);m.$d[f](h),m.init(),this.$d=m.set(p,Math.min(this.$D,m.daysInMonth())).$d}else f&&this.$d[f](h);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[E.p(e)]()},v.add=function(r,u){var p,f=this;r=Number(r);var h=E.p(u),m=function(e){var t=k(f);return E.w(t.date(t.date()+Math.round(e*r)),f)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===l)return m(1);if(h===s)return m(7);var g=(p={},p[i]=t,p[a]=n,p[o]=e,p)[h]||1,v=this.$d.getTime()+r*g;return E.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=E.z(this),i=this.$H,a=this.$m,l=this.$M,s=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},p=function(e){return E.s(i%12||12,e,"0")},h=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return E.s(t.$y,4,"0");case"M":return l+1;case"MM":return E.s(l+1,2,"0");case"MMM":return d(n.monthsShort,l,c,3);case"MMMM":return d(c,l);case"D":return t.$D;case"DD":return E.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,s,2);case"ddd":return d(n.weekdaysShort,t.$W,s,3);case"dddd":return s[t.$W];case"H":return String(i);case"HH":return E.s(i,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return h(i,a,!0);case"A":return h(i,a,!1);case"m":return String(a);case"mm":return E.s(a,2,"0");case"s":return String(t.$s);case"ss":return E.s(t.$s,2,"0");case"SSS":return E.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(r,p,f){var h,m=this,g=E.p(p),v=k(r),b=(v.utcOffset()-this.utcOffset())*t,y=this-v,w=function(){return E.m(m,v)};switch(g){case d:h=w()/12;break;case c:h=w();break;case u:h=w()/3;break;case s:h=(y-b)/6048e5;break;case l:h=(y-b)/864e5;break;case a:h=y/n;break;case i:h=y/t;break;case o:h=y/e;break;default:h=y}return f?h:E.a(h)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return w[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},v.clone=function(){return E.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),P=R.prototype;return k.prototype=P,[["$ms",r],["$s",o],["$m",i],["$H",a],["$W",l],["$M",c],["$y",d],["$D",p]].forEach(function(e){P[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),k.extend=function(e,t){return e.$i||(e(t,R,k),e.$i=!0),k},k.locale=C,k.isDayjs=S,k.unix=function(e){return k(1e3*e)},k.en=w[y],k.Ls=w,k.p={},k}()}(jX)),jX.exports),HX=t(_X),VX={exports:{}};var WX,UX=(BX||(BX=1,function(e){var t,n;e.exports=(t="week",n="year",function(e,r,o){var i=r.prototype;i.week=function(e){if(void 0===e&&(e=null),null!==e)return this.add(7*(e-this.week()),"day");var r=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var i=o(this).startOf(n).add(1,n).date(r),a=o(this).endOf(t);if(i.isBefore(a))return 1}var l=o(this).startOf(n).date(r).startOf(t).subtract(1,"millisecond"),s=this.diff(l,t,!0);return s<0?o(this).startOf("week").week():Math.ceil(s)},i.weeks=function(e){return void 0===e&&(e=null),this.week(e)}})}(VX)),VX.exports),GX=t(UX),KX={exports:{}};var qX,YX=(WX||(WX=1,function(e){e.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},l=function(e){return(e=+e)+(e>68?1900:2e3)},s=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],u=function(e){var t=a[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=a.meridiem;if(r){for(var o=1;o<=24;o+=1)if(e.indexOf(r(o,0,t))>-1){n=o>12;break}}else n=e===(t?"pm":"PM");return n},p={A:[i,function(e){this.afternoon=d(e,!1)}],a:[i,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[o,s("seconds")],ss:[o,s("seconds")],m:[o,s("minutes")],mm:[o,s("minutes")],H:[o,s("hours")],h:[o,s("hours")],HH:[o,s("hours")],hh:[o,s("hours")],D:[o,s("day")],DD:[r,s("day")],Do:[i,function(e){var t=a.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[o,s("week")],ww:[r,s("week")],M:[o,s("month")],MM:[r,s("month")],MMM:[i,function(e){var t=u("months"),n=(u("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,s("year")],YY:[r,function(e){this.year=l(e)}],YYYY:[/\d{4}/,s("year")],Z:c,ZZ:c};function f(n){var r,o;r=n,o=a&&a.formats;for(var i=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})).match(t),l=i.length,s=0;s<l;s+=1){var c=i[s],u=p[c],d=u&&u[0],f=u&&u[1];i[s]=f?{regex:d,parser:f}:c.replace(/^\[|\]$/g,"")}return function(e){for(var t={},n=0,r=0;n<l;n+=1){var o=i[n];if("string"==typeof o)r+=o.length;else{var a=o.regex,s=o.parser,c=e.slice(r),u=a.exec(c)[0];s.call(t,u),e=e.replace(u,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(l=e.parseTwoDigitYear);var r=t.prototype,o=r.parse;r.parse=function(e){var t=e.date,r=e.utc,i=e.args;this.$u=r;var l=i[1];if("string"==typeof l){var s=!0===i[2],c=!0===i[3],u=s||c,d=i[2];c&&(d=i[2]),a=this.$locale(),!s&&d&&(a=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var o=f(t)(e),i=o.year,a=o.month,l=o.day,s=o.hours,c=o.minutes,u=o.seconds,d=o.milliseconds,p=o.zone,h=o.week,m=new Date,g=l||(i||a?1:m.getDate()),v=i||m.getFullYear(),b=0;i&&!a||(b=a>0?a-1:m.getMonth());var y,w=s||0,x=c||0,S=u||0,C=d||0;return p?new Date(Date.UTC(v,b,g,w,x,S,C+60*p.offset*1e3)):n?new Date(Date.UTC(v,b,g,w,x,S,C)):(y=new Date(v,b,g,w,x,S,C),h&&(y=r(y).week(h).toDate()),y)}catch(e){return new Date("")}}(t,l,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(l)&&(this.$d=new Date("")),a={}}else if(l instanceof Array)for(var p=l.length,h=1;h<=p;h+=1){i[1]=l[h-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}h===p&&(this.$d=new Date(""))}else o.call(this,e)}}}()}(KX)),KX.exports),XX=t(YX),QX={exports:{}};var ZX,JX=(qX||(qX=1,function(e){var t;e.exports=(t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,n,r){var o=n.prototype,i=o.format;r.en.formats=t,o.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var n=this.$locale().formats,r=function(e,n){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(e,r,o){var i=o&&o.toUpperCase();return r||n[o]||t[o]||n[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})}(e,void 0===n?{}:n);return i.call(this,r)}})}(QX)),QX.exports),eQ=t(JX),tQ={exports:{}};var nQ,rQ=(ZX||(ZX=1,function(e){e.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,o){var i=n(e),a=n(t),l="("===(o=o||"()")[0],s=")"===o[1];return(l?this.isAfter(i,r):!this.isBefore(i,r))&&(s?this.isBefore(a,r):!this.isAfter(a,r))||(l?this.isBefore(i,r):!this.isAfter(i,r))&&(s?this.isAfter(a,r):!this.isBefore(a,r))}}}(tQ)),tQ.exports),oQ=t(rQ),iQ={exports:{}};var aQ=(nQ||(nQ=1,function(e){e.exports=function(e,t){var n=t.prototype,r=n.format;n.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return r.bind(this)(e);var o=this.$utils(),i=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return n.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return n.ordinal(t.week(),"W");case"w":case"ww":return o.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return o.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return o.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e}});return r.bind(this)(i)}}}(iQ)),iQ.exports),lQ=t(aQ);HX.extend(eQ),HX.extend(GX),HX.extend(oQ),HX.extend(lQ);const sQ={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},cQ={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},uQ=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join("\n"),dQ=["Missing timezone plugin","To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join("\n");class pQ{isMUIAdapter=!0;isTimezoneCompatible=!0;lib="dayjs";escapedCharacters={start:"[",end:"]"};formatTokenMap=(()=>sQ)();constructor({locale:e,formats:t}={}){this.locale=e,this.formats=f({},cQ,t),HX.extend(XX)}setLocaleToValue=e=>{const t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasUTCPlugin=()=>void 0!==HX.utc;hasTimezonePlugin=()=>void 0!==HX.tz;isSame=(e,t,n)=>{const r=this.setTimezone(t,this.getTimezone(e));return e.format(n)===r.format(n)};cleanTimezone=e=>{switch(e){case"default":return;case"system":return HX.tz.guess();default:return e}};createSystemDate=e=>{let t;if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const n=HX.tz.guess();t="UTC"===n?HX(e):HX.tz(e,n)}else t=HX(e);return this.setLocaleToValue(t)};createUTCDate=e=>{if(!this.hasUTCPlugin())throw new Error(uQ);return this.setLocaleToValue(HX.utc(e))};createTZDate=(e,t)=>{if(!this.hasUTCPlugin())throw new Error(uQ);if(!this.hasTimezonePlugin())throw new Error(dQ);const n=void 0!==e&&!e.endsWith("Z");return this.setLocaleToValue(HX(e).tz(this.cleanTimezone(t),n))};getLocaleFormats=()=>{const e=HX.Ls;let t=e[this.locale||"en"];return void 0===t&&(t=e.en),t.formats};adjustOffset=e=>{if(!this.hasTimezonePlugin())return e;const t=this.getTimezone(e);if("UTC"!==t){const n=e.tz(this.cleanTimezone(t),!0);if(n.$offset===(e.$offset??0))return e;e.$offset=n.$offset}return e};date=(e,t="default")=>null===e?null:"UTC"===t?this.createUTCDate(e):"system"===t||"default"===t&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t);getInvalidDate=()=>HX(new Date("Invalid date"));getTimezone=e=>{if(this.hasTimezonePlugin()){const t=e.$x?.$timezone;if(t)return t}return this.hasUTCPlugin()&&e.isUTC()?"UTC":"system"};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if("UTC"===t){if(!this.hasUTCPlugin())throw new Error(uQ);return e.utc()}if("system"===t)return e.local();if(!this.hasTimezonePlugin()){if("default"===t)return e;throw new Error(dQ)}return this.setLocaleToValue(HX.tz(e,this.cleanTimezone(t)))};toJsDate=e=>e.toDate();parse=(e,t)=>""===e?null:HX(e,t,this.locale,!0);getCurrentLocaleCode=()=>this.locale||"en";is12HourCycleInCurrentLocale=()=>/A|a/.test(this.getLocaleFormats().LT||"");expandFormat=e=>{const t=this.getLocaleFormats();return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(e,n,r)=>{const o=r&&r.toUpperCase();return n||t[r]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(e,t,n)=>t||n.slice(1))})};isValid=e=>null!=e&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>this.setLocaleToValue(e).format(t);formatNumber=e=>e;isEqual=(e,t)=>null===e&&null===t||null!==e&&null!==t&&e.toDate().getTime()===t.toDate().getTime();isSameYear=(e,t)=>this.isSame(e,t,"YYYY");isSameMonth=(e,t)=>this.isSame(e,t,"YYYY-MM");isSameDay=(e,t)=>this.isSame(e,t,"YYYY-MM-DD");isSameHour=(e,t)=>e.isSame(t,"hour");isAfter=(e,t)=>e>t;isAfterYear=(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()>t.utc():e.isAfter(t,"year");isAfterDay=(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()>t.utc():e.isAfter(t,"day");isBefore=(e,t)=>e<t;isBeforeYear=(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()<t.utc():e.isBefore(t,"year");isBeforeDay=(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()<t.utc():e.isBefore(t,"day");isWithinRange=(e,[t,n])=>e>=t&&e<=n;startOfYear=e=>this.adjustOffset(e.startOf("year"));startOfMonth=e=>this.adjustOffset(e.startOf("month"));startOfWeek=e=>this.adjustOffset(this.setLocaleToValue(e).startOf("week"));startOfDay=e=>this.adjustOffset(e.startOf("day"));endOfYear=e=>this.adjustOffset(e.endOf("year"));endOfMonth=e=>this.adjustOffset(e.endOf("month"));endOfWeek=e=>this.adjustOffset(this.setLocaleToValue(e).endOf("week"));endOfDay=e=>this.adjustOffset(e.endOf("day"));addYears=(e,t)=>this.adjustOffset(e.add(t,"year"));addMonths=(e,t)=>this.adjustOffset(e.add(t,"month"));addWeeks=(e,t)=>this.adjustOffset(e.add(t,"week"));addDays=(e,t)=>this.adjustOffset(e.add(t,"day"));addHours=(e,t)=>this.adjustOffset(e.add(t,"hour"));addMinutes=(e,t)=>this.adjustOffset(e.add(t,"minute"));addSeconds=(e,t)=>this.adjustOffset(e.add(t,"second"));getYear=e=>e.year();getMonth=e=>e.month();getDate=e=>e.date();getHours=e=>e.hour();getMinutes=e=>e.minute();getSeconds=e=>e.second();getMilliseconds=e=>e.millisecond();setYear=(e,t)=>this.adjustOffset(e.set("year",t));setMonth=(e,t)=>this.adjustOffset(e.set("month",t));setDate=(e,t)=>this.adjustOffset(e.set("date",t));setHours=(e,t)=>this.adjustOffset(e.set("hour",t));setMinutes=(e,t)=>this.adjustOffset(e.set("minute",t));setSeconds=(e,t)=>this.adjustOffset(e.set("second",t));setMilliseconds=(e,t)=>this.adjustOffset(e.set("millisecond",t));getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{const t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e));let r=0,o=t;const i=[];for(;o<n;){const e=Math.floor(r/7);i[e]=i[e]||[],i[e].push(o),o=this.addDays(o,1),r+=1}return i};getWeekNumber=e=>e.week();getDayOfWeek(e){return e.day()+1}getYearRange=([e,t])=>{const n=this.startOfYear(e),r=this.endOfYear(t),o=[];let i=n;for(;this.isBefore(i,r);)o.push(i),i=this.addYears(i,1);return o}}const fQ=({providersData:e,rootProvider:t,savedFilters:n={},onSaveFilter:r,onRemoveFilter:o,existingDimensions:i=[],existingMetrics:a=[],titleOverrides:l={},onUpdateTitle:u,onResetTitle:d})=>{const p=SR(),[f,h]=s.useState(!1),[m,g]=s.useState([]),[v,b]=s.useState(""),[y,w]=s.useState([]),[x,S]=s.useState([]),[C,k]=s.useState(!1),[E,R]=s.useState(null),[P,M]=s.useState(null),[T,I]=s.useState(null),[O,D]=s.useState(null),[F,L]=s.useState("");s.useEffect(()=>{b(""),w([]),S([]),M(null),I(null)},[m]);const A=e=>e&&("date"===e.type||"timestamp"===e.type),N=()=>{const n=t?0===m.length?t:m[m.length-1].targetKey:null;if(!n||!e||!e[n])return[];const r=e[n];if(!r.dimensions)return[];const o=[];return Object.keys(r.dimensions).forEach(e=>{const t=r.dimensions[e];Object.keys(t).forEach(r=>{const i=t[r];(e=>!!e.column&&/^[a-zA-Z0-9_.]+$/.test(e.column))(i)&&o.push({key:`${n}_${e}.${r}`,value:i.title||r,dimensionKey:r,alias:e,dimension:i})})}),o},$=()=>{h(!1),g([]),b(""),w([]),S([]),M(null),I(null),R(null)},z=()=>{R(null),w([]),S([]),M(null),I(null)},j=e=>{const t=F.trim();""!==t?(u(e,t),D(null),L("")):B()},B=()=>{D(null),L("")},_=async e=>{k(!0);try{const n={provider:t,doc:{query:{dimensions:[e],metrics:[],order_by:[{name:e}]}},parameters:p?.parameters||{base_currency:"EUR"}};console.log("Fetching filter values with payload:",n);const r=await jc.runAdHocReport({report:n});console.log("Filter values results:",r);const o=(Array.isArray(r)?r:r.data||[]).map(t=>{let n=t[e];if(void 0===n){n=t[e.replace(/\./g,"_")]}if(void 0===n){const e=Object.keys(t);e.length>0&&(n=t[e[0]])}return{key:String(n),value:String(n)}});console.log("Transformed distinct values:",o),w(o)}catch(e){console.error("Error fetching filter values:",e),w([])}finally{k(!1)}},H=e=>{const n=[t];return e.relationNames&&e.relationNames.length>0&&n.push(...e.relationNames),n.join(" → ")},V=Object.entries(n);return c.createElement("div",null,c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:2,marginBottom:2}},f?c.createElement(c.Fragment,null,c.createElement(Xw,{variant:"outlined",onClick:$},"Cancel"),c.createElement(Xw,{variant:"contained",onClick:()=>{const n=N().find(e=>e.key===v);if(!n)return;const o=A(n.dimension);if(o){if(!P&&!T)return}else if(0===x.length)return;if(!v)return;const i=[],a=[t],l=[];let s=t;m.forEach(t=>{const n=e[s];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(i.push(e),l.push(e.name))}a.push(t.targetKey),s=t.targetKey});const c=[e[t].default_alias];i.forEach(e=>{c.push(e.alias)});const u=`${c.join("_")}.${n.dimensionKey}`;let d;o?(d={},P&&(d.gte=P.format("YYYY-MM-DD")),T&&(d.lte=T.format("YYYY-MM-DD"))):d=x;const p={dimension:n.dimension,relations:i,providerPath:a,relationNames:l,dimensionKey:n.dimensionKey,dimensionTitle:n.value,fullPath:u,values:d};r(u,p),$()},disabled:(()=>{if(!v)return!0;const e=N().find(e=>e.key===v);if(!e)return!0;return A(e.dimension)?!P&&!T:0===x.length})()},"Save Filter")):c.createElement(Xw,{variant:"contained",onClick:()=>{h(!0),g([]),b(""),w([]),S([]),M(null),I(null),R(null)}},"Add Filter")),f&&c.createElement(qg,{sx:{padding:3,marginBottom:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Select Provider Path"),c.createElement(kH,{providersData:e,rootProvider:t,onSelectionChange:g,existingDimensions:i,existingMetrics:a,existingFilters:n}),c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},"Select Dimension for Filter"),c.createElement(uR,{items:N(),value:v,label:"Choose Dimension",onChange:n=>{const r=n.target.value;if(b(r),S([]),M(null),I(null),r){const n=N().find(e=>e.key===r);if(n){if(!A(n.dimension)){const r=[];let o=t;m.forEach(t=>{const n=e[o];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&r.push(e)}o=t.targetKey});const i=[e[t].default_alias];r.forEach(e=>{i.push(e.alias)});const a=`${i.join("_")}.${n.dimensionKey}`;_(a)}}}else w([])},sx:{width:"400px"}}),v&&(()=>{const e=N().find(e=>e.key===v),t=e&&A(e.dimension);return c.createElement(c.Fragment,null,c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},t?"Select Date Range":"Select Filter Values"),t?c.createElement(mU,{dateAdapter:pQ},c.createElement(jw,{sx:{display:"flex",gap:2,width:"400px"}},c.createElement($X,{label:"From Date",value:P,onChange:e=>M(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}),c.createElement($X,{label:"To Date",value:T,onChange:e=>I(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}))):c.createElement(jw,{sx:{width:"400px"}},c.createElement(sR,{items:y,selectedKeys:x,onChange:e=>S(e),label:"Choose Values",placeholder:"Select one or more values...",loading:C,helperText:x.length>0?`${x.length} value(s) selected`:"Select at least one value"})))})()),V.length>0&&c.createElement(jw,{sx:{marginTop:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Saved Filters"),c.createElement(jw,{sx:{display:"flex",flexDirection:"column",gap:2}},V.map(([e,t])=>{const i=A(t.dimension),a=E===e,s=O===e;let u,p,f;i&&t.values&&"object"==typeof t.values&&!Array.isArray(t.values)?(p=t.values.gte&&t.values.lte?`${t.values.gte} to ${t.values.lte}`:t.values.gte?`From ${t.values.gte}`:t.values.lte?`Until ${t.values.lte}`:"No dates",f="📅"):(u=t.values?.length||0,p=t.values?.join(", ")||"No values",f=u);const m=l[e]||t.dimensionTitle,g=!!l[e];return c.createElement(jw,{key:e},c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1,marginBottom:a?2:0}},s?c.createElement(c.Fragment,null,c.createElement(qE,{value:F,onChange:e=>L(e.target.value),onKeyDown:t=>((e,t)=>{"Enter"===e.key?j(t):"Escape"===e.key&&B()})(t,e),size:"small",autoFocus:!0,placeholder:"Enter custom title",sx:{width:"300px"}}),c.createElement(Hk,{title:"Save",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>j(e),color:"primary"},c.createElement(oU,{fontSize:"small"}))),c.createElement(Hk,{title:"Cancel",arrow:!0},c.createElement(Mv,{size:"small",onClick:B,color:"default"},c.createElement(iU,{fontSize:"small"}))),g&&c.createElement(Hk,{title:"Reset to default",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>(e=>{d(e),D(null),L("")})(e),color:"warning"},c.createElement(aU,{fontSize:"small"})))):c.createElement(c.Fragment,null,c.createElement(Hk,{title:c.createElement("div",null,c.createElement("div",null,c.createElement("strong",null,"Path:")," ",H(t)," → ",t.dimensionTitle),c.createElement("div",null,c.createElement("strong",null,"Full Path:")," ",e),c.createElement("div",null,c.createElement("strong",null,i?"Date Range":`Values (${u})`,":")," ",p)),arrow:!0,placement:"top"},c.createElement(Nw,{badgeContent:f,color:"secondary"},c.createElement(zy,{label:m,onDelete:()=>o(e),color:"secondary",variant:"outlined",sx:{fontWeight:g?"bold":"normal",fontStyle:g?"italic":"normal"}}))),c.createElement(Hk,{title:"Rename filter",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>((e,t)=>{D(e),L(l[e]||t||"")})(e,t.dimensionTitle),color:"primary",disabled:a},c.createElement(mH,{fontSize:"small"}))),c.createElement(Hk,{title:"Edit filter values",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>(async(e,t)=>{h(!1),R(e),A(t.dimension)?t.values&&"object"==typeof t.values&&!Array.isArray(t.values)&&(M(t.values.gte?HX(t.values.gte):null),I(t.values.lte?HX(t.values.lte):null)):(S(t.values||[]),await _(e))})(e,t),color:"primary",disabled:a},c.createElement(pU,{fontSize:"small"}))))),a&&c.createElement(qg,{sx:{padding:2,marginLeft:2}},c.createElement(Gv,{variant:"subtitle2",sx:{marginBottom:1}},"Edit Filter ",i?"Date Range":"Values"," for: ",t.dimensionTitle),i?c.createElement(mU,{dateAdapter:pQ},c.createElement(jw,{sx:{display:"flex",gap:2,width:"400px",marginBottom:2}},c.createElement($X,{label:"From Date",value:P,onChange:e=>M(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}),c.createElement($X,{label:"To Date",value:T,onChange:e=>I(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}))):c.createElement(jw,{sx:{width:"400px",marginBottom:2}},c.createElement(sR,{items:y,selectedKeys:x,onChange:e=>S(e),label:"Choose Values",placeholder:"Select one or more values...",loading:C,helperText:x.length>0?`${x.length} value(s) selected`:"Select at least one value"})),c.createElement(jw,{sx:{display:"flex",gap:1}},c.createElement(Xw,{variant:"outlined",size:"small",onClick:z},"Cancel"),c.createElement(Xw,{variant:"contained",size:"small",onClick:()=>(e=>{const t=n[e];if(A(t.dimension)){if(!P&&!T)return;const n={};P&&(n.gte=P.format("YYYY-MM-DD")),T&&(n.lte=T.format("YYYY-MM-DD"));const o={...t,values:n};r(e,o)}else{if(0===x.length)return;const n={...t,values:x};r(e,n)}R(null),w([]),S([]),M(null),I(null)})(e),disabled:i?!P&&!T:0===x.length},"Save Changes"))))}))))},hQ=({reportData:e,dimensions:t,metrics:n,loading:r,onPageChange:o,totalRows:i=0,titleOverrides:a={dimensions:{},metrics:{}}})=>{const[l,u]=s.useState({page:0,pageSize:50}),d=c.useMemo(()=>{const e=[];return t.forEach(t=>{let n,r;if(t.relations&&t.relations.length>0){const e=t.fullPath.split("."),r=e[0],o=e[1],i=r.split("_");i.shift();const a=i.join("_");n=a?`${a}_${o}`:o}else n=t.fullPath.replace(".","_");r=a.dimensions[t.fullPath]||t.dimensionTitle||n,e.push({field:n,headerName:r,flex:1,minWidth:150})}),n.forEach(t=>{const n=t.metric;let r,o;if(t.relations&&t.relations.length>0){const e=t.fullPath.split("."),n=e[0],o=e[1],i=n.split("_");i.shift();const a=i.join("_");r=a?`${a}_${o}`:o}else r=t.metricName;o=a.metrics[t.fullPath]||t.metricTitle||r,e.push({field:r,headerName:o,flex:1,minWidth:150,type:"integer"===n?.type||"currency"===n?.type?"number":"string",valueFormatter:e=>{if(null==e)return"";if(n?.format){const t=pl(e).format(n.format);return n?.prefix?`${n.prefix} ${t}`:t}return e}})}),e},[t,n,a]),p=c.useMemo(()=>e&&Array.isArray(e)?e.map((e,t)=>({id:t,...e})):[],[e]);return r?c.createElement(jw,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400},c.createElement(Cv,null)):e&&0!==e.length?c.createElement(jw,{sx:{height:600,width:"100%"}},c.createElement(fH,{rows:p,columns:d,paginationModel:l,onPaginationModelChange:e=>{u(e),o&&e.page!==l.page&&o(e.page,e.pageSize)},pageSizeOptions:[10,25,50,100],paginationMode:"server",rowCount:i||p.length,loading:r,disableRowSelectionOnClick:!0,sx:{"& .MuiDataGrid-cell":{padding:"8px"},"& .MuiDataGrid-columnHeader":{backgroundColor:"#f5f5f5",fontWeight:"bold"}}})):c.createElement(jw,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400},c.createElement(Gv,{variant:"body1",color:"textSecondary"},"No data available. Run a report to see results."))};function mQ({children:e,value:t,index:n}){return c.createElement("div",{role:"tabpanel",hidden:t!==n,id:`report-tabpanel-${n}`,"aria-labelledby":`report-tab-${n}`},t===n&&c.createElement(jw,{sx:{py:3}},e))}const gQ=({reportDefinitionId:e,cloneData:t,autoRun:n,onBackToList:r})=>{const o=ER(),i=SR(),[a,l]=s.useState(null),[u,d]=s.useState(""),[p,f]=s.useState(""),[h,m]=s.useState({dimensions:[],metrics:[],filters:{}}),[g,v]=s.useState({dimensions:{},metrics:{},filters:{}}),[b,y]=s.useState(null),[w,x]=s.useState(!1),[S,C]=s.useState(0),[k,E]=s.useState(0),[R,P]=s.useState(50),[M,T]=s.useState(0),[I,O]=s.useState(!1),[D,F]=s.useState(!1);s.useEffect(()=>{(async()=>{const e=await jc.getProviders();console.log({providers:e}),l(e)})()},[]),s.useEffect(()=>{e&&a&&N(e)},[e,a]),s.useEffect(()=>{t&&a&&$(t)},[t,a]),s.useEffect(()=>{n&&D&&u&&h.dimensions.length>0&&B()},[n,D]);const L=(e,t,n)=>{try{const[r,o]=e.split("."),i=r.split("_");let a=n;const l=[],s=[n],c=[];for(let e=1;e<i.length;e++){const n=i[e],r=t[a];if(!r||!r.relations)return console.warn(`Provider ${a} not found or has no relations`),null;const o=r.relations.find(e=>e.alias===n);if(!o)return console.warn(`Relation with alias ${n} not found in provider ${a}`),null;l.push(o),c.push(o.name),a=o.target,s.push(a)}const u=t[a];if(!u)return console.warn(`Final provider ${a} not found`),null;const d=u.default_alias;if(!u.dimensions||!u.dimensions[d])return console.warn(`Dimensions not found for alias ${d} in provider ${a}`),null;const p=u.dimensions[d][o];return p?{dimension:p,relations:l,providerPath:s,relationNames:c,dimensionKey:o,dimensionTitle:p.title||o,fullPath:e}:(console.warn(`Dimension ${o} not found in provider ${a}, alias ${d}`),null)}catch(t){return console.warn(`Error reconstructing dimension from path ${e}:`,t),null}},A=(e,t,n)=>{try{const[r,o]=e.split("."),i=r.split("_");let a=n;const l=[],s=[n],c=[];for(let e=1;e<i.length;e++){const n=i[e],r=t[a];if(!r||!r.relations)return console.warn(`Provider ${a} not found or has no relations`),null;const o=r.relations.find(e=>e.alias===n);if(!o)return console.warn(`Relation with alias ${n} not found in provider ${a}`),null;l.push(o),c.push(o.name),a=o.target,s.push(a)}const u=t[a];if(!u)return console.warn(`Final provider ${a} not found`),null;if(!u.metrics)return console.warn(`Metrics not found in provider ${a}`),null;const d=u.metrics.find(e=>e.name===o);return d?{metric:d,relations:l,providerPath:s,relationNames:c,metricName:o,metricTitle:d.title||o,fullPath:e}:(console.warn(`Metric ${o} not found in provider ${a}`),null)}catch(t){return console.warn(`Error reconstructing metric from path ${e}:`,t),null}},N=async e=>{try{console.log("Loading report definition:",e);const t=await jc.getReportDefinition({id:e});console.log("Loaded report definition:",t),d(t.provider),f(t.title||"");const n=[],r={};if(t.definition?.doc?.query?.order_by)for(const e of t.definition.doc.query.order_by)!0===e.desc?r[e.name]="desc":r[e.name]="asc";if(t.definition?.doc?.query?.dimensions)for(const e of t.definition.doc.query.dimensions){const o=L(e,a,t.provider);o&&(o.sortOrder=r[e]||null,n.push(o))}const o=[];if(t.definition?.doc?.query?.metrics)for(const e of t.definition.doc.query.metrics){const n=A(e,a,t.provider);n&&o.push(n)}const i={dimensions:{},metrics:{},filters:{}};t.definition?.doc?.query?.titles&&(t.definition.doc.query.titles.dimensions&&(i.dimensions=t.definition.doc.query.titles.dimensions),t.definition.doc.query.titles.metrics&&(i.metrics=t.definition.doc.query.titles.metrics),t.definition.doc.query.titles.filters&&(i.filters=t.definition.doc.query.titles.filters));const l={};if(t.definition?.doc?.query?.filter){const e=t.definition.doc.query.filter;(e.and||e.or||[]).forEach(e=>{const[n,r]=Object.entries(e)[0],o=L(n,a,t.provider);o&&(l[n]={...o,values:r})})}m({dimensions:n,metrics:o,filters:l}),v(i),F(!0),console.log("Reconstructed report:",{dimensions:n,metrics:o,filters:l,titleOverrides:i})}catch(e){console.error("Error loading report definition:",e),o.error("Error loading report definition: "+(e.message||"Unknown error"))}},$=e=>{try{console.log("Loading cloned report:",e),d(e.provider),f(e.title||"");const t=[],n={};if(e.definition?.doc?.query?.order_by)for(const t of e.definition.doc.query.order_by)!0===t.desc?n[t.name]="desc":n[t.name]="asc";if(e.definition?.doc?.query?.dimensions)for(const r of e.definition.doc.query.dimensions){const o=L(r,a,e.provider);o&&(o.sortOrder=n[r]||null,t.push(o))}const r=[];if(e.definition?.doc?.query?.metrics)for(const t of e.definition.doc.query.metrics){const n=A(t,a,e.provider);n&&r.push(n)}const o={dimensions:{},metrics:{},filters:{}};e.definition?.doc?.query?.titles&&(e.definition.doc.query.titles.dimensions&&(o.dimensions=e.definition.doc.query.titles.dimensions),e.definition.doc.query.titles.metrics&&(o.metrics=e.definition.doc.query.titles.metrics),e.definition.doc.query.titles.filters&&(o.filters=e.definition.doc.query.titles.filters));const i={};if(e.definition?.doc?.query?.filter){const t=e.definition.doc.query.filter;(t.and||t.or||[]).forEach(t=>{const[n,r]=Object.entries(t)[0],o=L(n,a,e.provider);o&&(i[n]={...o,values:r})})}m({dimensions:t,metrics:r,filters:i}),v(o),console.log("Loaded cloned report:",{dimensions:t,metrics:r,filters:i,titleOverrides:o})}catch(e){console.error("Error loading cloned report:",e),o.error("Error loading cloned report: "+(e.message||"Unknown error"))}},z=(e=0,t=50)=>{const n=h.dimensions.map(e=>{const t={name:e.fullPath};return"desc"===e.sortOrder&&(t.desc=!0),t}),r=[];h.filters&&Object.keys(h.filters).length>0&&Object.entries(h.filters).forEach(([e,t])=>{t.values&&(Array.isArray(t.values)?t.values.length>0&&r.push({[e]:t.values}):"object"==typeof t.values&&r.push({[e]:t.values}))});const o=r.length>0?{and:r}:null,a={};Object.keys(g.dimensions).length>0&&(a.dimensions=g.dimensions),Object.keys(g.metrics).length>0&&(a.metrics=g.metrics),Object.keys(g.filters).length>0&&(a.filters=g.filters);const l={dimensions:h.dimensions.map(e=>e.fullPath),metrics:h.metrics.map(e=>e.fullPath),order_by:n,limit:t,offset:e*t};Object.keys(a).length>0&&(l.titles=a),o&&(l.filter=o);return{provider:u,doc:{query:l},parameters:i?.parameters||{base_currency:"EUR"}}},j=async(e,t)=>{try{x(!0);const n=z(e,t);console.log("Running report with:",n);const r=await jc.runAdHocReport({report:n});console.log("Report result:",r),y(r),r&&r.length<t?C(e*t+r.length):C((e+2)*t)}catch(e){console.error("Error running report:",e),o.error("Error running report: "+(e.message||"Unknown error")),y(null)}finally{x(!1)}},B=async()=>{E(0),await j(0,R),T(3)},_=u,H=u&&p.trim()&&(h.dimensions.length>0||h.metrics.length>0);return c.createElement(jw,{sx:{p:3}},c.createElement(jw,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2}},c.createElement("h1",null,e?"Edit Report":"Create New Report"),r&&c.createElement(Xw,{variant:"outlined",startIcon:c.createElement(xH,null),onClick:r},"Back to List")),c.createElement(jw,{sx:{mt:2,display:"flex",gap:2,alignItems:"flex-start",flexWrap:"wrap"}},c.createElement(qE,{label:"Report Title",value:p,onChange:e=>f(e.target.value),placeholder:"Enter report title",sx:{width:"300px"},size:"small"}),c.createElement(uR,{items:a?Object.keys(a).map(e=>({key:e,value:a[e].name||e})):[],value:u,label:"Select Root Provider",onChange:e=>{d(e.target.value),m({dimensions:[],metrics:[],filters:{}}),v({dimensions:{},metrics:{},filters:{}}),console.log("Selected root provider:",e.target.value)},sx:{width:"300px"},disabled:!!e}),c.createElement(Xw,{variant:"contained",onClick:B,disabled:!_,sx:{height:"40px"}},"Run Report"),c.createElement(Xw,{variant:"contained",color:"secondary",startIcon:c.createElement(CH,null),onClick:async()=>{try{x(!0);const e=z();console.log("Downloading report with:",e);const t=(new Date).toISOString().split("T")[0],n=`${(p||"report").replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${t}.csv`;await jc.downloadAdHocReport({report:e,filename:n}),o.success("Report downloaded successfully!")}catch(e){console.error("Error downloading report:",e),o.error("Error downloading report: "+(e.message||"Unknown error"))}finally{x(!1)}},disabled:!_||w,sx:{height:"40px"}},"Download CSV"),c.createElement(Xw,{variant:"contained",color:"success",startIcon:c.createElement(SH,null),onClick:async()=>{if(u)if(p.trim())if(0!==h.dimensions.length||0!==h.metrics.length)try{O(!0);const t=h.dimensions.map(e=>{const t={name:e.fullPath};return"desc"===e.sortOrder&&(t.desc=!0),t}),n={};Object.keys(g.dimensions).length>0&&(n.dimensions=g.dimensions),Object.keys(g.metrics).length>0&&(n.metrics=g.metrics),Object.keys(g.filters).length>0&&(n.filters=g.filters);const i={dimensions:h.dimensions.map(e=>e.fullPath),metrics:h.metrics.map(e=>e.fullPath),order_by:t};if(Object.keys(n).length>0&&(i.titles=n),Object.keys(h.filters).length>0){const e=[];Object.entries(h.filters).forEach(([t,n])=>{n.values&&(Array.isArray(n.values)?n.values.length>0&&e.push({[t]:n.values}):"object"==typeof n.values&&e.push({[t]:n.values}))}),e.length>0&&(i.filter={and:e})}const a={query:i},l={provider:u,title:p.trim(),definition:{provider:u,doc:a,parameters:{base_currency:"EUR"}}};console.log("Saving report definition:",l),e?(await jc.updateReportDefinition({id:e,reportDefinition:l}),o.success("Report definition updated successfully!")):(await jc.createReportDefinition({reportDefinition:l}),o.success("Report definition created successfully!")),r&&r()}catch(e){console.error("Error saving report definition:",e),o.error("Error saving report definition: "+(e.message||"Unknown error"))}finally{O(!1)}else o.warning("Please add at least one dimension or metric");else o.warning("Please enter a report title");else o.warning("Please select a provider first")},disabled:!H||I,sx:{height:"40px"}},I?"Saving...":e?"Update Report":"Save Report")),u&&c.createElement(jw,{sx:{mt:4}},c.createElement(jw,{sx:{borderBottom:1,borderColor:"divider"}},c.createElement(WE,{value:M,onChange:(e,t)=>{T(t)},"aria-label":"report builder tabs"},c.createElement(Jk,{label:c.createElement(Nw,{badgeContent:h.dimensions.length,color:"primary"},c.createElement("span",{style:{marginRight:h.dimensions.length>0?"12px":"0"}},"Dimensions")),id:"report-tab-0","aria-controls":"report-tabpanel-0"}),c.createElement(Jk,{label:c.createElement(Nw,{badgeContent:h.metrics.length,color:"primary"},c.createElement("span",{style:{marginRight:h.metrics.length>0?"12px":"0"}},"Metrics")),id:"report-tab-1","aria-controls":"report-tabpanel-1"}),c.createElement(Jk,{label:c.createElement(Nw,{badgeContent:Object.keys(h.filters).length,color:"secondary"},c.createElement("span",{style:{marginRight:Object.keys(h.filters).length>0?"12px":"0"}},"Filters")),id:"report-tab-2","aria-controls":"report-tabpanel-2"}),c.createElement(Jk,{label:b?"Results":"Results (Run report first)",id:"report-tab-3","aria-controls":"report-tabpanel-3",disabled:!b}))),c.createElement(mQ,{value:M,index:0},c.createElement(cU,{providersData:a,rootProvider:u,savedDimensions:h.dimensions,onSaveDimension:e=>{m(t=>{const n={...t,dimensions:[...t.dimensions,e]};return console.log("Dimension saved:",e),console.log("Complete report:",n),n})},onRemoveDimension:e=>{m(t=>({...t,dimensions:t.dimensions.filter((t,n)=>n!==e)}))},onReorderDimensions:e=>{m(t=>({...t,dimensions:e}))},titleOverrides:g.dimensions,onUpdateTitle:(e,t)=>{v(n=>({...n,dimensions:{...n.dimensions,[e]:t}}))},onResetTitle:e=>{v(t=>{const n={...t.dimensions};return delete n[e],{...t,dimensions:n}})},existingMetrics:h.metrics,existingFilters:h.filters})),c.createElement(mQ,{value:M,index:1},c.createElement(dU,{providersData:a,rootProvider:u,savedMetrics:h.metrics,onSaveMetric:e=>{m(t=>{const n={...t,metrics:[...t.metrics,e]};return console.log("Metric saved:",e),console.log("Complete report:",n),n})},onRemoveMetric:e=>{m(t=>({...t,metrics:t.metrics.filter((t,n)=>n!==e)}))},onReorderMetrics:e=>{m(t=>({...t,metrics:e}))},titleOverrides:g.metrics,onUpdateTitle:(e,t)=>{v(n=>({...n,metrics:{...n.metrics,[e]:t}}))},onResetTitle:e=>{v(t=>{const n={...t.metrics};return delete n[e],{...t,metrics:n}})},existingDimensions:h.dimensions,existingFilters:h.filters})),c.createElement(mQ,{value:M,index:2},c.createElement(fQ,{providersData:a,rootProvider:u,savedFilters:h.filters,existingDimensions:h.dimensions,existingMetrics:h.metrics,onSaveFilter:(e,t)=>{m(n=>{const r={...n,filters:{...n.filters,[e]:t}};return console.log("Filter saved:",{fullPath:e,filterData:t}),console.log("Complete report:",r),r})},onRemoveFilter:e=>{m(t=>{const n={...t.filters};return delete n[e],{...t,filters:n}})},titleOverrides:g.filters,onUpdateTitle:(e,t)=>{v(n=>({...n,filters:{...n.filters,[e]:t}}))},onResetTitle:e=>{v(t=>{const n={...t.filters};return delete n[e],{...t,filters:n}})}})),c.createElement(mQ,{value:M,index:3},b&&c.createElement(hQ,{reportData:b,dimensions:h.dimensions,metrics:h.metrics,loading:w,onPageChange:async(e,t)=>{E(e),t!==R&&P(t),await j(e,t)},totalRows:S,titleOverrides:g}))))},vQ=()=>{const[e,t]=s.useState("list"),[n,r]=s.useState(null),[o,i]=s.useState(null),[a,l]=s.useState(!1),[u,d]=s.useState(0),p=e=>{r(e),i(null),l(!1),t("builder")},f=()=>{r(null),i(null),l(!1),t("builder")},h=e=>{r(e),i(null),l(!0),t("builder")},m=e=>{r(null),i(e),l(!1),t("builder")};return"list"===e?c.createElement(wH,{onSelectReport:p,onAddNew:f,onCloneReport:m,onRunReport:h,refreshTrigger:u}):c.createElement(gQ,{reportDefinitionId:n,cloneData:o,autoRun:a,onBackToList:()=>{r(null),i(null),l(!1),t("list"),d(e=>e+1)}})};var bQ={Chart:yR,Dashboard:function({id:e="sample_dashboard",api:t,params:n}){const r=SR(),o=t||r?.api||{},i=n||r?.parameters||{},[a,l]=c.useState(),[u]=c.useState(),[d,p]=c.useState([]),f=c.useRef({}),h=vR();bR(h),console.log({rows:d},{dashboard:a},{schema:u},{params:i}),s.useEffect(()=>{jc.setBaseUrl(o.base_url),jc.setToken(o.token)},[o]);const m=async e=>{const t=e?.doc?.rows||[],n=[];for(let e=0;e<t.length;e++){const r=t[e];r.columns?.forEach(e=>{if(e.override?.filter?.length){const t={};e.override.filter.forEach(e=>{e.hasOwnProperty("value")&&(t[e.field]=[e.value])}),e.filter=t}}),n.push(r)}p(n)};return c.useEffect(()=>{e&&(async()=>{jc.setBaseUrl(o.base_url),jc.setToken(o.token),await jc.loadDashboardMeta({dashboardId:e});const t=await jc.getDashboard({id:e});f.current[t?.id]=t,l(t),await m(t)})().catch(e=>console.error(e.message))},[e]),c.createElement(mi,{maxWidth:!1,disableGutters:!0},c.createElement(qi,{container:!0,spacing:3},d?.map((e,t)=>{const n=(e=>0===e?12:12/e)(e.columns.length);return c.createElement(c.Fragment,{key:t},1===t?c.createElement(qi,{item:!0,xs:12},c.createElement(qi,{container:!0,spacing:3},e.columns.map((e,t)=>c.createElement(qi,{key:t,item:!0,xs:12,md:n},c.createElement(yR,{api:o,cache:f.current,id:e.id,dashboard:a,schema:u,title:e.title,filter:e.filter,params:i}))))):e.columns.map((e,t)=>c.createElement(qi,{key:t,item:!0,xs:12,md:n},c.createElement(yR,{api:o,cache:f.current,id:e.id,dashboard:a,schema:u,title:e.title,filter:e.filter,params:i}))))})))},ReportApp:({params:e,api:t})=>(jc._initialized||(jc.setBaseUrl(t.base_url),jc.setToken(t.token),jc._initialized=!0),s.useEffect(()=>{jc.setBaseUrl(t.base_url),jc.setToken(t.token)},[t]),c.createElement(kR,null,c.createElement(xR,{defaultParameters:e,defaultApi:t},c.createElement(vQ,null))))};return bQ}();
|
|
257
|
+
`,Lz=TR(function(e,t){const{children:n}=e,r=d(e,Iz);return Xp.jsx(Fz,f({},r,{ref:t,children:n}))}),Az=new Intl.Collator;const Nz=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagement"})({display:"flex",flexDirection:"column",padding:bP.spacing(.5,1.5)}),$z=pg(Lz,{name:"MuiDataGrid",slot:"ColumnsManagementScrollArea"})({maxHeight:300}),zz=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagementHeader"})({padding:bP.spacing(1.5,2),borderBottom:`1px solid ${bP.colors.border.base}`}),jz=pg(gI,{name:"MuiDataGrid",slot:"ColumnsManagementSearchInput"})({[`& .${Yy.input}::-webkit-search-decoration,\n & .${Yy.input}::-webkit-search-cancel-button,\n & .${Yy.input}::-webkit-search-results-button,\n & .${Yy.input}::-webkit-search-results-decoration`]:{display:"none"}}),Bz=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagementFooter"})({padding:bP.spacing(1,1,1,1.5),display:"flex",justifyContent:"space-between",borderTop:`1px solid ${bP.colors.border.base}`}),_z=pg("div",{name:"MuiDataGrid",slot:"ColumnsManagementEmptyText"})({padding:bP.spacing(1,0),alignSelf:"center",font:bP.typography.font.body}),Hz=pg(gI,{name:"MuiDataGrid",slot:"ColumnsManagementRow"})({}),Vz=TR(function(e,t){const{children:n,slotProps:r={}}=e,o=r.button||{},i=r.tooltip||{},a=lP(),l=rP(),c=mm(),u=mm(),[d,p]=s.useState(!1),h=s.useRef(null),m=Tg(t,h),g=()=>p(!1);return null==n?null:Xp.jsxs(s.Fragment,{children:[Xp.jsx(l.slots.baseTooltip,f({title:a.current.getLocaleText("toolbarExportLabel"),enterDelay:1e3},l.slotProps?.baseTooltip,i,{children:Xp.jsx(l.slots.baseButton,f({size:"small",startIcon:Xp.jsx(l.slots.exportIcon,{}),"aria-expanded":d,"aria-label":a.current.getLocaleText("toolbarExportLabel"),"aria-haspopup":"menu","aria-controls":d?u:void 0,id:c},l.slotProps?.baseButton,o,{onClick:e=>{p(e=>!e),o.onClick?.(e)},ref:m,children:a.current.getLocaleText("toolbarExport")}))})),Xp.jsx(UO,{open:d,target:h.current,onClose:g,position:"bottom-end",children:Xp.jsx(l.slots.baseMenuList,{id:u,className:XT.menuList,"aria-labelledby":c,autoFocusItem:d,children:s.Children.map(n,e=>s.isValidElement(e)?s.cloneElement(e,{hideMenu:g}):e)})})]})}),Wz=["hideMenu","options"],Uz=["hideMenu","options"],Gz=["csvOptions","printOptions","excelOptions"];function Kz(e){const t=lP(),n=rP(),{hideMenu:r,options:o}=e,i=d(e,Wz);return Xp.jsx(n.slots.baseMenuItem,f({onClick:()=>{t.current.exportDataAsCsv(o),r?.()}},i,{children:t.current.getLocaleText("toolbarExportCSV")}))}function qz(e){const t=lP(),n=rP(),{hideMenu:r,options:o}=e,i=d(e,Uz);return Xp.jsx(n.slots.baseMenuItem,f({onClick:()=>{t.current.exportDataAsPrint(o),r?.()}},i,{children:t.current.getLocaleText("toolbarExportPrint")}))}TR(function(e,t){const n=e,{csvOptions:r={},printOptions:o={},excelOptions:i}=n,a=d(n,Gz),l=lP().current.unstable_applyPipeProcessors("exportMenu",[],{excelOptions:i,csvOptions:r,printOptions:o}).sort((e,t)=>e.componentName>t.componentName?1:-1);return 0===l.length?null:Xp.jsx(Vz,f({},a,{ref:t,children:l.map((e,t)=>s.cloneElement(e.component,{key:t}))}))});const Yz=s.createContext(void 0);function Xz(){const e=s.useContext(Yz);if(void 0===e)throw new Error("MUI X: Missing context. Quick Filter subcomponents must be placed within a <QuickFilter /> component.");return e}const Qz=["render","className","parser","formatter","debounceMs","defaultExpanded","expanded","onExpandedChange"],Zz=e=>e.split(" ").filter(e=>""!==e),Jz=e=>e.join(" ");function ej(e){const t=rP(),{render:n,className:r,parser:o=Zz,formatter:i=Jz,debounceMs:a=t.filterDebounceMs,defaultExpanded:l,expanded:c,onExpandedChange:u}=e,p=d(e,Qz),h=lP(),m=s.useRef(null),g=s.useRef(null),v=pI(h,wD),[b,y]=s.useState(i(v??[])),[w,x]=s.useState(l??b.length>0),S=c??w,C=s.useMemo(()=>({value:b,expanded:S}),[b,S]),k="function"==typeof r?r(C):r,E=s.useRef(null),R=mm(),P=s.useCallback(e=>{u&&u(e),void 0===c&&x(e)},[u,c]),M=s.useRef(v);s.useEffect(()=>{JL(M.current,v)||(M.current=v,y(e=>JL(o(e),v)?e:i(v??[])))},[v,i,o]);const T=s.useRef(!0),I=s.useRef(S);s.useEffect(()=>{T.current?T.current=!1:I.current!==S&&(S?requestAnimationFrame(()=>{m.current?.focus({preventScroll:!0})}):g.current?.focus({preventScroll:!0}),I.current=S)},[S]);const O=s.useMemo(()=>Cg(e=>{const t=o(e);M.current=t,h.current.setQuickFilterValues(t)},a),[h,a,o]);s.useEffect(()=>O.clear,[O]);const D=s.useCallback(e=>{const t=e.target.value;y(t),O(t)},[O]),F=s.useCallback(()=>{y(""),h.current.setQuickFilterValues([]),m.current?.focus()},[h,m]),L=s.useMemo(()=>({controlRef:m,triggerRef:g,state:C,controlId:R,clearValue:F,onValueChange:D,onExpandedChange:P}),[R,C,D,F,P]);Wh(()=>{E.current&&g.current&&E.current.style.setProperty("--trigger-width",`${g.current?.offsetWidth}px`)},[]);const A=o$("div",n,f({className:k},p,{ref:E}),C);return Xp.jsx(Yz.Provider,{value:L,children:A})}const tj=["render","className","slotProps","onKeyDown","onChange"],nj=TR(function(e,t){const{render:n,className:r,slotProps:o,onKeyDown:i,onChange:a}=e,l=d(e,tj),c=rP(),{state:u,controlId:p,controlRef:h,onValueChange:m,onExpandedChange:g,clearValue:v}=Xz(),b="function"==typeof r?r(u):r,y=Tg(h,t),w=o$(c.slots.baseTextField,n,f({},c.slotProps?.baseTextField,{slotProps:f({htmlInput:f({role:"searchbox",id:p,tabIndex:u.expanded?void 0:-1},o?.htmlInput,{onBlur:e=>{""===u.value&&g(!1),o?.htmlInput?.onBlur?.(e)}})},o),value:u.value,className:b},l,{onChange:e=>{u.expanded||g(!0),m(e),a?.(e)},onKeyDown:e=>{"Escape"===e.key&&(""===u.value?g(!1):v()),i?.(e)},ref:y}),u);return Xp.jsx(s.Fragment,{children:w})}),rj=["render","className","onClick"],oj=TR(function(e,t){const{render:n,className:r,onClick:o}=e,i=d(e,rj),a=rP(),{state:l,clearValue:c}=Xz(),u="function"==typeof r?r(l):r,p=o$(a.slots.baseIconButton,n,f({},a.slotProps?.baseIconButton,{className:u,tabIndex:-1},i,{onClick:e=>{c(),o?.(e)},ref:t}),l);return Xp.jsx(s.Fragment,{children:p})}),ij=["render","className","onClick"],aj=TR(function(e,t){const{render:n,className:r,onClick:o}=e,i=d(e,ij),a=rP(),{state:l,controlId:c,onExpandedChange:u,triggerRef:p}=Xz(),h="function"==typeof r?r(l):r,m=Tg(p,t),g=o$(a.slots.baseButton,n,f({},a.slotProps?.baseButton,{className:h,"aria-controls":c,"aria-expanded":l.expanded},i,{onClick:e=>{u(!l.expanded),o?.(e)},ref:m}),l);return Xp.jsx(s.Fragment,{children:g})}),lj=["quickFilterParser","quickFilterFormatter","debounceMs","className","slotProps"],sj=["ref","slotProps"],cj=jh("div",{name:"MuiDataGrid",slot:"ToolbarQuickFilter"})({display:"grid",alignItems:"center"}),uj=jh(d$,{name:"MuiDataGrid",slot:"ToolbarQuickFilterTrigger"})(({ownerState:e})=>({gridArea:"1 / 1",width:"min-content",height:"min-content",zIndex:1,opacity:e.expanded?0:1,pointerEvents:e.expanded?"none":"auto",transition:bP.transition(["opacity"])})),dj=jh(e=>{throw new Error("Failed assertion: should not be rendered")},{name:"MuiDataGrid",slot:"ToolbarQuickFilterControl"})(({ownerState:e})=>({gridArea:"1 / 1",overflowX:"clip",width:e.expanded?260:"var(--trigger-width)",opacity:e.expanded?1:0,transition:bP.transition(["width","opacity"])}));function pj(e){const t=lP(),n=rP(),r={classes:n.classes,expanded:!1},o=(e=>{const{classes:t}=e;return wm({root:["toolbarQuickFilter"],trigger:["toolbarQuickFilterTrigger"],control:["toolbarQuickFilterControl"]},YT,t)})(r),{quickFilterParser:i,quickFilterFormatter:a,debounceMs:l,className:s,slotProps:c}=e,u=d(e,lj);return Xp.jsx(ej,{parser:i,formatter:a,debounceMs:l,render:(e,i)=>{const a=f({},r,{expanded:i.expanded});return Xp.jsxs(cj,f({},e,{className:PR(o.root,s),children:[Xp.jsx(aj,{render:e=>Xp.jsx(n.slots.baseTooltip,{title:t.current.getLocaleText("toolbarQuickFilterLabel"),enterDelay:0,children:Xp.jsx(uj,f({className:o.trigger},e,{ownerState:a,color:"default","aria-disabled":i.expanded,children:Xp.jsx(n.slots.quickFilterIcon,{fontSize:"small"})}))})}),Xp.jsx(nj,{render:e=>{let{ref:r,slotProps:i}=e,l=d(e,sj);return Xp.jsx(dj,f({as:n.slots.baseTextField,className:o.control,ownerState:a,inputRef:r,"aria-label":t.current.getLocaleText("toolbarQuickFilterLabel"),placeholder:t.current.getLocaleText("toolbarQuickFilterPlaceholder"),size:"small",slotProps:f({input:f({startAdornment:Xp.jsx(n.slots.quickFilterIcon,{fontSize:"small"}),endAdornment:l.value?Xp.jsx(oj,{render:Xp.jsx(n.slots.baseIconButton,{size:"small",edge:"end","aria-label":t.current.getLocaleText("toolbarQuickFilterDeleteIconLabel"),children:Xp.jsx(n.slots.quickFilterClearIcon,{fontSize:"small"})})}):null},i?.input)},i)},n.slotProps?.baseTextField,l,c?.root,u))}})]}))}})}const fj=["render","className","onClick","onPointerUp"],hj=TR(function(e,t){const{render:n,className:r,onClick:o,onPointerUp:i}=e,a=d(e,fj),l=rP(),c=mm(),u=mm(),p=lP(),h=pI(p,KL),m=h.open&&h.openedPanelValue===YL.filters,g=pI(p,OD).length,v={open:m,filterCount:g},b="function"==typeof r?r(v):r,{filterPanelTriggerRef:y}=UN(),w=Tg(t,y),x=o$(l.slots.baseButton,n,f({},l.slotProps?.baseButton,{id:c,"aria-haspopup":"true","aria-expanded":m?"true":void 0,"aria-controls":m?u:void 0,onClick:e=>{m?p.current.hidePreferences():p.current.showPreferences(YL.filters,u,c),o?.(e)},onPointerUp:e=>{m&&e.stopPropagation(),i?.(e)},className:b},a,{ref:w}),v);return Xp.jsx(s.Fragment,{children:x})}),mj=["render","className","onClick","onPointerUp"],gj=TR(function(e,t){const{render:n,className:r,onClick:o,onPointerUp:i}=e,a=d(e,mj),l=rP(),c=mm(),u=mm(),p=lP(),h=pI(p,KL),m=h.open&&h.openedPanelValue===YL.columns,g={open:m},v="function"==typeof r?r(g):r,{columnsPanelTriggerRef:b}=UN(),y=Tg(t,b),w=o$(l.slots.baseButton,n,f({},l.slotProps?.baseButton,{id:c,"aria-haspopup":"true","aria-expanded":m?"true":void 0,"aria-controls":m?u:void 0,className:v},a,{onPointerUp:e=>{m&&e.stopPropagation(),i?.(e)},onClick:e=>{m?p.current.hidePreferences():p.current.showPreferences(YL.columns,u,c),o?.(e)},ref:y}),g);return Xp.jsx(s.Fragment,{children:w})}),vj=["render","options","onClick"],bj=TR(function(e,t){const{render:n,options:r,onClick:o}=e,i=d(e,vj),a=rP(),l=lP(),c=o$(a.slots.baseButton,n,f({},a.slotProps?.baseButton,{onClick:e=>{l.current.exportDataAsCsv(r),o?.(e)}},i,{ref:t}));return Xp.jsx(s.Fragment,{children:c})}),yj=["render","options","onClick"],wj=TR(function(e,t){const{render:n,options:r,onClick:o}=e,i=d(e,yj),a=rP(),l=lP(),c=o$(a.slots.baseButton,n,f({},a.slotProps?.baseButton,{onClick:e=>{l.current.exportDataAsPrint(r),o?.(e)}},i,{ref:t}));return Xp.jsx(s.Fragment,{children:c})}),xj=["className"],Sj=["className"],Cj=["showQuickFilter","quickFilterProps","csvOptions","printOptions","additionalItems","additionalExportMenuItems"],kj=e=>{const{classes:t}=e;return wm({divider:["toolbarDivider"],label:["toolbarLabel"]},YT,t)},Ej=jh(gI,{name:"MuiDataGrid",slot:"ToolbarDivider"})({height:"50%",margin:bP.spacing(0,.5)}),Rj=jh("span",{name:"MuiDataGrid",slot:"ToolbarLabel"})({flex:1,font:bP.typography.font.large,fontWeight:bP.typography.fontWeight.medium,margin:bP.spacing(0,.5),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"});function Pj(e){const t=d(e,xj),n=rP(),r=kj(n);return Xp.jsx(Ej,f({as:n.slots.baseDivider,orientation:"vertical",className:r.divider},t))}function Mj(e){const t=d(e,Sj),n=rP(),r=kj(n);return Xp.jsx(Rj,f({className:r.label},t))}const Tj=["className","selectedRowCount"],Ij=jh("div",{name:"MuiDataGrid",slot:"SelectedRowCount"})({alignItems:"center",display:"flex",margin:bP.spacing(0,2),visibility:"hidden",width:0,height:0,[bP.breakpoints.up("sm")]:{visibility:"visible",width:"auto",height:"auto"}}),Oj=TR(function(e,t){const{className:n,selectedRowCount:r}=e,o=d(e,Tj),i=lP(),a=rP(),l=(e=>{const{classes:t}=e;return wm({root:["selectedRowCount"]},YT,t)})(a),s=i.current.getLocaleText("footerRowSelected")(r);return Xp.jsx(Ij,f({className:PR(l.root,n),ownerState:a},o,{ref:t,children:s}))}),Dj=TR(function(e,t){const n=lP(),r=rP(),o=pI(n,yT),i=pI(n,ND),a=pI(n,TD),l=!r.hideFooterSelectedRowCount&&i>0?Xp.jsx(Oj,{selectedRowCount:i}):Xp.jsx("div",{}),s=r.hideFooterRowCount||r.pagination?null:Xp.jsx(r.slots.footerRowCount,f({},r.slotProps?.footerRowCount,{rowCount:o,visibleRowCount:a})),c=r.pagination&&!r.hideFooterPagination&&r.slots.pagination&&Xp.jsx(r.slots.pagination,f({},r.slotProps?.pagination));return Xp.jsxs(e$,f({},e,{ref:t,children:[l,s,c]}))}),Fj=(e,t,n,r,o,i)=>{let a;switch(e){case nD.LEFT:a=r[n];break;case nD.RIGHT:a=o-r[n]-t+i;break;default:a=void 0}return Number.isNaN(a)&&(a=void 0),a},Lj=(e,t,n,r,o,i)=>{const a=t===n-1;return!(!i?.startsWith("border")||e!==nD.LEFT||!a)||!!r&&(e===nD.LEFT||(e===nD.RIGHT?!a:!a||o))},Aj=(e,t,n,r)=>r?.startsWith("border")?e===nD.RIGHT&&0===t:n&&e===nD.RIGHT&&0===t,Nj=["skeletonRowsCount","visibleColumns","showFirstRowBorder"],$j=jh("div",{name:"MuiDataGrid",slot:"SkeletonLoadingOverlay"})({minWidth:"100%",width:"max-content",height:"100%",overflow:"clip"}),zj=e=>parseInt(e.getAttribute("data-colindex"),10),jj=TR(function(e,t){const n=rP(),{slots:r}=n,o=um(),i=(e=>{const{classes:t}=e;return wm({root:["skeletonLoadingOverlay"]},YT,t)})({classes:n.classes}),a=s.useRef(null),l=Tg(a,t),c=lP(),u=pI(c,oT),p=pI(c,iT),h=pI(c,hO),m=s.useMemo(()=>h.filter(e=>e<=p).length,[p,h]),{skeletonRowsCount:g,visibleColumns:v,showFirstRowBorder:b}=e,y=d(e,Nj),w=pI(c,cO),x=s.useMemo(()=>w.slice(0,m),[w,m]),S=pI(c,pO),C=s.useCallback(e=>-1!==S.left.findIndex(t=>t.field===e)?nD.LEFT:-1!==S.right.findIndex(t=>t.field===e)?nD.RIGHT:void 0,[S.left,S.right]),k=s.useMemo(()=>{const e=[];for(let t=0;t<g;t+=1){const i=[];for(let e=0;e<x.length;e+=1){const a=x[e],l=C(a.field),s=l===nD.LEFT,c=l===nD.RIGHT,d=kN(l,o),p=d?S[d].length:x.length-S.left.length-S.right.length,m=d?S[d].findIndex(e=>e.field===a.field):e-S.left.length,g=u.hasScrollY?u.scrollbarSize:0,b=EN({},o,l,Fj(l,a.computedWidth,e,h,u.columnsTotalWidth,g)),y=u.columnsTotalWidth<u.viewportOuterSize.width,w=Lj(l,m,p,n.showCellVerticalBorder,y,n.pinnedColumnsSectionSeparator),k=Aj(l,m,n.showCellVerticalBorder,n.pinnedColumnsSectionSeparator),E=c&&0===m,R=E&&y,P=e===x.length-1&&!E&&y,M=u.viewportOuterSize.width-u.columnsTotalWidth,T=Math.max(0,M),I=Xp.jsx(r.skeletonCell,{width:T,empty:!0},`skeleton-filler-column-${t}`);R&&i.push(I),i.push(Xp.jsx(r.skeletonCell,{field:a.field,type:a.type,align:a.align,width:"var(--width)",height:u.rowHeight,"data-colindex":e,empty:v&&!v.has(a.field),className:PR(s&&XT["cell--pinnedLeft"],c&&XT["cell--pinnedRight"],w&&XT["cell--withRightBorder"],k&&XT["cell--withLeftBorder"]),style:f({"--width":`${a.computedWidth}px`},b)},`skeleton-column-${t}-${a.field}`)),P&&i.push(I)}e.push(Xp.jsx("div",{className:PR(XT.row,XT.rowSkeleton,0===t&&!b&&XT["row--firstVisible"]),children:i},`skeleton-row-${t}`))}return e},[g,x,C,o,S,u.hasScrollY,u.scrollbarSize,u.columnsTotalWidth,u.viewportOuterSize.width,u.rowHeight,h,n.showCellVerticalBorder,n.pinnedColumnsSectionSeparator,r,v,b]);return rI(c,"columnResize",e=>{const{colDef:t,width:n}=e,r=a.current?.querySelectorAll(`[data-field="${m$(t.field)}"]`);if(!r)throw new Error("MUI X: Expected skeleton cells to be defined with `data-field` attribute.");const o=x.findIndex(e=>e.field===t.field),i=C(t.field),l=i===nD.LEFT,s=i===nD.RIGHT,c=getComputedStyle(r[0]).getPropertyValue("--width"),u=parseInt(c,10)-n;if(r&&r.forEach(e=>{e.style.setProperty("--width",`${n}px`)}),l){const e=a.current?.querySelectorAll(`.${XT["cell--pinnedLeft"]}`);e?.forEach(e=>{zj(e)>o&&(e.style.left=parseInt(getComputedStyle(e).left,10)-u+"px")})}if(s){const e=a.current?.querySelectorAll(`.${XT["cell--pinnedRight"]}`);e?.forEach(e=>{zj(e)<o&&(e.style.right=`${parseInt(getComputedStyle(e).right,10)+u}px`)})}}),Xp.jsx($j,f({className:i.root},y,{ref:l,children:k}))}),Bj=TR(function(e,t){const n=pI(lP(),oT),r=n?.viewportInnerSize.height??0,o=Math.ceil(r/n.rowHeight);return Xp.jsx(jj,f({},e,{skeletonRowsCount:o,ref:t}))}),_j=["variant","noRowsVariant","style"],Hj={"circular-progress":{component:e=>e.slots.baseCircularProgress,style:{}},"linear-progress":{component:e=>e.slots.baseLinearProgress,style:{display:"block"}},skeleton:{component:()=>Bj,style:{display:"block"}}},Vj=TR(function(e,t){const{variant:n="linear-progress",noRowsVariant:r="skeleton",style:o}=e,i=d(e,_j),a=lP(),l=rP(),s=pI(a,vT),c=Hj[0===s?r:n],u=c.component(l);return Xp.jsx(r$,f({style:f({},c.style,o)},i,{ref:t,children:Xp.jsx(u,{})}))}),Wj=TR(function(e,t){const n=lP().current.getLocaleText("noRowsLabel");return Xp.jsx(r$,f({},e,{ref:t,children:n}))}),Uj=TR(function(e,t){const n=rP(),r=lP(),o=pI(r,oO),i=!n.disableColumnSelector&&o.length>0;return Xp.jsxs(r$,f({},e,{ref:t,children:[r.current.getLocaleText("noColumnsOverlayLabel"),i&&Xp.jsx(n.slots.baseButton,f({size:"small"},n.slotProps?.baseButton,{onClick:()=>{r.current.showPreferences(YL.columns)},children:r.current.getLocaleText("noColumnsOverlayManageColumns")}))]}))}),Gj=pg(gI)({maxHeight:"calc(100% + 1px)",flexGrow:1});const Kj=["className","rowCount","visibleRowCount"],qj=jh("div",{name:"MuiDataGrid",slot:"RowCount"})({alignItems:"center",display:"flex",margin:bP.spacing(0,2)}),Yj=TR(function(e,t){const{className:n,rowCount:r,visibleRowCount:o}=e,i=d(e,Kj),a=lP(),l=rP(),s=(e=>{const{classes:t}=e;return wm({root:["rowCount"]},YT,t)})(l);if(0===r)return null;const c=o<r?a.current.getLocaleText("footerTotalVisibleRows")(o,r):r.toLocaleString();return Xp.jsxs(qj,f({className:PR(s.root,n),ownerState:l},i,{ref:t,children:[a.current.getLocaleText("footerTotalRows")," ",c]}))});const Xj=nT(e=>e.rowReorder),Qj=eT(Xj,e=>e?.isActive??!1),Zj=eT(Xj,e=>e?.dropTarget??{rowId:null,position:null});eT(Zj,e=>e.rowId??null);const Jj=eT(Zj,(e,t)=>e.rowId===t?e.position:null);eT(Xj,e=>e?.draggedRowId??null);const eB=pg("div",{name:"MuiDataGrid",slot:"RowDragOverlay",shouldForwardProp:e=>Oh(e)&&"action"!==e})(({theme:e,action:t})=>f({position:"absolute",left:0,right:0,top:0,bottom:0,pointerEvents:"none",zIndex:1},"above"===t&&{"&::before":{pointerEvents:"none",content:'""',position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:(e.vars||e).palette.primary.main}},"below"===t&&{"&::after":{pointerEvents:"none",content:'""',position:"absolute",bottom:"-2px",left:0,right:0,height:"2px",backgroundColor:(e.vars||e).palette.primary.main}},"inside"===t&&{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / 0.1)`:tm(e.palette.primary.main,.1)})),tB=s.memo(function(e){const{rowId:t,className:n}=e,r=pI(mL(),Jj,t);return r?Xp.jsx(eB,{action:r,className:n}):null}),nB=["selected","rowId","row","index","style","rowHeight","className","visibleColumns","pinnedColumns","offsetLeft","columnsTotalWidth","firstColumnIndex","lastColumnIndex","focusedColumnIndex","isFirstVisible","isLastVisible","isNotVisible","showBottomBorder","scrollbarWidth","gridHasFiller","onClick","onDoubleClick","onMouseEnter","onMouseLeave","onMouseOut","onMouseOver"],rB=eT(WL,(e,{rowReordering:t,treeData:n})=>{if(!t||n)return!1;return!!pD(e)}),oB=TR(function(e,t){const{selected:n,rowId:r,row:o,index:i,style:a,rowHeight:l,className:c,visibleColumns:u,pinnedColumns:p,offsetLeft:h,columnsTotalWidth:m,firstColumnIndex:g,lastColumnIndex:v,focusedColumnIndex:b,isFirstVisible:y,isLastVisible:w,isNotVisible:x,showBottomBorder:S,scrollbarWidth:C,gridHasFiller:k,onClick:E,onDoubleClick:R,onMouseEnter:P,onMouseLeave:M,onMouseOut:T,onMouseOver:I}=e,O=d(e,nB),D=mL(),F=jO(),L=s.useRef(null),A=rP(),N=sN(D),$=pI(D,gD),z=pI(D,hO),j=A.rowReordering,B=A.treeData,_=pI(D,rB,{rowReordering:j,treeData:B}),H=pI(D,Qj),V=Tg(L,t),W=ST(D,r),U=pI(D,UL,{rowId:r,editMode:A.editMode}),G=A.editMode===$I.Row,K=void 0!==b,q=K&&b>=p.left.length&&b<g,Y=K&&b<u.length-p.right.length&&b>=v,X=function(e,t){return wm(t,YT,e)}(A.classes,{root:["row",n&&"selected",G&&"row--editable",U&&"row--editing",y&&"row--firstVisible",w&&"row--lastVisible",S&&"row--borderBottom","auto"===l&&"row--dynamicHeight"]}),Q=F.hooks.useGridRowAriaAttributes();s.useLayoutEffect(()=>{if(N.range){const e=D.current.getRowIndexRelativeToVisibleRows(r);void 0!==e&&D.current.unstable_setLastMeasuredRowIndex(e)}if(L.current&&"auto"===l)return D.current.observeRowHeight(L.current,r)},[D,N.range,l,r]);const Z=s.useCallback((e,t)=>n=>{v$(n)||D.current.getRow(r)&&(D.current.publishEvent(e,D.current.getRowParams(r),n),t&&t(n))},[D,r]),J=s.useCallback(e=>{const t=h$(e.target,XT.cell),n=t?.getAttribute("data-field");if(n){if(n===wF.field)return;if(n===tD)return;if("__reorder__"===n)return;if(D.current.getCellMode(r,n)===zI.Edit)return;const e=D.current.getColumn(n);if(e?.type===ZO)return}Z("rowClick",E)(e)},[D,E,Z,r]),{slots:ee,slotProps:te,disableColumnReorder:ne}=A,re=pI(D,()=>f({},D.current.getRowHeightEntry(r)),void 0,lI),oe=s.useMemo(()=>{if(x)return{opacity:0,width:0,height:0};const e=f({},a,{maxHeight:"auto"===l?"none":l,minHeight:l,"--height":"number"==typeof l?`${l}px`:l});if(re.spacingTop){e["border"===A.rowSpacingType?"borderTopWidth":"marginTop"]=re.spacingTop}if(re.spacingBottom){const t="border"===A.rowSpacingType?"borderBottomWidth":"marginBottom";let n=e[t];"number"!=typeof n&&(n=parseInt(n||"0",10)),n+=re.spacingBottom,e[t]=n}return e},[x,l,a,re.spacingTop,re.spacingBottom,A.rowSpacingType]);if(!W)return null;const ie=D.current.unstable_applyPipeProcessors("rowClassName",[],r),ae=Q(W,i);if("function"==typeof A.getRowClassName){const e=i-(N.range?.firstRowIndex||0),t=f({},D.current.getRowParams(r),{isFirstVisible:0===e,isLastVisible:e===N.rows.length-1,indexRelativeToCurrentPage:e});ie.push(A.getRowClassName(t))}const le=(e,t,n,i,a=nD.NONE)=>{const s=D.current.unstable_getCellColSpanInfo(r,n);if(s?.spannedByColSpan)return null;const c=s?.cellProps.width??e.computedWidth,u=s?.cellProps.colSpan??1,d=Fj(a,e.computedWidth,n,z,m,C);if("skeletonRow"===W.type)return Xp.jsx(ee.skeletonCell,{type:e.type,width:c,height:l,field:e.field,align:e.align},e.field);const p="__reorder__"===e.field,h=!(ne||e.disableReorder),g=_&&!$.length,v=!(h||p&&g||H),b=a===nD.VIRTUAL,y=Aj(a,t,A.showCellVerticalBorder,A.pinnedColumnsSectionSeparator),w=Lj(a,t,i,A.showCellVerticalBorder,k,A.pinnedColumnsSectionSeparator);return Xp.jsx(ee.cell,f({column:e,width:c,rowId:r,align:e.align||"left",colIndex:n,colSpan:u,disableDragEvents:v,isNotVisible:b,pinnedOffset:d,pinnedPosition:a,showLeftBorder:y,showRightBorder:w,row:o,rowNode:W},te?.cell),e.field)},se=p.left.map((e,t)=>le(e,t,t,p.left.length,nD.LEFT)),ce=p.right.map((e,t)=>{const n=u.length-p.right.length+t;return le(e,t,n,p.right.length,nD.RIGHT)}),ue=u.length-p.left.length-p.right.length,de=[];q&&de.push(le(u[b],b-p.left.length,b,ue,nD.VIRTUAL));for(let e=g;e<v;e+=1){const t=u[e],n=e-p.left.length;t&&de.push(le(t,n,e,ue))}Y&&de.push(le(u[b],b-p.left.length,b,ue,nD.VIRTUAL));const pe=o?{onClick:J,onDoubleClick:Z("rowDoubleClick",R),onMouseEnter:Z("rowMouseEnter",P),onMouseLeave:Z("rowMouseLeave",M),onMouseOut:Z("rowMouseOut",T),onMouseOver:Z("rowMouseOver",I)}:null;return Xp.jsxs("div",f({"data-id":r,"data-rowindex":i,role:"row",className:PR(...ie,X.root,c),style:oe},ae,pe,O,{ref:V,children:[se,Xp.jsx("div",{role:"presentation",className:XT.cellOffsetLeft,style:{width:h}}),de,Xp.jsx("div",{role:"presentation",className:PR(XT.cell,XT.cellEmpty)}),ce,Xp.jsx(tB,{rowId:r})]}))}),iB=KT(oB);function aB({privateApiRef:e,configuration:t,props:n,children:r}){const o=s.useRef(e.current.getPublicApi());return Xp.jsx(zO.Provider,{value:t,children:Xp.jsx(nP.Provider,{value:n,children:Xp.jsx(hL.Provider,{value:e,children:Xp.jsx(aP.Provider,{value:o,children:Xp.jsx(GN,{children:Xp.jsx(HO,{children:r})})})})})})}const lB=function(){try{const e="__some_random_key_you_are_not_going_to_use__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}()&&null!=window.localStorage.getItem("DEBUG"),sB=()=>{},cB={debug:sB,info:sB,warn:sB,error:sB},uB=["debug","info","warn","error"];function dB(e,t,n=console){const r=uB.indexOf(t);if(-1===r)throw new Error(`MUI X: Log level ${t} not recognized.`);return uB.reduce((t,o,i)=>(t[o]=i>=r?(...t)=>{const[r,...i]=t;n[o](`MUI X: ${e} - ${r}`,...i)}:sB,t),{})}let pB=function(e){return e.DataSource="dataSource",e.RowTree="rowTree",e}({});const fB=(e,t,n,r)=>{const o=s.useCallback(()=>{e.current.registerStrategyProcessor(t,n,r)},[e,r,n,t]);wL(()=>{o()});const i=s.useRef(!0);s.useEffect(()=>{i.current?i.current=!1:o()},[o])},hB="none",mB={dataSourceRowsUpdate:pB.DataSource,rowTreeCreation:pB.RowTree,filtering:pB.RowTree,sorting:pB.RowTree,visibleRowsLookupCreation:pB.RowTree},gB=(e,t)=>f({},e,{props:{listView:t.listView,getRowId:t.getRowId,isCellEditable:t.isCellEditable}}),vB=(e,t)=>{(e=>{const t=s.useRef(null),n=s.useRef(null),r=s.useRef(null),o=s.useRef(null),i=s.useRef(null),a=s.useRef(null);e.current.register("public",{rootElementRef:t}),e.current.register("private",{mainElementRef:n,virtualScrollerRef:r,virtualScrollbarVerticalRef:o,virtualScrollbarHorizontalRef:i,columnHeadersContainerRef:a})})(e),((e,t)=>{const n=s.useRef(!0);s.useEffect(()=>{n.current?n.current=!1:e.current.setState(e=>f({},e,{props:{listView:t.listView,getRowId:t.getRowId,isCellEditable:t.isCellEditable,isRowSelectable:t.isRowSelectable}}))},[e,t.listView,t.getRowId,t.isCellEditable,t.isRowSelectable])})(e,t),(e=>{const t=um();void 0===e.current.state.isRtl&&(e.current.state.isRtl=t);const n=s.useRef(!0);s.useEffect(()=>{n.current?n.current=!1:e.current.setState(e=>f({},e,{isRtl:t}))},[e,t])})(e),((e,t)=>{vL(e,{getLogger:s.useCallback(e=>lB?dB(e,"debug",t.logger):t.logLevel?dB(e,t.logLevel.toString(),t.logger):cB,[t.logLevel,t.logger])},"private")})(e,t),(e=>{const t=s.useRef({}),n=s.useCallback(e=>{t.current[e.stateId]=e},[]),r=s.useCallback((n,r)=>{let o;if(o="function"==typeof n?n(e.current.state):n,e.current.state===o)return!1;const i={current:{state:o}};let a=!1;const l=[];if(Object.keys(t.current).forEach(n=>{const r=t.current[n],o=r.stateSelector(e),s=r.stateSelector(i);s!==o&&(l.push({stateId:r.stateId,hasPropChanged:s!==r.propModel}),void 0!==r.propModel&&s!==r.propModel&&(a=!0))}),l.length>1)throw new Error(`You're not allowed to update several sub-state in one transaction. You already updated ${l[0].stateId}, therefore, you're not allowed to update ${l.map(e=>e.stateId).join(", ")} in the same transaction.`);if(a||(e.current.state=o,e.current.publishEvent("stateChange",o),e.current.store.update(o)),1===l.length){const{stateId:n,hasPropChanged:o}=l[0],s=t.current[n],c=s.stateSelector(i);s.propOnChange&&o&&s.propOnChange(c,{reason:r,api:e.current}),a||e.current.publishEvent(s.changeEvent,c,{reason:r})}return!a},[e]),o=s.useCallback((t,n,r)=>e.current.setState(e=>f({},e,{[t]:n(e[t])}),r),[e]),i={updateControlState:o,registerControlState:n};vL(e,{setState:r},"public"),vL(e,i,"private")})(e),(e=>{const t=s.useRef({}),n=s.useRef(!1),r=s.useCallback(e=>{!n.current&&e&&(n.current=!0,Object.values(e.appliers).forEach(e=>{e()}),n.current=!1)},[]),o=s.useCallback((e,n,r)=>{t.current[e]||(t.current[e]={processors:new Map,processorsAsArray:[],appliers:{},processorsUpdated:!1});const o=t.current[e];return o.processors.get(n)!==r&&(o.processors.set(n,r),o.processorsAsArray=Array.from(t.current[e].processors.values()).filter(e=>null!==e),o.processorsUpdated=!0),()=>{t.current[e].processors.set(n,null),t.current[e].processorsAsArray=Array.from(t.current[e].processors.values()).filter(e=>null!==e)}},[]),i=s.useCallback((e,n,r)=>(t.current[e]||(t.current[e]={processors:new Map,processorsAsArray:[],appliers:{},processorsUpdated:!1}),t.current[e].appliers[n]=r,()=>{const r=d(t.current[e].appliers,[n].map(T));t.current[e].appliers=r}),[]),a=s.useCallback(e=>{r(t.current[e])},[r]),l=s.useCallback(()=>{for(const e in t.current){if(!Object.prototype.hasOwnProperty.call(t.current,e))continue;const n=t.current[e];n.processorsUpdated&&(n.processorsUpdated=!1,r(n))}},[r]),c={unstable_applyPipeProcessors:s.useCallback((...e)=>{const[n,r,o]=e;if(!t.current[n])return r;const i=t.current[n].processorsAsArray;let a=r;for(let e=0;e<i.length;e+=1)a=i[e](a,o);return a},[])};vL(e,{registerPipeProcessor:o,registerPipeApplier:i,requestPipeProcessorsApplication:a,runAppliersForPendingProcessors:l},"private"),vL(e,c,"public")})(e),(e=>{const t=s.useRef(new Map),n=s.useRef({}),r=s.useCallback((t,r,o)=>{const i=()=>{const e=d(n.current[r],[t].map(T));n.current[r]=e};n.current[r]||(n.current[r]={});const a=n.current[r],l=a[t];return a[t]=o,l&&l!==o?(t===e.current.getActiveStrategy(mB[r])&&e.current.publishEvent("activeStrategyProcessorChange",r),i):i},[e]),o=s.useCallback((t,r)=>{const o=e.current.getActiveStrategy(mB[t]);if(null==o)throw new Error("Can't apply a strategy processor before defining an active strategy");const i=n.current[t];if(!i||!i[o])throw new Error(`No processor found for processor "${t}" on strategy "${o}"`);return(0,i[o])(r)},[e]),i=s.useCallback(e=>{const n=Array.from(t.current.entries()).find(([,t])=>t.group===e&&t.isAvailable());return n?.[0]??hB},[]),a=s.useCallback((n,r,o)=>{t.current.set(r,{group:n,isAvailable:o}),e.current.publishEvent("strategyAvailabilityChange")},[e]);vL(e,{registerStrategyProcessor:r,applyStrategyProcessor:o,getActiveStrategy:i,setStrategyAvailability:a},"private")})(e),((e,t)=>{const n=s.useCallback(e=>{if(null==t.localeText[e])throw new Error(`Missing translation for key ${e}.`);return t.localeText[e]},[t.localeText]);e.current.register("public",{getLocaleText:n})})(e,t),e.current.register("private",{rootProps:t})},bB=(e,t,n,r)=>{const o=s.useRef(r),i=s.useRef(!1);r!==o.current&&(i.current=!1,o.current=r),i.current||(t.current.state=e(t.current.state,n,t),i.current=!0)};function yB(e,t){if(null==e)return"";const n="string"==typeof e?e:`${e}`;if(t.shouldAppendQuotes||t.escapeFormulas){const e=n.replace(/"/g,'""');return t.escapeFormulas&&["=","+","-","@","\t","\r"].includes(e[0])?`"'${e}"`:[t.delimiter,"\n","\r",'"'].some(e=>n.includes(e))?`"${e}"`:e}return n}const wB=(e,t)=>{const{csvOptions:n,ignoreValueFormatter:r}=t;let o;if(r){const t=e.colDef.type;o="number"===t?String(e.value):"date"===t||"dateTime"===t?e.value?.toISOString():"function"==typeof e.value?.toString?e.value.toString():e.value}else o=e.formattedValue;return yB(o,n)};class xB{rowString="";isEmpty=!0;constructor(e){this.options=e}addValue(e){this.isEmpty||(this.rowString+=this.options.csvOptions.delimiter),"function"==typeof this.options.sanitizeCellValue?this.rowString+=this.options.sanitizeCellValue(e,this.options.csvOptions):this.rowString+=e,this.isEmpty=!1}getRowString(){return this.rowString}}function SB(e){const{columns:t,rowIds:n,csvOptions:r,ignoreValueFormatter:o,apiRef:i}=e,a=n.reduce((e,n)=>`${e}${(({id:e,columns:t,getCellParams:n,csvOptions:r,ignoreValueFormatter:o})=>{const i=new xB({csvOptions:r});return t.forEach(t=>{const a=n(e,t.field);String(a.formattedValue),i.addValue(wB(a,{ignoreValueFormatter:o,csvOptions:r}))}),i.getRowString()})({id:n,columns:t,getCellParams:i.current.getCellParams,ignoreValueFormatter:o,csvOptions:r})}\r\n`,"").trim();if(!r.includeHeaders)return a;const l=t.filter(e=>e.field!==wF.field),s=[];if(r.includeColumnGroupsHeaders){const e=i.current.getAllGroupDetails();let t=0;const n=l.reduce((e,n)=>{const r=i.current.getColumnGroupPath(n.field);return e[n.field]=r,t=Math.max(t,r.length),e},{});for(let o=0;o<t;o+=1){const t=new xB({csvOptions:r,sanitizeCellValue:yB});s.push(t),l.forEach(r=>{const i=(n[r.field]||[])[o],a=e[i];t.addValue(a?a.headerName||a.groupId:"")})}}const c=new xB({csvOptions:r,sanitizeCellValue:yB});l.forEach(e=>{c.addValue(e.headerName||e.field)}),s.push(c);return`${`${s.map(e=>e.getRowString()).join("\r\n")}\r\n`}${a}`.trim()}function CB(e){const t=document.createElement("span");t.style.whiteSpace="pre",t.style.userSelect="all",t.style.opacity="0px",t.textContent=e,document.body.appendChild(t);const n=document.createRange();n.selectNode(t);const r=window.getSelection();r.removeAllRanges(),r.addRange(n);try{document.execCommand("copy")}finally{document.body.removeChild(t)}}const kB=(e,t)=>{const n=t.ignoreValueFormatterDuringExport,r=("object"==typeof n?n?.clipboardExport:n)||!1,o=t.clipboardCopyCellDelimiter,i=s.useCallback(t=>{if(!function(e){return(e.ctrlKey||e.metaKey)&&"C"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey}(t))return;if(n=t.target,window.getSelection()?.toString()||n&&(n.selectionEnd||0)-(n.selectionStart||0)>0)return;var n;let i="";if(ND(e)>0)i=e.current.getDataAsCsv({includeHeaders:!1,delimiter:o,shouldAppendQuotes:!1,escapeFormulas:!1});else{const t=YD(e);if(t){const n=e.current.getCellParams(t.id,t.field);i=wB(n,{csvOptions:{delimiter:o,shouldAppendQuotes:!1,escapeFormulas:!1},ignoreValueFormatter:r})}}var a;i=e.current.unstable_applyPipeProcessors("clipboardCopy",i),i&&(a=i,navigator.clipboard?navigator.clipboard.writeText(a).catch(()=>{CB(a)}):CB(a),e.current.publishEvent("clipboardCopy",i))},[e,r,o]);yL(e,()=>e.current.rootElementRef.current,"keydown",i),iI(e,"clipboardCopy",t.onClipboardCopy)},EB=e=>f({},e,{columnMenu:{open:!1}}),RB=(e,t,n)=>{n.current.caches.columns={lastColumnsProp:t.columns};return f({},e,{columns:aL({apiRef:n,columnsToUpsert:t.columns,initialState:t.initialState?.columns,columnVisibilityModel:t.columnVisibilityModel??t.initialState?.columns?.columnVisibilityModel??{},keepOnlyColumnsToUpsert:!0}),pinnedColumns:e.pinnedColumns??JI})};function PB(e,t){const n=bL(e,"useGridColumns");e.current.registerControlState({stateId:"visibleColumns",propModel:t.columnVisibilityModel,propOnChange:t.onColumnVisibilityModelChange,stateSelector:lO,changeEvent:"columnVisibilityModelChange"});const r=s.useCallback(t=>{n.debug("Updating columns state."),e.current.setState(function(e){return t=>f({},t,{columns:e})}(t)),e.current.publishEvent("columnsChange",t.orderedFields)},[n,e]),o=s.useCallback(t=>iO(e)[t],[e]),i=s.useCallback(()=>aO(e),[e]),a=s.useCallback(()=>cO(e),[e]),l=s.useCallback((t,n=!0)=>(n?cO(e):aO(e)).findIndex(e=>e.field===t),[e]),c=s.useCallback(t=>{const n=l(t);return hO(e)[n]},[e,l]),u=s.useCallback(t=>{lO(e)!==t&&(e.current.setState(n=>f({},n,{columns:aL({apiRef:e,columnsToUpsert:[],initialState:void 0,columnVisibilityModel:t,keepOnlyColumnsToUpsert:!1})})),e.current.updateRenderContext?.())},[e]),d=s.useCallback(t=>{let n=t;if(SL(e)){const r=[],o=[],i=kL(e);if(t.forEach(e=>{i.has(e.field)?r.push(e):o.push(e)}),r.length>0&&e.current.updateNonPivotColumns(r),0===o.length)return;n=o}const o=aL({apiRef:e,columnsToUpsert:n,initialState:void 0,keepOnlyColumnsToUpsert:!1,updateInitialVisibilityModel:!0});r(o)},[e,r]),p=s.useCallback((t,n)=>{const r=lO(e);if(n!==(r[t]??!0)){const o=f({},r,{[t]:n});e.current.setColumnVisibilityModel(o)}},[e]),h=s.useCallback(t=>oO(e).findIndex(e=>e===t),[e]),m=s.useCallback((t,o)=>{const i=oO(e),a=h(t);if(a===o)return;n.debug(`Moving column ${t} to index ${o}`);const l=[...i],s=l.splice(a,1)[0];l.splice(o,0,s),r(f({},rO(e),{orderedFields:l}));const c={column:e.current.getColumn(t),targetIndex:e.current.getColumnIndexRelativeToVisibleColumns(t),oldIndex:a};e.current.publishEvent("columnIndexChange",c)},[e,n,r,h]),g=s.useCallback((t,o)=>{n.debug(`Updating column ${t} width to ${o}`);const i=rO(e),a=f({},i.lookup[t],{width:o,hasBeenResized:!0});r(oL(f({},i,{lookup:f({},i.lookup,{[t]:a})}),e.current.getRootDimensions())),e.current.publishEvent("columnWidthChange",{element:e.current.getColumnHeaderElement(t),colDef:a,width:o})},[e,n,r]),v={setColumnIndex:m};vL(e,{getColumn:o,getAllColumns:i,getColumnIndex:l,getColumnPosition:c,getVisibleColumns:a,getColumnIndexRelativeToVisibleColumns:h,updateColumns:d,setColumnVisibilityModel:u,setColumnVisibility:p,setColumnWidth:g},"public"),vL(e,v,t.signature===QT.DataGrid?"private":"public");const b=s.useCallback((n,r)=>{const o={},i=lO(e);(!r.exportOnlyDirtyModels||null!=t.columnVisibilityModel||Object.keys(t.initialState?.columns?.columnVisibilityModel??{}).length>0||Object.keys(i).length>0)&&(o.columnVisibilityModel=i),o.orderedFields=oO(e);const a=aO(e),l={};return a.forEach(e=>{if(e.hasBeenResized){const t={};nL.forEach(n=>{let r=e[n];r===1/0&&(r=-1),t[n]=r}),l[e.field]=t}}),Object.keys(l).length>0&&(o.dimensions=l),f({},n,{columns:o})},[e,t.columnVisibilityModel,t.initialState?.columns]),y=s.useCallback((t,n)=>{const r=n.stateToRestore.columns,o=r?.columnVisibilityModel;if(null==r)return t;const i=aL({apiRef:e,columnsToUpsert:[],initialState:r,columnVisibilityModel:o,keepOnlyColumnsToUpsert:!1});return null!=r&&e.current.setState(e=>f({},e,{columns:f({},e.columns,{lookup:i.lookup,orderedFields:i.orderedFields,initialColumnVisibilityModel:i.initialColumnVisibilityModel})})),null!=o&&e.current.setState(e=>f({},e,{columns:f({},e.columns,{columnVisibilityModel:o})})),null!=r&&e.current.publishEvent("columnsChange",i.orderedFields),t},[e]),w=s.useCallback((e,n)=>{if(n===YL.columns){const e=t.slots.columnsPanel;return Xp.jsx(e,f({},t.slotProps?.columnsPanel))}return e},[t.slots.columnsPanel,t.slotProps?.columnsPanel]),x=s.useCallback(n=>{const r=SL(e);return t.disableColumnSelector||r?n:[...n,"columnMenuColumnsItem"]},[t.disableColumnSelector,e]);pN(e,"columnMenu",x),pN(e,"exportState",b),pN(e,"restoreState",y),pN(e,"preferencePanel",w);const S=s.useRef(null);rI(e,"viewportInnerSizeChange",t=>{if(S.current!==t.width){S.current=t.width;if(!cO(e).some(e=>e.flex&&e.flex>0))return;r(oL(rO(e),e.current.getRootDimensions()))}});const C=s.useCallback(()=>{n.info("Columns pipe processing have changed, regenerating the columns");const t=aL({apiRef:e,columnsToUpsert:[],initialState:void 0,keepOnlyColumnsToUpsert:!1});r(t)},[e,n,r]);fN(e,"hydrateColumns",C),s.useEffect(()=>{if(e.current.caches.columns.lastColumnsProp===t.columns)return;e.current.caches.columns.lastColumnsProp=t.columns,n.info(`GridColumns have changed, new length ${t.columns.length}`);const o=aL({apiRef:e,initialState:void 0,columnsToUpsert:t.columns,keepOnlyColumnsToUpsert:!0,updateInitialVisibilityModel:!0,columnVisibilityModel:t.columnVisibilityModel});r(o)},[n,e,r,t.columns,t.columnVisibilityModel]),s.useEffect(()=>{void 0!==t.columnVisibilityModel&&e.current.setColumnVisibilityModel(t.columnVisibilityModel)},[e,n,t.columnVisibilityModel])}const MB=(e,t)=>f({},e,{density:t.initialState?.density??t.density??"standard"});const TB=({apiRef:e,options:t})=>{const n=aO(e);if(t.fields)return t.fields.reduce((e,t)=>{const r=n.find(e=>e.field===t);return r&&e.push(r),e},[]);return(t.allColumns?n:cO(e)).filter(e=>!0!==e.disableExport)},IB=({apiRef:e})=>{const t=RD(e),n=xT(e),r=ND(e),o=t.filter(e=>"footer"!==n[e].type),i=TT(e),a=i?.top?.map(e=>e.id)||[],l=i?.bottom?.map(e=>e.id)||[];if(o.unshift(...a),o.push(...l),r>0){const t=$D(e);return o.filter(e=>t.has(e))}return o},OB=(e,t)=>{const n=bL(e,"useGridCsvExport"),r=t.ignoreValueFormatterDuringExport,o=("object"==typeof r?r?.csvExport:r)||!1,i=s.useCallback((t={})=>{n.debug("Get data as CSV");return SB({columns:TB({apiRef:e,options:t}),rowIds:(t.getRowsToExport??IB)({apiRef:e}),csvOptions:{delimiter:t.delimiter||",",shouldAppendQuotes:t.shouldAppendQuotes??!0,includeHeaders:t.includeHeaders??!0,includeColumnGroupsHeaders:t.includeColumnGroupsHeaders??!0,escapeFormulas:t.escapeFormulas??!0},ignoreValueFormatter:o,apiRef:e})},[n,e,o]),a=s.useCallback(e=>{n.debug("Export data as CSV");const t=i(e);!function(e,t="csv",n=document.title||"untitled"){const r=`${n}.${t}`;if("download"in HTMLAnchorElement.prototype){const t=URL.createObjectURL(e),n=document.createElement("a");return n.href=t,n.download=r,n.click(),void setTimeout(()=>{URL.revokeObjectURL(t)})}throw new Error("MUI X: exportAs not supported.")}(new Blob([e?.utf8WithBom?new Uint8Array([239,187,191]):"",t],{type:"text/csv"}),"csv",e?.fileName)},[n,i]);vL(e,{getDataAsCsv:i,exportDataAsCsv:a},"public");const l=s.useCallback((e,t)=>t.csvOptions?.disableToolbarButton?e:[...e,{component:Xp.jsx(Kz,{options:t.csvOptions}),componentName:"csvExport"}],[]);pN(e,"exportMenu",l)};const DB=(e,t,n)=>{let r=e.paginationModel;const o=e.rowCount,i=n?.pageSize??r.pageSize,a=n?.page??r.page,l=nF(o,i,a);!n||n?.page===r.page&&n?.pageSize===r.pageSize||(r=n);const s=-1===i?0:((e,t=0)=>0===t?e:Math.max(Math.min(e,t-1),0))(r.page,l);return s!==r.page&&(r=f({},r,{page:s})),oF(r.pageSize,t),r};const FB=(e,t)=>{const n=null!==e.current.rootElementRef.current,r=bL(e,"useGridPrintExport"),o=s.useRef(null),i=s.useRef(null),a=s.useRef({}),l=s.useRef([]),c=s.useRef(null);s.useEffect(()=>{o.current=kg(e.current.rootElementRef.current)},[e,n]);const u=s.useCallback((t,n,r)=>new Promise(o=>{const i=TB({apiRef:e,options:{fields:t,allColumns:n}}).map(e=>e.field),a=aO(e),l={};a.forEach(e=>{l[e.field]=i.includes(e.field)}),r&&(l[wF.field]=!0),e.current.setColumnVisibilityModel(l),o()}),[e]),d=s.useCallback(t=>{const n=t({apiRef:e}).reduce((t,n)=>{const r=e.current.getRow(n);return r[DT]||t.push(r),t},[]);e.current.setRows(n)},[e]),p=s.useCallback((t,n)=>{const r=f({copyStyles:!0,hideToolbar:!1,hideFooter:!1,includeCheckboxes:!1},n),i=t.contentDocument;if(!i)return;const a=e.current.rootElementRef.current,l=a.cloneNode(!0),s=l.querySelector(`.${XT.virtualScrollerContent}`);if(l.querySelector(`.${XT.main}`).style.overflow="visible",l.querySelector(`.${XT.virtualScrollerRenderZone}`).style.position="static",s.style.flexBasis="auto",l.querySelector(`.${XT["scrollbar--vertical"]}`)?.remove(),!(s.nextSibling instanceof HTMLElement&&s.nextSibling.classList.contains(XT.filler))){const e=document.createElement("div");e.style.height=XA,s.insertAdjacentElement("afterend",e)}const c=l.querySelector(`.${XT.footerContainer}`);r.hideToolbar&&l.querySelector(`.${XT.toolbar}`)?.remove(),r.hideFooter&&c&&c.remove(),l.style.height="auto",l.style.boxSizing="content-box",!r.hideFooter&&c&&(c.style.width="100%");const u=document.createElement("div");u.appendChild(l),i.body.style.marginTop="0px",i.body.innerHTML=u.innerHTML;const d="function"==typeof r.pageStyle?r.pageStyle():r.pageStyle;if("string"==typeof d){const e=i.createElement("style");e.appendChild(i.createTextNode(d)),i.head.appendChild(e)}r.bodyClassName&&i.body.classList.add(...r.bodyClassName.split(" "));let p=[];if(r.copyStyles){const e=a.getRootNode();p=function(e,t){const n=[],r=t.querySelectorAll("style, link[rel='stylesheet']");for(let t=0;t<r.length;t+=1){const o=r[t],i=e.createElement(o.tagName);if("STYLE"===o.tagName){const t=o.sheet;if(t){let n="";for(let e=0;e<t.cssRules.length;e+=1)"string"==typeof t.cssRules[e].cssText&&(n+=`${t.cssRules[e].cssText}\r\n`);i.appendChild(e.createTextNode(n))}}else if(o.getAttribute("href")){for(let e=0;e<o.attributes.length;e+=1){const t=o.attributes[e];t&&i.setAttribute(t.nodeName,t.nodeValue||"")}n.push(new Promise(e=>{i.addEventListener("load",()=>e())}))}e.head.appendChild(i)}return n}(i,"ShadowRoot"===e.constructor.name?e:o.current)}Promise.all(p).then(()=>{t.contentWindow.print()})},[e,o]),h=s.useCallback(t=>{o.current.body.removeChild(t),e.current.restoreState(i.current||{}),i.current?.columns?.columnVisibilityModel||e.current.setColumnVisibilityModel(a.current),e.current.setState(e=>f({},e,{virtualization:c.current})),e.current.setRows(l.current),i.current=null,a.current={},l.current=[]},[e]),m=s.useCallback(async n=>{if(r.debug("Export data as Print"),!e.current.rootElementRef.current)throw new Error("MUI X: No grid root element available.");if(i.current=e.current.exportState(),a.current=lO(e),l.current=e.current.getSortedRows().filter(e=>!e[DT]),t.pagination){const t={page:0,pageSize:MD(e)};e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,"DataGridPro",t)})}))}c.current=e.current.state.virtualization,e.current.unstable_setVirtualization(!1),await u(n?.fields,n?.allColumns,n?.includeCheckboxes),d(n?.getRowsToExport??IB),await new Promise(e=>{requestAnimationFrame(()=>{e()})});const s=function(e){const t=document.createElement("iframe");return t.style.position="absolute",t.style.width="0px",t.style.height="0px",t.title=e||document.title,t}(n?.fileName);s.onload=()=>{p(s,n);s.contentWindow.matchMedia("print").addEventListener("change",e=>{!1===e.matches&&h(s)})},o.current.body.appendChild(s)},[t,r,e,p,h,u,d]);vL(e,{exportDataAsPrint:m},"public");const g=s.useCallback((e,t)=>t.printOptions?.disableToolbarButton?e:[...e,{component:Xp.jsx(qz,{options:t.printOptions}),componentName:"printExport"}],[]);pN(e,"exportMenu",g)},LB=(e,t,n)=>{const r=t.filterModel??t.initialState?.filter?.filterModel??XI();return f({},e,{filter:f({filterModel:wO(r,t.disableMultipleColumnsFiltering,n)},YI),visibleRowsLookup:{}})},AB=e=>e.filteredRowsLookup;function NB(e,t){return e.current.applyStrategyProcessor("visibleRowsLookupCreation",{tree:t.rows.tree,filteredRowsLookup:t.filter.filteredRowsLookup})}function $B(){return PM(Object.values)}const zB=e=>f({},e,{focus:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null},tabIndex:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}}),jB=({currentColIndex:e,firstColIndex:t,lastColIndex:n,isRtl:r})=>{if(r){if(e<n)return e+1}else if(!r&&e>t)return e-1;return null},BB=({currentColIndex:e,firstColIndex:t,lastColIndex:n,isRtl:r})=>{if(r){if(e>t)return e-1}else if(!r&&e<n)return e+1;return null};const _B=tT(gF,TT,(e,t)=>(t.top||[]).concat(e.rows,t.bottom||[])),HB=(e,t)=>{const n=bL(e,"useGridKeyboardNavigation"),r=um(),o=s.useCallback(()=>_B(e),[e]),i="DataGrid"!==t.signature&&t.headerFilters,a=s.useCallback((t,r,o="left",i="up")=>{const a=CD(e),l=e.current.unstable_getCellColSpanInfo(r,t);l&&l.spannedByColSpan&&("left"===o?t=l.leftVisibleCellIndex:"right"===o&&(t=l.rightVisibleCellIndex));const s=uO(e)[t],c=function(e,t,n,r){const o=AA.selectors.hiddenCells(e.current.virtualizer.store.state);if(!o[t]?.[n])return t;const i=RD(e);let a=i.indexOf(t)+("down"===r?1:-1);for(;a>=0&&a<i.length;){const e=i[a];if(!o[e]?.[n])return e;a+="down"===r?1:-1}return t}(e,r,t,i),u=a.findIndex(e=>e.id===c);n.debug(`Navigating to cell row ${u}, col ${t}`),e.current.scrollToIndexes({colIndex:t,rowIndex:u}),e.current.setCellFocus(c,s)},[e,n]),l=s.useCallback((t,r)=>{n.debug(`Navigating to header col ${t}`),e.current.scrollToIndexes({colIndex:t});const o=e.current.getVisibleColumns()[t].field;e.current.setColumnHeaderFocus(o,r)},[e,n]),c=s.useCallback((t,r)=>{n.debug(`Navigating to header filter col ${t}`),e.current.scrollToIndexes({colIndex:t});const o=e.current.getVisibleColumns()[t].field;e.current.setColumnHeaderFilterFocus(o,r)},[e,n]),u=s.useCallback((t,r,o)=>{n.debug(`Navigating to header col ${t}`),e.current.scrollToIndexes({colIndex:t});const{field:i}=e.current.getVisibleColumns()[t];e.current.setColumnGroupHeaderFocus(i,r,o)},[e,n]),d=s.useCallback(e=>o()[e]?.id,[o]),p=s.useCallback((n,s)=>{const p=s.currentTarget.querySelector(`.${XT.columnHeaderTitleContainerContent}`);if(!!p&&p.contains(s.target)&&n.field!==wF.field)return;if(!AO(s.key)&&"Tab"!==s.key)return;if("Tab"===s.key&&("none"===t.tabNavigation||"content"===t.tabNavigation&&s.shiftKey))return;const f=o(),h=e.current.getViewportPageSize(),m=n.field?e.current.getColumnIndex(n.field):0,g=f.length>0?0:null,v=f.length>0?f.length-1:null,b=Math.max(0,cO(e).length-1),y=tL(e);let w=!0;if("Tab"!==s.key||"content"!==t.tabNavigation||s.shiftKey){switch(s.key){case"ArrowDown":i?c(m,s):null!==g&&a(m,d(g));break;case"ArrowRight":{const e=BB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&l(e,s);break}case"ArrowLeft":{const e=jB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&l(e,s);break}case"ArrowUp":y>0&&u(m,y-1,s);break;case"PageDown":null!==g&&null!==v&&a(m,d(Math.min(g+h,v)));break;case"Home":l(0,s);break;case"End":l(b,s);break;case"Enter":(s.ctrlKey||s.metaKey)&&e.current.toggleColumnMenu(n.field);break;case"Tab":s.shiftKey?0===m?y>0?u(b,y-1,s):w=!1:l(m-1,s):m===b?i?c(0,s):"all"===t.tabNavigation&&null!==g?a(0,d(g)):w=!1:l(m+1,s);break;case" ":break;default:w=!1}w&&s.preventDefault()}else null!==g&&(a(0,d(g)),s.preventDefault())},[e,t.tabNavigation,o,i,c,a,d,r,l,u]),f=s.useCallback((n,i)=>{const s=YF(e)===n.field;if(XF(e)===n.field||s&&"Tab"!==i.key)return;if(!AO(i.key)&&"Tab"!==i.key)return;if("Tab"===i.key&&("none"===t.tabNavigation||"content"===t.tabNavigation&&i.shiftKey))return;const u=o(),p=e.current.getViewportPageSize(),f=n.field?e.current.getColumnIndex(n.field):0,h=u.length>0?0:null,m=u.length>0?u.length-1:null,g=Math.max(0,cO(e).length-1);let v=!0;if("Tab"!==i.key||"content"!==t.tabNavigation||i.shiftKey){switch(i.key){case"ArrowDown":null!==h&&a(f,d(h));break;case"ArrowRight":{const e=BB({currentColIndex:f,firstColIndex:0,lastColIndex:g,isRtl:r});null!==e&&c(e,i);break}case"ArrowLeft":{const t=jB({currentColIndex:f,firstColIndex:0,lastColIndex:g,isRtl:r});null!==t?c(t,i):e.current.setColumnHeaderFilterFocus(n.field,i);break}case"ArrowUp":l(f,i);break;case"PageDown":null!==h&&null!==m&&a(f,d(Math.min(h+p,m)));break;case"Home":c(0,i);break;case"End":c(g,i);break;case"Tab":i.shiftKey?0===f?l(g,i):c(f-1,i):f===g?"all"===t.tabNavigation&&null!==h?a(0,d(h)):v=!1:c(f+1,i);break;case" ":break;default:v=!1}v&&i.preventDefault()}else null!==h&&(a(0,d(h)),i.preventDefault())},[e,t.tabNavigation,o,c,r,l,a,d]),h=s.useCallback((n,r)=>{const i=QD(e);if(null===i)return;const{field:s,depth:c}=i,{fields:p,depth:f,maxDepth:h}=n;if(!AO(r.key)&&"Tab"!==r.key)return;if("Tab"===r.key&&("none"===t.tabNavigation||"content"===t.tabNavigation&&r.shiftKey))return;const m=o(),g=e.current.getViewportPageSize(),v=e.current.getColumnIndex(s),b=s?e.current.getColumnIndex(s):0,y=m.length>0?0:null,w=m.length>0?m.length-1:null,x=Math.max(0,cO(e).length-1);let S=!0;if("Tab"!==r.key||"content"!==t.tabNavigation||r.shiftKey){switch(r.key){case"ArrowDown":f===h-1?l(v,r):u(v,c+1,r);break;case"ArrowUp":f>0&&u(v,c-1,r);break;case"ArrowRight":{const e=p.length-p.indexOf(s)-1;v+e+1<=x&&u(v+e+1,c,r);break}case"ArrowLeft":{const e=p.indexOf(s);v-e-1>=0&&u(v-e-1,c,r);break}case"PageDown":null!==y&&null!==w&&a(b,d(Math.min(y+g,w)));break;case"Home":u(0,c,r);break;case"End":u(x,c,r);break;case"Tab":if(r.shiftKey){const e=v-p.indexOf(s)-1;e<0?0===f?S=!1:u(x,c-1,r):u(e,c,r)}else{const e=v+(p.length-p.indexOf(s)-1)+1;e>x&&f===h-1?l(0,r):e>x?u(0,c+1,r):u(e,c,r)}break;case" ":break;default:S=!1}S&&r.preventDefault()}else null!==y&&(a(0,d(y)),r.preventDefault())},[e,t.tabNavigation,o,l,u,a,d]),m=s.useCallback((n,s)=>{if(v$(s))return;const u=e.current.getCellParams(n.id,n.field);if(u.cellMode===zI.Edit||!AO(s.key)&&"Tab"!==s.key)return;if("Tab"===s.key&&("none"===t.tabNavigation||"header"===t.tabNavigation&&!s.shiftKey))return;if(!e.current.unstable_applyPipeProcessors("canUpdateFocus",!0,{event:s,cell:u}))return;const p=o();if(0===p.length)return;const f=i?c:l,h=e.current.getViewportPageSize(),m=n.field?e.current.getColumnIndex(n.field):0,g=p.findIndex(e=>e.id===n.id),v=p.length-1,b=Math.max(0,cO(e).length-1);let y=!0;if("Tab"===s.key&&"header"===t.tabNavigation&&s.shiftKey)return f(b,s),void s.preventDefault();switch(s.key){case"ArrowDown":g<v&&a(m,d(g+1),r?"right":"left","down");break;case"ArrowUp":g>0?a(m,d(g-1)):f(m,s);break;case"ArrowRight":{const e=BB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&a(e,d(g),r?"left":"right");break}case"ArrowLeft":{const e=jB({currentColIndex:m,firstColIndex:0,lastColIndex:b,isRtl:r});null!==e&&a(e,d(g),r?"right":"left");break}case"Tab":s.shiftKey?0===m&&0===g?"all"===t.tabNavigation?f(b,s):y=!1:0===m?a(b,d(g-1)):a(m-1,d(g),"left"):m===b?g!==v?a(0,d(g+1)):y=!1:a(m+1,d(g),"right");break;case" ":{if(n.field===tD)break;const e=n.colDef;if(e&&("__tree_data_group__"===e.field||(e=>e===eD||null!==(e=>{const t=e.match(/^__row_group_by_columns_group_(.*)__$/);return t?t[1]:null})(e))(e.field)))break;!s.shiftKey&&g<v&&a(m,d(Math.min(g+h,v)));break}case"PageDown":g<v&&a(m,d(Math.min(g+h,v)));break;case"PageUp":{const e=Math.max(g-h,0);e!==g&&e>=0?a(m,d(e)):l(m,s);break}case"Home":s.ctrlKey||s.metaKey||s.shiftKey?a(0,d(0)):a(0,d(g));break;case"End":s.ctrlKey||s.metaKey||s.shiftKey?a(b,d(v)):a(b,d(g));break;default:y=!1}y&&s.preventDefault()},[e,t.tabNavigation,o,r,a,d,i,c,l]),g=s.useCallback((e,{event:t})=>" "!==t.key&&e,[]);pN(e,"canStartEditing",g),rI(e,"columnHeaderKeyDown",p),rI(e,"headerFilterKeyDown",f),rI(e,"columnGroupHeaderKeyDown",h),rI(e,"cellKeyDown",m)},VB=(e,t)=>{const n=f({},rF(t.autoPageSize),t.paginationModel??t.initialState?.pagination?.paginationModel);oF(n.pageSize,t.signature);const r=t.rowCount??t.initialState?.pagination?.rowCount??("client"===t.paginationMode?e.rows?.totalRowCount:void 0),o=t.paginationMeta??t.initialState?.pagination?.meta??{};return f({},e,{pagination:f({},e.pagination,{paginationModel:n,rowCount:r,meta:o,enabled:!0===t.pagination,paginationMode:t.paginationMode})})},WB=(e,t)=>{((e,t)=>{const n=bL(e,"useGridPaginationMeta");e.current.registerControlState({stateId:"paginationMeta",propModel:t.paginationMeta,propOnChange:t.onPaginationMetaChange,stateSelector:cF,changeEvent:"paginationMetaChange"});const r=s.useCallback(t=>{cF(e)!==t&&(n.debug("Setting 'paginationMeta' to",t),e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{meta:t})})))},[e,n]);vL(e,{setPaginationMeta:r},"public");const o=s.useCallback((n,r)=>{const o=cF(e);return r.exportOnlyDirtyModels&&null==t.paginationMeta&&null==t.initialState?.pagination?.meta?n:f({},n,{pagination:f({},n.pagination,{meta:o})})},[e,t.paginationMeta,t.initialState?.pagination?.meta]),i=s.useCallback((t,n)=>{const r=n.stateToRestore.pagination?.meta?n.stateToRestore.pagination.meta:cF(e);return e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{meta:r})})),t},[e]);pN(e,"exportState",o),pN(e,"restoreState",i),s.useEffect(()=>{t.paginationMeta&&e.current.setPaginationMeta(t.paginationMeta)},[e,t.paginationMeta])})(e,t),((e,t)=>{const n=bL(e,"useGridPaginationModel"),r=pI(e,mI),o=s.useRef(yD(e)),i=Math.floor(t.rowHeight*r);e.current.registerControlState({stateId:"paginationModel",propModel:t.paginationModel,propOnChange:t.onPaginationModelChange,stateSelector:lF,changeEvent:"paginationModelChange"});const a=s.useCallback(t=>{const r=lF(e);t!==r.page&&(n.debug(`Setting page to ${t}`),e.current.setPaginationModel({page:t,pageSize:r.pageSize}))},[e,n]),l=s.useMemo(()=>Cg(a,0),[a]),c=s.useCallback(t=>{const r=lF(e);t!==r.pageSize&&(n.debug(`Setting page size to ${t}`),e.current.setPaginationModel({pageSize:t,page:r.page}))},[e,n]),u=s.useCallback(r=>{const o=lF(e);r!==o&&(n.debug("Setting 'paginationModel' to",r),e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,t.signature,r)})}),"setPaginationModel"))},[e,n,t.signature]);vL(e,{setPage:a,setPageSize:c,setPaginationModel:u},"public");const d=s.useCallback((n,r)=>{const o=lF(e);return!r.exportOnlyDirtyModels||null!=t.paginationModel||null!=t.initialState?.pagination?.paginationModel||0!==o.page&&o.pageSize!==(t.autoPageSize?0:100)?f({},n,{pagination:f({},n.pagination,{paginationModel:o})}):n},[e,t.paginationModel,t.initialState?.pagination?.paginationModel,t.autoPageSize]),p=s.useCallback((n,r)=>{const o=r.stateToRestore.pagination?.paginationModel?f({},rF(t.autoPageSize),r.stateToRestore.pagination?.paginationModel):lF(e);return e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,t.signature,o)})}),"stateRestorePreProcessing"),n},[e,t.autoPageSize,t.signature]);pN(e,"exportState",d),pN(e,"restoreState",p);const h=s.useCallback(()=>{if(!t.autoPageSize)return;const n=e.current.getRootDimensions(),r=Math.max(1,Math.floor(n.viewportInnerSize.height/i));e.current.setPageSize(r)},[e,t.autoPageSize,i]),m=s.useCallback(t=>{if(null==t)return;const n=lF(e);if(0===n.page)return;const r=pF(e);n.page>r-1&&queueMicrotask(()=>{l(Math.max(0,r-1))})},[e,l]),g=s.useCallback(()=>{0!==lF(e).page&&l(0),0!==e.current.getScrollPosition().top&&e.current.scroll({top:0})},[e,l]),v=s.useMemo(()=>Cg(g,0),[g]),b=s.useCallback(t=>{const n=f({},t,{items:OD(e)});JL(n,o.current)||(o.current=n,v())},[e,v]);rI(e,"viewportInnerSizeChange",h),rI(e,"paginationModelChange",()=>{const t=lF(e);e.current.virtualScrollerRef?.current&&e.current.scrollToIndexes({rowIndex:t.page*t.pageSize})}),rI(e,"rowCountChange",m),rI(e,"sortModelChange",v),rI(e,"filterModelChange",b);const y=s.useRef(!0);s.useEffect(()=>{y.current?y.current=!1:t.pagination&&e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{paginationModel:DB(e.pagination,t.signature,t.paginationModel)})}))},[e,t.paginationModel,t.signature,t.pagination]),s.useEffect(()=>{e.current.setState(e=>{const n=!0===t.pagination;return e.pagination.paginationMode===t.paginationMode&&e.pagination.enabled===n?e:f({},e,{pagination:f({},e.pagination,{paginationMode:t.paginationMode,enabled:n})})})},[e,t.paginationMode,t.pagination]),s.useEffect(h,[h])})(e,t),((e,t)=>{const n=bL(e,"useGridRowCount"),r=Dg(()=>lF(e).pageSize);e.current.registerControlState({stateId:"paginationRowCount",propModel:t.rowCount,propOnChange:t.onRowCountChange,stateSelector:sF,changeEvent:"rowCountChange"});const o=s.useCallback(t=>{sF(e)!==t&&(n.debug("Setting 'rowCount' to",t),e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{rowCount:t})})))},[e,n]);vL(e,{setRowCount:o},"public");const i=s.useCallback((n,r)=>{const o=sF(e);return r.exportOnlyDirtyModels&&null==t.rowCount&&null==t.initialState?.pagination?.rowCount?n:f({},n,{pagination:f({},n.pagination,{rowCount:o})})},[e,t.rowCount,t.initialState?.pagination?.rowCount]),a=s.useCallback((t,n)=>{const r=n.stateToRestore.pagination?.rowCount?n.stateToRestore.pagination.rowCount:sF(e);return e.current.setState(e=>f({},e,{pagination:f({},e.pagination,{rowCount:r})})),t},[e]);pN(e,"exportState",i),pN(e,"restoreState",a);const l=s.useCallback(n=>{"client"!==t.paginationMode&&r.current&&n.pageSize!==r.current&&(r.current=n.pageSize,-1===sF(e)&&e.current.setPage(0))},[t.paginationMode,r,e]);rI(e,"paginationModelChange",l),s.useEffect(()=>{"server"===t.paginationMode&&null!=t.rowCount&&e.current.setRowCount(t.rowCount)},[e,t.paginationMode,t.rowCount]),QM(e.current.store,()=>!(!1!==cF(e).hasNextPage)||("client"===t.paginationMode?TD(e):void 0),(t,n)=>{if(!0===n&&-1!==sF(e)){const t=TD(e),n=lF(e);e.current.setRowCount(n.pageSize*n.page+t)}else"number"==typeof n&&e.current.setRowCount(n)}),s.useEffect(()=>{"client"===t.paginationMode&&e.current.setRowCount(TD(e))},[e,t.paginationMode])})(e,t)},UB=(e,t)=>f({},e,{preferencePanel:t.initialState?.preferencePanel??{open:!1}}),GB=e=>{switch(e.type){case"boolean":return!1;case"date":case"dateTime":case"number":return;case"singleSelect":return null;default:return""}},KB=["id","field"],qB=["id","field"],YB=["id"],XB=["id"],QB=e=>f({},e,{editRows:{}}),ZB=(e,t,n)=>{((e,t)=>{const[n,r]=s.useState({}),o=s.useRef(n),i=s.useRef({}),{processRowUpdate:a,onProcessRowUpdateError:l,cellModesModel:c,onCellModesModelChange:u}=t,p=e=>(...n)=>{t.editMode===$I.Cell&&e(...n)},h=s.useCallback((t,n)=>{const r=e.current.getCellParams(t,n);if(!e.current.isCellEditable(r))throw new Error(`MUI X: The cell with id=${t} and field=${n} is not editable.`)},[e]),m=s.useCallback((t,n,r)=>{if(e.current.getCellMode(t,n)!==r)throw new Error(`MUI X: The cell with id=${t} and field=${n} is not in ${r} mode.`)},[e]),g=s.useCallback((t,n)=>{if(!t.isEditable)return;if(t.cellMode===zI.Edit)return;const r=f({},t,{reason:WI.cellDoubleClick});e.current.publishEvent("cellEditStart",r,n)},[e]),v=s.useCallback((t,n)=>{if(t.cellMode===zI.View)return;if(e.current.getCellMode(t.id,t.field)===zI.View)return;const r=f({},t,{reason:UI.cellFocusOut});e.current.publishEvent("cellEditStop",r,n)},[e]),b=s.useCallback((t,n)=>{if(t.cellMode===zI.Edit){if(229===n.which)return;let r;if("Escape"===n.key?r=UI.escapeKeyDown:"Enter"===n.key?r=UI.enterKeyDown:"Tab"===n.key&&(r=n.shiftKey?UI.shiftTabKeyDown:UI.tabKeyDown,n.preventDefault()),r){const o=f({},t,{reason:r});e.current.publishEvent("cellEditStop",o,n)}}else if(t.isEditable){let r;if(!e.current.unstable_applyPipeProcessors("canStartEditing",!0,{event:n,cellParams:t,editMode:"cell"}))return;if(LO(n)?r=WI.printableKeyDown:$O(n)?r=WI.pasteKeyDown:"Enter"===n.key?r=WI.enterKeyDown:"Backspace"!==n.key&&"Delete"!==n.key||(r=WI.deleteKeyDown),r){const o=f({},t,{reason:r,key:n.key});e.current.publishEvent("cellEditStart",o,n)}}},[e]),y=s.useCallback(t=>{const{id:n,field:r,reason:o}=t,i={id:n,field:r};o!==WI.printableKeyDown&&o!==WI.deleteKeyDown&&o!==WI.pasteKeyDown||(i.deleteValue=!0),e.current.startCellEditMode(i)},[e]),w=s.useCallback(t=>{const{id:n,field:r,reason:o}=t;let i;e.current.runPendingEditCellValueMutation(n,r),o===UI.enterKeyDown?i="below":o===UI.tabKeyDown?i="right":o===UI.shiftTabKeyDown&&(i="left");const a="escapeKeyDown"===o;e.current.stopCellEditMode({id:n,field:r,ignoreModifications:a,cellToFocusAfter:i})},[e]);var x;rI(e,"cellDoubleClick",p(g)),rI(e,"cellFocusOut",p(v)),rI(e,"cellKeyDown",p(b)),rI(e,"cellEditStart",p(y)),rI(e,"cellEditStop",p(w)),iI(e,"cellEditStart",t.onCellEditStart),iI(e,"cellEditStop",(x=t.onCellEditStop,async(...t)=>{if(x){const{id:n,field:r}=t[0],o=e.current.state.editRows,i=o[n][r]?.error;i||x(...t)}}));const S=s.useCallback((t,n)=>{const r=WL(e);return r[t]&&r[t][n]?zI.Edit:zI.View},[e]),C=Mg(n=>{const i=n!==t.cellModesModel;u&&i&&u(n,{api:e.current}),t.cellModesModel&&i||(r(n),o.current=n,e.current.publishEvent("cellModesModelChange",n))}),k=s.useCallback((e,t,n)=>{const r=f({},o.current);if(null!==n)r[e]=f({},r[e],{[t]:f({},n)});else{const n=d(r[e],[t].map(T));r[e]=n,0===Object.keys(r[e]).length&&delete r[e]}C(r)},[C]),E=s.useCallback((t,n,r)=>{e.current.setState(e=>{const o=f({},e.editRows);return null!==r?o[t]=f({},o[t],{[n]:f({},r)}):(delete o[t][n],0===Object.keys(o[t]).length&&delete o[t]),f({},e,{editRows:o})})},[e]),R=s.useCallback(e=>{const{id:t,field:n}=e,r=d(e,KB);h(t,n),m(t,n,zI.View),k(t,n,f({mode:zI.Edit},r))},[h,m,k]),P=Mg(async t=>{const{id:n,field:r,deleteValue:o,initialValue:i}=t,a=e.current.getCellValue(n,r);let l=a;o?l=GB(e.current.getColumn(r)):i&&(l=i);const s=e.current.getColumn(r),c=!!s.preProcessEditCellProps&&o;let u={value:l,error:!1,isProcessingProps:c};if(E(n,r,u),e.current.setCellFocus(n,r),c&&(u=await Promise.resolve(s.preProcessEditCellProps({id:n,row:e.current.getRow(n),props:u,hasChanged:l!==a})),e.current.getCellMode(n,r)===zI.Edit)){const t=WL(e);E(n,r,f({},u,{value:t[n][r].value,isProcessingProps:!1}))}}),M=s.useCallback(e=>{const{id:t,field:n}=e,r=d(e,qB);m(t,n,zI.Edit),k(t,n,f({mode:zI.View},r))},[m,k]),I=Mg(async n=>{const{id:r,field:o,ignoreModifications:s,cellToFocusAfter:c="none"}=n;m(r,o,zI.Edit),e.current.runPendingEditCellValueMutation(r,o);const u=()=>{E(r,o,null),k(r,o,null),"none"!==c&&e.current.moveFocusToRelativeCell(r,o,c)};if(s)return void u();const d=WL(e),{error:p,isProcessingProps:f}=d[r][o],h=e.current.getRow(r);if(p||f)return i.current[r][o].mode=zI.Edit,void k(r,o,{mode:zI.Edit});const g=e.current.getRowWithUpdatedValuesFromCellEditing(r,o);if(t.dataSource?.updateRow){if(JL(h,g))return void u();const t=()=>{i.current[r][o].mode=zI.Edit,k(r,o,{mode:zI.Edit})},n={rowId:r,updatedRow:g,previousRow:h};try{await e.current.dataSource.editRow(n),u()}catch{t()}}else if(a){const t=e=>{i.current[r][o].mode=zI.Edit,k(r,o,{mode:zI.Edit}),l&&l(e)};try{Promise.resolve(a(g,h,{rowId:r})).then(t=>{e.current.updateRows([t]),u()}).catch(t)}catch(e){t(e)}}else e.current.updateRows([g]),u()}),O=s.useCallback(async t=>{const{id:n,field:r,value:o,debounceMs:i,unstable_skipValueParser:a}=t;h(n,r),m(n,r,zI.Edit);const l=e.current.getColumn(r),s=e.current.getRow(n);let c=o;l.valueParser&&!a&&(c=l.valueParser(o,s,l,e));let u=WL(e),d=f({},u[n][r],{value:c,changeReason:i?"debouncedSetEditCellValue":"setEditCellValue"});if(l.preProcessEditCellProps){const e=o!==u[n][r].value;d=f({},d,{isProcessingProps:!0}),E(n,r,d),d=await Promise.resolve(l.preProcessEditCellProps({id:n,row:s,props:d,hasChanged:e}))}return e.current.getCellMode(n,r)!==zI.View&&(u=WL(e),d=f({},d,{isProcessingProps:!1}),d.value=l.preProcessEditCellProps?u[n][r].value:c,E(n,r,d),u=WL(e),!u[n]?.[r]?.error)},[e,h,m,E]),D=s.useCallback((t,n)=>{const r=e.current.getColumn(n),o=WL(e),i=e.current.getRow(t);if(!o[t]||!o[t][n])return e.current.getRow(t);const{value:a}=o[t][n];return r.valueSetter?r.valueSetter(a,i,r,e):f({},i,{[n]:a})},[e]),F={setCellEditingEditCellValue:O,getRowWithUpdatedValuesFromCellEditing:D};vL(e,{getCellMode:S,startCellEditMode:R,stopCellEditMode:M},"public"),vL(e,F,"private"),s.useEffect(()=>{c&&C(c)},[c,C]),Wh(()=>{const t=wT(e),r=i.current;i.current=LI(n),Object.entries(n).forEach(([n,o])=>{Object.entries(o).forEach(([o,i])=>{const a=r[n]?.[o]?.mode||zI.View,l=t[n]?e.current.getRowId(t[n]):n;i.mode===zI.Edit&&a===zI.View?P(f({id:l,field:o},i)):i.mode===zI.View&&a===zI.Edit&&I(f({id:l,field:o},i))})})},[e,n,P,I])})(e,t),((e,t)=>{const[n,r]=s.useState({}),o=s.useRef(n),i=s.useRef({}),a=s.useRef({}),l=s.useRef(void 0),c=s.useRef(null),{processRowUpdate:u,onProcessRowUpdateError:p,rowModesModel:h,onRowModesModelChange:m}=t,g=e=>(...n)=>{t.editMode===$I.Row&&e(...n)},v=s.useCallback((t,n)=>{const r=e.current.getCellParams(t,n);if(!e.current.isCellEditable(r))throw new Error(`MUI X: The cell with id=${t} and field=${n} is not editable.`)},[e]),b=s.useCallback((t,n)=>{if(e.current.getRowMode(t)!==n)throw new Error(`MUI X: The row with id=${t} is not in ${n} mode.`)},[e]),y=s.useCallback(t=>{const n=WL(e);return Object.values(n[t]).some(e=>e.error)},[e]),w=s.useCallback((t,n)=>{if(!t.isEditable)return;if(e.current.getRowMode(t.id)===jI.Edit)return;const r=f({},e.current.getRowParams(t.id),{field:t.field,reason:GI.cellDoubleClick});e.current.publishEvent("rowEditStart",r,n)},[e]),x=s.useCallback(e=>{c.current=e},[]),S=s.useCallback((t,n)=>{t.isEditable&&e.current.getRowMode(t.id)!==jI.View&&(c.current=null,l.current=setTimeout(()=>{if(c.current?.id!==t.id){if(!e.current.getRow(t.id))return;if(e.current.getRowMode(t.id)===jI.View)return;if(y(t.id))return;const r=f({},e.current.getRowParams(t.id),{field:t.field,reason:KI.rowFocusOut});e.current.publishEvent("rowEditStop",r,n)}}))},[e,y]);s.useEffect(()=>()=>{clearTimeout(l.current)},[]);const C=s.useCallback((t,n)=>{if(t.cellMode===jI.Edit){if(229===n.which)return;let r;if("Escape"===n.key)r=KI.escapeKeyDown;else if("Enter"===n.key)r=KI.enterKeyDown;else if("Tab"===n.key){const o=uO(e).filter(n=>e.current.getColumn(n).type===ZO||e.current.isCellEditable(e.current.getCellParams(t.id,n)));if(n.shiftKey?t.field===o[0]&&(r=KI.shiftTabKeyDown):t.field===o[o.length-1]&&(r=KI.tabKeyDown),n.preventDefault(),!r){const r=o.findIndex(e=>e===t.field),i=o[n.shiftKey?r-1:r+1];e.current.setCellFocus(t.id,i)}}if(r){if(r!==KI.escapeKeyDown&&y(t.id))return;const o=f({},e.current.getRowParams(t.id),{reason:r,field:t.field});e.current.publishEvent("rowEditStop",o,n)}}else if(t.isEditable){let r;if(!e.current.unstable_applyPipeProcessors("canStartEditing",!0,{event:n,cellParams:t,editMode:"row"}))return;if(LO(n)||$O(n)?r=GI.printableKeyDown:"Enter"===n.key?r=GI.enterKeyDown:"Backspace"!==n.key&&"Delete"!==n.key||(r=GI.deleteKeyDown),r){const o=f({},e.current.getRowParams(t.id),{field:t.field,reason:r});e.current.publishEvent("rowEditStart",o,n)}}},[e,y]),k=s.useCallback(t=>{const{id:n,field:r,reason:o}=t,i={id:n,fieldToFocus:r};o!==GI.printableKeyDown&&o!==GI.deleteKeyDown||(i.deleteValue=!!r),e.current.startRowEditMode(i)},[e]),E=s.useCallback(t=>{const{id:n,reason:r,field:o}=t;let i;e.current.runPendingEditCellValueMutation(n),r===KI.enterKeyDown?i="below":r===KI.tabKeyDown?i="right":r===KI.shiftTabKeyDown&&(i="left");const a="escapeKeyDown"===r;e.current.stopRowEditMode({id:n,ignoreModifications:a,field:o,cellToFocusAfter:i})},[e]);rI(e,"cellDoubleClick",g(w)),rI(e,"cellFocusIn",g(x)),rI(e,"cellFocusOut",g(S)),rI(e,"cellKeyDown",g(C)),rI(e,"rowEditStart",g(k)),rI(e,"rowEditStop",g(E)),iI(e,"rowEditStart",t.onRowEditStart),iI(e,"rowEditStop",t.onRowEditStop);const R=s.useCallback(n=>UL(e,{rowId:n,editMode:t.editMode})?jI.Edit:jI.View,[e,t.editMode]),P=Mg(n=>{const i=n!==t.rowModesModel;m&&i&&m(n,{api:e.current}),t.rowModesModel&&i||(r(n),o.current=n,e.current.publishEvent("rowModesModelChange",n))}),M=s.useCallback((e,t)=>{const n=f({},o.current);null!==t?n[e]=f({},t):delete n[e],P(n)},[P]),I=s.useCallback((t,n)=>{e.current.setState(e=>{const r=f({},e.editRows);return null!==n?r[t]=n:delete r[t],f({},e,{editRows:r})})},[e]),O=s.useCallback((t,n,r)=>{e.current.setState(e=>{const o=f({},e.editRows);return null!==r?o[t]=f({},o[t],{[n]:f({},r)}):(delete o[t][n],0===Object.keys(o[t]).length&&delete o[t]),f({},e,{editRows:o})})},[e]),D=s.useCallback(e=>{const{id:t}=e,n=d(e,YB);b(t,jI.View),M(t,f({mode:jI.Edit},n))},[b,M]),F=Mg(t=>{const{id:n,fieldToFocus:r,deleteValue:o,initialValue:i}=t,l=e.current.getRow(n),s=aO(e),c=s.reduce((t,a)=>{const l=a.field;if(!e.current.getCellParams(n,l).isEditable)return t;const s=e.current.getColumn(l);let c=e.current.getCellValue(n,l);return r===l&&(o||i)&&(o?c=GB(s):i&&(c=i)),t[l]={value:c,error:!1,isProcessingProps:s.editable&&!!s.preProcessEditCellProps&&o},t},{});a.current[n]=l,I(n,c),r&&e.current.setCellFocus(n,r),s.filter(t=>e.current.getCellParams(n,t.field).isEditable&&t.editable&&!!t.preProcessEditCellProps&&o).forEach(t=>{const r=t.field,a=e.current.getCellValue(n,r),s=o?GB(t):i??a;Promise.resolve(t.preProcessEditCellProps({id:n,row:l,props:c[r],hasChanged:s!==a})).then(t=>{if(e.current.getRowMode(n)===jI.Edit){const o=WL(e);O(n,r,f({},t,{value:o[n][r].value,isProcessingProps:!1}))}})})}),L=s.useCallback(e=>{const{id:t}=e,n=d(e,XB);b(t,jI.Edit),M(t,f({mode:jI.View},n))},[b,M]),A=Mg(async n=>{const{id:r,ignoreModifications:o,field:l,cellToFocusAfter:s="none"}=n;e.current.runPendingEditCellValueMutation(r);const c=()=>{"none"!==s&&l&&e.current.moveFocusToRelativeCell(r,l,s),I(r,null),M(r,null),delete a.current[r]};if(o)return void c();const d=WL(e),f=a.current[r];if(Object.values(d[r]).some(e=>e.isProcessingProps))return void(i.current[r].mode=jI.Edit);if(y(r))return i.current[r].mode=jI.Edit,void M(r,{mode:jI.Edit});const h=e.current.getRowWithUpdatedValuesFromRowEditing(r);if(t.dataSource?.updateRow){if(JL(f,h))return void c();const t=()=>{i.current[r].mode=jI.Edit,M(r,{mode:jI.Edit})},n={rowId:r,updatedRow:h,previousRow:f};try{await e.current.dataSource.editRow(n),c()}catch{t()}}else if(u){const t=e=>{i.current[r]&&(i.current[r].mode=jI.Edit,M(r,{mode:jI.Edit})),p&&p(e)};try{Promise.resolve(u(h,f,{rowId:r})).then(t=>{e.current.updateRows([t]),c()}).catch(t)}catch(e){t(e)}}else e.current.updateRows([h]),c()}),N=s.useCallback(t=>{const{id:n,field:r,value:o,debounceMs:i,unstable_skipValueParser:a}=t;v(n,r);const l=e.current.getColumn(r),s=e.current.getRow(n);let c=o;l.valueParser&&!a&&(c=l.valueParser(o,s,l,e));let u=WL(e),p=f({},u[n][r],{value:c,changeReason:i?"debouncedSetEditCellValue":"setEditCellValue"});return l.preProcessEditCellProps||O(n,r,p),new Promise(t=>{const o=[];if(l.preProcessEditCellProps){const i=p.value!==u[n][r].value;p=f({},p,{isProcessingProps:!0}),O(n,r,p);const a=d(u[n],[r].map(T)),h=Promise.resolve(l.preProcessEditCellProps({id:n,row:s,props:p,hasChanged:i,otherFieldsProps:a})).then(o=>{e.current.getRowMode(n)!==jI.View?(u=WL(e),(o=f({},o,{isProcessingProps:!1})).value=l.preProcessEditCellProps?u[n][r].value:c,O(n,r,o)):t(!1)});o.push(h)}Object.entries(u[n]).forEach(([i,a])=>{if(i===r)return;const l=e.current.getColumn(i);if(!l.preProcessEditCellProps)return;a=f({},a,{isProcessingProps:!0}),O(n,i,a),u=WL(e);const c=d(u[n],[i].map(T)),p=Promise.resolve(l.preProcessEditCellProps({id:n,row:s,props:a,hasChanged:!1,otherFieldsProps:c})).then(r=>{e.current.getRowMode(n)!==jI.View?(r=f({},r,{isProcessingProps:!1}),O(n,i,r)):t(!1)});o.push(p)}),Promise.all(o).then(()=>{e.current.getRowMode(n)===jI.Edit?(u=WL(e),t(!u[n][r].error)):t(!1)})})},[e,v,O]),$=s.useCallback(t=>{const n=WL(e),r=e.current.getRow(t);if(!n[t])return e.current.getRow(t);let o=f({},a.current[t],r);return Object.entries(n[t]).forEach(([t,n])=>{const r=e.current.getColumn(t);r?.valueSetter?o=r.valueSetter(n.value,o,r,e):o[t]=n.value}),o},[e]),z={setRowEditingEditCellValue:N,getRowWithUpdatedValuesFromRowEditing:$};vL(e,{getRowMode:R,startRowEditMode:D,stopRowEditMode:L},"public"),vL(e,z,"private"),s.useEffect(()=>{h&&P(h)},[h,P]),Wh(()=>{const t=wT(e),r=i.current;i.current=LI(n);const o=new Set([...Object.keys(n),...Object.keys(r)]);Array.from(o).forEach(o=>{const i=n[o]??{mode:jI.View},a=r[o]?.mode||jI.View,l=t[o]?e.current.getRowId(t[o]):o;i.mode===jI.Edit&&a===jI.View?F(f({id:l},i)):i.mode===jI.View&&a===jI.Edit&&A(f({id:l},i))})},[e,n,F,A])})(e,t);const r=s.useRef({}),{isCellEditable:o}=t,i=n.hooks.useIsCellEditable(e,t),a=s.useCallback(e=>!!i(e)&&(!!e.colDef.editable&&(!!e.colDef.renderEditCell&&(!o||o(e)))),[o,i]);s.useEffect(()=>{const e=r.current;return()=>{Object.entries(e).forEach(([t,n])=>{Object.keys(n).forEach(n=>{const[r]=e[t][n];clearTimeout(r),delete e[t][n]})})}},[]);const l=s.useCallback((e,t)=>{if(r.current[e])if(t){if(r.current[e][t]){const[,n]=r.current[e][t];n()}}else Object.keys(r.current[e]).forEach(t=>{const[,n]=r.current[e][t];n()})},[]),c=s.useCallback(n=>{const{id:o,field:i,debounceMs:a}=n;return new Promise(l=>{((e,t,n,o)=>{if(!n)return void o();if(r.current[e]||(r.current[e]={}),r.current[e][t]){const[n]=r.current[e][t];clearTimeout(n)}const i=setTimeout(()=>{o(),delete r.current[e][t]},n);r.current[e][t]=[i,()=>{const[n]=r.current[e][t];clearTimeout(n),o(),delete r.current[e][t]}]})(o,i,a,async()=>{const r=t.editMode===$I.Row?e.current.setRowEditingEditCellValue:e.current.setCellEditingEditCellValue;if(e.current.getCellMode(o,i)===zI.Edit){const e=await r(n);l(e)}})})},[e,t.editMode]),u=s.useCallback((n,r)=>t.editMode===$I.Cell?e.current.getRowWithUpdatedValuesFromCellEditing(n,r):e.current.getRowWithUpdatedValuesFromRowEditing(n),[e,t.editMode]),p=s.useCallback((t,n)=>{const r=WL(e);return r[t]?.[n]??null},[e]),h={runPendingEditCellValueMutation:l};vL(e,{isCellEditable:a,setEditCellValue:c,getRowWithUpdatedValues:u,unstable_getEditCellMeta:p},"public"),vL(e,h,"private")},JB=(e,t,n)=>{const r=!!t.dataSource;return n.current.caches.rows=AT({rows:r?[]:t.rows,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),f({},e,{rows:$T({apiRef:n,rowCountProp:t.rowCount,loadingProp:!!r||t.loading,previousTree:null,previousTreeDepths:null})})},e_=e=>"full"===e.updates.type?(e=>{const t={[OT]:f({},{type:"group",id:OT,depth:-1,groupingField:null,groupingKey:null,isAutoGenerated:!0,children:[],childrenFromPath:{},childrenExpanded:!0,parent:null},{children:e})};for(let n=0;n<e.length;n+=1){const r=e[n];t[r]={id:r,depth:0,parent:OT,type:"leaf",groupingKey:null}}return{groupingName:hB,tree:t,treeDepths:{0:e.length},dataRowIds:e}})(e.updates.rows):(({previousTree:e,actions:t})=>{const n=f({},e),r={};for(let e=0;e<t.remove.length;e+=1){const o=t.remove[e];r[o]=!0,delete n[o]}for(let e=0;e<t.insert.length;e+=1){const r=t.insert[e];n[r]={id:r,depth:0,parent:OT,type:"leaf",groupingKey:null}}const o=n[OT];let i=[...o.children,...t.insert];return Object.values(r).length&&(i=i.filter(e=>!r[e])),n[OT]=f({},o,{children:i}),{groupingName:hB,tree:n,treeDepths:{0:i.length},dataRowIds:i}})({previousTree:e.previousTree,actions:e.updates.actions});class t_ extends Error{}function n_(e,t,n){const r=s.useCallback(t=>({field:t,colDef:e.current.getColumn(t)}),[e]),o=s.useCallback(t=>{const n=e.current.getRow(t);if(!n)throw new t_(`No row with id #${t} found`);return{id:t,columns:e.current.getAllColumns(),row:n}},[e]),i=s.useCallback((t,n,r,{cellMode:o,colDef:i,hasFocus:a,rowNode:l,tabIndex:s,value:c,formattedValue:u})=>{const d={id:t,field:n,row:r,rowNode:l,colDef:i,cellMode:o,hasFocus:a,tabIndex:s,value:void 0!==c?c:e.current.getRowValue(r,i),formattedValue:void 0!==u?u:e.current.getRowFormattedValue(r,i),isEditable:!1,api:e.current};return d.isEditable=i&&e.current.isCellEditable(d),d},[e]),a=s.useCallback((n,r)=>{const o=e.current.getRow(n),i=ST(e,n);if(!o||!i)throw new t_(`No row with id #${n} found`);const a=YD(e),l=JD(e),s=e.current.getCellMode(n,r);return e.current.getCellParamsForRow(n,r,o,{colDef:t.listView&&t.listViewColumn?.field===r?nO(e):e.current.getColumn(r),rowNode:i,hasFocus:null!==a&&a.field===r&&a.id===n,tabIndex:l&&l.field===r&&l.id===n?0:-1,cellMode:s})},[e,t.listView,t.listViewColumn?.field]),l=s.useCallback(t=>e.current.rootElementRef.current?function(e,t){return e.querySelector(`[role="columnheader"][data-field="${m$(t)}"]`)}(e.current.rootElementRef.current,t):null,[e]),c=s.useCallback(t=>e.current.rootElementRef.current?function(e,t){return e.querySelector(g$(t))}(e.current.rootElementRef.current,t):null,[e]),u=s.useCallback((t,n)=>e.current.rootElementRef.current?function(e,{id:t,field:n}){const r=`${g$(t)} .${XT.cell}[data-field="${m$(n)}"]`;return e.querySelector(r)}(e.current.rootElementRef.current,{id:t,field:n}):null,[e]),d=n.hooks.useGridParamsOverridableMethods(e),p={getCellValue:d.getCellValue,getCellParams:a,getCellElement:u,getRowValue:d.getRowValue,getRowFormattedValue:d.getRowFormattedValue,getRowParams:o,getRowElement:c,getColumnHeaderParams:r,getColumnHeaderElement:l},f={getCellParamsForRow:i};vL(e,p,"public"),vL(e,f,"private")}const r_={type:"include",ids:new Set},o_=(e,t)=>f({},e,{rowSelection:t.rowSelection?t.rowSelectionModel??r_:r_}),i_=(e,t)=>{const n=(e=>{const{classes:t}=e;return s.useMemo(()=>wm({cellCheckbox:["cellCheckbox"],columnHeaderCheckbox:["columnHeaderCheckbox"]},YT,t),[t])})({classes:t.classes}),r=s.useCallback(r=>{const o=f({},wF,{cellClassName:n.cellCheckbox,headerClassName:n.columnHeaderCheckbox,headerName:e.current.getLocaleText("checkboxSelectionHeaderName")}),i=t.checkboxSelection,a=null!=r.lookup[yF];return i&&!a?(r.lookup[yF]=o,r.orderedFields=[yF,...r.orderedFields]):!i&&a?(delete r.lookup[yF],r.orderedFields=r.orderedFields.filter(e=>e!==yF)):i&&a&&(r.lookup[yF]=f({},o,r.lookup[yF]),t.columns.some(e=>e.field===yF)||(r.orderedFields=[yF,...r.orderedFields.filter(e=>e!==yF)])),r},[e,n,t.columns,t.checkboxSelection]);pN(e,"hydrateColumns",r)},a_=(e,t)=>{const n=t.sortModel??t.initialState?.sorting?.sortModel??[];return f({},e,{sorting:{sortModel:wI(n,t.disableMultipleColumnsSorting),sortedRows:[]}})};function l_(e){const{containerSize:t,scrollPosition:n,elementSize:r,elementOffset:o}=e,i=o+r;return r>t?o:i-t>n?i-t:o<n?o:void 0}const s_={width:0,height:0},c_={isReady:!1,root:s_,viewportOuterSize:s_,viewportInnerSize:s_,contentSize:s_,minimumSize:s_,hasScrollX:!1,hasScrollY:!1,scrollbarSize:0,headerHeight:0,groupHeaderHeight:0,headerFilterHeight:0,rowWidth:0,rowHeight:0,columnsTotalWidth:0,leftPinnedWidth:0,rightPinnedWidth:0,headersTotalHeight:0,topContainerHeight:0,bottomContainerHeight:0,autoHeight:!1,minimalContentHeight:void 0},u_=(e,t,n)=>{const r=f({},c_,function(e,t,n,r){const o=WT(e.rowHeight,dN.rowHeight);return{rowHeight:Math.floor(o*n),headerHeight:Math.floor(e.columnHeaderHeight*n),groupHeaderHeight:Math.floor((e.columnGroupHeaderHeight??e.columnHeaderHeight)*n),headerFilterHeight:Math.floor((e.headerFilterHeight??e.columnHeaderHeight)*n),columnsTotalWidth:d_(t),headersTotalHeight:lL(t,e),leftPinnedWidth:r.left.reduce((e,t)=>e+t.computedWidth,0),rightPinnedWidth:r.right.reduce((e,t)=>e+t.computedWidth,0)}}(t,n,mI(n),pO(n)));return n.current.store.state.dimensions=r,f({},e,{dimensions:r})},d_=eT(cO,hO,(e,t)=>{const n=e.length;return 0===n?0:eA(t[n-1]+e[n-1].computedWidth,1)});function p_(e,t){const n=(t,n)=>e.style.setProperty(t,n);n("--DataGrid-hasScrollX",`${Number(t.hasScrollX)}`),n("--DataGrid-hasScrollY",`${Number(t.hasScrollY)}`),n("--DataGrid-scrollbarSize",`${t.scrollbarSize}px`),n("--DataGrid-rowWidth",`${t.rowWidth}px`),n("--DataGrid-columnsTotalWidth",`${t.columnsTotalWidth}px`),n("--DataGrid-leftPinnedWidth",`${t.leftPinnedWidth}px`),n("--DataGrid-rightPinnedWidth",`${t.rightPinnedWidth}px`),n("--DataGrid-headerHeight",`${t.headerHeight}px`),n("--DataGrid-headersTotalHeight",`${t.headersTotalHeight}px`),n("--DataGrid-topContainerHeight",`${t.topContainerHeight}px`),n("--DataGrid-bottomContainerHeight",`${t.bottomContainerHeight}px`),n("--height",`${t.rowHeight}px`)}const f_=["groupId","children"],h_=e=>{const t={};for(let n=0;n<e.length;n+=1){const r=e[n];if(qI(r))continue;const{groupId:o,children:i}=r,a=d(r,f_);if(!o)throw new Error("MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.");const l=f({},a,{groupId:o}),s=h_(i);if(void 0!==s[o]||void 0!==t[o])throw new Error(`MUI X: The groupId ${o} is used multiple times in the columnGroupingModel.`);Object.assign(t,s),t[o]=l}return t},m_=(e,t,n)=>{if(qI(e)){if(void 0!==n[e.field])throw new Error(["MUI X: columnGroupingModel contains duplicated field",`column field ${e.field} occurs two times in the grouping model:`,`- ${n[e.field].join(" > ")}`,`- ${t.join(" > ")}`].join("\n"));return void(n[e.field]=t)}const{groupId:r,children:o}=e;o.forEach(e=>{m_(e,[...t,r],n)})},g_=e=>{if(!e)return{};const t={};return e.forEach(e=>{m_(e,[],t)}),t},v_=(e,t,n)=>{const r=e=>t[e]??[],o=[],i=Math.max(0,...e.map(e=>r(e).length)),a=(e,t,n)=>{const o=r(e),i=r(t);for(let e=0;e<=n;e+=1)if(o[e]!==i[e])return!1;return!0},l=(e,t)=>{const r=n?.left,o=n?.right,i=!!r?.includes(e),a=!!r?.includes(t),l=!!o?.includes(e),s=!!o?.includes(t);return i!==a||l!==s};for(let t=0;t<i;t+=1){const n=[];for(let o=0;o<e.length;o+=1){const i=e[o],s=r(i)[t]??null;if(0===n.length){n.push({columnFields:[i],groupId:s});continue}const c=n[n.length-1],u=c.columnFields[c.columnFields.length-1];c.groupId!==s||!a(u,i,t)||l(u,i)?n.push({columnFields:[i],groupId:s}):c.columnFields.push(i)}o.push(n)}return o},b_=(e,t,n)=>{if(n.current.caches.columnGrouping={lastColumnGroupingModel:t.columnGroupingModel},!t.columnGroupingModel)return f({},e,{columnGrouping:void 0});const r=oO(n),o=uO(n),i=h_(t.columnGroupingModel??[]),a=g_(t.columnGroupingModel??[]),l=v_(r,a,n.current.state.pinnedColumns??{}),s=0===o.length?0:Math.max(...o.map(e=>a[e]?.length??0));return f({},e,{columnGrouping:{lookup:i,unwrappedGroupingModel:a,headerStructure:l,maxDepth:s}})};function y_(e,t){if(void 0!==t&&e.changedTouches){for(let n=0;n<e.changedTouches.length;n+=1){const r=e.changedTouches[n];if(r.identifier===t)return{x:r.clientX,y:r.clientY}}return!1}return{x:e.clientX,y:e.clientY}}function w_(e,t,n,r){let o=e;return o+="Right"===r?t-n.left:n.right-t,Math.round(o)}function x_(e,t){return t===ZI.LEFT?e?"--DataGrid-rightPinnedWidth":"--DataGrid-leftPinnedWidth":e?"--DataGrid-leftPinnedWidth":"--DataGrid-rightPinnedWidth"}function S_(e,t,n){return n===ZI.LEFT?t?e.rightPinnedWidth:e.leftPinnedWidth:t?e.leftPinnedWidth:e.rightPinnedWidth}function C_(e){e.preventDefault(),e.stopImmediatePropagation()}function k_(e){const t=s.useRef(void 0),n=()=>VA(e),r=pI(e,n);s.useEffect(()=>{t.current&&!1===r&&(t.current.resolve(),t.current=void 0)});return()=>{if(!t.current){if(!1===n())return Promise.resolve();t.current=function(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}()}return t.current}}function E_(e,t,n){const r={},o=e.current.rootElementRef.current;return o.classList.add(XT.autosizing),n.forEach(n=>{const o=function(e,t){const n=e.virtualScrollerRef.current;return Array.from(n.querySelectorAll(`:scope > div > div > div > [data-field="${m$(t)}"][role="gridcell"]`))}(e.current,n.field),i=o.map(e=>e.getBoundingClientRect().width??0),a=t.includeOutliers?i:function(e,t){if(e.length<4)return e;const n=e.slice();n.sort((e,t)=>e-t);const r=n[Math.floor(.25*n.length)],o=n[Math.floor(.75*n.length)-1],i=o-r,a=i<5?5:i*t;return n.filter(e=>e>r-a&&e<o+a)}(i,t.outliersFactor);if(t.includeHeaders){const t=(l=e.current,s=n.field,l.columnHeadersContainerRef.current.querySelector(`:scope > div > [data-field="${m$(s)}"][role="columnheader"]`));if(t){const e=t.querySelector(`.${XT.columnHeaderTitleContainer}`),n=Array.from(e.children),r=t.querySelector(`.${XT.menuIcon}`),o=window.getComputedStyle(e,null),i=parseInt(o.gap,10)||0,l=window.getComputedStyle(t,null),s=parseInt(l.paddingLeft,10)+parseInt(l.paddingRight,10);let c=0,u=0;for(let e=0;e<n.length;e+=1){const t=n[e];t.clientWidth>0&&(c+=1,u+=t.scrollWidth)}u+=1;const d=u+i*(c-1)+s+(r?.clientWidth??0);a.push(d)}}var l,s;const c=n.minWidth!==-1/0&&void 0!==n.minWidth,u=n.maxWidth!==1/0&&void 0!==n.maxWidth,d=c?n.minWidth:0,p=u?n.maxWidth:1/0,f=0===a.length?0:Math.max(...a);r[n.field]=FI(f,d,p)}),o.classList.remove(XT.autosizing),r}const R_=e=>f({},e,{columnResize:{resizingColumnField:""}});function P_(){return{colDef:void 0,initialColWidth:0,initialTotalWidth:0,previousMouseClickEvent:void 0,columnHeaderElement:void 0,headerFilterElement:void 0,groupHeaderElements:[],cellElements:[],leftPinnedCellsAfter:[],rightPinnedCellsBefore:[],fillerLeft:void 0,fillerRight:void 0,leftPinnedHeadersAfter:[],rightPinnedHeadersBefore:[]}}const M_=(e,t)=>{const n=um(),r=bL(e,"useGridColumnResize"),o=Dg(P_).current,i=s.useRef(null),a=s.useRef(null),l=Ng(),c=s.useRef(void 0),u=t=>{r.debug(`Updating width to ${t} for col ${o.colDef.field}`);const i=o.columnHeaderElement.offsetWidth,a=t-i,l=t-o.initialColWidth;if(l>0){const t=o.initialTotalWidth+l;e.current.rootElementRef?.current?.style.setProperty("--DataGrid-rowWidth",`${t}px`)}o.colDef.computedWidth=t,o.colDef.width=t,o.colDef.flex=0,o.columnHeaderElement.style.width=`${t}px`;const s=o.headerFilterElement;s&&(s.style.width=`${t}px`),o.groupHeaderElements.forEach(e=>{const n=e;let r;r="1"===n.getAttribute("aria-colspan")?`${t}px`:`${n.offsetWidth+a}px`,n.style.width=r}),o.cellElements.forEach(e=>{const n=e;let r;r="1"===n.getAttribute("aria-colspan")?`${t}px`:`${n.offsetWidth+a}px`,n.style.setProperty("--width",r)});const c=oT(e),u=e.current.unstable_applyPipeProcessors("isColumnPinned",!1,o.colDef.field);u===ZI.LEFT&&(T_(o.fillerLeft,"width",a),o.leftPinnedCellsAfter.forEach(e=>{T_(e,"left",a)}),o.leftPinnedHeadersAfter.forEach(e=>{T_(e,"left",a)}),e.current.rootElementRef?.current?.style.setProperty(x_(n,u),`${S_(c,n,u)+l}px`)),u===ZI.RIGHT&&(T_(o.fillerRight,"width",a),o.rightPinnedCellsBefore.forEach(e=>{T_(e,"right",a)}),o.rightPinnedHeadersBefore.forEach(e=>{T_(e,"right",a)}),e.current.rootElementRef?.current?.style.setProperty(x_(n,u),`${S_(c,n,u)+l}px`))},d=t=>{if(y(),o.previousMouseClickEvent){const n=o.previousMouseClickEvent,r=n.timeStamp,i=n.clientX,a=n.clientY;if(t.timeStamp-r<300&&t.clientX===i&&t.clientY===a)return o.previousMouseClickEvent=void 0,void e.current.publishEvent("columnResizeStop",null,t)}if(o.colDef){e.current.setColumnWidth(o.colDef.field,o.colDef.width),r.debug(`Updating col ${o.colDef.field} with new width: ${o.colDef.width}`);const t=rO(e);o.groupHeaderElements.forEach(e=>{const n=e,r=`${e.getAttribute("data-fields").slice(2,-2).split("-|-").reduce((e,n)=>!1!==t.columnVisibilityModel[n]?e+t.lookup[n].computedWidth:e,0)}px`;n.style.width=r})}l.start(0,()=>{e.current.publishEvent("columnResizeStop",null,t)})},p=(t,r,l)=>{const s=e.current.rootElementRef.current;var c,u;o.initialColWidth=t.computedWidth,o.initialTotalWidth=e.current.getRootDimensions().rowWidth,o.colDef=t,o.columnHeaderElement=(c=e.current.columnHeadersContainerRef.current,u=t.field,c.querySelector(`[data-field="${m$(u)}"]`));const d=s.querySelector(`.${XT.headerFilterRow} [data-field="${m$(t.field)}"]`);d&&(o.headerFilterElement=d),o.groupHeaderElements=function(e,t){return Array.from(e.querySelectorAll(`[data-fields*="|-${m$(t)}-|"]`)??[])}(e.current.columnHeadersContainerRef?.current,t.field),o.cellElements=function(e,t){if(!h$(e,XT.root))throw new Error("MUI X: The root element is not found.");const n=e.getAttribute("aria-colindex");if(!n)return[];const r=Number(n)-1,o=[];return t.virtualScrollerRef?.current?(x$(t).forEach(e=>{const n=e.getAttribute("data-id");if(!n)return;let i=r;const a=t.unstable_getCellColSpanInfo(n,r);a&&a.spannedByColSpan&&(i=a.leftVisibleCellIndex);const l=e.querySelector(`[data-colindex="${i}"]`);l&&o.push(l)}),o):[]}(o.columnHeaderElement,e.current),o.fillerLeft=b$(e.current,n?"filler--pinnedRight":"filler--pinnedLeft"),o.fillerRight=b$(e.current,n?"filler--pinnedLeft":"filler--pinnedRight");const p=e.current.unstable_applyPipeProcessors("isColumnPinned",!1,o.colDef.field);o.leftPinnedCellsAfter=p!==ZI.LEFT?[]:function(e,t,n){const r=S$(t);return y$({api:e,colIndex:r,position:n?"right":"left",filterFn:e=>n?e<r:e>r})}(e.current,o.columnHeaderElement,n),o.rightPinnedCellsBefore=p!==ZI.RIGHT?[]:function(e,t,n){const r=S$(t);return y$({api:e,colIndex:r,position:n?"left":"right",filterFn:e=>n?e>r:e<r})}(e.current,o.columnHeaderElement,n),o.leftPinnedHeadersAfter=p!==ZI.LEFT?[]:function(e,t,n){const r=S$(t);return w$({api:e,position:n?"right":"left",colIndex:r,filterFn:e=>n?e<r:e>r})}(e.current,o.columnHeaderElement,n),o.rightPinnedHeadersBefore=p!==ZI.RIGHT?[]:function(e,t,n){const r=S$(t);return w$({api:e,position:n?"left":"right",colIndex:r,filterFn:(e,t)=>!t.classList.contains(XT["columnHeader--last"])&&(n?e>r:e<r)})}(e.current,o.columnHeaderElement,n),a.current=function(e,t){const n=e.classList.contains(XT["columnSeparator--sideRight"])?"Right":"Left";return t?function(e){return"Right"===e?"Left":"Right"}(n):n}(r,n),i.current=function(e,t,n){return"Left"===n?e-t.left:t.right-e}(l,o.columnHeaderElement.getBoundingClientRect(),a.current)},h=Mg(d),m=Mg(t=>{if(0===t.buttons)return void h(t);let n=w_(i.current,t.clientX,o.columnHeaderElement.getBoundingClientRect(),a.current);n=FI(n,o.colDef.minWidth,o.colDef.maxWidth),u(n);const r={element:o.columnHeaderElement,colDef:o.colDef,width:n};e.current.publishEvent("columnResize",r,t)}),g=Mg(e=>{y_(e,c.current)&&d(e)}),v=Mg(t=>{const n=y_(t,c.current);if(!n)return;if("mousemove"===t.type&&0===t.buttons)return void g(t);let r=w_(i.current,n.x,o.columnHeaderElement.getBoundingClientRect(),a.current);r=FI(r,o.colDef.minWidth,o.colDef.maxWidth),u(r);const l={element:o.columnHeaderElement,colDef:o.colDef,width:r};e.current.publishEvent("columnResize",l,t)}),b=Mg(t=>{const n=h$(t.target,XT["columnSeparator--resizable"]);if(!n)return;const o=t.changedTouches[0];null!=o&&(c.current=o.identifier);const i=h$(t.target,XT.columnHeader),a=i.getAttribute("data-field");const l=e.current.getColumn(a);r.debug(`Start Resize on col ${l.field}`),e.current.publishEvent("columnResizeStart",{field:a},t),p(l,n,o.clientX);const s=kg(t.currentTarget);s.addEventListener("touchmove",v),s.addEventListener("touchend",g)}),y=s.useCallback(()=>{const t=kg(e.current.rootElementRef.current);t.body.style.removeProperty("cursor"),t.removeEventListener("mousemove",m),t.removeEventListener("mouseup",h),t.removeEventListener("touchmove",v),t.removeEventListener("touchend",g),setTimeout(()=>{t.removeEventListener("click",C_,!0)},100),o.columnHeaderElement&&(o.columnHeaderElement.style.pointerEvents="unset")},[e,o,m,h,v,g]),w=s.useCallback(({field:t})=>{e.current.setState(e=>f({},e,{columnResize:f({},e.columnResize,{resizingColumnField:t})}))},[e]),x=s.useCallback(()=>{e.current.setState(e=>f({},e,{columnResize:f({},e.columnResize,{resizingColumnField:""})}))},[e]),S=Mg(({colDef:t},n)=>{if(0!==n.button)return;if(!n.currentTarget.classList.contains(XT["columnSeparator--resizable"]))return;n.preventDefault(),r.debug(`Start Resize on col ${t.field}`),e.current.publishEvent("columnResizeStart",{field:t.field},n),p(t,n.currentTarget,n.clientX);const i=kg(e.current.rootElementRef.current);i.body.style.cursor="col-resize",o.previousMouseClickEvent=n.nativeEvent,i.addEventListener("mousemove",m),i.addEventListener("mouseup",h),i.addEventListener("click",C_,!0)}),C=Mg((n,r)=>{if(t.disableAutosize)return;if(0!==r.button)return;const o=e.current.state.columns.lookup[n.field];!1!==o.resizable&&e.current.autosizeColumns(f({},t.autosizeOptions,{disableColumnVirtualization:!1,columns:[o.field]}))}),k=k_(e),E=s.useRef(!1),R=s.useCallback(async n=>{const r=e.current.rootElementRef?.current;if(!r)return;if(E.current)return;E.current=!0;const o=rO(e),i=f({},VL,n,{columns:n?.columns??o.orderedFields});i.columns=i.columns.filter(e=>!1!==o.columnVisibilityModel[e]);const a=i.columns.map(t=>e.current.state.columns.lookup[t]);try{!t.disableVirtualization&&i.disableColumnVirtualization&&(e.current.unstable_setColumnVirtualization(!1),await k());const n=E_(e,i,a),r=a.map(e=>f({},e,{width:n[e.field],computedWidth:n[e.field],flex:0}));if(i.expand){const t=o.orderedFields.map(e=>o.lookup[e]).filter(e=>!1!==o.columnVisibilityModel[e.field]).reduce((e,t)=>e+(n[t.field]??t.computedWidth??t.width),0),i=e.current.getRootDimensions(),a=i.viewportInnerSize.width-t;if(a>0){const e=a/(r.length||1);r.forEach(t=>{t.width+=e,t.computedWidth+=e})}}e.current.updateColumns(r),r.forEach((t,n)=>{if(t.width!==a[n].width){const n=t.width;e.current.publishEvent("columnWidthChange",{element:e.current.getColumnHeaderElement(t.field),colDef:t,width:n})}})}finally{t.disableVirtualization||e.current.unstable_setColumnVirtualization(!0),E.current=!1}},[e,k,t.disableVirtualization]);s.useEffect(()=>y,[y]),Lg(()=>{t.autosizeOnMount&&Promise.resolve().then(()=>{e.current.autosizeColumns(t.autosizeOptions)})}),yL(e,()=>e.current.columnHeadersContainerRef?.current,"touchstart",b,{passive:!0}),vL(e,{autosizeColumns:R},"public"),rI(e,"columnResizeStop",x),rI(e,"columnResizeStart",w),rI(e,"columnSeparatorMouseDown",S),rI(e,"columnSeparatorDoubleClick",C),iI(e,"columnResize",t.onColumnResize),iI(e,"columnWidthChange",t.onColumnWidthChange)};function T_(e,t,n){e&&(e.style[t]=`${Math.round(parseFloat(e.style[t]))+n}px`)}function I_(e){return 0!==e.firstRowIndex||0!==e.lastRowIndex}const O_=(e,t,n)=>{if(!e)return null;const r=e[t.field];return t.rowSpanValueGetter?t.rowSpanValueGetter(r,e,t,n):LT(e,t,n)},D_={caches:{spannedCells:{},hiddenCells:{},hiddenCellOriginMap:{}},processedRange:{firstRowIndex:0,lastRowIndex:0}},F_=e=>f({},e,{rowSpanning:D_}),L_=(e,t)=>{const n=s.useCallback((t,n=!1)=>{const r=e.current.virtualizer.store,{range:o,rows:i}=lN(e);if(n&&r.set("rowSpanning",D_),null===o||!I_(t))return;const a=n?D_:AA.selectors.state(r.state),l=(s={firstRowIndex:t.firstRowIndex,lastRowIndex:Math.min(t.lastRowIndex,o.lastRowIndex-o.firstRowIndex+1)},c=a.processedRange,s.firstRowIndex>=c.firstRowIndex&&s.lastRowIndex<=c.lastRowIndex?null:s.firstRowIndex>=c.firstRowIndex&&s.lastRowIndex>c.lastRowIndex?{firstRowIndex:c.lastRowIndex,lastRowIndex:s.lastRowIndex}:s.firstRowIndex<c.firstRowIndex&&s.lastRowIndex<=c.lastRowIndex?{firstRowIndex:s.firstRowIndex,lastRowIndex:c.firstRowIndex-1}:s);var s,c;if(null===l)return;const u=cO(e),d=((e,t,n,r,o,i)=>{const a=e.current.virtualizer,l=i?D_:AA.selectors.state(a.store.state),s=f({},l.caches.spannedCells),c=f({},l.caches.hiddenCells),u=f({},l.caches.hiddenCellOriginMap),d={firstRowIndex:Math.min(l.processedRange.firstRowIndex,o.firstRowIndex),lastRowIndex:Math.max(l.processedRange.lastRowIndex,o.lastRowIndex)};return t.forEach((t,i)=>{for(let a=o.firstRowIndex;a<o.lastRowIndex;a+=1){const l=n[a];if(c[l.id]?.[i])continue;const d=O_(l.model,t,e);if(null==d)continue;let p=l.id,f=a,h=0;const m=[];if(a===o.firstRowIndex){let o=a-1,l=n[o];for(;o>=r.firstRowIndex&&l&&O_(l.model,t,e)===d;){const e=n[o+1];c[e.id]?c[e.id][i]=!0:c[e.id]={[i]:!0},m.push(a),h+=1,p=l.id,f=o,o-=1,l=n[o]}}m.forEach(e=>{u[e]?u[e][i]=f:u[e]={[i]:f}});let g=a+1;for(;g<=r.lastRowIndex&&n[g]&&O_(n[g].model,t,e)===d;){const e=n[g];c[e.id]?c[e.id][i]=!0:c[e.id]={[i]:!0},u[g]?u[g][i]=f:u[g]={[i]:f},g+=1,h+=1}h>0&&(s[p]?s[p][i]=h+1:s[p]={[i]:h+1})}}),{caches:{spannedCells:s,hiddenCells:c,hiddenCellOriginMap:u},processedRange:d}})(e,u,i,o,l,n),p=Object.keys(d.caches.spannedCells).length,h=Object.keys(d.caches.hiddenCells).length,m=Object.keys(a.caches.spannedCells).length,g=Object.keys(a.caches.hiddenCells).length;(n||p!==m||h!==g)&&!(0===p&&0===m)&&r.set("rowSpanning",d)},[e]),{schedule:r,cancel:o}=function(e){const t=s.useRef(null),n=s.useCallback((...n)=>{t.current||queueMicrotask(()=>{t.current&&t.current()}),t.current=()=>{t.current=null,e(...n)}},[e]);return s.useLayoutEffect(()=>{t.current&&t.current()}),{schedule:n,cancel:()=>!!t.current&&(t.current=null,!0)}}(n),i=s.useCallback(()=>{const t=WA(e);I_(t)&&r(t,!0)},[e,r]);rI(e,"renderedRowsIntervalChange",AI(t.rowSpanning,e=>{const t=o();n(e,t)})),rI(e,"sortedRowsSet",AI(t.rowSpanning,i)),rI(e,"paginationModelChange",AI(t.rowSpanning,i)),rI(e,"filteredRowsSet",AI(t.rowSpanning,i)),rI(e,"columnsChange",AI(t.rowSpanning,i)),s.useEffect(()=>{const r=e.current.virtualizer?.store;r&&(t.rowSpanning?r.state.rowSpanning===D_&&n(WA(e)):r.state.rowSpanning!==D_&&r.set("rowSpanning",D_))},[e,t.rowSpanning,n])},A_=(e,t,n)=>f({},e,{listViewColumn:t.listViewColumn?f({},t.listViewColumn,{computedWidth:N_(n)}):void 0});function N_(e){return oT(e).viewportInnerSize.width}const $_=eT(yD,gD,lF,(e,t,n)=>({groupKeys:[],paginationModel:n,sortModel:t,filterModel:e,start:n.page*n.pageSize,end:n.page*n.pageSize+n.pageSize-1}));let z_=function(e){return e.Default="set-flat-rows",e.LazyLoading="replace-row-range",e.GroupedData="set-grouped-rows",e}({});class j_{constructor(e){this.chunkSize=e}getCacheKeys=e=>{if(this.chunkSize<1||"number"!=typeof e.start)return[e];const t=[];for(let n=e.start;n<=e.end;n+=this.chunkSize){const r=Math.min(n+this.chunkSize-1,e.end);t.push(f({},e,{start:n,end:r}))}return t};splitResponse=(e,t)=>{const n=this.getCacheKeys(e);if(1===n.length)return new Map([[e,t]]);const r=new Map;return n.forEach(n=>{const o=n.end===e.end,i=f({},t,{pageInfo:f({},t.pageInfo,{hasNextPage:void 0!==t.pageInfo?.hasNextPage&&!o||t.pageInfo?.hasNextPage,nextCursor:void 0===t.pageInfo?.nextCursor||o?t.pageInfo?.nextCursor:t.rows[n.end+1].id}),rows:"number"!=typeof n.start||"number"!=typeof e.start?t.rows:t.rows.slice(n.start-e.start,n.end-e.start+1)});r.set(n,i)}),r};static mergeResponses=e=>1===e.length?e[0]:e.reduce((e,t)=>f({},t,{rows:[...e.rows,...t.rows]}),{rows:[],rowCount:0,pageInfo:{}})}const B_=["skipCache","keepChildrenExpanded"],__={clear:()=>{},get:()=>{},set:()=>{}};function H_(e,t={}){return null===e?__:e??new KA(t)}const V_=(e,t)=>{const{api:n,strategyProcessor:r,events:o,setStrategyAvailability:i}=((e,t,n={})=>{const r=s.useCallback(()=>{e.current.setStrategyAvailability(pB.DataSource,z_.Default,t.dataSource?()=>!0:()=>!1)},[e,t.dataSource]),[o,i]=s.useState(e.current.getActiveStrategy(pB.DataSource)),a=s.useMemo(()=>o===z_.Default||o===z_.GroupedData,[o]),l=pI(e,lF),c=s.useRef(0),u=t.onDataSourceError,p=Dg(()=>{if(!t.pagination)return new j_(l.pageSize);const e=t.pageSizeOptions.map(e=>"number"==typeof e?e:e.value).sort((e,t)=>e-t),n=Math.min(l.pageSize,e[0]);return new j_(n)}).current,[h,m]=s.useState(()=>H_(t.dataSourceCache,n.cacheOptions)),g=s.useCallback(async(r,o)=>{const i=t.dataSource?.getRows;if(!i)return;if(r&&r!==OT&&"DataGrid"!==t.signature)return void n.fetchRowChildren?.([r]);n.clearDataSourceState?.();const l=o||{},{skipCache:s,keepChildrenExpanded:m}=l,g=d(l,B_),v=f({},$_(e),e.current.unstable_applyPipeProcessors("getRowsParams",{}),g),b=p.getCacheKeys(v).map(e=>h.get(e));if(!s&&b.every(e=>void 0!==e))return void e.current.applyStrategyProcessor("dataSourceRowsUpdate",{response:j_.mergeResponses(b),fetchParams:v,options:{skipCache:s,keepChildrenExpanded:m}});(a||0===e.current.getRowsCount())&&e.current.setLoading(!0);const y=c.current+1;c.current=y;try{const t=await i(v);p.splitResponse(v,t).forEach((e,t)=>h.set(t,e)),c.current===y&&e.current.applyStrategyProcessor("dataSourceRowsUpdate",{response:t,fetchParams:v,options:{skipCache:s,keepChildrenExpanded:m}})}catch(t){c.current===y&&(e.current.applyStrategyProcessor("dataSourceRowsUpdate",{error:t,fetchParams:v,options:{skipCache:s,keepChildrenExpanded:m}}),"function"==typeof u&&u(new qA({message:t?.message,params:v,cause:t})))}finally{a&&c.current===y&&e.current.setLoading(!1)}},[p,h,e,a,t.dataSource?.getRows,u,n,t.signature]),v=s.useCallback(()=>{i(e.current.getActiveStrategy(pB.DataSource))},[e]),b=s.useCallback(t=>{if("error"in t)return void e.current.setRows([]);const{response:n}=t;void 0!==n.rowCount&&e.current.setRowCount(n.rowCount),e.current.setRows(n.rows),e.current.unstable_applyPipeProcessors("processDataSourceRows",{params:t.fetchParams,response:n},!0)},[e]),y=t.dataSource?.updateRow,w=n.handleEditRow,x=s.useCallback(async t=>{if(y)try{const n=await y(t);return"function"==typeof w?(w(t,n),n):(n&&!JL(n,t.previousRow)&&e.current.dataSource.cache.clear(),e.current.updateNestedRows([n],[]),n)}catch(e){throw"function"==typeof u&&u(new YA({message:e?.message,params:t,cause:e})),e}},[e,y,u,w]),S={dataSource:{fetchRows:g,cache:h,editRow:x}},C=s.useMemo(()=>Cg(g,0),[g]),k=s.useRef(!0);return s.useEffect(()=>{if(k.current)return void(k.current=!1);if(void 0===t.dataSourceCache)return;const e=H_(t.dataSourceCache,n.cacheOptions);m(t=>t!==e?e:t)},[t.dataSourceCache,n.cacheOptions]),s.useEffect(()=>{if(o===z_.Default||o===z_.LazyLoading||o===z_.GroupedData)return t.dataSource&&(e.current.dataSource.cache.clear(),e.current.dataSource.fetchRows()),()=>{c.current+=1}},[e,t.dataSource,o]),{api:{public:S},debouncedFetchRows:C,strategyProcessor:{strategyName:z_.Default,group:"dataSourceRowsUpdate",processor:b},setStrategyAvailability:r,cacheChunkManager:p,cache:h,events:{strategyAvailabilityChange:v,sortModelChange:AI(a,()=>C()),filterModelChange:AI(a,()=>C()),paginationModelChange:AI(a,()=>C())}}})(e,t);vL(e,n.public,"public"),fB(e,r.strategyName,r.group,r.processor),Object.entries(o).forEach(([t,n])=>{rI(e,t,n)}),s.useEffect(()=>{i()},[i])},W_=(e,t,n)=>{vB(e,t),i_(e,t),(e=>{fB(e,hB,"rowTreeCreation",e_)})(e),bB(gB,e,t),bB(o_,e,t),bB(RB,e,t),bB(JB,e,t),bB(VB,e,t),bB(QB,e,t),bB(zB,e,t),bB(a_,e,t),bB(UB,e,t),bB(LB,e,t),bB(F_,e,t),bB(MB,e,t),bB(R_,e,t),bB(EB,e,t),bB(b_,e,t),bB(_A,e,t),bB(u_,e,t),bB(hN,e,t),bB(A_,e,t),HB(e,t),((e,t)=>{const n=bL(e,"useGridSelection"),r=s.useCallback(e=>(...n)=>{t.rowSelection&&e(...n)},[t.rowSelection]),o=pI(e,RT)>1,i=t.signature!==QT.DataGrid&&(t.rowSelectionPropagation?.parents||t.rowSelectionPropagation?.descendants)&&o,a=s.useMemo(()=>t.rowSelectionModel,[t.rowSelectionModel]),l=s.useRef(null);e.current.registerControlState({stateId:"rowSelection",propModel:a,propOnChange:t.onRowSelectionModelChange,stateSelector:LD,changeEvent:"rowSelectionChange"});const{checkboxSelection:c,disableRowSelectionOnClick:u,isRowSelectable:d}=t,p=HD(t),h=s.useCallback(t=>{let n=t;const r=l.current??t,o=e.current.isRowSelected(t);if(o){const t=kD(e),o=t.findIndex(e=>e===r),i=t.findIndex(e=>e===n);if(o===i)return;n=o>i?t[i+1]:t[i-1]}l.current=t,e.current.selectRowRange({startId:r,endId:n},!o)},[e]),m=Mg(()=>t.pagination&&t.checkboxSelectionVisibleOnly&&"client"===t.paginationMode?mF(e):kD(e)),g=s.useCallback((r,o)=>{if(t.signature===QT.DataGrid&&!p&&("include"!==r.type||r.ids.size>1))throw new Error(["MUI X: `rowSelectionModel` can only contain 1 item in DataGrid.","You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection."].join("\n"));if(LD(e)!==r){if(n.debug("Setting selection model"),null!==l.current){const e=r.ids.has(l.current);("include"===r.type&&!e||"exclude"===r.type&&e)&&(l.current=null)}e.current.setState(e=>f({},e,{rowSelection:t.rowSelection?r:r_}),o)}},[e,n,t.rowSelection,t.signature,p]),v=s.useCallback(t=>AD(e).has(t),[e]),b=s.useCallback(n=>{if(!1===t.rowSelection)return!1;if(d&&!d(e.current.getRowParams(n)))return!1;const r=ST(e,n);return"footer"!==r?.type&&"pinnedRow"!==r?.type},[e,t.rowSelection,d]),y=s.useCallback(()=>$D(e),[e]),w=s.useCallback((r,o=!0,a=!1)=>{if(!e.current.isRowSelectable(r))return;const s=xT(e);if(l.current=o?r:null,a){n.debug(`Setting selection for row ${r}`);const a={type:"include",ids:new Set},l=e=>{a.ids.add(e)};o&&(l(r),i&&VD(e,s,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,l)),e.current.setRowSelectionModel(a,"singleRowSelection")}else{n.debug(`Toggling selection for row ${r}`);const a=LD(e),l={type:a.type,ids:new Set(a.ids)},c=VI(l);c.unselect(r);const u=e=>{c.select(e)},d=e=>{c.unselect(e)};o?(u(r),i&&VD(e,s,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,u)):i&&WD(e,s,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,d),("include"===l.type&&l.ids.size<2||p)&&e.current.setRowSelectionModel(l,"singleRowSelection")}},[e,n,i,t.rowSelectionPropagation?.descendants,t.rowSelectionPropagation?.parents,p]),x=s.useCallback((r,o=!0,a=!1)=>{if(n.debug("Setting selection for several rows"),!1===t.rowSelection)return;const l=xT(e),s=new Set;for(let t=0;t<r.length;t+=1){const n=r[t];e.current.isRowSelectable(n)&&s.add(n)}const c=LD(e);let u;if(a){if(u={type:"include",ids:s},o){const n=VI(u);if(i){const r=e=>{n.select(e)};for(const n of s)VD(e,l,n,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,r)}}else u.ids=new Set;if(c.type===u.type&&u.ids.size===c.ids.size&&Array.from(u.ids).every(e=>c.ids.has(e)))return}else{u={type:c.type,ids:new Set(c.ids)};const n=VI(u),r=e=>{n.select(e)},a=e=>{n.unselect(e)};for(const c of s)o?(n.select(c),i&&VD(e,l,c,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,r)):(a(c),i&&WD(e,l,c,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,a))}("include"===u.type&&u.ids.size<2||p)&&e.current.setRowSelectionModel(u,"multipleRowsSelection")},[n,i,p,e,t.rowSelectionPropagation?.descendants,t.rowSelectionPropagation?.parents,t.rowSelection]),S=s.useCallback(n=>{if(!o||!i||"exclude"===n.type||0===n.ids.size&&"include"===n.type)return n;const r={type:n.type,ids:new Set(n.ids)},a=xT(e),l=VI(r),s=e=>{l.select(e)};for(const r of n.ids)VD(e,a,r,t.rowSelectionPropagation?.descendants??!1,t.rowSelectionPropagation?.parents??!1,s,l);return r},[e,t.rowSelectionPropagation?.descendants,t.rowSelectionPropagation?.parents,o,i]),C=s.useCallback(({startId:t,endId:r},o=!0,i=!1)=>{if(!e.current.getRow(t)||!e.current.getRow(r))return;n.debug(`Expanding selection from row ${t} to row ${r}`);const a=kD(e),l=a.indexOf(t),s=a.indexOf(r),[c,u]=l>s?[s,l]:[l,s],d=a.slice(c,u+1);e.current.selectRows(d,o,i)},[e,n]),k={selectRows:x,selectRowRange:C,getPropagatedRowSelectionModel:S};vL(e,{selectRow:w,setRowSelectionModel:g,getSelectedRows:y,isRowSelected:v,isRowSelectable:b},"public"),vL(e,k,t.signature===QT.DataGrid?"private":"public");const E=s.useRef(!0),R=s.useCallback((n=!1)=>{if(E.current)return;const r=LD(e),i=wT(e),a=xT(e),l=SD(e),s=e=>"server"===t.filterMode?!i[e]:!a[e]||!1===l[e],c={type:r.type,ids:new Set(r.ids)},u=VI(c);let d=!1;for(const e of r.ids){if(s(e)){if(t.keepNonExistentRowsSelected)continue;u.unselect(e),d=!0;continue}if(!t.rowSelectionPropagation?.parents)continue;const n=a[e];if("group"===n?.type){if(n.isAutoGenerated){u.unselect(e),d=!0;continue}n.children.every(e=>!1===l[e])||(u.unselect(e),d=!0)}}const p=o&&t.rowSelectionPropagation?.parents&&(c.ids.size>0||"exclude"===c.type);if(d||p&&!n)if(p)if("exclude"===c.type){const n=m(),r=[];for(let e=0;e<n.length;e+=1){const o=n[e];!t.keepNonExistentRowsSelected&&s(o)||!u.has(o)||r.push(o)}e.current.selectRows(r,!0,!0)}else e.current.selectRows(Array.from(c.ids),!0,!0);else e.current.setRowSelectionModel(c,"multipleRowsSelection")},[e,o,t.rowSelectionPropagation?.parents,t.keepNonExistentRowsSelected,t.filterMode,m]),P=s.useCallback((t,n)=>{const r=n.metaKey||n.ctrlKey,o=!c&&!r&&!(e=>!!e.key)(n),i=!p||o,a=e.current.isRowSelected(t),l=ND(e)>1&&i||!a;e.current.selectRow(t,l,i)},[e,p,c]),M=s.useCallback((t,n)=>{if(u)return;const r=n.target.closest(`.${XT.cell}`)?.getAttribute("data-field");if(r!==wF.field&&r!==tD){if(r){const t=e.current.getColumn(r);if(t?.type===ZO)return}"pinnedRow"!==ST(e,t.id).type&&(n.shiftKey&&p?h(t.id):P(t.id,n))}},[u,p,e,h,P]),T=s.useCallback((e,t)=>{p&&t.shiftKey&&window.getSelection()?.removeAllRanges()},[p]),I=s.useCallback((t,n)=>{p&&n.nativeEvent.shiftKey?h(t.id):e.current.selectRow(t.id,t.value,!p)},[e,h,p]),O=s.useCallback(n=>{const r=yD(e),i=wD(e),a=r.items.length>0||i?.some(e=>e.length);t.isRowSelectable||t.checkboxSelectionVisibleOnly||o&&!t.rowSelectionPropagation?.descendants||a||t.disableRowSelectionExcludeModel?e.current.selectRows(m(),n):e.current.setRowSelectionModel({type:n?"exclude":"include",ids:new Set},"multipleRowsSelection")},[e,m,t.checkboxSelectionVisibleOnly,t.isRowSelectable,t.rowSelectionPropagation?.descendants,t.disableRowSelectionExcludeModel,o]),D=s.useCallback(e=>{O(e.value)},[O]),F=s.useCallback((t,n)=>{if(e.current.getCellMode(t.id,t.field)!==zI.Edit&&!v$(n)){if(AO(n.key)&&n.shiftKey){const r=YD(e);if(r&&r.id!==t.id){n.preventDefault();const o=e.current.isRowSelected(r.id);if(!p)return void e.current.selectRow(r.id,!o,!0);const i=e.current.getRowIndexRelativeToVisibleRows(r.id),a=e.current.getRowIndexRelativeToVisibleRows(t.id);let l,s;i>a?o?(l=a,s=i-1):(l=a,s=i):o?(l=i+1,s=a):(l=i,s=a);const c=lN(e),u=[];for(let e=l;e<=s;e+=1)u.push(c.rows[e].id);return void e.current.selectRows(u,!o)}}if(" "===n.key&&n.shiftKey)return n.preventDefault(),void P(t.id,n);"A"===String.fromCharCode(n.keyCode)&&(n.ctrlKey||n.metaKey)&&(n.preventDefault(),p&&O(!0))}},[e,p,P,O]),L=Mg(()=>{if(!t.rowSelection)return void e.current.setRowSelectionModel(r_);if(void 0===a)return;if(!i||!o||"include"===a.type&&0===a.ids.size)return void e.current.setRowSelectionModel(a);const n=e.current.getPropagatedRowSelectionModel(a);n.type===a.type&&n.ids.size===a.ids.size&&Array.from(a.ids).every(e=>n.ids.has(e))?e.current.setRowSelectionModel(a):e.current.setRowSelectionModel(n)});rI(e,"filteredRowsSet",r(()=>R())),rI(e,"rowClick",r(M)),rI(e,"rowSelectionCheckboxChange",r(I)),rI(e,"headerSelectionCheckboxChange",D),rI(e,"cellMouseDown",r(T)),rI(e,"cellKeyDown",r(F)),s.useEffect(()=>{L()},[e,a,t.rowSelection,L]);const A=null!=a;s.useEffect(()=>{if(A||!t.rowSelection||"function"!=typeof b)return;const n=LD(e);if("include"!==n.type)return;const r=new Set;for(const e of n.ids)b(e)&&r.add(e);r.size<n.ids.size&&e.current.setRowSelectionModel({type:n.type,ids:r})},[e,b,A,t.rowSelection]),s.useEffect(()=>{if(!t.rowSelection||A)return;const n=LD(e);!p&&("include"===n.type&&n.ids.size>1||"exclude"===n.type)&&e.current.setRowSelectionModel(r_)},[e,p,c,A,t.rowSelection]),s.useEffect(()=>{r(R)},[R,r]),s.useEffect(()=>{E.current&&(E.current=!1)},[])})(e,t),PB(e,t),((e,t,n)=>{const r=bL(e,"useGridRows"),o=s.useRef(Date.now()),i=s.useRef(t.rowCount),a=Ng(),{setRowIndex:l,setRowPosition:c}=n.hooks.useGridRowsOverridableMethods(e,t),u=s.useCallback(t=>{const n=wT(e)[t];if(n)return n;const r=ST(e,t);return r&&jT(r)?{[DT]:t}:null},[e]),d=s.useCallback(t=>zD(e,t),[e]),p=s.useCallback(({cache:n,throttle:r})=>{const i=()=>{o.current=Date.now(),e.current.setState(n=>f({},n,{rows:$T({apiRef:e,rowCountProp:t.rowCount,loadingProp:t.loading,previousTree:xT(e),previousTreeDepths:ET(e),previousGroupsToFetch:CT(e)})})),e.current.publishEvent("rowsSet")};if(a.clear(),e.current.caches.rows=n,!r)return void i();const l=t.throttleRowsMs-(Date.now()-o.current);l>0?a.start(l,i):i()},[t.throttleRowsMs,t.rowCount,t.loading,e,a]),h=s.useCallback(n=>{if(r.debug(`Updating all rows, new length ${n.length}`),!t.dataSource&&SL(e))return void e.current.updateNonPivotRows(n,!1);const o=AT({rows:n,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),i=e.current.caches.rows;o.rowsBeforePartialUpdates=i.rowsBeforePartialUpdates,p({cache:o,throttle:!0})},[r,t.getRowId,t.dataSource,t.loading,t.rowCount,p,e]),m=s.useCallback(n=>{if(t.signature===QT.DataGrid&&n.length>1)throw new Error(["MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.","You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature."].join("\n"));if(!t.dataSource&&SL(e))return void e.current.updateNonPivotRows(n);const r=VT(e,n,t.getRowId),o=_T({updates:r,getRowId:t.getRowId,previousCache:e.current.caches.rows});p({cache:o,throttle:!0})},[t.signature,t.dataSource,t.getRowId,p,e]),g=s.useCallback((n,r)=>{const o=VT(e,n,t.getRowId),i=_T({updates:o,getRowId:t.getRowId,previousCache:e.current.caches.rows,groupKeys:r??[]});p({cache:i,throttle:!1})},[t.getRowId,p,e]),v=s.useCallback(t=>{r.debug(`Setting loading to ${t}`),e.current.setState(e=>f({},e,{rows:f({},e.rows,{loading:t})})),e.current.caches.rows.loadingPropBeforePartialUpdates=t},[e,r]),b=s.useCallback(()=>{const t=PT(e),n=wT(e);return new Map(t.map(e=>[e,n[e]??{}]))},[e]),y=s.useCallback(()=>vT(e),[e]),w=s.useCallback(()=>PT(e),[e]),x=s.useCallback(t=>{const{rowIdToIndexMap:n}=lN(e);return n.get(t)},[e]),S=s.useCallback((t,n)=>{const r=ST(e,t);if(!r)throw new Error(`MUI X: No row with id #${t} found.`);if("group"!==r.type)throw new Error("MUI X: Only group nodes can be expanded or collapsed.");const o=f({},r,{childrenExpanded:n});e.current.setState(e=>f({},e,{rows:f({},e.rows,{tree:f({},e.rows.tree,{[t]:o})})})),e.current.publishEvent("rowExpansionChange",o)},[e]),C=s.useCallback(()=>{const t=f({},xT(e)),n=e=>{const r=t[e];"group"===r?.type&&(t[e]=f({},r,{childrenExpanded:!0}),r.children.forEach(n))};n(OT),e.current.setState(e=>f({},e,{rows:f({},e.rows,{tree:t})})),e.current.publishEvent("rowExpansionChange",t[OT])},[e]),k=s.useCallback(()=>{const t=f({},xT(e)),n=e=>{const r=t[e];"group"===r?.type&&(t[e]=f({},r,{childrenExpanded:!1}),r.children.forEach(n))};n(OT),e.current.setState(e=>f({},e,{rows:f({},e.rows,{tree:t})})),e.current.publishEvent("rowExpansionChange",t[OT])},[e]),E=s.useCallback(t=>ST(e,t)??null,[e]),R=s.useCallback(({skipAutoGeneratedRows:t=!0,groupId:n,applySorting:r,applyFiltering:o,directChildrenOnly:i=!1})=>{const a=xT(e);let l;if(r){const r=a[n];if(!r)return[];const o=hD(e);l=[];for(let e=o.findIndex(e=>e===n)+1;e<o.length&&(i?a[o[e]].depth===r.depth+1:a[o[e]].depth>r.depth);e+=1){const n=o[e];t&&jT(a[n])||l.push(n)}}else l=BT(a,n,t,i);if(o){const t=SD(e);l=pD(t)?l:l.filter(e=>!1!==t[e])}return l},[e]),P={getRow:u,setLoading:v,getRowId:d,getRowModels:b,getRowsCount:y,getAllRowIds:w,setRows:h,updateRows:m,getRowNode:E,getRowIndexRelativeToVisibleRows:x,unstable_replaceRows:s.useCallback((n,r)=>{if(t.signature===QT.DataGrid&&r.length>1)throw new Error(["MUI X: You cannot replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.","You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature."].join("\n"));if(0===r.length)return;if(RT(e)>1)throw new Error("`apiRef.current.unstable_replaceRows` is not compatible with tree data and row grouping");const o=f({},xT(e)),i=f({},wT(e)),a=o[OT],l=[...a.children],s=new Set;for(let e=0;e<r.length;e+=1){const a=r[e],c=FT(a,t.getRowId,"A row was provided without id when calling replaceRows()."),[u]=l.splice(n+e,1,c);s.has(u)||(delete i[u],delete o[u]);const d={id:c,depth:0,parent:OT,type:"leaf",groupingKey:null};i[c]=a,o[c]=d,s.add(c)}o[OT]=f({},a,{children:l});const c=l.filter(e=>"leaf"===o[e]?.type);e.current.caches.rows.dataRowIdToModelLookup=i,e.current.setState(e=>f({},e,{rows:f({},e.rows,{loading:t.loading,totalRowCount:Math.max(t.rowCount||0,l.length),dataRowIdToModelLookup:i,dataRowIds:c,tree:o})})),e.current.publishEvent("rowsSet")},[e,t.signature,t.getRowId,t.loading,t.rowCount])},M={setRowIndex:l,setRowPosition:c,setRowChildrenExpansion:S,getRowGroupChildren:R,expandAllRows:C,collapseAllRows:k},T={updateNestedRows:g},I=s.useCallback(()=>{let n;r.info("Row grouping pre-processing have changed, regenerating the row tree"),n=e.current.caches.rows.rowsBeforePartialUpdates===t.rows?f({},e.current.caches.rows,{updates:{type:"full",rows:PT(e)}}):AT({rows:t.rows,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),p({cache:n,throttle:!1})},[r,e,t.rows,t.getRowId,t.loading,t.rowCount,p]),O=Dg(()=>t.dataSource),D=s.useCallback(e=>{t.dataSource&&t.dataSource!==O.current?O.current=t.dataSource:"rowTreeCreation"===e&&I()},[I,O,t.dataSource]),F=s.useCallback(()=>{e.current.getActiveStrategy(pB.RowTree)!==kT(e)&&I()},[e,I]);rI(e,"activeStrategyProcessorChange",D),rI(e,"strategyAvailabilityChange",F);const L=s.useCallback(()=>{e.current.setState(n=>{const r=e.current.unstable_applyPipeProcessors("hydrateRows",{tree:xT(e),treeDepths:ET(e),dataRowIds:PT(e),dataRowIdToModelLookup:wT(e)});return f({},n,{rows:f({},n.rows,r,{totalTopLevelRowCount:NT({tree:r.tree,rowCountProp:t.rowCount})})})}),e.current.publishEvent("rowsSet")},[e,t.rowCount]);fN(e,"hydrateRows",L),vL(e,P,"public"),vL(e,M,t.signature===QT.DataGrid?"private":"public"),vL(e,T,"private");const A=s.useRef(!0);s.useEffect(()=>{if(A.current)return void(A.current=!1);let n=!1;t.rowCount!==i.current&&(n=!0,i.current=t.rowCount);const o=t.dataSource?MT(e):t.rows,a=e.current.caches.rows.rowsBeforePartialUpdates===o,l=e.current.caches.rows.loadingPropBeforePartialUpdates===t.loading,s=e.current.caches.rows.rowCountPropBeforePartialUpdates===t.rowCount;a&&(l||(e.current.setState(e=>f({},e,{rows:f({},e.rows,{loading:t.loading})})),e.current.caches.rows.loadingPropBeforePartialUpdates=t.loading),s||(e.current.setState(e=>f({},e,{rows:f({},e.rows,{totalRowCount:Math.max(t.rowCount||0,e.rows.totalRowCount),totalTopLevelRowCount:Math.max(t.rowCount||0,e.rows.totalTopLevelRowCount)})})),e.current.caches.rows.rowCountPropBeforePartialUpdates=t.rowCount),!n)||(r.debug(`Updating all rows, new length ${o?.length}`),p({cache:AT({rows:o,getRowId:t.getRowId,loading:t.loading,rowCount:t.rowCount}),throttle:!1}))},[t.rows,t.rowCount,t.getRowId,t.loading,t.dataSource,r,p,e])})(e,t,n),L_(e,t),n_(e,t,n),(e=>{const t=()=>e.current.virtualizer.api.resetColSpan(),n={unstable_getCellColSpanInfo:(...t)=>e.current.virtualizer.api.getCellColSpanInfo(...t)},r={resetColSpan:t,calculateColSpan:(...t)=>{e.current.virtualizer.api.calculateColSpan(...t)}};vL(e,n,"public"),vL(e,r,"private"),rI(e,"columnOrderChange",t)})(e),((e,t)=>{const n=s.useCallback(t=>ZF(e)[t]??[],[e]),r=s.useCallback(()=>JF(e),[e]);vL(e,{getColumnGroupPath:n,getAllGroupDetails:r},"public");const o=s.useCallback(()=>{const n=g_(t.columnGroupingModel??[]);e.current.setState(e=>{const t=e.columns?.orderedFields??[],r=e.pinnedColumns??{},o=v_(t,n,r);return f({},e,{columnGrouping:f({},e.columnGrouping,{headerStructure:o})})})},[e,t.columnGroupingModel]),i=s.useCallback(t=>{if(!t&&!e.current.caches.columnGrouping.lastColumnGroupingModel)return;e.current.caches.columnGrouping.lastColumnGroupingModel=t;const n=e.current.getPinnedColumns?.()??{},r=oO(e),o=uO(e),i=h_(t??[]),a=g_(t??[]),l=v_(r,a,n),s=0===o.length?0:Math.max(...o.map(e=>a[e]?.length??0));e.current.setState(e=>f({},e,{columnGrouping:{lookup:i,unwrappedGroupingModel:a,headerStructure:l,maxDepth:s}}))},[e]);rI(e,"columnIndexChange",o),rI(e,"columnsChange",()=>{i(t.columnGroupingModel)}),rI(e,"columnVisibilityModelChange",()=>{i(t.columnGroupingModel)}),s.useEffect(()=>{t.columnGroupingModel!==e.current.caches.columnGrouping.lastColumnGroupingModel&&i(t.columnGroupingModel)},[e,i,t.columnGroupingModel])})(e,t),ZB(e,t,n),((e,t)=>{const n=bL(e,"useGridFocus"),r=s.useRef(null),o=null!==e.current.rootElementRef.current,i=s.useCallback((t,n)=>{t&&e.current.getRow(t.id)&&e.current.publishEvent("cellFocusOut",e.current.getCellParams(t.id,t.field),n)},[e]),a=s.useCallback((t,r)=>{const o=YD(e);o?.id===t&&o?.field===r||(e.current.setState(e=>(n.debug(`Focusing on cell with id=${t} and field=${r}`),f({},e,{tabIndex:{cell:{id:t,field:r},columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null},focus:{cell:{id:t,field:r},columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}}))),e.current.getRow(t)&&(o&&i(o,{}),e.current.publishEvent("cellFocusIn",e.current.getCellParams(t,r))))},[e,n,i]),l=s.useCallback((t,r={})=>{const o=YD(e);i(o,r),e.current.setState(e=>(n.debug(`Focusing on column header with colIndex=${t}`),f({},e,{tabIndex:{columnHeader:{field:t},columnHeaderFilter:null,cell:null,columnGroupHeader:null},focus:{columnHeader:{field:t},columnHeaderFilter:null,cell:null,columnGroupHeader:null}})))},[e,n,i]),c=s.useCallback((t,r={})=>{const o=YD(e);i(o,r),e.current.setState(e=>(n.debug(`Focusing on column header filter with colIndex=${t}`),f({},e,{tabIndex:{columnHeader:null,columnHeaderFilter:{field:t},cell:null,columnGroupHeader:null},focus:{columnHeader:null,columnHeaderFilter:{field:t},cell:null,columnGroupHeader:null}})))},[e,n,i]),u=s.useCallback((t,n,r={})=>{const o=YD(e);o&&e.current.publishEvent("cellFocusOut",e.current.getCellParams(o.id,o.field),r),e.current.setState(e=>f({},e,{tabIndex:{columnGroupHeader:{field:t,depth:n},columnHeader:null,columnHeaderFilter:null,cell:null},focus:{columnGroupHeader:{field:t,depth:n},columnHeader:null,columnHeaderFilter:null,cell:null}}))},[e]),d=s.useCallback(()=>QD(e),[e]),p=s.useCallback((n,r,o)=>{let i=e.current.getColumnIndex(r);const a=cO(e),l=lN(e,(t.pagination,t.paginationMode)),s=TT(e),c=[].concat(s.top||[],l.rows,s.bottom||[]);let u=c.findIndex(e=>e.id===n);"right"===o?i+=1:"left"===o?i-=1:u+=1,i>=a.length?(u+=1,u<c.length&&(i=0)):i<0&&(u-=1,u>=0&&(i=a.length-1)),u=FI(u,0,c.length-1);const d=c[u];if(!d)return;const p=e.current.unstable_getCellColSpanInfo(d.id,i);p&&p.spannedByColSpan&&("left"===o||"below"===o?i=p.leftVisibleCellIndex:"right"===o&&(i=p.rightVisibleCellIndex)),i=FI(i,0,a.length-1);const f=a[i];e.current.setCellFocus(d.id,f.field)},[e,t.pagination,t.paginationMode]),h=s.useCallback(({id:t,field:n})=>{e.current.setCellFocus(t,n)},[e]),m=s.useCallback((t,n)=>{"Enter"===n.key||"Tab"===n.key||"Shift"===n.key||AO(n.key)||e.current.setCellFocus(t.id,t.field)},[e]),g=s.useCallback(({field:t},n)=>{n.target===n.currentTarget&&e.current.setColumnHeaderFocus(t,n)},[e]),v=s.useCallback(({fields:t,depth:n},r)=>{if(r.target!==r.currentTarget)return;const o=QD(e);null!==o&&o.depth===n&&t.includes(o.field)||e.current.setColumnGroupHeaderFocus(t[0],n,r)},[e]),b=s.useCallback((t,r)=>{r.relatedTarget?.getAttribute("class")?.includes(XT.columnHeader)||(n.debug("Clearing focus"),e.current.setState(e=>f({},e,{focus:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}})))},[n,e]),y=s.useCallback(e=>{r.current=e},[]),w=s.useCallback(t=>{const n=r.current;r.current=null;const o=YD(e);if(!e.current.unstable_applyPipeProcessors("canUpdateFocus",!0,{event:t,cell:n}))return;if(!o)return void(n&&e.current.setCellFocus(n.id,n.field));if(n?.id===o.id&&n?.field===o.field)return;const a=e.current.getCellElement(o.id,o.field);a?.contains(t.target)||(n?e.current.setCellFocus(n.id,n.field):(e.current.setState(e=>f({},e,{focus:{cell:null,columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}})),i(o,t)))},[e,i]),x=s.useCallback(t=>{if("view"===t.cellMode)return;const n=YD(e);n?.id===t.id&&n?.field===t.field||e.current.setCellFocus(t.id,t.field)},[e]),S=s.useCallback(()=>{const n=YD(e);if(n&&!e.current.getRow(n.id)){const r=n.id;let o=null;if(void 0!==r){const n=e.current.getRowElement(r),i=n?.dataset.rowindex?Number(n?.dataset.rowindex):0,a=lN(e,(t.pagination,t.paginationMode)),l=a.rows[FI(i,0,a.rows.length-1)];o=l?.id??null}e.current.setState(e=>f({},e,{focus:{cell:null===o?null:{id:o,field:n.field},columnHeader:null,columnHeaderFilter:null,columnGroupHeader:null}}))}},[e,t.pagination,t.paginationMode]),C=s.useMemo(()=>Cg(S,0),[S]),k=Mg(()=>{const n=YD(e);if(!n)return;const r=lN(e,(t.pagination,t.paginationMode));if(r.rows.find(e=>e.id===n.id)||0===r.rows.length)return;const o=cO(e);e.current.setState(e=>f({},e,{tabIndex:{cell:{id:r.rows[0].id,field:o[0].field},columnGroupHeader:null,columnHeader:null,columnHeaderFilter:null}}))}),E={moveFocusToRelativeCell:p,setColumnGroupHeaderFocus:u,getColumnGroupHeaderFocus:d};vL(e,{setCellFocus:a,setColumnHeaderFocus:l,setColumnHeaderFilterFocus:c},"public"),vL(e,E,"private"),s.useEffect(()=>{const t=kg(e.current.rootElementRef.current);return t.addEventListener("mouseup",w),()=>{t.removeEventListener("mouseup",w)}},[e,o,w]),rI(e,"columnHeaderBlur",b),rI(e,"cellDoubleClick",h),rI(e,"cellMouseDown",y),rI(e,"cellKeyDown",m),rI(e,"cellModeChange",x),rI(e,"columnHeaderFocus",g),rI(e,"columnGroupHeaderFocus",v),rI(e,"rowsSet",C),rI(e,"paginationModelChange",k)})(e,t),((e,t)=>{const n=bL(e,"useGridPreferencesPanel"),r=s.useCallback(()=>{e.current.setState(t=>{if(!t.preferencePanel.open)return t;n.debug("Hiding Preferences Panel");const r=KL(e);return e.current.publishEvent("preferencePanelClose",{openedPanelValue:r.openedPanelValue}),f({},t,{preferencePanel:{open:!1}})})},[e,n]),o=s.useCallback((t,r,o)=>{n.debug("Opening Preferences Panel"),e.current.setState(e=>f({},e,{preferencePanel:f({},e.preferencePanel,{open:!0,openedPanelValue:t,panelId:r,labelId:o})})),e.current.publishEvent("preferencePanelOpen",{openedPanelValue:t})},[n,e]);vL(e,{showPreferences:o,hidePreferences:r},"public");const i=s.useCallback((n,r)=>{const o=KL(e);return!r.exportOnlyDirtyModels||null!=t.initialState?.preferencePanel||o.open?f({},n,{preferencePanel:o}):n},[e,t.initialState?.preferencePanel]),a=s.useCallback((t,n)=>{const r=n.stateToRestore.preferencePanel;return null!=r&&e.current.setState(e=>f({},e,{preferencePanel:r})),t},[e]);pN(e,"exportState",i),pN(e,"restoreState",a)})(e,t),((e,t,n)=>{const r=bL(e,"useGridFilter");e.current.registerControlState({stateId:"filter",propModel:t.filterModel,propOnChange:t.onFilterModelChange,stateSelector:yD,changeEvent:"filterModelChange"});const o=s.useCallback(()=>{e.current.setState(t=>{const n=yD(e),r=e.current.getFilterState(n),o=f({},t,{filter:f({},t.filter,r)});return f({},o,{visibleRowsLookup:NB(e,o)})}),e.current.publishEvent("filteredRowsSet")},[e]),i=s.useCallback((e,n)=>null==n||!1===n.filterable||t.disableColumnFilter?e:[...e,"columnMenuFilterItem"],[t.disableColumnFilter]),a=s.useCallback(t=>{const n=yD(e),r=[...n.items],o=r.findIndex(e=>e.id===t.id);-1===o?r.push(t):r[o]=t,e.current.setFilterModel(f({},n,{items:r}),"upsertFilterItem")},[e]),l=s.useCallback(t=>{const n=yD(e),r=[...n.items];t.forEach(e=>{const t=r.findIndex(t=>t.id===e.id);-1===t?r.push(e):r[t]=e}),e.current.setFilterModel(f({},n,{items:r}),"upsertFilterItems")},[e]),c=s.useCallback(t=>{const n=yD(e),r=n.items.filter(e=>e.id!==t.id);r.length!==n.items.length&&e.current.setFilterModel(f({},n,{items:r}),"deleteFilterItem")},[e]),u=s.useCallback((n,o,i)=>{if(r.debug("Displaying filter panel"),n){const r=yD(e),o=r.items.filter(t=>{if(void 0!==t.value)return!Array.isArray(t.value)||0!==t.value.length;const n=e.current.getColumn(t.field),r=n.filterOperators?.find(e=>e.value===t.operator);return!(void 0===r?.requiresFilterValue||r?.requiresFilterValue)});let i;const a=o.find(e=>e.field===n),l=e.current.getColumn(n);i=a?o:t.disableMultipleColumnsFiltering?[yO({field:n,operator:l.filterOperators[0].value},e)]:[...o,yO({field:n,operator:l.filterOperators[0].value},e)],e.current.setFilterModel(f({},r,{items:i}))}e.current.showPreferences(YL.filters,o,i)},[e,r,t.disableMultipleColumnsFiltering]),d=s.useCallback(()=>{r.debug("Hiding filter panel"),e.current.hidePreferences()},[e,r]),p=s.useCallback(t=>{const n=yD(e);n.logicOperator!==t&&e.current.setFilterModel(f({},n,{logicOperator:t}),"changeLogicOperator")},[e]),h=s.useCallback(t=>{const n=yD(e);JL(n.quickFilterValues,t)||e.current.setFilterModel(f({},n,{quickFilterValues:[...t]}))},[e]),m=s.useCallback((n,o)=>{yD(e)!==n&&(r.debug("Setting filter model"),e.current.updateControlState("filter",xO(n,t.disableMultipleColumnsFiltering,e),o),e.current.unstable_applyFilters())},[e,r,t.disableMultipleColumnsFiltering]),g=s.useCallback(r=>{const o=wO(r,t.disableMultipleColumnsFiltering,e),i=n.hooks.useFilterValueGetter(e,t),a="client"===t.filterMode?PO(o,i,e,t.disableEval):null;return f({},e.current.applyStrategyProcessor("filtering",{isRowMatchingFilters:a,filterModel:o??XI(),filterValueGetter:i}),{filterModel:o})},[e,n.hooks,t]),v={setFilterLogicOperator:p,unstable_applyFilters:o,deleteFilterItem:c,upsertFilterItem:a,upsertFilterItems:l,setFilterModel:m,showFilterPanel:u,hideFilterPanel:d,setQuickFilterValues:h,ignoreDiacritics:t.ignoreDiacritics,getFilterState:g};vL(e,v,"public");const b=s.useCallback((n,r)=>{const o=yD(e);return o.items.forEach(e=>{delete e.fromInput}),r.exportOnlyDirtyModels&&null==t.filterModel&&null==t.initialState?.filter?.filterModel&&JL(o,XI())?n:f({},n,{filter:{filterModel:o}})},[e,t.filterModel,t.initialState?.filter?.filterModel]),y=s.useCallback((n,r)=>{const o=r.stateToRestore.filter?.filterModel;return null==o?n:(e.current.updateControlState("filter",xO(o,t.disableMultipleColumnsFiltering,e),"restoreState"),f({},n,{callbacks:[...n.callbacks,e.current.unstable_applyFilters]}))},[e,t.disableMultipleColumnsFiltering]),w=s.useCallback((e,n)=>{if(n===YL.filters){const e=t.slots.filterPanel;return Xp.jsx(e,f({},t.slotProps?.filterPanel))}return e},[t.slots.filterPanel,t.slotProps?.filterPanel]),{getRowId:x}=t,S=Dg($B),C=s.useCallback(n=>{if("client"!==t.filterMode||!n.isRowMatchingFilters||!n.filterModel.items.length&&!n.filterModel.quickFilterValues?.length)return YI;const r=wT(e),o={},{isRowMatchingFilters:i}=n,a={},l={passingFilterItems:null,passingQuickFilterValues:null},s=S.current(e.current.state.rows.dataRowIdToModelLookup);for(let t=0;t<s.length;t+=1){const r=s[t],c=x?x(r):r.id;i(r,void 0,l);const u=TO([l.passingFilterItems],[l.passingQuickFilterValues],n.filterModel,n.filterValueGetter,e,a);u||(o[c]=u)}const c="auto-generated-group-footer-root";return r[c]&&(o[c]=!0),{filteredRowsLookup:o,filteredChildrenCountLookup:{},filteredDescendantCountLookup:{}}},[e,t.filterMode,x,S]);pN(e,"columnMenu",i),pN(e,"exportState",b),pN(e,"restoreState",y),pN(e,"preferencePanel",w),fB(e,hB,"filtering",C),fB(e,hB,"visibleRowsLookupCreation",AB);const k=s.useCallback(()=>{r.debug("onColUpdated - GridColumns changed, applying filters");const t=yD(e),n=iO(e),o=t.items.filter(e=>e.field&&n[e.field]);o.length<t.items.length&&e.current.setFilterModel(f({},t,{items:o}))},[e,r]),E=s.useCallback(t=>{"filtering"===t&&e.current.unstable_applyFilters()},[e]),R=s.useCallback(()=>{e.current.setState(t=>f({},t,{visibleRowsLookup:NB(e,t)}))},[e]);rI(e,"rowsSet",o),rI(e,"columnsChange",k),rI(e,"activeStrategyProcessorChange",E),rI(e,"rowExpansionChange",R),rI(e,"columnVisibilityModelChange",()=>{const t=yD(e);t.quickFilterValues?.length&&RO(t)&&o()}),wL(()=>{"DataGrid"===t.signature&&o()}),Wh(()=>{void 0!==t.filterModel&&e.current.setFilterModel(t.filterModel)},[e,r,t.filterModel])})(e,t,n),((e,t)=>{const n=bL(e,"useGridSorting");e.current.registerControlState({stateId:"sortModel",propModel:t.sortModel,propOnChange:t.onSortModelChange,stateSelector:gD,changeEvent:"sortModelChange"});const r=s.useCallback((t,n)=>{const r=gD(e),o=r.findIndex(e=>e.field===t);let i=[...r];return o>-1?null==n?.sort?i.splice(o,1):i.splice(o,1,n):i=[...r,n],i},[e]),o=s.useCallback((n,r)=>{const o=gD(e).find(e=>e.field===n.field);if(o){const e=void 0===r?CI(n.sortingOrder??t.sortingOrder,o.sort):r;return void 0===e?void 0:f({},o,{sort:e})}return{field:n.field,sort:void 0===r?CI(n.sortingOrder??t.sortingOrder):r}},[e,t.sortingOrder]),i=s.useCallback((e,n)=>null==n||!1===n.sortable||t.disableColumnSorting?e:(n.sortingOrder||t.sortingOrder).some(e=>!!e)?[...e,"columnMenuSortItem"]:e,[t.sortingOrder,t.disableColumnSorting]),a=s.useCallback(()=>{e.current.setState(r=>{if("server"===t.sortingMode)return n.debug("Skipping sorting rows as sortingMode = server"),f({},r,{sorting:f({},r.sorting,{sortedRows:BT(xT(e),OT,!1)})});const o=gD(e),i=SI(o,e),a=e.current.applyStrategyProcessor("sorting",{sortRowList:i});return f({},r,{sorting:f({},r.sorting,{sortedRows:a})})}),e.current.publishEvent("sortedRowsSet")},[e,n,t.sortingMode]),l=s.useCallback(r=>{gD(e)!==r&&(n.debug("Setting sort model"),e.current.setState(xI(r,t.disableMultipleColumnsSorting)),e.current.applySorting())},[e,n,t.disableMultipleColumnsSorting]),c=s.useCallback((n,i,a)=>{const l=e.current.getColumn(n),s=o(l,i);let c;c=!a||t.disableMultipleColumnsSorting?null==s?.sort?[]:[s]:r(l.field,s),e.current.setSortModel(c)},[e,r,o,t.disableMultipleColumnsSorting]),u=s.useCallback(()=>gD(e),[e]),d=s.useCallback(()=>mD(e).map(e=>e.model),[e]),p=s.useCallback(()=>hD(e),[e]),h=s.useCallback(t=>e.current.getSortedRowIds()[t],[e]);vL(e,{getSortModel:u,getSortedRows:d,getSortedRowIds:p,getRowIdFromRowIndex:h,setSortModel:l,sortColumn:c,applySorting:a},"public");const m=s.useCallback((n,r)=>{const o=gD(e);return!r.exportOnlyDirtyModels||null!=t.sortModel||null!=t.initialState?.sorting?.sortModel||o.length>0?f({},n,{sorting:{sortModel:o}}):n},[e,t.sortModel,t.initialState?.sorting?.sortModel]),g=s.useCallback((n,r)=>{const o=r.stateToRestore.sorting?.sortModel;return null==o?n:(e.current.setState(xI(o,t.disableMultipleColumnsSorting)),f({},n,{callbacks:[...n.callbacks,e.current.applySorting]}))},[e,t.disableMultipleColumnsSorting]),v=s.useCallback(t=>{const n=xT(e),r=n[OT],o=t.sortRowList?t.sortRowList(r.children.map(e=>n[e])):[...r.children];return null!=r.footerId&&o.push(r.footerId),o},[e]);pN(e,"exportState",m),pN(e,"restoreState",g),fB(e,hB,"sorting",v);const b=s.useCallback(({field:e,colDef:n},r)=>{if(!n.sortable||t.disableColumnSorting)return;const o="always"===t.multipleColumnsSortingMode||r.shiftKey||r.metaKey||r.ctrlKey;c(e,void 0,o)},[c,t.disableColumnSorting,t.multipleColumnsSortingMode]),y=s.useCallback(({field:e,colDef:n},r)=>{n.sortable&&!t.disableColumnSorting&&("Enter"!==r.key||r.ctrlKey||r.metaKey||c(e,void 0,"always"===t.multipleColumnsSortingMode||r.shiftKey))},[c,t.disableColumnSorting,t.multipleColumnsSortingMode]),w=s.useCallback(()=>{const t=gD(e),n=iO(e);if(t.length>0){const r=t.filter(e=>n[e.field]);r.length<t.length&&e.current.setSortModel(r)}},[e]),x=s.useCallback(t=>{"sorting"===t&&e.current.applySorting()},[e]);pN(e,"columnMenu",i),rI(e,"columnHeaderClick",b),rI(e,"columnHeaderKeyDown",y),rI(e,"rowsSet",e.current.applySorting),rI(e,"columnsChange",w),rI(e,"activeStrategyProcessorChange",x),wL(()=>{"DataGrid"===t.signature&&e.current.applySorting()}),Wh(()=>{void 0!==t.sortModel&&e.current.setSortModel(t.sortModel)},[e,t.sortModel])})(e,t),((e,t)=>{const n=bL(e,"useDensity");e.current.registerControlState({stateId:"density",propModel:t.density,propOnChange:t.onDensityChange,stateSelector:hI,changeEvent:"densityChange"});const r=Mg(t=>{hI(e)!==t&&(n.debug(`Set grid density to ${t}`),e.current.setState(e=>f({},e,{density:t})))});vL(e,{setDensity:r},"public");const o=s.useCallback((n,r)=>{const o=hI(e);return r.exportOnlyDirtyModels&&null==t.density&&null==t.initialState?.density?n:f({},n,{density:o})},[e,t.density,t.initialState?.density]),i=s.useCallback((t,n)=>{const r=n.stateToRestore?.density?n.stateToRestore.density:hI(e);return e.current.setState(e=>f({},e,{density:r})),t},[e]);pN(e,"exportState",o),pN(e,"restoreState",i),s.useEffect(()=>{t.density&&e.current.setDensity(t.density)},[e,t.density])})(e,t),M_(e,t),WB(e,t),((e,t)=>{const n=um(),r=bL(e,"useGridScroll"),o=e.current.columnHeadersContainerRef,i=e.current.virtualScrollerRef,a=s.useCallback(n=>{const o=oT(e),a=vT(e),l=cO(e);if(null!=n.rowIndex&&0===a||0===l.length)return!1;r.debug(`Scrolling to cell at row ${n.rowIndex}, col: ${n.colIndex} `);let s={};if(void 0!==n.colIndex){const t=hO(e);let r;if(void 0!==n.rowIndex){const t=CD(e),o=t[n.rowIndex]?.id,i=e.current.unstable_getCellColSpanInfo(o,n.colIndex);i&&!i.spannedByColSpan&&(r=i.cellProps.width)}void 0===r&&(r=l[n.colIndex].computedWidth),s.left=l_({containerSize:o.viewportOuterSize.width,scrollPosition:Math.abs(i.current.scrollLeft),elementSize:r,elementOffset:t[n.colIndex]})}if(void 0!==n.rowIndex){const r=mT(e),a=uF(e),l=dF(e),c=t.pagination?n.rowIndex-a*l:n.rowIndex,u=r.positions[c+1]?r.positions[c+1]-r.positions[c]:r.currentPageTotalHeight-r.positions[c];s.top=l_({containerSize:o.viewportInnerSize.height,scrollPosition:i.current.scrollTop,elementSize:u,elementOffset:r.positions[c]})}return s=e.current.unstable_applyPipeProcessors("scrollToIndexes",s,n),(void 0!==s.left||void 0!==s.top)&&(e.current.scroll(s),!0)},[r,e,i,t.pagination]),l=s.useCallback(e=>{if(i.current&&void 0!==e.left&&o.current){const t=n?-1:1;o.current.scrollLeft=e.left,i.current.scrollLeft=t*e.left,r.debug(`Scrolling left: ${e.left}`)}i.current&&void 0!==e.top&&(i.current.scrollTop=e.top,r.debug(`Scrolling top: ${e.top}`)),r.debug("Scrolling, updating container, and viewport")},[i,n,o,r]),c=s.useCallback(()=>i?.current?{top:i.current.scrollTop,left:i.current.scrollLeft}:{top:0,left:0},[i]);vL(e,{scroll:l,scrollToIndexes:a,getScrollPosition:c},"public")})(e,t),(e=>{const t=bL(e,"useGridColumnMenu"),n=s.useRef({}),r=s.useCallback(()=>{n.current.wheel?.(),n.current.touchMove?.()},[]),o=s.useCallback(()=>{r(),n.current.wheel=e.current.subscribeEvent("virtualScrollerWheel",e.current.hideColumnMenu),n.current.touchMove=e.current.subscribeEvent("virtualScrollerTouchMove",e.current.hideColumnMenu)},[e,r]),i=s.useCallback(n=>{const r=RL(e),i=n;(!0!==r.open||i!==r.field)&&(e.current.setState(e=>e.columnMenu.open&&e.columnMenu.field===n?e:(t.debug("Opening Column Menu"),o(),f({},e,{columnMenu:{open:!0,field:n}}))),e.current.hidePreferences())},[e,t,o]),a=s.useCallback(()=>{const n=RL(e);if(n.field){const t=iO(e),r=lO(e),o=oO(e);let i=n.field;if(t[i]||(i=o[0]),!1===r[i]){const e=o.filter(e=>e===i||!1!==r[e]),t=e.indexOf(i);i=e[t+1]||e[t-1]}e.current.setColumnHeaderFocus(i)}const o={open:!1,field:void 0};(o.open!==n.open||o.field!==n.field)&&e.current.setState(e=>(t.debug("Hiding Column Menu"),r(),f({},e,{columnMenu:o})))},[e,t,r]),l=s.useCallback(n=>{t.debug("Toggle Column Menu");const r=RL(e);r.open&&r.field===n?a():i(n)},[e,t,i,a]);vL(e,{showColumnMenu:i,hideColumnMenu:a,toggleColumnMenu:l},"public"),rI(e,"columnResizeStart",a)})(e),OB(e,t),FB(e,t),kB(e,t),function(e,t){const n=s.useCallback(()=>oT(e),[e]),r={updateDimensions:()=>e.current.virtualizer.api.updateDimensions(),getViewportPageSize:()=>e.current.virtualizer.api.getViewportPageSize()};vL(e,{getRootDimensions:n},"public"),vL(e,r,"private"),iI(e,"rootMount",t=>{p_(t,oT(e))}),iI(e,"debouncedResize",t.onResize),QM(e.current.store,e=>e.dimensions,(t,n)=>{var r,o;n.isReady&&(e.current.rootElementRef.current&&p_(e.current.rootElementRef.current,n),r=n.viewportInnerSize,o=t.viewportInnerSize,(r.width!==o.width||r.height!==o.height)&&e.current.publishEvent("viewportInnerSizeChange",n.viewportInnerSize),e.current.publishEvent("debouncedResize",n.root))})}(e,t),function(e,t){iI(e,"columnHeaderClick",t.onColumnHeaderClick),iI(e,"columnHeaderContextMenu",t.onColumnHeaderContextMenu),iI(e,"columnHeaderDoubleClick",t.onColumnHeaderDoubleClick),iI(e,"columnHeaderOver",t.onColumnHeaderOver),iI(e,"columnHeaderOut",t.onColumnHeaderOut),iI(e,"columnHeaderEnter",t.onColumnHeaderEnter),iI(e,"columnHeaderLeave",t.onColumnHeaderLeave),iI(e,"cellClick",t.onCellClick),iI(e,"cellDoubleClick",t.onCellDoubleClick),iI(e,"cellKeyDown",t.onCellKeyDown),iI(e,"preferencePanelClose",t.onPreferencePanelClose),iI(e,"preferencePanelOpen",t.onPreferencePanelOpen),iI(e,"menuOpen",t.onMenuOpen),iI(e,"menuClose",t.onMenuClose),iI(e,"rowDoubleClick",t.onRowDoubleClick),iI(e,"rowClick",t.onRowClick),iI(e,"stateChange",t.onStateChange)}(e,t),(e=>{const t=s.useCallback((t={})=>e.current.unstable_applyPipeProcessors("exportState",{},t),[e]),n=s.useCallback(t=>{e.current.unstable_applyPipeProcessors("restoreState",{callbacks:[]},{stateToRestore:t}).callbacks.forEach(e=>{e()})},[e]);vL(e,{exportState:t,restoreState:n},"public")})(e),function(e,t){const{autoHeight:n,disableVirtualization:r}=t,o=t=>{const{virtualizer:r}=e.current;t&&=BA;const o=r.store.getSnapshot();o.virtualization.enabled===t&&o.virtualization.enabledForRows===t&&o.virtualization.enabledForColumns===t||r.store.set("virtualization",f({},r.store.state.virtualization,{enabled:t,enabledForColumns:t,enabledForRows:t&&!n}))};vL(e,{unstable_setVirtualization:o,unstable_setColumnVirtualization:t=>{const{virtualizer:n}=e.current;t&&=BA,n.store.getSnapshot().virtualization.enabledForColumns!==t&&n.store.set("virtualization",f({},n.store.state.virtualization,{enabledForColumns:t}))}},"public");const i=()=>{const{virtualizer:t}=e.current;t?.api.scheduleUpdateRenderContext()};e.current.register("private",{updateRenderContext:i}),iI(e,"sortedRowsSet",i),iI(e,"paginationModelChange",i),iI(e,"columnsChange",i),s.useEffect(()=>{e.current.virtualizer&&o(!t.disableVirtualization)},[e,r,n])}(e,t),function(e,t){const n=()=>{e.current.setState(t=>t.listViewColumn?f({},t,{listViewColumn:f({},t.listViewColumn,{computedWidth:N_(e)})}):t)},r=s.useRef(null);rI(e,"viewportInnerSizeChange",e=>{r.current!==e.width&&(r.current=e.width,n())}),rI(e,"columnVisibilityModelChange",n),Wh(()=>{const n=t.listViewColumn;n&&e.current.setState(t=>f({},t,{listViewColumn:f({},n,{computedWidth:N_(e)})}))},[e,t.listViewColumn]),s.useEffect(()=>{t.listView&&t.listViewColumn},[t.listView,t.listViewColumn])}(e,t),V_(e,t),wL(()=>{e.current.runAppliersForPendingProcessors()}),s.useEffect(()=>{e.current.runAppliersForPendingProcessors()})};function U_(e){const{groupId:t,width:n,depth:r,maxDepth:o,fields:i,height:a,colIndex:l,hasFocus:c,tabIndex:u,isLastColumn:d,pinnedPosition:p,pinnedOffset:h}=e,m=rP(),g=um(),v=s.useRef(null),b=lP(),y=pI(b,JF),w=t?y[t]:{},{headerName:x=t??"",description:S="",headerAlign:C}=w;let k;const E=t&&y[t]?.renderHeaderGroup,R=s.useMemo(()=>({groupId:t,headerName:x,description:S,depth:r,maxDepth:o,fields:i,colIndex:l,isLastColumn:d}),[t,x,S,r,o,i,l,d]);t&&E&&(k=E(R));const P=f({},e,{classes:m.classes,headerAlign:C,depth:r,isDragging:!1}),M=x??t,T=mm(),I=null===t?`empty-group-cell-${T}`:t,O=(e=>{const{classes:t,headerAlign:n,isDragging:r,isLastColumn:o,showLeftBorder:i,showRightBorder:a,groupId:l,pinnedPosition:s}=e;return wm({root:["columnHeader","left"===n&&"columnHeader--alignLeft","center"===n&&"columnHeader--alignCenter","right"===n&&"columnHeader--alignRight",r&&"columnHeader--moving",a&&"columnHeader--withRightBorder",i&&"columnHeader--withLeftBorder","withBorderColor",null===l?"columnHeader--emptyGroup":"columnHeader--filledGroup",s===nD.LEFT&&"columnHeader--pinnedLeft",s===nD.RIGHT&&"columnHeader--pinnedRight",o&&"columnHeader--last"],draggableContainer:["columnHeaderDraggableContainer"],titleContainer:["columnHeaderTitleContainer","withBorderColor"],titleContainerContent:["columnHeaderTitleContainerContent"]},YT,t)})(P);s.useLayoutEffect(()=>{if(c){const e=v.current.querySelector('[tabindex="0"]')||v.current;if(!e)return;if(CN())e.focus({preventScroll:!0});else{const t=b.current.getScrollPosition();e.focus(),b.current.scroll(t)}}},[b,c]);const D=s.useCallback(e=>t=>{v$(t)||b.current.publishEvent(e,R,t)},[b,R]),F=s.useMemo(()=>({onKeyDown:D("columnGroupHeaderKeyDown"),onFocus:D("columnGroupHeaderFocus"),onBlur:D("columnGroupHeaderBlur")}),[D]),L="function"==typeof w.headerClassName?w.headerClassName(R):w.headerClassName,A=s.useMemo(()=>EN(f({},e.style),g,p,h),[p,h,e.style,g]);return Xp.jsx(D$,f({ref:v,classes:O,columnMenuOpen:!1,colIndex:l,height:a,isResizing:!1,sortDirection:null,hasFocus:!1,tabIndex:u,isDraggable:!1,headerComponent:k,headerClassName:L,description:S,elementId:I,width:n,columnMenuIconButton:null,columnTitleIconButtons:null,resizable:!1,label:M,"aria-colspan":i.length,"data-fields":`|-${i.join("-|-")}-|`,style:A},F))}const G_={root:XT.scrollbarFiller,pinnedRight:XT["scrollbarFiller--pinnedRight"]};function K_({pinnedRight:e}){return Xp.jsx("div",{role:"presentation",className:PR(G_.root,e&&G_.pinnedRight)})}const q_=pg("div",{name:"MuiDataGrid",slot:"ColumnHeaderRow"})({display:"flex"}),Y_=["className"],X_=jh("div",{name:"MuiDataGrid",slot:"ColumnHeaders"})({display:"flex",flexDirection:"column",borderTopLeftRadius:"var(--unstable_DataGrid-radius)",borderTopRightRadius:"var(--unstable_DataGrid-radius)"}),Q_=TR(function(e,t){const{className:n}=e,r=d(e,Y_),o=rP(),i=(e=>{const{classes:t}=e;return wm({root:["columnHeaders"]},YT,t)})(o);return Xp.jsx(X_,f({className:PR(i.root,n),ownerState:o},r,{role:"presentation",ref:t}))}),Z_=["className","visibleColumns","sortColumnLookup","filterColumnLookup","columnHeaderTabIndexState","columnGroupHeaderTabIndexState","columnHeaderFocus","columnGroupHeaderFocus","headerGroupingMaxDepth","columnMenuState","columnVisibility","columnGroupsHeaderStructure","hasOtherElementInTabSequence"],J_=TR(function(e,t){const{visibleColumns:n,sortColumnLookup:r,filterColumnLookup:o,columnHeaderTabIndexState:i,columnGroupHeaderTabIndexState:a,columnHeaderFocus:l,columnGroupHeaderFocus:c,headerGroupingMaxDepth:u,columnMenuState:p,columnVisibility:h,columnGroupsHeaderStructure:m,hasOtherElementInTabSequence:g}=e,v=d(e,Z_),{getInnerProps:b,getColumnHeadersRow:y,getColumnGroupHeadersRows:w}=(e=>{const{visibleColumns:t,sortColumnLookup:n,filterColumnLookup:r,columnHeaderTabIndexState:o,columnGroupHeaderTabIndexState:i,columnHeaderFocus:a,columnGroupHeaderFocus:l,headerGroupingMaxDepth:c,columnMenuState:u,columnVisibility:d,columnGroupsHeaderStructure:p,hasOtherElementInTabSequence:h}=e,[m,g]=s.useState(""),[v,b]=s.useState(""),y=mL(),w=rP(),x=pI(y,ZF),S=pI(y,hO),C=pI(y,UA),k=pI(y,pO),E=pI(y,iO),R=EA(S,C,k.left.length),P=pI(y,iT),M=pI(y,cT),T=pI(y,uT),I=pI(y,dT),O=pI(y,fT),D=s.useCallback(e=>b(e.field),[]),F=s.useCallback(()=>b(""),[]),L=s.useCallback(e=>g(e.field),[]),A=s.useCallback(()=>g(""),[]),N=s.useMemo(()=>k.left.length?{firstColumnIndex:0,lastColumnIndex:k.left.length}:null,[k.left.length]),$=s.useMemo(()=>k.right.length?{firstColumnIndex:t.length-k.right.length,lastColumnIndex:t.length}:null,[k.right.length,t.length]);rI(y,"columnResizeStart",D),rI(y,"columnResizeStop",F),rI(y,"columnHeaderDragStart",L),rI(y,"columnHeaderDragEndNative",A);const z=e=>{const{renderContext:n=C}=e||{},r=n.firstColumnIndex,o=Math.min(n.lastColumnIndex,t.length);return{renderedColumns:t.slice(r,o),firstColumnToRender:r,lastColumnToRender:o}},j=(e,t,n,r=!1)=>{const o=e?.position===nD.RIGHT,i=void 0===e?.position,a=k.right.length>0&&o||0===k.right.length&&i,l=R-n;return Xp.jsxs(s.Fragment,{children:[i&&Xp.jsx("div",{role:"presentation",style:{width:l}}),t,i&&Xp.jsx("div",{role:"presentation",className:PR(XT.filler,r&&XT["filler--borderBottom"])}),a&&Xp.jsx(K_,{pinnedRight:o})]})},B=(e,t={})=>{const{renderedColumns:i,firstColumnToRender:l}=z(e),s=[];for(let c=0;c<i.length;c+=1){const d=i[c],p=l+c,g=0===p,b=null!==o&&o.field===d.field||g&&!h?0:-1,y=null!==a&&a.field===d.field,x=u.open&&u.field===d.field,C=e?.position,k=Fj(C,d.computedWidth,p,S,P,O),E=C===nD.RIGHT?i[c-1]:i[c+1],R=!!E&&null!==a&&a.field===E.field,I=c,D=i.length,F=Aj(C,I,w.showColumnVerticalBorder,w.pinnedColumnsSectionSeparator),L=Lj(C,I,D,w.showColumnVerticalBorder,M,w.pinnedColumnsSectionSeparator);s.push(Xp.jsx(F$,f({},n[d.field],{columnMenuOpen:x,filterItemsCounter:r[d.field]&&r[d.field].length,headerHeight:T,isDragging:d.field===m,colDef:d,colIndex:p,isResizing:v===d.field,isLast:p===S.length-1,hasFocus:y,tabIndex:b,pinnedPosition:C,pinnedOffset:k,isSiblingFocused:R,showLeftBorder:F,showRightBorder:L},t),d.field))}return j(e,s,0)},_=({depth:e,params:n})=>{const r=z(n);if(0===r.renderedColumns.length)return null;const{firstColumnToRender:o,lastColumnToRender:a}=r,s=p[e],u=t[o].field,h=x[u]?.[e]??null,m=s.findIndex(({groupId:e,columnFields:t})=>e===h&&t.includes(u)),g=t[a-1].field,v=x[g]?.[e]??null,b=s.findIndex(({groupId:e,columnFields:t})=>e===v&&t.includes(g)),y=s.slice(m,b+1).map(e=>f({},e,{columnFields:e.columnFields.filter(e=>!1!==d[e])})).filter(e=>e.columnFields.length>0),C=y[0].columnFields.indexOf(u),k=y[0].columnFields.slice(0,C).reduce((e,t)=>e+(E[t].computedWidth??0),0);let R=o;const T=y.map(({groupId:t,columnFields:r},o)=>{const a=null!==l&&l.depth===e&&r.includes(l.field),s=null!==i&&i.depth===e&&r.includes(i.field)?0:-1,u={width:r.reduce((e,t)=>e+E[t].computedWidth,0),fields:r,colIndex:R},d=n.position,p=Fj(d,u.width,R,S,P,O);R+=r.length;let f=o;return d===nD.LEFT&&(f=R-1),Xp.jsx(U_,{groupId:t,width:u.width,fields:u.fields,colIndex:u.colIndex,depth:e,isLastColumn:o===y.length-1,maxDepth:c,height:I,hasFocus:a,tabIndex:s,pinnedPosition:d,pinnedOffset:p,showLeftBorder:Aj(d,f,w.showColumnVerticalBorder,w.pinnedColumnsSectionSeparator),showRightBorder:Lj(d,f,y.length,w.showColumnVerticalBorder,M,w.pinnedColumnsSectionSeparator)},o)});return j(n,T,k)};return{renderContext:C,leftRenderContext:N,rightRenderContext:$,pinnedColumns:k,visibleColumns:t,columnPositions:S,getFillers:j,getColumnHeadersRow:()=>Xp.jsxs(q_,{role:"row","aria-rowindex":c+1,ownerState:w,className:XT["row--borderBottom"],style:{height:T},children:[N&&B({position:nD.LEFT,renderContext:N},{disableReorder:!0}),B({renderContext:C}),$&&B({position:nD.RIGHT,renderContext:$},{disableReorder:!0,separatorSide:M$.Left})]}),getColumnsToRender:z,getColumnGroupHeadersRows:()=>{if(0===c)return null;const e=[];for(let t=0;t<c;t+=1)e.push(Xp.jsxs(q_,{role:"row","aria-rowindex":t+1,ownerState:w,style:{height:I},children:[N&&_({depth:t,params:{position:nD.LEFT,renderContext:N,maxLastColumn:N.lastColumnIndex}}),_({depth:t,params:{renderContext:C}}),$&&_({depth:t,params:{position:nD.RIGHT,renderContext:$,maxLastColumn:$.lastColumnIndex}})]},t));return e},getPinnedCellOffset:Fj,isDragging:!!m,getInnerProps:()=>({role:"rowgroup"})}})({visibleColumns:n,sortColumnLookup:r,filterColumnLookup:o,columnHeaderTabIndexState:i,columnGroupHeaderTabIndexState:a,columnHeaderFocus:l,columnGroupHeaderFocus:c,headerGroupingMaxDepth:u,columnMenuState:p,columnVisibility:h,columnGroupsHeaderStructure:m,hasOtherElementInTabSequence:g});return Xp.jsxs(Q_,f({},v,b(),{ref:t,children:[w(),y()]}))}),eH=KT(J_);const tH=TR(function(e,t){const n=lP().current.getLocaleText("noResultsOverlayLabel");return Xp.jsx(r$,f({},e,{ref:t,children:n}))}),nH=jh("div")({position:"sticky",zIndex:40,bottom:"calc(var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize))"});const rH=f({},SM,{cell:TN,skeletonCell:AN,columnHeaderFilterIconButton:function(e){return e.counter?Xp.jsx(H$,f({},e)):null},columnHeaderSortIcon:_$,columnMenu:ez,columnHeaders:eH,detailPanels:function(e){return null},bottomContainer:function(e){const t=wm({root:["bottomContainer"]},YT,{});return Xp.jsx(nH,f({},e,{className:PR(t.root,XT["container--bottom"]),role:"presentation"}))},footer:Dj,footerRowCount:Yj,toolbar:function(e){const{showQuickFilter:t=!0,quickFilterProps:n,csvOptions:r,printOptions:o,additionalItems:i,additionalExportMenuItems:a}=e,l=d(e,Cj),c=lP(),u=rP(),[p,h]=s.useState(!1),m=s.useRef(null),g=mm(),v=mm(),b=!r?.disableToolbarButton||!o?.disableToolbarButton||a,y=()=>h(!1);return Xp.jsxs(c$,f({},l,{children:[u.label&&Xp.jsx(Mj,{children:u.label}),!u.disableColumnSelector&&Xp.jsx(u.slots.baseTooltip,{title:c.current.getLocaleText("toolbarColumns"),children:Xp.jsx(gj,{render:Xp.jsx(d$,{}),children:Xp.jsx(u.slots.columnSelectorIcon,{fontSize:"small"})})}),!u.disableColumnFilter&&Xp.jsx(u.slots.baseTooltip,{title:c.current.getLocaleText("toolbarFilters"),children:Xp.jsx(hj,{render:(e,t)=>Xp.jsx(d$,f({},e,{color:t.filterCount>0?"primary":"default",children:Xp.jsx(u.slots.baseBadge,{badgeContent:t.filterCount,color:"primary",variant:"dot",children:Xp.jsx(u.slots.openFilterButtonIcon,{fontSize:"small"})})}))})}),i,b&&(!u.disableColumnFilter||!u.disableColumnSelector)&&Xp.jsx(Pj,{}),b&&Xp.jsxs(s.Fragment,{children:[Xp.jsx(u.slots.baseTooltip,{title:c.current.getLocaleText("toolbarExport"),disableInteractive:p,children:Xp.jsx(d$,{ref:m,id:v,"aria-controls":g,"aria-haspopup":"true","aria-expanded":p?"true":void 0,onClick:()=>h(!p),children:Xp.jsx(u.slots.exportIcon,{fontSize:"small"})})}),Xp.jsx(UO,{target:m.current,open:p,onClose:y,position:"bottom-end",children:Xp.jsxs(u.slots.baseMenuList,f({id:g,"aria-labelledby":v,autoFocusItem:!0},u.slotProps?.baseMenuList,{children:[!o?.disableToolbarButton&&Xp.jsx(wj,{render:Xp.jsx(u.slots.baseMenuItem,f({},u.slotProps?.baseMenuItem)),options:o,onClick:y,children:c.current.getLocaleText("toolbarExportPrint")}),!r?.disableToolbarButton&&Xp.jsx(bj,{render:Xp.jsx(u.slots.baseMenuItem,f({},u.slotProps?.baseMenuItem)),options:r,onClick:y,children:c.current.getLocaleText("toolbarExportCSV")}),a?.(y)]}))})]}),t&&Xp.jsxs(s.Fragment,{children:[Xp.jsx(Pj,{}),Xp.jsx(pj,f({},n))]})]}))},pinnedRows:function(e){return null},loadingOverlay:Vj,noResultsOverlay:tH,noRowsOverlay:Wj,noColumnsOverlay:Uj,pagination:function(){const e=lP(),t=rP(),n=pI(e,lF),r=pI(e,sF),o=pI(e,pF),{paginationMode:i,loading:a}=t,l=-1===r&&"server"===i&&a,c=s.useMemo(()=>Math.max(0,o-1),[o]),u=s.useMemo(()=>-1===r||n.page<=c?n.page:c,[c,n.page,r]),d=s.useCallback(t=>{e.current.setPageSize(t)},[e]),p=s.useCallback((t,n)=>{e.current.setPage(n)},[e]),h=(e=>{for(let n=0;n<t.pageSizeOptions.length;n+=1){const r=t.pageSizeOptions[n];if("number"==typeof r){if(r===e)return!0}else if(r.value===e)return!0}return!1})(n.pageSize)?t.pageSizeOptions:[];return Xp.jsx(Gj,f({as:t.slots.basePagination,count:r,page:u,rowsPerPageOptions:h,rowsPerPage:n.pageSize,onPageChange:p,onRowsPerPageChange:d,disabled:l},t.slotProps?.basePagination))},filterPanel:Mz,columnsPanel:function(e){const t=rP();return Xp.jsx(rz,f({},e,{children:Xp.jsx(t.slots.columnsManagement,f({},t.slotProps?.columnsManagement))}))},columnsManagement:function(e){const t=lP(),n=s.useRef(null),r=pI(t,sO),o=pI(t,lO),i=rP(),[a,l]=s.useState(""),c=(e=>{const{classes:t}=e;return wm({root:["columnsManagement"],header:["columnsManagementHeader"],searchInput:["columnsManagementSearchInput"],footer:["columnsManagementFooter"],row:["columnsManagementRow"]},YT,t)})(i),u=pI(t,aO),d=pI(t,SL),p=pI(t,kL),h=s.useMemo(()=>d?Array.from(p.values()):u,[d,p,u]),{sort:m,searchPredicate:g=Tz,autoFocusSearchField:v=!0,disableShowHideToggle:b=!1,disableResetButton:y=!1,toggleAllMode:w="all",getTogglableColumns:x,searchInputProps:S,searchDebounceMs:C=i.columnFilterDebounceMs}=e,k=s.useMemo(()=>Cg(e=>{l(e)},C??150),[C]),E=s.useMemo(()=>((e,t)=>{const n=new Set(Object.keys(e).filter(t=>!1===e[t])),r=new Set(Object.keys(t).filter(e=>!1===t[e]));if(n.size!==r.size)return!1;let o=!0;return n.forEach(e=>{r.has(e)||(o=!1)}),o})(o,r),[o,r]),R=s.useMemo(()=>{switch(m){case"asc":return[...h].sort((e,t)=>Az.compare(e.headerName||e.field,t.headerName||t.field));case"desc":return[...h].sort((e,t)=>-Az.compare(e.headerName||e.field,t.headerName||t.field));default:return h}},[h,m]),P=e=>{const{name:n}=e.target;t.current.setColumnVisibility(n,!1===o[n])},M=s.useMemo(()=>{const e=x?x(R):null,t=e?R.filter(({field:t})=>e.includes(t)):R;return a?t.filter(e=>g(e,a.toLowerCase())):t},[R,a,g,x]),T=s.useCallback(e=>{const n=f({},lO(t)),r=x?x(h):null;return("filteredOnly"===w?M:h).forEach(t=>{t.hideable&&(null==r||r.includes(t.field))&&(e?delete n[t.field]:n[t.field]=!1)}),t.current.setColumnVisibilityModel(n)},[t,h,x,w,M]),I=s.useCallback(e=>{k(e.target.value)},[k]),O=s.useMemo(()=>M.filter(e=>e.hideable),[M]),D=s.useMemo(()=>O.every(e=>null==o[e.field]||!1!==o[e.field]),[o,O]),F=s.useMemo(()=>O.every(e=>!1===o[e.field]),[o,O]),L=s.useRef(null);s.useEffect(()=>{v?n.current?.focus():L.current&&"function"==typeof L.current.focus&&L.current.focus()},[v]);let A=!1;const N=e=>!1===A&&!1!==e.hideable&&(A=!0,!0),$=s.useCallback(()=>{l(""),n.current&&(n.current.value="",n.current.focus())},[]);return Xp.jsxs(s.Fragment,{children:[Xp.jsx(zz,{className:c.header,ownerState:i,children:Xp.jsx(jz,f({as:i.slots.baseTextField,ownerState:i,placeholder:t.current.getLocaleText("columnsManagementSearchTitle"),inputRef:n,className:c.searchInput,onChange:I,size:"small",type:"search",slotProps:{input:{startAdornment:Xp.jsx(i.slots.quickFilterIcon,{fontSize:"small"}),endAdornment:Xp.jsx(i.slots.baseIconButton,f({size:"small","aria-label":t.current.getLocaleText("columnsManagementDeleteIconLabel"),style:a?{visibility:"visible"}:{visibility:"hidden"},tabIndex:-1,onClick:$,edge:"end"},i.slotProps?.baseIconButton,{children:Xp.jsx(i.slots.quickFilterClearIcon,{fontSize:"small"})}))},htmlInput:{"aria-label":t.current.getLocaleText("columnsManagementSearchTitle")}},autoComplete:"off",fullWidth:!0},i.slotProps?.baseTextField,S))}),Xp.jsx($z,{ownerState:i,children:Xp.jsxs(Nz,{className:c.root,ownerState:i,children:[M.map(e=>Xp.jsx(Hz,f({as:i.slots.baseCheckbox,className:c.row,disabled:!1===e.hideable||d,checked:!1!==o[e.field],onChange:P,name:e.field,inputRef:N(e)?L:void 0,label:e.headerName||e.field,density:"compact",fullWidth:!0},i.slotProps?.baseCheckbox),e.field)),0===M.length&&Xp.jsx(_z,{ownerState:i,children:t.current.getLocaleText("columnsManagementNoColumns")})]})}),b&&y?null:Xp.jsxs(Bz,{ownerState:i,className:c.footer,children:[b?Xp.jsx("span",{}):Xp.jsx(i.slots.baseCheckbox,f({disabled:0===O.length||d,checked:D,indeterminate:!D&&!F,onChange:()=>T(!D),name:t.current.getLocaleText("columnsManagementShowHideAllText"),label:t.current.getLocaleText("columnsManagementShowHideAllText"),density:"compact"},i.slotProps?.baseCheckbox)),y?null:Xp.jsx(i.slots.baseButton,f({onClick:()=>t.current.setColumnVisibilityModel(r),disabled:E||d},i.slotProps?.baseButton,{children:t.current.getLocaleText("columnsManagementReset")}))]})]})},panel:sz,row:iB}),oH={disableMultipleColumnsFiltering:!0,disableMultipleColumnsSorting:!0,throttleRowsMs:void 0,hideFooterRowCount:!1,pagination:!0,checkboxSelectionVisibleOnly:!1,disableColumnReorder:!0,keepColumnPositionIfDraggedOutside:!1,signature:"DataGrid",listView:!1},iH=rH,aH=e=>{const t=sg(),n=s.useMemo(()=>Vh({props:e,theme:t,name:"MuiDataGrid"}),[t,e]),r=s.useMemo(()=>f({},qT,n.localeText),[n.localeText]),o=s.useMemo(()=>function({defaultSlots:e,slots:t}){const n=t;if(!n||0===Object.keys(n).length)return e;const r=f({},e);return Object.keys(n).forEach(e=>{const t=e;void 0!==n[t]&&(r[t]=n[t])}),r}({defaultSlots:iH,slots:n.slots}),[n.slots]),i=s.useMemo(()=>Object.keys(dN).reduce((e,t)=>(e[t]=n[t]??dN[t],e),{}),[n]);return s.useMemo(()=>f({},n,i,{localeText:r,slots:o},(e=>f({},oH,e.dataSource?{filterMode:"server",sortingMode:"server",paginationMode:"server"}:{}))(n)),[n,r,o,i])};class lH{maxListeners=20;warnOnce=!1;events={};on(e,t,n={}){let r=this.events[e];r||(r={highPriority:new Map,regular:new Map},this.events[e]=r),n.isFirst?r.highPriority.set(t,!0):r.regular.set(t,!0)}removeListener(e,t){this.events[e]&&(this.events[e].regular.delete(t),this.events[e].highPriority.delete(t))}removeAllListeners(){this.events={}}emit(e,...t){const n=this.events[e];if(!n)return;const r=Array.from(n.highPriority.keys()),o=Array.from(n.regular.keys());for(let e=r.length-1;e>=0;e-=1){const o=r[e];n.highPriority.has(o)&&o.apply(this,t)}for(let e=0;e<o.length;e+=1){const r=o[e];n.regular.has(r)&&r.apply(this,t)}}once(e,t){const n=this;this.on(e,function r(...o){n.removeListener(e,r),t.apply(n,o)})}}const sH=Symbol("mui.api_private");let cH=0;function uH(e,t){const n=s.useRef(null),r=s.useRef(null);r.current||(r.current=function(e){const t=e.current?.[sH];if(t)return t;const n={},r={state:n,store:JM.create(n),instanceId:{id:cH}};return cH+=1,r.getPublicApi=()=>e.current,r.register=(t,n)=>{Object.keys(n).forEach(o=>{const i=n[o],a=r[o];if(!0===a?.spying?a.target=i:r[o]=i,"public"===t){const t=e.current,n=t[o];!0===n?.spying?n.target=i:t[o]=i}})},r.register("private",{caches:{},eventManager:new lH}),r}(n)),n.current||(n.current=function(e){return{get state(){return e.current.state},get store(){return e.current.store},get instanceId(){return e.current.instanceId},[sH]:e.current}}(r));const o=s.useCallback((...e)=>{const[n,o,i={}]=e;if(i.defaultMuiPrevented=!1,(e=>void 0!==e.isPropagationStopped)(i)&&i.isPropagationStopped())return;const a=t.signature===QT.DataGridPro||t.signature===QT.DataGridPremium?{api:r.current.getPublicApi()}:{};r.current.eventManager.emit(n,o,i,a)},[r,t.signature]),i=s.useCallback((e,t,n)=>{r.current.eventManager.on(e,t,n);const o=r.current;return()=>{o.eventManager.removeListener(e,t)}},[r]);return vL(r,{subscribeEvent:i,publishEvent:o},"public"),e&&!e.current?.state&&(e.current=n.current),s.useImperativeHandle(e,()=>n.current,[n]),s.useEffect(()=>{const e=r.current;return()=>{e.publishEvent("unmount")}},[r]),r}const dH={hooks:{useCSSVariables:function(){const e=sg();return s.useMemo(()=>{const t=fP(function(e){const t=new WeakSet;return JSON.stringify(e,(e,n)=>{if("undefined"!=typeof window&&n===window||"undefined"!=typeof document&&n===document)return n.toString();if(null!==n&&"object"==typeof n){if(s.isValidElement(n))return null;if(t.has(n))return null;t.add(n)}return n})}(e)),n=function(e){const t=function(e){if(e.vars)return e.vars.palette.TableCell.border;if("light"===e.palette.mode)return im(tm(e.palette.divider,1),.88);return rm(tm(e.palette.divider,1),.68)}(e),n=(e.vars||e).palette.DataGrid,r=n?.bg??("dark"===e.palette.mode?`color-mix(in srgb, ${(e.vars||e).palette.background.paper} 95%, #fff)`:(e.vars||e).palette.background.paper),o=n?.headerBg??r,i=n?.pinnedBg??r,a=e.vars?`rgba(${e.vars.palette.background.defaultChannel} / ${e.vars.palette.action.disabledOpacity})`:tm(e.palette.background.default,e.palette.action.disabledOpacity),l="dark"===e.palette.mode?`color-mix(in srgb, ${(e.vars||e).palette.background.paper} 90%, #fff)`:(e.vars||e).palette.background.paper,s=e.vars?`rgb(${e.vars.palette.primary.mainChannel})`:e.palette.primary.main,c=function(e){if(e.vars)return e.vars.shape.borderRadius;return"number"==typeof e.shape.borderRadius?`${e.shape.borderRadius}px`:e.shape.borderRadius}(e),u=e.vars?.font?.body2??xP(e.typography.body2),d=e.vars?.font?.caption??xP(e.typography.caption),p=e.vars?.font?.body1??xP(e.typography.body1),f=bP.keys;return{[f.spacingUnit]:e.vars?e.vars.spacing??e.spacing(1):e.spacing(1),[f.colors.border.base]:t,[f.colors.background.base]:r,[f.colors.background.overlay]:l,[f.colors.background.backdrop]:a,[f.colors.foreground.base]:(e.vars||e).palette.text.primary,[f.colors.foreground.muted]:(e.vars||e).palette.text.secondary,[f.colors.foreground.accent]:(e.vars||e).palette.primary.dark,[f.colors.foreground.disabled]:(e.vars||e).palette.text.disabled,[f.colors.foreground.error]:(e.vars||e).palette.error.dark,[f.colors.interactive.hover]:(e.vars||e).palette.action.hover,[f.colors.interactive.hoverOpacity]:(e.vars||e).palette.action.hoverOpacity,[f.colors.interactive.focus]:wP((e.vars||e).palette.primary.main),[f.colors.interactive.focusOpacity]:(e.vars||e).palette.action.focusOpacity,[f.colors.interactive.disabled]:wP((e.vars||e).palette.action.disabled),[f.colors.interactive.disabledOpacity]:(e.vars||e).palette.action.disabledOpacity,[f.colors.interactive.selected]:s,[f.colors.interactive.selectedOpacity]:(e.vars||e).palette.action.selectedOpacity,[f.header.background.base]:o,[f.cell.background.pinned]:i,[f.radius.base]:c,[f.typography.fontFamily.base]:e.typography.fontFamily,[f.typography.fontWeight.light]:e.typography.fontWeightLight,[f.typography.fontWeight.regular]:e.typography.fontWeightRegular,[f.typography.fontWeight.medium]:e.typography.fontWeightMedium,[f.typography.fontWeight.bold]:e.typography.fontWeightBold,[f.typography.font.body]:u,[f.typography.font.small]:d,[f.typography.font.large]:p,[f.transitions.easing.easeIn]:e.transitions.easing.easeIn,[f.transitions.easing.easeOut]:e.transitions.easing.easeOut,[f.transitions.easing.easeInOut]:e.transitions.easing.easeInOut,[f.transitions.duration.short]:`${e.transitions.duration.shorter}ms`,[f.transitions.duration.base]:`${e.transitions.duration.short}ms`,[f.transitions.duration.long]:`${e.transitions.duration.standard}ms`,[f.shadows.base]:(e.vars||e).shadows[2],[f.shadows.overlay]:(e.vars||e).shadows[8],[f.zIndex.panel]:(e.vars||e).zIndex.modal,[f.zIndex.menu]:(e.vars||e).zIndex.modal}}(e);return{id:t,variables:n}},[e])},useGridAriaAttributes:()=>{const e=mL(),t=rP(),n=pI(e,cO),r=pI(e,MD),o=pI(e,tL),i=pI(e,IT),a=t["aria-label"],l=t["aria-labelledby"];return{role:"grid","aria-label":!a&&!l&&t.label?t.label:a,"aria-labelledby":l,"aria-colcount":n.length,"aria-rowcount":o+1+i+r,"aria-multiselectable":HD(t)}},useGridRowAriaAttributes:()=>{const e=mL(),t=pI(e,tL);return s.useCallback((n,r)=>{const o={},i=r+t+2;return o["aria-rowindex"]=i,n&&e.current.isRowSelectable(n.id)&&(o["aria-selected"]=e.current.isRowSelected(n.id)),o},[e,t])},useGridRowsOverridableMethods:e=>{const t=s.useCallback((t,n,r)=>{const o=ST(e,t),i=ST(e,n);if(!o)throw new Error(`MUI X: No row with id #${t} found.`);if(!i)throw new Error(`MUI X: No row with id #${n} found.`);if("leaf"!==o.type)throw new Error("MUI X: The row reordering does not support reordering of footer or grouping rows.");if("inside"===r)throw new Error("MUI X: The 'inside' position is only supported for tree data. Use 'above' or 'below' for flat data.");const a=FD(e),l=a[n];if(void 0===l)throw new Error(`MUI X: Target row with id #${n} not found in current view.`);const s=a[t];if(void 0===s)throw new Error(`MUI X: Source row with id #${t} not found in current view.`);let c;c="up"===(l<s?"up":"down")?"above"===r?l:l+1:"above"===r?l-1:l,c!==s&&(e.current.setState(t=>{const n=xT(e)[OT],r=[...n.children];return r.splice(c,0,r.splice(s,1)[0]),f({},t,{rows:f({},t.rows,{tree:f({},t.rows.tree,{[OT]:f({},n,{children:r})})})})}),e.current.publishEvent("rowsSet"))},[e]),n=s.useCallback((t,n)=>{const r=ST(e,t);if(!r)throw new Error(`MUI X: No row with id #${t} found.`);if("leaf"!==r.type)throw new Error("MUI X: The row reordering does not support reordering of footer or grouping rows.");e.current.setState(r=>{const o=xT(e)[OT],i=o.children,a=i.findIndex(e=>e===t);if(-1===a||a===n)return r;const l=[...i];return l.splice(n,0,l.splice(a,1)[0]),f({},r,{rows:f({},r.rows,{tree:f({},r.rows.tree,{[OT]:f({},o,{children:l})})})})}),e.current.publishEvent("rowsSet")},[e]);return{setRowIndex:n,setRowPosition:t}},useGridParamsOverridableMethods:e=>{const t=s.useCallback((t,n)=>{const r=e.current.getColumn(n),o=e.current.getRow(t);if(!o)throw new Error(`No row with id #${t} found`);return r&&r.valueGetter?r.valueGetter(o[r.field],o,r,e):o[n]},[e]),n=s.useCallback((t,n)=>LT(t,n,e),[e]),r=s.useCallback((t,r)=>{const o=n(t,r);return r&&r.valueFormatter?r.valueFormatter(o,t,r,e):o},[e,n]);return{getCellValue:t,getRowValue:n,getRowFormattedValue:r}},useIsCellEditable:()=>s.useCallback(e=>!jT(e.rowNode),[]),useCellAggregationResult:()=>null,useFilterValueGetter:e=>e.current.getRowValue}},pH=function(e,t){const n=aH(e),r=uH(n.apiRef,n);return W_(r,n,dH),Xp.jsx(aB,{privateApiRef:r,configuration:dH,props:n,children:Xp.jsx(QN,f({className:n.className,style:n.style,sx:n.sx},n.slotProps?.root,{ref:t}))})},fH=s.memo(TR(pH));pH.propTypes={apiRef:C.shape({current:C.object}),"aria-label":C.string,"aria-labelledby":C.string,autoHeight:C.bool,autoPageSize:C.bool,autosizeOnMount:C.bool,autosizeOptions:C.shape({columns:C.arrayOf(C.string),disableColumnVirtualization:C.bool,expand:C.bool,includeHeaders:C.bool,includeOutliers:C.bool,outliersFactor:C.number}),cellModesModel:C.object,checkboxSelection:C.bool,classes:C.object,className:C.string,clipboardCopyCellDelimiter:C.string,columnBufferPx:C.number,columnFilterDebounceMs:C.number,columnGroupHeaderHeight:C.number,columnGroupingModel:C.arrayOf(C.object),columnHeaderHeight:C.number,columns:C.arrayOf(C.object).isRequired,columnVisibilityModel:C.object,dataSource:C.shape({getRows:C.func.isRequired,updateRow:C.func}),dataSourceCache:C.shape({clear:C.func.isRequired,get:C.func.isRequired,set:C.func.isRequired}),density:C.oneOf(["comfortable","compact","standard"]),disableAutosize:C.bool,disableColumnFilter:C.bool,disableColumnMenu:C.bool,disableColumnResize:C.bool,disableColumnSelector:C.bool,disableColumnSorting:C.bool,disableDensitySelector:C.bool,disableEval:C.bool,disableMultipleRowSelection:C.bool,disableRowSelectionExcludeModel:C.bool,disableRowSelectionOnClick:C.bool,disableVirtualization:C.bool,editMode:C.oneOf(["cell","row"]),estimatedRowCount:C.number,experimentalFeatures:C.shape({warnIfFocusStateIsNotSynced:C.bool}),filterDebounceMs:C.number,filterMode:C.oneOf(["client","server"]),filterModel:C.shape({items:C.arrayOf(C.shape({field:C.string.isRequired,id:C.oneOfType([C.number,C.string]),operator:C.string.isRequired,value:C.any})).isRequired,logicOperator:C.oneOf(["and","or"]),quickFilterExcludeHiddenColumns:C.bool,quickFilterLogicOperator:C.oneOf(["and","or"]),quickFilterValues:C.array}),getCellClassName:C.func,getDetailPanelContent:C.func,getEstimatedRowHeight:C.func,getRowClassName:C.func,getRowHeight:C.func,getRowId:C.func,getRowSpacing:C.func,hideFooter:C.bool,hideFooterPagination:C.bool,hideFooterSelectedRowCount:C.bool,ignoreDiacritics:C.bool,ignoreValueFormatterDuringExport:C.oneOfType([C.shape({clipboardExport:C.bool,csvExport:C.bool}),C.bool]),initialState:C.object,isCellEditable:C.func,isRowSelectable:C.func,keepNonExistentRowsSelected:C.bool,label:C.string,loading:C.bool,localeText:C.object,logger:C.shape({debug:C.func.isRequired,error:C.func.isRequired,info:C.func.isRequired,warn:C.func.isRequired}),logLevel:C.oneOf(["debug","error","info","warn",!1]),nonce:C.string,onCellClick:C.func,onCellDoubleClick:C.func,onCellEditStart:C.func,onCellEditStop:C.func,onCellKeyDown:C.func,onCellModesModelChange:C.func,onClipboardCopy:C.func,onColumnHeaderClick:C.func,onColumnHeaderContextMenu:C.func,onColumnHeaderDoubleClick:C.func,onColumnHeaderEnter:C.func,onColumnHeaderLeave:C.func,onColumnHeaderOut:C.func,onColumnHeaderOver:C.func,onColumnOrderChange:C.func,onColumnResize:C.func,onColumnVisibilityModelChange:C.func,onColumnWidthChange:C.func,onDataSourceError:C.func,onDensityChange:C.func,onFilterModelChange:C.func,onMenuClose:C.func,onMenuOpen:C.func,onPaginationMetaChange:C.func,onPaginationModelChange:C.func,onPreferencePanelClose:C.func,onPreferencePanelOpen:C.func,onProcessRowUpdateError:C.func,onResize:C.func,onRowClick:C.func,onRowCountChange:C.func,onRowDoubleClick:C.func,onRowEditStart:C.func,onRowEditStop:C.func,onRowModesModelChange:C.func,onRowSelectionModelChange:C.func,onSortModelChange:C.func,onStateChange:C.func,pageSizeOptions:C.arrayOf(C.oneOfType([C.number,C.shape({label:C.string.isRequired,value:C.number.isRequired})]).isRequired),pagination:C.oneOf([!0]),paginationMeta:C.shape({hasNextPage:C.bool}),paginationMode:C.oneOf(["client","server"]),paginationModel:C.shape({page:C.number.isRequired,pageSize:C.number.isRequired}),processRowUpdate:C.func,resizeThrottleMs:C.number,rowBufferPx:C.number,rowCount:C.number,rowHeight:C.number,rowModesModel:C.object,rows:C.arrayOf(C.object),rowSelection:C.bool,rowSelectionModel:C.shape({ids:C.instanceOf(Set).isRequired,type:C.oneOf(["exclude","include"]).isRequired}),rowSpacingType:C.oneOf(["border","margin"]),rowSpanning:C.bool,scrollbarSize:C.number,showCellVerticalBorder:C.bool,showColumnVerticalBorder:C.bool,showToolbar:C.bool,slotProps:C.object,slots:C.object,sortingMode:C.oneOf(["client","server"]),sortingOrder:C.arrayOf(C.oneOf(["asc","desc"])),sortModel:C.arrayOf(C.shape({field:C.string.isRequired,sort:C.oneOf(["asc","desc"])})),style:C.object,sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),virtualizeColumnsWithAutoRowHeight:C.bool};var hH=Sg(Xp.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),mH=Sg(Xp.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"})),gH=Sg(Xp.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"})),vH=Sg(Xp.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),bH=Sg(Xp.jsx("path",{d:"M8 5v14l11-7z"}));const yH=({open:e,title:t="Confirm Action",message:n,onConfirm:r,onCancel:o,confirmText:i="Confirm",cancelText:a="Cancel",confirmColor:l="error"})=>c.createElement(zx,{open:e,onClose:o,"aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-description"},c.createElement(Qx,{id:"confirm-dialog-title"},t),c.createElement(Gx,null,c.createElement(Yx,{id:"confirm-dialog-description"},n)),c.createElement(_x,null,c.createElement(Xw,{onClick:o,variant:"outlined"},a),c.createElement(Xw,{onClick:r,variant:"contained",color:l,autoFocus:!0},i))),wH=({onSelectReport:e,onAddNew:t,onCloneReport:n,onRunReport:r,refreshTrigger:o})=>{const i=ER(),[a,l]=s.useState([]),[u,d]=s.useState(!0),[p,f]=s.useState(null),[h,m]=s.useState(!1),[g,v]=s.useState(null);s.useEffect(()=>{b()},[o]);const b=async()=>{try{d(!0),f(null);const e=await jc.getReportDefinitions();l(e)}catch(e){console.error("Error loading report definitions:",e);const t="Failed to load report definitions: "+(e.message||"Unknown error");f(t),i.error(t)}finally{d(!1)}},y=[{field:"title",headerName:"Title",flex:1,minWidth:200},{field:"provider",headerName:"Provider",flex:1,minWidth:200},{field:"actions",headerName:"Actions",width:200,sortable:!1,filterable:!1,disableColumnMenu:!0,renderCell:t=>c.createElement(jw,{sx:{display:"flex",gap:1}},c.createElement(Hk,{title:"Run"},c.createElement(Mv,{size:"small",color:"success",onClick:e=>{return n=t.row.id,e.stopPropagation(),void r(n);var n}},c.createElement(bH,{fontSize:"small"}))),c.createElement(Hk,{title:"Edit"},c.createElement(Mv,{size:"small",color:"primary",onClick:n=>{return r=t.row.id,n.stopPropagation(),void e(r);var r}},c.createElement(mH,{fontSize:"small"}))),c.createElement(Hk,{title:"Clone"},c.createElement(Mv,{size:"small",onClick:e=>(async(e,t)=>{t.stopPropagation();try{const t=await jc.getReportDefinition({id:e}),r={...t,title:`${t.title} (Copy)`};n(r)}catch(e){console.error("Error cloning report:",e),i.error("Failed to clone report: "+(e.message||"Unknown error"))}})(t.row.id,e)},c.createElement(gH,{fontSize:"small"}))),c.createElement(Hk,{title:"Delete"},c.createElement(Mv,{size:"small",color:"error",onClick:e=>((e,t)=>{t.stopPropagation();const n=a.find(t=>t.id===e);v(n),m(!0)})(t.row.id,e)},c.createElement(vH,{fontSize:"small"}))))}],w=a.map(e=>({id:e.id,title:e.title,provider:e.provider}));return u?c.createElement(jw,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400},c.createElement(Cv,null)):p?c.createElement(jw,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:400,gap:2},c.createElement(Gv,{variant:"body1",color:"error"},p),c.createElement(Xw,{variant:"contained",onClick:b},"Retry")):c.createElement(jw,{sx:{p:3}},c.createElement(jw,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3}},c.createElement(Gv,{variant:"h4",component:"h1"},"Report Definitions"),c.createElement(Xw,{variant:"contained",color:"primary",startIcon:c.createElement(hH,null),onClick:t},"Add New Report")),c.createElement(jw,{sx:{height:600,width:"100%"}},c.createElement(fH,{rows:w,columns:y,pageSize:10,rowsPerPageOptions:[10,25,50],disableSelectionOnClick:!0,onRowClick:t=>{e(t.row.id)},sx:{"& .MuiDataGrid-row":{cursor:"pointer"},"& .MuiDataGrid-row:hover":{backgroundColor:"#f5f5f5"},"& .MuiDataGrid-columnHeader":{backgroundColor:"#f5f5f5",fontWeight:"bold"}}})),c.createElement(yH,{open:h,title:"Delete Report Definition",message:g?`Are you sure you want to delete "${g.title}"? This action cannot be undone.`:"",onConfirm:async()=>{if(g)try{await jc.deleteReportDefinition({id:g.id}),i.success(`Report "${g.title}" deleted successfully!`),m(!1),v(null),b()}catch(e){console.error("Error deleting report:",e),i.error("Failed to delete report: "+(e.response?.data?.message||e.message||"Unknown error")),m(!1),v(null)}},onCancel:()=>{m(!1),v(null)},confirmText:"Delete",cancelText:"Cancel",confirmColor:"error"}))};var xH=Sg(Xp.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),SH=Sg(Xp.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),CH=Sg(Xp.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}));const kH=({providersData:e,rootProvider:t,onSelectionChange:n,existingDimensions:r=[],existingMetrics:o=[],existingFilters:i={}})=>{const[a,l]=s.useState([]);s.useEffect(()=>{l([]),n&&n([])},[t]);const u=t=>{if(!e||!t)return[];const n=e[t];if(!n||!n.relations||0===n.relations.length)return[];const a=(()=>{const e=new Map,t=t=>{if(t.relations&&t.providerPath)for(let n=0;n<t.relations.length;n++){const r=t.relations[n],o=t.providerPath[n];r.type&&(e.has(o)||e.set(o,new Set),e.get(o).add(r.name))}};return r.forEach(t),o.forEach(t),Object.values(i).forEach(t),e})().get(t);return n.relations.filter(t=>e[t.target]).map(e=>{let t=!1,n=null;if(!!e.type&&a&&a.size>0){if(!a.has(e.name)&&a.size>0){t=!0;n=`Cannot select: '${Array.from(a)[0]}' is already in use`}}return{key:e.name,value:e.name,targetKey:e.target,disabled:t,disabledReason:n}})},d=(e,r)=>{const o=r.target.value,i=0===e?t:a[e-1].targetKey,s=u(i).find(e=>e.key===o);if(!s)return;const c=a.slice(0,e);c.push({providerKey:o,relationName:o,targetKey:s.targetKey}),l(c),console.log("Selection chain:",c),n&&n(c)};return c.createElement(jw,null,a.length>0&&c.createElement(jw,{sx:{marginBottom:2}},c.createElement(Gv,{variant:"subtitle2",sx:{marginBottom:1,color:"text.secondary"}},"Selected Path:"),c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"}},c.createElement(zy,{label:t,size:"small",color:"primary",variant:"outlined"}),a.map((e,t)=>c.createElement(c.Fragment,{key:t},c.createElement(Gv,{variant:"body2",sx:{color:"text.secondary"}},"→"),c.createElement(zy,{label:e.targetKey,size:"small",color:"primary",onDelete:()=>(e=>{const t=a.slice(0,e);l(t),n&&n(t)})(t),sx:{fontWeight:500}}))))),c.createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",gap:"8px"}},(()=>{if(!e||!t)return null;const n=[],r=u(t);r.length>0&&n.push(c.createElement("div",{key:"level-0",style:{marginRight:"16px"}},c.createElement(uR,{items:r,value:a[0]?.providerKey||"",label:`Related to ${t}`,onChange:e=>d(0,e),sx:{width:"300px"}})));for(let e=0;e<a.length;e++){const t=a[e],r=u(t.targetKey);if(r.length>0){const o=a[e+1];n.push(c.createElement("div",{key:`level-${e+1}`,style:{marginRight:"16px"}},c.createElement(uR,{items:r,value:o?.providerKey||"",label:`Related to ${t.targetKey}`,onChange:t=>d(e+1,t),sx:{width:"300px"}})))}}return n})()))};const EH="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function RH(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function PH(e){return"nodeType"in e}function MH(e){var t,n;return e?RH(e)?e:PH(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function TH(e){const{Document:t}=MH(e);return e instanceof t}function IH(e){return!RH(e)&&e instanceof MH(e).HTMLElement}function OH(e){return e instanceof MH(e).SVGElement}function DH(e){return e?RH(e)?e.document:PH(e)?TH(e)?e:IH(e)||OH(e)?e.ownerDocument:document:document:document}const FH=EH?s.useLayoutEffect:s.useEffect;function LH(e){const t=s.useRef(e);return FH(()=>{t.current=e}),s.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function AH(e,t){void 0===t&&(t=[e]);const n=s.useRef(e);return FH(()=>{n.current!==e&&(n.current=e)},t),n}function NH(e,t){const n=s.useRef();return s.useMemo(()=>{const t=e(n.current);return n.current=t,t},[...t])}function $H(e){const t=LH(e),n=s.useRef(null),r=s.useCallback(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function zH(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let jH={};function BH(e,t){return s.useMemo(()=>{if(t)return t;const n=null==jH[e]?0:jH[e]+1;return jH[e]=n,e+"-"+n},[e,t])}function _H(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t},{...t})}}const HH=_H(1),VH=_H(-1);function WH(e){if(!e)return!1;const{KeyboardEvent:t}=MH(e.target);return t&&e instanceof t}function UH(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=MH(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const GH=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[GH.Translate.toString(e),GH.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),KH="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function qH(e){return e.matches(KH)?e:e.querySelector(KH)}const YH={display:"none"};function XH(e){let{id:t,value:n}=e;return c.createElement("div",{id:t,style:YH},n)}function QH(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return c.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const ZH=s.createContext(null);const JH={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},eV={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function tV(e){let{announcements:t=eV,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=JH}=e;const{announce:i,announcement:a}=function(){const[e,t]=s.useState("");return{announce:s.useCallback(e=>{null!=e&&t(e)},[]),announcement:e}}(),l=BH("DndLiveRegion"),[u,d]=s.useState(!1);if(s.useEffect(()=>{d(!0)},[]),function(e){const t=s.useContext(ZH);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(s.useMemo(()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}}),[i,t])),!u)return null;const p=c.createElement(c.Fragment,null,c.createElement(XH,{id:r,value:o.draggable}),c.createElement(QH,{id:l,announcement:a}));return n?So.createPortal(p,n):p}var nV;function rV(){}function oV(e,t){return s.useMemo(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}function iV(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>[...t].filter(e=>null!=e),[...t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(nV||(nV={}));const aV=Object.freeze({x:0,y:0});function lV(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sV(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function cV(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function uV(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function dV(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}function pV(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const fV=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=pV(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=lV(pV(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(sV)};function hV(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const mV=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=hV(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(cV)};function gV(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:aV}function vV(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const bV=vV(1);const yV={ignoreTransform:!1};function wV(e,t){void 0===t&&(t=yV);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=MH(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,s=e.left-a-(1-o)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:s+u,bottom:c+d,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:s}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:s}}function xV(e){return wV(e,{ignoreTransform:!0})}function SV(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(TH(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!IH(o)||OH(o))return n;if(n.includes(o))return n;const i=MH(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=MH(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=MH(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function CV(e){const[t]=SV(e,1);return null!=t?t:null}function kV(e){return EH&&e?RH(e)?e:PH(e)?TH(e)||e===DH(e).scrollingElement?window:IH(e)?e:null:null:null}function EV(e){return RH(e)?e.scrollX:e.scrollLeft}function RV(e){return RH(e)?e.scrollY:e.scrollTop}function PV(e){return{x:EV(e),y:RV(e)}}var MV;function TV(e){return!(!EH||!e)&&e===document.scrollingElement}function IV(e){const t={x:0,y:0},n=TV(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(MV||(MV={}));const OV={x:.2,y:.2};function DV(e,t,n,r,o){let{top:i,left:a,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=OV);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=IV(e),f={x:0,y:0},h={x:0,y:0},m=t.height*o.y,g=t.width*o.x;return!c&&i<=t.top+m?(f.y=MV.Backward,h.y=r*Math.abs((t.top+m-i)/m)):!u&&s>=t.bottom-m&&(f.y=MV.Forward,h.y=r*Math.abs((t.bottom-m-s)/m)),!p&&l>=t.right-g?(f.x=MV.Forward,h.x=r*Math.abs((t.right-g-l)/g)):!d&&a<=t.left+g&&(f.x=MV.Backward,h.x=r*Math.abs((t.left+g-a)/g)),{direction:f,speed:h}}function FV(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function LV(e){return e.reduce((e,t)=>HH(e,PV(t)),aV)}const AV=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+EV(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+RV(t),0)}]];class NV{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=SV(t),r=LV(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of AV)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class $V{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function zV(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var jV,BV;function _V(e){e.preventDefault()}function HV(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(jV||(jV={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(BV||(BV={}));const VV={start:[BV.Space,BV.Enter],cancel:[BV.Esc],end:[BV.Space,BV.Enter,BV.Tab]},WV=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case BV.Right:return{...n,x:n.x+25};case BV.Left:return{...n,x:n.x-25};case BV.Down:return{...n,y:n.y+25};case BV.Up:return{...n,y:n.y-25}}};class UV{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new $V(DH(t)),this.windowListeners=new $V(MH(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(jV.Resize,this.handleCancel),this.windowListeners.add(jV.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(jV.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=wV),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);CV(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(aV)}handleKeyDown(e){if(WH(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=VV,coordinateGetter:i=WV,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:aV;this.referenceCoordinates||(this.referenceCoordinates=c);const u=i(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=VH(u,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:s,isBottom:c,maxScroll:d,minScroll:p}=IV(n),f=FV(n),h={x:Math.min(o===BV.Right?f.right-f.width/2:f.right,Math.max(o===BV.Right?f.left:f.left+f.width/2,u.x)),y:Math.min(o===BV.Down?f.bottom-f.height/2:f.bottom,Math.max(o===BV.Down?f.top:f.top+f.height/2,u.y))},m=o===BV.Right&&!l||o===BV.Left&&!s,g=o===BV.Down&&!c||o===BV.Up&&!i;if(m&&h.x!==u.x){const e=n.scrollLeft+t.x,i=o===BV.Right&&e<=d.x||o===BV.Left&&e>=p.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===BV.Right?n.scrollLeft-d.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(g&&h.y!==u.y){const e=n.scrollTop+t.y,i=o===BV.Down&&e<=d.y||o===BV.Up&&e>=p.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===BV.Down?n.scrollTop-d.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,HH(VH(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function GV(e){return Boolean(e&&"distance"in e)}function KV(e){return Boolean(e&&"delay"in e)}UV.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=VV,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class qV{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=MH(e);return e instanceof t?e:DH(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=DH(i),this.documentListeners=new $V(this.document),this.listeners=new $V(n),this.windowListeners=new $V(MH(i)),this.initialCoordinates=null!=(r=UH(o))?r:aV,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(jV.Resize,this.handleCancel),this.windowListeners.add(jV.DragStart,_V),this.windowListeners.add(jV.VisibilityChange,this.handleCancel),this.windowListeners.add(jV.ContextMenu,_V),this.documentListeners.add(jV.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(KV(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(GV(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(jV.Click,HV,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(jV.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=UH(e))?t:aV,s=VH(r,l);if(!n&&a){if(GV(a)){if(null!=a.tolerance&&zV(s,a.tolerance))return this.handleCancel();if(zV(s,a.distance))return this.handleStart()}return KV(a)&&zV(s,a.tolerance)?this.handleCancel():void this.handlePending(a,s)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===BV.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const YV={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class XV extends qV{constructor(e){const{event:t}=e,n=DH(t.target);super(e,YV,n)}}XV.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const QV={move:{name:"mousemove"},end:{name:"mouseup"}};var ZV;!function(e){e[e.RightClick=2]="RightClick"}(ZV||(ZV={}));(class extends qV{constructor(e){super(e,QV,DH(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==ZV.RightClick&&(null==r||r({event:n}),!0)}}];const JV={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var eW,tW;function nW(e){let{acceleration:t,activator:n=eW.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=tW.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:p,threshold:f}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=zH(t);return NH(e=>{if(n||!r||!e)return rW;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[MV.Backward]:e.x[MV.Backward]||-1===o.x,[MV.Forward]:e.x[MV.Forward]||1===o.x},y:{[MV.Backward]:e.y[MV.Backward]||-1===o.y,[MV.Forward]:e.y[MV.Forward]||1===o.y}}},[n,t,r])}({delta:p,disabled:!i}),[m,g]=function(){const e=s.useRef(null),t=s.useCallback((t,n)=>{e.current=setInterval(t,n)},[]);return[t,s.useCallback(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),v=s.useRef({x:0,y:0}),b=s.useRef({x:0,y:0}),y=s.useMemo(()=>{switch(n){case eW.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case eW.DraggableRect:return o}},[n,o,c]),w=s.useRef(null),x=s.useCallback(()=>{const e=w.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)},[]),S=s.useMemo(()=>l===tW.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(i&&u.length&&y){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=u.indexOf(e),o=d[n];if(!o)continue;const{direction:i,speed:l}=DV(e,o,y,t,f);for(const e of["x","y"])h[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0)return g(),w.current=e,m(x,a),v.current=l,void(b.current=i)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[t,x,r,g,i,a,JSON.stringify(y),JSON.stringify(h),m,u,S,d,JSON.stringify(f)])}(class extends qV{constructor(e){super(e,JV)}static setup(){return window.addEventListener(JV.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(JV.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(eW||(eW={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(tW||(tW={}));const rW={x:{[MV.Backward]:!1,[MV.Forward]:!1},y:{[MV.Backward]:!1,[MV.Forward]:!1}};var oW,iW;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(oW||(oW={})),function(e){e.Optimized="optimized"}(iW||(iW={}));const aW=new Map;function lW(e,t){return NH(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function sW(e){let{callback:t,disabled:n}=e;const r=LH(t),o=s.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return s.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}function cW(e){return new NV(wV(e),e)}function uW(e,t,n){void 0===t&&(t=cW);const[r,o]=s.useState(null);function i(){o(r=>{if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}const a=function(e){let{callback:t,disabled:n}=e;const r=LH(t),o=s.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return s.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),l=sW({callback:i});return FH(()=>{i(),e?(null==l||l.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==a||a.disconnect())},[e]),r}const dW=[];function pW(e,t){void 0===t&&(t=[]);const n=s.useRef(null);return s.useEffect(()=>{n.current=null},t),s.useEffect(()=>{const t=e!==aV;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?VH(e,n.current):aV}function fW(e){return s.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const hW=[];function mW(e){let{measure:t}=e;const[n,r]=s.useState(null),o=s.useCallback(e=>{for(const{target:n}of e)if(IH(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t]),i=sW({callback:o}),a=s.useCallback(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return IH(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)},[t,i]),[l,c]=$H(a);return s.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const gW=[{sensor:XV,options:{}},{sensor:UV,options:{}}],vW={current:{}},bW={draggable:{measure:xV},droppable:{measure:xV,strategy:oW.WhileDragging,frequency:iW.Optimized},dragOverlay:{measure:wV}};class yW extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const wW={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yW,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rV},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bW,measureDroppableContainers:rV,windowRect:null,measuringScheduled:!1},xW={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:rV,draggableNodes:new Map,over:null,measureDroppableContainers:rV},SW=s.createContext(xW),CW=s.createContext(wW);function kW(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yW}}}function EW(e,t){switch(t.type){case nV.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nV.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case nV.DragEnd:case nV.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nV.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new yW(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case nV.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new yW(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case nV.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new yW(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function RW(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=s.useContext(SW),i=zH(r),a=zH(null==n?void 0:n.id);return s.useEffect(()=>{if(!t&&!r&&i&&null!=a){if(!WH(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=qH(e);if(t){t.focus();break}}})}},[r,t,o,a,i]),null}const PW=s.createContext({...aV,scaleX:1,scaleY:1});var MW;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(MW||(MW={}));const TW=s.memo(function(e){var t,n,r,o;let{id:i,accessibility:a,autoScroll:l=!0,children:u,sensors:d=gW,collisionDetection:p=mV,measuring:f,modifiers:h,...m}=e;const g=s.useReducer(EW,void 0,kW),[v,b]=g,[y,w]=function(){const[e]=s.useState(()=>new Set),t=s.useCallback(t=>(e.add(t),()=>e.delete(t)),[e]),n=s.useCallback(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]);return[n,t]}(),[x,S]=s.useState(MW.Uninitialized),C=x===MW.Initialized,{draggable:{active:k,nodes:E,translate:R},droppable:{containers:P}}=v,M=null!=k?E.get(k):null,T=s.useRef({initial:null,translated:null}),I=s.useMemo(()=>{var e;return null!=k?{id:k,data:null!=(e=null==M?void 0:M.data)?e:vW,rect:T}:null},[k,M]),O=s.useRef(null),[D,F]=s.useState(null),[L,A]=s.useState(null),N=AH(m,Object.values(m)),$=BH("DndDescribedBy",i),z=s.useMemo(()=>P.getEnabled(),[P]),j=function(e){return s.useMemo(()=>({draggable:{...bW.draggable,...null==e?void 0:e.draggable},droppable:{...bW.droppable,...null==e?void 0:e.droppable},dragOverlay:{...bW.dragOverlay,...null==e?void 0:e.dragOverlay}}),[null==e?void 0:e.draggable,null==e?void 0:e.droppable,null==e?void 0:e.dragOverlay])}(f),{droppableRects:B,measureDroppableContainers:_,measuringScheduled:H}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=s.useState(null),{frequency:l,measure:c,strategy:u}=o,d=s.useRef(e),p=function(){switch(u){case oW.Always:return!1;case oW.BeforeDragging:return n;default:return!n}}(),f=AH(p),h=s.useCallback(function(e){void 0===e&&(e=[]),f.current||a(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=s.useRef(null),g=NH(t=>{if(p&&!n)return aW;if(!t||t===aW||d.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new NV(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,p,c]);return s.useEffect(()=>{d.current=e},[e]),s.useEffect(()=>{p||h()},[n,p]),s.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),s.useEffect(()=>{p||"number"!=typeof l||null!==m.current||(m.current=setTimeout(()=>{h(),m.current=null},l))},[l,p,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:null!=i}}(z,{dragging:C,dependencies:[R.x,R.y],config:j.droppable}),V=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return NH(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(E,k),W=s.useMemo(()=>L?UH(L):null,[L]),U=function(){const e=!1===(null==D?void 0:D.autoScrollEnabled),t="object"==typeof l?!1===l.enabled:!1===l,n=C&&!e&&!t;if("object"==typeof l)return{...l,enabled:n};return{enabled:n}}(),G=function(e,t){return lW(e,t)}(V,j.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=s.useRef(!1),{x:a,y:l}="boolean"==typeof o?{x:o,y:o}:o;FH(()=>{if(!a&&!l||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=gV(n(e),r);if(a||(o.x=0),l||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=CV(e);t&&t.scrollBy({top:o.y,left:o.x})}},[t,a,l,r,n])}({activeNode:null!=k?E.get(k):null,config:U.layoutShiftCompensation,initialRect:G,measure:j.draggable.measure});const K=uW(V,j.draggable.measure,G),q=uW(V?V.parentElement:null),Y=s.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X=P.getNodeFor(null==(t=Y.current.over)?void 0:t.id),Q=mW({measure:j.dragOverlay.measure}),Z=null!=(n=Q.nodeRef.current)?n:V,J=C?null!=(r=Q.rect)?r:K:null,ee=Boolean(Q.nodeRef.current&&Q.rect),te=gV(ne=ee?null:K,lW(ne));var ne;const re=fW(Z?MH(Z):null),oe=function(e){const t=s.useRef(e),n=NH(n=>e?n&&n!==dW&&e&&t.current&&e.parentNode===t.current.parentNode?n:SV(e):dW,[e]);return s.useEffect(()=>{t.current=e},[e]),n}(C?null!=X?X:V:null),ie=function(e,t){void 0===t&&(t=wV);const[n]=e,r=fW(n?MH(n):null),[o,i]=s.useState(hW);function a(){i(()=>e.length?e.map(e=>TV(e)?r:new NV(t(e),e)):hW)}const l=sW({callback:a});return FH(()=>{null==l||l.disconnect(),a(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),o}(oe),ae=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(h,{transform:{x:R.x-te.x,y:R.y-te.y,scaleX:1,scaleY:1},activatorEvent:L,active:I,activeNodeRect:K,containerNodeRect:q,draggingNodeRect:J,over:Y.current.over,overlayNodeRect:Q.rect,scrollableAncestors:oe,scrollableAncestorRects:ie,windowRect:re}),le=W?HH(W,R):null,se=function(e){const[t,n]=s.useState(null),r=s.useRef(e),o=s.useCallback(e=>{const t=kV(e.target);t&&n(e=>e?(e.set(t,PV(t)),new Map(e)):null)},[]);return s.useEffect(()=>{const t=r.current;if(e!==t){i(t);const a=e.map(e=>{const t=kV(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,PV(t)]):null}).filter(e=>null!=e);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{const t=kV(e);null==t||t.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>HH(e,t),aV):LV(e):aV,[e,t])}(oe),ce=pW(se),ue=pW(se,[K]),de=HH(ae,ce),pe=J?bV(J,ae):null,fe=I&&pe?p({active:I,collisionRect:pe,droppableRects:B,droppableContainers:z,pointerCoordinates:le}):null,he=dV(fe,"id"),[me,ge]=s.useState(null),ve=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ee?ae:HH(ae,ue),null!=(o=null==me?void 0:me.rect)?o:null,K),be=s.useRef(null),ye=s.useCallback((e,t)=>{let{sensor:n,options:r}=t;if(null==O.current)return;const o=E.get(O.current);if(!o)return;const i=e.nativeEvent,a=new n({active:O.current,activeNode:o,event:i,options:r,context:Y,onAbort(e){if(!E.get(e))return;const{onDragAbort:t}=N.current,n={id:e};null==t||t(n),y({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!E.get(e))return;const{onDragPending:o}=N.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==o||o(i),y({type:"onDragPending",event:i})},onStart(e){const t=O.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:r}=N.current,o={activatorEvent:i,active:{id:t,data:n.data,rect:T}};So.unstable_batchedUpdates(()=>{null==r||r(o),S(MW.Initializing),b({type:nV.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:o}),F(be.current),A(i)})},onMove(e){b({type:nV.DragMove,coordinates:e})},onEnd:l(nV.DragEnd),onCancel:l(nV.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=Y.current;let a=null;if(t&&o){const{cancelDrop:l}=N.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===nV.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=nV.DragCancel)}}O.current=null,So.unstable_batchedUpdates(()=>{b({type:e}),S(MW.Uninitialized),ge(null),F(null),A(null),be.current=null;const t=e===nV.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=N.current[t];null==e||e(a),y({type:t,event:a})}})}}be.current=a},[E]),we=s.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent,i=E.get(r);if(null!==O.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},O.current=r,ye(n,t))},[E,ye]),xe=function(e,t){return s.useMemo(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(d,we);!function(e){s.useEffect(()=>{if(!EH)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(d),FH(()=>{K&&x===MW.Initializing&&S(MW.Initialized)},[K,x]),s.useEffect(()=>{const{onDragMove:e}=N.current,{active:t,activatorEvent:n,collisions:r,over:o}=Y.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:de.x,y:de.y},over:o};So.unstable_batchedUpdates(()=>{null==e||e(i),y({type:"onDragMove",event:i})})},[de.x,de.y]),s.useEffect(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=Y.current;if(!e||null==O.current||!t||!o)return;const{onDragOver:i}=N.current,a=r.get(he),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};So.unstable_batchedUpdates(()=>{ge(l),null==i||i(s),y({type:"onDragOver",event:s})})},[he]),FH(()=>{Y.current={activatorEvent:L,active:I,activeNode:V,collisionRect:pe,collisions:fe,droppableRects:B,draggableNodes:E,draggingNode:Z,draggingNodeRect:J,droppableContainers:P,over:me,scrollableAncestors:oe,scrollAdjustedTranslate:de},T.current={initial:J,translated:pe}},[I,V,fe,pe,E,Z,J,B,P,me,oe,de]),nW({...U,delta:R,draggingRect:pe,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:ie});const Se=s.useMemo(()=>({active:I,activeNode:V,activeNodeRect:K,activatorEvent:L,collisions:fe,containerNodeRect:q,dragOverlay:Q,draggableNodes:E,droppableContainers:P,droppableRects:B,over:me,measureDroppableContainers:_,scrollableAncestors:oe,scrollableAncestorRects:ie,measuringConfiguration:j,measuringScheduled:H,windowRect:re}),[I,V,K,L,fe,q,Q,E,P,B,me,_,oe,ie,j,H,re]),Ce=s.useMemo(()=>({activatorEvent:L,activators:xe,active:I,activeNodeRect:K,ariaDescribedById:{draggable:$},dispatch:b,draggableNodes:E,over:me,measureDroppableContainers:_}),[L,xe,I,K,b,$,E,me,_]);return c.createElement(ZH.Provider,{value:w},c.createElement(SW.Provider,{value:Ce},c.createElement(CW.Provider,{value:Se},c.createElement(PW.Provider,{value:ve},u)),c.createElement(RW,{disabled:!1===(null==a?void 0:a.restoreFocus)})),c.createElement(tV,{...a,hiddenTextDescribedById:$}))}),IW=s.createContext(null),OW="button";function DW(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=BH("Draggable"),{activators:a,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:p,over:f}=s.useContext(SW),{role:h=OW,roleDescription:m="draggable",tabIndex:g=0}=null!=o?o:{},v=(null==c?void 0:c.id)===t,b=s.useContext(v?PW:IW),[y,w]=$H(),[x,S]=$H(),C=function(e,t){return s.useMemo(()=>e.reduce((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e},{}),[e,t])}(a,t),k=AH(n);FH(()=>(p.set(t,{id:t,key:i,node:y,activatorNode:x,data:k}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)}),[p,t]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:s.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":!(!v||h!==OW)||void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,h,g,v,m,d.draggable]),isDragging:v,listeners:r?void 0:C,node:y,over:f,setNodeRef:w,setActivatorNodeRef:S,transform:b}}const FW={timeout:25};function LW(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function AW(e,t){return e.reduce((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e},Array(e.length))}function NW(e){return null!==e&&e>=0}const $W=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=LW(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},zW={scaleX:1,scaleY:1},jW=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...zW}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-s,...zW}:o<n&&o>=a?{x:0,y:l.height+s,...zW}:{x:0,y:0,...zW}};const BW="Sortable",_W=c.createContext({activeIndex:-1,containerId:BW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$W,disabled:{draggable:!1,droppable:!1}});function HW(e){let{children:t,id:n,items:r,strategy:o=$W,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:p}=s.useContext(CW),f=BH(BW,n),h=Boolean(null!==l.rect),m=s.useMemo(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),g=null!=a,v=a?m.indexOf(a.id):-1,b=d?m.indexOf(d.id):-1,y=s.useRef(m),w=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,y.current),x=-1!==b&&-1===v||w,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(i);FH(()=>{w&&g&&p(m)},[w,m,g,p]),s.useEffect(()=>{y.current=m},[m]);const C=s.useMemo(()=>({activeIndex:v,containerId:f,disabled:S,disableTransforms:x,items:m,overIndex:b,useDragOverlay:h,sortedRects:AW(m,u),strategy:o}),[v,f,S.draggable,S.droppable,x,m,b,u,h,o]);return c.createElement(_W.Provider,{value:C},t)}const VW=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return LW(n,r,o).indexOf(t)},WW=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===s))},UW={duration:200,easing:"ease"},GW="transform",KW=GH.Transition.toString({property:GW,duration:0,easing:"linear"}),qW={roleDescription:"sortable"};function YW(e){let{animateLayoutChanges:t=WW,attributes:n,disabled:r,data:o,getNewIndex:i=VW,id:a,strategy:l,resizeObserverConfig:c,transition:u=UW}=e;const{items:d,containerId:p,activeIndex:f,disabled:h,disableTransforms:m,sortedRects:g,overIndex:v,useDragOverlay:b,strategy:y}=s.useContext(_W),w=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,h),x=d.indexOf(a),S=s.useMemo(()=>({sortable:{containerId:p,index:x,items:d},...o}),[p,o,x,d]),C=s.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:k,node:E,isOver:R,setNodeRef:P}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=BH("Droppable"),{active:a,dispatch:l,over:c,measureDroppableContainers:u}=s.useContext(SW),d=s.useRef({disabled:n}),p=s.useRef(!1),f=s.useRef(null),h=s.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...FW,...o},b=AH(null!=g?g:r),y=sW({callback:s.useCallback(()=>{p.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},v)):p.current=!0},[v]),disabled:m||!a}),w=s.useCallback((e,t)=>{y&&(t&&(y.unobserve(t),p.current=!1),e&&y.observe(e))},[y]),[x,S]=$H(w),C=AH(t);return s.useEffect(()=>{y&&x.current&&(y.disconnect(),p.current=!1,y.observe(x.current))},[x,y]),s.useEffect(()=>(l({type:nV.RegisterDroppable,element:{id:r,key:i,disabled:n,node:x,rect:f,data:C}}),()=>l({type:nV.UnregisterDroppable,key:i,id:r})),[r]),s.useEffect(()=>{n!==d.current.disabled&&(l({type:nV.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:a,rect:f,isOver:(null==c?void 0:c.id)===r,node:x,over:c,setNodeRef:S}}({id:a,data:S,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:M,activatorEvent:T,activeNodeRect:I,attributes:O,setNodeRef:D,listeners:F,isDragging:L,over:A,setActivatorNodeRef:N,transform:$}=DW({id:a,data:S,attributes:{...qW,...n},disabled:w.draggable}),z=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>e=>{t.forEach(t=>t(e))},t)}(P,D),j=Boolean(M),B=j&&!m&&NW(f)&&NW(v),_=!b&&L,H=_&&B?$:null,V=B?null!=H?H:(null!=l?l:y)({rects:g,activeNodeRect:I,activeIndex:f,overIndex:v,index:x}):null,W=NW(f)&&NW(v)?i({id:a,items:d,activeIndex:f,overIndex:v}):x,U=null==M?void 0:M.id,G=s.useRef({activeId:U,items:d,newIndex:W,containerId:p}),K=d!==G.current.items,q=t({active:M,containerId:p,isDragging:L,isSorting:j,id:a,index:x,items:d,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:u,wasDragging:null!=G.current.activeId}),Y=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=s.useState(null),l=s.useRef(n);return FH(()=>{if(!t&&n!==l.current&&r.current){const e=o.current;if(e){const t=wV(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}n!==l.current&&(l.current=n)},[t,n,r,o]),s.useEffect(()=>{i&&a(null)},[i]),i}({disabled:!q,index:x,node:E,rect:k});return s.useEffect(()=>{j&&G.current.newIndex!==W&&(G.current.newIndex=W),p!==G.current.containerId&&(G.current.containerId=p),d!==G.current.items&&(G.current.items=d)},[j,W,p,d]),s.useEffect(()=>{if(U===G.current.activeId)return;if(null!=U&&null==G.current.activeId)return void(G.current.activeId=U);const e=setTimeout(()=>{G.current.activeId=U},50);return()=>clearTimeout(e)},[U]),{active:M,activeIndex:f,attributes:O,data:S,rect:k,index:x,newIndex:W,items:d,isOver:R,isSorting:j,isDragging:L,listeners:F,node:E,overIndex:v,over:A,setNodeRef:z,setActivatorNodeRef:N,setDroppableNodeRef:P,setDraggableNodeRef:D,transform:null!=Y?Y:V,transition:function(){if(Y||K&&G.current.newIndex===x)return KW;if(_&&!WH(T)||!u)return;if(j||q)return GH.Transition.toString({...u,property:GW});return}()}}function XW(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const QW=[BV.Down,BV.Right,BV.Up,BV.Left],ZW=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(QW.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case BV.Down:r.top<i.top&&t.push(n);break;case BV.Up:r.top>i.top&&t.push(n);break;case BV.Left:r.left>i.left&&t.push(n);break;case BV.Right:r.left<i.left&&t.push(n)}});const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=uV(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=uV(r),a=o.reduce((e,t,r)=>e+lV(n[r],t),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(sV)})({collisionRect:r,droppableRects:o,droppableContainers:t});let c=dV(s,"id");if(c===(null==a?void 0:a.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),a=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&a&&e&&t){const n=SV(s).some((e,t)=>l[t]!==e),o=JW(e,t),i=function(e,t){if(!XW(e)||!XW(t))return!1;if(!JW(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},u={x:a.left,y:a.top};return c.x&&c.y?u:VH(u,c)}}}};function JW(e,t){return!(!XW(e)||!XW(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var eU=Sg(Xp.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),tU=Sg(Xp.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),nU=Sg(Xp.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),rU=Sg(Xp.jsx("path",{d:"M3 18h6v-2H3zM3 6v2h18V6zm0 7h12v-2H3z"})),oU=Sg(Xp.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),iU=Sg(Xp.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),aU=Sg(Xp.jsx("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"})),lU=Sg(Xp.jsx("path",{d:"M14 10H3v2h11zm0-4H3v2h11zm4 8v-4h-2v4h-4v2h4v4h2v-4h4v-2zM3 16h7v-2H3z"}));const sU=({id:e,label:t,fullLabel:n,onDelete:r,onMoveUp:o,onMoveDown:i,isFirst:a,isLast:l,sortOrder:u,onSortOrderChange:d,fullPath:p,defaultTitle:f,customTitle:h,onUpdateTitle:m,onResetTitle:g})=>{const[v,b]=s.useState(!1),[y,w]=s.useState(""),x=s.useRef(null),S=s.useRef(null),{attributes:C,listeners:k,setNodeRef:E,transform:R,transition:P,isDragging:M}=YW({id:e}),T={transform:GH.Transform.toString(R),transition:P,opacity:M?.5:1,display:"flex",alignItems:"center",width:"100%"};s.useEffect(()=>{v&&x.current&&(x.current.focus(),x.current.select())},[v]),s.useEffect(()=>{const e=e=>{v&&S.current&&!S.current.contains(e.target)&&O()};if(v)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[v]);const I=()=>{const e=y.trim();""!==e?(m(p,e),b(!1)):O()},O=()=>{b(!1),w("")},D=h||t,F=!!h;return c.createElement("div",Xr({ref:E,style:T},C),c.createElement(jw,{ref:S,sx:{display:"flex",alignItems:"center",width:"100%",gap:1}},c.createElement(jw,Xr({},k,{sx:{display:"flex",alignItems:"center",cursor:"grab","&:active":{cursor:"grabbing"}}}),c.createElement(eU,{sx:{cursor:"grab"}})),v?c.createElement(c.Fragment,null,c.createElement(qE,{inputRef:x,value:y,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key?I():"Escape"===e.key&&O()},size:"small",sx:{width:"200px"}}),c.createElement(Hk,{title:"Save",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:I,color:"primary","aria-label":"save title"},c.createElement(oU,{fontSize:"small"}))),c.createElement(Hk,{title:"Cancel",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:O,"aria-label":"cancel edit"},c.createElement(iU,{fontSize:"small"}))),F&&c.createElement(Hk,{title:"Reset to default",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{g(p),b(!1),w("")},color:"warning","aria-label":"reset title"},c.createElement(aU,{fontSize:"small"})))):c.createElement(c.Fragment,null,c.createElement(Hk,{title:n,arrow:!0,placement:"top"},c.createElement(zy,{label:D,onDelete:r,color:"primary",variant:"outlined",sx:{fontWeight:F?"bold":"normal",fontStyle:F?"italic":"normal"}})),c.createElement(Hk,{title:"Edit title",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{w(h||f),b(!0)},"aria-label":"edit title"},c.createElement(mH,{fontSize:"small"})))),!v&&c.createElement(c.Fragment,null,c.createElement(Hk,{title:null===u?"No sort":"asc"===u?"Ascending":"Descending",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{d(null===u?"asc":"asc"===u?"desc":null)},"aria-label":"toggle sort order",color:u?"primary":"default"},"asc"===u?c.createElement(tU,{fontSize:"small"}):"desc"===u?c.createElement(nU,{fontSize:"small"}):c.createElement(rU,{fontSize:"small",sx:{opacity:.3}}))),c.createElement(jw,{sx:{flex:1}}),c.createElement(jw,{sx:{display:"flex",gap:.5}},c.createElement(Mv,{size:"small",onClick:o,disabled:a,"aria-label":"move up"},c.createElement(tU,{fontSize:"small"})),c.createElement(Mv,{size:"small",onClick:i,disabled:l,"aria-label":"move down"},c.createElement(nU,{fontSize:"small"}))))))},cU=({providersData:e,rootProvider:t,savedDimensions:n=[],onSaveDimension:r,onRemoveDimension:o,onReorderDimensions:i,titleOverrides:a={},onUpdateTitle:l,onResetTitle:u,existingMetrics:d=[],existingFilters:p={}})=>{const[f,h]=s.useState(!1),[m,g]=s.useState([]),[v,b]=s.useState(""),y=iV(oV(XV),oV(UV,{coordinateGetter:ZW})),w=()=>{const r=t?0===m.length?t:m[m.length-1].targetKey:null;if(!r||!e||!e[r])return[];const o=e[r];if(!o.dimensions)return[];const i=[e[t].default_alias];let a=t;m.forEach(t=>{const n=e[a];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&i.push(e.alias)}a=t.targetKey});const l=new Set(n.map(e=>e.fullPath)),s=[];return Object.keys(o.dimensions).forEach(e=>{const t=o.dimensions[e];Object.keys(t).forEach(n=>{const o=t[n],a=`${i.join("_")}.${n}`,c=l.has(a);s.push({key:`${r}_${e}.${n}`,value:o.title||n,dimensionKey:n,alias:e,dimension:o,disabled:c})})}),s},x=()=>{h(!1),g([]),b("")},S=e=>{const n=[t];return e.relationNames&&e.relationNames.length>0&&n.push(...e.relationNames),n.join(" → ")};return c.createElement("div",null,c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:2,marginBottom:2}},f?c.createElement(c.Fragment,null,c.createElement(Xw,{variant:"outlined",onClick:x},"Cancel"),c.createElement(Xw,{variant:"contained",onClick:()=>{if(!v)return;const n=w().find(e=>e.key===v);if(!n)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)});const c=`${s.join("_")}.${n.dimensionKey}`,u={dimension:n.dimension,relations:o,providerPath:i,relationNames:a,dimensionKey:n.dimensionKey,dimensionTitle:n.value,fullPath:c};r(u),x()},disabled:!v},"Save Dimension")):c.createElement(Xw,{variant:"contained",onClick:()=>{h(!0),g([]),b("")}},"Add Dimension")),f&&c.createElement(qg,{sx:{padding:3,marginBottom:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Select Provider Path"),c.createElement(kH,{providersData:e,rootProvider:t,onSelectionChange:g,existingDimensions:n,existingMetrics:d,existingFilters:p}),c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},"Select Dimension"),c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1}},c.createElement(uR,{items:w(),value:v,label:"Choose Dimension",onChange:e=>{b(e.target.value)},sx:{width:"400px"}}),c.createElement(Hk,{title:"Add all available dimensions",arrow:!0,placement:"top"},c.createElement("span",null,c.createElement(Mv,{color:"primary",onClick:()=>{const n=w().filter(e=>!e.disabled);if(0===n.length)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)}),n.forEach(e=>{const t=`${s.join("_")}.${e.dimensionKey}`,n={dimension:e.dimension,relations:o,providerPath:i,relationNames:a,dimensionKey:e.dimensionKey,dimensionTitle:e.value,fullPath:t};r(n)}),x()},disabled:0===w().filter(e=>!e.disabled).length,"aria-label":"add all dimensions"},c.createElement(lU,null)))))),n.length>0&&c.createElement(jw,{sx:{marginTop:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Saved Dimensions (Drag to reorder or use arrows)"),c.createElement(TW,{sensors:y,collisionDetection:fV,onDragEnd:e=>{const{active:t,over:r}=e;if(r&&t.id!==r.id){const e=n.findIndex((e,n)=>n===t.id),o=n.findIndex((e,t)=>t===r.id),a=LW(n,e,o);i(a)}}},c.createElement(HW,{items:n.map((e,t)=>t),strategy:jW},c.createElement(jw,{sx:{display:"flex",flexDirection:"column",gap:1}},n.map((e,t)=>c.createElement(sU,{key:t,id:t,label:e.dimensionTitle,fullLabel:`${S(e)} → ${e.dimensionTitle} (${e.fullPath})`,onDelete:()=>o(t),onMoveUp:()=>(e=>{if(e>0){const t=LW(n,e,e-1);i(t)}})(t),onMoveDown:()=>(e=>{if(e<n.length-1){const t=LW(n,e,e+1);i(t)}})(t),isFirst:0===t,isLast:t===n.length-1,sortOrder:e.sortOrder||null,onSortOrderChange:e=>((e,t)=>{const r=[...n];r[e]={...r[e],sortOrder:t},i(r)})(t,e),fullPath:e.fullPath,defaultTitle:e.dimensionTitle,customTitle:a[e.fullPath],onUpdateTitle:l,onResetTitle:u})))))))},uU=({id:e,label:t,fullLabel:n,onDelete:r,onMoveUp:o,onMoveDown:i,isFirst:a,isLast:l,fullPath:u,defaultTitle:d,customTitle:p,onUpdateTitle:f,onResetTitle:h})=>{const[m,g]=s.useState(!1),[v,b]=s.useState(""),y=s.useRef(null),w=s.useRef(null),{attributes:x,listeners:S,setNodeRef:C,transform:k,transition:E,isDragging:R}=YW({id:e}),P={transform:GH.Transform.toString(k),transition:E,opacity:R?.5:1,display:"flex",alignItems:"center",width:"100%"};s.useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select())},[m]),s.useEffect(()=>{const e=e=>{m&&w.current&&!w.current.contains(e.target)&&T()};if(m)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[m]);const M=()=>{const e=v.trim();""!==e?(f(u,e),g(!1)):T()},T=()=>{g(!1),b("")},I=p||t,O=!!p;return c.createElement("div",Xr({ref:C,style:P},x),c.createElement(jw,{ref:w,sx:{display:"flex",alignItems:"center",width:"100%",gap:1}},c.createElement(jw,Xr({},S,{sx:{display:"flex",alignItems:"center",cursor:"grab","&:active":{cursor:"grabbing"}}}),c.createElement(eU,{sx:{cursor:"grab"}})),m?c.createElement(c.Fragment,null,c.createElement(qE,{inputRef:y,value:v,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key?M():"Escape"===e.key&&T()},size:"small",sx:{width:"200px"}}),c.createElement(Hk,{title:"Save",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:M,color:"primary","aria-label":"save title"},c.createElement(oU,{fontSize:"small"}))),c.createElement(Hk,{title:"Cancel",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:T,"aria-label":"cancel edit"},c.createElement(iU,{fontSize:"small"}))),O&&c.createElement(Hk,{title:"Reset to default",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{h(u),g(!1),b("")},color:"warning","aria-label":"reset title"},c.createElement(aU,{fontSize:"small"})))):c.createElement(c.Fragment,null,c.createElement(Hk,{title:n,arrow:!0,placement:"top"},c.createElement(zy,{label:I,onDelete:r,color:"secondary",variant:"outlined",sx:{fontWeight:O?"bold":"normal",fontStyle:O?"italic":"normal"}})),c.createElement(Hk,{title:"Edit title",arrow:!0,placement:"top"},c.createElement(Mv,{size:"small",onClick:()=>{b(p||d),g(!0)},"aria-label":"edit title"},c.createElement(mH,{fontSize:"small"})))),!m&&c.createElement(c.Fragment,null,c.createElement(jw,{sx:{flex:1}}),c.createElement(jw,{sx:{display:"flex",gap:.5}},c.createElement(Mv,{size:"small",onClick:o,disabled:a,"aria-label":"move up"},c.createElement(tU,{fontSize:"small"})),c.createElement(Mv,{size:"small",onClick:i,disabled:l,"aria-label":"move down"},c.createElement(nU,{fontSize:"small"}))))))},dU=({providersData:e,rootProvider:t,savedMetrics:n=[],onSaveMetric:r,onRemoveMetric:o,onReorderMetrics:i,titleOverrides:a={},onUpdateTitle:l,onResetTitle:u,existingDimensions:d=[],existingFilters:p={}})=>{const[f,h]=s.useState(!1),[m,g]=s.useState([]),[v,b]=s.useState(""),y=iV(oV(XV),oV(UV,{coordinateGetter:ZW})),w=()=>{const r=t?0===m.length?t:m[m.length-1].targetKey:null;if(!r||!e||!e[r])return[];const o=e[r];if(!o.metrics)return[];const i=[e[t].default_alias];let a=t;m.forEach(t=>{const n=e[a];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&i.push(e.alias)}a=t.targetKey});const l=new Set(n.map(e=>e.fullPath)),s=o.metrics.map((e,t)=>{const n=`${i.join("_")}.${e.name}`,o=l.has(n);return{key:`${r}_${e.name}_${t}`,value:e.title||e.name,metricName:e.name,metric:e,disabled:o}});return s},x=()=>{h(!1),g([]),b("")},S=e=>{const n=[t];return e.relationNames&&e.relationNames.length>0&&n.push(...e.relationNames),n.join(" → ")};return c.createElement("div",null,c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:2,marginBottom:2}},f?c.createElement(c.Fragment,null,c.createElement(Xw,{variant:"outlined",onClick:x},"Cancel"),c.createElement(Xw,{variant:"contained",onClick:()=>{if(!v)return;const n=w().find(e=>e.key===v);if(!n)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)});const c=`${s.join("_")}.${n.metricName}`,u={metric:n.metric,relations:o,providerPath:i,relationNames:a,metricName:n.metricName,metricTitle:n.value,fullPath:c};r(u),x()},disabled:!v},"Save Metric")):c.createElement(Xw,{variant:"contained",onClick:()=>{h(!0),g([]),b("")}},"Add Metric")),f&&c.createElement(qg,{sx:{padding:3,marginBottom:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Select Provider Path"),c.createElement(kH,{providersData:e,rootProvider:t,onSelectionChange:g,existingDimensions:d,existingMetrics:n,existingFilters:p}),c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},"Select Metric"),c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1}},c.createElement(uR,{items:w(),value:v,label:"Choose Metric",onChange:e=>{b(e.target.value)},sx:{width:"400px"}}),c.createElement(Hk,{title:"Add all available metrics",arrow:!0,placement:"top"},c.createElement("span",null,c.createElement(Mv,{color:"primary",onClick:()=>{const n=w().filter(e=>!e.disabled);if(0===n.length)return;const o=[],i=[t],a=[];let l=t;m.forEach(t=>{const n=e[l];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(o.push(e),a.push(e.name))}i.push(t.targetKey),l=t.targetKey});const s=[e[t].default_alias];o.forEach(e=>{s.push(e.alias)}),n.forEach(e=>{const t=`${s.join("_")}.${e.metricName}`,n={metric:e.metric,relations:o,providerPath:i,relationNames:a,metricName:e.metricName,metricTitle:e.value,fullPath:t};r(n)}),x()},disabled:0===w().filter(e=>!e.disabled).length,"aria-label":"add all metrics"},c.createElement(lU,null)))))),n.length>0&&c.createElement(jw,{sx:{marginTop:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Saved Metrics (Drag to reorder or use arrows)"),c.createElement(TW,{sensors:y,collisionDetection:fV,onDragEnd:e=>{const{active:t,over:r}=e;if(r&&t.id!==r.id){const e=n.findIndex((e,n)=>n===t.id),o=n.findIndex((e,t)=>t===r.id),a=LW(n,e,o);i(a)}}},c.createElement(HW,{items:n.map((e,t)=>t),strategy:jW},c.createElement(jw,{sx:{display:"flex",flexDirection:"column",gap:1}},n.map((e,t)=>c.createElement(uU,{key:t,id:t,label:e.metricTitle,fullLabel:`${S(e)} → ${e.metricTitle} (${e.fullPath})`,onDelete:()=>o(t),onMoveUp:()=>(e=>{if(e>0){const t=LW(n,e,e-1);i(t)}})(t),onMoveDown:()=>(e=>{if(e<n.length-1){const t=LW(n,e,e+1);i(t)}})(t),isFirst:0===t,isLast:t===n.length-1,fullPath:e.fullPath,defaultTitle:e.metricTitle,customTitle:a[e.fullPath],onUpdateTitle:l,onResetTitle:u})))))))};var pU=Sg(Xp.jsx("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}));const fU=["localeText"],hU=s.createContext(null),mU=function(e){const{localeText:t}=e,n=d(e,fU),{adapter:r,localeText:o}=s.useContext(hU)??{adapter:void 0,localeText:void 0},i=cg({props:n,name:"MuiLocalizationProvider"}),{children:a,dateAdapter:l,dateFormats:c,dateLibInstance:u,adapterLocale:p,localeText:h}=i,m=s.useMemo(()=>f({},h,o,t),[h,o,t]),g=s.useMemo(()=>{if(!l)return r||null;const e=new l({locale:p,formats:c,instance:u});if(!e.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/quickstart/#installation"].join("\n"));return e},[l,p,c,u,r]),v=s.useMemo(()=>g?{minDate:g.date("1900-01-01T00:00:00.000"),maxDate:g.date("2099-12-31T00:00:00.000")}:null,[g]),b=s.useMemo(()=>({utils:g,adapter:g,defaultDates:v,localeText:m}),[v,g,m]);return Xp.jsx(hU.Provider,{value:b,children:a})},gU=(e,t)=>e.length===t.length&&t.every(t=>e.includes(t)),vU=(e,t,n)=>{let r=t;return r=e.setHours(r,e.getHours(n)),r=e.setMinutes(r,e.getMinutes(n)),r=e.setSeconds(r,e.getSeconds(n)),r=e.setMilliseconds(r,e.getMilliseconds(n)),r},bU=({date:e,disableFuture:t,disablePast:n,maxDate:r,minDate:o,isDateDisabled:i,adapter:a,timezone:l})=>{const s=vU(a,a.date(void 0,l),e);n&&a.isBefore(o,s)&&(o=s),t&&a.isAfter(r,s)&&(r=s);let c=e,u=e;for(a.isBefore(e,o)&&(c=o,u=null),a.isAfter(e,r)&&(u&&(u=r),c=null);c||u;){if(c&&a.isAfter(c,r)&&(c=null),u&&a.isBefore(u,o)&&(u=null),c){if(!i(c))return c;c=a.addDays(c,1)}if(u){if(!i(u))return u;u=a.addDays(u,-1)}}return null},yU=(e,t,n)=>null!=t&&e.isValid(t)?t:n,wU=(e,t)=>{const n=[e.startOfYear(t)];for(;n.length<12;){const t=n[n.length-1];n.push(e.addMonths(t,1))}return n},xU=(e,t,n)=>"date"===n?e.startOfDay(e.date(void 0,t)):e.date(void 0,t),SU=["year","month","day"],CU=e=>SU.includes(e),kU=(e,{format:t,views:n},r)=>{if(null!=t)return t;const o=e.formats;return gU(n,["year"])?o.year:gU(n,["month"])?o.month:gU(n,["day"])?o.dayOfMonth:gU(n,["month","year"])?`${o.month} ${o.year}`:gU(n,["day","month"])?`${o.month} ${o.dayOfMonth}`:r?/en/.test(e.getCurrentLocaleCode())?o.normalDateWithWeekday:o.normalDate:o.keyboardDate},EU=(e,t)=>{const n=e.startOfWeek(t);return[0,1,2,3,4,5,6].map(t=>e.addDays(n,t))},RU=["hours","minutes","seconds"],PU=(e,t)=>3600*t.getHours(e)+60*t.getMinutes(e)+t.getSeconds(e),MU={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},TU=(e,t,n)=>{if(t===MU.year)return e.startOfYear(n);if(t===MU.month)return e.startOfMonth(n);if(t===MU.day)return e.startOfDay(n);let r=n;return t<MU.minutes&&(r=e.setMinutes(r,0)),t<MU.seconds&&(r=e.setSeconds(r,0)),t<MU.milliseconds&&(r=e.setMilliseconds(r,0)),r},IU=({props:e,adapter:t,granularity:n,timezone:r,getTodayDate:o})=>{let i=o?o():TU(t,n,xU(t,r));null!=e.minDate&&t.isAfterDay(e.minDate,i)&&(i=TU(t,n,e.minDate)),null!=e.maxDate&&t.isBeforeDay(e.maxDate,i)&&(i=TU(t,n,e.maxDate));const a=((e,t)=>(n,r)=>e?t.isAfter(n,r):PU(n,t)>PU(r,t))(e.disableIgnoringDatePartForTimeValidation??!1,t);return null!=e.minTime&&a(e.minTime,i)&&(i=TU(t,n,e.disableIgnoringDatePartForTimeValidation?e.minTime:vU(t,i,e.minTime))),null!=e.maxTime&&a(i,e.maxTime)&&(i=TU(t,n,e.disableIgnoringDatePartForTimeValidation?e.maxTime:vU(t,i,e.maxTime))),i},OU=(e,t)=>{const n=e.formatTokenMap[t];if(null==n)throw new Error([`MUI X: The token "${t}" is not supported by the Date and Time Pickers.`,"Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported."].join("\n"));return"string"==typeof n?{type:n,contentType:"meridiem"===n?"letter":"digit",maxLength:void 0}:{type:n.sectionType,contentType:n.contentType,maxLength:n.maxLength}},DU=(e,t)=>{const n=[],r=e.date(void 0,"default"),o=e.startOfWeek(r),i=e.endOfWeek(r);let a=o;for(;e.isBefore(a,i);)n.push(a),a=e.addDays(a,1);return n.map(n=>e.formatByString(n,t))},FU=(e,t,n,r)=>{switch(n){case"month":return wU(e,e.date(void 0,t)).map(t=>e.formatByString(t,r));case"weekDay":return DU(e,r);case"meridiem":{const n=e.date(void 0,t);return[e.startOfDay(n),e.endOfDay(n)].map(t=>e.formatByString(t,r))}default:return[]}},LU=["0","1","2","3","4","5","6","7","8","9"],AU=(e,t)=>{if("0"===t[0])return e;const n=[];let r="";for(let o=0;o<e.length;o+=1){r+=e[o];const i=t.indexOf(r);i>-1&&(n.push(i.toString()),r="")}return n.join("")},NU=(e,t)=>"0"===t[0]?e:e.split("").map(e=>t[Number(e)]).join(""),$U=(e,t)=>{const n=AU(e,t);return" "!==n&&!Number.isNaN(Number(n))},zU=(e,t)=>Number(e).toString().padStart(t,"0"),jU=(e,t,n,r,o)=>{if("day"===o.type&&"digit-with-letter"===o.contentType){const r=e.setDate(n.longestMonth,t);return e.formatByString(r,o.format)}let i=t.toString();return o.hasLeadingZerosInInput&&(i=zU(i,o.maxLength)),NU(i,r)},BU=(e,t,n)=>{let r=e.value||e.placeholder;const o="non-input"===t?e.hasLeadingZerosInFormat:e.hasLeadingZerosInInput;"non-input"===t&&e.hasLeadingZerosInInput&&!e.hasLeadingZerosInFormat&&(r=Number(AU(r,n)).toString());return["input-rtl","input-ltr"].includes(t)&&"digit"===e.contentType&&!o&&1===r.length&&(r=`${r}`),"input-rtl"===t&&(r=`${r}`),r},_U=(e,t,n,r)=>e.formatByString(e.parse(t,n),r),HU=(e,t)=>4===e.formatByString(e.date(void 0,"system"),t).length,VU=(e,t,n,r)=>{if("digit"!==t)return!1;const o=e.date(void 0,"default");switch(n){case"year":return"dayjs"===e.lib&&"YY"===r||e.formatByString(e.setYear(o,1),r).startsWith("0");case"month":return e.formatByString(e.startOfYear(o),r).length>1;case"day":return e.formatByString(e.startOfMonth(o),r).length>1;case"weekDay":return e.formatByString(e.startOfWeek(o),r).length>1;case"hours":return e.formatByString(e.setHours(o,1),r).length>1;case"minutes":return e.formatByString(e.setMinutes(o,1),r).length>1;case"seconds":return e.formatByString(e.setSeconds(o,1),r).length>1;default:throw new Error("Invalid section type")}},WU={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},UU=(e,t,n,r,o)=>[...n].sort((e,t)=>WU[e.type]-WU[t.type]).reduce((n,r)=>!o||r.modified?((e,t,n,r)=>{switch(t.type){case"year":return e.setYear(r,e.getYear(n));case"month":return e.setMonth(r,e.getMonth(n));case"weekDay":{let r=e.formatByString(n,t.format);t.hasLeadingZerosInInput&&(r=zU(r,t.maxLength));const o=DU(e,t.format),i=o.indexOf(r),a=o.indexOf(t.value)-i;return e.addDays(n,a)}case"day":return e.setDate(r,e.getDate(n));case"meridiem":{const t=e.getHours(n)<12,o=e.getHours(r);return t&&o>=12?e.addHours(r,-12):!t&&o<12?e.addHours(r,12):r}case"hours":return e.setHours(r,e.getHours(n));case"minutes":return e.setMinutes(r,e.getMinutes(n));case"seconds":return e.setSeconds(r,e.getSeconds(n));default:return r}})(e,r,t,n):n,r),GU=(e,t)=>{if(null==e)return null;if("all"===e)return"all";if("string"==typeof e){const n=t.findIndex(t=>t.type===e);return-1===n?null:n}return e},KU=["value","referenceDate"],qU={emptyValue:null,getTodayValue:xU,getInitialReferenceValue:e=>{let{value:t,referenceDate:n}=e,r=d(e,KU);return r.adapter.isValid(t)?t:null!=n?n:IU(r)},cleanValue:(e,t)=>e.isValid(t)?t:null,areValuesEqual:(e,t,n)=>!e.isValid(t)&&null!=t&&!e.isValid(n)&&null!=n||e.isEqual(t,n),isSameError:(e,t)=>e===t,hasError:e=>null!=e,defaultErrorState:null,getTimezone:(e,t)=>e.isValid(t)?e.getTimezone(t):null,setTimezone:(e,t,n)=>null==n?null:e.setTimezone(n,t)},YU={updateReferenceValue:(e,t,n)=>e.isValid(t)?t:n,getSectionsFromValue:(e,t)=>t(e),getV7HiddenInputValueFromSections:e=>e.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),getV6InputValueFromSections:(e,t,n)=>{const r=e.map(e=>{const r=BU(e,n?"input-rtl":"input-ltr",t);return`${e.startSeparator}${r}${e.endSeparator}`}).join("");return n?`${r}`:r},parseValueStr:(e,t,n)=>n(e.trim(),t),getDateFromSection:e=>e,getDateSectionsFromValue:e=>e,updateDateInValue:(e,t,n)=>n,clearDateSections:e=>e.map(e=>f({},e,{value:""}))};function XU(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=XU(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function QU(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=XU(e))&&(r&&(r+=" "),r+=t);return r}function ZU(e){return Ph("MuiPickersToolbar",e)}Mh("MuiPickersToolbar",["root","title","content"]);const JU=s.createContext(()=>!0);const eG=s.createContext(null);function tG(){return s.useContext(eG)}const nG=s.createContext(null),rG=()=>{const e=s.useContext(nG);if(null==e)throw new Error("MUI X: The `usePickerContext` hook can only be called inside the context of a Picker component");return e},oG=s.createContext(null),iG=s.createContext({ownerState:{isPickerDisabled:!1,isPickerReadOnly:!1,isPickerValueEmpty:!1,isPickerOpen:!1,pickerVariant:"desktop",pickerOrientation:"portrait"},rootRefObject:{current:null},labelId:void 0,dismissViews:()=>{},hasUIView:!0,getCurrentViewMode:()=>"UI",triggerElement:null,viewContainerRole:null,defaultActionBarActions:[],onPopperExited:void 0});function aG(e){const{contextValue:t,actionsContextValue:n,privateContextValue:r,fieldPrivateContextValue:o,isValidContextValue:i,localeText:a,children:l}=e;return Xp.jsx(nG.Provider,{value:t,children:Xp.jsx(oG.Provider,{value:n,children:Xp.jsx(iG.Provider,{value:r,children:Xp.jsx(eG.Provider,{value:o,children:Xp.jsx(JU.Provider,{value:i,children:Xp.jsx(mU,{localeText:a,children:l})})})})})})}const lG=()=>s.useContext(iG);function sG(){const{ownerState:e}=lG(),t=um();return s.useMemo(()=>f({},e,{toolbarDirection:t?"rtl":"ltr"}),[e,t])}const cG=["children","className","classes","toolbarTitle","hidden","titleId","classes","landscapeDirection"],uG=pg("div",{name:"MuiPickersToolbar",slot:"Root"})(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"space-between",padding:e.spacing(2,3),variants:[{props:{pickerOrientation:"landscape"},style:{height:"auto",maxWidth:160,padding:16,justifyContent:"flex-start",flexWrap:"wrap"}}]})),dG=pg("div",{name:"MuiPickersToolbar",slot:"Content",shouldForwardProp:e=>Oh(e)&&"landscapeDirection"!==e})({display:"flex",flexWrap:"wrap",width:"100%",flex:1,justifyContent:"space-between",alignItems:"center",flexDirection:"row",variants:[{props:{pickerOrientation:"landscape"},style:{justifyContent:"flex-start",alignItems:"flex-start",flexDirection:"column"}},{props:{pickerOrientation:"landscape",landscapeDirection:"row"},style:{flexDirection:"row"}}]}),pG=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersToolbar"}),{children:r,className:o,classes:i,toolbarTitle:a,hidden:l,titleId:s,landscapeDirection:c}=n,u=d(n,cG),p=sG(),h=(e=>wm({root:["root"],title:["title"],content:["content"]},ZU,e))(i);return l?null:Xp.jsxs(uG,f({ref:t,className:QU(h.root,o),ownerState:p},u,{children:[Xp.jsx(Gv,{color:"text.secondary",variant:"overline",id:s,className:h.title,children:a}),Xp.jsx(dG,{className:h.content,ownerState:p,landscapeDirection:c,children:r})]}))}),fG={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:e=>"year"===e?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",nextStepButtonLabel:"Next",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",timeRangePickerToolbarTitle:"Select time range",clockLabelText:(e,t)=>`Select ${e}. ${t?`Selected time is ${t}`:"No time selected"}`,hoursClockNumberText:e=>`${e} hours`,minutesClockNumberText:e=>`${e} minutes`,secondsClockNumberText:e=>`${e} seconds`,selectViewText:e=>`Select ${e}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:e=>`Week ${e}`,calendarWeekNumberText:e=>`${e}`,openDatePickerDialogue:e=>e?`Choose date, selected date is ${e}`:"Choose date",openTimePickerDialogue:e=>e?`Choose time, selected time is ${e}`:"Choose time",openRangePickerDialogue:e=>e?`Choose range, selected range is ${e}`:"Choose range",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:e=>"Y".repeat(e.digitAmount),fieldMonthPlaceholder:e=>"letter"===e.contentType?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:e=>"letter"===e.contentType?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"},hG=fG;f({},fG);const mG=()=>{const e=s.useContext(hU);if(null===e)throw new Error(["MUI X: Can not find the date and time pickers localization context.","It looks like you forgot to wrap your component in LocalizationProvider.","This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package"].join("\n"));if(null===e.adapter)throw new Error(["MUI X: Can not find the date and time pickers adapter from its localization context.","It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider."].join("\n"));const t=s.useMemo(()=>f({},hG,e.localeText),[e.localeText]);return s.useMemo(()=>f({},e,{localeText:t}),[e,t])},gG=()=>mG().adapter,vG=()=>mG().localeText,bG=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],yG=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],wG=["minDateTime","maxDateTime"],xG=[...bG,...yG,...wG],SG=e=>xG.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{}),CG=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","unstableStartFieldRef","unstableEndFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator","autoFocus","focused"],kG=(e,t)=>s.useMemo(()=>{const n=f({},e),r={},o=e=>{n.hasOwnProperty(e)&&(r[e]=n[e],delete n[e])};return CG.forEach(o),"date"===t?bG.forEach(o):"time"===t?yG.forEach(o):"date-time"===t&&(bG.forEach(o),yG.forEach(o),wG.forEach(o)),{forwardedProps:n,internalProps:r}},[e,t]),EG=(e,t,n,r)=>{switch(n.type){case"year":return t.fieldYearPlaceholder({digitAmount:e.formatByString(e.date(void 0,"default"),r).length,format:r});case"month":return t.fieldMonthPlaceholder({contentType:n.contentType,format:r});case"day":return t.fieldDayPlaceholder({format:r});case"weekDay":return t.fieldWeekDayPlaceholder({contentType:n.contentType,format:r});case"hours":return t.fieldHoursPlaceholder({format:r});case"minutes":return t.fieldMinutesPlaceholder({format:r});case"seconds":return t.fieldSecondsPlaceholder({format:r});case"meridiem":return t.fieldMeridiemPlaceholder({format:r});default:return r}},RG=({adapter:e,date:t,shouldRespectLeadingZeros:n,localeText:r,localizedDigits:o,now:i,token:a,startSeparator:l})=>{if(""===a)throw new Error("MUI X: Should not call `commitToken` with an empty token");const s=OU(e,a),c=VU(e,s.contentType,s.type,a),u=n?c:"digit"===s.contentType,d=e.isValid(t);let p=d?e.formatByString(t,a):"",h=null;if(u)if(c)h=""===p?e.formatByString(i,a).length:p.length;else{if(null==s.maxLength)throw new Error(`MUI X: The token ${a} should have a 'maxLength' property on it's adapter`);h=s.maxLength,d&&(p=NU(zU(AU(p,o),h),o))}return f({},s,{format:a,maxLength:h,value:p,placeholder:EG(e,r,s,a),hasLeadingZerosInFormat:c,hasLeadingZerosInInput:u,startSeparator:l,endSeparator:"",modified:!1})},PG=e=>{let t=(({adapter:e,format:t})=>{let n=10,r=t,o=e.expandFormat(t);for(;o!==r;)if(r=o,o=e.expandFormat(r),n-=1,n<0)throw new Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the component.");return o})(e);e.isRtl&&e.enableAccessibleFieldDOMStructure&&(t=t.split(" ").reverse().join(" "));const n=(({adapter:e,expandedFormat:t})=>{const n=[],{start:r,end:o}=e.escapedCharacters,i=new RegExp(`(\\${r}[^\\${o}]*\\${o})+`,"g");let a=null;for(;a=i.exec(t);)n.push({start:a.index,end:i.lastIndex-1});return n})(f({},e,{expandedFormat:t})),r=(e=>{const{adapter:t,expandedFormat:n,escapedParts:r}=e,o=t.date(void 0),i=[];let a="";const l=Object.keys(t.formatTokenMap).sort((e,t)=>t.length-e.length),s=/^([a-zA-Z]+)/,c=new RegExp(`^(${l.join("|")})*$`),u=new RegExp(`^(${l.join("|")})`),d=e=>r.find(t=>t.start<=e&&t.end>=e);let p=0;for(;p<n.length;){const t=d(p),r=null!=t,l=s.exec(n.slice(p))?.[1];if(!r&&null!=l&&c.test(l)){let t=l;for(;t.length>0;){const n=u.exec(t)[1];t=t.slice(n.length),i.push(RG(f({},e,{now:o,token:n,startSeparator:a}))),a=""}p+=l.length}else{const e=n[p];r&&t?.start===p||t?.end===p||(0===i.length?a+=e:(i[i.length-1].endSeparator+=e,i[i.length-1].isEndFormatSeparator=!0)),p+=1}}return 0===i.length&&a.length>0&&i.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:a,endSeparator:"",modified:!1}),i})(f({},e,{expandedFormat:t,escapedParts:n}));return(({isRtl:e,formatDensity:t,sections:n})=>n.map(n=>{const r=n=>{let r=n;return e&&null!==r&&r.includes(" ")&&(r=`${r}`),"spacious"===t&&["/",".","-"].includes(r)&&(r=` ${r} `),r};return n.startSeparator=r(n.startSeparator),n.endSeparator=r(n.endSeparator),n}))(f({},e,{sections:r}))},MG=()=>s.useContext(nG);function TG(e){return Ph("MuiDatePickerToolbar",e)}Mh("MuiDatePickerToolbar",["root","title"]);const IG=["toolbarFormat","toolbarPlaceholder","className","classes"],OG=pg(pG,{name:"MuiDatePickerToolbar",slot:"Root"})({}),DG=pg(Gv,{name:"MuiDatePickerToolbar",slot:"Title"})({variants:[{props:{pickerOrientation:"landscape"},style:{margin:"auto 16px auto auto"}}]}),FG=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiDatePickerToolbar"}),{toolbarFormat:r,toolbarPlaceholder:o="––",className:i,classes:a}=n,l=d(n,IG),c=gG(),{value:u,views:p,orientation:h}=rG(),m=vG(),g=sG(),v=(e=>wm({root:["root"],title:["title"]},TG,e))(a),b=s.useMemo(()=>{if(!c.isValid(u))return o;const e=kU(c,{format:r,views:p},!0);return c.formatByString(u,e)},[u,r,o,c,p]);return Xp.jsx(OG,f({ref:t,toolbarTitle:m.datePickerToolbarTitle,className:QU(v.root,i)},l,{children:Xp.jsx(DG,{variant:"h4",align:"landscape"===h?"left":"center",ownerState:g,className:v.title,children:b})}))}),LG=({props:e,value:t,timezone:n,adapter:r})=>{if(null===t)return null;const{shouldDisableDate:o,shouldDisableMonth:i,shouldDisableYear:a,disablePast:l,disableFuture:s,minDate:c,maxDate:u}=e,d=r.date(void 0,n);switch(!0){case!r.isValid(t):return"invalidDate";case Boolean(o&&o(t)):return"shouldDisableDate";case Boolean(i&&i(t)):return"shouldDisableMonth";case Boolean(a&&a(t)):return"shouldDisableYear";case Boolean(s&&r.isAfterDay(t,d)):return"disableFuture";case Boolean(l&&r.isBeforeDay(t,d)):return"disablePast";case Boolean(c&&r.isBeforeDay(t,c)):return"minDate";case Boolean(u&&r.isAfterDay(t,u)):return"maxDate";default:return null}};function AG(e){const{props:t,validator:n,value:r,timezone:o,onError:i}=e,a=gG(),l=s.useRef(n.valueManager.defaultErrorState),c=n({adapter:a,value:r,timezone:o,props:t}),u=n.valueManager.hasError(c);s.useEffect(()=>{i&&!n.valueManager.isSameError(c,l.current)&&i(c,r),l.current=c},[n,i,c,r]);const d=Mg(e=>n({adapter:a,value:e,timezone:o,props:t}));return{validationError:c,hasValidationError:u,getValidationErrorForNewValue:d}}LG.valueManager=qU;const NG=e=>{const t=gG(),n=s.useRef(void 0);return void 0===n.current&&(n.current=t.date(void 0,e)),n.current};function $G(e){const t=gG(),n=vG();return s.useMemo(()=>{const r=t.isValid(e)?t.format(e,"fullDate"):null;return n.openDatePickerDialogue(r)},[e,n,t])}function zG(e){const t=gG(),n=jG(e);return s.useMemo(()=>f({},e,n,{format:e.format??t.formats.keyboardDate}),[e,n,t])}function jG(e){const t=gG(),n=mG().defaultDates;return s.useMemo(()=>({disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,minDate:yU(t,e.minDate,n.minDate),maxDate:yU(t,e.maxDate,n.maxDate)}),[e.minDate,e.maxDate,e.disableFuture,e.disablePast,t,n])}function BG(e,t){const n=cg({props:e,name:t}),r=jG(n),o=s.useMemo(()=>null==n.localeText?.toolbarTitle?n.localeText:f({},n.localeText,{datePickerToolbarTitle:n.localeText.toolbarTitle}),[n.localeText]);return f({},n,r,{localeText:o},(({openTo:e,defaultOpenTo:t,views:n,defaultViews:r})=>{const o=n??r;let i;if(null!=e)i=e;else if(o.includes(t))i=t;else{if(!(o.length>0))throw new Error("MUI X: The `views` prop must contain at least one view.");i=o[0]}return{views:o,openTo:i}})({views:n.views,openTo:n.openTo,defaultViews:["year","day"],defaultOpenTo:"day"}),{slots:f({toolbar:FG},n.slots)})}function _G(e){return Ph("MuiPickerPopper",e)}Mh("MuiPickerPopper",["root","paper"]);const HG=(e=document)=>{const t=e.activeElement;return t?t.shadowRoot?HG(t.shadowRoot):t:null},VG=e=>HG(kg(e)),WG="@media (pointer: fine)",UG=["PaperComponent","ownerState","children","paperSlotProps","paperClasses","onPaperClick","onPaperTouchStart"],GG=pg(My,{name:"MuiPickerPopper",slot:"Root"})(({theme:e})=>({zIndex:e.zIndex.modal})),KG=pg(qg,{name:"MuiPickerPopper",slot:"Paper"})({outline:0,transformOrigin:"top center",variants:[{props:({popperPlacement:e})=>new Set(["top","top-start","top-end"]).has(e),style:{transformOrigin:"bottom center"}}]});const qG=s.forwardRef((e,t)=>{const{PaperComponent:n,ownerState:r,children:o,paperSlotProps:i,paperClasses:a,onPaperClick:l,onPaperTouchStart:s}=e,c=d(e,UG),u=yy({elementType:n,externalSlotProps:i,additionalProps:{tabIndex:-1,elevation:8,ref:t},className:a,ownerState:r});return Xp.jsx(n,f({},c,u,{onClick:e=>{l(e),u.onClick?.(e)},onTouchStart:e=>{s(e),u.onTouchStart?.(e)},ownerState:r,children:o}))});function YG(e){const t=cg({props:e,name:"MuiPickerPopper"}),{children:n,placement:r="bottom-start",slots:o,slotProps:i,classes:a}=t,{open:l,popupRef:c,reduceAnimations:u}=rG(),{ownerState:d,rootRefObject:p}=lG(),{dismissViews:h,getCurrentViewMode:m,onPopperExited:g,triggerElement:v,viewContainerRole:b}=lG();s.useEffect(()=>{function e(e){l&&"Escape"===e.key&&h()}return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[h,l]);const y=s.useRef(null);s.useEffect(()=>{"tooltip"!==b&&"field"!==m()&&(l?y.current=VG(p.current):y.current&&y.current instanceof HTMLElement&&setTimeout(()=>{y.current instanceof HTMLElement&&y.current.focus()}))},[l,b,m,p]);const w=(e=>wm({root:["root"],paper:["paper"]},_G,e))(a),x=Mg(()=>{"tooltip"===b?setTimeout(()=>{p.current?.contains(VG(p.current))||c.current?.contains(VG(c.current))||h()},0):h()}),[S,C,k]=function(e,t){const n=s.useRef(!1),r=s.useRef(!1),o=s.useRef(null),i=s.useRef(!1);s.useEffect(()=>{if(e)return document.addEventListener("mousedown",t,!0),document.addEventListener("touchstart",t,!0),()=>{document.removeEventListener("mousedown",t,!0),document.removeEventListener("touchstart",t,!0),i.current=!1};function t(){i.current=!0}},[e]);const a=Mg(e=>{if(!i.current)return;const a=r.current;r.current=!1;const l=kg(o.current);if(!o.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,l))return;if(n.current)return void(n.current=!1);let s;s=e.composedPath?e.composedPath().indexOf(o.current)>-1:!l.documentElement.contains(e.target)||o.current.contains(e.target),s||a||t(e)}),l=e=>{e.defaultMuiPrevented||(r.current=!0)};return s.useEffect(()=>{if(e){const e=kg(o.current),t=()=>{n.current=!0};return e.addEventListener("touchstart",a),e.addEventListener("touchmove",t),()=>{e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",t)}}},[e,a]),s.useEffect(()=>{if(e){const e=kg(o.current);return e.addEventListener("click",a),()=>{e.removeEventListener("click",a),r.current=!1}}},[e,a]),[o,l,l]}(l,x),E=Tg(s.useRef(null),c),R=Tg(E,S),P=o?.desktopTransition??u?Pw:PS,M=o?.desktopTrapFocus??Cx,T=o?.desktopPaper??KG,I=o?.popper??GG,O=yy({elementType:I,externalSlotProps:i?.popper,additionalProps:{transition:!0,role:null==b?void 0:b,open:l,placement:r,anchorEl:v,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),h())}},className:w.root,ownerState:d}),D=s.useMemo(()=>f({},d,{popperPlacement:O.placement}),[d,O.placement]);return Xp.jsx(I,f({},O,{children:({TransitionProps:e})=>Xp.jsx(M,f({open:l,disableAutoFocus:!0,disableRestoreFocus:!0,disableEnforceFocus:"tooltip"===b,isEnabled:()=>!0},i?.desktopTrapFocus,{children:Xp.jsx(P,f({},e,i?.desktopTransition,{onExited:t=>{g?.(),i?.desktopTransition?.onExited?.(t),e?.onExited?.()},children:Xp.jsx(qG,{PaperComponent:T,ownerState:D,ref:R,onPaperClick:C,onPaperTouchStart:k,paperClasses:w.paper,paperSlotProps:i?.desktopPaper,children:n})}))}))}))}const XG="undefined"!=typeof navigator&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),QG=XG&&XG[1]?parseInt(XG[1],10):null,ZG=XG&&XG[2]?parseInt(XG[2],10):null,JG=QG&&QG<10||ZG&&ZG<13||!1;function eK(e){const t=nR("@media (prefers-reduced-motion: reduce)",{defaultMatches:!1});return null!=e?e:t||JG}const tK={hasNextStep:!1,hasSeveralSteps:!1,goToNextStep:()=>{},areViewsInSameStep:()=>!0};function nK({onChange:e,onViewChange:t,openTo:n,view:r,views:o,autoFocus:i,focusedView:a,onFocusedViewChange:l,getStepNavigation:c}){const u=s.useRef(n),d=s.useRef(o),p=s.useRef(o.includes(n)?n:o[0]),[h,m]=Pg({name:"useViews",state:"view",controlled:r,default:p.current}),g=s.useRef(i?h:null),[v,b]=Pg({name:"useViews",state:"focusedView",controlled:a,default:g.current}),y=c?c({setView:m,view:h,defaultView:p.current,views:o}):tK;s.useEffect(()=>{(u.current&&u.current!==n||d.current&&d.current.some(e=>!o.includes(e)))&&(m(o.includes(n)?n:o[0]),d.current=o,u.current=n)},[n,m,h,o]);const w=o.indexOf(h),x=o[w-1]??null,S=o[w+1]??null,C=Mg((e,t)=>{b(t?e:t=>e===t?null:t),l?.(e,t)}),k=Mg(e=>{C(e,!0),e!==h&&(m(e),t&&t(e))}),E=Mg(()=>{S&&k(S)}),R=Mg((t,n,r)=>{const i="finish"===n,a=r?o.indexOf(r)<o.length-1:Boolean(S);e(t,i&&a?"partial":n,r);let l=null;if(null!=r&&r!==h?l=r:i&&(l=h),null==l)return;const s=o[o.indexOf(l)+1];null!=s&&y.areViewsInSameStep(l,s)&&k(s)});return f({},y,{view:h,setView:k,focusedView:v,setFocusedView:C,nextView:S,previousView:x,defaultView:o.includes(n)?n:o[0],goToNextView:E,setValueAndGoToNextView:R})}function rK(){return"undefined"==typeof window?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?90===Math.abs(window.screen.orientation.angle)?"landscape":"portrait":window.orientation&&90===Math.abs(Number(window.orientation))?"landscape":"portrait"}function oK(e,t){const[n,r]=s.useState(rK);return Wh(()=>{const e=()=>{r(rK())};return window.addEventListener("orientationchange",e),()=>{window.removeEventListener("orientationchange",e)}},[]),o=e,i=["hours","minutes","seconds"],(Array.isArray(i)?i.every(e=>-1!==o.indexOf(e)):-1!==o.indexOf(i))?"portrait":t??n;var o,i}const iK=({name:e,timezone:t,value:n,defaultValue:r,referenceDate:o,onChange:i,valueManager:a})=>{const l=gG(),[c,u]=Pg({name:e,state:"value",controlled:n,default:r??a.emptyValue}),d=s.useMemo(()=>a.getTimezone(l,c),[l,a,c]),p=Mg(e=>null==d?e:a.setTimezone(l,d,e)),f=s.useMemo(()=>t||(d||(o?l.getTimezone(Array.isArray(o)?o[0]:o):"default")),[t,d,o,l]);return{value:s.useMemo(()=>a.setTimezone(l,f,c),[a,l,f,c]),handleValueChange:Mg((e,...t)=>{const n=p(e);u(n),i?.(n,...t)}),timezone:f}};const aK=["className","sx"],lK=({ref:e,props:t,valueManager:n,valueType:r,variant:o,validator:i,onPopperExited:a,autoFocusView:l,rendererInterceptor:c,localeText:u,viewContainerRole:p,getStepNavigation:h})=>{const{views:m,view:g,openTo:v,onViewChange:b,viewRenderers:y,reduceAnimations:w,orientation:x,disableOpenPicker:S,closeOnSelect:C,disabled:k,readOnly:E,formatDensity:R,enableAccessibleFieldDOMStructure:P,selectedSections:M,onSelectedSectionsChange:T,format:I,label:O,autoFocus:D,name:F}=t,{className:L,sx:A}=t,N=d(t,aK),$=mm(),z=gG(),j=eK(w),B=oK(m,x),{current:_}=s.useRef(v??null),[H,V]=s.useState(null),W=s.useRef(null),U=s.useRef(null),G=s.useRef(null),K=Tg(e,G),{timezone:q,state:Y,setOpen:X,setValue:Q,setValueFromView:Z,value:J,viewValue:ee}=function(e){const{props:t,valueManager:n,validator:r}=e,{value:o,defaultValue:i,onChange:a,referenceDate:l,timezone:c,onAccept:u,closeOnSelect:d,open:p,onOpen:h,onClose:m}=t,{current:g}=s.useRef(i),{current:v}=s.useRef(void 0!==o),{current:b}=s.useRef(void 0!==p),y=gG(),{timezone:w,value:x,handleValueChange:S}=iK({name:"a picker component",timezone:c,value:o,defaultValue:g,referenceDate:l,onChange:a,valueManager:n}),[C,k]=s.useState(()=>({open:!1,lastExternalValue:x,clockShallowValue:void 0,lastCommittedValue:x,hasBeenModifiedSinceMount:!1})),{getValidationErrorForNewValue:E}=AG({props:t,validator:r,timezone:w,value:x,onError:t.onError}),R=Mg(e=>{const t="function"==typeof e?e(C.open):e;b||k(e=>f({},e,{open:t})),t&&h&&h(),t||m?.()}),P=Mg((e,t)=>{const{changeImportance:r="accept",skipPublicationIfPristine:o=!1,validationError:i,shortcut:a,source:l,shouldClose:s="accept"===r}=t??{};let c,d;o||v||C.hasBeenModifiedSinceMount?(c=!n.areValuesEqual(y,e,x),d="accept"===r&&!n.areValuesEqual(y,e,C.lastCommittedValue)):(c=!0,d="accept"===r),k(t=>f({},t,{clockShallowValue:c?void 0:t.clockShallowValue,lastCommittedValue:d?e:t.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let p=null;const h=()=>{if(!p){let t;t=l||(a?"view":"unknown"),p={validationError:null==i?E(e):i,source:t},a&&(p.shortcut=a)}return p};c&&S(e,h()),d&&u&&u(e,h()),s&&R(!1)});x!==C.lastExternalValue&&k(e=>f({},e,{lastExternalValue:x,clockShallowValue:void 0,hasBeenModifiedSinceMount:!0}));const M=Mg((e,t="partial")=>{"shallow"!==t?P(e,{changeImportance:"finish"===t&&d?"accept":"set",source:"view"}):k(t=>f({},t,{clockShallowValue:e,hasBeenModifiedSinceMount:!0}))});s.useEffect(()=>{if(b){if(void 0===p)throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");k(e=>f({},e,{open:p}))}},[b,p]);const T=s.useMemo(()=>n.cleanValue(y,void 0===C.clockShallowValue?x:C.clockShallowValue),[y,n,C.clockShallowValue,x]);return{timezone:w,state:C,setValue:P,setValueFromView:M,setOpen:R,value:x,viewValue:T}}({props:t,valueManager:n,validator:i}),{view:te,setView:ne,defaultView:re,focusedView:oe,setFocusedView:ie,setValueAndGoToNextView:ae,goToNextStep:le,hasNextStep:se,hasSeveralSteps:ce}=nK({view:g,views:m,openTo:v,onChange:Z,onViewChange:b,autoFocus:l,getStepNavigation:h}),ue=Mg(()=>Q(n.emptyValue,{source:"view"})),de=Mg(()=>Q(n.getTodayValue(z,q,r),{source:"view"})),pe=Mg(()=>Q(J,{source:"view"})),fe=Mg(()=>Q(Y.lastCommittedValue,{skipPublicationIfPristine:!0,source:"view"})),he=Mg(()=>{Q(J,{skipPublicationIfPristine:!0,source:"view"})}),{hasUIView:me,viewModeLookup:ge,timeViewsCount:ve}=s.useMemo(()=>m.reduce((e,t)=>{const n=null==y[t]?"field":"UI";return e.viewModeLookup[t]=n,"UI"===n&&(e.hasUIView=!0,(e=>RU.includes(e))(t)&&(e.timeViewsCount+=1)),e},{hasUIView:!1,viewModeLookup:{},timeViewsCount:0}),[y,m]),be=ge[te],ye=Mg(()=>be),[we,xe]=s.useState("UI"===be?te:null);we!==te&&"UI"===ge[te]&&xe(te),Wh(()=>{"field"===be&&Y.open&&(X(!1),setTimeout(()=>{U?.current?.setSelectedSections(te),U?.current?.focusField(te)}))},[te]),Wh(()=>{if(!Y.open)return;let e=te;"field"===be&&null!=we&&(e=we),e!==re&&"UI"===ge[e]&&"UI"===ge[re]&&(e=re),e!==te&&ne(e),ie(e,!0)},[Y.open]);const Se=s.useMemo(()=>({isPickerValueEmpty:n.areValuesEqual(z,J,n.emptyValue),isPickerOpen:Y.open,isPickerDisabled:t.disabled??!1,isPickerReadOnly:t.readOnly??!1,pickerOrientation:B,pickerVariant:o}),[z,n,J,Y.open,B,o,t.disabled,t.readOnly]),Ce=s.useMemo(()=>S||!me?"hidden":k||E?"disabled":"enabled",[S,me,k,E]),ke=Mg(le),Ee=s.useMemo(()=>C&&!ce?[]:["cancel","nextOrAccept"],[C,ce]),Re=s.useMemo(()=>({setValue:Q,setOpen:X,clearValue:ue,setValueToToday:de,acceptValueChanges:pe,cancelValueChanges:fe,setView:ne,goToNextStep:ke}),[Q,X,ue,de,pe,fe,ne,ke]),Pe=s.useMemo(()=>f({},Re,{value:J,timezone:q,open:Y.open,views:m,view:we,initialView:_,disabled:k??!1,readOnly:E??!1,autoFocus:D??!1,variant:o,orientation:B,popupRef:W,reduceAnimations:j,triggerRef:V,triggerStatus:Ce,hasNextStep:se,fieldFormat:I??"",name:F,label:O,rootSx:A,rootRef:K,rootClassName:L}),[Re,J,K,o,B,j,k,E,I,L,F,O,A,Ce,se,q,Y.open,we,m,_,D]),Me=s.useMemo(()=>({dismissViews:he,ownerState:Se,hasUIView:me,getCurrentViewMode:ye,rootRefObject:G,labelId:$,triggerElement:H,viewContainerRole:p,defaultActionBarActions:Ee,onPopperExited:a}),[he,Se,me,ye,$,H,p,Ee,a]),Te=s.useMemo(()=>({formatDensity:R,enableAccessibleFieldDOMStructure:P,selectedSections:M,onSelectedSectionsChange:T,fieldRef:U}),[R,P,M,T,U]);return{providerProps:{localeText:u,contextValue:Pe,privateContextValue:Me,actionsContextValue:Re,fieldPrivateContextValue:Te,isValidContextValue:e=>{const r=i({adapter:z,value:e,timezone:q,props:t});return!n.hasError(r)}},renderCurrentView:()=>{if(null==we)return null;const e=y[we];if(null==e)return null;const t=f({},N,{views:m,timezone:q,value:ee,onChange:ae,view:we,onViewChange:ne,showViewSwitcher:ve>1,timeViewsCount:ve},"tooltip"===p?{focusedView:null,onFocusedViewChange:()=>{}}:{focusedView:oe,onFocusedViewChange:ie});return c?Xp.jsx(c,{viewRenderers:y,popperView:we,rendererProps:t}):e(t)},ownerState:Se}};function sK(e){return Ph("MuiPickersLayout",e)}const cK=Mh("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),uK=["actions"],dK=pg(_x,{name:"MuiPickersLayout",slot:"ActionBar"})({});function pK(e){const{actions:t}=e,n=d(e,uK),r=vG(),{clearValue:o,setValueToToday:i,acceptValueChanges:a,cancelValueChanges:l,goToNextStep:s,hasNextStep:c}=rG();if(null==t||0===t.length)return null;const u=t?.map(e=>{switch(e){case"clear":return Xp.jsx(Xw,{onClick:o,children:r.clearButtonLabel},e);case"cancel":return Xp.jsx(Xw,{onClick:l,children:r.cancelButtonLabel},e);case"accept":return Xp.jsx(Xw,{onClick:a,children:r.okButtonLabel},e);case"today":return Xp.jsx(Xw,{onClick:i,children:r.todayButtonLabel},e);case"next":return Xp.jsx(Xw,{onClick:s,children:r.nextStepButtonLabel},e);case"nextOrAccept":return c?Xp.jsx(Xw,{onClick:s,children:r.nextStepButtonLabel},e):Xp.jsx(Xw,{onClick:a,children:r.okButtonLabel},e);default:return null}});return Xp.jsx(dK,f({},n,{children:u}))}const fK=s.memo(pK),hK=320,mK=["items","changeImportance"],gK=["getValue"],vK=pg(tC,{name:"MuiPickersLayout",slot:"Shortcuts"})({});function bK(e){const{items:t,changeImportance:n="accept"}=e,r=d(e,mK),{setValue:o}=(()=>{const e=s.useContext(oG);if(null==e)throw new Error(["MUI X: The `usePickerActionsContext` can only be called in fields that are used as a slot of a Picker component"].join("\n"));return e})(),i=s.useContext(JU);if(null==t||0===t.length)return null;const a=t.map(e=>{let{getValue:t}=e,r=d(e,gK);const a=t({isValid:i});return f({},r,{label:r.label,onClick:()=>{o(a,{changeImportance:n,shortcut:r,source:"view"})},disabled:!i(a)})});return Xp.jsx(vK,f({dense:!0,sx:[{maxHeight:336,maxWidth:200,overflow:"auto"},...Array.isArray(r.sx)?r.sx:[r.sx]]},r,{children:a.map(e=>Xp.jsx(cC,{children:Xp.jsx(zy,f({},e))},e.id??e.label))}))}const yK=["ownerState"];const wK=e=>{const{ownerState:t,defaultActionBarActions:n}=lG(),{view:r}=rG(),o=um(),{children:i,slots:a,slotProps:l,classes:c}=e,u=s.useMemo(()=>f({},t,{layoutDirection:o?"rtl":"ltr",hasShortcuts:!1}),[t,o]),p=((e,t)=>{const{pickerOrientation:n}=t;return wm({root:["root","landscape"===n&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},sK,e)})(c,u),h=a?.actionBar??fK,m=d(yy({elementType:h,externalSlotProps:l?.actionBar,additionalProps:{actions:n},className:p.actionBar,ownerState:u}),yK),g=Xp.jsx(h,f({},m)),v=a?.toolbar,b=yy({elementType:v,externalSlotProps:l?.toolbar,className:p.toolbar,ownerState:u}),y=function(e){return null!==e.view}(b)&&v?Xp.jsx(v,f({},b)):null,w=i,x=a?.tabs,S=r&&x?Xp.jsx(x,f({className:p.tabs},l?.tabs)):null,C=a?.shortcuts??bK,k=yy({elementType:C,externalSlotProps:l?.shortcuts,className:p.shortcuts,ownerState:u}),E=Array.isArray(k?.items)&&k.items.length>0;return{toolbar:y,content:w,tabs:S,actionBar:g,shortcuts:r&&C?Xp.jsx(C,f({},k)):null,ownerState:f({},u,{hasShortcuts:E})}},xK=pg("div",{name:"MuiPickersLayout",slot:"Root"})({display:"grid",gridAutoColumns:"max-content auto max-content",gridAutoRows:"max-content auto max-content",[`& .${cK.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{pickerOrientation:"landscape",hasShortcuts:!1},style:{[`& .${cK.toolbar}`]:{gridColumn:1,gridRow:"1 / 3"}}},{props:{pickerOrientation:"landscape",hasShortcuts:!0},style:{[`& .${cK.toolbar}`]:{gridColumn:"2 / 4",gridRow:1,maxWidth:"max-content"},[`& .${cK.shortcuts}`]:{gridColumn:1,gridRow:2}}},{props:{pickerOrientation:"portrait"},style:{[`& .${cK.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${cK.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{hasShortcuts:!0,layoutDirection:"rtl"},style:{[`& .${cK.shortcuts}`]:{gridColumn:4}}}]}),SK=pg("div",{name:"MuiPickersLayout",slot:"ContentWrapper"})({gridColumn:"2 / 4",gridRow:2,display:"flex",flexDirection:"column"}),CK=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersLayout"}),{toolbar:r,content:o,tabs:i,actionBar:a,shortcuts:l,ownerState:c}=wK(n),{orientation:u,variant:d}=rG(),{sx:p,className:f,classes:h}=n,m=((e,t)=>{const{pickerOrientation:n}=t;return wm({root:["root","landscape"===n&&"landscape"],contentWrapper:["contentWrapper"]},sK,e)})(h,c);return Xp.jsxs(xK,{ref:t,sx:p,className:QU(m.root,f),ownerState:c,children:["landscape"===u?l:r,"landscape"===u?r:l,Xp.jsx(SK,{className:m.contentWrapper,ownerState:c,children:"desktop"===d?Xp.jsxs(s.Fragment,{children:[o,i]}):Xp.jsxs(s.Fragment,{children:[i,o]})}),a]})});function kK(e){const{steps:t}=e;return function(e){const{steps:t,isViewMatchingStep:n,onStepChange:r}=e;return e=>{if(null==t)return tK;const o=t.findIndex(t=>n(e.view,t)),i=-1===o||o===t.length-1?null:t[o+1];return{hasNextStep:null!=i,hasSeveralSteps:t.length>1,goToNextStep:()=>{null!=i&&r(f({},e,{step:i}))},areViewsInSameStep:(e,r)=>t.find(t=>n(e,t))===t.find(e=>n(r,e))}}}({steps:t,isViewMatchingStep:(e,t)=>null==t.views||t.views.includes(e),onStepChange:({step:e,defaultView:t,setView:n,view:r,views:o})=>{const i=null==e.views?t:e.views.find(e=>o.includes(e));i!==r&&n(i)}})}const EK=["props","steps"],RK=["ownerState"],PK=e=>null!=e.saveQuery,MK=({stateResponse:{localizedDigits:e,sectionsValueBoundaries:t,state:n,timezone:r,setCharacterQuery:o,setTempAndroidValueStr:i,updateSectionValue:a}})=>{const l=gG(),s=({keyPressed:e,sectionIndex:t},r,i)=>{const a=e.toLowerCase(),l=n.sections[t];if(null!=n.characterQuery&&(!i||i(n.characterQuery.value))&&n.characterQuery.sectionIndex===t){const e=`${n.characterQuery.value}${a}`,i=r(e,l);if(!PK(i))return o({sectionIndex:t,value:e,sectionType:l.type}),i}const s=r(a,l);return PK(s)&&!s.saveQuery?(o(null),null):(o({sectionIndex:t,value:a,sectionType:l.type}),PK(s)?null:s)};return Mg(o=>{const c=n.sections[o.sectionIndex],u=$U(o.keyPressed,e)?(n=>{const r=({queryValue:n,skipIfBelowMinimum:r,section:o})=>{const i=AU(n,e),a=Number(i),s=t[o.type]({currentDate:null,format:o.format,contentType:o.contentType});if(a>s.maximum)return{saveQuery:!1};if(r&&a<s.minimum)return{saveQuery:!0};const c=10*a>s.maximum||i.length===s.maximum.toString().length;return{sectionValue:jU(l,a,s,e,o),shouldGoToNextSection:c}};return s(n,(e,t)=>{if("digit"===t.contentType||"digit-with-letter"===t.contentType)return r({queryValue:e,skipIfBelowMinimum:!1,section:t});if("month"===t.type){VU(l,"digit","month","MM");const n=r({queryValue:e,skipIfBelowMinimum:!0,section:{type:t.type,format:"MM",hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2}});return PK(n)?n:f({},n,{sectionValue:_U(l,n.sectionValue,"MM",t.format)})}if("weekDay"===t.type){const n=r({queryValue:e,skipIfBelowMinimum:!0,section:t});return PK(n)?n:f({},n,{sectionValue:DU(l,t.format)[Number(n.sectionValue)-1]})}return{saveQuery:!1}},t=>$U(t,e))})(f({},o,{keyPressed:NU(o.keyPressed,e)})):(e=>{const t=(e,t,n)=>{const r=t.filter(e=>e.toLowerCase().startsWith(n));return 0===r.length?{saveQuery:!1}:{sectionValue:r[0],shouldGoToNextSection:1===r.length}},n=(e,n,o,i)=>{const a=e=>FU(l,r,n.type,e);if("letter"===n.contentType)return t(n.format,a(n.format),e);if(o&&null!=i&&"letter"===OU(l,o).contentType){const n=a(o),r=t(0,n,e);return PK(r)?{saveQuery:!1}:f({},r,{sectionValue:i(r.sectionValue,n)})}return{saveQuery:!1}};return s(e,(e,t)=>{switch(t.type){case"month":{const r=e=>_U(l,e,l.formats.month,t.format);return n(e,t,l.formats.month,r)}case"weekDay":{const r=(e,t)=>t.indexOf(e).toString();return n(e,t,l.formats.weekday,r)}case"meridiem":return n(e,t);default:return{saveQuery:!1}}})})(o);null!=u?a({section:c,newSectionValue:u.sectionValue,shouldGoToNextSection:u.shouldGoToNextSection}):i(null)})},TK=e=>{const t=gG(),n=vG(),r=um(),{manager:{validator:o,valueType:i,internal_valueManager:a,internal_fieldValueManager:l},internalPropsWithDefaults:c,internalPropsWithDefaults:{value:u,defaultValue:d,referenceDate:p,onChange:h,format:m,formatDensity:g="dense",selectedSections:v,onSelectedSectionsChange:b,shouldRespectLeadingZeros:y=!1,timezone:w,enableAccessibleFieldDOMStructure:x=!0},forwardedProps:{error:S}}=e,{value:C,handleValueChange:k,timezone:E}=iK({name:"a field component",timezone:w,value:u,defaultValue:d,referenceDate:p,onChange:h,valueManager:a}),R=s.useRef(C);s.useEffect(()=>{R.current=C},[C]);const{hasValidationError:P}=AG({props:c,validator:o,timezone:E,value:C,onError:c.onError}),M=s.useMemo(()=>(e=>{const t=e.date(void 0);return"0"===e.formatByString(e.setSeconds(t,0),"s")?LU:Array.from({length:10}).map((n,r)=>e.formatByString(e.setSeconds(t,r),"s"))})(t),[t]),T=s.useMemo(()=>((e,t,n)=>{const r=e.date(void 0,n),o=e.endOfYear(r),i=e.endOfDay(r),{maxDaysInMonth:a,longestMonth:l}=wU(e,r).reduce((t,n)=>{const r=e.getDaysInMonth(n);return r>t.maxDaysInMonth?{maxDaysInMonth:r,longestMonth:n}:t},{maxDaysInMonth:0,longestMonth:null});return{year:({format:t})=>({minimum:0,maximum:HU(e,t)?9999:99}),month:()=>({minimum:1,maximum:e.getMonth(o)+1}),day:({currentDate:t})=>({minimum:1,maximum:e.isValid(t)?e.getDaysInMonth(t):a,longestMonth:l}),weekDay:({format:t,contentType:n})=>{if("digit"===n){const n=DU(e,t).map(Number);return{minimum:Math.min(...n),maximum:Math.max(...n)}}return{minimum:1,maximum:7}},hours:({format:n})=>{const o=e.getHours(i);return AU(e.formatByString(e.endOfDay(r),n),t)!==o.toString()?{minimum:1,maximum:Number(AU(e.formatByString(e.startOfDay(r),n),t))}:{minimum:0,maximum:o}},minutes:()=>({minimum:0,maximum:e.getMinutes(i)}),seconds:()=>({minimum:0,maximum:e.getSeconds(i)}),meridiem:()=>({minimum:0,maximum:1}),empty:()=>({minimum:0,maximum:0})}})(t,M,E),[t,M,E]),I=s.useCallback(e=>l.getSectionsFromValue(e,e=>PG({adapter:t,localeText:n,localizedDigits:M,format:m,date:e,formatDensity:g,shouldRespectLeadingZeros:y,enableAccessibleFieldDOMStructure:x,isRtl:r})),[l,m,n,M,r,y,t,g,x]),[O,D]=s.useState(()=>{const e=I(C),n={sections:e,lastExternalValue:C,lastSectionsDependencies:{format:m,isRtl:r,locale:t.locale},tempValueStrAndroid:null,characterQuery:null},o=(e=>Math.max(...e.map(e=>MU[e.type]??1)))(e);return f({},n,{referenceValue:a.getInitialReferenceValue({referenceDate:p,value:C,adapter:t,props:c,granularity:o,timezone:E})})}),[F,L]=Pg({controlled:v,default:null,name:"useField",state:"selectedSections"}),A=e=>{L(e),b?.(e)},N=s.useMemo(()=>GU(F,O.sections),[F,O.sections]),$="all"===N?0:N,z=s.useMemo(()=>((e,t)=>{const n={};if(!t)return e.forEach((t,r)=>{const o=0===r?null:r-1,i=r===e.length-1?null:r+1;n[r]={leftIndex:o,rightIndex:i}}),{neighbors:n,startIndex:0,endIndex:e.length-1};const r={},o={};let i=0,a=0,l=e.length-1;for(;l>=0;){a=e.findIndex((e,t)=>t>=i&&e.endSeparator?.includes(" ")&&" / "!==e.endSeparator),-1===a&&(a=e.length-1);for(let e=a;e>=i;e-=1)o[e]=l,r[l]=e,l-=1;i=a+1}return e.forEach((t,i)=>{const a=o[i],l=0===a?null:r[a-1],s=a===e.length-1?null:r[a+1];n[i]={leftIndex:l,rightIndex:s}}),{neighbors:n,startIndex:r[0],endIndex:r[e.length-1]}})(O.sections,r&&!x),[O.sections,r,x]),j=s.useMemo(()=>O.sections.every(e=>""===e.value),[O.sections]),B=s.useMemo(()=>{if(null!=$)return!1;const e=O.sections.filter(e=>""!==e.value);return e.length>0&&O.sections.length-e.length>0},[O.sections,$]),_=s.useMemo(()=>void 0!==S?S:P||B,[P,B,S]),H=e=>{const n={validationError:o({adapter:t,value:e,timezone:E,props:c})};k(e,n)},V=(e,t)=>{const n=[...O.sections];return n[e]=f({},n[e],{value:t,modified:!0}),n},W=s.useRef(null),U=Ng(),G=e=>{null!=$&&(W.current={sectionIndex:$,value:e},U.start(0,()=>{W.current=null}))},K=()=>{if(null==$)return;const e=O.sections[$];""!==e.value&&(G(""),null===l.getDateFromSection(C,e)?D(e=>f({},e,{sections:V($,""),tempValueStrAndroid:null,characterQuery:null})):(D(e=>f({},e,{characterQuery:null})),H(l.updateDateInValue(C,e,null))))},q=Ng(),Y=Mg(e=>{D(t=>f({},t,{characterQuery:e}))});if(C!==O.lastExternalValue){const e=null!=W.current&&!t.isValid(l.getDateFromSection(C,O.sections[W.current.sectionIndex]));let n;n=e?V(W.current.sectionIndex,W.current.value):I(C),D(o=>f({},o,{lastExternalValue:C,sections:n,sectionsDependencies:{format:m,isRtl:r,locale:t.locale},referenceValue:e?o.referenceValue:l.updateReferenceValue(t,C,o.referenceValue),tempValueStrAndroid:null}))}if(r!==O.lastSectionsDependencies.isRtl||m!==O.lastSectionsDependencies.format||t.locale!==O.lastSectionsDependencies.locale){const e=I(C);D(n=>f({},n,{lastSectionsDependencies:{format:m,isRtl:r,locale:t.locale},sections:e,tempValueStrAndroid:null,characterQuery:null}))}null==O.characterQuery||_||null!=$||Y(null),null!=O.characterQuery&&O.sections[O.characterQuery.sectionIndex]?.type!==O.characterQuery.sectionType&&Y(null),s.useEffect(()=>{null!=W.current&&(W.current=null)});const X=Ng();return s.useEffect(()=>(null!=O.characterQuery&&X.start(5e3,()=>Y(null)),()=>{}),[O.characterQuery,Y,X]),s.useEffect(()=>{null!=O.tempValueStrAndroid&&null!=$&&K()},[O.sections]),{activeSectionIndex:$,areAllSectionsEmpty:j,error:_,localizedDigits:M,parsedSelectedSections:N,sectionOrder:z,sectionsValueBoundaries:T,state:O,timezone:E,value:C,clearValue:()=>{a.areValuesEqual(t,C,a.emptyValue)?D(e=>f({},e,{sections:e.sections.map(e=>f({},e,{value:""})),tempValueStrAndroid:null,characterQuery:null})):(D(e=>f({},e,{characterQuery:null})),H(a.emptyValue))},clearActiveSection:K,setCharacterQuery:Y,setSelectedSections:A,setTempAndroidValueStr:e=>D(t=>f({},t,{tempValueStrAndroid:e})),updateSectionValue:({section:e,newSectionValue:n,shouldGoToNextSection:r})=>{U.clear(),q.clear();const o=l.getDateFromSection(C,e);r&&$<O.sections.length-1&&A($+1);const i=V($,n),a=l.getDateSectionsFromValue(i,e),s=((e,t,n)=>{const r=t.some(e=>"day"===e.type),o=[],i=[];for(let e=0;e<t.length;e+=1){const a=t[e];r&&"weekDay"===a.type||(o.push(a.format),i.push(BU(a,"non-input",n)))}const a=o.join(" "),l=i.join(" ");return e.parse(l,a)})(t,a,M);if(t.isValid(s)){const n=UU(t,s,a,l.getDateFromSection(O.referenceValue,e),!0);return null==o&&q.start(0,()=>{R.current===C&&D(t=>f({},t,{sections:l.clearDateSections(O.sections,e),tempValueStrAndroid:null}))}),H(l.updateDateInValue(C,e,n))}return a.every(e=>""!==e.value)&&(null==o||t.isValid(o))?(G(n),H(l.updateDateInValue(C,e,s))):(null!=o&&(G(n),H(l.updateDateInValue(C,e,s))),D(e=>f({},e,{sections:i,tempValueStrAndroid:null})))},updateValueFromValueStr:e=>{const o=l.parseValueStr(e,O.referenceValue,(e,o)=>{const i=t.parse(e,m);if(!t.isValid(i))return null;const a=PG({adapter:t,localeText:n,localizedDigits:M,format:m,date:i,formatDensity:g,shouldRespectLeadingZeros:y,enableAccessibleFieldDOMStructure:x,isRtl:r});return UU(t,i,a,o,!1)});H(o)},getSectionsFromValue:I}};function IK(e){const{manager:{internal_useApplyDefaultValuesToFieldInternalProps:t},internalProps:n,skipContextFieldRefAssignment:r}=e,o=MG(),i=tG(),a=Tg(n.unstableFieldRef,r?null:i?.fieldRef),l=o?.setValue,c=s.useCallback((e,t)=>l?.(e,{validationError:t.validationError,shouldClose:!1}),[l]);return t(s.useMemo(()=>null!=i&&null!=o?f({value:o.value,onChange:c,timezone:o.timezone,disabled:o.disabled,readOnly:o.readOnly,autoFocus:o.autoFocus&&!o.open,focused:!!o.open||void 0,format:o.fieldFormat,formatDensity:i.formatDensity,enableAccessibleFieldDOMStructure:i.enableAccessibleFieldDOMStructure,selectedSections:i.selectedSections,onSelectedSectionsChange:i.onSelectedSectionsChange,unstableFieldRef:a},n):n,[o,i,n,c,a]))}function OK(e){const{focused:t,domGetters:n,stateResponse:{parsedSelectedSections:r,state:o}}=e;if(!n.isReady())return;const i=kg(n.getRoot()).getSelection();if(!i)return;if(null==r)return i.rangeCount>0&&i.getRangeAt(0).startContainer instanceof Node&&n.getRoot().contains(i.getRangeAt(0).startContainer)&&i.removeAllRanges(),void(t&&n.getRoot().blur());if(!n.getRoot().contains(VG(n.getRoot())))return;const a=new window.Range;let l;if("all"===r)l=n.getRoot();else{l="empty"===o.sections[r].type?n.getSectionContainer(r):n.getSectionContent(r)}a.selectNodeContents(l),l.focus(),i.removeAllRanges(),i.addRange(a)}function DK(e){const t=gG(),{manager:{internal_fieldValueManager:n},internalPropsWithDefaults:{minutesStep:r,disabled:o,readOnly:i},stateResponse:{state:a,value:l,activeSectionIndex:s,parsedSelectedSections:c,sectionsValueBoundaries:u,localizedDigits:d,timezone:p,sectionOrder:f,clearValue:h,clearActiveSection:m,setSelectedSections:g,updateSectionValue:v}}=e;return Mg(e=>{if(!o)switch(!0){case(e.ctrlKey||e.metaKey)&&"A"===String.fromCharCode(e.keyCode)&&!e.shiftKey&&!e.altKey:e.preventDefault(),g("all");break;case"ArrowRight"===e.key:if(e.preventDefault(),null==c)g(f.startIndex);else if("all"===c)g(f.endIndex);else{const e=f.neighbors[c].rightIndex;null!==e&&g(e)}break;case"ArrowLeft"===e.key:if(e.preventDefault(),null==c)g(f.endIndex);else if("all"===c)g(f.startIndex);else{const e=f.neighbors[c].leftIndex;null!==e&&g(e)}break;case"Delete"===e.key:if(e.preventDefault(),i)break;null==c||"all"===c?h():m();break;case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key):{if(e.preventDefault(),i||null==s)break;"all"===c&&g(s);const o=a.sections[s],f=function(e,t,n,r,o,i,a,l){const s=function(e){switch(e){case"ArrowUp":return 1;case"ArrowDown":return-1;case"PageUp":return 5;case"PageDown":return-5;default:return 0}}(r),c="Home"===r,u="End"===r,d=""===n.value||c||u,p=()=>{const r=o[n.type]({currentDate:a,format:n.format,contentType:n.contentType}),p=t=>jU(e,t,r,i,n),f="minutes"===n.type&&l?.minutesStep?l.minutesStep:1;let h;if(d){if("year"===n.type&&!u&&!c)return e.formatByString(e.date(void 0,t),n.format);h=s>0||c?r.minimum:r.maximum}else{h=parseInt(AU(n.value,i),10)+s*f}return h%f!==0&&((s<0||c)&&(h+=f-(f+h)%f),(s>0||u)&&(h-=h%f)),h>r.maximum?p(r.minimum+(h-r.maximum-1)%(r.maximum-r.minimum+1)):h<r.minimum?p(r.maximum-(r.minimum-h-1)%(r.maximum-r.minimum+1)):p(h)},f=()=>{const r=FU(e,t,n.type,n.format);if(0===r.length)return n.value;if(d)return s>0||c?r[0]:r[r.length-1];const o=r.indexOf(n.value);return r[((o+s)%r.length+r.length)%r.length]};if("digit"===n.contentType||"digit-with-letter"===n.contentType)return p();return f()}(t,p,o,e.key,u,d,n.getDateFromSection(l,o),{minutesStep:r});v({section:o,newSectionValue:f,shouldGoToNextSection:!1});break}}})}function FK(e,t){if(e.value)switch(e.type){case"month":{if("digit"===e.contentType){const n=t.setMonth(t.date(),Number(e.value)-1);return t.isValid(n)?t.format(n,"month"):""}const n=t.parse(e.value,e.format);return n&&t.isValid(n)?t.format(n,"month"):void 0}case"day":if("digit"===e.contentType){const n=t.setDate(t.startOfYear(t.date()),Number(e.value));return t.isValid(n)?t.format(n,"dayOfMonthFull"):""}return e.value;default:return}}function LK(e,t){if(e.value)switch(e.type){case"weekDay":if("letter"===e.contentType)return;return Number(e.value);case"meridiem":{const n=t.parse(`01:00 ${e.value}`,`${t.formats.hours12h}:${t.formats.minutes} ${e.format}`);return n?t.getHours(n)>=12?1:0:void 0}case"day":return"digit-with-letter"===e.contentType?parseInt(e.value,10):Number(e.value);case"month":{if("digit"===e.contentType)return Number(e.value);const n=t.parse(e.value,e.format);return n?t.getMonth(n)+1:void 0}default:return"letter"!==e.contentType?Number(e.value):void 0}}const AK=e=>{const{props:t,manager:n,skipContextFieldRefAssignment:r,manager:{valueType:o,internal_useOpenPickerButtonAriaLabel:i}}=e,{internalProps:a,forwardedProps:l}=kG(t,o),c=IK({manager:n,internalProps:a,skipContextFieldRefAssignment:r}),{sectionListRef:u,onBlur:d,onClick:p,onFocus:h,onInput:m,onPaste:g,onKeyDown:v,onClear:b,clearable:y}=l,{disabled:w=!1,readOnly:x=!1,autoFocus:S=!1,focused:C,unstableFieldRef:k}=c,E=s.useRef(null),R=Tg(u,E),P=s.useMemo(()=>({isReady:()=>null!=E.current,getRoot:()=>E.current.getRoot(),getSectionContainer:e=>E.current.getSectionContainer(e),getSectionContent:e=>E.current.getSectionContent(e),getSectionIndexFromDOMElement:e=>E.current.getSectionIndexFromDOMElement(e)}),[E]),M=TK({manager:n,internalPropsWithDefaults:c,forwardedProps:l}),{areAllSectionsEmpty:T,error:I,parsedSelectedSections:O,sectionOrder:D,state:F,value:L,clearValue:A,setSelectedSections:N}=M,$=MK({stateResponse:M}),z=i(L),[j,B]=s.useState(!1);function _(e=0){if(w||!E.current||null!=NK(E))return;const t=GU(e,F.sections);B(!0),E.current.getSectionContent(t).focus()}const H=function(e){const{manager:t,focused:n,setFocused:r,domGetters:o,stateResponse:i,applyCharacterEditing:a,internalPropsWithDefaults:l,stateResponse:{parsedSelectedSections:s,sectionOrder:c,state:u,clearValue:d,setCharacterQuery:p,setSelectedSections:f,updateValueFromValueStr:h},internalPropsWithDefaults:{disabled:m=!1,readOnly:g=!1}}=e,v=DK({manager:t,internalPropsWithDefaults:l,stateResponse:i}),b=Ng(),y=Mg(e=>{!m&&o.isReady()&&(r(!0),"all"===s?b.start(0,()=>{const e=document.getSelection().getRangeAt(0).startOffset;if(0===e)return void f(c.startIndex);let t=0,n=0;for(;n<e&&t<u.sections.length;){const e=u.sections[t];t+=1,n+=`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`.length}f(t-1)}):n?o.getRoot().contains(e.target)||f(c.startIndex):(r(!0),f(c.startIndex)))}),w=Mg(e=>{if(!o.isReady()||"all"!==s)return;const t=e.target.textContent??"";o.getRoot().innerHTML=u.sections.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),OK({focused:n,domGetters:o,stateResponse:i}),0===t.length||10===t.charCodeAt(0)?(d(),f("all")):t.length>1?h(t):("all"===s&&f(0),a({keyPressed:t,sectionIndex:0}))}),x=Mg(e=>{if(g||"all"!==s)return void e.preventDefault();const t=e.clipboardData.getData("text");e.preventDefault(),p(null),h(t)}),S=Mg(()=>{if(n||m||!o.isReady())return;const e=VG(o.getRoot());r(!0),null!=o.getSectionIndexFromDOMElement(e)||f(c.startIndex)}),C=Mg(()=>{setTimeout(()=>{if(!o.isReady())return;const e=VG(o.getRoot());!o.getRoot().contains(e)&&(r(!1),f(null))})});return{onKeyDown:v,onBlur:C,onFocus:S,onClick:y,onPaste:x,onInput:w,contentEditable:"all"===s,tabIndex:l.disabled||0===s?-1:0}}({manager:n,internalPropsWithDefaults:c,stateResponse:M,applyCharacterEditing:$,focused:j,setFocused:B,domGetters:P}),V=function(e){const{manager:{internal_fieldValueManager:t},stateResponse:{areAllSectionsEmpty:n,state:r,updateValueFromValueStr:o}}=e,i=Mg(e=>{o(e.target.value)});return{value:s.useMemo(()=>n?"":t.getV7HiddenInputValueFromSections(r.sections),[n,r.sections,t]),onChange:i}}({manager:n,stateResponse:M}),W=function(e){const{stateResponse:{setSelectedSections:t},internalPropsWithDefaults:{disabled:n=!1}}=e,r=s.useCallback(e=>r=>{n||r.isDefaultPrevented()||t(e)},[n,t]);return s.useCallback(e=>({"data-sectionindex":e,onClick:r(e)}),[r])}({stateResponse:M,internalPropsWithDefaults:c}),U=function(e){const t=gG(),n=vG(),{focused:r,domGetters:o,stateResponse:i,applyCharacterEditing:a,manager:{internal_fieldValueManager:l},stateResponse:{parsedSelectedSections:c,sectionsValueBoundaries:u,state:d,value:p,clearActiveSection:f,setCharacterQuery:h,setSelectedSections:m,updateSectionValue:g,updateValueFromValueStr:v},internalPropsWithDefaults:{disabled:b=!1,readOnly:y=!1}}=e,w="all"===c,x=!w&&!b&&!y,S=Mg(e=>{if(!o.isReady())return;const t=d.sections[e];o.getSectionContent(e).innerHTML=t.value||t.placeholder,OK({focused:r,domGetters:o,stateResponse:i})}),C=Mg(e=>{if(!o.isReady())return;const t=e.target,n=t.textContent??"",r=o.getSectionIndexFromDOMElement(t),i=d.sections[r];if(y)S(r);else{if(0===n.length){if(""===i.value)return void S(r);const t=e.nativeEvent.inputType;return"insertParagraph"===t||"insertLineBreak"===t?void S(r):(S(r),void f())}a({keyPressed:n,sectionIndex:r}),S(r)}}),k=Mg(e=>{e.preventDefault()}),E=Mg(e=>{if(e.preventDefault(),y||b||"number"!=typeof c)return;const t=d.sections[c],n=e.clipboardData.getData("text"),r=/^[a-zA-Z]+$/.test(n),o=/^[0-9]+$/.test(n),i=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(n);"letter"===t.contentType&&r||"digit"===t.contentType&&o||"digit-with-letter"===t.contentType&&i?(h(null),g({section:t,newSectionValue:n,shouldGoToNextSection:!0})):r||o||(h(null),v(n))}),R=Mg(e=>{e.preventDefault(),e.dataTransfer.dropEffect="none"}),P=s.useCallback(e=>()=>{b||m(e)},[b,m]);return s.useCallback((e,r)=>{const o=u[e.type]({currentDate:l.getDateFromSection(p,e),contentType:e.contentType,format:e.format});return{onInput:C,onPaste:E,onMouseUp:k,onDragOver:R,onFocus:P(r),"aria-readonly":y,"aria-valuenow":LK(e,t),"aria-valuemin":o.minimum,"aria-valuemax":o.maximum,"aria-valuetext":e.value?FK(e,t):n.empty,"aria-label":n[e.type],"aria-disabled":b,tabIndex:!x||w||r>0?-1:0,contentEditable:!w&&!b&&!y,role:"spinbutton","data-range-position":e.dateName||void 0,spellCheck:!x&&void 0,autoCapitalize:x?"none":void 0,autoCorrect:x?"off":void 0,children:e.value||e.placeholder,inputMode:"letter"===e.contentType?"text":"numeric"}},[u,w,b,y,x,n,t,C,E,k,R,P,l,p])}({manager:n,stateResponse:M,applyCharacterEditing:$,internalPropsWithDefaults:c,domGetters:P,focused:j}),G=Mg(e=>{v?.(e),H.onKeyDown(e)}),K=Mg(e=>{d?.(e),H.onBlur(e)}),q=Mg(e=>{h?.(e),H.onFocus(e)}),Y=Mg(e=>{e.isDefaultPrevented()||(p?.(e),H.onClick(e))}),X=Mg(e=>{g?.(e),H.onPaste(e)}),Q=Mg(e=>{m?.(e),H.onInput(e)}),Z=Mg((e,...t)=>{e.preventDefault(),b?.(e,...t),A(),$K(E)?N(D.startIndex):_(0)}),J=s.useMemo(()=>F.sections.map((e,t)=>{const n=U(e,t);return{container:W(t),content:U(e,t),before:{children:e.startSeparator},after:{children:e.endSeparator,"data-range-position":e.isEndFormatSeparator?n["data-range-position"]:void 0}}}),[F.sections,W,U]);return s.useEffect(()=>{if(null==E.current)throw new Error(["MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`","You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.","","If you want to keep using an `<input />` HTML element for the editing, please add the `enableAccessibleFieldDOMStructure={false}` prop to your Picker or Field component:","","<DatePicker enableAccessibleFieldDOMStructure={false} slots={{ textField: MyCustomTextField }} />","","Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element"].join("\n"));S&&!w&&E.current&&E.current.getSectionContent(D.startIndex).focus()},[]),Wh(()=>{if(j&&E.current)if("all"===O)E.current.getRoot().focus();else if("number"==typeof O){const e=E.current.getSectionContent(O);e&&e.focus()}},[O,j]),Wh(()=>{OK({focused:j,domGetters:P,stateResponse:M})}),s.useImperativeHandle(k,()=>({getSections:()=>F.sections,getActiveSectionIndex:()=>NK(E),setSelectedSections:e=>{if(w||!E.current)return;const t=GU(e,F.sections);B(null!==("all"===t?0:t)),N(e)},focusField:_,isFieldFocused:()=>$K(E)})),f({},l,H,{onBlur:K,onClick:Y,onFocus:q,onInput:Q,onPaste:X,onKeyDown:G,onClear:Z},V,{error:I,clearable:Boolean(y&&!T&&!x&&!w),focused:C??j,sectionListRef:R,enableAccessibleFieldDOMStructure:!0,elements:J,areAllSectionsEmpty:T,disabled:w,readOnly:x,autoFocus:S,openPickerAriaLabel:z})};function NK(e){const t=VG(e.current?.getRoot());return t&&e.current&&e.current.getRoot().contains(t)?e.current.getSectionIndexFromDOMElement(t):null}function $K(e){const t=VG(e.current?.getRoot());return!!e.current&&e.current.getRoot().contains(t)}const zK=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),jK=e=>{const t=um(),n=Ng(),r=Ng(),{props:o,manager:i,skipContextFieldRefAssignment:a,manager:{valueType:l,internal_valueManager:c,internal_fieldValueManager:u,internal_useOpenPickerButtonAriaLabel:d}}=e,{internalProps:p,forwardedProps:h}=kG(o,l),m=IK({manager:i,internalProps:p,skipContextFieldRefAssignment:a}),{onFocus:g,onClick:v,onPaste:b,onBlur:y,onKeyDown:w,onClear:x,clearable:S,inputRef:C,placeholder:k}=h,{readOnly:E=!1,disabled:R=!1,autoFocus:P=!1,focused:M,unstableFieldRef:T}=m,I=s.useRef(null),O=Tg(C,I),D=TK({manager:i,internalPropsWithDefaults:m,forwardedProps:h}),{activeSectionIndex:F,areAllSectionsEmpty:L,error:A,localizedDigits:N,parsedSelectedSections:$,sectionOrder:z,state:j,value:B,clearValue:_,clearActiveSection:H,setCharacterQuery:V,setSelectedSections:W,setTempAndroidValueStr:U,updateSectionValue:G,updateValueFromValueStr:K,getSectionsFromValue:q}=D,Y=MK({stateResponse:D}),X=d(B),Q=s.useMemo(()=>((e,t,n)=>{let r=0,o=n?1:0;const i=[];for(let a=0;a<e.length;a+=1){const l=e[a],s=BU(l,n?"input-rtl":"input-ltr",t),c=`${l.startSeparator}${s}${l.endSeparator}`,u=zK(c).length,d=c.length,p=zK(s),h=o+(""===p?0:s.indexOf(p[0]))+l.startSeparator.length,m=h+p.length;i.push(f({},l,{start:r,end:r+u,startInInput:h,endInInput:m})),r+=u,o+=d}return i})(j.sections,N,t),[j.sections,N,t]);function Z(){const e=I.current.selectionStart??0;let t;t=e<=Q[0].startInInput||e>=Q[Q.length-1].endInInput?1:Q.findIndex(t=>t.startInInput-t.startSeparator.length>e);const n=-1===t?Q.length-1:t-1;W(n)}function J(e=0){VG(I.current)!==I.current&&(I.current?.focus(),W(e))}const ee=Mg(e=>{g?.(e);const t=I.current;n.start(0,()=>{t&&t===I.current&&null==F&&(t.value.length&&Number(t.selectionEnd)-Number(t.selectionStart)===t.value.length?W("all"):Z())})}),te=Mg((e,...t)=>{e.isDefaultPrevented()||(v?.(e,...t),Z())}),ne=Mg(e=>{if(b?.(e),e.preventDefault(),E||R)return;const t=e.clipboardData.getData("text");if("number"==typeof $){const e=j.sections[$],n=/^[a-zA-Z]+$/.test(t),r=/^[0-9]+$/.test(t),o=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(t);if("letter"===e.contentType&&n||"digit"===e.contentType&&r||"digit-with-letter"===e.contentType&&o)return V(null),void G({section:e,newSectionValue:t,shouldGoToNextSection:!0});if(n||r)return}V(null),K(t)}),re=Mg(e=>{y?.(e),W(null)}),oe=Mg(e=>{if(E)return;const n=e.target.value;if(""===n)return void _();const r=e.nativeEvent.data,o=r&&r.length>1,i=o?r:n,a=zK(i);if("all"===$&&W(F),null==F||o)return void K(o?r:a);let l;if("all"===$&&1===a.length)l=a;else{const e=zK(u.getV6InputValueFromSections(Q,N,t));let n=-1,r=-1;for(let t=0;t<e.length;t+=1)-1===n&&e[t]!==a[t]&&(n=t),-1===r&&e[e.length-t-1]!==a[a.length-t-1]&&(r=t);const o=Q[F];if(n<o.start||e.length-r-1>o.end)return;const i=a.length-e.length+o.end-zK(o.endSeparator||"").length;l=a.slice(o.start+zK(o.startSeparator||"").length,i)}if(0===l.length)return navigator.userAgent.toLowerCase().includes("android")&&U(i),void H();Y({keyPressed:l,sectionIndex:F})}),ie=Mg((e,...t)=>{e.preventDefault(),x?.(e,...t),_(),BK(I)?W(z.startIndex):J(0)}),ae=DK({manager:i,internalPropsWithDefaults:m,stateResponse:D}),le=Mg(e=>{w?.(e),ae(e)}),se=s.useMemo(()=>void 0!==k?k:u.getV6InputValueFromSections(q(c.emptyValue),N,t),[k,u,q,c.emptyValue,N,t]),ce=s.useMemo(()=>j.tempValueStrAndroid??u.getV6InputValueFromSections(j.sections,N,t),[j.sections,u,j.tempValueStrAndroid,N,t]);s.useEffect(()=>{I.current&&I.current===VG(I.current)&&W("all")},[]),Wh(()=>{!function e(){if(!I.current)return;if(null==$)return void(I.current.scrollLeft&&(I.current.scrollLeft=0));if(I.current!==VG(I.current))return;const t=I.current.scrollTop;if("all"===$)I.current.select();else{const t=Q[$],n="empty"===t.type?t.startInInput-t.startSeparator.length:t.startInInput,o="empty"===t.type?t.endInInput+t.endSeparator.length:t.endInInput;n===I.current.selectionStart&&o===I.current.selectionEnd||I.current===VG(I.current)&&I.current.setSelectionRange(n,o),r.start(0,()=>{!I.current||I.current!==VG(I.current)||I.current.selectionStart!==I.current.selectionEnd||I.current.selectionStart===n&&I.current.selectionEnd===o||e()})}I.current.scrollTop=t}()});const ue=s.useMemo(()=>null==F||"letter"===j.sections[F].contentType?"text":"numeric",[F,j.sections]),de=!(I.current&&I.current===VG(I.current))&&L;return s.useImperativeHandle(T,()=>({getSections:()=>j.sections,getActiveSectionIndex:()=>{const e=I.current.selectionStart??0,t=I.current.selectionEnd??0;if(0===e&&0===t)return null;const n=e<=Q[0].startInInput?1:Q.findIndex(t=>t.startInInput-t.startSeparator.length>e);return-1===n?Q.length-1:n-1},setSelectedSections:e=>W(e),focusField:J,isFieldFocused:()=>BK(I)})),f({},h,{error:A,"aria-invalid":A,clearable:Boolean(S&&!L&&!E&&!R),onBlur:re,onClick:te,onFocus:ee,onPaste:ne,onKeyDown:le,onClear:ie,inputRef:O,enableAccessibleFieldDOMStructure:!1,placeholder:se,inputMode:ue,autoComplete:"off",value:de?"":ce,onChange:oe,focused:M,disabled:R,readOnly:E,autoFocus:P,openPickerAriaLabel:X})};function BK(e){return e.current===VG(e.current)}const _K=e=>(e=>{const t=tG();return(e.props.enableAccessibleFieldDOMStructure??t?.enableAccessibleFieldDOMStructure??1?AK:jK)(e)})({manager:function(e={}){const{enableAccessibleFieldDOMStructure:t=!0}=e;return s.useMemo(()=>({valueType:"date",validator:LG,internal_valueManager:qU,internal_fieldValueManager:YU,internal_enableAccessibleFieldDOMStructure:t,internal_useApplyDefaultValuesToFieldInternalProps:zG,internal_useOpenPickerButtonAriaLabel:$G}),[t])}(e),props:e});function HK(e){const{ownerState:t}=lG(),n=um();return s.useMemo(()=>f({},t,{isFieldDisabled:e.disabled??!1,isFieldReadOnly:e.readOnly??!1,isFieldRequired:e.required??!1,fieldDirection:n?"rtl":"ltr"}),[t,e.disabled,e.readOnly,e.required,n])}const VK=Sg(Xp.jsx("path",{d:"M7 10l5 5 5-5z"})),WK=Sg(Xp.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"})),UK=Sg(Xp.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"})),GK=Sg(Xp.jsx("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}));Sg(Xp.jsxs(s.Fragment,{children:[Xp.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),Xp.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]})),Sg(Xp.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"})),Sg(Xp.jsxs(s.Fragment,{children:[Xp.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),Xp.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}));const KK=Sg(Xp.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function qK(e){return Ph("MuiPickersTextField",e)}function YK(e){return Ph("MuiPickersInputBase",e)}Mh("MuiPickersTextField",["root","focused","disabled","error","required"]);const XK=Mh("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input","inputSizeSmall","activeBar"]);function QK(e){return Ph("MuiPickersSectionList",e)}const ZK=Mh("MuiPickersSectionList",["root","section","sectionContent"]),JK=["slots","slotProps","elements","sectionListRef","classes"],eq=pg("div",{name:"MuiPickersSectionList",slot:"Root"})({direction:"ltr /*! @noflip */",outline:"none"}),tq=pg("span",{name:"MuiPickersSectionList",slot:"Section"})({}),nq=pg("span",{name:"MuiPickersSectionList",slot:"SectionSeparator"})({whiteSpace:"pre"}),rq=pg("span",{name:"MuiPickersSectionList",slot:"SectionContent"})({outline:"none"});function oq(e){const{slots:t,slotProps:n,element:r,classes:o}=e,{ownerState:i}=lG(),a=t?.section??tq,l=yy({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:i}),c=t?.sectionContent??rq,u=yy({elementType:c,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:i}),d=t?.sectionSeparator??nq,p=yy({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:f({},i,{separatorPosition:"before"})}),h=yy({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:f({},i,{separatorPosition:"after"})}),m=s.useRef(null),g=Tg(u.ref,m);return Xp.jsxs(a,f({},l,{children:[Xp.jsx(d,f({},p)),Xp.jsx(c,f({},u,{ref:g,onBlur:e=>{const t=e.relatedTarget,n=e.currentTarget.closest(`.${ZK.root}`);n&&t instanceof Node&&n.contains(t)&&e.stopPropagation()}})),Xp.jsx(d,f({},h))]}))}const iq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:i,sectionListRef:a,classes:l}=n,c=d(n,JK),u=(e=>wm({root:["root"],section:["section"],sectionContent:["sectionContent"]},QK,e))(l),{ownerState:p}=lG(),h=s.useRef(null),m=Tg(t,h),g=e=>{if(!h.current)throw new Error(`MUI X: Cannot call sectionListRef.${e} before the mount of the component.`);return h.current};s.useImperativeHandle(a,()=>({getRoot:()=>g("getRoot"),getSectionContainer:e=>g("getSectionContainer").querySelector(`.${ZK.section}[data-sectionindex="${e}"]`),getSectionContent:e=>g("getSectionContent").querySelector(`.${ZK.section}[data-sectionindex="${e}"] .${ZK.sectionContent}`),getSectionIndexFromDOMElement(e){const t=g("getSectionIndexFromDOMElement");if(null==e||!t.contains(e))return null;let n=null;return e.classList.contains(ZK.section)?n=e:e.classList.contains(ZK.sectionContent)&&(n=e.parentElement),null==n?null:Number(n.dataset.sectionindex)}}));const v=r?.root??eq,b=yy({elementType:v,externalSlotProps:o?.root,externalForwardedProps:c,additionalProps:{ref:m,suppressContentEditableWarning:!0},className:u.root,ownerState:p});return Xp.jsx(v,f({},b,{children:b.contentEditable?i.map(({content:e,before:t,after:n})=>`${t.children}${e.children}${n.children}`).join(""):Xp.jsx(s.Fragment,{children:i.map((e,t)=>Xp.jsx(oq,{slots:r,slotProps:o,element:e,classes:u},t))})}))}),aq=s.createContext(null),lq=()=>{const e=s.useContext(aq);if(null==e)throw new Error(["MUI X: The `usePickerTextFieldOwnerState` can only be called in components that are used inside a PickerTextField component"].join("\n"));return e},sq=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef","onFocus","onBlur","classes","ownerState"],cq=pg("div",{name:"MuiPickersInputBase",slot:"Root"})(({theme:e})=>{return f({},e.typography.body1,{color:(e.vars||e).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:(t=.15/16,Math.round(1e5*t)/1e5)+"em",variants:[{props:{isInputInFullWidth:!0},style:{width:"100%"}}]});var t}),uq=pg(eq,{name:"MuiPickersInputBase",slot:"SectionsContainer"})(({theme:e})=>({padding:"4px 0 5px",fontFamily:e.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{fieldDirection:"rtl"},style:{justifyContent:"end"}},{props:{inputSize:"small"},style:{paddingTop:1}},{props:{hasStartAdornment:!1,isFieldFocused:!1,isFieldValueEmpty:!0},style:{color:"currentColor",opacity:0}},{props:{hasStartAdornment:!1,isFieldFocused:!1,isFieldValueEmpty:!0,inputHasLabel:!1},style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:"light"===e.palette.mode?.42:.5}},{props:{hasStartAdornment:!1,isFieldFocused:!1,isFieldValueEmpty:!0,inputHasLabel:!0,isLabelShrunk:!0},style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:"light"===e.palette.mode?.42:.5}}]})),dq=pg(tq,{name:"MuiPickersInputBase",slot:"Section"})(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),pq=pg(rq,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(e,t)=>t.content})(({theme:e})=>({fontFamily:e.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),fq=pg(nq,{name:"MuiPickersInputBase",slot:"Separator"})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),hq=pg("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(f({},{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"})),mq=pg("div",{name:"MuiPickersInputBase",slot:"ActiveBar"})(({theme:e,ownerState:t})=>({display:"none",position:"absolute",height:2,bottom:2,borderTopLeftRadius:2,borderTopRightRadius:2,transition:e.transitions.create(["width","left"],{duration:e.transitions.duration.shortest}),backgroundColor:(e.vars||e).palette.primary.main,'[data-active-range-position="start"] &, [data-active-range-position="end"] &':{display:"block"},'[data-active-range-position="start"] &':{left:t.sectionOffsets[0]},'[data-active-range-position="end"] &':{left:t.sectionOffsets[1]}}));function gq(e,t,n,r){if(e.content.id){const e=t.current?.querySelectorAll(`[data-sectionindex="${n}"] [data-range-position="${r}"]`);if(e)return Array.from(e).reduce((e,t)=>e+t.offsetWidth,0)}return 0}const vq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:i,onChange:a,id:l,endAdornment:c,startAdornment:u,renderSuffix:p,slots:h,slotProps:m,contentEditable:g,tabIndex:v,onInput:b,onPaste:y,onKeyDown:w,name:x,readOnly:S,inputProps:C,inputRef:k,sectionListRef:E,onFocus:R,onBlur:P,classes:M,ownerState:T}=n,I=d(n,sq),O=lq(),D=s.useRef(null),F=s.useRef(null),L=s.useRef([]),A=Tg(t,D),N=Tg(C?.ref,k),$=Uy();if(!$)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const z=T??O,j=e=>{$.onFocus?.(e),R?.(e)};s.useEffect(()=>{$&&$.setAdornedStart(Boolean(u))},[$,u]),s.useEffect(()=>{$&&(o?$.onEmpty():$.onFilled())},[$,o]);const B=((e,t)=>{const{isFieldFocused:n,isFieldDisabled:r,isFieldReadOnly:o,hasFieldError:i,inputSize:a,isInputInFullWidth:l,inputColor:s,hasStartAdornment:c,hasEndAdornment:u}=t;return wm({root:["root",n&&!r&&"focused",r&&"disabled",o&&"readOnly",i&&"error",l&&"fullWidth",`color${xf(s)}`,"small"===a&&"inputSizeSmall",c&&"adornedStart",u&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"],activeBar:["activeBar"]},YK,e)})(M,z),_=h?.root||cq,H=yy({elementType:_,externalSlotProps:m?.root,externalForwardedProps:I,additionalProps:{"aria-invalid":$.error,ref:A},className:B.root,ownerState:z}),V=h?.input||uq,W=r.some(e=>void 0!==e.content["data-range-position"]);return s.useEffect(()=>{if(!W||!z.isPickerOpen)return;const{activeBarWidth:e,sectionOffsets:t}=function(e,t){let n=0;const r=t.current?.getAttribute("data-active-range-position");if("end"===r)for(let r=e.length-1;r>=e.length/2;r-=1)n+=gq(e[r],t,r,"end");else for(let r=0;r<e.length/2;r+=1)n+=gq(e[r],t,r,"start");return{activeBarWidth:n,sectionOffsets:[t.current?.querySelector('[data-sectionindex="0"]')?.offsetLeft||0,t.current?.querySelector(`[data-sectionindex="${e.length/2}"]`)?.offsetLeft||0]}}(r,D);L.current=[t[0],t[1]],F.current&&(F.current.style.width=`${e}px`)},[r,W,z.isPickerOpen]),Xp.jsxs(_,f({},H,{children:[u,Xp.jsx(iq,{sectionListRef:E,elements:r,contentEditable:g,tabIndex:v,className:B.sectionsContainer,onFocus:j,onBlur:e=>{$.onBlur?.(e),P?.(e)},onInput:b,onPaste:y,onKeyDown:e=>{if(w?.(e),"Enter"===e.key&&!e.defaultMuiPrevented){if(D.current?.dataset.multiInput)return;const t=D.current?.closest("form"),n=t?.querySelector('[type="submit"]');if(!t||!n)return;e.preventDefault(),t.requestSubmit(n)}},slots:{root:V,section:dq,sectionContent:pq,sectionSeparator:fq},slotProps:{root:f({},m?.input,{ownerState:z}),sectionContent:{className:XK.sectionContent},sectionSeparator:({separatorPosition:e})=>({className:"before"===e?XK.sectionBefore:XK.sectionAfter})}}),c,p?p(f({},$)):null,Xp.jsx(hq,f({name:x,className:B.input,value:i,onChange:a,id:l,"aria-hidden":"true",tabIndex:-1,readOnly:S,required:$.required,disabled:$.disabled,onFocus:e=>{j(e)}},C,{ref:N})),W&&Xp.jsx(mq,{className:B.activeBar,ref:F,ownerState:{sectionOffsets:L.current}})]}))});function bq(e){return Ph("MuiPickersOutlinedInput",e)}const yq=f({},XK,Mh("MuiPickersOutlinedInput",["root","notchedOutline","input"])),wq=["children","className","label","notched","shrink"],xq=pg("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline"})(({theme:e})=>{const t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}}),Sq=pg("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),Cq=pg("legend",{shouldForwardProp:e=>Oh(e)&&"notched"!==e})(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{inputHasLabel:!1},style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:{inputHasLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{inputHasLabel:!0,notched:!0},style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]}));function kq(e){const{className:t,label:n,notched:r}=e,o=d(e,wq),i=lq();return Xp.jsx(xq,f({"aria-hidden":!0,className:t},o,{ownerState:i,children:Xp.jsx(Cq,{ownerState:i,notched:r,children:n?Xp.jsx(Sq,{children:n}):Xp.jsx(Sq,{className:"notranslate",children:""})})}))}const Eq=["label","autoFocus","ownerState","classes","notched"],Rq=pg(cq,{name:"MuiPickersOutlinedInput",slot:"Root"})(({theme:e})=>{const t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${yq.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${yq.focused} .${yq.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${yq.disabled}`]:{[`& .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${yq.error} .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},variants:Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t]?.main??!1).map(t=>({props:{inputColor:t},style:{[`&.${yq.focused}:not(.${yq.error}) .${yq.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}}))}}),Pq=pg(uq,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer"})({padding:"16.5px 0",variants:[{props:{inputSize:"small"},style:{padding:"8.5px 0"}}]}),Mq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersOutlinedInput"}),{label:r,classes:o,notched:i}=n,a=d(n,Eq),l=Uy(),c=(e=>f({},e,wm({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},bq,e)))(o);return Xp.jsx(vq,f({slots:{root:Rq,input:Pq},renderSuffix:e=>Xp.jsx(kq,{shrink:Boolean(i||e.adornedStart||e.focused||e.filled),notched:Boolean(i||e.adornedStart||e.focused||e.filled),className:c.notchedOutline,label:null!=r&&""!==r&&l?.required?Xp.jsxs(s.Fragment,{children:[r," ","*"]}):r})},a,{label:r,classes:c,ref:t}))});function Tq(e){return Ph("MuiPickersFilledInput",e)}Mq.muiName="Input";const Iq=f({},XK,Mh("MuiPickersFilledInput",["root","underline","input"])),Oq=["label","autoFocus","disableUnderline","hiddenLabel","classes"],Dq=pg(cq,{name:"MuiPickersFilledInput",slot:"Root",shouldForwardProp:e=>Oh(e)&&"disableUnderline"!==e})(({theme:e})=>{const t="light"===e.palette.mode,n=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",r=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",o=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",i=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:o,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${Iq.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${Iq.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:i},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{inputColor:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Iq.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Iq.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`:n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Iq.disabled}, .${Iq.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${Iq.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:{hasStartAdornment:!0},style:{paddingLeft:12}},{props:{hasEndAdornment:!0},style:{paddingRight:12}}]}}),Fq=pg(uq,{name:"MuiPickersFilledInput",slot:"sectionsContainer",shouldForwardProp:e=>Oh(e)&&"hiddenLabel"!==e})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{inputSize:"small"},style:{paddingTop:21,paddingBottom:4}},{props:{hasStartAdornment:!0},style:{paddingLeft:0}},{props:{hasEndAdornment:!0},style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,inputSize:"small"},style:{paddingTop:8,paddingBottom:9}}]}),Lq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,hiddenLabel:i=!1,classes:a}=n,l=d(n,Oq),s=f({},lq(),{inputHasUnderline:!o}),c=((e,t)=>{const{inputHasUnderline:n}=t;return f({},e,wm({root:["root",n&&"underline"],input:["input"]},Tq,e))})(a,s);return Xp.jsx(vq,f({slots:{root:Dq,input:Fq},slotProps:{root:{disableUnderline:o},input:{hiddenLabel:i}}},l,{label:r,classes:c,ref:t,ownerState:s}))});function Aq(e){return Ph("MuiPickersFilledInput",e)}Lq.muiName="Input";const Nq=f({},XK,Mh("MuiPickersInput",["root","underline","input"])),$q=["label","autoFocus","disableUnderline","ownerState","classes"],zq=pg(cq,{name:"MuiPickersInput",slot:"Root",shouldForwardProp:e=>Oh(e)&&"disableUnderline"!==e})(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(t=>(e.vars??e).palette[t].main).map(t=>({props:{inputColor:t,inputHasUnderline:!0},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}})),{props:{inputHasUnderline:!0},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Nq.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Nq.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Nq.disabled}, .${Nq.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${Nq.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),jq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,classes:i}=n,a=d(n,$q),l=f({},lq(),{inputHasUnderline:!o}),s=((e,t)=>{const{inputHasUnderline:n}=t;return f({},e,wm({root:["root",!n&&"underline"],input:["input"]},Aq,e))})(i,l);return Xp.jsx(vq,f({slots:{root:zq},slotProps:{root:{disableUnderline:o}}},a,{ownerState:l,label:r,classes:s,ref:t}))});jq.muiName="Input";const Bq=["onFocus","onBlur","className","classes","color","disabled","error","variant","required","hiddenLabel","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps","data-active-range-position"],_q={standard:jq,filled:Lq,outlined:Mq},Hq=pg(sS,{name:"MuiPickersTextField",slot:"Root"})({maxWidth:"100%"}),Vq=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:i,classes:a,color:l="primary",disabled:c=!1,error:u=!1,variant:p="outlined",required:h=!1,hiddenLabel:m=!1,InputProps:g,inputProps:v,inputRef:b,sectionListRef:y,elements:w,areAllSectionsEmpty:x,onClick:S,onKeyDown:C,onKeyUp:k,onPaste:E,onInput:R,endAdornment:P,startAdornment:M,tabIndex:T,contentEditable:I,focused:O,value:D,onChange:F,fullWidth:L,id:A,name:N,helperText:$,FormHelperTextProps:z,label:j,InputLabelProps:B,"data-active-range-position":_}=n,H=d(n,Bq),V=Tg(t,s.useRef(null)),W=mm(A),U=$&&W?`${W}-helper-text`:void 0,G=j&&W?`${W}-label`:void 0,K=HK({disabled:n.disabled,required:n.required,readOnly:g?.readOnly}),q=s.useMemo(()=>f({},K,{isFieldValueEmpty:x,isFieldFocused:O??!1,hasFieldError:u??!1,inputSize:n.size??"medium",inputColor:l??"primary",isInputInFullWidth:L??!1,hasStartAdornment:Boolean(M??g?.startAdornment),hasEndAdornment:Boolean(P??g?.endAdornment),inputHasLabel:!!j,isLabelShrunk:Boolean(B?.shrink)}),[K,x,O,u,n.size,l,L,M,P,g?.startAdornment,g?.endAdornment,j,B?.shrink]),Y=((e,t)=>{const{isFieldFocused:n,isFieldDisabled:r,isFieldRequired:o}=t;return wm({root:["root",n&&!r&&"focused",r&&"disabled",o&&"required"]},qK,e)})(a,q),X=_q[p],Q={};return"outlined"===p?(B&&void 0!==B.shrink&&(Q.notched=B.shrink),Q.label=j):"filled"===p&&(Q.hiddenLabel=m),Xp.jsx(aq.Provider,{value:q,children:Xp.jsxs(Hq,f({className:QU(Y.root,i),ref:V,focused:O,disabled:c,variant:p,error:u,color:l,fullWidth:L,required:h,ownerState:q},H,{children:[null!=j&&""!==j&&Xp.jsx(zS,f({htmlFor:W,id:G},B,{children:j})),Xp.jsx(X,f({elements:w,areAllSectionsEmpty:x,onClick:S,onKeyDown:C,onKeyUp:k,onInput:R,onPaste:E,onFocus:r,onBlur:o,endAdornment:P,startAdornment:M,tabIndex:T,contentEditable:I,value:D,onChange:F,id:W,fullWidth:L,inputProps:v,inputRef:b,sectionListRef:y,label:j,name:N,role:"group","aria-labelledby":G,"aria-describedby":U,"aria-live":U?"polite":void 0,"data-active-range-position":_},Q,g)),$&&Xp.jsx(bS,f({id:U},z,{children:$}))]}))})}),Wq=["enableAccessibleFieldDOMStructure"],Uq=["InputProps","readOnly","onClear","clearable","clearButtonPosition","openPickerButtonPosition","openPickerAriaLabel"],Gq=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef","onClear","clearable","clearButtonPosition","openPickerButtonPosition","openPickerAriaLabel"],Kq=["ownerState"],qq=["ownerState"],Yq=["ownerState"],Xq=["ownerState"],Qq=["InputProps","inputProps"],Zq=()=>{},Jq=s.createContext({slots:{},slotProps:{},inputRef:void 0});function eY(e){const{fieldResponse:t,defaultOpenPickerIcon:n}=e,r=vG(),o=MG(),i=s.useContext(Jq),{textFieldProps:a,onClear:l,clearable:c,openPickerAriaLabel:u,clearButtonPosition:p="end",openPickerButtonPosition:h="end"}=(e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=d(e,Wq);if(t){const{InputProps:e,readOnly:t,onClear:r,clearable:o,clearButtonPosition:i,openPickerButtonPosition:a,openPickerAriaLabel:l}=n,s=d(n,Uq),c=rR>=6&&s?.slotProps?.input?tY(s?.slotProps?.input,e):Zq;return{clearable:o,onClear:r,clearButtonPosition:i,openPickerButtonPosition:a,openPickerAriaLabel:l,textFieldProps:f({},s,rR>=6&&s?.slotProps?.input?{slotProps:f({},s?.slotProps,{input:e=>f({},_g(c,e),{readOnly:t})})}:{InputProps:f({},e??{},{readOnly:t})})}}const{onPaste:r,onKeyDown:o,inputMode:i,readOnly:a,InputProps:l,inputProps:s,inputRef:c,onClear:u,clearable:p,clearButtonPosition:h,openPickerButtonPosition:m,openPickerAriaLabel:g}=n,v=d(n,Gq),b=rR>=6&&v?.slotProps?.input?tY(v?.slotProps?.input,l):Zq,y=rR>=6&&v?.slotProps?.htmlInput?tY(v?.slotProps?.htmlInput,s):Zq;return{clearable:p,onClear:u,clearButtonPosition:h,openPickerButtonPosition:m,openPickerAriaLabel:g,textFieldProps:f({},v,rR>=6&&(v?.slotProps?.input||v?.slotProps?.htmlInput)?{slotProps:f({},v?.slotProps,{input:e=>f({},_g(b,e),{readOnly:a}),htmlInput:e=>f({},_g(y,e),{inputMode:i,onPaste:r,onKeyDown:o,ref:c})})}:{InputProps:f({},l??{},{readOnly:a}),inputProps:f({},s??{},{inputMode:i,onPaste:r,onKeyDown:o,ref:c})})}})(t),m=HK(a),g=Mg(e=>{e.preventDefault(),o?.setOpen(e=>!e)}),v=o?o.triggerStatus:"hidden",b=c?p:null,y="hidden"!==v?h:null,w=i.slots.textField??(!1===t.enableAccessibleFieldDOMStructure?qE:Vq),x=i.slots.inputAdornment??AS,S=d(yy({elementType:x,externalSlotProps:i.slotProps.inputAdornment,additionalProps:{position:"start"},ownerState:f({},m,{position:"start"})}),Kq),C=d(yy({elementType:x,externalSlotProps:i.slotProps.inputAdornment,additionalProps:{position:"end"},ownerState:f({},m,{position:"end"})}),qq),k=i.slots.openPickerButton??Mv,E=d(yy({elementType:k,externalSlotProps:i.slotProps.openPickerButton,additionalProps:{disabled:"disabled"===v,onClick:g,"aria-label":u,edge:"standard"!==a.variant&&y},ownerState:m}),Yq),R=i.slots.openPickerIcon??n,P=yy({elementType:R,externalSlotProps:i.slotProps.openPickerIcon,ownerState:m}),M=i.slots.clearButton??Mv,T=d(yy({elementType:M,externalSlotProps:i.slotProps.clearButton,className:"clearButton",additionalProps:{title:r.fieldClearLabel,tabIndex:-1,onClick:l,disabled:t.disabled||t.readOnly,edge:"standard"!==a.variant&&b!==y&&b},ownerState:m}),Xq),I=i.slots.clearIcon??KK,O=yy({elementType:I,externalSlotProps:i.slotProps.clearIcon,additionalProps:{fontSize:"small"},ownerState:m});a.ref=Tg(a.ref,o?.rootRef);const D={},F=_g((rR>=6&&a?.slotProps?.input)??a.InputProps,m);o&&(D.ref=o.triggerRef),F?.startAdornment||"start"!==b&&"start"!==y||(D.startAdornment=Xp.jsxs(x,f({},S,{children:["start"===y&&Xp.jsx(k,f({},E,{children:Xp.jsx(R,f({},P))})),"start"===b&&Xp.jsx(M,f({},T,{children:Xp.jsx(I,f({},O))}))]}))),F?.endAdornment||"end"!==b&&"end"!==y||(D.endAdornment=Xp.jsxs(x,f({},C,{children:["end"===b&&Xp.jsx(M,f({},T,{children:Xp.jsx(I,f({},O))})),"end"===y&&Xp.jsx(k,f({},E,{children:Xp.jsx(R,f({},P))}))]}))),D?.endAdornment||D?.startAdornment||!i.slots.inputAdornment||(D.endAdornment=Xp.jsx(x,f({},C))),null!=b&&(a.sx=[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(a.sx)?a.sx:[a.sx]]);const L=rR>=6&&a?.slotProps?.input?_g(tY(F,D),m):f({},F,D);return a.inputProps=rR>=6&&a?.slotProps?.htmlInput?_g(a.slotProps.htmlInput,m):a.inputProps,delete a?.slotProps?.input,t.enableAccessibleFieldDOMStructure&&delete a?.slotProps,Xp.jsx(w,f({},a,{InputProps:L}))}function tY(e,t){return e?t?n=>f({},_g(t,n),_g(e,n)):e:t}function nY(e){const{slots:t={},slotProps:n={},inputRef:r,children:o}=e,i=s.useMemo(()=>({inputRef:r,slots:{openPickerButton:t.openPickerButton,openPickerIcon:t.openPickerIcon,textField:t.textField,inputAdornment:t.inputAdornment,clearIcon:t.clearIcon,clearButton:t.clearButton},slotProps:{openPickerButton:n.openPickerButton,openPickerIcon:n.openPickerIcon,textField:n.textField,inputAdornment:n.inputAdornment,clearIcon:n.clearIcon,clearButton:n.clearButton}}),[r,t.openPickerButton,t.openPickerIcon,t.textField,t.inputAdornment,t.clearIcon,t.clearButton,n.openPickerButton,n.openPickerIcon,n.textField,n.inputAdornment,n.clearIcon,n.clearButton]);return Xp.jsx(Jq.Provider,{value:i,children:o})}const rY=["slots","slotProps"],oY=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiDateField"}),{slots:r,slotProps:o}=n,i=d(n,rY),a=function(e){const{ref:t,externalForwardedProps:n,slotProps:r}=e,o=s.useContext(Jq),i=MG(),a=HK(n),{InputProps:l,inputProps:c}=n,u=d(n,Qq),p=yy({elementType:Vq,externalSlotProps:tY(o.slotProps.textField,r?.textField),externalForwardedProps:u,additionalProps:{ref:t,sx:i?.rootSx,label:i?.label,name:i?.name,className:i?.rootClassName,inputRef:o.inputRef},ownerState:a});return p.inputProps=f({},c,p.inputProps),p.InputProps=f({},l,p.InputProps),p}({slotProps:o,ref:t,externalForwardedProps:i}),l=_K(a);return Xp.jsx(nY,{slots:r,slotProps:o,inputRef:i.inputRef,children:Xp.jsx(eY,{fieldResponse:l,defaultOpenPickerIcon:GK})})}),iY=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a,timezone:l})=>{const c=gG();return s.useCallback(s=>null!==LG({adapter:c,value:s,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:i,disablePast:a}}),[c,e,t,n,r,o,i,a,l])},aY=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,maxDate:i,minDate:a,onMonthChange:l,onYearChange:c,reduceAnimations:u,shouldDisableDate:d,timezone:p,getCurrentMonthFromVisibleDate:h}=e,m=gG(),g=s.useRef(((e,t)=>(n,r)=>{switch(r.type){case"setVisibleDate":return f({},n,{slideDirection:r.direction,currentMonth:r.month,isMonthSwitchingAnimating:!t.isSameMonth(r.month,n.currentMonth)&&!e&&!r.skipAnimation,focusedDay:r.focusedDay});case"changeMonthTimezone":{const e=r.newTimezone;if(t.getTimezone(n.currentMonth)===e)return n;let o=t.setTimezone(n.currentMonth,e);return t.getMonth(o)!==t.getMonth(n.currentMonth)&&(o=t.setMonth(o,t.getMonth(n.currentMonth))),f({},n,{currentMonth:o})}case"finishMonthSwitchingAnimation":return f({},n,{isMonthSwitchingAnimating:!1});default:throw new Error("missing support")}})(Boolean(u),m)).current,v=s.useMemo(()=>qU.getInitialReferenceValue({value:t,adapter:m,timezone:p,props:e,referenceDate:n,granularity:MU.day}),[n,p]),[b,y]=s.useReducer(g,{isMonthSwitchingAnimating:!1,focusedDay:v,currentMonth:m.startOfMonth(v),slideDirection:"left"}),w=iY({shouldDisableDate:d,minDate:a,maxDate:i,disableFuture:r,disablePast:o,timezone:p});s.useEffect(()=>{y({type:"changeMonthTimezone",newTimezone:m.getTimezone(v)})},[v,m]);const x=Mg(({target:e,reason:t})=>{if("cell-interaction"===t&&null!=b.focusedDay&&m.isSameDay(e,b.focusedDay))return;const n="cell-interaction"===t;let s,u;if("cell-interaction"===t)s=h(e,b.currentMonth),u=e;else if(s=m.isSameMonth(e,b.currentMonth)?b.currentMonth:m.startOfMonth(e),u=e,w(u)){const t=m.startOfMonth(e),n=m.endOfMonth(e);u=bU({adapter:m,date:u,minDate:m.isBefore(a,t)?t:a,maxDate:m.isAfter(i,n)?n:i,disablePast:o,disableFuture:r,isDateDisabled:w,timezone:p})}const d=!m.isSameMonth(b.currentMonth,s),f=!m.isSameYear(b.currentMonth,s);d&&l?.(s),f&&c?.(m.startOfYear(s)),y({type:"setVisibleDate",month:s,direction:m.isAfterDay(s,b.currentMonth)?"left":"right",focusedDay:null!=b.focusedDay&&null!=u&&m.isSameDay(u,b.focusedDay)?b.focusedDay:u,skipAnimation:n})}),S=s.useCallback(()=>{y({type:"finishMonthSwitchingAnimation"})},[]);return{referenceDate:v,calendarState:b,setVisibleDate:x,isDateDisabled:w,onMonthSwitchingAnimationEnd:S}},lY=e=>Ph("MuiPickersFadeTransitionGroup",e);Mh("MuiPickersFadeTransitionGroup",["root"]);const sY=["children"],cY=pg(Zo,{name:"MuiPickersFadeTransitionGroup",slot:"Root"})({display:"block",position:"relative"});function uY(e){const t=cg({props:e,name:"MuiPickersFadeTransitionGroup"}),{className:n,reduceAnimations:r,transKey:o,classes:i}=t,{children:a}=t,l=d(t,sY),s=(e=>wm({root:["root"]},lY,e))(i),c=sg();return r?a:Xp.jsx(cY,{className:QU(s.root,n),ownerState:l,children:Xp.jsx(Pw,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:c.transitions.duration.enteringScreen,enter:c.transitions.duration.enteringScreen,exit:0},children:a},o)})}function dY(e){return Ph("MuiPickersDay",e)}const pY=Mh("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]);function fY(e){const{disabled:t,selected:n,today:r,outsideCurrentMonth:o,day:i,disableMargin:a,disableHighlightToday:l,showDaysOutsideCurrentMonth:c}=e,u=gG(),{ownerState:d}=lG();return s.useMemo(()=>f({},d,{day:i,isDaySelected:n??!1,isDayDisabled:t??!1,isDayCurrent:r??!1,isDayOutsideMonth:o??!1,isDayStartOfWeek:u.isSameDay(i,u.startOfWeek(i)),isDayEndOfWeek:u.isSameDay(i,u.endOfWeek(i)),disableMargin:a??!1,disableHighlightToday:l??!1,showDaysOutsideCurrentMonth:c??!1}),[u,d,i,n,t,r,o,a,l,c])}const hY=["autoFocus","className","classes","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","children","isFirstVisibleCell","isLastVisibleCell","day","selected","disabled","today","outsideCurrentMonth","disableMargin","disableHighlightToday","showDaysOutsideCurrentMonth"],mY=({theme:e})=>f({},e.typography.caption,{width:36,height:36,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:tm(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${pY.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${pY.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${pY.disabled}:not(.${pY.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${pY.disabled}&.${pY.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:"0 2px"}},{props:{isDayOutsideMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,isDayCurrent:!0},style:{[`&:not(.${pY.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),gY=(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.isDayCurrent&&t.today,!n.isDayOutsideMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.isDayOutsideMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},vY=pg(sv,{name:"MuiPickersDay",slot:"Root",overridesResolver:gY})(mY),bY=pg("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:gY})(({theme:e})=>f({},mY({theme:e}),{opacity:0,pointerEvents:"none"})),yY=()=>{},wY=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,classes:i,isAnimating:a,onClick:l,onDaySelect:c,onFocus:u=yY,onBlur:p=yY,onKeyDown:h=yY,onMouseDown:m=yY,onMouseEnter:g=yY,children:v,day:b,selected:y,disabled:w,today:x,outsideCurrentMonth:S,disableMargin:C,disableHighlightToday:k,showDaysOutsideCurrentMonth:E}=n,R=d(n,hY),P=fY({day:b,selected:y,disabled:w,today:x,outsideCurrentMonth:S,disableMargin:C,disableHighlightToday:k,showDaysOutsideCurrentMonth:E}),M=((e,t)=>{const{isDaySelected:n,isDayDisabled:r,isDayCurrent:o,isDayOutsideMonth:i,disableMargin:a,disableHighlightToday:l,showDaysOutsideCurrentMonth:s}=t,c=i&&!s;return wm({root:["root",n&&!c&&"selected",r&&"disabled",!a&&"dayWithMargin",!l&&o&&"today",i&&s&&"dayOutsideMonth",c&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},dY,e)})(i,P),T=gG(),I=s.useRef(null),O=Tg(I,t);Wh(()=>{!r||w||a||S||I.current.focus()},[r,w,a,S]);return S&&!E?Xp.jsx(bY,{className:QU(M.root,M.hiddenDaySpacingFiller,o),ownerState:P,role:R.role}):Xp.jsx(vY,f({className:QU(M.root,o),ref:O,centerRipple:!0,disabled:w,tabIndex:y?0:-1,onKeyDown:e=>h(e,b),onFocus:e=>u(e,b),onBlur:e=>p(e,b),onMouseEnter:e=>g(e,b),onClick:e=>{e.defaultMuiPrevented=!0,w||c(b),S&&e.currentTarget.focus(),l&&l(e)},onMouseDown:e=>{m(e),S&&e.preventDefault()}},R,{ownerState:P,children:v??T.format(b,"dayOfMonth")}))}),xY=s.memo(wY),SY=e=>Ph("MuiPickersSlideTransition",e),CY=Mh("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),kY=["children","className","reduceAnimations","slideDirection","transKey","classes"],EY=pg(Zo,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${CY["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${CY["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${CY.slideEnterActive}`]:t.slideEnterActive},{[`.${CY.slideExit}`]:t.slideExit},{[`.${CY["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${CY["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{const t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${CY["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${CY["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${CY.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${CY.slideExit}`]:{transform:"translate(0%)"},[`& .${CY["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${CY["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});const RY=e=>Ph("MuiDayCalendar",e);Mh("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const PY=["parentProps","day","focusedDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],MY=["ownerState"],TY=pg("div",{name:"MuiDayCalendar",slot:"Root"})({}),IY=pg("div",{name:"MuiDayCalendar",slot:"Header"})({display:"flex",justifyContent:"center",alignItems:"center"}),OY=pg(Gv,{name:"MuiDayCalendar",slot:"WeekDayLabel"})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),DY=pg(Gv,{name:"MuiDayCalendar",slot:"WeekNumberLabel"})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.disabled})),FY=pg(Gv,{name:"MuiDayCalendar",slot:"WeekNumber"})(({theme:e})=>f({},e.typography.caption,{width:36,height:36,padding:0,margin:"0 2px",color:(e.vars||e).palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),LY=pg("div",{name:"MuiDayCalendar",slot:"LoadingContainer"})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:240}),AY=pg(function(e){const t=cg({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,slideDirection:i,transKey:a,classes:l}=t,c=d(t,kY),{ownerState:u}=lG(),p=f({},u,{slideDirection:i}),h=((e,t)=>{const{slideDirection:n}=t;return wm({root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]},SY,e)})(l,p),m=sg();if(o)return Xp.jsx("div",{className:QU(h.root,r),children:n});const g={exit:h.exit,enterActive:h.enterActive,enter:h.enter,exitActive:h.exitActive};return Xp.jsx(EY,{className:QU(h.root,r),childFactory:e=>s.cloneElement(e,{classNames:g}),role:"presentation",ownerState:p,children:Xp.jsx(Ko,f({mountOnEnter:!0,unmountOnExit:!0,timeout:m.transitions.duration.complex,classNames:g},c,{children:n}),a)})},{name:"MuiDayCalendar",slot:"SlideTransition"})({minHeight:240}),NY=pg("div",{name:"MuiDayCalendar",slot:"MonthContainer"})({overflow:"hidden"}),$Y=pg("div",{name:"MuiDayCalendar",slot:"WeekContainer"})({margin:"2px 0",display:"flex",justifyContent:"center"});function zY(e){let{parentProps:t,day:n,focusedDay:r,selectedDays:o,isDateDisabled:i,currentMonthNumber:a,isViewFocused:l}=e,c=d(e,PY);const{disabled:u,disableHighlightToday:p,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:m,slots:g,slotProps:v,timezone:b}=t,y=gG(),w=NG(b),x=null!=r&&y.isSameDay(n,r),S=l&&x,C=o.some(e=>y.isSameDay(e,n)),k=y.isSameDay(n,w),E=s.useMemo(()=>u||i(n),[u,i,n]),R=s.useMemo(()=>y.getMonth(n)!==a,[y,n,a]),P=fY({day:n,selected:C,disabled:E,today:k,outsideCurrentMonth:R,disableMargin:void 0,disableHighlightToday:p,showDaysOutsideCurrentMonth:m}),M=g?.day??xY,T=d(yy({elementType:M,externalSlotProps:v?.day,additionalProps:f({disableHighlightToday:p,showDaysOutsideCurrentMonth:m,role:"gridcell",isAnimating:h,"data-timestamp":y.toJsDate(n).valueOf()},c),ownerState:f({},P,{day:n,isDayDisabled:E,isDaySelected:C})}),MY),I=s.useMemo(()=>{const e=y.startOfMonth(y.setMonth(n,a));return m?y.isSameDay(n,y.startOfWeek(e)):y.isSameDay(n,e)},[a,n,m,y]),O=s.useMemo(()=>{const e=y.endOfMonth(y.setMonth(n,a));return m?y.isSameDay(n,y.endOfWeek(e)):y.isSameDay(n,e)},[a,n,m,y]);return Xp.jsx(M,f({},T,{day:n,disabled:E,autoFocus:!R&&S,today:k,outsideCurrentMonth:R,isFirstVisibleCell:I,isLastVisibleCell:O,selected:C,tabIndex:x?0:-1,"aria-selected":C,"aria-current":k?"date":void 0}))}function jY(e){const t=cg({props:e,name:"MuiDayCalendar"}),n=gG(),{onFocusedDayChange:r,className:o,classes:i,currentMonth:a,selectedDays:l,focusedDay:c,loading:u,onSelectedDaysChange:d,onMonthSwitchingAnimationEnd:p,readOnly:h,reduceAnimations:m,renderLoading:g=()=>Xp.jsx("span",{children:"..."}),slideDirection:v,TransitionProps:b,disablePast:y,disableFuture:w,minDate:x,maxDate:S,shouldDisableDate:C,shouldDisableMonth:k,shouldDisableYear:E,dayOfWeekFormatter:R=e=>n.format(e,"weekdayShort").charAt(0).toUpperCase(),hasFocus:P,onFocusedViewChange:M,gridLabelId:T,displayWeekNumber:I,fixedWeekNumber:O,timezone:D}=t,F=NG(D),L=(e=>wm({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},RY,e))(i),A=um(),N=iY({shouldDisableDate:C,shouldDisableMonth:k,shouldDisableYear:E,minDate:x,maxDate:S,disablePast:y,disableFuture:w,timezone:D}),$=vG(),z=Mg(e=>{h||d(e)}),j=e=>{N(e)||(r(e),M?.(!0))},B=Mg((e,t)=>{switch(e.key){case"ArrowUp":j(n.addDays(t,-7)),e.preventDefault();break;case"ArrowDown":j(n.addDays(t,7)),e.preventDefault();break;case"ArrowLeft":{const r=n.addDays(t,A?1:-1),o=n.addMonths(t,A?1:-1),i=bU({adapter:n,date:r,minDate:A?r:n.startOfMonth(o),maxDate:A?n.endOfMonth(o):r,isDateDisabled:N,timezone:D});j(i||r),e.preventDefault();break}case"ArrowRight":{const r=n.addDays(t,A?-1:1),o=n.addMonths(t,A?-1:1),i=bU({adapter:n,date:r,minDate:A?n.startOfMonth(o):r,maxDate:A?r:n.endOfMonth(o),isDateDisabled:N,timezone:D});j(i||r),e.preventDefault();break}case"Home":j(n.startOfWeek(t)),e.preventDefault();break;case"End":j(n.endOfWeek(t)),e.preventDefault();break;case"PageUp":j(n.addMonths(t,1)),e.preventDefault();break;case"PageDown":j(n.addMonths(t,-1)),e.preventDefault()}}),_=Mg((e,t)=>j(t)),H=Mg((e,t)=>{null!=c&&n.isSameDay(c,t)&&M?.(!1)}),V=n.getMonth(a),W=n.getYear(a),U=s.useMemo(()=>l.filter(e=>!!e).map(e=>n.startOfDay(e)),[n,l]),G=`${W}-${V}`,K=s.useMemo(()=>s.createRef(),[G]),q=s.useMemo(()=>{const e=n.getWeekArray(a);let t=n.addMonths(a,1);for(;O&&e.length<O;){const r=n.getWeekArray(t),o=n.isSameDay(e[e.length-1][0],r[0][0]);r.slice(o?1:0).forEach(t=>{e.length<O&&e.push(t)}),t=n.addMonths(t,1)}return e},[a,O,n]);return Xp.jsxs(TY,{role:"grid","aria-labelledby":T,className:L.root,children:[Xp.jsxs(IY,{role:"row",className:L.header,children:[I&&Xp.jsx(DY,{variant:"caption",role:"columnheader","aria-label":$.calendarWeekNumberHeaderLabel,className:L.weekNumberLabel,children:$.calendarWeekNumberHeaderText}),EU(n,F).map((e,t)=>Xp.jsx(OY,{variant:"caption",role:"columnheader","aria-label":n.format(e,"weekday"),className:L.weekDayLabel,children:R(e)},t.toString()))]}),u?Xp.jsx(LY,{className:L.loadingContainer,children:g()}):Xp.jsx(AY,f({transKey:G,onExited:p,reduceAnimations:m,slideDirection:v,className:QU(o,L.slideTransition)},b,{nodeRef:K,children:Xp.jsx(NY,{ref:K,role:"rowgroup",className:L.monthContainer,children:q.map((e,r)=>Xp.jsxs($Y,{role:"row",className:L.weekContainer,"aria-rowindex":r+1,children:[I&&Xp.jsx(FY,{className:L.weekNumber,role:"rowheader","aria-label":$.calendarWeekNumberAriaLabelText(n.getWeekNumber(e[0])),children:$.calendarWeekNumberText(n.getWeekNumber(e[0]))}),e.map((e,n)=>Xp.jsx(zY,{parentProps:t,day:e,selectedDays:U,isViewFocused:P,focusedDay:c,onKeyDown:B,onFocus:_,onBlur:H,onDaySelect:z,isDateDisabled:N,currentMonthNumber:V,"aria-colindex":n+1},e.toString()))]},`week-${e[0]}`))})}))]})}function BY(e){return Ph("MuiMonthCalendar",e)}const _Y=Mh("MuiMonthCalendar",["root","button","disabled","selected"]),HY=["autoFocus","classes","disabled","selected","value","onClick","onKeyDown","onFocus","onBlur","slots","slotProps"],VY=pg("button",{name:"MuiMonthCalendar",slot:"Button",overridesResolver:(e,t)=>[t.button,{[`&.${_Y.disabled}`]:t.disabled},{[`&.${_Y.selected}`]:t.selected}]})(({theme:e})=>f({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${_Y.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${_Y.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),WY=s.memo(function(e){const{autoFocus:t,classes:n,disabled:r,selected:o,value:i,onClick:a,onKeyDown:l,onFocus:c,onBlur:u,slots:p,slotProps:h}=e,m=d(e,HY),g=s.useRef(null),{ownerState:v}=lG(),b=f({},v,{isMonthDisabled:r,isMonthSelected:o}),y=((e,t)=>wm({button:["button",t.isMonthDisabled&&"disabled",t.isMonthSelected&&"selected"]},BY,e))(n,b);Wh(()=>{t&&g.current?.focus()},[t]);const w=p?.monthButton??VY,x=yy({elementType:w,externalSlotProps:h?.monthButton,externalForwardedProps:m,additionalProps:{disabled:r,ref:g,type:"button",role:"radio","aria-checked":o,onClick:e=>a(e,i),onKeyDown:e=>l(e,i),onFocus:e=>c(e,i),onBlur:e=>u(e,i)},ownerState:b,className:y.button});return Xp.jsx(w,f({},x))}),UY=["autoFocus","className","currentMonth","classes","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"];const GY=(e,t,n,r,o)=>Boolean(e===t&&r&&o.isSameYear(n,r)),KY=pg("div",{name:"MuiMonthCalendar",slot:"Root",shouldForwardProp:e=>Oh(e)&&"monthsPerRow"!==e})({display:"flex",flexWrap:"wrap",justifyContent:"space-evenly",rowGap:16,padding:"8px 0",width:hK,boxSizing:"border-box",variants:[{props:{monthsPerRow:3},style:{columnGap:24}},{props:{monthsPerRow:4},style:{columnGap:0}}]}),qY=s.forwardRef(function(e,t){const n=function(e,t){const n=cg({props:e,name:t});return f({},n,jG(n),{monthsPerRow:n.monthsPerRow??3})}(e,"MuiMonthCalendar"),{autoFocus:r,className:o,currentMonth:i,classes:a,value:l,defaultValue:c,referenceDate:u,disabled:p,disableFuture:h,disablePast:m,maxDate:g,minDate:v,onChange:b,shouldDisableMonth:y,readOnly:w,onMonthFocus:x,hasFocus:S,onFocusedViewChange:C,monthsPerRow:k,timezone:E,gridLabelId:R,slots:P,slotProps:M}=n,T=d(n,UY),{value:I,handleValueChange:O,timezone:D}=iK({name:"MonthCalendar",timezone:E,value:l,defaultValue:c,referenceDate:u,onChange:b,valueManager:qU}),F=NG(D),L=um(),A=gG(),{ownerState:N}=lG(),$=s.useMemo(()=>qU.getInitialReferenceValue({value:I,adapter:A,props:n,timezone:D,referenceDate:u,granularity:MU.month}),[]),z=(e=>wm({root:["root"]},BY,e))(a),j=s.useMemo(()=>A.getMonth(F),[A,F]),B=s.useMemo(()=>null!=I?A.getMonth(I):null,[I,A]),[_,H]=s.useState(()=>B||A.getMonth($)),[V,W]=Pg({name:"MonthCalendar",state:"hasFocus",controlled:S,default:r??!1}),U=Mg(e=>{W(e),C&&C(e)}),G=s.useCallback(e=>{const t=A.startOfMonth(m&&A.isAfter(F,v)?F:v),n=A.startOfMonth(h&&A.isBefore(F,g)?F:g),r=A.startOfMonth(e);return!!A.isBefore(r,t)||(!!A.isAfter(r,n)||!!y&&y(r))},[h,m,g,v,F,y,A]),K=Mg((e,t)=>{if(w)return;const n=I&&i&&!A.isSameYear(I,i)?A.setYear(I,A.getYear(i)):I,r=A.setMonth(n??$,t);O(r)}),q=Mg(e=>{G(A.setMonth(I??i??$,e))||(H(e),U(!0),x&&x(e))});s.useEffect(()=>{H(e=>null!==B&&e!==B?B:e)},[B]);const Y=Mg((e,t)=>{const n=12;switch(e.key){case"ArrowUp":q((n+t-3)%n),e.preventDefault();break;case"ArrowDown":q((n+t+3)%n),e.preventDefault();break;case"ArrowLeft":q((n+t+(L?1:-1))%n),e.preventDefault();break;case"ArrowRight":q((n+t+(L?-1:1))%n),e.preventDefault()}}),X=Mg((e,t)=>{q(t)}),Q=Mg((e,t)=>{_===t&&U(!1)});return Xp.jsx(KY,f({ref:t,className:QU(z.root,o),ownerState:N,role:"radiogroup","aria-labelledby":R,monthsPerRow:k},T,{children:wU(A,i??I??$).map(e=>{const t=A.getMonth(e),n=A.format(e,"monthShort"),r=A.format(e,"month"),o=GY(t,B,e,I,A),i=p||G(e);return Xp.jsx(WY,{selected:o,value:t,onClick:K,onKeyDown:Y,autoFocus:V&&t===_,disabled:i,tabIndex:t!==_||i?-1:0,onFocus:X,onBlur:Q,"aria-current":GY(t,j,e,F,A)?"date":void 0,"aria-label":r,slots:P,slotProps:M,classes:a,children:n},n)})}))});function YY(e){return Ph("MuiYearCalendar",e)}const XY=Mh("MuiYearCalendar",["root","button","disabled","selected"]),QY=["autoFocus","classes","disabled","selected","value","onClick","onKeyDown","onFocus","onBlur","slots","slotProps"],ZY=pg("button",{name:"MuiYearCalendar",slot:"Button",overridesResolver:(e,t)=>[t.button,{[`&.${XY.disabled}`]:t.disabled},{[`&.${XY.selected}`]:t.selected}]})(({theme:e})=>f({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:tm(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:tm(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${XY.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${XY.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),JY=s.memo(function(e){const{autoFocus:t,classes:n,disabled:r,selected:o,value:i,onClick:a,onKeyDown:l,onFocus:c,onBlur:u,slots:p,slotProps:h}=e,m=d(e,QY),g=s.useRef(null),{ownerState:v}=lG(),b=f({},v,{isYearDisabled:r,isYearSelected:o}),y=((e,t)=>wm({button:["button",t.isYearDisabled&&"disabled",t.isYearSelected&&"selected"]},YY,e))(n,b);Wh(()=>{t&&g.current?.focus()},[t]);const w=p?.yearButton??ZY,x=yy({elementType:w,externalSlotProps:h?.yearButton,externalForwardedProps:m,additionalProps:{disabled:r,ref:g,type:"button",role:"radio","aria-checked":o,onClick:e=>a(e,i),onKeyDown:e=>l(e,i),onFocus:e=>c(e,i),onBlur:e=>u(e,i)},ownerState:b,className:y.button});return Xp.jsx(w,f({},x))}),eX=["autoFocus","className","classes","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"];const tX=pg("div",{name:"MuiYearCalendar",slot:"Root",shouldForwardProp:e=>Oh(e)&&"yearsPerRow"!==e})({display:"flex",flexWrap:"wrap",justifyContent:"space-evenly",rowGap:12,padding:"6px 0",overflowY:"auto",height:"100%",width:hK,maxHeight:280,boxSizing:"border-box",position:"relative",variants:[{props:{yearsPerRow:3},style:{columnGap:24}},{props:{yearsPerRow:4},style:{columnGap:0,padding:"0 2px"}}]}),nX=pg("div",{name:"MuiYearCalendar",slot:"ButtonFiller"})({height:36,width:72}),rX=s.forwardRef(function(e,t){const n=function(e,t){const n=cg({props:e,name:t});return f({},n,jG(n),{yearsPerRow:n.yearsPerRow??3,yearsOrder:n.yearsOrder??"asc"})}(e,"MuiYearCalendar"),{autoFocus:r,className:o,classes:i,value:a,defaultValue:l,referenceDate:c,disabled:u,disableFuture:p,disablePast:h,maxDate:m,minDate:g,onChange:v,readOnly:b,shouldDisableYear:y,onYearFocus:w,hasFocus:x,onFocusedViewChange:S,yearsOrder:C,yearsPerRow:k,timezone:E,gridLabelId:R,slots:P,slotProps:M}=n,T=d(n,eX),{value:I,handleValueChange:O,timezone:D}=iK({name:"YearCalendar",timezone:E,value:a,defaultValue:l,referenceDate:c,onChange:v,valueManager:qU}),F=NG(D),L=um(),A=gG(),{ownerState:N}=lG(),$=s.useMemo(()=>qU.getInitialReferenceValue({value:I,adapter:A,props:n,timezone:D,referenceDate:c,granularity:MU.year}),[]),z=(e=>wm({root:["root"]},YY,e))(i),j=s.useMemo(()=>A.getYear(F),[A,F]),B=s.useMemo(()=>null!=I?A.getYear(I):null,[I,A]),[_,H]=s.useState(()=>B||A.getYear($)),[V,W]=Pg({name:"YearCalendar",state:"hasFocus",controlled:x,default:r??!1}),U=Mg(e=>{W(e),S&&S(e)}),G=s.useCallback(e=>{if(h&&A.isBeforeYear(e,F))return!0;if(p&&A.isAfterYear(e,F))return!0;if(g&&A.isBeforeYear(e,g))return!0;if(m&&A.isAfterYear(e,m))return!0;if(!y)return!1;const t=A.startOfYear(e);return y(t)},[p,h,m,g,F,y,A]),K=Mg((e,t)=>{if(b)return;const n=A.setYear(I??$,t);O(n)}),q=Mg(e=>{G(A.setYear(I??$,e))||(H(e),U(!0),w?.(e))});s.useEffect(()=>{H(e=>null!==B&&e!==B?B:e)},[B]);const Y="desc"!==C?1*k:-1*k,X=L&&"asc"===C||!L&&"desc"===C?-1:1,Q=Mg((e,t)=>{switch(e.key){case"ArrowUp":q(t-Y),e.preventDefault();break;case"ArrowDown":q(t+Y),e.preventDefault();break;case"ArrowLeft":q(t-X),e.preventDefault();break;case"ArrowRight":q(t+X),e.preventDefault()}}),Z=Mg((e,t)=>{q(t)}),J=Mg((e,t)=>{_===t&&U(!1)}),ee=s.useRef(null),te=Tg(t,ee);s.useEffect(()=>{if(r||null===ee.current)return;const e=ee.current.querySelector('[tabindex="0"]');if(!e)return;const t=e.offsetHeight,n=e.offsetTop,o=ee.current.clientHeight,i=ee.current.scrollTop,a=n+t;t>o||n<i||(ee.current.scrollTop=a-o/2-t/2)},[r]);const ne=A.getYearRange([g,m]);"desc"===C&&ne.reverse();let re=k-ne.length%k;return re===k&&(re=0),Xp.jsxs(tX,f({ref:te,className:QU(z.root,o),ownerState:N,role:"radiogroup","aria-labelledby":R,yearsPerRow:k},T,{children:[ne.map(e=>{const t=A.getYear(e),n=t===B,r=u||G(e);return Xp.jsx(JY,{selected:n,value:t,onClick:K,onKeyDown:Q,autoFocus:V&&t===_,disabled:r,tabIndex:t!==_||r?-1:0,onFocus:Z,onBlur:J,"aria-current":j===t?"date":void 0,slots:P,slotProps:M,classes:i,children:A.format(e,"year")},A.format(e,"year"))}),Array.from({length:re},(e,t)=>Xp.jsx(nX,{},t))]}))}),oX=e=>Ph("MuiPickersCalendarHeader",e),iX=Mh("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function aX(e){return Ph("MuiPickersArrowSwitcher",e)}Mh("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const lX=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId","classes"],sX=["ownerState"],cX=["ownerState"],uX=pg("div",{name:"MuiPickersArrowSwitcher",slot:"Root"})({display:"flex"}),dX=pg("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer"})(({theme:e})=>({width:e.spacing(3)})),pX=pg(Mv,{name:"MuiPickersArrowSwitcher",slot:"Button"})({variants:[{props:{isButtonHidden:!0},style:{visibility:"hidden"}}]}),fX=s.forwardRef(function(e,t){const n=um(),r=cg({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:i,slots:a,slotProps:l,isNextDisabled:s,isNextHidden:c,onGoToNext:u,nextLabel:p,isPreviousDisabled:h,isPreviousHidden:m,onGoToPrevious:g,previousLabel:v,labelId:b,classes:y}=r,w=d(r,lX),{ownerState:x}=lG(),S=(e=>wm({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},aX,e))(y),C={isDisabled:s,isHidden:c,goTo:u,label:p},k={isDisabled:h,isHidden:m,goTo:g,label:v},E=a?.previousIconButton??pX,R=yy({elementType:E,externalSlotProps:l?.previousIconButton,additionalProps:{size:"medium",title:k.label,"aria-label":k.label,disabled:k.isDisabled,edge:"end",onClick:k.goTo},ownerState:f({},x,{isButtonHidden:k.isHidden??!1}),className:QU(S.button,S.previousIconButton)}),P=a?.nextIconButton??pX,M=yy({elementType:P,externalSlotProps:l?.nextIconButton,additionalProps:{size:"medium",title:C.label,"aria-label":C.label,disabled:C.isDisabled,edge:"start",onClick:C.goTo},ownerState:f({},x,{isButtonHidden:C.isHidden??!1}),className:QU(S.button,S.nextIconButton)}),T=a?.leftArrowIcon??WK,I=d(yy({elementType:T,externalSlotProps:l?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:x,className:S.leftArrowIcon}),sX),O=a?.rightArrowIcon??UK,D=d(yy({elementType:O,externalSlotProps:l?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:x,className:S.rightArrowIcon}),cX);return Xp.jsxs(uX,f({ref:t,className:QU(S.root,i),ownerState:x},w,{children:[Xp.jsx(E,f({},R,{children:n?Xp.jsx(O,f({},D)):Xp.jsx(T,f({},I))})),o?Xp.jsx(Gv,{variant:"subtitle1",component:"span",id:b,children:o}):Xp.jsx(dX,{className:S.spacer,ownerState:x}),Xp.jsx(P,f({},M,{children:n?Xp.jsx(T,f({},I)):Xp.jsx(O,f({},D))}))]}))});const hX=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","classes","timezone","format"],mX=["ownerState"],gX=pg("div",{name:"MuiPickersCalendarHeader",slot:"Root"})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),vX=pg("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer"})(({theme:e})=>f({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),bX=pg("div",{name:"MuiPickersCalendarHeader",slot:"Label"})({marginRight:6}),yX=pg(Mv,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton"})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${iX.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),wX=pg(VK,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon"})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),xX=s.forwardRef(function(e,t){const n=vG(),r=gG(),o=cg({props:e,name:"MuiPickersCalendarHeader"}),{slots:i,slotProps:a,currentMonth:l,disabled:c,disableFuture:u,disablePast:p,maxDate:h,minDate:m,onMonthChange:g,onViewChange:v,view:b,reduceAnimations:y,views:w,labelId:x,className:S,classes:C,timezone:k,format:E=`${r.formats.month} ${r.formats.year}`}=o,R=d(o,hX),{ownerState:P}=lG(),M=(e=>wm({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},oX,e))(C),T=i?.switchViewButton??yX,I=yy({elementType:T,externalSlotProps:a?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(b)},ownerState:f({},P,{view:b}),className:M.switchViewButton}),O=i?.switchViewIcon??wX,D=d(yy({elementType:O,externalSlotProps:a?.switchViewIcon,ownerState:P,className:M.switchViewIcon}),mX),F=function(e,{disableFuture:t,maxDate:n,timezone:r}){const o=gG();return s.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isBefore(i,n)?i:n);return!o.isAfter(a,e)},[t,n,e,o,r])}(l,{disableFuture:u,maxDate:h,timezone:k}),L=function(e,{disablePast:t,minDate:n,timezone:r}){const o=gG();return s.useMemo(()=>{const i=o.date(void 0,r),a=o.startOfMonth(t&&o.isAfter(i,n)?i:n);return!o.isBefore(a,e)},[t,n,e,o,r])}(l,{disablePast:p,minDate:m,timezone:k});if(1===w.length&&"year"===w[0])return null;const A=r.formatByString(l,E);return Xp.jsxs(gX,f({},R,{ownerState:P,className:QU(M.root,S),ref:t,children:[Xp.jsxs(vX,{role:"presentation",onClick:()=>{if(1!==w.length&&v&&!c)if(2===w.length)v(w.find(e=>e!==b)||w[0]);else{const e=0!==w.indexOf(b)?0:1;v(w[e])}},ownerState:P,"aria-live":"polite",className:M.labelContainer,children:[Xp.jsx(uY,{reduceAnimations:y,transKey:A,children:Xp.jsx(bX,{id:x,ownerState:P,className:M.label,children:A})}),w.length>1&&!c&&Xp.jsx(T,f({},I,{children:Xp.jsx(O,f({},D))}))]}),Xp.jsx(Pw,{in:"day"===b,appear:!y,enter:!y,children:Xp.jsx(fX,{slots:i,slotProps:a,onGoToPrevious:()=>g(r.addMonths(l,-1)),isPreviousDisabled:L,previousLabel:n.previousMonth,onGoToNext:()=>g(r.addMonths(l,1)),isNextDisabled:F,nextLabel:n.nextMonth})})]}))}),SX=pg("div")({overflow:"hidden",width:hK,maxHeight:336,display:"flex",flexDirection:"column",margin:"0 auto"}),CX=e=>Ph("MuiDateCalendar",e);Mh("MuiDateCalendar",["root","viewTransitionContainer"]);const kX=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","classes","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"];const EX=pg(SX,{name:"MuiDateCalendar",slot:"Root"})({display:"flex",flexDirection:"column",height:336}),RX=pg(uY,{name:"MuiDateCalendar",slot:"ViewTransitionContainer"})({}),PX=s.forwardRef(function(e,t){const n=gG(),{ownerState:r}=lG(),o=mm(),i=function(e,t){const n=cg({props:e,name:t}),r=eK(n.reduceAnimations);return f({},n,jG(n),{loading:n.loading??!1,openTo:n.openTo??"day",views:n.views??["year","day"],reduceAnimations:r,renderLoading:n.renderLoading??(()=>Xp.jsx("span",{children:"..."}))})}(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:l,value:c,defaultValue:u,referenceDate:p,disableFuture:h,disablePast:m,onChange:g,onMonthChange:v,reduceAnimations:b,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:x,view:S,views:C,openTo:k,className:E,classes:R,disabled:P,readOnly:M,minDate:T,maxDate:I,disableHighlightToday:O,focusedView:D,onFocusedViewChange:F,showDaysOutsideCurrentMonth:L,fixedWeekNumber:A,dayOfWeekFormatter:N,slots:$,slotProps:z,loading:j,renderLoading:B,displayWeekNumber:_,yearsOrder:H,yearsPerRow:V,monthsPerRow:W,timezone:U}=i,G=d(i,kX),{value:K,handleValueChange:q,timezone:Y}=iK({name:"DateCalendar",timezone:U,value:c,defaultValue:u,referenceDate:p,onChange:g,valueManager:qU}),{view:X,setView:Q,focusedView:Z,setFocusedView:J,goToNextView:ee,setValueAndGoToNextView:te}=nK({view:S,views:C,openTo:k,onChange:q,onViewChange:l,autoFocus:a,focusedView:D,onFocusedViewChange:F}),{referenceDate:ne,calendarState:re,setVisibleDate:oe,isDateDisabled:ie,onMonthSwitchingAnimationEnd:ae}=aY({value:K,referenceDate:p,reduceAnimations:b,onMonthChange:v,minDate:T,maxDate:I,shouldDisableDate:y,disablePast:m,disableFuture:h,timezone:Y,getCurrentMonthFromVisibleDate:(e,t)=>n.isSameMonth(e,t)?t:n.startOfMonth(e)}),le=P&&K||T,se=P&&K||I,ce=`${o}-grid-label`,ue=null!==Z,de=$?.calendarHeader??xX,pe=yy({elementType:de,externalSlotProps:z?.calendarHeader,additionalProps:{views:C,view:X,currentMonth:re.currentMonth,onViewChange:Q,onMonthChange:e=>oe({target:e,reason:"header-navigation"}),minDate:le,maxDate:se,disabled:P,disablePast:m,disableFuture:h,reduceAnimations:b,timezone:Y,labelId:ce},ownerState:r}),fe=Mg(e=>{const t=n.startOfMonth(e),r=n.endOfMonth(e),o=ie(e)?bU({adapter:n,date:e,minDate:n.isBefore(T,t)?t:T,maxDate:n.isAfter(I,r)?r:I,disablePast:m,disableFuture:h,isDateDisabled:ie,timezone:Y}):e;o?(te(o,"finish"),oe({target:o,reason:"cell-interaction"})):(ee(),oe({target:t,reason:"cell-interaction"}))}),he=Mg(e=>{const t=n.startOfYear(e),r=n.endOfYear(e),o=ie(e)?bU({adapter:n,date:e,minDate:n.isBefore(T,t)?t:T,maxDate:n.isAfter(I,r)?r:I,disablePast:m,disableFuture:h,isDateDisabled:ie,timezone:Y}):e;o?(te(o,"finish"),oe({target:o,reason:"cell-interaction"})):(ee(),oe({target:t,reason:"cell-interaction"}))}),me=Mg(e=>q(e?vU(n,e,K??ne):e,"finish",X));s.useEffect(()=>{n.isValid(K)&&oe({target:K,reason:"controlled-value-change"})},[K]);const ge=(e=>wm({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},CX,e))(R),ve={disablePast:m,disableFuture:h,maxDate:I,minDate:T},be={disableHighlightToday:O,readOnly:M,disabled:P,timezone:Y,gridLabelId:ce,slots:$,slotProps:z},ye=s.useRef(X);s.useEffect(()=>{ye.current!==X&&(Z===ye.current&&J(X,!0),ye.current=X)},[Z,J,X]);const we=s.useMemo(()=>[K],[K]);return Xp.jsxs(EX,f({ref:t,className:QU(ge.root,E),ownerState:r},G,{children:[Xp.jsx(de,f({},pe,{slots:$,slotProps:z})),Xp.jsx(RX,{reduceAnimations:b,className:ge.viewTransitionContainer,transKey:X,ownerState:r,children:Xp.jsxs("div",{children:["year"===X&&Xp.jsx(rX,f({},ve,be,{value:K,onChange:he,shouldDisableYear:x,hasFocus:ue,onFocusedViewChange:e=>J("year",e),yearsOrder:H,yearsPerRow:V,referenceDate:ne})),"month"===X&&Xp.jsx(qY,f({},ve,be,{currentMonth:re.currentMonth,hasFocus:ue,className:E,value:K,onChange:fe,shouldDisableMonth:w,onFocusedViewChange:e=>J("month",e),monthsPerRow:W,referenceDate:ne})),"day"===X&&Xp.jsx(jY,f({},re,ve,be,{onMonthSwitchingAnimationEnd:ae,hasFocus:ue,onFocusedDayChange:e=>oe({target:e,reason:"cell-interaction"}),reduceAnimations:b,selectedDays:we,onSelectedDaysChange:me,shouldDisableDate:y,shouldDisableMonth:w,shouldDisableYear:x,onFocusedViewChange:e=>J("day",e),showDaysOutsideCurrentMonth:L,fixedWeekNumber:A,dayOfWeekFormatter:N,displayWeekNumber:_,loading:j,renderLoading:B}))]})})]}))}),MX=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:i,defaultValue:a,referenceDate:l,onChange:s,className:c,classes:u,disableFuture:d,disablePast:p,minDate:f,maxDate:h,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:y,monthsPerRow:w,onYearChange:x,yearsOrder:S,yearsPerRow:C,slots:k,slotProps:E,loading:R,renderLoading:P,disableHighlightToday:M,readOnly:T,disabled:I,showDaysOutsideCurrentMonth:O,dayOfWeekFormatter:D,sx:F,autoFocus:L,fixedWeekNumber:A,displayWeekNumber:N,timezone:$})=>Xp.jsx(PX,{view:e,onViewChange:t,views:n.filter(CU),focusedView:r&&CU(r)?r:null,onFocusedViewChange:o,value:i,defaultValue:a,referenceDate:l,onChange:s,className:c,classes:u,disableFuture:d,disablePast:p,minDate:f,maxDate:h,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:y,monthsPerRow:w,onYearChange:x,yearsOrder:S,yearsPerRow:C,slots:k,slotProps:E,loading:R,renderLoading:P,disableHighlightToday:M,readOnly:T,disabled:I,showDaysOutsideCurrentMonth:O,dayOfWeekFormatter:D,sx:F,autoFocus:L,fixedWeekNumber:A,displayWeekNumber:N,timezone:$}),TX=s.forwardRef(function(e,t){const n=gG(),r=BG(e,"MuiDesktopDatePicker"),o=f({day:MX,month:MX,year:MX},r.viewRenderers),i=f({},r,{closeOnSelect:r.closeOnSelect??!0,viewRenderers:o,format:kU(n,r,!1),yearsPerRow:r.yearsPerRow??4,slots:f({field:oY},r.slots),slotProps:f({},r.slotProps,{field:e=>f({},_g(r.slotProps?.field,e),SG(r)),toolbar:f({hidden:!0},r.slotProps?.toolbar)})}),{renderPicker:a}=(e=>{let{props:t,steps:n}=e,r=d(e,EK);const{slots:o,slotProps:i,label:a,inputRef:l,localeText:s}=t,c=kK({steps:n}),{providerProps:u,renderCurrentView:p,ownerState:h}=lK(f({},r,{props:t,localeText:s,autoFocusView:!0,viewContainerRole:"dialog",variant:"desktop",getStepNavigation:c})),m=u.privateContextValue.labelId,g=i?.toolbar?.hidden??!1,v=o.field,b=d(yy({elementType:v,externalSlotProps:i?.field,additionalProps:f({},g&&{id:m}),ownerState:h}),RK),y=o.layout??CK;let w=m;g&&(w=a?`${m}-label`:void 0);const x=f({},i,{toolbar:f({},i?.toolbar,{titleId:m}),popper:f({"aria-labelledby":w},i?.popper)});return{renderPicker:()=>Xp.jsxs(aG,f({},u,{children:[Xp.jsx(v,f({},b,{slots:f({},o,b.slots),slotProps:f({},x,b.slotProps),inputRef:l})),Xp.jsx(YG,{slots:o,slotProps:x,children:Xp.jsx(y,f({},x?.layout,{slots:o,slotProps:x,children:p()}))})]}))}})({ref:t,props:i,valueManager:qU,valueType:"date",validator:LG,steps:null});return a()});TX.propTypes={autoFocus:C.bool,className:C.string,closeOnSelect:C.bool,dayOfWeekFormatter:C.func,defaultValue:C.object,disabled:C.bool,disableFuture:C.bool,disableHighlightToday:C.bool,disableOpenPicker:C.bool,disablePast:C.bool,displayWeekNumber:C.bool,enableAccessibleFieldDOMStructure:C.any,fixedWeekNumber:C.number,format:C.string,formatDensity:C.oneOf(["dense","spacious"]),inputRef:Yg,label:C.node,loading:C.bool,localeText:C.object,maxDate:C.object,minDate:C.object,monthsPerRow:C.oneOf([3,4]),name:C.string,onAccept:C.func,onChange:C.func,onClose:C.func,onError:C.func,onMonthChange:C.func,onOpen:C.func,onSelectedSectionsChange:C.func,onViewChange:C.func,onYearChange:C.func,open:C.bool,openTo:C.oneOf(["day","month","year"]),orientation:C.oneOf(["landscape","portrait"]),readOnly:C.bool,reduceAnimations:C.bool,referenceDate:C.object,renderLoading:C.func,selectedSections:C.oneOfType([C.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),C.number]),shouldDisableDate:C.func,shouldDisableMonth:C.func,shouldDisableYear:C.func,showDaysOutsideCurrentMonth:C.bool,slotProps:C.object,slots:C.object,sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),timezone:C.string,value:C.object,view:C.oneOf(["day","month","year"]),viewRenderers:C.shape({day:C.func,month:C.func,year:C.func}),views:C.arrayOf(C.oneOf(["day","month","year"]).isRequired),yearsOrder:C.oneOf(["asc","desc"]),yearsPerRow:C.oneOf([3,4])};const IX=pg(zx)({[`& .${Dx.container}`]:{outline:0},[`& .${Dx.paper}`]:{outline:0,minWidth:hK}}),OX=pg(Gx)({"&:first-of-type":{padding:0}});function DX(e){const{children:t,slots:n,slotProps:r}=e,{open:o}=rG(),{dismissViews:i,onPopperExited:a}=lG(),l=n?.dialog??IX,s=n?.mobileTransition??Pw;return Xp.jsx(l,f({open:o,onClose:()=>{i(),a?.()}},r?.dialog,{TransitionComponent:s,TransitionProps:r?.mobileTransition,PaperComponent:n?.mobilePaper,PaperProps:r?.mobilePaper,children:Xp.jsx(OX,{children:t})}))}const FX=["props","steps"],LX=["ownerState"],AX=s.forwardRef(function(e,t){const n=gG(),r=BG(e,"MuiMobileDatePicker"),o=f({day:MX,month:MX,year:MX},r.viewRenderers),i=f({},r,{viewRenderers:o,format:kU(n,r,!1),slots:f({field:oY},r.slots),slotProps:f({},r.slotProps,{field:e=>f({},_g(r.slotProps?.field,e),SG(r)),toolbar:f({hidden:!1},r.slotProps?.toolbar)})}),{renderPicker:a}=(e=>{let{props:t,steps:n}=e,r=d(e,FX);const{slots:o,slotProps:i,label:a,inputRef:l,localeText:s}=t,c=kK({steps:n}),{providerProps:u,renderCurrentView:p,ownerState:h}=lK(f({},r,{props:t,localeText:s,autoFocusView:!0,viewContainerRole:"dialog",variant:"mobile",getStepNavigation:c})),m=u.privateContextValue.labelId,g=i?.toolbar?.hidden??!1,v=o.field,b=d(yy({elementType:v,externalSlotProps:i?.field,additionalProps:f({},g&&{id:m}),ownerState:h}),LX),y=o.layout??CK;let w=m;g&&(w=a?`${m}-label`:void 0);const x=f({},i,{toolbar:f({},i?.toolbar,{titleId:m}),mobilePaper:f({"aria-labelledby":w},i?.mobilePaper)});return{renderPicker:()=>Xp.jsxs(aG,f({},u,{children:[Xp.jsx(v,f({},b,{slots:f({},o,b.slots),slotProps:f({},x,b.slotProps),inputRef:l})),Xp.jsx(DX,{slots:o,slotProps:x,children:Xp.jsx(y,f({},x?.layout,{slots:o,slotProps:x,children:p()}))})]}))}})({ref:t,props:i,valueManager:qU,valueType:"date",validator:LG,steps:null});return a()});AX.propTypes={autoFocus:C.bool,className:C.string,closeOnSelect:C.bool,dayOfWeekFormatter:C.func,defaultValue:C.object,disabled:C.bool,disableFuture:C.bool,disableHighlightToday:C.bool,disableOpenPicker:C.bool,disablePast:C.bool,displayWeekNumber:C.bool,enableAccessibleFieldDOMStructure:C.any,fixedWeekNumber:C.number,format:C.string,formatDensity:C.oneOf(["dense","spacious"]),inputRef:Yg,label:C.node,loading:C.bool,localeText:C.object,maxDate:C.object,minDate:C.object,monthsPerRow:C.oneOf([3,4]),name:C.string,onAccept:C.func,onChange:C.func,onClose:C.func,onError:C.func,onMonthChange:C.func,onOpen:C.func,onSelectedSectionsChange:C.func,onViewChange:C.func,onYearChange:C.func,open:C.bool,openTo:C.oneOf(["day","month","year"]),orientation:C.oneOf(["landscape","portrait"]),readOnly:C.bool,reduceAnimations:C.bool,referenceDate:C.object,renderLoading:C.func,selectedSections:C.oneOfType([C.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),C.number]),shouldDisableDate:C.func,shouldDisableMonth:C.func,shouldDisableYear:C.func,showDaysOutsideCurrentMonth:C.bool,slotProps:C.object,slots:C.object,sx:C.oneOfType([C.arrayOf(C.oneOfType([C.func,C.object,C.bool])),C.func,C.object]),timezone:C.string,value:C.object,view:C.oneOf(["day","month","year"]),viewRenderers:C.shape({day:C.func,month:C.func,year:C.func}),views:C.arrayOf(C.oneOf(["day","month","year"]).isRequired),yearsOrder:C.oneOf(["asc","desc"]),yearsPerRow:C.oneOf([3,4])};const NX=["desktopModeMediaQuery"],$X=s.forwardRef(function(e,t){const n=cg({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=WG}=n,o=d(n,NX);return nR(r,{defaultMatches:!0})?Xp.jsx(TX,f({ref:t},o)):Xp.jsx(AX,f({ref:t},o))});var zX,jX={exports:{}};var BX,_X=(zX||(zX=1,function(e){e.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",i="minute",a="hour",l="day",s="week",c="month",u="quarter",d="year",p="date",f="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},v=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},b={s:v,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+v(r,2,"0")+":"+v(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),i=n-o<0,a=t.clone().add(r+(i?-1:1),c);return+(-(r+(n-o)/(i?o-a:a-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:s,d:l,D:p,h:a,m:i,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},y="en",w={};w[y]=g;var x="$isDayjsObject",S=function(e){return e instanceof R||!(!e||!e[x])},C=function e(t,n,r){var o;if(!t)return y;if("string"==typeof t){var i=t.toLowerCase();w[i]&&(o=i),n&&(w[i]=n,o=i);var a=t.split("-");if(!o&&a.length>1)return e(a[0])}else{var l=t.name;w[l]=t,o=l}return!r&&o&&(y=o),o||!r&&y},k=function(e,t){if(S(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new R(n)},E=b;E.l=C,E.i=S,E.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var R=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var v=g.prototype;return v.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(E.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var o=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},v.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},v.$utils=function(){return E},v.isValid=function(){return!(this.$d.toString()===f)},v.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},v.isAfter=function(e,t){return k(e)<this.startOf(t)},v.isBefore=function(e,t){return this.endOf(t)<k(e)},v.$g=function(e,t,n){return E.u(e)?this[t]:this.set(n,e)},v.unix=function(){return Math.floor(this.valueOf()/1e3)},v.valueOf=function(){return this.$d.getTime()},v.startOf=function(e,t){var n=this,r=!!E.u(t)||t,u=E.p(e),f=function(e,t){var o=E.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(l)},h=function(e,t){return E.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},m=this.$W,g=this.$M,v=this.$D,b="set"+(this.$u?"UTC":"");switch(u){case d:return r?f(1,0):f(31,11);case c:return r?f(1,g):f(0,g+1);case s:var y=this.$locale().weekStart||0,w=(m<y?m+7:m)-y;return f(r?v-w:v+(6-w),g);case l:case p:return h(b+"Hours",0);case a:return h(b+"Minutes",1);case i:return h(b+"Seconds",2);case o:return h(b+"Milliseconds",3);default:return this.clone()}},v.endOf=function(e){return this.startOf(e,!1)},v.$set=function(e,t){var n,s=E.p(e),u="set"+(this.$u?"UTC":""),f=(n={},n[l]=u+"Date",n[p]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[a]=u+"Hours",n[i]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[s],h=s===l?this.$D+(t-this.$W):t;if(s===c||s===d){var m=this.clone().set(p,1);m.$d[f](h),m.init(),this.$d=m.set(p,Math.min(this.$D,m.daysInMonth())).$d}else f&&this.$d[f](h);return this.init(),this},v.set=function(e,t){return this.clone().$set(e,t)},v.get=function(e){return this[E.p(e)]()},v.add=function(r,u){var p,f=this;r=Number(r);var h=E.p(u),m=function(e){var t=k(f);return E.w(t.date(t.date()+Math.round(e*r)),f)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===l)return m(1);if(h===s)return m(7);var g=(p={},p[i]=t,p[a]=n,p[o]=e,p)[h]||1,v=this.$d.getTime()+r*g;return E.w(v,this)},v.subtract=function(e,t){return this.add(-1*e,t)},v.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=E.z(this),i=this.$H,a=this.$m,l=this.$M,s=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,i){return e&&(e[n]||e(t,r))||o[n].slice(0,i)},p=function(e){return E.s(i%12||12,e,"0")},h=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return E.s(t.$y,4,"0");case"M":return l+1;case"MM":return E.s(l+1,2,"0");case"MMM":return d(n.monthsShort,l,c,3);case"MMMM":return d(c,l);case"D":return t.$D;case"DD":return E.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,s,2);case"ddd":return d(n.weekdaysShort,t.$W,s,3);case"dddd":return s[t.$W];case"H":return String(i);case"HH":return E.s(i,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return h(i,a,!0);case"A":return h(i,a,!1);case"m":return String(a);case"mm":return E.s(a,2,"0");case"s":return String(t.$s);case"ss":return E.s(t.$s,2,"0");case"SSS":return E.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")})},v.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},v.diff=function(r,p,f){var h,m=this,g=E.p(p),v=k(r),b=(v.utcOffset()-this.utcOffset())*t,y=this-v,w=function(){return E.m(m,v)};switch(g){case d:h=w()/12;break;case c:h=w();break;case u:h=w()/3;break;case s:h=(y-b)/6048e5;break;case l:h=(y-b)/864e5;break;case a:h=y/n;break;case i:h=y/t;break;case o:h=y/e;break;default:h=y}return f?h:E.a(h)},v.daysInMonth=function(){return this.endOf(c).$D},v.$locale=function(){return w[this.$L]},v.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},v.clone=function(){return E.w(this.$d,this)},v.toDate=function(){return new Date(this.valueOf())},v.toJSON=function(){return this.isValid()?this.toISOString():null},v.toISOString=function(){return this.$d.toISOString()},v.toString=function(){return this.$d.toUTCString()},g}(),P=R.prototype;return k.prototype=P,[["$ms",r],["$s",o],["$m",i],["$H",a],["$W",l],["$M",c],["$y",d],["$D",p]].forEach(function(e){P[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),k.extend=function(e,t){return e.$i||(e(t,R,k),e.$i=!0),k},k.locale=C,k.isDayjs=S,k.unix=function(e){return k(1e3*e)},k.en=w[y],k.Ls=w,k.p={},k}()}(jX)),jX.exports),HX=t(_X),VX={exports:{}};var WX,UX=(BX||(BX=1,function(e){var t,n;e.exports=(t="week",n="year",function(e,r,o){var i=r.prototype;i.week=function(e){if(void 0===e&&(e=null),null!==e)return this.add(7*(e-this.week()),"day");var r=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var i=o(this).startOf(n).add(1,n).date(r),a=o(this).endOf(t);if(i.isBefore(a))return 1}var l=o(this).startOf(n).date(r).startOf(t).subtract(1,"millisecond"),s=this.diff(l,t,!0);return s<0?o(this).startOf("week").week():Math.ceil(s)},i.weeks=function(e){return void 0===e&&(e=null),this.week(e)}})}(VX)),VX.exports),GX=t(UX),KX={exports:{}};var qX,YX=(WX||(WX=1,function(e){e.exports=function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,a={},l=function(e){return(e=+e)+(e>68?1900:2e3)},s=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],u=function(e){var t=a[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=a.meridiem;if(r){for(var o=1;o<=24;o+=1)if(e.indexOf(r(o,0,t))>-1){n=o>12;break}}else n=e===(t?"pm":"PM");return n},p={A:[i,function(e){this.afternoon=d(e,!1)}],a:[i,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*+e}],SS:[r,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[o,s("seconds")],ss:[o,s("seconds")],m:[o,s("minutes")],mm:[o,s("minutes")],H:[o,s("hours")],h:[o,s("hours")],HH:[o,s("hours")],hh:[o,s("hours")],D:[o,s("day")],DD:[r,s("day")],Do:[i,function(e){var t=a.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],w:[o,s("week")],ww:[r,s("week")],M:[o,s("month")],MM:[r,s("month")],MMM:[i,function(e){var t=u("months"),n=(u("monthsShort")||t.map(function(e){return e.slice(0,3)})).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,s("year")],YY:[r,function(e){this.year=l(e)}],YYYY:[/\d{4}/,s("year")],Z:c,ZZ:c};function f(n){var r,o;r=n,o=a&&a.formats;for(var i=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})).match(t),l=i.length,s=0;s<l;s+=1){var c=i[s],u=p[c],d=u&&u[0],f=u&&u[1];i[s]=f?{regex:d,parser:f}:c.replace(/^\[|\]$/g,"")}return function(e){for(var t={},n=0,r=0;n<l;n+=1){var o=i[n];if("string"==typeof o)r+=o.length;else{var a=o.regex,s=o.parser,c=e.slice(r),u=a.exec(c)[0];s.call(t,u),e=e.replace(u,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(l=e.parseTwoDigitYear);var r=t.prototype,o=r.parse;r.parse=function(e){var t=e.date,r=e.utc,i=e.args;this.$u=r;var l=i[1];if("string"==typeof l){var s=!0===i[2],c=!0===i[3],u=s||c,d=i[2];c&&(d=i[2]),a=this.$locale(),!s&&d&&(a=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var o=f(t)(e),i=o.year,a=o.month,l=o.day,s=o.hours,c=o.minutes,u=o.seconds,d=o.milliseconds,p=o.zone,h=o.week,m=new Date,g=l||(i||a?1:m.getDate()),v=i||m.getFullYear(),b=0;i&&!a||(b=a>0?a-1:m.getMonth());var y,w=s||0,x=c||0,S=u||0,C=d||0;return p?new Date(Date.UTC(v,b,g,w,x,S,C+60*p.offset*1e3)):n?new Date(Date.UTC(v,b,g,w,x,S,C)):(y=new Date(v,b,g,w,x,S,C),h&&(y=r(y).week(h).toDate()),y)}catch(e){return new Date("")}}(t,l,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(l)&&(this.$d=new Date("")),a={}}else if(l instanceof Array)for(var p=l.length,h=1;h<=p;h+=1){i[1]=l[h-1];var m=n.apply(this,i);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}h===p&&(this.$d=new Date(""))}else o.call(this,e)}}}()}(KX)),KX.exports),XX=t(YX),QX={exports:{}};var ZX,JX=(qX||(qX=1,function(e){var t;e.exports=(t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,n,r){var o=n.prototype,i=o.format;r.en.formats=t,o.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var n=this.$locale().formats,r=function(e,n){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(e,r,o){var i=o&&o.toUpperCase();return r||n[o]||t[o]||n[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e,t,n){return t||n.slice(1)})})}(e,void 0===n?{}:n);return i.call(this,r)}})}(QX)),QX.exports),eQ=t(JX),tQ={exports:{}};var nQ,rQ=(ZX||(ZX=1,function(e){e.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,o){var i=n(e),a=n(t),l="("===(o=o||"()")[0],s=")"===o[1];return(l?this.isAfter(i,r):!this.isBefore(i,r))&&(s?this.isBefore(a,r):!this.isAfter(a,r))||(l?this.isBefore(i,r):!this.isAfter(i,r))&&(s?this.isAfter(a,r):!this.isBefore(a,r))}}}(tQ)),tQ.exports),oQ=t(rQ),iQ={exports:{}};var aQ=(nQ||(nQ=1,function(e){e.exports=function(e,t){var n=t.prototype,r=n.format;n.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return r.bind(this)(e);var o=this.$utils(),i=(e||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(e){switch(e){case"Q":return Math.ceil((t.$M+1)/3);case"Do":return n.ordinal(t.$D);case"gggg":return t.weekYear();case"GGGG":return t.isoWeekYear();case"wo":return n.ordinal(t.week(),"W");case"w":case"ww":return o.s(t.week(),"w"===e?1:2,"0");case"W":case"WW":return o.s(t.isoWeek(),"W"===e?1:2,"0");case"k":case"kk":return o.s(String(0===t.$H?24:t.$H),"k"===e?1:2,"0");case"X":return Math.floor(t.$d.getTime()/1e3);case"x":return t.$d.getTime();case"z":return"["+t.offsetName()+"]";case"zzz":return"["+t.offsetName("long")+"]";default:return e}});return r.bind(this)(i)}}}(iQ)),iQ.exports),lQ=t(aQ);HX.extend(eQ),HX.extend(GX),HX.extend(oQ),HX.extend(lQ);const sQ={YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},d:{sectionType:"weekDay",contentType:"digit",maxLength:2},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},cQ={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"dd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},uQ=["Missing UTC plugin","To be able to use UTC or timezones, you have to enable the `utc` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-utc"].join("\n"),dQ=["Missing timezone plugin","To be able to use timezones, you have to enable both the `utc` and the `timezone` plugin","Find more information on https://mui.com/x/react-date-pickers/timezone/#day-js-and-timezone"].join("\n");class pQ{isMUIAdapter=!0;isTimezoneCompatible=!0;lib="dayjs";escapedCharacters={start:"[",end:"]"};formatTokenMap=(()=>sQ)();constructor({locale:e,formats:t}={}){this.locale=e,this.formats=f({},cQ,t),HX.extend(XX)}setLocaleToValue=e=>{const t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasUTCPlugin=()=>void 0!==HX.utc;hasTimezonePlugin=()=>void 0!==HX.tz;isSame=(e,t,n)=>{const r=this.setTimezone(t,this.getTimezone(e));return e.format(n)===r.format(n)};cleanTimezone=e=>{switch(e){case"default":return;case"system":return HX.tz.guess();default:return e}};createSystemDate=e=>{let t;if(this.hasUTCPlugin()&&this.hasTimezonePlugin()){const n=HX.tz.guess();t="UTC"===n?HX(e):HX.tz(e,n)}else t=HX(e);return this.setLocaleToValue(t)};createUTCDate=e=>{if(!this.hasUTCPlugin())throw new Error(uQ);return this.setLocaleToValue(HX.utc(e))};createTZDate=(e,t)=>{if(!this.hasUTCPlugin())throw new Error(uQ);if(!this.hasTimezonePlugin())throw new Error(dQ);const n=void 0!==e&&!e.endsWith("Z");return this.setLocaleToValue(HX(e).tz(this.cleanTimezone(t),n))};getLocaleFormats=()=>{const e=HX.Ls;let t=e[this.locale||"en"];return void 0===t&&(t=e.en),t.formats};adjustOffset=e=>{if(!this.hasTimezonePlugin())return e;const t=this.getTimezone(e);if("UTC"!==t){const n=e.tz(this.cleanTimezone(t),!0);if(n.$offset===(e.$offset??0))return e;e.$offset=n.$offset}return e};date=(e,t="default")=>null===e?null:"UTC"===t?this.createUTCDate(e):"system"===t||"default"===t&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t);getInvalidDate=()=>HX(new Date("Invalid date"));getTimezone=e=>{if(this.hasTimezonePlugin()){const t=e.$x?.$timezone;if(t)return t}return this.hasUTCPlugin()&&e.isUTC()?"UTC":"system"};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if("UTC"===t){if(!this.hasUTCPlugin())throw new Error(uQ);return e.utc()}if("system"===t)return e.local();if(!this.hasTimezonePlugin()){if("default"===t)return e;throw new Error(dQ)}return this.setLocaleToValue(HX.tz(e,this.cleanTimezone(t)))};toJsDate=e=>e.toDate();parse=(e,t)=>""===e?null:HX(e,t,this.locale,!0);getCurrentLocaleCode=()=>this.locale||"en";is12HourCycleInCurrentLocale=()=>/A|a/.test(this.getLocaleFormats().LT||"");expandFormat=e=>{const t=this.getLocaleFormats();return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(e,n,r)=>{const o=r&&r.toUpperCase();return n||t[r]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(e,t,n)=>t||n.slice(1))})};isValid=e=>null!=e&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>this.setLocaleToValue(e).format(t);formatNumber=e=>e;isEqual=(e,t)=>null===e&&null===t||null!==e&&null!==t&&e.toDate().getTime()===t.toDate().getTime();isSameYear=(e,t)=>this.isSame(e,t,"YYYY");isSameMonth=(e,t)=>this.isSame(e,t,"YYYY-MM");isSameDay=(e,t)=>this.isSame(e,t,"YYYY-MM-DD");isSameHour=(e,t)=>e.isSame(t,"hour");isAfter=(e,t)=>e>t;isAfterYear=(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()>t.utc():e.isAfter(t,"year");isAfterDay=(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()>t.utc():e.isAfter(t,"day");isBefore=(e,t)=>e<t;isBeforeYear=(e,t)=>this.hasUTCPlugin()?!this.isSameYear(e,t)&&e.utc()<t.utc():e.isBefore(t,"year");isBeforeDay=(e,t)=>this.hasUTCPlugin()?!this.isSameDay(e,t)&&e.utc()<t.utc():e.isBefore(t,"day");isWithinRange=(e,[t,n])=>e>=t&&e<=n;startOfYear=e=>this.adjustOffset(e.startOf("year"));startOfMonth=e=>this.adjustOffset(e.startOf("month"));startOfWeek=e=>this.adjustOffset(this.setLocaleToValue(e).startOf("week"));startOfDay=e=>this.adjustOffset(e.startOf("day"));endOfYear=e=>this.adjustOffset(e.endOf("year"));endOfMonth=e=>this.adjustOffset(e.endOf("month"));endOfWeek=e=>this.adjustOffset(this.setLocaleToValue(e).endOf("week"));endOfDay=e=>this.adjustOffset(e.endOf("day"));addYears=(e,t)=>this.adjustOffset(e.add(t,"year"));addMonths=(e,t)=>this.adjustOffset(e.add(t,"month"));addWeeks=(e,t)=>this.adjustOffset(e.add(t,"week"));addDays=(e,t)=>this.adjustOffset(e.add(t,"day"));addHours=(e,t)=>this.adjustOffset(e.add(t,"hour"));addMinutes=(e,t)=>this.adjustOffset(e.add(t,"minute"));addSeconds=(e,t)=>this.adjustOffset(e.add(t,"second"));getYear=e=>e.year();getMonth=e=>e.month();getDate=e=>e.date();getHours=e=>e.hour();getMinutes=e=>e.minute();getSeconds=e=>e.second();getMilliseconds=e=>e.millisecond();setYear=(e,t)=>this.adjustOffset(e.set("year",t));setMonth=(e,t)=>this.adjustOffset(e.set("month",t));setDate=(e,t)=>this.adjustOffset(e.set("date",t));setHours=(e,t)=>this.adjustOffset(e.set("hour",t));setMinutes=(e,t)=>this.adjustOffset(e.set("minute",t));setSeconds=(e,t)=>this.adjustOffset(e.set("second",t));setMilliseconds=(e,t)=>this.adjustOffset(e.set("millisecond",t));getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{const t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e));let r=0,o=t;const i=[];for(;o<n;){const e=Math.floor(r/7);i[e]=i[e]||[],i[e].push(o),o=this.addDays(o,1),r+=1}return i};getWeekNumber=e=>e.week();getDayOfWeek(e){return e.day()+1}getYearRange=([e,t])=>{const n=this.startOfYear(e),r=this.endOfYear(t),o=[];let i=n;for(;this.isBefore(i,r);)o.push(i),i=this.addYears(i,1);return o}}const fQ=({providersData:e,rootProvider:t,savedFilters:n={},onSaveFilter:r,onRemoveFilter:o,existingDimensions:i=[],existingMetrics:a=[],titleOverrides:l={},onUpdateTitle:u,onResetTitle:d})=>{const p=SR(),[f,h]=s.useState(!1),[m,g]=s.useState([]),[v,b]=s.useState(""),[y,w]=s.useState([]),[x,S]=s.useState([]),[C,k]=s.useState(!1),[E,R]=s.useState(null),[P,M]=s.useState(null),[T,I]=s.useState(null),[O,D]=s.useState(null),[F,L]=s.useState("");s.useEffect(()=>{b(""),w([]),S([]),M(null),I(null)},[m]);const A=e=>e&&("date"===e.type||"timestamp"===e.type),N=()=>{const n=t?0===m.length?t:m[m.length-1].targetKey:null;if(!n||!e||!e[n])return[];const r=e[n];if(!r.dimensions)return[];const o=[];return Object.keys(r.dimensions).forEach(e=>{const t=r.dimensions[e];Object.keys(t).forEach(r=>{const i=t[r];(e=>!!e.column&&/^[a-zA-Z0-9_.]+$/.test(e.column))(i)&&o.push({key:`${n}_${e}.${r}`,value:i.title||r,dimensionKey:r,alias:e,dimension:i})})}),o},$=()=>{h(!1),g([]),b(""),w([]),S([]),M(null),I(null),R(null)},z=()=>{R(null),w([]),S([]),M(null),I(null)},j=e=>{const t=F.trim();""!==t?(u(e,t),D(null),L("")):B()},B=()=>{D(null),L("")},_=async e=>{k(!0);try{const n={provider:t,doc:{query:{dimensions:[e],metrics:[],order_by:[{name:e}]}},parameters:p?.parameters||{base_currency:"EUR"}};console.log("Fetching filter values with payload:",n);const r=await jc.runAdHocReport({report:n});console.log("Filter values results:",r);const o=(Array.isArray(r)?r:r.data||[]).map(t=>{let n=t[e];if(void 0===n){n=t[e.replace(/\./g,"_")]}if(void 0===n){const e=Object.keys(t);e.length>0&&(n=t[e[0]])}return{key:String(n),value:String(n)}});console.log("Transformed distinct values:",o),w(o)}catch(e){console.error("Error fetching filter values:",e),w([])}finally{k(!1)}},H=e=>{const n=[t];return e.relationNames&&e.relationNames.length>0&&n.push(...e.relationNames),n.join(" → ")},V=Object.entries(n);return c.createElement("div",null,c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:2,marginBottom:2}},f?c.createElement(c.Fragment,null,c.createElement(Xw,{variant:"outlined",onClick:$},"Cancel"),c.createElement(Xw,{variant:"contained",onClick:()=>{const n=N().find(e=>e.key===v);if(!n)return;const o=A(n.dimension);if(o){if(!P&&!T)return}else if(0===x.length)return;if(!v)return;const i=[],a=[t],l=[];let s=t;m.forEach(t=>{const n=e[s];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&(i.push(e),l.push(e.name))}a.push(t.targetKey),s=t.targetKey});const c=[e[t].default_alias];i.forEach(e=>{c.push(e.alias)});const u=`${c.join("_")}.${n.dimensionKey}`;let d;o?(d={},P&&(d.gte=P.format("YYYY-MM-DD")),T&&(d.lte=T.format("YYYY-MM-DD"))):d=x;const p={dimension:n.dimension,relations:i,providerPath:a,relationNames:l,dimensionKey:n.dimensionKey,dimensionTitle:n.value,fullPath:u,values:d};r(u,p),$()},disabled:(()=>{if(!v)return!0;const e=N().find(e=>e.key===v);if(!e)return!0;return A(e.dimension)?!P&&!T:0===x.length})()},"Save Filter")):c.createElement(Xw,{variant:"contained",onClick:()=>{h(!0),g([]),b(""),w([]),S([]),M(null),I(null),R(null)}},"Add Filter")),f&&c.createElement(qg,{sx:{padding:3,marginBottom:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Select Provider Path"),c.createElement(kH,{providersData:e,rootProvider:t,onSelectionChange:g,existingDimensions:i,existingMetrics:a,existingFilters:n}),c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},"Select Dimension for Filter"),c.createElement(uR,{items:N(),value:v,label:"Choose Dimension",onChange:n=>{const r=n.target.value;if(b(r),S([]),M(null),I(null),r){const n=N().find(e=>e.key===r);if(n){if(!A(n.dimension)){const r=[];let o=t;m.forEach(t=>{const n=e[o];if(n&&n.relations){const e=n.relations.find(e=>e.name===t.relationName);e&&r.push(e)}o=t.targetKey});const i=[e[t].default_alias];r.forEach(e=>{i.push(e.alias)});const a=`${i.join("_")}.${n.dimensionKey}`;_(a)}}}else w([])},sx:{width:"400px"}}),v&&(()=>{const e=N().find(e=>e.key===v),t=e&&A(e.dimension);return c.createElement(c.Fragment,null,c.createElement(Gv,{variant:"h6",sx:{marginTop:3,marginBottom:2}},t?"Select Date Range":"Select Filter Values"),t?c.createElement(mU,{dateAdapter:pQ},c.createElement(jw,{sx:{display:"flex",gap:2,width:"400px"}},c.createElement($X,{label:"From Date",value:P,onChange:e=>M(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}),c.createElement($X,{label:"To Date",value:T,onChange:e=>I(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}))):c.createElement(jw,{sx:{width:"400px"}},c.createElement(sR,{items:y,selectedKeys:x,onChange:e=>S(e),label:"Choose Values",placeholder:"Select one or more values...",loading:C,helperText:x.length>0?`${x.length} value(s) selected`:"Select at least one value"})))})()),V.length>0&&c.createElement(jw,{sx:{marginTop:3}},c.createElement(Gv,{variant:"h6",sx:{marginBottom:2}},"Saved Filters"),c.createElement(jw,{sx:{display:"flex",flexDirection:"column",gap:2}},V.map(([e,t])=>{const i=A(t.dimension),a=E===e,s=O===e;let u,p,f;i&&t.values&&"object"==typeof t.values&&!Array.isArray(t.values)?(p=t.values.gte&&t.values.lte?`${t.values.gte} to ${t.values.lte}`:t.values.gte?`From ${t.values.gte}`:t.values.lte?`Until ${t.values.lte}`:"No dates",f="📅"):(u=t.values?.length||0,p=t.values?.join(", ")||"No values",f=u);const m=l[e]||t.dimensionTitle,g=!!l[e];return c.createElement(jw,{key:e},c.createElement(jw,{sx:{display:"flex",alignItems:"center",gap:1,marginBottom:a?2:0}},s?c.createElement(c.Fragment,null,c.createElement(qE,{value:F,onChange:e=>L(e.target.value),onKeyDown:t=>((e,t)=>{"Enter"===e.key?j(t):"Escape"===e.key&&B()})(t,e),size:"small",autoFocus:!0,placeholder:"Enter custom title",sx:{width:"300px"}}),c.createElement(Hk,{title:"Save",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>j(e),color:"primary"},c.createElement(oU,{fontSize:"small"}))),c.createElement(Hk,{title:"Cancel",arrow:!0},c.createElement(Mv,{size:"small",onClick:B,color:"default"},c.createElement(iU,{fontSize:"small"}))),g&&c.createElement(Hk,{title:"Reset to default",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>(e=>{d(e),D(null),L("")})(e),color:"warning"},c.createElement(aU,{fontSize:"small"})))):c.createElement(c.Fragment,null,c.createElement(Hk,{title:c.createElement("div",null,c.createElement("div",null,c.createElement("strong",null,"Path:")," ",H(t)," → ",t.dimensionTitle),c.createElement("div",null,c.createElement("strong",null,"Full Path:")," ",e),c.createElement("div",null,c.createElement("strong",null,i?"Date Range":`Values (${u})`,":")," ",p)),arrow:!0,placement:"top"},c.createElement(Nw,{badgeContent:f,color:"secondary"},c.createElement(zy,{label:m,onDelete:()=>o(e),color:"secondary",variant:"outlined",sx:{fontWeight:g?"bold":"normal",fontStyle:g?"italic":"normal"}}))),c.createElement(Hk,{title:"Rename filter",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>((e,t)=>{D(e),L(l[e]||t||"")})(e,t.dimensionTitle),color:"primary",disabled:a},c.createElement(mH,{fontSize:"small"}))),c.createElement(Hk,{title:"Edit filter values",arrow:!0},c.createElement(Mv,{size:"small",onClick:()=>(async(e,t)=>{h(!1),R(e),A(t.dimension)?t.values&&"object"==typeof t.values&&!Array.isArray(t.values)&&(M(t.values.gte?HX(t.values.gte):null),I(t.values.lte?HX(t.values.lte):null)):(S(t.values||[]),await _(e))})(e,t),color:"primary",disabled:a},c.createElement(pU,{fontSize:"small"}))))),a&&c.createElement(qg,{sx:{padding:2,marginLeft:2}},c.createElement(Gv,{variant:"subtitle2",sx:{marginBottom:1}},"Edit Filter ",i?"Date Range":"Values"," for: ",t.dimensionTitle),i?c.createElement(mU,{dateAdapter:pQ},c.createElement(jw,{sx:{display:"flex",gap:2,width:"400px",marginBottom:2}},c.createElement($X,{label:"From Date",value:P,onChange:e=>M(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}),c.createElement($X,{label:"To Date",value:T,onChange:e=>I(e),slotProps:{textField:{size:"small",fullWidth:!0},field:{clearable:!0}}}))):c.createElement(jw,{sx:{width:"400px",marginBottom:2}},c.createElement(sR,{items:y,selectedKeys:x,onChange:e=>S(e),label:"Choose Values",placeholder:"Select one or more values...",loading:C,helperText:x.length>0?`${x.length} value(s) selected`:"Select at least one value"})),c.createElement(jw,{sx:{display:"flex",gap:1}},c.createElement(Xw,{variant:"outlined",size:"small",onClick:z},"Cancel"),c.createElement(Xw,{variant:"contained",size:"small",onClick:()=>(e=>{const t=n[e];if(A(t.dimension)){if(!P&&!T)return;const n={};P&&(n.gte=P.format("YYYY-MM-DD")),T&&(n.lte=T.format("YYYY-MM-DD"));const o={...t,values:n};r(e,o)}else{if(0===x.length)return;const n={...t,values:x};r(e,n)}R(null),w([]),S([]),M(null),I(null)})(e),disabled:i?!P&&!T:0===x.length},"Save Changes"))))}))))},hQ=({reportData:e,dimensions:t,metrics:n,loading:r,onPageChange:o,totalRows:i=0,titleOverrides:a={dimensions:{},metrics:{}}})=>{const[l,u]=s.useState({page:0,pageSize:50}),d=c.useMemo(()=>{const e=[];return t.forEach(t=>{let n,r;if(t.relations&&t.relations.length>0){const e=t.fullPath.split("."),r=e[0],o=e[1],i=r.split("_");i.shift();const a=i.join("_");n=a?`${a}_${o}`:o}else n=t.fullPath.replace(".","_");r=a.dimensions[t.fullPath]||t.dimensionTitle||n,e.push({field:n,headerName:r,flex:1,minWidth:150})}),n.forEach(t=>{const n=t.metric;let r,o;if(t.relations&&t.relations.length>0){const e=t.fullPath.split("."),n=e[0],o=e[1],i=n.split("_");i.shift();const a=i.join("_");r=a?`${a}_${o}`:o}else r=t.metricName;o=a.metrics[t.fullPath]||t.metricTitle||r,e.push({field:r,headerName:o,flex:1,minWidth:150,type:"integer"===n?.type||"currency"===n?.type?"number":"string",valueFormatter:e=>{if(null==e)return"";if(n?.format){const t=pl(e).format(n.format);return n?.prefix?`${n.prefix} ${t}`:t}return e}})}),e},[t,n,a]),p=c.useMemo(()=>e&&Array.isArray(e)?e.map((e,t)=>({id:t,...e})):[],[e]);return r?c.createElement(jw,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400},c.createElement(Cv,null)):e&&0!==e.length?c.createElement(jw,{sx:{height:600,width:"100%"}},c.createElement(fH,{rows:p,columns:d,paginationModel:l,onPaginationModelChange:e=>{u(e),o&&e.page!==l.page&&o(e.page,e.pageSize)},pageSizeOptions:[10,25,50,100],paginationMode:"server",rowCount:i||p.length,loading:r,disableRowSelectionOnClick:!0,sx:{"& .MuiDataGrid-cell":{padding:"8px"},"& .MuiDataGrid-columnHeader":{backgroundColor:"#f5f5f5",fontWeight:"bold"}}})):c.createElement(jw,{display:"flex",justifyContent:"center",alignItems:"center",minHeight:400},c.createElement(Gv,{variant:"body1",color:"textSecondary"},"No data available. Run a report to see results."))};function mQ({children:e,value:t,index:n}){return c.createElement("div",{role:"tabpanel",hidden:t!==n,id:`report-tabpanel-${n}`,"aria-labelledby":`report-tab-${n}`},t===n&&c.createElement(jw,{sx:{py:3}},e))}const gQ=({reportDefinitionId:e,cloneData:t,autoRun:n,onBackToList:r})=>{const o=ER(),i=SR(),[a,l]=s.useState(null),[u,d]=s.useState(""),[p,f]=s.useState(""),[h,m]=s.useState({dimensions:[],metrics:[],filters:{}}),[g,v]=s.useState({dimensions:{},metrics:{},filters:{}}),[b,y]=s.useState(null),[w,x]=s.useState(!1),[S,C]=s.useState(0),[k,E]=s.useState(0),[R,P]=s.useState(50),[M,T]=s.useState(0),[I,O]=s.useState(!1),[D,F]=s.useState(!1);s.useEffect(()=>{(async()=>{const e=await jc.getProviders();console.log({providers:e}),l(e)})()},[]),s.useEffect(()=>{e&&a&&N(e)},[e,a]),s.useEffect(()=>{t&&a&&$(t)},[t,a]),s.useEffect(()=>{n&&D&&u&&h.dimensions.length>0&&B()},[n,D]);const L=(e,t,n)=>{try{const[r,o]=e.split("."),i=r.split("_");let a=n;const l=[],s=[n],c=[];for(let e=1;e<i.length;e++){const n=i[e],r=t[a];if(!r||!r.relations)return console.warn(`Provider ${a} not found or has no relations`),null;const o=r.relations.find(e=>e.alias===n);if(!o)return console.warn(`Relation with alias ${n} not found in provider ${a}`),null;l.push(o),c.push(o.name),a=o.target,s.push(a)}const u=t[a];if(!u)return console.warn(`Final provider ${a} not found`),null;const d=u.default_alias;if(!u.dimensions||!u.dimensions[d])return console.warn(`Dimensions not found for alias ${d} in provider ${a}`),null;const p=u.dimensions[d][o];return p?{dimension:p,relations:l,providerPath:s,relationNames:c,dimensionKey:o,dimensionTitle:p.title||o,fullPath:e}:(console.warn(`Dimension ${o} not found in provider ${a}, alias ${d}`),null)}catch(t){return console.warn(`Error reconstructing dimension from path ${e}:`,t),null}},A=(e,t,n)=>{try{const[r,o]=e.split("."),i=r.split("_");let a=n;const l=[],s=[n],c=[];for(let e=1;e<i.length;e++){const n=i[e],r=t[a];if(!r||!r.relations)return console.warn(`Provider ${a} not found or has no relations`),null;const o=r.relations.find(e=>e.alias===n);if(!o)return console.warn(`Relation with alias ${n} not found in provider ${a}`),null;l.push(o),c.push(o.name),a=o.target,s.push(a)}const u=t[a];if(!u)return console.warn(`Final provider ${a} not found`),null;if(!u.metrics)return console.warn(`Metrics not found in provider ${a}`),null;const d=u.metrics.find(e=>e.name===o);return d?{metric:d,relations:l,providerPath:s,relationNames:c,metricName:o,metricTitle:d.title||o,fullPath:e}:(console.warn(`Metric ${o} not found in provider ${a}`),null)}catch(t){return console.warn(`Error reconstructing metric from path ${e}:`,t),null}},N=async e=>{try{console.log("Loading report definition:",e);const t=await jc.getReportDefinition({id:e});console.log("Loaded report definition:",t),d(t.provider),f(t.title||"");const n=[],r={};if(t.definition?.doc?.query?.order_by)for(const e of t.definition.doc.query.order_by)!0===e.desc?r[e.name]="desc":r[e.name]="asc";if(t.definition?.doc?.query?.dimensions)for(const e of t.definition.doc.query.dimensions){const o=L(e,a,t.provider);o&&(o.sortOrder=r[e]||null,n.push(o))}const o=[];if(t.definition?.doc?.query?.metrics)for(const e of t.definition.doc.query.metrics){const n=A(e,a,t.provider);n&&o.push(n)}const i={dimensions:{},metrics:{},filters:{}};t.definition?.doc?.query?.titles&&(t.definition.doc.query.titles.dimensions&&(i.dimensions=t.definition.doc.query.titles.dimensions),t.definition.doc.query.titles.metrics&&(i.metrics=t.definition.doc.query.titles.metrics),t.definition.doc.query.titles.filters&&(i.filters=t.definition.doc.query.titles.filters));const l={};if(t.definition?.doc?.query?.filter){const e=t.definition.doc.query.filter;(e.and||e.or||[]).forEach(e=>{const[n,r]=Object.entries(e)[0],o=L(n,a,t.provider);o&&(l[n]={...o,values:r})})}m({dimensions:n,metrics:o,filters:l}),v(i),F(!0),console.log("Reconstructed report:",{dimensions:n,metrics:o,filters:l,titleOverrides:i})}catch(e){console.error("Error loading report definition:",e),o.error("Error loading report definition: "+(e.message||"Unknown error"))}},$=e=>{try{console.log("Loading cloned report:",e),d(e.provider),f(e.title||"");const t=[],n={};if(e.definition?.doc?.query?.order_by)for(const t of e.definition.doc.query.order_by)!0===t.desc?n[t.name]="desc":n[t.name]="asc";if(e.definition?.doc?.query?.dimensions)for(const r of e.definition.doc.query.dimensions){const o=L(r,a,e.provider);o&&(o.sortOrder=n[r]||null,t.push(o))}const r=[];if(e.definition?.doc?.query?.metrics)for(const t of e.definition.doc.query.metrics){const n=A(t,a,e.provider);n&&r.push(n)}const o={dimensions:{},metrics:{},filters:{}};e.definition?.doc?.query?.titles&&(e.definition.doc.query.titles.dimensions&&(o.dimensions=e.definition.doc.query.titles.dimensions),e.definition.doc.query.titles.metrics&&(o.metrics=e.definition.doc.query.titles.metrics),e.definition.doc.query.titles.filters&&(o.filters=e.definition.doc.query.titles.filters));const i={};if(e.definition?.doc?.query?.filter){const t=e.definition.doc.query.filter;(t.and||t.or||[]).forEach(t=>{const[n,r]=Object.entries(t)[0],o=L(n,a,e.provider);o&&(i[n]={...o,values:r})})}m({dimensions:t,metrics:r,filters:i}),v(o),console.log("Loaded cloned report:",{dimensions:t,metrics:r,filters:i,titleOverrides:o})}catch(e){console.error("Error loading cloned report:",e),o.error("Error loading cloned report: "+(e.message||"Unknown error"))}},z=(e=0,t=50)=>{const n=h.dimensions.map(e=>{const t={name:e.fullPath};return"desc"===e.sortOrder&&(t.desc=!0),t}),r=[];h.filters&&Object.keys(h.filters).length>0&&Object.entries(h.filters).forEach(([e,t])=>{t.values&&(Array.isArray(t.values)?t.values.length>0&&r.push({[e]:t.values}):"object"==typeof t.values&&r.push({[e]:t.values}))});const o=r.length>0?{and:r}:null,a={};Object.keys(g.dimensions).length>0&&(a.dimensions=g.dimensions),Object.keys(g.metrics).length>0&&(a.metrics=g.metrics),Object.keys(g.filters).length>0&&(a.filters=g.filters);const l={dimensions:h.dimensions.map(e=>e.fullPath),metrics:h.metrics.map(e=>e.fullPath),order_by:n,limit:t,offset:e*t};Object.keys(a).length>0&&(l.titles=a),o&&(l.filter=o);return{provider:u,doc:{query:l},parameters:i?.parameters||{base_currency:"EUR"}}},j=async(e,t)=>{try{x(!0);const n=z(e,t);console.log("Running report with:",n);const r=await jc.runAdHocReport({report:n});console.log("Report result:",r),y(r),r&&r.length<t?C(e*t+r.length):C((e+2)*t)}catch(e){console.error("Error running report:",e),o.error("Error running report: "+(e.message||"Unknown error")),y(null)}finally{x(!1)}},B=async()=>{E(0),await j(0,R),T(3)},_=u,H=u&&p.trim()&&(h.dimensions.length>0||h.metrics.length>0);return c.createElement(jw,{sx:{p:3}},c.createElement(jw,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2}},c.createElement("h1",null,e?"Edit Report":"Create New Report"),r&&c.createElement(Xw,{variant:"outlined",startIcon:c.createElement(xH,null),onClick:r},"Back to List")),c.createElement(jw,{sx:{mt:2,display:"flex",gap:2,alignItems:"flex-start",flexWrap:"wrap"}},c.createElement(qE,{label:"Report Title",value:p,onChange:e=>f(e.target.value),placeholder:"Enter report title",sx:{width:"300px"},size:"small"}),c.createElement(uR,{items:a?Object.keys(a).filter(e=>!0===a[e].base).map(e=>({key:e,value:a[e].name||e})):[],value:u,label:"Select Root Provider",onChange:e=>{d(e.target.value),m({dimensions:[],metrics:[],filters:{}}),v({dimensions:{},metrics:{},filters:{}}),console.log("Selected root provider:",e.target.value)},sx:{width:"300px"},disabled:!!e}),c.createElement(Xw,{variant:"contained",onClick:B,disabled:!_,sx:{height:"40px"}},"Run Report"),c.createElement(Xw,{variant:"contained",color:"secondary",startIcon:c.createElement(CH,null),onClick:async()=>{try{x(!0);const e=z();console.log("Downloading report with:",e);const t=(new Date).toISOString().split("T")[0],n=`${(p||"report").replace(/[^a-z0-9]/gi,"_").toLowerCase()}_${t}.csv`;await jc.downloadAdHocReport({report:e,filename:n}),o.success("Report downloaded successfully!")}catch(e){console.error("Error downloading report:",e),o.error("Error downloading report: "+(e.message||"Unknown error"))}finally{x(!1)}},disabled:!_||w,sx:{height:"40px"}},"Download CSV"),c.createElement(Xw,{variant:"contained",color:"success",startIcon:c.createElement(SH,null),onClick:async()=>{if(u)if(p.trim())if(0!==h.dimensions.length||0!==h.metrics.length)try{O(!0);const t=h.dimensions.map(e=>{const t={name:e.fullPath};return"desc"===e.sortOrder&&(t.desc=!0),t}),n={};Object.keys(g.dimensions).length>0&&(n.dimensions=g.dimensions),Object.keys(g.metrics).length>0&&(n.metrics=g.metrics),Object.keys(g.filters).length>0&&(n.filters=g.filters);const i={dimensions:h.dimensions.map(e=>e.fullPath),metrics:h.metrics.map(e=>e.fullPath),order_by:t};if(Object.keys(n).length>0&&(i.titles=n),Object.keys(h.filters).length>0){const e=[];Object.entries(h.filters).forEach(([t,n])=>{n.values&&(Array.isArray(n.values)?n.values.length>0&&e.push({[t]:n.values}):"object"==typeof n.values&&e.push({[t]:n.values}))}),e.length>0&&(i.filter={and:e})}const a={query:i},l={provider:u,title:p.trim(),definition:{provider:u,doc:a,parameters:{base_currency:"EUR"}}};console.log("Saving report definition:",l),e?(await jc.updateReportDefinition({id:e,reportDefinition:l}),o.success("Report definition updated successfully!")):(await jc.createReportDefinition({reportDefinition:l}),o.success("Report definition created successfully!")),r&&r()}catch(e){console.error("Error saving report definition:",e),o.error("Error saving report definition: "+(e.message||"Unknown error"))}finally{O(!1)}else o.warning("Please add at least one dimension or metric");else o.warning("Please enter a report title");else o.warning("Please select a provider first")},disabled:!H||I,sx:{height:"40px"}},I?"Saving...":e?"Update Report":"Save Report")),u&&c.createElement(jw,{sx:{mt:4}},c.createElement(jw,{sx:{borderBottom:1,borderColor:"divider"}},c.createElement(WE,{value:M,onChange:(e,t)=>{T(t)},"aria-label":"report builder tabs"},c.createElement(Jk,{label:c.createElement(Nw,{badgeContent:h.dimensions.length,color:"primary"},c.createElement("span",{style:{marginRight:h.dimensions.length>0?"12px":"0"}},"Dimensions")),id:"report-tab-0","aria-controls":"report-tabpanel-0"}),c.createElement(Jk,{label:c.createElement(Nw,{badgeContent:h.metrics.length,color:"primary"},c.createElement("span",{style:{marginRight:h.metrics.length>0?"12px":"0"}},"Metrics")),id:"report-tab-1","aria-controls":"report-tabpanel-1"}),c.createElement(Jk,{label:c.createElement(Nw,{badgeContent:Object.keys(h.filters).length,color:"secondary"},c.createElement("span",{style:{marginRight:Object.keys(h.filters).length>0?"12px":"0"}},"Filters")),id:"report-tab-2","aria-controls":"report-tabpanel-2"}),c.createElement(Jk,{label:b?"Results":"Results (Run report first)",id:"report-tab-3","aria-controls":"report-tabpanel-3",disabled:!b}))),c.createElement(mQ,{value:M,index:0},c.createElement(cU,{providersData:a,rootProvider:u,savedDimensions:h.dimensions,onSaveDimension:e=>{m(t=>{const n={...t,dimensions:[...t.dimensions,e]};return console.log("Dimension saved:",e),console.log("Complete report:",n),n})},onRemoveDimension:e=>{m(t=>({...t,dimensions:t.dimensions.filter((t,n)=>n!==e)}))},onReorderDimensions:e=>{m(t=>({...t,dimensions:e}))},titleOverrides:g.dimensions,onUpdateTitle:(e,t)=>{v(n=>({...n,dimensions:{...n.dimensions,[e]:t}}))},onResetTitle:e=>{v(t=>{const n={...t.dimensions};return delete n[e],{...t,dimensions:n}})},existingMetrics:h.metrics,existingFilters:h.filters})),c.createElement(mQ,{value:M,index:1},c.createElement(dU,{providersData:a,rootProvider:u,savedMetrics:h.metrics,onSaveMetric:e=>{m(t=>{const n={...t,metrics:[...t.metrics,e]};return console.log("Metric saved:",e),console.log("Complete report:",n),n})},onRemoveMetric:e=>{m(t=>({...t,metrics:t.metrics.filter((t,n)=>n!==e)}))},onReorderMetrics:e=>{m(t=>({...t,metrics:e}))},titleOverrides:g.metrics,onUpdateTitle:(e,t)=>{v(n=>({...n,metrics:{...n.metrics,[e]:t}}))},onResetTitle:e=>{v(t=>{const n={...t.metrics};return delete n[e],{...t,metrics:n}})},existingDimensions:h.dimensions,existingFilters:h.filters})),c.createElement(mQ,{value:M,index:2},c.createElement(fQ,{providersData:a,rootProvider:u,savedFilters:h.filters,existingDimensions:h.dimensions,existingMetrics:h.metrics,onSaveFilter:(e,t)=>{m(n=>{const r={...n,filters:{...n.filters,[e]:t}};return console.log("Filter saved:",{fullPath:e,filterData:t}),console.log("Complete report:",r),r})},onRemoveFilter:e=>{m(t=>{const n={...t.filters};return delete n[e],{...t,filters:n}})},titleOverrides:g.filters,onUpdateTitle:(e,t)=>{v(n=>({...n,filters:{...n.filters,[e]:t}}))},onResetTitle:e=>{v(t=>{const n={...t.filters};return delete n[e],{...t,filters:n}})}})),c.createElement(mQ,{value:M,index:3},b&&c.createElement(hQ,{reportData:b,dimensions:h.dimensions,metrics:h.metrics,loading:w,onPageChange:async(e,t)=>{E(e),t!==R&&P(t),await j(e,t)},totalRows:S,titleOverrides:g}))))},vQ=()=>{const[e,t]=s.useState("list"),[n,r]=s.useState(null),[o,i]=s.useState(null),[a,l]=s.useState(!1),[u,d]=s.useState(0),p=e=>{r(e),i(null),l(!1),t("builder")},f=()=>{r(null),i(null),l(!1),t("builder")},h=e=>{r(e),i(null),l(!0),t("builder")},m=e=>{r(null),i(e),l(!1),t("builder")};return"list"===e?c.createElement(wH,{onSelectReport:p,onAddNew:f,onCloneReport:m,onRunReport:h,refreshTrigger:u}):c.createElement(gQ,{reportDefinitionId:n,cloneData:o,autoRun:a,onBackToList:()=>{r(null),i(null),l(!1),t("list"),d(e=>e+1)}})};var bQ={Chart:yR,Dashboard:function({id:e="sample_dashboard",api:t,params:n}){const r=SR(),o=t||r?.api||{},i=n||r?.parameters||{},[a,l]=c.useState(),[u]=c.useState(),[d,p]=c.useState([]),f=c.useRef({}),h=vR();bR(h),console.log({rows:d},{dashboard:a},{schema:u},{params:i}),s.useEffect(()=>{jc.setBaseUrl(o.base_url),jc.setToken(o.token)},[o]);const m=async e=>{const t=e?.doc?.rows||[],n=[];for(let e=0;e<t.length;e++){const r=t[e];r.columns?.forEach(e=>{if(e.override?.filter?.length){const t={};e.override.filter.forEach(e=>{e.hasOwnProperty("value")&&(t[e.field]=[e.value])}),e.filter=t}}),n.push(r)}p(n)};return c.useEffect(()=>{e&&(async()=>{jc.setBaseUrl(o.base_url),jc.setToken(o.token),await jc.loadDashboardMeta({dashboardId:e});const t=await jc.getDashboard({id:e});f.current[t?.id]=t,l(t),await m(t)})().catch(e=>console.error(e.message))},[e]),c.createElement(mi,{maxWidth:!1,disableGutters:!0},c.createElement(qi,{container:!0,spacing:3},d?.map((e,t)=>{const n=(e=>0===e?12:12/e)(e.columns.length);return c.createElement(c.Fragment,{key:t},1===t?c.createElement(qi,{item:!0,xs:12},c.createElement(qi,{container:!0,spacing:3},e.columns.map((e,t)=>c.createElement(qi,{key:t,item:!0,xs:12,md:n},c.createElement(yR,{api:o,cache:f.current,id:e.id,dashboard:a,schema:u,title:e.title,filter:e.filter,params:i}))))):e.columns.map((e,t)=>c.createElement(qi,{key:t,item:!0,xs:12,md:n},c.createElement(yR,{api:o,cache:f.current,id:e.id,dashboard:a,schema:u,title:e.title,filter:e.filter,params:i}))))})))},ReportApp:({params:e,api:t})=>(jc._initialized||(jc.setBaseUrl(t.base_url),jc.setToken(t.token),jc._initialized=!0),s.useEffect(()=>{jc.setBaseUrl(t.base_url),jc.setToken(t.token)},[t]),c.createElement(kR,null,c.createElement(xR,{defaultParameters:e,defaultApi:t},c.createElement(vQ,null))))};return bQ}();
|