@riddix/hamh 2.1.0-alpha.793 → 2.1.0-alpha.795
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.
|
@@ -145,7 +145,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
145
145
|
animation: ${Ih} 1.4s linear infinite;
|
|
146
146
|
`,Hte=typeof Lh==`string`?null:dd`
|
|
147
147
|
animation: ${Lh} 1.4s ease-in-out infinite;
|
|
148
|
-
`,Ute=e=>{let{classes:t,variant:n,color:r,disableShrink:i}=e;return Cp({root:[`root`,n,`color${Y(r)}`],svg:[`svg`],track:[`track`],circle:[`circle`,`circle${Y(n)}`,i&&`circleDisableShrink`]},Bte,t)},Wte=J(`span`,{name:`MuiCircularProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({display:`inline-block`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`transform`)}},{props:{variant:`indeterminate`},style:Vte||{animation:`${Ih} 1.4s linear infinite`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))]}))),Gte=J(`svg`,{name:`MuiCircularProgress`,slot:`Svg`})({display:`block`}),Kte=J(`circle`,{name:`MuiCircularProgress`,slot:`Circle`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.circle,t[`circle${Y(n.variant)}`],n.disableShrink&&t.circleDisableShrink]}})(Fm(({theme:e})=>({stroke:`currentColor`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`stroke-dashoffset`)}},{props:{variant:`indeterminate`},style:{strokeDasharray:`80px, 200px`,strokeDashoffset:0}},{props:({ownerState:e})=>e.variant===`indeterminate`&&!e.disableShrink,style:Hte||{animation:`${Lh} 1.4s ease-in-out infinite`}}]}))),qte=J(`circle`,{name:`MuiCircularProgress`,slot:`Track`})(Fm(({theme:e})=>({stroke:`currentColor`,opacity:(e.vars||e).palette.action.activatedOpacity}))),Rh=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCircularProgress`}),{className:r,color:i=`primary`,disableShrink:a=!1,enableTrackSlot:o=!1,size:s=40,style:c,thickness:l=3.6,value:u=0,variant:d=`indeterminate`,...f}=n,p={...n,color:i,disableShrink:a,size:s,thickness:l,value:u,variant:d,enableTrackSlot:o},m=Ute(p),h={},g={},_={};if(d===`determinate`){let e=2*Math.PI*((Fh-l)/2);h.strokeDasharray=e.toFixed(3),_[`aria-valuenow`]=Math.round(u),h.strokeDashoffset=`${((100-u)/100*e).toFixed(3)}px`,g.transform=`rotate(-90deg)`}return(0,G.jsx)(Wte,{className:K(m.root,r),style:{width:s,height:s,...g,...c},ownerState:p,ref:t,role:`progressbar`,..._,...f,children:(0,G.jsxs)(Gte,{className:m.svg,ownerState:p,viewBox:`${Fh/2} ${Fh/2} ${Fh} ${Fh}`,children:[o?(0,G.jsx)(qte,{className:m.track,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l,"aria-hidden":`true`}):null,(0,G.jsx)(Kte,{className:m.circle,style:h,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l})]})})});function Jte(e){return Jd(`MuiIconButton`,e)}var zh=Yd(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),Yte=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return Cp({root:[`root`,o&&`loading`,n&&`disabled`,r!=="default"&&`color${Y(r)}`,i&&`edge${Y(i)}`,`size${Y(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},Jte,t)},Xte=J(Nh,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${Y(n.color)}`],n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})(Fm(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),Fm(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${zh.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${zh.loading}`]:{color:`transparent`}}))),Zte=J(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),Bh=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=rh(u),h=f??(0,G.jsx)(Rh,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=Yte(g);return(0,G.jsxs)(Xte,{id:d?m:u,className:K(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,G.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,G.jsx)(Zte,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),Qte=X((0,G.jsx)(`path`,{d:`M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z`}),`SuccessOutlined`),$te=X((0,G.jsx)(`path`,{d:`M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z`}),`ReportProblemOutlined`),ene=X((0,G.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.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`}),`ErrorOutline`),tne=X((0,G.jsx)(`path`,{d:`M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z`}),`InfoOutlined`),Vh=X((0,G.jsx)(`path`,{d:`M19 6.41L17.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`}),`Close`),nne=e=>{let{variant:t,color:n,severity:r,classes:i}=e;return Cp({root:[`root`,`color${Y(n||r)}`,`${t}${Y(n||r)}`,`${t}`],icon:[`icon`],message:[`message`],action:[`action`]},dte,i)},rne=J(Wm,{name:`MuiAlert`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color||n.severity)}`]]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.darken:e.lighten,n=e.palette.mode===`light`?e.lighten:e.darken;return{...e.typography.body2,backgroundColor:`transparent`,display:`flex`,padding:`6px 16px`,variants:[...Object.entries(e.palette).filter(Um([`light`])).map(([r])=>({props:{colorSeverity:r,variant:`standard`},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:n(e.palette[r].light,.9),[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}})),...Object.entries(e.palette).filter(Um([`light`])).map(([n])=>({props:{colorSeverity:n,variant:`outlined`},style:{color:e.vars?e.vars.palette.Alert[`${n}Color`]:t(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}}})),...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{colorSeverity:t,variant:`filled`},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:e.palette.mode===`dark`?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}}))]}})),ine=J(`div`,{name:`MuiAlert`,slot:`Icon`})({marginRight:12,padding:`7px 0`,display:`flex`,fontSize:22,opacity:.9}),ane=J(`div`,{name:`MuiAlert`,slot:`Message`})({padding:`8px 0`,minWidth:0,overflow:`auto`}),one=J(`div`,{name:`MuiAlert`,slot:`Action`})({display:`flex`,alignItems:`flex-start`,padding:`4px 0 0 16px`,marginLeft:`auto`,marginRight:-8}),Hh={success:(0,G.jsx)(Qte,{fontSize:`inherit`}),warning:(0,G.jsx)($te,{fontSize:`inherit`}),error:(0,G.jsx)(ene,{fontSize:`inherit`}),info:(0,G.jsx)(tne,{fontSize:`inherit`})},Uh=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAlert`}),{action:r,children:i,className:a,closeText:o=`Close`,color:s,components:c={},componentsProps:l={},icon:u,iconMapping:d=Hh,onClose:f,role:p=`alert`,severity:m=`success`,slotProps:h={},slots:g={},variant:_=`standard`,...v}=n,y={...n,color:s,severity:m,variant:_,colorSeverity:s||m},b=nne(y),x={slots:{closeButton:c.CloseButton,closeIcon:c.CloseIcon,...g},slotProps:{...l,...h}},[S,C]=Hm(`root`,{ref:t,shouldForwardComponentProp:!0,className:K(b.root,a),elementType:rne,externalForwardedProps:{...x,...v},ownerState:y,additionalProps:{role:p,elevation:0}}),[w,T]=Hm(`icon`,{className:b.icon,elementType:ine,externalForwardedProps:x,ownerState:y}),[E,D]=Hm(`message`,{className:b.message,elementType:ane,externalForwardedProps:x,ownerState:y}),[O,k]=Hm(`action`,{className:b.action,elementType:one,externalForwardedProps:x,ownerState:y}),[A,j]=Hm(`closeButton`,{elementType:Bh,externalForwardedProps:x,ownerState:y}),[M,N]=Hm(`closeIcon`,{elementType:Vh,externalForwardedProps:x,ownerState:y});return(0,G.jsxs)(S,{...C,children:[u===!1?null:(0,G.jsx)(w,{...T,children:u||d[m]||Hh[m]}),(0,G.jsx)(E,{...D,children:i}),r==null?null:(0,G.jsx)(O,{...k,children:r}),r==null&&f?(0,G.jsx)(O,{...k,children:(0,G.jsx)(A,{size:`small`,"aria-label":o,title:o,color:`inherit`,onClick:f,...j,children:(0,G.jsx)(M,{fontSize:`small`,...N})})}):null]})});function sne(e={}){let{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:i,resumeHideDuration:a}=e,o=Ah();C.useEffect(()=>{if(!i)return;function e(e){e.defaultPrevented||e.key===`Escape`&&r?.(e,`escapeKeyDown`)}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[i,r]);let s=oh((e,t)=>{r?.(e,t)}),c=oh(e=>{!r||e==null||o.start(e,()=>{s(null,`timeout`)})});C.useEffect(()=>(i&&c(t),o.clear),[i,t,c,o]);let l=e=>{r?.(e,`clickaway`)},u=o.clear,d=C.useCallback(()=>{t!=null&&c(a??t*.5)},[t,a,c]),f=e=>t=>{let n=e.onBlur;n?.(t),d()},p=e=>t=>{let n=e.onFocus;n?.(t),u()},m=e=>t=>{let n=e.onMouseEnter;n?.(t),u()},h=e=>t=>{let n=e.onMouseLeave;n?.(t),d()};return C.useEffect(()=>{if(!n&&i)return window.addEventListener(`focus`,d),window.addEventListener(`blur`,u),()=>{window.removeEventListener(`focus`,d),window.removeEventListener(`blur`,u)}},[n,i,d,u]),{getRootProps:(t={})=>{let n={...zm(e),...zm(t)};return{role:`presentation`,...t,...n,onBlur:f(n),onFocus:p(n),onMouseEnter:m(n),onMouseLeave:h(n)}},onClickAway:l}}function Wh(e){return e?.props?.ref||null}function Gh(e){return e.substring(2).toLowerCase()}function cne(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function Kh(e){let{children:t,disableReactTree:n=!1,mouseEvent:r=`onClick`,onClickAway:i,touchEvent:a=`onTouchEnd`}=e,o=C.useRef(!1),s=C.useRef(null),c=C.useRef(!1),l=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{c.current=!0},0),()=>{c.current=!1}),[]);let u=Im(Wh(t),s),d=oh(e=>{let t=l.current;l.current=!1;let r=Zm(s.current);if(!c.current||!s.current||`clientX`in e&&cne(e,r))return;if(o.current){o.current=!1;return}let a;a=e.composedPath?e.composedPath().includes(s.current):!r.documentElement.contains(e.target)||s.current.contains(e.target),!a&&(n||!t)&&i(e)}),f=e=>n=>{l.current=!0;let r=t.props[e];r&&r(n)},p={ref:u};return a!==!1&&(p[a]=f(a)),C.useEffect(()=>{if(a!==!1){let e=Gh(a),t=Zm(s.current),n=()=>{o.current=!0};return t.addEventListener(e,d),t.addEventListener(`touchmove`,n),()=>{t.removeEventListener(e,d),t.removeEventListener(`touchmove`,n)}}},[d,a]),r!==!1&&(p[r]=f(r)),C.useEffect(()=>{if(r!==!1){let e=Gh(r),t=Zm(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}},[d,r]),C.cloneElement(t,p)}var qh=e=>e.scrollTop;function Jh(e,t){return n=>{if(t){let r=e.current;n===void 0?t(r):t(r,n)}}}function Yh(e,t,n,r,i,a){let o=e===`exited`&&!t?r:n[e]||n.exited;return i||a?{...o,...i,...a}:o}function Xh(e,t){let{timeout:n,easing:r,style:i={}}=e;return{duration:i.transitionDuration??(typeof n==`number`?n:n[t.mode]||0),easing:i.transitionTimingFunction??(typeof r==`object`?r[t.mode]:r),delay:i.transitionDelay}}function Zh(e){return`scale(${e}, ${e**2})`}var lne={entering:{opacity:1,transform:Zh(1)},entered:{opacity:1,transform:`none`},exiting:{opacity:0,transform:Zh(.75)},exited:{opacity:0,transform:Zh(.75)}},une={opacity:0,transform:Zh(.75),visibility:`hidden`},Qh=C.forwardRef(function(e,t){let{addEndListener:n,appear:r=!0,children:i,easing:a,in:o,onEnter:s,onEntered:c,onEntering:l,onExit:u,onExited:d,onExiting:f,style:p,timeout:m=`auto`,...h}=e,g=Ah(),_=C.useRef(),v=wm(),y=C.useRef(null),b=ch(y,Wh(i),t),x=Jh(y,l),S=Jh(y,(e,t)=>{qh(e);let{duration:n,delay:r,easing:i}=Xh({style:p,timeout:m,easing:a},{mode:`enter`}),o;m===`auto`?(o=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=o):o=n,e.style.transition=[v.transitions.create(`opacity`,{duration:o,delay:r}),v.transitions.create(`transform`,{duration:o*.666,delay:r,easing:i})].join(`,`),s&&s(e,t)}),w=Jh(y,c),T=Jh(y,f),E=Jh(y,e=>{let{duration:t,delay:n,easing:r}=Xh({style:p,timeout:m,easing:a},{mode:`exit`}),i;m===`auto`?(i=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=i):i=t,e.style.transition=[v.transitions.create(`opacity`,{duration:i,delay:n}),v.transitions.create(`transform`,{duration:i*.666,delay:n||i*.333,easing:r})].join(`,`),e.style.opacity=0,e.style.transform=Zh(.75),u&&u(e)}),D=Jh(y,e=>{e.style.transition=``,d&&d(e)});return(0,G.jsx)(wh,{appear:r,in:o,nodeRef:y,onEnter:S,onEntered:w,onEntering:x,onExit:E,onExited:D,onExiting:T,addEndListener:e=>{m===`auto`&&g.start(_.current||0,e),n&&n(y.current,e)},timeout:m===`auto`?null:m,...h,children:(e,{ownerState:t,...n})=>{let r=Yh(e,o,lne,une,p,i.props.style);return C.cloneElement(i,{style:r,ref:b,...n})}})});Qh&&(Qh.muiSupportAuto=!0);function dne(e){return Jd(`MuiSnackbarContent`,e)}Yd(`MuiSnackbarContent`,[`root`,`message`,`action`]);var fne=e=>{let{classes:t}=e;return Cp({root:[`root`],action:[`action`],message:[`message`]},dne,t)},pne=J(Wm,{name:`MuiSnackbarContent`,slot:`Root`})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Pf(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Pf(e.palette.background.default,t),display:`flex`,alignItems:`center`,flexWrap:`wrap`,padding:`6px 16px`,flexGrow:1,[e.breakpoints.up(`sm`)]:{flexGrow:`initial`,minWidth:288}}})),mne=J(`div`,{name:`MuiSnackbarContent`,slot:`Message`})({padding:`8px 0`}),hne=J(`div`,{name:`MuiSnackbarContent`,slot:`Action`})({display:`flex`,alignItems:`center`,marginLeft:`auto`,paddingLeft:16,marginRight:-8}),gne=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiSnackbarContent`}),{action:r,className:i,message:a,role:o=`alert`,...s}=n,c=n,l=fne(c);return(0,G.jsxs)(pne,{role:o,elevation:6,className:K(l.root,i),ownerState:c,ref:t,...s,children:[(0,G.jsx)(mne,{className:l.message,ownerState:c,children:a}),r?(0,G.jsx)(hne,{className:l.action,ownerState:c,children:r}):null]})});function _ne(e){return Jd(`MuiSnackbar`,e)}Yd(`MuiSnackbar`,[`root`,`anchorOriginTopCenter`,`anchorOriginBottomCenter`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`]);var vne=e=>{let{classes:t,anchorOrigin:n}=e;return Cp({root:[`root`,`anchorOrigin${Y(n.vertical)}${Y(n.horizontal)}`]},_ne,t)},yne=J(`div`,{name:`MuiSnackbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`anchorOrigin${Y(n.anchorOrigin.vertical)}${Y(n.anchorOrigin.horizontal)}`]]}})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:`fixed`,display:`flex`,left:8,right:8,justifyContent:`center`,alignItems:`center`,variants:[{props:({ownerState:e})=>e.anchorOrigin.vertical===`top`,style:{top:8,[e.breakpoints.up(`sm`)]:{top:24}}},{props:({ownerState:e})=>e.anchorOrigin.vertical!==`top`,style:{bottom:8,[e.breakpoints.up(`sm`)]:{bottom:24}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`left`,style:{justifyContent:`flex-start`,[e.breakpoints.up(`sm`)]:{left:24,right:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`right`,style:{justifyContent:`flex-end`,[e.breakpoints.up(`sm`)]:{right:24,left:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`center`,style:{[e.breakpoints.up(`sm`)]:{left:`50%`,right:`auto`,transform:`translateX(-50%)`}}}]}))),$h=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiSnackbar`}),r=wm(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:o,horizontal:s}={vertical:`bottom`,horizontal:`left`},autoHideDuration:c=null,children:l,className:u,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:p=!1,message:m,onBlur:h,onClose:g,onFocus:_,onMouseEnter:v,onMouseLeave:y,open:b,resumeHideDuration:x,slots:S={},slotProps:w={},TransitionComponent:T,transitionDuration:E=i,TransitionProps:{onEnter:D,onExited:O,...k}={},...A}=n,j={...n,anchorOrigin:{vertical:o,horizontal:s},autoHideDuration:c,disableWindowBlurListener:p,TransitionComponent:T,transitionDuration:E},M=vne(j),{getRootProps:N,onClickAway:P}=sne(j),[F,I]=C.useState(!0),L=e=>{I(!0),O&&O(e)},R=(e,t)=>{I(!1),D&&D(e,t)},ee={slots:{transition:T,...S},slotProps:{content:f,clickAwayListener:d,transition:k,...w}},[z,te]=Hm(`root`,{ref:t,className:[M.root,u],elementType:yne,getSlotProps:N,externalForwardedProps:{...ee,...A},ownerState:j}),[B,{ownerState:V,...ne}]=Hm(`clickAwayListener`,{elementType:Kh,externalForwardedProps:ee,getSlotProps:e=>({onClickAway:(...t)=>{let n=t[0];e.onClickAway?.(...t),!n?.defaultMuiPrevented&&P(...t)}}),ownerState:j}),[re,ie]=Hm(`content`,{elementType:gne,shouldForwardComponentProp:!0,externalForwardedProps:ee,additionalProps:{message:m,action:a},ownerState:j}),[ae,oe]=Hm(`transition`,{elementType:Qh,externalForwardedProps:ee,getSlotProps:e=>({onEnter:(...t)=>{e.onEnter?.(...t),R(...t)},onExited:(...t)=>{e.onExited?.(...t),L(...t)}}),additionalProps:{appear:!0,in:b,timeout:E,direction:o===`top`?`down`:`up`},ownerState:j});return!b&&F?null:(0,G.jsx)(B,{...ne,...S.clickAwayListener&&{ownerState:V},children:(0,G.jsx)(z,{...te,children:(0,G.jsx)(ae,{...oe,children:l||(0,G.jsx)(re,{...ie})})})})}),eg=(0,C.createContext)({show:()=>{}}),bne=0,xne=e=>{let[t,n]=(0,C.useState)([]),r=(0,C.useCallback)(e=>{n(t=>[...t,{...e,autoHideDuration:e.autoHideDuration??6e3,notificationId:bne++}])},[]),i=e=>{n(t=>t.filter(t=>t.notificationId!==e))};return(0,G.jsxs)(eg.Provider,{value:{show:r},children:[e.children,t.map(e=>(0,G.jsx)($h,{open:!0,autoHideDuration:e.autoHideDuration,onClose:()=>i(e.notificationId),children:(0,G.jsx)(Uh,{severity:e.severity,variant:`filled`,sx:{minWidth:`300px`},children:e.message})},e.notificationId))]})};function tg(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ng=typeof Symbol==`function`&&Symbol.observable||`@@observable`,rg=()=>Math.random().toString(36).substring(7).split(``).join(`.`),ig={INIT:`@@redux/INIT${rg()}`,REPLACE:`@@redux/REPLACE${rg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${rg()}`};function ag(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function og(e,t,n){if(typeof e!=`function`)throw Error(tg(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(tg(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(tg(1));return n(og)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(tg(3));return i}function d(e){if(typeof e!=`function`)throw Error(tg(4));if(c)throw Error(tg(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(tg(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ag(e))throw Error(tg(7));if(e.type===void 0)throw Error(tg(8));if(typeof e.type!=`string`)throw Error(tg(17));if(c)throw Error(tg(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(tg(10));r=e,f({type:ig.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(tg(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[ng](){return this}}}return f({type:ig.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[ng]:m}}function Sne(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:ig.INIT})===void 0)throw Error(tg(12));if(n(void 0,{type:ig.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(tg(13))})}function Cne(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{Sne(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(tg(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function sg(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function wne(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(tg(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=sg(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function Tne(e){return ag(e)&&`type`in e&&typeof e.type==`string`}var cg=Symbol.for(`immer-nothing`),lg=Symbol.for(`immer-draftable`),ug=Symbol.for(`immer-state`);function dg(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fg=Object,pg=fg.getPrototypeOf,mg=`constructor`,hg=`prototype`,gg=`configurable`,_g=`enumerable`,vg=`writable`,yg=`value`,bg=e=>!!e&&!!e[ug];function xg(e){return e?Cg(e)||kg(e)||!!e[lg]||!!e[mg]?.[lg]||Ag(e)||jg(e):!1}var Ene=fg[hg][mg].toString(),Sg=new WeakMap;function Cg(e){if(!e||!Mg(e))return!1;let t=pg(e);if(t===null||t===fg[hg])return!0;let n=fg.hasOwnProperty.call(t,mg)&&t[mg];if(n===Object)return!0;if(!Ng(n))return!1;let r=Sg.get(n);return r===void 0&&(r=Function.toString.call(n),Sg.set(n,r)),r===Ene}function wg(e,t,n=!0){Tg(e)===0?(n?Reflect.ownKeys(e):fg.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Tg(e){let t=e[ug];return t?t.type_:kg(e)?1:Ag(e)?2:jg(e)?3:0}var Eg=(e,t,n=Tg(e))=>n===2?e.has(t):fg[hg].hasOwnProperty.call(e,t),Dg=(e,t,n=Tg(e))=>n===2?e.get(t):e[t],Og=(e,t,n,r=Tg(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Dne(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var kg=Array.isArray,Ag=e=>e instanceof Map,jg=e=>e instanceof Set,Mg=e=>typeof e==`object`,Ng=e=>typeof e==`function`,Pg=e=>typeof e==`boolean`;function One(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Fg=e=>e.copy_||e.base_,Ig=e=>e.modified_?e.copy_:e.base_;function Lg(e,t){if(Ag(e))return new Map(e);if(jg(e))return new Set(e);if(kg(e))return Array[hg].slice.call(e);let n=Cg(e);if(t===!0||t===`class_only`&&!n){let t=fg.getOwnPropertyDescriptors(e);delete t[ug];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[vg]===!1&&(a[vg]=!0,a[gg]=!0),(a.get||a.set)&&(t[i]={[gg]:!0,[vg]:!0,[_g]:a[_g],[yg]:e[i]})}return fg.create(pg(e),t)}else{let t=pg(e);if(t!==null&&n)return{...e};let r=fg.create(t);return fg.assign(r,e)}}function Rg(e,t=!1){return Bg(e)||bg(e)||!xg(e)?e:(Tg(e)>1&&fg.defineProperties(e,{set:zg,add:zg,clear:zg,delete:zg}),fg.freeze(e),t&&wg(e,(e,t)=>{Rg(t,!0)},!1),e)}function kne(){dg(2)}var zg={[yg]:kne};function Bg(e){return e===null||!Mg(e)?!0:fg.isFrozen(e)}var Vg=`MapSet`,Hg=`Patches`,Ug=`ArrayMethods`,Wg={};function Gg(e){let t=Wg[e];return t||dg(0,e),t}var Kg=e=>!!Wg[e],qg,Jg=()=>qg,Ane=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kg(Vg)?Gg(Vg):void 0,arrayMethodsPlugin_:Kg(Ug)?Gg(Ug):void 0});function Yg(e,t){t&&(e.patchPlugin_=Gg(Hg),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xg(e){Zg(e),e.drafts_.forEach(jne),e.drafts_=null}function Zg(e){e===qg&&(qg=e.parent_)}var Qg=e=>qg=Ane(qg,e);function jne(e){let t=e[ug];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $g(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ug].modified_&&(Xg(t),dg(4)),xg(e)&&(e=e_(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ug].base_,e,t)}else e=e_(t,n);return Mne(t,e,!0),Xg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===cg?void 0:e}function e_(e,t){if(Bg(t))return t;let n=t[ug];if(!n)return a_(t,e.handledSet_,e);if(!n_(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);i_(n,e)}return n.copy_}function Mne(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rg(t,n)}function t_(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var n_=(e,t)=>e.scope_===t,Nne=[];function r_(e,t,n,r){let i=Fg(e),a=e.type_;if(r!==void 0&&Dg(i,r,a)===t){Og(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;wg(i,(e,n)=>{if(bg(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Nne;for(let e of o)Og(i,e,n,a)}function Pne(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!n_(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Ig(i);r_(e,i.draft_??i,a,n),i_(i,r)})}function i_(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}t_(e)}}function Fne(e,t,n){let{scope_:r}=e;if(bg(n)){let i=n[ug];n_(i,r)&&i.callbacks_.push(function(){d_(e),r_(e,n,Ig(i),t)})}else xg(n)&&e.callbacks_.push(function(){let i=Fg(e);e.type_===3?i.has(n)&&a_(n,r.handledSet_,r):Dg(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&a_(Dg(e.copy_,t,e.type_),r.handledSet_,r)})}function a_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||bg(e)||t.has(e)||!xg(e)||Bg(e)?e:(t.add(e),wg(e,(r,i)=>{if(bg(i)){let t=i[ug];n_(t,n)&&(Og(e,r,Ig(t),e.type_),t_(t))}else xg(i)&&a_(i,t,n)}),e)}function Ine(e,t){let n=kg(e),r={type_:+!!n,scope_:t?t.scope_:Jg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=o_;n&&(i=[r],a=s_);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var o_={get(e,t){if(t===ug)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Fg(e);if(!Eg(i,t,e.type_))return Lne(e,i,t);let a=i[t];if(e.finalized_||!xg(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&One(t))return a;if(a===c_(e.base_,t)){d_(e);let n=e.type_===1?+t:t,r=f_(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Fg(e)},ownKeys(e){return Reflect.ownKeys(Fg(e))},set(e,t,n){let r=l_(Fg(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=c_(Fg(e),t),i=r?.[ug];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Dne(n,r)&&(n!==void 0||Eg(e.base_,t,e.type_)))return!0;d_(e),u_(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Fne(e,t,n),!0)},deleteProperty(e,t){return d_(e),c_(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),u_(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Fg(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[vg]:!0,[gg]:e.type_!==1||t!==`length`,[_g]:r[_g],[yg]:n[t]}},defineProperty(){dg(11)},getPrototypeOf(e){return pg(e.base_)},setPrototypeOf(){dg(12)}},s_={};for(let e in o_){let t=o_[e];s_[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}s_.deleteProperty=function(e,t){return s_.set.call(this,e,t,void 0)},s_.set=function(e,t,n){return o_.set.call(this,e[0],t,n,e[0])};function c_(e,t){let n=e[ug];return(n?Fg(n):e)[t]}function Lne(e,t,n){let r=l_(t,n);return r?yg in r?r[yg]:r.get?.call(e.draft_):void 0}function l_(e,t){if(!(t in e))return;let n=pg(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pg(n)}}function u_(e){e.modified_||(e.modified_=!0,e.parent_&&u_(e.parent_))}function d_(e){e.copy_||=(e.assigned_=new Map,Lg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Rne=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ng(e)&&!Ng(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ng(t)||dg(6),n!==void 0&&!Ng(n)&&dg(7);let r;if(xg(e)){let i=Qg(this),a=f_(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Xg(i):Zg(i)}return Yg(i,n),$g(r,i)}else if(!e||!Mg(e)){if(r=t(e),r===void 0&&(r=e),r===cg&&(r=void 0),this.autoFreeze_&&Rg(r,!0),n){let t=[],i=[];Gg(Hg).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else dg(1,e)},this.produceWithPatches=(e,t)=>{if(Ng(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Pg(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Pg(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Pg(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xg(e)||dg(8),bg(e)&&(e=zne(e));let t=Qg(this),n=f_(t,e,void 0);return n[ug].isManual_=!0,Zg(t),n}finishDraft(e,t){let n=e&&e[ug];(!n||!n.isManual_)&&dg(9);let{scope_:r}=n;return Yg(r,t),$g(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Gg(Hg).applyPatches_;return bg(e)?r(e,t):this.produce(e,e=>r(e,t))}};function f_(e,t,n,r){let[i,a]=Ag(t)?Gg(Vg).proxyMap_(t,n):jg(t)?Gg(Vg).proxySet_(t,n):Ine(t,n);return(n?.scope_??Jg()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Pne(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function zne(e){return bg(e)||dg(10,e),p_(e)}function p_(e){if(!xg(e)||Bg(e))return e;let t=e[ug],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Lg(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Lg(e,!0);return wg(n,(e,t)=>{Og(n,e,p_(t))},r),t&&(t.finalized_=!1),n}var m_=new Rne().produce,h_=Symbol(`NOT_FOUND`);function Bne(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Vne(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Hne(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var g_=e=>Array.isArray(e)?e:[e];function Une(e){let t=Array.isArray(e[0])?e[0]:e;return Hne(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Wne(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Gne(e){let t;return{get(n){return t&&e(t.key,n)?t.value:h_},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Kne(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return h_}function i(t,i){r(t)===h_&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var qne=(e,t)=>e===t;function Jne(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Yne(e,t){let{equalityCheck:n=qne,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Jne(n),o=0,s=r<=1?Gne(a):Kne(r,a);function c(){let t=s.get(arguments);if(t===h_){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Xne=class{constructor(e){this.value=e}deref(){return this.value}},Zne=typeof WeakRef<`u`?WeakRef:Xne,Qne=0,__=1;function v_(){return{s:Qne,v:void 0,o:null,p:null}}function y_(e,t={}){let n=v_(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}}let s=t,c;if(t.s===__)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Zne(c):c}return s.s=__,s.v=c,c}return o.clearCache=()=>{n=v_(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function b_(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Bne(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=y_,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=g_(c),p=g_(u),m=Une(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Wne(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var x_=b_(y_),$ne=Object.assign((e,t=x_)=>{Vne(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>$ne});function S_(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var ere=S_(),tre=S_,nre=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?sg:sg.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var rre=e=>e&&typeof e.match==`function`;function C_(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(A_(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Tne(t)&&t.type===e,n}var w_=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function T_(e){return xg(e)?m_(e,()=>{}):e}function ire(e){return typeof e==`boolean`}var are=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new w_;return t&&(ire(t)?a.push(ere):a.push(tre(t.extraArgument))),a},ore=`RTK_autoBatch`,E_=e=>t=>{setTimeout(t,e)},sre=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:E_(10):e.type===`callback`?e.queueNotification:E_(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[ore],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},cre=e=>function(t){let{autoBatch:n=!0}=t??{},r=new w_(e);return n&&r.push(sre(typeof n==`object`?n:void 0)),r};function lre(e){let t=are(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(ag(n))c=Cne(n);else throw Error(A_(1));let l;l=typeof r==`function`?r(t):t();let u=sg;i&&(u=nre({trace:!1,...typeof i==`object`&&i}));let d=cre(wne(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return og(c,o,p)}function ure(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(A_(28));if(r in t)throw Error(A_(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function dre(e){return typeof e==`function`}function D_(e,t){let[n,r,i]=ure(t),a;if(dre(e))a=()=>T_(e());else{let t=T_(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(bg(e)){let r=n(e,t);return r===void 0?e:r}else if(xg(e))return m_(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var fre=(e,t)=>rre(e)?e.match(t):e(t);function pre(...e){return t=>e.some(e=>fre(e,t))}var mre=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,hre=(e=21)=>{let t=``,n=e;for(;n--;)t+=mre[Math.random()*64|0];return t},gre=[`name`,`message`,`stack`,`code`],O_=class{constructor(e,t){this.payload=e,this.meta=t}_type},_re=class{constructor(e,t){this.payload=e,this.meta=t}_type},vre=e=>{if(typeof e==`object`&&e){let t={};for(let n of gre)typeof e[n]==`string`&&(t[n]=e[n]);return t}return{message:String(e)}},yre=`External signal was aborted`,bre=(()=>{function e(e,t,n){let r=C_(e+`/fulfilled`,(e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:`fulfilled`}})),i=C_(e+`/pending`,(e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:`pending`}})),a=C_(e+`/rejected`,(e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||vre)(e||`Rejected`),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:`rejected`,aborted:e?.name===`AbortError`,condition:e?.name===`ConditionError`}}));function o(e,{signal:o}={}){return(s,c,l)=>{let u=n?.idGenerator?n.idGenerator(e):hre(),d=new AbortController,f,p;function m(e){p=e,d.abort()}o&&(o.aborted?m(yre):o.addEventListener(`abort`,()=>m(yre),{once:!0}));let h=async function(){let o;try{let a=n?.condition?.(e,{getState:c,extra:l});if(Sre(a)&&(a=await a),a===!1||d.signal.aborted)throw{name:`ConditionError`,message:`Aborted due to condition callback returning false.`};let h=new Promise((e,t)=>{f=()=>{t({name:`AbortError`,message:p||`Aborted`})},d.signal.addEventListener(`abort`,f,{once:!0})});s(i(u,e,n?.getPendingMeta?.({requestId:u,arg:e},{getState:c,extra:l}))),o=await Promise.race([h,Promise.resolve(t(e,{dispatch:s,getState:c,extra:l,requestId:u,signal:d.signal,abort:m,rejectWithValue:(e,t)=>new O_(e,t),fulfillWithValue:(e,t)=>new _re(e,t)})).then(t=>{if(t instanceof O_)throw t;return t instanceof _re?r(t.payload,u,e,t.meta):r(t,u,e)})])}catch(t){o=t instanceof O_?a(null,u,e,t.payload,t.meta):a(t,u,e)}finally{f&&d.signal.removeEventListener(`abort`,f)}return n&&!n.dispatchConditionRejection&&a.match(o)&&o.meta.condition||s(o),o}();return Object.assign(h,{abort:m,requestId:u,arg:e,unwrap(){return h.then(xre)}})}}return Object.assign(o,{pending:i,rejected:a,fulfilled:r,settled:pre(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function xre(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Sre(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}var Cre=`listener`,wre=`completed`,Tre=`cancelled`;`${Tre}`,`${wre}`,`${Cre}${Tre}`,`${Cre}${wre}`;var{assign:Ere}=Object,k_=`listenerMiddleware`,Dre=Ere(C_(`${k_}/add`),{withTypes:()=>Dre});`${k_}`;var Ore=Ere(C_(`${k_}/remove`),{withTypes:()=>Ore});function A_(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kre=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n,this.name=`ApiError`}};async function j_(e){let t=await e.text();try{return JSON.parse(t)}catch{throw new kre(`Invalid JSON response (HTTP ${e.status}): ${t.slice(0,120)}`,e.status,t)}}async function M_(e,t){if(!e.ok){let n=await e.text().catch(()=>``),r=t;try{let e=JSON.parse(n);e?.error&&(r=e.error)}catch{r=n?`${t} (HTTP ${e.status}: ${n.slice(0,120)})`:`${t} (HTTP ${e.status})`}throw Error(r)}}async function Are(){let e=await fetch(`api/matter/bridges?_s=${Date.now()}`);return await M_(e,`Failed to fetch bridges`),j_(e)}async function N_(e){let t=await fetch(`api/matter/bridges`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to create bridge`),j_(t)}async function P_(e){let t=await fetch(`api/matter/bridges/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to update bridge`),j_(t)}async function jre(e){await M_(await fetch(`api/matter/bridges/${e}`,{method:`DELETE`}),`Failed to delete bridge`)}async function Mre(e){let t=await fetch(`api/matter/bridges/${e}/actions/factory-reset`,{method:`POST`});return await M_(t,`Factory reset failed`),j_(t)}async function F_(e){let t=await fetch(`api/matter/bridges/${e}/actions/force-sync`,{method:`POST`});return await M_(t,`Force sync failed`),j_(t)}async function Nre(e){let t=await fetch(`api/matter/bridges/${e}/actions/open-commissioning-window`,{method:`POST`});return await M_(t,`Failed to open commissioning window`),j_(t)}async function Pre(e){if(!(await fetch(`api/matter/bridges/priorities`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({updates:e})})).ok)throw Error(`Failed to update priorities`)}async function I_(){let e=await fetch(`api/matter/bridges/actions/start-all`,{method:`POST`});return await M_(e,`Failed to start all bridges`),j_(e)}async function L_(){let e=await fetch(`api/matter/bridges/actions/stop-all`,{method:`POST`});return await M_(e,`Failed to stop all bridges`),j_(e)}async function R_(){let e=await fetch(`api/matter/bridges/actions/restart-all`,{method:`POST`});return await M_(e,`Failed to restart all bridges`),j_(e)}var z_=bre.withTypes(),B_=x_.withTypes(),V_=z_(`bridges/load`,Are),H_=z_(`bridges/create`,N_),U_=z_(`bridges/delete`,jre),W_=z_(`bridges/update`,P_),G_=z_(`bridges/reset`,Mre),K_=C_(`bridges/setFromWebSocket`),q_=C_(`bridges/updateFromWebSocket`),J_=V.withTypes(),Y_=ie.withTypes(),X_=(0,C.createContext)({isConnected:!1,error:null});function Z_(){return(0,C.useContext)(X_)}function Fre({children:e}){let t=J_(),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(e=>{switch(e.type){case`bridges_update`:t(K_(e.data));break;case`bridge_update`:t(q_(e.data));break;case`ping`:o.current?.send(JSON.stringify({type:`pong`}));break}},[t]),l=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=document.querySelector(`base`)?.href||window.location.origin,n=new URL(t),i=`${e}//${n.host}${n.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`);try{let e=new WebSocket(i);o.current=e,e.onopen=()=>{r(!0),a(null)},e.onmessage=e=>{try{c(JSON.parse(e.data))}catch{console.warn(`Invalid WebSocket message`)}},e.onclose=()=>{r(!1),o.current=null,s.current=setTimeout(l,3e3)},e.onerror=()=>{a(Error(`WebSocket connection error`)),e.close()}}catch(e){a(e instanceof Error?e:Error(`Failed to connect`))}},[c]);return(0,C.useEffect)(()=>(l(),()=>{s.current&&clearTimeout(s.current),o.current?.close()}),[l]),(0,G.jsx)(X_.Provider,{value:{isConnected:n,error:i},children:e})}var Ire=()=>{let e=J_();return(0,C.useEffect)(()=>{e(V_())},[e]),(0,G.jsx)(_i,{})},Q_;(function(e){e.Starting=`starting`,e.Running=`running`,e.Stopped=`stopped`,e.Failed=`failed`})(Q_||={});var $_;(function(e){e.Pattern=`pattern`,e.Regex=`regex`,e.Domain=`domain`,e.Platform=`platform`,e.Label=`label`,e.EntityLabel=`entity_label`,e.DeviceLabel=`device_label`,e.EntityLabelRegex=`entity_label_regex`,e.DeviceLabelRegex=`device_label_regex`,e.AnyFieldRegex=`any_field_regex`,e.Area=`area`,e.EntityCategory=`entity_category`,e.DeviceName=`device_name`,e.ProductName=`product_name`,e.Manufacturer=`manufacturer`,e.DeviceClass=`device_class`})($_||={});var ev=[{id:`all_lights`,name:`All Lights`,description:`Expose all light entities. Ideal for controlling lights via Apple Home, Google Home, or Alexa.`,icon:`light`,filter:{include:[{type:$_.Domain,value:`light`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`lights`,`popular`]},{id:`all_switches`,name:`All Switches & Plugs`,description:`Expose all switch entities including smart plugs. Includes power and energy monitoring.`,icon:`switch`,filter:{include:[{type:$_.Domain,value:`switch`}],exclude:[]},featureFlags:{},tags:[`switches`,`plugs`]},{id:`sensors_only`,name:`All Sensors`,description:`Expose temperature, humidity, pressure, and other sensors. Auto-combines related sensors from the same device.`,icon:`sensor`,filter:{include:[{type:$_.Domain,value:`sensor`},{type:$_.Domain,value:`binary_sensor`}],exclude:[]},featureFlags:{autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`sensors`,`temperature`,`humidity`]},{id:`climate_control`,name:`Climate & Covers`,description:`Expose thermostats, fans, covers, and humidifiers for climate control.`,icon:`climate`,filter:{include:[{type:$_.Domain,value:`climate`},{type:$_.Domain,value:`fan`},{type:$_.Domain,value:`cover`},{type:$_.Domain,value:`humidifier`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`climate`,`thermostat`,`covers`]},{id:`security`,name:`Security & Locks`,description:`Expose locks, alarm panels, and security-related binary sensors (motion, door, window).`,icon:`lock`,filter:{include:[{type:$_.Domain,value:`lock`},{type:$_.Domain,value:`alarm_control_panel`},{type:$_.DeviceClass,value:`motion`},{type:$_.DeviceClass,value:`door`},{type:$_.DeviceClass,value:`window`}],exclude:[],includeMode:`any`},featureFlags:{autoBatteryMapping:!0},tags:[`security`,`locks`,`alarm`]},{id:`robot_vacuum`,name:`Robot Vacuum (Server Mode)`,description:`Single vacuum bridge with Server Mode enabled. Required for Apple Home Siri commands and proper Alexa discovery. Best with just the vacuum on this bridge.`,icon:`vacuum`,filter:{include:[{type:$_.Domain,value:`vacuum`}],exclude:[]},featureFlags:{serverMode:!0},tags:[`vacuum`,`server-mode`,`apple-home`]},{id:`media_players`,name:`Media Players & Speakers`,description:`Expose media players, speakers, and TVs for volume and playback control.`,icon:`media_player`,filter:{include:[{type:$_.Domain,value:`media_player`}],exclude:[]},featureFlags:{},tags:[`media`,`speakers`,`tv`]},{id:`google_home_optimized`,name:`Google Home Optimized`,description:`All devices with Auto Force Sync enabled. Prevents Google Home from showing devices as offline after a few hours.`,icon:`default`,filter:{include:[{type:$_.Pattern,value:`*`}],exclude:[]},featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`google-home`,`all-devices`]},{id:`alexa_covers`,name:`Alexa-Optimized Covers`,description:`Covers with Alexa-friendly percentage display. Displayed percentage matches Home Assistant values.`,icon:`cover`,filter:{include:[{type:$_.Domain,value:`cover`}],exclude:[]},featureFlags:{coverUseHomeAssistantPercentage:!0,autoBatteryMapping:!0},tags:[`alexa`,`covers`]},{id:`automations_scripts`,name:`Automations & Scripts`,description:`Expose Home Assistant automations, scripts, and scenes as Matter switches.`,icon:`remote`,filter:{include:[{type:$_.Domain,value:`automation`},{type:$_.Domain,value:`script`},{type:$_.Domain,value:`scene`}],exclude:[]},featureFlags:{},tags:[`automations`,`scripts`,`scenes`]}],Lre;(function(e){e[e.locked=1]=`locked`,e[e.unlocked=2]=`unlocked`})(Lre||={});var Rre;(function(e){e[e.Off=0]=`Off`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.On=4]=`On`,e[e.Auto=5]=`Auto`,e[e.Smart=6]=`Smart`})(Rre||={});var zre;(function(e){e[e.Forward=0]=`Forward`,e[e.Reverse=1]=`Reverse`})(zre||={});var Bre;(function(e){e[e.OffLowMedHigh=0]=`OffLowMedHigh`,e[e.OffLowHigh=1]=`OffLowHigh`,e[e.OffLowMedHighAuto=2]=`OffLowMedHighAuto`,e[e.OffLowHighAuto=3]=`OffLowHighAuto`,e[e.OffHighAuto=4]=`OffHighAuto`,e[e.OffHigh=5]=`OffHigh`})(Bre||={});var Vre;(function(e){e[e.Stopped=0]=`Stopped`,e[e.Running=1]=`Running`,e[e.Paused=2]=`Paused`,e[e.Error=3]=`Error`,e[e.SeekingCharger=64]=`SeekingCharger`,e[e.Charging=65]=`Charging`,e[e.Docked=66]=`Docked`})(Vre||={});var Hre;(function(e){e[e.Off=0]=`Off`,e[e.Auto=1]=`Auto`,e[e.Cool=3]=`Cool`,e[e.Heat=4]=`Heat`,e[e.EmergencyHeat=5]=`EmergencyHeat`,e[e.Precooling=6]=`Precooling`,e[e.FanOnly=7]=`FanOnly`,e[e.Dry=8]=`Dry`,e[e.Sleep=9]=`Sleep`})(Hre||={});var tv;(function(e){e.homeAssistantEntity=`homeAssistantEntity`,e.identify=`identify`,e.groups=`groups`,e.scenesManagement=`scenesManagement`,e.bridgedDeviceBasicInformation=`bridgedDeviceBasicInformation`,e.airQuality=`airQuality`,e.booleanState=`booleanState`,e.booleanStateConfiguration=`booleanStateConfiguration`,e.carbonDioxideConcentrationMeasurement=`carbonDioxideConcentrationMeasurement`,e.carbonMonoxideConcentrationMeasurement=`carbonMonoxideConcentrationMeasurement`,e.colorControl=`colorControl`,e.doorLock=`doorLock`,e.electricalEnergyMeasurement=`electricalEnergyMeasurement`,e.electricalPowerMeasurement=`electricalPowerMeasurement`,e.flowMeasurement=`flowMeasurement`,e.levelControl=`levelControl`,e.fanControl=`fanControl`,e.illuminanceMeasurement=`illuminanceMeasurement`,e.nitrogenDioxideConcentrationMeasurement=`nitrogenDioxideConcentrationMeasurement`,e.occupancySensing=`occupancySensing`,e.onOff=`onOff`,e.ozoneConcentrationMeasurement=`ozoneConcentrationMeasurement`,e.pm1ConcentrationMeasurement=`pm1ConcentrationMeasurement`,e.pm10ConcentrationMeasurement=`pm10ConcentrationMeasurement`,e.pm25ConcentrationMeasurement=`pm25ConcentrationMeasurement`,e.powerSource=`powerSource`,e.powerTopology=`powerTopology`,e.pressureMeasurement=`pressureMeasurement`,e.relativeHumidityMeasurement=`relativeHumidityMeasurement`,e.smokeCoAlarm=`smokeCoAlarm`,e.temperatureMeasurement=`temperatureMeasurement`,e.thermostat=`thermostat`,e.thermostatUserInterfaceConfiguration=`thermostatUserInterfaceConfiguration`,e.totalVolatileOrganicCompoundsConcentrationMeasurement=`totalVolatileOrganicCompoundsConcentrationMeasurement`,e.valveConfigurationAndControl=`valveConfigurationAndControl`,e.windowCovering=`windowCovering`,e.mediaInput=`mediaInput`,e.rvcCleanMode=`rvcCleanMode`,e.rvcRunMode=`rvcRunMode`,e.rvcOperationalState=`rvcOperationalState`,e.serviceArea=`serviceArea`,e.switch=`switch`,e.modeSelect=`modeSelect`})(tv||={});var Ure={4937:`apple`,4996:`apple`,24582:`google`,4631:`alexa`,4448:`alexa`,4447:`aqara`};function Wre(e){return Ure[e]}var nv=[{id:`apple_home`,name:`Apple Home`,description:`Optimized for Apple Home and Siri. Enables composed devices for clean sensor grouping. Covers use standard Matter percentage (inverted from HA).`,icon:`default`,featureFlags:{autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`google_home`,name:`Google Home`,description:`Optimized for Google Home. Enables Auto Force Sync to prevent devices from going offline. Composed devices enabled for proper sensor grouping.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`alexa`,name:`Amazon Alexa`,description:`Optimized for Alexa. Enables Auto Force Sync and Alexa-friendly cover percentages. Battery mapping included for sensor devices.`,icon:`default`,featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0,coverUseHomeAssistantPercentage:!0}},{id:`multi_controller`,name:`Multi-Controller`,description:`Balanced settings for use with multiple controllers at once (e.g. Apple Home + Alexa). Force Sync enabled. Standard cover behavior.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}}],Gre;(function(e){e.Battery=`battery`,e.BatteryCharging=`battery_charging`,e.CarbonMonoxide=`carbon_monoxide`,e.Cold=`cold`,e.Connectivity=`connectivity`,e.Door=`door`,e.GarageDoor=`garage_door`,e.Gas=`gas`,e.Heat=`heat`,e.Light=`light`,e.Lock=`lock`,e.Moisture=`moisture`,e.Motion=`motion`,e.Moving=`moving`,e.Occupancy=`occupancy`,e.Opening=`opening`,e.Plug=`plug`,e.Power=`power`,e.Presence=`presence`,e.Problem=`problem`,e.Running=`running`,e.Safety=`safety`,e.Smoke=`smoke`,e.Sound=`sound`,e.Tamper=`tamper`,e.Update=`update`,e.Vibration=`vibration`,e.Window=`window`})(Gre||={});var Kre;(function(e){e.off=`off`,e.heat=`heat`,e.cool=`cool`,e.heat_cool=`heat_cool`,e.auto=`auto`,e.dry=`dry`,e.fan_only=`fan_only`})(Kre||={});var qre;(function(e){e.off=`off`,e.preheating=`preheating`,e.heating=`heating`,e.cooling=`cooling`,e.drying=`drying`,e.fan=`fan`,e.idle=`idle`,e.defrosting=`defrosting`})(qre||={});var Jre;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.TARGET_TEMPERATURE_RANGE=2]=`TARGET_TEMPERATURE_RANGE`,e[e.TARGET_HUMIDITY=4]=`TARGET_HUMIDITY`,e[e.FAN_MODE=8]=`FAN_MODE`,e[e.PRESET_MODE=16]=`PRESET_MODE`,e[e.SWING_MODE=32]=`SWING_MODE`,e[e.AUX_HEAT=64]=`AUX_HEAT`,e[e.TURN_OFF=128]=`TURN_OFF`,e[e.TURN_ON=256]=`TURN_ON`,e[e.SWING_HORIZONTAL_MODE=512]=`SWING_HORIZONTAL_MODE`})(Jre||={});var Yre;(function(e){e.closed=`closed`,e.open=`open`,e.closing=`closing`,e.opening=`opening`})(Yre||={});var Xre;(function(e){e.button=`button`,e.doorbell=`doorbell`,e.motion=`motion`})(Xre||={});var Zre;(function(e){e.FORWARD=`forward`,e.REVERSE=`reverse`})(Zre||={});var Qre;(function(e){e[e.SET_SPEED=1]=`SET_SPEED`,e[e.OSCILLATE=2]=`OSCILLATE`,e[e.DIRECTION=4]=`DIRECTION`,e[e.PRESET_MODE=8]=`PRESET_MODE`,e[e.TURN_ON=16]=`TURN_ON`,e[e.TURN_OFF=32]=`TURN_OFF`})(Qre||={});var $re;(function(e){e.error=`error`,e.paused=`paused`,e.mowing=`mowing`,e.docked=`docked`,e.returning=`returning`})($re||={});var eie;(function(e){e[e.START_MOWING=1]=`START_MOWING`,e[e.PAUSE=2]=`PAUSE`,e[e.DOCK=4]=`DOCK`})(eie||={});var tie;(function(e){e.UNKNOWN=`unknown`,e.ONOFF=`onoff`,e.BRIGHTNESS=`brightness`,e.COLOR_TEMP=`color_temp`,e.HS=`hs`,e.XY=`xy`,e.RGB=`rgb`,e.RGBW=`rgbw`,e.RGBWW=`rgbww`,e.WHITE=`white`})(tie||={});var nie;(function(e){e.Tv=`tv`,e.Speaker=`speaker`,e.Receiver=`receiver`})(nie||={});var rie;(function(e){e[e.PAUSE=1]=`PAUSE`,e[e.SEEK=2]=`SEEK`,e[e.VOLUME_SET=4]=`VOLUME_SET`,e[e.VOLUME_MUTE=8]=`VOLUME_MUTE`,e[e.PREVIOUS_TRACK=16]=`PREVIOUS_TRACK`,e[e.NEXT_TRACK=32]=`NEXT_TRACK`,e[e.TURN_ON=128]=`TURN_ON`,e[e.TURN_OFF=256]=`TURN_OFF`,e[e.PLAY_MEDIA=512]=`PLAY_MEDIA`,e[e.VOLUME_STEP=1024]=`VOLUME_STEP`,e[e.SELECT_SOURCE=2048]=`SELECT_SOURCE`,e[e.STOP=4096]=`STOP`,e[e.CLEAR_PLAYLIST=8192]=`CLEAR_PLAYLIST`,e[e.PLAY=16384]=`PLAY`,e[e.SHUFFLE_SET=32768]=`SHUFFLE_SET`,e[e.SELECT_SOUND_MODE=65536]=`SELECT_SOUND_MODE`,e[e.BROWSE_MEDIA=131072]=`BROWSE_MEDIA`,e[e.REPEAT_SET=262144]=`REPEAT_SET`,e[e.GROUPING=524288]=`GROUPING`,e[e.MEDIA_ANNOUNCE=1048576]=`MEDIA_ANNOUNCE`,e[e.MEDIA_ENQUEUE=2097152]=`MEDIA_ENQUEUE`})(rie||={});var iie;(function(e){e.None=`None`,e.apparent_power=`apparent_power`,e.aqi=`aqi`,e.atmospheric_pressure=`atmospheric_pressure`,e.battery=`battery`,e.carbon_dioxide=`carbon_dioxide`,e.carbon_monoxide=`carbon_monoxide`,e.current=`current`,e.data_rate=`data_rate`,e.data_size=`data_size`,e.date=`date`,e.distance=`distance`,e.duration=`duration`,e.energy=`energy`,e.energy_storage=`energy_storage`,e.enum=`enum`,e.frequency=`frequency`,e.gas=`gas`,e.humidity=`humidity`,e.illuminance=`illuminance`,e.irradiance=`irradiance`,e.moisture=`moisture`,e.monetary=`monetary`,e.nitrogen_dioxide=`nitrogen_dioxide`,e.nitrogen_monoxide=`nitrogen_monoxide`,e.nitrous_oxide=`nitrous_oxide`,e.ozone=`ozone`,e.ph=`ph`,e.pm1=`pm1`,e.pm25=`pm25`,e.pm10=`pm10`,e.power_factor=`power_factor`,e.power=`power`,e.precipitation=`precipitation`,e.precipitation_intensity=`precipitation_intensity`,e.pressure=`pressure`,e.radon=`radon`,e.reactive_power=`reactive_power`,e.signal_strength=`signal_strength`,e.sound_pressure=`sound_pressure`,e.speed=`speed`,e.sulphur_dioxide=`sulphur_dioxide`,e.temperature=`temperature`,e.timestamp=`timestamp`,e.volatile_organic_compounds=`volatile_organic_compounds`,e.volatile_organic_compounds_parts=`volatile_organic_compounds_parts`,e.voltage=`voltage`,e.volume=`volume`,e.volume_flow_rate=`volume_flow_rate`,e.volume_storage=`volume_storage`,e.water=`water`,e.weight=`weight`,e.wind_speed=`wind_speed`})(iie||={});var aie;(function(e){e.cleaning=`cleaning`,e.docked=`docked`,e.returning=`returning`,e.error=`error`,e.idle=`idle`,e.paused=`paused`,e.segment_cleaning=`segment_cleaning`,e.zone_cleaning=`zone_cleaning`,e.spot_cleaning=`spot_cleaning`,e.mop_cleaning=`mop_cleaning`})(aie||={});var oie;(function(e){e[e.TURN_ON=1]=`TURN_ON`,e[e.TURN_OFF=2]=`TURN_OFF`,e[e.PAUSE=4]=`PAUSE`,e[e.STOP=8]=`STOP`,e[e.RETURN_HOME=16]=`RETURN_HOME`,e[e.FAN_SPEED=32]=`FAN_SPEED`,e[e.BATTERY=64]=`BATTERY`,e[e.STATUS=128]=`STATUS`,e[e.SEND_COMMAND=256]=`SEND_COMMAND`,e[e.LOCATE=512]=`LOCATE`,e[e.CLEAN_SPOT=1024]=`CLEAN_SPOT`,e[e.MAP=2048]=`MAP`,e[e.STATE=4096]=`STATE`,e[e.START=8192]=`START`,e[e.CLEAN_AREA=16384]=`CLEAN_AREA`})(oie||={});var sie;(function(e){e.off=`off`,e.low=`low`,e.medium=`medium`,e.high=`high`,e.turbo=`turbo`,e.auto=`auto`,e.max=`max`})(sie||={});var cie;(function(e){e.off=`off`,e.eco=`eco`,e.electric=`electric`,e.gas=`gas`,e.heat_pump=`heat_pump`,e.high_demand=`high_demand`,e.performance=`performance`})(cie||={});var lie;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.OPERATION_MODE=2]=`OPERATION_MODE`,e[e.AWAY_MODE=4]=`AWAY_MODE`,e[e.ON_OFF=8]=`ON_OFF`})(lie||={});var rv={air_purifier:`Air Purifier`,air_quality_sensor:`Air Quality Sensor`,basic_video_player:`Basic Video Player (TV)`,battery_storage:`Battery Sensor`,carbon_monoxide_sensor:`Carbon Monoxide (CO) Sensor`,color_temperature_light:`Color Temperature Light`,contact_sensor:`Contact Sensor`,dishwasher:`Dishwasher`,dimmable_light:`Dimmable Light`,dimmable_plugin_unit:`Dimmable Plug-in Unit`,door_lock:`Door Lock`,electrical_sensor:`Electrical Sensor (Power/Energy/Voltage/Current)`,extended_color_light:`Extended Color Light`,fan:`Fan`,flow_sensor:`Flow Sensor`,formaldehyde_sensor:`Formaldehyde (HCHO) Sensor`,generic_switch:`Generic Switch (Button)`,humidifier_dehumidifier:`Humidifier/Dehumidifier`,humidity_sensor:`Humidity Sensor`,light_sensor:`Light Sensor`,mode_select:`Mode Select`,motion_sensor:`Motion Sensor (PIR)`,nitrogen_dioxide_sensor:`Nitrogen Dioxide (NO₂) Sensor`,occupancy_sensor:`Occupancy Sensor`,on_off_light:`On/Off Light`,on_off_plugin_unit:`On/Off Plug-in Unit`,on_off_switch:`On/Off Switch`,mounted_on_off_control:`Mounted On/Off Control (experimental)`,ozone_sensor:`Ozone (O₃) Sensor`,pm1_sensor:`PM1 Sensor`,pressure_sensor:`Pressure Sensor`,pump:`Pump`,rain_sensor:`Rain Sensor`,radon_sensor:`Radon Sensor`,robot_vacuum_cleaner:`Robot Vacuum Cleaner`,robotic_lawn_mower:`Robotic Lawn Mower`,smoke_co_alarm:`Smoke/CO Alarm`,speaker:`Speaker`,temperature_sensor:`Temperature Sensor`,thermostat:`Thermostat`,tvoc_sensor:`TVOC / VOC Index Sensor`,water_heater:`Water Heater`,water_freeze_detector:`Water Freeze Detector`,water_leak_detector:`Water Leak Detector`,water_valve:`Water Valve`,window_covering:`Window Covering`},iv={on_off_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},dimmable_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},color_temperature_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},extended_color_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},on_off_plugin_unit:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},dimmable_plugin_unit:{apple:`yes`,google:`no`,alexa:`yes`,aqara:`yes`},on_off_switch:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},mounted_on_off_control:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Experimental Matter 1.4 type (0x010F). SmartThings and Aqara show it as a switch. Apple, Google and Alexa don't know it yet and are expected to fall back to the advertised plug subset, not verified on real devices (#380).`},door_lock:{apple:`yes`,google:`partial`,alexa:`yes`,aqara:`yes`},window_covering:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},thermostat:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},fan:{apple:`no`,google:`yes`,alexa:`yes`,aqara:`yes`,note:`Apple Home has no standalone fan, it only shows fans inside an AC.`},air_purifier:{apple:`no`,google:`yes`,alexa:`yes`,aqara:`yes`,note:`Apple Home does not list air purifiers.`},robot_vacuum_cleaner:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},robotic_lawn_mower:{apple:`yes`,google:`unknown`,alexa:`yes`,aqara:`unknown`,note:`Shows up as a robot vacuum, there is no Matter mower type yet.`},humidifier_dehumidifier:{apple:`unknown`,google:`no`,alexa:`yes`,aqara:`unknown`},dishwasher:{apple:`no`,google:`no`,alexa:`unknown`,aqara:`unknown`,note:`Appliance types have little controller support today.`},speaker:{apple:`no`,google:`yes`,alexa:`no`,aqara:`yes`,note:`Apple and Alexa do not show Matter speakers.`},basic_video_player:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`TV/media types only show in Aqara Home here.`},temperature_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},humidity_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},light_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`unknown`},pressure_sensor:{apple:`no`,google:`yes`,alexa:`no`,aqara:`yes`,note:`Google Home and Aqara show pressure sensors.`},flow_sensor:{apple:`no`,google:`yes`,alexa:`no`,aqara:`unknown`,note:`Only Google Home shows flow sensors.`},air_quality_sensor:{apple:`no`,google:`yes`,alexa:`yes`,aqara:`yes`,note:`Apple Home does not show air quality.`},tvoc_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},carbon_monoxide_sensor:{apple:`partial`,google:`no`,alexa:`partial`,aqara:`yes`,note:`Apple shows a CO alarm, not a CO level reading.`},nitrogen_dioxide_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},ozone_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},formaldehyde_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},radon_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},pm1_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},electrical_sensor:{apple:`no`,google:`no`,alexa:`unknown`,aqara:`unknown`,note:`Power/energy is rarely shown unless it is on a smart plug.`},battery_storage:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Aqara lists battery storage; others show battery inside a device.`},contact_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},motion_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},occupancy_sensor:{apple:`partial`,google:`yes`,alexa:`yes`,aqara:`yes`},mode_select:{apple:`no`,google:`no`,alexa:`no`,aqara:`unknown`,note:`Google Home does not support Mode Select (issue #356).`},water_valve:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`},pump:{apple:`no`,google:`yes`,alexa:`no`,aqara:`yes`,note:`Google Home and Aqara show pumps.`},rain_sensor:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Newer Matter detector type with thin support, Alexa may reject it (issue #365).`},water_freeze_detector:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Newer Matter detector type with thin support, Alexa may reject it (issue #365).`},water_leak_detector:{apple:`yes`,google:`no`,alexa:`yes`,aqara:`yes`,note:`Apple added leak sensors in iOS 18.4.`},water_heater:{apple:`no`,google:`no`,alexa:`unknown`,aqara:`yes`},generic_switch:{apple:`partial`,google:`no`,alexa:`yes`,aqara:`unknown`,note:`Best for stateless buttons.`},smoke_co_alarm:{apple:`yes`,google:`no`,alexa:`yes`,aqara:`yes`,note:`Apple added smoke/CO alarms in iOS 18.4.`}},av={Auto:0,Quick:1,Quiet:2,LowNoise:3,LowEnergy:4,Vacation:5,Min:6,Max:7,Night:8,Day:9,DeepClean:16384,Vacuum:16385,Mop:16386,VacuumThenMop:16387},uie={alarm_control_panel:[`mode_select`,`on_off_plugin_unit`],automation:[`on_off_switch`],binary_sensor:[`contact_sensor`,`motion_sensor`,`occupancy_sensor`,`rain_sensor`,`smoke_co_alarm`,`water_freeze_detector`,`water_leak_detector`],button:[`generic_switch`],climate:[`thermostat`],cover:[`window_covering`],event:[`generic_switch`],fan:[`air_purifier`,`fan`],humidifier:[`humidifier_dehumidifier`],input_boolean:[`on_off_plugin_unit`,`on_off_switch`,`mounted_on_off_control`],input_select:[`mode_select`],lawn_mower:[`robotic_lawn_mower`],input_button:[`generic_switch`],light:[`color_temperature_light`,`dimmable_light`,`extended_color_light`,`on_off_light`],lock:[`door_lock`],media_player:[`basic_video_player`,`on_off_switch`,`speaker`],scene:[`on_off_switch`],script:[`on_off_switch`],sensor:[`air_quality_sensor`,`battery_storage`,`carbon_monoxide_sensor`,`electrical_sensor`,`formaldehyde_sensor`,`humidity_sensor`,`light_sensor`,`nitrogen_dioxide_sensor`,`ozone_sensor`,`pm1_sensor`,`pressure_sensor`,`radon_sensor`,`temperature_sensor`,`tvoc_sensor`],select:[`mode_select`],siren:[`on_off_plugin_unit`],switch:[`dishwasher`,`on_off_plugin_unit`,`on_off_switch`,`mounted_on_off_control`,`pump`,`water_valve`],vacuum:[`robot_vacuum_cleaner`],valve:[`water_valve`,`on_off_plugin_unit`],water_heater:[`water_heater`,`thermostat`]},die;(function(e){e.alarm_control_panel=`alarm_control_panel`,e.automation=`automation`,e.button=`button`,e.binary_sensor=`binary_sensor`,e.climate=`climate`,e.cover=`cover`,e.event=`event`,e.fan=`fan`,e.humidifier=`humidifier`,e.input_boolean=`input_boolean`,e.input_button=`input_button`,e.input_select=`input_select`,e.lawn_mower=`lawn_mower`,e.light=`light`,e.lock=`lock`,e.media_player=`media_player`,e.remote=`remote`,e.scene=`scene`,e.select=`select`,e.script=`script`,e.sensor=`sensor`,e.siren=`siren`,e.switch=`switch`,e.vacuum=`vacuum`,e.valve=`valve`,e.water_heater=`water_heater`,e.weather=`weather`})(die||={});var ov={type:`object`,default:{type:``,value:``},properties:{type:{title:`Type`,type:`string`,oneOf:[{const:`pattern`,title:`pattern`,description:`Wildcard pattern matching entity IDs. Use * as wildcard. Example: 'light.living_room_*' matches all lights in the living room.`},{const:`regex`,title:`regex`,description:`Regex tested against the entity_id only (e.g. 'light.kitchen_lamp'). For labels use entity_label_regex or device_label_regex. Example: '^(light|switch)\\.kitchen_.*'.`},{const:`domain`,title:`domain`,description:`Match entities by their domain (the part before the dot). Example: 'light', 'switch', 'sensor'.`},{const:`platform`,title:`platform`,description:`Match entities by their integration/platform. Example: 'hue', 'zwave', 'mqtt'.`},{const:`label`,title:`label (deprecated)`,description:`Deprecated: use entity_label or device_label instead. Behaves like entity_label.`},{const:`entity_label`,title:`entity_label`,description:`Matches only entities that have this label assigned directly. Other entities of the same device are NOT included.`},{const:`device_label`,title:`device_label`,description:`Matches ALL entities of a device if the device has this label. Use this to include a complete device with all its entities.`},{const:`entity_label_regex`,title:`entity_label_regex`,description:`Regex tested against entity-label slugs and display names. Matches if any label assigned to the entity matches. Example: '^(matter|voice).*'.`},{const:`device_label_regex`,title:`device_label_regex`,description:`Regex tested against device-label slugs and display names. Matches ALL entities of a device whose label matches. Example: '^(matter|voice).*'.`},{const:`any_field_regex`,title:`any_field_regex`,description:`Regex tested against a single-line key=value haystack covering entity_id, domain, platform, area, entity_category, device_class, entity_labels, entity_label_names, device_labels, device_label_names, device_name, product_name, manufacturer. Use lookaheads for AND, alternation for OR. Example: '(?=.*domain=light)(?=.*area=living_room)|(?=.*domain=switch)(?=.*entity_labels=.*\\bvoice\\b)'.`},{const:`area`,title:`area`,description:`Match entities by their area slug. Example: 'living_room', 'bedroom'.`},{const:`entity_category`,title:`entity_category`,description:`Match entities by their category. Example: 'config', 'diagnostic' to exclude configuration entities.`},{const:`device_name`,title:`device_name`,description:`Match entities by their device name. Supports wildcards. Example: '*Philips*' matches all Philips devices.`},{const:`product_name`,title:`product_name`,description:`Match entities by their product/model name. Supports wildcards. Example: 'Hue*Bulb'.`},{const:`manufacturer`,title:`manufacturer`,description:`Match entities by their device manufacturer. Supports wildcards. Handy for MQTT or other generic integrations. Example: '*Sonoff*'.`},{const:`device_class`,title:`device_class`,description:`Match entities by their device class attribute. Example: 'temperature', 'motion', 'door', 'window'.`}]},value:{title:`Value`,description:`For labels, use the display name or the label_id (slug). You can look up both on the Labels page in the sidebar.`,type:`string`,minLength:1}},required:[`type`,`value`],additionalProperties:!1},sv={type:`object`,title:`Bridge Config`,properties:{name:{title:`Name`,type:`string`,minLength:1,maxLength:32},port:{title:`Port`,type:`number`,minimum:1},icon:{title:`Icon`,type:`string`,description:`Icon to display for this bridge in the UI`,enum:[`light`,`switch`,`climate`,`cover`,`fan`,`lock`,`sensor`,`media_player`,`vacuum`,`remote`,`humidifier`,`speaker`,`garage`,`door`,`window`,`motion`,`battery`,`power`,`camera`,`default`]},countryCode:{title:`Country Code`,type:`string`,description:`An ISO 3166-1 alpha-2 code to represent the country in which the Node is located. Only needed if the commissioning fails due to missing country code.`,minLength:2,maxLength:3},priority:{title:`Startup Priority`,type:`number`,description:`Startup order priority. Lower values start first. Default is 100.`,default:100,minimum:1,maximum:999},serialNumberSuffix:{title:`Serial Number Suffix`,type:`string`,description:`Append a suffix to every entity serial number on this bridge. Useful for forcing controllers like Aqara to treat devices as new and bypass cached device data. Leave empty for default behavior.`,maxLength:16},sessionMaxAgeHours:{title:`Session Rotation Max Age (hours)`,type:`number`,description:`Rotate matter sessions older than this many hours so controllers re-establish and re-subscribe. Server Mode rotates every 4h by default; standard bridges only rotate when you set a value here. Set 0 to disable. Range 0 to 168. (#287)`,minimum:0,maximum:168},filter:{title:`Include or exclude entities`,type:`object`,properties:{include:{title:`Include`,type:`array`,items:ov},exclude:{title:`Exclude`,type:`array`,items:ov},includeMode:{title:`Include Mode`,type:`string`,description:`How to combine include rules: 'any' matches if ANY rule matches (OR), 'all' matches only if ALL rules match (AND). Default: 'any'`,enum:[`any`,`all`],default:`any`}},required:[`include`,`exclude`],additionalProperties:!1},featureFlags:{title:`Feature Flags`,type:`object`,properties:{coverDoNotInvertPercentage:{title:`Do not invert Percentages for Covers`,description:`Do not invert the percentage of covers to match Home Assistant (not Matter compliant)`,type:`boolean`,default:!1},coverUseHomeAssistantPercentage:{title:`Use Home Assistant Percentage for Covers (Alexa-friendly)`,description:`Display cover percentages matching Home Assistant values in Matter controllers like Alexa. This makes the displayed percentage match what you see in Home Assistant, but the semantic meaning differs: in HA, higher percentage = more open; in Alexa, higher percentage is typically interpreted as more closed. Open/Close commands will still work correctly.`,type:`boolean`,default:!1},coverSwapOpenClose:{title:`Swap Open/Close for Covers`,description:`Swap open/close commands and invert position reporting for covers. Enable this if Alexa voice commands are reversed (saying 'close' opens the blinds and vice versa).`,type:`boolean`,default:!1},includeHiddenEntities:{title:`Include Hidden Entities`,description:`Include entities that are marked as hidden in Home Assistant`,type:`boolean`,default:!1},serverMode:{title:`Server Mode (standalone device)`,description:`Expose entities as standalone Matter devices instead of bridged ones. Works for any supported device type, e.g. robot vacuums need it for Apple Home Siri voice commands. One node carries up to 10 devices; the first entity is the primary and drives the node name and type (experimental beyond one device).`,type:`boolean`,default:!1},autoBatteryMapping:{title:`Auto Battery Mapping`,description:`Automatically assign battery sensors from the same Home Assistant device to the main entity. When enabled, battery sensors will be merged into their parent devices instead of appearing as separate devices.`,type:`boolean`,default:!1},autoHumidityMapping:{title:`Auto Humidity Mapping`,description:`Automatically combine humidity sensors with temperature sensors from the same Home Assistant device. When enabled, humidity sensors will be merged into temperature sensors to create combined TemperatureHumiditySensor devices.`,type:`boolean`,default:!0},autoPressureMapping:{title:`Auto Pressure Mapping`,description:`Automatically combine pressure sensors with temperature sensors from the same Home Assistant device. When enabled, pressure sensors will be merged into temperature sensors to create combined sensor devices.`,type:`boolean`,default:!0},autoComposedDevices:{title:`Auto Composed Devices`,description:`Master toggle: combine related entities from the same Home Assistant device into a single Matter endpoint. Turns on battery, humidity, pressure, power, and energy auto-mapping at once, a Shelly Plug shows up as one device with power monitoring instead of several siblings.`,type:`boolean`,default:!1},autoForceSync:{title:`Auto Force Sync`,description:`Periodically compare and push all device states to connected controllers every 90 seconds. Enable this if devices get out of sync after extended periods. Health checks for dead sessions always run regardless of this setting.`,type:`boolean`,default:!1},productNameFromNodeLabel:{title:`Product Name from Node Label`,description:`Report the entity's node label (custom name / friendly name / entity id) as the Matter productName. Useful for controllers like Aqara that display productName as the device name instead of nodeLabel. A per-entity customProductName still takes precedence.`,type:`boolean`,default:!1},preferEntityRegistryName:{title:`Prefer Entity Registry Name (HA 2026.4 workaround)`,description:`Use the entity registry name (or original_name) as nodeLabel instead of the composed friendly_name. Since Home Assistant 2026.4, friendly_name is prefixed with the device name, which breaks voice commands that relied on the short entity name. Resolution order: customName → registry name → registry original_name → friendly_name → entity_id. Matter has no alias concept, this only changes which single name is reported.`,type:`boolean`,default:!1},vacuumOnOff:{title:`Vacuum: Include OnOff Cluster (Alexa)`,description:`Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically, only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.`,type:`boolean`},alexaPreserveBrightnessOnTurnOn:{title:`Alexa: Preserve Brightness on Turn-On`,description:`Workaround for Alexa resetting light brightness to 100% after subscription renewal. When enabled, the bridge ignores brightness commands that set lights to 100% within 200ms of a turn-on command for the same light. WARNING: breaks Apple Home's 'set room to 100%' Siri commands, which use the same on() + moveToLevel(254) pattern. Only enable on Alexa-only bridges.`,type:`boolean`,default:!1},useHaRegistrySerial:{title:`Use HA Registry Serial Number`,description:`Fall back to the Home Assistant device registry serial_number when no per-entity customSerialNumber is configured. Default off because changing serialNumber after commissioning can confuse controllers. A per-entity customSerialNumber still takes precedence.`,type:`boolean`,default:!1},coverSliderDebounceMs:{title:`Cover Slider Debounce (ms)`,description:`Override the cover position-update debounce window for this bridge. Some controllers (Apple Home) stream slider updates while the user is still dragging, causing covers to start moving toward an intermediate target. Set to the time the bridge should wait after the last update before sending the final value to Home Assistant. 0 keeps the built-in two-phase debounce (400 ms initial / 150 ms subsequent), which fits most controllers. Try 800-1500 ms for slow blinds. A per-entity override on a single cover wins over this flag.`,type:`number`,minimum:0,maximum:5e3,default:0},fastSessionRecovery:{title:`Fast Session Recovery (Google offline workaround)`,description:`When a controller drops all subscriptions, clean up the dead session and re-announce after 5 seconds instead of 60. Opt-in for Google Home users whose devices go offline after a cancelled subscription (#386). It shortens the offline window but cannot stop the controller from rejecting the subscription. Default off.`,type:`boolean`,default:!1}}}},required:[`name`,`port`,`filter`],additionalProperties:!1};({...sv}),{...sv},{...sv.properties},[...sv?.required??[]];var cv=X((0,G.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z`}),`ArrowBack`),lv=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z`}),`CheckCircle`),uv=X((0,G.jsx)(`path`,{d:`M9.19 6.35c-2.04 2.29-3.44 5.58-3.57 5.89L2 10.69l4.05-4.05c.47-.47 1.15-.68 1.81-.55zM11.17 17s3.74-1.55 5.89-3.7c5.4-5.4 4.5-9.62 4.21-10.57-.95-.3-5.17-1.19-10.57 4.21C8.55 9.09 7 12.83 7 12.83zm6.48-2.19c-2.29 2.04-5.58 3.44-5.89 3.57L13.31 22l4.05-4.05c.47-.47.68-1.15.55-1.81zM9 18c0 .83-.34 1.58-.88 2.12C6.94 21.3 2 22 2 22s.7-4.94 1.88-6.12C4.42 15.34 5.17 15 6 15c1.66 0 3 1.34 3 3m4-9c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2`}),`RocketLaunch`),fie=Yd(`MuiBox`,[`root`]),Z=Kd({themeId:Cm,defaultTheme:xm(),defaultClassName:fie.root,generateClassName:Wd.generate});function pie(e){return Jd(`MuiButton`,e)}var dv=Yd(`MuiButton`,`root.text.textInherit.textPrimary.textSecondary.textSuccess.textError.textInfo.textWarning.outlined.outlinedInherit.outlinedPrimary.outlinedSecondary.outlinedSuccess.outlinedError.outlinedInfo.outlinedWarning.contained.containedInherit.containedPrimary.containedSecondary.containedSuccess.containedError.containedInfo.containedWarning.disableElevation.focusVisible.disabled.colorInherit.colorPrimary.colorSecondary.colorSuccess.colorError.colorInfo.colorWarning.textSizeSmall.textSizeMedium.textSizeLarge.outlinedSizeSmall.outlinedSizeMedium.outlinedSizeLarge.containedSizeSmall.containedSizeMedium.containedSizeLarge.sizeMedium.sizeSmall.sizeLarge.fullWidth.startIcon.endIcon.icon.iconSizeSmall.iconSizeMedium.iconSizeLarge.loading.loadingWrapper.loadingIconPlaceholder.loadingIndicator.loadingPositionCenter.loadingPositionStart.loadingPositionEnd`.split(`.`)),mie=C.createContext({}),hie=C.createContext(void 0),gie=e=>{let{color:t,disableElevation:n,fullWidth:r,size:i,variant:a,loading:o,loadingPosition:s,classes:c}=e,l=Cp({root:[`root`,o&&`loading`,a,`${a}${Y(t)}`,`size${Y(i)}`,`${a}Size${Y(i)}`,`color${Y(t)}`,n&&`disableElevation`,r&&`fullWidth`,o&&`loadingPosition${Y(s)}`],startIcon:[`icon`,`startIcon`,`iconSize${Y(i)}`],endIcon:[`icon`,`endIcon`,`iconSize${Y(i)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},pie,c);return{...c,...l}},fv=[{props:{size:`small`},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:`medium`},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:`large`},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],_ie=J(Nh,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color)}`],t[`size${Y(n.size)}`],t[`${n.variant}Size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,n.loading&&t.loading]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[300]:e.palette.grey[800],n=e.palette.mode===`light`?e.palette.grey.A100:e.palette.grey[700];return{...e.typography.button,minWidth:64,padding:`6px 16px`,border:0,borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`,`color`],{duration:e.transitions.duration.short}),"&:hover":{textDecoration:`none`},[`&.${dv.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:{variant:`contained`},style:{color:`var(--variant-containedColor)`,backgroundColor:`var(--variant-containedBg)`,boxShadow:(e.vars||e).shadows[2],"&:hover":{boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2]}},"&:active":{boxShadow:(e.vars||e).shadows[8]},[`&.${dv.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},[`&.${dv.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}},{props:{variant:`outlined`},style:{padding:`5px 15px`,border:`1px solid currentColor`,borderColor:`var(--variant-outlinedBorder, currentColor)`,backgroundColor:`var(--variant-outlinedBg)`,color:`var(--variant-outlinedColor)`,[`&.${dv.disabled}`]:{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`}}},{props:{variant:`text`},style:{padding:`6px 8px`,color:`var(--variant-textColor)`,backgroundColor:`var(--variant-textBg)`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--variant-textColor":(e.vars||e).palette[t].main,"--variant-outlinedColor":(e.vars||e).palette[t].main,"--variant-outlinedBorder":e.alpha((e.vars||e).palette[t].main,.5),"--variant-containedColor":(e.vars||e).palette[t].contrastText,"--variant-containedBg":(e.vars||e).palette[t].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(e.vars||e).palette[t].dark,"--variant-textBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBorder":(e.vars||e).palette[t].main,"--variant-outlinedBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}}})),{props:{color:`inherit`},style:{color:`inherit`,borderColor:`currentColor`,"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedBg:t,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity)}}}},{props:{size:`small`,variant:`text`},style:{padding:`4px 5px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`text`},style:{padding:`8px 11px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`outlined`},style:{padding:`3px 9px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`outlined`},style:{padding:`7px 21px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`contained`},style:{padding:`4px 10px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`contained`},style:{padding:`8px 22px`,fontSize:e.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:`none`,"&:hover":{boxShadow:`none`},[`&.${dv.focusVisible}`]:{boxShadow:`none`},"&:active":{boxShadow:`none`},[`&.${dv.disabled}`]:{boxShadow:`none`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{loadingPosition:`center`},style:{transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),[`&.${dv.loading}`]:{color:`transparent`}}}]}})),vie=J(`span`,{name:`MuiButton`,slot:`StartIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.startIcon,n.loading&&t.startIconLoadingStart,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:8,marginLeft:-4,variants:[{props:{size:`small`},style:{marginLeft:-2}},{props:{loadingPosition:`start`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`start`,loading:!0,fullWidth:!0},style:{marginRight:-8}},...fv]})),yie=J(`span`,{name:`MuiButton`,slot:`EndIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.endIcon,n.loading&&t.endIconLoadingEnd,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:-4,marginLeft:8,variants:[{props:{size:`small`},style:{marginRight:-2}},{props:{loadingPosition:`end`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`end`,loading:!0,fullWidth:!0},style:{marginLeft:-8}},...fv]})),bie=J(`span`,{name:`MuiButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,variants:[{props:{loading:!0},style:{display:`flex`}},{props:{loadingPosition:`start`},style:{left:14}},{props:{loadingPosition:`start`,size:`small`},style:{left:10}},{props:{variant:`text`,loadingPosition:`start`},style:{left:6}},{props:{loadingPosition:`center`},style:{left:`50%`,transform:`translate(-50%)`,color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:`end`},style:{right:14}},{props:{loadingPosition:`end`,size:`small`},style:{right:10}},{props:{variant:`text`,loadingPosition:`end`},style:{right:6}},{props:{loadingPosition:`start`,fullWidth:!0},style:{position:`relative`,left:-10}},{props:{loadingPosition:`end`,fullWidth:!0},style:{position:`relative`,right:-10}}]})),pv=J(`span`,{name:`MuiButton`,slot:`LoadingIconPlaceholder`})({display:`inline-block`,width:`1em`,height:`1em`}),mv=C.forwardRef(function(e,t){let n=C.useContext(mie),r=C.useContext(hie),i=km({props:uf(n,e),name:`MuiButton`}),{children:a,color:o=`primary`,component:s=`button`,className:c,disabled:l=!1,disableElevation:u=!1,disableFocusRipple:d=!1,endIcon:f,focusVisibleClassName:p,fullWidth:m=!1,id:h,loading:g=null,loadingIndicator:_,loadingPosition:v=`center`,size:y=`medium`,startIcon:b,type:x,variant:S=`text`,...w}=i,T=rh(h),E=_??(0,G.jsx)(Rh,{"aria-labelledby":T,color:`inherit`,size:16}),D={...i,color:o,component:s,disabled:l,disableElevation:u,disableFocusRipple:d,fullWidth:m,loading:g,loadingIndicator:E,loadingPosition:v,size:y,type:x,variant:S},O=gie(D),k=(b||g&&v===`start`)&&(0,G.jsx)(vie,{className:O.startIcon,ownerState:D,children:b||(0,G.jsx)(pv,{className:O.loadingIconPlaceholder,ownerState:D})}),A=(f||g&&v===`end`)&&(0,G.jsx)(yie,{className:O.endIcon,ownerState:D,children:f||(0,G.jsx)(pv,{className:O.loadingIconPlaceholder,ownerState:D})}),j=r||``,M=typeof g==`boolean`?(0,G.jsx)(`span`,{className:O.loadingWrapper,style:{display:`contents`},children:g&&(0,G.jsx)(bie,{className:O.loadingIndicator,ownerState:D,children:E})}):null;return(0,G.jsxs)(_ie,{ownerState:D,className:K(n.className,O.root,c,j),component:s,disabled:l||g,focusRipple:!d,focusVisibleClassName:K(O.focusVisible,p),ref:t,type:x,id:g?T:h,...w,classes:O,children:[k,v!==`end`&&M,a,v===`end`&&M,A]})});function xie(e){return Jd(`MuiCard`,e)}Yd(`MuiCard`,[`root`]);var Sie=e=>{let{classes:t}=e;return Cp({root:[`root`]},xie,t)},Cie=J(Wm,{name:`MuiCard`,slot:`Root`})({overflow:`hidden`}),hv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCard`}),{className:r,raised:i=!1,...a}=n,o={...n,raised:i};return(0,G.jsx)(Cie,{className:K(Sie(o).root,r),elevation:i?8:void 0,ref:t,ownerState:o,...a})});function wie(e){return Jd(`MuiCardActionArea`,e)}var gv=Yd(`MuiCardActionArea`,[`root`,`focusVisible`,`focusHighlight`]),Tie=e=>{let{classes:t}=e;return Cp({root:[`root`],focusHighlight:[`focusHighlight`]},wie,t)},Eie=J(Nh,{name:`MuiCardActionArea`,slot:`Root`})(Fm(({theme:e})=>({display:`block`,textAlign:`inherit`,borderRadius:`inherit`,width:`100%`,[`&:hover .${gv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${gv.focusVisible} .${gv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),Die=J(`span`,{name:`MuiCardActionArea`,slot:`FocusHighlight`})(Fm(({theme:e})=>({overflow:`hidden`,pointerEvents:`none`,position:`absolute`,top:0,right:0,bottom:0,left:0,borderRadius:`inherit`,opacity:0,backgroundColor:`currentcolor`,transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.short})}))),_v=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCardActionArea`}),{children:r,className:i,focusVisibleClassName:a,slots:o={},slotProps:s={},...c}=n,l=n,u=Tie(l),d={slots:o,slotProps:s},[f,p]=Hm(`root`,{elementType:Eie,externalForwardedProps:{...d,...c},shouldForwardComponentProp:!0,ownerState:l,ref:t,className:K(u.root,i),additionalProps:{focusVisibleClassName:K(a,u.focusVisible)}}),[m,h]=Hm(`focusHighlight`,{elementType:Die,externalForwardedProps:d,ownerState:l,className:u.focusHighlight});return(0,G.jsxs)(f,{...p,children:[r,(0,G.jsx)(m,{...h})]})});function Oie(e){return Jd(`MuiCardContent`,e)}Yd(`MuiCardContent`,[`root`]);var kie=e=>{let{classes:t}=e;return Cp({root:[`root`]},Oie,t)},Aie=J(`div`,{name:`MuiCardContent`,slot:`Root`})({padding:16,"&:last-child":{paddingBottom:24}}),vv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCardContent`}),{className:r,component:i=`div`,...a}=n,o={...n,component:i};return(0,G.jsx)(Aie,{as:i,className:K(kie(o).root,r),ownerState:o,ref:t,...a})}),yv=C.createContext(void 0);function bv(){return C.useContext(yv)}function jie(e){return Jd(`PrivateSwitchBase`,e)}Yd(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var Mie=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e;return Cp({root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${Y(i)}`],input:[`input`]},jie,t)},Nie=J(Nh,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),Pie=J(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Dm})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),xv=C.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,inputProps:d,inputRef:f,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:_,required:v=!1,tabIndex:y,type:b,value:x,slots:S={},slotProps:C={},...w}=e,[T,E]=ah({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=bv(),O=e=>{g&&g(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{m&&m(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||_)return;let t=e.target.checked;E(t),h&&h(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=b===`checkbox`||b===`radio`,N={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},P=Mie(N),F={slots:S,slotProps:{input:d,...C}},[I,L]=Hm(`root`,{ref:t,elementType:Nie,className:P.root,shouldForwardComponentProp:!0,externalForwardedProps:{...F,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:N,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[R,ee]=Hm(`input`,{ref:f,elementType:Pie,className:P.input,externalForwardedProps:F,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:N,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:p,readOnly:_,required:v,tabIndex:y,type:b,...b===`checkbox`&&x===void 0?{}:{value:x}}});return(0,G.jsxs)(I,{...L,children:[(0,G.jsx)(R,{...ee}),T?i:l]})}),Fie=X((0,G.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlank`),Iie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),Lie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z`}),`IndeterminateCheckBox`);function Rie(e){return Jd(`MuiCheckbox`,e)}var Sv=Yd(`MuiCheckbox`,[`root`,`checked`,`disabled`,`indeterminate`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`]),zie=e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,a=Cp({root:[`root`,n&&`indeterminate`,`color${Y(r)}`,`size${Y(i)}`]},Rie,t);return{...t,...a}},Bie=J(xv,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiCheckbox`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Y(n.size)}`],n.color!=="default"&&t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:`default`,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${Sv.checked}, &.${Sv.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${Sv.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),Vie=(0,G.jsx)(Iie,{}),Hie=(0,G.jsx)(Fie,{}),Uie=(0,G.jsx)(Lie,{}),Cv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCheckbox`}),{checkedIcon:r=Vie,color:i=`primary`,icon:a=Hie,indeterminate:o=!1,indeterminateIcon:s=Uie,inputProps:c,size:l=`medium`,disableRipple:u=!1,className:d,slots:f={},slotProps:p={},...m}=n,h=o?s:a,g=o?s:r,_={...n,disableRipple:u,color:i,indeterminate:o,size:l},v=zie(_),y=p.input??c,[b,x]=Hm(`root`,{ref:t,elementType:Bie,className:K(v.root,d),shouldForwardComponentProp:!0,externalForwardedProps:{slots:f,slotProps:p,...m},ownerState:_,additionalProps:{type:`checkbox`,icon:C.cloneElement(h,{fontSize:h.props.fontSize??l}),checkedIcon:C.cloneElement(g,{fontSize:g.props.fontSize??l}),disableRipple:u,slots:f,slotProps:{input:lh(typeof y==`function`?y(_):y,{"data-indeterminate":o})}}});return(0,G.jsx)(b,{...x,classes:v})}),Wie=X((0,G.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z`}),`Cancel`);function Gie(e){return Jd(`MuiChip`,e)}var wv=Yd(`MuiChip`,`root.sizeSmall.sizeMedium.colorDefault.colorError.colorInfo.colorPrimary.colorSecondary.colorSuccess.colorWarning.disabled.clickable.clickableColorPrimary.clickableColorSecondary.deletable.deletableColorPrimary.deletableColorSecondary.outlined.filled.outlinedPrimary.outlinedSecondary.filledPrimary.filledSecondary.avatar.avatarSmall.avatarMedium.avatarColorPrimary.avatarColorSecondary.icon.iconSmall.iconMedium.iconColorPrimary.iconColorSecondary.label.labelSmall.labelMedium.deleteIcon.deleteIconSmall.deleteIconMedium.deleteIconColorPrimary.deleteIconColorSecondary.deleteIconOutlinedColorPrimary.deleteIconOutlinedColorSecondary.deleteIconFilledColorPrimary.deleteIconFilledColorSecondary.focusVisible`.split(`.`)),Kie=e=>{let{classes:t,disabled:n,size:r,color:i,iconColor:a,onDelete:o,clickable:s,variant:c}=e;return Cp({root:[`root`,c,n&&`disabled`,`size${Y(r)}`,`color${Y(i)}`,s&&`clickable`,s&&`clickableColor${Y(i)}`,o&&`deletable`,o&&`deletableColor${Y(i)}`,`${c}${Y(i)}`],label:[`label`,`label${Y(r)}`],avatar:[`avatar`,`avatar${Y(r)}`,`avatarColor${Y(i)}`],icon:[`icon`,`icon${Y(r)}`,`iconColor${Y(a)}`],deleteIcon:[`deleteIcon`,`deleteIcon${Y(r)}`,`deleteIconColor${Y(i)}`,`deleteIcon${Y(c)}Color${Y(i)}`]},Gie,t)},qie=J(`div`,{name:`MuiChip`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{color:r,iconColor:i,clickable:a,onDelete:o,size:s,variant:c}=n;return[{[`& .${wv.avatar}`]:t.avatar},{[`& .${wv.avatar}`]:t[`avatar${Y(s)}`]},{[`& .${wv.avatar}`]:t[`avatarColor${Y(r)}`]},{[`& .${wv.icon}`]:t.icon},{[`& .${wv.icon}`]:t[`icon${Y(s)}`]},{[`& .${wv.icon}`]:t[`iconColor${Y(i)}`]},{[`& .${wv.deleteIcon}`]:t.deleteIcon},{[`& .${wv.deleteIcon}`]:t[`deleteIcon${Y(s)}`]},{[`& .${wv.deleteIcon}`]:t[`deleteIconColor${Y(r)}`]},{[`& .${wv.deleteIcon}`]:t[`deleteIcon${Y(c)}Color${Y(r)}`]},t.root,t[`size${Y(s)}`],t[`color${Y(r)}`],a&&t.clickable,a&&r!=="default"&&t[`clickableColor${Y(r)}`],o&&t.deletable,o&&r!=="default"&&t[`deletableColor${Y(r)}`],t[c],t[`${c}${Y(r)}`]]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[700]:e.palette.grey[300];return{maxWidth:`100%`,fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:`inline-flex`,alignItems:`center`,justifyContent:`center`,height:32,lineHeight:1.5,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:32/2,whiteSpace:`nowrap`,transition:e.transitions.create([`background-color`,`box-shadow`]),cursor:`unset`,outline:0,textDecoration:`none`,border:0,padding:0,verticalAlign:`middle`,boxSizing:`border-box`,[`&.${wv.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`& .${wv.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:t,fontSize:e.typography.pxToRem(12)},[`& .${wv.avatarColorPrimary}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark},[`& .${wv.avatarColorSecondary}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark},[`& .${wv.avatarSmall}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${wv.icon}`]:{marginLeft:5,marginRight:-6},[`& .${wv.deleteIcon}`]:{WebkitTapHighlightColor:`transparent`,color:e.alpha((e.vars||e).palette.text.primary,.26),fontSize:22,cursor:`pointer`,margin:`0 5px 0 -6px`,"&:hover":{color:e.alpha((e.vars||e).palette.text.primary,.4)}},variants:[{props:{size:`small`},style:{height:24,[`& .${wv.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${wv.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText,[`& .${wv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].contrastText}}}})),{props:e=>e.iconColor===e.color,style:{[`& .${wv.icon}`]:{color:e.vars?e.vars.palette.Chip.defaultIconColor:t}}},{props:e=>e.iconColor===e.color&&e.color!=="default",style:{[`& .${wv.icon}`]:{color:`inherit`}}},{props:{onDelete:!0},style:{[`&.${wv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,onDelete:!0},style:{[`&.${wv.focusVisible}`]:{background:(e.vars||e).palette[t].dark}}})),{props:{clickable:!0},style:{userSelect:`none`,WebkitTapHighlightColor:`transparent`,cursor:`pointer`,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)},[`&.${wv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},"&:active":{boxShadow:(e.vars||e).shadows[1]}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,clickable:!0},style:{[`&:hover, &.${wv.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark}}})),{props:{variant:`outlined`},style:{backgroundColor:`transparent`,border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${e.palette.mode===`light`?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${wv.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${wv.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${wv.avatar}`]:{marginLeft:4},[`& .${wv.avatarSmall}`]:{marginLeft:2},[`& .${wv.icon}`]:{marginLeft:4},[`& .${wv.iconSmall}`]:{marginLeft:2},[`& .${wv.deleteIcon}`]:{marginRight:5},[`& .${wv.deleteIconSmall}`]:{marginRight:3}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{variant:`outlined`,color:t},style:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.7)}`,[`&.${wv.clickable}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)},[`&.${wv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.focusOpacity)},[`& .${wv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].main}}}}))]}})),Jie=J(`span`,{name:`MuiChip`,slot:`Label`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{size:r}=n;return[t.label,t[`label${Y(r)}`]]}})({overflow:`hidden`,textOverflow:`ellipsis`,paddingLeft:12,paddingRight:12,whiteSpace:`nowrap`,variants:[{props:{variant:`outlined`},style:{paddingLeft:11,paddingRight:11}},{props:{size:`small`},style:{paddingLeft:8,paddingRight:8}},{props:{size:`small`,variant:`outlined`},style:{paddingLeft:7,paddingRight:7}}]});function Tv(e){return e.key===`Backspace`||e.key===`Delete`}var Ev=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiChip`}),{avatar:r,className:i,clickable:a,color:o=`default`,component:s,deleteIcon:c,disabled:l=!1,icon:u,label:d,onClick:f,onDelete:p,onKeyDown:m,onKeyUp:h,size:g=`medium`,variant:_=`filled`,tabIndex:v,skipFocusWhenDisabled:y=!1,slots:b={},slotProps:x={},...S}=n,w=ch(C.useRef(null),t),T=e=>{e.stopPropagation(),p(e)},E=e=>{e.currentTarget===e.target&&Tv(e)&&e.preventDefault(),m&&m(e)},D=e=>{e.currentTarget===e.target&&p&&Tv(e)&&p(e),h&&h(e)},O=a!==!1&&f?!0:a,k=O||p?Nh:s||`div`,A={...n,component:k,disabled:l,size:g,color:o,iconColor:C.isValidElement(u)&&u.props.color||o,onDelete:!!p,clickable:O,variant:_},j=Kie(A),M=k===Nh?{component:s||`div`,focusVisibleClassName:j.focusVisible,...p&&{disableRipple:!0}}:{},N=null;p&&(N=c&&C.isValidElement(c)?C.cloneElement(c,{className:K(c.props.className,j.deleteIcon),onClick:T}):(0,G.jsx)(Wie,{className:j.deleteIcon,onClick:T}));let P=null;r&&C.isValidElement(r)&&(P=C.cloneElement(r,{className:K(j.avatar,r.props.className)}));let F=null;u&&C.isValidElement(u)&&(F=C.cloneElement(u,{className:K(j.icon,u.props.className)}));let I={slots:b,slotProps:x},[L,R]=Hm(`root`,{elementType:qie,externalForwardedProps:{...I,...S},ownerState:A,shouldForwardComponentProp:!0,ref:w,className:K(j.root,i),additionalProps:{disabled:O&&l?!0:void 0,tabIndex:y&&l?-1:v,...M},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),f?.(t)},onKeyDown:t=>{e.onKeyDown?.(t),E(t)},onKeyUp:t=>{e.onKeyUp?.(t),D(t)}})}),[ee,z]=Hm(`label`,{elementType:Jie,externalForwardedProps:I,ownerState:A,className:j.label});return(0,G.jsxs)(L,{as:k,...R,children:[P||F,(0,G.jsx)(ee,{...z,children:d}),N]})});function Dv(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function Ov(e,t=!1){return e&&(Dv(e.value)&&e.value!==``||t&&Dv(e.defaultValue)&&e.defaultValue!==``)}function Yie(e){return e.startAdornment}function Xie(e){return Jd(`MuiFormControl`,e)}Yd(`MuiFormControl`,[`root`,`marginNone`,`marginNormal`,`marginDense`,`fullWidth`,`disabled`]);var Zie=e=>{let{classes:t,margin:n,fullWidth:r}=e;return Cp({root:[`root`,n!==`none`&&`margin${Y(n)}`,r&&`fullWidth`]},Xie,t)},Qie=J(`div`,{name:`MuiFormControl`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`margin${Y(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:`inline-flex`,flexDirection:`column`,position:`relative`,minWidth:0,padding:0,margin:0,border:0,verticalAlign:`top`,variants:[{props:{margin:`normal`},style:{marginTop:16,marginBottom:8}},{props:{margin:`dense`},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:`100%`}}]}),kv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormControl`}),{children:r,className:i,color:a=`primary`,component:o=`div`,disabled:s=!1,error:c=!1,focused:l,fullWidth:u=!1,hiddenLabel:d=!1,margin:f=`none`,required:p=!1,size:m=`medium`,variant:h=`outlined`,...g}=n,_={...n,color:a,component:o,disabled:s,error:c,fullWidth:u,hiddenLabel:d,margin:f,required:p,size:m,variant:h},v=Zie(_),[y,b]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{if(!Xm(t,[`Input`,`Select`]))return;let n=Xm(t,[`Select`])?t.props.input:t;n&&Yie(n.props)&&(e=!0)}),e}),[x,S]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{Xm(t,[`Input`,`Select`])&&(Ov(t.props,!0)||Ov(t.props.inputProps,!0))&&(e=!0)}),e}),[w,T]=C.useState(!1);s&&w&&T(!1);let E=l!==void 0&&!s?l:w;C.useRef(!1);let D=C.useCallback(()=>{S(!0)},[]),O=C.useCallback(()=>{S(!1)},[]),k=C.useMemo(()=>({adornedStart:y,setAdornedStart:b,color:a,disabled:s,error:c,filled:x,focused:E,fullWidth:u,hiddenLabel:d,size:m,onBlur:()=>{T(!1)},onFocus:()=>{T(!0)},onEmpty:O,onFilled:D,registerEffect:void 0,required:p,variant:h}),[y,a,s,c,x,E,u,d,void 0,O,D,p,m,h]);return(0,G.jsx)(yv.Provider,{value:k,children:(0,G.jsx)(Qie,{as:o,ownerState:_,className:K(v.root,i),ref:t,...g,children:r})})});function $ie(e){return Jd(`MuiTypography`,e)}var Av=Yd(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]),eae={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},tae=qee(),nae=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return Cp({root:[`root`,a,e.align!==`inherit`&&`align${Y(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},$ie,o)},rae=J(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${Y(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Fm(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${Y(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),jv={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},Q=C.forwardRef(function(e,t){let{color:n,...r}=km({props:e,name:`MuiTypography`}),i=!eae[n],a=tae({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=jv,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p};return(0,G.jsx)(rae,{as:c||(d?`p`:p[f]||jv[f])||`span`,ref:t,className:K(nae(h).root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})});function iae(e){return Jd(`MuiFormControlLabel`,e)}var Mv=Yd(`MuiFormControlLabel`,[`root`,`labelPlacementStart`,`labelPlacementTop`,`labelPlacementBottom`,`disabled`,`label`,`error`,`required`,`asterisk`]);function Nv({props:e,states:t,muiFormControl:n}){return t.reduce((t,r)=>(t[r]=e[r],n&&e[r]===void 0&&(t[r]=n[r]),t),{})}var aae=e=>{let{classes:t,disabled:n,labelPlacement:r,error:i,required:a}=e;return Cp({root:[`root`,n&&`disabled`,`labelPlacement${Y(r)}`,i&&`error`,a&&`required`],label:[`label`,n&&`disabled`],asterisk:[`asterisk`,i&&`error`]},iae,t)},oae=J(`label`,{name:`MuiFormControlLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Mv.label}`]:t.label},t.root,t[`labelPlacement${Y(n.labelPlacement)}`]]}})(Fm(({theme:e})=>({display:`inline-flex`,alignItems:`center`,cursor:`pointer`,verticalAlign:`middle`,WebkitTapHighlightColor:`transparent`,marginLeft:-11,marginRight:16,[`&.${Mv.disabled}`]:{cursor:`default`},[`& .${Mv.label}`]:{[`&.${Mv.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:`start`},style:{flexDirection:`row-reverse`,marginRight:-11}},{props:{labelPlacement:`top`},style:{flexDirection:`column-reverse`}},{props:{labelPlacement:`bottom`},style:{flexDirection:`column`}},{props:({labelPlacement:e})=>e===`start`||e===`top`||e===`bottom`,style:{marginLeft:16}}]}))),sae=J(`span`,{name:`MuiFormControlLabel`,slot:`Asterisk`})(Fm(({theme:e})=>({[`&.${Mv.error}`]:{color:(e.vars||e).palette.error.main}}))),Pv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormControlLabel`}),{checked:r,className:i,componentsProps:a={},control:o,disabled:s,disableTypography:c,inputRef:l,label:u,labelPlacement:d=`end`,name:f,onChange:p,required:m,slots:h={},slotProps:g={},value:_,...v}=n,y=bv(),b=s??o.props.disabled??y?.disabled,x=m??o.props.required,S={disabled:b,required:x};[`checked`,`name`,`onChange`,`value`,`inputRef`].forEach(e=>{o.props[e]===void 0&&n[e]!==void 0&&(S[e]=n[e])});let w=Nv({props:n,muiFormControl:y,states:[`error`]}),T={...n,disabled:b,labelPlacement:d,required:x,error:w.error},E=aae(T),[D,O]=Hm(`typography`,{elementType:Q,externalForwardedProps:{slots:h,slotProps:{...a,...g}},ownerState:T}),k=u;return k!=null&&k.type!==Q&&!c&&(k=(0,G.jsx)(D,{component:`span`,...O,className:K(E.label,O?.className),children:k})),(0,G.jsxs)(oae,{className:K(E.root,i),ownerState:T,ref:t,...v,children:[C.cloneElement(o,S),x?(0,G.jsxs)(`div`,{children:[k,(0,G.jsxs)(sae,{ownerState:T,"aria-hidden":!0,className:E.asterisk,children:[` `,`*`]})]}):k]})}),Fv=cee({createStyledComponent:J(`div`,{name:`MuiGrid`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.container&&t.container]}}),componentName:`MuiGrid`,useThemeProps:e=>km({props:e,name:`MuiGrid`}),useTheme:wm});function cae(e){return Jd(`MuiLinearProgress`,e)}Yd(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var Iv=4,Lv=fd`
|
|
148
|
+
`,Ute=e=>{let{classes:t,variant:n,color:r,disableShrink:i}=e;return Cp({root:[`root`,n,`color${Y(r)}`],svg:[`svg`],track:[`track`],circle:[`circle`,`circle${Y(n)}`,i&&`circleDisableShrink`]},Bte,t)},Wte=J(`span`,{name:`MuiCircularProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({display:`inline-block`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`transform`)}},{props:{variant:`indeterminate`},style:Vte||{animation:`${Ih} 1.4s linear infinite`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))]}))),Gte=J(`svg`,{name:`MuiCircularProgress`,slot:`Svg`})({display:`block`}),Kte=J(`circle`,{name:`MuiCircularProgress`,slot:`Circle`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.circle,t[`circle${Y(n.variant)}`],n.disableShrink&&t.circleDisableShrink]}})(Fm(({theme:e})=>({stroke:`currentColor`,variants:[{props:{variant:`determinate`},style:{transition:e.transitions.create(`stroke-dashoffset`)}},{props:{variant:`indeterminate`},style:{strokeDasharray:`80px, 200px`,strokeDashoffset:0}},{props:({ownerState:e})=>e.variant===`indeterminate`&&!e.disableShrink,style:Hte||{animation:`${Lh} 1.4s ease-in-out infinite`}}]}))),qte=J(`circle`,{name:`MuiCircularProgress`,slot:`Track`})(Fm(({theme:e})=>({stroke:`currentColor`,opacity:(e.vars||e).palette.action.activatedOpacity}))),Rh=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCircularProgress`}),{className:r,color:i=`primary`,disableShrink:a=!1,enableTrackSlot:o=!1,size:s=40,style:c,thickness:l=3.6,value:u=0,variant:d=`indeterminate`,...f}=n,p={...n,color:i,disableShrink:a,size:s,thickness:l,value:u,variant:d,enableTrackSlot:o},m=Ute(p),h={},g={},_={};if(d===`determinate`){let e=2*Math.PI*((Fh-l)/2);h.strokeDasharray=e.toFixed(3),_[`aria-valuenow`]=Math.round(u),h.strokeDashoffset=`${((100-u)/100*e).toFixed(3)}px`,g.transform=`rotate(-90deg)`}return(0,G.jsx)(Wte,{className:K(m.root,r),style:{width:s,height:s,...g,...c},ownerState:p,ref:t,role:`progressbar`,..._,...f,children:(0,G.jsxs)(Gte,{className:m.svg,ownerState:p,viewBox:`${Fh/2} ${Fh/2} ${Fh} ${Fh}`,children:[o?(0,G.jsx)(qte,{className:m.track,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l,"aria-hidden":`true`}):null,(0,G.jsx)(Kte,{className:m.circle,style:h,ownerState:p,cx:Fh,cy:Fh,r:(Fh-l)/2,fill:`none`,strokeWidth:l})]})})});function Jte(e){return Jd(`MuiIconButton`,e)}var zh=Yd(`MuiIconButton`,[`root`,`disabled`,`colorInherit`,`colorPrimary`,`colorSecondary`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`,`edgeStart`,`edgeEnd`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`loading`,`loadingIndicator`,`loadingWrapper`]),Yte=e=>{let{classes:t,disabled:n,color:r,edge:i,size:a,loading:o}=e;return Cp({root:[`root`,o&&`loading`,n&&`disabled`,r!=="default"&&`color${Y(r)}`,i&&`edge${Y(i)}`,`size${Y(a)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},Jte,t)},Xte=J(Nh,{name:`MuiIconButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${Y(n.color)}`],n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})(Fm(({theme:e})=>({textAlign:`center`,flex:`0 0 auto`,fontSize:e.typography.pxToRem(24),padding:8,borderRadius:`50%`,color:(e.vars||e).palette.action.active,transition:e.transitions.create(`background-color`,{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:`var(--IconButton-hoverBg)`,"@media (hover: none)":{backgroundColor:`transparent`}}}},{props:{edge:`start`},style:{marginLeft:-12}},{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:{edge:`end`},style:{marginRight:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}}]})),Fm(({theme:e})=>({variants:[{props:{color:`inherit`},style:{color:`inherit`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:`small`},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${zh.disabled}`]:{backgroundColor:`transparent`,color:(e.vars||e).palette.action.disabled},[`&.${zh.loading}`]:{color:`transparent`}}))),Zte=J(`span`,{name:`MuiIconButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:`flex`}}]})),Bh=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiIconButton`}),{edge:r=!1,children:i,className:a,color:o=`default`,disabled:s=!1,disableFocusRipple:c=!1,size:l=`medium`,id:u,loading:d=null,loadingIndicator:f,...p}=n,m=rh(u),h=f??(0,G.jsx)(Rh,{"aria-labelledby":m,color:`inherit`,size:16}),g={...n,edge:r,color:o,disabled:s,disableFocusRipple:c,loading:d,loadingIndicator:h,size:l},_=Yte(g);return(0,G.jsxs)(Xte,{id:d?m:u,className:K(_.root,a),centerRipple:!0,focusRipple:!c,disabled:s||d,ref:t,...p,ownerState:g,children:[typeof d==`boolean`&&(0,G.jsx)(`span`,{className:_.loadingWrapper,style:{display:`contents`},children:(0,G.jsx)(Zte,{className:_.loadingIndicator,ownerState:g,children:d&&h})}),i]})}),Qte=X((0,G.jsx)(`path`,{d:`M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z`}),`SuccessOutlined`),$te=X((0,G.jsx)(`path`,{d:`M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z`}),`ReportProblemOutlined`),ene=X((0,G.jsx)(`path`,{d:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.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`}),`ErrorOutline`),tne=X((0,G.jsx)(`path`,{d:`M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z`}),`InfoOutlined`),Vh=X((0,G.jsx)(`path`,{d:`M19 6.41L17.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`}),`Close`),nne=e=>{let{variant:t,color:n,severity:r,classes:i}=e;return Cp({root:[`root`,`color${Y(n||r)}`,`${t}${Y(n||r)}`,`${t}`],icon:[`icon`],message:[`message`],action:[`action`]},dte,i)},rne=J(Wm,{name:`MuiAlert`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color||n.severity)}`]]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.darken:e.lighten,n=e.palette.mode===`light`?e.lighten:e.darken;return{...e.typography.body2,backgroundColor:`transparent`,display:`flex`,padding:`6px 16px`,variants:[...Object.entries(e.palette).filter(Um([`light`])).map(([r])=>({props:{colorSeverity:r,variant:`standard`},style:{color:e.vars?e.vars.palette.Alert[`${r}Color`]:t(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:n(e.palette[r].light,.9),[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}}})),...Object.entries(e.palette).filter(Um([`light`])).map(([n])=>({props:{colorSeverity:n,variant:`outlined`},style:{color:e.vars?e.vars.palette.Alert[`${n}Color`]:t(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Gm.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}}})),...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{colorSeverity:t,variant:`filled`},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:e.palette.mode===`dark`?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}}))]}})),ine=J(`div`,{name:`MuiAlert`,slot:`Icon`})({marginRight:12,padding:`7px 0`,display:`flex`,fontSize:22,opacity:.9}),ane=J(`div`,{name:`MuiAlert`,slot:`Message`})({padding:`8px 0`,minWidth:0,overflow:`auto`}),one=J(`div`,{name:`MuiAlert`,slot:`Action`})({display:`flex`,alignItems:`flex-start`,padding:`4px 0 0 16px`,marginLeft:`auto`,marginRight:-8}),Hh={success:(0,G.jsx)(Qte,{fontSize:`inherit`}),warning:(0,G.jsx)($te,{fontSize:`inherit`}),error:(0,G.jsx)(ene,{fontSize:`inherit`}),info:(0,G.jsx)(tne,{fontSize:`inherit`})},Uh=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAlert`}),{action:r,children:i,className:a,closeText:o=`Close`,color:s,components:c={},componentsProps:l={},icon:u,iconMapping:d=Hh,onClose:f,role:p=`alert`,severity:m=`success`,slotProps:h={},slots:g={},variant:_=`standard`,...v}=n,y={...n,color:s,severity:m,variant:_,colorSeverity:s||m},b=nne(y),x={slots:{closeButton:c.CloseButton,closeIcon:c.CloseIcon,...g},slotProps:{...l,...h}},[S,C]=Hm(`root`,{ref:t,shouldForwardComponentProp:!0,className:K(b.root,a),elementType:rne,externalForwardedProps:{...x,...v},ownerState:y,additionalProps:{role:p,elevation:0}}),[w,T]=Hm(`icon`,{className:b.icon,elementType:ine,externalForwardedProps:x,ownerState:y}),[E,D]=Hm(`message`,{className:b.message,elementType:ane,externalForwardedProps:x,ownerState:y}),[O,k]=Hm(`action`,{className:b.action,elementType:one,externalForwardedProps:x,ownerState:y}),[A,j]=Hm(`closeButton`,{elementType:Bh,externalForwardedProps:x,ownerState:y}),[M,N]=Hm(`closeIcon`,{elementType:Vh,externalForwardedProps:x,ownerState:y});return(0,G.jsxs)(S,{...C,children:[u===!1?null:(0,G.jsx)(w,{...T,children:u||d[m]||Hh[m]}),(0,G.jsx)(E,{...D,children:i}),r==null?null:(0,G.jsx)(O,{...k,children:r}),r==null&&f?(0,G.jsx)(O,{...k,children:(0,G.jsx)(A,{size:`small`,"aria-label":o,title:o,color:`inherit`,onClick:f,...j,children:(0,G.jsx)(M,{fontSize:`small`,...N})})}):null]})});function sne(e={}){let{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:i,resumeHideDuration:a}=e,o=Ah();C.useEffect(()=>{if(!i)return;function e(e){e.defaultPrevented||e.key===`Escape`&&r?.(e,`escapeKeyDown`)}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[i,r]);let s=oh((e,t)=>{r?.(e,t)}),c=oh(e=>{!r||e==null||o.start(e,()=>{s(null,`timeout`)})});C.useEffect(()=>(i&&c(t),o.clear),[i,t,c,o]);let l=e=>{r?.(e,`clickaway`)},u=o.clear,d=C.useCallback(()=>{t!=null&&c(a??t*.5)},[t,a,c]),f=e=>t=>{let n=e.onBlur;n?.(t),d()},p=e=>t=>{let n=e.onFocus;n?.(t),u()},m=e=>t=>{let n=e.onMouseEnter;n?.(t),u()},h=e=>t=>{let n=e.onMouseLeave;n?.(t),d()};return C.useEffect(()=>{if(!n&&i)return window.addEventListener(`focus`,d),window.addEventListener(`blur`,u),()=>{window.removeEventListener(`focus`,d),window.removeEventListener(`blur`,u)}},[n,i,d,u]),{getRootProps:(t={})=>{let n={...zm(e),...zm(t)};return{role:`presentation`,...t,...n,onBlur:f(n),onFocus:p(n),onMouseEnter:m(n),onMouseLeave:h(n)}},onClickAway:l}}function Wh(e){return e?.props?.ref||null}function Gh(e){return e.substring(2).toLowerCase()}function cne(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function Kh(e){let{children:t,disableReactTree:n=!1,mouseEvent:r=`onClick`,onClickAway:i,touchEvent:a=`onTouchEnd`}=e,o=C.useRef(!1),s=C.useRef(null),c=C.useRef(!1),l=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{c.current=!0},0),()=>{c.current=!1}),[]);let u=Im(Wh(t),s),d=oh(e=>{let t=l.current;l.current=!1;let r=Zm(s.current);if(!c.current||!s.current||`clientX`in e&&cne(e,r))return;if(o.current){o.current=!1;return}let a;a=e.composedPath?e.composedPath().includes(s.current):!r.documentElement.contains(e.target)||s.current.contains(e.target),!a&&(n||!t)&&i(e)}),f=e=>n=>{l.current=!0;let r=t.props[e];r&&r(n)},p={ref:u};return a!==!1&&(p[a]=f(a)),C.useEffect(()=>{if(a!==!1){let e=Gh(a),t=Zm(s.current),n=()=>{o.current=!0};return t.addEventListener(e,d),t.addEventListener(`touchmove`,n),()=>{t.removeEventListener(e,d),t.removeEventListener(`touchmove`,n)}}},[d,a]),r!==!1&&(p[r]=f(r)),C.useEffect(()=>{if(r!==!1){let e=Gh(r),t=Zm(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}},[d,r]),C.cloneElement(t,p)}var qh=e=>e.scrollTop;function Jh(e,t){return n=>{if(t){let r=e.current;n===void 0?t(r):t(r,n)}}}function Yh(e,t,n,r,i,a){let o=e===`exited`&&!t?r:n[e]||n.exited;return i||a?{...o,...i,...a}:o}function Xh(e,t){let{timeout:n,easing:r,style:i={}}=e;return{duration:i.transitionDuration??(typeof n==`number`?n:n[t.mode]||0),easing:i.transitionTimingFunction??(typeof r==`object`?r[t.mode]:r),delay:i.transitionDelay}}function Zh(e){return`scale(${e}, ${e**2})`}var lne={entering:{opacity:1,transform:Zh(1)},entered:{opacity:1,transform:`none`},exiting:{opacity:0,transform:Zh(.75)},exited:{opacity:0,transform:Zh(.75)}},une={opacity:0,transform:Zh(.75),visibility:`hidden`},Qh=C.forwardRef(function(e,t){let{addEndListener:n,appear:r=!0,children:i,easing:a,in:o,onEnter:s,onEntered:c,onEntering:l,onExit:u,onExited:d,onExiting:f,style:p,timeout:m=`auto`,...h}=e,g=Ah(),_=C.useRef(),v=wm(),y=C.useRef(null),b=ch(y,Wh(i),t),x=Jh(y,l),S=Jh(y,(e,t)=>{qh(e);let{duration:n,delay:r,easing:i}=Xh({style:p,timeout:m,easing:a},{mode:`enter`}),o;m===`auto`?(o=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=o):o=n,e.style.transition=[v.transitions.create(`opacity`,{duration:o,delay:r}),v.transitions.create(`transform`,{duration:o*.666,delay:r,easing:i})].join(`,`),s&&s(e,t)}),w=Jh(y,c),T=Jh(y,f),E=Jh(y,e=>{let{duration:t,delay:n,easing:r}=Xh({style:p,timeout:m,easing:a},{mode:`exit`}),i;m===`auto`?(i=v.transitions.getAutoHeightDuration(e.clientHeight),_.current=i):i=t,e.style.transition=[v.transitions.create(`opacity`,{duration:i,delay:n}),v.transitions.create(`transform`,{duration:i*.666,delay:n||i*.333,easing:r})].join(`,`),e.style.opacity=0,e.style.transform=Zh(.75),u&&u(e)}),D=Jh(y,e=>{e.style.transition=``,d&&d(e)});return(0,G.jsx)(wh,{appear:r,in:o,nodeRef:y,onEnter:S,onEntered:w,onEntering:x,onExit:E,onExited:D,onExiting:T,addEndListener:e=>{m===`auto`&&g.start(_.current||0,e),n&&n(y.current,e)},timeout:m===`auto`?null:m,...h,children:(e,{ownerState:t,...n})=>{let r=Yh(e,o,lne,une,p,i.props.style);return C.cloneElement(i,{style:r,ref:b,...n})}})});Qh&&(Qh.muiSupportAuto=!0);function dne(e){return Jd(`MuiSnackbarContent`,e)}Yd(`MuiSnackbarContent`,[`root`,`message`,`action`]);var fne=e=>{let{classes:t}=e;return Cp({root:[`root`],action:[`action`],message:[`message`]},dne,t)},pne=J(Wm,{name:`MuiSnackbarContent`,slot:`Root`})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Pf(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Pf(e.palette.background.default,t),display:`flex`,alignItems:`center`,flexWrap:`wrap`,padding:`6px 16px`,flexGrow:1,[e.breakpoints.up(`sm`)]:{flexGrow:`initial`,minWidth:288}}})),mne=J(`div`,{name:`MuiSnackbarContent`,slot:`Message`})({padding:`8px 0`}),hne=J(`div`,{name:`MuiSnackbarContent`,slot:`Action`})({display:`flex`,alignItems:`center`,marginLeft:`auto`,paddingLeft:16,marginRight:-8}),gne=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiSnackbarContent`}),{action:r,className:i,message:a,role:o=`alert`,...s}=n,c=n,l=fne(c);return(0,G.jsxs)(pne,{role:o,elevation:6,className:K(l.root,i),ownerState:c,ref:t,...s,children:[(0,G.jsx)(mne,{className:l.message,ownerState:c,children:a}),r?(0,G.jsx)(hne,{className:l.action,ownerState:c,children:r}):null]})});function _ne(e){return Jd(`MuiSnackbar`,e)}Yd(`MuiSnackbar`,[`root`,`anchorOriginTopCenter`,`anchorOriginBottomCenter`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`]);var vne=e=>{let{classes:t,anchorOrigin:n}=e;return Cp({root:[`root`,`anchorOrigin${Y(n.vertical)}${Y(n.horizontal)}`]},_ne,t)},yne=J(`div`,{name:`MuiSnackbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`anchorOrigin${Y(n.anchorOrigin.vertical)}${Y(n.anchorOrigin.horizontal)}`]]}})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:`fixed`,display:`flex`,left:8,right:8,justifyContent:`center`,alignItems:`center`,variants:[{props:({ownerState:e})=>e.anchorOrigin.vertical===`top`,style:{top:8,[e.breakpoints.up(`sm`)]:{top:24}}},{props:({ownerState:e})=>e.anchorOrigin.vertical!==`top`,style:{bottom:8,[e.breakpoints.up(`sm`)]:{bottom:24}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`left`,style:{justifyContent:`flex-start`,[e.breakpoints.up(`sm`)]:{left:24,right:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`right`,style:{justifyContent:`flex-end`,[e.breakpoints.up(`sm`)]:{right:24,left:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`center`,style:{[e.breakpoints.up(`sm`)]:{left:`50%`,right:`auto`,transform:`translateX(-50%)`}}}]}))),$h=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiSnackbar`}),r=wm(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:o,horizontal:s}={vertical:`bottom`,horizontal:`left`},autoHideDuration:c=null,children:l,className:u,ClickAwayListenerProps:d,ContentProps:f,disableWindowBlurListener:p=!1,message:m,onBlur:h,onClose:g,onFocus:_,onMouseEnter:v,onMouseLeave:y,open:b,resumeHideDuration:x,slots:S={},slotProps:w={},TransitionComponent:T,transitionDuration:E=i,TransitionProps:{onEnter:D,onExited:O,...k}={},...A}=n,j={...n,anchorOrigin:{vertical:o,horizontal:s},autoHideDuration:c,disableWindowBlurListener:p,TransitionComponent:T,transitionDuration:E},M=vne(j),{getRootProps:N,onClickAway:P}=sne(j),[F,I]=C.useState(!0),L=e=>{I(!0),O&&O(e)},R=(e,t)=>{I(!1),D&&D(e,t)},ee={slots:{transition:T,...S},slotProps:{content:f,clickAwayListener:d,transition:k,...w}},[z,te]=Hm(`root`,{ref:t,className:[M.root,u],elementType:yne,getSlotProps:N,externalForwardedProps:{...ee,...A},ownerState:j}),[B,{ownerState:V,...ne}]=Hm(`clickAwayListener`,{elementType:Kh,externalForwardedProps:ee,getSlotProps:e=>({onClickAway:(...t)=>{let n=t[0];e.onClickAway?.(...t),!n?.defaultMuiPrevented&&P(...t)}}),ownerState:j}),[re,ie]=Hm(`content`,{elementType:gne,shouldForwardComponentProp:!0,externalForwardedProps:ee,additionalProps:{message:m,action:a},ownerState:j}),[ae,oe]=Hm(`transition`,{elementType:Qh,externalForwardedProps:ee,getSlotProps:e=>({onEnter:(...t)=>{e.onEnter?.(...t),R(...t)},onExited:(...t)=>{e.onExited?.(...t),L(...t)}}),additionalProps:{appear:!0,in:b,timeout:E,direction:o===`top`?`down`:`up`},ownerState:j});return!b&&F?null:(0,G.jsx)(B,{...ne,...S.clickAwayListener&&{ownerState:V},children:(0,G.jsx)(z,{...te,children:(0,G.jsx)(ae,{...oe,children:l||(0,G.jsx)(re,{...ie})})})})}),eg=(0,C.createContext)({show:()=>{}}),bne=0,xne=e=>{let[t,n]=(0,C.useState)([]),r=(0,C.useCallback)(e=>{n(t=>[...t,{...e,autoHideDuration:e.autoHideDuration??6e3,notificationId:bne++}])},[]),i=e=>{n(t=>t.filter(t=>t.notificationId!==e))};return(0,G.jsxs)(eg.Provider,{value:{show:r},children:[e.children,t.map(e=>(0,G.jsx)($h,{open:!0,autoHideDuration:e.autoHideDuration,onClose:()=>i(e.notificationId),children:(0,G.jsx)(Uh,{severity:e.severity,variant:`filled`,sx:{minWidth:`300px`},children:e.message})},e.notificationId))]})};function tg(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var ng=typeof Symbol==`function`&&Symbol.observable||`@@observable`,rg=()=>Math.random().toString(36).substring(7).split(``).join(`.`),ig={INIT:`@@redux/INIT${rg()}`,REPLACE:`@@redux/REPLACE${rg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${rg()}`};function ag(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function og(e,t,n){if(typeof e!=`function`)throw Error(tg(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(tg(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(tg(1));return n(og)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(tg(3));return i}function d(e){if(typeof e!=`function`)throw Error(tg(4));if(c)throw Error(tg(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(tg(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!ag(e))throw Error(tg(7));if(e.type===void 0)throw Error(tg(8));if(typeof e.type!=`string`)throw Error(tg(17));if(c)throw Error(tg(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(tg(10));r=e,f({type:ig.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(tg(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[ng](){return this}}}return f({type:ig.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[ng]:m}}function Sne(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:ig.INIT})===void 0)throw Error(tg(12));if(n(void 0,{type:ig.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(tg(13))})}function Cne(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{Sne(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(tg(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function sg(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function wne(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(tg(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=sg(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function Tne(e){return ag(e)&&`type`in e&&typeof e.type==`string`}var cg=Symbol.for(`immer-nothing`),lg=Symbol.for(`immer-draftable`),ug=Symbol.for(`immer-state`);function dg(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fg=Object,pg=fg.getPrototypeOf,mg=`constructor`,hg=`prototype`,gg=`configurable`,_g=`enumerable`,vg=`writable`,yg=`value`,bg=e=>!!e&&!!e[ug];function xg(e){return e?Cg(e)||kg(e)||!!e[lg]||!!e[mg]?.[lg]||Ag(e)||jg(e):!1}var Ene=fg[hg][mg].toString(),Sg=new WeakMap;function Cg(e){if(!e||!Mg(e))return!1;let t=pg(e);if(t===null||t===fg[hg])return!0;let n=fg.hasOwnProperty.call(t,mg)&&t[mg];if(n===Object)return!0;if(!Ng(n))return!1;let r=Sg.get(n);return r===void 0&&(r=Function.toString.call(n),Sg.set(n,r)),r===Ene}function wg(e,t,n=!0){Tg(e)===0?(n?Reflect.ownKeys(e):fg.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Tg(e){let t=e[ug];return t?t.type_:kg(e)?1:Ag(e)?2:jg(e)?3:0}var Eg=(e,t,n=Tg(e))=>n===2?e.has(t):fg[hg].hasOwnProperty.call(e,t),Dg=(e,t,n=Tg(e))=>n===2?e.get(t):e[t],Og=(e,t,n,r=Tg(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function Dne(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var kg=Array.isArray,Ag=e=>e instanceof Map,jg=e=>e instanceof Set,Mg=e=>typeof e==`object`,Ng=e=>typeof e==`function`,Pg=e=>typeof e==`boolean`;function One(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Fg=e=>e.copy_||e.base_,Ig=e=>e.modified_?e.copy_:e.base_;function Lg(e,t){if(Ag(e))return new Map(e);if(jg(e))return new Set(e);if(kg(e))return Array[hg].slice.call(e);let n=Cg(e);if(t===!0||t===`class_only`&&!n){let t=fg.getOwnPropertyDescriptors(e);delete t[ug];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[vg]===!1&&(a[vg]=!0,a[gg]=!0),(a.get||a.set)&&(t[i]={[gg]:!0,[vg]:!0,[_g]:a[_g],[yg]:e[i]})}return fg.create(pg(e),t)}else{let t=pg(e);if(t!==null&&n)return{...e};let r=fg.create(t);return fg.assign(r,e)}}function Rg(e,t=!1){return Bg(e)||bg(e)||!xg(e)?e:(Tg(e)>1&&fg.defineProperties(e,{set:zg,add:zg,clear:zg,delete:zg}),fg.freeze(e),t&&wg(e,(e,t)=>{Rg(t,!0)},!1),e)}function kne(){dg(2)}var zg={[yg]:kne};function Bg(e){return e===null||!Mg(e)?!0:fg.isFrozen(e)}var Vg=`MapSet`,Hg=`Patches`,Ug=`ArrayMethods`,Wg={};function Gg(e){let t=Wg[e];return t||dg(0,e),t}var Kg=e=>!!Wg[e],qg,Jg=()=>qg,Ane=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Kg(Vg)?Gg(Vg):void 0,arrayMethodsPlugin_:Kg(Ug)?Gg(Ug):void 0});function Yg(e,t){t&&(e.patchPlugin_=Gg(Hg),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xg(e){Zg(e),e.drafts_.forEach(jne),e.drafts_=null}function Zg(e){e===qg&&(qg=e.parent_)}var Qg=e=>qg=Ane(qg,e);function jne(e){let t=e[ug];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $g(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ug].modified_&&(Xg(t),dg(4)),xg(e)&&(e=e_(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ug].base_,e,t)}else e=e_(t,n);return Mne(t,e,!0),Xg(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===cg?void 0:e}function e_(e,t){if(Bg(t))return t;let n=t[ug];if(!n)return a_(t,e.handledSet_,e);if(!n_(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);i_(n,e)}return n.copy_}function Mne(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Rg(t,n)}function t_(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var n_=(e,t)=>e.scope_===t,Nne=[];function r_(e,t,n,r){let i=Fg(e),a=e.type_;if(r!==void 0&&Dg(i,r,a)===t){Og(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;wg(i,(e,n)=>{if(bg(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??Nne;for(let e of o)Og(i,e,n,a)}function Pne(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!n_(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Ig(i);r_(e,i.draft_??i,a,n),i_(i,r)})}function i_(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}t_(e)}}function Fne(e,t,n){let{scope_:r}=e;if(bg(n)){let i=n[ug];n_(i,r)&&i.callbacks_.push(function(){d_(e),r_(e,n,Ig(i),t)})}else xg(n)&&e.callbacks_.push(function(){let i=Fg(e);e.type_===3?i.has(n)&&a_(n,r.handledSet_,r):Dg(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&a_(Dg(e.copy_,t,e.type_),r.handledSet_,r)})}function a_(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||bg(e)||t.has(e)||!xg(e)||Bg(e)?e:(t.add(e),wg(e,(r,i)=>{if(bg(i)){let t=i[ug];n_(t,n)&&(Og(e,r,Ig(t),e.type_),t_(t))}else xg(i)&&a_(i,t,n)}),e)}function Ine(e,t){let n=kg(e),r={type_:+!!n,scope_:t?t.scope_:Jg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=o_;n&&(i=[r],a=s_);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var o_={get(e,t){if(t===ug)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Fg(e);if(!Eg(i,t,e.type_))return Lne(e,i,t);let a=i[t];if(e.finalized_||!xg(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&One(t))return a;if(a===c_(e.base_,t)){d_(e);let n=e.type_===1?+t:t,r=f_(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Fg(e)},ownKeys(e){return Reflect.ownKeys(Fg(e))},set(e,t,n){let r=l_(Fg(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=c_(Fg(e),t),i=r?.[ug];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(Dne(n,r)&&(n!==void 0||Eg(e.base_,t,e.type_)))return!0;d_(e),u_(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),Fne(e,t,n),!0)},deleteProperty(e,t){return d_(e),c_(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),u_(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Fg(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[vg]:!0,[gg]:e.type_!==1||t!==`length`,[_g]:r[_g],[yg]:n[t]}},defineProperty(){dg(11)},getPrototypeOf(e){return pg(e.base_)},setPrototypeOf(){dg(12)}},s_={};for(let e in o_){let t=o_[e];s_[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}s_.deleteProperty=function(e,t){return s_.set.call(this,e,t,void 0)},s_.set=function(e,t,n){return o_.set.call(this,e[0],t,n,e[0])};function c_(e,t){let n=e[ug];return(n?Fg(n):e)[t]}function Lne(e,t,n){let r=l_(t,n);return r?yg in r?r[yg]:r.get?.call(e.draft_):void 0}function l_(e,t){if(!(t in e))return;let n=pg(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=pg(n)}}function u_(e){e.modified_||(e.modified_=!0,e.parent_&&u_(e.parent_))}function d_(e){e.copy_||=(e.assigned_=new Map,Lg(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Rne=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(Ng(e)&&!Ng(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}Ng(t)||dg(6),n!==void 0&&!Ng(n)&&dg(7);let r;if(xg(e)){let i=Qg(this),a=f_(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Xg(i):Zg(i)}return Yg(i,n),$g(r,i)}else if(!e||!Mg(e)){if(r=t(e),r===void 0&&(r=e),r===cg&&(r=void 0),this.autoFreeze_&&Rg(r,!0),n){let t=[],i=[];Gg(Hg).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}else dg(1,e)},this.produceWithPatches=(e,t)=>{if(Ng(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Pg(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Pg(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Pg(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xg(e)||dg(8),bg(e)&&(e=zne(e));let t=Qg(this),n=f_(t,e,void 0);return n[ug].isManual_=!0,Zg(t),n}finishDraft(e,t){let n=e&&e[ug];(!n||!n.isManual_)&&dg(9);let{scope_:r}=n;return Yg(r,t),$g(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Gg(Hg).applyPatches_;return bg(e)?r(e,t):this.produce(e,e=>r(e,t))}};function f_(e,t,n,r){let[i,a]=Ag(t)?Gg(Vg).proxyMap_(t,n):jg(t)?Gg(Vg).proxySet_(t,n):Ine(t,n);return(n?.scope_??Jg()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?Pne(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function zne(e){return bg(e)||dg(10,e),p_(e)}function p_(e){if(!xg(e)||Bg(e))return e;let t=e[ug],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Lg(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Lg(e,!0);return wg(n,(e,t)=>{Og(n,e,p_(t))},r),t&&(t.finalized_=!1),n}var m_=new Rne().produce,h_=Symbol(`NOT_FOUND`);function Bne(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Vne(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function Hne(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var g_=e=>Array.isArray(e)?e:[e];function Une(e){let t=Array.isArray(e[0])?e[0]:e;return Hne(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Wne(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function Gne(e){let t;return{get(n){return t&&e(t.key,n)?t.value:h_},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Kne(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return h_}function i(t,i){r(t)===h_&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var qne=(e,t)=>e===t;function Jne(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function Yne(e,t){let{equalityCheck:n=qne,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=Jne(n),o=0,s=r<=1?Gne(a):Kne(r,a);function c(){let t=s.get(arguments);if(t===h_){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Xne=class{constructor(e){this.value=e}deref(){return this.value}},Zne=typeof WeakRef<`u`?WeakRef:Xne,Qne=0,__=1;function v_(){return{s:Qne,v:void 0,o:null,p:null}}function y_(e,t={}){let n=v_(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=v_(),e.set(n,t)):t=r}}let s=t,c;if(t.s===__)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Zne(c):c}return s.s=__,s.v=c,c}return o.clearCache=()=>{n=v_(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function b_(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Bne(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=y_,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=g_(c),p=g_(u),m=Une(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=Wne(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var x_=b_(y_),$ne=Object.assign((e,t=x_)=>{Vne(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>$ne});function S_(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var ere=S_(),tre=S_,nre=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?sg:sg.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var rre=e=>e&&typeof e.match==`function`;function C_(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(A_(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>Tne(t)&&t.type===e,n}var w_=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function T_(e){return xg(e)?m_(e,()=>{}):e}function ire(e){return typeof e==`boolean`}var are=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new w_;return t&&(ire(t)?a.push(ere):a.push(tre(t.extraArgument))),a},ore=`RTK_autoBatch`,E_=e=>t=>{setTimeout(t,e)},sre=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?window.requestAnimationFrame:E_(10):e.type===`callback`?e.queueNotification:E_(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[ore],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},cre=e=>function(t){let{autoBatch:n=!0}=t??{},r=new w_(e);return n&&r.push(sre(typeof n==`object`?n:void 0)),r};function lre(e){let t=are(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(ag(n))c=Cne(n);else throw Error(A_(1));let l;l=typeof r==`function`?r(t):t();let u=sg;i&&(u=nre({trace:!1,...typeof i==`object`&&i}));let d=cre(wne(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return og(c,o,p)}function ure(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(A_(28));if(r in t)throw Error(A_(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function dre(e){return typeof e==`function`}function D_(e,t){let[n,r,i]=ure(t),a;if(dre(e))a=()=>T_(e());else{let t=T_(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n)if(bg(e)){let r=n(e,t);return r===void 0?e:r}else if(xg(e))return m_(e,e=>n(e,t));else{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(`A case reducer on a non-draftable value must not return undefined`)}return r}return e},e)}return o.getInitialState=a,o}var fre=(e,t)=>rre(e)?e.match(t):e(t);function pre(...e){return t=>e.some(e=>fre(e,t))}var mre=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,hre=(e=21)=>{let t=``,n=e;for(;n--;)t+=mre[Math.random()*64|0];return t},gre=[`name`,`message`,`stack`,`code`],O_=class{constructor(e,t){this.payload=e,this.meta=t}_type},_re=class{constructor(e,t){this.payload=e,this.meta=t}_type},vre=e=>{if(typeof e==`object`&&e){let t={};for(let n of gre)typeof e[n]==`string`&&(t[n]=e[n]);return t}return{message:String(e)}},yre=`External signal was aborted`,bre=(()=>{function e(e,t,n){let r=C_(e+`/fulfilled`,(e,t,n,r)=>({payload:e,meta:{...r||{},arg:n,requestId:t,requestStatus:`fulfilled`}})),i=C_(e+`/pending`,(e,t,n)=>({payload:void 0,meta:{...n||{},arg:t,requestId:e,requestStatus:`pending`}})),a=C_(e+`/rejected`,(e,t,r,i,a)=>({payload:i,error:(n&&n.serializeError||vre)(e||`Rejected`),meta:{...a||{},arg:r,requestId:t,rejectedWithValue:!!i,requestStatus:`rejected`,aborted:e?.name===`AbortError`,condition:e?.name===`ConditionError`}}));function o(e,{signal:o}={}){return(s,c,l)=>{let u=n?.idGenerator?n.idGenerator(e):hre(),d=new AbortController,f,p;function m(e){p=e,d.abort()}o&&(o.aborted?m(yre):o.addEventListener(`abort`,()=>m(yre),{once:!0}));let h=async function(){let o;try{let a=n?.condition?.(e,{getState:c,extra:l});if(Sre(a)&&(a=await a),a===!1||d.signal.aborted)throw{name:`ConditionError`,message:`Aborted due to condition callback returning false.`};let h=new Promise((e,t)=>{f=()=>{t({name:`AbortError`,message:p||`Aborted`})},d.signal.addEventListener(`abort`,f,{once:!0})});s(i(u,e,n?.getPendingMeta?.({requestId:u,arg:e},{getState:c,extra:l}))),o=await Promise.race([h,Promise.resolve(t(e,{dispatch:s,getState:c,extra:l,requestId:u,signal:d.signal,abort:m,rejectWithValue:(e,t)=>new O_(e,t),fulfillWithValue:(e,t)=>new _re(e,t)})).then(t=>{if(t instanceof O_)throw t;return t instanceof _re?r(t.payload,u,e,t.meta):r(t,u,e)})])}catch(t){o=t instanceof O_?a(null,u,e,t.payload,t.meta):a(t,u,e)}finally{f&&d.signal.removeEventListener(`abort`,f)}return n&&!n.dispatchConditionRejection&&a.match(o)&&o.meta.condition||s(o),o}();return Object.assign(h,{abort:m,requestId:u,arg:e,unwrap(){return h.then(xre)}})}}return Object.assign(o,{pending:i,rejected:a,fulfilled:r,settled:pre(a,r),typePrefix:e})}return e.withTypes=()=>e,e})();function xre(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}function Sre(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}var Cre=`listener`,wre=`completed`,Tre=`cancelled`;`${Tre}`,`${wre}`,`${Cre}${Tre}`,`${Cre}${wre}`;var{assign:Ere}=Object,k_=`listenerMiddleware`,Dre=Ere(C_(`${k_}/add`),{withTypes:()=>Dre});`${k_}`;var Ore=Ere(C_(`${k_}/remove`),{withTypes:()=>Ore});function A_(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kre=class extends Error{status;body;constructor(e,t,n){super(e),this.status=t,this.body=n,this.name=`ApiError`}};async function j_(e){let t=await e.text();try{return JSON.parse(t)}catch{throw new kre(`Invalid JSON response (HTTP ${e.status}): ${t.slice(0,120)}`,e.status,t)}}async function M_(e,t){if(!e.ok){let n=await e.text().catch(()=>``),r=t;try{let e=JSON.parse(n);e?.error&&(r=e.error)}catch{r=n?`${t} (HTTP ${e.status}: ${n.slice(0,120)})`:`${t} (HTTP ${e.status})`}throw Error(r)}}async function Are(){let e=await fetch(`api/matter/bridges?_s=${Date.now()}`);return await M_(e,`Failed to fetch bridges`),j_(e)}async function N_(e){let t=await fetch(`api/matter/bridges`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to create bridge`),j_(t)}async function P_(e){let t=await fetch(`api/matter/bridges/${e.id}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to update bridge`),j_(t)}async function jre(e){await M_(await fetch(`api/matter/bridges/${e}`,{method:`DELETE`}),`Failed to delete bridge`)}async function Mre(e){let t=await fetch(`api/matter/bridges/${e}/actions/factory-reset`,{method:`POST`});return await M_(t,`Factory reset failed`),j_(t)}async function F_(e){let t=await fetch(`api/matter/bridges/${e}/actions/force-sync`,{method:`POST`});return await M_(t,`Force sync failed`),j_(t)}async function Nre(e){let t=await fetch(`api/matter/bridges/${e}/actions/open-commissioning-window`,{method:`POST`});return await M_(t,`Failed to open commissioning window`),j_(t)}async function Pre(e){if(!(await fetch(`api/matter/bridges/priorities`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({updates:e})})).ok)throw Error(`Failed to update priorities`)}async function I_(){let e=await fetch(`api/matter/bridges/actions/start-all`,{method:`POST`});return await M_(e,`Failed to start all bridges`),j_(e)}async function L_(){let e=await fetch(`api/matter/bridges/actions/stop-all`,{method:`POST`});return await M_(e,`Failed to stop all bridges`),j_(e)}async function R_(){let e=await fetch(`api/matter/bridges/actions/restart-all`,{method:`POST`});return await M_(e,`Failed to restart all bridges`),j_(e)}var z_=bre.withTypes(),B_=x_.withTypes(),V_=z_(`bridges/load`,Are),H_=z_(`bridges/create`,N_),U_=z_(`bridges/delete`,jre),W_=z_(`bridges/update`,P_),G_=z_(`bridges/reset`,Mre),K_=C_(`bridges/setFromWebSocket`),q_=C_(`bridges/updateFromWebSocket`),J_=V.withTypes(),Y_=ie.withTypes(),X_=(0,C.createContext)({isConnected:!1,error:null});function Z_(){return(0,C.useContext)(X_)}function Fre({children:e}){let t=J_(),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(e=>{switch(e.type){case`bridges_update`:t(K_(e.data));break;case`bridge_update`:t(q_(e.data));break;case`ping`:o.current?.send(JSON.stringify({type:`pong`}));break}},[t]),l=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=document.querySelector(`base`)?.href||window.location.origin,n=new URL(t),i=`${e}//${n.host}${n.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`);try{let e=new WebSocket(i);o.current=e,e.onopen=()=>{r(!0),a(null)},e.onmessage=e=>{try{c(JSON.parse(e.data))}catch{console.warn(`Invalid WebSocket message`)}},e.onclose=()=>{r(!1),o.current=null,s.current=setTimeout(l,3e3)},e.onerror=()=>{a(Error(`WebSocket connection error`)),e.close()}}catch(e){a(e instanceof Error?e:Error(`Failed to connect`))}},[c]);return(0,C.useEffect)(()=>(l(),()=>{s.current&&clearTimeout(s.current),o.current?.close()}),[l]),(0,G.jsx)(X_.Provider,{value:{isConnected:n,error:i},children:e})}var Ire=()=>{let e=J_();return(0,C.useEffect)(()=>{e(V_())},[e]),(0,G.jsx)(_i,{})},Q_;(function(e){e.Starting=`starting`,e.Running=`running`,e.Stopped=`stopped`,e.Failed=`failed`})(Q_||={});var $_;(function(e){e.Pattern=`pattern`,e.Regex=`regex`,e.Domain=`domain`,e.Platform=`platform`,e.Label=`label`,e.EntityLabel=`entity_label`,e.DeviceLabel=`device_label`,e.EntityLabelRegex=`entity_label_regex`,e.DeviceLabelRegex=`device_label_regex`,e.AnyFieldRegex=`any_field_regex`,e.Area=`area`,e.EntityCategory=`entity_category`,e.DeviceName=`device_name`,e.ProductName=`product_name`,e.Manufacturer=`manufacturer`,e.DeviceClass=`device_class`})($_||={});var ev=[{id:`all_lights`,name:`All Lights`,description:`Expose all light entities. Ideal for controlling lights via Apple Home, Google Home, or Alexa.`,icon:`light`,filter:{include:[{type:$_.Domain,value:`light`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`lights`,`popular`]},{id:`all_switches`,name:`All Switches & Plugs`,description:`Expose all switch entities including smart plugs. Includes power and energy monitoring.`,icon:`switch`,filter:{include:[{type:$_.Domain,value:`switch`}],exclude:[]},featureFlags:{},tags:[`switches`,`plugs`]},{id:`sensors_only`,name:`All Sensors`,description:`Expose temperature, humidity, pressure, and other sensors. Auto-combines related sensors from the same device.`,icon:`sensor`,filter:{include:[{type:$_.Domain,value:`sensor`},{type:$_.Domain,value:`binary_sensor`}],exclude:[]},featureFlags:{autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`sensors`,`temperature`,`humidity`]},{id:`climate_control`,name:`Climate & Covers`,description:`Expose thermostats, fans, covers, and humidifiers for climate control.`,icon:`climate`,filter:{include:[{type:$_.Domain,value:`climate`},{type:$_.Domain,value:`fan`},{type:$_.Domain,value:`cover`},{type:$_.Domain,value:`humidifier`}],exclude:[]},featureFlags:{autoBatteryMapping:!0},tags:[`climate`,`thermostat`,`covers`]},{id:`security`,name:`Security & Locks`,description:`Expose locks, alarm panels, and security-related binary sensors (motion, door, window).`,icon:`lock`,filter:{include:[{type:$_.Domain,value:`lock`},{type:$_.Domain,value:`alarm_control_panel`},{type:$_.DeviceClass,value:`motion`},{type:$_.DeviceClass,value:`door`},{type:$_.DeviceClass,value:`window`}],exclude:[],includeMode:`any`},featureFlags:{autoBatteryMapping:!0},tags:[`security`,`locks`,`alarm`]},{id:`robot_vacuum`,name:`Robot Vacuum (Server Mode)`,description:`Single vacuum bridge with Server Mode enabled. Required for Apple Home Siri commands and proper Alexa discovery. Best with just the vacuum on this bridge.`,icon:`vacuum`,filter:{include:[{type:$_.Domain,value:`vacuum`}],exclude:[]},featureFlags:{serverMode:!0},tags:[`vacuum`,`server-mode`,`apple-home`]},{id:`media_players`,name:`Media Players & Speakers`,description:`Expose media players, speakers, and TVs for volume and playback control.`,icon:`media_player`,filter:{include:[{type:$_.Domain,value:`media_player`}],exclude:[]},featureFlags:{},tags:[`media`,`speakers`,`tv`]},{id:`google_home_optimized`,name:`Google Home Optimized`,description:`All devices with Auto Force Sync enabled. Prevents Google Home from showing devices as offline after a few hours.`,icon:`default`,filter:{include:[{type:$_.Pattern,value:`*`}],exclude:[]},featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0},tags:[`google-home`,`all-devices`]},{id:`alexa_covers`,name:`Alexa-Optimized Covers`,description:`Covers with Alexa-friendly percentage display. Displayed percentage matches Home Assistant values.`,icon:`cover`,filter:{include:[{type:$_.Domain,value:`cover`}],exclude:[]},featureFlags:{coverUseHomeAssistantPercentage:!0,autoBatteryMapping:!0},tags:[`alexa`,`covers`]},{id:`automations_scripts`,name:`Automations & Scripts`,description:`Expose Home Assistant automations, scripts, and scenes as Matter switches.`,icon:`remote`,filter:{include:[{type:$_.Domain,value:`automation`},{type:$_.Domain,value:`script`},{type:$_.Domain,value:`scene`}],exclude:[]},featureFlags:{},tags:[`automations`,`scripts`,`scenes`]}],Lre;(function(e){e[e.locked=1]=`locked`,e[e.unlocked=2]=`unlocked`})(Lre||={});var Rre;(function(e){e[e.Off=0]=`Off`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.On=4]=`On`,e[e.Auto=5]=`Auto`,e[e.Smart=6]=`Smart`})(Rre||={});var zre;(function(e){e[e.Forward=0]=`Forward`,e[e.Reverse=1]=`Reverse`})(zre||={});var Bre;(function(e){e[e.OffLowMedHigh=0]=`OffLowMedHigh`,e[e.OffLowHigh=1]=`OffLowHigh`,e[e.OffLowMedHighAuto=2]=`OffLowMedHighAuto`,e[e.OffLowHighAuto=3]=`OffLowHighAuto`,e[e.OffHighAuto=4]=`OffHighAuto`,e[e.OffHigh=5]=`OffHigh`})(Bre||={});var Vre;(function(e){e[e.Stopped=0]=`Stopped`,e[e.Running=1]=`Running`,e[e.Paused=2]=`Paused`,e[e.Error=3]=`Error`,e[e.SeekingCharger=64]=`SeekingCharger`,e[e.Charging=65]=`Charging`,e[e.Docked=66]=`Docked`})(Vre||={});var Hre;(function(e){e[e.Off=0]=`Off`,e[e.Auto=1]=`Auto`,e[e.Cool=3]=`Cool`,e[e.Heat=4]=`Heat`,e[e.EmergencyHeat=5]=`EmergencyHeat`,e[e.Precooling=6]=`Precooling`,e[e.FanOnly=7]=`FanOnly`,e[e.Dry=8]=`Dry`,e[e.Sleep=9]=`Sleep`})(Hre||={});var tv;(function(e){e.homeAssistantEntity=`homeAssistantEntity`,e.identify=`identify`,e.groups=`groups`,e.scenesManagement=`scenesManagement`,e.bridgedDeviceBasicInformation=`bridgedDeviceBasicInformation`,e.airQuality=`airQuality`,e.booleanState=`booleanState`,e.booleanStateConfiguration=`booleanStateConfiguration`,e.carbonDioxideConcentrationMeasurement=`carbonDioxideConcentrationMeasurement`,e.carbonMonoxideConcentrationMeasurement=`carbonMonoxideConcentrationMeasurement`,e.colorControl=`colorControl`,e.doorLock=`doorLock`,e.electricalEnergyMeasurement=`electricalEnergyMeasurement`,e.electricalPowerMeasurement=`electricalPowerMeasurement`,e.flowMeasurement=`flowMeasurement`,e.levelControl=`levelControl`,e.fanControl=`fanControl`,e.illuminanceMeasurement=`illuminanceMeasurement`,e.nitrogenDioxideConcentrationMeasurement=`nitrogenDioxideConcentrationMeasurement`,e.occupancySensing=`occupancySensing`,e.onOff=`onOff`,e.ozoneConcentrationMeasurement=`ozoneConcentrationMeasurement`,e.pm1ConcentrationMeasurement=`pm1ConcentrationMeasurement`,e.pm10ConcentrationMeasurement=`pm10ConcentrationMeasurement`,e.pm25ConcentrationMeasurement=`pm25ConcentrationMeasurement`,e.powerSource=`powerSource`,e.powerTopology=`powerTopology`,e.pressureMeasurement=`pressureMeasurement`,e.relativeHumidityMeasurement=`relativeHumidityMeasurement`,e.smokeCoAlarm=`smokeCoAlarm`,e.temperatureMeasurement=`temperatureMeasurement`,e.thermostat=`thermostat`,e.thermostatUserInterfaceConfiguration=`thermostatUserInterfaceConfiguration`,e.totalVolatileOrganicCompoundsConcentrationMeasurement=`totalVolatileOrganicCompoundsConcentrationMeasurement`,e.valveConfigurationAndControl=`valveConfigurationAndControl`,e.windowCovering=`windowCovering`,e.mediaInput=`mediaInput`,e.rvcCleanMode=`rvcCleanMode`,e.rvcRunMode=`rvcRunMode`,e.rvcOperationalState=`rvcOperationalState`,e.serviceArea=`serviceArea`,e.switch=`switch`,e.modeSelect=`modeSelect`})(tv||={});var Ure={4937:`apple`,4996:`apple`,24582:`google`,4631:`alexa`,4448:`alexa`,4447:`aqara`};function Wre(e){return Ure[e]}var nv=[{id:`apple_home`,name:`Apple Home`,description:`Optimized for Apple Home and Siri. Enables composed devices for clean sensor grouping. Covers use standard Matter percentage (inverted from HA).`,icon:`default`,featureFlags:{autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`google_home`,name:`Google Home`,description:`Optimized for Google Home. Enables Auto Force Sync to prevent devices from going offline. Composed devices enabled for proper sensor grouping.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}},{id:`alexa`,name:`Amazon Alexa`,description:`Optimized for Alexa. Enables Auto Force Sync and Alexa-friendly cover percentages. Battery mapping included for sensor devices.`,icon:`default`,featureFlags:{autoForceSync:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0,coverUseHomeAssistantPercentage:!0}},{id:`multi_controller`,name:`Multi-Controller`,description:`Balanced settings for use with multiple controllers at once (e.g. Apple Home + Alexa). Force Sync enabled. Standard cover behavior.`,icon:`default`,featureFlags:{autoForceSync:!0,autoComposedDevices:!0,autoBatteryMapping:!0,autoHumidityMapping:!0,autoPressureMapping:!0}}],Gre;(function(e){e.Battery=`battery`,e.BatteryCharging=`battery_charging`,e.CarbonMonoxide=`carbon_monoxide`,e.Cold=`cold`,e.Connectivity=`connectivity`,e.Door=`door`,e.GarageDoor=`garage_door`,e.Gas=`gas`,e.Heat=`heat`,e.Light=`light`,e.Lock=`lock`,e.Moisture=`moisture`,e.Motion=`motion`,e.Moving=`moving`,e.Occupancy=`occupancy`,e.Opening=`opening`,e.Plug=`plug`,e.Power=`power`,e.Presence=`presence`,e.Problem=`problem`,e.Running=`running`,e.Safety=`safety`,e.Smoke=`smoke`,e.Sound=`sound`,e.Tamper=`tamper`,e.Update=`update`,e.Vibration=`vibration`,e.Window=`window`})(Gre||={});var Kre;(function(e){e.off=`off`,e.heat=`heat`,e.cool=`cool`,e.heat_cool=`heat_cool`,e.auto=`auto`,e.dry=`dry`,e.fan_only=`fan_only`})(Kre||={});var qre;(function(e){e.off=`off`,e.preheating=`preheating`,e.heating=`heating`,e.cooling=`cooling`,e.drying=`drying`,e.fan=`fan`,e.idle=`idle`,e.defrosting=`defrosting`})(qre||={});var Jre;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.TARGET_TEMPERATURE_RANGE=2]=`TARGET_TEMPERATURE_RANGE`,e[e.TARGET_HUMIDITY=4]=`TARGET_HUMIDITY`,e[e.FAN_MODE=8]=`FAN_MODE`,e[e.PRESET_MODE=16]=`PRESET_MODE`,e[e.SWING_MODE=32]=`SWING_MODE`,e[e.AUX_HEAT=64]=`AUX_HEAT`,e[e.TURN_OFF=128]=`TURN_OFF`,e[e.TURN_ON=256]=`TURN_ON`,e[e.SWING_HORIZONTAL_MODE=512]=`SWING_HORIZONTAL_MODE`})(Jre||={});var Yre;(function(e){e.closed=`closed`,e.open=`open`,e.closing=`closing`,e.opening=`opening`})(Yre||={});var Xre;(function(e){e.button=`button`,e.doorbell=`doorbell`,e.motion=`motion`})(Xre||={});var Zre;(function(e){e.FORWARD=`forward`,e.REVERSE=`reverse`})(Zre||={});var Qre;(function(e){e[e.SET_SPEED=1]=`SET_SPEED`,e[e.OSCILLATE=2]=`OSCILLATE`,e[e.DIRECTION=4]=`DIRECTION`,e[e.PRESET_MODE=8]=`PRESET_MODE`,e[e.TURN_ON=16]=`TURN_ON`,e[e.TURN_OFF=32]=`TURN_OFF`})(Qre||={});var $re;(function(e){e.error=`error`,e.paused=`paused`,e.mowing=`mowing`,e.docked=`docked`,e.returning=`returning`})($re||={});var eie;(function(e){e[e.START_MOWING=1]=`START_MOWING`,e[e.PAUSE=2]=`PAUSE`,e[e.DOCK=4]=`DOCK`})(eie||={});var tie;(function(e){e.UNKNOWN=`unknown`,e.ONOFF=`onoff`,e.BRIGHTNESS=`brightness`,e.COLOR_TEMP=`color_temp`,e.HS=`hs`,e.XY=`xy`,e.RGB=`rgb`,e.RGBW=`rgbw`,e.RGBWW=`rgbww`,e.WHITE=`white`})(tie||={});var nie;(function(e){e.Tv=`tv`,e.Speaker=`speaker`,e.Receiver=`receiver`})(nie||={});var rie;(function(e){e[e.PAUSE=1]=`PAUSE`,e[e.SEEK=2]=`SEEK`,e[e.VOLUME_SET=4]=`VOLUME_SET`,e[e.VOLUME_MUTE=8]=`VOLUME_MUTE`,e[e.PREVIOUS_TRACK=16]=`PREVIOUS_TRACK`,e[e.NEXT_TRACK=32]=`NEXT_TRACK`,e[e.TURN_ON=128]=`TURN_ON`,e[e.TURN_OFF=256]=`TURN_OFF`,e[e.PLAY_MEDIA=512]=`PLAY_MEDIA`,e[e.VOLUME_STEP=1024]=`VOLUME_STEP`,e[e.SELECT_SOURCE=2048]=`SELECT_SOURCE`,e[e.STOP=4096]=`STOP`,e[e.CLEAR_PLAYLIST=8192]=`CLEAR_PLAYLIST`,e[e.PLAY=16384]=`PLAY`,e[e.SHUFFLE_SET=32768]=`SHUFFLE_SET`,e[e.SELECT_SOUND_MODE=65536]=`SELECT_SOUND_MODE`,e[e.BROWSE_MEDIA=131072]=`BROWSE_MEDIA`,e[e.REPEAT_SET=262144]=`REPEAT_SET`,e[e.GROUPING=524288]=`GROUPING`,e[e.MEDIA_ANNOUNCE=1048576]=`MEDIA_ANNOUNCE`,e[e.MEDIA_ENQUEUE=2097152]=`MEDIA_ENQUEUE`})(rie||={});var iie;(function(e){e.None=`None`,e.apparent_power=`apparent_power`,e.aqi=`aqi`,e.atmospheric_pressure=`atmospheric_pressure`,e.battery=`battery`,e.carbon_dioxide=`carbon_dioxide`,e.carbon_monoxide=`carbon_monoxide`,e.current=`current`,e.data_rate=`data_rate`,e.data_size=`data_size`,e.date=`date`,e.distance=`distance`,e.duration=`duration`,e.energy=`energy`,e.energy_storage=`energy_storage`,e.enum=`enum`,e.frequency=`frequency`,e.gas=`gas`,e.humidity=`humidity`,e.illuminance=`illuminance`,e.irradiance=`irradiance`,e.moisture=`moisture`,e.monetary=`monetary`,e.nitrogen_dioxide=`nitrogen_dioxide`,e.nitrogen_monoxide=`nitrogen_monoxide`,e.nitrous_oxide=`nitrous_oxide`,e.ozone=`ozone`,e.ph=`ph`,e.pm1=`pm1`,e.pm25=`pm25`,e.pm10=`pm10`,e.power_factor=`power_factor`,e.power=`power`,e.precipitation=`precipitation`,e.precipitation_intensity=`precipitation_intensity`,e.pressure=`pressure`,e.radon=`radon`,e.reactive_power=`reactive_power`,e.signal_strength=`signal_strength`,e.sound_pressure=`sound_pressure`,e.speed=`speed`,e.sulphur_dioxide=`sulphur_dioxide`,e.temperature=`temperature`,e.timestamp=`timestamp`,e.volatile_organic_compounds=`volatile_organic_compounds`,e.volatile_organic_compounds_parts=`volatile_organic_compounds_parts`,e.voltage=`voltage`,e.volume=`volume`,e.volume_flow_rate=`volume_flow_rate`,e.volume_storage=`volume_storage`,e.water=`water`,e.weight=`weight`,e.wind_speed=`wind_speed`})(iie||={});var aie;(function(e){e.cleaning=`cleaning`,e.docked=`docked`,e.returning=`returning`,e.error=`error`,e.idle=`idle`,e.paused=`paused`,e.segment_cleaning=`segment_cleaning`,e.zone_cleaning=`zone_cleaning`,e.spot_cleaning=`spot_cleaning`,e.mop_cleaning=`mop_cleaning`})(aie||={});var oie;(function(e){e[e.TURN_ON=1]=`TURN_ON`,e[e.TURN_OFF=2]=`TURN_OFF`,e[e.PAUSE=4]=`PAUSE`,e[e.STOP=8]=`STOP`,e[e.RETURN_HOME=16]=`RETURN_HOME`,e[e.FAN_SPEED=32]=`FAN_SPEED`,e[e.BATTERY=64]=`BATTERY`,e[e.STATUS=128]=`STATUS`,e[e.SEND_COMMAND=256]=`SEND_COMMAND`,e[e.LOCATE=512]=`LOCATE`,e[e.CLEAN_SPOT=1024]=`CLEAN_SPOT`,e[e.MAP=2048]=`MAP`,e[e.STATE=4096]=`STATE`,e[e.START=8192]=`START`,e[e.CLEAN_AREA=16384]=`CLEAN_AREA`})(oie||={});var sie;(function(e){e.off=`off`,e.low=`low`,e.medium=`medium`,e.high=`high`,e.turbo=`turbo`,e.auto=`auto`,e.max=`max`})(sie||={});var cie;(function(e){e.off=`off`,e.eco=`eco`,e.electric=`electric`,e.gas=`gas`,e.heat_pump=`heat_pump`,e.high_demand=`high_demand`,e.performance=`performance`})(cie||={});var lie;(function(e){e[e.TARGET_TEMPERATURE=1]=`TARGET_TEMPERATURE`,e[e.OPERATION_MODE=2]=`OPERATION_MODE`,e[e.AWAY_MODE=4]=`AWAY_MODE`,e[e.ON_OFF=8]=`ON_OFF`})(lie||={});var rv={air_purifier:`Air Purifier`,air_quality_sensor:`Air Quality Sensor`,basic_video_player:`Basic Video Player (TV)`,battery_storage:`Battery Sensor`,carbon_monoxide_sensor:`Carbon Monoxide (CO) Sensor`,color_temperature_light:`Color Temperature Light`,contact_sensor:`Contact Sensor`,dishwasher:`Dishwasher`,dimmable_light:`Dimmable Light`,dimmable_plugin_unit:`Dimmable Plug-in Unit`,door_lock:`Door Lock`,electrical_sensor:`Electrical Sensor (Power/Energy/Voltage/Current)`,extended_color_light:`Extended Color Light`,fan:`Fan`,flow_sensor:`Flow Sensor`,formaldehyde_sensor:`Formaldehyde (HCHO) Sensor`,generic_switch:`Generic Switch (Button)`,humidifier_dehumidifier:`Humidifier/Dehumidifier`,humidity_sensor:`Humidity Sensor`,light_sensor:`Light Sensor`,mode_select:`Mode Select`,motion_sensor:`Motion Sensor (PIR)`,nitrogen_dioxide_sensor:`Nitrogen Dioxide (NO₂) Sensor`,occupancy_sensor:`Occupancy Sensor`,on_off_light:`On/Off Light`,on_off_plugin_unit:`On/Off Plug-in Unit`,on_off_switch:`On/Off Switch`,mounted_on_off_control:`Mounted On/Off Control (experimental)`,ozone_sensor:`Ozone (O₃) Sensor`,pm1_sensor:`PM1 Sensor`,pressure_sensor:`Pressure Sensor`,pump:`Pump`,rain_sensor:`Rain Sensor`,radon_sensor:`Radon Sensor`,robot_vacuum_cleaner:`Robot Vacuum Cleaner`,robotic_lawn_mower:`Robotic Lawn Mower`,smoke_co_alarm:`Smoke/CO Alarm`,speaker:`Speaker`,temperature_sensor:`Temperature Sensor`,thermostat:`Thermostat`,tvoc_sensor:`TVOC / VOC Index Sensor`,water_heater:`Water Heater`,water_freeze_detector:`Water Freeze Detector`,water_leak_detector:`Water Leak Detector`,water_valve:`Water Valve`,window_covering:`Window Covering`},iv={on_off_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},dimmable_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},color_temperature_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},extended_color_light:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},on_off_plugin_unit:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},dimmable_plugin_unit:{apple:`yes`,google:`no`,alexa:`yes`,aqara:`yes`},on_off_switch:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},mounted_on_off_control:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Experimental Matter 1.4 type (0x010F). SmartThings and Aqara show it as a switch. Apple, Google and Alexa don't know it yet and are expected to fall back to the advertised plug subset, not verified on real devices (#380).`},door_lock:{apple:`yes`,google:`partial`,alexa:`yes`,aqara:`yes`},window_covering:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},thermostat:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},fan:{apple:`no`,google:`yes`,alexa:`yes`,aqara:`yes`,note:`Apple Home has no standalone fan, it only shows fans inside an AC.`},air_purifier:{apple:`no`,google:`yes`,alexa:`yes`,aqara:`yes`,note:`Apple Home does not list air purifiers.`},robot_vacuum_cleaner:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},robotic_lawn_mower:{apple:`yes`,google:`unknown`,alexa:`yes`,aqara:`unknown`,note:`Shows up as a robot vacuum, there is no Matter mower type yet.`},humidifier_dehumidifier:{apple:`unknown`,google:`no`,alexa:`yes`,aqara:`unknown`},dishwasher:{apple:`no`,google:`no`,alexa:`unknown`,aqara:`unknown`,note:`Appliance types have little controller support today.`},speaker:{apple:`no`,google:`yes`,alexa:`no`,aqara:`yes`,note:`Apple and Alexa do not show Matter speakers.`},basic_video_player:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`TV/media types only show in Aqara Home here.`},temperature_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},humidity_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},light_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`unknown`},pressure_sensor:{apple:`no`,google:`yes`,alexa:`no`,aqara:`yes`,note:`Google Home and Aqara show pressure sensors.`},flow_sensor:{apple:`no`,google:`yes`,alexa:`no`,aqara:`unknown`,note:`Only Google Home shows flow sensors.`},air_quality_sensor:{apple:`no`,google:`yes`,alexa:`yes`,aqara:`yes`,note:`Apple Home does not show air quality.`},tvoc_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},carbon_monoxide_sensor:{apple:`partial`,google:`no`,alexa:`partial`,aqara:`yes`,note:`Apple shows a CO alarm, not a CO level reading.`},nitrogen_dioxide_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},ozone_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},formaldehyde_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},radon_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},pm1_sensor:{apple:`no`,google:`no`,alexa:`partial`,aqara:`yes`},electrical_sensor:{apple:`no`,google:`no`,alexa:`unknown`,aqara:`unknown`,note:`Power/energy is rarely shown unless it is on a smart plug.`},battery_storage:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Aqara lists battery storage; others show battery inside a device.`},contact_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},motion_sensor:{apple:`yes`,google:`yes`,alexa:`yes`,aqara:`yes`},occupancy_sensor:{apple:`partial`,google:`yes`,alexa:`yes`,aqara:`yes`},mode_select:{apple:`no`,google:`no`,alexa:`no`,aqara:`unknown`,note:`Google Home does not support Mode Select (issue #356).`},water_valve:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`},pump:{apple:`no`,google:`yes`,alexa:`no`,aqara:`yes`,note:`Google Home and Aqara show pumps.`},rain_sensor:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Newer Matter detector type with thin support, Alexa may reject it (issue #365).`},water_freeze_detector:{apple:`no`,google:`no`,alexa:`no`,aqara:`yes`,note:`Newer Matter detector type with thin support, Alexa may reject it (issue #365).`},water_leak_detector:{apple:`yes`,google:`no`,alexa:`yes`,aqara:`yes`,note:`Apple added leak sensors in iOS 18.4.`},water_heater:{apple:`no`,google:`no`,alexa:`unknown`,aqara:`yes`},generic_switch:{apple:`partial`,google:`no`,alexa:`yes`,aqara:`unknown`,note:`Best for stateless buttons.`},smoke_co_alarm:{apple:`yes`,google:`no`,alexa:`yes`,aqara:`yes`,note:`Apple added smoke/CO alarms in iOS 18.4.`}},av={Auto:0,Quick:1,Quiet:2,LowNoise:3,LowEnergy:4,Vacation:5,Min:6,Max:7,Night:8,Day:9,DeepClean:16384,Vacuum:16385,Mop:16386,VacuumThenMop:16387},uie={alarm_control_panel:[`mode_select`,`on_off_plugin_unit`],automation:[`on_off_switch`],binary_sensor:[`contact_sensor`,`motion_sensor`,`occupancy_sensor`,`rain_sensor`,`smoke_co_alarm`,`water_freeze_detector`,`water_leak_detector`],button:[`generic_switch`],climate:[`thermostat`],cover:[`window_covering`],event:[`generic_switch`],fan:[`air_purifier`,`fan`],humidifier:[`humidifier_dehumidifier`],input_boolean:[`on_off_plugin_unit`,`on_off_switch`,`mounted_on_off_control`],input_select:[`mode_select`],lawn_mower:[`robotic_lawn_mower`],input_button:[`generic_switch`],light:[`color_temperature_light`,`dimmable_light`,`extended_color_light`,`on_off_light`],lock:[`door_lock`],media_player:[`basic_video_player`,`on_off_switch`,`speaker`],scene:[`on_off_switch`],script:[`on_off_switch`],sensor:[`air_quality_sensor`,`battery_storage`,`carbon_monoxide_sensor`,`electrical_sensor`,`formaldehyde_sensor`,`humidity_sensor`,`light_sensor`,`nitrogen_dioxide_sensor`,`ozone_sensor`,`pm1_sensor`,`pressure_sensor`,`radon_sensor`,`temperature_sensor`,`tvoc_sensor`],select:[`mode_select`],siren:[`on_off_plugin_unit`],switch:[`dishwasher`,`on_off_plugin_unit`,`on_off_switch`,`mounted_on_off_control`,`pump`,`water_valve`],vacuum:[`robot_vacuum_cleaner`],valve:[`water_valve`,`on_off_plugin_unit`],water_heater:[`water_heater`,`thermostat`]},die;(function(e){e.alarm_control_panel=`alarm_control_panel`,e.automation=`automation`,e.button=`button`,e.binary_sensor=`binary_sensor`,e.climate=`climate`,e.cover=`cover`,e.event=`event`,e.fan=`fan`,e.humidifier=`humidifier`,e.input_boolean=`input_boolean`,e.input_button=`input_button`,e.input_select=`input_select`,e.lawn_mower=`lawn_mower`,e.light=`light`,e.lock=`lock`,e.media_player=`media_player`,e.remote=`remote`,e.scene=`scene`,e.select=`select`,e.script=`script`,e.sensor=`sensor`,e.siren=`siren`,e.switch=`switch`,e.vacuum=`vacuum`,e.valve=`valve`,e.water_heater=`water_heater`,e.weather=`weather`})(die||={});var ov={type:`object`,default:{type:``,value:``},properties:{type:{title:`Type`,type:`string`,oneOf:[{const:`pattern`,title:`pattern`,description:`Wildcard pattern matching entity IDs. Use * as wildcard. Example: 'light.living_room_*' matches all lights in the living room.`},{const:`regex`,title:`regex`,description:`Regex tested against the entity_id only (e.g. 'light.kitchen_lamp'). For labels use entity_label_regex or device_label_regex. Example: '^(light|switch)\\.kitchen_.*'.`},{const:`domain`,title:`domain`,description:`Match entities by their domain (the part before the dot). Example: 'light', 'switch', 'sensor'.`},{const:`platform`,title:`platform`,description:`Match entities by their integration/platform. Example: 'hue', 'zwave', 'mqtt'.`},{const:`label`,title:`label (deprecated)`,description:`Deprecated: use entity_label or device_label instead. Behaves like entity_label.`},{const:`entity_label`,title:`entity_label`,description:`Matches only entities that have this label assigned directly. Other entities of the same device are NOT included.`},{const:`device_label`,title:`device_label`,description:`Matches ALL entities of a device if the device has this label. Use this to include a complete device with all its entities.`},{const:`entity_label_regex`,title:`entity_label_regex`,description:`Regex tested against entity-label slugs and display names. Matches if any label assigned to the entity matches. Example: '^(matter|voice).*'.`},{const:`device_label_regex`,title:`device_label_regex`,description:`Regex tested against device-label slugs and display names. Matches ALL entities of a device whose label matches. Example: '^(matter|voice).*'.`},{const:`any_field_regex`,title:`any_field_regex`,description:`Regex tested against a single-line key=value haystack covering entity_id, domain, platform, area, entity_category, device_class, entity_labels, entity_label_names, device_labels, device_label_names, device_name, product_name, manufacturer. Use lookaheads for AND, alternation for OR. Example: '(?=.*domain=light)(?=.*area=living_room)|(?=.*domain=switch)(?=.*entity_labels=.*\\bvoice\\b)'.`},{const:`area`,title:`area`,description:`Match entities by their area slug. Example: 'living_room', 'bedroom'.`},{const:`entity_category`,title:`entity_category`,description:`Match entities by their category. Example: 'config', 'diagnostic' to exclude configuration entities.`},{const:`device_name`,title:`device_name`,description:`Match entities by their device name. Supports wildcards. Example: '*Philips*' matches all Philips devices.`},{const:`product_name`,title:`product_name`,description:`Match entities by their product/model name. Supports wildcards. Example: 'Hue*Bulb'.`},{const:`manufacturer`,title:`manufacturer`,description:`Match entities by their device manufacturer. Supports wildcards. Handy for MQTT or other generic integrations. Example: '*Sonoff*'.`},{const:`device_class`,title:`device_class`,description:`Match entities by their device class attribute. Example: 'temperature', 'motion', 'door', 'window'.`}]},value:{title:`Value`,description:`For labels, use the display name or the label_id (slug). You can look up both on the Labels page in the sidebar.`,type:`string`,minLength:1}},required:[`type`,`value`],additionalProperties:!1},sv={type:`object`,title:`Bridge Config`,properties:{name:{title:`Name`,type:`string`,minLength:1,maxLength:32},port:{title:`Port`,type:`number`,minimum:1},icon:{title:`Icon`,type:`string`,description:`Icon to display for this bridge in the UI`,enum:[`light`,`switch`,`climate`,`cover`,`fan`,`lock`,`sensor`,`media_player`,`vacuum`,`remote`,`humidifier`,`speaker`,`garage`,`door`,`window`,`motion`,`battery`,`power`,`camera`,`default`]},countryCode:{title:`Country Code`,type:`string`,description:`An ISO 3166-1 alpha-2 code to represent the country in which the Node is located. Only needed if the commissioning fails due to missing country code.`,minLength:2,maxLength:3},priority:{title:`Startup Priority`,type:`number`,description:`Startup order priority. Lower values start first. Default is 100.`,default:100,minimum:1,maximum:999},serialNumberSuffix:{title:`Serial Number Suffix`,type:`string`,description:`Append a suffix to every entity serial number on this bridge. Useful for forcing controllers like Aqara to treat devices as new and bypass cached device data. Leave empty for default behavior.`,maxLength:16},uniqueIdSuffix:{title:`Unique ID Suffix`,type:`string`,description:`Mixed into the unique ID of every bridged device on this bridge (standard bridge mode). Controllers like Alexa cache device records keyed on the unique ID, so setting or changing this can help mint fresh identities. Applies after a bridge restart, then re-discover in the controller. Leave empty for default behavior.`,maxLength:16},sessionMaxAgeHours:{title:`Session Rotation Max Age (hours)`,type:`number`,description:`Rotate matter sessions older than this many hours so controllers re-establish and re-subscribe. Server Mode rotates every 4h by default; standard bridges only rotate when you set a value here. Set 0 to disable. Range 0 to 168. (#287)`,minimum:0,maximum:168},filter:{title:`Include or exclude entities`,type:`object`,properties:{include:{title:`Include`,type:`array`,items:ov},exclude:{title:`Exclude`,type:`array`,items:ov},includeMode:{title:`Include Mode`,type:`string`,description:`How to combine include rules: 'any' matches if ANY rule matches (OR), 'all' matches only if ALL rules match (AND). Default: 'any'`,enum:[`any`,`all`],default:`any`}},required:[`include`,`exclude`],additionalProperties:!1},featureFlags:{title:`Feature Flags`,type:`object`,properties:{coverDoNotInvertPercentage:{title:`Do not invert Percentages for Covers`,description:`Do not invert the percentage of covers to match Home Assistant (not Matter compliant)`,type:`boolean`,default:!1},coverUseHomeAssistantPercentage:{title:`Use Home Assistant Percentage for Covers (Alexa-friendly)`,description:`Display cover percentages matching Home Assistant values in Matter controllers like Alexa. This makes the displayed percentage match what you see in Home Assistant, but the semantic meaning differs: in HA, higher percentage = more open; in Alexa, higher percentage is typically interpreted as more closed. Open/Close commands will still work correctly.`,type:`boolean`,default:!1},coverSwapOpenClose:{title:`Swap Open/Close for Covers`,description:`Swap open/close commands and invert position reporting for covers. Enable this if Alexa voice commands are reversed (saying 'close' opens the blinds and vice versa).`,type:`boolean`,default:!1},includeHiddenEntities:{title:`Include Hidden Entities`,description:`Include entities that are marked as hidden in Home Assistant`,type:`boolean`,default:!1},serverMode:{title:`Server Mode (standalone device)`,description:`Expose entities as standalone Matter devices instead of bridged ones. Works for any supported device type, e.g. robot vacuums need it for Apple Home Siri voice commands. One node carries up to 10 devices; the first entity is the primary and drives the node name and type (experimental beyond one device).`,type:`boolean`,default:!1},autoBatteryMapping:{title:`Auto Battery Mapping`,description:`Automatically assign battery sensors from the same Home Assistant device to the main entity. When enabled, battery sensors will be merged into their parent devices instead of appearing as separate devices.`,type:`boolean`,default:!1},autoHumidityMapping:{title:`Auto Humidity Mapping`,description:`Automatically combine humidity sensors with temperature sensors from the same Home Assistant device. When enabled, humidity sensors will be merged into temperature sensors to create combined TemperatureHumiditySensor devices.`,type:`boolean`,default:!0},autoPressureMapping:{title:`Auto Pressure Mapping`,description:`Automatically combine pressure sensors with temperature sensors from the same Home Assistant device. When enabled, pressure sensors will be merged into temperature sensors to create combined sensor devices.`,type:`boolean`,default:!0},autoComposedDevices:{title:`Auto Composed Devices`,description:`Master toggle: combine related entities from the same Home Assistant device into a single Matter endpoint. Turns on battery, humidity, pressure, power, and energy auto-mapping at once, a Shelly Plug shows up as one device with power monitoring instead of several siblings.`,type:`boolean`,default:!1},autoForceSync:{title:`Auto Force Sync`,description:`Periodically compare and push all device states to connected controllers every 90 seconds. Enable this if devices get out of sync after extended periods. Health checks for dead sessions always run regardless of this setting.`,type:`boolean`,default:!1},productNameFromNodeLabel:{title:`Product Name from Node Label`,description:`Report the entity's node label (custom name / friendly name / entity id) as the Matter productName. Useful for controllers like Aqara that display productName as the device name instead of nodeLabel. A per-entity customProductName still takes precedence.`,type:`boolean`,default:!1},preferEntityRegistryName:{title:`Prefer Entity Registry Name (HA 2026.4 workaround)`,description:`Use the entity registry name (or original_name) as nodeLabel instead of the composed friendly_name. Since Home Assistant 2026.4, friendly_name is prefixed with the device name, which breaks voice commands that relied on the short entity name. Resolution order: customName → registry name → registry original_name → friendly_name → entity_id. Matter has no alias concept, this only changes which single name is reported.`,type:`boolean`,default:!1},vacuumOnOff:{title:`Vacuum: Include OnOff Cluster (Alexa)`,description:`Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically, only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.`,type:`boolean`},alexaPreserveBrightnessOnTurnOn:{title:`Alexa: Preserve Brightness on Turn-On`,description:`Workaround for Alexa resetting light brightness to 100% after subscription renewal. When enabled, the bridge ignores brightness commands that set lights to 100% within 200ms of a turn-on command for the same light. WARNING: breaks Apple Home's 'set room to 100%' Siri commands, which use the same on() + moveToLevel(254) pattern. Only enable on Alexa-only bridges.`,type:`boolean`,default:!1},useHaRegistrySerial:{title:`Use HA Registry Serial Number`,description:`Fall back to the Home Assistant device registry serial_number when no per-entity customSerialNumber is configured. Default off because changing serialNumber after commissioning can confuse controllers. A per-entity customSerialNumber still takes precedence.`,type:`boolean`,default:!1},coverSliderDebounceMs:{title:`Cover Slider Debounce (ms)`,description:`Override the cover position-update debounce window for this bridge. Some controllers (Apple Home) stream slider updates while the user is still dragging, causing covers to start moving toward an intermediate target. Set to the time the bridge should wait after the last update before sending the final value to Home Assistant. 0 keeps the built-in two-phase debounce (400 ms initial / 150 ms subsequent), which fits most controllers. Try 800-1500 ms for slow blinds. A per-entity override on a single cover wins over this flag.`,type:`number`,minimum:0,maximum:5e3,default:0},fastSessionRecovery:{title:`Fast Session Recovery (Google offline workaround)`,description:`When a controller drops all subscriptions, clean up the dead session and re-announce after 5 seconds instead of 60. Opt-in for Google Home users whose devices go offline after a cancelled subscription (#386). It shortens the offline window but cannot stop the controller from rejecting the subscription. Default off.`,type:`boolean`,default:!1}}}},required:[`name`,`port`,`filter`],additionalProperties:!1};({...sv}),{...sv},{...sv.properties},[...sv?.required??[]];var cv=X((0,G.jsx)(`path`,{d:`M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z`}),`ArrowBack`),lv=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z`}),`CheckCircle`),uv=X((0,G.jsx)(`path`,{d:`M9.19 6.35c-2.04 2.29-3.44 5.58-3.57 5.89L2 10.69l4.05-4.05c.47-.47 1.15-.68 1.81-.55zM11.17 17s3.74-1.55 5.89-3.7c5.4-5.4 4.5-9.62 4.21-10.57-.95-.3-5.17-1.19-10.57 4.21C8.55 9.09 7 12.83 7 12.83zm6.48-2.19c-2.29 2.04-5.58 3.44-5.89 3.57L13.31 22l4.05-4.05c.47-.47.68-1.15.55-1.81zM9 18c0 .83-.34 1.58-.88 2.12C6.94 21.3 2 22 2 22s.7-4.94 1.88-6.12C4.42 15.34 5.17 15 6 15c1.66 0 3 1.34 3 3m4-9c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2`}),`RocketLaunch`),fie=Yd(`MuiBox`,[`root`]),Z=Kd({themeId:Cm,defaultTheme:xm(),defaultClassName:fie.root,generateClassName:Wd.generate});function pie(e){return Jd(`MuiButton`,e)}var dv=Yd(`MuiButton`,`root.text.textInherit.textPrimary.textSecondary.textSuccess.textError.textInfo.textWarning.outlined.outlinedInherit.outlinedPrimary.outlinedSecondary.outlinedSuccess.outlinedError.outlinedInfo.outlinedWarning.contained.containedInherit.containedPrimary.containedSecondary.containedSuccess.containedError.containedInfo.containedWarning.disableElevation.focusVisible.disabled.colorInherit.colorPrimary.colorSecondary.colorSuccess.colorError.colorInfo.colorWarning.textSizeSmall.textSizeMedium.textSizeLarge.outlinedSizeSmall.outlinedSizeMedium.outlinedSizeLarge.containedSizeSmall.containedSizeMedium.containedSizeLarge.sizeMedium.sizeSmall.sizeLarge.fullWidth.startIcon.endIcon.icon.iconSizeSmall.iconSizeMedium.iconSizeLarge.loading.loadingWrapper.loadingIconPlaceholder.loadingIndicator.loadingPositionCenter.loadingPositionStart.loadingPositionEnd`.split(`.`)),mie=C.createContext({}),hie=C.createContext(void 0),gie=e=>{let{color:t,disableElevation:n,fullWidth:r,size:i,variant:a,loading:o,loadingPosition:s,classes:c}=e,l=Cp({root:[`root`,o&&`loading`,a,`${a}${Y(t)}`,`size${Y(i)}`,`${a}Size${Y(i)}`,`color${Y(t)}`,n&&`disableElevation`,r&&`fullWidth`,o&&`loadingPosition${Y(s)}`],startIcon:[`icon`,`startIcon`,`iconSize${Y(i)}`],endIcon:[`icon`,`endIcon`,`iconSize${Y(i)}`],loadingIndicator:[`loadingIndicator`],loadingWrapper:[`loadingWrapper`]},pie,c);return{...c,...l}},fv=[{props:{size:`small`},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:`medium`},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:`large`},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],_ie=J(Nh,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${Y(n.color)}`],t[`size${Y(n.size)}`],t[`${n.variant}Size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,n.loading&&t.loading]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[300]:e.palette.grey[800],n=e.palette.mode===`light`?e.palette.grey.A100:e.palette.grey[700];return{...e.typography.button,minWidth:64,padding:`6px 16px`,border:0,borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`,`color`],{duration:e.transitions.duration.short}),"&:hover":{textDecoration:`none`},[`&.${dv.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:{variant:`contained`},style:{color:`var(--variant-containedColor)`,backgroundColor:`var(--variant-containedBg)`,boxShadow:(e.vars||e).shadows[2],"&:hover":{boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2]}},"&:active":{boxShadow:(e.vars||e).shadows[8]},[`&.${dv.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},[`&.${dv.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}},{props:{variant:`outlined`},style:{padding:`5px 15px`,border:`1px solid currentColor`,borderColor:`var(--variant-outlinedBorder, currentColor)`,backgroundColor:`var(--variant-outlinedBg)`,color:`var(--variant-outlinedColor)`,[`&.${dv.disabled}`]:{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`}}},{props:{variant:`text`},style:{padding:`6px 8px`,color:`var(--variant-textColor)`,backgroundColor:`var(--variant-textBg)`}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{"--variant-textColor":(e.vars||e).palette[t].main,"--variant-outlinedColor":(e.vars||e).palette[t].main,"--variant-outlinedBorder":e.alpha((e.vars||e).palette[t].main,.5),"--variant-containedColor":(e.vars||e).palette[t].contrastText,"--variant-containedBg":(e.vars||e).palette[t].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(e.vars||e).palette[t].dark,"--variant-textBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBorder":(e.vars||e).palette[t].main,"--variant-outlinedBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}}})),{props:{color:`inherit`},style:{color:`inherit`,borderColor:`currentColor`,"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedBg:t,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity)}}}},{props:{size:`small`,variant:`text`},style:{padding:`4px 5px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`text`},style:{padding:`8px 11px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`outlined`},style:{padding:`3px 9px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`outlined`},style:{padding:`7px 21px`,fontSize:e.typography.pxToRem(15)}},{props:{size:`small`,variant:`contained`},style:{padding:`4px 10px`,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`,variant:`contained`},style:{padding:`8px 22px`,fontSize:e.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:`none`,"&:hover":{boxShadow:`none`},[`&.${dv.focusVisible}`]:{boxShadow:`none`},"&:active":{boxShadow:`none`},[`&.${dv.disabled}`]:{boxShadow:`none`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{loadingPosition:`center`},style:{transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),[`&.${dv.loading}`]:{color:`transparent`}}}]}})),vie=J(`span`,{name:`MuiButton`,slot:`StartIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.startIcon,n.loading&&t.startIconLoadingStart,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:8,marginLeft:-4,variants:[{props:{size:`small`},style:{marginLeft:-2}},{props:{loadingPosition:`start`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`start`,loading:!0,fullWidth:!0},style:{marginRight:-8}},...fv]})),yie=J(`span`,{name:`MuiButton`,slot:`EndIcon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.endIcon,n.loading&&t.endIconLoadingEnd,t[`iconSize${Y(n.size)}`]]}})(({theme:e})=>({display:`inherit`,marginRight:-4,marginLeft:8,variants:[{props:{size:`small`},style:{marginRight:-2}},{props:{loadingPosition:`end`,loading:!0},style:{transition:e.transitions.create([`opacity`],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:`end`,loading:!0,fullWidth:!0},style:{marginLeft:-8}},...fv]})),bie=J(`span`,{name:`MuiButton`,slot:`LoadingIndicator`})(({theme:e})=>({display:`none`,position:`absolute`,visibility:`visible`,variants:[{props:{loading:!0},style:{display:`flex`}},{props:{loadingPosition:`start`},style:{left:14}},{props:{loadingPosition:`start`,size:`small`},style:{left:10}},{props:{variant:`text`,loadingPosition:`start`},style:{left:6}},{props:{loadingPosition:`center`},style:{left:`50%`,transform:`translate(-50%)`,color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:`end`},style:{right:14}},{props:{loadingPosition:`end`,size:`small`},style:{right:10}},{props:{variant:`text`,loadingPosition:`end`},style:{right:6}},{props:{loadingPosition:`start`,fullWidth:!0},style:{position:`relative`,left:-10}},{props:{loadingPosition:`end`,fullWidth:!0},style:{position:`relative`,right:-10}}]})),pv=J(`span`,{name:`MuiButton`,slot:`LoadingIconPlaceholder`})({display:`inline-block`,width:`1em`,height:`1em`}),mv=C.forwardRef(function(e,t){let n=C.useContext(mie),r=C.useContext(hie),i=km({props:uf(n,e),name:`MuiButton`}),{children:a,color:o=`primary`,component:s=`button`,className:c,disabled:l=!1,disableElevation:u=!1,disableFocusRipple:d=!1,endIcon:f,focusVisibleClassName:p,fullWidth:m=!1,id:h,loading:g=null,loadingIndicator:_,loadingPosition:v=`center`,size:y=`medium`,startIcon:b,type:x,variant:S=`text`,...w}=i,T=rh(h),E=_??(0,G.jsx)(Rh,{"aria-labelledby":T,color:`inherit`,size:16}),D={...i,color:o,component:s,disabled:l,disableElevation:u,disableFocusRipple:d,fullWidth:m,loading:g,loadingIndicator:E,loadingPosition:v,size:y,type:x,variant:S},O=gie(D),k=(b||g&&v===`start`)&&(0,G.jsx)(vie,{className:O.startIcon,ownerState:D,children:b||(0,G.jsx)(pv,{className:O.loadingIconPlaceholder,ownerState:D})}),A=(f||g&&v===`end`)&&(0,G.jsx)(yie,{className:O.endIcon,ownerState:D,children:f||(0,G.jsx)(pv,{className:O.loadingIconPlaceholder,ownerState:D})}),j=r||``,M=typeof g==`boolean`?(0,G.jsx)(`span`,{className:O.loadingWrapper,style:{display:`contents`},children:g&&(0,G.jsx)(bie,{className:O.loadingIndicator,ownerState:D,children:E})}):null;return(0,G.jsxs)(_ie,{ownerState:D,className:K(n.className,O.root,c,j),component:s,disabled:l||g,focusRipple:!d,focusVisibleClassName:K(O.focusVisible,p),ref:t,type:x,id:g?T:h,...w,classes:O,children:[k,v!==`end`&&M,a,v===`end`&&M,A]})});function xie(e){return Jd(`MuiCard`,e)}Yd(`MuiCard`,[`root`]);var Sie=e=>{let{classes:t}=e;return Cp({root:[`root`]},xie,t)},Cie=J(Wm,{name:`MuiCard`,slot:`Root`})({overflow:`hidden`}),hv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCard`}),{className:r,raised:i=!1,...a}=n,o={...n,raised:i};return(0,G.jsx)(Cie,{className:K(Sie(o).root,r),elevation:i?8:void 0,ref:t,ownerState:o,...a})});function wie(e){return Jd(`MuiCardActionArea`,e)}var gv=Yd(`MuiCardActionArea`,[`root`,`focusVisible`,`focusHighlight`]),Tie=e=>{let{classes:t}=e;return Cp({root:[`root`],focusHighlight:[`focusHighlight`]},wie,t)},Eie=J(Nh,{name:`MuiCardActionArea`,slot:`Root`})(Fm(({theme:e})=>({display:`block`,textAlign:`inherit`,borderRadius:`inherit`,width:`100%`,[`&:hover .${gv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${gv.focusVisible} .${gv.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),Die=J(`span`,{name:`MuiCardActionArea`,slot:`FocusHighlight`})(Fm(({theme:e})=>({overflow:`hidden`,pointerEvents:`none`,position:`absolute`,top:0,right:0,bottom:0,left:0,borderRadius:`inherit`,opacity:0,backgroundColor:`currentcolor`,transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.short})}))),_v=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCardActionArea`}),{children:r,className:i,focusVisibleClassName:a,slots:o={},slotProps:s={},...c}=n,l=n,u=Tie(l),d={slots:o,slotProps:s},[f,p]=Hm(`root`,{elementType:Eie,externalForwardedProps:{...d,...c},shouldForwardComponentProp:!0,ownerState:l,ref:t,className:K(u.root,i),additionalProps:{focusVisibleClassName:K(a,u.focusVisible)}}),[m,h]=Hm(`focusHighlight`,{elementType:Die,externalForwardedProps:d,ownerState:l,className:u.focusHighlight});return(0,G.jsxs)(f,{...p,children:[r,(0,G.jsx)(m,{...h})]})});function Oie(e){return Jd(`MuiCardContent`,e)}Yd(`MuiCardContent`,[`root`]);var kie=e=>{let{classes:t}=e;return Cp({root:[`root`]},Oie,t)},Aie=J(`div`,{name:`MuiCardContent`,slot:`Root`})({padding:16,"&:last-child":{paddingBottom:24}}),vv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCardContent`}),{className:r,component:i=`div`,...a}=n,o={...n,component:i};return(0,G.jsx)(Aie,{as:i,className:K(kie(o).root,r),ownerState:o,ref:t,...a})}),yv=C.createContext(void 0);function bv(){return C.useContext(yv)}function jie(e){return Jd(`PrivateSwitchBase`,e)}Yd(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var Mie=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e;return Cp({root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${Y(i)}`],input:[`input`]},jie,t)},Nie=J(Nh,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),Pie=J(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Dm})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),xv=C.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,inputProps:d,inputRef:f,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:_,required:v=!1,tabIndex:y,type:b,value:x,slots:S={},slotProps:C={},...w}=e,[T,E]=ah({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=bv(),O=e=>{g&&g(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{m&&m(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||_)return;let t=e.target.checked;E(t),h&&h(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=b===`checkbox`||b===`radio`,N={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},P=Mie(N),F={slots:S,slotProps:{input:d,...C}},[I,L]=Hm(`root`,{ref:t,elementType:Nie,className:P.root,shouldForwardComponentProp:!0,externalForwardedProps:{...F,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:N,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[R,ee]=Hm(`input`,{ref:f,elementType:Pie,className:P.input,externalForwardedProps:F,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:N,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:p,readOnly:_,required:v,tabIndex:y,type:b,...b===`checkbox`&&x===void 0?{}:{value:x}}});return(0,G.jsxs)(I,{...L,children:[(0,G.jsx)(R,{...ee}),T?i:l]})}),Fie=X((0,G.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlank`),Iie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),Lie=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z`}),`IndeterminateCheckBox`);function Rie(e){return Jd(`MuiCheckbox`,e)}var Sv=Yd(`MuiCheckbox`,[`root`,`checked`,`disabled`,`indeterminate`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`]),zie=e=>{let{classes:t,indeterminate:n,color:r,size:i}=e,a=Cp({root:[`root`,n&&`indeterminate`,`color${Y(r)}`,`size${Y(i)}`]},Rie,t);return{...t,...a}},Bie=J(xv,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiCheckbox`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Y(n.size)}`],n.color!=="default"&&t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:`default`,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${Sv.checked}, &.${Sv.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${Sv.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),Vie=(0,G.jsx)(Iie,{}),Hie=(0,G.jsx)(Fie,{}),Uie=(0,G.jsx)(Lie,{}),Cv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiCheckbox`}),{checkedIcon:r=Vie,color:i=`primary`,icon:a=Hie,indeterminate:o=!1,indeterminateIcon:s=Uie,inputProps:c,size:l=`medium`,disableRipple:u=!1,className:d,slots:f={},slotProps:p={},...m}=n,h=o?s:a,g=o?s:r,_={...n,disableRipple:u,color:i,indeterminate:o,size:l},v=zie(_),y=p.input??c,[b,x]=Hm(`root`,{ref:t,elementType:Bie,className:K(v.root,d),shouldForwardComponentProp:!0,externalForwardedProps:{slots:f,slotProps:p,...m},ownerState:_,additionalProps:{type:`checkbox`,icon:C.cloneElement(h,{fontSize:h.props.fontSize??l}),checkedIcon:C.cloneElement(g,{fontSize:g.props.fontSize??l}),disableRipple:u,slots:f,slotProps:{input:lh(typeof y==`function`?y(_):y,{"data-indeterminate":o})}}});return(0,G.jsx)(b,{...x,classes:v})}),Wie=X((0,G.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z`}),`Cancel`);function Gie(e){return Jd(`MuiChip`,e)}var wv=Yd(`MuiChip`,`root.sizeSmall.sizeMedium.colorDefault.colorError.colorInfo.colorPrimary.colorSecondary.colorSuccess.colorWarning.disabled.clickable.clickableColorPrimary.clickableColorSecondary.deletable.deletableColorPrimary.deletableColorSecondary.outlined.filled.outlinedPrimary.outlinedSecondary.filledPrimary.filledSecondary.avatar.avatarSmall.avatarMedium.avatarColorPrimary.avatarColorSecondary.icon.iconSmall.iconMedium.iconColorPrimary.iconColorSecondary.label.labelSmall.labelMedium.deleteIcon.deleteIconSmall.deleteIconMedium.deleteIconColorPrimary.deleteIconColorSecondary.deleteIconOutlinedColorPrimary.deleteIconOutlinedColorSecondary.deleteIconFilledColorPrimary.deleteIconFilledColorSecondary.focusVisible`.split(`.`)),Kie=e=>{let{classes:t,disabled:n,size:r,color:i,iconColor:a,onDelete:o,clickable:s,variant:c}=e;return Cp({root:[`root`,c,n&&`disabled`,`size${Y(r)}`,`color${Y(i)}`,s&&`clickable`,s&&`clickableColor${Y(i)}`,o&&`deletable`,o&&`deletableColor${Y(i)}`,`${c}${Y(i)}`],label:[`label`,`label${Y(r)}`],avatar:[`avatar`,`avatar${Y(r)}`,`avatarColor${Y(i)}`],icon:[`icon`,`icon${Y(r)}`,`iconColor${Y(a)}`],deleteIcon:[`deleteIcon`,`deleteIcon${Y(r)}`,`deleteIconColor${Y(i)}`,`deleteIcon${Y(c)}Color${Y(i)}`]},Gie,t)},qie=J(`div`,{name:`MuiChip`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{color:r,iconColor:i,clickable:a,onDelete:o,size:s,variant:c}=n;return[{[`& .${wv.avatar}`]:t.avatar},{[`& .${wv.avatar}`]:t[`avatar${Y(s)}`]},{[`& .${wv.avatar}`]:t[`avatarColor${Y(r)}`]},{[`& .${wv.icon}`]:t.icon},{[`& .${wv.icon}`]:t[`icon${Y(s)}`]},{[`& .${wv.icon}`]:t[`iconColor${Y(i)}`]},{[`& .${wv.deleteIcon}`]:t.deleteIcon},{[`& .${wv.deleteIcon}`]:t[`deleteIcon${Y(s)}`]},{[`& .${wv.deleteIcon}`]:t[`deleteIconColor${Y(r)}`]},{[`& .${wv.deleteIcon}`]:t[`deleteIcon${Y(c)}Color${Y(r)}`]},t.root,t[`size${Y(s)}`],t[`color${Y(r)}`],a&&t.clickable,a&&r!=="default"&&t[`clickableColor${Y(r)}`],o&&t.deletable,o&&r!=="default"&&t[`deletableColor${Y(r)}`],t[c],t[`${c}${Y(r)}`]]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[700]:e.palette.grey[300];return{maxWidth:`100%`,fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:`inline-flex`,alignItems:`center`,justifyContent:`center`,height:32,lineHeight:1.5,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:32/2,whiteSpace:`nowrap`,transition:e.transitions.create([`background-color`,`box-shadow`]),cursor:`unset`,outline:0,textDecoration:`none`,border:0,padding:0,verticalAlign:`middle`,boxSizing:`border-box`,[`&.${wv.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`& .${wv.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:t,fontSize:e.typography.pxToRem(12)},[`& .${wv.avatarColorPrimary}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark},[`& .${wv.avatarColorSecondary}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark},[`& .${wv.avatarSmall}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${wv.icon}`]:{marginLeft:5,marginRight:-6},[`& .${wv.deleteIcon}`]:{WebkitTapHighlightColor:`transparent`,color:e.alpha((e.vars||e).palette.text.primary,.26),fontSize:22,cursor:`pointer`,margin:`0 5px 0 -6px`,"&:hover":{color:e.alpha((e.vars||e).palette.text.primary,.4)}},variants:[{props:{size:`small`},style:{height:24,[`& .${wv.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${wv.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText,[`& .${wv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].contrastText}}}})),{props:e=>e.iconColor===e.color,style:{[`& .${wv.icon}`]:{color:e.vars?e.vars.palette.Chip.defaultIconColor:t}}},{props:e=>e.iconColor===e.color&&e.color!=="default",style:{[`& .${wv.icon}`]:{color:`inherit`}}},{props:{onDelete:!0},style:{[`&.${wv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,onDelete:!0},style:{[`&.${wv.focusVisible}`]:{background:(e.vars||e).palette[t].dark}}})),{props:{clickable:!0},style:{userSelect:`none`,WebkitTapHighlightColor:`transparent`,cursor:`pointer`,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)},[`&.${wv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},"&:active":{boxShadow:(e.vars||e).shadows[1]}}},...Object.entries(e.palette).filter(Um([`dark`])).map(([t])=>({props:{color:t,clickable:!0},style:{[`&:hover, &.${wv.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark}}})),{props:{variant:`outlined`},style:{backgroundColor:`transparent`,border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${e.palette.mode===`light`?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${wv.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${wv.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${wv.avatar}`]:{marginLeft:4},[`& .${wv.avatarSmall}`]:{marginLeft:2},[`& .${wv.icon}`]:{marginLeft:4},[`& .${wv.iconSmall}`]:{marginLeft:2},[`& .${wv.deleteIcon}`]:{marginRight:5},[`& .${wv.deleteIconSmall}`]:{marginRight:3}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{variant:`outlined`,color:t},style:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.7)}`,[`&.${wv.clickable}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)},[`&.${wv.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.focusOpacity)},[`& .${wv.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].main}}}}))]}})),Jie=J(`span`,{name:`MuiChip`,slot:`Label`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{size:r}=n;return[t.label,t[`label${Y(r)}`]]}})({overflow:`hidden`,textOverflow:`ellipsis`,paddingLeft:12,paddingRight:12,whiteSpace:`nowrap`,variants:[{props:{variant:`outlined`},style:{paddingLeft:11,paddingRight:11}},{props:{size:`small`},style:{paddingLeft:8,paddingRight:8}},{props:{size:`small`,variant:`outlined`},style:{paddingLeft:7,paddingRight:7}}]});function Tv(e){return e.key===`Backspace`||e.key===`Delete`}var Ev=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiChip`}),{avatar:r,className:i,clickable:a,color:o=`default`,component:s,deleteIcon:c,disabled:l=!1,icon:u,label:d,onClick:f,onDelete:p,onKeyDown:m,onKeyUp:h,size:g=`medium`,variant:_=`filled`,tabIndex:v,skipFocusWhenDisabled:y=!1,slots:b={},slotProps:x={},...S}=n,w=ch(C.useRef(null),t),T=e=>{e.stopPropagation(),p(e)},E=e=>{e.currentTarget===e.target&&Tv(e)&&e.preventDefault(),m&&m(e)},D=e=>{e.currentTarget===e.target&&p&&Tv(e)&&p(e),h&&h(e)},O=a!==!1&&f?!0:a,k=O||p?Nh:s||`div`,A={...n,component:k,disabled:l,size:g,color:o,iconColor:C.isValidElement(u)&&u.props.color||o,onDelete:!!p,clickable:O,variant:_},j=Kie(A),M=k===Nh?{component:s||`div`,focusVisibleClassName:j.focusVisible,...p&&{disableRipple:!0}}:{},N=null;p&&(N=c&&C.isValidElement(c)?C.cloneElement(c,{className:K(c.props.className,j.deleteIcon),onClick:T}):(0,G.jsx)(Wie,{className:j.deleteIcon,onClick:T}));let P=null;r&&C.isValidElement(r)&&(P=C.cloneElement(r,{className:K(j.avatar,r.props.className)}));let F=null;u&&C.isValidElement(u)&&(F=C.cloneElement(u,{className:K(j.icon,u.props.className)}));let I={slots:b,slotProps:x},[L,R]=Hm(`root`,{elementType:qie,externalForwardedProps:{...I,...S},ownerState:A,shouldForwardComponentProp:!0,ref:w,className:K(j.root,i),additionalProps:{disabled:O&&l?!0:void 0,tabIndex:y&&l?-1:v,...M},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),f?.(t)},onKeyDown:t=>{e.onKeyDown?.(t),E(t)},onKeyUp:t=>{e.onKeyUp?.(t),D(t)}})}),[ee,z]=Hm(`label`,{elementType:Jie,externalForwardedProps:I,ownerState:A,className:j.label});return(0,G.jsxs)(L,{as:k,...R,children:[P||F,(0,G.jsx)(ee,{...z,children:d}),N]})});function Dv(e){return e!=null&&!(Array.isArray(e)&&e.length===0)}function Ov(e,t=!1){return e&&(Dv(e.value)&&e.value!==``||t&&Dv(e.defaultValue)&&e.defaultValue!==``)}function Yie(e){return e.startAdornment}function Xie(e){return Jd(`MuiFormControl`,e)}Yd(`MuiFormControl`,[`root`,`marginNone`,`marginNormal`,`marginDense`,`fullWidth`,`disabled`]);var Zie=e=>{let{classes:t,margin:n,fullWidth:r}=e;return Cp({root:[`root`,n!==`none`&&`margin${Y(n)}`,r&&`fullWidth`]},Xie,t)},Qie=J(`div`,{name:`MuiFormControl`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`margin${Y(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:`inline-flex`,flexDirection:`column`,position:`relative`,minWidth:0,padding:0,margin:0,border:0,verticalAlign:`top`,variants:[{props:{margin:`normal`},style:{marginTop:16,marginBottom:8}},{props:{margin:`dense`},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:`100%`}}]}),kv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormControl`}),{children:r,className:i,color:a=`primary`,component:o=`div`,disabled:s=!1,error:c=!1,focused:l,fullWidth:u=!1,hiddenLabel:d=!1,margin:f=`none`,required:p=!1,size:m=`medium`,variant:h=`outlined`,...g}=n,_={...n,color:a,component:o,disabled:s,error:c,fullWidth:u,hiddenLabel:d,margin:f,required:p,size:m,variant:h},v=Zie(_),[y,b]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{if(!Xm(t,[`Input`,`Select`]))return;let n=Xm(t,[`Select`])?t.props.input:t;n&&Yie(n.props)&&(e=!0)}),e}),[x,S]=C.useState(()=>{let e=!1;return r&&C.Children.forEach(r,t=>{Xm(t,[`Input`,`Select`])&&(Ov(t.props,!0)||Ov(t.props.inputProps,!0))&&(e=!0)}),e}),[w,T]=C.useState(!1);s&&w&&T(!1);let E=l!==void 0&&!s?l:w;C.useRef(!1);let D=C.useCallback(()=>{S(!0)},[]),O=C.useCallback(()=>{S(!1)},[]),k=C.useMemo(()=>({adornedStart:y,setAdornedStart:b,color:a,disabled:s,error:c,filled:x,focused:E,fullWidth:u,hiddenLabel:d,size:m,onBlur:()=>{T(!1)},onFocus:()=>{T(!0)},onEmpty:O,onFilled:D,registerEffect:void 0,required:p,variant:h}),[y,a,s,c,x,E,u,d,void 0,O,D,p,m,h]);return(0,G.jsx)(yv.Provider,{value:k,children:(0,G.jsx)(Qie,{as:o,ownerState:_,className:K(v.root,i),ref:t,...g,children:r})})});function $ie(e){return Jd(`MuiTypography`,e)}var Av=Yd(`MuiTypography`,[`root`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`subtitle1`,`subtitle2`,`body1`,`body2`,`inherit`,`button`,`caption`,`overline`,`alignLeft`,`alignRight`,`alignCenter`,`alignJustify`,`noWrap`,`gutterBottom`,`paragraph`]),eae={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},tae=qee(),nae=e=>{let{align:t,gutterBottom:n,noWrap:r,paragraph:i,variant:a,classes:o}=e;return Cp({root:[`root`,a,e.align!==`inherit`&&`align${Y(t)}`,n&&`gutterBottom`,r&&`noWrap`,i&&`paragraph`]},$ie,o)},rae=J(`span`,{name:`MuiTypography`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!==`inherit`&&t[`align${Y(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(Fm(({theme:e})=>({margin:0,variants:[{props:{variant:`inherit`},style:{font:`inherit`,lineHeight:`inherit`,letterSpacing:`inherit`}},...Object.entries(e.typography).filter(([e,t])=>e!==`inherit`&&t&&typeof t==`object`).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>typeof e==`string`).map(([t])=>({props:{color:`text${Y(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>e.align!==`inherit`,style:{textAlign:`var(--Typography-textAlign)`}},{props:({ownerState:e})=>e.noWrap,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:`0.35em`}},{props:({ownerState:e})=>e.paragraph,style:{marginBottom:16}}]}))),jv={h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,subtitle1:`h6`,subtitle2:`h6`,body1:`p`,body2:`p`,inherit:`p`},Q=C.forwardRef(function(e,t){let{color:n,...r}=km({props:e,name:`MuiTypography`}),i=!eae[n],a=tae({...r,...i&&{color:n}}),{align:o=`inherit`,className:s,component:c,gutterBottom:l=!1,noWrap:u=!1,paragraph:d=!1,variant:f=`body1`,variantMapping:p=jv,...m}=a,h={...a,align:o,color:n,className:s,component:c,gutterBottom:l,noWrap:u,paragraph:d,variant:f,variantMapping:p};return(0,G.jsx)(rae,{as:c||(d?`p`:p[f]||jv[f])||`span`,ref:t,className:K(nae(h).root,s),...m,ownerState:h,style:{...o!==`inherit`&&{"--Typography-textAlign":o},...m.style}})});function iae(e){return Jd(`MuiFormControlLabel`,e)}var Mv=Yd(`MuiFormControlLabel`,[`root`,`labelPlacementStart`,`labelPlacementTop`,`labelPlacementBottom`,`disabled`,`label`,`error`,`required`,`asterisk`]);function Nv({props:e,states:t,muiFormControl:n}){return t.reduce((t,r)=>(t[r]=e[r],n&&e[r]===void 0&&(t[r]=n[r]),t),{})}var aae=e=>{let{classes:t,disabled:n,labelPlacement:r,error:i,required:a}=e;return Cp({root:[`root`,n&&`disabled`,`labelPlacement${Y(r)}`,i&&`error`,a&&`required`],label:[`label`,n&&`disabled`],asterisk:[`asterisk`,i&&`error`]},iae,t)},oae=J(`label`,{name:`MuiFormControlLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Mv.label}`]:t.label},t.root,t[`labelPlacement${Y(n.labelPlacement)}`]]}})(Fm(({theme:e})=>({display:`inline-flex`,alignItems:`center`,cursor:`pointer`,verticalAlign:`middle`,WebkitTapHighlightColor:`transparent`,marginLeft:-11,marginRight:16,[`&.${Mv.disabled}`]:{cursor:`default`},[`& .${Mv.label}`]:{[`&.${Mv.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:`start`},style:{flexDirection:`row-reverse`,marginRight:-11}},{props:{labelPlacement:`top`},style:{flexDirection:`column-reverse`}},{props:{labelPlacement:`bottom`},style:{flexDirection:`column`}},{props:({labelPlacement:e})=>e===`start`||e===`top`||e===`bottom`,style:{marginLeft:16}}]}))),sae=J(`span`,{name:`MuiFormControlLabel`,slot:`Asterisk`})(Fm(({theme:e})=>({[`&.${Mv.error}`]:{color:(e.vars||e).palette.error.main}}))),Pv=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormControlLabel`}),{checked:r,className:i,componentsProps:a={},control:o,disabled:s,disableTypography:c,inputRef:l,label:u,labelPlacement:d=`end`,name:f,onChange:p,required:m,slots:h={},slotProps:g={},value:_,...v}=n,y=bv(),b=s??o.props.disabled??y?.disabled,x=m??o.props.required,S={disabled:b,required:x};[`checked`,`name`,`onChange`,`value`,`inputRef`].forEach(e=>{o.props[e]===void 0&&n[e]!==void 0&&(S[e]=n[e])});let w=Nv({props:n,muiFormControl:y,states:[`error`]}),T={...n,disabled:b,labelPlacement:d,required:x,error:w.error},E=aae(T),[D,O]=Hm(`typography`,{elementType:Q,externalForwardedProps:{slots:h,slotProps:{...a,...g}},ownerState:T}),k=u;return k!=null&&k.type!==Q&&!c&&(k=(0,G.jsx)(D,{component:`span`,...O,className:K(E.label,O?.className),children:k})),(0,G.jsxs)(oae,{className:K(E.root,i),ownerState:T,ref:t,...v,children:[C.cloneElement(o,S),x?(0,G.jsxs)(`div`,{children:[k,(0,G.jsxs)(sae,{ownerState:T,"aria-hidden":!0,className:E.asterisk,children:[` `,`*`]})]}):k]})}),Fv=cee({createStyledComponent:J(`div`,{name:`MuiGrid`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.container&&t.container]}}),componentName:`MuiGrid`,useThemeProps:e=>km({props:e,name:`MuiGrid`}),useTheme:wm});function cae(e){return Jd(`MuiLinearProgress`,e)}Yd(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`dashedColorPrimary`,`dashedColorSecondary`,`bar`,`bar1`,`bar2`,`barColorPrimary`,`barColorSecondary`,`bar1Indeterminate`,`bar1Determinate`,`bar1Buffer`,`bar2Indeterminate`,`bar2Buffer`]);var Iv=4,Lv=fd`
|
|
149
149
|
0% {
|
|
150
150
|
left: -35%;
|
|
151
151
|
right: 100%;
|
|
@@ -214,7 +214,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
214
214
|
}\r
|
|
215
215
|
`}),(0,G.jsx)(`clipPath`,{id:`clippath`,children:(0,G.jsx)(`path`,{className:`cls-1`,d:`M152.8,32.08h-6.03V12.37c0-.27-.22-.49-.49-.49h-9.76c-.27,0-.49.22-.49.49v3.59c0,.27.22.49.49.49h5.28v15.63h-6.03c-.27,0-.49.22-.49.49v3.59c0,.27.22.49.49.49h17.02c.27,0,.49-.22.49-.49v-3.59c0-.27-.22-.49-.49-.49ZM119.4,11.55c-2.76,0-5.17,1.2-6.76,3.04v-2.22c0-.27-.22-.49-.49-.49h-3.99c-.27,0-.49.22-.49.49v23.79c0,.27.22.49.49.49h3.99c.27,0,.49-.22.49-.49v-13.83c0-3.47,2.43-6.2,5.75-6.2,2.96,0,4.81,1.77,5.33,4.08.13.6.21,1.5.21,2.24v13.72c0,.27.22.49.49.49h3.99c.27,0,.49-.22.49-.49v-12.78c0-1.99-.09-2.88-.23-3.9-.67-4.51-4.29-7.93-9.26-7.93ZM24.16,15.84c2.71,0,4.28,1.34,4.7,3.59.05.28.29.48.57.48h4.08c.29,0,.52-.26.48-.55-.63-5.02-4.72-7.97-9.72-7.97-4.7,0-9.24,2.57-9.24,7.68,0,4.22,3.14,6.1,6.72,6.96l3.95.92c2.01.48,3.32,1.34,3.32,2.83,0,2.04-2.09,2.85-4.33,2.85-2.92,0-4.6-1.29-5.02-3.69-.05-.29-.3-.5-.59-.5h-4.05c-.29,0-.52.25-.48.54.65,5.4,5.16,8.14,9.96,8.14,4.69,0,9.66-2.41,9.66-7.88,0-3.59-2.32-5.74-6.77-6.78l-3.83-.89c-1.46-.33-3.42-1.01-3.42-2.88,0-1.8,1.64-2.85,4.02-2.85ZM48.68,24.28c0,13.74-10.55,24.16-24.34,24.16S0,38.01,0,24.28C0,11.45,9.22,1.37,21.88,0c.29-.03.54.19.54.48v3.67c0,.29-.22.54-.51.58C11.97,6.03,4.87,14.14,4.87,24.32c0,11.05,8.36,19.53,19.47,19.53,11.11,0,19.47-8.48,19.47-19.53,0-10.18-7.13-18.3-17.04-19.59-.29-.04-.51-.28-.51-.58V.49c0-.29.25-.51.54-.48,12.66,1.37,21.88,11.44,21.88,24.27ZM155.55,16.45h5.07v19.71c0,.27.22.49.49.49h3.99c.27,0,.49-.22.49-.49v-19.71h7.39c.27,0,.49-.22.49-.49v-3.59c0-.27-.22-.49-.49-.49h-7.39v-3.22c0-2.47,1.59-3.65,3.61-3.65,1.52,0,3.03.58,4.28,1.48.31.22.73,0,.73-.38v-3.62c0-.27-.14-.52-.37-.66-1.45-.89-3.19-1.41-5.17-1.41-4.65,0-8.04,3.09-8.04,8.25v3.22h-5.07c-.27,0-.49.22-.49.49v3.59c0,.27.22.49.49.49ZM62.17,8.47c2.04,0,3.71-1.67,3.71-3.76,0-2.07-1.67-3.71-3.71-3.71s-3.71,1.64-3.71,3.71c0,2.09,1.67,3.76,3.71,3.76ZM143.95,8.47c2.04,0,3.71-1.67,3.71-3.76s-1.67-3.71-3.71-3.71-3.71,1.64-3.71,3.71c0,2.09,1.67,3.76,3.71,3.76ZM71.02,32.08h-6.03V12.37c0-.27-.22-.49-.49-.49h-9.76c-.27,0-.49.22-.49.49v3.59c0,.27.22.49.49.49h5.28v15.63h-6.03c-.27,0-.49.22-.49.49v3.59c0,.27.22.49.49.49h17.02c.27,0,.49-.22.49-.49v-3.59c0-.27-.22-.49-.49-.49ZM185.95,35.65l-1.51,3.8c-.79,2-1.95,2.91-3.31,2.91-1.07,0-2.39-.44-3.52-1.46-.28-.26-.73-.06-.73.32v4.21c.02.27.16.53.39.67,1.21.72,2.51,1.12,4.03,1.12,3.85,0,6.35-2.38,8.25-7.36l10.41-27.32c.12-.32-.11-.66-.45-.66h-4.14c-.33,0-.62.2-.73.51l-6.21,17.07-6.7-17.09c-.12-.3-.4-.49-.72-.49h-4.23c-.35,0-.58.35-.45.67l9.62,23.09ZM98.39,11.88h-3.9c-.27,0-.49.22-.49.49v2.08c-1.13-1.31-2.65-2.25-4.66-2.65-.27-.05-.52.15-.52.43v3.81c0,.27.17.5.43.58,3.09.95,4.87,3.87,4.87,7.52,0,4.52-2.66,7.88-7.01,7.88-3.99,0-7.06-3.36-7.06-7.91,0-3.42,1.76-6.36,4.56-7.43.23-.09.39-.32.39-.57v-3.87c0-.28-.26-.49-.53-.43-5.61,1.28-9.45,6.17-9.45,12.41,0,7.17,4.76,12.37,11.46,12.37,3.35,0,5.79-1.3,7.44-3.33v3.21c0,1.09-.13,1.95-.35,2.7-.67,2.27-2.67,3.78-5.67,3.78-2.98,0-5.1-1.41-5.69-4.01-.06-.24-.28-.41-.52-.41h-3.99c-.29,0-.52.26-.48.55.84,5.76,5.31,8.48,10.6,8.48,5.08,0,9.42-2.56,10.64-7.34.29-1.12.44-2.96.44-4.29V12.37c0-.27-.22-.49-.49-.49Z`})}),(0,G.jsxs)(`linearGradient`,{id:`Naamloos_verloop_7`,"data-name":`Naamloos verloop 7`,x1:-48.59,y1:128.26,x2:186.52,y2:-36.37,gradientUnits:`userSpaceOnUse`,children:[(0,G.jsx)(`stop`,{offset:.5,stopColor:`#00e487`}),(0,G.jsx)(`stop`,{offset:1,stopColor:`#1ecbd0`})]})]}),(0,G.jsx)(`g`,{className:`cls-3`,children:(0,G.jsx)(`rect`,{className:`cls-2`,width:200,height:48.44})})]}),vx=e=>(0,G.jsxs)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,G.jsx)(`title`,{children:`TP-Link`}),(0,G.jsx)(`path`,{d:`M15.185 0C10.218 0 6.25 3.984 6.25 8.903V10.8h4.99V8.903c0-2.135 1.736-3.863 3.946-3.863 2.187 0 3.708 1.536 3.708 3.815 0 2.257-1.64 3.912-3.827 3.912h-1.878v5.039h1.878c4.874 0 8.819-4.007 8.819-8.952C23.885 3.72 20.2 0 15.185 0zM.115 12.6v4.103c0 .624.523 1.248 1.236 1.248h4.753v4.801c0 .624.523 1.248 1.236 1.248h4.065V12.6Z`})]}),yx=e=>(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`2000.000000pt`,height:`1000.000000pt`,viewBox:`0 0 2000.000000 1000.000000`,preserveAspectRatio:`xMidYMid meet`,...e,children:(0,G.jsx)(`g`,{transform:`translate(0.000000,1000.000000) scale(0.100000,-0.100000)`,fill:`#000000`,stroke:`none`,children:(0,G.jsx)(`path`,{d:`M214 9972 c-78 -27 -142 -88 -182 -172 -16 -33 -17 -289 -20 -3655 -2 -2604 0 -3659 8 -3760 34 -430 121 -759 286 -1083 332 -650 912 -1075 1680 -1231 328 -66 -433 -61 9102 -61 7915 0 8652 1 8696 16 60 21 147 100 177 161 l24 48 0 3700 c0 3520 -1 3707 -18 3840 -55 422 -181 789 -380 1112 -173 279 -448 550 -728 718 -317 189 -636 299 -1059 362 -108 16 -626 18 -8825 20 -8317 2 -8712 2 -8761 -15z m17121 -1089 c446 -67 853 -276 1161 -595 290 -300 477 -684 541 -1106 19 -129 22 -413 5 -526 -20 -133 -77 -212 -192 -264 -147 -68 -330 2 -406 156 -17 33 -19 58 -16 222 3 201 -8 331 -39 453 -67 265 -191 479 -385 666 -199 192 -424 309 -692 361 -275 53 -508 30 -791 -80 -108 -41 -142 -50 -194 -50 -172 0 -294 117 -305 291 -8 129 40 223 143 283 164 97 481 186 735 206 121 10 306 3 435 -17z m-135 -1188 c354 -86 627 -356 727 -720 24 -87 27 -118 28 -245 0 -139 -1 -148 -29 -207 -55 -121 -157 -187 -286 -188 -95 0 -168 33 -234 106 -60 66 -76 119 -76 244 0 194 -68 309 -224 381 -83 38 -164 41 -261 10 -132 -42 -168 -47 -227 -35 -105 23 -182 83 -226 179 -74 159 -6 336 161 418 180 88 427 110 647 57z m-14089 -45 c139 -26 263 -123 327 -257 l37 -78 -2 -265 c-1 -146 -4 -311 -8 -367 l-6 -103 689 0 c649 0 694 -1 751 -19 149 -46 267 -168 305 -316 59 -223 -53 -454 -270 -562 l-78 -38 -712 -3 -712 -3 -6 -72 c-10 -121 -31 -773 -30 -927 0 -114 5 -164 22 -233 81 -326 319 -564 643 -643 61 -15 136 -19 444 -24 398 -7 402 -7 500 -64 62 -37 142 -128 178 -203 30 -65 32 -74 32 -188 0 -118 -1 -121 -37 -198 -53 -110 -128 -186 -237 -240 l-85 -42 -425 0 c-443 0 -462 1 -646 47 -193 47 -383 132 -562 250 -151 101 -362 312 -462 462 -160 241 -254 484 -296 764 -17 112 -19 386 -5 722 5 124 12 307 16 407 l7 182 -290 3 -289 3 -75 37 c-331 164 -350 616 -35 820 110 71 151 78 457 78 l269 0 0 113 c0 247 20 550 40 617 70 234 314 384 551 340z m12624 -1019 c66 -12 172 -37 235 -57 145 -44 388 -164 503 -247 371 -268 618 -648 719 -1108 21 -96 23 -128 23 -429 0 -380 -31 -1310 -46 -1390 -38 -193 -216 -363 -409 -389 -246 -33 -474 128 -520 367 -7 37 -5 170 5 440 43 1141 43 1136 -9 1290 -61 178 -189 347 -341 452 -62 43 -196 104 -270 125 -81 22 -290 31 -384 16 -381 -60 -704 -368 -782 -746 -93 -452 149 -890 574 -1036 81 -28 210 -49 297 -49 149 0 297 -83 381 -212 82 -128 93 -302 26 -442 -59 -125 -156 -214 -284 -262 -66 -25 -74 -26 -238 -21 -479 13 -917 207 -1243 552 -121 128 -209 256 -291 420 -104 210 -154 378 -181 610 -61 539 142 1121 534 1532 324 339 732 545 1196 602 117 15 368 6 505 -18z m-9341 -130 c98 -48 177 -126 223 -218 25 -52 28 -71 32 -174 1 -64 -7 -409 -19 -765 -29 -839 -25 -945 45 -1130 80 -213 222 -352 430 -421 71 -23 96 -26 220 -27 149 0 180 5 305 55 235 93 407 336 465 654 14 79 31 428 59 1261 13 371 17 416 36 474 93 276 404 416 656 296 130 -62 224 -178 256 -316 12 -52 11 -76 -23 -1015 -26 -740 -37 -854 -109 -1123 -92 -344 -272 -646 -509 -855 -306 -269 -757 -406 -1244 -376 -461 28 -806 171 -1083 447 -230 229 -375 533 -446 937 -21 118 -23 158 -22 440 1 171 6 425 12 565 7 140 16 399 22 575 6 176 15 345 21 375 23 118 121 255 227 317 93 55 167 74 270 70 85 -4 100 -8 176 -46z m3885 30 c148 -46 263 -164 307 -316 13 -47 15 -82 10 -175 -3 -63 -15 -281 -26 -485 -46 -866 -51 -980 -40 -1082 22 -207 90 -383 192 -498 212 -237 608 -284 907 -106 154 91 270 247 341 459 54 162 60 225 95 912 32 647 46 877 55 923 22 108 110 232 214 301 29 19 89 47 132 62 69 23 90 26 166 21 74 -4 99 -10 163 -41 146 -69 242 -204 252 -355 5 -74 -7 -402 -27 -726 -5 -82 -21 -377 -35 -655 -14 -278 -32 -622 -40 -765 -8 -143 -21 -402 -30 -575 -8 -173 -20 -366 -25 -429 -26 -290 -125 -564 -288 -801 -79 -115 -274 -311 -390 -394 -266 -188 -597 -320 -932 -371 -152 -23 -384 -31 -461 -16 -227 45 -387 273 -352 502 38 240 249 428 483 429 186 1 410 45 547 110 212 99 339 236 409 442 23 70 43 178 31 178 -3 0 -24 -16 -46 -35 -113 -94 -281 -175 -419 -201 -392 -75 -837 8 -1157 217 -298 193 -520 491 -639 854 -96 294 -113 528 -80 1090 17 293 31 571 44 850 13 279 20 320 66 413 105 213 358 330 573 263z`})})}),bx=e=>(0,G.jsxs)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,G.jsx)(`title`,{children:`Xiaomi`}),(0,G.jsx)(`path`,{d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`})]}),Kce=e=>(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 320 512`,...e,children:(0,G.jsx)(`path`,{d:`M129.5 512V345.9L18.5 48h55.8l81.8 229.7L250.2 0h51.3L180.8 347.8V512h-51.3z`})}),qce={1:`Panasonic`,4107:`Signify`,4125:`Fortune Brands`,4129:`Legrand`,4142:`LG Electronics`,4151:`NXP Semiconductors`,4161:`STMicroelectronics`,4169:`Silicon Labs`,4190:`Schneider Electric`,4216:`ntve home`,4240:`Green Energy Options`,4251:`Leviton`,4304:`Qorvo`,4321:`Samsung`,4334:`UEI`,4338:`ubisys`,4362:`Samsung SmartThings`,4381:`Comcast`,4388:`Jasco Products`,4405:`dresden elektronik`,4417:`Tuya`,4442:`LG ThinQ`,4447:`Aqara`,4448:`Amazon Alexa`,4454:`Innr`,4456:`Leedarson`,4469:`D-Link`,4472:`WNC Corporation`,4474:`Insta GmbH`,4476:`IKEA`,4478:`Feibit`,4488:`TP-Link`,4489:`LEDVANCE`,4492:`Midea`,4501:`CommScope`,4614:`EME Americas`,4617:`Bosch`,4619:`HEIMAN`,4631:`Amazon Alexa`,4633:`ORVIBO`,4644:`Sunricher`,4653:`AduroSmart`,4662:`Allegion`,4673:`Samjin`,4689:`Neonlite`,4701:`Tuya`,4711:`ARC Technology`,4718:`Xiaomi`,4724:`Trust International`,4735:`Nordic Semiconductor`,4736:`Siterwell`,4738:`SEI Robotics`,4741:`Hager`,4742:`CoolKit`,4745:`Lidl`,4746:`Changhong Network`,4751:`EGLO`,4757:`AVM`,4762:`Delta Dore Rademacher`,4767:`Level Home`,4874:`Eve`,4876:`EVVR`,4877:`BouffaloLab`,4882:`Yeelight`,4886:`Realtek`,4889:`Mitsubishi Electric`,4890:`Resideo`,4891:`Espressif`,4892:`HELLA`,4894:`CAME`,4895:`Longan.link`,4897:`SONOFF`,4903:`Mill International`,4910:`Energetic`,4911:`Yandex`,4915:`Becker Antriebe`,4916:`TCL`,4917:`Dexatek`,4921:`GE Lighting`,4923:`WAREMA`,4927:`ASR`,4930:`Beken`,4932:`Eltako`,4933:`Meross`,4934:`Rafael`,4937:`Apple Home`,4938:`Rollease Acmeda`,4939:`Home Assistant`,4940:`Simon`,4942:`tado°`,4943:`mediola`,4945:`HooRii Technology`,4946:`Häfele`,4950:`Lennox`,4952:`TPV`,4953:`GOQUAL`,4954:`SIEGENIA`,4957:`Nuki`,4961:`Inovelli`,4962:`deveritec`,4965:`Dooya`,4969:`BHtronics`,4972:`Onewish`,4974:`Ambi Labs`,4977:`Tridonic`,4978:`innovation matters`,4987:`Amazon Basics`,4991:`NEO`,4993:`Amazon Prime Video`,4994:`ION INDUSTRIES`,4996:`Apple (iCloud Keychain)`,4998:`Skylux`,4999:`Govee`,5e3:`Infineon`,5002:`Nature`,5003:`ULTRON`,5004:`Hisense`,5006:`Twinkly`,5009:`Kasa`,5010:`Tapo`,5014:`AiDot`,5015:`SwitchBot`,5019:`ITIUS`,5020:`Zemismart`,5022:`Dyson`,5023:`Razer`,5120:`Uascent`,5123:`Grid Connect`,5124:`Phaten`,5125:`Ecovacs`,5127:`ThirdReality`,5128:`VELUX`,5131:`70mai`,5136:`Quectel`,5137:`Freedompro`,5138:`SMARTWIZ`,5139:`1Home`,5141:`Nanoleaf (Caveman)`,5142:`Nanoleaf (Umbra)`,5143:`Konnected`,5144:`Klite`,5145:`Lorex`,5147:`Rang Dong`,5149:`Secuyou`,5150:`arre home`,5151:`Ductech`,5152:`EcoFlow`,5153:`Kwikset`,5155:`Feit Electric`,5158:`ELEGRP`,5159:`Hama`,5161:`Albrecht Jung`,5163:`LETIANPAI`,5165:`QIHANG`,5167:`QIACHIP`,5168:`L-TRADE`,5170:`ELKO EP`,5171:`MOMAX`,5174:`SinuxSoft`,5175:`ACCEL LAB`,5176:`Topstar Lighting`,5181:`Onvis`,5184:`VerLuce`,5185:`Snowball`,5186:`REHAU`,5187:`Goods iQ`,5189:`Finesse Decor`,5190:`TAKE AS GLOBAL`,5192:`LivingStyle`,5193:`Lloyd's`,5196:`TrustAsia`,5197:`Atios`,5199:`Yale`,5202:`Big Ass Fans`,5205:`MagentaHome`,5207:`Wistar`,5212:`Lockly`,5213:`Hosiden`,5215:`Good Way Technology`,5216:`lipro`,5217:`Xinda`,5218:`Energy Magic Cube`,5219:`Eberle`,5221:`Hunter Douglas`,5222:`Hemos Lighting`,5224:`Anona Security`,5226:`Intecular`,5229:`Polyaire`,5230:`SMART`,5231:`SmartWings`,5232:`HOPERF`,5234:`Jiecang`,5235:`Lelight`,5239:`Multi IR`,5240:`APYNOV`,5242:`Realwe`,5243:`LUMIFLOW`,5244:`SHENAN YANGGUANG`,5245:`Morning Electronics`,5246:`MIWA LOCK`,5247:`U-tec`,5248:`Roborock`,5249:`Xenon Industrial`,5250:`Lengceoi`,5251:`jhome`,5254:`Infibrite`,5256:`Flic`,5258:`Occhio`,5259:`Samraj`,5261:`EME`,5262:`Binthen`,5264:`Shelly`,5266:`xxter`,5267:`NIE-TECH`,5268:`Martin Renz`,5269:`Pacific Hogar`,5270:`InnoPhase IOT`,5271:`DMA`,5273:`CLIO`,5274:`Guangdong A-OK`,5275:`AIGOSTAR`,5276:`Launray`,5279:`Deyi Smart`,5282:`Brennenstuhl`,5293:`Raex`,5376:`SmartWave`,5379:`Ronco`,5380:`Mango Network`,5382:`SAFEMO`,5383:`Bweetech`,5384:`Rui Teng`,5385:`SmartSetup`,5387:`Technology Nexus`,5388:`Nexxt Solutions`,5389:`Huayu Lian`,5391:`in-lite`,5393:`Saishigao`,5394:`Yourlite`,5395:`Alpha Tubular Motors`,5396:`Chuan Dian`,5398:`iRobot`,5399:`Huacheng Network`,5401:`i3 Engineering`,5402:`Leviosa`,5403:`Sunfree Motor`,5404:`Schoenberger`,5405:`Dendo Systems`,5406:`Kudelski IoT`,5407:`Apporo`,5408:`Rachio`,5409:`NEWLAB`,5410:`Zimi`,5411:`Yooksmart`,5412:`BofuSmart`,5415:`habi`,5416:`ntve home`,5418:`BSH Home Appliances`,5419:`Kumho Electric`,5420:`Dreame`,5421:`Neo Smart Blinds`,5424:`Taiwan Fu Hsing`,5425:`Solity`,5426:`Arpobot`,5427:`Anker`,5428:`WAGO`,5430:`DomoPlus`,5431:`PEARL`,5432:`Beca`,5433:`WISeKey`,5435:`Griesser`,5436:`alre`,5437:`Amlogic`,5438:`ART DOM`,5439:`Brel`,5441:`Kärcher`,5442:`Lanbon`,5447:`MACO`,5450:`Sciener`,5451:`SkyAngle`,5452:`VIZO Technology`,5456:`AvatarControls`,5457:`Kaijet`,5458:`DEWENWILS`,5459:`SuperBrightLEDS`,5461:`MIUC Technology`,5464:`Ai-Thinker`,5465:`tink`,5467:`MinebeaMitsumi`,5468:`Feierge`,5470:`Sandstrom`,5472:`SIXWGH`,5474:`Renesas`,5475:`StrongKey`,5476:`NEXTY ELECTRONICS`,5478:`ODELIC`,5479:`Haier`,5480:`Econet`,5481:`Feller`,5482:`xCREAS`,5483:`ShinDong-A ES`,5484:`Motionblinds`,5486:`BrizLabs`,5489:`Eurotronic`,5490:`Babai`,5491:`SELVE`,5493:`Xizhen Electronics`,5494:`Enlight`,5496:`WINTEC KOREA`,5497:`Hinkley`,5498:`SMARTSPEC`,5500:`L&S Lighting`,5502:`APICAL`,5506:`KEGU`,5507:`MAMABA`,5510:`Megaman`,5512:`Atouch Winwel`,5513:`Warmup`,5514:`Flipper`,5515:`Deasino`,5516:`ZFL SMART`,5518:`A solution`,5519:`Bold Smart Lock`,5520:`GL.iNet`,5521:`ZH Currtain`,5522:`MEAN WELL`,5525:`Kotonic`,5526:`Sensereo`,5529:`Huarui`,5530:`HAOJAI`,5533:`wibutler`,5534:`UIOT`,5535:`Ltech`,5537:`Delta Dore`,5539:`Intermatic`,5540:`Mikrotik`,5541:`Laticrete`,5543:`Hunter Fan`,5544:`LOCKIN`,5546:`GLEDOPTO`,5547:`Accurate Lock & Hardware`,5548:`SWAN Lite`,5549:`AnablepSecurity`,5551:`Corston`,5552:`JustPlus`,5553:`INSIIDA`,5555:`MiBoxer`,5557:`Brighter Lighting`,5564:`Lysome`,5565:`TBS`,5566:`Easfina`,5567:`Korrus`,5568:`DIANXIAOKU`,5570:`Kaadas`,5572:`FAST ČR`,5574:`Wozart`,5575:`Homewell`,5576:`Maktar`,5577:`Ci Global`,5580:`Schüco`,5582:`MAKEGOOD`,5583:`Globe Electric`,5584:`Vantiva`,5586:`Desjoyaux`,5591:`Boldr`,5594:`JEM Accessories`,5597:`SG Armaturen`,5598:`VoxAura`,5599:`Vitrumshade`,5600:`Leaguer MicroElectronics`,5601:`NOVO`,5603:`YCZNWL`,5607:`Fresh Electric`,5608:`Doorma`,5609:`Sukces`,5614:`moorgen`,5615:`KASTA`,5618:`Viomi`,5620:`Tedee`,5621:`Bouygues Telecom`,5623:`AC Infinity`,5625:`Narwal`,5627:`nomos system`,5630:`Senscomm`,5637:`Remac Smart`,5645:`SUFN`,5646:`LLW`,5647:`POYAL`,5648:`Zhuhai Shengchang`,5651:`Calex`,5653:`Rayrun`,5655:`Jianbian`,5656:`Matterize Labs`,5661:`ACME`,5663:`Fatboy`,5668:`Zhenghui`,5669:`United Electric`,5695:`ADT`,24582:`Google Home`};function xx(e){return qce[e]??`Vendor ${e}`}var Jce={Alexa:lx,Amazon:lx,Apple:ux,Google:fx,SmartThings:gx,Samsung:hx,IKEA:px,Tuya:yx,Xiaomi:bx,Aqara:dx,Shelly:_x,Meross:mx},Yce={1:Hce,4107:Gce,4142:zce,4321:hx,4362:gx,4417:yx,4447:dx,4448:lx,4469:Ice,4476:px,4488:vx,4631:lx,4701:yx,4718:bx,4745:Bce,4757:Fce,4911:Kce,4933:mx,4937:ux,4957:Vce,4987:lx,4993:lx,4996:ux,5009:vx,5010:vx,5023:Uce,5248:Wce,5264:_x,5420:Lce,5398:Rce,5427:Pce,24582:fx};function Xce(e){return Yce[e.rootVendorId]||Object.entries(Jce).find(([t])=>e.label.toUpperCase().includes(t.toUpperCase()))?.[1]}var Sx=({fabric:e})=>{let t=(0,C.useMemo)(()=>Xce(e),[e]);return(0,G.jsx)(db,{title:`${e.label||xx(e.rootVendorId)} (0x${e.rootVendorId.toString(16).toUpperCase().padStart(4,`0`)})`,arrow:!0,children:(0,G.jsx)(Z,{component:`span`,sx:{fill:e=>e.palette.text.primary},children:t?(0,G.jsx)(t,{style:{height:`1.4em`,width:`auto`,maxWidth:`3em`,display:`block`}}):(0,G.jsx)(Nce,{})})})},Zce=e=>(0,G.jsx)(G.Fragment,{children:e.fabrics.map(e=>(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1.5,py:.5,children:[(0,G.jsx)(Sx,{fabric:e}),(0,G.jsx)(Q,{variant:`body2`,children:e.label||xx(e.rootVendorId)})]},e.fabricId))}),Qce=({bridge:e})=>(0,G.jsxs)(Fv,{container:!0,spacing:2,children:[e.featureFlags?.serverMode&&e.featureFlags?.vacuumOnOff===!1&&(0,G.jsx)(Fv,{size:{xs:12},children:(0,G.jsxs)(Uh,{severity:`warning`,icon:(0,G.jsx)(Sb,{}),children:[(0,G.jsx)(Xv,{children:`Vacuum OnOff Disabled (Alexa incompatible)`}),`Alexa `,(0,G.jsx)(`strong`,{children:`requires`}),` the OnOff cluster (PowerController) for robotic vacuums. With OnOff disabled, the vacuum commissions but never appears in the Alexa app. Only disable this if you exclusively use `,(0,G.jsx)(`strong`,{children:`Apple Home`}),`.`]})}),!e.featureFlags?.serverMode&&e.featureFlags?.vacuumOnOff&&(0,G.jsx)(Fv,{size:{xs:12},children:(0,G.jsxs)(Uh,{severity:`info`,icon:(0,G.jsx)(Sb,{}),children:[(0,G.jsx)(Xv,{children:`Vacuum OnOff Cluster Enabled (Alexa)`}),`OnOff cluster is active for Alexa PowerController compatibility. This may cause issues with `,(0,G.jsx)(`strong`,{children:`Apple Home`}),` and`,` `,(0,G.jsx)(`strong`,{children:`Google Home`}),`.`]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsx)($ce,{bridge:e})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsx)(ele,{bridge:e})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsx)(tle,{bridge:e})}),(0,G.jsx)(Fv,{size:{xs:12},children:(0,G.jsx)(nle,{bridge:e})}),(0,G.jsx)(Fv,{size:{xs:12},children:(0,G.jsx)(ile,{bridge:e})}),(0,G.jsx)(Fv,{size:{xs:12},children:(0,G.jsx)(ale,{bridge:e})})]}),$ce=({bridge:e})=>{let{t}=ws(),[n,r]=(0,C.useState)(!1),[i,a]=(0,C.useState)(!1),o=qv(),s=async()=>{a(!0);try{await Nre(e.id),r(!0)}catch(e){o.show({message:`Failed to open commissioning window: ${e instanceof Error?e.message:String(e)}`,severity:`error`})}finally{a(!1)}};if(!e.commissioning)return(0,G.jsx)(hv,{sx:{height:`100%`},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(wb,{sx:{bgcolor:`grey.500`},children:(0,G.jsx)(yb,{})}),(0,G.jsx)(Q,{variant:`h6`,children:t(`bridge.pairing`)})]}),(0,G.jsx)(Q,{color:`text.secondary`,children:t(`bridge.bridgeNotRunning`)})]})});let c=e=>{navigator.clipboard.writeText(e)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(hv,{sx:{height:`100%`},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(wb,{sx:{bgcolor:`primary.main`},children:(0,G.jsx)(yb,{})}),(0,G.jsx)(Q,{variant:`h6`,children:t(`bridge.pairing`)})]}),(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:2,children:[(0,G.jsxs)(Z,{position:`relative`,children:[e.commissioning.isCommissioned&&(0,G.jsx)(Z,{position:`absolute`,top:`50%`,left:`50%`,sx:{transform:`translate(-50%, -50%) rotate(-45deg)`,zIndex:1},children:(0,G.jsx)(Ev,{label:t(`bridge.commissioned`),color:`success`,size:`small`})}),(0,G.jsx)(Z,{sx:{background:`white`,padding:1,borderRadius:1,opacity:e.commissioning.isCommissioned?.5:1},children:(0,G.jsx)(sx,{value:e.commissioning.qrPairingCode,size:120})})]}),(0,G.jsx)(Hv,{spacing:1,width:`100%`,children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,children:[(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[t(`bridge.manualCode`),`:`]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:.5,children:[(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,children:e.commissioning.manualPairingCode}),(0,G.jsx)(Bh,{size:`small`,onClick:()=>c(e.commissioning.manualPairingCode),children:(0,G.jsx)(pb,{fontSize:`small`})})]})]})}),e.commissioning.isCommissioned&&(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:i?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(yb,{}),onClick:s,disabled:i,fullWidth:!0,children:t(i?`bridge.openingWindow`:`bridge.addController`)})]})]})}),(0,G.jsx)(rle,{bridge:e,open:n,onClose:()=>r(!1)})]})},ele=({bridge:e})=>{let{t}=ws();return(0,G.jsx)(hv,{sx:{height:`100%`},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(wb,{sx:{bgcolor:`info.main`},children:(0,G.jsx)(vb,{})}),(0,G.jsx)(Q,{variant:`h6`,children:t(`bridge.bridgeInfo`)})]}),(0,G.jsxs)(Hv,{spacing:1.5,children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:t(`bridge.bridgeId`)}),(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,noWrap:!0,children:e.id})]}),(0,G.jsx)(Ub,{}),(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`common.port`)}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:`medium`,children:e.port})]}),(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`common.devices`)}),(0,G.jsx)(Ev,{icon:(0,G.jsx)(mb,{}),label:e.deviceCount,size:`small`,color:`primary`,variant:`outlined`})]}),e.commissioning&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`bridge.passcode`)}),(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,children:e.commissioning.passcode})]}),(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`bridge.discriminator`)}),(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,children:e.commissioning.discriminator})]})]})]})]})})},tle=({bridge:e})=>{let{t}=ws(),n=e.commissioning?.fabrics??[],[r,i]=(0,C.useState)(!1),a=qv();return(0,G.jsx)(hv,{sx:{height:`100%`},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(wb,{sx:{bgcolor:n.length>0?`success.main`:`grey.500`},children:(0,G.jsx)(Cb,{})}),(0,G.jsx)(Q,{variant:`h6`,children:t(`bridge.connectedFabrics`,{count:n.length})}),(0,G.jsx)(db,{title:`A fabric represents a connection to a Matter controller (e.g., Apple Home, Google Home, Alexa). Each controller creates one fabric when paired.`,children:(0,G.jsx)(Jv,{fontSize:`small`,color:`action`,sx:{cursor:`help`}})})]}),n.length===0?(0,G.jsx)(Q,{color:`text.secondary`,children:t(`bridge.noFabrics`)}):(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsx)(Zce,{fabrics:n}),(0,G.jsx)(db,{title:`Push all current device states to connected controllers`,children:(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:r?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(xb,{}),onClick:async()=>{i(!0);try{let t=await F_(e.id);a.show({message:`Synced ${t.syncedCount} devices to controllers`,severity:`success`})}catch(e){a.show({message:`Force sync failed: ${e instanceof Error?e.message:String(e)}`,severity:`error`})}finally{i(!1)}},disabled:r,fullWidth:!0,children:t(r?`bridge.syncing`:`bridge.forceSync`)})})]})]})})},nle=({bridge:e})=>{let{t}=ws(),n=Nr(),r=e.filter.include.length>0||e.filter.exclude.length>0;return(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(wb,{sx:{bgcolor:`warning.main`},children:(0,G.jsx)(_b,{})}),(0,G.jsx)(Q,{variant:`h6`,sx:{flexGrow:1},children:t(`bridge.entityFilters`)}),(0,G.jsx)(db,{title:t(r?`bridge.editFilters`:`bridge.addFilters`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>n(J9.editBridge(e.id)),children:r?(0,G.jsx)(hb,{}):(0,G.jsx)(fb,{})})})]}),r?(0,G.jsxs)(Hv,{direction:`row`,spacing:1,flexWrap:`wrap`,useFlexGap:!0,children:[e.filter.include.map(e=>(0,G.jsx)(Ev,{size:`small`,icon:(0,G.jsx)(fb,{}),label:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.type}),`: `,e.value]}),color:`success`,variant:`outlined`},`include-${e.type}-${e.value}`)),e.filter.exclude.map(e=>(0,G.jsx)(Ev,{size:`small`,icon:(0,G.jsx)(bb,{}),label:(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:e.type}),`: `,e.value]}),color:`error`,variant:`outlined`},`exclude-${e.type}-${e.value}`))]}):(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`bridge.noFilters`)})]})})},rle=({bridge:e,open:t,onClose:n})=>{let{t:r}=ws();if(!e.commissioning)return null;let i=e=>{navigator.clipboard.writeText(e)};return(0,G.jsxs)(Rb,{open:t,onClose:n,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(yb,{}),r(`bridge.addController`)]})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,gutterBottom:!0,children:r(`bridge.scanQrCode`)}),(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,my:3,children:(0,G.jsx)(Z,{sx:{background:`white`,padding:2,borderRadius:1},children:(0,G.jsx)(sx,{value:e.commissioning.qrPairingCode,size:200})})}),(0,G.jsxs)(Hv,{spacing:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[(0,G.jsx)(`strong`,{children:`Manual Code:`}),` `,e.commissioning.manualPairingCode]}),(0,G.jsx)(db,{title:`Copy`,children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>i(e.commissioning.manualPairingCode),children:(0,G.jsx)(pb,{fontSize:`small`})})})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[(0,G.jsx)(`strong`,{children:`Passcode:`}),` `,e.commissioning.passcode]}),(0,G.jsx)(db,{title:`Copy`,children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>i(e.commissioning.passcode.toString()),children:(0,G.jsx)(pb,{fontSize:`small`})})})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[(0,G.jsx)(`strong`,{children:`Discriminator:`}),` `,e.commissioning.discriminator]}),(0,G.jsx)(db,{title:`Copy`,children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>i(e.commissioning.discriminator.toString()),children:(0,G.jsx)(pb,{fontSize:`small`})})})]})]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mt:2},children:(0,G.jsx)(Q,{variant:`body2`,children:`Matter supports connecting the same bridge to multiple controllers simultaneously. Each controller will have independent control.`})})]}),(0,G.jsx)(zb,{children:(0,G.jsx)(mv,{onClick:n,children:r(`common.close`)})})]})},ile=({bridge:e})=>{let t=e.controllerWarnings;return!t||t.length===0?null:(0,G.jsx)(hv,{children:(0,G.jsx)(vv,{children:(0,G.jsxs)(Uh,{severity:`warning`,icon:(0,G.jsx)(gb,{}),children:[(0,G.jsxs)(Xv,{children:[`Controller warnings (`,t.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,component:`div`,children:`A commissioned controller may not show these devices:`}),(0,G.jsx)(Z,{sx:{mt:1,maxHeight:200,overflow:`auto`},children:t.map(e=>(0,G.jsxs)(Z,{sx:{mb:.5},children:[(0,G.jsx)(Q,{variant:`body2`,component:`span`,fontWeight:`bold`,children:e.entityId}),(0,G.jsxs)(Q,{variant:`body2`,component:`span`,color:`text.secondary`,children:[` on `,e.controllerLabel,e.note?` (${e.note})`:``]})]},`${e.entityId}:${e.deviceTypeId}:${e.controller}`))})]})})})},ale=({bridge:e})=>{let t=e.failedEntities;return!t||t.length===0?null:(0,G.jsx)(hv,{children:(0,G.jsx)(vv,{children:(0,G.jsxs)(Uh,{severity:`warning`,icon:(0,G.jsx)(gb,{}),children:[(0,G.jsxs)(Xv,{children:[`Failed Entities (`,t.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,component:`div`,children:`The following entities could not be added to the bridge:`}),(0,G.jsx)(Z,{sx:{mt:1,maxHeight:200,overflow:`auto`},children:t.map(e=>(0,G.jsxs)(Z,{sx:{mb:.5},children:[(0,G.jsx)(Q,{variant:`body2`,component:`span`,fontWeight:`bold`,children:e.entityId}),(0,G.jsxs)(Q,{variant:`body2`,component:`span`,color:`text.secondary`,children:[`, `,e.reason,e.failedAt?` (${cx(e.failedAt)})`:``]})]},e.entityId))})]})})})},ole={[Q_.Failed]:`error`,[Q_.Stopped]:`warning`,[Q_.Starting]:`info`,[Q_.Running]:`success`},sle=({status:e,reason:t})=>{if(t)return(0,G.jsx)(Uh,{severity:ole[e],variant:`outlined`,children:t})},Cx=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z`}),`Error`),cle=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-1 14H9V8h2zm4 0h-2V8h2z`}),`PauseCircle`),lle={[Q_.Starting]:{label:`Starting`,color:`info`,icon:(0,G.jsx)(xb,{fontSize:`small`})},[Q_.Running]:{label:`Running`,color:`success`,icon:(0,G.jsx)(lv,{fontSize:`small`})},[Q_.Stopped]:{label:`Stopped`,color:`warning`,icon:(0,G.jsx)(cle,{fontSize:`small`})},[Q_.Failed]:{label:`Failed`,color:`error`,icon:(0,G.jsx)(Cx,{fontSize:`small`})}},wx=({status:e,reason:t})=>{let n=lle[e],r=(0,G.jsx)(Ev,{icon:n.icon,label:n.label,size:`small`,color:n.color,variant:`filled`,sx:{fontWeight:500}});return t?(0,G.jsx)(db,{title:t,children:r}):r},Tx=X((0,G.jsx)(`path`,{d:`M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4M13 18h-2v-2h2zm0-4h-2V9h2z`}),`BatteryAlert`),Ex=X((0,G.jsx)(`path`,{d:`M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4M11 20v-5.5H9L13 7v5.5h2z`}),`BatteryChargingFull`),Dx=X((0,G.jsx)(`path`,{d:`M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v15.33C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V5.33C17 4.6 16.4 4 15.67 4`}),`BatteryFull`),Ox=X((0,G.jsx)(`path`,{d:`M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5`}),`Link`),kx=X([(0,G.jsx)(`path`,{d:`M15.11 12.45 14 10.24l-3.11 6.21c-.16.34-.51.55-.89.55s-.73-.21-.89-.55L7.38 13H2v5c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-5h-6c-.38 0-.73-.21-.89-.55`},`0`),(0,G.jsx)(`path`,{d:`M20 4H4c-1.1 0-2 .9-2 2v5h6c.38 0 .73.21.89.55L10 13.76l3.11-6.21c.34-.68 1.45-.68 1.79 0L16.62 11H22V6c0-1.1-.9-2-2-2`},`1`)],`MonitorHeart`),ule=({endpoint:e})=>Ax(e.state)??e.id.local;function Ax(e){if(`basicInformation`in e)return e.basicInformation.nodeLabel;if(`bridgedDeviceBasicInformation`in e)return e.bridgedDeviceBasicInformation.nodeLabel}var jx=e=>{let t=e.parts??[];return t.length===0?[e]:t.flatMap(e=>jx(e))},dle=e=>{let t=e.state,n=t.homeAssistantEntity,r=n?.entity?.entity_id;if(!r)return null;let i=n?.entity?.state?.state??`unknown`,a=i===`unavailable`||i===`unknown`,o=t.powerSource,s=o?.batPercentRemaining==null?null:Math.round(o.batPercentRemaining/2),c=o?.batChargeState===1||o?.batChargeState===2,l=Object.keys(e.state).filter(e=>![`homeAssistantEntity`,`bridgedDeviceBasicInformation`,`identify`].includes(e)),u=[];return n?.mapping?.batteryEntity&&u.push({label:`Battery`,entity:n.mapping.batteryEntity}),n?.mapping?.humidityEntity&&u.push({label:`Humidity`,entity:n.mapping.humidityEntity}),n?.mapping?.pressureEntity&&u.push({label:`Pressure`,entity:n.mapping.pressureEntity}),n?.mapping?.powerEntity&&u.push({label:`Power`,entity:n.mapping.powerEntity}),n?.mapping?.energyEntity&&u.push({label:`Energy`,entity:n.mapping.energyEntity}),{name:Ax(e.state)??e.id.local,entityId:r,haState:i,isUnavailable:a,batteryPercent:s,isCharging:c,clusters:l,autoMappings:u}},fle=({devices:e})=>{let[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=(0,C.useMemo)(()=>jx(e).map(dle).filter(e=>e!==null),[e]),c=(0,C.useMemo)(()=>s.filter(e=>e.isUnavailable),[s]),l=(0,C.useMemo)(()=>s.filter(e=>e.batteryPercent!=null),[s]),u=(0,C.useMemo)(()=>s.filter(e=>e.autoMappings.length>0),[s]),d=s.length-c.length;return(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(wb,{sx:{bgcolor:`secondary.main`},children:(0,G.jsx)(kx,{})}),(0,G.jsx)(Q,{variant:`h6`,sx:{flexGrow:1},children:`Diagnostics`})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:1,flexWrap:`wrap`,useFlexGap:!0,sx:{mb:2},children:[(0,G.jsx)(Ev,{icon:(0,G.jsx)(lv,{}),label:`${d} Healthy`,color:`success`,size:`small`,variant:`outlined`}),c.length>0&&(0,G.jsx)(Ev,{icon:(0,G.jsx)(Sb,{}),label:`${c.length} Unavailable`,color:`warning`,size:`small`,variant:`outlined`,onClick:()=>n(!t),sx:{cursor:`pointer`}}),l.length>0&&(0,G.jsx)(Ev,{icon:(0,G.jsx)(Dx,{}),label:`${l.length} Battery`,color:`info`,size:`small`,variant:`outlined`,onClick:()=>i(!r),sx:{cursor:`pointer`}}),u.length>0&&(0,G.jsx)(Ev,{icon:(0,G.jsx)(Ox,{}),label:`${u.length} Auto-Mapped`,size:`small`,variant:`outlined`,onClick:()=>o(!a),sx:{cursor:`pointer`}})]}),(0,G.jsxs)(Zv,{in:t&&c.length>0,children:[(0,G.jsx)(Ub,{sx:{mb:1}}),(0,G.jsx)(Q,{variant:`subtitle2`,color:`warning.main`,gutterBottom:!0,children:`Unavailable Entities`}),(0,G.jsx)(Hv,{spacing:.5,sx:{mb:1},children:c.map(e=>(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Sb,{color:`warning`,sx:{fontSize:16}}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:`medium`,children:e.name}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontFamily:`monospace`,children:e.entityId}),(0,G.jsx)(Ev,{label:e.haState,size:`small`,color:`warning`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:20,ml:`auto`}})]},e.entityId))})]}),(0,G.jsxs)(Zv,{in:r&&l.length>0,children:[(0,G.jsx)(Ub,{sx:{mb:1}}),(0,G.jsx)(Q,{variant:`subtitle2`,color:`info.main`,gutterBottom:!0,children:`Battery Levels`}),(0,G.jsx)(Hv,{spacing:1,sx:{mb:1},children:l.sort((e,t)=>(e.batteryPercent??0)-(t.batteryPercent??0)).map(e=>(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:.5,children:[e.isCharging?(0,G.jsx)(Ex,{color:`info`,sx:{fontSize:16}}):(e.batteryPercent??0)<=20?(0,G.jsx)(Tx,{color:`warning`,sx:{fontSize:16}}):(0,G.jsx)(Dx,{color:`success`,sx:{fontSize:16}}),(0,G.jsx)(Q,{variant:`body2`,sx:{flexGrow:1},children:e.name}),(0,G.jsxs)(Q,{variant:`body2`,fontWeight:`medium`,children:[e.batteryPercent,`%`,e.isCharging?` ⚡`:``]})]}),(0,G.jsx)(Vv,{variant:`determinate`,value:e.batteryPercent??0,color:(e.batteryPercent??0)<=10?`error`:(e.batteryPercent??0)<=20?`warning`:`success`,sx:{height:4,borderRadius:2}})]},e.entityId))})]}),(0,G.jsxs)(Zv,{in:a&&u.length>0,children:[(0,G.jsx)(Ub,{sx:{mb:1}}),(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Auto-Mapped Entities`}),(0,G.jsx)(Hv,{spacing:.5,sx:{mb:1},children:u.map(e=>(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Q,{variant:`body2`,fontWeight:`medium`,noWrap:!0,children:e.name}),(0,G.jsx)(Hv,{direction:`row`,spacing:.5,sx:{ml:`auto`},children:e.autoMappings.map(e=>(0,G.jsx)(db,{title:e.entity,children:(0,G.jsx)(Ev,{icon:(0,G.jsx)(Ox,{}),label:e.label,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:20}})},e.label))})]},e.entityId))})]})]})})},ple=X((0,G.jsx)(`path`,{fillRule:`evenodd`,d:`M3 3v8h8V3zm6 6H5V5h4zm-6 4v8h8v-8zm6 6H5v-4h4zm4-16v8h8V3zm6 6h-4V5h4zm-6 4v8h8v-8zm6 6h-4v-4h4z`}),`GridView`),mle=X((0,G.jsx)(`path`,{d:`M3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm4 4h14v-2H7zm0 4h14v-2H7zM7 7v2h14V7z`}),`List`),Mx=X((0,G.jsx)(`path`,{d:`M3 18h6v-2H3zM3 6v2h18V6zm0 7h12v-2H3z`}),`Sort`);function Nx(e){let t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current}function hle(e){let{badgeContent:t,invisible:n=!1,max:r=99,showZero:i=!1}=e,a=Nx({badgeContent:t,max:r}),o=n;n===!1&&t===0&&!i&&(o=!0);let{badgeContent:s,max:c=r}=o?a:e,l=s&&Number(s)>c?`${c}+`:s;return{badgeContent:s,invisible:o,max:c,displayValue:l}}function gle(e){return Jd(`MuiBadge`,e)}var _le=Yd(`MuiBadge`,[`root`,`badge`,`dot`,`standard`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`,`invisible`,`colorError`,`colorInfo`,`colorPrimary`,`colorSecondary`,`colorSuccess`,`colorWarning`,`overlapRectangular`,`overlapCircular`,`anchorOriginTopLeftCircular`,`anchorOriginTopLeftRectangular`,`anchorOriginTopRightCircular`,`anchorOriginTopRightRectangular`,`anchorOriginBottomLeftCircular`,`anchorOriginBottomLeftRectangular`,`anchorOriginBottomRightCircular`,`anchorOriginBottomRightRectangular`]),Px=10,Fx=4,vle=e=>{let{color:t,anchorOrigin:n,invisible:r,overlap:i,variant:a,classes:o={}}=e;return Cp({root:[`root`],badge:[`badge`,a,r&&`invisible`,`anchorOrigin${Y(n.vertical)}${Y(n.horizontal)}`,`anchorOrigin${Y(n.vertical)}${Y(n.horizontal)}${Y(i)}`,`overlap${Y(i)}`,t!=="default"&&`color${Y(t)}`]},gle,o)},yle=J(`span`,{name:`MuiBadge`,slot:`Root`})({position:`relative`,display:`inline-flex`,verticalAlign:`middle`,flexShrink:0}),ble=J(`span`,{name:`MuiBadge`,slot:`Badge`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.badge,t[n.variant],t[`anchorOrigin${Y(n.anchorOrigin.vertical)}${Y(n.anchorOrigin.horizontal)}${Y(n.overlap)}`],n.color!=="default"&&t[`color${Y(n.color)}`],n.invisible&&t.invisible]}})(Fm(({theme:e})=>({display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`center`,alignContent:`center`,alignItems:`center`,position:`absolute`,boxSizing:`border-box`,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(12),minWidth:Px*2,lineHeight:1,padding:`0 6px`,height:Px*2,borderRadius:Px,zIndex:1,transition:e.transitions.create(`transform`,{easing:e.transitions.easing.easeInOut,duration:e.transitions.duration.enteringScreen}),variants:[...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText}})),{props:{variant:`dot`},style:{borderRadius:Fx,height:Fx*2,minWidth:Fx*2,padding:0}},{props:{invisible:!0},style:{transition:e.transitions.create(`transform`,{easing:e.transitions.easing.easeInOut,duration:e.transitions.duration.leavingScreen})}},{style:({ownerState:e})=>{let{vertical:t,horizontal:n}=e.anchorOrigin,r=e.overlap===`circular`?`14%`:0;return{"--Badge-translateX":n===`right`?`50%`:`-50%`,"--Badge-translateY":t===`top`?`-50%`:`50%`,top:t===`top`?r:`initial`,bottom:t===`bottom`?r:`initial`,right:n===`right`?r:`initial`,left:n===`left`?r:`initial`,transform:`scale(1) translate(var(--Badge-translateX), var(--Badge-translateY))`,transformOrigin:`${n===`right`?`100%`:`0%`} ${t===`top`?`0%`:`100%`}`,[`&.${_le.invisible}`]:{transform:`scale(0) translate(var(--Badge-translateX), var(--Badge-translateY))`}}}}]})));function Ix(e){return{vertical:e?.vertical??`top`,horizontal:e?.horizontal??`right`}}var Lx=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiBadge`}),{anchorOrigin:r,className:i,classes:a,component:o,components:s={},componentsProps:c={},children:l,overlap:u=`rectangular`,color:d=`default`,invisible:f=!1,max:p=99,badgeContent:m,slots:h,slotProps:g,showZero:_=!1,variant:v=`standard`,...y}=n,{badgeContent:b,invisible:x,max:S,displayValue:C}=hle({max:p,invisible:f,badgeContent:m,showZero:_}),w=Nx({anchorOrigin:Ix(r),color:d,overlap:u,variant:v,badgeContent:m}),T=x||b==null&&v!==`dot`,{color:E=d,overlap:D=u,anchorOrigin:O,variant:k=v}=T?w:n,A=Ix(O),j=k===`dot`?void 0:C,M={...n,badgeContent:b,invisible:T,max:S,displayValue:j,showZero:_,anchorOrigin:A,color:E,overlap:D,variant:k},N=vle(M),P={slots:{root:h?.root??s.Root,badge:h?.badge??s.Badge},slotProps:{root:g?.root??c.root,badge:g?.badge??c.badge}},[F,I]=Hm(`root`,{elementType:yle,externalForwardedProps:{...P,...y},ownerState:M,className:K(N.root,i),ref:t,additionalProps:{as:o}}),[L,R]=Hm(`badge`,{elementType:ble,externalForwardedProps:P,ownerState:M,className:N.badge});return(0,G.jsxs)(F,{...I,children:[l,(0,G.jsx)(L,{...R,children:j})]})});function xle(e){return Jd(`MuiFormLabel`,e)}var Rx=Yd(`MuiFormLabel`,[`root`,`colorSecondary`,`focused`,`disabled`,`error`,`filled`,`required`,`asterisk`]),Sle=e=>{let{classes:t,color:n,focused:r,disabled:i,error:a,filled:o,required:s}=e;return Cp({root:[`root`,`color${Y(n)}`,i&&`disabled`,a&&`error`,o&&`filled`,r&&`focused`,s&&`required`],asterisk:[`asterisk`,a&&`error`]},xle,t)},Cle=J(`label`,{name:`MuiFormLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color===`secondary`&&t.colorSecondary,n.filled&&t.filled]}})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.body1,lineHeight:`1.4375em`,padding:0,position:`relative`,variants:[...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${Rx.focused}`]:{color:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${Rx.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Rx.error}`]:{color:(e.vars||e).palette.error.main}}}]}))),wle=J(`span`,{name:`MuiFormLabel`,slot:`Asterisk`})(Fm(({theme:e})=>({[`&.${Rx.error}`]:{color:(e.vars||e).palette.error.main}}))),zx=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormLabel`}),{children:r,className:i,color:a,component:o=`label`,disabled:s,error:c,filled:l,focused:u,required:d,...f}=n,p=Nv({props:n,muiFormControl:bv(),states:[`color`,`required`,`focused`,`disabled`,`error`,`filled`]}),m={...n,color:p.color||`primary`,component:o,disabled:p.disabled,error:p.error,filled:p.filled,focused:p.focused,required:p.required},h=Sle(m);return(0,G.jsxs)(Cle,{as:o,ownerState:m,className:K(h.root,i),ref:t,...f,children:[r,p.required&&(0,G.jsxs)(wle,{ownerState:m,"aria-hidden":!0,className:h.asterisk,children:[` `,`*`]})]})});function Tle(e){return Jd(`MuiInputLabel`,e)}Yd(`MuiInputLabel`,[`root`,`focused`,`disabled`,`error`,`required`,`asterisk`,`formControl`,`sizeSmall`,`shrink`,`animated`,`standard`,`filled`,`outlined`]);var Ele=e=>{let{classes:t,formControl:n,size:r,shrink:i,disableAnimation:a,variant:o,required:s}=e,c=Cp({root:[`root`,n&&`formControl`,!a&&`animated`,i&&`shrink`,r&&r!==`medium`&&`size${Y(r)}`,o],asterisk:[s&&`asterisk`]},Tle,t);return{...t,...c}},Dle=J(zx,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiInputLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Rx.asterisk}`]:t.asterisk},t.root,n.formControl&&t.formControl,n.size===`small`&&t.sizeSmall,n.shrink&&t.shrink,!n.disableAnimation&&t.animated,n.focused&&t.focused,t[n.variant]]}})(Fm(({theme:e})=>({display:`block`,transformOrigin:`top left`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:`100%`,variants:[{props:({ownerState:e})=>e.formControl,style:{position:`absolute`,left:0,top:0,transform:`translate(0, 20px) scale(1)`}},{props:{size:`small`},style:{transform:`translate(0, 17px) scale(1)`}},{props:({ownerState:e})=>e.shrink,style:{transform:`translate(0, -1.5px) scale(0.75)`,transformOrigin:`top left`,maxWidth:`133%`}},{props:({ownerState:e})=>!e.disableAnimation,style:{transition:e.transitions.create([`color`,`transform`,`max-width`],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})}},{props:{variant:`filled`},style:{zIndex:1,pointerEvents:`none`,transform:`translate(12px, 16px) scale(1)`,maxWidth:`calc(100% - 24px)`}},{props:{variant:`filled`,size:`small`},style:{transform:`translate(12px, 13px) scale(1)`}},{props:({variant:e,ownerState:t})=>e===`filled`&&t.shrink,style:{userSelect:`none`,pointerEvents:`auto`,transform:`translate(12px, 7px) scale(0.75)`,maxWidth:`calc(133% - 24px)`}},{props:({variant:e,ownerState:t,size:n})=>e===`filled`&&t.shrink&&n===`small`,style:{transform:`translate(12px, 4px) scale(0.75)`}},{props:{variant:`outlined`},style:{zIndex:1,pointerEvents:`none`,transform:`translate(14px, 16px) scale(1)`,maxWidth:`calc(100% - 24px)`}},{props:{variant:`outlined`,size:`small`},style:{transform:`translate(14px, 9px) scale(1)`}},{props:({variant:e,ownerState:t})=>e===`outlined`&&t.shrink,style:{userSelect:`none`,pointerEvents:`auto`,maxWidth:`calc(133% - 32px)`,transform:`translate(14px, -9px) scale(0.75)`}}]}))),Bx=C.forwardRef(function(e,t){let n=km({name:`MuiInputLabel`,props:e}),{disableAnimation:r=!1,margin:i,shrink:a,variant:o,className:s,...c}=n,l=bv(),u=a;u===void 0&&l&&(u=l.filled||l.focused||l.adornedStart);let d=Nv({props:n,muiFormControl:l,states:[`size`,`variant`,`required`,`focused`]}),f={...n,disableAnimation:r,formControl:l,shrink:u,size:d.size,variant:d.variant,required:d.required,focused:d.focused},p=Ele(f);return(0,G.jsx)(Dle,{"data-shrink":u,ref:t,className:K(p.root,s),...c,ownerState:f,classes:p})});function Ole(e){return Jd(`MuiMenuItem`,e)}var Vx=Yd(`MuiMenuItem`,[`root`,`focusVisible`,`dense`,`disabled`,`divider`,`gutters`,`selected`]),kle=Tb;function Hx(e,t,n){return e===t?e.firstChild:t&&t.nextElementSibling?t.nextElementSibling:n?null:e.firstChild}function Ux(e,t,n){return e===t?n?e.firstChild:e.lastChild:t&&t.previousElementSibling?t.previousElementSibling:n?null:e.lastChild}function Wx(e,t){if(t===void 0)return!0;let n=e.innerText;return n===void 0&&(n=e.textContent),n=n.trim().toLowerCase(),n.length===0?!1:t.repeating?n[0]===t.keys[0]:n.startsWith(t.keys.join(``))}function Gx(e,t,n,r,i,a){let o=!1,s=i(e,t,t?n:!1);for(;s;){if(s===e.firstChild){if(o)return!1;o=!0}let t=r?!1:s.disabled||s.getAttribute(`aria-disabled`)===`true`;if(!s.hasAttribute(`tabindex`)||!Wx(s,a)||t)s=i(e,s,n);else return s.focus(),!0}return!1}var Ale=C.forwardRef(function(e,t){let{actions:n,autoFocus:r=!1,autoFocusItem:i=!1,children:a,className:o,disabledItemsFocusable:s=!1,disableListWrap:c=!1,onKeyDown:l,variant:u=`selectedMenu`,...d}=e,f=C.useRef(null),p=C.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null});nh(()=>{r&&f.current.focus()},[r]),C.useImperativeHandle(n,()=>({adjustStyleForScrollbar:(e,{direction:t})=>{let n=!f.current.style.width;if(e.clientHeight<f.current.clientHeight&&n){let n=`${kle(eh(e))}px`;f.current.style[t===`rtl`?`paddingLeft`:`paddingRight`]=n,f.current.style.width=`calc(100% + ${n})`}return f.current}}),[]);let m=e=>{let t=f.current,n=e.key;if(e.ctrlKey||e.metaKey||e.altKey){l&&l(e);return}let r=Ab(Qm(t));if(n===`ArrowDown`)e.preventDefault(),Gx(t,r,c,s,Hx);else if(n===`ArrowUp`)e.preventDefault(),Gx(t,r,c,s,Ux);else if(n===`Home`)e.preventDefault(),Gx(t,null,c,s,Hx);else if(n===`End`)e.preventDefault(),Gx(t,null,c,s,Ux);else if(n.length===1){let i=p.current,a=n.toLowerCase(),o=performance.now();i.keys.length>0&&(o-i.lastTime>500?(i.keys=[],i.repeating=!0,i.previousKeyMatched=!0):i.repeating&&a!==i.keys[0]&&(i.repeating=!1)),i.lastTime=o,i.keys.push(a);let c=r&&!i.repeating&&Wx(r,i);i.previousKeyMatched&&(c||Gx(t,r,!1,s,Hx,i))?e.preventDefault():i.previousKeyMatched=!1}l&&l(e)},h=ch(f,t),g=-1;C.Children.forEach(a,(e,t)=>{if(!C.isValidElement(e)){g===t&&(g+=1,g>=a.length&&(g=-1));return}e.props.disabled||(u===`selectedMenu`&&e.props.selected||g===-1)&&(g=t),g===t&&(e.props.disabled||e.props.muiSkipListHighlight||e.type.muiSkipListHighlight)&&(g+=1,g>=a.length&&(g=-1))});let _=C.Children.map(a,(e,t)=>{if(t===g){let t={};return i&&(t.autoFocus=!0),e.props.tabIndex===void 0&&u===`selectedMenu`&&(t.tabIndex=0),C.cloneElement(e,t)}return e});return(0,G.jsx)($v,{role:`menu`,ref:h,className:o,onKeyDown:m,tabIndex:r?0:-1,...d,children:_})});function jle(e){return Jd(`MuiPopover`,e)}Yd(`MuiPopover`,[`root`,`paper`]);function Kx(e,t){let n=0;return typeof t==`number`?n=t:t===`center`?n=e.height/2:t===`bottom`&&(n=e.height),n}function qx(e,t){let n=0;return typeof t==`number`?n=t:t===`center`?n=e.width/2:t===`right`&&(n=e.width),n}function Jx(e){return[e.horizontal,e.vertical].map(e=>typeof e==`number`?`${e}px`:e).join(` `)}function Yx(e){return typeof e==`function`?e():e}var Mle=e=>{let{classes:t}=e;return Cp({root:[`root`],paper:[`paper`]},jle,t)},Nle=J(Fb,{name:`MuiPopover`,slot:`Root`})({}),Xx=J(Wm,{name:`MuiPopover`,slot:`Paper`})({position:`absolute`,overflowY:`auto`,overflowX:`hidden`,minWidth:16,minHeight:16,maxWidth:`calc(100% - 32px)`,maxHeight:`calc(100% - 32px)`,outline:0}),Ple=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiPopover`}),{action:r,anchorEl:i,anchorOrigin:a={vertical:`top`,horizontal:`left`},anchorPosition:o,anchorReference:s=`anchorEl`,children:c,className:l,container:u,elevation:d=8,marginThreshold:f=16,open:p,PaperProps:m={},slots:h={},slotProps:g={},transformOrigin:_={vertical:`top`,horizontal:`left`},TransitionComponent:v,transitionDuration:y=`auto`,TransitionProps:b={},disableScrollLock:x=!1,...S}=n,w=C.useRef(),T={...n,anchorOrigin:a,anchorReference:s,elevation:d,marginThreshold:f,transformOrigin:_,TransitionComponent:v,transitionDuration:y,TransitionProps:b},E=Mle(T),D=C.useCallback(()=>{if(s===`anchorPosition`)return o;let e=Yx(i),t=(e&&e.nodeType===1?e:Qm(w.current).body).getBoundingClientRect();return{top:t.top+Kx(t,a.vertical),left:t.left+qx(t,a.horizontal)}},[i,a.horizontal,a.vertical,o,s]),O=C.useCallback(e=>({vertical:Kx(e,_.vertical),horizontal:qx(e,_.horizontal)}),[_.horizontal,_.vertical]),k=C.useCallback(e=>{let t={width:e.offsetWidth,height:e.offsetHeight},n=O(t);if(s===`none`)return{top:null,left:null,transformOrigin:Jx(n)};let r=D(),a=r.top-n.vertical,o=r.left-n.horizontal,c=a+t.height,l=o+t.width,u=eh(Yx(i)),d=u.innerHeight-f,p=u.innerWidth-f;if(f!==null&&a<f){let e=a-f;a-=e,n.vertical+=e}else if(f!==null&&c>d){let e=c-d;a-=e,n.vertical+=e}if(f!==null&&o<f){let e=o-f;o-=e,n.horizontal+=e}else if(l>p){let e=l-p;o-=e,n.horizontal+=e}return{top:`${Math.round(a)}px`,left:`${Math.round(o)}px`,transformOrigin:Jx(n)}},[i,s,D,O,f]),[A,j]=C.useState(p),M=C.useCallback(()=>{let e=w.current;if(!e)return;let t=k(e);t.top!==null&&e.style.setProperty(`top`,t.top),t.left!==null&&(e.style.left=t.left),e.style.transformOrigin=t.transformOrigin,j(!0)},[k]);C.useEffect(()=>(x&&window.addEventListener(`scroll`,M),()=>window.removeEventListener(`scroll`,M)),[i,x,M]);let N=()=>{M()},P=()=>{j(!1)};C.useEffect(()=>{p&&M()}),C.useImperativeHandle(r,()=>p?{updatePosition:()=>{M()}}:null,[p,M]),C.useEffect(()=>{if(!p)return;let e=Ym(()=>{M()}),t=eh(Yx(i));return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[i,p,M]);let F=y,I={slots:{transition:v,...h},slotProps:{transition:b,paper:m,...g}},[L,R]=Hm(`transition`,{elementType:Qh,externalForwardedProps:I,ownerState:T,getSlotProps:e=>({...e,onEntering:(t,n)=>{e.onEntering?.(t,n),N()},onExited:t=>{e.onExited?.(t),P()}}),additionalProps:{appear:!0,in:p}});y===`auto`&&!L.muiSupportAuto&&(F=void 0);let ee=u||(i?Qm(Yx(i)).body:void 0),[z,{slots:te,slotProps:B,...V}]=Hm(`root`,{ref:t,elementType:Nle,externalForwardedProps:{...I,...S},shouldForwardComponentProp:!0,additionalProps:{slots:{backdrop:h.backdrop},slotProps:{backdrop:lh(typeof g.backdrop==`function`?g.backdrop(T):g.backdrop,{invisible:!0})},container:ee,open:p},ownerState:T,className:K(E.root,l)}),[ne,re]=Hm(`paper`,{ref:w,className:E.paper,elementType:Xx,externalForwardedProps:I,shouldForwardComponentProp:!0,additionalProps:{elevation:d,style:A?void 0:{opacity:0}},ownerState:T});return(0,G.jsx)(z,{...V,...!Lm(z)&&{slots:te,slotProps:B,disableScrollLock:x},children:(0,G.jsx)(L,{...R,timeout:F,children:(0,G.jsx)(ne,{...re,children:c})})})});function Fle(e){return Jd(`MuiMenu`,e)}Yd(`MuiMenu`,[`root`,`paper`,`list`]);var Ile={vertical:`top`,horizontal:`right`},Lle={vertical:`top`,horizontal:`left`},Rle=e=>{let{classes:t}=e;return Cp({root:[`root`],paper:[`paper`],list:[`list`]},Fle,t)},zle=J(Ple,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiMenu`,slot:`Root`})({}),Ble=J(Xx,{name:`MuiMenu`,slot:`Paper`})({maxHeight:`calc(100% - 96px)`,WebkitOverflowScrolling:`touch`}),Vle=J(Ale,{name:`MuiMenu`,slot:`List`})({outline:0}),Zx=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiMenu`}),{autoFocus:r=!0,children:i,className:a,disableAutoFocusItem:o=!1,MenuListProps:s={},onClose:c,open:l,PaperProps:u={},PopoverClasses:d,transitionDuration:f=`auto`,TransitionProps:{onEntering:p,...m}={},variant:h=`selectedMenu`,slots:g={},slotProps:_={},...v}=n,y=Uf(),b={...n,autoFocus:r,disableAutoFocusItem:o,MenuListProps:s,onEntering:p,PaperProps:u,transitionDuration:f,TransitionProps:m,variant:h},x=Rle(b),S=r&&!o&&l,w=C.useRef(null),T=(e,t)=>{w.current&&w.current.adjustStyleForScrollbar(e,{direction:y?`rtl`:`ltr`}),p&&p(e,t)},E=e=>{e.key===`Tab`&&(e.preventDefault(),c&&c(e,`tabKeyDown`))},D=-1;C.Children.map(i,(e,t)=>{C.isValidElement(e)&&(e.props.disabled||(h===`selectedMenu`&&e.props.selected||D===-1)&&(D=t))});let O={slots:g,slotProps:{list:s,transition:m,paper:u,..._}},k=Uv({elementType:g.root,externalSlotProps:_.root,ownerState:b,className:[x.root,a]}),[A,j]=Hm(`paper`,{className:x.paper,elementType:Ble,externalForwardedProps:O,shouldForwardComponentProp:!0,ownerState:b}),[M,N]=Hm(`list`,{className:K(x.list,s.className),elementType:Vle,shouldForwardComponentProp:!0,externalForwardedProps:O,getSlotProps:e=>({...e,onKeyDown:t=>{E(t),e.onKeyDown?.(t)}}),ownerState:b}),P=typeof O.slotProps.transition==`function`?O.slotProps.transition(b):O.slotProps.transition;return(0,G.jsx)(zle,{onClose:c,anchorOrigin:{vertical:`bottom`,horizontal:y?`right`:`left`},transformOrigin:y?Ile:Lle,slots:{root:g.root,paper:A,backdrop:g.backdrop,...g.transition&&{transition:g.transition}},slotProps:{root:k,paper:j,backdrop:typeof _.backdrop==`function`?_.backdrop(b):_.backdrop,transition:{...P,onEntering:(...e)=>{T(...e),P?.onEntering?.(...e)}}},open:l,ref:t,transitionDuration:f,ownerState:b,...v,classes:d,children:(0,G.jsx)(M,{actions:w,autoFocus:r&&(D===-1||o),autoFocusItem:S,variant:h,...N,children:i})})});function Hle(e){return Jd(`MuiNativeSelect`,e)}var Qx=Yd(`MuiNativeSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]),Ule=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return Cp({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${Y(n)}`,a&&`iconOpen`,r&&`disabled`]},Hle,t)},$x=J(`select`,{name:`MuiNativeSelect`})(({theme:e})=>({MozAppearance:`none`,WebkitAppearance:`none`,userSelect:`none`,borderRadius:0,cursor:`pointer`,"&:focus":{borderRadius:0},[`&.${Qx.disabled}`]:{cursor:`default`},"&[multiple]":{height:`auto`},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:e})=>e.variant!==`filled`&&e.variant!==`outlined`,style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:`filled`},style:{"&&&":{paddingRight:32}}},{props:{variant:`outlined`},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),Wle=J($x,{name:`MuiNativeSelect`,slot:`Select`,shouldForwardProp:Dm,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${Qx.multiple}`]:t.multiple}]}})({}),eS=J(`svg`,{name:`MuiNativeSelect`})(({theme:e})=>({position:`absolute`,right:0,top:`calc(50% - .5em)`,pointerEvents:`none`,color:(e.vars||e).palette.action.active,[`&.${Qx.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:`rotate(180deg)`}},{props:{variant:`filled`},style:{right:7}},{props:{variant:`outlined`},style:{right:7}}]})),Gle=J(eS,{name:`MuiNativeSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${Y(n.variant)}`],n.open&&t.iconOpen]}})({}),Kle=C.forwardRef(function(e,t){let{className:n,disabled:r,error:i,IconComponent:a,inputRef:o,variant:s=`standard`,...c}=e,l={...e,disabled:r,variant:s,error:i},u=Ule(l);return(0,G.jsxs)(C.Fragment,{children:[(0,G.jsx)(Wle,{ownerState:l,className:K(u.select,n),disabled:r,ref:o||t,...c}),e.multiple?null:(0,G.jsx)(Gle,{as:a,ownerState:l,className:u.icon})]})});function tS(e){return Jd(`MuiSelect`,e)}var nS=Yd(`MuiSelect`,[`root`,`select`,`multiple`,`filled`,`outlined`,`standard`,`disabled`,`focused`,`icon`,`iconOpen`,`iconFilled`,`iconOutlined`,`iconStandard`,`nativeInput`,`error`]);function qle(e){return e?e.type===`mousedown`||e.type===`pointerdown`||e.type===`touchstart`?`pointer`:e.type===`keydown`||e.type===`click`&&e.detail===0?`keyboard`:null:null}function Jle(e){return e==null||typeof e==`string`&&!e.trim()}function rS(e,t){return typeof t==`object`&&t?e===t:String(e)===String(t)}var iS=C.createContext(null);function Yle(){return C.useContext(iS)}var Xle=iS.Provider,Zle,Qle=J($x,{name:`MuiSelect`,slot:`Select`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`&.${nS.select}`]:t.select},{[`&.${nS.select}`]:t[n.variant]},{[`&.${nS.error}`]:t.error},{[`&.${nS.multiple}`]:t.multiple}]}})({[`&.${nS.select}`]:{height:`auto`,minHeight:`1.4375em`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`}}),$le=J(eS,{name:`MuiSelect`,slot:`Icon`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${Y(n.variant)}`],n.open&&t.iconOpen]}})({}),eue=J(`input`,{shouldForwardProp:e=>Em(e)&&e!==`classes`,name:`MuiSelect`,slot:`NativeInput`})({bottom:0,left:0,position:`absolute`,opacity:0,pointerEvents:`none`,width:`100%`,boxSizing:`border-box`}),tue=e=>{let{classes:t,variant:n,disabled:r,multiple:i,open:a,error:o}=e;return Cp({select:[`select`,n,r&&`disabled`,i&&`multiple`,o&&`error`],icon:[`icon`,`icon${Y(n)}`,a&&`iconOpen`,r&&`disabled`],nativeInput:[`nativeInput`]},tS,t)},nue=C.forwardRef(function(e,t){let{"aria-describedby":n,"aria-label":r,autoFocus:i,autoWidth:a,children:o,className:s,defaultOpen:c,defaultValue:l,disabled:u,displayEmpty:d,error:f=!1,IconComponent:p,inputRef:m,labelId:h,MenuProps:g={},multiple:_,name:v,onBlur:y,onChange:b,onClose:x,onFocus:S,onKeyDown:w,onMouseDown:T,onOpen:E,open:D,readOnly:O,renderValue:k,required:A,SelectDisplayProps:j={},tabIndex:M,type:N,value:P,variant:F=`standard`,...I}=e,[L,R]=ah({controlled:P,default:l,name:`Select`}),[ee,z]=ah({controlled:D,default:c,name:`Select`}),te=C.useRef(null),B=C.useRef(null),[V,ne]=C.useState(null),{current:re}=C.useRef(D!=null),[ie,ae]=C.useState(),[oe,se]=C.useState(null),ce=ch(t,m),le=C.useCallback(e=>{B.current=e,e&&ne(e)},[]),ue=V?.parentNode;C.useImperativeHandle(ce,()=>({focus:()=>{B.current.focus()},node:te.current,value:L}),[L]);let H=V!==null&ⅇC.useEffect(()=>{if(!H||!ue||a||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{ae(ue.clientWidth)});return e.observe(ue),()=>{e.disconnect()}},[H,ue,a]),C.useEffect(()=>{c&&ee&&V&&!re&&(ae(a?null:ue.clientWidth),B.current.focus())},[V,a]),C.useEffect(()=>{i&&B.current.focus()},[i]),C.useEffect(()=>{if(!h)return;let e=Qm(B.current).getElementById(h);if(e){let t=()=>{getSelection().isCollapsed&&B.current.focus()};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}},[h]);let de=(e,t)=>{e?(se(qle(t)),E&&E(t)):(se(null),x&&x(t)),re||(ae(a?null:ue.clientWidth),z(e))},fe=e=>{T?.(e),e.button===0&&(e.preventDefault(),B.current.focus(),de(!0,e))},U=e=>{de(!1,e)},pe=C.Children.toArray(o),me=e=>{let t=pe.find(t=>t.props.value===e.target.value);t!==void 0&&(R(t.props.value),b&&b(e,t))},W=e=>t=>{let n;if(t.currentTarget.hasAttribute(`tabindex`)){if(_){n=Array.isArray(L)?L.slice():[];let t=L.indexOf(e.props.value);t===-1?n.push(e.props.value):n.splice(t,1)}else n=e.props.value;if(e.props.onClick&&e.props.onClick(t),L!==n&&(R(n),b)){let r=t.nativeEvent||t,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:n,name:v}}),b(i,e)}_||de(!1,t)}},he=e=>{O||([` `,`ArrowUp`,`ArrowDown`,`Enter`].includes(e.key)&&(e.preventDefault(),de(!0,e)),w?.(e))},ge=e=>{!H&&y&&(Object.defineProperty(e,"target",{writable:!0,value:{value:L,name:v}}),y(e))};delete I[`aria-invalid`];let _e,ve,ye=[],be=!1;(Ov({value:L})||d)&&(k?_e=k(L):be=!0);let xe=pe.map(e=>{if(!C.isValidElement(e))return null;let t;if(_){if(!Array.isArray(L))throw Error(Ks(2));t=L.some(t=>rS(t,e.props.value)),t&&be&&ye.push(e.props.children)}else t=rS(L,e.props.value),t&&be&&(ve=e.props.children);return C.cloneElement(e,{"aria-selected":t?`true`:`false`,onClick:W(e),onKeyUp:t=>{t.key===` `&&t.preventDefault(),e.props.onKeyUp&&e.props.onKeyUp(t)},role:`option`,selected:t,value:void 0,"data-value":e.props.value})});be&&(_e=_?ye.length===0?null:ye.reduce((e,t,n)=>(e.push(t),n<ye.length-1&&e.push(`, `),e),[]):ve);let Se=ie;!a&&re&&V&&(Se=ue.clientWidth);let Ce;Ce=M===void 0?u?null:0:M;let we=j.id||(v?`mui-component-select-${v}`:void 0),Te={...e,variant:F,value:L,open:H,error:f},Ee=tue(Te),De={...g.PaperProps,...typeof g.slotProps?.paper==`function`?g.slotProps.paper(Te):g.slotProps?.paper},Oe={...g.MenuListProps,...typeof g.slotProps?.list==`function`?g.slotProps.list(Te):g.slotProps?.list},ke=Zf();return(0,G.jsxs)(C.Fragment,{children:[(0,G.jsx)(Qle,{as:`div`,ref:le,tabIndex:Ce,role:`combobox`,"aria-controls":H?ke:void 0,"aria-disabled":u?`true`:void 0,"aria-expanded":H?`true`:`false`,"aria-haspopup":`listbox`,"aria-label":r,"aria-labelledby":[h,we].filter(Boolean).join(` `)||void 0,"aria-describedby":n,"aria-required":A?`true`:void 0,"aria-invalid":f?`true`:void 0,onKeyDown:he,onMouseDown:u||O?null:fe,onBlur:ge,onFocus:S,...j,ownerState:Te,className:K(j.className,Ee.select,s),id:we,children:Jle(_e)?Zle||=(0,G.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):_e}),(0,G.jsx)(eue,{"aria-invalid":f,value:Array.isArray(L)?L.join(`,`):L,name:v,ref:te,"aria-hidden":!0,onChange:me,tabIndex:-1,disabled:u,className:Ee.nativeInput,autoFocus:i,required:A,...I,ownerState:Te}),(0,G.jsx)($le,{as:p,className:Ee.icon,ownerState:Te}),(0,G.jsx)(Xle,{value:oe,children:(0,G.jsx)(Zx,{id:`menu-${v||``}`,anchorEl:ue,open:H,onClose:U,anchorOrigin:{vertical:`bottom`,horizontal:`center`},transformOrigin:{vertical:`top`,horizontal:`center`},...g,slotProps:{...g.slotProps,list:{"aria-labelledby":h,role:`listbox`,"aria-multiselectable":_?`true`:void 0,disableListWrap:!0,id:ke,...Oe},paper:{...De,style:{minWidth:Se,...De==null?null:De.style}}},children:xe})})]})}),aS=X((0,G.jsx)(`path`,{d:`M7 10l5 5 5-5z`}),`ArrowDropDown`);function oS(e){return parseInt(e,10)||0}var rue={shadow:{visibility:`hidden`,position:`absolute`,overflow:`hidden`,height:0,top:0,left:0,transform:`translateZ(0)`}};function iue(e){for(let t in e)return!1;return!0}function sS(e){return iue(e)||e.outerHeightStyle===0&&!e.overflowing}var aue=C.forwardRef(function(e,t){let{onChange:n,maxRows:r,minRows:i=1,style:a,value:o,...s}=e,{current:c}=C.useRef(o!=null),l=C.useRef(null),u=Im(t,l),d=C.useRef(null),f=C.useRef(null),p=C.useCallback(()=>{let t=l.current,n=f.current;if(!t||!n)return;let a=$m(t).getComputedStyle(t);if(a.width===`0px`)return{outerHeightStyle:0,overflowing:!1};n.style.width=a.width,n.value=t.value||e.placeholder||`x`,n.value.slice(-1)===`
|
|
216
216
|
`&&(n.value+=` `);let o=a.boxSizing,s=oS(a.paddingBottom)+oS(a.paddingTop),c=oS(a.borderBottomWidth)+oS(a.borderTopWidth),u=n.scrollHeight;n.value=`x`;let d=n.scrollHeight,p=u;return i&&(p=Math.max(Number(i)*d,p)),r&&(p=Math.min(Number(r)*d,p)),p=Math.max(p,d),{outerHeightStyle:p+(o===`border-box`?s+c:0),overflowing:Math.abs(p-u)<=1}},[r,i,e.placeholder]),m=oh(()=>{let e=l.current,t=p();if(!e||!t||sS(t))return!1;let n=t.outerHeightStyle;return d.current!=null&&d.current!==n}),h=C.useCallback(()=>{let e=l.current,t=p();if(!e||!t||sS(t))return;let n=t.outerHeightStyle;d.current!==n&&(d.current=n,e.style.height=`${n}px`),e.style.overflow=t.overflowing?`hidden`:``},[p]),g=C.useRef(-1);return pf(()=>{let e=Jm(h),t=l?.current;if(!t)return;let n=$m(t);n.addEventListener(`resize`,e);let r;return typeof ResizeObserver<`u`&&(r=new ResizeObserver(()=>{m()&&(r.unobserve(t),cancelAnimationFrame(g.current),h(),g.current=requestAnimationFrame(()=>{r.observe(t)}))}),r.observe(t)),()=>{e.clear(),cancelAnimationFrame(g.current),n.removeEventListener(`resize`,e),r&&r.disconnect()}},[p,h,m]),pf(()=>{h()}),(0,G.jsxs)(C.Fragment,{children:[(0,G.jsx)(`textarea`,{value:o,onChange:e=>{c||h();let t=e.target,r=t.value.length,i=t.value.endsWith(`
|
|
217
|
-
`),a=t.selectionStart===r;i&&a&&t.setSelectionRange(r,r),n&&n(e)},ref:u,rows:i,style:a,...s}),(0,G.jsx)(`textarea`,{"aria-hidden":!0,className:e.className,readOnly:!0,ref:f,tabIndex:-1,style:{...rue.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function oue(e){return Jd(`MuiInputBase`,e)}var cS=Yd(`MuiInputBase`,[`root`,`formControl`,`focused`,`disabled`,`adornedStart`,`adornedEnd`,`error`,`sizeSmall`,`multiline`,`colorSecondary`,`fullWidth`,`hiddenLabel`,`readOnly`,`input`,`inputSizeSmall`,`inputMultiline`,`inputTypeSearch`,`inputAdornedStart`,`inputAdornedEnd`,`inputHiddenLabel`]),sue,lS=(e,t)=>{let{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size===`small`&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${Y(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},uS=(e,t)=>{let{ownerState:n}=e;return[t.input,n.size===`small`&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type===`search`&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},cue=e=>{let{classes:t,color:n,disabled:r,error:i,endAdornment:a,focused:o,formControl:s,fullWidth:c,hiddenLabel:l,multiline:u,readOnly:d,size:f,startAdornment:p,type:m}=e;return Cp({root:[`root`,`color${Y(n)}`,r&&`disabled`,i&&`error`,c&&`fullWidth`,o&&`focused`,s&&`formControl`,f&&f!==`medium`&&`size${Y(f)}`,u&&`multiline`,p&&`adornedStart`,a&&`adornedEnd`,l&&`hiddenLabel`,d&&`readOnly`],input:[`input`,r&&`disabled`,m===`search`&&`inputTypeSearch`,u&&`inputMultiline`,f===`small`&&`inputSizeSmall`,l&&`inputHiddenLabel`,p&&`inputAdornedStart`,a&&`inputAdornedEnd`,d&&`readOnly`]},oue,t)},dS=J(`div`,{name:`MuiInputBase`,slot:`Root`,overridesResolver:lS})(Fm(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:`1.4375em`,boxSizing:`border-box`,position:`relative`,cursor:`text`,display:`inline-flex`,alignItems:`center`,[`&.${cS.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:`default`},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:`4px 0 5px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:`100%`}}]}))),fS=J(`input`,{name:`MuiInputBase`,slot:`Input`,overridesResolver:uS})(Fm(({theme:e})=>{let t=e.palette.mode===`light`,n={color:`currentColor`,...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},r={opacity:`0 !important`},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:`inherit`,letterSpacing:`inherit`,color:`currentColor`,padding:`4px 0 5px`,border:0,boxSizing:`content-box`,background:`none`,height:`1.4375em`,margin:0,WebkitTapHighlightColor:`transparent`,display:`block`,minWidth:0,width:`100%`,"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:`none`},"&::-webkit-search-decoration":{WebkitAppearance:`none`},[`label[data-shrink=false] + .${cS.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${cS.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:`mui-auto-fill-cancel`,animationDuration:`10ms`,"&:-webkit-autofill":{animationDuration:`5000s`,animationName:`mui-auto-fill`}}},{props:{size:`small`},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:`auto`,resize:`none`,padding:0,paddingTop:0}},{props:{type:`search`},style:{MozAppearance:`textfield`}}]}})),pS=Om({"@keyframes mui-auto-fill":{from:{display:`block`}},"@keyframes mui-auto-fill-cancel":{from:{display:`block`}}}),mS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiInputBase`}),{"aria-describedby":r,autoComplete:i,autoFocus:a,className:o,color:s,components:c={},componentsProps:l={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:f,endAdornment:p,error:m,fullWidth:h=!1,id:g,inputComponent:_=`input`,inputProps:v={},inputRef:y,margin:b,maxRows:x,minRows:S,multiline:w=!1,name:T,onBlur:E,onChange:D,onClick:O,onFocus:k,onKeyDown:A,onKeyUp:j,placeholder:M,readOnly:N,renderSuffix:P,rows:F,size:I,slotProps:L={},slots:R={},startAdornment:ee,type:z=`text`,value:te,...B}=n,V=v.value==null?te:v.value,{current:ne}=C.useRef(V!=null),re=C.useRef(),ie=C.useCallback(e=>{},[]),ae=ch(re,y,v.ref,ie),[oe,se]=C.useState(!1),ce=bv(),le=Nv({props:n,muiFormControl:ce,states:[`color`,`disabled`,`error`,`hiddenLabel`,`size`,`required`,`filled`]});le.focused=ce?ce.focused:oe,C.useEffect(()=>{!ce&&d&&oe&&(se(!1),E&&E())},[ce,d,oe,E]);let ue=ce&&ce.onFilled,H=ce&&ce.onEmpty,de=C.useCallback(e=>{Ov(e)?ue&&ue():H&&H()},[ue,H]);nh(()=>{ne&&de({value:V})},[V,de,ne]);let fe=e=>{k&&k(e),v.onFocus&&v.onFocus(e),ce&&ce.onFocus?ce.onFocus(e):se(!0)},U=e=>{E&&E(e),v.onBlur&&v.onBlur(e),ce&&ce.onBlur?ce.onBlur(e):se(!1)},pe=(e,...t)=>{if(!ne){let t=e.target||re.current;if(t==null)throw Error(Ks(1));de({value:t.value})}v.onChange&&v.onChange(e,...t),D&&D(e,...t)};C.useEffect(()=>{de(re.current)},[]);let me=e=>{re.current&&e.currentTarget===e.target&&re.current.focus(),O&&O(e)},W=_,he=v;w&&W===`input`&&(he=F?{type:void 0,minRows:F,maxRows:F,...he}:{type:void 0,maxRows:x,minRows:S,...he},W=aue);let ge=e=>{de(e.animationName===`mui-auto-fill-cancel`?re.current:{value:`x`})};C.useEffect(()=>{ce&&ce.setAdornedStart(!!ee)},[ce,ee]);let _e={...n,color:le.color||`primary`,disabled:le.disabled,endAdornment:p,error:le.error,focused:le.focused,formControl:ce,fullWidth:h,hiddenLabel:le.hiddenLabel,multiline:w,size:le.size,startAdornment:ee,type:z},ve=cue(_e),ye=R.root||c.Root||dS,be=L.root||l.root||{},xe=R.input||c.Input||fS;return he={...he,...L.input??l.input},(0,G.jsxs)(C.Fragment,{children:[!f&&typeof pS==`function`&&(sue||=(0,G.jsx)(pS,{})),(0,G.jsxs)(ye,{...be,ref:t,onClick:me,...B,...!Lm(ye)&&{ownerState:{..._e,...be.ownerState}},className:K(ve.root,be.className,o,N&&`MuiInputBase-readOnly`),children:[ee,(0,G.jsx)(yv.Provider,{value:null,children:(0,G.jsx)(xe,{"aria-invalid":le.error,"aria-describedby":r,autoComplete:i,autoFocus:a,defaultValue:u,disabled:le.disabled,id:g,onAnimationStart:ge,name:T,placeholder:M,readOnly:N,required:le.required,rows:F,value:V,onKeyDown:A,onKeyUp:j,type:z,...he,...!Lm(xe)&&{as:W,ownerState:{..._e,...he.ownerState}},ref:ae,className:K(ve.input,he.className,N&&`MuiInputBase-readOnly`),onBlur:U,onChange:pe,onFocus:fe})}),p,P?P({...le,startAdornment:ee}):null]})]})});function lue(e){return Jd(`MuiInput`,e)}var hS={...cS,...Yd(`MuiInput`,[`root`,`underline`,`input`])},uue=e=>{let{classes:t,disableUnderline:n}=e,r=Cp({root:[`root`,!n&&`underline`],input:[`input`]},lue,t);return{...t,...r}},due=J(dS,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...lS(e,t),!n.disableUnderline&&t.underline]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`;return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:`relative`,variants:[{props:({ownerState:e})=>e.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,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`},[`&.${hS.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${hS.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${hS.disabled}, .${hS.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${hS.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),fue=J(fS,{name:`MuiInput`,slot:`Input`,overridesResolver:uS})({}),gS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,inputComponent:s=`input`,multiline:c=!1,slotProps:l,slots:u={},type:d=`text`,...f}=n,p=uue(n),m={root:{ownerState:{disableUnderline:r}}},h=l??a?Qs(l??a,m):m;return(0,G.jsx)(mS,{slots:{root:u.root??i.Root??due,input:u.input??i.Input??fue},slotProps:h,fullWidth:o,inputComponent:s,multiline:c,ref:t,type:d,...f,classes:p})});gS.muiName=`Input`;function pue(e){return Jd(`MuiFilledInput`,e)}var _S={...cS,...Yd(`MuiFilledInput`,[`root`,`underline`,`input`,`adornedStart`,`adornedEnd`,`sizeSmall`,`multiline`,`hiddenLabel`])},mue=e=>{let{classes:t,disableUnderline:n,startAdornment:r,endAdornment:i,size:a,hiddenLabel:o,multiline:s}=e,c=Cp({root:[`root`,!n&&`underline`,r&&`adornedStart`,i&&`adornedEnd`,a===`small`&&`size${Y(a)}`,o&&`hiddenLabel`,s&&`multiline`],input:[`input`]},pue,t);return{...t,...c}},hue=J(dS,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiFilledInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...lS(e,t),!n.disableUnderline&&t.underline]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`,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)`,i=t?`rgba(0, 0, 0, 0.09)`:`rgba(255, 255, 255, 0.13)`,a=t?`rgba(0, 0, 0, 0.12)`:`rgba(255, 255, 255, 0.12)`;return{position:`relative`,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:i,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${_S.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${_S.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:e})=>!e.disableUnderline,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`},[`&.${_S.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${_S.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${_S.disabled}, .${_S.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${_S.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:`25px 12px 8px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}}]}})),gue=J(fS,{name:`MuiFilledInput`,slot:`Input`,overridesResolver:uS})(Fm(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),vS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFilledInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,hiddenLabel:s,inputComponent:c=`input`,multiline:l=!1,slotProps:u,slots:d={},type:f=`text`,...p}=n,m={...n,disableUnderline:r,fullWidth:o,inputComponent:c,multiline:l,type:f},h=mue(n),g={root:{ownerState:m},input:{ownerState:m}},_=u??a?Qs(g,u??a):g;return(0,G.jsx)(mS,{slots:{root:d.root??i.Root??hue,input:d.input??i.Input??gue},slotProps:_,fullWidth:o,inputComponent:c,multiline:l,ref:t,type:f,...p,classes:h})});vS.muiName=`Input`;var _ue,vue=J(`fieldset`,{name:`MuiNotchedOutlined`,shouldForwardProp:Dm})({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%`}),yue=J(`legend`,{name:`MuiNotchedOutlined`,shouldForwardProp:Dm})(Fm(({theme:e})=>({float:`unset`,width:`auto`,overflow:`hidden`,variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:`11px`,transition:e.transitions.create(`width`,{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,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:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:`100%`,transition:e.transitions.create(`max-width`,{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function bue(e){let{children:t,classes:n,className:r,label:i,notched:a,...o}=e,s=i!=null&&i!==``,c={...e,notched:a,withLabel:s};return(0,G.jsx)(vue,{"aria-hidden":!0,className:r,ownerState:c,...o,children:(0,G.jsx)(yue,{ownerState:c,children:s?(0,G.jsx)(`span`,{children:i}):_ue||=(0,G.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``})})})}function xue(e){return Jd(`MuiOutlinedInput`,e)}var yS={...cS,...Yd(`MuiOutlinedInput`,[`root`,`notchedOutline`,`input`])},Sue=e=>{let{classes:t}=e,n=Cp({root:[`root`],notchedOutline:[`notchedOutline`],input:[`input`]},xue,t);return{...t,...n}},Cue=J(dS,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiOutlinedInput`,slot:`Root`,overridesResolver:lS})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{position:`relative`,borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${yS.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${yS.focused} .${yS.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${yS.focused} .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${yS.error} .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${yS.disabled} .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:`16.5px 14px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{padding:`8.5px 14px`}}]}})),wue=J(bue,{name:`MuiOutlinedInput`,slot:`NotchedOutline`})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),Tue=J(fS,{name:`MuiOutlinedInput`,slot:`Input`,overridesResolver:uS})(Fm(({theme:e})=>({padding:`16.5px 14px`,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{padding:`8.5px 14px`}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),bS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiOutlinedInput`}),{components:r={},fullWidth:i=!1,inputComponent:a=`input`,label:o,multiline:s=!1,notched:c,slots:l={},slotProps:u={},type:d=`text`,...f}=n,p=Sue(n),m=bv(),h=Nv({props:n,muiFormControl:m,states:[`color`,`disabled`,`error`,`focused`,`hiddenLabel`,`size`,`required`]}),g={...n,color:h.color||`primary`,disabled:h.disabled,error:h.error,focused:h.focused,formControl:m,fullWidth:i,hiddenLabel:h.hiddenLabel,multiline:s,size:h.size,type:d},_=l.root??r.Root??Cue,v=l.input??r.Input??Tue,[y,b]=Hm(`notchedOutline`,{elementType:wue,className:p.notchedOutline,shouldForwardComponentProp:!0,ownerState:g,externalForwardedProps:{slots:l,slotProps:u},additionalProps:{label:o!=null&&o!==``&&h.required?(0,G.jsxs)(C.Fragment,{children:[o,` `,`*`]}):o}});return(0,G.jsx)(mS,{slots:{root:_,input:v},slotProps:u,renderSuffix:e=>(0,G.jsx)(y,{...b,notched:c===void 0?!!(e.startAdornment||e.filled||e.focused):c}),fullWidth:i,inputComponent:a,multiline:s,ref:t,type:d,...f,classes:{...p,notchedOutline:null}})});bS.muiName=`Input`;var Eue=e=>{let{classes:t}=e,n=Cp({root:[`root`]},tS,t);return{...t,...n}},xS={name:`MuiSelect`,slot:`Root`,shouldForwardProp:e=>Dm(e)&&e!==`variant`},Due=J(gS,xS)(``),Oue=J(bS,xS)(``),kue=J(vS,xS)(``),SS=C.forwardRef(function(e,t){let n=km({name:`MuiSelect`,props:e}),{autoWidth:r=!1,children:i,classes:a={},className:o,defaultOpen:s=!1,displayEmpty:c=!1,IconComponent:l=aS,id:u,input:d,inputProps:f,label:p,labelId:m,MenuProps:h,multiple:g=!1,native:_=!1,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:S,variant:w=`outlined`,...T}=n,E=_?Kle:nue,D=Nv({props:n,muiFormControl:bv(),states:[`variant`,`error`]}),O=D.variant||w,k={...n,variant:O,classes:a},A=Eue(k),{root:j,...M}=A,N=d||{standard:(0,G.jsx)(Due,{ownerState:k}),outlined:(0,G.jsx)(Oue,{label:p,ownerState:k}),filled:(0,G.jsx)(kue,{ownerState:k})}[O],P=ch(t,Wh(N));return(0,G.jsx)(C.Fragment,{children:C.cloneElement(N,{inputComponent:E,inputProps:{children:i,error:D.error,IconComponent:l,variant:O,type:void 0,multiple:g,..._?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:c,labelId:m,MenuProps:h,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:{id:u,...S}},...f,classes:f?Qs(M,f.classes):M,...d?d.props.inputProps:{}},...(g&&_||c)&&O===`outlined`?{notched:!0}:{},ref:P,className:K(N.props.className,o,A.root),...!d&&{variant:O},...T})})});SS.muiName=`Select`;function Aue(e,t){if(t==null){e.focus();return}try{e.focus({focusVisible:t===`keyboard`})}catch{e.focus()}}var jue=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},Mue=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=Cp({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},Ole,o);return{...o,...s}},Nue=J(Nh,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:jue})(Fm(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${Vx.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Vx.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${Vx.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${Vx.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Vx.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${Hb.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${Hb.inset}`]:{marginLeft:52},[`& .${ay.root}`]:{marginTop:0,marginBottom:0},[`& .${ay.inset}`]:{paddingLeft:36},[`& .${ry.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${ry.root} svg`]:{fontSize:`1.25rem`}}}]}))),CS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=Yle(),m=C.useContext(Qv),h=C.useMemo(()=>({dense:a||m.dense||!1,disableGutters:s}),[m.dense,a,s]),g=C.useRef(null);nh(()=>{r&&g.current&&Aue(g.current,p)},[r]);let _={...n,dense:h.dense,divider:o,disableGutters:s},v=Mue(n),y=ch(g,t),b;return n.disabled||(b=u===void 0?-1:u),(0,G.jsx)(Qv.Provider,{value:h,children:(0,G.jsx)(Nue,{ref:y,role:l,tabIndex:b,component:i,focusVisibleClassName:K(v.focusVisible,c),className:K(v.root,d),...f,ownerState:_,classes:v})})});function Pue(e){return Jd(`MuiFormHelperText`,e)}var wS=Yd(`MuiFormHelperText`,[`root`,`error`,`disabled`,`sizeSmall`,`sizeMedium`,`contained`,`focused`,`filled`,`required`]),Fue,Iue=e=>{let{classes:t,contained:n,size:r,disabled:i,error:a,filled:o,focused:s,required:c}=e;return Cp({root:[`root`,i&&`disabled`,a&&`error`,r&&`size${Y(r)}`,n&&`contained`,s&&`focused`,o&&`filled`,c&&`required`]},Pue,t)},Lue=J(`p`,{name:`MuiFormHelperText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.size&&t[`size${Y(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:`left`,marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${wS.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${wS.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:`small`},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),TS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormHelperText`}),{children:r,className:i,component:a=`p`,disabled:o,error:s,filled:c,focused:l,margin:u,required:d,variant:f,...p}=n,m=Nv({props:n,muiFormControl:bv(),states:[`variant`,`size`,`disabled`,`error`,`filled`,`focused`,`required`]}),h={...n,component:a,contained:m.variant===`filled`||m.variant===`outlined`,variant:m.variant,size:m.size,disabled:m.disabled,error:m.error,filled:m.filled,focused:m.focused,required:m.required};return delete h.ownerState,(0,G.jsx)(Lue,{as:a,className:K(Iue(h).root,i),ref:t,...p,ownerState:h,children:r===` `?Fue||=(0,G.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):r})});function Rue(e){return Jd(`MuiTextField`,e)}Yd(`MuiTextField`,[`root`]);var zue={standard:gS,filled:vS,outlined:bS},Bue=e=>{let{classes:t}=e;return Cp({root:[`root`]},Rue,t)},Vue=J(kv,{name:`MuiTextField`,slot:`Root`})({}),ES=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTextField`}),{autoComplete:r,autoFocus:i=!1,children:a,className:o,color:s=`primary`,defaultValue:c,disabled:l=!1,error:u=!1,FormHelperTextProps:d,fullWidth:f=!1,helperText:p,id:m,InputLabelProps:h,inputProps:g,InputProps:_,inputRef:v,label:y,maxRows:b,minRows:x,multiline:S=!1,name:C,onBlur:w,onChange:T,onFocus:E,placeholder:D,required:O=!1,rows:k,select:A=!1,SelectProps:j,slots:M={},slotProps:N={},type:P,value:F,variant:I=`outlined`,...L}=n,R={...n,autoFocus:i,color:s,disabled:l,error:u,fullWidth:f,multiline:S,required:O,select:A,variant:I},ee=Bue(R),z=Zf(m),te=p&&z?`${z}-helper-text`:void 0,B=y&&z?`${z}-label`:void 0,V=zue[I],ne={slots:M,slotProps:{input:_,inputLabel:h,htmlInput:g,formHelperText:d,select:j,...N}},re={},ie=ne.slotProps.inputLabel;I===`outlined`&&(ie&&ie.shrink!==void 0&&(re.notched=ie.shrink),re.label=y),A&&((!j||!j.native)&&(re.id=void 0),re[`aria-describedby`]=void 0);let[ae,oe]=Hm(`root`,{elementType:Vue,shouldForwardComponentProp:!0,externalForwardedProps:{...ne,...L},ownerState:R,className:K(ee.root,o),ref:t,additionalProps:{disabled:l,error:u,fullWidth:f,required:O,color:s,variant:I}}),[se,ce]=Hm(`input`,{elementType:V,externalForwardedProps:ne,additionalProps:re,ownerState:R}),[le,ue]=Hm(`inputLabel`,{elementType:Bx,externalForwardedProps:ne,ownerState:R}),[H,de]=Hm(`htmlInput`,{elementType:`input`,externalForwardedProps:ne,ownerState:R}),[fe,U]=Hm(`formHelperText`,{elementType:TS,externalForwardedProps:ne,ownerState:R}),[pe,me]=Hm(`select`,{elementType:SS,externalForwardedProps:ne,ownerState:R}),W=(0,G.jsx)(se,{"aria-describedby":te,autoComplete:r,autoFocus:i,defaultValue:c,fullWidth:f,multiline:S,name:C,rows:k,maxRows:b,minRows:x,type:P,value:F,id:z,inputRef:v,onBlur:w,onChange:T,onFocus:E,placeholder:D,inputProps:de,slots:{input:M.htmlInput?H:void 0},...ce});return(0,G.jsxs)(ae,{...oe,children:[y!=null&&y!==``&&(0,G.jsx)(le,{htmlFor:z,id:B,...ue,children:y}),A?(0,G.jsx)(pe,{"aria-describedby":te,id:z,labelId:B,value:F,input:W,...me,children:a}):W,p&&(0,G.jsx)(fe,{id:te,...U,children:p})]})});function Hue(e){return Jd(`MuiToggleButton`,e)}var DS=Yd(`MuiToggleButton`,[`root`,`disabled`,`selected`,`standard`,`primary`,`secondary`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`fullWidth`]),OS=C.createContext({}),kS=C.createContext(void 0);function Uue(e,t){return t===void 0||e===void 0?!1:Array.isArray(t)?t.includes(e):e===t}var Wue=e=>{let{classes:t,fullWidth:n,selected:r,disabled:i,size:a,color:o}=e;return Cp({root:[`root`,r&&`selected`,i&&`disabled`,n&&`fullWidth`,`size${Y(a)}`,o]},Hue,t)},Gue=J(Nh,{name:`MuiToggleButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`size${Y(n.size)}`]]}})(Fm(({theme:e})=>({...e.typography.button,borderRadius:(e.vars||e).shape.borderRadius,padding:11,border:`1px solid ${(e.vars||e).palette.divider}`,color:(e.vars||e).palette.action.active,[`&.${DS.disabled}`]:{color:(e.vars||e).palette.action.disabled,border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},"&:hover":{textDecoration:`none`,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[{props:{color:`standard`},style:{[`&.${DS.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${DS.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:`100%`}},{props:{size:`small`},style:{padding:7,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`},style:{padding:15,fontSize:e.typography.pxToRem(15)}}]}))),AS=C.forwardRef(function(e,t){let{value:n,...r}=C.useContext(OS),i=C.useContext(kS),a=km({props:uf({...r,selected:Uue(e.value,n)},e),name:`MuiToggleButton`}),{children:o,className:s,color:c=`standard`,disabled:l=!1,disableFocusRipple:u=!1,fullWidth:d=!1,onChange:f,onClick:p,selected:m,size:h=`medium`,value:g,..._}=a,v={...a,color:c,disabled:l,disableFocusRipple:u,fullWidth:d,size:h},y=Wue(v),b=e=>{p&&(p(e,g),e.defaultPrevented)||f&&f(e,g)},x=i||``;return(0,G.jsx)(Gue,{className:K(r.className,y.root,s,x),disabled:l,focusRipple:!u,ref:t,onClick:b,onChange:f,value:g,ownerState:v,"aria-pressed":m,..._,children:o})});function Kue(e){return C.Children.toArray(e).filter(e=>C.isValidElement(e))}function que(e){return Jd(`MuiToggleButtonGroup`,e)}var jS=Yd(`MuiToggleButtonGroup`,[`root`,`selected`,`horizontal`,`vertical`,`disabled`,`grouped`,`groupedHorizontal`,`groupedVertical`,`fullWidth`,`firstButton`,`lastButton`,`middleButton`]),Jue=e=>{let{classes:t,orientation:n,fullWidth:r,disabled:i}=e;return Cp({root:[`root`,n,r&&`fullWidth`],grouped:[`grouped`,`grouped${Y(n)}`,i&&`disabled`],firstButton:[`firstButton`],lastButton:[`lastButton`],middleButton:[`middleButton`]},que,t)},Yue=J(`div`,{name:`MuiToggleButtonGroup`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${jS.grouped}`]:t.grouped},{[`& .${jS.grouped}`]:t[`grouped${Y(n.orientation)}`]},{[`& .${jS.firstButton}`]:t.firstButton},{[`& .${jS.lastButton}`]:t.lastButton},{[`& .${jS.middleButton}`]:t.middleButton},t.root,n.orientation===`vertical`&&t.vertical,n.fullWidth&&t.fullWidth]}})(Fm(({theme:e})=>({display:`inline-flex`,borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:`vertical`},style:{flexDirection:`column`,[`& .${jS.grouped}`]:{[`&.${jS.selected} + .${jS.grouped}.${jS.selected}`]:{borderTop:0,marginTop:0}},[`& .${jS.firstButton},& .${jS.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${jS.lastButton},& .${jS.middleButton}`]:{marginTop:-1,borderTop:`1px solid transparent`,borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${jS.lastButton}.${DS.disabled},& .${jS.middleButton}.${DS.disabled}`]:{borderTop:`1px solid transparent`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{orientation:`horizontal`},style:{[`& .${jS.grouped}`]:{[`&.${jS.selected} + .${jS.grouped}.${jS.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${jS.firstButton},& .${jS.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${jS.lastButton},& .${jS.middleButton}`]:{marginLeft:-1,borderLeft:`1px solid transparent`,borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${jS.lastButton}.${DS.disabled},& .${jS.middleButton}.${DS.disabled}`]:{borderLeft:`1px solid transparent`}}}]}))),Xue=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiToggleButtonGroup`}),{children:r,className:i,color:a=`standard`,disabled:o=!1,exclusive:s=!1,fullWidth:c=!1,onChange:l,orientation:u=`horizontal`,size:d=`medium`,value:f,...p}=n,m={...n,disabled:o,fullWidth:c,orientation:u,size:d},h=Jue(m),g=C.useCallback((e,t)=>{if(!l)return;let n=f&&f.indexOf(t),r;f&&n>=0?(r=f.slice(),r.splice(n,1)):r=f?f.concat(t):[t],l(e,r)},[l,f]),_=C.useCallback((e,t)=>{l&&l(e,f===t?null:t)},[l,f]),v=C.useMemo(()=>({className:h.grouped,onChange:s?_:g,value:f,size:d,fullWidth:c,color:a,disabled:o}),[h.grouped,s,_,g,f,d,c,a,o]),y=Kue(r),b=y.length,x=e=>{let t=e===0,n=e===b-1;return t&&n?``:t?h.firstButton:n?h.lastButton:h.middleButton};return(0,G.jsx)(Yue,{role:`group`,className:K(h.root,i),ref:t,ownerState:m,...p,children:(0,G.jsx)(OS.Provider,{value:v,children:y.map((e,t)=>(0,G.jsx)(kS.Provider,{value:x(t),children:e},t))})})}),MS=`api/device-images`;async function NS(e){let t=await fetch(`${MS}/resolve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entityIds:e})});return t.ok?j_(t):{}}async function Zue(e,t){let n=new FormData;n.append(`image`,t),await M_(await fetch(`${MS}/${encodeURIComponent(e)}`,{method:`POST`,body:n}),`Failed to upload image`)}async function Que(e){await M_(await fetch(`${MS}/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete image`)}function $ue(e){return`${MS}/${encodeURIComponent(e)}`}async function PS(e){let t=await fetch(`api/entity-mappings/${e}`);return await M_(t,`Failed to fetch entity mappings`),j_(t)}async function FS(e,t,n){let r=await fetch(`api/entity-mappings/${e}/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});return await M_(r,`Failed to update entity mapping`),j_(r)}async function ede(e,t){let n=await fetch(`api/entity-mappings/${e}/${encodeURIComponent(t)}`,{method:`DELETE`});if(!n.ok)throw Error(`Failed to delete entity mapping: ${n.statusText}`)}var IS=X((0,G.jsx)(`path`,{d:`M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`AddCircleOutline`),LS=X((0,G.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`}),`Delete`);function RS({array1:e,array2:t,parser:n=e=>e}){return e&&t&&e.length===t.length&&e.every((e,r)=>n(e)===n(t[r]))}function zS(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}function tde(e={}){let{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:i=`any`,stringify:a,trim:o=!1}=e;return(e,{inputValue:s,getOptionLabel:c})=>{let l=o?s.trim():s;n&&(l=l.toLowerCase()),t&&(l=zS(l));let u=l?e.filter(e=>{let r=(a||c)(e);return n&&(r=r.toLowerCase()),t&&(r=zS(r)),i===`start`?r.startsWith(l):r.includes(l)}):e;return typeof r==`number`?u.slice(0,r):u}}var nde=tde(),rde=5,ide=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),BS=(e,t)=>e===t,ade=[];function VS(e,t,n,r){if(t||e==null||r)return``;let i=n(e);return typeof i==`string`?i:``}function ode(e){let{unstable_isActiveElementInListbox:t=ide,unstable_classNamePrefix:n=`Mui`,autoComplete:r=!1,autoHighlight:i=!1,autoSelect:a=!1,blurOnSelect:o=!1,clearOnBlur:s=!e.freeSolo,clearOnEscape:c=!1,componentName:l=`useAutocomplete`,defaultValue:u=e.multiple?ade:null,disableClearable:d=!1,disableCloseOnSelect:f=!1,disabled:p,disabledItemsFocusable:m=!1,disableListWrap:h=!1,filterOptions:g=nde,filterSelectedOptions:_=!1,freeSolo:v=!1,getOptionDisabled:y,getOptionKey:b,getOptionLabel:x=e=>e.label??e,groupBy:S,handleHomeEndKeys:w=!e.freeSolo,id:T,includeInputInList:E=!1,inputValue:D,isOptionEqualToValue:O=BS,multiple:k=!1,onChange:A,onClose:j,onHighlightChange:M,onInputChange:N,onOpen:P,open:F,openOnFocus:I=!1,options:L,readOnly:R=!1,renderValue:ee,selectOnFocus:z=!e.freeSolo,value:te}=e,B=Zf(T),V=x;V=e=>{let t=x(e);return typeof t==`string`?t:String(t)};let ne=C.useRef(!1),re=C.useRef(!0),ie=C.useRef(null),ae=C.useRef(null),oe=C.useRef(!1),[se,ce]=C.useState(null),[le,ue]=C.useState(-1),H=i?0:-1,de=C.useRef(H),fe=C.useRef(VS(u??te,k,V)).current,[U,pe]=ih({controlled:te,default:u,name:l}),[me,W]=ih({controlled:D,default:fe,name:l,state:`inputValue`}),[he,ge]=C.useState(!1),_e=C.useCallback((e,t,n)=>{if(!(k?U.length<t.length:t!==null)&&!s)return;let r=VS(t,k,V,ee);me!==r&&(W(r),N&&N(e,r,n))},[V,me,k,N,W,s,U,ee]),[ve,ye]=ih({controlled:F,default:!1,name:l,state:`open`}),[be,xe]=C.useState(!0),Se=!k&&U!=null&&me===V(U),Ce=ve&&!R,we=C.useMemo(()=>k?U:U==null?[]:[U],[k,U]),Te=C.useMemo(()=>O!==BS||we.length===0?null:new Set(we),[O,we]),Ee=C.useCallback(e=>Te?Te.has(e):we.some(t=>t!=null&&O(e,t)),[O,we,Te]),De=Ce?g(L.filter(e=>!(_&&Ee(e))),{inputValue:Se&&be?``:me,getOptionLabel:V}):[],Oe=Nx({filteredOptions:De,value:U,inputValue:me});C.useEffect(()=>{let e=U!==Oe.value;he&&!e||v&&!e||_e(null,U,`reset`)},[U,_e,he,Oe.value,v]);let ke=ve&&De.length>0&&!R,Ae=oh(e=>{if(e===-1)ie.current.focus();else{let t=ee?`data-item-index`:`data-tag-index`;se.querySelector(`[${t}="${e}"]`).focus()}});C.useEffect(()=>{k&&le>U.length-1&&(ue(-1),Ae(-1))},[U,k,le,Ae]);function je(e,t){if(!ae.current||e<0||e>=De.length)return-1;let n=e;for(;;){let r=ae.current.querySelector(`[data-option-index="${n}"]`),i=m?!1:!r||r.disabled||r.getAttribute(`aria-disabled`)===`true`;if(r&&r.hasAttribute(`tabindex`)&&!i)return n;if(n=t===`next`?(n+1)%De.length:(n-1+De.length)%De.length,n===e)return-1}}let Me=oh(({event:e,index:t,reason:r})=>{if(de.current=t,t===-1?ie.current.removeAttribute(`aria-activedescendant`):ie.current.setAttribute(`aria-activedescendant`,`${B}-option-${t}`),M&&[`mouse`,`keyboard`,`touch`].includes(r)&&M(e,t===-1?null:De[t],r),!ae.current)return;let i=ae.current.querySelector(`[role="option"].${n}-focused`);i&&(i.classList.remove(`${n}-focused`),i.classList.remove(`${n}-focusVisible`));let a=ae.current;if(ae.current.getAttribute(`role`)!==`listbox`&&(a=ae.current.parentElement.querySelector(`[role="listbox"]`)),!a)return;if(t===-1){a.scrollTop=0;return}let o=ae.current.querySelector(`[data-option-index="${t}"]`);if(o&&(o.classList.add(`${n}-focused`),r===`keyboard`&&o.classList.add(`${n}-focusVisible`),a.scrollHeight>a.clientHeight&&r!==`mouse`&&r!==`touch`)){let e=o,t=a.clientHeight+a.scrollTop,n=e.offsetTop+e.offsetHeight;n>t?a.scrollTop=n-a.clientHeight:e.offsetTop-e.offsetHeight*(S?1.3:0)<a.scrollTop&&(a.scrollTop=e.offsetTop-e.offsetHeight*(S?1.3:0))}}),Ne=oh(({event:e,diff:t,direction:n=`next`,reason:i})=>{if(!Ce)return;let a=je((()=>{let e=De.length-1;if(t===`reset`)return H;if(t===`start`)return 0;if(t===`end`)return e;let n=de.current+t;return n<0?n===-1&&E?-1:h&&de.current!==-1||Math.abs(t)>1?0:e:n>e?n===e+1&&E?-1:h||Math.abs(t)>1?e:0:n})(),n);if(Me({index:a,reason:i,event:e}),r&&t!==`reset`)if(a===-1)ie.current.value=me;else{let e=V(De[a]);ie.current.value=e,e.toLowerCase().indexOf(me.toLowerCase())===0&&me.length>0&&ie.current.setSelectionRange(me.length,e.length)}}),Pe=!RS({array1:Oe.filteredOptions,array2:De,parser:V}),Fe=()=>{if(de.current!==-1&&!RS({array1:Oe.filteredOptions,array2:De,parser:V})&&Oe.inputValue===me&&(k?U.length===Oe.value.length&&Oe.value.every((e,t)=>V(U[t])===V(e)):((e,t)=>(e?V(e):``)===(t?V(t):``))(Oe.value,U))){let e=Oe.filteredOptions[de.current];if(e)return De.findIndex(t=>V(t)===V(e))}return-1},Ie=C.useCallback(()=>{if(!Ce)return;let e=Fe();if(e!==-1){de.current=e;return}let t=k?U[0]:U;if(De.length===0||t==null){Ne({diff:`reset`});return}if(ae.current){if(t!=null){let e=De[de.current];if(k&&e&&U.findIndex(t=>O(e,t))!==-1)return;let n=De.findIndex(e=>O(e,t));n===-1?Ne({diff:`reset`}):Me({index:n});return}if(de.current>=De.length-1){Me({index:De.length-1});return}Me({index:de.current})}},[De.length,k?!1:U,Ne,Me,Ce,me,k]),Le=oh(e=>{th(ae,e),e&&Ie()});C.useEffect(()=>{(Pe||Ce&&!f)&&Ie()},[Ie,Pe,Ce,f]),C.useEffect(()=>{if(typeof window>`u`)return;let e=()=>{oe.current=!0};return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e)}},[]);let Re=e=>{ve||(ye(!0),xe(!0),P&&P(e))},ze=(e,t)=>{ve&&(ye(!1),j&&j(e,t))},Be=(e,t,n,r)=>{if(k){if(U.length===t.length&&U.every((e,n)=>e===t[n]))return}else if(U===t)return;A&&A(e,t,n,r),pe(t)},Ve=C.useRef(!1),He=(e,t,n=`selectOption`,r=`options`)=>{let i=n,a=t;if(k){a=Array.isArray(U)?U.slice():[];let e=a.findIndex(e=>O(t,e));e===-1?a.push(t):r!==`freeSolo`&&(a.splice(e,1),i=`removeOption`)}_e(e,a,i),Be(e,a,i,{option:t}),!f&&(!e||!e.ctrlKey&&!e.metaKey)&&ze(e,i),(o===!0||o===`touch`&&Ve.current||o===`mouse`&&!Ve.current)&&ie.current.blur()};function Ue(e,t){if(e===-1)return-1;let n=e;for(;;){if(t===`next`&&n===U.length||t===`previous`&&n===-1)return-1;let e=ee?`data-item-index`:`data-tag-index`,r=se.querySelector(`[${e}="${n}"]`);if(!r||!r.hasAttribute(`tabindex`)||r.disabled||r.getAttribute(`aria-disabled`)===`true`)n+=t===`next`?1:-1;else return n}}let We=(e,t)=>{if(!k)return;me===``&&ze(e,`toggleInput`);let n=le;le===-1&&t===`previous`?(n=U.length-1,v&&me!==``&&(W(``),N&&N(e,``,`reset`))):(n+=t===`next`?1:-1,n<0&&(n=0),n===U.length&&(n=-1)),n=Ue(n,t),ue(n),Ae(n)},Ge=e=>{ne.current=!0,W(``),N&&N(e,``,`clear`),Be(e,k?[]:null,`clear`)},Ke=e=>t=>{if(e.onKeyDown&&e.onKeyDown(t),!t.defaultMuiPrevented&&(le!==-1&&![`ArrowLeft`,`ArrowRight`].includes(t.key)&&(ue(-1),Ae(-1)),t.which!==229))switch(t.key){case`Home`:Ce&&w&&(t.preventDefault(),Ne({diff:`start`,direction:`next`,reason:`keyboard`,event:t}));break;case`End`:Ce&&w&&(t.preventDefault(),Ne({diff:`end`,direction:`previous`,reason:`keyboard`,event:t}));break;case`PageUp`:t.preventDefault(),Ne({diff:-5,direction:`previous`,reason:`keyboard`,event:t}),Re(t);break;case`PageDown`:t.preventDefault(),Ne({diff:rde,direction:`next`,reason:`keyboard`,event:t}),Re(t);break;case`ArrowDown`:t.preventDefault(),Ne({diff:1,direction:`next`,reason:`keyboard`,event:t}),Re(t);break;case`ArrowUp`:t.preventDefault(),Ne({diff:-1,direction:`previous`,reason:`keyboard`,event:t}),Re(t);break;case`ArrowLeft`:{let e=ie.current;if(!(e&&e.selectionStart===0&&e.selectionEnd===0))return;!k&&ee&&U!=null?(v&&me!==``&&(W(``),N&&N(t,``,`reset`)),ue(0),Ae(0)):We(t,`previous`);break}case`ArrowRight`:!k&&ee?(ue(-1),Ae(-1)):We(t,`next`);break;case`Enter`:if(de.current!==-1&&Ce){let e=De[de.current],n=y?y(e):!1;if(t.preventDefault(),n)return;He(t,e,`selectOption`),r&&ie.current.setSelectionRange(ie.current.value.length,ie.current.value.length)}else v&&me!==``&&Se===!1&&(k&&t.preventDefault(),He(t,me,`createOption`,`freeSolo`));break;case`Escape`:Ce?(t.preventDefault(),t.stopPropagation(),ze(t,`escape`)):c&&(me!==``||k&&U.length>0||ee)&&(t.preventDefault(),t.stopPropagation(),Ge(t));break;case`Backspace`:if(k&&!R&&me===``&&U.length>0){let e=le===-1?U.length-1:le,n=U.slice();n.splice(e,1),Be(t,n,`removeOption`,{option:U[e]})}!k&&ee&&!R&&me===``&&Be(t,null,`removeOption`,{option:U});break;case`Delete`:if(k&&!R&&me===``&&U.length>0&&le!==-1){let e=le,n=U.slice();n.splice(e,1),Be(t,n,`removeOption`,{option:U[e]})}!k&&ee&&!R&&me===``&&Be(t,null,`removeOption`,{option:U});break;default:}},qe=e=>{if(ge(!0),le!==-1&&(ue(-1),Ae(-1)),oe.current){oe.current=!1;return}I&&!ne.current&&Re(e)},Je=e=>{if(t(ae)){ie.current.focus();return}ge(!1),re.current=!0,ne.current=!1,a&&de.current!==-1&&Ce?He(e,De[de.current],`blur`):a&&v&&me!==``?He(e,me,`blur`,`freeSolo`):s&&_e(e,U,`blur`),ze(e,`blur`)},Ye=e=>{let t=e.target.value;me!==t&&(W(t),xe(!1),N&&N(e,t,`input`)),t===``?!d&&!k&&!ee&&Be(e,null,`clear`):Re(e)},Xe=e=>{let t=Number(e.currentTarget.getAttribute(`data-option-index`));de.current!==t&&Me({event:e,index:t,reason:`mouse`})},Ze=e=>{Me({event:e,index:Number(e.currentTarget.getAttribute(`data-option-index`)),reason:`touch`}),Ve.current=!0},Qe=e=>{He(e,De[Number(e.currentTarget.getAttribute(`data-option-index`))],`selectOption`),Ve.current=!1},$e=e=>t=>{let n=U.slice();n.splice(e,1),Be(t,n,`removeOption`,{option:U[e]})},et=e=>{Be(e,null,`removeOption`,{option:U})},tt=e=>{ve?ze(e,`toggleInput`):Re(e)},nt=e=>{e.currentTarget.contains(e.target)&&(se&&!se.contains(e.target)||e.target.getAttribute(`id`)!==B&&e.preventDefault())},rt=e=>{e.currentTarget.contains(e.target)&&(se&&!se.contains(e.target)||(ie.current.focus(),z&&re.current&&ie.current.selectionEnd-ie.current.selectionStart===0&&ie.current.select(),re.current=!1))},it=e=>{!p&&(me===``||!ve)&&tt(e)},at=v&&me.length>0;at||=k?U.length>0:U!==null;let ot=De;return S&&(ot=De.reduce((e,t,n)=>{let r=S(t);return e.length>0&&e[e.length-1].group===r?e[e.length-1].options.push(t):e.push({key:n,index:n,group:r,options:[t]}),e},[])),p&&he&&Je(),{getRootProps:(e={})=>({...e,onKeyDown:Ke(e),onMouseDown:nt,onClick:rt}),getInputLabelProps:()=>({id:`${B}-label`,htmlFor:B}),getInputProps:()=>({id:B,value:me,onBlur:Je,onFocus:qe,onChange:Ye,onMouseDown:it,"aria-activedescendant":Ce?``:null,"aria-autocomplete":r?`both`:`list`,"aria-controls":ke?`${B}-listbox`:void 0,"aria-expanded":ke,autoComplete:`off`,ref:ie,autoCapitalize:`none`,spellCheck:`false`,role:`combobox`,disabled:p}),getClearProps:()=>({tabIndex:-1,type:`button`,onClick:Ge}),getItemProps:({index:e=0}={})=>({...k&&{key:e},...ee?{"data-item-index":e}:{"data-tag-index":e},tabIndex:-1,...!R&&{onDelete:k?$e(e):et}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:`button`,onClick:tt}),getTagProps:({index:e})=>({key:e,"data-tag-index":e,tabIndex:-1,...!R&&{onDelete:$e(e)}}),getListboxProps:()=>({role:`listbox`,id:`${B}-listbox`,"aria-labelledby":`${B}-label`,"aria-multiselectable":k||void 0,ref:Le,onMouseDown:e=>{e.preventDefault()}}),getOptionProps:({index:e,option:t})=>{let n=Ee(t),r=y?y(t):!1;return{key:b?.(t)??V(t),tabIndex:-1,role:`option`,id:`${B}-option-${e}`,onMouseMove:Xe,onClick:Qe,onTouchStart:Ze,"data-option-index":e,"aria-disabled":r,"aria-selected":n}},id:B,inputValue:me,value:U,dirty:at,expanded:Ce&&se,popupOpen:Ce,focused:he||le!==-1,anchorEl:se,setAnchorEl:ce,focusedItem:le,focusedTag:le,groupedOptions:ot}}function sde(e){return Jd(`MuiListSubheader`,e)}Yd(`MuiListSubheader`,[`root`,`colorPrimary`,`colorInherit`,`gutters`,`inset`,`sticky`]);var cde=e=>{let{classes:t,color:n,disableGutters:r,inset:i,disableSticky:a}=e;return Cp({root:[`root`,n!=="default"&&`color${Y(n)}`,!r&&`gutters`,i&&`inset`,!a&&`sticky`]},sde,t)},lde=J(`li`,{name:`MuiListSubheader`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Y(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(Fm(({theme:e})=>({boxSizing:`border-box`,lineHeight:`48px`,listStyle:`none`,color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:`primary`},style:{color:(e.vars||e).palette.primary.main}},{props:{color:`inherit`},style:{color:`inherit`}},{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:72}},{props:({ownerState:e})=>!e.disableSticky,style:{position:`sticky`,top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),HS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiListSubheader`}),{className:r,color:i=`default`,component:a=`li`,disableGutters:o=!1,disableSticky:s=!1,inset:c=!1,...l}=n,u={...n,color:i,component:a,disableGutters:o,disableSticky:s,inset:c};return(0,G.jsx)(lde,{as:a,className:K(cde(u).root,r),ref:t,ownerState:u,...l})});HS&&(HS.muiSkipListHighlight=!0);function ude(e){return Jd(`MuiAutocomplete`,e)}var US=Yd(`MuiAutocomplete`,`root.expanded.fullWidth.focused.focusVisible.tag.tagSizeSmall.tagSizeMedium.hasPopupIcon.hasClearIcon.inputRoot.input.inputFocused.endAdornment.clearIndicator.popupIndicator.popupIndicatorOpen.popper.popperDisablePortal.paper.listbox.loading.noOptions.option.groupLabel.groupUl`.split(`.`)),dde,fde,pde=e=>{let{classes:t,disablePortal:n,expanded:r,focused:i,fullWidth:a,hasClearIcon:o,hasPopupIcon:s,inputFocused:c,popupOpen:l,size:u}=e;return Cp({root:[`root`,r&&`expanded`,i&&`focused`,a&&`fullWidth`,o&&`hasClearIcon`,s&&`hasPopupIcon`],inputRoot:[`inputRoot`],input:[`input`,c&&`inputFocused`],tag:[`tag`,`tagSize${Y(u)}`],endAdornment:[`endAdornment`],clearIndicator:[`clearIndicator`],popupIndicator:[`popupIndicator`,l&&`popupIndicatorOpen`],popper:[`popper`,n&&`popperDisablePortal`],paper:[`paper`],listbox:[`listbox`],loading:[`loading`],noOptions:[`noOptions`],option:[`option`],groupLabel:[`groupLabel`],groupUl:[`groupUl`]},ude,t)},mde=J(`div`,{name:`MuiAutocomplete`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{fullWidth:r,hasClearIcon:i,hasPopupIcon:a,inputFocused:o,size:s}=n;return[{[`& .${US.tag}`]:t.tag},{[`& .${US.tag}`]:t[`tagSize${Y(s)}`]},{[`& .${US.inputRoot}`]:t.inputRoot},{[`& .${US.input}`]:t.input},{[`& .${US.input}`]:o&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,i&&t.hasClearIcon]}})({[`&.${US.focused} .${US.clearIndicator}`]:{visibility:`visible`},"@media (pointer: fine)":{[`&:hover .${US.clearIndicator}`]:{visibility:`visible`}},[`& .${US.tag}`]:{margin:3,maxWidth:`calc(100% - 6px)`},[`& .${US.inputRoot}`]:{[`.${US.hasPopupIcon}&, .${US.hasClearIcon}&`]:{paddingRight:30},[`.${US.hasPopupIcon}.${US.hasClearIcon}&`]:{paddingRight:56},[`& .${US.input}`]:{width:0,minWidth:30}},[`& .${hS.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:`4px 4px 4px 0px`}},[`& .${hS.root}.${cS.sizeSmall}`]:{[`& .${hS.input}`]:{padding:`2px 4px 3px 0`}},[`& .${yS.root}`]:{padding:9,[`.${US.hasPopupIcon}&, .${US.hasClearIcon}&`]:{paddingRight:39},[`.${US.hasPopupIcon}.${US.hasClearIcon}&`]:{paddingRight:65},[`& .${US.input}`]:{padding:`7.5px 4px 7.5px 5px`},[`& .${US.endAdornment}`]:{right:9}},[`& .${yS.root}.${cS.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${US.input}`]:{padding:`2.5px 4px 2.5px 8px`}},[`& .${_S.root}`]:{paddingTop:19,paddingLeft:8,[`.${US.hasPopupIcon}&, .${US.hasClearIcon}&`]:{paddingRight:39},[`.${US.hasPopupIcon}.${US.hasClearIcon}&`]:{paddingRight:65},[`& .${_S.input}`]:{padding:`7px 4px`},[`& .${US.endAdornment}`]:{right:9}},[`& .${_S.root}.${cS.sizeSmall}`]:{paddingBottom:1,[`& .${_S.input}`]:{padding:`2.5px 4px`}},[`& .${cS.hiddenLabel}`]:{paddingTop:8},[`& .${_S.root}.${cS.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${US.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${_S.root}.${cS.hiddenLabel}.${cS.sizeSmall}`]:{[`& .${US.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${US.input}`]:{flexGrow:1,textOverflow:`ellipsis`,opacity:0},variants:[{props:{fullWidth:!0},style:{width:`100%`}},{props:{size:`small`},style:{[`& .${US.tag}`]:{margin:2,maxWidth:`calc(100% - 4px)`}}},{props:{inputFocused:!0},style:{[`& .${US.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${US.inputRoot}`]:{flexWrap:`wrap`}}}]}),hde=J(`div`,{name:`MuiAutocomplete`,slot:`EndAdornment`})({position:`absolute`,right:0,top:`50%`,transform:`translate(0, -50%)`}),gde=J(Bh,{name:`MuiAutocomplete`,slot:`ClearIndicator`})({marginRight:-2,padding:4,visibility:`hidden`}),_de=J(Bh,{name:`MuiAutocomplete`,slot:`PopupIndicator`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen]}})({padding:2,marginRight:-2,variants:[{props:{popupOpen:!0},style:{transform:`rotate(180deg)`}}]}),vde=J(ab,{name:`MuiAutocomplete`,slot:`Popper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${US.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:`absolute`}}]}))),yde=J(Wm,{name:`MuiAutocomplete`,slot:`Paper`})(Fm(({theme:e})=>({...e.typography.body1,overflow:`auto`}))),bde=J(`div`,{name:`MuiAutocomplete`,slot:`Loading`})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:`14px 16px`}))),xde=J(`div`,{name:`MuiAutocomplete`,slot:`NoOptions`})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:`14px 16px`}))),Sde=J(`ul`,{name:`MuiAutocomplete`,slot:`Listbox`})(Fm(({theme:e})=>({listStyle:`none`,margin:0,padding:`8px 0`,maxHeight:`40vh`,overflow:`auto`,position:`relative`,[`& .${US.option}`]:{minHeight:48,display:`flex`,overflow:`hidden`,justifyContent:`flex-start`,alignItems:`center`,cursor:`pointer`,paddingTop:6,boxSizing:`border-box`,outline:`0`,WebkitTapHighlightColor:`transparent`,paddingBottom:6,paddingLeft:16,paddingRight:16,[e.breakpoints.up(`sm`)]:{minHeight:`auto`},[`&.${US.focused}`]:{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},'&[aria-disabled="true"]':{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`&.${US.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${US.focused}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${US.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),Cde=J(HS,{name:`MuiAutocomplete`,slot:`GroupLabel`})(Fm(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),wde=J(`ul`,{name:`MuiAutocomplete`,slot:`GroupUl`})({padding:0,[`& .${US.option}`]:{paddingLeft:24}}),WS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAutocomplete`}),{autoComplete:r=!1,autoHighlight:i=!1,autoSelect:a=!1,blurOnSelect:o=!1,ChipProps:s,className:c,clearIcon:l=dde||=(0,G.jsx)(Vh,{fontSize:`small`}),clearOnBlur:u=!n.freeSolo,clearOnEscape:d=!1,clearText:f=`Clear`,closeText:p=`Close`,componentsProps:m,defaultValue:h=n.multiple?[]:null,disableClearable:g=!1,disableCloseOnSelect:_=!1,disabled:v=!1,disabledItemsFocusable:y=!1,disableListWrap:b=!1,disablePortal:x=!1,filterOptions:S,filterSelectedOptions:w=!1,forcePopupIcon:T=`auto`,freeSolo:E=!1,fullWidth:D=!1,getLimitTagsText:O=e=>`+${e}`,getOptionDisabled:k,getOptionKey:A,getOptionLabel:j,isOptionEqualToValue:M,groupBy:N,handleHomeEndKeys:P=!n.freeSolo,id:F,includeInputInList:I=!1,inputValue:L,limitTags:R=-1,ListboxComponent:ee,ListboxProps:z,loading:te=!1,loadingText:B=`Loading…`,multiple:V=!1,noOptionsText:ne=`No options`,onChange:re,onClose:ie,onHighlightChange:ae,onInputChange:oe,onOpen:se,open:ce,openOnFocus:le=!1,openText:ue=`Open`,options:H,PaperComponent:de,PopperComponent:fe,popupIcon:U=fde||=(0,G.jsx)(aS,{}),readOnly:pe=!1,renderGroup:me,renderInput:W,renderOption:he,renderTags:ge,renderValue:_e,selectOnFocus:ve=!n.freeSolo,size:ye=`medium`,slots:be={},slotProps:xe={},value:Se,...Ce}=n,{getRootProps:we,getInputProps:Te,getInputLabelProps:Ee,getPopupIndicatorProps:De,getClearProps:Oe,getItemProps:ke,getListboxProps:Ae,getOptionProps:je,value:Me,dirty:Ne,expanded:Pe,id:Fe,popupOpen:Ie,focused:Le,focusedItem:Re,anchorEl:ze,setAnchorEl:Be,inputValue:Ve,groupedOptions:He}=ode({...n,componentName:`Autocomplete`}),Ue=!g&&!v&&Ne&&!pe,We=(!E||T===!0)&&T!==!1,{onMouseDown:Ge}=Te(),{ref:Ke,...qe}=Ae(),Je=j||(e=>e.label??e),Ye={...n,disablePortal:x,expanded:Pe,focused:Le,fullWidth:D,getOptionLabel:Je,hasClearIcon:Ue,hasPopupIcon:We,inputFocused:Re===-1,popupOpen:Ie,size:ye},Xe=pde(Ye),Ze={slots:{paper:de,popper:fe,...be},slotProps:{chip:s,listbox:z,...m,...xe}},[Qe,$e]=Hm(`root`,{ref:t,className:[Xe.root,c],elementType:mde,externalForwardedProps:{...Ze,...Ce},getSlotProps:we,ownerState:Ye}),[et,tt]=Hm(`listbox`,{elementType:Sde,externalForwardedProps:Ze,ownerState:Ye,className:Xe.listbox,additionalProps:qe,ref:Ke}),[nt,rt]=Hm(`paper`,{elementType:Wm,externalForwardedProps:Ze,ownerState:Ye,className:Xe.paper}),[it,at]=Hm(`popper`,{elementType:ab,externalForwardedProps:Ze,ownerState:Ye,className:Xe.popper,additionalProps:{disablePortal:x,style:{width:ze?ze.clientWidth:null},role:`presentation`,anchorEl:ze,open:Ie}}),[ot,st]=Hm(`clearIndicator`,{elementType:gde,externalForwardedProps:Ze,ownerState:Ye,className:Xe.clearIndicator,shouldForwardComponentProp:!0,additionalProps:{...Oe(),"aria-label":f,title:f}}),[ct,lt]=Hm(`popupIndicator`,{elementType:_de,externalForwardedProps:Ze,ownerState:Ye,className:Xe.popupIndicator,shouldForwardComponentProp:!0,additionalProps:{...De(),disabled:v,"aria-label":Ie?p:ue,title:Ie?p:ue}}),ut,dt=e=>({className:Xe.tag,disabled:v,...ke(e)});if(V?Me.length>0&&(ut=ge?ge(Me,dt,Ye):_e?_e(Me,dt,Ye):Me.map((e,t)=>{let{key:n,...r}=dt({index:t});return(0,G.jsx)(Ev,{label:Je(e),size:ye,...r,...Ze.slotProps.chip},n)})):_e&&Me!=null&&(ut=_e(Me,dt,Ye)),R>-1&&Array.isArray(ut)){let e=ut.length-R;!Le&&e>0&&(ut=ut.splice(0,R),ut.push((0,G.jsx)(`span`,{className:Xe.tag,children:O(e)},ut.length)))}let ft=me||(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(Cde,{className:Xe.groupLabel,ownerState:Ye,component:`div`,children:e.group}),(0,G.jsx)(wde,{className:Xe.groupUl,ownerState:Ye,children:e.children})]},e.key)),pt=he||((e,t)=>{let{key:n,...r}=e;return(0,G.jsx)(`li`,{...r,children:Je(t)},n)}),mt=(e,t)=>{let n=je({option:e,index:t});return pt({...n,className:Xe.option},e,{selected:n[`aria-selected`],index:t,inputValue:Ve},Ye)};return(0,G.jsxs)(C.Fragment,{children:[(0,G.jsx)(Qe,{...$e,children:W({id:Fe,disabled:v,fullWidth:n.fullWidth??!0,size:ye===`small`?`small`:void 0,InputLabelProps:Ee(),InputProps:{ref:Be,className:Xe.inputRoot,startAdornment:ut,onMouseDown:e=>{e.target===e.currentTarget&&Ge(e)},...(Ue||We)&&{endAdornment:(0,G.jsxs)(hde,{className:Xe.endAdornment,ownerState:Ye,children:[Ue?(0,G.jsx)(ot,{...st,children:l}):null,We?(0,G.jsx)(ct,{...lt,children:U}):null]})}},inputProps:{className:Xe.input,disabled:v,readOnly:pe,...Te()}})}),ze?(0,G.jsx)(vde,{as:it,...at,children:(0,G.jsxs)(yde,{as:nt,...rt,children:[te&&He.length===0?(0,G.jsx)(bde,{className:Xe.loading,ownerState:Ye,children:B}):null,He.length===0&&!E&&!te?(0,G.jsx)(xde,{className:Xe.noOptions,ownerState:Ye,role:`presentation`,onMouseDown:e=>{e.preventDefault()},children:ne}):null,He.length>0?(0,G.jsx)(et,{as:ee,...tt,children:He.map((e,t)=>N?ft({key:e.key,group:e.group,children:e.options.map((t,n)=>mt(t,e.index+n))}):mt(e,t))}):null]})}):null]})});function Tde(e){return Jd(`MuiSwitch`,e)}var GS=Yd(`MuiSwitch`,[`root`,`edgeStart`,`edgeEnd`,`switchBase`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`,`checked`,`disabled`,`input`,`thumb`,`track`]),Ede=e=>{let{classes:t,edge:n,size:r,color:i,checked:a,disabled:o}=e,s=Cp({root:[`root`,n&&`edge${Y(n)}`,`size${Y(r)}`],switchBase:[`switchBase`,`color${Y(i)}`,a&&`checked`,o&&`disabled`],thumb:[`thumb`],track:[`track`],input:[`input`]},Tde,t);return{...t,...s}},Dde=J(`span`,{name:`MuiSwitch`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})({display:`inline-flex`,width:58,height:38,overflow:`hidden`,padding:12,boxSizing:`border-box`,position:`relative`,flexShrink:0,zIndex:0,verticalAlign:`middle`,"@media print":{colorAdjust:`exact`},variants:[{props:{edge:`start`},style:{marginLeft:-8}},{props:{edge:`end`},style:{marginRight:-8}},{props:{size:`small`},style:{width:40,height:24,padding:7,[`& .${GS.thumb}`]:{width:16,height:16},[`& .${GS.switchBase}`]:{padding:4,[`&.${GS.checked}`]:{transform:`translateX(16px)`}}}}]}),Ode=J(xv,{name:`MuiSwitch`,slot:`SwitchBase`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.switchBase,{[`& .${GS.input}`]:t.input},n.color!=="default"&&t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({position:`absolute`,top:0,left:0,zIndex:1,color:e.vars?e.vars.palette.Switch.defaultColor:`${e.palette.mode===`light`?e.palette.common.white:e.palette.grey[300]}`,transition:e.transitions.create([`left`,`transform`],{duration:e.transitions.duration.shortest}),[`&.${GS.checked}`]:{transform:`translateX(20px)`},[`&.${GS.disabled}`]:{color:e.vars?e.vars.palette.Switch.defaultDisabledColor:`${e.palette.mode===`light`?e.palette.grey[100]:e.palette.grey[600]}`},[`&.${GS.checked} + .${GS.track}`]:{opacity:.5},[`&.${GS.disabled} + .${GS.track}`]:{opacity:e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`},[`& .${GS.input}`]:{left:`-100%`,width:`300%`}})),Fm(({theme:e})=>({"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[...Object.entries(e.palette).filter(Um([`light`])).map(([t])=>({props:{color:t},style:{[`&.${GS.checked}`]:{color:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${GS.disabled}`]:{color:e.vars?e.vars.palette.Switch[`${t}DisabledColor`]:`${e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.55)}`}},[`&.${GS.checked} + .${GS.track}`]:{backgroundColor:(e.vars||e).palette[t].main}}}))]}))),kde=J(`span`,{name:`MuiSwitch`,slot:`Track`})(Fm(({theme:e})=>({height:`100%`,width:`100%`,borderRadius:14/2,boxSizing:`border-box`,border:`1px solid transparent`,zIndex:-1,transition:e.transitions.create([`opacity`,`background-color`],{duration:e.transitions.duration.shortest}),backgroundColor:e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,opacity:e.vars?e.vars.opacity.switchTrack:`${e.palette.mode===`light`?.38:.3}`}))),Ade=J(`span`,{name:`MuiSwitch`,slot:`Thumb`})(Fm(({theme:e})=>({boxShadow:(e.vars||e).shadows[1],backgroundColor:`currentColor`,boxSizing:`border-box`,border:`1px solid transparent`,width:20,height:20,borderRadius:`50%`}))),KS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiSwitch`}),{className:r,color:i=`primary`,edge:a=!1,size:o=`medium`,sx:s,slots:c={},slotProps:l={},...u}=n,d={...n,color:i,edge:a,size:o},f=Ede(d),p={slots:c,slotProps:l},[m,h]=Hm(`root`,{className:K(f.root,r),elementType:Dde,externalForwardedProps:p,ownerState:d,additionalProps:{sx:s}}),[g,_]=Hm(`thumb`,{className:f.thumb,elementType:Ade,externalForwardedProps:p,ownerState:d}),v=(0,G.jsx)(g,{..._}),[y,b]=Hm(`track`,{className:f.track,elementType:kde,externalForwardedProps:p,ownerState:d});return(0,G.jsxs)(m,{...h,children:[(0,G.jsx)(Ode,{type:`checkbox`,icon:v,checkedIcon:v,ref:t,ownerState:d,...u,classes:{...f,root:f.switchBase},slots:{...c.switchBase&&{root:c.switchBase},...c.input&&{input:c.input}},slotProps:{...l.switchBase&&{root:typeof l.switchBase==`function`?l.switchBase(d):l.switchBase},input:{role:`switch`},...l.input&&{input:typeof l.input==`function`?l.input(d):l.input}}}),(0,G.jsx)(y,{...b})]})}),qS=[{key:`apple`,label:`Apple Home`,short:`A`},{key:`google`,label:`Google Home`,short:`G`},{key:`alexa`,label:`Alexa`,short:`X`},{key:`aqara`,label:`Aqara Home`,short:`Q`}],jde={yes:`#2e7d32`,partial:`#ed6c02`,no:`#9e9e9e`,unknown:`#9e9e9e`},Mde={yes:`works`,partial:`partly works`,no:`not supported`,unknown:`unverified`};function JS({type:e}){let t=iv[e];return t?(0,G.jsx)(Z,{sx:{display:`inline-flex`,gap:.5,ml:1},children:qS.map(e=>{let n=t[e.key];return(0,G.jsx)(Z,{component:`span`,title:`${e.label}: ${Mde[n]}`,sx:{width:18,height:18,borderRadius:`50%`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontSize:11,fontWeight:600,color:`#fff`,bgcolor:jde[n],opacity:n===`yes`||n===`partial`?1:.45},children:e.short},e.key)})}):null}function YS(e){let t=iv[e];if(!t)return;let n=qS.filter(e=>t[e.key]===`no`).map(e=>e.label),r=[];return n.length===1?r.push(`${n[0]} does not support this type, so it may not show up there.`):n.length>1&&r.push(`${n.join(` and `)} do not support this type, so it may not show up there.`),t.note&&r.push(t.note),r.length>0?r.join(` `):void 0}function XS({value:e,onChange:t,label:n,placeholder:r,helperText:i,domain:a,fullWidth:o=!0,margin:s=`normal`}){let[c,l]=(0,C.useState)([]),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(e),m=(0,C.useRef)(void 0),h=(0,C.useRef)(e),g=(0,C.useCallback)(async e=>{d(!0);try{let t=new URLSearchParams({limit:`50`});a&&t.set(`domain`,a),e&&t.set(`search`,e);let n=await fetch(`api/home-assistant/entities?${t.toString()}`);n.ok&&l((await n.json()).entities??[])}catch{}finally{d(!1)}},[a]);(0,C.useEffect)(()=>{g(h.current)},[g]);let _=(0,C.useCallback)((e,n,r)=>{p(n),r===`input`&&t(n),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{g(n)},300)},[g,t]),v=(0,C.useCallback)((e,n)=>{t(n?typeof n==`string`?n:n.entity_id:``)},[t]);return(0,G.jsx)(WS,{freeSolo:!0,options:c,getOptionLabel:e=>typeof e==`string`?e:e.entity_id,renderOption:(e,t)=>{let{key:n,...r}=e;return(0,G.jsx)(`li`,{...r,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Q,{variant:`body2`,children:t.entity_id}),t.friendly_name&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:t.friendly_name})]})},n)},isOptionEqualToValue:(e,t)=>(typeof e==`string`?e:e.entity_id)===(typeof t==`string`?t:t.entity_id),value:e||null,inputValue:f,onInputChange:_,onChange:v,loading:u,filterOptions:e=>e,renderInput:e=>(0,G.jsx)(ES,{...e,label:n,placeholder:r,helperText:i,fullWidth:o,margin:s,slotProps:{input:{...e.InputProps,endAdornment:(0,G.jsxs)(G.Fragment,{children:[u?(0,G.jsx)(Rh,{color:`inherit`,size:18}):null,e.InputProps.endAdornment]})}}})})}function Nde(e){let t=e.trim();if(!t)return;let n=t.startsWith(`0x`)||t.startsWith(`0X`)?Number.parseInt(t.slice(2),16):Number(t);if(!(!Number.isInteger(n)||n<1||n>65534))return n}function ZS(e){let t=e.trim();if(!t)return{value:void 0,valid:!0};try{let e=JSON.parse(t);return e&&typeof e==`object`&&!Array.isArray(e)?{value:e,valid:!0}:{valid:!1}}catch{return{valid:!1}}}function Pde(e){let t=e.trim();if(!t)return;let n=Number(t);if(!(!Number.isFinite(n)||n<=0))return Math.min(5e3,Math.round(n))}function Fde(e){let t=e.trim();if(!t)return;let n=Number(t);if(!(!Number.isFinite(n)||n<=0))return Math.min(6e4,Math.round(n))}function QS({open:e,entityId:t,domain:n,currentMapping:r,onSave:i,onClose:a}){let{t:o}=ws(),[s,c]=(0,C.useState)(t),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(!1),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(``),[M,N]=(0,C.useState)(``),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)([]),[R,ee]=(0,C.useState)(!1),[z,te]=(0,C.useState)(``),[B,V]=(0,C.useState)(``),[ne,re]=(0,C.useState)(``),[ie,ae]=(0,C.useState)(``),[oe,se]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,H]=(0,C.useState)(``),[de,fe]=(0,C.useState)(!1),[U,pe]=(0,C.useState)([]),[me,W]=(0,C.useState)([]),[he,ge]=(0,C.useState)(``),[_e,ve]=(0,C.useState)(!1),[ye,be]=(0,C.useState)(!1),[xe,Se]=(0,C.useState)(``),[Ce,we]=(0,C.useState)(``),[Te,Ee]=(0,C.useState)(!1),[De,Oe]=(0,C.useState)(!1),[ke,Ae]=(0,C.useState)(!1),[je,Me]=(0,C.useState)(!1),[Ne,Pe]=(0,C.useState)(!1),[Fe,Ie]=(0,C.useState)(``),Le=(0,C.useRef)(0),[Re,ze]=(0,C.useState)([]),[Be,Ve]=(0,C.useState)([]),[He,Ue]=(0,C.useState)(!1),We=!t,[Ge,Ke]=(0,C.useState)([]),[qe,Je]=(0,C.useState)(``),[Ye,Xe]=(0,C.useState)(``),Ze=(0,C.useMemo)(()=>Object.entries(av).filter(([e,t])=>typeof t==`number`&&t!==av.Vacuum&&t!==av.Mop&&t!==av.VacuumThenMop).map(([e,t])=>({label:e,value:t})),[]);(0,C.useEffect)(()=>{e&&(c(t),u(r?.matterDeviceType||``),f(r?.customName||``),m(r?.customProductName||``),g(r?.customVendorName||``),v(r?.customSerialNumber||``),b(r?.customVendorId===void 0?``:`0x${r.customVendorId.toString(16).toUpperCase()}`),S(r?.disabled||!1),T(r?.filterLifeEntity||``),D(r?.cleaningModeEntity||``),k(r?.temperatureEntity||``),j(r?.humidityEntity||``),N(r?.pressureEntity||``),F(r?.batteryEntity||``),L(r?.roomEntities||[]),ee(r?.disableLockPin||!1),te(r?.powerEntity||``),V(r?.energyEntity||``),re(r?.suctionLevelEntity||``),ae(r?.mopIntensityEntity||``),se(r?.currentRoomEntity||``),le(r?.chargingStateEntity||``),H(r?.cleanedAreaEntity||``),fe(r?.disableCustomAreaRoomModes||!1),pe(r?.customServiceAreas||[]),W((r?.customServiceAreas||[]).map(e=>e.data?JSON.stringify(e.data):``)),ge(r?.valetudoIdentifier||``),ve(r?.coverSwapOpenClose||!1),be(r?.coverExposeAsDimmableLight||!1),Se(r?.coverSliderDebounceMs==null?``:String(r.coverSliderDebounceMs)),we(r?.updateThrottleMs==null?``:String(r.updateThrottleMs)),Ee(r?.disableClimateOnOff||!1),Oe(r?.disableClimateFanControl||!1),Ae(r?.climateKeepModeOnIdle||!1),Me(r?.climateExposeFan||!1),Pe(r?.fanRestoreSpeedOnPowerOn||!1),Ie(r?.climateAutoMode||``),Le.current=0,ze((r?.composedEntities||[]).map(e=>({...e,_key:Le.current++}))),Ve([]),Ke(Object.entries(r?.customFanSpeedTags||{}).map(([e,t])=>({option:e,tag:t}))),Je((r?.fanWindPresets?.natural||[]).join(`, `)),Xe((r?.fanWindPresets?.sleep||[]).join(`, `)))},[e,t,r]),(0,C.useEffect)(()=>{!e||!t||n!==`vacuum`||(async()=>{Ue(!0);try{let e=await fetch(`api/home-assistant/related-buttons/${encodeURIComponent(t)}`);e.ok&&Ve((await e.json()).buttons||[])}catch(e){console.error(`Failed to load related buttons:`,e)}finally{Ue(!1)}})()},[e,t,n]);let Qe=s.split(`.`)[0]||n,$e=(0,C.useCallback)(()=>{if(!s.trim())return;let e=Ge.reduce((e,t)=>(t.option.trim()&&(e[t.option.trim()]=t.tag),e),{}),t=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),n=t(qe),r=t(Ye),a=n.length>0||r.length>0?{natural:n.length>0?n:void 0,sleep:r.length>0?r:void 0}:void 0;i({entityId:s.trim(),matterDeviceType:l||void 0,customName:d.trim()||void 0,customProductName:p.trim()||void 0,customVendorName:h.trim()||void 0,customSerialNumber:_.trim()||void 0,customVendorId:Nde(y),disabled:x,filterLifeEntity:w.trim()||void 0,cleaningModeEntity:E.trim()||void 0,temperatureEntity:O.trim()||void 0,humidityEntity:A.trim()||void 0,pressureEntity:M.trim()||void 0,batteryEntity:P.trim()||void 0,roomEntities:I.length>0?I:void 0,customServiceAreas:U.length>0?U:void 0,disableLockPin:R||void 0,powerEntity:z.trim()||void 0,energyEntity:B.trim()||void 0,suctionLevelEntity:ne.trim()||void 0,mopIntensityEntity:ie.trim()||void 0,currentRoomEntity:oe.trim()||void 0,chargingStateEntity:ce.trim()||void 0,cleanedAreaEntity:ue.trim()||void 0,disableCustomAreaRoomModes:de||void 0,customFanSpeedTags:Object.keys(e).length>0?e:void 0,fanWindPresets:a,valetudoIdentifier:he.trim()||void 0,coverSwapOpenClose:_e||void 0,coverExposeAsDimmableLight:ye||void 0,coverSliderDebounceMs:Pde(xe),updateThrottleMs:Fde(Ce),disableClimateOnOff:Te||void 0,disableClimateFanControl:De||void 0,climateKeepModeOnIdle:ke||void 0,climateExposeFan:je||void 0,fanRestoreSpeedOnPowerOn:Ne||void 0,climateAutoMode:Fe||void 0,composedEntities:Re.filter(e=>e.entityId?.trim()).length>0?Re.filter(e=>e.entityId?.trim()).map(({_key:e,...t})=>t):void 0})},[s,l,d,p,h,_,y,x,w,E,O,A,M,P,I,R,z,B,ne,ie,oe,ce,ue,de,U,Ge,qe,Ye,he,_e,ye,xe,Ce,Te,De,ke,je,Ne,Fe,Re,i]),et=l===`air_purifier`||Qe===`fan`&&!l,tt=Qe===`fan`&&(!l||l===`fan`),nt=Qe===`vacuum`,rt=Qe===`vacuum`&&s.startsWith(`vacuum.valetudo_`),it=Qe===`vacuum`,at=l===`temperature_sensor`||Qe===`sensor`&&!l,ot=l===`air_purifier`,st=l===`window_covering`||Qe===`cover`,ct=l===`door_lock`||Qe===`lock`,lt=l===`thermostat`||Qe===`climate`,ut=l!==`on_off_switch`&&(Qe===`switch`||Qe===`light`||l===`on_off_plugin_unit`||l===`dimmable_plugin_unit`),dt=Object.entries(rv),ft=uie[Qe]||[];return(0,G.jsxs)(Rb,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:We?o(`mapping.addMapping`):`${o(`common.edit`)}: ${t}`}),(0,G.jsxs)(Bb,{children:[We&&(0,G.jsx)(XS,{value:s,onChange:c,label:`Entity ID`,placeholder:`light.living_room`,helperText:`Search or enter the Home Assistant entity ID (e.g., light.living_room)`}),(0,G.jsxs)(kv,{fullWidth:!0,margin:`normal`,children:[(0,G.jsx)(Bx,{id:`matter-device-type-label`,children:`Matter Device Type`}),(0,G.jsxs)(SS,{labelId:`matter-device-type-label`,value:l,label:`Matter Device Type`,onChange:e=>u(e.target.value),renderValue:e=>e?rv[e]:(0,G.jsx)(`em`,{children:o(`mapping.autoDetect`)}),children:[(0,G.jsx)(CS,{value:``,children:(0,G.jsx)(`em`,{children:o(`mapping.autoDetect`)})}),ft.length>0&&(0,G.jsxs)(CS,{disabled:!0,children:[`Suggested for `,n]}),ft.map(e=>(0,G.jsxs)(CS,{value:e,children:[rv[e],(0,G.jsx)(JS,{type:e})]},e)),ft.length>0&&(0,G.jsx)(CS,{disabled:!0,children:`All types`}),dt.filter(([e])=>!ft.includes(e)).map(([e,t])=>(0,G.jsxs)(CS,{value:e,children:[t,(0,G.jsx)(JS,{type:e})]},e))]})]}),l!==``&&YS(l)&&(0,G.jsx)(Uh,{severity:`info`,sx:{mt:1},children:YS(l)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:`Custom Name`,placeholder:t,value:d,onChange:e=>f(e.target.value),helperText:`Override the entity name shown in Matter controllers`}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customProductName`),value:p,onChange:e=>m(e.target.value),helperText:o(`mapping.customProductNameHelp`)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customVendorName`),value:h,onChange:e=>g(e.target.value),helperText:o(`mapping.customVendorNameHelp`)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customSerialNumber`),value:_,onChange:e=>v(e.target.value),helperText:o(`mapping.customSerialNumberHelp`)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customVendorId`),placeholder:`0x115F`,value:y,onChange:e=>b(e.target.value),helperText:o(`mapping.customVendorIdHelp`)}),et&&(0,G.jsx)(XS,{value:w,onChange:T,label:`Filter Life Sensor (optional)`,placeholder:`sensor.air_purifier_filter_life`,helperText:`Sensor entity that provides filter life percentage (0-100%) for HEPA filter monitoring`,domain:`sensor`}),tt&&(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Wind Preset Mapping (optional)`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Map localized preset names to Matter wind modes. Comma-separated HA preset names, e.g. 自然风 for natural wind.`}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,size:`small`,label:`Natural Wind Presets`,placeholder:`自然风, Natural`,value:qe,onChange:e=>Je(e.target.value)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,size:`small`,label:`Sleep Wind Presets`,placeholder:`睡眠风, Sleep`,value:Ye,onChange:e=>Xe(e.target.value)})]}),Qe===`fan`&&(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:Ne,onChange:e=>Pe(e.target.checked)}),label:`Restore the last fan speed when turned on, ignoring a controller's injected value (Apple Home power button). While on, you cannot turn on at full speed from off.`,sx:{mt:1,display:`block`}}),nt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:E,onChange:D,label:`Cleaning Mode Entity (optional)`,placeholder:`select.vacuum_cleaning_mode`,helperText:`Select entity that controls the vacuum cleaning mode (e.g., select.r2_d2_cleaning_mode for Dreame vacuums)`,domain:`select`}),(0,G.jsx)(XS,{value:ne,onChange:re,label:`Suction Level Entity (optional)`,placeholder:`select.vacuum_suction_level`,helperText:`Select entity that controls suction level. Adds Quiet/Max intensity options to Apple Home's extra features panel.`,domain:`select`}),(0,G.jsx)(XS,{value:ie,onChange:ae,label:`Mop Intensity Entity (optional)`,placeholder:`select.vacuum_mop_pad_humidity`,helperText:`Select entity that controls mop water level / intensity. Adds intensity options when mopping in Apple Home.`,domain:`select`}),(0,G.jsx)(XS,{value:oe,onChange:se,label:`Current Room Entity (optional)`,placeholder:`sensor.vacuum_current_room`,helperText:`Sensor that reports which room the vacuum is currently in (e.g. Dreame current_room sensor). Enables dynamic room progress tracking during multi-room cleaning.`,domain:`sensor`}),(0,G.jsx)(XS,{value:ce,onChange:le,label:`Charging State Entity (optional)`,placeholder:`sensor.vacuum_charging_state`,helperText:`Sensor reporting the charging state (e.g. Xiaomi charging_state: charging / not_charging / full). Drives the Matter charge state directly instead of inferring it from docked + battery level.`,domain:`sensor`}),(0,G.jsx)(XS,{value:ue,onChange:H,label:`Cleaned Area Sensor (m², optional)`,placeholder:`sensor.vacuum_cleaned_area`,helperText:`Sensor reporting cumulative cleaned area in m². With a Size (m²) set on each area, advances room progress for batch vacuums that report area but not the current room.`,domain:`sensor`}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:de,onChange:e=>fe(e.target.checked)}),label:`Don't expose custom areas as per-room cleaning modes (forces Apple Home to use the multi-room area picker). Keep off for Google Home / Alexa, which rely on the modes.`,sx:{mt:1,display:`block`}}),rt&&(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:`Valetudo MQTT Identifier (optional)`,placeholder:`GentleFinishedSpider`,value:he,onChange:e=>ge(e.target.value),helperText:`Exact identifier from Valetudo Connectivity → MQTT. Only needed if it differs from the lowercase entity ID.`}),(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Custom Tag Mapping`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Map home assistant speeds to matter tags. When configured these will override default speeds.`}),Ge.map((e,t)=>(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,mb:1,alignItems:`flex-start`},children:[(0,G.jsx)(ES,{size:`small`,label:`HA Option (e.g. Max+)`,value:e.option,onChange:n=>{let r=[...Ge];r[t]={...e,option:n.target.value},Ke(r)}}),(0,G.jsxs)(kv,{size:`small`,sx:{flex:1},children:[(0,G.jsx)(Bx,{children:`Matter Tag`}),(0,G.jsx)(SS,{value:e.tag,label:`Matter Tag`,onChange:n=>{let r=[...Ge];r[t]={...e,tag:n.target.value},Ke(r)},children:Ze.map(e=>(0,G.jsx)(CS,{value:e.value,children:e.label},e.value))})]}),(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>{Ke(Ge.filter((e,n)=>n!==t))},children:(0,G.jsx)(LS,{fontSize:`small`})})]},`${e.option}-${e.tag}`)),(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(IS,{}),onClick:()=>Ke([...Ge,{option:``,tag:av.Auto}]),children:`Add Tag Mapping`})]})]}),it&&U.length===0&&(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Room Button Entities (Roborock)`}),(0,G.jsx)(WS,{multiple:!0,options:Be,getOptionLabel:e=>typeof e==`string`?e:e.friendly_name||e.clean_name,value:Be.filter(e=>I.includes(e.entity_id)),onChange:(e,t)=>{L(t.map(e=>typeof e==`string`?e:e.entity_id))},loading:He,freeSolo:!0,renderTags:(e,t)=>e.map((e,n)=>(0,C.createElement)(Ev,{label:typeof e==`string`?e:e.friendly_name||e.clean_name,size:`small`,...t({index:n}),key:typeof e==`string`?e:e.entity_id})),renderInput:e=>(0,G.jsx)(ES,{...e,variant:`outlined`,placeholder:He?`Loading buttons...`:`Select room buttons or type entity ID`,helperText:`Select button entities that trigger room cleaning (e.g., button.roborock_clean_kitchen). These appear as rooms in Apple Home.`,InputProps:{...e.InputProps,endAdornment:(0,G.jsxs)(G.Fragment,{children:[He?(0,G.jsx)(Rh,{color:`inherit`,size:20}):null,e.InputProps.endAdornment]})}})}),Be.length===0&&!He&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:`No button entities found for this device. You can manually enter entity IDs.`})]}),at&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:A,onChange:j,label:`Humidity Sensor (optional)`,placeholder:`sensor.h_t_bad_humidity`,helperText:`Combine with a humidity sensor to create a single Temperature+Humidity device`,domain:`sensor`}),(0,G.jsx)(XS,{value:M,onChange:N,label:`Pressure Sensor (optional)`,placeholder:`sensor.h_t_bad_pressure`,helperText:`Combine with a pressure sensor to create a single Temperature+Pressure device`,domain:`sensor`}),(0,G.jsx)(XS,{value:P,onChange:F,label:`Battery Sensor (optional)`,placeholder:`sensor.h_t_bad_battery`,helperText:`Include battery level from a separate sensor entity`,domain:`sensor`})]}),ot&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:O,onChange:k,label:`Temperature Sensor (optional)`,placeholder:`sensor.air_purifier_temperature`,helperText:`Add temperature measurement to this air purifier from a separate sensor entity`,domain:`sensor`}),(0,G.jsx)(XS,{value:A,onChange:j,label:`Humidity Sensor (optional)`,placeholder:`sensor.air_purifier_humidity`,helperText:`Add humidity measurement to this air purifier from a separate sensor entity`,domain:`sensor`})]}),ut&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:z,onChange:te,label:`Power Sensor (optional)`,placeholder:`sensor.smart_plug_power`,helperText:`Sensor with device_class: power (W), adds real-time power measurement to this device`,domain:`sensor`}),(0,G.jsx)(XS,{value:B,onChange:V,label:`Energy Sensor (optional)`,placeholder:`sensor.smart_plug_energy`,helperText:`Sensor with device_class: energy (kWh), adds cumulative energy measurement to this device`,domain:`sensor`})]}),it&&(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Custom Service Areas`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Define custom zones mapped to HA service calls. Works for lawn mowers, pool cleaners, or any zone-based robot. When configured, these replace auto-detected rooms. Data is extra JSON sent with the call. Batch fires one combined call for all selected zones instead of one per zone.`}),U.map((e,t)=>{let n=ZS(me[t]??``).valid;return(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:1,mb:2},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,alignItems:`flex-start`},children:[(0,G.jsx)(ES,{size:`small`,label:`Name`,value:e.name,onChange:n=>{let r=[...U];r[t]={...e,name:n.target.value},pe(r)},sx:{flex:1}}),(0,G.jsx)(ES,{size:`small`,label:`Service`,placeholder:`script.start_zone`,value:e.service,onChange:n=>{let r=[...U];r[t]={...e,service:n.target.value},pe(r)},sx:{flex:1}}),(0,G.jsx)(ES,{size:`small`,label:`Target (optional)`,placeholder:`button.zone_1`,value:e.target||``,onChange:n=>{let r=[...U];r[t]={...e,target:n.target.value||void 0},pe(r)},sx:{flex:1}}),(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>{pe(U.filter((e,n)=>n!==t)),W(me.filter((e,n)=>n!==t))},children:(0,G.jsx)(LS,{fontSize:`small`})})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,alignItems:`center`},children:[(0,G.jsx)(ES,{size:`small`,label:`Data (JSON, optional)`,placeholder:`{"segments": [16, 17]}`,value:me[t]??``,error:!n,helperText:n?void 0:`Invalid JSON object`,onChange:n=>{let r=n.target.value,i=[...me];i[t]=r,W(i);let{value:a,valid:o}=ZS(r);if(!o)return;let{data:s,...c}=e,l=[...U];l[t]=a===void 0?c:{...c,data:a},pe(l)},sx:{flex:2}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{size:`small`,checked:e.batchDispatch??!1,onChange:n=>{let r=[...U];r[t]={...e,batchDispatch:n.target.checked||void 0},pe(r)}}),label:`Batch`}),(0,G.jsx)(ES,{size:`small`,type:`number`,label:`Size (m²)`,placeholder:`20`,value:e.sizeSqm==null?``:String(e.sizeSqm),onChange:n=>{let r=Number.parseFloat(n.target.value),i=[...U];i[t]={...e,sizeSqm:Number.isFinite(r)&&r>0?r:void 0},pe(i)},sx:{width:110}})]})]},`area-${e.name||t}`)}),(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(IS,{}),onClick:()=>{pe([...U,{name:``,service:``}]),W([...me,``])},children:`Add Area`})]}),st&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:_e,onChange:e=>ve(e.target.checked)}),label:`Swap open/close commands (for awnings and similar covers)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:ye,onChange:e=>be(e.target.checked)}),label:`Expose as a dimmable light (Alexa workaround: level = open %, on/off = open/close). Keep off for Apple / Google.`,sx:{mt:1,display:`block`}}),(0,G.jsx)(ES,{label:`Slider debounce (ms)`,type:`number`,size:`small`,value:xe,onChange:e=>Se(e.target.value),helperText:`Override for slow blinds. 0 / empty uses bridge setting (default 400/150ms two-phase). Try 800-1500 for sluggish covers. Max 5000.`,slotProps:{htmlInput:{min:0,max:5e3,step:50}},sx:{mt:1,display:`block`}})]}),ct&&(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:R,onChange:e=>ee(e.target.checked)}),label:`Disable PIN requirement for this lock`,sx:{mt:1,display:`block`}}),lt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:Te,onChange:e=>Ee(e.target.checked)}),label:`Disable on/off for this climate entity (keeps the thermostat running when a room is turned off by voice)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:De,onChange:e=>Oe(e.target.checked)}),label:`Expose as plain Thermostat (drop FanControl), workaround for controllers like Aqara that don't recognise the air conditioner device type. Needs a full HAMH restart, then re-pair the bridge in the controller (Aqara caches the device list)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:ke,onChange:e=>Ae(e.target.checked)}),label:`Keep last mode on Matter while off + idle (workaround for ACs that report off + hvac_action=idle during internal cleaning, so the controller's Off button stays actionable)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:je,onChange:e=>Me(e.target.checked)}),label:`Expose a companion Fan device (adds a separate Apple Home fan tile for fan_only mode and speed, only for ACs with a fan mode, and re-pairs this AC once)`,sx:{mt:1,display:`block`}}),(0,G.jsxs)(kv,{size:`small`,sx:{mt:1,minWidth:260},children:[(0,G.jsx)(Bx,{id:`climate-auto-mode-label`,children:`Auto mode direction`}),(0,G.jsxs)(SS,{labelId:`climate-auto-mode-label`,value:Fe,label:`Auto mode direction`,onChange:e=>Ie(e.target.value||``),children:[(0,G.jsx)(CS,{value:``,children:(0,G.jsx)(`em`,{children:`Auto-detect`})}),(0,G.jsx)(CS,{value:`cool`,children:`Cool`}),(0,G.jsx)(CS,{value:`heat`,children:`Heat`})]})]})]}),(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Composed Sub-Entities`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Group additional HA entities into this device. Each entity becomes a sub-endpoint under a shared Matter device. Requires the autoComposedDevices feature flag.`}),Re.map((e,t)=>(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,mb:1,alignItems:`flex-start`},children:[(0,G.jsx)(Z,{sx:{flex:2},children:(0,G.jsx)(XS,{value:e.entityId,onChange:n=>{let r=[...Re];r[t]={...e,entityId:n},ze(r)},label:`Entity ID`,placeholder:`sensor.temperature`})}),(0,G.jsxs)(kv,{size:`small`,sx:{flex:1,mt:1},children:[(0,G.jsx)(Bx,{children:`Device Type`}),(0,G.jsxs)(SS,{value:e.matterDeviceType||``,label:`Device Type`,onChange:n=>{let r=[...Re];r[t]={...e,matterDeviceType:n.target.value||void 0},ze(r)},children:[(0,G.jsx)(CS,{value:``,children:(0,G.jsx)(`em`,{children:`Auto-detect`})}),Object.entries(rv).map(([e,t])=>(0,G.jsx)(CS,{value:e,children:t},e))]})]}),(0,G.jsx)(Bh,{size:`small`,color:`error`,sx:{mt:1.5},onClick:()=>{ze(Re.filter((e,n)=>n!==t))},children:(0,G.jsx)(LS,{fontSize:`small`})})]},e._key)),(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(IS,{}),onClick:()=>ze([...Re,{entityId:``,_key:Le.current++}]),children:`Add Sub-Entity`})]}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:x,onChange:e=>S(e.target.checked)}),label:`Disable this entity (exclude from bridge)`}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:`Update throttle (ms, optional)`,type:`number`,value:Ce,onChange:e=>we(e.target.value),helperText:`Limit Matter updates for chatty sensors (power, energy) to one per N ms. Empty / 0 keeps the default. Max 60000.`,slotProps:{htmlInput:{min:0,max:6e4,step:100}}})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:a,children:o(`common.cancel`)}),(0,G.jsx)(mv,{onClick:$e,variant:`contained`,disabled:!s.trim(),children:o(`common.save`)})]})]})}var Ide=X([(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3.2`},`0`),(0,G.jsx)(`path`,{d:`M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5`},`1`)],`CameraAlt`),$S=X((0,G.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`}),`ExpandMore`),Lde=e=>{let t=e.toLowerCase();return t.includes(`light`)?`💡`:t.includes(`switch`)||t.includes(`plugin`)?`🔌`:t.includes(`lock`)?`🔒`:t.includes(`thermostat`)||t.includes(`temperature`)?`🌡️`:t.includes(`humidity`)?`💧`:t.includes(`pressure`)||t.includes(`sensor`)?`📊`:t.includes(`fan`)?`🌀`:t.includes(`cover`)||t.includes(`window`)?`🪟`:t.includes(`contact`)?`🚪`:t.includes(`occupancy`)?`👤`:t.includes(`smoke`)||t.includes(`alarm`)?`🚨`:t.includes(`water`)?`💧`:t.includes(`air`)?`🌬️`:`📱`},eC=(e,t)=>{let n=e.toLowerCase();return t?n.includes(`light`)?`#FFE082`:n.includes(`switch`)||n.includes(`plugin`)?`#81C784`:n.includes(`lock`)?`#64B5F6`:n.includes(`thermostat`)||n.includes(`temperature`)?`#FF8A65`:n.includes(`humidity`)?`#4FC3F7`:n.includes(`sensor`)?`#CE93D8`:n.includes(`fan`)?`#4DD0E1`:n.includes(`cover`)||n.includes(`window`)?`#A1887F`:n.includes(`contact`)?`#90A4AE`:n.includes(`occupancy`)?`#F48FB1`:`#BDBDBD`:n.includes(`light`)?`#F9A825`:n.includes(`switch`)||n.includes(`plugin`)?`#388E3C`:n.includes(`lock`)?`#1976D2`:n.includes(`thermostat`)||n.includes(`temperature`)?`#E64A19`:n.includes(`humidity`)?`#0288D1`:n.includes(`sensor`)?`#7B1FA2`:n.includes(`fan`)?`#00838F`:n.includes(`cover`)||n.includes(`window`)?`#5D4037`:n.includes(`contact`)?`#455A64`:n.includes(`occupancy`)?`#C2185B`:`#616161`},Rde=e=>{if(e==null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return String(e);if(typeof e==`string`)return e.length>80?`${e.slice(0,80)}…`:e;if(Array.isArray(e))return e.length===0?`[]`:`[${e.length} items]`;if(typeof e==`object`){let t=Object.keys(e);return t.length===0?`{}`:`{${t.length} keys}`}return String(e)},tC=({endpoint:e,bridgeName:t,bridgeId:n,onClick:r,onEditMapping:i,imageInfo:a,onImageChanged:o})=>{let{t:s}=ws(),c=wm().palette.mode===`dark`,l=Ax(e.state)??e.id.local,u=e.type.name,d=(0,C.useMemo)(()=>e.state.bridgedDeviceBasicInformation,[e.state])?.reachable??!0,f=(0,C.useMemo)(()=>e.state.homeAssistantEntity,[e.state]),p=f?.entity?.entity_id,m=f?.entity?.state?.state,h=m===`unavailable`||m===`unknown`,g=f?.mapping,_=(0,C.useMemo)(()=>{let e=[];return g?.batteryEntity&&e.push({label:`Battery`,entity:g.batteryEntity}),g?.humidityEntity&&e.push({label:`Humidity`,entity:g.humidityEntity}),g?.pressureEntity&&e.push({label:`Pressure`,entity:g.pressureEntity}),g?.powerEntity&&e.push({label:`Power`,entity:g.powerEntity}),g?.energyEntity&&e.push({label:`Energy`,entity:g.energyEntity}),e},[g]),v=(0,C.useMemo)(()=>{let e=new Set;return g?.batteryEntity&&e.add(`powerSource`),g?.humidityEntity&&e.add(`relativeHumidityMeasurement`),g?.pressureEntity&&e.add(`pressureMeasurement`),g?.powerEntity&&e.add(`electricalPowerMeasurement`),g?.energyEntity&&e.add(`electricalEnergyMeasurement`),e},[g]),y=(0,C.useMemo)(()=>e.state.powerSource,[e.state]),b=(0,C.useMemo)(()=>y?.batPercentRemaining==null?null:Math.round(y.batPercentRemaining/2),[y]),x=y?.batChargeState===1||y?.batChargeState===2,[S,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(0),k=(0,C.useRef)(null),A=a&&a.source!==`none`&&!T,j=(0,C.useMemo)(()=>{if(!(!a||a.source===`none`)){if(a.source===`custom`&&p)return`${$ue(p)}?v=${D}`;if(a.source===`z2m`&&a.z2mUrl)return a.z2mUrl}},[a,p,D]),M=(0,C.useCallback)(e=>{e.stopPropagation(),k.current?.click()},[]),N=(0,C.useCallback)(async e=>{let t=e.target.files?.[0];if(!(!t||!p)){try{await Zue(p,t),E(!1),O(e=>e+1),o?.()}catch(e){console.error(`Failed to upload device image:`,e)}k.current&&(k.current.value=``)}},[p,o]),P=(0,C.useCallback)(async e=>{if(e.stopPropagation(),p)try{await Que(p),E(!1),O(e=>e+1),o?.()}catch(e){console.error(`Failed to delete device image:`,e)}},[p,o]),F=(0,C.useMemo)(()=>Object.keys(e.state).filter(e=>![`homeAssistantEntity`,`bridgedDeviceBasicInformation`,`identify`].includes(e)),[e.state]),I=(0,C.useMemo)(()=>{let t=e.state,n=[],r=t.onOff,i=t.levelControl,a=t.thermostat,o=t.colorControl,s=t.fanControl,c=t.temperatureMeasurement,l=t.relativeHumidityMeasurement,u=t.pressureMeasurement,d=t.illuminanceMeasurement,f=t.carbonDioxideConcentrationMeasurement,p=t.pm25ConcentrationMeasurement,m=t.totalVolatileOrganicCompoundsConcentrationMeasurement,h=t.windowCovering,g=t.doorLock,_=t.booleanState;if(r?.onOff!==void 0&&n.push({label:r.onOff?`On`:`Off`,color:r.onOff?`success`:`default`}),i?.currentLevel!==void 0){let e=Math.round(i.currentLevel/254*100);n.push({label:`${e}%`})}if(o?.colorTemperatureMireds!=null&&o.colorTemperatureMireds>0){let e=Math.round(1e6/o.colorTemperatureMireds);n.push({label:`${e}K`})}if(a?.localTemperature!=null){let e=a.localTemperature/100;n.push({label:`${e.toFixed(1)}°C`})}if(a?.systemMode!==void 0){let e={0:`Off`,1:`Auto`,3:`Cool`,4:`Heat`,7:`Fan`,8:`Dry`}[a.systemMode];e&&n.push({label:e,color:a.systemMode===0?`default`:`info`})}if(c?.measuredValue!=null){let e=c.measuredValue/100;n.push({label:`${e.toFixed(1)}°C`})}if(l?.measuredValue!=null){let e=l.measuredValue/100;n.push({label:`${e.toFixed(0)}% RH`})}if(u?.measuredValue!=null&&n.push({label:`${u.measuredValue} hPa`}),d?.measuredValue!=null&&d.measuredValue>0){let e=Math.round(10**((d.measuredValue-1)/1e4));n.push({label:`${e} lx`})}if(f?.measuredValue!=null&&n.push({label:`${Math.round(f.measuredValue)} ppm CO2`}),p?.measuredValue!=null&&n.push({label:`PM2.5: ${Math.round(p.measuredValue)}`}),m?.measuredValue!=null&&n.push({label:`TVOC: ${Math.round(m.measuredValue)}`}),s?.percentCurrent!=null&&s.percentCurrent>0&&n.push({label:`Fan ${s.percentCurrent}%`}),h?.currentPositionLiftPercent100ths!=null){let e=Math.round(h.currentPositionLiftPercent100ths/100);n.push({label:`${e}% open`})}if(g?.lockState!==void 0){let e=g.lockState===1;n.push({label:e?`Locked`:`Unlocked`,color:e?`success`:`warning`})}return _?.stateValue!==void 0&&r?.onOff===void 0&&n.push({label:_.stateValue?`Closed`:`Open`,color:_.stateValue?`success`:`warning`}),n},[e.state]);return(0,G.jsx)(hv,{onClick:r,sx:{height:`100%`,cursor:r?`pointer`:`default`,transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,opacity:d?1:.6,"&:hover":r?{transform:`translateY(-4px)`,boxShadow:4}:{}},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:2,mb:2},children:[(0,G.jsx)(Z,{sx:{fontSize:36,display:`flex`,alignItems:`center`,justifyContent:`center`,width:56,height:56,borderRadius:2,backgroundColor:`${eC(u,c)}20`,overflow:`hidden`,flexShrink:0},children:A&&j?(0,G.jsx)(Z,{component:`img`,src:j,alt:l,onError:()=>E(!0),sx:{width:`100%`,height:`100%`,objectFit:`cover`}}):Lde(u)}),(0,G.jsxs)(Z,{sx:{flexGrow:1,minWidth:0},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(Q,{variant:`h6`,noWrap:!0,sx:{flexGrow:1},children:l}),p&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`input`,{type:`file`,ref:k,onChange:N,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml`,style:{display:`none`}}),(0,G.jsx)(db,{title:s(`endpoints.uploadImage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:M,sx:{ml:.5},"aria-label":`Upload image for ${l}`,children:(0,G.jsx)(Ide,{fontSize:`small`})})}),a?.source===`custom`&&(0,G.jsx)(db,{title:s(`endpoints.removeImage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:P,sx:{ml:-.5},"aria-label":`Remove image for ${l}`,children:(0,G.jsx)(LS,{fontSize:`small`})})})]}),i&&p&&n&&(0,G.jsx)(db,{title:s(`endpoints.editMapping`),children:(0,G.jsx)(Bh,{size:`small`,onClick:e=>{e.stopPropagation(),i(p,n)},sx:{ml:.5},"aria-label":`Edit mapping for ${l}`,children:(0,G.jsx)(hb,{fontSize:`small`})})}),h?(0,G.jsx)(db,{title:`HA State: ${m}`,children:(0,G.jsx)(Sb,{color:`warning`,fontSize:`small`})}):(0,G.jsx)(db,{title:s(d?`common.online`:`common.offline`),children:d?(0,G.jsx)(lv,{color:`success`,fontSize:`small`}):(0,G.jsx)(Cx,{color:`error`,fontSize:`small`})})]}),p&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontFamily:`monospace`,noWrap:!0,children:p}),t&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,noWrap:!0,children:t}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,sx:{mt:1,flexWrap:`wrap`,gap:.5},children:[(0,G.jsx)(db,{title:`Device Type ID: ${e.type.id}`,children:(0,G.jsx)(Ev,{label:`${u} (${e.type.id})`,size:`small`,sx:{backgroundColor:`${eC(u,c)}20`,color:eC(u,c),fontWeight:500}})}),I.map(e=>(0,G.jsx)(Ev,{label:e.label,size:`small`,variant:`outlined`,color:e.color??`default`},e.label))]})]})]}),(b!=null||_.length>0)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ub,{sx:{my:1}}),(0,G.jsxs)(Hv,{direction:`row`,spacing:1,alignItems:`center`,sx:{flexWrap:`wrap`,gap:.5,mb:1},children:[b!=null&&(0,G.jsx)(Ev,{icon:x?(0,G.jsx)(Ex,{}):b<=20?(0,G.jsx)(Tx,{}):(0,G.jsx)(Dx,{}),label:`${b}%`,size:`small`,color:x?`info`:b<=10?`error`:b<=20?`warning`:`success`,variant:`outlined`}),_.map(e=>(0,G.jsx)(db,{title:e.entity,children:(0,G.jsx)(Ev,{icon:(0,G.jsx)(Ox,{}),label:e.label,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})},e.label))]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,sx:{cursor:`pointer`},onClick:e=>{e.stopPropagation(),w(!S)},children:[(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{flexGrow:1},children:[s(`endpoints.clusters`),` (`,F.length,`)`]}),(0,G.jsx)($S,{sx:{fontSize:16,color:`text.secondary`,transform:S?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`}})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,gap:.5,mt:.5},children:[F.slice(0,S?void 0:5).map(e=>{let t=v.has(e);return(0,G.jsx)(db,{title:t?`Auto-mapped from linked entity`:`Device cluster`,children:(0,G.jsx)(Ev,{icon:t?(0,G.jsx)(Ox,{}):void 0,label:e,size:`small`,variant:`outlined`,color:t?`info`:`default`,sx:{fontSize:`0.7rem`,height:22}})},e)}),!S&&F.length>5&&(0,G.jsx)(Ev,{label:`+${F.length-5}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})]})]}),(0,G.jsxs)(Zv,{in:S,children:[(0,G.jsx)(Ub,{sx:{my:1}}),p&&(0,G.jsxs)(Z,{sx:{mb:1},children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mb:.5},children:s(`endpoints.homeAssistantEntity`)}),(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.75rem`,children:[s(`endpoints.haState`),`: `,m??s(`common.unknown`)]}),(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.75rem`,children:[`Device Type: `,e.type.name,` (`,e.type.id,`)`]}),(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.75rem`,children:[`Endpoint: `,e.endpoint??`N/A`]})]}),F.map(t=>{let n=e.state[t];if(!n||typeof n!=`object`||Object.keys(n).length===0)return null;let r=Object.entries(n).filter(([e])=>!e.startsWith(`__`)&&e!==`config`);return r.length===0?null:(0,G.jsxs)(Z,{sx:{mb:1},children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontWeight:600,sx:{display:`block`,mb:.25},children:t}),r.map(([e,t])=>(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.7rem`,color:`text.secondary`,noWrap:!0,children:[e,`: `,Rde(t)]},e))]},t)})]})]})})},nC=C.createContext({});function zde(e){return Jd(`MuiAccordion`,e)}var rC=Yd(`MuiAccordion`,[`root`,`heading`,`rounded`,`expanded`,`disabled`,`gutters`,`region`]),Bde=e=>{let{classes:t,square:n,expanded:r,disabled:i,disableGutters:a}=e;return Cp({root:[`root`,!n&&`rounded`,r&&`expanded`,i&&`disabled`,!a&&`gutters`],heading:[`heading`],region:[`region`]},zde,t)},Vde=J(Wm,{name:`MuiAccordion`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${rC.region}`]:t.region},t.root,!n.square&&t.rounded,!n.disableGutters&&t.gutters]}})(Fm(({theme:e})=>{let t={duration:e.transitions.duration.shortest};return{position:`relative`,transition:e.transitions.create([`margin`],t),overflowAnchor:`none`,"&::before":{position:`absolute`,left:0,top:-1,right:0,height:1,content:`""`,opacity:1,backgroundColor:(e.vars||e).palette.divider,transition:e.transitions.create([`opacity`,`background-color`],t)},"&:first-of-type":{"&::before":{display:`none`}},[`&.${rC.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:`none`}}},[`&.${rC.disabled}`]:{backgroundColor:(e.vars||e).palette.action.disabledBackground}}}),Fm(({theme:e})=>({variants:[{props:e=>!e.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(e.vars||e).shape.borderRadius,borderBottomRightRadius:(e.vars||e).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:e=>!e.disableGutters,style:{[`&.${rC.expanded}`]:{margin:`16px 0`}}}]}))),Hde=J(`h3`,{name:`MuiAccordion`,slot:`Heading`})({all:`unset`}),Ude=J(`div`,{name:`MuiAccordion`,slot:`Region`})({}),iC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAccordion`}),{children:r,className:i,defaultExpanded:a=!1,disabled:o=!1,disableGutters:s=!1,expanded:c,onChange:l,slots:u={},slotProps:d={},TransitionComponent:f,TransitionProps:p,...m}=n,[h,g]=ah({controlled:c,default:a,name:`Accordion`,state:`expanded`}),_=C.useCallback(e=>{g(!h),l&&l(e,!h)},[h,l,g]),[v,...y]=C.Children.toArray(r),b=C.useMemo(()=>({expanded:h,disabled:o,disableGutters:s,toggle:_}),[h,o,s,_]),x={...n,disabled:o,disableGutters:s,expanded:h},S=Bde(x),w={slots:{transition:f,...u},slotProps:{transition:p,...d}},[T,E]=Hm(`root`,{elementType:Vde,externalForwardedProps:{...w,...m},className:K(S.root,i),shouldForwardComponentProp:!0,ownerState:x,ref:t}),[D,O]=Hm(`heading`,{elementType:Hde,externalForwardedProps:w,className:S.heading,ownerState:x}),[k,A]=Hm(`transition`,{elementType:Zv,externalForwardedProps:w,ownerState:x}),[j,M]=Hm(`region`,{elementType:Ude,externalForwardedProps:w,ownerState:x,className:S.region,additionalProps:{"aria-labelledby":v.props.id,id:v.props[`aria-controls`],role:`region`}});return(0,G.jsxs)(T,{...E,children:[(0,G.jsx)(D,{...O,children:(0,G.jsx)(nC.Provider,{value:b,children:v})}),(0,G.jsx)(k,{in:h,timeout:`auto`,...A,children:(0,G.jsx)(j,{...M,children:y})})]})});function Wde(e){return Jd(`MuiAccordionDetails`,e)}Yd(`MuiAccordionDetails`,[`root`]);var Gde=e=>{let{classes:t}=e;return Cp({root:[`root`]},Wde,t)},Kde=J(`div`,{name:`MuiAccordionDetails`,slot:`Root`})(Fm(({theme:e})=>({padding:e.spacing(1,2,2)}))),aC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAccordionDetails`}),{className:r,...i}=n,a=n;return(0,G.jsx)(Kde,{className:K(Gde(a).root,r),ref:t,ownerState:a,...i})});function qde(e){return Jd(`MuiAccordionSummary`,e)}var oC=Yd(`MuiAccordionSummary`,[`root`,`expanded`,`focusVisible`,`disabled`,`gutters`,`contentGutters`,`content`,`expandIconWrapper`]),Jde=e=>{let{classes:t,expanded:n,disabled:r,disableGutters:i}=e;return Cp({root:[`root`,n&&`expanded`,r&&`disabled`,!i&&`gutters`],focusVisible:[`focusVisible`],content:[`content`,n&&`expanded`,!i&&`contentGutters`],expandIconWrapper:[`expandIconWrapper`,n&&`expanded`]},qde,t)},Yde=J(Nh,{name:`MuiAccordionSummary`,slot:`Root`})(Fm(({theme:e})=>{let t={duration:e.transitions.duration.shortest};return{display:`flex`,width:`100%`,minHeight:48,padding:e.spacing(0,2),transition:e.transitions.create([`min-height`,`background-color`],t),[`&.${oC.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${oC.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`&:hover:not(.${oC.disabled})`]:{cursor:`pointer`},variants:[{props:e=>!e.disableGutters,style:{[`&.${oC.expanded}`]:{minHeight:64}}}]}})),Xde=J(`span`,{name:`MuiAccordionSummary`,slot:`Content`})(Fm(({theme:e})=>({display:`flex`,textAlign:`start`,flexGrow:1,margin:`12px 0`,variants:[{props:e=>!e.disableGutters,style:{transition:e.transitions.create([`margin`],{duration:e.transitions.duration.shortest}),[`&.${oC.expanded}`]:{margin:`20px 0`}}}]}))),Zde=J(`span`,{name:`MuiAccordionSummary`,slot:`ExpandIconWrapper`})(Fm(({theme:e})=>({display:`flex`,color:(e.vars||e).palette.action.active,transform:`rotate(0deg)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shortest}),[`&.${oC.expanded}`]:{transform:`rotate(180deg)`}}))),sC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAccordionSummary`}),{children:r,className:i,expandIcon:a,focusVisibleClassName:o,onClick:s,slots:c,slotProps:l,...u}=n,{disabled:d=!1,disableGutters:f,expanded:p,toggle:m}=C.useContext(nC),h=e=>{m&&m(e),s&&s(e)},g={...n,expanded:p,disabled:d,disableGutters:f},_=Jde(g),v={slots:c,slotProps:l},[y,b]=Hm(`root`,{ref:t,shouldForwardComponentProp:!0,className:K(_.root,i),elementType:Yde,externalForwardedProps:{...v,...u},ownerState:g,additionalProps:{focusRipple:!1,disableRipple:!0,disabled:d,"aria-expanded":p,focusVisibleClassName:K(_.focusVisible,o)},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),h(t)}})}),[x,S]=Hm(`content`,{className:_.content,elementType:Xde,externalForwardedProps:v,ownerState:g}),[w,T]=Hm(`expandIconWrapper`,{className:_.expandIconWrapper,elementType:Zde,externalForwardedProps:v,ownerState:g});return(0,G.jsxs)(y,{...b,children:[(0,G.jsx)(x,{...S,children:r}),a&&(0,G.jsx)(w,{...T,children:a})]})}),cC=C.createContext();function Qde(e){return Jd(`MuiTable`,e)}Yd(`MuiTable`,[`root`,`stickyHeader`]);var $de=e=>{let{classes:t,stickyHeader:n}=e;return Cp({root:[`root`,n&&`stickyHeader`]},Qde,t)},efe=J(`table`,{name:`MuiTable`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.stickyHeader&&t.stickyHeader]}})(Fm(({theme:e})=>({display:`table`,width:`100%`,borderCollapse:`collapse`,borderSpacing:0,"& caption":{...e.typography.body2,padding:e.spacing(2),color:(e.vars||e).palette.text.secondary,textAlign:`left`,captionSide:`bottom`},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:`separate`}}]}))),lC=`table`,uC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTable`}),{className:r,component:i=lC,padding:a=`normal`,size:o=`medium`,stickyHeader:s=!1,...c}=n,l={...n,component:i,padding:a,size:o,stickyHeader:s},u=$de(l),d=C.useMemo(()=>({padding:a,size:o,stickyHeader:s}),[a,o,s]);return(0,G.jsx)(cC.Provider,{value:d,children:(0,G.jsx)(efe,{as:i,role:i===lC?null:`table`,ref:t,className:K(u.root,r),ownerState:l,...c})})}),dC=C.createContext();function tfe(e){return Jd(`MuiTableBody`,e)}Yd(`MuiTableBody`,[`root`]);var nfe=e=>{let{classes:t}=e;return Cp({root:[`root`]},tfe,t)},rfe=J(`tbody`,{name:`MuiTableBody`,slot:`Root`})({display:`table-row-group`}),ife={variant:`body`},fC=`tbody`,pC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTableBody`}),{className:r,component:i=fC,...a}=n,o={...n,component:i},s=nfe(o);return(0,G.jsx)(dC.Provider,{value:ife,children:(0,G.jsx)(rfe,{className:K(s.root,r),as:i,ref:t,role:i===fC?null:`rowgroup`,ownerState:o,...a})})});function afe(e){return Jd(`MuiTableCell`,e)}var ofe=Yd(`MuiTableCell`,[`root`,`head`,`body`,`footer`,`sizeSmall`,`sizeMedium`,`paddingCheckbox`,`paddingNone`,`alignLeft`,`alignCenter`,`alignRight`,`alignJustify`,`stickyHeader`]),sfe=e=>{let{classes:t,variant:n,align:r,padding:i,size:a,stickyHeader:o}=e;return Cp({root:[`root`,n,o&&`stickyHeader`,r!==`inherit`&&`align${Y(r)}`,i!==`normal`&&`padding${Y(i)}`,`size${Y(a)}`]},afe,t)},cfe=J(`td`,{name:`MuiTableCell`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.padding!==`normal`&&t[`padding${Y(n.padding)}`],n.align!==`inherit`&&t[`align${Y(n.align)}`],n.stickyHeader&&t.stickyHeader]}})(Fm(({theme:e})=>({...e.typography.body2,display:`table-cell`,verticalAlign:`inherit`,borderBottom:e.vars?`1px solid ${e.vars.palette.TableCell.border}`:`1px solid
|
|
217
|
+
`),a=t.selectionStart===r;i&&a&&t.setSelectionRange(r,r),n&&n(e)},ref:u,rows:i,style:a,...s}),(0,G.jsx)(`textarea`,{"aria-hidden":!0,className:e.className,readOnly:!0,ref:f,tabIndex:-1,style:{...rue.shadow,...a,paddingTop:0,paddingBottom:0}})]})});function oue(e){return Jd(`MuiInputBase`,e)}var cS=Yd(`MuiInputBase`,[`root`,`formControl`,`focused`,`disabled`,`adornedStart`,`adornedEnd`,`error`,`sizeSmall`,`multiline`,`colorSecondary`,`fullWidth`,`hiddenLabel`,`readOnly`,`input`,`inputSizeSmall`,`inputMultiline`,`inputTypeSearch`,`inputAdornedStart`,`inputAdornedEnd`,`inputHiddenLabel`]),sue,lS=(e,t)=>{let{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,n.size===`small`&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${Y(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},uS=(e,t)=>{let{ownerState:n}=e;return[t.input,n.size===`small`&&t.inputSizeSmall,n.multiline&&t.inputMultiline,n.type===`search`&&t.inputTypeSearch,n.startAdornment&&t.inputAdornedStart,n.endAdornment&&t.inputAdornedEnd,n.hiddenLabel&&t.inputHiddenLabel]},cue=e=>{let{classes:t,color:n,disabled:r,error:i,endAdornment:a,focused:o,formControl:s,fullWidth:c,hiddenLabel:l,multiline:u,readOnly:d,size:f,startAdornment:p,type:m}=e;return Cp({root:[`root`,`color${Y(n)}`,r&&`disabled`,i&&`error`,c&&`fullWidth`,o&&`focused`,s&&`formControl`,f&&f!==`medium`&&`size${Y(f)}`,u&&`multiline`,p&&`adornedStart`,a&&`adornedEnd`,l&&`hiddenLabel`,d&&`readOnly`],input:[`input`,r&&`disabled`,m===`search`&&`inputTypeSearch`,u&&`inputMultiline`,f===`small`&&`inputSizeSmall`,l&&`inputHiddenLabel`,p&&`inputAdornedStart`,a&&`inputAdornedEnd`,d&&`readOnly`]},oue,t)},dS=J(`div`,{name:`MuiInputBase`,slot:`Root`,overridesResolver:lS})(Fm(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:`1.4375em`,boxSizing:`border-box`,position:`relative`,cursor:`text`,display:`inline-flex`,alignItems:`center`,[`&.${cS.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:`default`},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:`4px 0 5px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:`100%`}}]}))),fS=J(`input`,{name:`MuiInputBase`,slot:`Input`,overridesResolver:uS})(Fm(({theme:e})=>{let t=e.palette.mode===`light`,n={color:`currentColor`,...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create(`opacity`,{duration:e.transitions.duration.shorter})},r={opacity:`0 !important`},i=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:`inherit`,letterSpacing:`inherit`,color:`currentColor`,padding:`4px 0 5px`,border:0,boxSizing:`content-box`,background:`none`,height:`1.4375em`,margin:0,WebkitTapHighlightColor:`transparent`,display:`block`,minWidth:0,width:`100%`,"&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:`none`},"&::-webkit-search-decoration":{WebkitAppearance:`none`},[`label[data-shrink=false] + .${cS.formControl} &`]:{"&::-webkit-input-placeholder":r,"&::-moz-placeholder":r,"&::-ms-input-placeholder":r,"&:focus::-webkit-input-placeholder":i,"&:focus::-moz-placeholder":i,"&:focus::-ms-input-placeholder":i},[`&.${cS.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:`mui-auto-fill-cancel`,animationDuration:`10ms`,"&:-webkit-autofill":{animationDuration:`5000s`,animationName:`mui-auto-fill`}}},{props:{size:`small`},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:`auto`,resize:`none`,padding:0,paddingTop:0}},{props:{type:`search`},style:{MozAppearance:`textfield`}}]}})),pS=Om({"@keyframes mui-auto-fill":{from:{display:`block`}},"@keyframes mui-auto-fill-cancel":{from:{display:`block`}}}),mS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiInputBase`}),{"aria-describedby":r,autoComplete:i,autoFocus:a,className:o,color:s,components:c={},componentsProps:l={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:f,endAdornment:p,error:m,fullWidth:h=!1,id:g,inputComponent:_=`input`,inputProps:v={},inputRef:y,margin:b,maxRows:x,minRows:S,multiline:w=!1,name:T,onBlur:E,onChange:D,onClick:O,onFocus:k,onKeyDown:A,onKeyUp:j,placeholder:M,readOnly:N,renderSuffix:P,rows:F,size:I,slotProps:L={},slots:R={},startAdornment:ee,type:z=`text`,value:te,...B}=n,V=v.value==null?te:v.value,{current:ne}=C.useRef(V!=null),re=C.useRef(),ie=C.useCallback(e=>{},[]),ae=ch(re,y,v.ref,ie),[oe,se]=C.useState(!1),ce=bv(),le=Nv({props:n,muiFormControl:ce,states:[`color`,`disabled`,`error`,`hiddenLabel`,`size`,`required`,`filled`]});le.focused=ce?ce.focused:oe,C.useEffect(()=>{!ce&&d&&oe&&(se(!1),E&&E())},[ce,d,oe,E]);let ue=ce&&ce.onFilled,H=ce&&ce.onEmpty,de=C.useCallback(e=>{Ov(e)?ue&&ue():H&&H()},[ue,H]);nh(()=>{ne&&de({value:V})},[V,de,ne]);let fe=e=>{k&&k(e),v.onFocus&&v.onFocus(e),ce&&ce.onFocus?ce.onFocus(e):se(!0)},U=e=>{E&&E(e),v.onBlur&&v.onBlur(e),ce&&ce.onBlur?ce.onBlur(e):se(!1)},pe=(e,...t)=>{if(!ne){let t=e.target||re.current;if(t==null)throw Error(Ks(1));de({value:t.value})}v.onChange&&v.onChange(e,...t),D&&D(e,...t)};C.useEffect(()=>{de(re.current)},[]);let me=e=>{re.current&&e.currentTarget===e.target&&re.current.focus(),O&&O(e)},W=_,he=v;w&&W===`input`&&(he=F?{type:void 0,minRows:F,maxRows:F,...he}:{type:void 0,maxRows:x,minRows:S,...he},W=aue);let ge=e=>{de(e.animationName===`mui-auto-fill-cancel`?re.current:{value:`x`})};C.useEffect(()=>{ce&&ce.setAdornedStart(!!ee)},[ce,ee]);let _e={...n,color:le.color||`primary`,disabled:le.disabled,endAdornment:p,error:le.error,focused:le.focused,formControl:ce,fullWidth:h,hiddenLabel:le.hiddenLabel,multiline:w,size:le.size,startAdornment:ee,type:z},ve=cue(_e),ye=R.root||c.Root||dS,be=L.root||l.root||{},xe=R.input||c.Input||fS;return he={...he,...L.input??l.input},(0,G.jsxs)(C.Fragment,{children:[!f&&typeof pS==`function`&&(sue||=(0,G.jsx)(pS,{})),(0,G.jsxs)(ye,{...be,ref:t,onClick:me,...B,...!Lm(ye)&&{ownerState:{..._e,...be.ownerState}},className:K(ve.root,be.className,o,N&&`MuiInputBase-readOnly`),children:[ee,(0,G.jsx)(yv.Provider,{value:null,children:(0,G.jsx)(xe,{"aria-invalid":le.error,"aria-describedby":r,autoComplete:i,autoFocus:a,defaultValue:u,disabled:le.disabled,id:g,onAnimationStart:ge,name:T,placeholder:M,readOnly:N,required:le.required,rows:F,value:V,onKeyDown:A,onKeyUp:j,type:z,...he,...!Lm(xe)&&{as:W,ownerState:{..._e,...he.ownerState}},ref:ae,className:K(ve.input,he.className,N&&`MuiInputBase-readOnly`),onBlur:U,onChange:pe,onFocus:fe})}),p,P?P({...le,startAdornment:ee}):null]})]})});function lue(e){return Jd(`MuiInput`,e)}var hS={...cS,...Yd(`MuiInput`,[`root`,`underline`,`input`])},uue=e=>{let{classes:t,disableUnderline:n}=e,r=Cp({root:[`root`,!n&&`underline`],input:[`input`]},lue,t);return{...t,...r}},due=J(dS,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...lS(e,t),!n.disableUnderline&&t.underline]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.42)`:`rgba(255, 255, 255, 0.7)`;return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:`relative`,variants:[{props:({ownerState:e})=>e.formControl,style:{"label + &":{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,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`},[`&.${hS.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${hS.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${hS.disabled}, .${hS.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${hS.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),fue=J(fS,{name:`MuiInput`,slot:`Input`,overridesResolver:uS})({}),gS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,inputComponent:s=`input`,multiline:c=!1,slotProps:l,slots:u={},type:d=`text`,...f}=n,p=uue(n),m={root:{ownerState:{disableUnderline:r}}},h=l??a?Qs(l??a,m):m;return(0,G.jsx)(mS,{slots:{root:u.root??i.Root??due,input:u.input??i.Input??fue},slotProps:h,fullWidth:o,inputComponent:s,multiline:c,ref:t,type:d,...f,classes:p})});gS.muiName=`Input`;function pue(e){return Jd(`MuiFilledInput`,e)}var _S={...cS,...Yd(`MuiFilledInput`,[`root`,`underline`,`input`,`adornedStart`,`adornedEnd`,`sizeSmall`,`multiline`,`hiddenLabel`])},mue=e=>{let{classes:t,disableUnderline:n,startAdornment:r,endAdornment:i,size:a,hiddenLabel:o,multiline:s}=e,c=Cp({root:[`root`,!n&&`underline`,r&&`adornedStart`,i&&`adornedEnd`,a===`small`&&`size${Y(a)}`,o&&`hiddenLabel`,s&&`multiline`],input:[`input`]},pue,t);return{...t,...c}},hue=J(dS,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiFilledInput`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[...lS(e,t),!n.disableUnderline&&t.underline]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`,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)`,i=t?`rgba(0, 0, 0, 0.09)`:`rgba(255, 255, 255, 0.13)`,a=t?`rgba(0, 0, 0, 0.12)`:`rgba(255, 255, 255, 0.12)`;return{position:`relative`,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:i,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${_S.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${_S.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[{props:({ownerState:e})=>!e.disableUnderline,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`},[`&.${_S.focused}:after`]:{transform:`scaleX(1) translateX(0)`},[`&.${_S.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:`""`,position:`absolute`,right:0,transition:e.transitions.create(`border-bottom-color`,{duration:e.transitions.duration.shorter}),pointerEvents:`none`},[`&:hover:not(.${_S.disabled}, .${_S.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${_S.disabled}:before`]:{borderBottomStyle:`dotted`}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:`25px 12px 8px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}}]}})),gue=J(fS,{name:`MuiFilledInput`,slot:`Input`,overridesResolver:uS})(Fm(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:`inherit`,borderTopRightRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&e.size===`small`,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),vS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFilledInput`}),{disableUnderline:r=!1,components:i={},componentsProps:a,fullWidth:o=!1,hiddenLabel:s,inputComponent:c=`input`,multiline:l=!1,slotProps:u,slots:d={},type:f=`text`,...p}=n,m={...n,disableUnderline:r,fullWidth:o,inputComponent:c,multiline:l,type:f},h=mue(n),g={root:{ownerState:m},input:{ownerState:m}},_=u??a?Qs(g,u??a):g;return(0,G.jsx)(mS,{slots:{root:d.root??i.Root??hue,input:d.input??i.Input??gue},slotProps:_,fullWidth:o,inputComponent:c,multiline:l,ref:t,type:f,...p,classes:h})});vS.muiName=`Input`;var _ue,vue=J(`fieldset`,{name:`MuiNotchedOutlined`,shouldForwardProp:Dm})({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%`}),yue=J(`legend`,{name:`MuiNotchedOutlined`,shouldForwardProp:Dm})(Fm(({theme:e})=>({float:`unset`,width:`auto`,overflow:`hidden`,variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:`11px`,transition:e.transitions.create(`width`,{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,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:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:`100%`,transition:e.transitions.create(`max-width`,{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function bue(e){let{children:t,classes:n,className:r,label:i,notched:a,...o}=e,s=i!=null&&i!==``,c={...e,notched:a,withLabel:s};return(0,G.jsx)(vue,{"aria-hidden":!0,className:r,ownerState:c,...o,children:(0,G.jsx)(yue,{ownerState:c,children:s?(0,G.jsx)(`span`,{children:i}):_ue||=(0,G.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``})})})}function xue(e){return Jd(`MuiOutlinedInput`,e)}var yS={...cS,...Yd(`MuiOutlinedInput`,[`root`,`notchedOutline`,`input`])},Sue=e=>{let{classes:t}=e,n=Cp({root:[`root`],notchedOutline:[`notchedOutline`],input:[`input`]},xue,t);return{...t,...n}},Cue=J(dS,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiOutlinedInput`,slot:`Root`,overridesResolver:lS})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{position:`relative`,borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${yS.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${yS.focused} .${yS.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${yS.focused} .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${yS.error} .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${yS.disabled} .${yS.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:`16.5px 14px`}},{props:({ownerState:e,size:t})=>e.multiline&&t===`small`,style:{padding:`8.5px 14px`}}]}})),wue=J(bue,{name:`MuiOutlinedInput`,slot:`NotchedOutline`})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`;return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),Tue=J(fS,{name:`MuiOutlinedInput`,slot:`Input`,overridesResolver:uS})(Fm(({theme:e})=>({padding:`16.5px 14px`,...!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:e.palette.mode===`light`?null:`0 0 0 100px #266798 inset`,WebkitTextFillColor:e.palette.mode===`light`?null:`#fff`,caretColor:e.palette.mode===`light`?null:`#fff`,borderRadius:`inherit`}},...e.vars&&{"&:-webkit-autofill":{borderRadius:`inherit`},[e.getColorSchemeSelector(`dark`)]:{"&:-webkit-autofill":{WebkitBoxShadow:`0 0 0 100px #266798 inset`,WebkitTextFillColor:`#fff`,caretColor:`#fff`}}},variants:[{props:{size:`small`},style:{padding:`8.5px 14px`}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),bS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiOutlinedInput`}),{components:r={},fullWidth:i=!1,inputComponent:a=`input`,label:o,multiline:s=!1,notched:c,slots:l={},slotProps:u={},type:d=`text`,...f}=n,p=Sue(n),m=bv(),h=Nv({props:n,muiFormControl:m,states:[`color`,`disabled`,`error`,`focused`,`hiddenLabel`,`size`,`required`]}),g={...n,color:h.color||`primary`,disabled:h.disabled,error:h.error,focused:h.focused,formControl:m,fullWidth:i,hiddenLabel:h.hiddenLabel,multiline:s,size:h.size,type:d},_=l.root??r.Root??Cue,v=l.input??r.Input??Tue,[y,b]=Hm(`notchedOutline`,{elementType:wue,className:p.notchedOutline,shouldForwardComponentProp:!0,ownerState:g,externalForwardedProps:{slots:l,slotProps:u},additionalProps:{label:o!=null&&o!==``&&h.required?(0,G.jsxs)(C.Fragment,{children:[o,` `,`*`]}):o}});return(0,G.jsx)(mS,{slots:{root:_,input:v},slotProps:u,renderSuffix:e=>(0,G.jsx)(y,{...b,notched:c===void 0?!!(e.startAdornment||e.filled||e.focused):c}),fullWidth:i,inputComponent:a,multiline:s,ref:t,type:d,...f,classes:{...p,notchedOutline:null}})});bS.muiName=`Input`;var Eue=e=>{let{classes:t}=e,n=Cp({root:[`root`]},tS,t);return{...t,...n}},xS={name:`MuiSelect`,slot:`Root`,shouldForwardProp:e=>Dm(e)&&e!==`variant`},Due=J(gS,xS)(``),Oue=J(bS,xS)(``),kue=J(vS,xS)(``),SS=C.forwardRef(function(e,t){let n=km({name:`MuiSelect`,props:e}),{autoWidth:r=!1,children:i,classes:a={},className:o,defaultOpen:s=!1,displayEmpty:c=!1,IconComponent:l=aS,id:u,input:d,inputProps:f,label:p,labelId:m,MenuProps:h,multiple:g=!1,native:_=!1,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:S,variant:w=`outlined`,...T}=n,E=_?Kle:nue,D=Nv({props:n,muiFormControl:bv(),states:[`variant`,`error`]}),O=D.variant||w,k={...n,variant:O,classes:a},A=Eue(k),{root:j,...M}=A,N=d||{standard:(0,G.jsx)(Due,{ownerState:k}),outlined:(0,G.jsx)(Oue,{label:p,ownerState:k}),filled:(0,G.jsx)(kue,{ownerState:k})}[O],P=ch(t,Wh(N));return(0,G.jsx)(C.Fragment,{children:C.cloneElement(N,{inputComponent:E,inputProps:{children:i,error:D.error,IconComponent:l,variant:O,type:void 0,multiple:g,..._?{id:u}:{autoWidth:r,defaultOpen:s,displayEmpty:c,labelId:m,MenuProps:h,onClose:v,onOpen:y,open:b,renderValue:x,SelectDisplayProps:{id:u,...S}},...f,classes:f?Qs(M,f.classes):M,...d?d.props.inputProps:{}},...(g&&_||c)&&O===`outlined`?{notched:!0}:{},ref:P,className:K(N.props.className,o,A.root),...!d&&{variant:O},...T})})});SS.muiName=`Select`;function Aue(e,t){if(t==null){e.focus();return}try{e.focus({focusVisible:t===`keyboard`})}catch{e.focus()}}var jue=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},Mue=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=Cp({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},Ole,o);return{...o,...s}},Nue=J(Nh,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:jue})(Fm(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${Vx.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Vx.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${Vx.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${Vx.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Vx.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${Hb.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${Hb.inset}`]:{marginLeft:52},[`& .${ay.root}`]:{marginTop:0,marginBottom:0},[`& .${ay.inset}`]:{paddingLeft:36},[`& .${ry.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${ry.root} svg`]:{fontSize:`1.25rem`}}}]}))),CS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=Yle(),m=C.useContext(Qv),h=C.useMemo(()=>({dense:a||m.dense||!1,disableGutters:s}),[m.dense,a,s]),g=C.useRef(null);nh(()=>{r&&g.current&&Aue(g.current,p)},[r]);let _={...n,dense:h.dense,divider:o,disableGutters:s},v=Mue(n),y=ch(g,t),b;return n.disabled||(b=u===void 0?-1:u),(0,G.jsx)(Qv.Provider,{value:h,children:(0,G.jsx)(Nue,{ref:y,role:l,tabIndex:b,component:i,focusVisibleClassName:K(v.focusVisible,c),className:K(v.root,d),...f,ownerState:_,classes:v})})});function Pue(e){return Jd(`MuiFormHelperText`,e)}var wS=Yd(`MuiFormHelperText`,[`root`,`error`,`disabled`,`sizeSmall`,`sizeMedium`,`contained`,`focused`,`filled`,`required`]),Fue,Iue=e=>{let{classes:t,contained:n,size:r,disabled:i,error:a,filled:o,focused:s,required:c}=e;return Cp({root:[`root`,i&&`disabled`,a&&`error`,r&&`size${Y(r)}`,n&&`contained`,s&&`focused`,o&&`filled`,c&&`required`]},Pue,t)},Lue=J(`p`,{name:`MuiFormHelperText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.size&&t[`size${Y(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:`left`,marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${wS.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${wS.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:`small`},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),TS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFormHelperText`}),{children:r,className:i,component:a=`p`,disabled:o,error:s,filled:c,focused:l,margin:u,required:d,variant:f,...p}=n,m=Nv({props:n,muiFormControl:bv(),states:[`variant`,`size`,`disabled`,`error`,`filled`,`focused`,`required`]}),h={...n,component:a,contained:m.variant===`filled`||m.variant===`outlined`,variant:m.variant,size:m.size,disabled:m.disabled,error:m.error,filled:m.filled,focused:m.focused,required:m.required};return delete h.ownerState,(0,G.jsx)(Lue,{as:a,className:K(Iue(h).root,i),ref:t,...p,ownerState:h,children:r===` `?Fue||=(0,G.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:``}):r})});function Rue(e){return Jd(`MuiTextField`,e)}Yd(`MuiTextField`,[`root`]);var zue={standard:gS,filled:vS,outlined:bS},Bue=e=>{let{classes:t}=e;return Cp({root:[`root`]},Rue,t)},Vue=J(kv,{name:`MuiTextField`,slot:`Root`})({}),ES=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTextField`}),{autoComplete:r,autoFocus:i=!1,children:a,className:o,color:s=`primary`,defaultValue:c,disabled:l=!1,error:u=!1,FormHelperTextProps:d,fullWidth:f=!1,helperText:p,id:m,InputLabelProps:h,inputProps:g,InputProps:_,inputRef:v,label:y,maxRows:b,minRows:x,multiline:S=!1,name:C,onBlur:w,onChange:T,onFocus:E,placeholder:D,required:O=!1,rows:k,select:A=!1,SelectProps:j,slots:M={},slotProps:N={},type:P,value:F,variant:I=`outlined`,...L}=n,R={...n,autoFocus:i,color:s,disabled:l,error:u,fullWidth:f,multiline:S,required:O,select:A,variant:I},ee=Bue(R),z=Zf(m),te=p&&z?`${z}-helper-text`:void 0,B=y&&z?`${z}-label`:void 0,V=zue[I],ne={slots:M,slotProps:{input:_,inputLabel:h,htmlInput:g,formHelperText:d,select:j,...N}},re={},ie=ne.slotProps.inputLabel;I===`outlined`&&(ie&&ie.shrink!==void 0&&(re.notched=ie.shrink),re.label=y),A&&((!j||!j.native)&&(re.id=void 0),re[`aria-describedby`]=void 0);let[ae,oe]=Hm(`root`,{elementType:Vue,shouldForwardComponentProp:!0,externalForwardedProps:{...ne,...L},ownerState:R,className:K(ee.root,o),ref:t,additionalProps:{disabled:l,error:u,fullWidth:f,required:O,color:s,variant:I}}),[se,ce]=Hm(`input`,{elementType:V,externalForwardedProps:ne,additionalProps:re,ownerState:R}),[le,ue]=Hm(`inputLabel`,{elementType:Bx,externalForwardedProps:ne,ownerState:R}),[H,de]=Hm(`htmlInput`,{elementType:`input`,externalForwardedProps:ne,ownerState:R}),[fe,U]=Hm(`formHelperText`,{elementType:TS,externalForwardedProps:ne,ownerState:R}),[pe,me]=Hm(`select`,{elementType:SS,externalForwardedProps:ne,ownerState:R}),W=(0,G.jsx)(se,{"aria-describedby":te,autoComplete:r,autoFocus:i,defaultValue:c,fullWidth:f,multiline:S,name:C,rows:k,maxRows:b,minRows:x,type:P,value:F,id:z,inputRef:v,onBlur:w,onChange:T,onFocus:E,placeholder:D,inputProps:de,slots:{input:M.htmlInput?H:void 0},...ce});return(0,G.jsxs)(ae,{...oe,children:[y!=null&&y!==``&&(0,G.jsx)(le,{htmlFor:z,id:B,...ue,children:y}),A?(0,G.jsx)(pe,{"aria-describedby":te,id:z,labelId:B,value:F,input:W,...me,children:a}):W,p&&(0,G.jsx)(fe,{id:te,...U,children:p})]})});function Hue(e){return Jd(`MuiToggleButton`,e)}var DS=Yd(`MuiToggleButton`,[`root`,`disabled`,`selected`,`standard`,`primary`,`secondary`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`fullWidth`]),OS=C.createContext({}),kS=C.createContext(void 0);function Uue(e,t){return t===void 0||e===void 0?!1:Array.isArray(t)?t.includes(e):e===t}var Wue=e=>{let{classes:t,fullWidth:n,selected:r,disabled:i,size:a,color:o}=e;return Cp({root:[`root`,r&&`selected`,i&&`disabled`,n&&`fullWidth`,`size${Y(a)}`,o]},Hue,t)},Gue=J(Nh,{name:`MuiToggleButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`size${Y(n.size)}`]]}})(Fm(({theme:e})=>({...e.typography.button,borderRadius:(e.vars||e).shape.borderRadius,padding:11,border:`1px solid ${(e.vars||e).palette.divider}`,color:(e.vars||e).palette.action.active,[`&.${DS.disabled}`]:{color:(e.vars||e).palette.action.disabled,border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},"&:hover":{textDecoration:`none`,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[{props:{color:`standard`},style:{[`&.${DS.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter(Um()).map(([t])=>({props:{color:t},style:{[`&.${DS.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:`100%`}},{props:{size:`small`},style:{padding:7,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`},style:{padding:15,fontSize:e.typography.pxToRem(15)}}]}))),AS=C.forwardRef(function(e,t){let{value:n,...r}=C.useContext(OS),i=C.useContext(kS),a=km({props:uf({...r,selected:Uue(e.value,n)},e),name:`MuiToggleButton`}),{children:o,className:s,color:c=`standard`,disabled:l=!1,disableFocusRipple:u=!1,fullWidth:d=!1,onChange:f,onClick:p,selected:m,size:h=`medium`,value:g,..._}=a,v={...a,color:c,disabled:l,disableFocusRipple:u,fullWidth:d,size:h},y=Wue(v),b=e=>{p&&(p(e,g),e.defaultPrevented)||f&&f(e,g)},x=i||``;return(0,G.jsx)(Gue,{className:K(r.className,y.root,s,x),disabled:l,focusRipple:!u,ref:t,onClick:b,onChange:f,value:g,ownerState:v,"aria-pressed":m,..._,children:o})});function Kue(e){return C.Children.toArray(e).filter(e=>C.isValidElement(e))}function que(e){return Jd(`MuiToggleButtonGroup`,e)}var jS=Yd(`MuiToggleButtonGroup`,[`root`,`selected`,`horizontal`,`vertical`,`disabled`,`grouped`,`groupedHorizontal`,`groupedVertical`,`fullWidth`,`firstButton`,`lastButton`,`middleButton`]),Jue=e=>{let{classes:t,orientation:n,fullWidth:r,disabled:i}=e;return Cp({root:[`root`,n,r&&`fullWidth`],grouped:[`grouped`,`grouped${Y(n)}`,i&&`disabled`],firstButton:[`firstButton`],lastButton:[`lastButton`],middleButton:[`middleButton`]},que,t)},Yue=J(`div`,{name:`MuiToggleButtonGroup`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${jS.grouped}`]:t.grouped},{[`& .${jS.grouped}`]:t[`grouped${Y(n.orientation)}`]},{[`& .${jS.firstButton}`]:t.firstButton},{[`& .${jS.lastButton}`]:t.lastButton},{[`& .${jS.middleButton}`]:t.middleButton},t.root,n.orientation===`vertical`&&t.vertical,n.fullWidth&&t.fullWidth]}})(Fm(({theme:e})=>({display:`inline-flex`,borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:`vertical`},style:{flexDirection:`column`,[`& .${jS.grouped}`]:{[`&.${jS.selected} + .${jS.grouped}.${jS.selected}`]:{borderTop:0,marginTop:0}},[`& .${jS.firstButton},& .${jS.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${jS.lastButton},& .${jS.middleButton}`]:{marginTop:-1,borderTop:`1px solid transparent`,borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${jS.lastButton}.${DS.disabled},& .${jS.middleButton}.${DS.disabled}`]:{borderTop:`1px solid transparent`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{orientation:`horizontal`},style:{[`& .${jS.grouped}`]:{[`&.${jS.selected} + .${jS.grouped}.${jS.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${jS.firstButton},& .${jS.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${jS.lastButton},& .${jS.middleButton}`]:{marginLeft:-1,borderLeft:`1px solid transparent`,borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${jS.lastButton}.${DS.disabled},& .${jS.middleButton}.${DS.disabled}`]:{borderLeft:`1px solid transparent`}}}]}))),Xue=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiToggleButtonGroup`}),{children:r,className:i,color:a=`standard`,disabled:o=!1,exclusive:s=!1,fullWidth:c=!1,onChange:l,orientation:u=`horizontal`,size:d=`medium`,value:f,...p}=n,m={...n,disabled:o,fullWidth:c,orientation:u,size:d},h=Jue(m),g=C.useCallback((e,t)=>{if(!l)return;let n=f&&f.indexOf(t),r;f&&n>=0?(r=f.slice(),r.splice(n,1)):r=f?f.concat(t):[t],l(e,r)},[l,f]),_=C.useCallback((e,t)=>{l&&l(e,f===t?null:t)},[l,f]),v=C.useMemo(()=>({className:h.grouped,onChange:s?_:g,value:f,size:d,fullWidth:c,color:a,disabled:o}),[h.grouped,s,_,g,f,d,c,a,o]),y=Kue(r),b=y.length,x=e=>{let t=e===0,n=e===b-1;return t&&n?``:t?h.firstButton:n?h.lastButton:h.middleButton};return(0,G.jsx)(Yue,{role:`group`,className:K(h.root,i),ref:t,ownerState:m,...p,children:(0,G.jsx)(OS.Provider,{value:v,children:y.map((e,t)=>(0,G.jsx)(kS.Provider,{value:x(t),children:e},t))})})}),MS=`api/device-images`;async function NS(e){let t=await fetch(`${MS}/resolve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({entityIds:e})});return t.ok?j_(t):{}}async function Zue(e,t){let n=new FormData;n.append(`image`,t),await M_(await fetch(`${MS}/${encodeURIComponent(e)}`,{method:`POST`,body:n}),`Failed to upload image`)}async function Que(e){await M_(await fetch(`${MS}/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete image`)}function $ue(e){return`${MS}/${encodeURIComponent(e)}`}async function PS(e){let t=await fetch(`api/entity-mappings/${e}`);return await M_(t,`Failed to fetch entity mappings`),j_(t)}async function FS(e,t,n){let r=await fetch(`api/entity-mappings/${e}/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});return await M_(r,`Failed to update entity mapping`),j_(r)}async function ede(e,t){let n=await fetch(`api/entity-mappings/${e}/${encodeURIComponent(t)}`,{method:`DELETE`});if(!n.ok)throw Error(`Failed to delete entity mapping: ${n.statusText}`)}var IS=X((0,G.jsx)(`path`,{d:`M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`AddCircleOutline`),LS=X((0,G.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`}),`Delete`);function RS({array1:e,array2:t,parser:n=e=>e}){return e&&t&&e.length===t.length&&e.every((e,r)=>n(e)===n(t[r]))}function zS(e){return e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}function tde(e={}){let{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:i=`any`,stringify:a,trim:o=!1}=e;return(e,{inputValue:s,getOptionLabel:c})=>{let l=o?s.trim():s;n&&(l=l.toLowerCase()),t&&(l=zS(l));let u=l?e.filter(e=>{let r=(a||c)(e);return n&&(r=r.toLowerCase()),t&&(r=zS(r)),i===`start`?r.startsWith(l):r.includes(l)}):e;return typeof r==`number`?u.slice(0,r):u}}var nde=tde(),rde=5,ide=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),BS=(e,t)=>e===t,ade=[];function VS(e,t,n,r){if(t||e==null||r)return``;let i=n(e);return typeof i==`string`?i:``}function ode(e){let{unstable_isActiveElementInListbox:t=ide,unstable_classNamePrefix:n=`Mui`,autoComplete:r=!1,autoHighlight:i=!1,autoSelect:a=!1,blurOnSelect:o=!1,clearOnBlur:s=!e.freeSolo,clearOnEscape:c=!1,componentName:l=`useAutocomplete`,defaultValue:u=e.multiple?ade:null,disableClearable:d=!1,disableCloseOnSelect:f=!1,disabled:p,disabledItemsFocusable:m=!1,disableListWrap:h=!1,filterOptions:g=nde,filterSelectedOptions:_=!1,freeSolo:v=!1,getOptionDisabled:y,getOptionKey:b,getOptionLabel:x=e=>e.label??e,groupBy:S,handleHomeEndKeys:w=!e.freeSolo,id:T,includeInputInList:E=!1,inputValue:D,isOptionEqualToValue:O=BS,multiple:k=!1,onChange:A,onClose:j,onHighlightChange:M,onInputChange:N,onOpen:P,open:F,openOnFocus:I=!1,options:L,readOnly:R=!1,renderValue:ee,selectOnFocus:z=!e.freeSolo,value:te}=e,B=Zf(T),V=x;V=e=>{let t=x(e);return typeof t==`string`?t:String(t)};let ne=C.useRef(!1),re=C.useRef(!0),ie=C.useRef(null),ae=C.useRef(null),oe=C.useRef(!1),[se,ce]=C.useState(null),[le,ue]=C.useState(-1),H=i?0:-1,de=C.useRef(H),fe=C.useRef(VS(u??te,k,V)).current,[U,pe]=ih({controlled:te,default:u,name:l}),[me,W]=ih({controlled:D,default:fe,name:l,state:`inputValue`}),[he,ge]=C.useState(!1),_e=C.useCallback((e,t,n)=>{if(!(k?U.length<t.length:t!==null)&&!s)return;let r=VS(t,k,V,ee);me!==r&&(W(r),N&&N(e,r,n))},[V,me,k,N,W,s,U,ee]),[ve,ye]=ih({controlled:F,default:!1,name:l,state:`open`}),[be,xe]=C.useState(!0),Se=!k&&U!=null&&me===V(U),Ce=ve&&!R,we=C.useMemo(()=>k?U:U==null?[]:[U],[k,U]),Te=C.useMemo(()=>O!==BS||we.length===0?null:new Set(we),[O,we]),Ee=C.useCallback(e=>Te?Te.has(e):we.some(t=>t!=null&&O(e,t)),[O,we,Te]),De=Ce?g(L.filter(e=>!(_&&Ee(e))),{inputValue:Se&&be?``:me,getOptionLabel:V}):[],Oe=Nx({filteredOptions:De,value:U,inputValue:me});C.useEffect(()=>{let e=U!==Oe.value;he&&!e||v&&!e||_e(null,U,`reset`)},[U,_e,he,Oe.value,v]);let ke=ve&&De.length>0&&!R,Ae=oh(e=>{if(e===-1)ie.current.focus();else{let t=ee?`data-item-index`:`data-tag-index`;se.querySelector(`[${t}="${e}"]`).focus()}});C.useEffect(()=>{k&&le>U.length-1&&(ue(-1),Ae(-1))},[U,k,le,Ae]);function je(e,t){if(!ae.current||e<0||e>=De.length)return-1;let n=e;for(;;){let r=ae.current.querySelector(`[data-option-index="${n}"]`),i=m?!1:!r||r.disabled||r.getAttribute(`aria-disabled`)===`true`;if(r&&r.hasAttribute(`tabindex`)&&!i)return n;if(n=t===`next`?(n+1)%De.length:(n-1+De.length)%De.length,n===e)return-1}}let Me=oh(({event:e,index:t,reason:r})=>{if(de.current=t,t===-1?ie.current.removeAttribute(`aria-activedescendant`):ie.current.setAttribute(`aria-activedescendant`,`${B}-option-${t}`),M&&[`mouse`,`keyboard`,`touch`].includes(r)&&M(e,t===-1?null:De[t],r),!ae.current)return;let i=ae.current.querySelector(`[role="option"].${n}-focused`);i&&(i.classList.remove(`${n}-focused`),i.classList.remove(`${n}-focusVisible`));let a=ae.current;if(ae.current.getAttribute(`role`)!==`listbox`&&(a=ae.current.parentElement.querySelector(`[role="listbox"]`)),!a)return;if(t===-1){a.scrollTop=0;return}let o=ae.current.querySelector(`[data-option-index="${t}"]`);if(o&&(o.classList.add(`${n}-focused`),r===`keyboard`&&o.classList.add(`${n}-focusVisible`),a.scrollHeight>a.clientHeight&&r!==`mouse`&&r!==`touch`)){let e=o,t=a.clientHeight+a.scrollTop,n=e.offsetTop+e.offsetHeight;n>t?a.scrollTop=n-a.clientHeight:e.offsetTop-e.offsetHeight*(S?1.3:0)<a.scrollTop&&(a.scrollTop=e.offsetTop-e.offsetHeight*(S?1.3:0))}}),Ne=oh(({event:e,diff:t,direction:n=`next`,reason:i})=>{if(!Ce)return;let a=je((()=>{let e=De.length-1;if(t===`reset`)return H;if(t===`start`)return 0;if(t===`end`)return e;let n=de.current+t;return n<0?n===-1&&E?-1:h&&de.current!==-1||Math.abs(t)>1?0:e:n>e?n===e+1&&E?-1:h||Math.abs(t)>1?e:0:n})(),n);if(Me({index:a,reason:i,event:e}),r&&t!==`reset`)if(a===-1)ie.current.value=me;else{let e=V(De[a]);ie.current.value=e,e.toLowerCase().indexOf(me.toLowerCase())===0&&me.length>0&&ie.current.setSelectionRange(me.length,e.length)}}),Pe=!RS({array1:Oe.filteredOptions,array2:De,parser:V}),Fe=()=>{if(de.current!==-1&&!RS({array1:Oe.filteredOptions,array2:De,parser:V})&&Oe.inputValue===me&&(k?U.length===Oe.value.length&&Oe.value.every((e,t)=>V(U[t])===V(e)):((e,t)=>(e?V(e):``)===(t?V(t):``))(Oe.value,U))){let e=Oe.filteredOptions[de.current];if(e)return De.findIndex(t=>V(t)===V(e))}return-1},Ie=C.useCallback(()=>{if(!Ce)return;let e=Fe();if(e!==-1){de.current=e;return}let t=k?U[0]:U;if(De.length===0||t==null){Ne({diff:`reset`});return}if(ae.current){if(t!=null){let e=De[de.current];if(k&&e&&U.findIndex(t=>O(e,t))!==-1)return;let n=De.findIndex(e=>O(e,t));n===-1?Ne({diff:`reset`}):Me({index:n});return}if(de.current>=De.length-1){Me({index:De.length-1});return}Me({index:de.current})}},[De.length,k?!1:U,Ne,Me,Ce,me,k]),Le=oh(e=>{th(ae,e),e&&Ie()});C.useEffect(()=>{(Pe||Ce&&!f)&&Ie()},[Ie,Pe,Ce,f]),C.useEffect(()=>{if(typeof window>`u`)return;let e=()=>{oe.current=!0};return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e)}},[]);let Re=e=>{ve||(ye(!0),xe(!0),P&&P(e))},ze=(e,t)=>{ve&&(ye(!1),j&&j(e,t))},Be=(e,t,n,r)=>{if(k){if(U.length===t.length&&U.every((e,n)=>e===t[n]))return}else if(U===t)return;A&&A(e,t,n,r),pe(t)},Ve=C.useRef(!1),He=(e,t,n=`selectOption`,r=`options`)=>{let i=n,a=t;if(k){a=Array.isArray(U)?U.slice():[];let e=a.findIndex(e=>O(t,e));e===-1?a.push(t):r!==`freeSolo`&&(a.splice(e,1),i=`removeOption`)}_e(e,a,i),Be(e,a,i,{option:t}),!f&&(!e||!e.ctrlKey&&!e.metaKey)&&ze(e,i),(o===!0||o===`touch`&&Ve.current||o===`mouse`&&!Ve.current)&&ie.current.blur()};function Ue(e,t){if(e===-1)return-1;let n=e;for(;;){if(t===`next`&&n===U.length||t===`previous`&&n===-1)return-1;let e=ee?`data-item-index`:`data-tag-index`,r=se.querySelector(`[${e}="${n}"]`);if(!r||!r.hasAttribute(`tabindex`)||r.disabled||r.getAttribute(`aria-disabled`)===`true`)n+=t===`next`?1:-1;else return n}}let We=(e,t)=>{if(!k)return;me===``&&ze(e,`toggleInput`);let n=le;le===-1&&t===`previous`?(n=U.length-1,v&&me!==``&&(W(``),N&&N(e,``,`reset`))):(n+=t===`next`?1:-1,n<0&&(n=0),n===U.length&&(n=-1)),n=Ue(n,t),ue(n),Ae(n)},Ge=e=>{ne.current=!0,W(``),N&&N(e,``,`clear`),Be(e,k?[]:null,`clear`)},Ke=e=>t=>{if(e.onKeyDown&&e.onKeyDown(t),!t.defaultMuiPrevented&&(le!==-1&&![`ArrowLeft`,`ArrowRight`].includes(t.key)&&(ue(-1),Ae(-1)),t.which!==229))switch(t.key){case`Home`:Ce&&w&&(t.preventDefault(),Ne({diff:`start`,direction:`next`,reason:`keyboard`,event:t}));break;case`End`:Ce&&w&&(t.preventDefault(),Ne({diff:`end`,direction:`previous`,reason:`keyboard`,event:t}));break;case`PageUp`:t.preventDefault(),Ne({diff:-5,direction:`previous`,reason:`keyboard`,event:t}),Re(t);break;case`PageDown`:t.preventDefault(),Ne({diff:rde,direction:`next`,reason:`keyboard`,event:t}),Re(t);break;case`ArrowDown`:t.preventDefault(),Ne({diff:1,direction:`next`,reason:`keyboard`,event:t}),Re(t);break;case`ArrowUp`:t.preventDefault(),Ne({diff:-1,direction:`previous`,reason:`keyboard`,event:t}),Re(t);break;case`ArrowLeft`:{let e=ie.current;if(!(e&&e.selectionStart===0&&e.selectionEnd===0))return;!k&&ee&&U!=null?(v&&me!==``&&(W(``),N&&N(t,``,`reset`)),ue(0),Ae(0)):We(t,`previous`);break}case`ArrowRight`:!k&&ee?(ue(-1),Ae(-1)):We(t,`next`);break;case`Enter`:if(de.current!==-1&&Ce){let e=De[de.current],n=y?y(e):!1;if(t.preventDefault(),n)return;He(t,e,`selectOption`),r&&ie.current.setSelectionRange(ie.current.value.length,ie.current.value.length)}else v&&me!==``&&Se===!1&&(k&&t.preventDefault(),He(t,me,`createOption`,`freeSolo`));break;case`Escape`:Ce?(t.preventDefault(),t.stopPropagation(),ze(t,`escape`)):c&&(me!==``||k&&U.length>0||ee)&&(t.preventDefault(),t.stopPropagation(),Ge(t));break;case`Backspace`:if(k&&!R&&me===``&&U.length>0){let e=le===-1?U.length-1:le,n=U.slice();n.splice(e,1),Be(t,n,`removeOption`,{option:U[e]})}!k&&ee&&!R&&me===``&&Be(t,null,`removeOption`,{option:U});break;case`Delete`:if(k&&!R&&me===``&&U.length>0&&le!==-1){let e=le,n=U.slice();n.splice(e,1),Be(t,n,`removeOption`,{option:U[e]})}!k&&ee&&!R&&me===``&&Be(t,null,`removeOption`,{option:U});break;default:}},qe=e=>{if(ge(!0),le!==-1&&(ue(-1),Ae(-1)),oe.current){oe.current=!1;return}I&&!ne.current&&Re(e)},Je=e=>{if(t(ae)){ie.current.focus();return}ge(!1),re.current=!0,ne.current=!1,a&&de.current!==-1&&Ce?He(e,De[de.current],`blur`):a&&v&&me!==``?He(e,me,`blur`,`freeSolo`):s&&_e(e,U,`blur`),ze(e,`blur`)},Ye=e=>{let t=e.target.value;me!==t&&(W(t),xe(!1),N&&N(e,t,`input`)),t===``?!d&&!k&&!ee&&Be(e,null,`clear`):Re(e)},Xe=e=>{let t=Number(e.currentTarget.getAttribute(`data-option-index`));de.current!==t&&Me({event:e,index:t,reason:`mouse`})},Ze=e=>{Me({event:e,index:Number(e.currentTarget.getAttribute(`data-option-index`)),reason:`touch`}),Ve.current=!0},Qe=e=>{He(e,De[Number(e.currentTarget.getAttribute(`data-option-index`))],`selectOption`),Ve.current=!1},$e=e=>t=>{let n=U.slice();n.splice(e,1),Be(t,n,`removeOption`,{option:U[e]})},et=e=>{Be(e,null,`removeOption`,{option:U})},tt=e=>{ve?ze(e,`toggleInput`):Re(e)},nt=e=>{e.currentTarget.contains(e.target)&&(se&&!se.contains(e.target)||e.target.getAttribute(`id`)!==B&&e.preventDefault())},rt=e=>{e.currentTarget.contains(e.target)&&(se&&!se.contains(e.target)||(ie.current.focus(),z&&re.current&&ie.current.selectionEnd-ie.current.selectionStart===0&&ie.current.select(),re.current=!1))},it=e=>{!p&&(me===``||!ve)&&tt(e)},at=v&&me.length>0;at||=k?U.length>0:U!==null;let ot=De;return S&&(ot=De.reduce((e,t,n)=>{let r=S(t);return e.length>0&&e[e.length-1].group===r?e[e.length-1].options.push(t):e.push({key:n,index:n,group:r,options:[t]}),e},[])),p&&he&&Je(),{getRootProps:(e={})=>({...e,onKeyDown:Ke(e),onMouseDown:nt,onClick:rt}),getInputLabelProps:()=>({id:`${B}-label`,htmlFor:B}),getInputProps:()=>({id:B,value:me,onBlur:Je,onFocus:qe,onChange:Ye,onMouseDown:it,"aria-activedescendant":Ce?``:null,"aria-autocomplete":r?`both`:`list`,"aria-controls":ke?`${B}-listbox`:void 0,"aria-expanded":ke,autoComplete:`off`,ref:ie,autoCapitalize:`none`,spellCheck:`false`,role:`combobox`,disabled:p}),getClearProps:()=>({tabIndex:-1,type:`button`,onClick:Ge}),getItemProps:({index:e=0}={})=>({...k&&{key:e},...ee?{"data-item-index":e}:{"data-tag-index":e},tabIndex:-1,...!R&&{onDelete:k?$e(e):et}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:`button`,onClick:tt}),getTagProps:({index:e})=>({key:e,"data-tag-index":e,tabIndex:-1,...!R&&{onDelete:$e(e)}}),getListboxProps:()=>({role:`listbox`,id:`${B}-listbox`,"aria-labelledby":`${B}-label`,"aria-multiselectable":k||void 0,ref:Le,onMouseDown:e=>{e.preventDefault()}}),getOptionProps:({index:e,option:t})=>{let n=Ee(t),r=y?y(t):!1;return{key:b?.(t)??V(t),tabIndex:-1,role:`option`,id:`${B}-option-${e}`,onMouseMove:Xe,onClick:Qe,onTouchStart:Ze,"data-option-index":e,"aria-disabled":r,"aria-selected":n}},id:B,inputValue:me,value:U,dirty:at,expanded:Ce&&se,popupOpen:Ce,focused:he||le!==-1,anchorEl:se,setAnchorEl:ce,focusedItem:le,focusedTag:le,groupedOptions:ot}}function sde(e){return Jd(`MuiListSubheader`,e)}Yd(`MuiListSubheader`,[`root`,`colorPrimary`,`colorInherit`,`gutters`,`inset`,`sticky`]);var cde=e=>{let{classes:t,color:n,disableGutters:r,inset:i,disableSticky:a}=e;return Cp({root:[`root`,n!=="default"&&`color${Y(n)}`,!r&&`gutters`,i&&`inset`,!a&&`sticky`]},sde,t)},lde=J(`li`,{name:`MuiListSubheader`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Y(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(Fm(({theme:e})=>({boxSizing:`border-box`,lineHeight:`48px`,listStyle:`none`,color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:`primary`},style:{color:(e.vars||e).palette.primary.main}},{props:{color:`inherit`},style:{color:`inherit`}},{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:72}},{props:({ownerState:e})=>!e.disableSticky,style:{position:`sticky`,top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),HS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiListSubheader`}),{className:r,color:i=`default`,component:a=`li`,disableGutters:o=!1,disableSticky:s=!1,inset:c=!1,...l}=n,u={...n,color:i,component:a,disableGutters:o,disableSticky:s,inset:c};return(0,G.jsx)(lde,{as:a,className:K(cde(u).root,r),ref:t,ownerState:u,...l})});HS&&(HS.muiSkipListHighlight=!0);function ude(e){return Jd(`MuiAutocomplete`,e)}var US=Yd(`MuiAutocomplete`,`root.expanded.fullWidth.focused.focusVisible.tag.tagSizeSmall.tagSizeMedium.hasPopupIcon.hasClearIcon.inputRoot.input.inputFocused.endAdornment.clearIndicator.popupIndicator.popupIndicatorOpen.popper.popperDisablePortal.paper.listbox.loading.noOptions.option.groupLabel.groupUl`.split(`.`)),dde,fde,pde=e=>{let{classes:t,disablePortal:n,expanded:r,focused:i,fullWidth:a,hasClearIcon:o,hasPopupIcon:s,inputFocused:c,popupOpen:l,size:u}=e;return Cp({root:[`root`,r&&`expanded`,i&&`focused`,a&&`fullWidth`,o&&`hasClearIcon`,s&&`hasPopupIcon`],inputRoot:[`inputRoot`],input:[`input`,c&&`inputFocused`],tag:[`tag`,`tagSize${Y(u)}`],endAdornment:[`endAdornment`],clearIndicator:[`clearIndicator`],popupIndicator:[`popupIndicator`,l&&`popupIndicatorOpen`],popper:[`popper`,n&&`popperDisablePortal`],paper:[`paper`],listbox:[`listbox`],loading:[`loading`],noOptions:[`noOptions`],option:[`option`],groupLabel:[`groupLabel`],groupUl:[`groupUl`]},ude,t)},mde=J(`div`,{name:`MuiAutocomplete`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{fullWidth:r,hasClearIcon:i,hasPopupIcon:a,inputFocused:o,size:s}=n;return[{[`& .${US.tag}`]:t.tag},{[`& .${US.tag}`]:t[`tagSize${Y(s)}`]},{[`& .${US.inputRoot}`]:t.inputRoot},{[`& .${US.input}`]:t.input},{[`& .${US.input}`]:o&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,i&&t.hasClearIcon]}})({[`&.${US.focused} .${US.clearIndicator}`]:{visibility:`visible`},"@media (pointer: fine)":{[`&:hover .${US.clearIndicator}`]:{visibility:`visible`}},[`& .${US.tag}`]:{margin:3,maxWidth:`calc(100% - 6px)`},[`& .${US.inputRoot}`]:{[`.${US.hasPopupIcon}&, .${US.hasClearIcon}&`]:{paddingRight:30},[`.${US.hasPopupIcon}.${US.hasClearIcon}&`]:{paddingRight:56},[`& .${US.input}`]:{width:0,minWidth:30}},[`& .${hS.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:`4px 4px 4px 0px`}},[`& .${hS.root}.${cS.sizeSmall}`]:{[`& .${hS.input}`]:{padding:`2px 4px 3px 0`}},[`& .${yS.root}`]:{padding:9,[`.${US.hasPopupIcon}&, .${US.hasClearIcon}&`]:{paddingRight:39},[`.${US.hasPopupIcon}.${US.hasClearIcon}&`]:{paddingRight:65},[`& .${US.input}`]:{padding:`7.5px 4px 7.5px 5px`},[`& .${US.endAdornment}`]:{right:9}},[`& .${yS.root}.${cS.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${US.input}`]:{padding:`2.5px 4px 2.5px 8px`}},[`& .${_S.root}`]:{paddingTop:19,paddingLeft:8,[`.${US.hasPopupIcon}&, .${US.hasClearIcon}&`]:{paddingRight:39},[`.${US.hasPopupIcon}.${US.hasClearIcon}&`]:{paddingRight:65},[`& .${_S.input}`]:{padding:`7px 4px`},[`& .${US.endAdornment}`]:{right:9}},[`& .${_S.root}.${cS.sizeSmall}`]:{paddingBottom:1,[`& .${_S.input}`]:{padding:`2.5px 4px`}},[`& .${cS.hiddenLabel}`]:{paddingTop:8},[`& .${_S.root}.${cS.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${US.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${_S.root}.${cS.hiddenLabel}.${cS.sizeSmall}`]:{[`& .${US.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${US.input}`]:{flexGrow:1,textOverflow:`ellipsis`,opacity:0},variants:[{props:{fullWidth:!0},style:{width:`100%`}},{props:{size:`small`},style:{[`& .${US.tag}`]:{margin:2,maxWidth:`calc(100% - 4px)`}}},{props:{inputFocused:!0},style:{[`& .${US.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${US.inputRoot}`]:{flexWrap:`wrap`}}}]}),hde=J(`div`,{name:`MuiAutocomplete`,slot:`EndAdornment`})({position:`absolute`,right:0,top:`50%`,transform:`translate(0, -50%)`}),gde=J(Bh,{name:`MuiAutocomplete`,slot:`ClearIndicator`})({marginRight:-2,padding:4,visibility:`hidden`}),_de=J(Bh,{name:`MuiAutocomplete`,slot:`PopupIndicator`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen]}})({padding:2,marginRight:-2,variants:[{props:{popupOpen:!0},style:{transform:`rotate(180deg)`}}]}),vde=J(ab,{name:`MuiAutocomplete`,slot:`Popper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${US.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:`absolute`}}]}))),yde=J(Wm,{name:`MuiAutocomplete`,slot:`Paper`})(Fm(({theme:e})=>({...e.typography.body1,overflow:`auto`}))),bde=J(`div`,{name:`MuiAutocomplete`,slot:`Loading`})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:`14px 16px`}))),xde=J(`div`,{name:`MuiAutocomplete`,slot:`NoOptions`})(Fm(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:`14px 16px`}))),Sde=J(`ul`,{name:`MuiAutocomplete`,slot:`Listbox`})(Fm(({theme:e})=>({listStyle:`none`,margin:0,padding:`8px 0`,maxHeight:`40vh`,overflow:`auto`,position:`relative`,[`& .${US.option}`]:{minHeight:48,display:`flex`,overflow:`hidden`,justifyContent:`flex-start`,alignItems:`center`,cursor:`pointer`,paddingTop:6,boxSizing:`border-box`,outline:`0`,WebkitTapHighlightColor:`transparent`,paddingBottom:6,paddingLeft:16,paddingRight:16,[e.breakpoints.up(`sm`)]:{minHeight:`auto`},[`&.${US.focused}`]:{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},'&[aria-disabled="true"]':{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`&.${US.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${US.focused}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${US.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),Cde=J(HS,{name:`MuiAutocomplete`,slot:`GroupLabel`})(Fm(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),wde=J(`ul`,{name:`MuiAutocomplete`,slot:`GroupUl`})({padding:0,[`& .${US.option}`]:{paddingLeft:24}}),WS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAutocomplete`}),{autoComplete:r=!1,autoHighlight:i=!1,autoSelect:a=!1,blurOnSelect:o=!1,ChipProps:s,className:c,clearIcon:l=dde||=(0,G.jsx)(Vh,{fontSize:`small`}),clearOnBlur:u=!n.freeSolo,clearOnEscape:d=!1,clearText:f=`Clear`,closeText:p=`Close`,componentsProps:m,defaultValue:h=n.multiple?[]:null,disableClearable:g=!1,disableCloseOnSelect:_=!1,disabled:v=!1,disabledItemsFocusable:y=!1,disableListWrap:b=!1,disablePortal:x=!1,filterOptions:S,filterSelectedOptions:w=!1,forcePopupIcon:T=`auto`,freeSolo:E=!1,fullWidth:D=!1,getLimitTagsText:O=e=>`+${e}`,getOptionDisabled:k,getOptionKey:A,getOptionLabel:j,isOptionEqualToValue:M,groupBy:N,handleHomeEndKeys:P=!n.freeSolo,id:F,includeInputInList:I=!1,inputValue:L,limitTags:R=-1,ListboxComponent:ee,ListboxProps:z,loading:te=!1,loadingText:B=`Loading…`,multiple:V=!1,noOptionsText:ne=`No options`,onChange:re,onClose:ie,onHighlightChange:ae,onInputChange:oe,onOpen:se,open:ce,openOnFocus:le=!1,openText:ue=`Open`,options:H,PaperComponent:de,PopperComponent:fe,popupIcon:U=fde||=(0,G.jsx)(aS,{}),readOnly:pe=!1,renderGroup:me,renderInput:W,renderOption:he,renderTags:ge,renderValue:_e,selectOnFocus:ve=!n.freeSolo,size:ye=`medium`,slots:be={},slotProps:xe={},value:Se,...Ce}=n,{getRootProps:we,getInputProps:Te,getInputLabelProps:Ee,getPopupIndicatorProps:De,getClearProps:Oe,getItemProps:ke,getListboxProps:Ae,getOptionProps:je,value:Me,dirty:Ne,expanded:Pe,id:Fe,popupOpen:Ie,focused:Le,focusedItem:Re,anchorEl:ze,setAnchorEl:Be,inputValue:Ve,groupedOptions:He}=ode({...n,componentName:`Autocomplete`}),Ue=!g&&!v&&Ne&&!pe,We=(!E||T===!0)&&T!==!1,{onMouseDown:Ge}=Te(),{ref:Ke,...qe}=Ae(),Je=j||(e=>e.label??e),Ye={...n,disablePortal:x,expanded:Pe,focused:Le,fullWidth:D,getOptionLabel:Je,hasClearIcon:Ue,hasPopupIcon:We,inputFocused:Re===-1,popupOpen:Ie,size:ye},Xe=pde(Ye),Ze={slots:{paper:de,popper:fe,...be},slotProps:{chip:s,listbox:z,...m,...xe}},[Qe,$e]=Hm(`root`,{ref:t,className:[Xe.root,c],elementType:mde,externalForwardedProps:{...Ze,...Ce},getSlotProps:we,ownerState:Ye}),[et,tt]=Hm(`listbox`,{elementType:Sde,externalForwardedProps:Ze,ownerState:Ye,className:Xe.listbox,additionalProps:qe,ref:Ke}),[nt,rt]=Hm(`paper`,{elementType:Wm,externalForwardedProps:Ze,ownerState:Ye,className:Xe.paper}),[it,at]=Hm(`popper`,{elementType:ab,externalForwardedProps:Ze,ownerState:Ye,className:Xe.popper,additionalProps:{disablePortal:x,style:{width:ze?ze.clientWidth:null},role:`presentation`,anchorEl:ze,open:Ie}}),[ot,st]=Hm(`clearIndicator`,{elementType:gde,externalForwardedProps:Ze,ownerState:Ye,className:Xe.clearIndicator,shouldForwardComponentProp:!0,additionalProps:{...Oe(),"aria-label":f,title:f}}),[ct,lt]=Hm(`popupIndicator`,{elementType:_de,externalForwardedProps:Ze,ownerState:Ye,className:Xe.popupIndicator,shouldForwardComponentProp:!0,additionalProps:{...De(),disabled:v,"aria-label":Ie?p:ue,title:Ie?p:ue}}),ut,dt=e=>({className:Xe.tag,disabled:v,...ke(e)});if(V?Me.length>0&&(ut=ge?ge(Me,dt,Ye):_e?_e(Me,dt,Ye):Me.map((e,t)=>{let{key:n,...r}=dt({index:t});return(0,G.jsx)(Ev,{label:Je(e),size:ye,...r,...Ze.slotProps.chip},n)})):_e&&Me!=null&&(ut=_e(Me,dt,Ye)),R>-1&&Array.isArray(ut)){let e=ut.length-R;!Le&&e>0&&(ut=ut.splice(0,R),ut.push((0,G.jsx)(`span`,{className:Xe.tag,children:O(e)},ut.length)))}let ft=me||(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(Cde,{className:Xe.groupLabel,ownerState:Ye,component:`div`,children:e.group}),(0,G.jsx)(wde,{className:Xe.groupUl,ownerState:Ye,children:e.children})]},e.key)),pt=he||((e,t)=>{let{key:n,...r}=e;return(0,G.jsx)(`li`,{...r,children:Je(t)},n)}),mt=(e,t)=>{let n=je({option:e,index:t});return pt({...n,className:Xe.option},e,{selected:n[`aria-selected`],index:t,inputValue:Ve},Ye)};return(0,G.jsxs)(C.Fragment,{children:[(0,G.jsx)(Qe,{...$e,children:W({id:Fe,disabled:v,fullWidth:n.fullWidth??!0,size:ye===`small`?`small`:void 0,InputLabelProps:Ee(),InputProps:{ref:Be,className:Xe.inputRoot,startAdornment:ut,onMouseDown:e=>{e.target===e.currentTarget&&Ge(e)},...(Ue||We)&&{endAdornment:(0,G.jsxs)(hde,{className:Xe.endAdornment,ownerState:Ye,children:[Ue?(0,G.jsx)(ot,{...st,children:l}):null,We?(0,G.jsx)(ct,{...lt,children:U}):null]})}},inputProps:{className:Xe.input,disabled:v,readOnly:pe,...Te()}})}),ze?(0,G.jsx)(vde,{as:it,...at,children:(0,G.jsxs)(yde,{as:nt,...rt,children:[te&&He.length===0?(0,G.jsx)(bde,{className:Xe.loading,ownerState:Ye,children:B}):null,He.length===0&&!E&&!te?(0,G.jsx)(xde,{className:Xe.noOptions,ownerState:Ye,role:`presentation`,onMouseDown:e=>{e.preventDefault()},children:ne}):null,He.length>0?(0,G.jsx)(et,{as:ee,...tt,children:He.map((e,t)=>N?ft({key:e.key,group:e.group,children:e.options.map((t,n)=>mt(t,e.index+n))}):mt(e,t))}):null]})}):null]})});function Tde(e){return Jd(`MuiSwitch`,e)}var GS=Yd(`MuiSwitch`,[`root`,`edgeStart`,`edgeEnd`,`switchBase`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`,`checked`,`disabled`,`input`,`thumb`,`track`]),Ede=e=>{let{classes:t,edge:n,size:r,color:i,checked:a,disabled:o}=e,s=Cp({root:[`root`,n&&`edge${Y(n)}`,`size${Y(r)}`],switchBase:[`switchBase`,`color${Y(i)}`,a&&`checked`,o&&`disabled`],thumb:[`thumb`],track:[`track`],input:[`input`]},Tde,t);return{...t,...s}},Dde=J(`span`,{name:`MuiSwitch`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.edge&&t[`edge${Y(n.edge)}`],t[`size${Y(n.size)}`]]}})({display:`inline-flex`,width:58,height:38,overflow:`hidden`,padding:12,boxSizing:`border-box`,position:`relative`,flexShrink:0,zIndex:0,verticalAlign:`middle`,"@media print":{colorAdjust:`exact`},variants:[{props:{edge:`start`},style:{marginLeft:-8}},{props:{edge:`end`},style:{marginRight:-8}},{props:{size:`small`},style:{width:40,height:24,padding:7,[`& .${GS.thumb}`]:{width:16,height:16},[`& .${GS.switchBase}`]:{padding:4,[`&.${GS.checked}`]:{transform:`translateX(16px)`}}}}]}),Ode=J(xv,{name:`MuiSwitch`,slot:`SwitchBase`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.switchBase,{[`& .${GS.input}`]:t.input},n.color!=="default"&&t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({position:`absolute`,top:0,left:0,zIndex:1,color:e.vars?e.vars.palette.Switch.defaultColor:`${e.palette.mode===`light`?e.palette.common.white:e.palette.grey[300]}`,transition:e.transitions.create([`left`,`transform`],{duration:e.transitions.duration.shortest}),[`&.${GS.checked}`]:{transform:`translateX(20px)`},[`&.${GS.disabled}`]:{color:e.vars?e.vars.palette.Switch.defaultDisabledColor:`${e.palette.mode===`light`?e.palette.grey[100]:e.palette.grey[600]}`},[`&.${GS.checked} + .${GS.track}`]:{opacity:.5},[`&.${GS.disabled} + .${GS.track}`]:{opacity:e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`},[`& .${GS.input}`]:{left:`-100%`,width:`300%`}})),Fm(({theme:e})=>({"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[...Object.entries(e.palette).filter(Um([`light`])).map(([t])=>({props:{color:t},style:{[`&.${GS.checked}`]:{color:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${GS.disabled}`]:{color:e.vars?e.vars.palette.Switch[`${t}DisabledColor`]:`${e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.55)}`}},[`&.${GS.checked} + .${GS.track}`]:{backgroundColor:(e.vars||e).palette[t].main}}}))]}))),kde=J(`span`,{name:`MuiSwitch`,slot:`Track`})(Fm(({theme:e})=>({height:`100%`,width:`100%`,borderRadius:14/2,boxSizing:`border-box`,border:`1px solid transparent`,zIndex:-1,transition:e.transitions.create([`opacity`,`background-color`],{duration:e.transitions.duration.shortest}),backgroundColor:e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,opacity:e.vars?e.vars.opacity.switchTrack:`${e.palette.mode===`light`?.38:.3}`}))),Ade=J(`span`,{name:`MuiSwitch`,slot:`Thumb`})(Fm(({theme:e})=>({boxShadow:(e.vars||e).shadows[1],backgroundColor:`currentColor`,boxSizing:`border-box`,border:`1px solid transparent`,width:20,height:20,borderRadius:`50%`}))),KS=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiSwitch`}),{className:r,color:i=`primary`,edge:a=!1,size:o=`medium`,sx:s,slots:c={},slotProps:l={},...u}=n,d={...n,color:i,edge:a,size:o},f=Ede(d),p={slots:c,slotProps:l},[m,h]=Hm(`root`,{className:K(f.root,r),elementType:Dde,externalForwardedProps:p,ownerState:d,additionalProps:{sx:s}}),[g,_]=Hm(`thumb`,{className:f.thumb,elementType:Ade,externalForwardedProps:p,ownerState:d}),v=(0,G.jsx)(g,{..._}),[y,b]=Hm(`track`,{className:f.track,elementType:kde,externalForwardedProps:p,ownerState:d});return(0,G.jsxs)(m,{...h,children:[(0,G.jsx)(Ode,{type:`checkbox`,icon:v,checkedIcon:v,ref:t,ownerState:d,...u,classes:{...f,root:f.switchBase},slots:{...c.switchBase&&{root:c.switchBase},...c.input&&{input:c.input}},slotProps:{...l.switchBase&&{root:typeof l.switchBase==`function`?l.switchBase(d):l.switchBase},input:{role:`switch`},...l.input&&{input:typeof l.input==`function`?l.input(d):l.input}}}),(0,G.jsx)(y,{...b})]})}),qS=[{key:`apple`,label:`Apple Home`,short:`A`},{key:`google`,label:`Google Home`,short:`G`},{key:`alexa`,label:`Alexa`,short:`X`},{key:`aqara`,label:`Aqara Home`,short:`Q`}],jde={yes:`#2e7d32`,partial:`#ed6c02`,no:`#9e9e9e`,unknown:`#9e9e9e`},Mde={yes:`works`,partial:`partly works`,no:`not supported`,unknown:`unverified`};function JS({type:e}){let t=iv[e];return t?(0,G.jsx)(Z,{sx:{display:`inline-flex`,gap:.5,ml:1},children:qS.map(e=>{let n=t[e.key];return(0,G.jsx)(Z,{component:`span`,title:`${e.label}: ${Mde[n]}`,sx:{width:18,height:18,borderRadius:`50%`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontSize:11,fontWeight:600,color:`#fff`,bgcolor:jde[n],opacity:n===`yes`||n===`partial`?1:.45},children:e.short},e.key)})}):null}function YS(e){let t=iv[e];if(!t)return;let n=qS.filter(e=>t[e.key]===`no`).map(e=>e.label),r=[];return n.length===1?r.push(`${n[0]} does not support this type, so it may not show up there.`):n.length>1&&r.push(`${n.join(` and `)} do not support this type, so it may not show up there.`),t.note&&r.push(t.note),r.length>0?r.join(` `):void 0}function XS({value:e,onChange:t,label:n,placeholder:r,helperText:i,domain:a,fullWidth:o=!0,margin:s=`normal`}){let[c,l]=(0,C.useState)([]),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(e),m=(0,C.useRef)(void 0),h=(0,C.useRef)(e),g=(0,C.useCallback)(async e=>{d(!0);try{let t=new URLSearchParams({limit:`50`});a&&t.set(`domain`,a),e&&t.set(`search`,e);let n=await fetch(`api/home-assistant/entities?${t.toString()}`);n.ok&&l((await n.json()).entities??[])}catch{}finally{d(!1)}},[a]);(0,C.useEffect)(()=>{g(h.current)},[g]);let _=(0,C.useCallback)((e,n,r)=>{p(n),r===`input`&&t(n),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{g(n)},300)},[g,t]),v=(0,C.useCallback)((e,n)=>{t(n?typeof n==`string`?n:n.entity_id:``)},[t]);return(0,G.jsx)(WS,{freeSolo:!0,options:c,getOptionLabel:e=>typeof e==`string`?e:e.entity_id,renderOption:(e,t)=>{let{key:n,...r}=e;return(0,G.jsx)(`li`,{...r,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Q,{variant:`body2`,children:t.entity_id}),t.friendly_name&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:t.friendly_name})]})},n)},isOptionEqualToValue:(e,t)=>(typeof e==`string`?e:e.entity_id)===(typeof t==`string`?t:t.entity_id),value:e||null,inputValue:f,onInputChange:_,onChange:v,loading:u,filterOptions:e=>e,renderInput:e=>(0,G.jsx)(ES,{...e,label:n,placeholder:r,helperText:i,fullWidth:o,margin:s,slotProps:{input:{...e.InputProps,endAdornment:(0,G.jsxs)(G.Fragment,{children:[u?(0,G.jsx)(Rh,{color:`inherit`,size:18}):null,e.InputProps.endAdornment]})}}})})}function Nde(e){let t=e.trim();if(!t)return;let n=t.startsWith(`0x`)||t.startsWith(`0X`)?Number.parseInt(t.slice(2),16):Number(t);if(!(!Number.isInteger(n)||n<1||n>65534))return n}function ZS(e){let t=e.trim();if(!t)return{value:void 0,valid:!0};try{let e=JSON.parse(t);return e&&typeof e==`object`&&!Array.isArray(e)?{value:e,valid:!0}:{valid:!1}}catch{return{valid:!1}}}function Pde(e){let t=e.trim();if(!t)return;let n=Number(t);if(!(!Number.isFinite(n)||n<=0))return Math.min(5e3,Math.round(n))}function Fde(e){let t=e.trim();if(!t)return;let n=Number(t);if(!(!Number.isFinite(n)||n<=0))return Math.min(6e4,Math.round(n))}function QS({open:e,entityId:t,domain:n,currentMapping:r,onSave:i,onClose:a}){let{t:o}=ws(),[s,c]=(0,C.useState)(t),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(!1),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(``),[M,N]=(0,C.useState)(``),[P,F]=(0,C.useState)(``),[I,L]=(0,C.useState)([]),[R,ee]=(0,C.useState)(!1),[z,te]=(0,C.useState)(``),[B,V]=(0,C.useState)(``),[ne,re]=(0,C.useState)(``),[ie,ae]=(0,C.useState)(``),[oe,se]=(0,C.useState)(``),[ce,le]=(0,C.useState)(``),[ue,H]=(0,C.useState)(``),[de,fe]=(0,C.useState)(!1),[U,pe]=(0,C.useState)([]),[me,W]=(0,C.useState)([]),[he,ge]=(0,C.useState)(``),[_e,ve]=(0,C.useState)(!1),[ye,be]=(0,C.useState)(!1),[xe,Se]=(0,C.useState)(``),[Ce,we]=(0,C.useState)(``),[Te,Ee]=(0,C.useState)(!1),[De,Oe]=(0,C.useState)(!1),[ke,Ae]=(0,C.useState)(!1),[je,Me]=(0,C.useState)(!1),[Ne,Pe]=(0,C.useState)(!1),[Fe,Ie]=(0,C.useState)(``),Le=(0,C.useRef)(0),[Re,ze]=(0,C.useState)([]),[Be,Ve]=(0,C.useState)([]),[He,Ue]=(0,C.useState)(!1),We=!t,[Ge,Ke]=(0,C.useState)([]),[qe,Je]=(0,C.useState)(``),[Ye,Xe]=(0,C.useState)(``),Ze=(0,C.useMemo)(()=>Object.entries(av).filter(([e,t])=>typeof t==`number`&&t!==av.Vacuum&&t!==av.Mop&&t!==av.VacuumThenMop).map(([e,t])=>({label:e,value:t})),[]);(0,C.useEffect)(()=>{e&&(c(t),u(r?.matterDeviceType||``),f(r?.customName||``),m(r?.customProductName||``),g(r?.customVendorName||``),v(r?.customSerialNumber||``),b(r?.customVendorId===void 0?``:`0x${r.customVendorId.toString(16).toUpperCase()}`),S(r?.disabled||!1),T(r?.filterLifeEntity||``),D(r?.cleaningModeEntity||``),k(r?.temperatureEntity||``),j(r?.humidityEntity||``),N(r?.pressureEntity||``),F(r?.batteryEntity||``),L(r?.roomEntities||[]),ee(r?.disableLockPin||!1),te(r?.powerEntity||``),V(r?.energyEntity||``),re(r?.suctionLevelEntity||``),ae(r?.mopIntensityEntity||``),se(r?.currentRoomEntity||``),le(r?.chargingStateEntity||``),H(r?.cleanedAreaEntity||``),fe(r?.disableCustomAreaRoomModes||!1),pe(r?.customServiceAreas||[]),W((r?.customServiceAreas||[]).map(e=>e.data?JSON.stringify(e.data):``)),ge(r?.valetudoIdentifier||``),ve(r?.coverSwapOpenClose||!1),be(r?.coverExposeAsDimmableLight||!1),Se(r?.coverSliderDebounceMs==null?``:String(r.coverSliderDebounceMs)),we(r?.updateThrottleMs==null?``:String(r.updateThrottleMs)),Ee(r?.disableClimateOnOff||!1),Oe(r?.disableClimateFanControl||!1),Ae(r?.climateKeepModeOnIdle||!1),Me(r?.climateExposeFan||!1),Pe(r?.fanRestoreSpeedOnPowerOn||!1),Ie(r?.climateAutoMode||``),Le.current=0,ze((r?.composedEntities||[]).map(e=>({...e,_key:Le.current++}))),Ve([]),Ke(Object.entries(r?.customFanSpeedTags||{}).map(([e,t])=>({option:e,tag:t}))),Je((r?.fanWindPresets?.natural||[]).join(`, `)),Xe((r?.fanWindPresets?.sleep||[]).join(`, `)))},[e,t,r]),(0,C.useEffect)(()=>{!e||!t||n!==`vacuum`||(async()=>{Ue(!0);try{let e=await fetch(`api/home-assistant/related-buttons/${encodeURIComponent(t)}`);e.ok&&Ve((await e.json()).buttons||[])}catch(e){console.error(`Failed to load related buttons:`,e)}finally{Ue(!1)}})()},[e,t,n]);let Qe=s.split(`.`)[0]||n,$e=(0,C.useCallback)(()=>{if(!s.trim())return;let e=Ge.reduce((e,t)=>(t.option.trim()&&(e[t.option.trim()]=t.tag),e),{}),t=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),n=t(qe),r=t(Ye),a=n.length>0||r.length>0?{natural:n.length>0?n:void 0,sleep:r.length>0?r:void 0}:void 0;i({entityId:s.trim(),matterDeviceType:l||void 0,customName:d.trim()||void 0,customProductName:p.trim()||void 0,customVendorName:h.trim()||void 0,customSerialNumber:_.trim()||void 0,customVendorId:Nde(y),disabled:x,filterLifeEntity:w.trim()||void 0,cleaningModeEntity:E.trim()||void 0,temperatureEntity:O.trim()||void 0,humidityEntity:A.trim()||void 0,pressureEntity:M.trim()||void 0,batteryEntity:P.trim()||void 0,roomEntities:I.length>0?I:void 0,customServiceAreas:U.length>0?U:void 0,disableLockPin:R||void 0,powerEntity:z.trim()||void 0,energyEntity:B.trim()||void 0,suctionLevelEntity:ne.trim()||void 0,mopIntensityEntity:ie.trim()||void 0,currentRoomEntity:oe.trim()||void 0,chargingStateEntity:ce.trim()||void 0,cleanedAreaEntity:ue.trim()||void 0,disableCustomAreaRoomModes:de||void 0,customFanSpeedTags:Object.keys(e).length>0?e:void 0,fanWindPresets:a,valetudoIdentifier:he.trim()||void 0,coverSwapOpenClose:_e||void 0,coverExposeAsDimmableLight:ye||void 0,coverSliderDebounceMs:Pde(xe),updateThrottleMs:Fde(Ce),disableClimateOnOff:Te||void 0,disableClimateFanControl:De||void 0,climateKeepModeOnIdle:ke||void 0,climateExposeFan:je||void 0,fanRestoreSpeedOnPowerOn:Ne||void 0,climateAutoMode:Fe||void 0,composedEntities:Re.filter(e=>e.entityId?.trim()).length>0?Re.filter(e=>e.entityId?.trim()).map(({_key:e,...t})=>t):void 0})},[s,l,d,p,h,_,y,x,w,E,O,A,M,P,I,R,z,B,ne,ie,oe,ce,ue,de,U,Ge,qe,Ye,he,_e,ye,xe,Ce,Te,De,ke,je,Ne,Fe,Re,i]),et=l===`air_purifier`||Qe===`fan`&&!l,tt=Qe===`fan`&&(!l||l===`fan`),nt=Qe===`vacuum`,rt=Qe===`vacuum`&&s.startsWith(`vacuum.valetudo_`),it=Qe===`vacuum`,at=l===`temperature_sensor`||Qe===`sensor`&&!l,ot=l===`air_purifier`,st=l===`window_covering`||Qe===`cover`,ct=l===`door_lock`||Qe===`lock`,lt=l===`thermostat`||Qe===`climate`,ut=l!==`on_off_switch`&&(Qe===`switch`||Qe===`light`||l===`on_off_plugin_unit`||l===`dimmable_plugin_unit`),dt=Object.entries(rv),ft=uie[Qe]||[];return(0,G.jsxs)(Rb,{open:e,onClose:a,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:We?o(`mapping.addMapping`):`${o(`common.edit`)}: ${t}`}),(0,G.jsxs)(Bb,{children:[We&&(0,G.jsx)(XS,{value:s,onChange:c,label:`Entity ID`,placeholder:`light.living_room`,helperText:`Search or enter the Home Assistant entity ID (e.g., light.living_room)`}),(0,G.jsxs)(kv,{fullWidth:!0,margin:`normal`,children:[(0,G.jsx)(Bx,{id:`matter-device-type-label`,children:`Matter Device Type`}),(0,G.jsxs)(SS,{labelId:`matter-device-type-label`,value:l,label:`Matter Device Type`,onChange:e=>u(e.target.value),renderValue:e=>e?rv[e]:(0,G.jsx)(`em`,{children:o(`mapping.autoDetect`)}),children:[(0,G.jsx)(CS,{value:``,children:(0,G.jsx)(`em`,{children:o(`mapping.autoDetect`)})}),ft.length>0&&(0,G.jsxs)(CS,{disabled:!0,children:[`Suggested for `,n]}),ft.map(e=>(0,G.jsxs)(CS,{value:e,children:[rv[e],(0,G.jsx)(JS,{type:e})]},e)),ft.length>0&&(0,G.jsx)(CS,{disabled:!0,children:`All types`}),dt.filter(([e])=>!ft.includes(e)).map(([e,t])=>(0,G.jsxs)(CS,{value:e,children:[t,(0,G.jsx)(JS,{type:e})]},e))]})]}),l!==``&&YS(l)&&(0,G.jsx)(Uh,{severity:`info`,sx:{mt:1},children:YS(l)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:`Custom Name`,placeholder:t,value:d,onChange:e=>f(e.target.value),helperText:`Override the entity name shown in Matter controllers`}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customProductName`),value:p,onChange:e=>m(e.target.value),helperText:o(`mapping.customProductNameHelp`)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customVendorName`),value:h,onChange:e=>g(e.target.value),helperText:o(`mapping.customVendorNameHelp`)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customSerialNumber`),value:_,onChange:e=>v(e.target.value),helperText:o(`mapping.customSerialNumberHelp`)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:o(`mapping.customVendorId`),placeholder:`0x115F`,value:y,onChange:e=>b(e.target.value),helperText:o(`mapping.customVendorIdHelp`)}),et&&(0,G.jsx)(XS,{value:w,onChange:T,label:`Filter Life Sensor (optional)`,placeholder:`sensor.air_purifier_filter_life`,helperText:`Sensor entity that provides filter life percentage (0-100%) for HEPA filter monitoring`,domain:`sensor`}),tt&&(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Wind Preset Mapping (optional)`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Map localized preset names to Matter wind modes. Comma-separated HA preset names, e.g. 自然风 for natural wind.`}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,size:`small`,label:`Natural Wind Presets`,placeholder:`自然风, Natural`,value:qe,onChange:e=>Je(e.target.value)}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,size:`small`,label:`Sleep Wind Presets`,placeholder:`睡眠风, Sleep`,value:Ye,onChange:e=>Xe(e.target.value)})]}),Qe===`fan`&&(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:Ne,onChange:e=>Pe(e.target.checked)}),label:`Restore the last fan speed when turned on (Apple Home's power button injects 100%). Only a 100% or High command while off is treated as power-on; lower speeds set while off are kept, so you cannot start an off fan at full speed.`,sx:{mt:1,display:`block`}}),nt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:E,onChange:D,label:`Cleaning Mode Entity (optional)`,placeholder:`select.vacuum_cleaning_mode`,helperText:`Select entity that controls the vacuum cleaning mode (e.g., select.r2_d2_cleaning_mode for Dreame vacuums)`,domain:`select`}),(0,G.jsx)(XS,{value:ne,onChange:re,label:`Suction Level Entity (optional)`,placeholder:`select.vacuum_suction_level`,helperText:`Select entity that controls suction level. Adds Quiet/Max intensity options to Apple Home's extra features panel.`,domain:`select`}),(0,G.jsx)(XS,{value:ie,onChange:ae,label:`Mop Intensity Entity (optional)`,placeholder:`select.vacuum_mop_pad_humidity`,helperText:`Select entity that controls mop water level / intensity. Adds intensity options when mopping in Apple Home.`,domain:`select`}),(0,G.jsx)(XS,{value:oe,onChange:se,label:`Current Room Entity (optional)`,placeholder:`sensor.vacuum_current_room`,helperText:`Sensor that reports which room the vacuum is currently in (e.g. Dreame current_room sensor). Enables dynamic room progress tracking during multi-room cleaning.`,domain:`sensor`}),(0,G.jsx)(XS,{value:ce,onChange:le,label:`Charging State Entity (optional)`,placeholder:`sensor.vacuum_charging_state`,helperText:`Sensor reporting the charging state (e.g. Xiaomi charging_state: charging / not_charging / full). Drives the Matter charge state directly instead of inferring it from docked + battery level.`,domain:`sensor`}),(0,G.jsx)(XS,{value:ue,onChange:H,label:`Cleaned Area Sensor (m², optional)`,placeholder:`sensor.vacuum_cleaned_area`,helperText:`Sensor reporting cumulative cleaned area in m². With a Size (m²) set on each area, advances room progress for batch vacuums that report area but not the current room.`,domain:`sensor`}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:de,onChange:e=>fe(e.target.checked)}),label:`Don't expose custom areas as per-room cleaning modes (forces Apple Home to use the multi-room area picker). Keep off for Google Home / Alexa, which rely on the modes.`,sx:{mt:1,display:`block`}}),rt&&(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:`Valetudo MQTT Identifier (optional)`,placeholder:`GentleFinishedSpider`,value:he,onChange:e=>ge(e.target.value),helperText:`Exact identifier from Valetudo Connectivity → MQTT. Only needed if it differs from the lowercase entity ID.`}),(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Custom Tag Mapping`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Map home assistant speeds to matter tags. When configured these will override default speeds.`}),Ge.map((e,t)=>(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,mb:1,alignItems:`flex-start`},children:[(0,G.jsx)(ES,{size:`small`,label:`HA Option (e.g. Max+)`,value:e.option,onChange:n=>{let r=[...Ge];r[t]={...e,option:n.target.value},Ke(r)}}),(0,G.jsxs)(kv,{size:`small`,sx:{flex:1},children:[(0,G.jsx)(Bx,{children:`Matter Tag`}),(0,G.jsx)(SS,{value:e.tag,label:`Matter Tag`,onChange:n=>{let r=[...Ge];r[t]={...e,tag:n.target.value},Ke(r)},children:Ze.map(e=>(0,G.jsx)(CS,{value:e.value,children:e.label},e.value))})]}),(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>{Ke(Ge.filter((e,n)=>n!==t))},children:(0,G.jsx)(LS,{fontSize:`small`})})]},`${e.option}-${e.tag}`)),(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(IS,{}),onClick:()=>Ke([...Ge,{option:``,tag:av.Auto}]),children:`Add Tag Mapping`})]})]}),it&&U.length===0&&(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Room Button Entities (Roborock)`}),(0,G.jsx)(WS,{multiple:!0,options:Be,getOptionLabel:e=>typeof e==`string`?e:e.friendly_name||e.clean_name,value:Be.filter(e=>I.includes(e.entity_id)),onChange:(e,t)=>{L(t.map(e=>typeof e==`string`?e:e.entity_id))},loading:He,freeSolo:!0,renderTags:(e,t)=>e.map((e,n)=>(0,C.createElement)(Ev,{label:typeof e==`string`?e:e.friendly_name||e.clean_name,size:`small`,...t({index:n}),key:typeof e==`string`?e:e.entity_id})),renderInput:e=>(0,G.jsx)(ES,{...e,variant:`outlined`,placeholder:He?`Loading buttons...`:`Select room buttons or type entity ID`,helperText:`Select button entities that trigger room cleaning (e.g., button.roborock_clean_kitchen). These appear as rooms in Apple Home.`,InputProps:{...e.InputProps,endAdornment:(0,G.jsxs)(G.Fragment,{children:[He?(0,G.jsx)(Rh,{color:`inherit`,size:20}):null,e.InputProps.endAdornment]})}})}),Be.length===0&&!He&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:`No button entities found for this device. You can manually enter entity IDs.`})]}),at&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:A,onChange:j,label:`Humidity Sensor (optional)`,placeholder:`sensor.h_t_bad_humidity`,helperText:`Combine with a humidity sensor to create a single Temperature+Humidity device`,domain:`sensor`}),(0,G.jsx)(XS,{value:M,onChange:N,label:`Pressure Sensor (optional)`,placeholder:`sensor.h_t_bad_pressure`,helperText:`Combine with a pressure sensor to create a single Temperature+Pressure device`,domain:`sensor`}),(0,G.jsx)(XS,{value:P,onChange:F,label:`Battery Sensor (optional)`,placeholder:`sensor.h_t_bad_battery`,helperText:`Include battery level from a separate sensor entity`,domain:`sensor`})]}),ot&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:O,onChange:k,label:`Temperature Sensor (optional)`,placeholder:`sensor.air_purifier_temperature`,helperText:`Add temperature measurement to this air purifier from a separate sensor entity`,domain:`sensor`}),(0,G.jsx)(XS,{value:A,onChange:j,label:`Humidity Sensor (optional)`,placeholder:`sensor.air_purifier_humidity`,helperText:`Add humidity measurement to this air purifier from a separate sensor entity`,domain:`sensor`})]}),ut&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(XS,{value:z,onChange:te,label:`Power Sensor (optional)`,placeholder:`sensor.smart_plug_power`,helperText:`Sensor with device_class: power (W), adds real-time power measurement to this device`,domain:`sensor`}),(0,G.jsx)(XS,{value:B,onChange:V,label:`Energy Sensor (optional)`,placeholder:`sensor.smart_plug_energy`,helperText:`Sensor with device_class: energy (kWh), adds cumulative energy measurement to this device`,domain:`sensor`})]}),it&&(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Custom Service Areas`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Define custom zones mapped to HA service calls. Works for lawn mowers, pool cleaners, or any zone-based robot. When configured, these replace auto-detected rooms. Data is extra JSON sent with the call. Batch fires one combined call for all selected zones instead of one per zone.`}),U.map((e,t)=>{let n=ZS(me[t]??``).valid;return(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:1,mb:2},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,alignItems:`flex-start`},children:[(0,G.jsx)(ES,{size:`small`,label:`Name`,value:e.name,onChange:n=>{let r=[...U];r[t]={...e,name:n.target.value},pe(r)},sx:{flex:1}}),(0,G.jsx)(ES,{size:`small`,label:`Service`,placeholder:`script.start_zone`,value:e.service,onChange:n=>{let r=[...U];r[t]={...e,service:n.target.value},pe(r)},sx:{flex:1}}),(0,G.jsx)(ES,{size:`small`,label:`Target (optional)`,placeholder:`button.zone_1`,value:e.target||``,onChange:n=>{let r=[...U];r[t]={...e,target:n.target.value||void 0},pe(r)},sx:{flex:1}}),(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>{pe(U.filter((e,n)=>n!==t)),W(me.filter((e,n)=>n!==t))},children:(0,G.jsx)(LS,{fontSize:`small`})})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,alignItems:`center`},children:[(0,G.jsx)(ES,{size:`small`,label:`Data (JSON, optional)`,placeholder:`{"segments": [16, 17]}`,value:me[t]??``,error:!n,helperText:n?void 0:`Invalid JSON object`,onChange:n=>{let r=n.target.value,i=[...me];i[t]=r,W(i);let{value:a,valid:o}=ZS(r);if(!o)return;let{data:s,...c}=e,l=[...U];l[t]=a===void 0?c:{...c,data:a},pe(l)},sx:{flex:2}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{size:`small`,checked:e.batchDispatch??!1,onChange:n=>{let r=[...U];r[t]={...e,batchDispatch:n.target.checked||void 0},pe(r)}}),label:`Batch`}),(0,G.jsx)(ES,{size:`small`,type:`number`,label:`Size (m²)`,placeholder:`20`,value:e.sizeSqm==null?``:String(e.sizeSqm),onChange:n=>{let r=Number.parseFloat(n.target.value),i=[...U];i[t]={...e,sizeSqm:Number.isFinite(r)&&r>0?r:void 0},pe(i)},sx:{width:110}})]})]},`area-${e.name||t}`)}),(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(IS,{}),onClick:()=>{pe([...U,{name:``,service:``}]),W([...me,``])},children:`Add Area`})]}),st&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:_e,onChange:e=>ve(e.target.checked)}),label:`Swap open/close commands (for awnings and similar covers)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:ye,onChange:e=>be(e.target.checked)}),label:`Expose as a dimmable light (Alexa workaround: level = open %, on/off = open/close). Keep off for Apple / Google.`,sx:{mt:1,display:`block`}}),(0,G.jsx)(ES,{label:`Slider debounce (ms)`,type:`number`,size:`small`,value:xe,onChange:e=>Se(e.target.value),helperText:`Override for slow blinds. 0 / empty uses bridge setting (default 400/150ms two-phase). Try 800-1500 for sluggish covers. Max 5000.`,slotProps:{htmlInput:{min:0,max:5e3,step:50}},sx:{mt:1,display:`block`}})]}),ct&&(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:R,onChange:e=>ee(e.target.checked)}),label:`Disable PIN requirement for this lock`,sx:{mt:1,display:`block`}}),lt&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:Te,onChange:e=>Ee(e.target.checked)}),label:`Disable on/off for this climate entity (keeps the thermostat running when a room is turned off by voice)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:De,onChange:e=>Oe(e.target.checked)}),label:`Expose as plain Thermostat (drop FanControl), workaround for controllers like Aqara that don't recognise the air conditioner device type. Needs a full HAMH restart, then re-pair the bridge in the controller (Aqara caches the device list)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:ke,onChange:e=>Ae(e.target.checked)}),label:`Keep last mode on Matter while off + idle (workaround for ACs that report off + hvac_action=idle during internal cleaning, so the controller's Off button stays actionable)`,sx:{mt:1,display:`block`}}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:je,onChange:e=>Me(e.target.checked)}),label:`Expose a companion Fan device (adds a separate Apple Home fan tile for fan_only mode and speed, only for ACs with a fan mode, and re-pairs this AC once)`,sx:{mt:1,display:`block`}}),(0,G.jsxs)(kv,{size:`small`,sx:{mt:1,minWidth:260},children:[(0,G.jsx)(Bx,{id:`climate-auto-mode-label`,children:`Auto mode direction`}),(0,G.jsxs)(SS,{labelId:`climate-auto-mode-label`,value:Fe,label:`Auto mode direction`,onChange:e=>Ie(e.target.value||``),children:[(0,G.jsx)(CS,{value:``,children:(0,G.jsx)(`em`,{children:`Auto-detect`})}),(0,G.jsx)(CS,{value:`cool`,children:`Cool`}),(0,G.jsx)(CS,{value:`heat`,children:`Heat`})]})]})]}),(0,G.jsxs)(Z,{sx:{mt:2,mb:1},children:[(0,G.jsx)(Q,{variant:`subtitle2`,gutterBottom:!0,children:`Composed Sub-Entities`}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mb:1,display:`block`},children:`Group additional HA entities into this device. Each entity becomes a sub-endpoint under a shared Matter device. Requires the autoComposedDevices feature flag.`}),Re.map((e,t)=>(0,G.jsxs)(Z,{sx:{display:`flex`,gap:1,mb:1,alignItems:`flex-start`},children:[(0,G.jsx)(Z,{sx:{flex:2},children:(0,G.jsx)(XS,{value:e.entityId,onChange:n=>{let r=[...Re];r[t]={...e,entityId:n},ze(r)},label:`Entity ID`,placeholder:`sensor.temperature`})}),(0,G.jsxs)(kv,{size:`small`,sx:{flex:1,mt:1},children:[(0,G.jsx)(Bx,{children:`Device Type`}),(0,G.jsxs)(SS,{value:e.matterDeviceType||``,label:`Device Type`,onChange:n=>{let r=[...Re];r[t]={...e,matterDeviceType:n.target.value||void 0},ze(r)},children:[(0,G.jsx)(CS,{value:``,children:(0,G.jsx)(`em`,{children:`Auto-detect`})}),Object.entries(rv).map(([e,t])=>(0,G.jsx)(CS,{value:e,children:t},e))]})]}),(0,G.jsx)(Bh,{size:`small`,color:`error`,sx:{mt:1.5},onClick:()=>{ze(Re.filter((e,n)=>n!==t))},children:(0,G.jsx)(LS,{fontSize:`small`})})]},e._key)),(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(IS,{}),onClick:()=>ze([...Re,{entityId:``,_key:Le.current++}]),children:`Add Sub-Entity`})]}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:x,onChange:e=>S(e.target.checked)}),label:`Disable this entity (exclude from bridge)`}),(0,G.jsx)(ES,{fullWidth:!0,margin:`normal`,label:`Update throttle (ms, optional)`,type:`number`,value:Ce,onChange:e=>we(e.target.value),helperText:`Limit Matter updates for chatty sensors (power, energy) to one per N ms. Empty / 0 keeps the default. Max 60000.`,slotProps:{htmlInput:{min:0,max:6e4,step:100}}})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:a,children:o(`common.cancel`)}),(0,G.jsx)(mv,{onClick:$e,variant:`contained`,disabled:!s.trim(),children:o(`common.save`)})]})]})}var Ide=X([(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3.2`},`0`),(0,G.jsx)(`path`,{d:`M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5`},`1`)],`CameraAlt`),$S=X((0,G.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`}),`ExpandMore`),Lde=e=>{let t=e.toLowerCase();return t.includes(`light`)?`💡`:t.includes(`switch`)||t.includes(`plugin`)?`🔌`:t.includes(`lock`)?`🔒`:t.includes(`thermostat`)||t.includes(`temperature`)?`🌡️`:t.includes(`humidity`)?`💧`:t.includes(`pressure`)||t.includes(`sensor`)?`📊`:t.includes(`fan`)?`🌀`:t.includes(`cover`)||t.includes(`window`)?`🪟`:t.includes(`contact`)?`🚪`:t.includes(`occupancy`)?`👤`:t.includes(`smoke`)||t.includes(`alarm`)?`🚨`:t.includes(`water`)?`💧`:t.includes(`air`)?`🌬️`:`📱`},eC=(e,t)=>{let n=e.toLowerCase();return t?n.includes(`light`)?`#FFE082`:n.includes(`switch`)||n.includes(`plugin`)?`#81C784`:n.includes(`lock`)?`#64B5F6`:n.includes(`thermostat`)||n.includes(`temperature`)?`#FF8A65`:n.includes(`humidity`)?`#4FC3F7`:n.includes(`sensor`)?`#CE93D8`:n.includes(`fan`)?`#4DD0E1`:n.includes(`cover`)||n.includes(`window`)?`#A1887F`:n.includes(`contact`)?`#90A4AE`:n.includes(`occupancy`)?`#F48FB1`:`#BDBDBD`:n.includes(`light`)?`#F9A825`:n.includes(`switch`)||n.includes(`plugin`)?`#388E3C`:n.includes(`lock`)?`#1976D2`:n.includes(`thermostat`)||n.includes(`temperature`)?`#E64A19`:n.includes(`humidity`)?`#0288D1`:n.includes(`sensor`)?`#7B1FA2`:n.includes(`fan`)?`#00838F`:n.includes(`cover`)||n.includes(`window`)?`#5D4037`:n.includes(`contact`)?`#455A64`:n.includes(`occupancy`)?`#C2185B`:`#616161`},Rde=e=>{if(e==null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return String(e);if(typeof e==`string`)return e.length>80?`${e.slice(0,80)}…`:e;if(Array.isArray(e))return e.length===0?`[]`:`[${e.length} items]`;if(typeof e==`object`){let t=Object.keys(e);return t.length===0?`{}`:`{${t.length} keys}`}return String(e)},tC=({endpoint:e,bridgeName:t,bridgeId:n,onClick:r,onEditMapping:i,imageInfo:a,onImageChanged:o})=>{let{t:s}=ws(),c=wm().palette.mode===`dark`,l=Ax(e.state)??e.id.local,u=e.type.name,d=(0,C.useMemo)(()=>e.state.bridgedDeviceBasicInformation,[e.state])?.reachable??!0,f=(0,C.useMemo)(()=>e.state.homeAssistantEntity,[e.state]),p=f?.entity?.entity_id,m=f?.entity?.state?.state,h=m===`unavailable`||m===`unknown`,g=f?.mapping,_=(0,C.useMemo)(()=>{let e=[];return g?.batteryEntity&&e.push({label:`Battery`,entity:g.batteryEntity}),g?.humidityEntity&&e.push({label:`Humidity`,entity:g.humidityEntity}),g?.pressureEntity&&e.push({label:`Pressure`,entity:g.pressureEntity}),g?.powerEntity&&e.push({label:`Power`,entity:g.powerEntity}),g?.energyEntity&&e.push({label:`Energy`,entity:g.energyEntity}),e},[g]),v=(0,C.useMemo)(()=>{let e=new Set;return g?.batteryEntity&&e.add(`powerSource`),g?.humidityEntity&&e.add(`relativeHumidityMeasurement`),g?.pressureEntity&&e.add(`pressureMeasurement`),g?.powerEntity&&e.add(`electricalPowerMeasurement`),g?.energyEntity&&e.add(`electricalEnergyMeasurement`),e},[g]),y=(0,C.useMemo)(()=>e.state.powerSource,[e.state]),b=(0,C.useMemo)(()=>y?.batPercentRemaining==null?null:Math.round(y.batPercentRemaining/2),[y]),x=y?.batChargeState===1||y?.batChargeState===2,[S,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(0),k=(0,C.useRef)(null),A=a&&a.source!==`none`&&!T,j=(0,C.useMemo)(()=>{if(!(!a||a.source===`none`)){if(a.source===`custom`&&p)return`${$ue(p)}?v=${D}`;if(a.source===`z2m`&&a.z2mUrl)return a.z2mUrl}},[a,p,D]),M=(0,C.useCallback)(e=>{e.stopPropagation(),k.current?.click()},[]),N=(0,C.useCallback)(async e=>{let t=e.target.files?.[0];if(!(!t||!p)){try{await Zue(p,t),E(!1),O(e=>e+1),o?.()}catch(e){console.error(`Failed to upload device image:`,e)}k.current&&(k.current.value=``)}},[p,o]),P=(0,C.useCallback)(async e=>{if(e.stopPropagation(),p)try{await Que(p),E(!1),O(e=>e+1),o?.()}catch(e){console.error(`Failed to delete device image:`,e)}},[p,o]),F=(0,C.useMemo)(()=>Object.keys(e.state).filter(e=>![`homeAssistantEntity`,`bridgedDeviceBasicInformation`,`identify`].includes(e)),[e.state]),I=(0,C.useMemo)(()=>{let t=e.state,n=[],r=t.onOff,i=t.levelControl,a=t.thermostat,o=t.colorControl,s=t.fanControl,c=t.temperatureMeasurement,l=t.relativeHumidityMeasurement,u=t.pressureMeasurement,d=t.illuminanceMeasurement,f=t.carbonDioxideConcentrationMeasurement,p=t.pm25ConcentrationMeasurement,m=t.totalVolatileOrganicCompoundsConcentrationMeasurement,h=t.windowCovering,g=t.doorLock,_=t.booleanState;if(r?.onOff!==void 0&&n.push({label:r.onOff?`On`:`Off`,color:r.onOff?`success`:`default`}),i?.currentLevel!==void 0){let e=Math.round(i.currentLevel/254*100);n.push({label:`${e}%`})}if(o?.colorTemperatureMireds!=null&&o.colorTemperatureMireds>0){let e=Math.round(1e6/o.colorTemperatureMireds);n.push({label:`${e}K`})}if(a?.localTemperature!=null){let e=a.localTemperature/100;n.push({label:`${e.toFixed(1)}°C`})}if(a?.systemMode!==void 0){let e={0:`Off`,1:`Auto`,3:`Cool`,4:`Heat`,7:`Fan`,8:`Dry`}[a.systemMode];e&&n.push({label:e,color:a.systemMode===0?`default`:`info`})}if(c?.measuredValue!=null){let e=c.measuredValue/100;n.push({label:`${e.toFixed(1)}°C`})}if(l?.measuredValue!=null){let e=l.measuredValue/100;n.push({label:`${e.toFixed(0)}% RH`})}if(u?.measuredValue!=null&&n.push({label:`${u.measuredValue} hPa`}),d?.measuredValue!=null&&d.measuredValue>0){let e=Math.round(10**((d.measuredValue-1)/1e4));n.push({label:`${e} lx`})}if(f?.measuredValue!=null&&n.push({label:`${Math.round(f.measuredValue)} ppm CO2`}),p?.measuredValue!=null&&n.push({label:`PM2.5: ${Math.round(p.measuredValue)}`}),m?.measuredValue!=null&&n.push({label:`TVOC: ${Math.round(m.measuredValue)}`}),s?.percentCurrent!=null&&s.percentCurrent>0&&n.push({label:`Fan ${s.percentCurrent}%`}),h?.currentPositionLiftPercent100ths!=null){let e=Math.round(h.currentPositionLiftPercent100ths/100);n.push({label:`${e}% open`})}if(g?.lockState!==void 0){let e=g.lockState===1;n.push({label:e?`Locked`:`Unlocked`,color:e?`success`:`warning`})}return _?.stateValue!==void 0&&r?.onOff===void 0&&n.push({label:_.stateValue?`Closed`:`Open`,color:_.stateValue?`success`:`warning`}),n},[e.state]);return(0,G.jsx)(hv,{onClick:r,sx:{height:`100%`,cursor:r?`pointer`:`default`,transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,opacity:d?1:.6,"&:hover":r?{transform:`translateY(-4px)`,boxShadow:4}:{}},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:2,mb:2},children:[(0,G.jsx)(Z,{sx:{fontSize:36,display:`flex`,alignItems:`center`,justifyContent:`center`,width:56,height:56,borderRadius:2,backgroundColor:`${eC(u,c)}20`,overflow:`hidden`,flexShrink:0},children:A&&j?(0,G.jsx)(Z,{component:`img`,src:j,alt:l,onError:()=>E(!0),sx:{width:`100%`,height:`100%`,objectFit:`cover`}}):Lde(u)}),(0,G.jsxs)(Z,{sx:{flexGrow:1,minWidth:0},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(Q,{variant:`h6`,noWrap:!0,sx:{flexGrow:1},children:l}),p&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`input`,{type:`file`,ref:k,onChange:N,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml`,style:{display:`none`}}),(0,G.jsx)(db,{title:s(`endpoints.uploadImage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:M,sx:{ml:.5},"aria-label":`Upload image for ${l}`,children:(0,G.jsx)(Ide,{fontSize:`small`})})}),a?.source===`custom`&&(0,G.jsx)(db,{title:s(`endpoints.removeImage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:P,sx:{ml:-.5},"aria-label":`Remove image for ${l}`,children:(0,G.jsx)(LS,{fontSize:`small`})})})]}),i&&p&&n&&(0,G.jsx)(db,{title:s(`endpoints.editMapping`),children:(0,G.jsx)(Bh,{size:`small`,onClick:e=>{e.stopPropagation(),i(p,n)},sx:{ml:.5},"aria-label":`Edit mapping for ${l}`,children:(0,G.jsx)(hb,{fontSize:`small`})})}),h?(0,G.jsx)(db,{title:`HA State: ${m}`,children:(0,G.jsx)(Sb,{color:`warning`,fontSize:`small`})}):(0,G.jsx)(db,{title:s(d?`common.online`:`common.offline`),children:d?(0,G.jsx)(lv,{color:`success`,fontSize:`small`}):(0,G.jsx)(Cx,{color:`error`,fontSize:`small`})})]}),p&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontFamily:`monospace`,noWrap:!0,children:p}),t&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,noWrap:!0,children:t}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,sx:{mt:1,flexWrap:`wrap`,gap:.5},children:[(0,G.jsx)(db,{title:`Device Type ID: ${e.type.id}`,children:(0,G.jsx)(Ev,{label:`${u} (${e.type.id})`,size:`small`,sx:{backgroundColor:`${eC(u,c)}20`,color:eC(u,c),fontWeight:500}})}),I.map(e=>(0,G.jsx)(Ev,{label:e.label,size:`small`,variant:`outlined`,color:e.color??`default`},e.label))]})]})]}),(b!=null||_.length>0)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ub,{sx:{my:1}}),(0,G.jsxs)(Hv,{direction:`row`,spacing:1,alignItems:`center`,sx:{flexWrap:`wrap`,gap:.5,mb:1},children:[b!=null&&(0,G.jsx)(Ev,{icon:x?(0,G.jsx)(Ex,{}):b<=20?(0,G.jsx)(Tx,{}):(0,G.jsx)(Dx,{}),label:`${b}%`,size:`small`,color:x?`info`:b<=10?`error`:b<=20?`warning`:`success`,variant:`outlined`}),_.map(e=>(0,G.jsx)(db,{title:e.entity,children:(0,G.jsx)(Ev,{icon:(0,G.jsx)(Ox,{}),label:e.label,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})},e.label))]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,sx:{cursor:`pointer`},onClick:e=>{e.stopPropagation(),w(!S)},children:[(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{flexGrow:1},children:[s(`endpoints.clusters`),` (`,F.length,`)`]}),(0,G.jsx)($S,{sx:{fontSize:16,color:`text.secondary`,transform:S?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`}})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,sx:{flexWrap:`wrap`,gap:.5,mt:.5},children:[F.slice(0,S?void 0:5).map(e=>{let t=v.has(e);return(0,G.jsx)(db,{title:t?`Auto-mapped from linked entity`:`Device cluster`,children:(0,G.jsx)(Ev,{icon:t?(0,G.jsx)(Ox,{}):void 0,label:e,size:`small`,variant:`outlined`,color:t?`info`:`default`,sx:{fontSize:`0.7rem`,height:22}})},e)}),!S&&F.length>5&&(0,G.jsx)(Ev,{label:`+${F.length-5}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})]})]}),(0,G.jsxs)(Zv,{in:S,children:[(0,G.jsx)(Ub,{sx:{my:1}}),p&&(0,G.jsxs)(Z,{sx:{mb:1},children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mb:.5},children:s(`endpoints.homeAssistantEntity`)}),(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.75rem`,children:[s(`endpoints.haState`),`: `,m??s(`common.unknown`)]}),(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.75rem`,children:[`Device Type: `,e.type.name,` (`,e.type.id,`)`]}),(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.75rem`,children:[`Endpoint: `,e.endpoint??`N/A`]})]}),F.map(t=>{let n=e.state[t];if(!n||typeof n!=`object`||Object.keys(n).length===0)return null;let r=Object.entries(n).filter(([e])=>!e.startsWith(`__`)&&e!==`config`);return r.length===0?null:(0,G.jsxs)(Z,{sx:{mb:1},children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontWeight:600,sx:{display:`block`,mb:.25},children:t}),r.map(([e,t])=>(0,G.jsxs)(Q,{variant:`body2`,fontFamily:`monospace`,fontSize:`0.7rem`,color:`text.secondary`,noWrap:!0,children:[e,`: `,Rde(t)]},e))]},t)})]})]})})},nC=C.createContext({});function zde(e){return Jd(`MuiAccordion`,e)}var rC=Yd(`MuiAccordion`,[`root`,`heading`,`rounded`,`expanded`,`disabled`,`gutters`,`region`]),Bde=e=>{let{classes:t,square:n,expanded:r,disabled:i,disableGutters:a}=e;return Cp({root:[`root`,!n&&`rounded`,r&&`expanded`,i&&`disabled`,!a&&`gutters`],heading:[`heading`],region:[`region`]},zde,t)},Vde=J(Wm,{name:`MuiAccordion`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${rC.region}`]:t.region},t.root,!n.square&&t.rounded,!n.disableGutters&&t.gutters]}})(Fm(({theme:e})=>{let t={duration:e.transitions.duration.shortest};return{position:`relative`,transition:e.transitions.create([`margin`],t),overflowAnchor:`none`,"&::before":{position:`absolute`,left:0,top:-1,right:0,height:1,content:`""`,opacity:1,backgroundColor:(e.vars||e).palette.divider,transition:e.transitions.create([`opacity`,`background-color`],t)},"&:first-of-type":{"&::before":{display:`none`}},[`&.${rC.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:`none`}}},[`&.${rC.disabled}`]:{backgroundColor:(e.vars||e).palette.action.disabledBackground}}}),Fm(({theme:e})=>({variants:[{props:e=>!e.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(e.vars||e).shape.borderRadius,borderBottomRightRadius:(e.vars||e).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:e=>!e.disableGutters,style:{[`&.${rC.expanded}`]:{margin:`16px 0`}}}]}))),Hde=J(`h3`,{name:`MuiAccordion`,slot:`Heading`})({all:`unset`}),Ude=J(`div`,{name:`MuiAccordion`,slot:`Region`})({}),iC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAccordion`}),{children:r,className:i,defaultExpanded:a=!1,disabled:o=!1,disableGutters:s=!1,expanded:c,onChange:l,slots:u={},slotProps:d={},TransitionComponent:f,TransitionProps:p,...m}=n,[h,g]=ah({controlled:c,default:a,name:`Accordion`,state:`expanded`}),_=C.useCallback(e=>{g(!h),l&&l(e,!h)},[h,l,g]),[v,...y]=C.Children.toArray(r),b=C.useMemo(()=>({expanded:h,disabled:o,disableGutters:s,toggle:_}),[h,o,s,_]),x={...n,disabled:o,disableGutters:s,expanded:h},S=Bde(x),w={slots:{transition:f,...u},slotProps:{transition:p,...d}},[T,E]=Hm(`root`,{elementType:Vde,externalForwardedProps:{...w,...m},className:K(S.root,i),shouldForwardComponentProp:!0,ownerState:x,ref:t}),[D,O]=Hm(`heading`,{elementType:Hde,externalForwardedProps:w,className:S.heading,ownerState:x}),[k,A]=Hm(`transition`,{elementType:Zv,externalForwardedProps:w,ownerState:x}),[j,M]=Hm(`region`,{elementType:Ude,externalForwardedProps:w,ownerState:x,className:S.region,additionalProps:{"aria-labelledby":v.props.id,id:v.props[`aria-controls`],role:`region`}});return(0,G.jsxs)(T,{...E,children:[(0,G.jsx)(D,{...O,children:(0,G.jsx)(nC.Provider,{value:b,children:v})}),(0,G.jsx)(k,{in:h,timeout:`auto`,...A,children:(0,G.jsx)(j,{...M,children:y})})]})});function Wde(e){return Jd(`MuiAccordionDetails`,e)}Yd(`MuiAccordionDetails`,[`root`]);var Gde=e=>{let{classes:t}=e;return Cp({root:[`root`]},Wde,t)},Kde=J(`div`,{name:`MuiAccordionDetails`,slot:`Root`})(Fm(({theme:e})=>({padding:e.spacing(1,2,2)}))),aC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAccordionDetails`}),{className:r,...i}=n,a=n;return(0,G.jsx)(Kde,{className:K(Gde(a).root,r),ref:t,ownerState:a,...i})});function qde(e){return Jd(`MuiAccordionSummary`,e)}var oC=Yd(`MuiAccordionSummary`,[`root`,`expanded`,`focusVisible`,`disabled`,`gutters`,`contentGutters`,`content`,`expandIconWrapper`]),Jde=e=>{let{classes:t,expanded:n,disabled:r,disableGutters:i}=e;return Cp({root:[`root`,n&&`expanded`,r&&`disabled`,!i&&`gutters`],focusVisible:[`focusVisible`],content:[`content`,n&&`expanded`,!i&&`contentGutters`],expandIconWrapper:[`expandIconWrapper`,n&&`expanded`]},qde,t)},Yde=J(Nh,{name:`MuiAccordionSummary`,slot:`Root`})(Fm(({theme:e})=>{let t={duration:e.transitions.duration.shortest};return{display:`flex`,width:`100%`,minHeight:48,padding:e.spacing(0,2),transition:e.transitions.create([`min-height`,`background-color`],t),[`&.${oC.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${oC.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`&:hover:not(.${oC.disabled})`]:{cursor:`pointer`},variants:[{props:e=>!e.disableGutters,style:{[`&.${oC.expanded}`]:{minHeight:64}}}]}})),Xde=J(`span`,{name:`MuiAccordionSummary`,slot:`Content`})(Fm(({theme:e})=>({display:`flex`,textAlign:`start`,flexGrow:1,margin:`12px 0`,variants:[{props:e=>!e.disableGutters,style:{transition:e.transitions.create([`margin`],{duration:e.transitions.duration.shortest}),[`&.${oC.expanded}`]:{margin:`20px 0`}}}]}))),Zde=J(`span`,{name:`MuiAccordionSummary`,slot:`ExpandIconWrapper`})(Fm(({theme:e})=>({display:`flex`,color:(e.vars||e).palette.action.active,transform:`rotate(0deg)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shortest}),[`&.${oC.expanded}`]:{transform:`rotate(180deg)`}}))),sC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAccordionSummary`}),{children:r,className:i,expandIcon:a,focusVisibleClassName:o,onClick:s,slots:c,slotProps:l,...u}=n,{disabled:d=!1,disableGutters:f,expanded:p,toggle:m}=C.useContext(nC),h=e=>{m&&m(e),s&&s(e)},g={...n,expanded:p,disabled:d,disableGutters:f},_=Jde(g),v={slots:c,slotProps:l},[y,b]=Hm(`root`,{ref:t,shouldForwardComponentProp:!0,className:K(_.root,i),elementType:Yde,externalForwardedProps:{...v,...u},ownerState:g,additionalProps:{focusRipple:!1,disableRipple:!0,disabled:d,"aria-expanded":p,focusVisibleClassName:K(_.focusVisible,o)},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),h(t)}})}),[x,S]=Hm(`content`,{className:_.content,elementType:Xde,externalForwardedProps:v,ownerState:g}),[w,T]=Hm(`expandIconWrapper`,{className:_.expandIconWrapper,elementType:Zde,externalForwardedProps:v,ownerState:g});return(0,G.jsxs)(y,{...b,children:[(0,G.jsx)(x,{...S,children:r}),a&&(0,G.jsx)(w,{...T,children:a})]})}),cC=C.createContext();function Qde(e){return Jd(`MuiTable`,e)}Yd(`MuiTable`,[`root`,`stickyHeader`]);var $de=e=>{let{classes:t,stickyHeader:n}=e;return Cp({root:[`root`,n&&`stickyHeader`]},Qde,t)},efe=J(`table`,{name:`MuiTable`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.stickyHeader&&t.stickyHeader]}})(Fm(({theme:e})=>({display:`table`,width:`100%`,borderCollapse:`collapse`,borderSpacing:0,"& caption":{...e.typography.body2,padding:e.spacing(2),color:(e.vars||e).palette.text.secondary,textAlign:`left`,captionSide:`bottom`},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:`separate`}}]}))),lC=`table`,uC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTable`}),{className:r,component:i=lC,padding:a=`normal`,size:o=`medium`,stickyHeader:s=!1,...c}=n,l={...n,component:i,padding:a,size:o,stickyHeader:s},u=$de(l),d=C.useMemo(()=>({padding:a,size:o,stickyHeader:s}),[a,o,s]);return(0,G.jsx)(cC.Provider,{value:d,children:(0,G.jsx)(efe,{as:i,role:i===lC?null:`table`,ref:t,className:K(u.root,r),ownerState:l,...c})})}),dC=C.createContext();function tfe(e){return Jd(`MuiTableBody`,e)}Yd(`MuiTableBody`,[`root`]);var nfe=e=>{let{classes:t}=e;return Cp({root:[`root`]},tfe,t)},rfe=J(`tbody`,{name:`MuiTableBody`,slot:`Root`})({display:`table-row-group`}),ife={variant:`body`},fC=`tbody`,pC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTableBody`}),{className:r,component:i=fC,...a}=n,o={...n,component:i},s=nfe(o);return(0,G.jsx)(dC.Provider,{value:ife,children:(0,G.jsx)(rfe,{className:K(s.root,r),as:i,ref:t,role:i===fC?null:`rowgroup`,ownerState:o,...a})})});function afe(e){return Jd(`MuiTableCell`,e)}var ofe=Yd(`MuiTableCell`,[`root`,`head`,`body`,`footer`,`sizeSmall`,`sizeMedium`,`paddingCheckbox`,`paddingNone`,`alignLeft`,`alignCenter`,`alignRight`,`alignJustify`,`stickyHeader`]),sfe=e=>{let{classes:t,variant:n,align:r,padding:i,size:a,stickyHeader:o}=e;return Cp({root:[`root`,n,o&&`stickyHeader`,r!==`inherit`&&`align${Y(r)}`,i!==`normal`&&`padding${Y(i)}`,`size${Y(a)}`]},afe,t)},cfe=J(`td`,{name:`MuiTableCell`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.padding!==`normal`&&t[`padding${Y(n.padding)}`],n.align!==`inherit`&&t[`align${Y(n.align)}`],n.stickyHeader&&t.stickyHeader]}})(Fm(({theme:e})=>({...e.typography.body2,display:`table-cell`,verticalAlign:`inherit`,borderBottom:e.vars?`1px solid ${e.vars.palette.TableCell.border}`:`1px solid
|
|
218
218
|
${e.palette.mode===`light`?e.lighten(e.alpha(e.palette.divider,1),.88):e.darken(e.alpha(e.palette.divider,1),.68)}`,textAlign:`left`,padding:16,variants:[{props:{variant:`head`},style:{color:(e.vars||e).palette.text.primary,lineHeight:e.typography.pxToRem(24),fontWeight:e.typography.fontWeightMedium}},{props:{variant:`body`},style:{color:(e.vars||e).palette.text.primary}},{props:{variant:`footer`},style:{color:(e.vars||e).palette.text.secondary,lineHeight:e.typography.pxToRem(21),fontSize:e.typography.pxToRem(12)}},{props:{size:`small`},style:{padding:`6px 16px`,[`&.${ofe.paddingCheckbox}`]:{width:24,padding:`0 12px 0 16px`,"& > *":{padding:0}}}},{props:{padding:`checkbox`},style:{width:48,padding:`0 0 0 4px`}},{props:{padding:`none`},style:{padding:0}},{props:{align:`left`},style:{textAlign:`left`}},{props:{align:`center`},style:{textAlign:`center`}},{props:{align:`right`},style:{textAlign:`right`,flexDirection:`row-reverse`}},{props:{align:`justify`},style:{textAlign:`justify`}},{props:({ownerState:e})=>e.stickyHeader,style:{position:`sticky`,top:0,zIndex:2,backgroundColor:(e.vars||e).palette.background.default}}]}))),mC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTableCell`}),{align:r=`inherit`,className:i,component:a,padding:o,scope:s,size:c,sortDirection:l,variant:u,...d}=n,f=C.useContext(cC),p=C.useContext(dC),m=p&&p.variant===`head`,h;h=a||(m?`th`:`td`);let g=s;h===`td`?g=void 0:!g&&m&&(g=`col`);let _=u||p&&p.variant,v={...n,align:r,component:h,padding:o||(f&&f.padding?f.padding:`normal`),size:c||(f&&f.size?f.size:`medium`),sortDirection:l,stickyHeader:_===`head`&&f&&f.stickyHeader,variant:_},y=sfe(v),b=null;return l&&(b=l===`asc`?`ascending`:`descending`),(0,G.jsx)(cfe,{as:h,ref:t,className:K(y.root,i),"aria-sort":b,scope:g,ownerState:v,...d})});function lfe(e){return Jd(`MuiTableContainer`,e)}Yd(`MuiTableContainer`,[`root`]);var ufe=e=>{let{classes:t}=e;return Cp({root:[`root`]},lfe,t)},dfe=J(`div`,{name:`MuiTableContainer`,slot:`Root`})({width:`100%`,overflowX:`auto`}),hC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTableContainer`}),{className:r,component:i=`div`,...a}=n,o={...n,component:i};return(0,G.jsx)(dfe,{ref:t,as:i,className:K(ufe(o).root,r),ownerState:o,...a})});function ffe(e){return Jd(`MuiTableHead`,e)}Yd(`MuiTableHead`,[`root`]);var pfe=e=>{let{classes:t}=e;return Cp({root:[`root`]},ffe,t)},mfe=J(`thead`,{name:`MuiTableHead`,slot:`Root`})({display:`table-header-group`}),hfe={variant:`head`},gC=`thead`,_C=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTableHead`}),{className:r,component:i=gC,...a}=n,o={...n,component:i},s=pfe(o);return(0,G.jsx)(dC.Provider,{value:hfe,children:(0,G.jsx)(mfe,{as:i,className:K(s.root,r),ref:t,role:i===gC?null:`rowgroup`,ownerState:o,...a})})});function gfe(e){return Jd(`MuiTableRow`,e)}var vC=Yd(`MuiTableRow`,[`root`,`selected`,`hover`,`head`,`footer`]),_fe=e=>{let{classes:t,selected:n,hover:r,head:i,footer:a}=e;return Cp({root:[`root`,n&&`selected`,r&&`hover`,i&&`head`,a&&`footer`]},gfe,t)},vfe=J(`tr`,{name:`MuiTableRow`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.head&&t.head,n.footer&&t.footer]}})(Fm(({theme:e})=>({color:`inherit`,display:`table-row`,verticalAlign:`middle`,outline:0,[`&.${vC.hover}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${vC.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)}}}))),yC=`tr`,bC=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiTableRow`}),{className:r,component:i=yC,hover:a=!1,selected:o=!1,...s}=n,c=C.useContext(dC),l={...n,component:i,hover:a,selected:o,head:c&&c.variant===`head`,footer:c&&c.variant===`footer`};return(0,G.jsx)(vfe,{as:i,ref:t,className:K(_fe(l).root,r),role:i===yC?null:`row`,ownerState:l,...s})}),yfe=[tv.homeAssistantEntity],xC=e=>{let t=e.homeAssistantEntity;if(!t?.entity?.entity_id)return null;let n=t.entity.entity_id,r=t.entity.state?.state??`unknown`,i=t.entity.state?.attributes??{},a=r===`unavailable`||r===`unknown`,o=[],s=t.mapping;return s&&(typeof s.batteryEntity==`string`&&o.push({label:`Battery`,entity:s.batteryEntity}),typeof s.humidityEntity==`string`&&o.push({label:`Humidity`,entity:s.humidityEntity}),typeof s.pressureEntity==`string`&&o.push({label:`Pressure`,entity:s.pressureEntity}),typeof s.powerEntity==`string`&&o.push({label:`Power`,entity:s.powerEntity}),typeof s.energyEntity==`string`&&o.push({label:`Energy`,entity:s.energyEntity}),typeof s.filterLifeEntity==`string`&&o.push({label:`Filter Life`,entity:s.filterLifeEntity}),typeof s.cleaningModeEntity==`string`&&o.push({label:`Cleaning Mode`,entity:s.cleaningModeEntity}),typeof s.suctionLevelEntity==`string`&&o.push({label:`Suction Level`,entity:s.suctionLevelEntity}),typeof s.currentRoomEntity==`string`&&o.push({label:`Current Room`,entity:s.currentRoomEntity}),Array.isArray(s.roomEntities)&&s.roomEntities.length>0&&o.push({label:`Rooms`,entity:s.roomEntities.join(`, `)})),{entityId:n,haState:r,haAttributes:i,isUnavailable:a,mappings:o,customName:t.customName,matterDeviceType:typeof s?.matterDeviceType==`string`?s.matterDeviceType:void 0}},bfe=({endpoint:e})=>{let{t}=ws(),n=(0,C.useMemo)(()=>xC(e.state),[e.state]);if(!n)return null;let r=[`device_class`,`supported_features`,`supported_color_modes`,`color_mode`,`brightness`,`color_temp`,`hvac_modes`,`hvac_mode`,`hvac_action`,`current_temperature`,`temperature`,`fan_speed`,`fan_speed_list`,`volume_level`,`is_volume_muted`,`source`,`source_list`,`current_position`,`current_tilt_position`,`battery_level`,`unit_of_measurement`,`state_class`],i=Object.entries(n.haAttributes).filter(([e])=>r.includes(e)||e===`friendly_name`);return(0,G.jsx)(Wm,{sx:{p:2,mb:2,bgcolor:`background.default`},variant:`outlined`,children:(0,G.jsxs)(Hv,{spacing:1.5,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,children:t(`endpoints.homeAssistantEntity`)}),n.isUnavailable?(0,G.jsx)(Ev,{icon:(0,G.jsx)(Sb,{}),label:n.haState,size:`small`,color:`warning`,variant:`outlined`}):(0,G.jsx)(Ev,{icon:(0,G.jsx)(lv,{}),label:n.haState,size:`small`,color:`success`,variant:`outlined`})]}),(0,G.jsx)(hC,{children:(0,G.jsx)(uC,{size:`small`,children:(0,G.jsxs)(pC,{children:[(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:500,width:`35%`},children:t(`endpoints.entityId`)}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{fontFamily:`monospace`,fontSize:`0.85em`,children:n.entityId})})]}),(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:500},children:t(`endpoints.haState`)}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{fontFamily:`monospace`,fontSize:`0.85em`,children:n.haState})})]}),n.customName&&(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:500},children:t(`endpoints.customName`)}),(0,G.jsx)(mC,{children:n.customName})]}),n.matterDeviceType&&(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:500},children:t(`endpoints.deviceTypeOverride`)}),(0,G.jsx)(mC,{children:(0,G.jsx)(Ev,{label:n.matterDeviceType,size:`small`,variant:`outlined`})})]})]})})}),i.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ub,{}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontWeight:600,children:t(`endpoints.keyHaAttributes`)}),(0,G.jsx)(hC,{children:(0,G.jsx)(uC,{size:`small`,children:(0,G.jsx)(pC,{children:i.map(([e,t])=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:500,width:`35%`,fontSize:`0.8em`},children:e}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{fontFamily:`monospace`,fontSize:`0.8em`,children:typeof t==`object`?JSON.stringify(t):String(t)})})]},e))})})})]}),n.mappings.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ub,{}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,fontWeight:600,children:t(`endpoints.entityMappings`)}),(0,G.jsx)(Hv,{direction:`row`,spacing:.5,flexWrap:`wrap`,useFlexGap:!0,children:n.mappings.map(e=>(0,G.jsx)(db,{title:e.entity,children:(0,G.jsx)(Ev,{icon:(0,G.jsx)(Ox,{}),label:`${e.label}: ${e.entity}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.75rem`}})},e.label))})]})]})})},xfe={powerSource:`batteryEntity`,relativeHumidityMeasurement:`humidityEntity`,pressureMeasurement:`pressureEntity`,electricalPowerMeasurement:`powerEntity`,electricalEnergyMeasurement:`energyEntity`},SC=e=>{let{t}=ws(),n=(0,C.useMemo)(()=>Object.keys(e.endpoint.state),[e.endpoint]),r=(0,C.useMemo)(()=>n.filter(e=>!yfe.includes(e)).sort(),[n]),i=(0,C.useMemo)(()=>{let t=xC(e.endpoint.state);if(!t)return new Set;let n=new Set;for(let e of t.mappings)for(let[t,r]of Object.entries(xfe))r.toLowerCase().startsWith(e.label.toLowerCase())&&n.add(t);return n},[e.endpoint.state]),a=(0,C.useMemo)(()=>({"Endpoint ID":e.endpoint.id.local,"Endpoint Type":`${e.endpoint.type.name} (${e.endpoint.type.id})`,"Endpoint Number":e.endpoint.endpoint,"# of Child Endpoints":e.endpoint.parts.length}),[e.endpoint]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(bfe,{endpoint:e.endpoint}),(0,G.jsx)(Wm,{sx:{p:2,mb:2},variant:`outlined`,children:(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Hv,{direction:`row`,justifyContent:`space-between`,alignItems:`center`,children:[(0,G.jsx)(Q,{component:`span`,children:t(`endpoints.aboutEndpoint`)}),(0,G.jsx)(mv,{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(e.endpoint,null,2))},variant:`outlined`,size:`small`,children:t(`endpoints.copyData`)})]}),(0,G.jsx)(CC,{value:a,hideHead:!0})]})}),r.map(n=>{let r=i.has(n);return(0,G.jsxs)(iC,{children:[(0,G.jsx)(sC,{expandIcon:(0,G.jsx)($S,{}),"aria-controls":`panel1-content`,children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Q,{component:`span`,children:[t(`endpoints.behavior`),`: `,(0,G.jsx)(`strong`,{children:n})]}),r&&(0,G.jsx)(Ev,{icon:(0,G.jsx)(Ox,{}),label:`auto-mapped`,size:`small`,color:`info`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:20}})]})}),(0,G.jsx)(aC,{children:(0,G.jsx)(CC,{value:e.endpoint.state[n]})})]},n)})]})},CC=e=>{let{t}=ws(),n=(0,C.useMemo)(()=>Object.keys(e.value),[e.value]);return(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[!e.hideHead&&(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:t(`common.property`)}),(0,G.jsx)(mC,{children:t(`common.value`)})]})}),(0,G.jsx)(pC,{children:n.map(t=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:t}),(0,G.jsx)(mC,{children:(0,G.jsx)(Sfe,{property:e.value[t]})})]},t))})]})})},Sfe=e=>(0,G.jsx)(Q,{fontFamily:`monospace`,fontSize:`0.9em`,children:(0,C.useMemo)(()=>typeof e.property==`string`||typeof e.property==`number`?e.property.toString():typeof e.property==`boolean`?String(e.property):JSON.stringify(e.property),[e.property])}),wC={};function TC(e,t){let n=C.useRef(wC);return n.current===wC&&(n.current=e(t)),n}function EC(e,t,n,r){let i=TC(Cfe).current;return wfe(i,e,t,n,r)&&Tfe(i,[e,t,n,r]),i.callback}function Cfe(){return{callback:null,cleanup:null,refs:[]}}function wfe(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Tfe(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}function DC(e,t,n=void 0){let r={};for(let i in e){let a=e[i],o=``,s=!0;for(let e=0;e<a.length;e+=1){let r=a[e];r&&(o+=(s===!0?``:` `)+t(r),s=!1,n&&n[r]&&(o+=` `+n[r]))}r[i]=o}return r}function Efe(...e){let t=C.useRef(void 0),n=C.useCallback(t=>{let n=e.map(e=>{if(e==null)return null;if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}});return()=>{n.forEach(e=>e?.())}},e);return C.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}function Dfe(e){return typeof e==`string`}function Ofe(e,t,n){return e===void 0||Dfe(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function OC(e,t=[]){if(e===void 0)return{};let n={};return Object.keys(e).filter(n=>n.match(/^on[A-Z]/)&&typeof e[n]==`function`&&!t.includes(n)).forEach(t=>{n[t]=e[t]}),n}function kC(e){if(e===void 0)return{};let t={};return Object.keys(e).filter(t=>!(t.match(/^on[A-Z]/)&&typeof e[t]==`function`)).forEach(n=>{t[n]=e[n]}),t}function kfe(e){let{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:i,className:a}=e;if(!t){let e=K(n?.className,a,i?.className,r?.className),t={...n?.style,...i?.style,...r?.style},o={...n,...i,...r};return e.length>0&&(o.className=e),Object.keys(t).length>0&&(o.style=t),{props:o,internalRef:void 0}}let o=OC({...i,...r}),s=kC(r),c=kC(i),l=t(o),u=K(l?.className,n?.className,a,i?.className,r?.className),d={...l?.style,...n?.style,...i?.style,...r?.style},f={...l,...n,...c,...s};return u.length>0&&(f.className=u),Object.keys(d).length>0&&(f.style=d),{props:f,internalRef:l.ref}}function AC(e,t,n){return typeof e==`function`?e(t,n):e}function jC(e){let{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:i=!1,...a}=e,o=i?{}:AC(n,r),{props:s,internalRef:c}=kfe({...a,externalSlotProps:o}),l=Efe(c,o?.ref,e.additionalProps?.ref);return Ofe(t,{...s,ref:l},r)}function MC(e){return $ee}var NC=e=>e,Afe=(()=>{let e=NC;return{configure(t){e=t},generate(t){return e(t)},reset(){e=NC}}})(),jfe={active:`active`,checked:`checked`,completed:`completed`,disabled:`disabled`,error:`error`,expanded:`expanded`,focused:`focused`,focusVisible:`focusVisible`,open:`open`,readOnly:`readOnly`,required:`required`,selected:`selected`};function PC(e,t,n=`Mui`){let r=jfe[t];return r?`${n}-${r}`:`${Afe.generate(e)}-${t}`}function FC(e,t,n=`Mui`){let r={};return t.forEach(t=>{r[t]=PC(e,t,n)}),r}function Mfe(e){return PC(`MuiSimpleTreeView`,e)}FC(`MuiSimpleTreeView`,[`root`,`item`,`itemContent`,`itemGroupTransition`,`itemIconContainer`,`itemLabel`,`itemCheckbox`]);var IC=Object.freeze([]),LC=Object.freeze({});function RC(e,...t){let n=new URL(`https://mui.com/x/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`MUI X error #${e}; visit ${n} for the full message.`}var zC=C.createContext(null),BC=()=>{let e=C.useContext(zC);if(e==null)throw Error(RC(190));return e},VC=C.createContext({classes:{},slots:{},slotProps:{}}),HC=()=>C.useContext(VC),Nfe=e=>{let{store:t,apiRef:n,rootRef:r}=e,i=TC(()=>t.buildPublicAPI()).current;Pfe(i,n);let a=C.useCallback(e=>{let n=null,r=null,i=[],a={};t.itemPluginManager.listPlugins().forEach(t=>{let o=t({props:e,rootRef:n,contentRef:r});o?.rootRef&&(n=o.rootRef),o?.contentRef&&(r=o.contentRef),o?.propsEnhancers&&(i.push(o.propsEnhancers),Object.keys(o.propsEnhancers).forEach(e=>{a[e]=!0}))});let o=e=>t=>{let n={};return i.forEach(r=>{let i=r[e];i!=null&&Object.assign(n,i(t))}),n},s=Object.fromEntries(Object.keys(a).map(e=>[e,o(e)]));return{contentRef:r,rootRef:n,propsEnhancers:s}},[t]),o=C.useCallback(({itemId:e,children:n,idAttribute:r})=>{let i=n,a=t.itemPluginManager.listWrappers();for(let n=a.length-1;n>=0;--n){let o=a[n];i=o({store:t,itemId:e,children:i,idAttribute:r})}return i},[t]);return C.useMemo(()=>({runItemPlugins:a,wrapItem:o,publicAPI:i,store:t,rootRef:r}),[a,o,i,t,r])};function Pfe(e,t){t!=null&&t.current==null&&(t.current=e)}function Ffe(e){let{store:t,apiRef:n,rootRef:r,classes:i=LC,slots:a=LC,slotProps:o=LC,children:s}=e,c=Nfe({store:t,apiRef:n,rootRef:r}),l=C.useMemo(()=>({classes:i,slots:{collapseIcon:a.collapseIcon,expandIcon:a.expandIcon,endIcon:a.endIcon},slotProps:{collapseIcon:o.collapseIcon,expandIcon:o.expandIcon,endIcon:o.endIcon}}),[i,a.collapseIcon,a.expandIcon,a.endIcon,o.collapseIcon,o.expandIcon,o.endIcon]);return(0,G.jsx)(zC.Provider,{value:c,children:(0,G.jsx)(VC.Provider,{value:l,children:s})})}var Ife=[`apiRef`,`slots`,`slotProps`,`disabledItemsFocusable`,`onItemClick`,`itemChildrenIndentation`,`id`,`expandedItems`,`defaultExpandedItems`,`onExpandedItemsChange`,`onItemExpansionToggle`,`expansionTrigger`,`disableSelection`,`selectedItems`,`defaultSelectedItems`,`multiSelect`,`checkboxSelection`,`selectionPropagation`,`onSelectedItemsChange`,`onItemSelectionToggle`,`onItemFocus`,`itemHeight`];function Lfe(e){let{apiRef:t,slots:n,slotProps:r,disabledItemsFocusable:i,onItemClick:a,itemChildrenIndentation:o,id:s,expandedItems:c,defaultExpandedItems:l,onExpandedItemsChange:u,onItemExpansionToggle:d,expansionTrigger:f,disableSelection:p,selectedItems:m,defaultSelectedItems:h,multiSelect:g,checkboxSelection:_,selectionPropagation:v,onSelectedItemsChange:y,onItemSelectionToggle:b,onItemFocus:x,itemHeight:S}=e,w=mh(e,Ife);return{apiRef:t,slots:n,slotProps:r,parameters:C.useMemo(()=>({disabledItemsFocusable:i,onItemClick:a,itemChildrenIndentation:o,id:s,expandedItems:c,defaultExpandedItems:l,onExpandedItemsChange:u,onItemExpansionToggle:d,expansionTrigger:f,disableSelection:p,selectedItems:m,defaultSelectedItems:h,multiSelect:g,checkboxSelection:_,selectionPropagation:v,onSelectedItemsChange:y,onItemSelectionToggle:b,onItemFocus:x,itemHeight:S}),[i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S]),forwardedProps:w}}var Rfe=b_({memoize:Yne,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),UC=(e,t,n,r,i,a,o,s,...c)=>{if(c.length>0)throw Error(RC(179));let l;if(e&&t&&n&&r&&i&&a&&o&&s)l=(c,l,u,d)=>s(e(c,l,u,d),t(c,l,u,d),n(c,l,u,d),r(c,l,u,d),i(c,l,u,d),a(c,l,u,d),o(c,l,u,d),l,u,d);else if(e&&t&&n&&r&&i&&a&&o)l=(s,c,l,u)=>o(e(s,c,l,u),t(s,c,l,u),n(s,c,l,u),r(s,c,l,u),i(s,c,l,u),a(s,c,l,u),c,l,u);else if(e&&t&&n&&r&&i&&a)l=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)l=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)l=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)l=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)l=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)l=e;else throw Error(RC(180));return l},WC=(e=>(...t)=>{let n=new WeakMap,r=1,i=t[t.length-1],a=t.length-1||1,o=Math.max(i.length-a,0);if(o>3)throw Error(RC(181));return(a,s,c,l)=>{let u=a.__cacheKey__;u||(u={id:r},a.__cacheKey__=u,r+=1);let d=n.get(u);if(!d){let r=t.length===1?[e=>e,i]:t,a=t,s=[void 0,void 0,void 0];switch(o){case 0:break;case 1:a=[...r.slice(0,-1),()=>s[0],i];break;case 2:a=[...r.slice(0,-1),()=>s[0],()=>s[1],i];break;case 3:a=[...r.slice(0,-1),()=>s[0],()=>s[1],()=>s[2],i];break;default:throw Error(RC(182))}e&&(a=[...a,e]),d=Rfe(...a),d.selectorArgs=s,n.set(u,d)}switch(o){case 3:d.selectorArgs[2]=l;case 2:d.selectorArgs[1]=c;case 1:d.selectorArgs[0]=s;default:}switch(o){case 0:return d(a);case 1:return d(a,s);case 2:return d(a,s,c);case 3:return d(a,s,c,l);default:throw Error(`unreachable`)}}})(),zfe=s((e=>{var t=p(),n=bs();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Bfe=s(((e,t)=>{t.exports=zfe()})),Vfe=19,GC=u(Bfe(),1),Hfe=Vfe>=19?Ufe:Wfe;function KC(e,t,n,r,i){return Hfe(e,t,n,r,i)}function Ufe(e,t,n,r,i){let a=C.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,xs.useSyncExternalStore)(e.subscribe,a,a)}function Wfe(e,t,n,r,i){return(0,GC.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Gfe=class e{static create(t){return new e(t)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){this.state=e,this.updateTick+=1;let t=this.updateTick,n=this.listeners.values(),r;for(;r=n.next(),!r.done;){if(t!==this.updateTick)return;let n=r.value;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState(ph({},this.state,e));return}}set(e,t){Object.is(this.state[e],t)||this.setState(ph({},this.state,{[e]:t}))}use=(e,t,n,r)=>KC(this,e,t,n,r)},qC=UC(e=>e.providedTreeId??e.treeId),JC={treeId:qC,treeItemIdAttribute:UC(qC,(e,t,n)=>n??`${e??``}-${t}`)},YC=e=>{let t={};return e.forEach((e,n)=>{t[e]=n}),t},XC=(e,t)=>{if(t==null)return!1;let n=e[t];if(!n)return!1;if(n.disabled)return!0;for(;n.parentId!=null;){if(n=e[n.parentId],!n)return!1;if(n.disabled)return!0}return!1};function ZC(e){let{storeParameters:t,items:n,parentId:r,depth:i,isItemExpandable:a,otherItemsMetaLookup:o}=e,s={},c={},l=[],u=[],d=e=>{let n=t.getItemId?t.getItemId(e):e.id;Kfe({id:n,parentId:r,item:e,itemMetaLookup:o,siblingsMetaLookup:s});let d=t.getItemLabel?t.getItemLabel(e):e.label;if(d==null)throw Error(RC(192,JSON.stringify(e)));let f=(t.getItemChildren?t.getItemChildren(e):e.children)||[];u.push({id:n,children:f}),c[n]=e,s[n]={id:n,label:d,parentId:r,idAttribute:void 0,expandable:a(e,f),disabled:t.isItemDisabled?t.isItemDisabled(e):!1,selectable:t.isItemSelectionDisabled?!t.isItemSelectionDisabled(e):!0,depth:i},l.push(n)};for(let e of n)d(e);return{metaLookup:s,modelLookup:c,orderedChildrenIds:l,childrenIndexes:YC(l),itemsChildren:u}}function Kfe({id:e,parentId:t,item:n,itemMetaLookup:r,siblingsMetaLookup:i}){if(e==null)throw Error(RC(193,JSON.stringify(n)));if(i[e]!=null||r[e]!=null&&r[e].parentId!==t)throw Error(RC(194,e))}var qfe=[],QC={domStructure:UC(e=>e.domStructure),disabledItemFocusable:UC(e=>e.disabledItemsFocusable),itemMetaLookup:UC(e=>e.itemMetaLookup),itemOrderedChildrenIdsLookup:UC(e=>e.itemOrderedChildrenIdsLookup),itemMeta:UC((e,t)=>e.itemMetaLookup[t??`__TREE_VIEW_ROOT_PARENT_ID__`]??null),itemOrderedChildrenIds:UC((e,t)=>e.itemOrderedChildrenIdsLookup[t??`__TREE_VIEW_ROOT_PARENT_ID__`]??qfe),itemModel:UC((e,t)=>e.itemModelLookup[t]),isItemDisabled:UC((e,t)=>XC(e.itemMetaLookup,t)),itemIndex:UC((e,t)=>{let n=e.itemMetaLookup[t];return n==null?-1:e.itemChildrenIndexesLookup[n.parentId??`__TREE_VIEW_ROOT_PARENT_ID__`][n.id]}),itemParentId:UC((e,t)=>e.itemMetaLookup[t]?.parentId??null),itemDepth:UC((e,t)=>e.itemMetaLookup[t]?.depth??0),canItemBeFocused:UC((e,t)=>e.disabledItemsFocusable||e.itemModelLookup[t]!=null&&!XC(e.itemMetaLookup,t)),itemChildrenIndentation:UC(e=>e.itemChildrenIndentation),itemHeight:UC(e=>e.itemHeight)},$C=class{constructor(e){this.store=e}static shouldRebuildItemsState=(e,t)=>[`items`,`isItemDisabled`,`isItemSelectionDisabled`,`getItemId`,`getItemLabel`,`getItemChildren`].some(n=>{let r=n;return e[r]!==t[r]});static buildItemsStateIfNeeded=e=>{let t={},n={},r={},i={};function a(o,s,c){let l=s??`__TREE_VIEW_ROOT_PARENT_ID__`,{metaLookup:u,modelLookup:d,orderedChildrenIds:f,childrenIndexes:p,itemsChildren:m}=ZC({storeParameters:e,items:o,parentId:s,depth:c,isItemExpandable:(e,t)=>!!t&&t.length>0,otherItemsMetaLookup:t});Object.assign(t,u),Object.assign(n,d),r[l]=f,i[l]=p;for(let e of m)a(e.children||[],e.id,c+1)}return a(e.items,null,0),{itemMetaLookup:t,itemModelLookup:n,itemOrderedChildrenIdsLookup:r,itemChildrenIndexesLookup:i}};getItem=e=>QC.itemModel(this.store.state,e);getItemTree=()=>{let e=t=>{let n=ph({},QC.itemModel(this.store.state,t)),r=QC.itemOrderedChildrenIds(this.store.state,t);return r.length>0?n.children=r.map(e):delete n.children,n};return QC.itemOrderedChildrenIds(this.store.state,null).map(e)};getItemOrderedChildrenIds=e=>QC.itemOrderedChildrenIds(this.store.state,e);getParentId=e=>QC.itemMeta(this.store.state,e)?.parentId||null;setIsItemDisabled=({itemId:e,shouldBeDisabled:t})=>{if(!this.store.state.itemMetaLookup[e])return;let n=ph({},this.store.state.itemMetaLookup);n[e]=ph({},n[e],{disabled:t??!n[e].disabled}),this.store.set(`itemMetaLookup`,n)};buildPublicAPI=()=>({getItem:this.getItem,getItemDOMElement:this.getItemDOMElement,getItemOrderedChildrenIds:this.getItemOrderedChildrenIds,getItemTree:this.getItemTree,getParentId:this.getParentId,setIsItemDisabled:this.setIsItemDisabled});getItemDOMElement=e=>{let t=QC.itemMeta(this.store.state,e);if(t==null)return null;let n=JC.treeItemIdAttribute(this.store.state,e,t.idAttribute);return document.getElementById(n)};setItemChildren=({items:e,parentId:t,getChildrenCount:n})=>{let r=t??`__TREE_VIEW_ROOT_PARENT_ID__`,i=t==null?-1:QC.itemDepth(this.store.state,t),{metaLookup:a,modelLookup:o,orderedChildrenIds:s,childrenIndexes:c}=ZC({storeParameters:this.store.parameters,items:e,parentId:t,depth:i+1,isItemExpandable:n?e=>n(e)!==0:()=>!1,otherItemsMetaLookup:QC.itemMetaLookup(this.store.state)});this.store.update({itemModelLookup:ph({},this.store.state.itemModelLookup,o),itemMetaLookup:ph({},this.store.state.itemMetaLookup,a),itemOrderedChildrenIdsLookup:ph({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:s}),itemChildrenIndexesLookup:ph({},this.store.state.itemChildrenIndexesLookup,{[r]:c})})};removeChildren=e=>{let t=this.store.state.itemMetaLookup,n=Object.keys(t).reduce((n,r)=>{let i=t[r];return i.parentId===e?n:ph({},n,{[i.id]:i})},{}),r=ph({},this.store.state.itemOrderedChildrenIdsLookup),i=ph({},this.store.state.itemChildrenIndexesLookup),a=e??`__TREE_VIEW_ROOT_PARENT_ID__`;delete i[a],delete r[a],this.store.update({itemMetaLookup:n,itemOrderedChildrenIdsLookup:r,itemChildrenIndexesLookup:i})};handleItemClick=(e,t)=>{this.store.parameters.onItemClick?.(e,t)}},ew=WC(e=>e.selectedItems,e=>Array.isArray(e)?e:e==null?[]:[e]),tw=WC(ew,e=>{let t=new Map;return e.forEach(e=>{t.set(e,!0)}),t}),nw=UC((e,t)=>e.itemMetaLookup[t]?.selectable??!0),rw={selectedItemsRaw:UC(e=>e.selectedItems),selectedItems:ew,selectedItemsMap:tw,enabled:UC(e=>!e.disableSelection),isMultiSelectEnabled:UC(e=>e.multiSelect),isCheckboxSelectionEnabled:UC(e=>e.checkboxSelection),propagationRules:UC(e=>e.selectionPropagation),isItemSelected:UC(tw,(e,t)=>e.has(t)),isFeatureEnabledForItem:UC(nw,e=>!e.disableSelection,(e,t,n)=>t&&e),canItemBeSelected:UC(QC.isItemDisabled,nw,e=>!e.disableSelection,(e,t,n,r)=>n&&!e&&t),isItemSelectable:nw},Jfe=UC((e,t)=>{if(rw.isItemSelected(e,t))return`checked`;let n=!1,r=!1,i=a=>{a!==t&&(rw.isItemSelected(e,a)?n=!0:r=!0),QC.itemOrderedChildrenIds(e,a).forEach(i)};return i(t),rw.propagationRules(e).parents?n&&r?`indeterminate`:n&&!r?`checked`:`empty`:n?`indeterminate`:`empty`}),Yfe=({props:e})=>{let{itemId:t}=e,{store:n}=BC(),r=KC(n,rw.isCheckboxSelectionEnabled),i=KC(n,rw.isFeatureEnabledForItem,t),a=KC(n,rw.canItemBeSelected,t),o=KC(n,Jfe,t);return{propsEnhancers:{root:()=>{let e;return e=o===`checked`?!0:o===`indeterminate`?`mixed`:a?!1:void 0,{"aria-checked":e}},checkbox:({externalEventHandlers:e,interactions:s})=>({tabIndex:-1,onChange:r=>{e.onChange?.(r),!r.defaultMuiPrevented&&rw.canItemBeSelected(n.state,t)&&s.handleCheckboxSelection(r)},visible:r&&i,disabled:!a,checked:o===`checked`,indeterminate:o===`indeterminate`})}}},iw=WC(e=>e.expandedItems,e=>{let t=new Map;return e.forEach(e=>{t.set(e,!0)}),t}),aw={expandedItemsRaw:UC(e=>e.expandedItems),expandedItemsMap:iw,flatList:WC(QC.itemOrderedChildrenIdsLookup,iw,(e,t)=>{function n(r){if(!t.has(r))return[r];let i=[r],a=e[r]||[];for(let e of a)i.push(...n(e));return i}return(e.__TREE_VIEW_ROOT_PARENT_ID__??[]).flatMap(n)}),triggerSlot:UC(e=>e.expansionTrigger),isItemExpanded:UC(iw,(e,t)=>e.has(t)),isItemExpandable:UC(QC.itemMeta,(e,t)=>e?.expandable??!1)},ow=(e,t)=>{let n=t.length-1;for(;n>=0&&!QC.canItemBeFocused(e,t[n]);)--n;if(n!==-1)return t[n]},sw=(e,t)=>{let n=QC.itemMeta(e,t);if(!n)return null;let r=QC.itemOrderedChildrenIds(e,n.parentId),i=QC.itemIndex(e,t);if(i===0)return n.parentId;let a=i-1;for(;!QC.canItemBeFocused(e,r[a])&&a>=0;)--a;if(a===-1)return n.parentId==null?null:sw(e,n.parentId);let o=r[a],s=ow(e,QC.itemOrderedChildrenIds(e,o));for(;aw.isItemExpanded(e,o)&&s!=null;)o=s,s=ow(e,QC.itemOrderedChildrenIds(e,o));return o},cw=(e,t)=>{if(aw.isItemExpanded(e,t)){let n=QC.itemOrderedChildrenIds(e,t).find(t=>QC.canItemBeFocused(e,t));if(n!=null)return n}let n=QC.itemMeta(e,t);for(;n!=null;){let t=QC.itemOrderedChildrenIds(e,n.parentId),r=QC.itemIndex(e,n.id);if(r<t.length-1){let n=r+1;for(;!QC.canItemBeFocused(e,t[n])&&n<t.length-1;)n+=1;if(QC.canItemBeFocused(e,t[n]))return t[n]}n=QC.itemMeta(e,n.parentId)}return null},lw=e=>{let t=null;for(;t==null||aw.isItemExpanded(e,t);){let n=ow(e,QC.itemOrderedChildrenIds(e,t));if(n==null)return t;t=n}return t},uw=e=>QC.itemOrderedChildrenIds(e,null).find(t=>QC.canItemBeFocused(e,t)),dw=(e,t,n)=>{if(t===n)return[t,n];let r=QC.itemMeta(e,t),i=QC.itemMeta(e,n);if(!r||!i)return[t,n];if(r.parentId===i.id||i.parentId===r.id)return i.parentId===r.id?[r.id,i.id]:[i.id,r.id];let a=[r.id],o=[i.id],s=r.parentId,c=i.parentId,l=o.indexOf(s)!==-1,u=a.indexOf(c)!==-1,d=!0,f=!0;for(;!u&&!l;)d&&(a.push(s),l=o.indexOf(s)!==-1,d=s!==null,!l&&d&&(s=QC.itemParentId(e,s))),f&&!l&&(o.push(c),u=a.indexOf(c)!==-1,f=c!==null,!u&&f&&(c=QC.itemParentId(e,c)));let p=l?s:c,m=QC.itemOrderedChildrenIds(e,p),h=a[a.indexOf(p)-1],g=o[o.indexOf(p)-1];return m.indexOf(h)<m.indexOf(g)?[t,n]:[n,t]},Xfe=(e,t,n)=>{let r=t=>{if(aw.isItemExpandable(e,t)&&aw.isItemExpanded(e,t))return QC.itemOrderedChildrenIds(e,t)[0];let n=QC.itemMeta(e,t);for(;n!=null;){let t=QC.itemOrderedChildrenIds(e,n.parentId),r=QC.itemIndex(e,n.id);if(r<t.length-1)return t[r+1];n=n.parentId?QC.itemMeta(e,n.parentId):null}throw Error(RC(191))},[i,a]=dw(e,t,n),o=[i],s=i;for(;s!==a;)s=r(s),QC.isItemDisabled(e,s)||o.push(s);return o},Zfe=e=>{let t=uw(e),n=[];for(;t!=null;)n.push(t),t=cw(e,t);return n},fw=(e,t)=>t!==e.closest(`*[role="treeitem"]`),Qfe=class{lastSelectedItem=null;lastSelectedRange={};constructor(e){this.store=e,e.itemPluginManager.register(Yfe,null)}setSelectedItems=(e,t,n)=>{let{selectionPropagation:r=LC,selectedItems:i,onItemSelectionToggle:a,onSelectedItemsChange:o}=this.store.parameters,s=rw.selectedItemsRaw(this.store.state),c,l=rw.isMultiSelectEnabled(this.store.state);if(c=l&&(r.descendants||r.parents)?$fe({store:this.store,selectionPropagation:r,newModel:t,oldModel:s,additionalItemsToPropagate:n}):t,a)if(l){let t=pw({store:this.store,newModel:c,oldModel:s});a&&(t.added.forEach(t=>{a(e,t,!0)}),t.removed.forEach(t=>{a(e,t,!1)}))}else c!==s&&(s!=null&&a(e,s,!1),c!=null&&a(e,c,!0));i===void 0&&this.store.set(`selectedItems`,c),o?.(e,c)};selectRange=(e,[t,n])=>{if(!rw.isMultiSelectEnabled(this.store.state))return;let r=rw.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length>0&&(r=r.filter(e=>!this.lastSelectedRange[e]));let i=mw(r),a=Xfe(this.store.state,t,n).filter(e=>rw.isItemSelectable(this.store.state,e)),o=a.filter(e=>!i[e]);r=r.concat(o),this.setSelectedItems(e,r),this.lastSelectedRange=mw(a)};buildPublicAPI=()=>({setItemSelection:this.setItemSelection});setItemSelection=({itemId:e,event:t=null,keepExistingSelection:n=!1,shouldBeSelected:r})=>{if(!rw.enabled(this.store.state))return;let i,a=rw.isMultiSelectEnabled(this.store.state);if(n){let t=rw.selectedItems(this.store.state),n=rw.isItemSelected(this.store.state,e);i=n&&(r===!1||r==null)?t.filter(t=>t!==e):!n&&(r===!0||r==null)?[e].concat(t):t}else i=r===!1||r==null&&rw.isItemSelected(this.store.state,e)?a?[]:null:a?[e]:e;this.setSelectedItems(t,i,[e]),this.lastSelectedItem=e,this.lastSelectedRange={}};selectAllNavigableItems=e=>{if(!rw.isMultiSelectEnabled(this.store.state))return;let t=Zfe(this.store.state);this.setSelectedItems(e,t),this.lastSelectedRange=mw(t)};expandSelectionRange=(e,t)=>{if(this.lastSelectedItem!=null){let[n,r]=dw(this.store.state,t,this.lastSelectedItem);this.selectRange(e,[n,r])}};selectRangeFromStartToItem=(e,t)=>{this.selectRange(e,[uw(this.store.state),t])};selectRangeFromItemToEnd=(e,t)=>{this.selectRange(e,[t,lw(this.store.state)])};selectItemFromArrowNavigation=(e,t,n)=>{if(!rw.isMultiSelectEnabled(this.store.state))return;let r=rw.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length===0?(r.push(n),this.lastSelectedRange={[t]:!0,[n]:!0}):(this.lastSelectedRange[t]||(this.lastSelectedRange={}),this.lastSelectedRange[n]?(r=r.filter(e=>e!==t),delete this.lastSelectedRange[t]):(r.push(n),this.lastSelectedRange[n]=!0)),this.setSelectedItems(e,r)}};function $fe({store:e,selectionPropagation:t,newModel:n,oldModel:r,additionalItemsToPropagate:i}){if(!t.descendants&&!t.parents)return n;let a=!1,o=mw(n),s=pw({store:e,newModel:n,oldModel:r});return i?.forEach(e=>{o[e]?s.added.includes(e)||s.added.push(e):s.removed.includes(e)||s.removed.push(e)}),s.added.forEach(n=>{if(t.descendants){let t=r=>{r!==n&&(a=!0,o[r]=!0),QC.itemOrderedChildrenIds(e.state,r).forEach(t)};t(n)}if(t.parents){let t=n=>o[n]?QC.itemOrderedChildrenIds(e.state,n).every(t):!1,r=n=>{let i=QC.itemParentId(e.state,n);i!=null&&QC.itemOrderedChildrenIds(e.state,i).every(t)&&(a=!0,o[i]=!0,r(i))};r(n)}}),s.removed.forEach(n=>{if(t.parents){let t=QC.itemParentId(e.state,n);for(;t!=null;)o[t]&&(a=!0,delete o[t]),t=QC.itemParentId(e.state,t)}if(t.descendants){let t=r=>{r!==n&&(a=!0,delete o[r]),QC.itemOrderedChildrenIds(e.state,r).forEach(t)};t(n)}}),a?Object.keys(o):n}function pw({store:e,oldModel:t,newModel:n}){let r=new Map;return n.forEach(e=>{r.set(e,!0)}),{added:n.filter(t=>!rw.isItemSelected(e.state,t)),removed:t.filter(e=>!r.has(e))}}function mw(e){let t={};return e.forEach(e=>{t[e]=!0}),t}function epe(e,t,n){let r=KC(e,JC.treeId),i=KC(e,QC.itemChildrenIndentation),a=KC(e,rw.isMultiSelectEnabled);return o=>ph({ref:n,role:`tree`,id:r,"aria-multiselectable":a},t,o,{style:ph({},t.style,{"--TreeView-itemChildrenIndentation":typeof i==`number`?`${i}px`:i}),onFocus:t=>{o.onFocus?.(t),e.focus.handleRootFocus(t)},onBlur:t=>{o.onBlur?.(t),e.focus.handleRootBlur(t)}})}function tpe(e){return e.replace(/["\\]/g,`\\$&`)}var hw=C.createContext(null);function gw(e){let{children:t,itemId:n=null,idAttribute:r}=e,{store:i,rootRef:a}=BC(),o=C.useRef(new Map);C.useEffect(()=>{if(!a.current)return;let e=QC.itemOrderedChildrenIds(i.state,n??null)??[],t=tpe(r??a.current.id);if(n!=null){let e=a.current.querySelector(`*[id="${t}"][role="treeitem"]`);if(e&&e.getAttribute(`aria-expanded`)===`false`)return}let s=a.current.querySelectorAll(`${n==null?``:`*[id="${t}"] `}[role="treeitem"]:not(*[id="${t}"] [role="treeitem"] [role="treeitem"])`),c=Array.from(s).map(e=>o.current.get(e.id));(c.length!==e.length||c.some((t,n)=>t!==e[n]))&&i.jsxItems.setJSXItemsOrderedChildrenIds(n??null,c)});let s=C.useMemo(()=>({registerChild:(e,t)=>o.current.set(e,t),unregisterChild:e=>o.current.delete(e),parentId:n}),[n]);return(0,G.jsx)(hw.Provider,{value:s,children:t})}var _w=C.createContext(()=>-1),vw=typeof document<`u`?C.useLayoutEffect:()=>{},npe=[];function rpe(e){C.useEffect(e,npe)}var ipe=C.createContext(),ape=()=>C.useContext(ipe)??!1;function ope(e,t){let n=ape(),r=TC(()=>new e(ph({},t,{isRtl:n}))).current;return vw(()=>r.updateStateFromParameters(ph({},t,{isRtl:n})),[r,n,t]),rpe(r.disposeEffect),r}var spe=class{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){let n=this.events[e];if(!n)return;let r=Array.from(n.highPriority.keys()),i=Array.from(n.regular.keys());for(let e=r.length-1;e>=0;--e){let i=r[e];n.highPriority.has(i)&&i.apply(this,t)}for(let e=0;e<i.length;e+=1){let r=i[e];n.regular.has(r)&&r.apply(this,t)}}once(e,t){let n=this;this.on(e,function r(...i){n.removeListener(e,r),t.apply(n,i)})}},cpe=({isItemEditable:e,expansionTrigger:t})=>t||(e?`iconContainer`:`content`);function yw(e){return{disabledItemsFocusable:e.disabledItemsFocusable??!1,itemChildrenIndentation:e.itemChildrenIndentation??`12px`,providedTreeId:e.id,expansionTrigger:cpe({isItemEditable:e.isItemEditable,expansionTrigger:e.expansionTrigger}),disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,selectionPropagation:e.selectionPropagation??LC,itemHeight:e.itemHeight??null}}function bw(e,t,n){return e===void 0?t===void 0?n:t:e}function lpe(e){return ph({treeId:void 0,focusedItemId:null},yw(e),$C.buildItemsStateIfNeeded(e),{expandedItems:bw(e.expandedItems,e.defaultExpandedItems,[]),selectedItems:bw(e.selectedItems,e.defaultSelectedItems,e.multiSelect?IC:null)})}var xw=0,upe=()=>(xw+=1,`mui-tree-view-${xw}`),dpe=class{timeoutIds=new Map;intervalIds=new Map;startTimeout=(e,t,n)=>{this.clearTimeout(e);let r=setTimeout(()=>{this.timeoutIds.delete(e),n()},t);this.timeoutIds.set(e,r)};startInterval=(e,t,n)=>{this.clearInterval(e);let r=setInterval(n,t);this.intervalIds.set(e,r)};clearTimeout=e=>{let t=this.timeoutIds.get(e);t!=null&&(clearTimeout(t),this.timeoutIds.delete(e))};clearInterval=e=>{let t=this.intervalIds.get(e);t!=null&&(clearInterval(t),this.intervalIds.delete(e))};clearAll=()=>{this.timeoutIds.forEach(clearTimeout),this.timeoutIds.clear(),this.intervalIds.forEach(clearInterval),this.intervalIds.clear()}},fpe=class{constructor(e){this.store=e}setExpandedItems=(e,t)=>{this.store.parameters.expandedItems===void 0&&this.store.set(`expandedItems`,t),this.store.parameters.onExpandedItemsChange?.(e,t)};isItemExpanded=e=>aw.isItemExpanded(this.store.state,e);buildPublicAPI=()=>({isItemExpanded:this.isItemExpanded,setItemExpansion:this.setItemExpansion});setItemExpansion=({itemId:e,event:t=null,shouldBeExpanded:n})=>{let r=aw.isItemExpanded(this.store.state,e),i=n??!r;if(r===i)return;let a={isExpansionPrevented:!1,shouldBeExpanded:i,itemId:e};this.store.publishEvent(`beforeItemToggleExpansion`,a,t),!a.isExpansionPrevented&&this.applyItemExpansion({itemId:e,event:t,shouldBeExpanded:i})};applyItemExpansion=({itemId:e,event:t,shouldBeExpanded:n})=>{let r=aw.expandedItemsRaw(this.store.state),i;i=n?[e].concat(r):r.filter(t=>t!==e),this.store.parameters.onItemExpansionToggle?.(t,e,n),this.setExpandedItems(t,i)};expandAllSiblings=(e,t)=>{let n=QC.itemMeta(this.store.state,t);if(n==null)return;let r=QC.itemOrderedChildrenIds(this.store.state,n.parentId).filter(e=>aw.isItemExpandable(this.store.state,e)&&!aw.isItemExpanded(this.store.state,e)),i=aw.expandedItemsRaw(this.store.state).concat(r);r.length>0&&(this.store.parameters.onItemExpansionToggle&&r.forEach(t=>{this.store.parameters.onItemExpansionToggle(e,t,!0)}),this.setExpandedItems(e,i))};addExpandableItems=e=>{let t=ph({},this.store.state.itemMetaLookup);for(let n of e)t[n]=ph({},t[n],{expandable:!0});this.store.set(`itemMetaLookup`,t)}},Sw={isItemEditable:UC(e=>e.isItemEditable,QC.itemModel,(e,t,n)=>!t||e==null?!1:typeof e==`boolean`?e:e(t)),isItemBeingEdited:UC((e,t)=>t==null?!1:e.editedItemId===t),isAnyItemBeingEdited:UC(e=>!!e.editedItemId)},ppe=500,mpe=class{typeaheadQuery=``;constructor(e){this.store=e,this.labelMap=Cw(QC.itemMetaLookup(this.store.state)),this.store.registerStoreEffect(QC.itemMetaLookup,(e,t)=>{this.store.shouldIgnoreItemsStateUpdate()||(this.labelMap=Cw(t))})}canToggleItemSelection=e=>rw.canItemBeSelected(this.store.state,e);canToggleItemExpansion=e=>!QC.isItemDisabled(this.store.state,e)&&aw.isItemExpandable(this.store.state,e);getFirstItemMatchingTypeaheadQuery=(e,t)=>{let n=e=>{let t=cw(this.store.state,e);return t===null?uw(this.store.state):t},r=t=>{let r=null,i={},a=t.length>1?e:n(e);for(;r==null&&!i[a];)this.labelMap[a]?.startsWith(t)?r=a:(i[a]=!0,a=n(a));return r},i=t.toLowerCase(),a=`${this.typeaheadQuery}${i}`,o=r(a);if(o!=null)return this.typeaheadQuery=a,o;let s=r(i);return s==null?(this.typeaheadQuery=``,null):(this.typeaheadQuery=i,s)};updateLabelMap=e=>{this.labelMap=e(this.labelMap)};handleItemKeyDown=async(e,t)=>{if(e.defaultMuiPrevented||e.altKey||fw(e.target,e.currentTarget))return;let n=e.ctrlKey||e.metaKey,r=e.key,i=rw.isMultiSelectEnabled(this.store.state);switch(!0){case r===` `&&this.canToggleItemSelection(t):e.preventDefault(),i&&e.shiftKey?this.store.selection.expandSelectionRange(e,t):this.store.selection.setItemSelection({event:e,itemId:t,keepExistingSelection:i,shouldBeSelected:void 0});break;case r===`Enter`:this.store.labelEditing?.setEditedItem&&Sw.isItemEditable(this.store.state,t)&&!Sw.isItemBeingEdited(this.store.state,t)?this.store.labelEditing.setEditedItem(t):this.canToggleItemExpansion(t)?(this.store.expansion.setItemExpansion({event:e,itemId:t}),e.preventDefault()):this.canToggleItemSelection(t)&&(i?(e.preventDefault(),this.store.selection.setItemSelection({event:e,itemId:t,keepExistingSelection:!0})):rw.isItemSelected(this.store.state,t)||(this.store.selection.setItemSelection({event:e,itemId:t}),e.preventDefault()));break;case r===`ArrowDown`:{let n=cw(this.store.state,t);n&&(e.preventDefault(),this.store.focus.focusItem(e,n),i&&e.shiftKey&&this.canToggleItemSelection(n)&&this.store.selection.selectItemFromArrowNavigation(e,t,n));break}case r===`ArrowUp`:{let n=sw(this.store.state,t);n&&(e.preventDefault(),this.store.focus.focusItem(e,n),i&&e.shiftKey&&this.canToggleItemSelection(n)&&this.store.selection.selectItemFromArrowNavigation(e,t,n));break}case r===`ArrowRight`&&!this.store.parameters.isRtl||r===`ArrowLeft`&&this.store.parameters.isRtl:if(n)return;if(aw.isItemExpanded(this.store.state,t)){let n=cw(this.store.state,t);n&&(this.store.focus.focusItem(e,n),e.preventDefault())}else this.canToggleItemExpansion(t)&&(this.store.expansion.setItemExpansion({event:e,itemId:t}),e.preventDefault());break;case r===`ArrowLeft`&&!this.store.parameters.isRtl||r===`ArrowRight`&&this.store.parameters.isRtl:if(n)return;if(this.canToggleItemExpansion(t)&&aw.isItemExpanded(this.store.state,t))this.store.expansion.setItemExpansion({event:e,itemId:t}),e.preventDefault();else{let n=QC.itemParentId(this.store.state,t);n&&(this.store.focus.focusItem(e,n),e.preventDefault())}break;case r===`Home`:this.canToggleItemSelection(t)&&i&&n&&e.shiftKey?this.store.selection.selectRangeFromStartToItem(e,t):this.store.focus.focusItem(e,uw(this.store.state)),e.preventDefault();break;case r===`End`:this.canToggleItemSelection(t)&&i&&n&&e.shiftKey?this.store.selection.selectRangeFromItemToEnd(e,t):this.store.focus.focusItem(e,lw(this.store.state)),e.preventDefault();break;case r===`*`:this.store.expansion.expandAllSiblings(e,t),e.preventDefault();break;case String.fromCharCode(e.keyCode)===`A`&&n&&i&&rw.enabled(this.store.state):this.store.selection.selectAllNavigableItems(e),e.preventDefault();break;case!n&&!e.shiftKey&&hpe(r):{this.store.timeoutManager.clearTimeout(`typeahead`);let n=this.getFirstItemMatchingTypeaheadQuery(t,r);n==null?this.typeaheadQuery=``:(this.store.focus.focusItem(e,n),e.preventDefault()),this.store.timeoutManager.startTimeout(`typeahead`,ppe,()=>{this.typeaheadQuery=``});break}}}};function hpe(e){return!!e&&e.length===1&&!!e.match(/\S/)}function Cw(e){let t={};return Object.values(e).forEach(e=>{t[e.id]=e.label.toLowerCase()}),t}var ww=WC(rw.selectedItems,aw.expandedItemsMap,QC.itemMetaLookup,QC.disabledItemFocusable,e=>QC.itemOrderedChildrenIds(e,null),(e,t,n,r,i)=>e.find(e=>{if(!r&&XC(n,e))return!1;let i=n[e];return i&&(i.parentId==null||t.has(i.parentId))})??i.find(e=>r||!XC(n,e))??null),Tw={defaultFocusableItemId:ww,isItemTheDefaultFocusableItem:UC(ww,(e,t)=>e===t),focusedItemId:UC(e=>e.focusedItemId),isItemFocused:UC((e,t)=>e.focusedItemId===t)},gpe=class{constructor(e){this.store=e;let t=e.state;this.store.subscribe(e=>{if(e.itemMetaLookup===t.itemMetaLookup){t=e;return}let n=Tw.focusedItemId(e);if(n==null||QC.itemMeta(e,n)){t=e;return}let r=t=>t==null||!QC.itemMeta(e,t)?null:t,i=r(cw(t,n))??r(sw(t,n))??uw(e);i==null?this.setFocusedItemId(null):this.applyItemFocus(null,i),t=e})}setFocusedItemId=e=>{Tw.focusedItemId(this.store.state)!==e&&this.store.set(`focusedItemId`,e)};applyItemFocus=(e,t)=>{this.store.items.getItemDOMElement(t)?.focus(),this.setFocusedItemId(t),this.store.parameters.onItemFocus?.(e,t)};buildPublicAPI=()=>({focusItem:this.focusItem});focusItem=(e,t)=>{let n=QC.itemMeta(this.store.state,t);n&&(n.parentId==null||aw.isItemExpanded(this.store.state,n.parentId))&&this.applyItemFocus(e,t)};removeFocusedItem=()=>{let e=Tw.focusedItemId(this.store.state);if(e!=null){if(QC.itemMeta(this.store.state,e)){let t=this.store.items.getItemDOMElement(e);t&&t.blur()}this.setFocusedItemId(null)}};handleRootFocus=e=>{if(e.defaultMuiPrevented)return;let t=Tw.defaultFocusableItemId(this.store.state);e.target===e.currentTarget&&t!=null&&this.applyItemFocus(e,t)};handleRootBlur=e=>{e.defaultMuiPrevented||this.setFocusedItemId(null)}},_pe=class{itemPlugins=[];itemWrappers=[];register=(e,t)=>{this.itemPlugins.push(e),t&&this.itemWrappers.push(t)};listPlugins=()=>this.itemPlugins;listWrappers=()=>this.itemWrappers},vpe=class extends Gfe{initialParameters=null;eventManager=new spe;timeoutManager=new dpe;itemPluginManager=new _pe;constructor(e,t,n){let r=lpe(e),i=n.getInitialState(r,e);super(i),this.parameters=e,this.instanceName=t,this.mapper=n,this.items=new $C(this),this.focus=new gpe(this),this.expansion=new fpe(this),this.selection=new Qfe(this),this.keyboardNavigation=new mpe(this)}buildPublicAPI(){return ph({},this.items.buildPublicAPI(),this.focus.buildPublicAPI(),this.expansion.buildPublicAPI(),this.selection.buildPublicAPI())}updateStateFromParameters(e){let t=(t,n,r)=>{e[n]!==void 0&&(t[n]=e[n])},n=yw(e);t(n,`expandedItems`,`defaultExpandedItems`),t(n,`selectedItems`,`defaultSelectedItems`),(this.state.providedTreeId!==e.id||this.state.treeId===void 0)&&(n.treeId=upe()),!this.mapper.shouldIgnoreItemsStateUpdate(e)&&$C.shouldRebuildItemsState(e,this.parameters)&&Object.assign(n,$C.buildItemsStateIfNeeded(e));let r=this.mapper.updateStateFromParameters(n,e,t);this.update(r),this.parameters=e}disposeEffect=()=>this.timeoutManager.clearAll;shouldIgnoreItemsStateUpdate=()=>this.mapper.shouldIgnoreItemsStateUpdate(this.parameters);registerStoreEffect=(e,t)=>{let n=e(this.state);this.subscribe(r=>{let i=e(r);i!==n&&(t(n,i),n=i)})};publishEvent=(e,t,n)=>{ype(n)&&n.isPropagationStopped()||this.eventManager.emit(e,t,n)};subscribeEvent=(e,t)=>{this.eventManager.on(e,t)}};function ype(e){return e?.isPropagationStopped!==void 0}var Ew={isEmpty:UC(e=>e.lazyLoadedItems==null?!0:Object.keys(e.lazyLoadedItems.loading).length===0&&Object.keys(e.lazyLoadedItems.errors).length===0),isItemLoading:UC((e,t)=>e.lazyLoadedItems?.loading[t??`__TREE_VIEW_ROOT_PARENT_ID__`]??!1),itemHasError:UC((e,t)=>!!e.lazyLoadedItems?.errors[t??`__TREE_VIEW_ROOT_PARENT_ID__`]),itemError:UC((e,t)=>e.lazyLoadedItems?.errors[t??`__TREE_VIEW_ROOT_PARENT_ID__`])},Dw=e=>Array.isArray(e)?e.length>0&&e.some(Dw):!!e,bpe=({itemId:e,children:t})=>{let{store:n,publicAPI:r}=BC(),i=KC(n,aw.isItemExpandable,e),a=KC(n,Ew.isItemLoading,e),o=KC(n,Ew.itemHasError,e),s=Dw(t)||i,c=KC(n,aw.isItemExpanded,e),l=KC(n,Tw.isItemFocused,e),u=KC(n,rw.isItemSelected,e),d=KC(n,QC.isItemDisabled,e),f=KC(n,Sw.isItemBeingEdited,e),p={expandable:s,expanded:c,focused:l,selected:u,disabled:d,editing:f,editable:KC(n,Sw.isItemEditable,e),loading:a,error:o},m=t=>{if(p.disabled)return;p.focused||n.focus.focusItem(t,e);let r=rw.isMultiSelectEnabled(n.state)&&(t.shiftKey||t.ctrlKey||t.metaKey);p.expandable&&!(r&&aw.isItemExpanded(n.state,e))&&n.expansion.setItemExpansion({event:t,itemId:e})},h=t=>{rw.canItemBeSelected(n.state,e)&&(!p.focused&&!p.editing&&n.focus.focusItem(t,e),rw.isMultiSelectEnabled(n.state)&&(t.shiftKey||t.ctrlKey||t.metaKey)?t.shiftKey?n.selection.expandSelectionRange(t,e):n.selection.setItemSelection({event:t,itemId:e,keepExistingSelection:!0}):n.selection.setItemSelection({event:t,itemId:e,shouldBeSelected:!0}))},g=t=>{let r=t.nativeEvent.shiftKey,i=rw.isMultiSelectEnabled(n.state);i&&r?n.selection.expandSelectionRange(t,e):n.selection.setItemSelection({event:t,itemId:e,keepExistingSelection:i,shouldBeSelected:t.target.checked})},_=()=>{n.labelEditing&&(f?n.labelEditing.setEditedItem(null):n.labelEditing.setEditedItem(e))};return{interactions:{handleExpansion:m,handleSelection:h,handleCheckboxSelection:g,toggleItemEditing:_,handleSaveItemLabel:(t,r)=>{n.labelEditing&&Sw.isItemBeingEdited(n.state,e)&&(n.labelEditing.updateItemLabel(e,r),_(),n.focus.focusItem(t,e))},handleCancelItemLabelEditing:t=>{n.labelEditing&&Sw.isItemBeingEdited(n.state,e)&&(_(),n.focus.focusItem(t,e))}},status:p,publicAPI:r}},xpe=({props:e,rootRef:t,contentRef:n})=>{let{store:r}=BC(),{children:i,disabled:a=!1,disableSelection:o=!1,label:s,itemId:c,id:l}=e,u=C.useContext(hw);if(u==null)throw Error(RC(196));let{registerChild:d,unregisterChild:f,parentId:p}=u,m=Dw(i),h=C.useRef(null),g=EC(h,n),_=KC(r,JC.treeItemIdAttribute,c,l),v=C.useRef(!0),y=TC(Symbol);return vw(()=>(d(_,c),()=>{f(_),f(_)}),[r,d,f,_,c]),vw(()=>(v.current=!0,()=>{v.current=!1}),[]),vw(()=>{let e=r.jsxItems.upsertJSXItem({id:c,idAttribute:l,parentId:p,expandable:m,disabled:a,selectable:!o},y.current);return()=>{v.current||e()}},[r,p,c,m,a,o,l,y]),C.useEffect(()=>{if(s)return r.jsxItems.mapLabelFromJSX(c,(h.current?.textContent??``).toLowerCase())},[r,c,s]),{contentRef:g,rootRef:t}},Spe=({children:e,itemId:t,idAttribute:n})=>{let r=C.useContext(_w);return(0,G.jsx)(gw,{itemId:t,idAttribute:n,children:(0,G.jsx)(_w.Provider,{value:r+1,children:e})})},Cpe=class{itemOwners=new Map;constructor(e){this.store=e,e.itemPluginManager.register(xpe,Spe)}upsertJSXItem=(e,t)=>{let n=this.itemOwners.get(e.id);if(n!=null&&n!==t)throw Error(RC(195,e.id));this.itemOwners.set(e.id,t);let r=QC.itemMeta(this.store.state,e.id);if(r!=null){let t=!1;for(let n of Object.keys(e))if(r[n]!==e[n]){t=!0;break}t&&this.store.update({itemMetaLookup:ph({},this.store.state.itemMetaLookup,{[e.id]:ph({},r,e)})})}else this.store.update({itemMetaLookup:ph({},this.store.state.itemMetaLookup,{[e.id]:e}),itemModelLookup:ph({},this.store.state.itemModelLookup,{[e.id]:{id:e.id,label:e.label??``}})});return()=>{this.itemOwners.delete(e.id);let t=ph({},this.store.state.itemMetaLookup),n=ph({},this.store.state.itemModelLookup);delete t[e.id],delete n[e.id],this.store.update({itemMetaLookup:t,itemModelLookup:n})}};mapLabelFromJSX=(e,t)=>(this.store.keyboardNavigation.updateLabelMap(n=>(n[e]=t,n)),()=>{this.store.keyboardNavigation.updateLabelMap(t=>{let n=ph({},t);return delete n[e],n})});setJSXItemsOrderedChildrenIds=(e,t)=>{let n=e??`__TREE_VIEW_ROOT_PARENT_ID__`;this.store.update({itemOrderedChildrenIdsLookup:ph({},this.store.state.itemOrderedChildrenIdsLookup,{[n]:t}),itemChildrenIndexesLookup:ph({},this.store.state.itemChildrenIndexesLookup,{[n]:YC(t)})}),e!==null&&rw.isItemSelected(this.store.state,e)&&this.store.selection.setItemSelection({itemId:e,shouldBeSelected:!0,keepExistingSelection:!0})}},wpe={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0},Tpe=class extends vpe{jsxItems=new Cpe(this);constructor(e){super(ph({},e,{items:IC}),`SimpleTreeView`,wpe)}updateStateFromParameters(e){super.updateStateFromParameters(ph({},e,{items:IC}))}},Epe=MC(`MuiSimpleTreeView`),Dpe=e=>{let{classes:t}=e;return C.useMemo(()=>DC({root:[`root`],item:[`item`],itemContent:[`itemContent`],itemGroupTransition:[`itemGroupTransition`],itemIconContainer:[`itemIconContainer`],itemLabel:[`itemLabel`],itemCheckbox:[`itemCheckbox`]},Mfe,t),[t])},Ope=J(`ul`,{name:`MuiSimpleTreeView`,slot:`Root`})({padding:0,margin:0,listStyle:`none`,outline:0,position:`relative`}),kpe=C.forwardRef(function(e,t){let n=Epe({props:e,name:`MuiSimpleTreeView`}),{slots:r,slotProps:i,apiRef:a,parameters:o,forwardedProps:s}=Lfe(n),c=ope(Tpe,o),l=C.useRef(null),u=epe(c,s,EC(t,l)),d=Dpe(n),f=r?.root??Ope,p=jC({elementType:f,externalSlotProps:i?.root,className:d.root,getSlotProps:u,ownerState:n});return(0,G.jsx)(Ffe,{store:c,classes:d,slots:r,slotProps:i,apiRef:a,rootRef:l,children:(0,G.jsx)(gw,{itemId:null,idAttribute:null,children:(0,G.jsx)(_w.Provider,{value:0,children:(0,G.jsx)(f,ph({},p))})})})});function Ape(e){if(e==null)return!0;for(let t in e)return!1;return!0}function Ow(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function kw(e){if(C.isValidElement(e)||(0,Ys.isValidElementType)(e)||!Ow(e))return e;let t={};return Object.keys(e).forEach(n=>{t[n]=kw(e[n])}),t}function Aw(e,t,n={clone:!0}){let r=n.clone?{...e}:e;return Ow(e)&&Ow(t)&&Object.keys(t).forEach(i=>{C.isValidElement(t[i])||(0,Ys.isValidElementType)(t[i])?r[i]=t[i]:Ow(t[i])&&Object.prototype.hasOwnProperty.call(e,i)&&Ow(e[i])?r[i]=Aw(e[i],t[i],n):n.clone?r[i]=Ow(t[i])?kw(t[i]):t[i]:r[i]=t[i]}),r}function jpe(e,...t){let n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append(`args[]`,e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function Mpe(e){if(typeof e!=`string`)throw Error(jpe(7));return e.charAt(0).toUpperCase()+e.slice(1)}var Npe=e=>{let t=Object.keys(e).map(t=>({key:t,val:e[t]}))||[];return t.sort((e,t)=>e.val-t.val),t.reduce((e,t)=>({...e,[t.key]:t.val}),{})};function jw(e){let{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n=`px`,step:r=5,...i}=e,a=Npe(t),o=Object.keys(a);function s(e){return`@media (min-width:${typeof t[e]==`number`?t[e]:e}${n})`}function c(e){return`@media (max-width:${(typeof t[e]==`number`?t[e]:e)-r/100}${n})`}function l(e,i){let a=o.indexOf(i);return`@media (min-width:${typeof t[e]==`number`?t[e]:e}${n}) and (max-width:${(a!==-1&&typeof t[o[a]]==`number`?t[o[a]]:i)-r/100}${n})`}function u(e){return o.indexOf(e)+1<o.length?l(e,o[o.indexOf(e)+1]):s(e)}function d(e){let t=o.indexOf(e);return t===0?s(o[1]):t===o.length-1?c(o[t]):l(e,o[o.indexOf(e)+1]).replace(`@media`,`@media not all and`)}let f=[];for(let e=0;e<o.length;e+=1)f.push(s(o[e]));return{keys:o,values:a,up:s,down:c,between:l,only:u,not:d,unit:n,internal_mediaKeys:f,...i}}var Mw=/min-width:\s*([0-9.]+)/;function Nw(e,t){if(!e.containerQueries||!Ppe(t))return t;let n=[];for(let e in t)e.startsWith(`@container`)&&n.push(e);n.sort((e,t)=>(e.match(Mw)?.[1]||0)-+(t.match(Mw)?.[1]||0));let r=t;for(let e=0;e<n.length;e+=1){let t=n[e],i=r[t];delete r[t],r[t]=i}return r}function Ppe(e){for(let t in e)if(t.startsWith(`@container`))return!0;return!1}function Pw(e,t){return t===`@`||t.startsWith(`@`)&&(e.some(e=>t.startsWith(`@${e}`))||!!t.match(/^@\d/))}function Fpe(e,t){let n=t.match(/^@([^/]+)?\/?(.+)?$/);if(!n)return null;let[,r,i]=n,a=Number.isNaN(+r)?r||0:+r;return e.containerQueries(i).up(a)}function Ipe(e){let t=(e,t)=>e.replace(`@media`,t?`@container ${t}`:`@container`);function n(n,r){n.up=(...n)=>t(e.breakpoints.up(...n),r),n.down=(...n)=>t(e.breakpoints.down(...n),r),n.between=(...n)=>t(e.breakpoints.between(...n),r),n.only=(...n)=>t(e.breakpoints.only(...n),r),n.not=(...n)=>{let i=t(e.breakpoints.not(...n),r);return i.includes(`not all and`)?i.replace(`not all and `,``).replace(`min-width:`,`width<`).replace(`max-width:`,`width>`).replace(`and`,`or`):i}}let r={},i=e=>(n(r,e),r);return n(i),{...e,containerQueries:i}}var Lpe={borderRadius:4};function Fw(e,t){let n=Array.isArray(t),r=Array.isArray(e);return Hpe(t)?t:Upe(e)?Iw(t):n&&r?Bpe(e,t):n===r?Wpe(e,t):Iw(t)}function Rpe(e){let t=0,n=e.length,r=Array(n);for(t=0;t<n;t+=1)r[t]=Iw(e[t]);return r}function zpe(e){let t={};for(let n in e)t[n]=Iw(e[n]);return t}function Bpe(e,t){let n=e.length;for(let r=0;r<t.length;r+=1)e[n+r]=Iw(t[r]);return e}function Vpe(e){return typeof e==`object`&&!!e&&!(e instanceof RegExp)&&!(e instanceof Date)}function Hpe(e){return typeof e!=`object`||!e}function Upe(e){return typeof e!=`object`||!e||e instanceof RegExp||e instanceof Date}function Iw(e){return Vpe(e)?Array.isArray(e)?Rpe(e):zpe(e):e}function Wpe(e,t){for(let n in t)n in e?e[n]=Fw(e[n],t[n]):e[n]=Iw(t[n]);return e}var Gpe={},Lw={xs:0,sm:600,md:900,lg:1200,xl:1536},Rw=jw({values:Lw}),Kpe={containerQueries:e=>({up:t=>{let n=typeof t==`number`?t:Lw[t]||t;return typeof n==`number`&&(n=`${n}px`),e?`@container ${e} (min-width:${n})`:`@container (min-width:${n})`}})};function zw(e,t,n){let r={};return Bw(r,e.theme,t,(e,t,i)=>{let a=n(t,i);e?r[e]=a:Fw(r,a)})}function Bw(e,t,n,r){if(t??=Gpe,Array.isArray(n)){let i=t.breakpoints??Rw;for(let t=0;t<n.length;t+=1)Vw(e,i.up(i.keys[t]),n[t],void 0,r);return e}if(typeof n==`object`){let i=t.breakpoints??Rw,a=i.values??Lw;for(let o in n)if(Pw(i.keys,o)){let i=Fpe(t.containerQueries?t:Kpe,o);i&&Vw(e,i,n[o],o,r)}else if(o in a)Vw(e,i.up(o),n[o],o,r);else{let t=o;e[t]=n[t]}return e}return r(void 0,n),e}function Vw(e,t,n,r,i){e[t]??={},i(t,n,r)}function qpe(e=Rw){let{internal_mediaKeys:t}=e,n={};for(let e=0;e<t.length;e+=1)n[t[e]]={};return n}function Hw(e,t){let n=e.internal_mediaKeys;for(let e=0;e<n.length;e+=1){let r=n[e];Ape(t[r])&&delete t[r]}return t}function Jpe(e,t){if(Array.isArray(t))return!0;if(typeof t==`object`&&t){for(let n=0;n<e.keys.length;n+=1)if(e.keys[n]in t)return!0;let n=Object.keys(t);for(let t=0;t<n.length;t+=1)if(Pw(e.keys,n[t]))return!0}return!1}function Uw(e,t,n,r){let i;return i=typeof e==`function`?e(n):Array.isArray(e)?e[n]||n:typeof n==`string`&&Ww(e,n,!0,r)||n,t&&(i=t(i,n,e)),i}function Ww(e,t,n=!0,r=void 0){if(!e||!t)return null;let i=t.split(`.`);if(e.vars&&n){let t=Gw(e.vars,i,r);if(t!=null)return t}return Gw(e,i,r)}function Gw(e,t,n=void 0){let r,i=e,a=0;for(;a<t.length;){if(i==null)return i;r=i,i=i[t[a]],a+=1}if(n&&i===void 0){let e=t[t.length-1],i=`${n}${e==="default"?``:Mpe(e)}`;return r?.[i]}return i}function Kw(e){let{prop:t,cssProperty:n=e.prop,themeKey:r,transform:i}=e,a=e=>{if(e[t]==null)return null;let a=e[t],o=e.theme,s=Ww(o,r)||{};return zw(e,a,e=>{let r=Uw(s,i,e,t);return n===!1?r:{[n]:r}})};return a.propTypes={},a.filterProps=[t],a}var Ype={internal_cache:{}},qw={m:`margin`,p:`padding`},Jw={t:`Top`,r:`Right`,b:`Bottom`,l:`Left`,x:[`Left`,`Right`],y:[`Top`,`Bottom`]},Yw={marginX:`mx`,marginY:`my`,paddingX:`px`,paddingY:`py`},Xw={};for(let e in qw)Xw[e]=[qw[e]];for(let e in qw)for(let t in Jw){let n=qw[e],r=Jw[t],i=Array.isArray(r)?r.map(e=>n+e):[n+r];Xw[e+t]=i}for(let e in Yw)Xw[e]=Xw[Yw[e]];var Zw=new Set([`m`,`mt`,`mr`,`mb`,`ml`,`mx`,`my`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`marginX`,`marginY`,`marginInline`,`marginInlineStart`,`marginInlineEnd`,`marginBlock`,`marginBlockStart`,`marginBlockEnd`]),Qw=new Set([`p`,`pt`,`pr`,`pb`,`pl`,`px`,`py`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`paddingX`,`paddingY`,`paddingInline`,`paddingInlineStart`,`paddingInlineEnd`,`paddingBlock`,`paddingBlockStart`,`paddingBlockEnd`]),$w=new Set([...Zw,...Qw]);function eT(e,t,n,r){let i=Ww(e,t,!0)??n;return typeof i==`number`||typeof i==`string`?e=>typeof e==`string`?e:typeof i==`string`?i.startsWith(`var(`)&&e===0?0:i.startsWith(`var(`)&&e===1?i:`calc(${e} * ${i})`:i*e:Array.isArray(i)?e=>{if(typeof e==`string`)return e;let t=i[Math.abs(e)];return e>=0?t:typeof t==`number`?-t:typeof t==`string`&&t.startsWith(`var(`)?`calc(-1 * ${t})`:`-${t}`}:typeof i==`function`?i:()=>void 0}function tT(e){return eT(e,`spacing`,8,`spacing`)}function nT(e,t){return typeof t==`string`||t==null?t:e(t)}var rT=[``];function iT(e,t){let n=e.theme??Ype,r=n?.internal_cache?.unarySpacing??tT(n),i={};for(let n in e){if(!t.has(n))continue;let a=Xw[n]??(rT[0]=n,rT),o=e[n];Bw(i,e.theme,o,(e,t)=>{let n=e?i[e]:i;for(let e=0;e<a.length;e+=1)n[a[e]]=nT(r,t)})}return i}function aT(e){return iT(e,Zw)}aT.propTypes={},aT.filterProps=Zw;function oT(e){return iT(e,Qw)}oT.propTypes={},oT.filterProps=Qw;function sT(e){return iT(e,$w)}sT.propTypes={},sT.filterProps=$w;function Xpe(e=8,t=tT({spacing:e})){if(e.mui)return e;let n=(...e)=>(e.length===0?[1]:e).map(e=>{let n=t(e);return typeof n==`number`?`${n}px`:n}).join(` `);return n.mui=!0,n}function cT(...e){let t=e.reduce((e,t)=>(t.filterProps.forEach(n=>{e[n]=t}),e),{}),n=e=>{let n={};for(let r in e)t[r]&&Fw(n,t[r](e));return n};return n.propTypes={},n.filterProps=e.reduce((e,t)=>e.concat(t.filterProps),[]),n}function lT(e){return typeof e==`number`?`${e}px solid`:e}function uT(e,t){return Kw({prop:e,themeKey:`borders`,transform:t})}var Zpe=uT(`border`,lT),Qpe=uT(`borderTop`,lT),$pe=uT(`borderRight`,lT),eme=uT(`borderBottom`,lT),tme=uT(`borderLeft`,lT),nme=uT(`borderColor`),rme=uT(`borderTopColor`),ime=uT(`borderRightColor`),ame=uT(`borderBottomColor`),ome=uT(`borderLeftColor`),sme=uT(`outline`,lT),cme=uT(`outlineColor`),dT=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){let t=eT(e.theme,`shape.borderRadius`,4,`borderRadius`);return zw(e,e.borderRadius,e=>({borderRadius:nT(t,e)}))}return null};dT.propTypes={},dT.filterProps=[`borderRadius`],cT(Zpe,Qpe,$pe,eme,tme,nme,rme,ime,ame,ome,dT,sme,cme);var fT=e=>{if(e.gap!==void 0&&e.gap!==null){let t=eT(e.theme,`spacing`,8,`gap`);return zw(e,e.gap,e=>({gap:nT(t,e)}))}return null};fT.propTypes={},fT.filterProps=[`gap`];var pT=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){let t=eT(e.theme,`spacing`,8,`columnGap`);return zw(e,e.columnGap,e=>({columnGap:nT(t,e)}))}return null};pT.propTypes={},pT.filterProps=[`columnGap`];var mT=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){let t=eT(e.theme,`spacing`,8,`rowGap`);return zw(e,e.rowGap,e=>({rowGap:nT(t,e)}))}return null};mT.propTypes={},mT.filterProps=[`rowGap`],cT(fT,pT,mT,Kw({prop:`gridColumn`}),Kw({prop:`gridRow`}),Kw({prop:`gridAutoFlow`}),Kw({prop:`gridAutoColumns`}),Kw({prop:`gridAutoRows`}),Kw({prop:`gridTemplateColumns`}),Kw({prop:`gridTemplateRows`}),Kw({prop:`gridTemplateAreas`}),Kw({prop:`gridArea`}));function hT(e,t){return t===`grey`?t:e}cT(Kw({prop:`color`,themeKey:`palette`,transform:hT}),Kw({prop:`bgcolor`,cssProperty:`backgroundColor`,themeKey:`palette`,transform:hT}),Kw({prop:`backgroundColor`,themeKey:`palette`,transform:hT}));function gT(e){return e<=1&&e!==0?`${e*100}%`:e}var lme=Kw({prop:`width`,transform:gT}),_T=e=>e.maxWidth!==void 0&&e.maxWidth!==null?zw(e,e.maxWidth,t=>{let n=e.theme?.breakpoints?.values?.[t]||Lw[t];return n?e.theme?.breakpoints?.unit===`px`?{maxWidth:n}:{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:gT(t)}}):null;_T.filterProps=[`maxWidth`];var ume=Kw({prop:`minWidth`,transform:gT}),dme=Kw({prop:`height`,transform:gT}),fme=Kw({prop:`maxHeight`,transform:gT}),pme=Kw({prop:`minHeight`,transform:gT});Kw({prop:`size`,cssProperty:`width`,transform:gT}),Kw({prop:`size`,cssProperty:`height`,transform:gT}),cT(lme,_T,ume,dme,fme,pme,Kw({prop:`boxSizing`}));var vT={border:{themeKey:`borders`,transform:lT},borderTop:{themeKey:`borders`,transform:lT},borderRight:{themeKey:`borders`,transform:lT},borderBottom:{themeKey:`borders`,transform:lT},borderLeft:{themeKey:`borders`,transform:lT},borderColor:{themeKey:`palette`},borderTopColor:{themeKey:`palette`},borderRightColor:{themeKey:`palette`},borderBottomColor:{themeKey:`palette`},borderLeftColor:{themeKey:`palette`},outline:{themeKey:`borders`,transform:lT},outlineColor:{themeKey:`palette`},borderRadius:{themeKey:`shape.borderRadius`,style:dT},color:{themeKey:`palette`,transform:hT},bgcolor:{themeKey:`palette`,cssProperty:`backgroundColor`,transform:hT},backgroundColor:{themeKey:`palette`,transform:hT},p:{style:oT},pt:{style:oT},pr:{style:oT},pb:{style:oT},pl:{style:oT},px:{style:oT},py:{style:oT},padding:{style:oT},paddingTop:{style:oT},paddingRight:{style:oT},paddingBottom:{style:oT},paddingLeft:{style:oT},paddingX:{style:oT},paddingY:{style:oT},paddingInline:{style:oT},paddingInlineStart:{style:oT},paddingInlineEnd:{style:oT},paddingBlock:{style:oT},paddingBlockStart:{style:oT},paddingBlockEnd:{style:oT},m:{style:aT},mt:{style:aT},mr:{style:aT},mb:{style:aT},ml:{style:aT},mx:{style:aT},my:{style:aT},margin:{style:aT},marginTop:{style:aT},marginRight:{style:aT},marginBottom:{style:aT},marginLeft:{style:aT},marginX:{style:aT},marginY:{style:aT},marginInline:{style:aT},marginInlineStart:{style:aT},marginInlineEnd:{style:aT},marginBlock:{style:aT},marginBlockStart:{style:aT},marginBlockEnd:{style:aT},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:fT},rowGap:{style:mT},columnGap:{style:pT},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:`zIndex`},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:`shadows`},width:{transform:gT},maxWidth:{style:_T},minWidth:{transform:gT},height:{transform:gT},maxHeight:{transform:gT},minHeight:{transform:gT},boxSizing:{},font:{themeKey:`font`},fontFamily:{themeKey:`typography`},fontSize:{themeKey:`typography`},fontStyle:{themeKey:`typography`},fontWeight:{themeKey:`typography`},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:`typography`}},mme={};function hme(){function e(t){if(!t.sx)return null;let{sx:n,theme:r=mme,nested:i}=t,a=r.unstable_sxConfig??vT,o={sx:null,theme:r,nested:!0};function s(n){let s=n;if(typeof n==`function`)s=n(r);else if(typeof n!=`object`)return n;if(!s)return null;let c=r.breakpoints??Rw,l=qpe(c);for(let n in s){let i=_me(s[n],r);if(i!=null){if(typeof i!=`object`){yT(l,n,i,r,a);continue}if(a[n]){yT(l,n,i,r,a);continue}Jpe(c,i)?Bw(l,t.theme,i,(e,t)=>{l[e][n]=t}):(o.sx=i,l[n]=e(o))}}return!i&&r.modularCssLayers?{"@layer sx":Nw(r,Hw(c,l))}:Nw(r,Hw(c,l))}return Array.isArray(n)?n.map(s):s(n)}return e.filterProps=[`sx`],e}var gme=hme();function yT(e,t,n,r,i){let a=i[t];if(!a){e[t]=n;return}if(n==null)return;let{themeKey:o}=a;if(o===`typography`&&n===`inherit`){e[t]=n;return}let{style:s}=a;if(s){Fw(e,s({[t]:n,theme:r}));return}let{cssProperty:c=t,transform:l}=a,u=Ww(r,o);Bw(e,r,n,(n,r)=>{let i=Uw(u,l,r,t);c===!1?n?e[n]=i:Fw(e,i):n?e[n][c]=i:e[c]=i})}function _me(e,t){return typeof e==`function`?e(t):e}function vme(e,t){let n=this;if(n.vars){if(!n.colorSchemes?.[e]||typeof n.getColorSchemeSelector!=`function`)return{};let r=n.getColorSchemeSelector(e);return r===`&`?t:((r.includes(`data-`)||r.includes(`.`))&&(r=`*:where(${r.replace(/\s*&$/,``)}) &`),{[r]:t})}return n.palette.mode===e?t:{}}function yme(e={},...t){let{breakpoints:n={},palette:r={},spacing:i,shape:a={},...o}=e,s=jw(n),c=Xpe(i),l=Aw({breakpoints:s,direction:`ltr`,components:{},palette:{mode:`light`,...r},spacing:c,shape:{...Lpe,...a}},o);return l=Ipe(l),l.applyStyles=vme,l=t.reduce((e,t)=>Aw(e,t),l),l.unstable_sxConfig={...vT,...o?.unstable_sxConfig},l.unstable_sx=function(e){return gme({sx:e,theme:this})},l.internal_cache={},l}yme();function bT(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}var bme=(e,t,n)=>typeof n==`function`?n(e,t):n,xme=e=>{let{runItemPlugins:t,publicAPI:n,store:r}=BC(),i=C.useContext(_w),a=KC(r,bme,e.itemId,i),{id:o,itemId:s,label:c,children:l,rootRef:u}=e,{rootRef:d,contentRef:f,propsEnhancers:p}=t(e),{interactions:m,status:h}=bpe({itemId:s,children:l}),g=C.useRef(null),_=C.useRef(null),v=EC(u,d,g),y=EC(f,_),b=C.useRef(null),x=KC(r,rw.isCheckboxSelectionEnabled),S=KC(r,JC.treeItemIdAttribute,s,o),w=KC(r,Tw.isItemTheDefaultFocusableItem,s),T=KC(r,QC.itemHeight),E={rootRefObject:g,contentRefObject:_,interactions:m},D=e=>t=>{e.onFocus?.(t),!t.defaultMuiPrevented&&!h.focused&&QC.canItemBeFocused(r.state,s)&&t.currentTarget===t.target&&r.focus.focusItem(t,s)},O=e=>t=>{if(e.onBlur?.(t),t.defaultMuiPrevented)return;let n=r.items.getItemDOMElement(s);h.editing||t.relatedTarget&&fw(t.relatedTarget,n)&&(t.target&&t.target?.dataset?.element===`labelInput`&&fw(t.target,n)||t.relatedTarget?.dataset?.element===`labelInput`)||r.focus.removeFocusedItem()},k=e=>t=>{e.onKeyDown?.(t),!(t.defaultMuiPrevented||t.target?.dataset?.element===`labelInput`)&&r.keyboardNavigation.handleItemKeyDown(t,s)},A=e=>t=>{e.onDoubleClick?.(t),!t.defaultMuiPrevented&&m.toggleItemEditing()},j=e=>t=>{e.onClick?.(t),r.items.handleItemClick(t,s),!(t.defaultMuiPrevented||b.current?.contains(t.target))&&(aw.triggerSlot(r.state)===`content`&&m.handleExpansion(t),x||m.handleSelection(t))},M=e=>t=>{e.onMouseDown?.(t),!t.defaultMuiPrevented&&(t.shiftKey||t.ctrlKey||t.metaKey||h.disabled)&&t.preventDefault()},N=e=>t=>{e.onClick?.(t),!t.defaultMuiPrevented&&aw.triggerSlot(r.state)===`iconContainer`&&m.handleExpansion(t)};return{getContextProviderProps:()=>({itemId:s,id:o}),getRootProps:(t={})=>{let n=ph({},OC(e),OC(t));return ph({},ph({},n,{ref:v,role:`treeitem`,tabIndex:w?0:-1,id:S,"aria-expanded":h.expandable?h.expanded:void 0,"aria-disabled":h.disabled||void 0},t,{style:ph({},t.style??{},{"--TreeView-itemDepth":a},T==null?{}:{"--TreeView-itemHeight":`${T}px`}),onFocus:D(n),onBlur:O(n),onKeyDown:k(n)}),p.root?.(ph({},E,{externalEventHandlers:n}))??{})},getContentProps:(e={})=>{let t=OC(e),n=ph({},t,e,{ref:y,onClick:j(t),onMouseDown:M(t)});return[`expanded`,`selected`,`focused`,`disabled`,`editing`,`editable`].forEach(e=>{h[e]&&(n[`data-${e}`]=``)}),ph({},n,p.content?.(ph({},E,{externalEventHandlers:t}))??{})},getGroupTransitionProps:(e={})=>ph({},OC(e),{unmountOnExit:!0,component:`ul`,role:`group`,in:h.expanded,children:l},e),getIconContainerProps:(e={})=>{let t=OC(e);return ph({},t,e,{onClick:N(t)})},getCheckboxProps:(e={})=>{let t=OC(e);return ph({},ph({},t,{ref:b,"aria-hidden":!0},e),p.checkbox?.(ph({},E,{externalEventHandlers:t}))??{})},getLabelProps:(e={})=>{let t=ph({},OC(e)),n=ph({},t,{children:c},e,{onDoubleClick:A(t)});return ph({},p.label?.(ph({},E,{externalEventHandlers:t}))??{},n)},getLabelInputProps:(e={})=>{let t=OC(e);return ph({},e,p.labelInput?.(ph({},E,{externalEventHandlers:t}))??{})},getDragAndDropOverlayProps:(e={})=>{let t=OC(e);return ph({},e,p.dragAndDropOverlay?.(ph({},E,{externalEventHandlers:t}))??{})},getErrorContainerProps:(e={})=>ph({},OC(e),e),getLoadingContainerProps:(e={})=>ph({size:`12px`,thickness:6},OC(e),e),rootRef:v,status:h,publicAPI:n}};function Sme(e){return PC(`MuiTreeItem`,e)}FC(`MuiTreeItem`,[`root`,`content`,`groupTransition`,`iconContainer`,`label`,`checkbox`,`labelInput`,`dragAndDropOverlay`,`errorIcon`,`loadingIcon`]);var Cme=X((0,G.jsx)(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`TreeViewExpandIcon`),wme=X((0,G.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`}),`TreeViewCollapseIcon`),Tme=[`ownerState`];function xT(e,t,n){return e===void 0?t===void 0?n:t:e}function Eme(e){let{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:a}=HC(),o={collapseIcon:xT(t?.collapseIcon,i.collapseIcon,wme),expandIcon:xT(t?.expandIcon,i.expandIcon,Cme),endIcon:xT(t?.endIcon,i.endIcon),icon:t?.icon},s;s=o?.icon?`icon`:r.expandable?r.expanded?`collapseIcon`:`expandIcon`:`endIcon`;let c=o[s],l=mh(jC({elementType:c,externalSlotProps:e=>ph({},AC(a[s],e),AC(n?.[s],e)),ownerState:{}}),Tme);return c?(0,G.jsx)(c,ph({},l)):null}var Dme=J(`div`,{name:`MuiTreeItemDragAndDropOverlay`,slot:`Root`,shouldForwardProp:e=>bT(e)&&e!==`action`})(({theme:e})=>({position:`absolute`,left:0,display:`flex`,top:0,bottom:0,right:0,pointerEvents:`none`,variants:[{props:{action:`make-child`},style:{marginLeft:`calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,backgroundColor:e.alpha((e.vars||e).palette.primary.dark,(e.vars||e).palette.action.focusOpacity)}},{props:{action:`reorder-above`},style:{marginLeft:`calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))`,borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:`reorder-below`},style:{marginLeft:`calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))`,borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:`move-to-parent`},style:{marginLeft:`calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))`,borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function Ome(e){return e.action==null?null:(0,G.jsx)(Dme,ph({},e))}function kme(e){let{children:t,itemId:n,id:r}=e,{wrapItem:i,store:a}=BC(),o=KC(a,JC.treeItemIdAttribute,n,r);return(0,G.jsx)(C.Fragment,{children:i({children:t,itemId:n,store:a,idAttribute:o})})}var Ame=J(`input`,{name:`MuiTreeItem`,slot:`LabelInput`})(({theme:e})=>ph({},e.typography.body1,{width:`100%`,backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:`none`,padding:`0 2px`,boxSizing:`border-box`,"&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),jme=[`visible`],Mme=[`id`,`itemId`,`label`,`disabled`,`disableSelection`,`children`,`slots`,`slotProps`,`classes`],Nme=MC(`MuiTreeItem`),Pme=J(`li`,{name:`MuiTreeItem`,slot:`Root`})({listStyle:`none`,margin:0,padding:0,outline:0}),Fme=J(`div`,{name:`MuiTreeItem`,slot:`Content`,shouldForwardProp:e=>bT(e)&&e!==`status`})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:`100%`,height:`var(--TreeView-itemHeight, unset)`,boxSizing:`border-box`,position:`relative`,display:`flex`,alignItems:`center`,gap:e.spacing(1),cursor:`pointer`,WebkitTapHighlightColor:`transparent`,"&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:`transparent`,cursor:`auto`},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}})),Ime=J(`div`,{name:`MuiTreeItem`,slot:`Label`,shouldForwardProp:e=>bT(e)&&e!==`editable`})(({theme:e})=>ph({width:`100%`,boxSizing:`border-box`,minWidth:0,position:`relative`,overflow:`hidden`},e.typography.body1,{variants:[{props:({editable:e})=>e,style:{paddingLeft:`2px`}}]})),Lme=J(`div`,{name:`MuiTreeItem`,slot:`IconContainer`})({width:16,display:`flex`,flexShrink:0,justifyContent:`center`,position:`relative`,cursor:`inherit`,"& svg":{fontSize:18}}),Rme=J(Zv,{name:`MuiTreeItem`,slot:`GroupTransition`,overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),zme=J(`div`,{name:`MuiTreeItem`,slot:`ErrorIcon`})({position:`absolute`,right:-3,width:7,height:7,borderRadius:`50%`,backgroundColor:`red`}),Bme=J(Rh,{name:`MuiTreeItem`,slot:`LoadingIcon`})({color:`text.primary`}),Vme=J(C.forwardRef((e,t)=>{let{visible:n}=e,r=mh(e,jme);return n?(0,G.jsx)(Cv,ph({},r,{ref:t})):null}),{name:`MuiTreeItem`,slot:`Checkbox`})({padding:0}),Hme=e=>{let{classes:t}=HC();return DC({root:[`root`],content:[`content`],iconContainer:[`iconContainer`],checkbox:[`checkbox`],label:[`label`],groupTransition:[`groupTransition`],labelInput:[`labelInput`],dragAndDropOverlay:[`dragAndDropOverlay`],errorIcon:[`errorIcon`],loadingIcon:[`loadingIcon`]},Sme,ph({},e,{root:K(e?.root,t.root),content:K(e?.content,t.itemContent),iconContainer:K(e?.iconContainer,t.itemIconContainer),checkbox:K(e?.checkbox,t.itemCheckbox),label:K(e?.label,t.itemLabel),groupTransition:K(e?.groupTransition,t.itemGroupTransition),labelInput:K(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:K(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:K(e?.errorIcon,t.itemErrorIcon),loadingIcon:K(e?.loadingIcon,t.itemLoadingIcon)}))},Ume=C.forwardRef(function(e,t){let n=Nme({props:e,name:`MuiTreeItem`}),{id:r,itemId:i,label:a,disabled:o,disableSelection:s,children:c,slots:l={},slotProps:u={},classes:d}=n,f=mh(n,Mme),{getContextProviderProps:p,getRootProps:m,getContentProps:h,getIconContainerProps:g,getCheckboxProps:_,getLabelProps:v,getGroupTransitionProps:y,getLabelInputProps:b,getDragAndDropOverlayProps:x,getErrorContainerProps:S,getLoadingContainerProps:C,status:w}=xme({id:r,itemId:i,children:c,label:a,disabled:o,disableSelection:s}),T=Hme(d),E=l.root??Pme,D=jC({elementType:E,getSlotProps:m,externalForwardedProps:f,externalSlotProps:u.root,additionalProps:{ref:t},ownerState:{},className:T.root}),O=l.content??Fme,k=jC({elementType:O,getSlotProps:h,externalSlotProps:u.content,ownerState:{},className:T.content}),A=l.iconContainer??Lme,j=jC({elementType:A,getSlotProps:g,externalSlotProps:u.iconContainer,ownerState:{},className:T.iconContainer}),M=l.label??Ime,N=jC({elementType:M,getSlotProps:v,externalSlotProps:u.label,ownerState:{},className:T.label}),P=l.checkbox??Vme,F=jC({elementType:P,getSlotProps:_,externalSlotProps:u.checkbox,ownerState:{},className:T.checkbox}),I=l.groupTransition??void 0,L=jC({elementType:I,getSlotProps:y,externalSlotProps:u.groupTransition,ownerState:{},className:T.groupTransition}),R=l.labelInput??Ame,ee=jC({elementType:R,getSlotProps:b,externalSlotProps:u.labelInput,ownerState:{},className:T.labelInput}),z=l.dragAndDropOverlay??Ome,te=jC({elementType:z,getSlotProps:x,externalSlotProps:u.dragAndDropOverlay,ownerState:{},className:T.dragAndDropOverlay}),B=l.errorIcon??zme,V=jC({elementType:B,getSlotProps:S,externalSlotProps:u.errorIcon,ownerState:{},className:T.errorIcon}),ne=l.loadingIcon??Bme,re=jC({elementType:ne,getSlotProps:C,externalSlotProps:u.loadingIcon,ownerState:{},className:T.loadingIcon});return(0,G.jsx)(kme,ph({},p(),{children:(0,G.jsxs)(E,ph({},D,{children:[(0,G.jsxs)(O,ph({},k,{children:[(0,G.jsxs)(A,ph({},j,{children:[w.error&&(0,G.jsx)(B,ph({},V)),w.loading?(0,G.jsx)(ne,ph({},re)):(0,G.jsx)(Eme,{status:w,slots:l,slotProps:u})]})),(0,G.jsx)(P,ph({},F)),w.editing?(0,G.jsx)(R,ph({},ee)):(0,G.jsx)(M,ph({},N)),(0,G.jsx)(z,ph({},te))]})),c&&(0,G.jsx)(Rme,ph({as:I},L))]}))}))}),ST=X((0,G.jsx)(`path`,{d:`M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22z`}),`AcUnit`),CT=X((0,G.jsx)(`path`,{d:`M20 19V3H4v16H2v2h20v-2zM16 9h2v2h-2zm-2 2H6V9h8zm4-4h-2V5h2zm-4-2v2H6V5zM6 19v-6h8v1.82c-.45.32-.75.84-.75 1.43 0 .97.78 1.75 1.75 1.75s1.75-.78 1.75-1.75c0-.59-.3-1.12-.75-1.43V13h2v6z`}),`Blinds`),Wme=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z`}),`CheckBox`),wT=X((0,G.jsx)(`path`,{d:`m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5z`}),`DeviceHub`),Gme=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5M9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8m6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5`}),`GroupWork`),Kme=X((0,G.jsx)(`path`,{d:`M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4`}),`HelpOutline`),TT=X((0,G.jsx)(`path`,{d:`M9 21c0 .5.4 1 1 1h4c.6 0 1-.5 1-1v-1H9zm3-19C8.1 2 5 5.1 5 9c0 2.4 1.2 4.5 3 5.7V17c0 .5.4 1 1 1h6c.6 0 1-.5 1-1v-2.3c1.8-1.3 3-3.4 3-5.7 0-3.9-3.1-7-7-7`}),`Lightbulb`),ET=X((0,G.jsx)(`path`,{d:`M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z`}),`Lock`),DT=X((0,G.jsx)(`path`,{d:`M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z`}),`MeetingRoom`),qme=X((0,G.jsx)(`path`,{d:`M12 11c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3m0 1c-1.84 0-3.56.5-5.03 1.37-.61.35-.97 1.02-.97 1.72V17h12v-1.91c0-.7-.36-1.36-.97-1.72C15.56 12.5 13.84 12 12 12m9.23-3.85 1.85-.77c-1.22-2.91-3.55-5.25-6.46-6.46l-.77 1.85c2.42 1.02 4.36 2.96 5.38 5.38M8.15 2.77 7.38.92C4.47 2.14 2.14 4.47.92 7.38l1.85.77c1.02-2.42 2.96-4.36 5.38-5.38M2.77 15.85l-1.85.77c1.22 2.91 3.55 5.25 6.46 6.46l.77-1.85c-2.42-1.02-4.36-2.96-5.38-5.38m13.08 5.38.77 1.85c2.91-1.22 5.25-3.55 6.46-6.46l-1.85-.77c-1.02 2.42-2.96 4.36-5.38 5.38`}),`SensorOccupied`),OT=X((0,G.jsx)(`path`,{d:`M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13`}),`SmartToy`),kT=X((0,G.jsx)(`path`,{d:`M17 2H7c-1.1 0-2 .9-2 2v16c0 1.1.9 1.99 2 1.99L17 22c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-5 2c1.1 0 2 .9 2 2s-.9 2-2 2c-1.11 0-2-.9-2-2s.89-2 2-2m0 16c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3`}),`Speaker`),AT=X((0,G.jsx)(`path`,{d:`M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4m-4-2V5c0-.55.45-1 1-1s1 .45 1 1v1h-1v1h1v2h-1v1h1v1z`}),`Thermostat`),Jme=X((0,G.jsx)(`path`,{d:`M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5m0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3`}),`ToggleOn`),Yme=X((0,G.jsx)(`path`,{d:`M12 3 2 12h3v8h14v-8h3zm0 13c-1.1 0-2-.9-2-2s2-4 2-4 2 2.9 2 4-.9 2-2 2`}),`WaterDamage`),jT=X((0,G.jsx)(`path`,{d:`M12 2c-5.33 4.55-8 8.48-8 11.8 0 4.98 3.8 8.2 8 8.2s8-3.22 8-8.2c0-3.32-2.67-7.25-8-11.8M7.83 14c.37 0 .67.26.74.62.41 2.22 2.28 2.98 3.64 2.87.43-.02.79.32.79.75 0 .4-.32.73-.72.75-2.13.13-4.62-1.09-5.19-4.12-.08-.45.28-.87.74-.87`}),`WaterDrop`),Xme=X([(0,G.jsx)(`path`,{d:`M4 3h6v2H4zM1 7h5v2H1zm2 12h5v2H3zm10.73-8.39c.75.23 1.3.78 1.57 1.46l4.27-7.11c.65-1.08.3-2.48-.78-3.13-.87-.52-1.99-.41-2.73.29l-3.43 3.21c-.4.37-.63.9-.63 1.45v3.93c.36-.15.98-.33 1.73-.1m-3.12 1.66c.16-.52.48-.96.89-1.27H3.28C2.02 11 1 12.02 1 13.28c0 1.02.67 1.91 1.65 2.19l4.51 1.29c.53.15 1.1.08 1.58-.21l2.69-1.61c-.77-.62-1.13-1.67-.82-2.67m11.6 6.34-2.28-4.1c-.27-.48-.73-.83-1.26-.97l-3.18-.8c.03.32 0 .66-.1.99-.32 1.06-1.28 1.77-2.39 1.77-.61 0-.99-.22-1-.22V21c-1.1 0-2 .9-2 2h6c0-1.1-.9-2-2-2v-4.28l4.61 4.61c.89.89 2.33.89 3.22 0 .72-.72.88-1.83.38-2.72`},`0`),(0,G.jsx)(`path`,{d:`M12.56 14.43c.79.24 1.63-.2 1.87-1 .24-.79-.2-1.63-1-1.87-.79-.24-1.63.2-1.87 1-.24.79.21 1.63 1 1.87`},`1`)],`WindPower`),Zme=({endpoint:e})=>{let t=(0,C.useMemo)(()=>{switch(e.type.name){case`RootNode`:return(0,G.jsx)(wT,{});case`Aggregator`:return(0,G.jsx)(Gme,{});case`OnOffPlugInUnit`:return(0,G.jsx)(Jme,{});case`OnOffLight`:case`ExtendedColorLight`:case`ColorTemperatureLight`:case`DimmableLight`:return(0,G.jsx)(TT,{});case`TemperatureSensor`:return(0,G.jsx)(AT,{});case`Thermostat`:return(0,G.jsx)(ST,{});case`Fan`:return(0,G.jsx)(Xme,{});case`OnOffSensor`:return(0,G.jsx)(Wme,{});case`HumiditySensor`:return(0,G.jsx)(jT,{});case`WindowCovering`:return(0,G.jsx)(CT,{});case`DoorLock`:return(0,G.jsx)(ET,{});case`OccupancySensor`:return(0,G.jsx)(qme,{});case`ContactSensor`:return(0,G.jsx)(DT,{});case`WaterLeakDetector`:return(0,G.jsx)(Yme,{});case`Speaker`:return(0,G.jsx)(kT,{});case`RoboticVacuumCleaner`:return(0,G.jsx)(OT,{});default:return(0,G.jsx)(Kme,{})}},[e]);return(0,G.jsx)(db,{title:`${e.type.name} (${e.type.id})`,children:t})},Qme=e=>{let[t,n]=(0,C.useState)(()=>ehe(e.endpoint)),r=t=>{let n;t&&(n=the(t,e.endpoint)),e.onSelected(n)};return(0,G.jsx)(kpe,{expandedItems:t,onExpandedItemsChange:(e,t)=>n(t),onSelectedItemsChange:(e,t)=>r(t),children:(0,G.jsx)(MT,{endpoint:e.endpoint,sortBy:e.sortBy})})},MT=e=>{let t=(0,C.useMemo)(()=>{let t=[...e.endpoint.parts];switch(e.sortBy){case`name`:return t.sort((e,t)=>{let n=Ax(e.state)??e.id.local,r=Ax(t.state)??t.id.local;return n.localeCompare(r)});case`type`:return t.sort((e,t)=>{let n=e.type?.name??``,r=t.type?.name??``;return n.localeCompare(r)});default:return t.sort((e,t)=>e.endpoint-t.endpoint)}},[e.endpoint.parts,e.sortBy]);return(0,G.jsx)(Ume,{itemId:e.endpoint.id.global,label:(0,G.jsx)($me,{endpoint:e.endpoint}),children:t.map(t=>(0,G.jsx)(MT,{endpoint:t,sortBy:e.sortBy},t.id.global))})},$me=e=>{let{t}=ws(),n=(0,C.useMemo)(()=>{let t=e.endpoint.state.homeAssistantEntity?.entity?.state?.state;return t===`unavailable`||t===`unknown`},[e.endpoint.state]);return(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,children:[(0,G.jsx)(Zme,{endpoint:e.endpoint}),(0,G.jsx)(Z,{marginLeft:1,component:`span`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,overflow:`hidden`,sx:n?{opacity:.6}:void 0,children:(0,G.jsx)(ule,{endpoint:e.endpoint})}),n&&(0,G.jsx)(db,{title:t(`endpoints.entityUnavailable`),children:(0,G.jsx)(Sb,{color:`warning`,sx:{fontSize:16,ml:.5,flexShrink:0}})})]})};function ehe(e){let t=[e.id.global],n=[e];for(;n.length>0;){let e=n.shift();e.parts.length===1&&t.push(e.parts[0].id.global),n.push(...e.parts)}return t}function the(e,t){let n=[t];for(;n.length>0;){let t=n.shift();if(t.id.global===e)return t;n.push(...t.parts)}}var NT=e=>{let t=e.parts??[];return t.length===0?[e]:t.flatMap(e=>NT(e))},nhe=e=>{let{t}=ws(),[n,r]=(0,C.useState)(void 0),[i,a]=(0,C.useState)(`name`),[o,s]=(0,C.useState)(`cards`),[c,l]=(0,C.useState)(``),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),[m,h]=(0,C.useState)(!1),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)(),[b,x]=(0,C.useState)({open:!1,message:``,severity:`success`}),[S,w]=(0,C.useState)({}),T=(0,C.useMemo)(()=>{let t=NT(e.endpoint),n=[];for(let e of t){let t=e.state.homeAssistantEntity?.entity?.entity_id;t&&n.push(t)}return n},[e.endpoint]),E=(0,C.useCallback)(()=>{T.length!==0&&NS(T).then(w).catch(()=>{})},[T]);(0,C.useEffect)(()=>{E()},[E]);let D=(0,C.useCallback)(()=>{E()},[E]),O=(0,C.useCallback)(async(e,t)=>{if(t){_(e);try{y((await PS(t)).mappings.find(t=>t.entityId===e))}catch{y(void 0)}h(!0)}},[]),k=(0,C.useCallback)(async t=>{if(!(!e.bridgeId||!g))try{await FS(e.bridgeId,g,t),x({open:!0,message:`Mapping saved for ${g}. Restart the bridge to apply changes.`,severity:`success`}),h(!1),e.onMappingSaved?.()}catch(e){x({open:!0,message:`Failed to save mapping: ${e}`,severity:`error`})}},[e.bridgeId,g,e.onMappingSaved]),A=(0,C.useCallback)(e=>{let t=e.state.homeAssistantEntity?.entity?.state?.state;return t===`unavailable`||t===`unknown`},[]),j=(0,C.useMemo)(()=>NT(e.endpoint).filter(A).length,[e.endpoint,A]),M=(0,C.useMemo)(()=>[...NT(e.endpoint).filter(e=>{if(f&&!A(e))return!1;let t=Ax(e.state)??e.id.local,n=e.type.name,r=c.toLowerCase();return t.toLowerCase().includes(r)||n.toLowerCase().includes(r)})].sort((e,t)=>{let n=Ax(e.state)??e.id.local,r=Ax(t.state)??t.id.local;switch(i){case`name`:return n.localeCompare(r);case`endpoint`:return e.id.local.localeCompare(t.id.local);case`type`:return e.type.name.localeCompare(t.type.name);default:return 0}}),[e.endpoint,c,i,f,A]),N=e=>{r(e),d(!0)};return(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:2,gap:2,flexWrap:`wrap`,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsxs)(Q,{variant:`h6`,component:`span`,children:[t(`endpoints.title`),` (`,M.length,`)`]}),(0,G.jsx)(db,{title:t(`endpoints.viewAll`),children:(0,G.jsx)(Bh,{component:ua,to:J9.devices,size:`small`,color:`primary`,children:(0,G.jsx)(mb,{})})})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,flexGrow:1,children:[(0,G.jsx)(ES,{size:`small`,placeholder:t(`endpoints.searchPlaceholder`),value:c,onChange:e=>l(e.target.value),sx:{flexGrow:1,maxWidth:300}}),j>0&&(0,G.jsx)(db,{title:f?t(`endpoints.showAll`):t(`endpoints.showUnavailable`,{count:j}),children:(0,G.jsx)(Bh,{size:`small`,color:f?`warning`:`default`,onClick:()=>p(e=>!e),"aria-label":f?`Show all entities`:`Show ${j} unavailable entities`,children:(0,G.jsx)(Lx,{badgeContent:j,color:`warning`,max:99,children:(0,G.jsx)(Sb,{})})})}),(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:120},children:[(0,G.jsx)(Bx,{id:`sort-label`,children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:.5,children:[(0,G.jsx)(Mx,{fontSize:`small`}),` `,t(`endpoints.sortBy`)]})}),(0,G.jsxs)(SS,{labelId:`sort-label`,value:i,label:t(`endpoints.sortBy`),onChange:e=>a(e.target.value),children:[(0,G.jsx)(CS,{value:`name`,children:t(`endpoints.sortName`)}),(0,G.jsx)(CS,{value:`endpoint`,children:t(`endpoints.sortEndpoint`)}),(0,G.jsx)(CS,{value:`type`,children:t(`endpoints.sortType`)})]})]}),(0,G.jsxs)(Xue,{value:o,exclusive:!0,onChange:(e,t)=>t&&s(t),size:`small`,"aria-label":`View mode`,children:[(0,G.jsx)(AS,{value:`cards`,"aria-label":`Card view`,children:(0,G.jsx)(db,{title:t(`endpoints.cardView`),children:(0,G.jsx)(ple,{})})}),(0,G.jsx)(AS,{value:`tree`,"aria-label":`Tree view`,children:(0,G.jsx)(db,{title:t(`endpoints.treeView`),children:(0,G.jsx)(mle,{})})})]})]})]}),o===`cards`?(0,G.jsx)(Fv,{container:!0,spacing:2,children:M.map(t=>(0,G.jsx)(Fv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(tC,{endpoint:t,bridgeId:e.bridgeId,onClick:()=>N(t),onEditMapping:e.bridgeId?O:void 0,imageInfo:S[t.state.homeAssistantEntity?.entity?.entity_id??``],onImageChanged:D})},t.id.global))}):(0,G.jsxs)(Fv,{container:!0,spacing:2,children:[(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsx)(Qme,{endpoint:e.endpoint,onSelected:r,sortBy:i})}),(0,G.jsx)(Fv,{size:{xs:12,md:8},children:n&&(0,G.jsx)(SC,{endpoint:n})})]}),(0,G.jsxs)(Rb,{open:u,onClose:()=>d(!1),maxWidth:`md`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:n&&(Ax(n.state)??n.id.local)}),(0,G.jsx)(Bb,{children:n&&(0,G.jsx)(SC,{endpoint:n})})]}),e.bridgeId&&(0,G.jsx)(QS,{open:m,onClose:()=>h(!1),entityId:g,domain:g.split(`.`)[0]||``,currentMapping:v,onSave:k}),(0,G.jsx)($h,{open:b.open,autoHideDuration:6e3,onClose:()=>x({...b,open:!1}),children:(0,G.jsx)(Uh,{onClose:()=>x({...b,open:!1}),severity:b.severity,sx:{width:`100%`},children:b.message})})]})},PT=X((0,G.jsx)(`path`,{d:`M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z`}),`Download`),FT=X((0,G.jsx)(`path`,{d:`M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6`}),`Settings`),IT=X((0,G.jsx)(`path`,{d:`M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z`}),`Upload`);async function rhe(e,t,n){let r=new URLSearchParams({name:t});n?.length&&r.set(`entityIds`,n.join(`,`));let i=await fetch(`api/mapping-profiles/export/${e}?${r.toString()}`);return await M_(i,`Failed to export mapping profile`),j_(i)}async function ihe(e,t,n){let r=await fetch(`api/mapping-profiles/import/preview/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t,availableEntityIds:n})});return await M_(r,`Failed to preview import`),j_(r)}async function ahe(e,t,n){let r=await fetch(`api/mapping-profiles/import/apply/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t,selectedEntityIds:n})});return await M_(r,`Failed to apply mapping profile`),j_(r)}function ohe({bridgeId:e}){let{t}=ws(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[v,y]=(0,C.useState)(new Set),[b,x]=(0,C.useState)(!1),[S,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(new Set),[D,O]=(0,C.useState)(`Bridge Mappings`),k=(0,C.useRef)(null),A=(0,C.useCallback)(async()=>{try{r(await PS(e)),s(null)}catch{s(t(`mapping.loadFailed`))}finally{a(!1)}},[e,t]);(0,C.useEffect)(()=>{A()},[A]);let j=(0,C.useCallback)(()=>{p({entityId:``,domain:``}),d(!0)},[]),M=(0,C.useCallback)((e,t)=>{p({entityId:e,domain:e.split(`.`)[0]||``,config:t}),d(!0)},[]),N=(0,C.useCallback)(async n=>{try{await ede(e,n),await A()}catch{s(t(`mapping.deleteFailed`))}},[e,A,t]),P=(0,C.useCallback)(async n=>{if(n.entityId)try{await FS(e,n.entityId,n),d(!1),p(null),await A()}catch{s(t(`mapping.saveFailed`,{error:``}))}},[e,A,t]),F=(0,C.useCallback)(()=>{d(!1),p(null)},[]),I=n?.mappings??[],L=(0,C.useCallback)(()=>{E(new Set(I.map(e=>e.entityId))),O(`Bridge Mappings`),w(!0)},[I]),R=(0,C.useCallback)(async()=>{try{let t=await rhe(e,D,[...T]),n=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`mapping-profile-${e.slice(0,8)}.json`,i.click(),URL.revokeObjectURL(r),w(!1)}catch{s(`Failed to export mapping profile`)}},[e,T,D]),ee=(0,C.useCallback)(()=>{w(!1)},[]),z=(0,C.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),te=(0,C.useCallback)(()=>{E(e=>e.size===I.length?new Set:new Set(I.map(e=>e.entityId)))},[I]),B=(0,C.useCallback)(()=>{k.current?.click()},[]),V=(0,C.useCallback)(async t=>{let r=t.target.files?.[0];if(r){t.target.value=``;try{let t=await r.text(),i=JSON.parse(t);if(!i.version||!i.entries){s(`Invalid mapping profile file`);return}let a=await ihe(e,i,(n?.mappings??[]).map(e=>e.entityId));_(i),h(a),y(new Set(a.matches.map(e=>e.matchedEntityId)))}catch{s(`Failed to parse mapping profile file`)}}},[e,n]),ne=(0,C.useCallback)(async()=>{if(g){x(!0);try{let t=await ahe(e,g,[...v]);h(null),_(null),y(new Set),l(`Imported ${t.applied} mapping(s)${t.skipped>0?`, ${t.skipped} skipped`:``}${t.errors.length>0?`, ${t.errors.length} error(s)`:``}`),await A()}catch{s(`Failed to apply mapping profile`)}finally{x(!1)}}},[e,g,v,A]),re=(0,C.useCallback)(()=>{h(null),_(null),y(new Set)},[]),ie=(0,C.useCallback)(e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return(0,G.jsxs)(hv,{children:[(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:2,children:[(0,G.jsxs)(Q,{variant:`h6`,children:[(0,G.jsx)(FT,{sx:{mr:1,verticalAlign:`middle`}}),t(`mapping.title`)]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:1,children:[I.length>0&&(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(IT,{}),onClick:L,children:t(`common.export`)}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(PT,{}),onClick:B,children:t(`common.import`)}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,onClick:j,children:t(`mapping.addMapping`)})]}),(0,G.jsx)(`input`,{ref:k,type:`file`,accept:`.json`,style:{display:`none`},onChange:V})]}),o&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},onClose:()=>s(null),children:o}),c&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},icon:(0,G.jsx)(lv,{}),onClose:()=>l(null),children:c}),i&&(0,G.jsxs)(Q,{color:`text.secondary`,children:[t(`common.loading`),`...`]}),!i&&I.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,children:t(`mapping.noMappings`)}),!i&&I.length>0&&(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:t(`mapping.entityId`)}),(0,G.jsx)(mC,{children:t(`mapping.deviceType`)}),(0,G.jsx)(mC,{children:t(`mapping.customName`)}),(0,G.jsx)(mC,{children:t(`mapping.status`)}),(0,G.jsx)(mC,{align:`right`,children:t(`common.actions`)})]})}),(0,G.jsx)(pC,{children:I.map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,children:e.entityId})}),(0,G.jsx)(mC,{children:e.matterDeviceType||(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`Auto`})}),(0,G.jsx)(mC,{children:e.customName||(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`-`})}),(0,G.jsx)(mC,{children:e.disabled?(0,G.jsx)(Ev,{label:t(`common.disabled`),color:`error`,size:`small`}):(0,G.jsx)(Ev,{label:t(`common.enabled`),color:`success`,size:`small`})}),(0,G.jsxs)(mC,{align:`right`,children:[(0,G.jsx)(Bh,{size:`small`,onClick:()=>M(e.entityId,e),"aria-label":`Edit mapping for ${e.entityId}`,children:(0,G.jsx)(hb,{fontSize:`small`})}),(0,G.jsx)(Bh,{size:`small`,onClick:()=>N(e.entityId),"aria-label":`Delete mapping for ${e.entityId}`,children:(0,G.jsx)(LS,{fontSize:`small`})})]})]},e.entityId))})]})})]}),f&&(0,G.jsx)(QS,{open:u,entityId:f.entityId,domain:f.domain,currentMapping:f.config,onSave:P,onClose:F}),(0,G.jsxs)(Rb,{open:S,onClose:ee,maxWidth:`md`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:t(`mapping.exportProfile`)}),(0,G.jsx)(Bb,{children:(0,G.jsxs)(Hv,{spacing:2,sx:{mt:1},children:[(0,G.jsx)(ES,{label:t(`mapping.profileName`),size:`small`,fullWidth:!0,value:D,onChange:e=>O(e.target.value)}),(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{padding:`checkbox`,children:(0,G.jsx)(Cv,{size:`small`,checked:T.size===I.length,indeterminate:T.size>0&&T.size<I.length,onChange:te})}),(0,G.jsx)(mC,{children:t(`mapping.entityId`)}),(0,G.jsx)(mC,{children:t(`mapping.deviceType`)}),(0,G.jsx)(mC,{children:t(`mapping.customName`)})]})}),(0,G.jsx)(pC,{children:I.map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{padding:`checkbox`,children:(0,G.jsx)(Cv,{size:`small`,checked:T.has(e.entityId),onChange:()=>z(e.entityId)})}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,children:e.entityId})}),(0,G.jsx)(mC,{children:e.matterDeviceType||(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`Auto`})}),(0,G.jsx)(mC,{children:e.customName||(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`-`})})]},e.entityId))})]})})]})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:ee,children:t(`common.cancel`)}),(0,G.jsxs)(mv,{variant:`contained`,onClick:R,disabled:T.size===0,startIcon:(0,G.jsx)(IT,{}),children:[t(`common.export`),` `,T.size]})]})]}),(0,G.jsxs)(Rb,{open:!!m,onClose:re,maxWidth:`md`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:t(`mapping.importProfile`)}),(0,G.jsx)(Bb,{children:m&&(0,G.jsxs)(Hv,{spacing:2,sx:{mt:1},children:[(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Profile: `,(0,G.jsx)(`strong`,{children:m.profileName}),`,`,` `,m.totalEntries,` entries,`,` `,m.matches.length,` matched`]}),m.matches.length>0&&(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{padding:`checkbox`}),(0,G.jsx)(mC,{children:t(`mapping.entityId`)}),(0,G.jsx)(mC,{children:t(`mapping.match`)}),(0,G.jsx)(mC,{children:t(`mapping.deviceType`)}),(0,G.jsx)(mC,{children:t(`mapping.existing`)})]})}),(0,G.jsx)(pC,{children:m.matches.map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{padding:`checkbox`,children:(0,G.jsx)(Cv,{size:`small`,checked:v.has(e.matchedEntityId),onChange:()=>ie(e.matchedEntityId)})}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,fontFamily:`monospace`,children:e.matchedEntityId})}),(0,G.jsx)(mC,{children:(0,G.jsx)(Ev,{label:e.matchType,size:`small`,color:e.matchType===`exact`?`success`:`default`,variant:`outlined`})}),(0,G.jsx)(mC,{children:e.entry.matterDeviceType||`Auto`}),(0,G.jsx)(mC,{children:e.existingMapping?(0,G.jsx)(Ev,{label:t(`common.overwrite`),size:`small`,color:`warning`,variant:`outlined`}):(0,G.jsx)(Ev,{label:t(`common.new`),size:`small`,color:`info`,variant:`outlined`})})]},e.matchedEntityId))})]})}),m.unmatchedEntries.length>0&&(0,G.jsxs)(Uh,{severity:`info`,children:[m.unmatchedEntries.length,` entries could not be matched to entities on this bridge.`]})]})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:re,children:t(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:ne,disabled:b||v.size===0,children:b?t(`mapping.applying`):t(`mapping.applyCount`,{count:v.size})})]})]})]})}var LT=B_([e=>e.bridges],e=>e.items),she=e=>B_([LT],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(t=>t.id===e)})),che=B_([LT],e=>{if(!e.isInitialized)return;let t={};return(e.content?.map(e=>[e.port,e.id])??[]).forEach(([e,n])=>{t[e]=n}),t});function RT(){return Y_(LT)}function zT(){return Y_(che)}function BT(e){return Y_((0,C.useMemo)(()=>she(e),[e]))}function VT(){let e=J_();return(0,C.useCallback)(async t=>{let n=await e(H_(t));if(n.meta.requestStatus===`rejected`)throw n.error;return n.payload},[e])}function lhe(){let e=J_();return(0,C.useCallback)(async t=>{let n=await e(W_(t));if(n.meta.requestStatus===`rejected`)throw n.error;return n.payload},[e])}function uhe(){let e=J_();return(0,C.useCallback)(async t=>{let n=await e(G_(t));if(n.meta.requestStatus===`rejected`)throw n.error;return n.payload},[e])}function HT(){let e=J_();return(0,C.useCallback)(async t=>{let n=await e(U_(t));if(n.meta.requestStatus===`rejected`)throw n.error},[e])}function dhe(){let e=J_();return(0,C.useCallback)(async t=>{await Pre(t),await e(V_())},[e])}function fhe(){let e=J_();return(0,C.useCallback)(async t=>{let n=await F_(t);return await e(V_()),n},[e])}var phe=e=>e.devices,mhe=e=>B_([phe],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function hhe(e){return Y_((0,C.useMemo)(()=>mhe(e),[e]))}function ghe(e,t){let[n,r]=(0,C.useState)(e);return(0,C.useEffect)(()=>{let n=e;t();let i=setInterval(()=>{n--,n===0&&(t(),n=e),r(n)},1e3);return()=>clearInterval(i)},[e,t]),n}async function _he(e){let t=await fetch(`api/matter/bridges/${e}/devices`);return await M_(t,`Failed to fetch devices`),j_(t)}var UT=z_(`devices/load`,_he),vhe=X((0,G.jsx)(`path`,{d:`M12 8c1.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`}),`MoreVert`),yhe=X((0,G.jsx)(`path`,{d:`M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93`}),`RotateLeft`);function bhe(e){return Jd(`MuiDialogContentText`,e)}Yd(`MuiDialogContentText`,[`root`]);var xhe=e=>{let{classes:t}=e,n=Cp({root:[`root`]},bhe,t);return{...t,...n}},She=J(Q,{shouldForwardProp:e=>Dm(e)||e===`classes`,name:`MuiDialogContentText`,slot:`Root`})({}),Che=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiDialogContentText`}),{children:r,className:i,...a}=n,o=xhe(a);return(0,G.jsx)(She,{component:`p`,variant:`body1`,color:`textSecondary`,ref:t,ownerState:a,className:K(o.root,i),...n,classes:o})});function WT({open:e,title:t,message:n,confirmLabel:r=`Confirm`,cancelLabel:i=`Cancel`,confirmColor:a=`error`,onConfirm:o,onCancel:s}){return(0,G.jsxs)(Rb,{open:e,onClose:s,maxWidth:`xs`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:t}),(0,G.jsx)(Bb,{children:(0,G.jsx)(Che,{children:n})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:s,autoFocus:!0,children:i}),(0,G.jsx)(mv,{onClick:o,color:a,variant:`contained`,children:r})]})]})}var whe=({bridge:e})=>{let[t,n]=C.useState(null),r=!!t,i=Nr(),a=qv(),{t:o}=ws(),s=uhe(),c=HT(),l=fhe(),[u,d]=C.useState(null),f=e=>n(e.currentTarget),p=()=>n(null);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Bh,{onClick:f,children:(0,G.jsx)(vhe,{})}),(0,G.jsxs)(Zx,{open:r,onClose:p,anchorEl:t,children:[(0,G.jsxs)(CS,{component:ua,to:J9.editBridge(e),children:[(0,G.jsx)(iy,{children:(0,G.jsx)(hb,{fontSize:`small`})}),(0,G.jsx)(oy,{children:o(`common.edit`)})]}),(0,G.jsx)(Ub,{}),(0,G.jsxs)(CS,{onClick:async()=>{p(),await l(e).then(e=>a.show({message:`Synced ${e.syncedCount} devices to controllers`,severity:`success`})).catch(e=>a.show({message:`Failed to sync: ${e?.message??JSON.stringify(e)}`,severity:`error`}))},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(xb,{fontSize:`small`})}),(0,G.jsx)(oy,{children:o(`bridge.forceSync`)})]}),(0,G.jsxs)(CS,{onClick:()=>{p(),d(`reset`)},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(yhe,{fontSize:`small`})}),(0,G.jsx)(oy,{children:o(`bridge.factoryReset`)})]}),(0,G.jsxs)(CS,{onClick:()=>{p(),d(`delete`)},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(LS,{fontSize:`small`})}),(0,G.jsx)(oy,{children:o(`common.delete`)})]})]}),(0,G.jsx)(WT,{open:u===`reset`,title:o(`bridge.confirmResetTitle`),message:o(`bridge.confirmResetMessage`),confirmLabel:o(`common.reset`),confirmColor:`warning`,onConfirm:async()=>{d(null),await s(e).then(()=>a.show({message:o(`bridge.resetSuccess`),severity:`success`})).catch(e=>a.show({message:`Failed to reset bridge: ${e?.message??JSON.stringify(e)}`,severity:`error`}))},onCancel:()=>d(null)}),(0,G.jsx)(WT,{open:u===`delete`,title:o(`bridge.confirmDeleteTitle`),message:o(`bridge.confirmDeleteMessage`),confirmLabel:o(`common.delete`),confirmColor:`error`,onConfirm:async()=>{d(null),await c(e).then(()=>a.show({message:o(`bridge.deleteSuccess`),severity:`success`})).then(()=>i(J9.bridges)).catch(e=>a.show({message:`Failed to delete bridge: ${e?.message??JSON.stringify(e)}`,severity:`error`}))},onCancel:()=>d(null)})]})},The=(0,C.memo)(Qce),Ehe=({failedEntities:e})=>{let{t}=ws(),[n,r]=(0,C.useState)(!1);return!e||e.length===0?null:(0,G.jsxs)(Uh,{severity:`warning`,sx:{cursor:`pointer`},onClick:()=>r(!n),children:[(0,G.jsxs)(Q,{variant:`body2`,children:[(0,G.jsx)(`strong`,{children:t(`bridge.failedEntitiesCount`,{count:e.length})}),` `,t(n?`bridge.clickToHide`:`bridge.clickToShow`)]}),(0,G.jsx)(Zv,{in:n,children:(0,G.jsx)($v,{dense:!0,sx:{mt:1},children:e.map(e=>(0,G.jsxs)(ny,{sx:{py:0},children:[(0,G.jsx)(iy,{sx:{minWidth:32},children:(0,G.jsx)(Yv,{color:`warning`,fontSize:`small`})}),(0,G.jsx)(oy,{primary:e.entityId,secondary:e.reason,primaryTypographyProps:{variant:`body2`,fontWeight:`bold`},secondaryTypographyProps:{variant:`caption`}})]},e.entityId))})})]})},Dhe=()=>{let{t:e}=ws(),t=qv(),n=J_(),{bridgeId:r}=Lr(),[i,a]=(0,C.useState)(0),o=(0,C.useCallback)(()=>{a(e=>e+1)},[]),s=ghe(10,(0,C.useCallback)(()=>{n(UT(r))},[n,r])),{content:c,isLoading:l,error:u}=BT(r),{content:d,error:f}=hhe(r);return(0,C.useEffect)(()=>{u&&t.show({message:u.message??e(`bridge.loadFailed`),severity:`error`})},[u,t,e]),(0,C.useEffect)(()=>{f?.message&&t.show({message:f.message,severity:`error`})},[f,t]),!c&&l?e(`common.loading`):c?(0,G.jsxs)(Hv,{spacing:4,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:c.name,to:J9.bridge(r)}]}),(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,children:[(0,G.jsxs)(Q,{variant:`h4`,children:[c.name,` `,(0,G.jsx)(wx,{status:c.status})]}),(0,G.jsx)(whe,{bridge:r})]}),(0,G.jsx)(sle,{status:c.status,reason:c.statusReason}),c.status===`running`&&c.commissioning&&!c.commissioning.isCommissioned&&c.commissioning.fabrics.length===0&&(0,G.jsxs)(Uh,{severity:`info`,icon:(0,G.jsx)(Jv,{}),children:[(0,G.jsx)(Xv,{children:e(`bridge.pairHint`)}),(0,G.jsx)(Q,{variant:`body2`,sx:{mb:1},children:e(`bridge.pairDescription`)})]}),c.failedEntities&&c.failedEntities.length>0&&(0,G.jsx)(Ehe,{failedEntities:c.failedEntities}),(0,G.jsx)(Ahe,{bridge:c,devices:d}),(0,G.jsx)(The,{bridge:c}),d&&(0,G.jsx)(fle,{devices:d}),(0,G.jsx)(ohe,{bridgeId:r},i),d&&(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,alignItems:`center`,children:s!=null&&(0,G.jsx)(db,{title:e(`bridge.refreshHint`),children:(0,G.jsx)(Q,{variant:`body2`,color:`textSecondary`,children:e(`bridge.refreshingStates`,{seconds:s-1})})})}),(0,G.jsx)(nhe,{endpoint:d,bridgeId:r,onMappingSaved:o})]})]}):e(`common.notFound`)};function Ohe(e){return e.type.name===`RoboticVacuumCleaner`?!0:e.parts.some(Ohe)}function khe(e){if(e.type.name===`Aggregator`)return e.parts.length;let t=0;for(let n of e.parts)t+=khe(n);return t}var Ahe=({bridge:e,devices:t})=>{let{t:n}=ws(),r=qv(),[i,a]=(0,C.useState)(!1),o=(0,C.useMemo)(()=>{if(!t||e.featureFlags?.serverMode||!Ohe(t))return!1;let n=e.commissioning?.fabrics??[];if(n.length===0)return!0;let r=new Set([4937,4631,4448]);return n.some(e=>r.has(e.rootVendorId))},[t,e.featureFlags?.serverMode,e.commissioning?.fabrics]),s=(0,C.useMemo)(()=>t?khe(t)===1:!1,[t]);return o?(0,G.jsxs)(Uh,{severity:`warning`,icon:(0,G.jsx)(uv,{}),action:s?(0,G.jsx)(mv,{color:`warning`,size:`small`,variant:`outlined`,onClick:async()=>{a(!0);try{await P_({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),r.show({message:n(`bridge.serverModeEnabled`),severity:`success`})}catch(e){r.show({message:n(`bridge.serverModeEnableFailed`,{error:e instanceof Error?e.message:String(e)}),severity:`error`})}finally{a(!1)}},disabled:i,startIcon:i?(0,G.jsx)(Rh,{size:16}):void 0,sx:{whiteSpace:`nowrap`},children:n(i?`bridge.enabling`:`bridge.enableServerMode`)}):void 0,children:[(0,G.jsx)(Xv,{children:n(`bridge.serverModeRecommended`)}),(0,G.jsx)(Q,{variant:`body2`,children:n(`bridge.serverModeDescription`)}),!s&&(0,G.jsx)(Q,{variant:`body2`,sx:{mt:1},children:n(`bridge.serverModeSingleDeviceNote`)})]}):null},GT=X((0,G.jsx)(`path`,{d:`M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z`}),`AccountTree`),KT=X((0,G.jsx)(`path`,{d:`m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z`}),`ArrowDownward`),jhe=X((0,G.jsx)(`path`,{d:`m7 10 5 5 5-5z`}),`ArrowDropDown`),Mhe=X((0,G.jsx)(`path`,{d:`m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z`}),`ArrowForward`),Nhe=X((0,G.jsx)(`path`,{d:`m10 17 5-5-5-5z`}),`ArrowRight`),qT=X((0,G.jsx)(`path`,{d:`m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z`}),`ArrowUpward`),JT=X((0,G.jsx)(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),Phe=X((0,G.jsx)(`path`,{d:`M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26`}),`Autorenew`),YT=X((0,G.jsx)(`path`,{d:`M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z`}),`Backup`),Fhe=X((0,G.jsxs)(C.Fragment,{children:[(0,G.jsx)(`path`,{fillOpacity:`.3`,d:`M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h10V5.33z`}),(0,G.jsx)(`path`,{d:`M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z`})]}),`Battery80`),Ihe=X((0,G.jsx)(`path`,{d:`M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66s.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21`}),`Bolt`),XT=X((0,G.jsx)(`path`,{d:`M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z`}),`BugReport`),Lhe=X([(0,G.jsx)(`path`,{d:`M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2`},`0`),(0,G.jsx)(`path`,{d:`m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z`},`1`)],`Cameraswitch`),Rhe=X((0,G.jsx)(`path`,{d:`M1 18v3h3c0-1.66-1.34-3-3-3m0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7m18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11m20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2`}),`CastConnected`),zhe=X([(0,G.jsx)(`path`,{d:`m12 2-5.5 9h11z`},`0`),(0,G.jsx)(`circle`,{cx:`17.5`,cy:`17.5`,r:`4.5`},`1`),(0,G.jsx)(`path`,{d:`M3 13.5h8v8H3z`},`2`)],`Category`),Bhe=X((0,G.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z`}),`Check`),ZT=X((0,G.jsx)(`path`,{d:`M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5m3 10h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3z`}),`CleaningServices`),Vhe=X((0,G.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`}),`Clear`),Hhe=X((0,G.jsx)(`path`,{d:`M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z`}),`ClearAll`),QT=X((0,G.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`}),`Close`),Uhe=X((0,G.jsx)(`path`,{d:`M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z`}),`CloudUpload`),Whe=X((0,G.jsx)(`path`,{d:`M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z`}),`Computer`),Ghe=X((0,G.jsx)(`path`,{d:`M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1`}),`DarkMode`),$T=X((0,G.jsx)(`path`,{d:`M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z`}),`DeleteOutline`),Khe=X((0,G.jsx)(`path`,{d:`M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z`}),`DirectionsRun`),qhe=X((0,G.jsx)(`path`,{d:`M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z`}),`DoorFront`),Jhe=X((0,G.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`}),`DragIndicator`),Yhe=X([(0,G.jsx)(`path`,{d:`M21 14c0-.55-.45-1-1-1h-2v2h2c.55 0 1-.45 1-1m-1 3h-2v2h2c.55 0 1-.45 1-1s-.45-1-1-1m-8-3h-2v4h2c0 1.1.9 2 2 2h3v-8h-3c-1.1 0-2 .9-2 2`},`0`),(0,G.jsx)(`path`,{d:`M5 13c0-1.1.9-2 2-2h1.5c1.93 0 3.5-1.57 3.5-3.5S10.43 4 8.5 4H5c-.55 0-1 .45-1 1s.45 1 1 1h3.5c.83 0 1.5.67 1.5 1.5S9.33 9 8.5 9H7c-2.21 0-4 1.79-4 4s1.79 4 4 4h2v-2H7c-1.1 0-2-.9-2-2`},`1`)],`ElectricalServices`),eE=X((0,G.jsx)(`path`,{d:`M17 10H7v2h10zm2-7h-1V1h-2v2H8V1H6v2H5c-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-2m0 16H5V8h14zm-5-5H7v2h7z`}),`EventNote`),tE=X((0,G.jsx)(`path`,{d:`M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11`}),`Extension`),Xhe=X((0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),`FiberManualRecord`),Zhe=X((0,G.jsx)(`path`,{d:`M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z`}),`FolderOpen`),Qhe=X((0,G.jsx)(`path`,{d:`M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z`}),`Fullscreen`),$he=X((0,G.jsx)(`path`,{d:`M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z`}),`FullscreenExit`),nE=X([(0,G.jsx)(`circle`,{cx:`15`,cy:`13`,r:`1`},`0`),(0,G.jsx)(`circle`,{cx:`9`,cy:`13`,r:`1`},`1`),(0,G.jsx)(`path`,{d:`m8.33 7.5-.66 2h8.66l-.66-2z`},`2`),(0,G.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15.69c0 .45-.35.81-.78.81h-.44c-.44 0-.78-.36-.78-.81V16.5H7v1.19c0 .45-.35.81-.78.81h-.44c-.43 0-.78-.36-.78-.81v-6.5c.82-2.47 1.34-4.03 1.56-4.69.05-.16.12-.29.19-.4.02-.02.03-.04.05-.06.38-.53.92-.54.92-.54h8.56s.54.01.92.53c.02.03.03.05.05.07.07.11.14.24.19.4.22.66.74 2.23 1.56 4.69z`},`3`)],`Garage`),rE=X((0,G.jsx)(`path`,{d:`M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z`}),`Home`),ege=X((0,G.jsx)(`path`,{d:`M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z`}),`HourglassEmpty`),iE=X((0,G.jsx)(`path`,{d:`M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77Q17.34 17 18 17c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z`}),`Hub`),aE=X((0,G.jsx)(`path`,{d:`M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z`}),`Label`),tge=X((0,G.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 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z`}),`Language`),nge=X((0,G.jsx)(`path`,{d:`M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z`}),`Launch`),rge=X((0,G.jsx)(`path`,{d:`M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9H9V9h10zm-4 4H9v-2h6zm4-8H9V5h10z`}),`LibraryBooks`),ige=X((0,G.jsx)(`path`,{d:`M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z`}),`LightMode`),oE=X((0,G.jsx)(`path`,{d:`m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z`}),`Map`),sE=X((0,G.jsx)(`path`,{d:`M15 9H9v6h6zm-2 4h-2v-2h2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2zm-4 6H7V7h10z`}),`Memory`),age=X((0,G.jsx)(`path`,{d:`M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z`}),`Menu`),oge=X((0,G.jsx)(`path`,{d:`M12 14.67 3.41 6.09 2 7.5l8.5 8.5H4v2h16v-2h-6.5l5.15-5.15c.26.1.55.15.85.15 1.38 0 2.5-1.12 2.5-2.5S20.88 6 19.5 6 17 7.12 17 8.5c0 .35.07.67.2.97z`}),`NetworkPing`),sge=X((0,G.jsx)(`path`,{d:`m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68zm-10 5h-2v-2h2zm0-4h-2V7h2z`}),`NewReleases`),cE=X((0,G.jsx)(`path`,{d:`M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z`}),`OpenInNew`),lE=X((0,G.jsx)(`path`,{d:`M8 5v14l11-7z`}),`PlayArrow`),cge=X((0,G.jsx)(`path`,{d:`M16.01 7 16 3h-2v4h-4V3H8v4h-.01C7 6.99 6 7.99 6 8.99v5.49L9.5 18v3h5v-3l3.5-3.51v-5.5c0-1-1-2-1.99-1.99`}),`Power`),lge=X((0,G.jsx)(`path`,{d:`M18 14.49V9c0-1-1.01-2.01-2-2V3h-2v4h-4V3H8v2.48l9.51 9.5zm-1.76 1.77L7.2 7.2l-.01.01L3.98 4 2.71 5.25l3.36 3.36C6.04 8.74 6 8.87 6 9v5.48L9.5 18v3h5v-3l.48-.48L19.45 22l1.26-1.28z`}),`PowerOff`),uE=X((0,G.jsx)(`path`,{d:`M13 3h-2v10h2zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83`}),`PowerSettingsNew`),uge=X((0,G.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5`}),`Preview`),dE=X((0,G.jsx)(`path`,{d:`M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z`}),`Refresh`),fE=X((0,G.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`}),`RestartAlt`),pE=X((0,G.jsx)(`path`,{d:`M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z`}),`Restore`),dge=X((0,G.jsx)(`path`,{d:`m20.2 5.9.8-.8C19.6 3.7 17.8 3 16 3s-3.6.7-5 2.1l.8.8C13 4.8 14.5 4.2 16 4.2s3 .6 4.2 1.7m-.9.8c-.9-.9-2.1-1.4-3.3-1.4s-2.4.5-3.3 1.4l.8.8c.7-.7 1.6-1 2.5-1s1.8.3 2.5 1zM19 13h-2V9h-2v4H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2M8 18H6v-2h2zm3.5 0h-2v-2h2zm3.5 0h-2v-2h2z`}),`Router`),mE=X((0,G.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`}),`Save`),hE=X((0,G.jsx)(`path`,{d:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14`}),`Search`),fge=X([(0,G.jsx)(`path`,{d:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z`},`0`),(0,G.jsx)(`path`,{d:`M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z`},`1`)],`SearchOff`),gE=X((0,G.jsx)(`path`,{d:`M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z`}),`Security`),_E=X((0,G.jsx)(`path`,{d:`M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12s.45 2.1 1.17 2.83zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12s-.45 2.1-1.17 2.83zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12M6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65`}),`Sensors`),vE=X((0,G.jsx)(`path`,{d:`M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1m-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05M12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0`}),`SettingsRemote`),yE=X((0,G.jsx)(`path`,{d:`M6 6h12v12H6z`}),`Stop`),pge=X((0,G.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 14H8V8h8z`}),`StopCircle`),mge=X((0,G.jsx)(`path`,{d:`M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z`}),`Storage`),hge=X((0,G.jsx)(`path`,{d:`M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z`}),`TextFields`),gge=X((0,G.jsx)(`path`,{d:`M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2`}),`Timeline`),bE=X((0,G.jsx)(`path`,{d:`M22 14c0-1.95-1.4-3.57-3.25-3.92L17.4 6.05C17 4.82 15.85 4 14.56 4H9.44C8.15 4 7 4.82 6.6 6.05L5.81 8.4 4.41 7l.29-.29c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0l-2 2c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l.3-.3 1.79 1.79C3.18 10.72 2 12.22 2 14c0 1.5.83 2.79 2.05 3.48C4.28 18.9 5.51 20 7 20c1.3 0 2.4-.84 2.82-2h4.37c.41 1.16 1.51 2 2.82 2 1.49 0 2.72-1.1 2.95-2.52C21.17 16.79 22 15.5 22 14M7 18c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-8H7.41l-.02-.02 1.1-3.3c.14-.41.52-.68.95-.68H11zm2-4h1.56c.43 0 .81.27.95.68l1.1 3.32H13zm4 12c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1`}),`Toys`),_ge=X((0,G.jsx)(`path`,{d:`m12.87 15.07-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2zm-2.62 7 1.62-4.33L19.12 17z`}),`Translate`),vge=X((0,G.jsx)(`path`,{d:`M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z`}),`Tune`),xE=X((0,G.jsx)(`path`,{d:`M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2m0 14H3V5h18z`}),`Tv`),yge=X((0,G.jsx)(`path`,{d:`M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8`}),`Undo`),SE=X((0,G.jsx)(`path`,{d:`M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z`}),`UploadFile`),bge=X((0,G.jsx)(`path`,{d:`M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z`}),`ViewModule`),xge=X((0,G.jsx)(`path`,{d:`M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3`}),`Visibility`),Sge=X((0,G.jsx)(`path`,{d:`M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z`}),`VisibilityOff`),Cge=X((0,G.jsx)(`path`,{d:`M11 11V3H5c-1.1 0-2 .9-2 2v6zm2 0h8V5c0-1.1-.9-2-2-2h-6zm-2 2H3v6c0 1.1.9 2 2 2h6zm2 0v8h6c1.1 0 2-.9 2-2v-6z`}),`Window`);async function wge(){let e=await fetch(`api/bridges/export`);await M_(e,`Failed to export bridges`),Dge(await e.blob(),e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split(`T`)[0]}.json`)}async function Tge(e){let t=await fetch(`api/bridges/import/preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to preview import`),j_(t)}async function Ege(e,t){let n=await fetch(`api/bridges/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:e,options:t})});return await M_(n,`Failed to import bridges`),j_(n)}function Dge(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Oge({open:e,file:t,onClose:n,onImported:r}){let{t:i}=ws(),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(new Set),[l,u]=(0,C.useState)(!1),[d,f]=(0,C.useState)(null),[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(!1),[_,v]=(0,C.useState)(null);(0,C.useEffect)(()=>{if(!e||!t){o(null),c(new Set),f(null),m(null),v(null);return}let n=new FileReader;n.onload=async e=>{try{let t=JSON.parse(e.target?.result);f(t);let n=await Tge(t);o(n),c(new Set(n.bridges.map(e=>e.id)))}catch{m(i(`bridge.importParseFailed`))}},n.readAsText(t)},[e,t,i]);let y=(0,C.useCallback)(e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),b=(0,C.useCallback)(()=>{a&&c(new Set(a.bridges.map(e=>e.id)))},[a]),x=(0,C.useCallback)(()=>{c(new Set)},[]),S=(0,C.useCallback)(async()=>{if(d){g(!0);try{let e=await Ege(d,{bridgeIds:Array.from(s),overwriteExisting:l}),t=[];e.imported>0&&t.push(`${e.imported} bridge(s) imported`),e.skipped>0&&t.push(`${e.skipped} skipped (already exist)`),e.errors.length>0&&t.push(`${e.errors.length} failed`),v(t.join(`, `)),r()}catch(e){m(e instanceof Error?e.message:`Import failed`)}finally{g(!1)}}},[d,s,l,r]);return(0,G.jsxs)(Rb,{open:e,onClose:n,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:i(`bridge.importTitle`)}),(0,G.jsxs)(Bb,{children:[p&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:p}),_&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},children:_}),a&&!_&&(0,G.jsxs)(G.Fragment,{children:[a.migrated&&(0,G.jsxs)(Uh,{severity:`info`,sx:{mb:2},children:[`This export is from an older version (`,a.sourceVersion,`). Bridges will be migrated to the current format during import.`]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:[`Exported on `,new Date(a.exportedAt).toLocaleString(),a.sourceVersion&&!a.migrated&&(0,G.jsxs)(G.Fragment,{children:[` • Format: `,a.sourceVersion]})]}),(0,G.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:16},children:[(0,G.jsx)(mv,{size:`small`,onClick:b,children:i(`common.selectAll`)}),(0,G.jsx)(mv,{size:`small`,onClick:x,children:i(`common.selectNone`)})]}),(0,G.jsx)($v,{dense:!0,children:a.bridges.map(e=>(0,G.jsxs)(ny,{disablePadding:!0,children:[(0,G.jsx)(iy,{children:(0,G.jsx)(Cv,{edge:`start`,checked:s.has(e.id),onChange:()=>y(e.id)})}),(0,G.jsx)(oy,{primary:e.name,secondary:(0,G.jsxs)(G.Fragment,{children:[`Port `,e.port,` • `,e.entityCount,` filter rules`,e.exists&&(0,G.jsxs)(`span`,{style:{color:`orange`},children:[` `,`• Already exists`]})]})})]},e.id))}),(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:l,onChange:e=>u(e.target.checked)}),label:i(`bridge.overwriteExisting`)})]})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:n,children:i(_?`common.close`:`common.cancel`)}),!_&&(0,G.jsx)(mv,{onClick:S,variant:`contained`,disabled:h||s.size===0,children:h?i(`bridge.importing`):i(`bridge.importCount`,{count:s.size})})]})]})}var CE=`api/bridge-icons`;async function kge(e,t){let n=new FormData;n.append(`icon`,t);let r=await fetch(`${CE}/${e}`,{method:`POST`,body:n});return await M_(r,`Failed to upload icon`),j_(r)}async function Age(e){await M_(await fetch(`${CE}/${e}`,{method:`DELETE`}),`Failed to delete icon`)}async function wE(e){let t=await fetch(`${CE}/${e}/exists`);if(!t.ok)return!1;let{exists:n}=await j_(t);return n}function TE(e){return`${CE}/${e}`}var EE={light:TT,switch:uE,climate:AT,cover:CT,fan:bE,lock:ET,sensor:_E,media_player:xE,vacuum:ZT,remote:vE,humidifier:jT,speaker:kT,garage:nE,door:qhe,window:Cge,motion:Khe,battery:Fhe,power:Ihe,camera:Lhe,default:wT},DE={light:TT,switch:uE,climate:AT,cover:CT,fan:bE,lock:ET,sensor:_E,binary_sensor:_E,media_player:xE,vacuum:ZT,remote:vE,humidifier:jT,input_boolean:Yhe,input_button:eE,button:eE,scene:eE,script:eE,automation:eE,speaker:kT,air_quality:ST,garage:nE},OE={light:`warning.main`,switch:`info.main`,climate:`error.main`,cover:`success.main`,fan:`info.light`,lock:`secondary.main`,sensor:`primary.main`,binary_sensor:`primary.main`,media_player:`secondary.main`,vacuum:`success.main`,remote:`warning.main`,humidifier:`info.main`},kE=e=>e.filter.include.find(e=>e.type===$_.Domain)?.value??null,jge=e=>{let t=e.toLowerCase();if(t.includes(`lamp`)||t.includes(`light`)||t.includes(`ljus`))return TT;if(t.includes(`vacuum`)||t.includes(`dammsug`))return ZT;if(t.includes(`thermo`)||t.includes(`climate`)||t.includes(`värme`))return AT;if(t.includes(`sensor`))return _E;if(t.includes(`cover`)||t.includes(`blind`)||t.includes(`rullgardin`)||t.includes(`jalousie`))return CT;if(t.includes(`remote`)||t.includes(`fjärr`))return vE;if(t.includes(`lock`)||t.includes(`lås`))return ET;if(t.includes(`fan`)||t.includes(`fläkt`))return bE;if(t.includes(`tv`)||t.includes(`media`))return xE;if(t.includes(`speaker`)||t.includes(`högtalare`))return kT;if(t.includes(`switch`)||t.includes(`brytare`))return uE;if(t.includes(`garage`))return nE},AE=e=>{if(e.icon&&EE[e.icon])return EE[e.icon];let t=kE(e);return t&&DE[t]?DE[t]:jge(e.name)||(e.deviceCount===0?mb:wT)},jE=e=>{let t=kE(e);return t&&OE[t]?OE[t]:e.deviceCount===0?`text.disabled`:`primary.main`},Mge=({bridge:e})=>{let t=e.commissioning?.fabrics.length??0,n=AE(e),r=jE(e),[i,a]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{wE(e.id).then(a)},[e.id]),(0,G.jsx)(hv,{variant:`elevation`,sx:{height:`100%`,transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,"&:hover":{transform:`translateY(-4px)`,boxShadow:4}},children:(0,G.jsx)(_v,{component:ua,to:J9.bridge(e.id),sx:{height:`100%`},children:(0,G.jsx)(vv,{children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`flex-start`,gap:2,children:[i?(0,G.jsx)(Z,{component:`img`,src:TE(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(wb,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:(0,G.jsx)(n,{sx:{fontSize:32}})}),(0,G.jsxs)(Z,{flexGrow:1,minWidth:0,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(Q,{variant:`h6`,component:`div`,noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),(0,G.jsx)(wx,{status:e.status})]}),(0,G.jsxs)(Hv,{spacing:1,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(mb,{sx:{fontSize:16,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[e.deviceCount,` devices`]})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Cb,{sx:{fontSize:16,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[t,` fabric`,t===1?``:`s`]})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(_E,{sx:{fontSize:16,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Port `,e.port]})]})]})]})]})})})})},Nge=({bridges:e})=>(0,G.jsx)(Fv,{container:!0,spacing:2,children:(0,C.useMemo)(()=>[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),[e]).map(e=>(0,G.jsx)(Fv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(Mge,{bridge:e})},e.id))}),ME=C.createContext({}),NE=C.createContext({});function Pge(e){return Jd(`MuiStep`,e)}Yd(`MuiStep`,[`root`,`horizontal`,`vertical`,`alternativeLabel`,`completed`]);var Fge=e=>{let{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return Cp({root:[`root`,n,r&&`alternativeLabel`,i&&`completed`]},Pge,t)},Ige=J(`div`,{name:`MuiStep`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({variants:[{props:{orientation:`horizontal`},style:{paddingLeft:8,paddingRight:8}},{props:{alternativeLabel:!0},style:{flex:1,position:`relative`}}]}),Lge=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiStep`}),{active:r,children:i,className:a,component:o=`div`,completed:s,disabled:c,expanded:l=!1,index:u,last:d,...f}=n,{activeStep:p,connector:m,alternativeLabel:h,orientation:g,nonLinear:_}=C.useContext(ME),[v=!1,y=!1,b=!1]=[r,s,c];p===u?v=r===void 0?!0:r:!_&&p>u?y=s===void 0?!0:s:!_&&p<u&&(b=c===void 0?!0:c);let x=C.useMemo(()=>({index:u,last:d,expanded:l,icon:u+1,active:v,completed:y,disabled:b}),[u,d,l,v,y,b]),S={...n,active:v,orientation:g,alternativeLabel:h,completed:y,disabled:b,expanded:l,component:o},w=(0,G.jsxs)(Ige,{as:o,className:K(Fge(S).root,a),ref:t,ownerState:S,...f,children:[m&&h&&u!==0?m:null,i]});return(0,G.jsx)(NE.Provider,{value:x,children:m&&!h&&u!==0?(0,G.jsxs)(C.Fragment,{children:[m,w]}):w})}),Rge=X((0,G.jsx)(`path`,{d:`M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z`}),`CheckCircle`),zge=X((0,G.jsx)(`path`,{d:`M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z`}),`Warning`);function Bge(e){return Jd(`MuiStepIcon`,e)}var PE=Yd(`MuiStepIcon`,[`root`,`active`,`completed`,`error`,`text`]),Vge,Hge=e=>{let{classes:t,active:n,completed:r,error:i}=e;return Cp({root:[`root`,n&&`active`,r&&`completed`,i&&`error`],text:[`text`]},Bge,t)},FE=J(qm,{name:`MuiStepIcon`,slot:`Root`})(Fm(({theme:e})=>({display:`block`,transition:e.transitions.create(`color`,{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${PE.completed}, &.${PE.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${PE.error}`]:{color:(e.vars||e).palette.error.main}}))),Uge=J(`text`,{name:`MuiStepIcon`,slot:`Text`})(Fm(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),Wge=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiStepIcon`}),{active:r=!1,className:i,completed:a=!1,error:o=!1,icon:s,...c}=n,l={...n,active:r,completed:a,error:o},u=Hge(l);if(typeof s==`number`||typeof s==`string`){let e=K(i,u.root);return o?(0,G.jsx)(FE,{as:zge,className:e,ref:t,ownerState:l,...c}):a?(0,G.jsx)(FE,{as:Rge,className:e,ref:t,ownerState:l,...c}):(0,G.jsxs)(FE,{className:e,ref:t,ownerState:l,...c,children:[Vge||=(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`12`}),(0,G.jsx)(Uge,{className:u.text,x:`12`,y:`12`,textAnchor:`middle`,dominantBaseline:`central`,ownerState:l,children:s})]})}return s});function Gge(e){return Jd(`MuiStepLabel`,e)}var IE=Yd(`MuiStepLabel`,[`root`,`horizontal`,`vertical`,`label`,`active`,`completed`,`error`,`disabled`,`iconContainer`,`alternativeLabel`,`labelContainer`]),Kge=e=>{let{classes:t,orientation:n,active:r,completed:i,error:a,disabled:o,alternativeLabel:s}=e;return Cp({root:[`root`,n,a&&`error`,o&&`disabled`,s&&`alternativeLabel`],label:[`label`,r&&`active`,i&&`completed`,a&&`error`,o&&`disabled`,s&&`alternativeLabel`],iconContainer:[`iconContainer`,r&&`active`,i&&`completed`,a&&`error`,o&&`disabled`,s&&`alternativeLabel`],labelContainer:[`labelContainer`,s&&`alternativeLabel`]},Gge,t)},qge=J(`span`,{name:`MuiStepLabel`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:`flex`,alignItems:`center`,[`&.${IE.alternativeLabel}`]:{flexDirection:`column`},[`&.${IE.disabled}`]:{cursor:`default`},variants:[{props:{orientation:`vertical`},style:{textAlign:`left`,padding:`8px 0`}}]}),Jge=J(`span`,{name:`MuiStepLabel`,slot:`Label`})(Fm(({theme:e})=>({...e.typography.body2,display:`block`,transition:e.transitions.create(`color`,{duration:e.transitions.duration.shortest}),[`&.${IE.active}, &.${IE.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${IE.alternativeLabel}`]:{marginTop:16},[`&.${IE.error}`]:{color:(e.vars||e).palette.error.main}}))),Yge=J(`span`,{name:`MuiStepLabel`,slot:`IconContainer`})({flexShrink:0,display:`flex`,paddingRight:8,[`&.${IE.alternativeLabel}`]:{paddingRight:0}}),Xge=J(`span`,{name:`MuiStepLabel`,slot:`LabelContainer`})(Fm(({theme:e})=>({width:`100%`,color:(e.vars||e).palette.text.secondary,[`&.${IE.alternativeLabel}`]:{textAlign:`center`}}))),LE=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiStepLabel`}),{children:r,className:i,componentsProps:a={},error:o=!1,icon:s,optional:c,slots:l={},slotProps:u={},StepIconComponent:d,StepIconProps:f,...p}=n,{alternativeLabel:m,orientation:h}=C.useContext(ME),{active:g,disabled:_,completed:v,icon:y}=C.useContext(NE),b=s||y,x=d;b&&!x&&(x=Wge);let S={...n,active:g,alternativeLabel:m,completed:v,disabled:_,error:o,orientation:h},w=Kge(S),T={slots:l,slotProps:{stepIcon:f,...a,...u}},[E,D]=Hm(`root`,{elementType:qge,externalForwardedProps:{...T,...p},ownerState:S,ref:t,className:K(w.root,i)}),[O,k]=Hm(`label`,{elementType:Jge,externalForwardedProps:T,ownerState:S}),[A,j]=Hm(`stepIcon`,{elementType:x,externalForwardedProps:T,ownerState:S});return(0,G.jsxs)(E,{...D,children:[b||A?(0,G.jsx)(Yge,{className:w.iconContainer,ownerState:S,children:(0,G.jsx)(A,{completed:v,active:g,error:o,icon:b,...j})}):null,(0,G.jsxs)(Xge,{className:w.labelContainer,ownerState:S,children:[r?(0,G.jsx)(O,{...k,className:K(w.label,k?.className),children:r}):null,c]})]})});LE.muiName=`StepLabel`;function Zge(e){return Jd(`MuiStepper`,e)}Yd(`MuiStepper`,[`root`,`horizontal`,`vertical`,`nonLinear`,`alternativeLabel`]);function Qge(e){return Jd(`MuiStepConnector`,e)}Yd(`MuiStepConnector`,[`root`,`horizontal`,`vertical`,`alternativeLabel`,`active`,`completed`,`disabled`,`line`,`lineHorizontal`,`lineVertical`]);var $ge=e=>{let{classes:t,orientation:n,alternativeLabel:r,active:i,completed:a,disabled:o}=e;return Cp({root:[`root`,n,r&&`alternativeLabel`,i&&`active`,a&&`completed`,o&&`disabled`],line:[`line`,`line${Y(n)}`]},Qge,t)},e_e=J(`div`,{name:`MuiStepConnector`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({flex:`1 1 auto`,variants:[{props:{orientation:`vertical`},style:{marginLeft:12}},{props:{alternativeLabel:!0},style:{position:`absolute`,top:12,left:`calc(-50% + 20px)`,right:`calc(50% + 20px)`}}]}),t_e=J(`span`,{name:`MuiStepConnector`,slot:`Line`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.line,t[`line${Y(n.orientation)}`]]}})(Fm(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[400]:e.palette.grey[600];return{display:`block`,borderColor:e.vars?e.vars.palette.StepConnector.border:t,variants:[{props:{orientation:`horizontal`},style:{borderTopStyle:`solid`,borderTopWidth:1}},{props:{orientation:`vertical`},style:{borderLeftStyle:`solid`,borderLeftWidth:1,minHeight:24}}]}})),n_e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiStepConnector`}),{className:r,...i}=n,{alternativeLabel:a,orientation:o=`horizontal`}=C.useContext(ME),{active:s,disabled:c,completed:l}=C.useContext(NE),u={...n,alternativeLabel:a,orientation:o,active:s,completed:l,disabled:c},d=$ge(u);return(0,G.jsx)(e_e,{className:K(d.root,r),ref:t,ownerState:u,...i,children:(0,G.jsx)(t_e,{className:d.line,ownerState:u})})}),r_e=e=>{let{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return Cp({root:[`root`,t,n&&`nonLinear`,r&&`alternativeLabel`]},Zge,i)},i_e=J(`div`,{name:`MuiStepper`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.nonLinear&&t.nonLinear]}})({display:`flex`,variants:[{props:{orientation:`horizontal`},style:{flexDirection:`row`,alignItems:`center`}},{props:{orientation:`vertical`},style:{flexDirection:`column`}},{props:{alternativeLabel:!0},style:{alignItems:`flex-start`}}]}),a_e=(0,G.jsx)(n_e,{}),o_e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiStepper`}),{activeStep:r=0,alternativeLabel:i=!1,children:a,className:o,component:s=`div`,connector:c=a_e,nonLinear:l=!1,orientation:u=`horizontal`,...d}=n,f={...n,nonLinear:l,alternativeLabel:i,orientation:u,component:s},p=r_e(f),m=C.Children.toArray(a).filter(Boolean),h=m.map((e,t)=>C.cloneElement(e,{index:t,last:t+1===m.length,...e.props})),g=C.useMemo(()=>({activeStep:r,alternativeLabel:i,connector:c,nonLinear:l,orientation:u}),[r,i,c,l,u]);return(0,G.jsx)(ME.Provider,{value:g,children:(0,G.jsx)(i_e,{as:s,ownerState:f,className:K(p.root,o),ref:t,...d,children:h})})}),RE={light:`💡`,switch:`🔌`,sensor:`📊`,climate:`🌡️`,lock:`🔒`,vacuum:`🤖`,media_player:`🎵`,cover:`🪟`,remote:`⚡`,default:`🏠`};function zE({selectedTemplate:e,onSelect:t}){return(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle1`,gutterBottom:!0,fontWeight:600,children:`Start from a Template (optional)`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:`Choose a preset to pre-fill the bridge configuration with recommended settings. You can customize everything afterwards.`}),(0,G.jsx)(Fv,{container:!0,spacing:1.5,alignItems:`flex-start`,children:ev.map(n=>{let r=e===n.id;return(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(hv,{variant:`outlined`,sx:{height:`100%`,borderColor:r?`primary.main`:`divider`,borderWidth:r?2:1,bgcolor:r?`action.selected`:`background.paper`,transition:`all 0.15s ease`},children:(0,G.jsx)(_v,{onClick:()=>t(r?null:n),sx:{p:0,display:`flex`,flexDirection:`column`,alignItems:`flex-start`,justifyContent:`flex-start`},children:(0,G.jsxs)(vv,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:.5,children:[(0,G.jsx)(Q,{fontSize:20,children:RE[n.icon]??RE.default}),(0,G.jsx)(Q,{variant:`subtitle2`,sx:{flexGrow:1},children:n.name}),r&&(0,G.jsx)(lv,{color:`primary`,sx:{fontSize:18}})]}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{display:`-webkit-box`,WebkitLineClamp:r?`none`:2,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:n.description}),n.featureFlags?.serverMode&&(0,G.jsx)(Ev,{label:`Server Mode`,size:`small`,color:`warning`,variant:`outlined`,sx:{mt:.5,height:20,fontSize:`0.65rem`}}),n.featureFlags?.autoForceSync&&(0,G.jsx)(Ev,{label:`Auto Force Sync`,size:`small`,color:`info`,variant:`outlined`,sx:{mt:.5,ml:.5,height:20,fontSize:`0.65rem`}})]})})})},n.id)})})]})}var s_e={apple_home:`🍏`,google_home:`🏠`,alexa:`🔵`,multi_controller:`🔀`},BE=[`bridgeWizard.stepTemplate`,`bridgeWizard.stepController`,`bridgeWizard.stepBridgeInfo`,`bridgeWizard.stepEntityFilter`,`bridgeWizard.stepFeatureFlags`,`bridgeWizard.stepReview`],c_e=[{key:`autoComposedDevices`,label:`Auto Compose Devices`,description:`Combine related entities (battery, humidity, pressure, power, energy) from the same HA device into a single Matter endpoint.`},{key:`autoForceSync`,label:`Auto Force Sync`,description:`Periodically push all device states to controllers. Recommended for Google Home and Alexa to prevent devices from going offline.`},{key:`coverSwapOpenClose`,label:`Invert Cover Direction`,description:`Swap open/close direction for covers. Use this if your covers show the wrong position in Matter controllers.`},{key:`includeHiddenEntities`,label:`Include Hidden Entities`,description:`Also expose entities that are marked as hidden in Home Assistant.`}];function VE({open:e,onClose:t,onComplete:n}){let{t:r}=ws(),[i,a]=(0,C.useState)(0),[o,s]=(0,C.useState)(!1),[c,l]=(0,C.useState)(5540),[u,d]=(0,C.useState)([]),[f,p]=(0,C.useState)(),[m,h]=(0,C.useState)({name:``,port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[g,_]=(0,C.useState)(!0),[v,y]=(0,C.useState)(`*`),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(null),[T,E]=(0,C.useState)(),D=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/matter/next-port`);if(e.ok){let t=await e.json();l(t.port),h(e=>({...e,port:t.port}))}}catch{}},[]);(0,C.useEffect)(()=>{e&&(D(),a(0),d([]),p(void 0),h({name:``,port:c,serverMode:!1,filter:{include:[],exclude:[]}}),_(!0),y(`*`),x(``),w(null),E(void 0))},[e,D,c]);let O=(0,C.useCallback)(e=>{if(p(e??void 0),e){h(t=>({...t,name:e.name,serverMode:e.featureFlags?.serverMode??!1,icon:e.icon,featureFlags:e.featureFlags,filter:{...e.filter}}));let t=e.filter.include;t.length>0&&(_(!1),e.featureFlags?.serverMode?y(t.map(e=>e.type===$_.Domain?`${e.value}.*`:e.value).join(`, `)):y(t.map(e=>e.value).join(`, `)));let n=e.filter.exclude;x(n.map(e=>e.value).join(`, `))}else h(e=>({...e,name:``,serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),_(!0),y(`*`),x(``)},[]),k=(0,C.useCallback)(e=>{E(e??void 0),e&&h(t=>({...t,featureFlags:{...t.featureFlags,...e.featureFlags}}))},[]),A=()=>{if(i===0&&w(null),i===1&&w(null),i===2){if(!m.name.trim()){w(r(`bridgeWizard.nameRequired`));return}w(null)}if(i===3){let e,t;if(f&&!m.serverMode)e=[...f.filter.include],t=[...f.filter.exclude];else{let n=g?[v||`*`]:v.split(`,`).map(e=>e.trim()).filter(Boolean),r=b.split(`,`).map(e=>e.trim()).filter(Boolean);e=n.map(e=>({type:$_.Pattern,value:e})),t=r.map(e=>({type:$_.Pattern,value:e}))}h(n=>({...n,filter:{include:e,exclude:t}}))}a(e=>e+1)},j=()=>{a(e=>e-1),w(null)},M=async()=>{await N();let e=c+u.length+1;d(e=>[...e,m]),p(void 0),E(void 0),h({name:``,port:e,serverMode:!1,filter:{include:[],exclude:[]}}),a(0),_(!0),y(`*`),x(``)},N=async()=>{s(!0),w(null);try{let e={...m.featureFlags,...m.serverMode?{serverMode:!0}:{}},t=Object.keys(e).length>0;return await N_({name:m.name,port:m.port,filter:m.filter,featureFlags:t?e:void 0,icon:m.icon}),!0}catch(e){return w(e instanceof Error?e.message:r(`bridgeWizard.createFailed`)),!1}finally{s(!1)}};return(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`md`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(FT,{}),(0,G.jsx)(`span`,{children:r(`bridgeWizard.title`)})]})}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(o_e,{activeStep:i,sx:{mt:1},children:BE.map(e=>(0,G.jsx)(Lge,{children:(0,G.jsx)(LE,{children:r(e)})},e))}),i===0&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Q,{variant:`body1`,gutterBottom:!0,children:r(`bridgeWizard.templateDescription`)}),(0,G.jsx)(Z,{sx:{mt:2},children:(0,G.jsx)(zE,{selectedTemplate:f?.id,onSelect:O})})]}),i===1&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Q,{variant:`body1`,gutterBottom:!0,children:r(`bridgeWizard.controllerDescription`)}),(0,G.jsx)(Fv,{container:!0,spacing:1.5,sx:{mt:1},children:nv.map(e=>{let t=T?.id===e.id;return(0,G.jsx)(Fv,{size:{xs:12,sm:6},children:(0,G.jsx)(hv,{variant:`outlined`,sx:{borderColor:t?`primary.main`:`divider`,borderWidth:t?2:1,bgcolor:t?`action.selected`:`background.paper`,transition:`all 0.15s ease`},children:(0,G.jsx)(_v,{onClick:()=>k(t?null:e),sx:{p:0,display:`flex`,flexDirection:`column`,alignItems:`flex-start`,justifyContent:`flex-start`},children:(0,G.jsxs)(vv,{sx:{p:1.5,"&:last-child":{pb:1.5},width:`100%`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:.5,children:[(0,G.jsx)(Q,{fontSize:20,children:s_e[e.id]??`🏠`}),(0,G.jsx)(Q,{variant:`subtitle2`,sx:{flexGrow:1},children:e.name}),t&&(0,G.jsx)(lv,{color:`primary`,sx:{fontSize:18}})]}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:e.description}),t&&(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mt:.5,children:Object.entries(e.featureFlags).filter(([,e])=>e).map(([e])=>(0,G.jsx)(Ev,{label:e.replace(/^auto/,``).replace(/([A-Z])/g,` $1`).trim(),size:`small`,variant:`outlined`,sx:{fontSize:`0.6rem`,height:18}},e))})]})})})},e.id)})}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:2,display:`block`},children:r(`bridgeWizard.controllerHint`)})]}),i===2&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Q,{variant:`body1`,gutterBottom:!0,children:f?r(`bridgeWizard.templateApplied`,{name:f.name}):r(`bridgeWizard.bridgeInfoDescription`)}),(0,G.jsx)(ES,{fullWidth:!0,label:r(`bridgeWizard.bridgeName`),value:m.name,onChange:e=>h(t=>({...t,name:e.target.value})),margin:`normal`,placeholder:`e.g., Living Room, Kitchen, All Lights`,error:!!S,helperText:S}),(0,G.jsx)(ES,{fullWidth:!0,label:r(`bridgeWizard.portLabel`),type:`number`,value:m.port,onChange:e=>h(t=>({...t,port:parseInt(e.target.value,10)||5540})),margin:`normal`,helperText:r(`bridgeWizard.portAutoAssign`)}),T&&(T.id===`alexa`||T.id===`multi_controller`)&&m.port!==5540&&(0,G.jsxs)(Uh,{severity:`warning`,sx:{mt:1},children:[`Alexa only pairs on port `,(0,G.jsx)(`strong`,{children:`5540`}),`. This bridge uses`,` `,m.port,`, so Alexa will not discover it. Set the port back to 5540 for the Alexa bridge.`]}),(0,G.jsx)(db,{title:`Exposes the entity as a standalone Matter device, e.g. so robot vacuums work with Apple Home (Siri) and Alexa. The first entity is the primary; more than one device per node is experimental.`,placement:`right`,children:(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:m.serverMode,onChange:e=>h(t=>({...t,serverMode:e.target.checked})),icon:(0,G.jsx)(OT,{}),checkedIcon:(0,G.jsx)(OT,{color:`primary`})}),label:r(`bridgeWizard.serverModeLabel`),sx:{mt:1}})}),m.serverMode&&(0,G.jsxs)(Uh,{severity:`info`,sx:{mt:1},children:[(0,G.jsx)(`strong`,{children:`Server Mode enabled:`}),` This bridge exposes devices standalone instead of bridged, required for Apple Home Siri commands and Alexa discovery. The first entity is the primary and names the node; more than one device per node is experimental.`]}),u.length>0&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,children:[r(`bridgeWizard.bridgesToCreate`,{count:u.length}),`:`]}),(0,G.jsx)(Z,{display:`flex`,gap:1,flexWrap:`wrap`,mt:1,children:u.map(e=>(0,G.jsx)(Ev,{label:`${e.name} (:${e.port})`,size:`small`},e.port))})]})]}),i===3&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Q,{variant:`body1`,gutterBottom:!0,children:f?r(`bridgeWizard.filterPreConfiguredFrom`,{name:f.name}):r(`bridgeWizard.entityFilterDescription`)}),m.serverMode&&(0,G.jsxs)(Uh,{severity:`warning`,sx:{mt:1,mb:1},children:[`Server Mode requires exactly `,(0,G.jsx)(`strong`,{children:`one`}),` entity. Change the filter to match only your device (e.g., `,(0,G.jsx)(`code`,{children:`vacuum.my_vacuum`}),`).`]}),!f&&(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:g,onChange:e=>_(e.target.checked)}),label:r(`bridgeWizard.includeAll`)}),(0,G.jsx)(ES,{fullWidth:!0,label:m.serverMode?`Entity ID`:g&&!f?`Include Pattern`:`Entity Filters`,value:f&&!m.serverMode?f.filter.include.map(e=>`${e.type}:${e.value}`).join(`, `):v,onChange:e=>y(e.target.value),margin:`normal`,placeholder:g?`* or light.*, switch.*`:`light.living_room, switch.kitchen`,helperText:m.serverMode?`Enter exact entity IDs (e.g., vacuum.my_vacuum). The first one is the primary device of the node.`:f?`Pre-configured by template. Edit in the full editor after creation.`:g?`Use * for all, or patterns like light.*, switch.*`:`Enter specific entity IDs separated by commas`,disabled:!!f&&!m.serverMode}),!f&&(0,G.jsx)(ES,{fullWidth:!0,label:r(`bridgeWizard.excludePatterns`),value:b,onChange:e=>x(e.target.value),margin:`normal`,placeholder:`sensor.*, binary_sensor.*`,helperText:r(`bridgeWizard.excludeHelperText`)})]}),i===4&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsxs)(Q,{variant:`body1`,gutterBottom:!0,children:[r(`bridgeWizard.featureFlagsDescription`),T?` ${r(`bridgeWizard.recommendedFlags`,{name:T.name})}`:` ${r(`bridgeWizard.selectFlags`)}`]}),c_e.map(e=>(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:m.featureFlags?.[e.key]===!0,onChange:t=>h(n=>({...n,featureFlags:{...n.featureFlags,[e.key]:t.target.checked}}))}),label:e.label}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,display:`block`,sx:{ml:7,mt:-.5},children:e.description})]},e.key))]}),i===5&&(()=>{let e=Object.entries(m.featureFlags??{}).filter(([,e])=>e===!0);return(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Q,{variant:`body1`,gutterBottom:!0,children:r(`bridgeWizard.reviewDescription`)}),(0,G.jsx)(hv,{variant:`outlined`,sx:{mt:2},children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(mb,{}),(0,G.jsx)(Q,{variant:`h6`,children:m.name})]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[r(`bridgeWizard.portLabel`),`: `,m.port]}),f&&(0,G.jsx)(Ev,{label:`Template: ${f.name}`,size:`small`,color:`info`,variant:`outlined`,sx:{mt:1,mr:.5}}),m.serverMode&&(0,G.jsx)(Ev,{icon:(0,G.jsx)(OT,{}),label:`Server Mode`,color:`primary`,size:`small`,sx:{mt:1}}),e.length>0&&(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mt:1,children:e.filter(([e])=>e!==`serverMode`).map(([e])=>(0,G.jsx)(Ev,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}},e))}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:[`Include:`,` `,m.filter.include.length>0?m.filter.include.map(e=>`${e.type}:${e.value}`).join(`, `):v||`*`]}),S&&(0,G.jsx)(Q,{variant:`body2`,color:`error`,sx:{mt:1},children:S}),(b||m.filter.exclude.length>0)&&(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Exclude:`,` `,m.filter.exclude.length>0?m.filter.exclude.map(e=>e.value).join(`, `):b]})]})}),u.length>0&&(0,G.jsx)(Z,{sx:{mt:2},children:(0,G.jsx)(Q,{variant:`subtitle2`,children:r(`bridgeWizard.bridgesCreated`,{count:u.length})})})]})})()]}),(0,G.jsxs)(zb,{sx:{px:3,pb:2},children:[(0,G.jsx)(mv,{onClick:t,disabled:o,children:r(`common.cancel`)}),(0,G.jsx)(Z,{sx:{flex:1}}),i>0&&(0,G.jsx)(mv,{onClick:j,startIcon:(0,G.jsx)(cv,{}),disabled:o,children:r(`common.back`)}),i<BE.length-1&&(0,G.jsx)(mv,{variant:`contained`,onClick:A,endIcon:(0,G.jsx)(Mhe,{}),disabled:o,children:r(i===0&&!f?`bridgeWizard.skipTemplate`:i===1&&!T?`common.skip`:`common.next`)}),i===BE.length-1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(mv,{variant:`outlined`,onClick:M,startIcon:(0,G.jsx)(fb,{}),disabled:o,children:r(`bridgeWizard.addAnother`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:async()=>{await N()&&(n(),t())},startIcon:o?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(Bhe,{}),disabled:o,children:r(o?`bridgeWizard.creating`:`bridgeWizard.createBridge`)})]})]})]})}var l_e=()=>{let{t:e}=ws(),t=qv(),n=J_(),{content:r,isLoading:i,error:a}=RT(),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),m=(0,C.useRef)(null),h=(0,C.useCallback)(async()=>{try{await wge()}catch(n){t.show({message:n instanceof Error?n.message:e(`bridge.exportFailed`),severity:`error`})}},[t,e]),g=(0,C.useCallback)(()=>{m.current?.click()},[]),_=(0,C.useCallback)(e=>{let t=e.target.files?.[0];t&&(s(t),l(!0)),e.target.value=``},[]),v=(0,C.useCallback)(()=>{l(!1),s(null)},[]),y=(0,C.useCallback)(()=>{n(V_())},[n]),b=(0,C.useCallback)(async r=>{p(!0);try{let i={start:e(`bridge.actionStarted`),stop:e(`bridge.actionStopped`),restart:e(`bridge.actionRestarted`)},a=await{start:I_,stop:L_,restart:R_}[r]();t.show({message:e(`bridge.actionResult`,{label:i[r],count:a.count}),severity:`success`}),n(V_())}catch(n){t.show({message:n instanceof Error?n.message:e(`bridge.actionFailed`,{action:r}),severity:`error`})}finally{p(!1)}},[t,n,e]);return(0,C.useEffect)(()=>{a&&t.show({message:a.message??e(`bridge.couldNotLoad`),severity:`error`})},[a,t,e]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Mb,{sx:e=>({zIndex:e.zIndex.drawer+1}),open:i||f,children:(i||f)&&(0,G.jsx)(Rh,{color:`inherit`})}),(0,G.jsx)(Hv,{spacing:4,children:r&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`end`,flexWrap:`wrap`,gap:1,paddingTop:{xs:1,sm:0},children:[r.length>=1&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(mv,{onClick:()=>b(`start`),startIcon:(0,G.jsx)(lE,{}),variant:`outlined`,size:`small`,color:`success`,disabled:f,children:e(`common.startAll`)}),(0,G.jsx)(mv,{onClick:()=>b(`stop`),startIcon:(0,G.jsx)(yE,{}),variant:`outlined`,size:`small`,color:`error`,disabled:f,children:e(`common.stopAll`)}),(0,G.jsx)(mv,{onClick:()=>b(`restart`),startIcon:(0,G.jsx)(fE,{}),variant:`outlined`,size:`small`,color:`warning`,disabled:f,children:e(`common.restartAll`)}),(0,G.jsx)(Ub,{orientation:`vertical`,flexItem:!0})]}),(0,G.jsx)(mv,{onClick:g,startIcon:(0,G.jsx)(PT,{}),variant:`outlined`,children:e(`common.import`)}),(0,G.jsx)(mv,{onClick:h,startIcon:(0,G.jsx)(IT,{}),variant:`outlined`,disabled:r.length===0,children:e(`common.exportAll`)}),(0,G.jsx)(mv,{component:ua,to:J9.areaSetup,startIcon:(0,G.jsx)(oE,{}),variant:`outlined`,children:e(`areaSetup.title`)}),(0,G.jsx)(mv,{onClick:()=>d(!0),startIcon:(0,G.jsx)(JT,{}),variant:`outlined`,children:e(`bridgeWizard.title`)}),(0,G.jsx)(mv,{component:ua,to:J9.createBridge,endIcon:(0,G.jsx)(fb,{}),variant:`outlined`,children:e(`dashboard.createBridge`)}),(0,G.jsx)(`input`,{type:`file`,ref:m,onChange:_,accept:`.json`,style:{display:`none`}})]}),(0,G.jsx)(Nge,{bridges:r})]})}),(0,G.jsx)(Oge,{open:c,file:o,onClose:v,onImported:y}),(0,G.jsx)(VE,{open:u,onClose:()=>d(!1),onComplete:()=>n(V_())})]})},HE=[{id:`stats`,label:`Status Overview`,description:`Bridge count, device count, fabric count, and HA connection status.`},{id:`bridges`,label:`Bridges`,description:`Bridge cards with bulk actions (start/stop/restart all).`},{id:`quickNav`,label:`Quick Navigation`,description:`Shortcut cards to other pages (Devices, Network Map, Health, etc.).`}],UE=`hamh-dashboard-widgets`,WE={order:HE.map(e=>e.id),hidden:[]};function u_e(){try{let e=localStorage.getItem(UE);if(!e)return WE;let t=JSON.parse(e),n=new Set(HE.map(e=>e.id)),r=t.order.filter(e=>n.has(e));for(let e of HE)r.includes(e.id)||r.push(e.id);return{order:r,hidden:(t.hidden||[]).filter(e=>n.has(e))}}catch{return WE}}function GE(e){localStorage.setItem(UE,JSON.stringify(e))}function d_e(){let[e,t]=(0,C.useState)(u_e),n=(0,C.useCallback)(t=>!e.hidden.includes(t),[e.hidden]);return{config:e,visibleWidgets:e.order.filter(t=>!e.hidden.includes(t)),isVisible:n,toggleWidget:(0,C.useCallback)(e=>{t(t=>{let n=t.hidden.includes(e)?t.hidden.filter(t=>t!==e):[...t.hidden,e],r={...t,hidden:n};return GE(r),r})},[]),moveWidget:(0,C.useCallback)((e,n)=>{t(t=>{let r=[...t.order],i=r.indexOf(e);if(i<0)return t;let a=n===`up`?i-1:i+1;if(a<0||a>=r.length)return t;[r[i],r[a]]=[r[a],r[i]];let o={...t,order:r};return GE(o),o})},[]),resetToDefaults:(0,C.useCallback)(()=>{GE(WE),t(WE)},[])}}function f_e({open:e,config:t,onToggle:n,onMove:r,onReset:i,onClose:a}){let o=new Map(HE.map(e=>[e.id,e]));return(0,G.jsxs)(Rb,{open:e,onClose:a,maxWidth:`xs`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:`Customize Dashboard`}),(0,G.jsx)(Bb,{dividers:!0,children:(0,G.jsx)($v,{disablePadding:!0,children:t.order.map((e,i)=>{let a=o.get(e);if(!a)return null;let s=t.hidden.includes(e);return(0,G.jsxs)(ny,{sx:{opacity:s?.5:1},secondaryAction:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(db,{title:`Move up`,children:(0,G.jsx)(`span`,{children:(0,G.jsx)(Bh,{size:`small`,disabled:i===0,onClick:()=>r(e,`up`),children:(0,G.jsx)(qT,{fontSize:`small`})})})}),(0,G.jsx)(db,{title:`Move down`,children:(0,G.jsx)(`span`,{children:(0,G.jsx)(Bh,{size:`small`,disabled:i===t.order.length-1,onClick:()=>r(e,`down`),children:(0,G.jsx)(KT,{fontSize:`small`})})})})]}),children:[(0,G.jsx)(iy,{sx:{minWidth:36},children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>n(e),children:s?(0,G.jsx)(Sge,{fontSize:`small`}):(0,G.jsx)(xge,{fontSize:`small`,color:`primary`})})}),(0,G.jsx)(oy,{primary:a.label,secondary:a.description,secondaryTypographyProps:{variant:`caption`}})]},e)})})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{startIcon:(0,G.jsx)(pE,{}),onClick:i,color:`warning`,children:`Reset`}),(0,G.jsx)(mv,{onClick:a,variant:`contained`,children:`Done`})]})]})}var p_e=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function KE({title:e,value:t,icon:n,color:r,subtitle:i,onClick:a}){let o=(0,G.jsx)(vv,{sx:{py:2,"&:last-child":{pb:2}},children:(0,G.jsxs)(Z,{display:`flex`,sx:{flexDirection:{xs:`column`,sm:`row`},alignItems:`center`,gap:{xs:1,sm:2},textAlign:{xs:`center`,sm:`left`}},children:[(0,G.jsx)(wb,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),(0,G.jsxs)(Z,{sx:{minWidth:0},children:[(0,G.jsx)(Q,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:`1.5rem`,sm:`2.125rem`}},children:t}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,noWrap:!0,children:e}),i&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:i})]})]})});return(0,G.jsx)(hv,{variant:`outlined`,sx:{height:`100%`},children:a?(0,G.jsx)(_v,{onClick:a,sx:{height:`100%`},children:o}):o})}function m_e({bridge:e,order:t,onClick:n}){let{t:r}=ws(),{content:i}=RT(),a=i?.find(t=>t.id===e.id),[o,s]=(0,C.useState)(!1);(0,C.useEffect)(()=>{wE(e.id).then(s)},[e.id]);let c=e.status===`running`?`success`:e.status===`failed`?`error`:`default`;return(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsx)(_v,{onClick:n,children:(0,G.jsx)(vv,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1.5,children:[(0,G.jsx)(Ev,{label:`#${t}`,size:`small`,color:`primary`,variant:`outlined`,sx:{minWidth:28,height:22,fontSize:`0.65rem`,fontWeight:`bold`,flexShrink:0}}),o?(0,G.jsx)(Z,{component:`img`,src:TE(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:`50%`,objectFit:`cover`}}):a&&(0,G.jsx)(wb,{sx:{bgcolor:jE(a),width:36,height:36},children:(0,G.jsx)(AE(a),{sx:{fontSize:20}})}),(0,G.jsxs)(Z,{flex:1,minWidth:0,children:[(0,G.jsx)(Q,{variant:`subtitle2`,noWrap:!0,children:e.name}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,alignItems:`center`,children:[(0,G.jsx)(Ev,{label:e.status,size:`small`,color:c,sx:{height:18,fontSize:`0.65rem`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[e.deviceCount,` `,r(`common.devices`).toLowerCase()]}),e.fabricCount>0&&(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`· `,e.fabricCount,` `,r(`common.fabrics`).toLowerCase()]})]})]}),e.failedEntityCount>0&&(0,G.jsx)(Ev,{icon:(0,G.jsx)(Yv,{sx:{fontSize:14}}),label:e.failedEntityCount,size:`small`,color:`warning`,variant:`outlined`,sx:{height:22}})]})})})})}function qE({title:e,icon:t,onClick:n}){return(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsx)(_v,{onClick:n,children:(0,G.jsx)(vv,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1.5,children:[(0,G.jsx)(wb,{sx:{bgcolor:`action.selected`,color:`text.secondary`,width:36,height:36},children:t}),(0,G.jsx)(Q,{variant:`subtitle2`,children:e})]})})})})}var h_e=()=>{let{t:e}=ws(),t=wm(),n=Nr(),r=J_(),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(!0),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(!1),f=(0,C.useRef)(!1),[p,m]=(0,C.useState)(!1),h=d_e(),[g,_]=(0,C.useState)(()=>localStorage.getItem(`hamh-first-success-dismissed`)===`true`),v=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/health/detailed`);e.ok&&a(await e.json())}catch{}finally{s(!1)}},[]);(0,C.useEffect)(()=>{v();let e=setInterval(v,15e3);return()=>clearInterval(e)},[v]);let y=(0,C.useMemo)(()=>i?.bridgeDetails.reduce((e,t)=>e+t.deviceCount,0)??0,[i]),b=(0,C.useMemo)(()=>i?.bridgeDetails?i.bridgeDetails.reduce((e,t)=>e+t.fabricCount,0):0,[i]),x=(0,C.useMemo)(()=>i?.bridgeDetails.reduce((e,t)=>e+t.failedEntityCount,0)??0,[i]);if(o)return(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:8,children:(0,G.jsx)(Rh,{})});let S=i?.services.bridges,w=i?.services.homeAssistant.connected??!1,T=(S?.total??0)>0;return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,mb:3,children:[(0,G.jsx)(rE,{color:`primary`,fontSize:`large`}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,component:`h1`,children:e(`dashboard.title`)}),T&&(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(!0),sx:{ml:`auto`},title:e(`dashboard.customizeDashboard`),children:(0,G.jsx)(vge,{})})]}),T&&b>0&&!g&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},action:(0,G.jsx)(Bh,{size:`small`,color:`inherit`,onClick:()=>{_(!0),localStorage.setItem(`hamh-first-success-dismissed`,`true`)},children:(0,G.jsx)(QT,{fontSize:`small`})}),children:e(`dashboard.successMessage`,{count:b})}),!T&&!o&&(0,G.jsx)(hv,{sx:{mb:3,background:e=>`linear-gradient(135deg, ${e.palette.primary.dark}15, ${e.palette.secondary.dark}15)`,border:`1px solid`,borderColor:`divider`},children:(0,G.jsxs)(vv,{sx:{textAlign:`center`,py:5,px:3},children:[(0,G.jsx)(iE,{sx:{fontSize:56,color:`primary.main`,mb:2}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,gutterBottom:!0,children:e(`dashboard.welcome`)}),(0,G.jsx)(Q,{variant:`body1`,color:`text.secondary`,sx:{maxWidth:520,mx:`auto`,mb:4},children:e(`dashboard.welcomeDescription`)}),(0,G.jsxs)(Hv,{direction:{xs:`column`,sm:`row`},spacing:2,justifyContent:`center`,sx:{mb:3},children:[(0,G.jsx)(mv,{variant:`contained`,size:`large`,startIcon:(0,G.jsx)(JT,{}),onClick:()=>l(!0),children:e(`dashboard.bridgeWizard`)}),(0,G.jsx)(mv,{variant:`outlined`,size:`large`,startIcon:(0,G.jsx)(oE,{}),onClick:()=>n(J9.areaSetup),children:e(`dashboard.setupByArea`)}),(0,G.jsx)(mv,{variant:`outlined`,size:`large`,startIcon:(0,G.jsx)(fb,{}),onClick:()=>n(J9.createBridge),children:e(`dashboard.manualSetup`)})]}),(0,G.jsx)(mv,{size:`small`,endIcon:(0,G.jsx)(cE,{sx:{fontSize:14}}),href:J9.documentation,target:`_blank`,rel:`noopener`,children:e(`dashboard.documentation`)})]})}),T&&h.visibleWidgets.map((r,a)=>(0,G.jsxs)(Z,{children:[a>0&&(0,G.jsx)(Ub,{sx:{my:3}}),r===`stats`&&(0,G.jsxs)(Fv,{container:!0,spacing:2,sx:{mb:3},children:[(0,G.jsx)(Fv,{size:{xs:6,sm:3},children:(0,G.jsx)(KE,{title:e(`nav.bridges`),value:S?.total??0,icon:(0,G.jsx)(iE,{}),color:t.palette.success.main,subtitle:S?`${S.running} running${S.failed>0?` · ${S.failed} failed`:``}`:void 0,onClick:()=>n(J9.bridges)})}),(0,G.jsx)(Fv,{size:{xs:6,sm:3},children:(0,G.jsx)(KE,{title:e(`common.devices`),value:y,icon:(0,G.jsx)(mb,{}),color:t.palette.primary.main,subtitle:x>0?(0,G.jsx)(Ev,{icon:(0,G.jsx)(Yv,{sx:{fontSize:14}}),label:`${x} failed`,size:`small`,color:`warning`,variant:`outlined`,clickable:!0,onClick:e=>{e.stopPropagation(),n(`${J9.devices}?showFailed=true`)},sx:{height:22,fontSize:`0.7rem`}}):void 0,onClick:()=>n(J9.devices)})}),(0,G.jsx)(Fv,{size:{xs:6,sm:3},children:(0,G.jsx)(KE,{title:e(`common.fabrics`),value:b,icon:(0,G.jsx)(Ox,{}),color:t.palette.secondary.main,onClick:()=>n(J9.networkMap)})}),(0,G.jsx)(Fv,{size:{xs:6,sm:3},children:(0,G.jsx)(KE,{title:e(`dashboard.haConnection`),value:e(w?`common.online`:`common.offline`),icon:w?(0,G.jsx)(lv,{}):(0,G.jsx)(Cx,{}),color:w?t.palette.success.main:t.palette.error.main,subtitle:i?.uptime==null?void 0:`${e(`health.uptime`)} ${p_e(i.uptime)}`})})]}),r===`bridges`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:(0,G.jsx)(Q,{variant:`h6`,children:e(`nav.bridges`)})}),(0,G.jsxs)(Hv,{direction:`row`,spacing:1.5,sx:{mb:2},flexWrap:`wrap`,useFlexGap:!0,children:[(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(JT,{}),onClick:()=>l(!0),size:`large`,children:e(`dashboard.bridgeWizard`)}),(0,G.jsx)(mv,{variant:`outlined`,startIcon:(0,G.jsx)(fb,{}),onClick:()=>n(J9.createBridge),size:`large`,children:e(`dashboard.createBridge`)}),(0,G.jsx)(mv,{variant:`outlined`,startIcon:(0,G.jsx)(oE,{}),onClick:()=>n(J9.areaSetup),size:`large`,children:e(`dashboard.areaSetup`)}),(0,G.jsx)(Ub,{orientation:`vertical`,flexItem:!0}),(0,G.jsx)(mv,{variant:`outlined`,color:`success`,startIcon:(0,G.jsx)(lE,{}),disabled:u,onClick:async()=>{if(!f.current){f.current=!0,d(!0);try{await I_(),await v()}finally{d(!1),f.current=!1}}},children:e(`dashboard.startAll`)}),(0,G.jsx)(mv,{variant:`outlined`,color:`error`,startIcon:(0,G.jsx)(yE,{}),disabled:u,onClick:async()=>{if(!f.current){f.current=!0,d(!0);try{await L_(),await v()}finally{d(!1),f.current=!1}}},children:e(`dashboard.stopAll`)}),(0,G.jsx)(mv,{variant:`outlined`,color:`warning`,startIcon:(0,G.jsx)(fE,{}),disabled:u,onClick:async()=>{if(!f.current){f.current=!0,d(!0);try{await R_(),await v()}finally{d(!1),f.current=!1}}},children:e(`dashboard.restartAll`)})]}),i?.bridgeDetails&&i.bridgeDetails.length>0?(0,G.jsx)(Fv,{container:!0,spacing:1.5,children:[...i.bridgeDetails].sort((e,t)=>(e.priority??100)-(t.priority??100)).map((e,t)=>(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(m_e,{bridge:e,order:t+1,onClick:()=>n(J9.bridge(e.id))})},e.id))}):(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsx)(vv,{sx:{textAlign:`center`,py:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`dashboard.noBridgesHint`)})})})]}),r===`quickNav`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:e(`dashboard.quickNavigation`)}),(0,G.jsxs)(Fv,{container:!0,spacing:1.5,children:[(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`nav.bridges`),icon:(0,G.jsx)(iE,{sx:{fontSize:20}}),onClick:()=>n(J9.bridges)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`dashboard.areaSetup`),icon:(0,G.jsx)(oE,{sx:{fontSize:20}}),onClick:()=>n(J9.areaSetup)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`nav.devices`),icon:(0,G.jsx)(mb,{sx:{fontSize:20}}),onClick:()=>n(J9.devices)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`nav.networkMap`),icon:(0,G.jsx)(GT,{sx:{fontSize:20}}),onClick:()=>n(J9.networkMap)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`nav.health`),icon:(0,G.jsx)(kx,{sx:{fontSize:20}}),onClick:()=>n(J9.health)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`dashboard.startupOrder`),icon:(0,G.jsx)(uv,{sx:{fontSize:20}}),onClick:()=>n(J9.startup)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`dashboard.lockCredentials`),icon:(0,G.jsx)(ET,{sx:{fontSize:20}}),onClick:()=>n(J9.lockCredentials)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`dashboard.filterReference`),icon:(0,G.jsx)(aE,{sx:{fontSize:20}}),onClick:()=>n(J9.labels)})}),(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:4},children:(0,G.jsx)(qE,{title:e(`nav.settings`),icon:(0,G.jsx)(FT,{sx:{fontSize:20}}),onClick:()=>n(J9.settings)})})]})]})]},r)),(0,G.jsx)(f_e,{open:p,config:h.config,onToggle:h.toggleWidget,onMove:h.moveWidget,onReset:h.resetToDefaults,onClose:()=>m(!1)}),(0,G.jsx)(VE,{open:c,onClose:()=>l(!1),onComplete:()=>{r(V_()),v()}})]})};function g_e(e){return Jd(`MuiPagination`,e)}Yd(`MuiPagination`,[`root`,`ul`,`outlined`,`text`]);function v_e(e={}){let{boundaryCount:t=1,componentName:n=`usePagination`,count:r=1,defaultPage:i=1,disabled:a=!1,hideNextButton:o=!1,hidePrevButton:s=!1,onChange:c,page:l,showFirstButton:u=!1,showLastButton:d=!1,siblingCount:f=1,...p}=e,[m,h]=ih({controlled:l,default:i,name:n,state:`page`}),g=(e,t)=>{l||h(t),c&&c(e,t)},_=(e,t)=>{let n=t-e+1;return Array.from({length:n},(t,n)=>e+n)},v=_(1,Math.min(t,r)),y=_(Math.max(r-t+1,t+1),r),b=Math.max(Math.min(m-f,r-t-f*2-1),t+2),x=Math.min(Math.max(m+f,t+f*2+2),r-t-1),S=[...u?[`first`]:[],...s?[]:[`previous`],...v,...b>t+2?[`start-ellipsis`]:t+1<r-t?[t+1]:[],..._(b,x),...x<r-t-1?[`end-ellipsis`]:r-t>t?[r-t]:[],...y,...o?[]:[`next`],...d?[`last`]:[]],C=e=>{switch(e){case`first`:return 1;case`previous`:return m-1;case`next`:return m+1;case`last`:return r;default:return null}};return{items:S.map(e=>typeof e==`number`?{onClick:t=>{g(t,e)},type:`page`,page:e,selected:e===m,disabled:a,"aria-current":e===m?`page`:void 0}:{onClick:t=>{g(t,C(e))},type:e,page:C(e),selected:!1,disabled:a||!e.includes(`ellipsis`)&&(e===`next`||e===`last`?m>=r:m<=1)}),...p}}function y_e(e){return Jd(`MuiPaginationItem`,e)}var JE=Yd(`MuiPaginationItem`,[`root`,`page`,`sizeSmall`,`sizeLarge`,`text`,`textPrimary`,`textSecondary`,`outlined`,`outlinedPrimary`,`outlinedSecondary`,`rounded`,`ellipsis`,`firstLast`,`previousNext`,`focusVisible`,`disabled`,`selected`,`icon`,`colorPrimary`,`colorSecondary`]),b_e=X((0,G.jsx)(`path`,{d:`M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z`}),`FirstPage`),x_e=X((0,G.jsx)(`path`,{d:`M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z`}),`LastPage`),S_e=X((0,G.jsx)(`path`,{d:`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`NavigateBefore`),C_e=X((0,G.jsx)(`path`,{d:`M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`NavigateNext`),YE=(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.variant===`text`&&t[`text${Y(n.color)}`],n.variant===`outlined`&&t[`outlined${Y(n.color)}`],n.shape===`rounded`&&t.rounded,n.type===`page`&&t.page,(n.type===`start-ellipsis`||n.type===`end-ellipsis`)&&t.ellipsis,(n.type===`previous`||n.type===`next`)&&t.previousNext,(n.type===`first`||n.type===`last`)&&t.firstLast]},w_e=e=>{let{classes:t,color:n,disabled:r,selected:i,size:a,shape:o,type:s,variant:c}=e;return Cp({root:[`root`,`size${Y(a)}`,c,o,n!==`standard`&&`color${Y(n)}`,n!==`standard`&&`${c}${Y(n)}`,r&&`disabled`,i&&`selected`,{page:`page`,first:`firstLast`,last:`firstLast`,"start-ellipsis":`ellipsis`,"end-ellipsis":`ellipsis`,previous:`previousNext`,next:`previousNext`}[s]],icon:[`icon`]},y_e,t)},T_e=J(`div`,{name:`MuiPaginationItem`,slot:`Root`,overridesResolver:YE})(Fm(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:`center`,boxSizing:`border-box`,minWidth:32,padding:`0 6px`,margin:`0 3px`,color:(e.vars||e).palette.text.primary,height:`auto`,[`&.${JE.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:`small`},style:{minWidth:26,borderRadius:26/2,margin:`0 1px`,padding:`0 4px`}},{props:{size:`large`},style:{minWidth:40,borderRadius:40/2,padding:`0 10px`,fontSize:e.typography.pxToRem(15)}}]}))),E_e=J(Nh,{name:`MuiPaginationItem`,slot:`Root`,overridesResolver:YE})(Fm(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:`center`,boxSizing:`border-box`,minWidth:32,height:32,padding:`0 6px`,margin:`0 3px`,color:(e.vars||e).palette.text.primary,[`&.${JE.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${JE.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},transition:e.transitions.create([`color`,`background-color`],{duration:e.transitions.duration.short}),"&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${JE.selected}`]:{backgroundColor:(e.vars||e).palette.action.selected,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${JE.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${JE.disabled}`]:{opacity:1,color:(e.vars||e).palette.action.disabled,backgroundColor:(e.vars||e).palette.action.selected}},variants:[{props:{size:`small`},style:{minWidth:26,height:26,borderRadius:26/2,margin:`0 1px`,padding:`0 4px`}},{props:{size:`large`},style:{minWidth:40,height:40,borderRadius:40/2,padding:`0 10px`,fontSize:e.typography.pxToRem(15)}},{props:{shape:`rounded`},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:{variant:`outlined`},style:{border:e.vars?`1px solid ${e.alpha(e.vars.palette.common.onBackground,.23)}`:`1px solid ${e.palette.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`}`,[`&.${JE.selected}`]:{[`&.${JE.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:`text`},style:{[`&.${JE.selected}`]:{[`&.${JE.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Um([`dark`,`contrastText`])).map(([t])=>({props:{variant:`text`,color:t},style:{[`&.${JE.selected}`]:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}},[`&.${JE.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${JE.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Um([`light`])).map(([t])=>({props:{variant:`outlined`,color:t},style:{[`&.${JE.selected}`]:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.5)}`,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.activatedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`),"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${JE.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),D_e=J(`div`,{name:`MuiPaginationItem`,slot:`Icon`})(Fm(({theme:e})=>({fontSize:e.typography.pxToRem(20),margin:`0 -8px`,variants:[{props:{size:`small`},style:{fontSize:e.typography.pxToRem(18)}},{props:{size:`large`},style:{fontSize:e.typography.pxToRem(22)}}]}))),O_e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiPaginationItem`}),{className:r,color:i=`standard`,component:a,components:o={},disabled:s=!1,page:c,selected:l=!1,shape:u=`circular`,size:d=`medium`,slots:f={},slotProps:p={},type:m=`page`,variant:h=`text`,...g}=n,_={...n,color:i,disabled:s,selected:l,shape:u,size:d,type:m,variant:h},v=Uf(),y=w_e(_),b={slots:{previous:f.previous??o.previous,next:f.next??o.next,first:f.first??o.first,last:f.last??o.last},slotProps:p},[x,S]=Hm(`previous`,{elementType:S_e,externalForwardedProps:b,ownerState:_}),[C,w]=Hm(`next`,{elementType:C_e,externalForwardedProps:b,ownerState:_}),[T,E]=Hm(`first`,{elementType:b_e,externalForwardedProps:b,ownerState:_}),[D,O]=Hm(`last`,{elementType:x_e,externalForwardedProps:b,ownerState:_}),k=v?{previous:`next`,next:`previous`,first:`last`,last:`first`}[m]:m,A={previous:x,next:C,first:T,last:D}[k],j={previous:S,next:w,first:E,last:O}[k];return m===`start-ellipsis`||m===`end-ellipsis`?(0,G.jsx)(T_e,{ref:t,ownerState:_,className:K(y.root,r),children:`…`}):(0,G.jsxs)(E_e,{ref:t,ownerState:_,component:a,disabled:s,className:K(y.root,r),...g,children:[m===`page`&&c,A?(0,G.jsx)(D_e,{...j,className:y.icon,as:A}):null]})}),k_e=e=>{let{classes:t,variant:n}=e;return Cp({root:[`root`,n],ul:[`ul`]},g_e,t)},A_e=J(`nav`,{name:`MuiPagination`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),j_e=J(`ul`,{name:`MuiPagination`,slot:`Ul`})({display:`flex`,flexWrap:`wrap`,alignItems:`center`,padding:0,margin:0,listStyle:`none`});function M_e(e,t,n){return e===`page`?`${n?``:`Go to `}page ${t}`:`Go to ${e} page`}var N_e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiPagination`}),{boundaryCount:r=1,className:i,color:a=`standard`,count:o=1,defaultPage:s=1,disabled:c=!1,getItemAriaLabel:l=M_e,hideNextButton:u=!1,hidePrevButton:d=!1,onChange:f,page:p,renderItem:m=e=>(0,G.jsx)(O_e,{...e}),shape:h=`circular`,showFirstButton:g=!1,showLastButton:_=!1,siblingCount:v=1,size:y=`medium`,variant:b=`text`,...x}=n,{items:S}=v_e({...n,componentName:`Pagination`}),C={...n,boundaryCount:r,color:a,count:o,defaultPage:s,disabled:c,getItemAriaLabel:l,hideNextButton:u,hidePrevButton:d,renderItem:m,shape:h,showFirstButton:g,showLastButton:_,siblingCount:v,size:y,variant:b},w=k_e(C);return(0,G.jsx)(A_e,{"aria-label":`pagination navigation`,className:K(w.root,i),ownerState:C,ref:t,...x,children:(0,G.jsx)(j_e,{className:w.ul,ownerState:C,children:S.map((e,t)=>(0,G.jsx)(`li`,{children:m({...e,color:a,"aria-label":l(e.type,e.page,e.selected),shape:h,size:y,variant:b})},t))})})}),XE=[10,25,50,100],ZE=`hamh-devices-page-size`,P_e=()=>{let{t:e}=ws(),t=J_(),{content:n,isLoading:r}=RT(),[i,a]=va(),o=i.get(`showFailed`)===`true`,[s,c]=(0,C.useState)(``),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(`name`),[h,g]=(0,C.useState)(`asc`),[_,v]=(0,C.useState)(1),[y,b]=(0,C.useState)(()=>{let e=localStorage.getItem(ZE);if(!e)return 12;if(e===`all`)return 0;let t=parseInt(e,10);return t>0?t:12}),[x,S]=(0,C.useState)(``),w=(0,C.useCallback)(e=>{b(e),localStorage.setItem(ZE,e===0?`all`:String(e)),v(1)},[]),[T,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(``),[k,A]=(0,C.useState)(``),[j,M]=(0,C.useState)(),[N,P]=(0,C.useState)({open:!1,message:``,severity:`success`});(0,C.useEffect)(()=>{t(V_())},[t]),(0,C.useEffect)(()=>{n&&n.forEach(e=>{t(UT(e.id))})},[t,n]);let F=Y_(e=>e.devices.byBridge),I=(0,C.useCallback)((e,t,n)=>{let r=[];if(!e.parts||e.parts.length===0)e.endpoint!==0&&r.push({bridgeId:t,bridgeName:n,endpoint:e});else for(let i of e.parts)r.push(...I(i,t,n));return r},[]),L=(0,C.useMemo)(()=>{let e=[];return(n||[]).forEach(t=>{let n=F[t.id]?.content;n&&e.push(...I(n,t.id,t.name))}),e},[n,F,I]),[R,ee]=(0,C.useState)({}),z=(0,C.useMemo)(()=>{let e=[];for(let t of L){let n=t.endpoint.state.homeAssistantEntity?.entity?.entity_id;n&&e.push(n)}return e},[L]),te=(0,C.useCallback)(()=>{z.length!==0&&NS(z).then(ee).catch(()=>{})},[z]);(0,C.useEffect)(()=>{te()},[te]);let B=(0,C.useCallback)(()=>{te()},[te]),V=r||n&&n.length>0&&L.length===0,ne=(0,C.useMemo)(()=>{if(!n)return[];let e=[];for(let t of n)for(let n of t.failedEntities??[])e.push({...n,bridgeName:t.name});return e},[n]),re=(0,C.useCallback)(()=>{a(e=>(e.delete(`showFailed`),e))},[a]),ie=(0,C.useMemo)(()=>L.filter(e=>{let t=Ax(e.endpoint.state)??e.endpoint.id.local,n=e.endpoint.type.name,r=t.toLowerCase().includes(s.toLowerCase())||e.bridgeName.toLowerCase().includes(s.toLowerCase())||n.toLowerCase().includes(s.toLowerCase()),i=!l||e.bridgeId===l;return r&&i&&(!d||n===d)}),[L,s,l,d]),ae=(0,C.useMemo)(()=>[...ie].sort((e,t)=>{let n=Ax(e.endpoint.state)??e.endpoint.id.local,r=Ax(t.endpoint.state)??t.endpoint.id.local,i=0;switch(p){case`name`:i=n.localeCompare(r);break;case`type`:i=e.endpoint.type.name.localeCompare(t.endpoint.type.name),i===0&&(i=n.localeCompare(r));break;case`bridge`:i=e.bridgeName.localeCompare(t.bridgeName),i===0&&(i=n.localeCompare(r));break}return h===`asc`?i:-i}),[ie,p,h]),oe=y===0?1:Math.ceil(ae.length/y),se=y===0?ae:ae.slice((_-1)*y,_*y),ce=(0,C.useMemo)(()=>{let e=new Set(L.map(e=>e.endpoint.type.name));return Array.from(e).sort()},[L]),le=(0,C.useMemo)(()=>n?[...n].sort((e,t)=>{let n=e.name.localeCompare(t.name);return h===`asc`?n:-n}):[],[n,h]),ue=(0,C.useCallback)(()=>{t(V_())},[t]),H=(0,C.useCallback)(async(e,t)=>{O(e),A(t);try{M((await PS(t)).mappings.find(t=>t.entityId===e))}catch{M(void 0)}E(!0)},[]),de=(0,C.useCallback)(async t=>{if(!(!k||!D))try{await FS(k,D,t),P({open:!0,message:e(`mapping.saved`,{entityId:D}),severity:`success`}),E(!1)}catch(t){P({open:!0,message:e(`mapping.saveFailed`,{error:String(t)}),severity:`error`})}},[k,D,e]);return V?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Q,{variant:`h4`,gutterBottom:!0,sx:{display:`flex`,alignItems:`center`,gap:2},children:[(0,G.jsx)(mb,{}),e(`nav.devices`),(0,G.jsx)(mv,{variant:`outlined`,startIcon:(0,G.jsx)(dE,{}),onClick:ue,sx:{ml:`auto`},children:e(`common.refresh`)})]}),o&&ne.length>0&&(0,G.jsxs)(Uh,{severity:`warning`,sx:{mb:3},action:(0,G.jsx)(Bh,{size:`small`,color:`inherit`,onClick:re,children:(0,G.jsx)(QT,{fontSize:`small`})}),children:[(0,G.jsx)(Q,{variant:`body2`,fontWeight:`bold`,gutterBottom:!0,children:e(`devices.failedEntitiesTitle`,{count:ne.length,defaultValue:`${ne.length} failed entities`})}),(0,G.jsx)($v,{dense:!0,disablePadding:!0,children:ne.map(e=>(0,G.jsxs)(ny,{sx:{py:0},children:[(0,G.jsx)(iy,{sx:{minWidth:32},children:(0,G.jsx)(Yv,{color:`warning`,fontSize:`small`})}),(0,G.jsx)(oy,{primary:e.entityId,secondary:`${e.bridgeName}, ${e.reason}`,primaryTypographyProps:{variant:`body2`,fontWeight:`bold`},secondaryTypographyProps:{variant:`caption`}})]},`${e.bridgeName}-${e.entityId}`))})]}),o&&ne.length===0&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:3},action:(0,G.jsx)(Bh,{size:`small`,color:`inherit`,onClick:re,children:(0,G.jsx)(QT,{fontSize:`small`})}),children:(0,G.jsx)(Q,{variant:`body2`,children:e(`devices.noFailedEntities`,{defaultValue:`No failed entities, all devices loaded successfully.`})})}),(0,G.jsx)(hv,{sx:{mb:3},children:(0,G.jsx)(vv,{children:(0,G.jsxs)(Hv,{spacing:2,direction:{xs:`column`,md:`row`},alignItems:{md:`center`},children:[(0,G.jsx)(ES,{label:e(`devices.searchPlaceholder`),value:s,onChange:e=>c(e.target.value),sx:{flexGrow:1}}),(0,G.jsxs)(kv,{sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:e(`devices.filterBridge`)}),(0,G.jsxs)(SS,{value:l,label:e(`devices.filterBridge`),onChange:e=>u(e.target.value),children:[(0,G.jsx)(CS,{value:``,children:e(`devices.allBridges`)}),le.map(e=>(0,G.jsx)(CS,{value:e.id,children:e.name},e.id))]})]}),(0,G.jsxs)(kv,{sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:e(`devices.filterDeviceType`)}),(0,G.jsxs)(SS,{value:d,label:e(`devices.filterDeviceType`),onChange:e=>f(e.target.value),children:[(0,G.jsx)(CS,{value:``,children:e(`devices.allTypes`)}),ce.map(e=>(0,G.jsx)(CS,{value:e,children:e},e))]})]}),(0,G.jsxs)(kv,{sx:{minWidth:150},children:[(0,G.jsx)(Bx,{children:e(`devices.sortBy`)}),(0,G.jsxs)(SS,{value:p,label:e(`devices.sortBy`),onChange:e=>m(e.target.value),children:[(0,G.jsx)(CS,{value:`bridge`,children:e(`devices.sortBridge`)}),(0,G.jsx)(CS,{value:`type`,children:e(`devices.sortType`)}),(0,G.jsx)(CS,{value:`name`,children:e(`devices.sortName`)})]})]}),(0,G.jsx)(db,{title:e(h===`asc`?`common.ascending`:`common.descending`),children:(0,G.jsx)(Bh,{onClick:()=>g(e=>e===`asc`?`desc`:`asc`),color:`primary`,children:h===`asc`?(0,G.jsx)(qT,{}):(0,G.jsx)(KT,{})})})]})})}),(0,G.jsx)(Fv,{container:!0,spacing:2,children:se.map(e=>(0,G.jsx)(Fv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(tC,{endpoint:e.endpoint,bridgeName:e.bridgeName,bridgeId:e.bridgeId,onEditMapping:H,imageInfo:R[e.endpoint.state.homeAssistantEntity?.entity?.entity_id??``],onImageChanged:B})},`${e.bridgeId}-${e.endpoint.id.global}`))}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,mt:3,gap:2,flexWrap:`wrap`},children:[(0,G.jsxs)(Hv,{direction:`row`,spacing:1,alignItems:`center`,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{whiteSpace:`nowrap`},children:`Per page:`}),(0,G.jsxs)(SS,{value:y===0?`all`:XE.includes(y)?String(y):``,onChange:e=>{let t=e.target.value;S(``),w(t===`all`?0:parseInt(t,10))},displayEmpty:!0,renderValue:t=>t===`all`?e(`common.all`):t===``?String(y):t,size:`small`,sx:{minWidth:80},children:[XE.map(e=>(0,G.jsx)(CS,{value:String(e),children:e},e)),(0,G.jsx)(CS,{value:`all`,children:e(`common.all`)})]}),(0,G.jsx)(ES,{size:`small`,type:`number`,placeholder:e(`common.custom`),value:x,onChange:e=>S(e.target.value),onBlur:()=>{let e=parseInt(x,10);e>0&&w(e),S(``)},onKeyDown:e=>{if(e.key===`Enter`){let e=parseInt(x,10);e>0&&w(e),S(``)}},slotProps:{htmlInput:{min:1,style:{textAlign:`center`}}},sx:{width:80}})]}),oe>1&&(0,G.jsx)(N_e,{count:oe,page:_,onChange:(e,t)=>v(t),color:`primary`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{whiteSpace:`nowrap`},children:ie.length===L.length?e(`devices.deviceCount`,{count:L.length}):e(`devices.filteredCount`,{filtered:ie.length,total:L.length})})]}),ie.length===0&&(0,G.jsxs)(Z,{sx:{textAlign:`center`,py:8},children:[(0,G.jsx)(Q,{variant:`h6`,color:`text.secondary`,children:`No devices found`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:`Try adjusting your filters or check if any bridges are running`})]}),(0,G.jsx)(QS,{open:T,entityId:D,domain:D.split(`.`)[0]||``,currentMapping:j,onSave:de,onClose:()=>E(!1)}),(0,G.jsx)($h,{open:N.open,autoHideDuration:6e3,onClose:()=>P(e=>({...e,open:!1})),children:(0,G.jsx)(Uh,{onClose:()=>P(e=>({...e,open:!1})),severity:N.severity,sx:{width:`100%`},children:N.message})})]})};function QE(e){return typeof e!=`object`||!e||typeof e.lastModified==`number`&&typeof File<`u`&&e instanceof File||typeof e.getMonth==`function`&&typeof Date<`u`&&e instanceof Date?!1:!Array.isArray(e)}function F_e(e){return e.additionalItems===!0&&console.warn(`additionalItems=true is currently not supported`),QE(e.additionalItems)}function $E(e){if(e===``)return;if(e===null)return null;if(/\.$/.test(e)||/\.0$/.test(e)||/\.\d*0$/.test(e))return e;let t=Number(e);return typeof t==`number`&&!Number.isNaN(t)?t:e}var eD=`__additional_property`,I_e=`additionalProperties`,tD=`allOf`,nD=`anyOf`,rD=`const`,iD=`default`,aD=`__errors`,oD=`items`,L_e=`_$junk_option_schema_id$_`,sD=`$name`,cD=`oneOf`,lD=`properties`,uD=`readonly`,R_e=`required`,dD=`submitButtonOptions`,fD=`$ref`,pD=`__rjsf_ref`,mD=`root`,z_e=[`discriminator`,`propertyName`],B_e=`formContext`,V_e=`layoutGridLookupMap`,hD=`__rjsf_additionalProperties`,gD=`__rjsf_rootSchema`,_D=`ui:options`,vD=`ui:globalOptions`;function yD(e={},t={}){return e?Object.keys(e).filter(e=>e.indexOf(`ui:`)===0).reduce((t,n)=>{let r=e[n];return n===`ui:widget`&&QE(r)?(console.error(`Setting options via ui:widget object is no longer supported, use ui:options instead`),t):n===`ui:options`&&QE(r)?{...t,...r}:{...t,[n.substring(3)]:r}},{...t}):{...t}}function bD(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;let{expandable:r=!0}=yD(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var xD=typeof global==`object`&&global&&global.Object===Object&&global,H_e=typeof self==`object`&&self&&self.Object===Object&&self,SD=xD||H_e||Function(`return this`)(),CD=SD.Symbol,wD=Object.prototype,U_e=wD.hasOwnProperty,W_e=wD.toString,TD=CD?CD.toStringTag:void 0;function G_e(e){var t=U_e.call(e,TD),n=e[TD];try{e[TD]=void 0;var r=!0}catch{}var i=W_e.call(e);return r&&(t?e[TD]=n:delete e[TD]),i}var K_e=Object.prototype.toString;function q_e(e){return K_e.call(e)}var J_e=`[object Null]`,Y_e=`[object Undefined]`,ED=CD?CD.toStringTag:void 0;function DD(e){return e==null?e===void 0?Y_e:J_e:ED&&ED in Object(e)?G_e(e):q_e(e)}function OD(e,t){return function(n){return e(t(n))}}var kD=OD(Object.getPrototypeOf,Object);function AD(e){return typeof e==`object`&&!!e}var X_e=`[object Object]`,Z_e=Function.prototype,Q_e=Object.prototype,jD=Z_e.toString,$_e=Q_e.hasOwnProperty,eve=jD.call(Object);function MD(e){if(!AD(e)||DD(e)!=X_e)return!1;var t=kD(e);if(t===null)return!0;var n=$_e.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&jD.call(n)==eve}function ND(e){let t={[aD]:[],addError(e){this[aD].push(e)}};if(Array.isArray(e))return e.reduce((e,t,n)=>({...e,[n]:ND(t)}),t);if(MD(e)){let n=e;return Object.keys(n).reduce((e,t)=>({...e,[t]:ND(n[t])}),t)}return t}function tve(){this.__data__=[],this.size=0}function PD(e,t){return e===t||e!==e&&t!==t}function FD(e,t){for(var n=e.length;n--;)if(PD(e[n][0],t))return n;return-1}var nve=Array.prototype.splice;function rve(e){var t=this.__data__,n=FD(t,e);return n<0?!1:(n==t.length-1?t.pop():nve.call(t,n,1),--this.size,!0)}function ive(e){var t=this.__data__,n=FD(t,e);return n<0?void 0:t[n][1]}function ave(e){return FD(this.__data__,e)>-1}function ove(e,t){var n=this.__data__,r=FD(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ID(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ID.prototype.clear=tve,ID.prototype.delete=rve,ID.prototype.get=ive,ID.prototype.has=ave,ID.prototype.set=ove;function sve(){this.__data__=new ID,this.size=0}function cve(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function lve(e){return this.__data__.get(e)}function uve(e){return this.__data__.has(e)}function LD(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var dve=`[object AsyncFunction]`,fve=`[object Function]`,pve=`[object GeneratorFunction]`,mve=`[object Proxy]`;function RD(e){if(!LD(e))return!1;var t=DD(e);return t==fve||t==pve||t==dve||t==mve}var zD=SD[`__core-js_shared__`],BD=function(){var e=/[^.]+$/.exec(zD&&zD.keys&&zD.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function hve(e){return!!BD&&BD in e}var gve=Function.prototype.toString;function VD(e){if(e!=null){try{return gve.call(e)}catch{}try{return e+``}catch{}}return``}var _ve=/[\\^$.*+?()[\]{}|]/g,vve=/^\[object .+?Constructor\]$/,yve=Function.prototype,bve=Object.prototype,xve=yve.toString,Sve=bve.hasOwnProperty,Cve=RegExp(`^`+xve.call(Sve).replace(_ve,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function wve(e){return!LD(e)||hve(e)?!1:(RD(e)?Cve:vve).test(VD(e))}function Tve(e,t){return e?.[t]}function HD(e,t){var n=Tve(e,t);return wve(n)?n:void 0}var UD=HD(SD,`Map`),WD=HD(Object,`create`);function Eve(){this.__data__=WD?WD(null):{},this.size=0}function Dve(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var Ove=`__lodash_hash_undefined__`,kve=Object.prototype.hasOwnProperty;function Ave(e){var t=this.__data__;if(WD){var n=t[e];return n===Ove?void 0:n}return kve.call(t,e)?t[e]:void 0}var jve=Object.prototype.hasOwnProperty;function Mve(e){var t=this.__data__;return WD?t[e]!==void 0:jve.call(t,e)}var Nve=`__lodash_hash_undefined__`;function Pve(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=WD&&t===void 0?Nve:t,this}function GD(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}GD.prototype.clear=Eve,GD.prototype.delete=Dve,GD.prototype.get=Ave,GD.prototype.has=Mve,GD.prototype.set=Pve;function Fve(){this.size=0,this.__data__={hash:new GD,map:new(UD||ID),string:new GD}}function Ive(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function KD(e,t){var n=e.__data__;return Ive(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Lve(e){var t=KD(this,e).delete(e);return this.size-=+!!t,t}function Rve(e){return KD(this,e).get(e)}function zve(e){return KD(this,e).has(e)}function Bve(e,t){var n=KD(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function qD(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qD.prototype.clear=Fve,qD.prototype.delete=Lve,qD.prototype.get=Rve,qD.prototype.has=zve,qD.prototype.set=Bve;var Vve=200;function Hve(e,t){var n=this.__data__;if(n instanceof ID){var r=n.__data__;if(!UD||r.length<Vve-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qD(r)}return n.set(e,t),this.size=n.size,this}function JD(e){var t=this.__data__=new ID(e);this.size=t.size}JD.prototype.clear=sve,JD.prototype.delete=cve,JD.prototype.get=lve,JD.prototype.has=uve,JD.prototype.set=Hve;var Uve=`__lodash_hash_undefined__`;function Wve(e){return this.__data__.set(e,Uve),this}function Gve(e){return this.__data__.has(e)}function YD(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new qD;++t<n;)this.add(e[t])}YD.prototype.add=YD.prototype.push=Wve,YD.prototype.has=Gve;function Kve(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function XD(e,t){return e.has(t)}var qve=1,Jve=2;function ZD(e,t,n,r,i,a){var o=n&qve,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&Jve?new YD:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!Kve(t,function(e,t){if(!XD(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}var QD=SD.Uint8Array;function Yve(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function $D(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Xve=1,Zve=2,Qve=`[object Boolean]`,$ve=`[object Date]`,eye=`[object Error]`,tye=`[object Map]`,nye=`[object Number]`,rye=`[object RegExp]`,iye=`[object Set]`,aye=`[object String]`,oye=`[object Symbol]`,sye=`[object ArrayBuffer]`,cye=`[object DataView]`,eO=CD?CD.prototype:void 0,tO=eO?eO.valueOf:void 0;function lye(e,t,n,r,i,a,o){switch(n){case cye:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case sye:return!(e.byteLength!=t.byteLength||!a(new QD(e),new QD(t)));case Qve:case $ve:case nye:return PD(+e,+t);case eye:return e.name==t.name&&e.message==t.message;case rye:case aye:return e==t+``;case tye:var s=Yve;case iye:var c=r&Xve;if(s||=$D,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=Zve,o.set(e,t);var u=ZD(s(e),s(t),r,i,a,o);return o.delete(e),u;case oye:if(tO)return tO.call(e)==tO.call(t)}return!1}function nO(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var rO=Array.isArray;function iO(e,t,n){var r=t(e);return rO(e)?r:nO(r,n(e))}function uye(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function aO(){return[]}var dye=Object.prototype.propertyIsEnumerable,oO=Object.getOwnPropertySymbols,sO=oO?function(e){return e==null?[]:(e=Object(e),uye(oO(e),function(t){return dye.call(e,t)}))}:aO;function cO(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var fye=`[object Arguments]`;function lO(e){return AD(e)&&DD(e)==fye}var uO=Object.prototype,pye=uO.hasOwnProperty,mye=uO.propertyIsEnumerable,dO=lO(function(){return arguments}())?lO:function(e){return AD(e)&&pye.call(e,`callee`)&&!mye.call(e,`callee`)};function hye(){return!1}var fO=typeof exports==`object`&&exports&&!exports.nodeType&&exports,pO=fO&&typeof module==`object`&&module&&!module.nodeType&&module,mO=pO&&pO.exports===fO?SD.Buffer:void 0,hO=(mO?mO.isBuffer:void 0)||hye,gye=9007199254740991,_ye=/^(?:0|[1-9]\d*)$/;function gO(e,t){var n=typeof e;return t??=gye,!!t&&(n==`number`||n!=`symbol`&&_ye.test(e))&&e>-1&&e%1==0&&e<t}var vye=9007199254740991;function _O(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=vye}var yye=`[object Arguments]`,bye=`[object Array]`,xye=`[object Boolean]`,Sye=`[object Date]`,Cye=`[object Error]`,wye=`[object Function]`,Tye=`[object Map]`,Eye=`[object Number]`,Dye=`[object Object]`,Oye=`[object RegExp]`,kye=`[object Set]`,Aye=`[object String]`,jye=`[object WeakMap]`,Mye=`[object ArrayBuffer]`,Nye=`[object DataView]`,Pye=`[object Float32Array]`,Fye=`[object Float64Array]`,Iye=`[object Int8Array]`,Lye=`[object Int16Array]`,Rye=`[object Int32Array]`,zye=`[object Uint8Array]`,Bye=`[object Uint8ClampedArray]`,Vye=`[object Uint16Array]`,Hye=`[object Uint32Array]`,vO={};vO[Pye]=vO[Fye]=vO[Iye]=vO[Lye]=vO[Rye]=vO[zye]=vO[Bye]=vO[Vye]=vO[Hye]=!0,vO[yye]=vO[bye]=vO[Mye]=vO[xye]=vO[Nye]=vO[Sye]=vO[Cye]=vO[wye]=vO[Tye]=vO[Eye]=vO[Dye]=vO[Oye]=vO[kye]=vO[Aye]=vO[jye]=!1;function Uye(e){return AD(e)&&_O(e.length)&&!!vO[DD(e)]}function yO(e){return function(t){return e(t)}}var bO=typeof exports==`object`&&exports&&!exports.nodeType&&exports,xO=bO&&typeof module==`object`&&module&&!module.nodeType&&module,SO=xO&&xO.exports===bO&&xD.process,CO=function(){try{return xO&&xO.require&&xO.require(`util`).types||SO&&SO.binding&&SO.binding(`util`)}catch{}}(),wO=CO&&CO.isTypedArray,TO=wO?yO(wO):Uye,Wye=Object.prototype.hasOwnProperty;function EO(e,t){var n=rO(e),r=!n&&dO(e),i=!n&&!r&&hO(e),a=!n&&!r&&!i&&TO(e),o=n||r||i||a,s=o?cO(e.length,String):[],c=s.length;for(var l in e)(t||Wye.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||gO(l,c)))&&s.push(l);return s}var Gye=Object.prototype;function DO(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Gye)}var Kye=OD(Object.keys,Object),qye=Object.prototype.hasOwnProperty;function OO(e){if(!DO(e))return Kye(e);var t=[];for(var n in Object(e))qye.call(e,n)&&n!=`constructor`&&t.push(n);return t}function kO(e){return e!=null&&_O(e.length)&&!RD(e)}function AO(e){return kO(e)?EO(e):OO(e)}function jO(e){return iO(e,AO,sO)}var Jye=1,Yye=Object.prototype.hasOwnProperty;function Xye(e,t,n,r,i,a){var o=n&Jye,s=jO(e),c=s.length;if(c!=jO(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:Yye.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var MO=HD(SD,`DataView`),NO=HD(SD,`Promise`),PO=HD(SD,`Set`),FO=HD(SD,`WeakMap`),IO=`[object Map]`,Zye=`[object Object]`,LO=`[object Promise]`,RO=`[object Set]`,zO=`[object WeakMap]`,BO=`[object DataView]`,Qye=VD(MO),$ye=VD(UD),ebe=VD(NO),tbe=VD(PO),nbe=VD(FO),VO=DD;(MO&&VO(new MO(new ArrayBuffer(1)))!=BO||UD&&VO(new UD)!=IO||NO&&VO(NO.resolve())!=LO||PO&&VO(new PO)!=RO||FO&&VO(new FO)!=zO)&&(VO=function(e){var t=DD(e),n=t==Zye?e.constructor:void 0,r=n?VD(n):``;if(r)switch(r){case Qye:return BO;case $ye:return IO;case ebe:return LO;case tbe:return RO;case nbe:return zO}return t});var HO=VO,rbe=1,UO=`[object Arguments]`,WO=`[object Array]`,GO=`[object Object]`,KO=Object.prototype.hasOwnProperty;function ibe(e,t,n,r,i,a){var o=rO(e),s=rO(t),c=o?WO:HO(e),l=s?WO:HO(t);c=c==UO?GO:c,l=l==UO?GO:l;var u=c==GO,d=l==GO,f=c==l;if(f&&hO(e)){if(!hO(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new JD,o||TO(e)?ZD(e,t,n,r,i,a):lye(e,t,c,n,r,i,a);if(!(n&rbe)){var p=u&&KO.call(e,`__wrapped__`),m=d&&KO.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new JD,i(h,g,n,r,a)}}return f?(a||=new JD,Xye(e,t,n,r,i,a)):!1}function qO(e,t,n,r,i){return e===t?!0:e==null||t==null||!AD(e)&&!AD(t)?e!==e&&t!==t:ibe(e,t,n,r,qO,i)}function abe(e,t,n){n=typeof n==`function`?n:void 0;var r=n?n(e,t):void 0;return r===void 0?qO(e,t,void 0,n):!!r}function JO(e,t){return abe(e,t,(e,t)=>{if(typeof e==`function`&&typeof t==`function`)return!0})}var obe=`[object Symbol]`;function YO(e){return typeof e==`symbol`||AD(e)&&DD(e)==obe}var sbe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cbe=/^\w*$/;function XO(e,t){if(rO(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||YO(e)?!0:cbe.test(e)||!sbe.test(e)||t!=null&&e in Object(t)}var lbe=`Expected a function`;function ZO(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(lbe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ZO.Cache||qD),n}ZO.Cache=qD;var ube=500;function dbe(e){var t=ZO(e,function(e){return n.size===ube&&n.clear(),e}),n=t.cache;return t}var fbe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pbe=/\\(\\)?/g,QO=dbe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(fbe,function(e,n,r,i){t.push(r?i.replace(pbe,`$1`):n||e)}),t});function $O(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var mbe=1/0,ek=CD?CD.prototype:void 0,tk=ek?ek.toString:void 0;function nk(e){if(typeof e==`string`)return e;if(rO(e))return $O(e,nk)+``;if(YO(e))return tk?tk.call(e):``;var t=e+``;return t==`0`&&1/e==-mbe?`-0`:t}function rk(e){return e==null?``:nk(e)}function ik(e,t){return rO(e)?e:XO(e,t)?[e]:QO(rk(e))}var hbe=1/0;function ak(e){if(typeof e==`string`||YO(e))return e;var t=e+``;return t==`0`&&1/e==-hbe?`-0`:t}function ok(e,t){t=ik(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[ak(t[n++])];return n&&n==r?e:void 0}function sk(e,t,n){var r=e==null?void 0:ok(e,t);return r===void 0?n:r}var gbe=Object.prototype.hasOwnProperty;function _be(e,t){return e!=null&&gbe.call(e,t)}function ck(e,t,n){t=ik(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=ak(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&_O(i)&&gO(o,i)&&(rO(e)||dO(e)))}function lk(e,t){return e!=null&&ck(e,t,_be)}function uk(e,t){return qO(e,t)}var dk=function(){try{var e=HD(Object,`defineProperty`);return e({},``,{}),e}catch{}}();function fk(e,t,n){t==`__proto__`&&dk?dk(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var vbe=Object.prototype.hasOwnProperty;function pk(e,t,n){var r=e[t];(!(vbe.call(e,t)&&PD(r,n))||n===void 0&&!(t in e))&&fk(e,t,n)}function mk(e,t,n,r){if(!LD(e))return e;t=ik(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=ak(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=LD(u)?u:gO(t[i+1])?[]:{})}pk(s,c,l),s=s[c]}return e}function hk(e,t,n){return e==null?e:mk(e,t,n)}function gk(e){return e}function _k(e){return typeof e==`function`?e:gk}var ybe=/\s/;function bbe(e){for(var t=e.length;t--&&ybe.test(e.charAt(t)););return t}var xbe=/^\s+/;function Sbe(e){return e&&e.slice(0,bbe(e)+1).replace(xbe,``)}var vk=NaN,Cbe=/^[-+]0x[0-9a-f]+$/i,wbe=/^0b[01]+$/i,Tbe=/^0o[0-7]+$/i,Ebe=parseInt;function Dbe(e){if(typeof e==`number`)return e;if(YO(e))return vk;if(LD(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=LD(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Sbe(e);var n=wbe.test(e);return n||Tbe.test(e)?Ebe(e.slice(2),n?2:8):Cbe.test(e)?vk:+e}var yk=1/0,Obe=17976931348623157e292;function kbe(e){return e?(e=Dbe(e),e===yk||e===-yk?(e<0?-1:1)*Obe:e===e?e:0):e===0?e:0}function bk(e){var t=kbe(e),n=t%1;return t===t?n?t-n:t:0}var Abe=9007199254740991,xk=4294967295,jbe=Math.min;function Sk(e,t){if(e=bk(e),e<1||e>Abe)return[];var n=xk,r=jbe(e,xk);t=_k(t),e-=xk;for(var i=cO(r,t);++n<e;)t(n);return i}function Ck(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var wk=Object.create,Tk=function(){function e(){}return function(t){if(!LD(t))return{};if(wk)return wk(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Mbe(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var Ek=Mbe();function Dk(e,t){return e&&Ek(e,t,AO)}var Nbe=1,Pbe=2;function Fbe(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new JD;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?qO(u,l,Nbe|Pbe,r,d):f))return!1}}return!0}function Ok(e){return e===e&&!LD(e)}function Ibe(e){for(var t=AO(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Ok(i)]}return t}function kk(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Lbe(e){var t=Ibe(e);return t.length==1&&t[0][2]?kk(t[0][0],t[0][1]):function(n){return n===e||Fbe(n,e,t)}}function Rbe(e,t){return e!=null&&t in Object(e)}function Ak(e,t){return e!=null&&ck(e,t,Rbe)}var zbe=1,Bbe=2;function Vbe(e,t){return XO(e)&&Ok(t)?kk(ak(e),t):function(n){var r=sk(n,e);return r===void 0&&r===t?Ak(n,e):qO(t,r,zbe|Bbe)}}function Hbe(e){return function(t){return t?.[e]}}function Ube(e){return function(t){return ok(t,e)}}function Wbe(e){return XO(e)?Hbe(ak(e)):Ube(e)}function jk(e){return typeof e==`function`?e:e==null?gk:typeof e==`object`?rO(e)?Vbe(e[0],e[1]):Lbe(e):Wbe(e)}function Gbe(e,t,n){var r=rO(e),i=r||hO(e)||TO(e);if(t=jk(t,4),n==null){var a=e&&e.constructor;n=i?r?new a:[]:LD(e)&&RD(a)?Tk(kD(e)):{}}return(i?Ck:Dk)(e,function(e,r,i){return t(n,e,r,i)}),n}function Mk(e,t,n){(n!==void 0&&!PD(e[t],n)||n===void 0&&!(t in e))&&fk(e,t,n)}var Nk=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Pk=Nk&&typeof module==`object`&&module&&!module.nodeType&&module,Fk=Pk&&Pk.exports===Nk?SD.Buffer:void 0,Ik=Fk?Fk.allocUnsafe:void 0;function Lk(e,t){if(t)return e.slice();var n=e.length,r=Ik?Ik(n):new e.constructor(n);return e.copy(r),r}function Rk(e){var t=new e.constructor(e.byteLength);return new QD(t).set(new QD(e)),t}function zk(e,t){var n=t?Rk(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Bk(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function Vk(e){return typeof e.constructor==`function`&&!DO(e)?Tk(kD(e)):{}}function Hk(e){return AD(e)&&kO(e)}function Uk(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}function Wk(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?fk(n,s,c):pk(n,s,c)}return n}function Kbe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var qbe=Object.prototype.hasOwnProperty;function Jbe(e){if(!LD(e))return Kbe(e);var t=DO(e),n=[];for(var r in e)r==`constructor`&&(t||!qbe.call(e,r))||n.push(r);return n}function Gk(e){return kO(e)?EO(e,!0):Jbe(e)}function Ybe(e){return Wk(e,Gk(e))}function Xbe(e,t,n,r,i,a,o){var s=Uk(e,n),c=Uk(t,n),l=o.get(c);if(l){Mk(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=rO(c),p=!f&&hO(c),m=!f&&!p&&TO(c);u=c,f||p||m?rO(s)?u=s:Hk(s)?u=Bk(s):p?(d=!1,u=Lk(c,!0)):m?(d=!1,u=zk(c,!0)):u=[]:MD(c)||dO(c)?(u=s,dO(s)?u=Ybe(s):(!LD(s)||RD(s))&&(u=Vk(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),Mk(e,n,u)}function Kk(e,t,n,r,i){e!==t&&Ek(t,function(a,o){if(i||=new JD,LD(a))Xbe(e,t,o,n,Kk,r,i);else{var s=r?r(Uk(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Mk(e,o,s)}},Gk)}function Zbe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var qk=Math.max;function Jk(e,t,n){return t=qk(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=qk(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Zbe(e,this,s)}}function Qbe(e){return function(){return e}}var $be=dk?function(e,t){return dk(e,`toString`,{configurable:!0,enumerable:!1,value:Qbe(t),writable:!0})}:gk,exe=800,txe=16,nxe=Date.now;function rxe(e){var t=0,n=0;return function(){var r=nxe(),i=txe-(r-n);if(n=r,i>0){if(++t>=exe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Yk=rxe($be);function Xk(e,t){return Yk(Jk(e,t,gk),e+``)}function ixe(e,t,n){if(!LD(n))return!1;var r=typeof t;return(r==`number`?kO(n)&&gO(t,n.length):r==`string`&&t in n)?PD(n[t],e):!1}function axe(e){return Xk(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&ixe(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var oxe=axe(function(e,t,n){Kk(e,t,n)}),Zk=CD?CD.isConcatSpreadable:void 0;function sxe(e){return rO(e)||dO(e)||!!(Zk&&e&&e[Zk])}function Qk(e,t,n,r,i){var a=-1,o=e.length;for(n||=sxe,i||=[];++a<o;){var s=e[a];t>0&&n(s)?t>1?Qk(s,t-1,n,r,i):nO(i,s):r||(i[i.length]=s)}return i}var cxe=1/0;function lxe(e){return e!=null&&e.length?Qk(e,cxe):[]}function uxe(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function dxe(e){return e!==e}function fxe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function $k(e,t,n){return t===t?fxe(e,t,n):uxe(e,dxe,n)}function eA(e,t){return!!(e!=null&&e.length)&&$k(e,t,0)>-1}function tA(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function nA(){}var pxe=PO&&1/$D(new PO([,-0]))[1]==1/0?function(e){return new PO(e)}:nA,mxe=200;function rA(e,t,n){var r=-1,i=eA,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=tA;else if(a>=mxe){var l=t?null:pxe(e);if(l)return $D(l);o=!1,i=XD,c=new YD}else c=t?[]:s;outer:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||u!==0?u:0,o&&d===d){for(var f=c.length;f--;)if(c[f]===d)continue outer;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}function iA(e){return e&&e.length?rA(e):[]}var hxe=`[object Map]`,gxe=`[object Set]`,_xe=Object.prototype.hasOwnProperty;function aA(e){if(e==null)return!0;if(kO(e)&&(rO(e)||typeof e==`string`||typeof e.splice==`function`||hO(e)||TO(e)||dO(e)))return!e.length;var t=HO(e);if(t==hxe||t==gxe)return!e.size;if(DO(e))return!OO(e).length;for(var n in e)if(_xe.call(e,n))return!1;return!0}var vxe=Object.prototype;function oA(e){for(let t in e)if(vxe.hasOwnProperty.call(e,t))return!1;return!0}new Set([`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]);var sA=[`$defs`,`definitions`,`properties`,`patternProperties`,`dependencies`];new Set(sA);var cA=[`items`,`allOf`,`oneOf`,`anyOf`];new Set(cA);var lA=[`items`,`additionalItems`,`additionalProperties`,`propertyNames`,`contains`,`if`,`then`,`else`,`not`];new Set(lA),[...sA,...cA,...lA];function uA(e){return typeof e==`object`}function dA(e){return uA(e)?oA(e):e===!0}function fA(e,t){return e<t?-1:+(e>t)}function pA(e,t){let n=e.length;if(n===0)return t;let r=t.length;if(r===0)return e;if(n<r){let i=e;e=t,t=i,r=n}let i=new Set(e);for(let e=0;e<r;e++)i.add(t[e]);return Array.from(i)}function yxe(e,t){let n=[];if(e.length===0||t.length===0)return n;if(e.length>t.length){let n=e;e=t,t=n}let r=new Set(t);for(let t=0;t<e.length&&r.size>0;t++){let i=e[t];r.delete(i)&&n.push(i)}return n}function mA(e){return e.length===0}function hA(e){return(t,n)=>{let r=t.length-n.length;if(r!==0)return r;for(let r=0;r<t.length;r++)if(t[r]!==n[r]){let i=e(t[r],n[r]);if(i!==0)return i}return 0}}function gA(e,{threshold:t=12}={}){return n=>{let r=n.length;if(r===0)return n;if(r<=t){let t=[],i=0;outer:for(let a=0;a<r;a++){let r=n[a];for(let n=0;n<i;n++)if(e(r,t[n])===0)continue outer;i=t.push(r)}return t}let i=n.slice().sort(e),a=0;for(let t=1;t<r;t++)e(i[a],i[t])!==0&&++a!==t&&(i[a]=i[t]);return i.length=a+1,i}}function bxe(e){return(t,n)=>{let r=[],i=t.length,a=n.length;if(i===0||a===0)return r;if(i>a){let e=t;t=n,n=e;let r=i;i=a,a=r}let o=[...t].sort(e),s=[...n].sort(e),c=0,l=0;for(;c<i&&l<a;){let t=e(o[c],s[l]);t===0?((r.length===0||e(r[r.length-1],o[c])!==0)&&r.push(o[c]),c++,l++):t<0?c++:l++}return r}}function xxe(e,t){return n=>{if(e.has(n))return e.get(n);let r=t(n);return e.set(n,r),r}}var _A=xxe,vA=()=>0,Sxe=e=>e===void 0,Cxe=e=>typeof e!=`object`,yA={boolean:0,number:1,string:2};function wxe(e,t){let n=typeof e,r=typeof t;return n===r?fA(e,t):yA[n]-yA[r]}function Txe(e,t){let n=e.length;if(n===0)return t;let r=t.length;if(r===0)return e;if(r>n){let n=e;e=t,t=n}let i=new Set(e),a=t.length;for(let n=0;n<a;n++){let r=t[n];i.has(r)||e.push(r)}return e}function bA(e,t,n=vA){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function xA(e){return bA(Sxe,e)}function SA(e,t){return bA(t=>t===void 0||e(t),t)}function CA(e,t){return bA(Array.isArray,e,t)}var wA=xA(fA),TA=SA(e=>e===0,(e,t)=>e-t);function Exe({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){let n=_A(t,e=>Object.keys(e).sort());function r(e){return(t,r)=>{let i=n(t),a=n(r),o=Math.min(i.length,a.length);for(let e=0;e<o;e++){let t=fA(i[e],a[e]);if(t!==0)return t}if(i.length!==a.length)return i.length-a.length;for(let n=0;n<o;n++){let a=i[n],o=e(t[a],r[a]);if(o!==0)return o}return 0}}function i(t){let n=hA(t),r=_A(e,gA(t,{threshold:0}));return(e,t)=>n(r(e),r(t))}let a=i(fA);function o(e,t){if(uA(e)){if(uA(t)){let n=Txe(Object.keys(e),Object.keys(t)),r=n.length;for(let i=0;i<r;i++){let r=n[i];if(e[r]===t[r])continue;let a=(m[r]??s)(e[r],t[r]);if(a!==0)return a}return 0}return t===!0&&oA(e)?0:1}return uA(t)?e===!0&&oA(t)?0:-1:fA(e,t)}let s=xA(l),c=bA(Cxe,CA(r(s),hA(l)),wxe);function l(e,t){return e===null?-1:t===null?1:c(e,t)}let u=xA(o),d=SA(oA,r(u)),f=xA(i(o)),p=SA(dA,o),m={$id:wA,$comment:wA,$defs:d,$ref:wA,$schema:wA,const:s,contains:u,contentEncoding:wA,contentMediaType:wA,default:s,definitions:d,description:wA,else:u,examples:s,exclusiveMaximum:wA,exclusiveMinimum:wA,format:wA,if:u,maximum:wA,maxItems:wA,maxLength:wA,maxProperties:wA,minimum:wA,multipleOf:wA,not:u,pattern:wA,propertyNames:u,readOnly:wA,then:u,title:wA,writeOnly:wA,uniqueItems:SA(e=>e===!1,vA),minLength:TA,minItems:TA,minProperties:TA,required:SA(mA,a),enum:SA(mA,i(l)),type:xA((e,t)=>{let n=Array.isArray(e),r=Array.isArray(t);return!n&&!r?fA(e,t):a(n?e:[e],r?t:[t])}),items:SA(e=>!Array.isArray(e)&&dA(e),CA(o,hA(o))),anyOf:f,allOf:f,oneOf:f,properties:d,patternProperties:d,additionalProperties:p,additionalItems:p,dependencies:SA(oA,r(xA(CA(o,a))))};return{compareSchemaValues:l,compareSchemaDefinitions:o}}function EA(e){return e}var DA=(e,t)=>e?DA(t%e,e):t,Dxe=(e,t)=>Math.abs(e*t)/DA(e,t);function Oxe(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function OA(e,t,n){let r=e.length,i=t.length;if(r>0&&i>0)for(let a=0;a<r;a++){let r=e[a];for(let e=0;e<i;e++)n(r,t[e])}}function kA(e,t){return e||t}function AA(e){return(t,n)=>{let r={...t},i=Object.keys(n),a=i.length;for(let o=0;o<a;o++){let a=i[o];r[a]=t[a]===void 0?n[a]:e(t[a],n[a])}return r}}function kxe(e){let t=new Map;for(let n of e)for(let e of n[0])t.set(e,n[1]);return t}function jA(e,t,n){n===void 0||dA(n)?delete e[t]:e[t]=n}var Axe=[`properties`,`patternProperties`,`additionalProperties`];function MA(e){let t=Object.keys(e),n=t.length,r=[];for(let i=0;i<n;i++){let n=t[i];r.push({regExp:new RegExp(n),schema:e[n]})}return[r,t]}var NA=[[],[]];function PA(e,t,n){let r=n.length;for(let i=0;i<r;i++){let r=n[i];if(!r.regExp.test(t))continue;let a=r.schema;if(a===!1)return!0;e.push(a)}return!1}var jxe=[`items`,`additionalItems`],Mxe=[`if`,`then`,`else`];function FA(e,t){return t.if!==void 0&&(e.if=t.if),t.then!==void 0&&(e.then=t.then),t.else!==void 0&&(e.else=t.else),e}function IA(e,t){if(e===t)return e;switch(e){case`number`:if(t===`integer`)return`integer`;case`integer`:if(t===`number`)return`integer`;default:return}}function LA(e,t,n){return[e,t,n]}function Nxe(e){let t=new Map;for(let[n,r,i]of e){let e=e=>{if(!i(e))throw Error(`Schema keys '${n}' and '${r}' are conflicting (${n}: ${JSON.stringify(e[n])}, ${r}: ${JSON.stringify(e[r])})`)};for(let i of[[n,r],[r,n]]){let n=t.get(i[0]);n===void 0&&(n=[],t.set(i[0],n)),n.push({oppositeKey:i[1],check:e})}}return t}var Pxe=[LA(`minimum`,`maximum`,e=>e.maximum>=e.minimum),LA(`exclusiveMinimum`,`maximum`,e=>e.maximum>e.exclusiveMinimum),LA(`minimum`,`exclusiveMaximum`,e=>e.exclusiveMaximum>e.minimum),LA(`exclusiveMinimum`,`exclusiveMaximum`,e=>e.exclusiveMaximum>e.exclusiveMinimum),LA(`minLength`,`maxLength`,e=>e.maxLength>=e.minLength),LA(`minItems`,`maxItems`,e=>e.maxItems>=e.minItems),LA(`minProperties`,`maxProperties`,e=>e.maxProperties>=e.minProperties)];function Fxe({mergePatterns:e=Oxe,isSubRegExp:t=Object.is,intersectJson:n=yxe,deduplicateJsonSchemaDef:r=EA,defaultMerger:i=EA,assigners:a=[],checks:o=Pxe,mergers:s}={}){function c(e){let t=e.length,n=e[0];for(let r=1;r<t;r++){let t=_(n,e[r]);if(t===!1)return!1;dA(t)||(n=t)}return n}function l(e,t,n,r,i,a,o){if(e.length=0,n===!1)return!1;if(e.push(n),i!==void 0){if(i===!1)return!1;e.push(i)}if(PA(e,t,a))return!1;let s=e.length<2;if(o===!1){if(s)return;if(PA(e,t,r))return!1}else s&&o!==void 0&&e.push(o);return e.length===1?e[0]:c(e)}function u(e,t,n,r,i,a){let o=n.length;if(o>0&&i!==!1)if(a)Object.assign(e,t);else for(let a=0;a<o;a++){let o=n[a];r.has(o)||(e[o]=_(t[o],i))}return e}let d=(n,{properties:r={},patternProperties:i,additionalProperties:a=!0},{properties:o={},patternProperties:s,additionalProperties:c=!0})=>{let d=dA(a),f=dA(c);if(d&&f)return jA(n,`properties`,v(r,o)),jA(n,`patternProperties`,i&&s?v(i,s):i??s),delete n.additionalProperties,n;jA(n,`additionalProperties`,_(a,c));let p={},m=Object.keys(r),h=m.length,[g,y]=i?MA(i):NA,[b,x]=s?MA(s):NA,S=[],C=new Set,w=f?void 0:c;for(let e=0;e<h;e++){let t=m[e];C.add(t);let n=l(S,t,r[t],g,o[t],b,w);n!==void 0&&(p[t]=n)}let T=Object.keys(o),E=T.length,D=d?void 0:a;for(let e=0;e<E;e++){let t=T[e];if(C.has(t))continue;let n=l(S,t,o[t],b,void 0,g,D);n!==void 0&&(p[t]=n)}jA(n,`properties`,p);let O={},k=new Set;return y.length>0&&x.length>0&&OA(y,x,(n,r)=>{t(n,r)&&k.add(n),t(r,n)&&k.add(r),O[e(n,r)]=_(i[n],s[r])}),O=u(O,i,y,k,c,f),O=u(O,s,x,k,a,d),jA(n,`patternProperties`,O),n},f=(e,{items:t=[],additionalItems:n},{items:r=[],additionalItems:i})=>{let a=Array.isArray(t),o=Array.isArray(r),s=[];if(e.items=s,a&&o){let[a,o,c]=t.length<r.length?[t.length,n,r]:[r.length,i,t],l=0;for(;l<a;l++)s.push(_(t[l],r[l]));if(o===!1)e.additionalItems=!1;else{let t=o===void 0||dA(o);for(;l<c.length;l++)s.push(t?c[l]:_(c[l],o));jA(e,`additionalItems`,n!==void 0&&i!==void 0?_(n,i):n??i)}}else if(a||o){let[o,c,l]=a?[t,r,n]:[r,t,i];jA(e,`additionalItems`,l&&_(l,c));for(let e=0;e<o.length;e++)s.push(_(o[e],c))}else delete e.additionalItems,e.items=_(t,r);return e},p=(e,t,n)=>{FA(e,t);let r=FA({},n);return e.allOf===void 0?e.allOf=[r]:e.allOf=e.allOf.concat(r),e};function m(e,t){let n=[];if(OA(e,t,(e,t)=>{try{n.push(_(e,t))}catch{}}),n.length===0)throw Error(`No valid schema combinations could be produced for "${JSON.stringify(e)}" and "${JSON.stringify(t)}"; the merged result is empty`);return r(n)}let h=kxe([[Axe,d],[jxe,f],[Mxe,p],...a]),g=Nxe(o);function _(e,t){if(e===!1||t===!1)return!1;if(dA(e))return dA(t)?!0:t;if(dA(t))return e;let n={...e},r=new Set,a=new Set,o=Object.keys(t),s=o.length;for(let c=0;c<s;c++){let s=o[c],l=t[s];if(l===void 0)continue;let u=g.get(s);if(u!==void 0){let t=u.length;for(let n=0;n<t;n++){let t=u[n];e[t.oppositeKey]!==void 0&&a.add(t.check)}}let d=e[s];if(d===void 0){n[s]=l;continue}let f=h.get(s);if(f){r.add(f);continue}let p=y[s]??i;n[s]=p(d,l)}for(let i of r)n=i(n,e,t);for(let e of a)e(n);return n}let v=AA(_),y={$id:i,$ref:i,$schema:i,$comment:i,$defs:v,definitions:v,type:(e,t)=>{if(e===t)return e;let n=Array.isArray(e),r=Array.isArray(t);if(!n&&!r){let n=IA(e,t);if(n!==void 0)return n}else if(n||r){let i=new Set;if(n&&r)OA(e,t,(e,t)=>{let n=IA(e,t);n!==void 0&&i.add(n)});else{let r=n?e:t,a=n?t:e,o=r.length;for(let e=0;e<o;e++){let t=IA(a,r[e]);t!==void 0&&i.add(t)}}let a=i.size;if(a===1)return i.values().next().value;if(a>1)return Array.from(i)}throw Error(`It is not possible to create an intersection of the following incompatible types: ${e.toString()}, ${t.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(e,t)=>{let n=r([e,t]);return n.length===1?n[0]:{anyOf:n}},pattern:e,readOnly:kA,writeOnly:kA,enum:(e,t)=>{let r=n(e,t);if(r.length===0)throw Error(`Intersection of the following enums is empty: "${JSON.stringify(e)}", "${JSON.stringify(t)}"`);return r},anyOf:m,oneOf:m,allOf:(e,t)=>r(e.concat(t)),propertyNames:_,contains:_,dependencies:AA((e,t)=>Array.isArray(e)?Array.isArray(t)?pA(e,t):_(t,{required:e}):Array.isArray(t)?_(e,{required:t}):_(e,t)),examples:(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))throw Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(e)}" and "${JSON.stringify(t)}"`);return pA(e,t)},multipleOf:(e,t)=>{let n=1;for(;!Number.isInteger(e)||!Number.isInteger(t);)n*=10,e*=10,t*=10;return Dxe(e,t)/n},exclusiveMaximum:Math.min,maximum:Math.min,maxItems:Math.min,maxLength:Math.min,maxProperties:Math.min,exclusiveMinimum:Math.max,minimum:Math.max,minItems:Math.max,minLength:Math.max,minProperties:Math.max,uniqueItems:kA,required:pA,...s};return{mergeSchemaDefinitions:_,mergeArrayOfSchemaDefinitions:c}}function Ixe(e){let t=[],n=[e];for(;n.length>0;){let e=n.pop();if(typeof e==`boolean`||e.allOf===void 0){t.push(e);continue}let{allOf:r,...i}=e;t.push(i);for(let e=r.length-1;e>=0;e--)n.push(r[e])}return t}function Lxe(e){return t=>e(Ixe(t))}var RA=u(s((e=>{var t=/~/,n=/~[01]/g;function r(e){switch(e){case`~1`:return`/`;case`~0`:return`~`}throw Error(`Invalid tilde escape: `+e)}function i(e){return t.test(e)?e.replace(n,r):e}function a(e){if(typeof e==`string`){if(e=e.split(`/`),e[0]===``)return e;throw Error(`Invalid JSON pointer.`)}else if(Array.isArray(e)){for(let t of e)if(typeof t!=`string`&&typeof t!=`number`)throw Error(`Invalid JSON pointer. Must be of type string or number.`);return e}throw Error(`Invalid JSON pointer.`)}function o(e,t){if(typeof e!=`object`)throw Error(`Invalid input object.`);t=a(t);var n=t.length;if(n===1)return e;for(var r=1;r<n;){if(e=e[i(t[r++])],n===r)return e;if(typeof e!=`object`||!e)return}}e.get=o}))(),1);function Rxe(e,t){return e&&Wk(t,AO(t),e)}function zxe(e,t){return e&&Wk(t,Gk(t),e)}function Bxe(e,t){return Wk(e,sO(e),t)}var zA=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)nO(t,sO(e)),e=kD(e);return t}:aO;function Vxe(e,t){return Wk(e,zA(e),t)}function BA(e){return iO(e,Gk,zA)}var Hxe=Object.prototype.hasOwnProperty;function Uxe(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Hxe.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Wxe(e,t){var n=t?Rk(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Gxe=/\w*$/;function Kxe(e){var t=new e.constructor(e.source,Gxe.exec(e));return t.lastIndex=e.lastIndex,t}var VA=CD?CD.prototype:void 0,HA=VA?VA.valueOf:void 0;function qxe(e){return HA?Object(HA.call(e)):{}}var Jxe=`[object Boolean]`,Yxe=`[object Date]`,Xxe=`[object Map]`,Zxe=`[object Number]`,Qxe=`[object RegExp]`,$xe=`[object Set]`,eSe=`[object String]`,tSe=`[object Symbol]`,nSe=`[object ArrayBuffer]`,rSe=`[object DataView]`,iSe=`[object Float32Array]`,aSe=`[object Float64Array]`,oSe=`[object Int8Array]`,sSe=`[object Int16Array]`,cSe=`[object Int32Array]`,lSe=`[object Uint8Array]`,uSe=`[object Uint8ClampedArray]`,dSe=`[object Uint16Array]`,fSe=`[object Uint32Array]`;function pSe(e,t,n){var r=e.constructor;switch(t){case nSe:return Rk(e);case Jxe:case Yxe:return new r(+e);case rSe:return Wxe(e,n);case iSe:case aSe:case oSe:case sSe:case cSe:case lSe:case uSe:case dSe:case fSe:return zk(e,n);case Xxe:return new r;case Zxe:case eSe:return new r(e);case Qxe:return Kxe(e);case $xe:return new r;case tSe:return qxe(e)}}var mSe=`[object Map]`;function hSe(e){return AD(e)&&HO(e)==mSe}var UA=CO&&CO.isMap,gSe=UA?yO(UA):hSe,_Se=`[object Set]`;function vSe(e){return AD(e)&&HO(e)==_Se}var WA=CO&&CO.isSet,ySe=WA?yO(WA):vSe,bSe=1,xSe=2,SSe=4,GA=`[object Arguments]`,CSe=`[object Array]`,wSe=`[object Boolean]`,TSe=`[object Date]`,ESe=`[object Error]`,KA=`[object Function]`,DSe=`[object GeneratorFunction]`,OSe=`[object Map]`,kSe=`[object Number]`,qA=`[object Object]`,ASe=`[object RegExp]`,jSe=`[object Set]`,MSe=`[object String]`,NSe=`[object Symbol]`,PSe=`[object WeakMap]`,FSe=`[object ArrayBuffer]`,ISe=`[object DataView]`,LSe=`[object Float32Array]`,RSe=`[object Float64Array]`,zSe=`[object Int8Array]`,BSe=`[object Int16Array]`,VSe=`[object Int32Array]`,HSe=`[object Uint8Array]`,USe=`[object Uint8ClampedArray]`,WSe=`[object Uint16Array]`,GSe=`[object Uint32Array]`,JA={};JA[GA]=JA[CSe]=JA[FSe]=JA[ISe]=JA[wSe]=JA[TSe]=JA[LSe]=JA[RSe]=JA[zSe]=JA[BSe]=JA[VSe]=JA[OSe]=JA[kSe]=JA[qA]=JA[ASe]=JA[jSe]=JA[MSe]=JA[NSe]=JA[HSe]=JA[USe]=JA[WSe]=JA[GSe]=!0,JA[ESe]=JA[KA]=JA[PSe]=!1;function YA(e,t,n,r,i,a){var o,s=t&bSe,c=t&xSe,l=t&SSe;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!LD(e))return e;var u=rO(e);if(u){if(o=Uxe(e),!s)return Bk(e,o)}else{var d=HO(e),f=d==KA||d==DSe;if(hO(e))return Lk(e,s);if(d==qA||d==GA||f&&!i){if(o=c||f?{}:Vk(e),!s)return c?Vxe(e,zxe(o,e)):Bxe(e,Rxe(o,e))}else{if(!JA[d])return i?e:{};o=pSe(e,d,s)}}a||=new JD;var p=a.get(e);if(p)return p;a.set(e,o),ySe(e)?e.forEach(function(r){o.add(YA(r,t,n,r,e,a))}):gSe(e)&&e.forEach(function(r,i){o.set(i,YA(r,t,n,i,e,a))});var m=u?void 0:(l?c?BA:jO:c?Gk:AO)(e);return Ck(m||e,function(r,i){m&&(i=r,r=e[i]),pk(o,i,YA(r,t,n,i,e,a))}),o}function XA(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function KSe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r<i;)a[r]=e[r+t];return a}function qSe(e,t){return t.length<2?e:ok(e,KSe(t,0,-1))}var JSe=Object.prototype.hasOwnProperty;function ZA(e,t){t=ik(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=ak(t[n]);if(i===`__proto__`&&!JSe.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=qSe(e,t);return a==null||delete a[ak(XA(t))]}function YSe(e){return MD(e)?void 0:e}function QA(e){return e!=null&&e.length?Qk(e,1):[]}function $A(e){return Yk(Jk(e,void 0,QA),e+``)}var XSe=1,ZSe=2,QSe=4,ej=$A(function(e,t){var n={};if(e==null)return n;var r=!1;t=$O(t,function(t){return t=ik(t,e),r||=t.length>1,t}),Wk(e,BA(e),n),r&&(n=YA(n,XSe|ZSe|QSe,YSe));for(var i=t.length;i--;)ZA(n,t[i]);return n}),tj=s(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),i=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var c=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function l(e){return e.length=0,!0}function u(e,t,n){if(e.length){let r=s(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function d(e){let t=0,n={error:!1,address:``,zone:``},r=[],i=[],a=!1,o=!1,c=u;for(let s=0;s<e.length;s++){let u=e[s];if(!(u===`[`||u===`]`))if(u===`:`){if(a===!0&&(o=!0),!c(i,r,n))break;if(++t>7){n.error=!0;break}s>0&&e[s-1]===`:`&&(a=!0),r.push(`:`);continue}else if(u===`%`){if(!c(i,r,n))break;c=l}else{i.push(u);continue}}return i.length&&(c===l?n.zone=i.join(``):o?r.push(i.join(``)):r.push(s(i))),n.address=r.join(``),n}function f(e){if(p(e,`:`)<2)return{host:e,isIPV6:!1};let t=d(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function p(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function m(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}var h={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},g=/[@/?#:]/g,_=/[@/?#]/g;function v(e,t){let n=t?_:g;return n.lastIndex=0,e.replace(n,e=>h[e])}function y(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let o=e.slice(r+1,r+3);if(i(o)){let e=o.toUpperCase(),i=String.fromCharCode(parseInt(e,16));t&&a(i)?n+=i:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function b(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&a(i)?t+=i:t+=`%`+e,n+=2;continue}}o(e[n])?t+=e[n]:t+=escape(e[n])}return t}function x(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(i(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function S(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let e=f(n);n=e.isIPV6===!0?`[${e.escapedHost}]`:v(n,!1)}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:c,recomposeAuthority:S,reescapeHostDelimiters:v,normalizePercentEncoding:y,normalizePathEncoding:b,escapePreservingEscapes:x,removeDotSegments:m,isIPv4:r,isUUID:n,normalizeIPv6:f,stringArrayToHexStripped:s}})),$Se=s(((e,t)=>{var{isUUID:n}=tj(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),nj=s(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,escapePreservingEscapes:s,reescapeHostDelimiters:c,isIPv4:l,nonSimpleDomain:u}=tj(),{SCHEMES:d,getSchemeHandler:f}=$Se();function p(e,t){return typeof e==`string`?e=S(e,t):typeof e==`object`&&(e=x(_(e,t),t)),e}function m(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=h(x(e,r),x(t,r),r,!0);return r.skipEscape=!0,_(i,r)}function h(e,t,n,i){let a={};return i||(e=x(_(e,n),n),t=x(_(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function g(e,t,n){let r=w(e,n),i=w(t,n);return r!==void 0&&i!==void 0&&r.toLowerCase()===i.toLowerCase()}function _(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},o=Object.assign({},t),c=[],l=f(o.scheme||n.scheme);l&&l.serialize&&l.serialize(n,o),n.path!==void 0&&(o.skipEscape?n.path=a(n.path):(n.path=s(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),o.reference!==`suffix`&&n.scheme&&c.push(n.scheme,`:`);let u=i(n);if(u!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(u),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!l||!l.absolutePath)&&(e=r(e)),u===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,n.query),n.fragment!==void 0&&c.push(`#`,n.fragment),c.join(``)}var v=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function b(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1,s=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let d=e.match(v);if(d){i.scheme=d[1],i.userinfo=d[3],i.host=d[4],i.port=parseInt(d[5],10),i.path=d[6]||``,i.query=d[7],i.fragment=d[8],isNaN(i.port)&&(i.port=d[5]);let t=y(i,d);if(t!==void 0&&(i.error=i.error||t,a=!0),i.host)if(l(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),s=e.isIPV6}else s=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let p=f(r.scheme||i.scheme);if(!r.unicodeSupport&&(!p||!p.unicodeSupport)&&i.host&&(r.domainHost||p&&p.domainHost)&&s===!1&&u(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}if((!p||p&&!p.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=c(unescape(i.host),s))),i.path&&=o(i.path),i.fragment))try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||`URI malformed`}p&&p.parse&&p.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:a}}function x(e,t){return b(e,t).parsed}function S(e,t){return C(e,t).normalized}function C(e,t){let{parsed:n,malformedAuthorityOrPort:r}=b(e,t);return{normalized:r?e:_(n,t),malformedAuthorityOrPort:r}}function w(e,t){if(typeof e==`string`){let{normalized:n,malformedAuthorityOrPort:r}=C(e,t);return r?void 0:n}if(typeof e==`object`)return _(e,t)}var T={SCHEMES:d,normalize:p,resolve:m,resolveComponent:h,equal:g,serialize:_,parse:x};t.exports=T,t.exports.default=T,t.exports.fastUri=T})),rj=u(nj(),1);function ij(e,t){if(`$id`in e&&rj.default.equal(e.$id,t))return e;for(let n of Object.values(e))if(Array.isArray(n)){for(let e of n)if(LD(e)){let n=ij(e,t);if(n!==void 0)return n}}else if(LD(n)){let e=ij(n,t);if(e!==void 0)return e}}function aj(e,t){let n=sk(e,`$id`,t);`$ref`in e&&(e={...e,[fD]:rj.default.resolve(n,e[fD])});for(let[t,r]of Object.entries(e))Array.isArray(r)?e={...e,[t]:r.map(e=>LD(e)?aj(e,n):e)}:LD(r)&&(e={...e,[t]:aj(r,n)});return e}function oj(e,t){let n=t[e];return[ej(t,[e]),n]}function sj(e,t={},n=[],r=sk(t,[`$id`])){let i=e||``,a;if(i.startsWith(`#`)){let e=decodeURIComponent(i.substring(1));r===void 0||`$id`in t&&t.$id===r?a=RA.get(t,e):t.$schema===`https://json-schema.org/draft/2020-12/schema`&&(a=ij(t,r.replace(/\/$/,``)),a!==void 0&&(a=RA.get(a,e)))}else if(t.$schema===`https://json-schema.org/draft/2020-12/schema`){let[e,...n]=(r?rj.default.resolve(r,i):i).replace(/#\/?$/,``).split(`#`);a=ij(t,e.replace(/\/$/,``)),a!==void 0&&(r=a.$id,aA(n)||(a=RA.get(a,decodeURIComponent(n.join(`#`)))))}if(a===void 0)throw Error(`Could not find a definition for ${e}.`);let o=a[fD];if(o){if(n.includes(o)){if(n.length===1)throw Error(`Definition for ${e} is a circular reference`);let[t,...r]=n,a=[...r,i,t].join(` -> `);throw Error(`Definition for ${t} contains a circular reference through ${a}`)}let[s,c]=oj(fD,a),l=sj(c,t,[...n,i],r);return Object.keys(s).length>0?t.$schema===`https://json-schema.org/draft/2019-09/schema`||t.$schema===`https://json-schema.org/draft/2020-12/schema`?{[tD]:[s,l]}:{...s,...l}:l}return a}function cj(e,t={},n=sk(t,[`$id`])){return sj(e,t,[],n)}var eCe=`[object String]`;function lj(e){return typeof e==`string`||!rO(e)&&AD(e)&&DD(e)==eCe}function uj(e){let t,n=sk(e,z_e);return lj(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function dj(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:e==null?`null`:typeof e==`boolean`?`boolean`:isNaN(e)?typeof e==`object`?`object`:`string`:`number`}var tCe=Xk(function(e){return rA(Qk(e,1,Hk,!0))});function fj(e){let{type:t}=e;return!t&&e.const?dj(e.const):!t&&e.enum?`string`:!t&&(e.properties||e.additionalProperties||e.patternProperties)?`object`:(Array.isArray(t)&&(t=t.length===2&&t.includes(`null`)?t.find(e=>e!==`null`):t[0]),t)}function pj(e,t){let n=Object.assign({},e);return Object.keys(t).reduce((n,r)=>{let i=e?e[r]:{},a=t[r];return e&&r in e&&QE(a)?n[r]=pj(i,a):e&&t&&(fj(e)===`object`||fj(t)===`object`)&&r===`required`&&Array.isArray(i)&&Array.isArray(a)?n[r]=tCe(i,a):n[r]=a,n},n)}var nCe=`[object Number]`;function mj(e){return typeof e==`number`||AD(e)&&DD(e)==nCe}function hj(e,t,n){if(e&&n){let r=sk(e,n);if(r===void 0)return;for(let e=0;e<t.length;e++){let i=t[e],a=sk(i,[lD,n],{});if(!(a.type===`object`||a.type===`array`)&&(a.const===r||a.enum?.includes(r)))return e}}}function gj(e,t,n,r,i){if(t===void 0)return 0;let a=hj(t,n,i);if(mj(a))return a;for(let a=0;a<n.length;a++){let o=n[a];if(i&&lk(o,[`properties`,i])){let n=sk(t,i),s=sk(o,[lD,i],{});if(e.isValid(s,n,r))return a}else if(o.properties){let n={anyOf:Object.keys(o[lD]).map(e=>({required:[e]}))},i;if(o.anyOf){let{...e}=o;e.allOf?e.allOf=e.allOf.slice():e.allOf=[],e.allOf.push(n),i=e}else i=Object.assign({},o,n);if(delete i.required,e.isValid(i,t,r))return a}else if(e.isValid(o,t,r))return a}return 0}function _j(e,t,n={},r,i,a=!1){return Sj(e,t,n,r,void 0,void 0,i,a)[0]}function rCe(e,t,n,r,i,a,o){let{if:s,then:c,else:l,...u}=t,d=e.isValid(s,a||{},n),f=[u],p=[];if(r)c&&typeof c!=`boolean`&&(p=p.concat(Sj(e,c,n,a,r,i,o))),l&&typeof l!=`boolean`&&(p=p.concat(Sj(e,l,n,a,r,i,o)));else{let t=d?c:l;t&&typeof t!=`boolean`&&(p=p.concat(Sj(e,t,n,a,r,i,o)))}return p.length&&(f=p.map(e=>pj(u,e))),f.flatMap(t=>Sj(e,t,n,a,r,i,o))}function vj(e){return e.reduce((e,t)=>t.length>1?t.flatMap(t=>Sk(e.length,n=>[...e[n]].concat(t))):(e.forEach(e=>e.push(t[0])),e),[[]])}function yj(e,t){return Object.keys(e.patternProperties).filter(e=>RegExp(e).test(t)).reduce((t,n)=>(hk(t,[n],e.patternProperties[n]),t),{})}function iCe(e,t,n,r,i,a,o,s){let c=bj(e,t,n,r,i,a,o,s);return c.length>1||c[0]!==t?c:`dependencies`in t?Cj(e,t,n,r,i,a,o).flatMap(t=>Sj(e,t,n,a,r,i,o)):`allOf`in t&&Array.isArray(t.allOf)?vj(t.allOf.map(t=>Sj(e,t,n,a,r,i,o))).map(e=>({...t,allOf:e})):[t]}function bj(e,t,n,r,i,a,o,s){let c=xj(t,n,i,void 0,s);return c===t?[t]:Sj(e,c,n,a,r,i,o,s)}function xj(e,t,n,r,i){if(!QE(e))return e;let a=e;if(`$ref`in a){let{$ref:e,...i}=a;if(n.includes(e))return a;n.push(e),a={...cj(e,t,r),...i,[pD]:e},`$id`in a&&(r=a.$id)}if(`properties`in a){let e=[],o=Gbe(a[lD],(a,o,s)=>{let c=[...n];a[s]=xj(o,t,c,r,i),e.push(c)},{});oxe(n,iA(lxe(e))),a={...a,[lD]:o}}if(`items`in a&&!Array.isArray(a.items)&&typeof a.items!=`boolean`&&(a={...a,items:xj(a.items,t,n,r,i)}),i){let o,s;`anyOf`in e&&Array.isArray(e.anyOf)?(o=nD,s=a[nD]):`oneOf`in e&&Array.isArray(e.oneOf)&&(o=cD,s=a[cD]),o&&s&&(a={...a,[o]:s.map(e=>xj(e,t,n,r,i))})}return JO(e,a)?e:a}function aCe(e,t,n,r,i){let a={...t,properties:{...t.properties}},o=r&&QE(r)?r:{};return Object.keys(o).forEach(t=>{if(!(t in a.properties)){if(`patternProperties`in a){let r=yj(a,t);if(!aA(r)){a.properties[t]=_j(e,{[tD]:Object.values(r)},n,sk(o,[t]),i),hk(a.properties,[t,eD],!0);return}}if(`additionalProperties`in a&&a.additionalProperties!==!1){let r;r=typeof a.additionalProperties==`boolean`?{type:dj(sk(o,[t]))}:`$ref`in a.additionalProperties?_j(e,{[fD]:sk(a.additionalProperties,[fD])},n,o,i):`type`in a.additionalProperties?{...a.additionalProperties}:`anyOf`in a.additionalProperties||`oneOf`in a.additionalProperties?{type:`object`,...a.additionalProperties}:{type:dj(sk(o,[t]))},a.properties[t]=r,hk(a.properties,[t,eD],!0)}else a.properties[t]={type:`null`},hk(a.properties,[t,eD],!0)}}),a}var{compareSchemaDefinitions:oCe,compareSchemaValues:sCe}=Exe(),{mergeArrayOfSchemaDefinitions:cCe}=Fxe({intersectJson:bxe(sCe),deduplicateJsonSchemaDef:gA(oCe)}),lCe=Lxe(cCe);function uCe(e){return lCe(e)}function Sj(e,t,n,r,i=!1,a=[],o,s){return QE(t)?iCe(e,t,n,i,a,r,o,s).flatMap(t=>{var s;let c=t;if(`if`in c)return rCe(e,c,n,i,a,r,o);if(`allOf`in c){if(i){let{allOf:e,...t}=c;return[...e,t]}try{let e=[],t=[];(s=c.allOf)==null||s.forEach(n=>{typeof n==`object`&&n.contains?e.push(n):t.push(n)}),e.length&&(c={...c,allOf:t}),c=o?o(c):uCe(c),e.length&&(c.allOf=e)}catch(e){console.warn(`could not merge subschemas in allOf:
|
|
219
219
|
`,e);let{allOf:t,...n}=c;return n}}return`properties`in c&&`patternProperties`in c&&(c=Object.keys(c.properties).reduce((t,i)=>{let a=yj(t,i);return aA(a)||(t.properties[i]=_j(e,{allOf:[t.properties[i],...Object.values(a)]},n,sk(r,[i]),o)),t},{...c,properties:{...c.properties}})),`patternProperties`in c||`additionalProperties`in c&&c.additionalProperties!==!1?aCe(e,c,n,r,o):c}):[{}]}function dCe(e,t,n,r,i){let a,{oneOf:o,anyOf:s,...c}=t;if(Array.isArray(o)?a=o:Array.isArray(s)&&(a=s),a){let o=i===void 0&&r?{}:i,s=uj(t);a=a.map(e=>xj(e,n,[]));let l=gj(e,o,a,n,s);if(r)return a.map(e=>pj(c,e));t=pj(c,a[l])}return[t]}function Cj(e,t,n,r,i,a,o){let{dependencies:s,...c}=t;return dCe(e,c,n,r,a).flatMap(t=>wj(e,s,t,n,r,i,a,o))}function wj(e,t,n,r,i,a,o,s){let c=[n];for(let l in t){if(!i&&sk(o,[l])===void 0||n.properties&&!(l in n.properties))continue;let[u,d]=oj(l,t);return Array.isArray(d)?c[0]=fCe(n,d):QE(d)&&(c=pCe(e,n,r,l,d,i,a,o,s)),c.flatMap(t=>wj(e,u,t,r,i,a,o,s))}return c}function fCe(e,t){if(!t)return e;let n=Array.isArray(e.required)?Array.from(new Set([...e.required,...t])):t;return{...e,required:n}}function pCe(e,t,n,r,i,a,o,s,c){return Sj(e,i,n,s,a,o,c).flatMap(i=>{let{oneOf:l,...u}=i;return t=pj(t,u),l===void 0?t:vj(l.map(t=>typeof t==`boolean`||!(`$ref`in t)?[t]:bj(e,t,n,a,o,s))).flatMap(i=>mCe(e,t,n,r,i,a,o,s,c))})}function mCe(e,t,n,r,i,a,o,s,c){let l=i.filter(t=>{if(typeof t==`boolean`||!t||!t.properties)return!1;let{[r]:i}=t.properties;if(i){let t={type:`object`,properties:{[r]:i}};return e.isValid(t,s,n)||a}return!1});return!a&&l.length!==1?(console.warn(`ignoring oneOf in dependencies because there isn't exactly one subschema that is valid`),[t]):l.flatMap(i=>{let l=i,[u]=oj(r,l.properties);return Sj(e,{...l,properties:u},n,s,a,o,c).map(e=>pj(t,e))})}function Tj(e,t,n,r,i,a={},o){if(Array.isArray(n[i])){let s=uj(n)||r,c=n[i].map(n=>_j(e,n,t,a,o)),l=sk(a,s);if(l!==void 0)return c.find(e=>uk(sk(e,[lD,s,iD],sk(e,[lD,s,rD])),l))}}function Ej(e,t,n,r,i){let a=n;if(lk(n,`$ref`)&&(a=_j(e,n,t,void 0,i)),aA(r))return a;let[o,...s]=Array.isArray(r)?r:r.split(`.`);if(o&&lk(a,o))return a=sk(a,o),Ej(e,t,a,s,i)}function Dj(e,t,n,r,i,a){let o=Ej(e,t,n,r,a);return o===void 0?i:o}var Oj={title:`!@#$_UNKNOWN_$#@!`};function hCe(e,t,n,r,i={},a){let o=Array.isArray(r)?[...r]:r.split(`.`),s=n,c=o.pop();o.length&&o.forEach(n=>{s=Dj(e,t,s,[lD,n],{},a),lk(s,`oneOf`)?s=Tj(e,t,s,c,cD,sk(i,n),a):lk(s,`anyOf`)&&(s=Tj(e,t,s,c,nD,sk(i,n),a))}),lk(s,`oneOf`)?s=Tj(e,t,s,c,cD,i,a):lk(s,`anyOf`)&&(s=Tj(e,t,s,c,nD,i,a));let l=Dj(e,t,s,[lD,c],Oj,a);l===Oj&&(l=void 0);let u=Dj(e,t,s,R_e,[],a),d;return l&&Array.isArray(u)&&(d=u.includes(c)),{field:l,isRequired:d}}function gCe(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function _Ce(e,t){return function(n,r){if(n==null)return n;if(!kO(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var kj=_Ce(Dk);function vCe(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function yCe(e,t,n){var r=rO(e)?gCe:vCe,i=arguments.length<3;return r(e,jk(t,4),n,i,kj)}var bCe={type:`object`,$id:L_e,properties:{__not_really_there__:{type:`number`}}};function Aj(e,t,n,r,i){let a=0;return n&&(LD(n.properties)?a+=yCe(n.properties,(n,a,o)=>{let s=sk(r,o);if(typeof a==`boolean`)return n;if(lk(a,`$ref`)){let r=_j(e,a,t,s,i);return n+Aj(e,t,r,s||{},i)}if((lk(a,`oneOf`)||lk(a,`anyOf`))&&s){let r=lk(a,`oneOf`)?cD:nD,o=uj(a);return n+jj(e,t,s,sk(a,r),-1,o,i)}if(a.type===`object`)return LD(s)&&(n+=1),n+Aj(e,t,a,s,i);if(a.type===dj(s)){let e=n+1;return a.default?e+=s===a.default?1:-1:a.const&&(e+=s===a.const?1:-1),e}return n},0):lj(n.type)&&n.type===dj(r)&&(a+=1)),a}function jj(e,t,n,r,i=-1,a,o){let s=r.map(e=>xj(e,t,[])),c=hj(n,r,a);if(mj(c))return c;let l=s.reduce((r,i,o)=>(gj(e,n,[bCe,i],t,a)===1&&r.push(o),r),[]);if(l.length===1)return l[0];l.length||Sk(s.length,e=>l.push(e));let u=new Set,{bestIndex:d}=l.reduce((r,i)=>{let{bestScore:a}=r,c=s[i],l=Aj(e,t,c,n,o);return u.add(l),l>a?{bestIndex:i,bestScore:l}:r},{bestIndex:i,bestScore:0});return u.size===1&&i>=0?i:d}function Mj(e){return Array.isArray(e.items)&&e.items.length>0&&e.items.every(e=>QE(e))}function Nj(e){return e==null}function Pj(e,t,n=!1,r=!1,i=!1){if(Array.isArray(t)){let a=Array.isArray(e)?e:[],o=i?a:t,s=i?t:a,c=o.map((e,o)=>s[o]===void 0?e:Pj(a[o],t[o],n,r,i));return(n||i)&&c.length<s.length&&c.push(...s.slice(c.length)),c}if(QE(t)){let a=Object.assign({},e);return Object.keys(t).reduce((a,o)=>{let s=sk(t,o),c=QE(e)&&o in e,l=o in t,u=sk(e,o)??{},d=c&&Object.entries(u).some(([,e])=>QE(e)),f=c&&QE(sk(e,o)),p=l&&QE(s);return f&&p&&!d?(a[o]={...sk(e,o),...s},a):(a[o]=Pj(sk(e,o),s,n,r,i&&(c||!l)),a)},a)}return r&&(e!==void 0&&Nj(t)||typeof t==`number`&&isNaN(t))||i&&!Nj(t)?e:t}function Fj(e,t,n=!1){return Object.keys(t).reduce((r,i)=>{let a=e?e[i]:{},o=t[i];if(e&&i in e&&QE(o))r[i]=Fj(a,o,n);else if(n&&Array.isArray(a)&&Array.isArray(o)){let e=o;n===`preventDuplicates`&&(e=o.reduce((e,t)=>(a.includes(t)||e.push(t),e),[])),r[i]=a.concat(e)}else r[i]=o;return r},Object.assign({},e))}function Ij(e){return Array.isArray(e.enum)&&e.enum.length===1||`const`in e}function Lj(e,t,n={},r){let i=_j(e,t,n,void 0,r),a=i.oneOf||i.anyOf;return Array.isArray(i.enum)?!0:Array.isArray(a)?a.every(e=>typeof e!=`boolean`&&Ij(e)):!1}function Rj(e,t,n,r){return!t.uniqueItems||!t.items||typeof t.items==`boolean`?!1:Lj(e,t.items,n,r)}function zj(e){let t=e[rD],n=fj(e);return QE(t)&&lj(t?.$data)&&n!==`object`&&n!==`array`}function xCe(e){if(`enum`in e&&Array.isArray(e.enum)&&e.enum.length===1)return e.enum[0];if(`const`in e)return e.const;throw Error(`schema cannot be inferred as a constant`)}function SCe(e,t){let n=new Map(e.map(e=>[String(e.value),e])),r=new Set(t.filter(e=>e!==`*`).map(String)),i=e.filter(e=>!r.has(String(e.value)));return t.flatMap(e=>{if(e===`*`)return i;let t=n.get(String(e));return t?[t]:[]})}function Bj(e,t){if(e.enum){let n,r;if(t){let{enumNames:e,enumOrder:i}=yD(t);n=e,r=i}let i=e.enum.map((e,t)=>({label:Array.isArray(n)?n[t]||String(e):n?.[String(e)]||String(e),value:e}));return r&&(i=SCe(i,r)),i}let n,r;e.anyOf?(n=e.anyOf,r=t?.anyOf):e.oneOf&&(n=e.oneOf,r=t?.oneOf);let i=uj(e);if(t){let{optionsSchemaSelector:e=i}=yD(t);i=e}return n&&n.map((e,t)=>{let{title:n}=yD(r?.[t]),a=e,o,s=n;if(i){let e=sk(a,[`properties`,i],{});o=sk(e,`default`,sk(e,`const`)),s=s||e?.title||a.title||String(o)}else o=xCe(a),s=s||a.title||String(o);return{schema:a,label:s,value:o}})}var CCe=[`string`,`number`,`integer`,`boolean`,`null`],Vj;(function(e){e[e.Ignore=0]=`Ignore`,e[e.Invert=1]=`Invert`,e[e.Fallback=2]=`Fallback`})(Vj||={});function Hj(e,t=Vj.Ignore,n=-1){if(n>=0){if(Array.isArray(e.items)&&n<e.items.length){let t=e.items[n];if(typeof t!=`boolean`)return t}}else if(e.items&&!Array.isArray(e.items)&&typeof e.items!=`boolean`)return e.items;return t!==Vj.Ignore&&QE(e.additionalItems)?e.additionalItems:{}}function Uj(e,t){let{default:n,type:r}=e;return Array.isArray(r)&&r.includes(`null`)&&aA(t)&&n===null?null:t}function Wj(e,t,n,r,i,a=[],o={},s=!1,c=!1){let{emptyObjectFields:l=`populateAllDefaults`}=o;if(r===!0||s)e[t]=n;else if(r===`excludeObjectChildren`)(c&&n!==void 0||!QE(n)||!aA(n))&&(e[t]=n);else if(l!==`skipDefaults`){let r=i===void 0?a.includes(t):i;QE(n)?l===`skipEmptyDefaults`?aA(n)||(e[t]=n):(!aA(n)||a.includes(t))&&(r||l!==`populateRequiredDefaults`)&&(e[t]=n):n!==void 0&&(l===`populateAllDefaults`||l===`skipEmptyDefaults`||r&&a.includes(t))&&(e[t]=n)}}function Gj(e,t,n={}){let{parentDefaults:r,rawFormData:i,rootSchema:a={},includeUndefinedValues:o=!1,_recurseList:s=[],experimental_defaultFormStateBehavior:c=void 0,experimental_customMergeAllOf:l=void 0,required:u,shouldMergeDefaultsIntoFormData:d=!1,initialDefaultsGenerated:f}=n,p=QE(i)?i:{},m=QE(t)?t:{},h=r,g=null,_=c,v=s;if(m.const!==void 0&&c?.constAsDefaults!==`never`&&!zj(m))h=m[rD];else if(QE(h)&&QE(m.default)&&!m.anyOf&&!m.oneOf&&!m.$ref)h=Fj(h,m.default);else if(`default`in m&&!m.anyOf&&!m.oneOf&&!m.$ref)h=m.default;else if(`$ref`in m){let e=m[fD];s.includes(e)||(v=s.concat(e),g=cj(e,a));let t=i===void 0||QE(i)&&aA(i);g&&!h&&t&&(h=m.default),d&&g&&!QE(i)&&(p=i)}else if(`dependencies`in m)g=Cj(e,m,a,!1,[],{...Kj(e,m,n,h),...p},l)[0];else if(Mj(m))h=m.items.map((t,n)=>Gj(e,t,{rootSchema:a,includeUndefinedValues:o,_recurseList:s,experimental_defaultFormStateBehavior:c,experimental_customMergeAllOf:l,parentDefaults:Array.isArray(r)?r[n]:void 0,rawFormData:p,required:u,shouldMergeDefaultsIntoFormData:d}));else if(`oneOf`in m){let{oneOf:t,...n}=m;if(t.length===0)return;let r=uj(m),{type:o=`null`}=n;!Array.isArray(o)&&CCe.includes(o)&&_?.constAsDefaults===`skipOneOf`&&(_={..._,constAsDefaults:`never`}),g=t[jj(e,a,i??m.default,t,0,r,l)],g=pj(n,g)}else if(`anyOf`in m){let{anyOf:t,...n}=m;if(t.length===0)return;let r=uj(m);g=t[jj(e,a,i??m.default,t,0,r,l)],g=pj(n,g)}if(g)return Gj(e,g,{rootSchema:a,includeUndefinedValues:o,_recurseList:v,experimental_defaultFormStateBehavior:_,experimental_customMergeAllOf:l,parentDefaults:h,rawFormData:i??p,required:u,shouldMergeDefaultsIntoFormData:d,initialDefaultsGenerated:f});h===void 0&&(h=m.default);let y=Kj(e,m,n,h)??h;if(d){let{arrayMinItems:t={}}=c||{},{mergeExtraDefaults:n}=t,r=wCe(e,m,a,i,c,l);(!QE(i)||`allOf`in m)&&(y=Pj(y,r,n,!0))}return y}function wCe(e,t,n,r,i,a){let o=!Ij(t)&&Lj(e,t,n,a),s=r;return o&&(s=Bj(t)?.some(e=>JO(e.value,r))?r:void 0),t.const&&i?.constAsDefaults===`always`&&(s=t.const),s}function TCe(e,t,{rawFormData:n,rootSchema:r={},includeUndefinedValues:i=!1,_recurseList:a=[],experimental_defaultFormStateBehavior:o=void 0,experimental_customMergeAllOf:s=void 0,required:c,shouldMergeDefaultsIntoFormData:l,initialDefaultsGenerated:u}={},d){{let f=QE(n)?n:{},p=t,m=o?.allOf===`populateDefaults`&&`allOf`in p||o?.emptyObjectFields!==`skipEmptyDefaults`&&`if`in p?_j(e,p,r,f,s):p,h=m[rD],g=Object.keys(m.properties||{}).reduce((t,n)=>{let p=sk(m,[lD,n],{}),g=QE(h)&&h[n]!==void 0,_=(QE(p)&&`const`in p||g)&&o?.constAsDefaults!==`never`&&!zj(p);return Wj(t,n,Gj(e,p,{rootSchema:r,_recurseList:a,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,includeUndefinedValues:i===!0,parentDefaults:sk(d,[n]),rawFormData:sk(f,[n]),required:m.required?.includes(n),shouldMergeDefaultsIntoFormData:l,initialDefaultsGenerated:u}),i,c,m.required,o,_,p?.type===`null`),t},{});if(m.additionalProperties&&!u){let t=QE(m.additionalProperties)?m.additionalProperties:{},n=new Set;QE(d)&&Object.keys(d).filter(e=>!m.properties||!m.properties[e]).forEach(e=>n.add(e));let p=[];Object.keys(f).filter(e=>!m.properties||!m.properties[e]).forEach(e=>{n.add(e),p.push(e)}),n.forEach(n=>{Wj(g,n,Gj(e,t,{rootSchema:r,_recurseList:a,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,includeUndefinedValues:i===!0,parentDefaults:sk(d,[n]),rawFormData:sk(f,[n]),required:m.required?.includes(n),shouldMergeDefaultsIntoFormData:l,initialDefaultsGenerated:u}),i,c,p)})}return Uj(t,g)}}function ECe(e,t,{rawFormData:n,rootSchema:r={},_recurseList:i=[],experimental_defaultFormStateBehavior:a=void 0,experimental_customMergeAllOf:o=void 0,required:s,requiredAsRoot:c=!1,shouldMergeDefaultsIntoFormData:l,initialDefaultsGenerated:u}={},d){let f=t,p=a?.arrayMinItems??{},{populate:m,mergeExtraDefaults:h}=p,g=m===`never`,_=m===`requiredOnly`,v=m===`all`||!g&&!_,y=p?.computeSkipPopulate??(()=>!1),b=a?.emptyObjectFields===`skipEmptyDefaults`?void 0:[];if(Array.isArray(d)&&(d=d.map((t,c)=>Gj(e,Hj(f,Vj.Fallback,c),{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:a,experimental_customMergeAllOf:o,parentDefaults:t,rawFormData:Array.isArray(n)?n[c]:void 0,required:s,shouldMergeDefaultsIntoFormData:l,initialDefaultsGenerated:u}))),Array.isArray(n)){let t=Hj(f);if(g)d=n;else{let c=n.map((n,c)=>Gj(e,t,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:a,experimental_customMergeAllOf:o,rawFormData:n,parentDefaults:sk(d,[c]),required:s,shouldMergeDefaultsIntoFormData:l,initialDefaultsGenerated:u}));d=Pj(d,c,(_&&s||v)&&h)}}if((QE(f)&&`const`in f&&a?.constAsDefaults!==`never`)===!1){if(g)return d??b;if(_&&!s)return d||void 0}let x,S=Array.isArray(d)?d.length:0;if(!f.minItems||Rj(e,f,r,o)||y(e,f,r)||f.minItems<=S)x=d||!s&&!c?d:b;else{let t=d||[],n=Hj(f,Vj.Invert),c=n.default,u=Array.from({length:f.minItems-S},()=>Gj(e,n,{parentDefaults:c,rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:a,experimental_customMergeAllOf:o,required:s,shouldMergeDefaultsIntoFormData:l}));x=t.concat(u)}return Uj(t,x)}function Kj(e,t,n={},r){switch(fj(t)){case`object`:return TCe(e,t,n,r);case`array`:return ECe(e,t,n,r)}}function qj(e,t,n,r,i=!1,a,o,s){if(!QE(t))throw Error(`Invalid schema: `+t);let c=_j(e,t,r,n,o),l=Gj(e,c,{rootSchema:r,includeUndefinedValues:i,experimental_defaultFormStateBehavior:a,experimental_customMergeAllOf:o,rawFormData:n,shouldMergeDefaultsIntoFormData:!0,initialDefaultsGenerated:s,requiredAsRoot:!0});if(c.type!==`object`&&QE(c.default))return{...l,...n};if(QE(n)||Array.isArray(n)){let{mergeDefaultsIntoFormData:e}=a||{};return Pj(l,n,!0,e===`useDefaultIfFormDataUndefined`,!0)}return l}function Jj(e={}){return`widget`in yD(e)&&yD(e).widget!==`hidden`}function Yj(e,t,n={},r,i){if(n[`ui:widget`]===`files`)return!0;if(t.items){let n=_j(e,t.items,r,void 0,i);return n.type===`string`&&n.format===`data-url`}return!1}function DCe(e,t,n={},r,i,a){let{label:o=!0}=yD(n,i),s=!!o;if(s){let i=fj(t),o=sk(t,eD,!1);i===`array`&&(s=o||Rj(e,t,r,a)||Yj(e,t,n,r,a)||Jj(n)),i===`object`&&(s=o),i===`boolean`&&n&&!n[`ui:widget`]&&(s=!1),n&&n[`ui:field`]&&(s=!1)}return s}function Xj(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ok(e,o);n(s,o)&&mk(a,ik(o,e),s)}return a}function OCe(e,t){return Xj(e,t,function(t,n){return Ak(e,n)})}var Zj=$A(function(e,t){return e==null?{}:OCe(e,t)});function Qj(e,t,n,r,i,a=[],o){if(`$ref`in t||`dependencies`in t||`allOf`in t||`if`in t){let s=_j(e,t,r,i,o);if(a.findIndex(e=>JO(e,s))===-1)return Qj(e,s,n,r,i,a.concat(s),o)}let s={[sD]:n.replace(/^\./,``)};if(`oneOf`in t||`anyOf`in t){let c=`oneOf`in t?t.oneOf:t.anyOf,l=c[jj(e,r,i,c,0,uj(t),o)];s={...s,...Qj(e,l,n,r,i,a,o)}}if(`additionalProperties`in t&&t.additionalProperties!==!1){hk(s,hD,!0);let c=LD(t.additionalProperties)?t[I_e]:{},l=sk(t,lD,{});for(let t of Object.keys(i??{}))t in l||(s[t]=Qj(e,c,`${n}.${t}`,r,sk(i,[t]),a,o))}if(`items`in t&&Array.isArray(i)){let{items:c,additionalItems:l}=t;Array.isArray(c)?i.forEach((t,i)=>{c[i]?s[i]=Qj(e,c[i],`${n}.${i}`,r,t,a,o):l?s[i]=Qj(e,l,`${n}.${i}`,r,t,a,o):console.warn(`Unable to generate path schema for "${n}.${i}". No schema defined for it`)}):i.forEach((t,i)=>{s[i]=Qj(e,c,`${n}.${i}`,r,t,a,o)})}else if(`properties`in t)for(let c in t.properties){let l=sk(t,[lD,c],{});s[c]=Qj(e,l,`${n}.${c}`,r,sk(i,[c]),a,o)}return s}function $j(e,t,n=``,r,i,a){return Qj(e,t,n,r,i,void 0,a)}function eM(e,t){if(t.length===0&&typeof e!=`object`)return e;let n=Zj(e,t);return Array.isArray(e)?Object.keys(n).map(e=>n[e]):n}function tM(e,t){let n=(e,t)=>typeof e!=`object`||aA(e)||t&&!aA(e),r=(e,i=[],a=[[]])=>{let o=Object.keys(e);return o.forEach(s=>{let c=e[s];if(typeof c==`object`){let e=a.map(e=>[...e,s]);c.__rjsf_additionalProperties&&c.$name!==``?i.push(c[sD]):r(c,i,e)}else s===`$name`&&c!==``&&a.forEach(e=>{let r=sk(t,e),a=o.length===1;(n(r,a)||Array.isArray(r)&&r.every(e=>n(e,a)))&&i.push(e)})}),i};return r(e)}function kCe(e,t,n={},r){return eM(r,tM($j(e,_j(e,t,n,r),``,n,r),r).map(e=>Array.isArray(e)?e.join(`.`):e))}var nM=Symbol(`no Value`);function rM(e,t,n,r,i={},a){let o;if(lk(n,`properties`)){let s={};if(lk(r,`properties`)){let e=sk(r,lD,{});Object.keys(e).forEach(e=>{lk(i,e)&&(s[e]=void 0)})}let c=Object.keys(sk(n,lD,{})),l={};c.forEach(o=>{let c=sk(i,o),u=sk(r,[lD,o],{}),d=sk(n,[lD,o],{});lk(u,`$ref`)&&(u=_j(e,u,t,c,a)),lk(d,`$ref`)&&(d=_j(e,d,t,c,a));let f=sk(u,`type`),p=sk(d,`type`);if(!f||f===p)if(lk(s,o)&&delete s[o],p===`object`||p===`array`&&Array.isArray(c)){let n=rM(e,t,d,u,c,a);(n!==void 0||p===`array`)&&(l[o]=n)}else{let e=sk(d,`default`,nM),t=sk(u,`default`,nM);e!==nM&&e!==c&&(t===c?s[o]=e:sk(d,`readOnly`)===!0&&(s[o]=void 0));let n=sk(d,`const`,nM),r=sk(u,`const`,nM);n!==nM&&n!==c&&(s[o]=r===c?n:void 0)}}),o={...typeof i==`string`||Array.isArray(i)?void 0:i,...s,...l}}else if(sk(r,`type`)===`array`&&sk(n,`type`)===`array`&&Array.isArray(i)){let s=sk(r,`items`),c=sk(n,`items`);if(typeof s==`object`&&typeof c==`object`&&!Array.isArray(s)&&!Array.isArray(c)){lk(s,`$ref`)&&(s=_j(e,s,t,i,a)),lk(c,`$ref`)&&(c=_j(e,c,t,i,a));let r=sk(s,`type`),l=sk(c,`type`);if(!r||r===l){let r=sk(n,`maxItems`,-1);o=l===`object`?i.reduce((n,i)=>{let o=rM(e,t,c,s,i,a);return o!==void 0&&(r<0||n.length<r)&&n.push(o),n},[]):r>0&&i.length>r?i.slice(0,r):i}}else typeof s==`boolean`&&typeof c==`boolean`&&s===c&&(o=i)}return o}var ACe=class{constructor(e,t,n,r){t&&t.$schema===`https://json-schema.org/draft/2020-12/schema`?this.rootSchema=aj(t,sk(t,`$id`,`#`)):this.rootSchema=t,this.validator=e,this.experimental_defaultFormStateBehavior=n,this.experimental_customMergeAllOf=r}getRootSchema(){return this.rootSchema}getValidator(){return this.validator}doesSchemaUtilsDiffer(e,t,n={},r){return!e||!t?!1:this.validator!==e||!JO(this.rootSchema,t)||!JO(this.experimental_defaultFormStateBehavior,n)||this.experimental_customMergeAllOf!==r}findFieldInSchema(e,t,n){return hCe(this.validator,this.rootSchema,e,t,n,this.experimental_customMergeAllOf)}findSelectedOptionInXxxOf(e,t,n,r){return Tj(this.validator,this.rootSchema,e,t,n,r,this.experimental_customMergeAllOf)}getDefaultFormState(e,t,n=!1,r){return qj(this.validator,e,t,this.rootSchema,n,this.experimental_defaultFormStateBehavior,this.experimental_customMergeAllOf,r)}getDisplayLabel(e,t,n){return DCe(this.validator,e,t,this.rootSchema,n,this.experimental_customMergeAllOf)}getClosestMatchingOption(e,t,n,r){return jj(this.validator,this.rootSchema,e,t,n,r,this.experimental_customMergeAllOf)}getFirstMatchingOption(e,t,n){return gj(this.validator,e,t,this.rootSchema,n)}getFromSchema(e,t,n){return Dj(this.validator,this.rootSchema,e,t,n,this.experimental_customMergeAllOf)}isFilesArray(e,t){return Yj(this.validator,e,t,this.rootSchema,this.experimental_customMergeAllOf)}isMultiSelect(e){return Rj(this.validator,e,this.rootSchema,this.experimental_customMergeAllOf)}isSelect(e){return Lj(this.validator,e,this.rootSchema,this.experimental_customMergeAllOf)}omitExtraData(e,t){return kCe(this.validator,e,this.rootSchema,t)}retrieveSchema(e,t,n){return _j(this.validator,e,this.rootSchema,t,this.experimental_customMergeAllOf,n)}sanitizeDataForNewSchema(e,t,n){return rM(this.validator,this.rootSchema,e,t,n,this.experimental_customMergeAllOf)}toPathSchema(e,t,n){return $j(this.validator,e,t,this.rootSchema,n,this.experimental_customMergeAllOf)}};function jCe(e,t,n={},r){return new ACe(e,t,n,r)}function MCe(e){if(e.indexOf(`data:`)===-1)throw Error(`File is invalid: URI must be a dataURI`);let t=e.slice(5).split(`;base64,`);if(t.length!==2)throw Error(`File is invalid: dataURI must be base64`);let[n,r]=t,[i,...a]=n.split(`;`),o=i||``,s=decodeURI(a.map(e=>e.split(`=`)).find(([e])=>e===`name`)?.[1]||`unknown`);try{let e=atob(r),t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return{blob:new window.Blob([new Uint8Array(t)],{type:o}),name:s}}catch(e){throw Error(`File is invalid: `+e.message)}}function iM(e,t){let n=String(e);for(;n.length<t;)n=`0`+n;return n}function aM(e,t){if(e<=0&&t<=0)e=new Date().getFullYear()+e,t=new Date().getFullYear()+t;else if(e<0||t<0)throw Error(`Both start (${e}) and stop (${t}) must both be <= 0 or > 0, got one of each`);if(e>t)return aM(t,e).reverse();let n=[];for(let r=e;r<=t;r++)n.push({value:r,label:iM(r,2)});return n}function oM(e,t){if(Object.is(e,t))return!0;if(e==null||t==null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++){let i=n[r];if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1}return!0}function NCe(e,t){let n=e;if(Array.isArray(t)){let e=n.split(/(%\d)/);t.forEach((t,n)=>{let r=e.findIndex(e=>e===`%${n+1}`);r>=0&&(e[r]=t)}),n=e.join(``)}return n}function PCe(e,t){return NCe(e,t)}function sM(e,t){return Array.isArray(t)?t.some(t=>JO(t,e)):JO(t,e)}function FCe(e,t=[],n=!1){let r=t.map((t,n)=>sM(t.value,e)?String(n):void 0).filter(e=>e!==void 0);return n?r:r[0]}function cM(e,t,n,r=`indexed`,i){if(e===void 0||n&&Array.isArray(e)&&e.length<1||!n&&e===i)return i;if(r===`realValue`)return n?e.map(String):String(e);let a=FCe(e,t,n);return a===void 0?i:a}function lM(e,t=[],n){if(Array.isArray(e))return e.map(e=>lM(e,t)).filter(e=>e!==n);let r=t[e===``||e===null?-1:Number(e)];return r?r.value:n}function uM(e,t,n){if(e===``||!Array.isArray(t))return n;let r=t.find(t=>String(t.value)===e);if(r)return r.value;let i=Number(e);return!isNaN(i)&&i>=0&&i<t.length?t[i].value:n}function dM(e,t,n=`indexed`,r){return n===`realValue`?Array.isArray(e)?e.map(e=>uM(e,t,r)):uM(e,t,r):lM(e,t,r)}function fM(e,t,n=`indexed`){return n===`realValue`?Nj(e)?``:String(typeof e==`object`?t:e):String(t)}function pM(e,t,n=[]){let r=lM(e,n);return Array.isArray(t)?t.filter(e=>!JO(e,r)):JO(r,t)?void 0:t}function mM(e,t,n=[]){let r=lM(e,n);if(!Nj(r)){let e=n.findIndex(e=>r===e.value),i=n.map(({value:e})=>e);return t.slice(0,e).concat(r,t.slice(e)).sort((e,t)=>Number(i.indexOf(e)>i.indexOf(t)))}return t}var ICe=1,LCe=4;function hM(e){return YA(e,ICe|LCe)}function RCe(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:mk(e,t,n,r)}var gM=class{constructor(e){this.errorSchema={},this.resetAllErrors(e)}get ErrorSchema(){return this.errorSchema}getOrCreateErrorBlock(e){let t=Array.isArray(e)&&e.length>0||typeof e==`string`?sk(this.errorSchema,e):this.errorSchema;return!t&&e&&(t={},RCe(this.errorSchema,e,t,Object)),t}resetAllErrors(e){return this.errorSchema=e?hM(e):{},this}addErrors(e,t){let n=this.getOrCreateErrorBlock(t),r=sk(n,aD);return Array.isArray(r)||(r=[],n[aD]=r),Array.isArray(e)?hk(n,aD,[...new Set([...r,...e])]):hk(n,aD,[...new Set([...r,e])]),this}setErrors(e,t){return hk(this.getOrCreateErrorBlock(t),aD,Array.isArray(e)?[...new Set([...e])]:[e]),this}clearErrors(e){return hk(this.getOrCreateErrorBlock(e),aD,[]),this}};function zCe(e,t){if(e==null)return{};var n=$O(BA(e),function(e){return[e]});return t=jk(t),Xj(e,n,function(e,n){return t(e,n[0])})}var BCe=200;function VCe(e,t,n,r){var i=-1,a=eA,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=$O(t,yO(n))),r?(a=tA,o=!1):t.length>=BCe&&(a=XD,o=!1,t=new YD(t));outer:for(;++i<s;){var u=e[i],d=n==null?u:n(u);if(u=r||u!==0?u:0,o&&d===d){for(var f=l;f--;)if(t[f]===d)continue outer;c.push(u)}else a(t,d,r)||c.push(u)}return c}var HCe=Xk(function(e,t){return Hk(e)?VCe(e,Qk(t,1,Hk,!0)):[]});function _M(e,t){let n=MD(e),r=MD(t);if(e===t||!n&&!r)return[];if(n&&!r)return AO(e);if(!n&&r)return AO(t);{let n=AO(zCe(e,(e,n)=>!JO(e,sk(t,n)))),r=HCe(AO(t),AO(e));return[...n,...r]}}function UCe(e,t,n=[1900,new Date().getFullYear()+2],r=`YMD`){let{day:i,month:a,year:o,hour:s,minute:c,second:l}=e,u={type:`day`,range:[1,31],value:i},d={type:`month`,range:[1,12],value:a},f={type:`year`,range:n,value:o},p=[];switch(r){case`MDY`:p.push(d,u,f);break;case`DMY`:p.push(u,d,f);break;default:p.push(f,d,u)}return t&&p.push({type:`hour`,range:[0,23],value:s},{type:`minute`,range:[0,59],value:c},{type:`second`,range:[0,59],value:l}),p}function vM(e){let t={};return e.multipleOf&&(t.step=e.multipleOf),(e.minimum||e.minimum===0)&&(t.min=e.minimum),(e.maximum||e.maximum===0)&&(t.max=e.maximum),t}function yM(e,t,n={},r=!0){let i={type:t||`text`,...vM(e)};return n.inputType?i.type=n.inputType:t||(e.type===`number`?(i.type=`number`,r&&i.step===void 0&&(i.step=`any`)):e.type===`integer`&&(i.type=`number`,i.step===void 0&&(i.step=1))),[`date`,`datetime-local`,`time`,`week`,`month`].includes(i.type)&&(e.formatMinimum!==void 0&&(i.min=e.formatMinimum),e.formatMaximum!==void 0&&(i.max=e.formatMaximum)),n.autocomplete&&(i.autoComplete=n.autocomplete),n.accept&&(i.accept=n.accept),i}function bM(e){return e?.optionValueFormat??`indexed`}var xM={props:{disabled:!1},submitText:`Submit`,norender:!1};function SM(e={}){let t=yD(e);if(t&&t.submitButtonOptions){let e=t[dD];return{...xM,...e}}return xM}function CM(e,t,n={}){let{templates:r}=t;return e===`ButtonTemplates`?r[e]:Object.hasOwn(n,e)&&typeof n[e]==`string`&&Object.hasOwn(r,n[e])?r[n[e]]:n[e]||r[e]}var WCe=0;function wM(e){var t=++WCe;return rk(e)+t}function TM(){if(typeof process>`u`||sk(process,`env.NODE_ENV`)!==`test`)return{};let e=new Map;return new Proxy({},{get(t,n){return e.has(n)||e.set(n,wM(`test-id-`)),e.get(n)}})}var GCe=s((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isForwardRef=function(e){return m(e)===l},e.isMemo=function(e){return m(e)===f}})),EM=u(s(((e,t)=>{t.exports=GCe()}))(),1),DM={boolean:{checkbox:`CheckboxWidget`,radio:`RadioWidget`,select:`SelectWidget`,hidden:`HiddenWidget`},string:{text:`TextWidget`,password:`PasswordWidget`,email:`EmailWidget`,hostname:`TextWidget`,ipv4:`TextWidget`,ipv6:`TextWidget`,uri:`URLWidget`,"data-url":`FileWidget`,radio:`RadioWidget`,select:`SelectWidget`,textarea:`TextareaWidget`,hidden:`HiddenWidget`,date:`DateWidget`,datetime:`DateTimeWidget`,"date-time":`DateTimeWidget`,"alt-date":`AltDateWidget`,"alt-datetime":`AltDateTimeWidget`,time:`TimeWidget`,color:`ColorWidget`,file:`FileWidget`},number:{text:`TextWidget`,select:`SelectWidget`,updown:`UpDownWidget`,range:`RangeWidget`,radio:`RadioWidget`,hidden:`HiddenWidget`},integer:{text:`TextWidget`,select:`SelectWidget`,updown:`UpDownWidget`,range:`RangeWidget`,radio:`RadioWidget`,hidden:`HiddenWidget`},array:{select:`SelectWidget`,checkboxes:`CheckboxesWidget`,files:`FileWidget`,hidden:`HiddenWidget`}};function KCe(e){let t=sk(e,`MergedWidget`);if(!t){let n=e.defaultProps&&e.defaultProps.options||{};t=({options:t,...r})=>(0,G.jsx)(e,{options:{...n,...t},...r}),hk(e,`MergedWidget`,t)}return t}function OM(e,t,n={}){let r=fj(e);if(typeof t==`function`||t&&EM.isForwardRef((0,C.createElement)(t))||EM.isMemo(t))return KCe(t);if(typeof t!=`string`)throw Error(`Unsupported widget definition: ${typeof t} in schema: ${JSON.stringify(e)}`);if(t in n){let r=n[t];return OM(e,r,n)}if(typeof r==`string`){if(!(r in DM))throw Error(`No widget for type '${r}' in schema: ${JSON.stringify(e)}`);if(t in DM[r]){let i=n[DM[r][t]];return OM(e,i,n)}}throw Error(`No widget '${t}' for type '${r}' in schema: ${JSON.stringify(e)}`)}function qCe(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return t.toString(16)}function JCe(e){let t=new Set;return JSON.stringify(e,(e,n)=>(t.add(e),n)),JSON.stringify(e,Array.from(t).sort())}function kM(e){return qCe(JCe(e))}function YCe(e){return kM(e)}function XCe(e,t,n={}){try{return OM(e,t,n),!0}catch(e){let t=e;if(t.message&&(t.message.startsWith(`No widget`)||t.message.startsWith(`Unsupported widget`)))return!1;throw e}}function AM(e,t){return`${lj(e)?e:e.$id}__${t}`}function jM(e){return AM(e,`description`)}function MM(e){return AM(e,`error`)}function NM(e){return AM(e,`examples`)}function PM(e){return AM(e,`help`)}function FM(e){return AM(e,`title`)}function IM(e,t=!1){let n=t?` ${NM(e)}`:``;return`${MM(e)} ${jM(e)} ${PM(e)}${n}`}function LM(e,t){return`${e}-${t}`}function RM(e,t){return AM(e,t)}function zM(e,t){return AM(e,`optional${t}`)}function BM(e){return!Nj(e)&&(!LD(e)||Array.isArray(e)||!aA(e))}function ZCe(e,t){let{rootSchema:n,schemaUtils:r}=e;return uk(t,n)?!0:`$ref`in n?uk(t,ej(r.retrieveSchema(n),pD)):!1}function VM(e,t,n){return t?n:e}function QCe(e){return e?new Date(e).toJSON():void 0}function HM(e,t,n){let r=[V_e];return lk(e,`formContext`)&&r.unshift(B_e),sk(e,[...r,t],n)}function UM(e){if(Nj(e)||e===``)return!0;if(Array.isArray(e))return e.length===0;if(QE(e)){let t=e;return Object.keys(t).every(e=>UM(t[e]))}return!1}function WM(e,t,n,r){if(!QE(t))return r;let i=_j(e,t,n,r);if(Array.isArray(r)){let t=i.items;if(!t)return r;let a=!1,o=r.map((r,o)=>{let s=t;Array.isArray(t)&&(s=t[o]||i.additionalItems||{});let c=WM(e,s,n,r);return c!==r&&(a=!0),c===void 0?{}:c});return a?o:r}let{properties:a,required:o=[]}=i;if(!QE(r)||!a)return r;let s={},c=r,l=!1;for(let t of Object.keys(c)){let r=c[t],i=a[t]||{},u=o.includes(t);if((QE(r)||Array.isArray(r))&&a[t]){let a=WM(e,i,n,r);if(!u&&UM(a))continue;s[t]=a,l=!0}else if(!u&&UM(r)&&a[t])continue;else s[t]=r,UM(r)||(l=!0)}if(!(!l&&Object.keys(s).length===0))return s}function $Ce(e,t){if(!Array.isArray(t))return e;let n=e=>e.reduce((e,t)=>(e[t]=!0,e),{}),r=e=>e.length>1?`properties '${e.join(`', '`)}'`:`property '${e[0]}'`,i=n(e),a=t.filter(e=>e===`*`||i[e]),o=n(a),s=e.filter(e=>!o[e]),c=a.indexOf(`*`);if(c===-1){if(s.length)throw Error(`uiSchema order list does not contain ${r(s)}`);return a}if(c!==a.lastIndexOf(`*`))throw Error(`uiSchema order list contains more than one wildcard item`);let l=[...a];return l.splice(c,1,...s),l}function GM(e,t=!0){if(!e)return{year:-1,month:-1,day:-1,hour:t?-1:0,minute:t?-1:0,second:t?-1:0};let n=new Date(e);if(Number.isNaN(n.getTime()))throw Error(`Unable to parse date `+e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:t?n.getUTCHours():0,minute:t?n.getUTCMinutes():0,second:t?n.getUTCSeconds():0}}function ewe(e,t,n){let r=e.__rjsf_ref??e[fD],i=n.uiSchemaDefinitions,a=r&&i?i[r]:void 0,o;if(o=a?!t||aA(t)?{...a}:Fj(a,t):t||{},i){let t=e;if(r&&e.$ref&&!e.__rjsf_ref)try{t=cj(r,n.rootSchema)}catch(e){return console.warn(`could not resolve $ref in resolveUiSchema:
|
|
220
220
|
`,e),o}for(let e of[cD,nD]){let n=t[e];if(!Array.isArray(n)||n.length===0)continue;let r=o[e],a=Array.isArray(r)?[...r]:[],s=!1;for(let e=0;e<n.length;e++){let t=n[e],r=t?.__rjsf_ref??t?.[fD];if(r&&r in i){let t=a[e]||{};a[e]=Fj(i[r],t),s=!0}}s&&(o[e]=a)}}return o}function KM(e){return e.const||e.enum&&e.enum.length===1&&e.enum[0]===!0?!0:e.anyOf&&e.anyOf.length===1?KM(e.anyOf[0]):e.oneOf&&e.oneOf.length===1?KM(e.oneOf[0]):e.allOf?e.allOf.some(e=>KM(e)):!1}function qM(e,t,n,r=`customDeep`){if(r===`always`)return!0;if(r===`shallow`){let{props:r,state:i}=e;return!oM(r,t)||!oM(i,n)}let{props:i,state:a}=e;return!JO(i,t)||!JO(a,n)}function JM(e){let t=iA(e.map(e=>LD(e)?fj(e):void 0).flat().filter(e=>e!==void 0));return t.length===1?t[0]:t}function YM(e,t,n,r){let{enableOptionalDataFieldForType:i=[]}=yD(r,e.globalUiOptions),a;return a=`anyOf`in t&&Array.isArray(t.anyOf)?JM(t[nD]):`oneOf`in t&&Array.isArray(t.oneOf)?JM(t[cD]):fj(t),!ZCe(e,t)&&!n&&!!a&&!Array.isArray(a)&&!!i.find(e=>e===a)}function XM(e,t=!0){let{year:n,month:r,day:i,hour:a=0,minute:o=0,second:s=0}=e,c=Date.UTC(n,r-1,i,a,o,s),l=new Date(c).toJSON();return t?l:l.slice(0,10)}function ZM(e,t=[]){if(!e)return[];let n=[];return`__errors`in e&&(n=n.concat(e[aD].map(e=>{let n=`.${t.join(`.`)}`;return{property:n,message:e,stack:`${n} ${e}`}}))),Object.keys(e).reduce((n,r)=>{if(r!==`__errors`){let i=e[r];MD(i)&&(n=n.concat(ZM(i,[...t,r])))}return n},n)}function QM(e){return rO(e)?$O(e,ak):YO(e)?[e]:Bk(QO(rk(e)))}function twe(e){let t=new gM;return e.length&&e.forEach(e=>{let{property:n,message:r}=e,i=n===`.`?[]:QM(n);i.length>0&&i[0]===``&&i.splice(0,1),r&&t.addErrors(r,i)}),t.ErrorSchema}function $M(e,t,n,r){let i=Array.isArray(n)?n:n?.path,a=e===``?[]:[e],o=i?i.concat(...a):a,s=[t.idPrefix,...o].join(t.idSeparator),c;return t.nameGenerator&&o.length>0&&(c=t.nameGenerator(o,t.idPrefix,r)),{path:o,$id:s,...c!==void 0&&{name:c}}}function eN(e){return Object.keys(e).reduce((t,n)=>{if(n===`addError`)return t;{let r=e[n];return MD(r)?{...t,[n]:eN(r)}:{...t,[n]:r}}},{})}function nwe(e){return Object.values(e).every(e=>e!==-1)}function rwe(e){let{className:t=`form-control`,type:n,range:r,value:i,select:a,rootId:o,name:s,disabled:c,readonly:l,autofocus:u,registry:d,onBlur:f,onFocus:p}=e,m=`${o}_${n}`,{SelectWidget:h}=d.widgets,g=(0,C.useCallback)(e=>a(n,e),[a,n]);return(0,G.jsx)(h,{schema:{type:`integer`},id:m,name:s,className:t,options:{enumOptions:aM(r[0],r[1])},placeholder:n,value:i,disabled:c,readonly:l,autofocus:u,onChange:g,onBlur:f,onFocus:p,registry:d,label:``,"aria-describedby":IM(o)})}function iwe(e){let{time:t=!1,disabled:n=!1,readonly:r=!1,options:i,onChange:a,value:o}=e,[s,c]=(0,C.useState)(GM(o,t));(0,C.useEffect)(()=>{c(GM(o,t))},[t,o]);let l=(0,C.useCallback)((e,n)=>{let r={...s,[e]:n===void 0?-1:n};nwe(r)?a(XM(r,t)):c(r)},[s,a,t]),u=(0,C.useCallback)(e=>{e.preventDefault(),!(n||r)&&a(void 0)},[n,r,a]),d=(0,C.useCallback)(e=>{e.preventDefault(),!(n||r)&&a(XM(GM(new Date().toJSON(),t),t))},[n,r,t,a]);return{elements:(0,C.useMemo)(()=>UCe(s,t,i.yearsRange,i.format),[s,t,i.yearsRange,i.format]),handleChange:l,handleClear:u,handleSetNow:d}}function tN(e){let t=(0,C.useRef)(e);return uk(e,t.current)||(t.current=e),t.current}function awe(e,t){return e.replace(`;base64`,`;name=${encodeURIComponent(t)};base64`)}function owe(e){let{name:t,size:n,type:r}=e;return new Promise((i,a)=>{let o=new window.FileReader;o.onerror=a,o.onload=e=>{typeof e.target?.result==`string`?i({dataURL:awe(e.target.result,t),name:t,size:n,type:r}):i({dataURL:null,name:t,size:n,type:r})},o.readAsDataURL(e)})}function swe(e){return Promise.all(Array.from(e).map(owe))}function cwe(e){return e.reduce((e,t)=>{if(!t)return e;try{let{blob:n,name:r}=MCe(t);return[...e,{dataURL:t,name:r,size:n.size,type:n.type}]}catch{return e}},[])}function lwe(e,t,n=!1){let r=(0,C.useMemo)(()=>n&&e?Array.isArray(e)?e:[e]:[],[e,n]);return{filesInfo:(0,C.useMemo)(()=>cwe(Array.isArray(e)?e:[e||``]),[e]),handleChange:(0,C.useCallback)(e=>{swe(e).then(e=>{let i=e.map(e=>e.dataURL||null);t(n?r.concat(...i):i[0])})},[r,n,t]),handleRemove:(0,C.useCallback)(e=>{t(n?r.filter((t,n)=>n!==e):void 0)},[r,n,t])}}function uwe(e){if(!e)return``;let t=new Date(e);return`${iM(t.getFullYear(),4)}-${iM(t.getMonth()+1,2)}-${iM(t.getDate(),2)}T${iM(t.getHours(),2)}:${iM(t.getMinutes(),2)}:${iM(t.getSeconds(),2)}.${iM(t.getMilliseconds(),3)}`}function nN(e,t,n=!1){if(!t)return e;let{errors:r,errorSchema:i}=e,a=ZM(t),o=t;return aA(i)||(o=Fj(i,t,n?`preventDuplicates`:!0),a=[...r].concat(a)),{errorSchema:o,errors:a}}function dwe(e){for(let t in e){let n=e,r=n[t];t===`$ref`&&typeof r==`string`&&r.startsWith(`#`)?n[t]=gD+r:n[t]=rN(r)}return e}function fwe(e){for(let t=0;t<e.length;t++)e[t]=rN(e[t]);return e}function rN(e){return Array.isArray(e)?fwe([...e]):LD(e)?dwe({...e}):e}var iN;(function(e){e.ArrayItemTitle=`Item`,e.MissingItems=`Missing items definition`,e.EmptyArray=`No items yet. Use the button below to add some.`,e.YesLabel=`Yes`,e.NoLabel=`No`,e.CloseLabel=`Close`,e.ErrorsLabel=`Errors`,e.NewStringDefault=`New Value`,e.AddButton=`Add`,e.AddItemButton=`Add Item`,e.CopyButton=`Copy`,e.MoveDownButton=`Move down`,e.MoveUpButton=`Move up`,e.RemoveButton=`Remove`,e.NowLabel=`Now`,e.ClearLabel=`Clear`,e.AriaDateLabel=`Select a date`,e.PreviewLabel=`Preview`,e.DecrementAriaLabel=`Decrease value by 1`,e.IncrementAriaLabel=`Increase value by 1`,e.OptionalObjectAdd=`Add data for optional field`,e.OptionalObjectRemove=`Remove data for optional field`,e.OptionalObjectEmptyMsg=`No data for optional field`,e.Type=`Type`,e.Value=`Value`,e.ClearButton=`clear input`,e.UnknownFieldType=`Unknown field type %1`,e.OptionPrefix=`Option %1`,e.TitleOptionPrefix=`%1 option %2`,e.KeyLabel=`%1 Key`,e.InvalidObjectField=`Invalid "%1" object field configuration: _%2_.`,e.UnsupportedField=`Unsupported field schema.`,e.UnsupportedFieldWithId="Unsupported field schema for field `%1`.",e.UnsupportedFieldWithReason=`Unsupported field schema: _%1_.`,e.UnsupportedFieldWithIdAndReason="Unsupported field schema for field `%1`: _%2_.",e.FilesInfo=`**%1** (%2, %3 bytes)`})(iN||={});function pwe(e,t){return(rO(e)?Ck:kj)(e,_k(t))}function mwe(e,t){return e==null?!0:ZA(e,t)}function aN(){return wM(`rjsf-array-item-`)}function oN(e){return Array.isArray(e)?e.map(e=>({key:aN(),item:e})):[]}function sN(e){return Array.isArray(e)?e.map(e=>e.item):[]}function hwe(e){return Array.isArray(e.type)?!e.type.includes(`null`):e.type!==`null`}function cN(e,t,n,r){let{addable:i}=yD(r,e.globalUiOptions);return i!==!1&&(i=t.maxItems===void 0?!0:n.length<t.maxItems),i}function lN(e,t,n,r){if(typeof e.items==`function`)try{return e.items(t,n,r)}catch(e){console.error(`Error executing dynamic uiSchema.items function for item at index ${n}:`,e);return}else return e.items}function gwe(e,t){let{schemaUtils:n,globalFormOptions:r}=e,i=t.items;return r.useFallbackUiForUnsupportedType&&!i?i={}:Mj(t)&&F_e(t)&&(i=t.additionalItems),n.getDefaultFormState(i)}function _we(e){let{schema:t,fieldPathId:n,uiSchema:r,formData:i=[],disabled:a=!1,readonly:o=!1,autofocus:s=!1,required:c=!1,placeholder:l,onBlur:u,onFocus:d,registry:f,rawErrors:p,name:m,onSelectChange:h}=e,{widgets:g,schemaUtils:_,globalFormOptions:v,globalUiOptions:y}=f,b=Bj(_.retrieveSchema(t.items,i),r?.items??r),{widget:x=`select`,title:S,...C}=yD(r,y),w=OM(t,x,g),T=S??t.title??m,E=_.getDisplayLabel(t,r,y),D=tN($M(``,v,n,!0));return(0,G.jsx)(w,{id:D.$id,name:m,multiple:!0,onChange:h,onBlur:u,onFocus:d,options:{...C,enumOptions:b},schema:t,uiSchema:r,registry:f,value:i,disabled:a,readonly:o,required:c,label:T,hideLabel:!E,placeholder:l,autofocus:s,rawErrors:p,htmlName:D.name})}function vwe(e){let{schema:t,fieldPathId:n,uiSchema:r,disabled:i=!1,readonly:a=!1,autofocus:o=!1,required:s=!1,hideError:c,placeholder:l,onBlur:u,onFocus:d,formData:f=[],registry:p,rawErrors:m,name:h,onSelectChange:g}=e,{widgets:_,schemaUtils:v,globalFormOptions:y,globalUiOptions:b}=p,{widget:x,title:S,...C}=yD(r,b),w=OM(t,x,_),T=S??t.title??h,E=v.getDisplayLabel(t,r,b),D=tN($M(``,y,n,!0));return(0,G.jsx)(w,{id:D.$id,name:h,multiple:!0,onChange:g,onBlur:u,onFocus:d,options:C,schema:t,uiSchema:r,registry:p,value:f,disabled:i,readonly:a,hideError:c,required:s,label:T,hideLabel:!E,placeholder:l,autofocus:o,rawErrors:m,htmlName:D.name})}function ywe(e){let{schema:t,uiSchema:n,fieldPathId:r,name:i,disabled:a=!1,readonly:o=!1,autofocus:s=!1,required:c=!1,onBlur:l,onFocus:u,registry:d,formData:f=[],rawErrors:p,onSelectChange:m}=e,{widgets:h,schemaUtils:g,globalFormOptions:_,globalUiOptions:v}=d,{widget:y=`files`,title:b,...x}=yD(n,v),S=OM(t,y,h),C=b??t.title??i,w=g.getDisplayLabel(t,n,v),T=tN($M(``,_,r,!0));return(0,G.jsx)(S,{options:x,id:T.$id,name:i,multiple:!0,onChange:m,onBlur:l,onFocus:u,schema:t,uiSchema:n,value:f,disabled:a,readonly:o,required:c,registry:d,autofocus:s,rawErrors:p,label:C,hideLabel:!w,htmlName:T.name})}function uN(e){let{itemKey:t,index:n,name:r,disabled:i,hideError:a,readonly:o,registry:s,uiOptions:c,parentUiSchema:l,canAdd:u,canRemove:d=!0,canMoveUp:f,canMoveDown:p,itemSchema:m,itemData:h,itemUiSchema:g,itemFieldPathId:_,itemErrorSchema:v,autofocus:y,onBlur:b,onFocus:x,onChange:S,rawErrors:w,totalItems:T,title:E,handleAddItem:D,handleCopyItem:O,handleRemoveItem:k,handleReorderItems:A}=e,{schemaUtils:j,fields:{ArraySchemaField:M,SchemaField:N},globalUiOptions:P}=s,F=tN(_),I=M||N,L=CM(`ArrayFieldItemTemplate`,s,c),R=j.getDisplayLabel(m,g,P),{description:ee}=yD(g),z=!!ee||!!m.description,{orderable:te=!0,removable:B=!0,copyable:V=!1}=c,ne={moveUp:te&&f,moveDown:te&&p,copy:V&&u,remove:B&&d,toolbar:!1};ne.toolbar=Object.keys(ne).some(e=>ne[e]);let re=(0,C.useCallback)(e=>{D(e,n+1)},[D,n]),ie=(0,C.useCallback)(e=>{O(e,n)},[O,n]),ae=(0,C.useCallback)(e=>{k(e,n)},[k,n]),oe=(0,C.useCallback)(e=>{A(e,n,n-1)},[A,n]),se=(0,C.useCallback)(e=>{A(e,n,n+1)},[A,n]);return(0,G.jsx)(L,{children:(0,G.jsx)(I,{name:r,title:E,index:n,schema:m,uiSchema:g,formData:h,errorSchema:v,fieldPathId:F,required:hwe(m),onChange:S,onBlur:b,onFocus:x,registry:s,disabled:i,readonly:o,hideError:a,autofocus:y,rawErrors:w}),buttonsProps:{fieldPathId:F,disabled:i,readonly:o,canAdd:u,hasCopy:ne.copy,hasMoveUp:ne.moveUp,hasMoveDown:ne.moveDown,hasRemove:ne.remove,index:n,totalItems:T,onAddItem:re,onCopyItem:ie,onRemoveItem:ae,onMoveUpItem:oe,onMoveDownItem:se,registry:s,schema:m,uiSchema:g},itemKey:t,className:`rjsf-array-item`,disabled:i,hasToolbar:ne.toolbar,index:n,totalItems:T,readonly:o,registry:s,schema:m,uiSchema:g,parentUiSchema:l,displayLabel:R,hasDescription:z})}function bwe(e){let{schema:t,uiSchema:n={},errorSchema:r,fieldPathId:i,formData:a,name:o,title:s,disabled:c=!1,readonly:l=!1,autofocus:u=!1,required:d=!1,hideError:f=!1,registry:p,onBlur:m,onFocus:h,rawErrors:g,onChange:_,keyedFormData:v,handleAddItem:y,handleCopyItem:b,handleRemoveItem:x,handleReorderItems:S}=e,C=t.title||s||o,{schemaUtils:w,fields:T,formContext:E,globalFormOptions:D,globalUiOptions:O}=p,{OptionalDataControlsField:k}=T,A=yD(n,O),j=LD(t.items)?t.items:{},M=w.retrieveSchema(j),N=sN(v),P=YM(p,t,d,n),F=BM(a),I=cN(p,t,N,n)&&(!P||F),L=F?v:[],R=P?` rjsf-optional-array-field`:``,ee=e.childFieldPathId??i,z=P?(0,G.jsx)(k,{...e,fieldPathId:ee}):void 0,te={canAdd:I,items:L.map((e,t)=>{let{key:i,item:a}=e,s=a,T=w.retrieveSchema(j,s),O=r?r[t]:void 0,k=$M(t,D,ee),M=lN(n,a,t,E);return(0,G.jsx)(uN,{itemKey:i,index:t,name:o&&`${o}-${t}`,registry:p,uiOptions:A,parentUiSchema:n,hideError:f,readonly:l,disabled:c,required:d,title:C?`${C}-${t+1}`:void 0,canAdd:I,canMoveUp:t>0,canMoveDown:t<N.length-1,itemSchema:T,itemFieldPathId:k,itemErrorSchema:O,itemData:s,itemUiSchema:M,autofocus:u&&t===0,onBlur:m,onFocus:h,rawErrors:g,totalItems:v.length,handleAddItem:y,handleCopyItem:b,handleRemoveItem:x,handleReorderItems:S,onChange:_},i)}),className:`rjsf-field rjsf-field-array rjsf-field-array-of-${M.type}${R}`,disabled:c,fieldPathId:i,uiSchema:n,onAddClick:y,readonly:l,required:d,schema:t,title:C,formData:N,rawErrors:g,registry:p,optionalDataControl:z};return(0,G.jsx)(CM(`ArrayFieldTemplate`,p,A),{...te})}function xwe(e){let{schema:t,uiSchema:n={},formData:r,errorSchema:i,fieldPathId:a,name:o,title:s,disabled:c=!1,readonly:l=!1,autofocus:u=!1,required:d=!1,hideError:f=!1,registry:p,onBlur:m,onFocus:h,rawErrors:g,keyedFormData:_,onChange:v,handleAddItem:y,handleCopyItem:b,handleRemoveItem:x,handleReorderItems:S}=e,{formData:C=[]}=e,w=t.title||s||o,{schemaUtils:T,fields:E,formContext:D,globalFormOptions:O,globalUiOptions:k}=p,A=yD(n,k),{OptionalDataControlsField:j}=E,M=YM(p,t,d,n),N=BM(r),P=(LD(t.items)?t.items:[]).map((e,t)=>T.retrieveSchema(e,C[t])),F=LD(t.additionalItems)?T.retrieveSchema(t.additionalItems,r):null,I=e.childFieldPathId??a;C.length<P.length&&(C=C.concat(Array(P.length-C.length)));let L=N?_:[],R=M?` rjsf-optional-array-field`:``,ee=M?(0,G.jsx)(j,{...e,fieldPathId:I}):void 0,z=cN(p,t,C,n)&&!!F&&(!M||N),te={canAdd:z,className:`rjsf-field rjsf-field-array rjsf-field-array-fixed-items${R}`,disabled:c,fieldPathId:a,formData:r,items:L.map((e,r)=>{let{key:a,item:s}=e,E=s,k=r>=P.length,j=(k&&LD(t.additionalItems)?T.retrieveSchema(t.additionalItems,E):P[r])||{},M=$M(r,O,I),N;N=k?n.additionalItems:Array.isArray(n.items)?n.items[r]:lN(n,s,r,D);let F=i?i[r]:void 0;return(0,G.jsx)(uN,{index:r,itemKey:a,name:o&&`${o}-${r}`,registry:p,uiOptions:A,parentUiSchema:n,hideError:f,readonly:l,disabled:c,required:d,title:w?`${w}-${r+1}`:void 0,canAdd:z,canRemove:k,canMoveUp:r>=P.length+1,canMoveDown:k&&r<C.length-1,itemSchema:j,itemData:E,itemUiSchema:N,itemFieldPathId:M,itemErrorSchema:F,autofocus:u&&r===0,onBlur:m,onFocus:h,rawErrors:g,totalItems:_.length,onChange:v,handleAddItem:y,handleCopyItem:b,handleRemoveItem:x,handleReorderItems:S},a)}),onAddClick:y,readonly:l,required:d,registry:p,schema:t,uiSchema:n,title:w,errorSchema:i,rawErrors:g,optionalDataControl:ee};return(0,G.jsx)(CM(`ArrayFieldTemplate`,p,A),{...te})}function Swe(e=[]){let t=(0,C.useMemo)(()=>kM(e),[e]),[n,r]=(0,C.useState)(()=>({formDataHash:t,keyedFormData:oN(e)})),{keyedFormData:i,formDataHash:a}=n;if(t!==a){let n=Array.isArray(e)?e:[],o=i||[];i=n.length===o.length?o.map((e,t)=>({key:e.key,item:n[t]})):oN(n),a=t,r({formDataHash:a,keyedFormData:i})}let o=(0,C.useCallback)(e=>{let t=sN(e);return r({formDataHash:kM(t),keyedFormData:e}),t},[]);return{keyedFormData:i,updateKeyedFormData:o}}function Cwe(e){let{schema:t,uiSchema:n,errorSchema:r,fieldPathId:i,registry:a,formData:o,onChange:s}=e,{globalFormOptions:c,schemaUtils:l,translateString:u}=a,{keyedFormData:d,updateKeyedFormData:f}=Swe(o),p=e.childFieldPathId??i,m=(0,C.useCallback)((e,n)=>{e&&e.preventDefault();let i;if(r){i={};for(let e in r){let t=parseInt(e);n===void 0||t<n?hk(i,[t],r[e]):t>=n&&hk(i,[t+1],r[e])}}let o={key:aN(),item:gwe(a,t)},c=[...d];n===void 0?c.push(o):c.splice(n,0,o),s(f(c),p.path,i)},[d,a,t,s,f,r,p]),h=(0,C.useCallback)((e,t)=>{e&&e.preventDefault();let n;if(r){n={};for(let e in r){let i=parseInt(e);i<=t?hk(n,[i],r[e]):i>t&&hk(n,[i+1],r[e])}}let i={key:aN(),item:hM(d[t].item)},a=[...d];t===void 0?a.push(i):a.splice(t+1,0,i),s(f(a),p.path,n)},[d,s,f,r,p]),g=(0,C.useCallback)((e,t)=>{e&&e.preventDefault();let n;if(r){n={};for(let e in r){let i=parseInt(e);i<t?hk(n,[i],r[e]):i>t&&hk(n,[i-1],r[e])}}s(f(d.filter((e,n)=>n!==t)),p.path,n)},[d,s,f,r,p]),_=(0,C.useCallback)((e,t,n)=>{e&&(e.preventDefault(),e.currentTarget.blur());let i;if(r){i={};for(let e in r){let a=parseInt(e);a==t?hk(i,[n],r[t]):a==n?hk(i,[t],r[n]):hk(i,[e],r[a])}}function a(){let e=d.slice();return e.splice(t,1),e.splice(n,0,d[t]),e}s(f(a()),p.path,i)},[d,s,f,r,p]),v=(0,C.useCallback)((e,t,n,r)=>{s(e===void 0?null:e,t,n,r)},[s]),y=(0,C.useCallback)(e=>{s(e,p.path,void 0,p?.$id)},[s,p]),b={...e,formData:o,fieldPathId:p,onSelectChange:y},x={...e,handleAddItem:m,handleCopyItem:h,handleRemoveItem:g,handleReorderItems:_,keyedFormData:d,onChange:v};if(!(`items`in t)){if(!c.useFallbackUiForUnsupportedType)return(0,G.jsx)(CM(`UnsupportedFieldTemplate`,a,yD(n)),{schema:t,fieldPathId:i,reason:u(iN.MissingItems),registry:a});let e={...t,[oD]:{type:void 0}};b.schema=e,x.schema=e}return l.isMultiSelect(b.schema)?(0,G.jsx)(_we,{...b}):Jj(n)?(0,G.jsx)(vwe,{...b}):Mj(b.schema)?(0,G.jsx)(xwe,{...x}):l.isFilesArray(b.schema,n)?(0,G.jsx)(ywe,{...b}):(0,G.jsx)(bwe,{...x})}function wwe(e){let{schema:t,name:n,uiSchema:r,fieldPathId:i,formData:a,registry:o,required:s,disabled:c,readonly:l,hideError:u,autofocus:d,title:f,onChange:p,onFocus:m,onBlur:h,rawErrors:g}=e,{title:_}=t,{widgets:v,translateString:y,globalUiOptions:b}=o,{widget:x=`checkbox`,title:S,label:w=!0,enumNames:T,...E}=yD(r,b),D=OM(t,x,v),O=y(iN.YesLabel),k=y(iN.NoLabel),A,j=S??_??f??n;if(Array.isArray(t.oneOf))A=Bj({oneOf:t.oneOf.map(e=>{if(LD(e))return{...e,title:e.title||(e.const===!0?O:k)}}).filter(e=>e)},r);else{let e=t.enum??[!0,!1];A=!T&&e.length===2&&e.every(e=>typeof e==`boolean`)?[{value:e[0],label:e[0]?O:k},{value:e[1],label:e[1]?O:k}]:Bj({enum:e},r)}let M=(0,C.useCallback)((e,t,n)=>p(e,i.path,t,n),[p,i]);return(0,G.jsx)(D,{options:{...E,enumOptions:A},schema:t,uiSchema:r,id:i.$id,name:n,onChange:M,onFocus:m,onBlur:h,label:j,hideLabel:!w,value:a,required:s,disabled:c,readonly:l,hideError:u,registry:o,autofocus:d,rawErrors:g,htmlName:i.name})}function Twe(e){return{type:`string`,enum:[`string`,`number`,`boolean`,`object`,`array`],default:`string`,title:e}}function Ewe(e){let t=typeof e;return t===`string`||t===`number`||t===`boolean`?t:t===`object`?Array.isArray(e)?`array`:`object`:`string`}function Dwe(e,t){switch(t){case`string`:return String(e);case`number`:{let t=Number(e);return isNaN(t)?0:t}case`boolean`:return!!e;default:return e}}function Owe(e){let{id:t,formData:n,displayLabel:r=!0,schema:i,name:a,uiSchema:o,required:s,disabled:c=!1,readonly:l=!1,onBlur:u,onFocus:d,registry:f,fieldPathId:p,onChange:m,errorSchema:h}=e,{translateString:g,fields:_,globalFormOptions:v}=f,[y,b]=(0,C.useState)(Ewe(n)),x=yD(o),S=tN($M(`__internal_type_selector`,v,p)),w=g(iN.Type),T=(0,C.useMemo)(()=>Twe(w),[w]),E=e=>{e!=null&&(b(e),m(Dwe(n,e),p.path,h,t))};if(!v.useFallbackUiForUnsupportedType){let{reason:t=g(iN.UnknownFieldType,[String(i.type)])}=e;return(0,G.jsx)(CM(`UnsupportedFieldTemplate`,f,x),{schema:i,fieldPathId:p,reason:t,registry:f})}let D=CM(`FallbackFieldTemplate`,f,x),{SchemaField:O}=_;return(0,G.jsx)(D,{schema:i,registry:f,typeSelector:(0,G.jsx)(O,{fieldPathId:S,name:`${a}__fallback_type`,schema:T,formData:y,onChange:E,onBlur:u,onFocus:d,registry:f,hideLabel:!r,disabled:c,readonly:l,required:s},n?kM(n):`__empty__`),schemaField:(0,G.jsx)(O,{...e,schema:{type:y,title:g(iN.Value),...y===`object`&&{additionalProperties:!0}}})})}function kwe(e,t){return $O(t,function(t){return e[t]})}function Awe(e){return e==null?[]:kwe(e,AO(e))}var jwe=Math.max;function Mwe(e,t,n,r){e=kO(e)?e:Awe(e),n=n&&!r?bk(n):0;var i=e.length;return n<0&&(n=jwe(i+n,0)),lj(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&$k(e,t,n)>-1}var Nwe=Math.min;function Pwe(e,t,n){for(var r=n?tA:eA,i=e[0].length,a=e.length,o=a,s=Array(a),c=1/0,l=[];o--;){var u=e[o];o&&t&&(u=$O(u,yO(t))),c=Nwe(u.length,c),s[o]=!n&&(t||i>=120&&u.length>=120)?new YD(o&&u):void 0}u=e[0];var d=-1,f=s[0];outer:for(;++d<i&&l.length<c;){var p=u[d],m=t?t(p):p;if(p=n||p!==0?p:0,!(f?XD(f,m):r(l,m,n))){for(o=a;--o;){var h=s[o];if(!(h?XD(h,m):r(e[o],m,n)))continue outer}f&&f.push(m),l.push(p)}}return l}function Fwe(e){return Hk(e)?e:[]}var dN=Xk(function(e){var t=$O(e,Fwe);return t.length&&t[0]===e[0]?Pwe(t):[]});function fN(e){return e===void 0}var pN;(function(e){e.ROW=`ui:row`,e.COLUMN=`ui:col`,e.COLUMNS=`ui:columns`,e.CONDITION=`ui:condition`})(pN||={});var mN;(function(e){e.ALL=`all`,e.SOME=`some`,e.NONE=`none`})(mN||={});var Iwe=/^\$lookup=(.+)/,hN=`layoutGrid`;`${hN}`;function gN(e,t){return e??t}function Lwe(e){return/^\d+?$/.test(e)}var _N=TM();function Rwe(e,t,n,r,i){let a=sk(n,[vD],{}),o=sk(n,e),s={...sk(o,[_D],{}),...t,...a},c={...o};aA(s)||hk(c,[_D],s),aA(a)||hk(c,[vD],a);let{readonly:l}=yD(c);return(i===!0||fN(l)&&r===!0)&&(l=!0,lk(s,`readonly`)?hk(c,[_D,uD],!0):hk(c,`ui:${uD}`,!0)),{fieldUiSchema:c,uiReadonly:l}}function zwe(e,t,n=`$0m3tH1nG Un3xP3cT3d`){let r=QA([t]).sort(),i=QA([n]).sort();switch(e){case mN.ALL:return uk(r,i);case mN.SOME:return dN(r,i).length>0;case mN.NONE:return dN(r,i).length===0;default:return!1}}function vN(e,t,n){let r={},i=e[t];if(MD(i)){let{children:e,className:t,...a}=i;if(i=e,t){let e=t.split(` `).map(e=>HM(n,e,e)).join(` `);r={...a,className:e}}else r=a}if(!Array.isArray(i))throw TypeError(`Expected array for "${t}" in ${JSON.stringify(e)}`);return{children:i,gridProps:r}}function yN(e,t,n){let r;if(Lwe(n)&&e&&e?.type===`array`&&lk(e,`items`)){let i=Number(n),a=e[oD];r=Array.isArray(a)?i>a.length?XA(a):a[i]:a,t={$id:t.$id,path:[...t.path.slice(0,t.path.length-1),i]}}return{rawSchema:r,fieldPathId:t}}function Bwe(e,t,n,r,i){let{schemaUtils:a,globalFormOptions:o}=e,s=n,c=i,l=t.split(`.`),u=l.pop(),d=a.retrieveSchema(s,r),f=r,p=d.readOnly;l.forEach(e=>{if(c=$M(e,o,c),lk(d,`properties`))s=sk(d,[lD,e],{});else if(d&&(lk(d,`oneOf`)||lk(d,`anyOf`))){let t=lk(d,`oneOf`)?cD:nD;s=sk(a.findSelectedOptionInXxxOf(d,e,t,f),[lD,e],{})}else{let t=yN(d,c,e);s=t.rawSchema??{},c=t.fieldPathId}f=sk(f,e,{}),d=a.retrieveSchema(s,f),p=gN(d.readOnly,p)});let m,h=!1;if(aA(d)&&(d=void 0),d&&u){if(d&&(lk(d,`oneOf`)||lk(d,`anyOf`))){let e=lk(d,`oneOf`)?cD:nD;d=a.findSelectedOptionInXxxOf(d,u,e,f)}c=$M(u,o,c),h=d!==void 0&&Array.isArray(d.required)&&Mwe(d.required,u);let e=yN(d,c,u);if(e.rawSchema?(d=e.rawSchema,c=e.fieldPathId):(d=sk(d,[lD,u]),d&&=a.retrieveSchema(d)),p=gN(d?.readOnly,p),d&&(lk(d,`oneOf`)||lk(d,`anyOf`))){let e=lk(d,`oneOf`)?cD:nD,t=uj(d);m={options:d[e],hasDiscriminator:!!t}}}return{schema:d,isRequired:h,isReadonly:p,optionsInfo:m,fieldPathId:c}}function Vwe(e,t){let n=e;return lj(n)&&(n=HM(t,n)),RD(n)?n:null}function Hwe(e,t){let n,r=null,i={},a;if(lj(t)||fN(t))n=t??``;else{let{name:o=``,render:s,...c}=t;n=o,i=c,aA(i)||pwe(i,(t,n)=>{if(lj(t)){let r=Iwe.exec(t);if(Array.isArray(r)&&r.length>1){let t=r[1];i[n]=HM(e,t,t)}}}),r=Vwe(s,e),!o&&r&&(a=(0,G.jsx)(r,{...c,"data-testid":_N.uiComponent}))}return{name:n,UIComponent:r,uiProps:i,rendered:a}}function bN(e){let{childrenLayoutGridSchemaId:t,...n}=e,{registry:r,schema:i,formData:a}=n,{schemaUtils:o}=r,s=o.retrieveSchema(i,a);return t.map(e=>(0,C.createElement)(xN,{...n,key:`layoutGrid-${kM(e)}`,schema:s,layoutGridSchema:e}))}function Uwe(e){let{layoutGridSchema:t,...n}=e,{formData:r,registry:i}=n,{children:a,gridProps:o}=vN(t,pN.CONDITION,i),{operator:s,field:c=``,value:l}=o;return zwe(s,sk(r,c,null),l)?(0,G.jsx)(bN,{...n,childrenLayoutGridSchemaId:a}):null}function Wwe(e){let{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:a,gridProps:o}=vN(t,pN.COLUMN,r);return(0,G.jsx)(CM(`GridTemplate`,r,yD(i)),{column:!0,"data-testid":_N.col,...o,children:(0,G.jsx)(bN,{...n,childrenLayoutGridSchemaId:a})})}function Gwe(e){let{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:a,gridProps:o}=vN(t,pN.COLUMNS,r),s=CM(`GridTemplate`,r,yD(i));return a.map(e=>(0,G.jsx)(s,{column:!0,"data-testid":_N.col,...o,children:(0,G.jsx)(bN,{...n,childrenLayoutGridSchemaId:[e]})},`column-${kM(e)}`))}function Kwe(e){let{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:a,gridProps:o}=vN(t,pN.ROW,r);return(0,G.jsx)(CM(`GridTemplate`,r,yD(i)),{...o,"data-testid":_N.row,children:(0,G.jsx)(bN,{...n,childrenLayoutGridSchemaId:a})})}function qwe(e){let{gridSchema:t,schema:n,uiSchema:r,errorSchema:i,fieldPathId:a,onBlur:o,onFocus:s,formData:c,readonly:l,registry:u,layoutGridSchema:d,...f}=e,{onChange:p}=f,{fields:m}=u,{SchemaField:h,LayoutMultiSchemaField:g}=m,_=Hwe(u,t),{name:v,UIComponent:y,uiProps:b}=_,{schema:x,isRequired:S,isReadonly:C,optionsInfo:w,fieldPathId:T}=Bwe(u,v,n,c,a),E=tN(T);if(_.rendered)return _.rendered;if(x){let e=w?.hasDiscriminator?g:h,{fieldUiSchema:t,uiReadonly:n}=Rwe(v,b,r,C,l);return(0,G.jsx)(e,{"data-testid":w?.hasDiscriminator?_N.layoutMultiSchemaField:_N.field,...f,name:v,required:S,readonly:n,schema:x,uiSchema:t,errorSchema:sk(i,v),fieldPathId:E,formData:sk(c,v),onChange:p,onBlur:o,onFocus:s,options:w?.options,registry:u})}return y?(0,G.jsx)(y,{"data-testid":_N.uiComponent,...f,name:v,required:S,formData:c,readOnly:!!C||l,errorSchema:i,uiSchema:r,schema:n,fieldPathId:a,onBlur:o,onFocus:s,registry:u,...b}):null}function xN(e){let{uiSchema:t}=e,{layoutGridSchema:n}=e,r=yD(t);if(!n&&`layoutGrid`in r&&LD(r.layoutGrid)&&(n=r[hN]),LD(n)){if(pN.ROW in n)return(0,G.jsx)(Kwe,{...e,layoutGridSchema:n});if(pN.COLUMN in n)return(0,G.jsx)(Wwe,{...e,layoutGridSchema:n});if(pN.COLUMNS in n)return(0,G.jsx)(Gwe,{...e,layoutGridSchema:n});if(pN.CONDITION in n)return(0,G.jsx)(Uwe,{...e,layoutGridSchema:n})}return(0,G.jsx)(qwe,{...e,gridSchema:n})}xN.TEST_IDS=_N;function Jwe(e){let{fieldPathId:t,title:n,schema:r,uiSchema:i,required:a,registry:o,name:s}=e,c=yD(i,o.globalUiOptions),{title:l}=c,{title:u}=r,d=l||n||u||s;return d?(0,G.jsx)(CM(`TitleFieldTemplate`,o,c),{id:FM(t),title:d,required:a,schema:r,uiSchema:i,registry:o}):null}function SN(e,t,n){return e.map(({schema:e})=>e).find(e=>{let r=sk(e,[lD,t]);return sk(r,iD,sk(r,rD,`!@#!@$@#$!@$#`))===n})}function CN(e,t,n,r,i){let a=t.map(e=>n.retrieveSchema(e,i)),o=e;lk(e,`oneOf`)?o={...e,[cD]:a}:lk(e,`anyOf`)&&(o={...e,[nD]:a});let s=Bj(o,r);if(!s)throw Error(`No enumOptions were computed from the schema ${JSON.stringify(o)}`);return s}function Ywe(e){let{name:t,baseType:n,disabled:r=!1,formData:i,fieldPathId:a,onBlur:o,onChange:s,options:c,onFocus:l,registry:u,uiSchema:d,schema:f,autofocus:p,readonly:m,required:h,errorSchema:g,hideError:_=!1}=e,{widgets:v,schemaUtils:y,globalUiOptions:b}=u,[x,S]=(0,C.useState)(CN(f,c,y,d,i)),w=sk(a,`$id`),T=uj(f),E=CM(`FieldErrorTemplate`,u,c),D=CM(`FieldTemplate`,u,c);(0,C.useEffect)(()=>{S(CN(f,c,y,d,i))},[kM(f),kM(c),y,d?kM(d):``,i?kM(i):``]);let{widget:O=T?`radio`:`select`,title:k=``,placeholder:A=``,optionsSchemaSelector:j=T,hideError:M,...N}=yD(d);if(!j)throw Error(`No selector field provided for the LayoutMultiSchemaField`);let P=sk(i,j),F=sk(x[0]?.schema,[lD,j],{}),I=SN(x,j,P);F=F?.type?F:{...F,type:I?.type||n};let L=OM(F,O,v),R=M===void 0?_:!!M,ee=sk(g,[aD],[]),z=ej(g,[aD]),te=y.getDisplayLabel(f,d,b),B=e=>{let t=SN(x,j,e),n=SN(x,j,P),r=y.sanitizeDataForNewSchema(t,n,i);r&&t&&(r=y.getDefaultFormState(t,r,`excludeObjectChildren`)),r&&hk(r,j,e),s(r,a.path,void 0,w)},V={enumOptions:x,...N},ne=!R&&ee.length>0?(0,G.jsx)(E,{fieldPathId:a,schema:f,errors:ee,registry:u}):void 0;return(0,G.jsx)(D,{fieldPathId:a,id:w,schema:f,label:(k||f.title)??``,disabled:r||Array.isArray(x)&&aA(x),uiSchema:d,required:h,readonly:!!m,registry:u,displayLabel:te,errors:ne,onChange:s,onKeyRename:nA,onKeyRenameBlur:nA,onRemoveProperty:nA,children:(0,G.jsx)(L,{id:w,name:t,schema:f,label:(k||f.title)??``,disabled:r||Array.isArray(x)&&aA(x),uiSchema:d,autofocus:p,readonly:m,required:h,registry:u,multiple:!1,rawErrors:ee,hideError:R,hideLabel:!te,errorSchema:z,placeholder:A,onChange:B,onBlur:o,onFocus:l,value:P,options:V,htmlName:a.name})})}var wN=class extends C.Component{constructor(e){super(e);let{formData:t,options:n,registry:{schemaUtils:r}}=this.props,i=n.map(e=>r.retrieveSchema(e,t));this.state={retrievedOptions:i,selectedOption:this.getMatchingOption(0,t,i)}}componentDidUpdate(e,t){let{formData:n,options:r,fieldPathId:i}=this.props,{selectedOption:a}=this.state,o=this.state;if(!JO(e.options,r)){let{registry:{schemaUtils:e}}=this.props;o={selectedOption:a,retrievedOptions:r.map(t=>e.retrieveSchema(t,n))}}if(!JO(n,e.formData)&&i.$id===e.fieldPathId.$id){let{retrievedOptions:e}=o,r=this.getMatchingOption(a,n,e);t&&r!==a&&(o={selectedOption:r,retrievedOptions:e})}o!==this.state&&this.setState(o)}getMatchingOption(e,t,n){let{schema:r,registry:{schemaUtils:i}}=this.props,a=uj(r);return i.getClosestMatchingOption(t,n,e,a)}onOptionChange=e=>{let{selectedOption:t,retrievedOptions:n}=this.state,{formData:r,onChange:i,registry:a,fieldPathId:o}=this.props,{schemaUtils:s}=a,c=e===void 0?-1:parseInt(e,10);if(c===t)return;let l=c>=0?n[c]:void 0,u=t>=0?n[t]:void 0,d=s.sanitizeDataForNewSchema(l,u,r);l&&(d=s.getDefaultFormState(l,d,`excludeObjectChildren`)),this.setState({selectedOption:c},()=>{i(d,o.path,void 0,this.getFieldId())})};getFieldId(){let{fieldPathId:e,schema:t}=this.props;return`${e.$id}${t.oneOf?`__oneof_select`:`__anyof_select`}`}render(){let{name:e,disabled:t=!1,errorSchema:n={},formData:r,onBlur:i,onFocus:a,readonly:o,required:s=!1,registry:c,schema:l,uiSchema:u}=this.props,{widgets:d,fields:f,translateString:p,globalUiOptions:m,schemaUtils:h}=c,{SchemaField:g}=f,_=CM(`MultiSchemaFieldTemplate`,c,m),v=YM(c,l,s,u),y=BM(r),{selectedOption:b,retrievedOptions:x}=this.state,{widget:S=`select`,placeholder:C,autofocus:w,autocomplete:T,title:E=l.title,...D}=yD(u,m),O=OM({type:`number`},S,d),k=sk(n,aD,[]),A=ej(n,[aD]),j=h.getDisplayLabel(l,u,m),M=b>=0&&x[b]||null,N;if(M){let{required:e}=l;N=e?pj({required:e},M):M}let P=[];`oneOf`in l&&u&&`oneOf`in u?Array.isArray(u.oneOf)?P=u[cD]:console.warn(`uiSchema.oneOf is not an array for "${E||e}"`):`anyOf`in l&&u&&`anyOf`in u&&(Array.isArray(u.anyOf)?P=u[nD]:console.warn(`uiSchema.anyOf is not an array for "${E||e}"`));let F=u;b>=0&&P.length>b&&(F=P[b]);let I=E?iN.TitleOptionPrefix:iN.OptionPrefix,L=E?[E]:[],R=x.map((e,t)=>{let{title:n=e.title}=yD(P[t]);return{label:n||p(I,L.concat(String(t+1))),value:t}});return(0,G.jsx)(_,{schema:l,registry:c,uiSchema:u,selector:!v||y?(0,G.jsx)(O,{id:this.getFieldId(),name:`${e}${l.oneOf?`__oneof_select`:`__anyof_select`}`,schema:{type:`number`,default:0},onChange:this.onOptionChange,onBlur:i,onFocus:a,disabled:t||aA(R),multiple:!1,rawErrors:k,errorSchema:A,value:b>=0?b:void 0,options:{enumOptions:R,...D},registry:c,placeholder:C,autocomplete:T,autofocus:w,label:E??e,hideLabel:!j,readonly:o}):void 0,optionSchemaField:N&&N.type!==`null`&&(0,G.jsx)(g,{...this.props,schema:N,uiSchema:F})||null})}},Xwe=/\.([0-9]*0)*$/,Zwe=/[0.]0*$/;function Qwe(e){let{registry:t,onChange:n,formData:r,value:i}=e,[a,o]=(0,C.useState)(i),{StringField:s}=t.fields,c=r,l=(0,C.useCallback)((e,t,r,i)=>{o(e),`${e}`.charAt(0)===`.`&&(e=`0${e}`),n(typeof e==`string`&&e.match(Xwe)?$E(e.replace(Zwe,``)):$E(e),t,r,i)},[n]);if(typeof a==`string`&&typeof c==`number`){let e=RegExp(`^(${String(c).replace(`.`,`\\.`)})?\\.?0*$`);a.match(e)&&(c=a)}return(0,G.jsx)(s,{...e,formData:c,onChange:l})}function TN(){return TN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},TN.apply(null,arguments)}var EN=[`strong`,`em`,`del`,`mark`],DN=[[`**`,EN[0]],[`__`,EN[0]],[`~~`,EN[2]],[`==`,EN[3]],[`*`,`em`],[`_`,`em`]];function $we(e,t){for(var n=1,r=t+1;r<e.length&&n>0;)e[r]===`\\`?r+=2:(e[r]===`[`&&n++,e[r]===`]`&&n--,r++);if(n===0&&r<e.length&&(e[r]===`(`||e[r]===`[`)){var i=e[r]===`(`?`)`:`]`,a=1;for(r++;r<e.length&&a>0;)e[r]===`\\`?r+=2:(e[r]===`(`&&i===`)`&&a++,e[r]===i&&a--,r++);if(a===0)return r}return-1}function eTe(e,t){if(!t||!t.inline&&!t.simple)return null;var n=e[0];if(n!==`*`&&n!==`_`&&n!==`~`&&n!==`=`)return null;for(var r=``,i=0,a=``,o=0;o<6;o++){var s=DN[o][0];if(e.startsWith(s)&&e.length>=2*s.length){r=s,i=s.length,a=DN[o][1];break}}if(!r)return null;for(var c=i,l=!1,u=!1,d=``,f=0,p=``,m=!1,h=``;c<e.length;){var g=e[c];if(m)p+=g,m=!1,h=g,c++;else if(g!==`\\`)if(g!=="`"||f!==0){if(g===`[`&&!l&&f===0){var _=$we(e,c);if(_!==-1){p+=e.slice(c,_),c=_,h=e[_-1];continue}}if(u)p+=g,d?g===d&&(d=``):g===`"`||g===`'`?d=g:g===`>`&&(u=!1),h=g,c++;else if(g!==`<`||l){if(g===`
|
|
@@ -456,7 +456,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
456
456
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
457
457
|
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(G2(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Y2(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(G2(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(q2(t.key)&&!G2(t.sep,`newline`)){let e=Y2(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):G2(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!G2(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||G2(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=Y2(J2(t));X2(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
458
458
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
459
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Y2(J2(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Y2(J2(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function Q2(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new W2||null,prettyErrors:t}}function hqe(e,t={}){let{lineCounter:n,prettyErrors:r}=Q2(t),i=new Z2(n?.addNewLine),a=new k2(t),o=Array.from(a.compose(i.parse(e)));if(r&&n)for(let t of o)t.errors.forEach(d2(e,n)),t.warnings.forEach(d2(e,n));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function $2(e,t={}){let{lineCounter:n,prettyErrors:r}=Q2(t),i=new Z2(n?.addNewLine),a=new k2(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new l2(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(d2(e,n)),o.warnings.forEach(d2(e,n))),o}function gqe(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=$2(e,n);if(!i)return null;if(i.warnings.forEach(e=>a0(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function _qe(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return d1(e)&&!r?e.toString(n):new o2(e,r,n).toString(n)}var vqe=c({Alias:()=>I1,CST:()=>lqe,Composer:()=>k2,Document:()=>o2,Lexer:()=>U2,LineCounter:()=>W2,Pair:()=>f0,Parser:()=>Z2,Scalar:()=>z1,Schema:()=>a2,YAMLError:()=>c2,YAMLMap:()=>g0,YAMLParseError:()=>l2,YAMLSeq:()=>v0,YAMLWarning:()=>u2,isAlias:()=>u1,isCollection:()=>g1,isDocument:()=>d1,isMap:()=>f1,isNode:()=>_1,isPair:()=>p1,isScalar:()=>m1,isSeq:()=>h1,parse:()=>gqe,parseAllDocuments:()=>hqe,parseDocument:()=>$2,stringify:()=>_qe,visit:()=>S1,visitAsync:()=>w1});function yqe(e){let t=null;try{t=vqe.parse(e.doc.toString())}catch{}let n=gq(e,fq.YAML);return{data:t,pointers:n}}var e4=e=>{switch(e){case fq.JSON:return oKe;case fq.JSON5:return cKe;case fq.YAML:return yqe}};function bqe(e){return Object.entries(e)}function t4(e,t){if(typeof e==`string`||typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>t4(e,t));if(e instanceof Map){let n=new Map;for(let[r,i]of e){let e=r,a=t4(i,t);n.set(e,a)}return n}if(e instanceof Set){let n=new Set;for(let r of e){let e=t4(r,t);n.add(e)}return n}let n={};function r(e,r,i,a){i===e&&a===r?n[i]=t4(r,t):n[i]=a}for(let[n,i]of bqe(e)){let e=t(n,i);if(e.length===2&&typeof e[0]==`string`)r(n,i,e[0],e[1]);else for(let[t,a]of e)r(n,i,t,a)}return n}var xqe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Sqe=class{constructor(){this.completions=new Map,this.reservedKeys=new Set}reserve(e){this.reservedKeys.add(e)}add(e){this.reservedKeys.has(e.label)||this.completions.set(e.label,e)}};function n4(e){return!(!e||Fq(e)||e.name===`UnknownPropertyError`||e.type===`undefined`)}var Cqe=class{constructor(e){this.opts=e,this.originalSchema=null,this.schema=null,this.laxSchema=null,this.mode=fq.JSON,this.mode=e.mode??fq.JSON,this.parser=this.opts?.jsonParser??e4(this.mode)}doComplete(e){let t=kq(e.state);if(this.originalSchema!==t&&(this.schema=a4(t,t)??t,this.laxSchema=Tqe(this.schema)),!this.schema||!this.laxSchema)return[];cq.log(`xxx`,`trying with original schema`);let n=this.doCompleteForSchema(e,this.schema);return n.options.length===0?(cq.log(`xxx`,`no completions with original schema, trying with lax schema`),this.doCompleteForSchema(e,this.laxSchema)):n}doCompleteForSchema(e,t){let n={from:e.pos,to:e.pos,options:[],filter:!1},r=e.state.doc.sliceString(0),i=_q(e.state,e.pos),a=e.state.sliceDoc(i.from,e.pos).replace(/^(["'])/,``);if(cq.log(`xxx`,`node`,i,`prefix`,a,`ctx`,e),!(xq(i,this.mode)||Sq(i,this.mode))&&!e.explicit)return cq.log(`xxx`,`no completions for non-word/primitive`,i),n;let o=yq(e.state.doc,i),s=yq(e.state.doc,i,!1);if(i&&(xq(i,this.mode)||Sq(i,this.mode)))n.from=i.from,n.to=i.to;else{let t=e.matchBefore(/[A-Za-z0-9._]*/),a=e.pos-o.length;cq.log(`xxx`,`overwriteStart after`,a,`ctx.pos`,e.pos,`word`,t,`currentWord`,o,`=>`,r[a-1],`..`,r[a],`..`,r),n.from=i.name===lq.INVALID?t?.from??e.pos:a,n.to=e.pos}let c=new Sqe,l=!0,u=Dq(i,lq.PROPERTY_NAME,this.mode);if(u&&(cq.log(`xxx`,`closestPropertyNameNode`,u,`node`,i),i=u),Sq(i,this.mode)){cq.log(`xxx`,`isPropertyNameNode`,i);let e=i.parent;if(e){let t=Tq(e,this.mode);l=!t||t.name===lq.INVALID&&t.from-t.to===0||(t.parent?Cq(t.parent).length<=1:!1),cq.log(`xxx`,`addValue`,l,Tq(e,this.mode),i),i=Dq(e,lq.OBJECT,this.mode)??null}}if(cq.log(`xxx`,i,o,e,`node at pos`,_q(e.state,e.pos)),i&&[lq.OBJECT,lq.JSON_TEXT].includes(pq(i.name,this.mode))&&(Sq(_q(e.state,e.pos),this.mode)||u)){if(i.from===e.pos)return cq.log(`xxx`,`no completions for just before opening brace`),n;this.getPropertyCompletions(t,e,i,c,l,s)}else{let n=this.getValueCompletions(t,e,{},c);cq.log(`xxx`,`getValueCompletions res`,n)}return n.options=Array.from(c.completions.values()).filter(e=>vq(e.label).startsWith(a)),cq.log(`xxx`,`result`,n,`prefix`,a,`collector.completions`,c.completions,`reservedKeys`,c.reservedKeys),n}applySnippetCompletion(e){return wLe(typeof e.apply==`string`?e.apply:e.label,e)}getPropertyCompletions(e,t,n,r,i,a){let o=oRe(n,lq.PROPERTY,this.mode);cq.log(`xxx`,`getPropertyCompletions`,n,t,o),o.forEach(e=>{let n=yq(t.state.doc,wq(e,lq.PROPERTY_NAME,this.mode));r.reserve(vq(n))});let s=this.getSchemas(e,t);cq.log(`xxx`,`propertyCompletion schemas`,s),s.forEach(t=>{if(typeof t!=`object`)return;let n=t.properties;n&&Object.entries(n).forEach(([t,n])=>{if(typeof n==`object`){let o=n.description??``,s=n.type??``,c=Array.isArray(s)?s.toString():s,l={label:t,apply:this.getInsertTextForProperty(t,i,a,e,n),type:`property`,detail:c,info:()=>IY(`div`,{inner:t1(o)})};r.add(this.applySnippetCompletion(l))}});let o=t.propertyNames;if(typeof o==`object`&&(o.enum&&o.enum.forEach(t=>{let n=t?.toString();if(n){let t={label:n,apply:this.getInsertTextForProperty(n,i,a,e),type:`property`};r.add(this.applySnippetCompletion(t))}}),o.const)){let t=o.const.toString(),n={label:t,apply:this.getInsertTextForProperty(t,i,a,e),type:`property`};r.add(this.applySnippetCompletion(n))}})}getInsertTextForProperty(e,t,n,r,i){i&&=a4(i,r);let a=this.getInsertTextForPropertyName(e,n);if(!t)return a;a+=`: `;let o,s=0;if(typeof i==`object`){if(i.default!==void 0)o||=this.getInsertTextForGuessedValue(i.default,``),s++;else if(i.enum&&(!o&&i.enum.length===1&&(o=this.getInsertTextForGuessedValue(i.enum[0],``)),s+=i.enum.length),i.const!==void 0&&(o||=this.getInsertTextForGuessedValue(i.const,``),s++),Array.isArray(i.examples)&&i.examples.length&&(o||=this.getInsertTextForGuessedValue(i.examples[0],``),s+=i.examples.length),o===void 0&&s===0){let e=Array.isArray(i.type)?i.type[0]:i.type;switch(e||(i.properties?e=`object`:i.items&&(e=`array`)),e){case`boolean`:o=`#{}`;break;case`string`:o=this.getInsertTextForString(``);break;case`object`:switch(this.mode){case fq.JSON5:o=`{#{}}`;break;case fq.YAML:o=`#{}`;break;default:o=`{#{}}`;break}break;case`array`:o=`[#{}]`;break;case`number`:case`integer`:o=`#{0}`;break;case`null`:o=`#{null}`;break;default:o=`#{}`;break}}}return(!o||s>1)&&(cq.log(`xxx`,`value`,o,`nValueProposals`,s,i),o=`#{}`),a+o}getInsertTextForPropertyName(e,t){switch(this.mode){case fq.JSON5:case fq.YAML:return t.startsWith(`"`)?`"${e}"`:t.startsWith(`'`)?`'${e}'`:e;default:return`"${e}"`}}getInsertTextForString(e,t=`#`){switch(this.mode){case fq.JSON5:return`'${t}{${e}}'`;case fq.YAML:return`${t}{${e}}`;default:return`"${t}{${e}}"`}}getInsertTextForGuessedValue(e,t=``){switch(typeof e){case`object`:return e===null?"${null}"+t:this.getInsertTextForValue(e,t);case`string`:{let n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),this.getInsertTextForString(n,`$`)+t}case`number`:case`boolean`:return"${"+JSON.stringify(e)+`}`+t}return this.getInsertTextForValue(e,t)}getInsertTextForPlainText(e){return e.replace(/[\\$}]/g,`\\$&`)}getInsertTextForValue(e,t){let n=JSON.stringify(e,null,` `);return n===`{}`?`{#{}}`+t:n===`[]`?`[#{}]`+t:this.getInsertTextForPlainText(n+t)}getValueCompletions(e,t,n,r){let i=ZH(t.state).resolveInner(t.pos,-1),a=null,o;if(cq.log(`xxx`,`getValueCompletions`,i,t),i&&xq(i,this.mode)&&(a=i,i=i.parent),!i){this.addSchemaValueCompletions(e,n,r);return}if(pq(i.name,this.mode)===lq.PROPERTY){let e=wq(i,lq.PROPERTY_NAME,this.mode);e&&(o=yq(t.state.doc,e),i=i.parent)}if(cq.log(`xxx`,`node`,i,`parentKey`,o),i&&(o!==void 0||pq(i.name,this.mode)===lq.ARRAY)){let s=this.getSchemas(e,t);for(let e of s){if(typeof e!=`object`)return;if(pq(i.name,this.mode)===lq.ARRAY&&e.items){let t=r;if(e.uniqueItems&&(t=Object.assign(Object.assign({},t),{add(e){t.completions.has(e.label)||r.add(e)},reserve(e){r.reserve(e)}})),Array.isArray(e.items)){let r=0;if(a){let e=Eq(i,a,this.mode);e>=0&&(r=e)}let o=e.items[r];o&&this.addSchemaValueCompletions(o,n,t)}else this.addSchemaValueCompletions(e.items,n,t)}if((e.type==null||e.type!==`object`)&&this.addSchemaValueCompletions(e,n,r),o!==void 0){let t=!1;if(e.properties){let i=e.properties[o];i&&(t=!0,this.addSchemaValueCompletions(i,n,r))}if(e.patternProperties&&!t){for(let i of Object.keys(e.patternProperties))if(this.extendedRegExp(i)?.test(o)){t=!0;let a=e.patternProperties[i];a&&this.addSchemaValueCompletions(a,n,r)}}if(e.additionalProperties&&!t){let t=e.additionalProperties;this.addSchemaValueCompletions(t,n,r)}}n.boolean&&(this.addBooleanValueCompletion(!0,r),this.addBooleanValueCompletion(!1,r)),n.null&&this.addNullValueCompletion(r)}}return{valuePrefix:a?yq(t.state.doc,a,!0,!1):``}}addSchemaValueCompletions(e,t,n){typeof e==`object`&&(this.addEnumValueCompletions(e,n),this.addDefaultValueCompletions(e,n),this.collectTypes(e,t),Array.isArray(e.allOf)&&e.allOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.anyOf)&&e.anyOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.oneOf)&&e.oneOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)))}addDefaultValueCompletions(e,t,n=0){let r=!1;if(e.default!==void 0){let i=e.type,a=e.default;for(let e=n;e>0;e--)a=[a],i=`array`;let o=Object.assign(Object.assign({type:i?.toString()},this.getAppliedValue(a)),{detail:`Default value`});t.add(o),r=!0}Array.isArray(e.examples)&&e.examples.forEach(i=>{let a=e.type,o=i;for(let e=n;e>0;e--)o=[o],a=`array`;t.add(Object.assign({type:a?.toString()},this.getAppliedValue(o))),r=!0}),!r&&typeof e.items==`object`&&!Array.isArray(e.items)&&n<5&&this.addDefaultValueCompletions(e.items,t,n+1)}addEnumValueCompletions(e,t){if(e.const!==void 0&&t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(e.const)),{info:e.description})),Array.isArray(e.enum))for(let n=0,r=e.enum.length;n<r;n++){let r=e.enum[n];t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(r)),{info:e.description}))}}addBooleanValueCompletion(e,t){t.add({type:`boolean`,label:e?`true`:`false`})}addNullValueCompletion(e){e.add({type:`null`,label:`null`})}collectTypes(e,t){if(Array.isArray(e.enum)||e.const!==void 0)return;let n=e.type;Array.isArray(n)?n.forEach(e=>t[e]=!0):n&&(t[n]=!0)}getSchemas(e,t){let{data:n}=this.parser(t.state),r=new FY(e),i=hq(t.state,t.pos,-1,this.mode);if(i===``&&(i=void 0),i!=null&&i.endsWith(`/`)){i=i.substring(0,i.length-1);let t=r4(e,n,i);if(t!=null)return[t]}let a=i?.replace(/\/[^/]*$/,``);a===``&&(a=void 0);let o=r4(e,n,a),s=i?.split(`/`).pop(),c=s==null||s in(o?.properties??{}),l=r.getSchema({pointer:i,data:n??void 0});return!c&&l?.type===`null`&&this.mode===`yaml`&&(l=void 0),cq.log(`xxxx`,`draft.getSchema`,l,`data`,n,`pointer`,i,`pointerPointsToKnownProperty`,c),Fq(l)&&(l=l.data?.schema),!n4(l)&&o?[o]:(n4(l)||(l=r.getSchema({pointer:a}),i=a),cq.log(`xxx`,`pointer..`,JSON.stringify(i)),!n4(l)&&(!i||i===`/`)&&(l=a4(e,e)??e),cq.log(`xxx`,`subSchema..`,l),l?Array.isArray(l.allOf)?[l,...l.allOf.map(t=>a4(t,e))]:Array.isArray(l.oneOf)?[l,...l.oneOf.map(t=>a4(t,e))]:Array.isArray(l.anyOf)?[l,...l.anyOf.map(t=>a4(t,e))]:[l]:[])}getAppliedValue(e){let t=vq(JSON.stringify(e));switch(this.mode){case fq.JSON5:return{label:t,apply:iRe(JSON.stringify(e))};case fq.YAML:return{label:t,apply:t};default:return{label:t,apply:JSON.stringify(e)}}}getValueFromLabel(e){return JSON.parse(e)}extendedRegExp(e){let t=``;e.startsWith(`(?i)`)&&(e=e.substring(4),t=`i`);try{return new RegExp(e,t+`u`)}catch{try{return new RegExp(e,t)}catch{return}}}};function wqe(e={}){let t=new Cqe(e);return function(e){return t.doComplete(e)}}function Tqe(e){return t4(e,(e,t)=>e===`additionalProperties`&&t===!1||e===`required`&&Array.isArray(t)||e===`unevaluatedProperties`&&t===!1||e===`unevaluatedItems`&&t===!1?[]:[e,t])}function r4(e,t,n){let r=new FY(e),i=r.getSchema({pointer:n,data:t??void 0});if(!n4(i))return;let a=i4(r,i),o={};for(let e of a){let i=Dqe(n,e),a=r.getSchema({pointer:i,data:t??void 0});n4(a)&&Object.assign(o,{[e]:a})}if(a.length===0||Object.keys(o).length===0)return;let s=i,{allOf:c,anyOf:l,oneOf:u}=s,d=xqe(s,[`allOf`,`anyOf`,`oneOf`]);return Object.assign(Object.assign({},d),{properties:o})}function i4(e,t){if(t=a4(t,e.rootSchema),typeof t!=`object`||!t)return[];let n=[];function r(t){let r=i4(e,t);n.push(...r)}if(typeof t.properties==`object`&&t.properties!=null&&n.push(...Object.keys(t.properties)),typeof t.then==`object`&&t.then!=null&&r(t.then),Array.isArray(t.allOf))for(let e of t.allOf)r(e);if(Array.isArray(t.anyOf))for(let e of t.anyOf)r(e);if(Array.isArray(t.oneOf))for(let e of t.oneOf)r(e);return n}function a4(e,t){if(typeof e==`object`&&e.$ref){let n=Eqe(t,e.$ref);if(typeof n==`object`){let t=Object.assign(Object.assign({},e),n);return Reflect.deleteProperty(t,`$ref`),t}}return e}function Eqe(e,t){let n=t.split(`/`),r=e;return n.forEach(t=>{if(t){if(t===`#`){r=e;return}typeof r==`object`&&(r=r[t])}}),r}function Dqe(e,t){return e===void 0?`/${t}`:`${e}/${t}`}var o4=(e,t)=>{let n=e.length>2,r=e.map((n,r)=>{let i="`"+(t?t(n):n)+"`";return r===e.length-1?`or `+i:i});return n?r.join(`, `):r.join(` `)},Oqe=e=>e?.data?.pointer&&e?.data?.pointer!==`#`?e.data.pointer.slice(1):e?.data?.property?`/${e.data.property}`:``,kqe=e=>e.startState.field(Oq)!==e.state.field(Oq);function Aqe(e){let t=new Mqe(e);return e=>t.doValidation(e)}var jqe=[`NoAdditionalPropertiesError`,`RequiredPropertyError`,`InvalidPropertyNameError`,`ForbiddenPropertyError`,`UndefinedValueError`],Mqe=class{constructor(e){this.options=e,this.schema=null,this.mode=fq.JSON,this.rewriteError=e=>{let t=e?.data?.errors;return e.code===`one-of-error`&&t?.length?`Expected one of ${o4(t,e=>e.data.expected)}`:e.code===`type-error`?`Expected \`${e?.data?.expected&&Array.isArray(e?.data?.expected)?o4(e?.data?.expected):e?.data?.expected}\` but received \`${e?.data?.received}\``:e.message.replaceAll("in `#` ",``).replaceAll("at `#`",``).replaceAll(`/`,`.`).replaceAll(`#.`,``)},this.mode=this.options?.mode??fq.JSON,this.parser=this.options?.jsonParser??e4(this.mode)}get schemaTitle(){return this.schema?.getSchema()?.title??`json-schema`}doValidation(e){let t=kq(e.state);if(!t||(this.schema=new jY(t),!this.schema)||!e.state.doc.toString()?.length)return[];let n=this.parser(e.state);if(n.data==null)return[];let r=[];try{r=this.schema.validate(n.data)}catch{}return cq.log(`xxx`,`validation errors`,r,n.data),r.length?r.reduce((e,t)=>{let r=()=>{let n=this.rewriteError(t);e.push({from:0,to:0,message:n,severity:`error`,source:this.schemaTitle,renderMessage:()=>{let e=IY(`div`,{});return e.innerHTML=t1(n),e}})},i=Oqe(t),a=n.pointers.get(i);if(t.name===`MaxPropertiesError`||t.name===`MinPropertiesError`||i===``)r();else if(a){let n=jqe.includes(t.name),r=this.rewriteError(t),i=n?a.keyFrom:a.valueFrom,o=n?a.keyTo:a.valueTo;o!==void 0&&i!==void 0&&e.push({from:i,to:o,message:r,renderMessage:()=>{let e=IY(`div`,{});return e.innerHTML=t1(r),e},severity:`error`,source:this.schemaTitle})}else r();return e},[]):[]}};function Nqe(e){let t=new Fqe(e);return async function(e,n,r){return t.doHover(e,n,r)}}function Pqe(e){if(e.type)return e.$ref?`${e.$ref} (${e.type})`:e.type;if(e.$ref)return`${e.$ref}`}function s4(e,t,n){return`${t}: ${o4(e[t].map(e=>{try{let{data:t}=n.resolveRef({data:e,pointer:e.$ref});return Pqe(t||e)}catch{return e.type}}))}`}var Fqe=class{constructor(e){this.opts=e,this.schema=null,this.mode=fq.JSON,this.opts=Object.assign({parser:JSON.parse},this.opts),this.mode=this.opts?.mode??fq.JSON}getDataForCursor(e,t,n){let r=kq(e.state);if(!r)return null;this.schema=new jY(r);let i=hq(e.state,t,n,this.mode),a;try{a=this.opts.parser(e.state.doc.toString())}catch{}if(!i)return null;let o=this.schema.getSchema({pointer:i,data:a,withSchemaWarning:!0});return Fq(o)&&(o=o?.data.schema.$ref?this.schema.resolveRef(o):o?.data.schema),{schema:o,pointer:i}}formatMessage(e){let{message:t,typeInfo:n}=e;return t?IY(`div`,{class:`cm6-json-schema-hover`},[IY(`div`,{class:`cm6-json-schema-hover--description`,inner:t1(t,!1)}),IY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[IY(`div`,{class:`cm6-json-schema-hover--code`,inner:t1(n,!1)})])]):IY(`div`,{class:`cm6-json-schema-hover`},[IY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[IY(`code`,{class:`cm6-json-schema-hover--code`,inner:t1(n,!1)})])])}getHoverTexts(e,t){let n=``,r=null,{schema:i}=e;return i.oneOf&&(n=s4(i,`oneOf`,t)),i.anyOf&&(n=s4(i,`anyOf`,t)),i.allOf&&(n=s4(i,`allOf`,t)),i.type&&(n=Array.isArray(i.type)?o4(i.type):i.type),i.$ref&&(n=` Reference: ${i.$ref}`),i.enum&&(n=`\`enum\`: ${o4(i.enum)}`),i.format&&(n+=`\`format\`: ${i.format}`),i.pattern&&(n+=`\`pattern\`: ${i.pattern}`),i.description&&(r=i.description),{message:r,typeInfo:n}}async doHover(e,t,n){let r=t,i=t;try{let a=this.getDataForCursor(e,t,n);if(cq.log(`cursorData`,a),!a?.schema)return null;let o=(this.opts?.getHoverTexts??this.getHoverTexts)(a,this.schema),s=(this.opts?.formatHover??this.formatMessage)(o);return{pos:r,end:i,arrow:!0,above:!0,create:e=>({dom:s})}}catch(e){return cq.log(e),null}}},Iqe=e=>(0,G.jsx)($v,{disablePadding:!0,children:e.validationErrors.map((e,t)=>(0,G.jsx)(ny,{disableGutters:!0,disablePadding:!0,children:(0,G.jsxs)(Hv,{direction:`row`,spacing:1,children:[(0,G.jsx)(Q,{variant:`body2`,children:`•`}),(0,G.jsx)(Q,{variant:`caption`,children:e.instancePath.length===0?`/`:e.instancePath}),(0,G.jsx)(Q,{variant:`body2`,children:e.message})]})},t.toString()))}),c4=e=>{let t;try{t=JSON.parse(e)}catch{t=void 0}return t};function Lqe({schema:e,customValidate:t}){let n=(0,C.useMemo)(()=>new cF.default({allErrors:!0}),[]);return(0,C.useCallback)(r=>{let i=[];return n.validate(e,r),i.push(...n.errors??[]),i.push(...t?.(r)??[]),i},[n,e,t])}var Rqe=e=>{let t=zqe(),[n,r]=(0,C.useState)(()=>JSON.stringify(e.value,null,2)),i=Lqe(e),[a,o]=(0,C.useState)([]);(0,C.useEffect)(()=>{o(i(e.value))},[i,e.value]);let s=e.onChange,c=(0,C.useCallback)(e=>{let t=c4(e),n=i(t);s(t,n.length===0),r(e),o(n)},[i,s]),l=()=>{let e=c4(n);e&&r(JSON.stringify(e,null,2))};return(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Z,{position:`relative`,children:[(0,G.jsx)(oq,{value:n,onChange:e=>c(e),extensions:[MPe(),tW(APe(),{delay:100}),tW(Aqe(),{delay:100,needsRefresh:kqe}),UU.data.of({autocomplete:wqe({mode:`json4`})}),DH(Nqe()),lRe(e.schema)],theme:t,height:`400px`}),(0,G.jsx)(mv,{sx:{position:`absolute`,right:`0`,bottom:`0`},onClick:()=>l(),children:`Prettify`})]}),a.length>0&&(0,G.jsx)(Uh,{severity:`error`,variant:`outlined`,children:(0,G.jsx)(Iqe,{validationErrors:a})})]})};function zqe(){return wm().palette.mode===`dark`?eFe:XPe}var Bqe=[{value:``,label:`Auto (based on domain/name)`},{value:`light`,label:`💡 Light`},{value:`switch`,label:`🔌 Switch`},{value:`climate`,label:`🌡️ Climate`},{value:`cover`,label:`🪟 Cover`},{value:`fan`,label:`🌀 Fan`},{value:`lock`,label:`🔒 Lock`},{value:`sensor`,label:`📊 Sensor`},{value:`media_player`,label:`📺 Media Player`},{value:`vacuum`,label:`🧹 Vacuum`},{value:`remote`,label:`🎮 Remote`},{value:`humidifier`,label:`💧 Humidifier`},{value:`speaker`,label:`🔊 Speaker`},{value:`garage`,label:`🚗 Garage`},{value:`door`,label:`🚪 Door`},{value:`window`,label:`🪟 Window`},{value:`motion`,label:`🏃 Motion`},{value:`battery`,label:`🔋 Battery`},{value:`power`,label:`⚡ Power`},{value:`camera`,label:`📷 Camera`},{value:`default`,label:`🔗 Default`}],Vqe=({bridgeId:e,selectedIcon:t,onIconChange:n})=>{let r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null);(0,C.useEffect)(()=>{e&&wE(e).then(t=>{a(t),t&&s(`${TE(e)}?t=${Date.now()}`)}).catch(()=>{a(!1)})},[e]);let f=(0,C.useCallback)(async t=>{let i=t.target.files?.[0];if(!(!i||!e)){d(null),l(!0);try{await kge(e,i),a(!0),s(`${TE(e)}?t=${Date.now()}`),n(void 0)}catch(e){d(e instanceof Error?e.message:`Upload failed`)}finally{l(!1),r.current&&(r.current.value=``)}}},[e,n]),p=(0,C.useCallback)(async()=>{if(e){d(null);try{await Age(e),a(!1),s(null)}catch(e){d(e instanceof Error?e.message:`Delete failed`)}}},[e]),m=(0,C.useCallback)(e=>{n(e===``?void 0:e)},[n]);return(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(kv,{fullWidth:!0,size:`small`,children:[(0,G.jsx)(Bx,{id:`icon-select-label`,children:`Bridge Icon`}),(0,G.jsx)(SS,{labelId:`icon-select-label`,value:t??``,label:`Bridge Icon`,onChange:e=>m(e.target.value),disabled:i,children:Bqe.map(e=>(0,G.jsx)(CS,{value:e.value,children:e.label},e.value))}),(0,G.jsx)(TS,{children:i?`Custom icon is set. Delete it to use preset icons.`:`Select a preset icon or upload a custom image`})]}),e&&(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,gutterBottom:!0,children:`Custom Icon`}),(0,G.jsxs)(Hv,{direction:`row`,spacing:2,alignItems:`center`,children:[i&&o&&(0,G.jsx)(Z,{component:`img`,src:o,alt:`Custom bridge icon`,sx:{width:48,height:48,objectFit:`contain`,borderRadius:1,border:`1px solid`,borderColor:`divider`}}),(0,G.jsx)(`input`,{ref:r,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml`,style:{display:`none`},onChange:f}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(Uhe,{}),onClick:()=>r.current?.click(),disabled:c,children:c?`Uploading...`:`Upload Image`}),i&&(0,G.jsx)(mv,{variant:`outlined`,size:`small`,color:`error`,startIcon:(0,G.jsx)(LS,{}),onClick:p,children:`Delete`})]}),u&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:1},children:u}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,display:`block`},children:`Supported formats: PNG, JPG, GIF, WebP, SVG (max 5MB)`})]}),!e&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:`Save the bridge first to upload a custom icon.`})]})},l4={light:`Light`,switch:`On/Off Plug-in Unit`,lock:`Door Lock`,fan:`Fan`,binary_sensor:`Sensor`,sensor:`Sensor`,cover:`Window Covering`,climate:`Thermostat`,media_player:`Speaker / Video Player`,vacuum:`Robot Vacuum Cleaner`,humidifier:`Humidifier`,valve:`Water Valve`,alarm_control_panel:`On/Off Plug-in Unit`,event:`Generic Switch`,button:`Generic Switch`,input_button:`Generic Switch`,automation:`On/Off Switch`,script:`On/Off Switch`,scene:`On/Off Switch`,remote:`On/Off`,water_heater:`Water Heater`,input_boolean:`On/Off Plug-in Unit`,select:`Mode Select`,input_select:`Mode Select`,siren:`On/Off Plug-in Unit`,weather:`Sensor`},u4=e=>{try{return JSON.parse(e)}catch{return}};function Hqe({filter:e}){let[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(``),d=(0,C.useCallback)(async()=>{n(!0),o(null);try{let t=await fetch(`api/matter/filter-preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.text(),r=u4(n);if(!t.ok){let e=typeof r==`object`&&r&&`error`in r?String(r.error):n||`Failed to fetch preview`;throw Error(e)}i(r??u4(n)),c(!0)}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},[e]);(0,C.useEffect)(()=>{if(!(e.include.length>0&&e.include.some(e=>e.type&&e.value))){i(null),c(!1);return}let t=JSON.stringify(e);if(t!==u.current)return u.current=t,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{d()},800),()=>{l.current&&clearTimeout(l.current)}},[e,d]);let f=r?r.entities.reduce((e,t)=>(e[t.domain]=(e[t.domain]||0)+1,e),{}):{},p=[];if(r){r.entities.some(e=>e.domain===`vacuum`)&&p.push(`This filter includes a vacuum. Consider using Server Mode (standalone device node) for Apple Home/Alexa compatibility.`),r.total>50&&p.push(`${r.total} entities is a large number. Consider splitting across multiple bridges for better stability.`);let e=Object.keys(f).filter(e=>!l4[e]);e.length>0&&p.push(`Unsupported domains will be skipped: ${e.join(`, `)}`)}return(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(mv,{variant:`outlined`,startIcon:t?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(uge,{}),onClick:d,disabled:t,size:`small`,children:t?`Loading...`:`Preview Matching Entities`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mt:1},children:a}),(0,G.jsx)(Zv,{in:s&&r!==null,children:r&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsxs)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:[r.total,` entities match`]}),r.truncated&&(0,G.jsx)(Ev,{label:`Showing first 100`,size:`small`,color:`warning`,variant:`outlined`})]}),p.length>0&&(0,G.jsx)(Hv,{spacing:.5,sx:{mb:1.5},children:p.map(e=>(0,G.jsx)(Uh,{severity:`warning`,variant:`outlined`,icon:e.includes(`vacuum`)?(0,G.jsx)(uv,{fontSize:`small`}):(0,G.jsx)(Sb,{fontSize:`small`}),sx:{py:0},children:(0,G.jsx)(Q,{variant:`caption`,children:e})},e))}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mb:2,children:Object.entries(f).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,G.jsx)(Ev,{label:`${e}: ${t}${l4[e]?` → ${l4[e]}`:``}`,size:`small`,variant:`outlined`,color:l4[e]?`default`:`warning`},e))}),(0,G.jsx)($v,{dense:!0,sx:{maxHeight:200,overflow:`auto`,bgcolor:`background.paper`,borderRadius:1,border:1,borderColor:`divider`},children:r.entities.map(e=>(0,G.jsx)(ny,{divider:!0,children:(0,G.jsx)(oy,{primary:e.friendly_name||e.entity_id,secondary:`${e.entity_id}${l4[e.domain]?` → ${l4[e.domain]}`:``}`,primaryTypographyProps:{variant:`body2`},secondaryTypographyProps:{variant:`caption`,fontFamily:`monospace`}})},e.entity_id))}),(0,G.jsx)(mv,{size:`small`,onClick:()=>c(!1),sx:{mt:1},children:`Hide Preview`})]})})]})}var Uqe=hF().ObjectFieldTemplate;function Wqe(e){return(e.fieldPathId?.$id??``)===`root_filter`?(0,G.jsx)(Gqe,{...e}):(0,G.jsx)(Uqe,{...e})}function Gqe(e){let t=(e.formData?.include?.length??0)+(e.formData?.exclude?.length??0),[n,r]=(0,C.useState)(t>0);return(0,G.jsxs)(iC,{expanded:n,onChange:(e,t)=>r(t),variant:`outlined`,disableGutters:!0,sx:{borderRadius:2,"&::before":{display:`none`},overflow:`hidden`},children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),sx:{px:2,"& .MuiAccordionSummary-content":{alignItems:`center`,gap:1.5}},children:[(0,G.jsx)(_b,{fontSize:`small`,color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,children:`Entity Filters`}),(0,G.jsx)(Lx,{badgeContent:t,color:`primary`,sx:{ml:1},max:99,children:(0,G.jsx)(Z,{})}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{ml:1},children:n?`Click to collapse`:`${t} rule${t===1?``:`s`} configured`})]}),(0,G.jsx)(aC,{sx:{px:2,pb:2},children:e.properties.map(e=>(0,G.jsx)(`div`,{children:e.content},e.name))})]})}function Kqe(e){let t=(0,C.useRef)(e),n=t.current;return t.current=e,n}function d4(e){let{items:t,canAdd:n,onAddClick:r,title:i,formData:a}=e,o=a??[],[s,c]=(0,C.useState)(()=>new Set),[l,u]=(0,C.useState)(``),d=Kqe(o.length);(0,C.useEffect)(()=>{if(o.length>d){let e=o.length-1,t=o[e];!t?.type&&!t?.value&&c(t=>new Set([...t,e]))}},[o,d]);let f=(0,C.useCallback)(e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),p=(0,C.useMemo)(()=>{if(!l.trim())return null;let e=l.toLowerCase(),t=[];for(let n=0;n<o.length;n++){let r=o[n],i=r?.type??``,a=r?.value??``;(i.toLowerCase().includes(e)||a.toLowerCase().includes(e))&&t.push(n)}return new Set(t)},[l,o]),m=(0,C.useMemo)(()=>{let e=Array.from({length:t.length},(e,t)=>t);return p?e.filter(e=>p.has(e)):e},[t.length,p]);return(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,children:i}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Ev,{label:t.length,size:`small`,color:`default`,sx:{height:22,fontSize:`0.75rem`}}),n&&(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(fb,{}),onClick:r,children:`Add`})]})]}),t.length>3&&(0,G.jsx)(ES,{size:`small`,fullWidth:!0,placeholder:`Search rules...`,value:l,onChange:e=>u(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(fF,{position:`start`,children:(0,G.jsx)(hE,{fontSize:`small`,color:`action`})})}},sx:{mb:1}}),p&&m.length===0&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,py:2,children:`No matching rules`}),(0,G.jsx)(Hv,{spacing:.5,children:m.map(e=>{let n=o[e],r=n?.type??``,i=n?.value??``,a=s.has(e);return(0,G.jsxs)(Z,{sx:{border:1,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,sx:{px:1.5,py:.75,cursor:`pointer`,"&:hover":{bgcolor:`action.hover`},bgcolor:a?`action.selected`:`transparent`},onClick:()=>f(e),children:[a?(0,G.jsx)(jhe,{fontSize:`small`,color:`action`}):(0,G.jsx)(Nhe,{fontSize:`small`,color:`action`}),r||i?(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,ml:.5,flex:1,minWidth:0,children:[(0,G.jsx)(Ev,{label:r,size:`small`,variant:`outlined`,sx:{height:22,fontSize:`0.75rem`,flexShrink:0}}),(0,G.jsx)(Q,{variant:`body2`,noWrap:!0,sx:{flex:1,minWidth:0},children:i})]}):(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,ml:.5,fontStyle:`italic`,children:`New rule (click to configure)`})]}),(0,G.jsx)(Zv,{in:a,children:(0,G.jsx)(Z,{sx:{px:2,pb:1.5,pt:.5},children:t[e]})})]},e)})})]})}var qqe=new Set([``,`pattern`,`regex`]);function Jqe(e){let{schema:t,formData:n,onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=n??{},c=s.type??``,l=s.value??``,u=i||a,d=t.properties??{},f=(d.type?.oneOf??[]).filter(e=>typeof e.const==`string`),p=d.value?.title??`Value`,m=f.find(e=>e.const===c),h=(0,C.useCallback)(e=>r({...s,type:e},o.path),[s,r,o]),g=(0,C.useCallback)(e=>r({...s,value:e},o.path),[s,r,o]),_=qqe.has(c)&&!u;return(0,G.jsxs)(Hv,{spacing:2,sx:{pt:1},children:[(0,G.jsxs)(kv,{fullWidth:!0,size:`small`,disabled:u,children:[(0,G.jsx)(Bx,{id:`${o.path}-type`,children:`Type`}),(0,G.jsx)(SS,{labelId:`${o.path}-type`,label:`Type`,value:c,onChange:e=>h(e.target.value),children:f.map(e=>(0,G.jsx)(CS,{value:e.const,children:e.title??e.const},e.const))})]}),m?.description&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:m.description}),_?(0,G.jsx)(XS,{value:l,onChange:g,label:p,placeholder:`sensor.living_room_*`,helperText:`Search or type an entity ID. Wildcards and regex still work.`,margin:`none`}):(0,G.jsx)(ES,{fullWidth:!0,size:`small`,label:p,value:l,disabled:u,onChange:e=>g(e.target.value),helperText:d.value?.description})]})}function Yqe(e){let{schema:t,formData:n={},onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=t.properties??{},c=(0,C.useCallback)((e,t)=>{r({...n,[e]:t},o.path)},[n,r,o]);return(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:`Feature Flags`}),(0,G.jsx)(Fv,{container:!0,spacing:2,children:Object.entries(s).map(([e,t])=>{let r=n[e]??t.default??!1;return(0,G.jsx)(Fv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(hv,{variant:`outlined`,sx:{height:`100%`,opacity:t.title?.toLowerCase().includes(`deprecated`)??!1?.6:1,transition:`border-color 0.2s, box-shadow 0.2s`,borderColor:r?`primary.main`:`divider`,"&:hover":{transform:`none`,boxShadow:`none`}},children:(0,G.jsx)(_v,{onClick:()=>{!i&&!a&&c(e,!r)},disabled:i||a,sx:{height:`100%`},children:(0,G.jsxs)(vv,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:1,children:[(0,G.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,sx:{lineHeight:1.3},children:t.title??e}),r&&(0,G.jsx)(Ev,{label:`Active`,size:`small`,color:`primary`,variant:`outlined`,sx:{mt:.5,height:20,fontSize:`0.7rem`}})]}),(0,G.jsx)(KS,{checked:r,size:`small`,disabled:i||a,tabIndex:-1,onClick:e=>e.stopPropagation(),onChange:t=>c(e,t.target.checked)})]}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,lineHeight:1.4,flex:1},children:t.description})]})})})},e)})})]})}var f4=e=>{let{t}=ws(),[n,r]=(0,C.useState)(`FIELDS_EDITOR`),i=()=>{r(n===`FIELDS_EDITOR`?`JSON_EDITOR`:`FIELDS_EDITOR`)},[a,o]=(0,C.useState)(e.bridge),[s,c]=(0,C.useState)(!0),l=(0,C.useCallback)(t=>{let n=t;if(!n?.port)return[];let r=e.usedPorts[n.port];return r!==void 0&&r!==e.bridgeId?[{instancePath:`/port`,message:`Port is already used by bridge with id ${r}`}]:[]},[e.bridgeId,e.usedPorts]),u=(e,t)=>{let n=e=>e?.icon;o(t=>{let r=n(t);return r==null?{...e}:{...e,icon:r}}),c(t)},d=(0,C.useCallback)(e=>{o(t=>{if(e!=null)return{...t,icon:e};let{icon:n,...r}=t??{};return r})},[]),f=(0,C.useMemo)(()=>{let e=a?.featureFlags,t=[];return e?.serverMode&&t.push({severity:`warning`,message:`Server Mode is enabled. The node carries up to 10 devices; the first entity is the primary and drives the node name and type. More than one device is experimental.`}),e?.serverMode&&e?.vacuumOnOff===!1&&t.push({severity:`warning`,message:`Server Mode with Vacuum OnOff disabled: Alexa REQUIRES the OnOff cluster (PowerController) for robotic vacuums. Without it, the vacuum commissions but never appears in Alexa. Only disable this for Apple Home.`}),!e?.serverMode&&e?.vacuumOnOff&&t.push({severity:`warning`,message:`Vacuum OnOff is enabled in bridge mode. This adds a non-standard cluster to the RVC device type which may cause issues with Apple Home and Google Home.`}),e?.autoForceSync&&e?.autoComposedDevices&&t.push({severity:`warning`,message:`Auto Force Sync with Auto Composed Devices increases network traffic. Composed devices have more clusters, so each sync cycle sends more data.`}),t},[a]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Uh,{severity:`warning`,variant:`outlined`,children:[`Please consult`,` `,(0,G.jsx)(Gv,{href:J9.faq.bridgeConfig,target:`_blank`,children:`the documentation`}),` `,`for proper bridge configurations.`,` `,(0,G.jsx)(`strong`,{children:`Especially if you are using labels, see the "Labels" section.`})]}),(0,G.jsxs)(Uh,{severity:`info`,variant:`outlined`,children:[(0,G.jsx)(`strong`,{children:`Community tip:`}),` Users have reported that bridges with a large number of devices can become unstable depending on the controller. If you experience connectivity issues, consider splitting your devices across multiple bridges.`]}),f.map(e=>(0,G.jsx)(Uh,{severity:e.severity,variant:`outlined`,children:e.message},e.message)),(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(mv,{onClick:()=>i(),title:t(n===`FIELDS_EDITOR`?`bridge.jsonEditor`:`bridge.formEditor`),children:n===`FIELDS_EDITOR`?(0,G.jsx)(hge,{}):(0,G.jsx)(rge,{})})}),n===`FIELDS_EDITOR`&&(0,G.jsx)(qke,{value:a??{},onChange:u,schema:sv,uiSchema:{icon:{"ui:widget":`hidden`},featureFlags:{"ui:field":`featureFlags`},filter:{include:{"ui:options":{ArrayFieldTemplate:d4},items:{"ui:field":`entityFilterRule`}},exclude:{"ui:options":{ArrayFieldTemplate:d4},items:{"ui:field":`entityFilterRule`}}}},customValidate:l,templates:{ObjectFieldTemplate:Wqe},fields:{featureFlags:Yqe,entityFilterRule:Jqe}}),n===`JSON_EDITOR`&&(0,G.jsx)(Rqe,{value:a??{},onChange:u,schema:sv,customValidate:l}),a?.filter&&(0,G.jsx)(Hqe,{filter:a.filter}),(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsxs)(vv,{children:[(0,G.jsx)(Q,{variant:`subtitle1`,gutterBottom:!0,fontWeight:600,children:t(`bridge.iconLabel`)}),(0,G.jsx)(Vqe,{bridgeId:e.bridgeId,selectedIcon:a?.icon,onIconChange:d})]})}),(0,G.jsxs)(Fv,{container:!0,children:[(0,G.jsx)(Fv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(mv,{fullWidth:!0,variant:`outlined`,color:`error`,onClick:e.onCancel,children:t(`common.cancel`)})}),(0,G.jsx)(Fv,{size:{xs:0,sm:4,md:6},sx:{display:{xs:`none`,sm:`block`}}}),(0,G.jsx)(Fv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(mv,{fullWidth:!0,variant:`outlined`,disabled:!s,onClick:async()=>{s&&await e.onSave(a)},children:t(`common.save`)})})]})]})]})},Xqe={name:``,featureFlags:{},filter:{include:[],exclude:[]}};function Zqe(e){let t=5540;for(;e[t];)t++;return t}var Qqe=()=>{let{t:e}=ws(),t=qv(),n=Nr(),[r,i]=(0,C.useState)(),a=!!RT().content?.length,o=zT(),s=(0,C.useCallback)(e=>{i(e?.id)},[]),c=(0,C.useMemo)(()=>{if(!o)return;let e=Zqe(o);if(r){let t=ev.find(e=>e.id===r);if(t)return{name:t.name,port:e,filter:{...t.filter},featureFlags:{...t.featureFlags},icon:t.icon}}return{...Xqe,port:e}},[o,r]),l=VT(),u=()=>{n(-1)};return!c||!o?e(`common.loading`):(0,G.jsxs)(Hv,{spacing:4,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:e(`common.create`),to:J9.createBridge}]}),a&&(0,G.jsx)(Uh,{severity:`info`,variant:`outlined`,children:(0,G.jsxs)(Q,{children:[`Did you know that you can connect the same bridge with multiple assistants?`,` `,(0,G.jsx)(Gv,{href:J9.faq.multiFabric,target:`_blank`,children:`Learn more.`})]})}),(0,G.jsx)(zE,{selectedTemplate:r,onSelect:s}),(0,G.jsx)(f4,{bridge:c,usedPorts:o,onSave:async n=>{await l({...n}).then(()=>t.show({message:e(`bridge.saveSuccess`),severity:`success`})).then(()=>u()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:u},r??`custom`)]})},$qe=()=>{let{t:e}=ws(),t=qv(),n=Nr(),{bridgeId:r}=Lr(),{content:i,isLoading:a}=BT(r),o=zT(),s=lhe(),c=(0,C.useMemo)(()=>{if(!(a||!i))return{name:i.name,port:i.port,filter:i.filter,...i.countryCode!=null&&{countryCode:i.countryCode},...i.featureFlags!=null&&{featureFlags:i.featureFlags},...i.icon!=null&&{icon:i.icon},...i.priority!=null&&{priority:i.priority},...i.serialNumberSuffix!=null&&{serialNumberSuffix:i.serialNumberSuffix}}},[a,i]),l=()=>{n(-1)};return a||!o?e(`common.loading`):!i||!c?e(`notFound.title`):(0,G.jsxs)(Hv,{spacing:4,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:i.name,to:J9.bridge(r)},{name:e(`common.edit`),to:J9.editBridge(r)}]}),(0,G.jsx)(f4,{bridgeId:r,bridge:c,usedPorts:o,onSave:async n=>{await s({...n,id:r}).then(()=>t.show({message:e(`bridge.updateSuccess`),severity:`success`})).then(()=>l()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:l})]})};async function eJe(){let e=await fetch(`api/backup/snapshots`);return await M_(e,`Failed to fetch backups`),j_(e)}async function tJe(){let e=await fetch(`api/backup/snapshots/create`,{method:`POST`});return await M_(e,`Failed to create backup`),j_(e)}async function nJe(e){let t=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/download`);if(!t.ok)throw Error(`Failed to download backup`);let n=await t.blob(),r=window.URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i)}async function rJe(e,t){let n=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({overwriteExisting:!0,includeMappings:!0,restoreIdentity:!0,...t})});return await M_(n,`Failed to restore backup`),j_(n)}async function iJe(e){await M_(await fetch(`api/backup/snapshots/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete backup`)}async function aJe(){let e=await fetch(`api/backup/settings`);return await M_(e,`Failed to fetch backup settings`),j_(e)}async function oJe(e){let t=await fetch(`api/backup/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to update backup settings`),j_(t)}function sJe(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function p4(){let{t:e}=ws(),[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(new Set),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(!0),[h,g]=(0,C.useState)(!0),[_,v]=(0,C.useState)(!1),[y,b]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),w=(0,C.useRef)(null),[T,E]=(0,C.useState)([]),[D,O]=(0,C.useState)(!0),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),L=(0,C.useCallback)(async()=>{try{O(!0);let[e,t]=await Promise.all([eJe(),aJe()]);E(e),A(t)}catch(e){i(e instanceof Error?e.message:`Failed to load backups`)}finally{O(!1)}},[]);(0,C.useEffect)(()=>{L()},[L]);let R=async()=>{I(!0),i(null);try{await tJe(),o(e(`backup.snapshotCreated`)),await L()}catch(e){i(e instanceof Error?e.message:`Failed to create backup`)}finally{I(!1)}},ee=async e=>{try{await nJe(e)}catch(e){i(e instanceof Error?e.message:`Failed to download backup`)}},z=async t=>{n(!0),i(null);try{let n=await rJe(t);n.errors.length>0?i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`):o(e(`backup.snapshotRestored`,{bridges:n.bridgesRestored,mappings:n.mappingsRestored,identities:n.identitiesRestored})),M(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Failed to restore backup`)}finally{n(!1)}},te=async e=>{try{await iJe(e),P(null),await L()}catch(e){i(e instanceof Error?e.message:`Failed to delete backup`)}},B=async e=>{try{A(await oJe(e))}catch(e){i(e instanceof Error?e.message:`Failed to update settings`)}},V=async(t=!1)=>{n(!0),i(null);try{let n=await fetch(t?`api/backup/download?includeIdentity=true`:`api/backup/download`);if(!n.ok)throw Error(`Failed to create backup`);let r=await n.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]||`hamh-backup.zip`,document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(i),document.body.removeChild(a),o(e(`backup.downloadSuccess`))}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},ne=async e=>{let t=e.target.files?.[0];if(t){S(t),n(!0),i(null);try{let e=new FormData;e.append(`file`,t);let n=await fetch(`api/backup/restore/preview`,{method:`POST`,body:e});if(!n.ok){let e=await n.text(),t=`Failed to parse backup`;try{let n=JSON.parse(e);n.error&&(t=n.error)}catch{e&&(t=`${t} (HTTP ${n.status}: ${e.slice(0,120)})`)}throw Error(t)}let r=await n.json();c(r),u(new Set(r.bridges.map(e=>e.id))),v(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1),w.current&&(w.current.value=``)}}},re=async()=>{if(x){n(!0),i(null);try{let e=new FormData;e.append(`file`,x),e.append(`options`,JSON.stringify({bridgeIds:Array.from(l),overwriteExisting:d,includeMappings:p,restoreIdentity:h&&s?.includesIdentity}));let t=await fetch(`api/backup/restore`,{method:`POST`,body:e});if(!t.ok){let e=await t.text(),n=`Failed to restore backup`;try{let t=JSON.parse(e);t.error&&(n=t.error)}catch{e&&(n=`${n} (HTTP ${t.status}: ${e.slice(0,120)})`)}throw Error(n)}let n=await t.json();if(n.errors.length>0)i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`);else{let e=[`Restored ${n.bridgesRestored} bridges`];n.mappingsRestored>0&&e.push(`${n.mappingsRestored} entity mappings`),n.identitiesRestored>0&&e.push(`${n.identitiesRestored} identities`),o(`${e.join(`, `)}!`)}v(!1),c(null),S(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}}},ie=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)};return(0,G.jsxs)(hv,{children:[(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,children:[(0,G.jsx)(YT,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.title`)]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`backup.description`)}),r&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},onClose:()=>i(null),children:r}),a&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,G.jsxs)(Fv,{container:!0,spacing:2,children:[(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(YT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.configBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupNote`)})]}),(0,G.jsx)(mv,{variant:`contained`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(YT,{}),onClick:()=>V(!1),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.configBackup`)})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(gE,{color:`warning`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.fullBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupWarning`)})]}),(0,G.jsx)(mv,{variant:`contained`,color:`warning`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(YT,{}),onClick:()=>V(!0),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.fullBackup`)})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(pE,{color:`info`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.restoreFromBackup`)})]}),(0,G.jsx)(Z,{sx:{flexGrow:1},children:(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.restoreDesc`)})}),(0,G.jsxs)(mv,{variant:`outlined`,color:`info`,startIcon:(0,G.jsx)(pE,{}),component:`label`,disabled:t,fullWidth:!0,sx:{mt:2},children:[e(`backup.restoreFromBackup`),(0,G.jsx)(`input`,{ref:w,type:`file`,accept:`.zip`,hidden:!0,onChange:ne})]})]})})]}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(YT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.storedBackups`)}),T.length>0&&(0,G.jsx)(Ev,{label:T.length,size:`small`,color:`primary`,variant:`outlined`})]}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:F?(0,G.jsx)(Rh,{size:16,color:`inherit`}):(0,G.jsx)(fb,{}),onClick:R,disabled:F,children:e(`backup.createSnapshot`)})]}),D?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:2,children:(0,G.jsx)(Rh,{size:24})}):T.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:2},children:e(`backup.noSnapshots`)}):(0,G.jsx)($v,{dense:!0,children:T.map(t=>(0,G.jsxs)(ny,{secondaryAction:(0,G.jsxs)(Z,{display:`flex`,gap:.5,children:[(0,G.jsx)(db,{title:e(`backup.downloadSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>ee(t.filename),children:(0,G.jsx)(PT,{fontSize:`small`})})}),(0,G.jsx)(db,{title:e(`backup.restoreSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,color:`warning`,onClick:()=>M(t.filename),children:(0,G.jsx)(pE,{fontSize:`small`})})}),(0,G.jsx)(db,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>P(t.filename),children:(0,G.jsx)(LS,{fontSize:`small`})})})]}),children:[(0,G.jsx)(iy,{sx:{minWidth:36},children:(0,G.jsx)(YT,{fontSize:`small`,color:t.auto?`action`:`primary`})}),(0,G.jsx)(oy,{primary:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`v`,t.version]}),(0,G.jsx)(Ev,{label:t.auto?e(`backup.auto`):e(`backup.manual`),size:`small`,variant:`outlined`,color:t.auto?`default`:`primary`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:sJe(t.sizeBytes)})]}),secondary:new Date(t.createdAt).toLocaleString()})]},t.filename))}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(FT,{color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.settings`)})]}),k&&(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,maxWidth:400},children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:k.autoBackup,onChange:e=>B({autoBackup:e.target.checked})}),label:e(`backup.autoBackupLabel`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:-1},children:e(`backup.autoBackupDesc`)}),(0,G.jsx)(ES,{label:e(`backup.retentionCount`),type:`number`,size:`small`,value:k.backupRetentionCount,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=100&&B({backupRetentionCount:t})},inputProps:{min:1,max:100},helperText:e(`backup.retentionCountDesc`),sx:{maxWidth:200}})]})]}),(0,G.jsxs)(Rb,{open:_,onClose:()=>v(!1),maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:e(`backup.restoreTitle`)}),(0,G.jsx)(Bb,{children:s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,gutterBottom:!0,children:[`Backup created: `,new Date(s.createdAt).toLocaleString()]}),s.includesIdentity&&(0,G.jsx)(Uh,{severity:`info`,sx:{mt:1},children:`This backup includes Matter identity data (keypairs, fabric credentials). Restoring identities allows bridges to reconnect without re-commissioning.`}),(0,G.jsxs)(Q,{variant:`subtitle2`,sx:{mt:2,mb:1},children:[e(`backup.selectBridges`),`:`]}),(0,G.jsx)($v,{dense:!0,children:s.bridges.map(e=>(0,G.jsxs)(ny,{onClick:()=>ie(e.id),sx:{cursor:`pointer`},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(Cv,{edge:`start`,checked:l.has(e.id),tabIndex:-1,disableRipple:!0})}),(0,G.jsx)(oy,{primary:e.name,secondary:(0,G.jsxs)(G.Fragment,{children:[`Port: `,e.port,e.hasMappings&&` • ${e.mappingCount} entity mappings`,e.exists&&(0,G.jsx)(Q,{component:`span`,color:`warning.main`,sx:{ml:1},children:`(exists)`})]})})]},e.id))}),(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:d,onChange:e=>f(e.target.checked)}),label:e(`backup.overwriteExisting`)}),(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:p,onChange:e=>m(e.target.checked)}),label:e(`backup.includeMappings`)}),s?.includesIdentity&&(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:h,onChange:e=>g(e.target.checked)}),label:e(`backup.restoreIdentities`)})]})]})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>v(!1),children:e(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:re,disabled:t||l.size===0,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(Rb,{open:y,onClose:()=>b(!1),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(fE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.restartRequired`)]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Q,{children:e(`backup.restartMessage`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:e(`backup.restartNote`)})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>b(!1),children:e(`common.later`)}),(0,G.jsx)(mv,{variant:`contained`,color:`warning`,onClick:async()=>{n(!0);try{await fetch(`api/backup/restart`,{method:`POST`}),o(`Application is restarting...`)}catch(e){i(e instanceof Error?e.message:`Failed to restart`)}finally{n(!1),b(!1)}},disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(fE,{}),children:e(`backup.restartNow`)})]})]}),(0,G.jsxs)(Rb,{open:j!==null,onClose:()=>M(null),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(pE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmRestore`)]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Q,{children:e(`backup.confirmRestoreMessage`,{filename:j})}),(0,G.jsx)(Uh,{severity:`warning`,sx:{mt:2},children:e(`backup.restoreWarning`)})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>M(null),children:e(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,color:`warning`,onClick:()=>j&&z(j),disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(Rb,{open:N!==null,onClose:()=>P(null),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(LS,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmDelete`)]}),(0,G.jsx)(Bb,{children:(0,G.jsx)(Q,{children:e(`backup.confirmDeleteMessage`,{filename:N})})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>P(null),children:e(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,color:`error`,onClick:()=>N&&te(N),children:e(`common.delete`)})]})]})]})}function cJe(e,t){return e.map(e=>{let n=t.filter(t=>t.fabricIndex===e.fabricIndex),r=n.reduce((e,t)=>e+t.subscriptionCount,0),i=n.map(e=>e.lastActiveMsAgo).filter(e=>e!=null),a=i.length?Math.min(...i):null,o=r>0&&a!=null&&a>12e4;return{fabricIndex:e.fabricIndex,rootVendorId:e.rootVendorId,label:e.label,ecosystem:Wre(e.rootVendorId),connected:n.length>0,stale:o,subscriptions:r,sessions:n.length,lastActiveMsAgo:a}})}function lJe({fabrics:e,sessions:t}){let{t:n}=ws(),r=cJe(e,t);return r.length===0?null:(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1.5,children:[(0,G.jsx)(iE,{fontSize:`small`,color:`action`}),(0,G.jsx)(Q,{variant:`h6`,children:n(`health.fabricHealth`)})]}),(0,G.jsx)(Hv,{spacing:1,children:r.map(e=>{let t=e.connected?e.stale?{label:n(`health.stale`),color:`warning`}:{label:n(`health.connected`),color:`success`}:{label:n(`health.offline`),color:`default`};return(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1,children:[(0,G.jsx)(Ev,{size:`small`,color:t.color,label:t.label,sx:{minWidth:88}}),(0,G.jsxs)(Q,{variant:`body2`,sx:{fontWeight:600},children:[xx(e.rootVendorId),e.label?` (${e.label})`:``]}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[n(`health.subscriptions`),`: `,e.subscriptions,e.lastActiveMsAgo==null?``:` | ${n(`health.lastActiveAgo`,{seconds:Math.round(e.lastActiveMsAgo/1e3)})}`]})]},e.fabricIndex)})})]})})}var uJe=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function dJe(e={}){let{t}=ws(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(`name`),[u,d]=(0,C.useState)(`asc`),f=e.sortField??c,p=e.sortDirection??u,m=e.onSortFieldChange??l,h=e.onSortDirectionChange??d,g=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/health/detailed`);e.ok?(r(await e.json()),s(null)):s(t(`health.fetchFailed`))}catch{s(t(`health.connectionError`))}finally{a(!1)}},[t]);(0,C.useEffect)(()=>{g();let e=setInterval(g,1e4);return()=>clearInterval(e)},[g]);let _=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/diagnostic/export`);if(e.ok){let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`hamh-diagnostic-${new Date().toISOString().replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}catch{s(t(`health.exportFailed`))}},[t]),v=async e=>{try{await fetch(`api/matter/bridges/${e}/actions/restart`,{method:`POST`}),g()}catch{s(t(`health.restartFailed`))}};return i?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:4,children:(0,G.jsx)(Rh,{})}):o||!n?(0,G.jsx)(Uh,{severity:`error`,sx:{m:2},children:o??t(`health.unableToLoad`)}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[n.status===`healthy`?(0,G.jsx)(lv,{color:`success`}):n.status===`degraded`?(0,G.jsx)(Yv,{color:`warning`}):(0,G.jsx)(Cx,{color:`error`}),(0,G.jsx)(Q,{variant:`h5`,children:t(`health.systemHealth`)}),(0,G.jsx)(Ev,{label:n.status.toUpperCase(),color:n.status===`healthy`?`success`:n.status===`degraded`?`warning`:`error`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(XT,{}),onClick:_,children:t(`health.exportDiagnostic`)}),(0,G.jsx)(db,{title:t(`common.refresh`),children:(0,G.jsx)(Bh,{onClick:g,"aria-label":`Refresh health data`,children:(0,G.jsx)(dE,{})})})]})]}),(0,G.jsxs)(Fv,{container:!0,spacing:2,children:[(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.version`)}),(0,G.jsx)(Q,{variant:`h6`,children:n.version})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.uptime`)}),(0,G.jsx)(Q,{variant:`h6`,children:uJe(n.uptime)})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.homeAssistant`)}),(0,G.jsx)(Ev,{label:n.services.homeAssistant.connected?t(`health.connected`):t(`health.disconnected`),color:n.services.homeAssistant.connected?`success`:`error`,size:`small`})]})})]}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(sE,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.bridgeStatus`)}),(0,G.jsx)(Ev,{label:`${n.services.bridges.running}/${n.services.bridges.total} ${t(`common.running`)}`,size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Mx,{fontSize:`small`,color:`action`}),(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:120},children:[(0,G.jsx)(Bx,{children:t(`health.sortBy`)}),(0,G.jsxs)(SS,{value:f,label:t(`health.sortBy`),onChange:e=>m(e.target.value),children:[(0,G.jsx)(CS,{value:`name`,children:t(`common.name`)}),(0,G.jsx)(CS,{value:`created`,children:t(`health.created`)})]})]}),(0,G.jsx)(db,{title:t(p===`asc`?`health.ascending`:`health.descending`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>h(p===`asc`?`desc`:`asc`),"aria-label":`Sort ${p===`asc`?`descending`:`ascending`}`,children:p===`asc`?(0,G.jsx)(qT,{fontSize:`small`}):(0,G.jsx)(KT,{fontSize:`small`})})})]})]}),(0,G.jsx)(Fv,{container:!0,spacing:2,alignItems:`stretch`,children:[...n.bridgeDetails].sort((e,t)=>{let n=0;return n=f===`name`?e.name.localeCompare(t.name):e.id.localeCompare(t.id),p===`asc`?n:-n}).map(e=>(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:6,lg:4,xl:3},sx:{display:`flex`},children:(0,G.jsx)(hv,{variant:`outlined`,sx:{width:`100%`,height:`100%`,minWidth:280,maxWidth:480,display:`flex`,flexDirection:`column`,borderColor:e.status===`running`?`success.main`:e.status===`failed`?`error.main`:`warning.main`},children:(0,G.jsxs)(vv,{sx:{flex:1,display:`flex`,flexDirection:`column`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,flexShrink:0,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,minWidth:0,children:[(0,G.jsx)(mb,{}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,noWrap:!0,sx:{maxWidth:140},children:e.name})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:.5,flexShrink:0,children:[(0,G.jsx)(Ev,{label:e.status.toUpperCase(),color:e.status===`running`?`success`:e.status===`failed`?`error`:`warning`,size:`small`}),e.status===`failed`&&(0,G.jsx)(db,{title:t(`bridge.restart`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>v(e.id),children:(0,G.jsx)(Phe,{})})})]})]}),e.statusReason&&(0,G.jsx)(Q,{variant:`body2`,color:`error`,sx:{mt:1,flexShrink:0},children:e.statusReason}),(0,G.jsx)(Z,{sx:{mt:`auto`,pt:1,flexShrink:0},children:(0,G.jsxs)(Z,{display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`,children:[(0,G.jsx)(Ev,{label:`${t(`common.port`)} ${e.port}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(Ev,{label:`${e.deviceCount} ${t(`common.devices`)}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(Ev,{label:`${e.fabricCount} ${t(`common.fabrics`)}`,size:`small`,variant:`outlined`,color:`default`}),e.failedEntityCount>0&&(0,G.jsx)(Ev,{label:`${e.failedEntityCount} failed`,color:`error`,size:`small`})]})}),e.connectivity&&e.status===`running`&&(0,G.jsx)(Z,{sx:{mt:1,flexShrink:0},children:(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.sessions`),`:`,` `,e.connectivity.totalSessions,` |`,` `,t(`health.subscriptions`),`:`,` `,e.connectivity.totalSubscriptions,e.connectivity.fabricSummary&&e.connectivity.fabricSummary.length>1&&` (${e.connectivity.fabricSummary.length} ${t(`health.fabrics`)})`]})}),e.fabrics.length>0&&(0,G.jsxs)(Z,{sx:{mt:1,flexShrink:0},children:[(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.connectedTo`),`:`]}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mt:.5,children:e.fabrics.map(e=>(0,G.jsx)(db,{title:(0,G.jsxs)(Z,{sx:{fontSize:`0.75rem`},children:[(0,G.jsxs)(`div`,{children:[`Fabric #`,e.fabricIndex]}),(0,G.jsxs)(`div`,{children:[`Vendor: `,xx(e.rootVendorId),` `,`(0x`,e.rootVendorId.toString(16).toUpperCase().padStart(4,`0`),`)`]}),(0,G.jsxs)(`div`,{children:[`Fabric ID: `,e.fabricId]}),(0,G.jsxs)(`div`,{children:[`Node ID: `,e.nodeId]}),(0,G.jsxs)(`div`,{children:[`Root Node ID: `,e.rootNodeId]})]}),children:(0,G.jsx)(Ev,{icon:(0,G.jsx)(Sx,{fabric:e}),label:e.label||xx(e.rootVendorId),size:`small`,variant:`outlined`})},e.fabricIndex))})]}),e.connectivity&&e.status===`running`&&(0,G.jsx)(Z,{sx:{mt:1,flexShrink:0},children:(0,G.jsx)(lJe,{fabrics:e.fabrics,sessions:e.connectivity.sessions})}),(()=>{let n=(e.entityDiagnostics??[]).filter(e=>e.status===`failed`);return n.length>0?(0,G.jsxs)(Uh,{severity:`error`,sx:{mt:1,flexShrink:0,py:0},children:[(0,G.jsxs)(Q,{variant:`caption`,component:`div`,children:[t(`health.failedDevicesTitle`,`Devices that failed to start:`),` `,`(`,n.length,`)`]}),(0,G.jsx)(Z,{sx:{maxHeight:160,overflowY:`auto`},children:n.map(e=>(0,G.jsxs)(Q,{variant:`caption`,component:`div`,color:`text.secondary`,children:[e.entityId,e.reason?`: ${e.reason}`:``,e.failedAt?` (${cx(e.failedAt)})`:``]},e.entityId))})]}):null})(),e.controllerWarnings&&e.controllerWarnings.length>0&&(0,G.jsxs)(Uh,{severity:`warning`,sx:{mt:1,flexShrink:0,py:0},children:[(0,G.jsxs)(Q,{variant:`caption`,component:`div`,children:[t(`health.controllerWarningsTitle`,`Some devices may not show up in a connected controller:`),` `,`(`,e.controllerWarnings.length,`)`]}),(0,G.jsx)(Z,{sx:{maxHeight:160,overflowY:`auto`},children:e.controllerWarnings.map(e=>(0,G.jsxs)(Q,{variant:`caption`,component:`div`,color:`text.secondary`,children:[e.entityId,` on `,e.controllerLabel,e.note?` (${e.note})`:``]},`${e.entityId}:${e.deviceTypeId}:${e.controller}`))})]})]})})},e.id))}),n.recovery.enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(Phe,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.autoRecovery`)}),(0,G.jsx)(Ev,{label:t(`common.enabled`),color:`success`,size:`small`})]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[t(`health.recoveryAttempts`),`: `,n.recovery.recoveryCount,n.recovery.lastRecoveryAttempt&&` | Last attempt: ${new Date(n.recovery.lastRecoveryAttempt).toLocaleString()}`]}),n.recovery.history&&n.recovery.history.length>0&&(0,G.jsx)(Z,{sx:{mt:1},children:[...n.recovery.history].reverse().map((e,t)=>(0,G.jsxs)(Q,{variant:`caption`,component:`div`,color:`text.secondary`,children:[cx(e.timestamp),`: `,e.bridgeName,` (`,e.outcome,`)`]},`${e.timestamp}:${e.bridgeId}:${t}`))})]}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsx)(p4,{})]})}var m4=e=>e===`pass`?`success`:e===`warn`?`warning`:`error`;function fJe(){let{t:e}=ws(),[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useCallback)(async()=>{i(!0),o(null);try{let t=await fetch(`api/network`);t.ok?n(await t.json()):o(e(`health.fetchFailed`))}catch{o(e(`health.connectionError`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{l()},[l]);let u=t?.checks.filter(e=>e.status===`pass`).length??0,d=t?.checks.filter(e=>e.status===`warn`).length??0,f=t?.checks.filter(e=>e.status===`fail`).length??0;return(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`health.networkDiagnostics`)}),(0,G.jsx)(mv,{size:`small`,onClick:l,disabled:r,children:r?(0,G.jsx)(Rh,{size:16}):e(`health.refresh`)})]}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:1},children:a}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:1.5,flexWrap:`wrap`,children:[u>0&&(0,G.jsx)(Ev,{label:`${u} ${e(`health.checksPassed`)}`,color:`success`,size:`small`,variant:`outlined`}),d>0&&(0,G.jsx)(Ev,{label:`${d} ${e(`health.checksWarning`)}`,color:`warning`,size:`small`,variant:`outlined`}),f>0&&(0,G.jsx)(Ev,{label:`${f} ${e(`health.checksFailed`)}`,color:`error`,size:`small`,variant:`outlined`}),(0,G.jsx)(Ev,{label:t.matterConfig.boundInterface?`mDNS: ${t.matterConfig.boundInterface}`:`mDNS: all interfaces`,size:`small`,variant:`outlined`}),(0,G.jsx)(Ev,{label:`IPv4: ${t.matterConfig.ipv4Enabled?`on`:`off`}`,size:`small`,variant:`outlined`})]}),t.checks.filter(e=>e.status!==`pass`).map(e=>(0,G.jsxs)(Uh,{severity:m4(e.status),sx:{mb:1},children:[(0,G.jsx)(`strong`,{children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.5},children:e.detail})]},e.name)),(0,G.jsx)(mv,{size:`small`,onClick:()=>c(!s),sx:{mt:.5},children:e(s?`health.hideDetails`:`health.showDetails`)}),(0,G.jsxs)(Zv,{in:s,children:[(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:1,mb:.5},children:e(`health.allChecks`)}),(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:e(`health.check`)}),(0,G.jsx)(mC,{children:e(`health.statusLabel`)}),(0,G.jsx)(mC,{children:e(`health.message`)})]})}),(0,G.jsx)(pC,{children:t.checks.map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,children:e.name})}),(0,G.jsx)(mC,{children:(0,G.jsx)(Ev,{label:e.status,color:m4(e.status),size:`small`})}),(0,G.jsxs)(mC,{children:[(0,G.jsx)(Q,{variant:`body2`,children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,display:`block`,children:e.detail})]})]},e.name))})]}),(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:2,mb:.5},children:e(`health.networkInterfaces`)}),(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:e(`health.interfaceName`)}),(0,G.jsx)(mC,{children:`IPv4`}),(0,G.jsx)(mC,{children:`IPv6`}),(0,G.jsx)(mC,{children:`MAC`})]})}),(0,G.jsx)(pC,{children:t.interfaces.filter(e=>!e.internal).map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:e.name}),(0,G.jsx)(mC,{children:e.ipv4.join(`, `)||`-`}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,sx:{wordBreak:`break-all`,maxWidth:240},children:e.ipv6.join(`, `)||`-`})}),(0,G.jsx)(mC,{children:e.mac})]},e.name))})]})]})]})]})}var h4=`hamh-translation-overrides`;function g4(e,t=``){let n={};for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(n,g4(i,e)):n[e]=String(i??``)}return n}function _4(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.split(`.`),i=t;for(let t=0;t<e.length-1;t++)e[t]in i||(i[e[t]]={}),i=i[e[t]];i[e[e.length-1]]=r}return t}function v4(e){try{let t=localStorage.getItem(h4);return t?JSON.parse(t)[e]??{}:{}}catch{return{}}}function y4(e,t){try{let n=localStorage.getItem(h4),r=n?JSON.parse(n):{};Object.keys(t).length===0?delete r[e]:r[e]=t,localStorage.setItem(h4,JSON.stringify(r))}catch{}}var b4=`hamh-custom-languages`;function pJe(){try{let e=localStorage.getItem(b4);return e?JSON.parse(e):[]}catch{return[]}}function x4(e){localStorage.setItem(b4,JSON.stringify(e))}var S4=[{code:`de`,name:`Deutsch`},{code:`fr`,name:`Français`},{code:`es`,name:`Español`},{code:`it`,name:`Italiano`},{code:`zh`,name:`中文`},{code:`zh-TW`,name:`繁體中文`},{code:`ja`,name:`日本語`},{code:`th`,name:`ไทย`},{code:`sv`,name:`Svenska`},{code:`tr`,name:`Türkçe`},{code:`ru`,name:`Русский`}];function mJe(){let{t:e,i18n:t}=ws(),n=t.language??`en`,r=S4.some(e=>e.code===n)?n:n.split(`-`)[0]??`en`,[i,a]=(0,C.useState)(()=>r===`en`?`de`:r),[o,s]=(0,C.useState)(``),[c,l]=(0,C.useState)(()=>v4(i)),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(`all`),[m,h]=(0,C.useState)(pJe),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(``),D=(0,C.useMemo)(()=>[...S4,...m],[m]),O=(0,C.useCallback)(e=>m.some(t=>t.code===e),[m]),k=(0,C.useMemo)(()=>g4(Es),[]),A=(0,C.useMemo)(()=>{let e=t.getResourceBundle(i,`translation`);return e?g4(e):{}},[i,t]),j=(0,C.useMemo)(()=>Object.keys(k).map(e=>({key:e,section:e.split(`.`)[0],enValue:k[e],currentValue:c[e]??A[e]??``,isOverridden:e in c})),[k,A,c]),M=(0,C.useMemo)(()=>{let e=j;if(o){let t=o.toLowerCase();e=e.filter(e=>e.key.toLowerCase().includes(t)||e.enValue.toLowerCase().includes(t)||e.currentValue.toLowerCase().includes(t))}return f===`missing`?e=e.filter(e=>!e.currentValue):f===`edited`&&(e=e.filter(e=>e.isOverridden)),e},[j,o,f]),N=(0,C.useMemo)(()=>[...new Set(M.map(e=>e.section))],[M]),P=Object.keys(k).length,F=j.filter(e=>e.currentValue).length,I=Object.keys(c).length,L=P>0?F/P*100:0;(0,C.useEffect)(()=>{l(v4(i))},[i]);let R=(0,C.useCallback)(e=>{l(e),y4(i,e);let n=t.getResourceBundle(i,`translation`),r=n?g4(n):{},a={};for(let[t,n]of Object.entries(e))n&&n!==r[t]&&(a[t]=n);if(Object.keys(a).length>0){let e=_4({...r,...a});t.addResourceBundle(i,`translation`,e,!0,!0)}},[i,t]),ee=(0,C.useCallback)((e,t)=>{let n={...c,[e]:t};t||delete n[e],R(n)},[c,R]),z=(0,C.useCallback)(e=>{let t={...c};delete t[e],R(t)},[c,R]),te=(0,C.useCallback)(()=>{R({})},[R]),B=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=_4(e),n=JSON.stringify(t,null,2),r=new Blob([n],{type:`application/json`}),a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=`${i}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},[k,A,c,i]),V=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=_4(e);navigator.clipboard.writeText(JSON.stringify(t,null,2)),d(!0),setTimeout(()=>d(!1),2e3)},[k,A,c]),ne=(0,C.useCallback)(()=>{let n=v.trim().toLowerCase(),r=b.trim();if(!n){w(e(`translationEditor.codeRequired`));return}if(!r){w(e(`translationEditor.nameRequired`));return}if(S4.some(e=>e.code===n)||m.some(e=>e.code===n)||n===`en`){w(e(`translationEditor.languageExists`));return}let i=[...m,{code:n,name:r}];h(i),x4(i),t.addResourceBundle(n,`translation`,{},!0,!0),a(n),_(!1),y(``),x(``),w(``)},[v,b,m,t,e]),re=(0,C.useCallback)(()=>{if(!O(i))return;let e=m.filter(e=>e.code!==i);h(e),x4(e),y4(i,{}),a(S4[0].code)},[i,m,O]),ie=(0,C.useCallback)(()=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.json`,t.onchange=()=>{let n=t.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{try{let t=JSON.parse(r.result);if(typeof t!=`object`||!t)throw Error();let n=g4(t),i=new Set(Object.keys(k)),a={},o=0;for(let[e,t]of Object.entries(n))i.has(e)&&t&&(a[e]=t,o++);R({...c,...a}),E(e(`translationEditor.importSuccess`,{count:o}))}catch{E(e(`translationEditor.importFailed`))}},r.readAsText(n)},t.click()},[k,c,R,e]);return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(_ge,{}),(0,G.jsx)(Q,{variant:`h5`,children:e(`translationEditor.title`)})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:140},children:[(0,G.jsx)(Bx,{children:e(`translationEditor.editLanguage`)}),(0,G.jsx)(SS,{value:i,label:e(`translationEditor.editLanguage`),onChange:e=>a(e.target.value),children:D.map(e=>(0,G.jsxs)(CS,{value:e.code,children:[(0,G.jsx)(oy,{primary:e.name}),O(e.code)&&(0,G.jsx)(iy,{sx:{minWidth:`auto`,ml:1},children:(0,G.jsx)($T,{fontSize:`small`,color:`disabled`})})]},e.code))})]}),(0,G.jsx)(db,{title:e(`translationEditor.addLanguage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>_(e=>!e),children:(0,G.jsx)(fb,{fontSize:`small`})})}),O(i)&&(0,G.jsx)(db,{title:e(`translationEditor.removeLanguage`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:re,children:(0,G.jsx)($T,{fontSize:`small`})})})]})]}),(0,G.jsx)(Zv,{in:g,children:(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,alignItems:`flex-start`,flexWrap:`wrap`,children:[(0,G.jsx)(ES,{size:`small`,label:e(`translationEditor.newLanguageCode`),value:v,onChange:e=>y(e.target.value),error:!!S,sx:{width:180}}),(0,G.jsx)(ES,{size:`small`,label:e(`translationEditor.newLanguageName`),value:b,onChange:e=>x(e.target.value),sx:{width:220}}),(0,G.jsx)(mv,{variant:`contained`,size:`small`,onClick:ne,children:e(`translationEditor.addLanguageButton`)}),S&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:.5},children:S})]})}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:2},children:e(`translationEditor.info`)}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,mb:2,flexWrap:`wrap`,children:[(0,G.jsxs)(Z,{sx:{flexGrow:1,minWidth:200},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:.5,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`translationEditor.progress`,{translated:F,total:P})}),(0,G.jsxs)(Q,{variant:`body2`,fontWeight:600,children:[Math.round(L),`%`]})]}),(0,G.jsx)(Vv,{variant:`determinate`,value:L,sx:{height:8,borderRadius:4}})]}),I>0&&(0,G.jsx)(Ev,{label:e(`translationEditor.localEdits`,{count:I}),color:`primary`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,flexWrap:`wrap`,children:[(0,G.jsx)(ES,{size:`small`,placeholder:e(`translationEditor.searchPlaceholder`),value:o,onChange:e=>s(e.target.value),sx:{flexGrow:1,minWidth:200},slotProps:{input:{startAdornment:(0,G.jsx)(fF,{position:`start`,children:(0,G.jsx)(hE,{fontSize:`small`})})}}}),(0,G.jsx)(kv,{size:`small`,sx:{minWidth:130},children:(0,G.jsxs)(SS,{value:f,onChange:e=>p(e.target.value),children:[(0,G.jsx)(CS,{value:`all`,children:e(`translationEditor.filterAll`)}),(0,G.jsx)(CS,{value:`missing`,children:e(`translationEditor.filterMissing`)}),(0,G.jsx)(CS,{value:`edited`,children:e(`translationEditor.filterEdited`)})]})})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:3,flexWrap:`wrap`,children:[(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(SE,{}),onClick:B,children:e(`translationEditor.exportJson`)}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(PT,{}),onClick:ie,children:e(`translationEditor.importJson`)}),(0,G.jsx)(db,{title:u?e(`translationEditor.copied`):``,children:(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(pb,{}),onClick:V,children:e(`translationEditor.copyJson`)})}),I>0&&(0,G.jsx)(mv,{variant:`outlined`,size:`small`,color:`warning`,startIcon:(0,G.jsx)(pE,{}),onClick:te,children:e(`translationEditor.resetAll`)})]}),N.map(t=>(0,G.jsxs)(Z,{sx:{mb:3},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,sx:{mb:1,textTransform:`capitalize`},children:t}),(0,G.jsx)(Ub,{sx:{mb:1.5}}),M.filter(e=>e.section===t).map(t=>(0,G.jsxs)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`1fr 1fr auto`},gap:1,mb:1.5,alignItems:`start`},children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:`monospace`},children:t.key}),(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.25},children:t.enValue})]}),(0,G.jsx)(ES,{size:`small`,fullWidth:!0,multiline:t.enValue.length>60,minRows:1,maxRows:4,value:t.currentValue,onChange:e=>ee(t.key,e.target.value),placeholder:t.enValue,sx:{"& .MuiOutlinedInput-root":t.isOverridden?{borderColor:`primary.main`,"& fieldset":{borderColor:`primary.main`,borderWidth:2}}:{}}}),t.isOverridden&&(0,G.jsx)(db,{title:e(`translationEditor.resetKey`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>z(t.key),children:(0,G.jsx)(pE,{fontSize:`small`})})})]},t.key))]},t)),M.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,sx:{textAlign:`center`,py:4},children:e(`translationEditor.noResults`)}),(0,G.jsx)($h,{open:!!T,autoHideDuration:3e3,onClose:()=>E(``),message:T})]})}var C4=e=>{let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`},w4=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`},hJe=()=>{let[e,t]=(0,C.useState)(null),[n,r]=(0,C.useState)(!0),[i,a]=(0,C.useState)(!0);if((0,C.useEffect)(()=>{let e=null,n=async()=>{try{let n=await fetch(`api/system/info`);n.ok?(t(await n.json()),a(!0)):n.status===404&&(a(!1),e&&=(clearInterval(e),null))}catch{}finally{r(!1)}};return n(),e=setInterval(n,3e4),()=>{e&&clearInterval(e)}},[]),!i)return null;if(n)return(0,G.jsx)(hv,{children:(0,G.jsx)(vv,{children:(0,G.jsx)(Q,{children:`Loading system information...`})})});if(!e)return(0,G.jsx)(hv,{children:(0,G.jsx)(vv,{children:(0,G.jsx)(Q,{color:`error`,children:`Failed to load system information`})})});let o=e.memory.used/e.memory.total*100,s=e.storage.used/e.storage.total*100;return(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(Whe,{}),`System Information`]}),(0,G.jsxs)(Fv,{container:!0,spacing:3,children:[(0,G.jsx)(Fv,{size:{xs:12,md:6},children:(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`Application`}),(0,G.jsxs)(Hv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Version:`}),(0,G.jsx)(Ev,{label:e.version,size:`small`,color:`primary`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Environment:`}),(0,G.jsx)(Ev,{label:e.environment,size:`small`,variant:`outlined`,color:e.environment===`Home Assistant Add-on`?`success`:`default`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Node.js:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.nodeVersion})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Process Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:w4(e.process.uptime)})]})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`System`}),(0,G.jsxs)(Hv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Hostname:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.hostname})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Platform:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[e.platform,` (`,e.arch,`)`]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`CPU:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,sx:{maxWidth:200,textAlign:`right`},noWrap:!0,title:e.cpuModel,children:[e.cpuCount,`x`,` `,e.cpuModel.split(`@`)[0].trim()]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`System Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:w4(e.uptime)})]})]})]})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:6},children:(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(sE,{}),`Memory Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[C4(e.memory.used),` /`,` `,C4(e.memory.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[o.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${o}%`,backgroundColor:o>80?`error.main`:o>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(sE,{}),`HAMH Process Memory`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:.5},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`RSS: `,C4(e.process.rss)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Heap: `,C4(e.process.heapUsed),` /`,` `,C4(e.process.heapSizeLimit)]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${Math.min(e.process.heapUsed/e.process.heapSizeLimit*100,100)}%`,backgroundColor:e.process.heapUsed/e.process.heapSizeLimit>.85?`error.main`:e.process.heapUsed/e.process.heapSizeLimit>.6?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(mge,{}),`Storage Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[C4(e.storage.used),` /`,` `,C4(e.storage.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[s.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${s}%`,backgroundColor:s>80?`error.main`:s>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]})]})}),(0,G.jsxs)(Fv,{size:{xs:12},children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(oge,{}),`Network Interfaces`]}),(0,G.jsx)(Hv,{spacing:1,sx:{mt:1},children:e.network.interfaces.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(Q,{variant:`body2`,children:e.name}),(0,G.jsx)(Ev,{label:`${e.address} (${e.family})`,size:`small`,variant:`outlined`})]},`${e.name}-${e.address}`))})]})]})]})})},gJe=200;function _Je(){let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,n=document.querySelector(`base`)?.href||window.location.origin,i=new URL(n),l=`${e}//${i.host}${i.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`),u=new WebSocket(l);o.current=u,u.onopen=()=>{a(!0),u.send(JSON.stringify({type:`subscribe_diagnostics`}))},u.onmessage=e=>{try{let n=JSON.parse(e.data);if(n.type===`diagnostic_event`){let e=n.data;t(t=>{let n=[...t,e];return n.length>gJe?n.slice(-200):n})}else if(n.type===`diagnostic_snapshot`){let e=n.data;r(e),t(e.recentEvents??[])}}catch{}},u.onclose=()=>{a(!1),o.current=null,s.current=setTimeout(c,3e3)},u.onerror=()=>u.close()},[]);return(0,C.useEffect)(()=>(c(),()=>{clearTimeout(s.current),o.current&&(o.current.send(JSON.stringify({type:`unsubscribe_diagnostics`})),o.current.close())}),[c]),{events:e,snapshot:n,connected:i,clearEvents:(0,C.useCallback)(()=>t([]),[])}}function T4(e){let t=e.replace(`#`,``),n=Number.parseInt(t.substring(0,2),16)/255,r=Number.parseInt(t.substring(2,4),16)/255,i=Number.parseInt(t.substring(4,6),16)/255;return .2126*(n<=.03928?n/12.92:((n+.055)/1.055)**2.4)+.7152*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.0722*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)>.179?`#000`:`#fff`}var E4={state_update:`#4caf50`,command_received:`#2196f3`,entity_error:`#f44336`,session_opened:`#ff9800`,session_closed:`#9e9e9e`,subscription_changed:`#9c27b0`,bridge_started:`#00bcd4`,bridge_stopped:`#795548`,entity_warning:`#ff9800`},D4={state_update:`diagnostics.stateUpdate`,command_received:`diagnostics.command`,entity_error:`diagnostics.entityError`,session_opened:`diagnostics.sessionOpen`,session_closed:`diagnostics.sessionClose`,subscription_changed:`diagnostics.subscription`,bridge_started:`diagnostics.bridgeStart`,bridge_stopped:`diagnostics.bridgeStop`,entity_warning:`diagnostics.entityWarning`};function vJe(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}var O4=Object.keys(E4);function yJe({sortField:e,sortDirection:t}={}){let{t:n}=ws(),r=wm(),{events:i,snapshot:a,connected:o,clearEvents:s}=_Je(),[c,l]=(0,C.useState)(new Set(O4)),[u,d]=(0,C.useState)(!1),f=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},p=i.filter(e=>c.has(e.type)),m=(0,C.useMemo)(()=>{let n=a?.bridges??[];return e?[...n].sort((n,r)=>{let i=0;return i=e===`name`?n.bridgeName.localeCompare(r.bridgeName):n.bridgeId.localeCompare(r.bridgeId),t===`desc`?-i:i}):n},[a?.bridges,e,t]),h={};for(let e of i)h[e.type]=(h[e.type]??0)+1;return(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(gge,{}),(0,G.jsx)(Q,{variant:`h6`,children:n(`diagnostics.title`)}),(0,G.jsx)(Ev,{icon:(0,G.jsx)(Xhe,{sx:{fontSize:10,color:o?r.palette.success.main:r.palette.error.main}}),label:n(o?`common.live`:`common.offline`),size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,alignItems:`center`,children:[(0,G.jsx)(db,{title:n(`diagnostics.filterEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>d(e=>!e),color:u?`primary`:`default`,children:(0,G.jsx)(_b,{})})}),(0,G.jsx)(db,{title:n(`diagnostics.clearEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:s,children:(0,G.jsx)(Hhe,{})})})]})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,flexWrap:`wrap`,sx:{mb:2,gap:.5},children:[O4.map(e=>{let t=h[e]??0;if(t===0&&!u)return null;let r=E4[e];return(0,G.jsx)(Ev,{label:`${n(D4[e])}: ${t}`,size:`small`,sx:{bgcolor:c.has(e)?r:`action.disabledBackground`,color:c.has(e)?T4(r):`text.disabled`,fontSize:`0.7rem`,height:22,cursor:`pointer`,opacity:c.has(e)?1:.5},onClick:()=>f(e)},e)}),a?.system&&(0,G.jsx)(Ev,{label:`Total: ${a.system.eventCount}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})]}),(0,G.jsx)(Zv,{in:u,children:(0,G.jsx)(Wm,{variant:`outlined`,sx:{p:1.5,mb:2},children:(0,G.jsx)(Fv,{container:!0,spacing:0,children:O4.map(e=>{let t=E4[e];return(0,G.jsx)(Fv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{size:`small`,checked:c.has(e),onChange:()=>f(e),sx:{color:t,"&.Mui-checked":{color:t}}}),label:(0,G.jsx)(Q,{variant:`caption`,children:n(D4[e])})})},e)})})})}),m.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Fv,{container:!0,spacing:1,sx:{mb:2},children:m.map(e=>(0,G.jsx)(bJe,{bridge:e},e.bridgeId))}),(0,G.jsx)(Ub,{sx:{mb:2}})]}),(0,G.jsx)(Z,{sx:{maxHeight:400,overflow:`auto`,bgcolor:`background.default`,borderRadius:1,p:1},children:p.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:4},children:i.length===0?`Waiting for diagnostic events…`:n(`diagnostics.noEvents`)}):p.map(e=>{let t=E4[e.type];return(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,py:.4,px:.5,minWidth:0,borderBottom:`1px solid`,borderColor:`divider`,"&:hover":{bgcolor:`action.hover`},"&:last-child":{borderBottom:`none`}},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.secondary`,whiteSpace:`nowrap`,fontFamily:`monospace`,fontSize:`0.72rem`,minWidth:85,pt:.1},children:vJe(e.timestamp)}),(0,G.jsx)(Ev,{label:D4[e.type]?n(D4[e.type]):e.type,size:`small`,sx:{bgcolor:t??`#757575`,color:T4(t??`#757575`),fontSize:`0.62rem`,fontWeight:600,height:18,minWidth:90}}),e.bridgeName&&(0,G.jsxs)(Q,{variant:`caption`,sx:{color:`primary.main`,fontWeight:600,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:140,flexShrink:0},children:[`[`,e.bridgeName,`]`]}),e.entityId&&(0,G.jsx)(Q,{variant:`caption`,sx:{color:`warning.main`,fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:220,flexShrink:1},children:e.entityId}),(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.primary`,flex:1,wordBreak:`break-word`,fontSize:`0.72rem`},children:e.message})]},e.id)})})]})})}function bJe({bridge:e}){let[t,n]=(0,C.useState)(!1);return(0,G.jsx)(Fv,{size:{xs:12,sm:6},children:(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:1.5,overflow:`hidden`,minWidth:0},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,sx:{cursor:`pointer`},onClick:()=>n(e=>!e),children:[(0,G.jsxs)(Z,{sx:{minWidth:0,overflow:`hidden`},children:[(0,G.jsx)(Q,{variant:`body2`,fontWeight:500,noWrap:!0,children:e.bridgeName}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:[e.entityCount,` devices · `,e.sessionCount,` sessions`]})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,alignItems:`center`,flexWrap:`wrap`,justifyContent:`flex-end`,sx:{flexShrink:0,ml:1},children:[Object.entries(e.featureFlags).filter(([,e])=>e).map(([e])=>(0,G.jsx)(Ev,{label:e.replace(/^auto/,``).replace(/([A-Z])/g,` $1`).trim(),size:`small`,variant:`outlined`,sx:{fontSize:`0.6rem`,height:18}},e)),(0,G.jsx)(Ev,{label:e.status,size:`small`,color:e.status===`running`?`success`:e.status===`failed`?`error`:`default`,sx:{height:20}}),(0,G.jsx)($S,{sx:{transform:t?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`,fontSize:18,color:`text.secondary`}})]})]}),(0,G.jsx)(Zv,{in:t,children:(0,G.jsx)(Z,{sx:{mt:1,maxHeight:200,overflow:`auto`},children:e.entities.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`baseline`,gap:.5,py:.3,borderBottom:`1px solid`,borderColor:`divider`},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:`0.68rem`,minWidth:180,flexShrink:0,color:e.available?`text.primary`:`error.main`},noWrap:!0,children:e.entityId}),(0,G.jsx)(Z,{display:`flex`,gap:.3,flexWrap:`wrap`,children:e.matterClusters.map(e=>(0,G.jsx)(Ev,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:`0.58rem`,height:16,"& .MuiChip-label":{px:.5}}},e))})]},e.entityId))})})]})})}var xJe=()=>{let[e,t]=(0,C.useState)(`name`),[n,r]=(0,C.useState)(`asc`);return(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,G.jsx)(dJe,{sortField:e,sortDirection:n,onSortFieldChange:t,onSortDirectionChange:r}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(yJe,{sortField:e,sortDirection:n})}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(fJe,{})}),(0,G.jsx)(Z,{sx:{px:2,pb:2},children:(0,G.jsx)(hJe,{})}),(0,G.jsx)(Ub,{}),(0,G.jsx)(mJe,{})]})};async function SJe(){let e=await fetch(`api/matter/labels?_s=${Date.now()}`);return await M_(e,`Failed to fetch labels`),j_(e)}async function CJe(){let e=await fetch(`api/matter/areas?_s=${Date.now()}`);return await M_(e,`Failed to fetch areas`),j_(e)}async function wJe(){let e=await fetch(`api/matter/filter-values?_s=${Date.now()}`);return await M_(e,`Failed to fetch filter values`),j_(e)}var k4=({values:e,copiedId:t,onCopy:n,searchable:r})=>{let[i,a]=(0,C.useState)(``),o=(0,C.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,i]);return e.length===0?(0,G.jsx)(Z,{sx:{p:2,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`No values found.`})}):(0,G.jsxs)(Z,{children:[r&&e.length>10&&(0,G.jsx)(Z,{sx:{px:2,pt:1,pb:.5},children:(0,G.jsx)(ES,{size:`small`,fullWidth:!0,placeholder:`Search...`,value:i,onChange:e=>a(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(fF,{position:`start`,children:(0,G.jsx)(hE,{fontSize:`small`})})}}})}),(0,G.jsxs)(Z,{sx:{p:1.5,display:`flex`,flexWrap:`wrap`,gap:.75},children:[o.map(e=>(0,G.jsx)(Ev,{label:e,size:`small`,variant:t===e?`filled`:`outlined`,color:t===e?`success`:`default`,onClick:()=>n(e),sx:{fontFamily:`monospace`,fontSize:`0.8rem`}},e)),i&&o.length===0&&(0,G.jsxs)(Q,{color:`text.secondary`,variant:`body2`,sx:{p:1},children:[`No matches for "`,i,`"`]})]})]})},TJe=()=>{let{t:e}=ws(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)([]),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(null),p=(0,C.useCallback)(async()=>{c(!0);try{let[e,t,r]=await Promise.all([SJe(),CJe(),wJe()]);n(e),i(t),o(r),u(null)}catch(t){u(t instanceof Error?t.message:e(`labels.loadFailed`))}finally{c(!1)}},[e]);(0,C.useEffect)(()=>{p()},[p]);let m=e=>{navigator.clipboard.writeText(e),f(e),setTimeout(()=>f(null),2e3)};return s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,sx:{mb:3},children:[(0,G.jsx)(_b,{sx:{mr:1,verticalAlign:`middle`}}),e(`labels.title`)]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:e(`labels.info`)}),l&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:l}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)(aE,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.labelsSection`),` (`,t.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.labelsHint`)}),(0,G.jsx)(hv,{sx:{mb:4},children:t.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noLabels`)})}):(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.labelId`)}),(0,G.jsx)(mC,{width:48})]})}),(0,G.jsx)(pC,{children:t.map(t=>(0,G.jsxs)(bC,{hover:!0,children:[(0,G.jsxs)(mC,{children:[t.color&&(0,G.jsx)(Z,{component:`span`,sx:{display:`inline-block`,width:12,height:12,borderRadius:`50%`,backgroundColor:t.color,mr:1,verticalAlign:`middle`}}),t.name]}),(0,G.jsx)(mC,{children:(0,G.jsx)(`code`,{children:t.label_id})}),(0,G.jsx)(mC,{children:(0,G.jsx)(db,{title:d===t.label_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.label_id),children:(0,G.jsx)(pb,{fontSize:`small`})})})})]},t.label_id))})]})})}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)(DT,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.areasSection`),` (`,r.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.areasHint`)}),(0,G.jsx)(hv,{sx:{mb:4},children:r.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noAreas`)})}):(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.areaId`)}),(0,G.jsx)(mC,{width:48})]})}),(0,G.jsx)(pC,{children:r.map(t=>(0,G.jsxs)(bC,{hover:!0,children:[(0,G.jsx)(mC,{children:t.name}),(0,G.jsx)(mC,{children:(0,G.jsx)(`code`,{children:t.area_id})}),(0,G.jsx)(mC,{children:(0,G.jsx)(db,{title:d===t.area_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.area_id),children:(0,G.jsx)(pb,{fontSize:`small`})})})})]},t.area_id))})]})})}),a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:e(`labels.otherFilterValues`)}),(0,G.jsxs)(iC,{defaultExpanded:!0,children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(bge,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.domains`),` (`,a.domains.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.domainsHint`)}),(0,G.jsx)(k4,{values:a.domains,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(tE,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.platforms`),` (`,a.platforms.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.platformsHint`)}),(0,G.jsx)(k4,{values:a.platforms,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(zhe,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.entityCategories`),` (`,a.entityCategories.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.entityCategoriesHint`)}),(0,G.jsx)(k4,{values:a.entityCategories,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(zhe,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceClasses`),` (`,a.deviceClasses.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceClassesHint`)}),(0,G.jsx)(k4,{values:a.deviceClasses,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(mb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceNames`),` (`,a.deviceNames.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceNamesHint`)}),(0,G.jsx)(k4,{values:a.deviceNames,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(mb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.productNames`),` (`,a.productNames.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.productNamesHint`)}),(0,G.jsx)(k4,{values:a.productNames,copiedId:d,onCopy:m,searchable:!0})]})]})]})]})};async function EJe(){let e=await fetch(`api/lock-credentials`);return await M_(e,`Failed to fetch lock credentials`),j_(e)}async function DJe(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return await M_(n,`Failed to update lock credential`),j_(n)}async function OJe(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}/enabled`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})});return await M_(n,`Failed to toggle credential`),j_(n)}async function kJe(e){await M_(await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete lock credential`)}var AJe=({open:e,onClose:t,onSave:n,initialEntityId:r=``,initialName:i=``,isEdit:a=!1})=>{let{t:o}=ws(),[s,c]=(0,C.useState)(r),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(i),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{e&&(c(r),f(i),u(``),m(``))},[e,r,i]),(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:o(a?`lockCredentials.editCredential`:`lockCredentials.addCredential`)}),(0,G.jsx)(Bb,{children:(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,mt:1},children:[p&&(0,G.jsx)(Uh,{severity:`error`,children:p}),(0,G.jsx)(ES,{label:o(`lockCredentials.lockEntityId`),placeholder:`lock.front_door`,value:s,onChange:e=>c(e.target.value),disabled:a,fullWidth:!0,helperText:o(`lockCredentials.lockEntityHelperText`)}),(0,G.jsx)(ES,{label:o(`lockCredentials.pinCode`),type:`password`,placeholder:`1234`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,8)),fullWidth:!0,helperText:`4-8 digit PIN code for this lock`,inputProps:{inputMode:`numeric`,pattern:`[0-9]*`}}),(0,G.jsx)(ES,{label:o(`lockCredentials.nameOptional`),placeholder:o(`lockCredentials.namePlaceholder`),value:d,onChange:e=>f(e.target.value),fullWidth:!0,helperText:o(`lockCredentials.nameHelperText`)})]})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:t,disabled:h,children:o(`common.cancel`)}),(0,G.jsx)(mv,{onClick:async()=>{if(!s.trim()){m(o(`lockCredentials.entityRequired`));return}if(!l||l.length<4||l.length>8){m(o(`lockCredentials.pinLength`));return}if(!/^\d+$/.test(l)){m(o(`lockCredentials.pinDigitsOnly`));return}g(!0);try{await n(s.trim(),l,d.trim()),t()}catch(e){m(e instanceof Error?e.message:o(`lockCredentials.saveFailed`))}finally{g(!1)}},variant:`contained`,disabled:h,startIcon:h?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(mE,{}),children:o(`common.save`)})]})]})},jJe=()=>{let{t:e}=ws(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(!0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(null),d=(0,C.useCallback)(async()=>{i(!0);try{n((await EJe()).credentials),o(null)}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.loadFailed`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{d()},[d]);let f=async(e,t,n)=>{await DJe(e,{entityId:e,pinCode:t,name:n||void 0,enabled:!0}),await d()},[p,m]=(0,C.useState)(null),h=async t=>{m(null);try{await kJe(t),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.deleteFailed`))}},g=async t=>{try{await OJe(t.entityId,!t.enabled),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.updateFailed`))}},_=e=>{u(e),c(!0)},v=()=>{u(null),c(!0)};return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:3},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,children:[(0,G.jsx)(ET,{sx:{mr:1,verticalAlign:`middle`}}),e(`lockCredentials.title`)]}),(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(fb,{}),onClick:v,children:e(`lockCredentials.addCredential`)})]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:`Configure PIN codes for locks that require authentication for remote lock/unlock operations. The PIN will be sent with lock/unlock commands to Matter locks.`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:a}),r?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):t.length===0?(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{sx:{textAlign:`center`,py:4},children:[(0,G.jsx)(ET,{sx:{fontSize:48,color:`text.secondary`,mb:2}}),(0,G.jsx)(Q,{variant:`h6`,color:`text.secondary`,children:`No lock credentials configured`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:`Add a PIN code for your Matter locks to enable remote lock/unlock`}),(0,G.jsx)(mv,{variant:`outlined`,startIcon:(0,G.jsx)(fb,{}),onClick:v,children:`Add Your First Credential`})]})}):(0,G.jsx)(hv,{children:(0,G.jsx)($v,{children:t.map((n,r)=>(0,G.jsxs)(ny,{divider:r<t.length-1,onClick:()=>_(n),sx:{cursor:`pointer`,"&:hover":{bgcolor:`action.hover`}},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(ET,{color:n.enabled?`primary`:`disabled`})}),(0,G.jsx)(oy,{primary:n.name||n.entityId,secondary:(0,G.jsxs)(G.Fragment,{children:[n.name&&(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,children:n.entityId}),(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,sx:{ml:n.name?2:0},children:`PIN: ****`})]})}),(0,G.jsxs)(ty,{children:[(0,G.jsx)(db,{title:n.enabled?e(`lockCredentials.disable`):e(`lockCredentials.enable`),children:(0,G.jsx)(KS,{edge:`end`,checked:n.enabled,onChange:e=>{e.stopPropagation(),g(n)}})}),(0,G.jsx)(db,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{edge:`end`,onClick:e=>{e.stopPropagation(),m(n.entityId)},sx:{ml:1},children:(0,G.jsx)(LS,{})})})]})]},n.entityId))})}),(0,G.jsx)(AJe,{open:s,onClose:()=>c(!1),onSave:f,initialEntityId:l?.entityId,initialName:l?.name,isEdit:!!l}),(0,G.jsx)(WT,{open:p!==null,title:e(`lockCredentials.confirmDeleteTitle`),message:e(`lockCredentials.confirmDeleteMessage`,{entity:p??``}),confirmLabel:e(`common.delete`),confirmColor:`error`,onConfirm:()=>{p&&h(p)},onCancel:()=>m(null)})]})},MJe=()=>{let e=Nr(),{t}=ws();return(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(fge,{color:`disabled`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:t(`notFound.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`notFound.description`)}),(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(rE,{}),onClick:()=>e(J9.dashboard),children:t(`notFound.backToDashboard`)})]})};function A4(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=A4(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var NJe={value:()=>{}};function j4(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new M4(n)}function M4(e){this._=e}function PJe(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}M4.prototype=j4.prototype={constructor:M4,on:function(e,t){var n=this._,r=PJe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=FJe(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=N4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=N4(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new M4(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function FJe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function N4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=NJe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var P4={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function F4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),P4.hasOwnProperty(t)?{space:P4[t],local:e}:e}function IJe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function LJe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function I4(e){var t=F4(e);return(t.local?LJe:IJe)(t)}function RJe(){}function L4(e){return e==null?RJe:function(){return this.querySelector(e)}}function zJe(e){typeof e!=`function`&&(e=L4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new Q4(r,this._parents)}function BJe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function VJe(){return[]}function R4(e){return e==null?VJe:function(){return this.querySelectorAll(e)}}function HJe(e){return function(){return BJe(e.apply(this,arguments))}}function UJe(e){e=typeof e==`function`?HJe(e):R4(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new Q4(r,i)}function z4(e){return function(){return this.matches(e)}}function B4(e){return function(t){return t.matches(e)}}var WJe=Array.prototype.find;function GJe(e){return function(){return WJe.call(this.children,e)}}function KJe(){return this.firstElementChild}function qJe(e){return this.select(e==null?KJe:GJe(typeof e==`function`?e:B4(e)))}var JJe=Array.prototype.filter;function YJe(){return Array.from(this.children)}function XJe(e){return function(){return JJe.call(this.children,e)}}function ZJe(e){return this.selectAll(e==null?YJe:XJe(typeof e==`function`?e:B4(e)))}function QJe(e){typeof e!=`function`&&(e=z4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Q4(r,this._parents)}function V4(e){return Array(e.length)}function $Je(){return new Q4(this._enter||this._groups.map(V4),this._parents)}function H4(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}H4.prototype={constructor:H4,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function eYe(e){return function(){return e}}function tYe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new H4(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function nYe(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new H4(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function rYe(e){return e.__data__}function iYe(e,t){if(!arguments.length)return Array.from(this,rYe);var n=t?nYe:tYe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=eYe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=aYe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new Q4(o,r),o._enter=s,o._exit=c,o}function aYe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function oYe(){return new Q4(this._exit||this._groups.map(V4),this._parents)}function sYe(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function cYe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new Q4(s,this._parents)}function lYe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function uYe(e){e||=dYe;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new Q4(i,this._parents).order()}function dYe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fYe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pYe(){return Array.from(this)}function mYe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function hYe(){let e=0;for(let t of this)++e;return e}function gYe(){return!this.node()}function _Ye(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function vYe(e){return function(){this.removeAttribute(e)}}function yYe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bYe(e,t){return function(){this.setAttribute(e,t)}}function xYe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function CYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function wYe(e,t){var n=F4(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?yYe:vYe:typeof t==`function`?n.local?CYe:SYe:n.local?xYe:bYe)(n,t))}function U4(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function TYe(e){return function(){this.style.removeProperty(e)}}function EYe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function DYe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function OYe(e,t,n){return arguments.length>1?this.each((t==null?TYe:typeof t==`function`?DYe:EYe)(e,t,n??``)):W4(this.node(),e)}function W4(e,t){return e.style.getPropertyValue(t)||U4(e).getComputedStyle(e,null).getPropertyValue(t)}function kYe(e){return function(){delete this[e]}}function AYe(e,t){return function(){this[e]=t}}function jYe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function MYe(e,t){return arguments.length>1?this.each((t==null?kYe:typeof t==`function`?jYe:AYe)(e,t)):this.node()[e]}function G4(e){return e.trim().split(/^|\s+/)}function K4(e){return e.classList||new q4(e)}function q4(e){this._node=e,this._names=G4(e.getAttribute(`class`)||``)}q4.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function J4(e,t){for(var n=K4(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Y4(e,t){for(var n=K4(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function NYe(e){return function(){J4(this,e)}}function PYe(e){return function(){Y4(this,e)}}function FYe(e,t){return function(){(t.apply(this,arguments)?J4:Y4)(this,e)}}function IYe(e,t){var n=G4(e+``);if(arguments.length<2){for(var r=K4(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?FYe:t?NYe:PYe)(n,t))}function LYe(){this.textContent=``}function RYe(e){return function(){this.textContent=e}}function zYe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function BYe(e){return arguments.length?this.each(e==null?LYe:(typeof e==`function`?zYe:RYe)(e)):this.node().textContent}function VYe(){this.innerHTML=``}function HYe(e){return function(){this.innerHTML=e}}function UYe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function WYe(e){return arguments.length?this.each(e==null?VYe:(typeof e==`function`?UYe:HYe)(e)):this.node().innerHTML}function GYe(){this.nextSibling&&this.parentNode.appendChild(this)}function KYe(){return this.each(GYe)}function qYe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function JYe(){return this.each(qYe)}function YYe(e){var t=typeof e==`function`?e:I4(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function XYe(){return null}function ZYe(e,t){var n=typeof e==`function`?e:I4(e),r=t==null?XYe:typeof t==`function`?t:L4(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function QYe(){var e=this.parentNode;e&&e.removeChild(this)}function $Ye(){return this.each(QYe)}function eXe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tXe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nXe(e){return this.select(e?tXe:eXe)}function rXe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function iXe(e){return function(t){e.call(this,t,this.__data__)}}function aXe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function oXe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function sXe(e,t,n){return function(){var r=this.__on,i,a=iXe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function cXe(e,t,n){var r=aXe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?sXe:oXe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function X4(e,t,n){var r=U4(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function lXe(e,t){return function(){return X4(this,e,t)}}function uXe(e,t){return function(){return X4(this,e,t.apply(this,arguments))}}function dXe(e,t){return this.each((typeof t==`function`?uXe:lXe)(e,t))}function*fXe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Z4=[null];function Q4(e,t){this._groups=e,this._parents=t}function $4(){return new Q4([[document.documentElement]],Z4)}function pXe(){return this}Q4.prototype=$4.prototype={constructor:Q4,select:zJe,selectAll:UJe,selectChild:qJe,selectChildren:ZJe,filter:QJe,data:iYe,enter:$Je,exit:oYe,join:sYe,merge:cYe,selection:pXe,order:lYe,sort:uYe,call:fYe,nodes:pYe,node:mYe,size:hYe,empty:gYe,each:_Ye,attr:wYe,style:OYe,property:MYe,classed:IYe,text:BYe,html:WYe,raise:KYe,lower:JYe,append:YYe,insert:ZYe,remove:$Ye,clone:nXe,datum:rXe,on:cXe,dispatch:dXe,[Symbol.iterator]:fXe};function e3(e){return typeof e==`string`?new Q4([[document.querySelector(e)]],[document.documentElement]):new Q4([[e]],Z4)}function mXe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function t3(e,t){if(e=mXe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var hXe={passive:!1},n3={capture:!0,passive:!1};function r3(e){e.stopImmediatePropagation()}function i3(e){e.preventDefault(),e.stopImmediatePropagation()}function a3(e){var t=e.document.documentElement,n=e3(e).on(`dragstart.drag`,i3,n3);`onselectstart`in t?n.on(`selectstart.drag`,i3,n3):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function o3(e,t){var n=e.document.documentElement,r=e3(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,i3,n3),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var s3=e=>()=>e;function c3(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}c3.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gXe(e){return!e.ctrlKey&&!e.button}function _Xe(){return this.parentNode}function vXe(e,t){return t??{x:e.x,y:e.y}}function yXe(){return navigator.maxTouchPoints||`ontouchstart`in this}function l3(){var e=gXe,t=_Xe,n=vXe,r=yXe,i={},a=j4(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,hXe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(e3(n.view).on(`mousemove.drag`,m,n3).on(`mouseup.drag`,h,n3),a3(n.view),r3(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(i3(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){e3(e.view).on(`mousemove.drag mouseup.drag`,null),o3(e.view,l),i3(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(r3(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(i3(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(r3(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=t3(l||r,t),p,m,h;if((h=n.call(e,new c3(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=t3(l||a,t),_=o;break}u.call(r,e,new c3(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:s3(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:s3(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:s3(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:s3(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function u3(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function d3(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function f3(){}var p3=.7,m3=1/p3,h3=`\\s*([+-]?\\d+)\\s*`,g3=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,_3=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,bXe=/^#([0-9a-f]{3,8})$/,xXe=RegExp(`^rgb\\(${h3},${h3},${h3}\\)$`),SXe=RegExp(`^rgb\\(${_3},${_3},${_3}\\)$`),CXe=RegExp(`^rgba\\(${h3},${h3},${h3},${g3}\\)$`),wXe=RegExp(`^rgba\\(${_3},${_3},${_3},${g3}\\)$`),TXe=RegExp(`^hsl\\(${g3},${_3},${_3}\\)$`),EXe=RegExp(`^hsla\\(${g3},${_3},${_3},${g3}\\)$`),v3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};u3(f3,x3,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:y3,formatHex:y3,formatHex8:DXe,formatHsl:OXe,formatRgb:b3,toString:b3});function y3(){return this.rgb().formatHex()}function DXe(){return this.rgb().formatHex8()}function OXe(){return M3(this).formatHsl()}function b3(){return this.rgb().formatRgb()}function x3(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=bXe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?S3(t):n===3?new T3(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?C3(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?C3(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xXe.exec(e))?new T3(t[1],t[2],t[3],1):(t=SXe.exec(e))?new T3(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=CXe.exec(e))?C3(t[1],t[2],t[3],t[4]):(t=wXe.exec(e))?C3(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=TXe.exec(e))?j3(t[1],t[2]/100,t[3]/100,1):(t=EXe.exec(e))?j3(t[1],t[2]/100,t[3]/100,t[4]):v3.hasOwnProperty(e)?S3(v3[e]):e===`transparent`?new T3(NaN,NaN,NaN,0):null}function S3(e){return new T3(e>>16&255,e>>8&255,e&255,1)}function C3(e,t,n,r){return r<=0&&(e=t=n=NaN),new T3(e,t,n,r)}function kXe(e){return e instanceof f3||(e=x3(e)),e?(e=e.rgb(),new T3(e.r,e.g,e.b,e.opacity)):new T3}function w3(e,t,n,r){return arguments.length===1?kXe(e):new T3(e,t,n,r??1)}function T3(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}u3(T3,w3,d3(f3,{brighter(e){return e=e==null?m3:m3**+e,new T3(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?p3:p3**+e,new T3(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new T3(k3(this.r),k3(this.g),k3(this.b),O3(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:E3,formatHex:E3,formatHex8:AXe,formatRgb:D3,toString:D3}));function E3(){return`#${A3(this.r)}${A3(this.g)}${A3(this.b)}`}function AXe(){return`#${A3(this.r)}${A3(this.g)}${A3(this.b)}${A3((isNaN(this.opacity)?1:this.opacity)*255)}`}function D3(){let e=O3(this.opacity);return`${e===1?`rgb(`:`rgba(`}${k3(this.r)}, ${k3(this.g)}, ${k3(this.b)}${e===1?`)`:`, ${e})`}`}function O3(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function k3(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function A3(e){return e=k3(e),(e<16?`0`:``)+e.toString(16)}function j3(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new N3(e,t,n,r)}function M3(e){if(e instanceof N3)return new N3(e.h,e.s,e.l,e.opacity);if(e instanceof f3||(e=x3(e)),!e)return new N3;if(e instanceof N3)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new N3(o,s,c,e.opacity)}function jXe(e,t,n,r){return arguments.length===1?M3(e):new N3(e,t,n,r??1)}function N3(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}u3(N3,jXe,d3(f3,{brighter(e){return e=e==null?m3:m3**+e,new N3(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?p3:p3**+e,new N3(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new T3(I3(e>=240?e-240:e+120,i,r),I3(e,i,r),I3(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new N3(P3(this.h),F3(this.s),F3(this.l),O3(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=O3(this.opacity);return`${e===1?`hsl(`:`hsla(`}${P3(this.h)}, ${F3(this.s)*100}%, ${F3(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function P3(e){return e=(e||0)%360,e<0?e+360:e}function F3(e){return Math.max(0,Math.min(1,e||0))}function I3(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var L3=e=>()=>e;function MXe(e,t){return function(n){return e+n*t}}function NXe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function PXe(e){return(e=+e)==1?R3:function(t,n){return n-t?NXe(t,n,e):L3(isNaN(t)?n:t)}}function R3(e,t){var n=t-e;return n?MXe(e,n):L3(isNaN(e)?t:e)}var z3=(function e(t){var n=PXe(t);function r(e,t){var r=n((e=w3(e)).r,(t=w3(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=R3(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function FXe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function IXe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function LXe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=W3(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function RXe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function B3(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zXe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=W3(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var V3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,H3=new RegExp(V3.source,`g`);function BXe(e){return function(){return e}}function VXe(e){return function(t){return e(t)+``}}function U3(e,t){var n=V3.lastIndex=H3.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=V3.exec(e))&&(i=H3.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:B3(r,i)})),n=H3.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?VXe(c[0].x):BXe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function W3(e,t){var n=typeof t,r;return t==null||n===`boolean`?L3(t):(n===`number`?B3:n===`string`?(r=x3(t))?(t=r,z3):U3:t instanceof x3?z3:t instanceof Date?RXe:IXe(t)?FXe:Array.isArray(t)?LXe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?zXe:B3)(e,t)}var G3=180/Math.PI,K3={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function q3(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*G3,skewX:Math.atan(c)*G3,scaleX:o,scaleY:s}}var J3;function HXe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?K3:q3(t.a,t.b,t.c,t.d,t.e,t.f)}function UXe(e){return e==null||(J3||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),J3.setAttribute(`transform`,e),!(e=J3.transform.baseVal.consolidate()))?K3:(e=e.matrix,q3(e.a,e.b,e.c,e.d,e.e,e.f))}function Y3(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:B3(e,i)},{i:c-2,x:B3(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:B3(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:B3(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:B3(e,n)},{i:s-2,x:B3(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var WXe=Y3(HXe,`px, `,`px)`,`deg)`),GXe=Y3(UXe,`, `,`)`,`)`),KXe=1e-12;function X3(e){return((e=Math.exp(e))+1/e)/2}function qXe(e){return((e=Math.exp(e))-1/e)/2}function JXe(e){return((e=Math.exp(2*e))-1)/(e+1)}var Z3=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<KXe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=X3(y),c=s/(n*g)*(i*JXe(t*r+y)-qXe(y));return[a+c*d,o+c*f,s*i/X3(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Q3=0,$3=0,e6=0,t6=1e3,n6,r6,i6=0,a6=0,o6=0,s6=typeof performance==`object`&&performance.now?performance:Date,c6=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function l6(){return a6||=(c6(YXe),s6.now()+o6)}function YXe(){a6=0}function u6(){this._call=this._time=this._next=null}u6.prototype=d6.prototype={constructor:u6,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?l6():+n)+(t==null?0:+t),!this._next&&r6!==this&&(r6?r6._next=this:n6=this,r6=this),this._call=e,this._time=n,p6()},stop:function(){this._call&&(this._call=null,this._time=1/0,p6())}};function d6(e,t,n){var r=new u6;return r.restart(e,t,n),r}function XXe(){l6(),++Q3;for(var e=n6,t;e;)(t=a6-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Q3}function f6(){a6=(i6=s6.now())+o6,Q3=$3=0;try{XXe()}finally{Q3=0,QXe(),a6=0}}function ZXe(){var e=s6.now(),t=e-i6;t>t6&&(o6-=t,i6=e)}function QXe(){for(var e,t=n6,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:n6=n);r6=e,p6(r)}function p6(e){Q3||($3&&=clearTimeout($3),e-a6>24?(e<1/0&&($3=setTimeout(f6,e-s6.now()-o6)),e6&&=clearInterval(e6)):(e6||=(i6=s6.now(),setInterval(ZXe,t6)),Q3=1,c6(f6)))}function m6(e,t,n){var r=new u6;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var $Xe=j4(`start`,`end`,`cancel`,`interrupt`),eZe=[];function h6(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;tZe(e,n,{name:t,index:r,group:i,on:$Xe,tween:eZe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function g6(e,t){var n=v6(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function _6(e,t){var n=v6(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function v6(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function tZe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=d6(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return m6(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(m6(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function y6(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function nZe(e){return this.each(function(){y6(this,e)})}function rZe(e,t){var n,r;return function(){var i=_6(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function iZe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=_6(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function aZe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=v6(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?rZe:iZe)(n,e,t))}function b6(e,t,n){var r=e._id;return e.each(function(){var e=_6(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return v6(e,r).value[t]}}function x6(e,t){var n;return(typeof t==`number`?B3:t instanceof x3?z3:(n=x3(t))?(t=n,z3):U3)(e,t)}function oZe(e){return function(){this.removeAttribute(e)}}function sZe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cZe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function lZe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function uZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function dZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function fZe(e,t){var n=F4(e),r=n===`transform`?GXe:x6;return this.attrTween(e,typeof t==`function`?(n.local?dZe:uZe)(n,r,b6(this,`attr.`+e,t)):t==null?(n.local?sZe:oZe)(n):(n.local?lZe:cZe)(n,r,t))}function pZe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mZe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&mZe(e,i)),n}return i._value=t,i}function gZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&pZe(e,i)),n}return i._value=t,i}function _Ze(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=F4(e);return this.tween(n,(r.local?hZe:gZe)(r,t))}function vZe(e,t){return function(){g6(this,e).delay=+t.apply(this,arguments)}}function yZe(e,t){return t=+t,function(){g6(this,e).delay=t}}function bZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?vZe:yZe)(t,e)):v6(this.node(),t).delay}function xZe(e,t){return function(){_6(this,e).duration=+t.apply(this,arguments)}}function SZe(e,t){return t=+t,function(){_6(this,e).duration=t}}function CZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?xZe:SZe)(t,e)):v6(this.node(),t).duration}function wZe(e,t){if(typeof t!=`function`)throw Error();return function(){_6(this,e).ease=t}}function TZe(e){var t=this._id;return arguments.length?this.each(wZe(t,e)):v6(this.node(),t).ease}function EZe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();_6(this,e).ease=n}}function DZe(e){if(typeof e!=`function`)throw Error();return this.each(EZe(this._id,e))}function OZe(e){typeof e!=`function`&&(e=z4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new C6(r,this._parents,this._name,this._id)}function kZe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new C6(o,this._parents,this._name,this._id)}function AZe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function jZe(e,t,n){var r,i,a=AZe(t)?g6:_6;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function MZe(e,t){var n=this._id;return arguments.length<2?v6(this.node(),n).on.on(e):this.each(jZe(n,e,t))}function NZe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function PZe(){return this.on(`end.remove`,NZe(this._id))}function FZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=L4(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,h6(l[f],t,n,f,l,v6(u,n)));return new C6(a,this._parents,t,n)}function IZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=R4(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=v6(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&h6(p,t,n,h,f,m);a.push(f),o.push(u)}return new C6(a,o,t,n)}var LZe=$4.prototype.constructor;function RZe(){return new LZe(this._groups,this._parents)}function zZe(e,t){var n,r,i;return function(){var a=W4(this,e),o=(this.style.removeProperty(e),W4(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function S6(e){return function(){this.style.removeProperty(e)}}function BZe(e,t,n){var r,i=n+``,a;return function(){var o=W4(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function VZe(e,t,n){var r,i,a;return function(){var o=W4(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),W4(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function HZe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=_6(this,e),l=c.on,u=c.value[a]==null?s||=S6(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function UZe(e,t,n){var r=(e+=``)==`transform`?WXe:x6;return t==null?this.styleTween(e,zZe(e,r)).on(`end.style.`+e,S6(e)):typeof t==`function`?this.styleTween(e,VZe(e,r,b6(this,`style.`+e,t))).each(HZe(this._id,e)):this.styleTween(e,BZe(e,r,t),n).on(`end.style.`+e,null)}function WZe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function GZe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&WZe(e,a,n)),r}return a._value=t,a}function KZe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,GZe(e,t,n??``))}function qZe(e){return function(){this.textContent=e}}function JZe(e){return function(){var t=e(this);this.textContent=t??``}}function YZe(e){return this.tween(`text`,typeof e==`function`?JZe(b6(this,`text`,e)):qZe(e==null?``:e+``))}function XZe(e){return function(t){this.textContent=e.call(this,t)}}function ZZe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&XZe(r)),t}return r._value=e,r}function QZe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,ZZe(e))}function $Ze(){for(var e=this._name,t=this._id,n=w6(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=v6(c,t);h6(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new C6(r,this._parents,e,n)}function eQe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=_6(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var tQe=0;function C6(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function nQe(e){return $4().transition(e)}function w6(){return++tQe}var T6=$4.prototype;C6.prototype=nQe.prototype={constructor:C6,select:FZe,selectAll:IZe,selectChild:T6.selectChild,selectChildren:T6.selectChildren,filter:OZe,merge:kZe,selection:RZe,transition:$Ze,call:T6.call,nodes:T6.nodes,node:T6.node,size:T6.size,empty:T6.empty,each:T6.each,on:MZe,attr:fZe,attrTween:_Ze,style:UZe,styleTween:KZe,text:YZe,textTween:QZe,remove:PZe,tween:aZe,delay:bZe,duration:CZe,ease:TZe,easeVarying:DZe,end:eQe,[Symbol.iterator]:T6[Symbol.iterator]};function rQe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var iQe={time:null,delay:0,duration:250,ease:rQe};function aQe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function oQe(e){var t,n;e instanceof C6?(t=e._id,e=e._name):(t=w6(),(n=iQe).time=l6(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&h6(c,e,t,l,o,n||aQe(c,t));return new C6(r,this._parents,e,t)}$4.prototype.interrupt=nZe,$4.prototype.transition=oQe;var E6=e=>()=>e;function sQe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function D6(e,t,n){this.k=e,this.x=t,this.y=n}D6.prototype={constructor:D6,scale:function(e){return e===1?this:new D6(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new D6(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var O6=new D6(1,0,0);k6.prototype=D6.prototype;function k6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return O6;return e.__zoom}function A6(e){e.stopImmediatePropagation()}function j6(e){e.preventDefault(),e.stopImmediatePropagation()}function cQe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function lQe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function M6(){return this.__zoom||O6}function uQe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dQe(){return navigator.maxTouchPoints||`ontouchstart`in this}function fQe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function N6(){var e=cQe,t=lQe,n=fQe,r=uQe,i=dQe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Z3,l=j4(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,M6).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,M6),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(O6.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new D6(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new D6(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new D6(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=e3(this.that).datum();l.call(e,this.that,new sQe(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=t3(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],y6(this),s.start();j6(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=e3(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=t3(t,i),l=t.clientX,u=t.clientY;a3(t.view),A6(t),a.mouse=[c,this.__zoom.invert(c)],y6(this),a.start();function d(e){if(j6(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=t3(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),o3(e.view,a.moved),j6(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=t3(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);j6(r),s>0?e3(this).transition().duration(s).call(x,d,c,r):e3(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(A6(t),s=0;s<i;++s)c=r[s],l=t3(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),y6(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(j6(e),s=0;s<a;++s)c=i[s],l=t3(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(A6(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=t3(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=e3(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:E6(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:E6(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:E6(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:E6([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var P6={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},F6=[[-1/0,-1/0],[1/0,1/0]],I6=[`Enter`,` `,`Escape`],L6={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},R6;(function(e){e.Strict=`strict`,e.Loose=`loose`})(R6||={});var z6;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(z6||={});var B6;(function(e){e.Partial=`partial`,e.Full=`full`})(B6||={});var V6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},H6;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(H6||={});var U6;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(U6||={});var W6;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(W6||={});var G6={[W6.Left]:W6.Right,[W6.Right]:W6.Left,[W6.Top]:W6.Bottom,[W6.Bottom]:W6.Top};function K6(e){return e===null?null:e?`valid`:`invalid`}var q6=e=>`id`in e&&`source`in e&&`target`in e,pQe=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),J6=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Y6=(e,t=[0,0])=>{let{width:n,height:r}=b8(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},mQe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:o8(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):J6(n)?n:t.nodeLookup.get(n.id)),i8(e,i?c8(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),X6=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=i8(n,c8(e)),r=!0)}),r?o8(n):{x:0,y:0,width:0,height:0}},Z6=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...m8(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=u8(s,s8(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},hQe=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function gQe(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function _Qe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=_8(X6(gQe(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function Q6({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,P6.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&y8(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=y8(d)?e8(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,P6.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function vQe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=hQe(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var $6=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),e8=(e={x:0,y:0},t,n)=>({x:$6(e.x,t[0][0],t[1][0]-(n?.width??0)),y:$6(e.y,t[0][1],t[1][1]-(n?.height??0))});function t8(e,t,n){let{width:r,height:i}=b8(n),{x:a,y:o}=n.internals.positionAbsolute;return e8(e,[[a,o],[a+r,o+i]],t)}var n8=(e,t,n)=>e<t?$6(Math.abs(e-t),1,t)/t:e>n?-$6(Math.abs(e-n),1,t)/t:0,r8=(e,t,n=15,r=40)=>[n8(e.x,r,t.width-r)*n,n8(e.y,r,t.height-r)*n],i8=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),a8=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),o8=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),s8=(e,t=[0,0])=>{let{x:n,y:r}=J6(e)?e.internals.positionAbsolute:Y6(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},c8=(e,t=[0,0])=>{let{x:n,y:r}=J6(e)?e.internals.positionAbsolute:Y6(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},l8=(e,t)=>o8(i8(a8(e),a8(t))),u8=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},d8=e=>f8(e.width)&&f8(e.height)&&f8(e.x)&&f8(e.y),f8=e=>!isNaN(e)&&isFinite(e),yQe=(e,t)=>{},p8=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),m8=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?p8(s,o):s},h8=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function g8(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function bQe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=g8(e,n),i=g8(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=g8(e.top??e.y??0,n),i=g8(e.bottom??e.y??0,n),a=g8(e.left??e.x??0,t),o=g8(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function xQe(e,t,n,r,i,a){let{x:o,y:s}=h8(e,[t,n,r]),{x:c,y:l}=h8({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var _8=(e,t,n,r,i,a)=>{let o=bQe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=$6(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=xQe(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},v8=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function y8(e){return e!=null&&e!==`parent`}function b8(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function x8(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function S8(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function C8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function SQe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function CQe(e){return{...L6,...e||{}}}function w8(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=k8(e),s=m8({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?p8(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var T8=e=>({width:e.offsetWidth,height:e.offsetHeight}),E8=e=>e?.getRootNode?.()||window?.document,wQe=[`INPUT`,`SELECT`,`TEXTAREA`];function D8(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?wQe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var O8=e=>`clientX`in e,k8=(e,t)=>{let n=O8(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},A8=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...T8(t)}})};function j8({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function M8(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function N8({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case W6.Left:return[t-M8(t-r,a),n];case W6.Right:return[t+M8(r-t,a),n];case W6.Top:return[t,n-M8(n-i,a)];case W6.Bottom:return[t,n+M8(i-n,a)]}}function P8({sourceX:e,sourceY:t,sourcePosition:n=W6.Bottom,targetX:r,targetY:i,targetPosition:a=W6.Top,curvature:o=.25}){let[s,c]=N8({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=N8({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=j8({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function F8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function TQe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function EQe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=i8(c8(e),c8(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),u8({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},o8(a))>0}var DQe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,OQe=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),kQe=(e,t,n={})=>{if(!e.source||!e.target)return P6.error006(),t;let r=n.getEdgeId||DQe,i;return i=q6(e)?{...e}:{...e,id:r(e)},OQe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function I8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=F8({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var L8={[W6.Left]:{x:-1,y:0},[W6.Right]:{x:1,y:0},[W6.Top]:{x:0,y:-1},[W6.Bottom]:{x:0,y:1}},AQe=({source:e,sourcePosition:t=W6.Bottom,target:n})=>t===W6.Left||t===W6.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},R8=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function jQe({source:e,sourcePosition:t=W6.Bottom,target:n,targetPosition:r=W6.Top,center:i,offset:a,stepPosition:o}){let s=L8[t],c=L8[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=AQe({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=F8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function MQe(e,t,n,r){let i=Math.min(R8(e,t)/2,R8(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function z8({sourceX:e,sourceY:t,sourcePosition:n=W6.Bottom,targetX:r,targetY:i,targetPosition:a=W6.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=jQe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=MQe(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function B8(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function NQe(e){let{sourceNode:t,targetNode:n}=e;if(!B8(t)||!B8(n))return null;let r=t.internals.handleBounds||V8(t.handles),i=n.internals.handleBounds||V8(n.handles),a=U8(r?.source??[],e.sourceHandle),o=U8(e.connectionMode===R6.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,P6.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||W6.Bottom,c=o?.position||W6.Top,l=H8(t,a,s),u=H8(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function V8(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function H8(e,t,n=W6.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??b8(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case W6.Top:return{x:i+o/2,y:a};case W6.Right:return{x:i+o,y:a+s/2};case W6.Bottom:return{x:i+o/2,y:a+s};case W6.Left:return{x:i,y:a+s/2}}}function U8(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function W8(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function PQe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=W8(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var G8=1e3,FQe=10,K8={nodeOrigin:[0,0],nodeExtent:F6,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},IQe={...K8,checkEquality:!0};function q8(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function LQe(e,t,n){let r=q8(K8,n);for(let n of e.values())if(n.parentId)X8(n,e,t,r);else{let e=e8(Y6(n,r.nodeOrigin),y8(n.extent)?n.extent:r.nodeExtent,b8(n));n.internals.positionAbsolute=e}}function RQe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function J8(e){return e===`manual`}function Y8(e,t,n,r={}){let i=q8(IQe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!J8(i.zIndexMode)?G8:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=e8(Y6(u,i.nodeOrigin),y8(u.extent)?u.extent:i.nodeExtent,b8(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:RQe(u,e),z:Z8(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&X8(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function zQe(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function X8(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=q8(K8,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zQe(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*FQe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=BQe(e,u,o,s,a&&!J8(c)?G8:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Z8(e,t,n){let r=f8(e.zIndex)?e.zIndex:0;return J8(n)?r:r+(e.selected?t:0)}function BQe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=b8(e),l=Y6(e,n),u=y8(e.extent)?e8(l,e.extent,c):l,d=e8({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=t8(d,c,t));let f=Z8(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Q8(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=l8(a.get(n.parentId)?.expandedRect??s8(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=b8(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function VQe(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=T8(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=y8(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=t8(h,s,t.get(e.parentId)):m&&(h=e8(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:A8(`source`,r.nodeElement,p,d,e.id),target:A8(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&X8(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:s8(g,i)}))}}if(f.length>0){let e=Q8(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function HQe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function $8(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function e5(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;$8(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),$8(`target`,s,c,e,i,o),t.set(r.id,r)}}function t5(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:t5(n,t):!1}function n5(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function UQe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!t5(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function r5({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function WQe({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=p8(a,t);return{x:o.x-a.x,y:o.y-a.y}}function GQe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=e3(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?a8(X6(s)):null,x=v&&l?WQe({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:p8(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Q6({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=r5({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=r8(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=w8(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=UQe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=r5({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=l3().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=w8(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=k8(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=w8(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=k8(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=k8(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=r5({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!n5(t,`.${g}`,v))&&(!_||n5(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function KQe(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())u8(i,s8(e))>0&&r.push(e);return r}var qQe=250;function JQe(e,t,n,r){let i=[],a=1/0,o=KQe(e,n,t+qQe);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=H8(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function i5(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...H8(o,c,c.position,!0)}:c}function a5(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function YQe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var o5=()=>!0;function XQe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=o5,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=E8(e.target),E=0,D,{x:O,y:k}=k8(e),A=a5(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=i5(i,A,r,c,t);if(!N)return;let P=k8(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=r8(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},te=c.get(i),B={inProgress:!0,isValid:null,from:H8(te,z,W6.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:te,to:P,toHandle:null,toPosition:G6[z.position],toNode:null,pointer:P};function V(){M=!0,y(B),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function ne(e){if(!M){let{x:t,y:n}=k8(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!z){re(e);return}let a=b();P=k8(e,j),D=JQe(m8(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=s5(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=YQe(!!D,s.isValid);let u=c.get(i),f=u?H8(u,z,W6.Left,!0):B.from,p={...B,from:f,isValid:L,to:s.toHandle&&L?h8({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:G6[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),B=p}function re(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=B,r={...n,toPosition:B.toHandle?B.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ne),T.removeEventListener(`mouseup`,re),T.removeEventListener(`touchmove`,ne),T.removeEventListener(`touchend`,re)}}T.addEventListener(`mousemove`,ne),T.addEventListener(`mouseup`,re),T.addEventListener(`touchmove`,ne),T.addEventListener(`touchend`,re)}function s5(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=o5,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=k8(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=a5(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===R6.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=i5(t,e,a,u,n,!0)}return _}var c5={onPointerDown:XQe,isValid:s5};function ZQe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=e3(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&v8()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=N6().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:t3}}var l5=e=>({x:e.x,y:e.y,zoom:e.k}),u5=({x:e,y:t,zoom:n})=>O6.translate(e,t).scale(n),d5=(e,t)=>e.target.closest(`.${t}`),f5=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),QQe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,p5=(e,t=0,n=QQe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},m5=e=>{let t=e.ctrlKey&&v8()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $Qe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(d5(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=t3(u),t=d*2**m5(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===z6.Vertical?0:u.deltaX*f,m=i===z6.Horizontal?0:u.deltaY*f;!v8()&&u.shiftKey&&i!==z6.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=l5(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function e$e({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=d5(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function t$e({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=l5(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function n$e({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&f5(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,l5(a.transform))}}function r$e({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&f5(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=l5(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function i$e({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(d5(d,`${l}-flow__node`)||d5(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||d5(d,s)&&m||d5(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function a$e({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=N6().scaleExtent([t,n]).translateExtent(r),f=e3(e).call(d);v({x:i.x,y:i.y,zoom:$6(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(m5);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?W3:Z3).transform(p5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!f8(E)||E<0?0:E);let k=O?$Qe({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):e$e({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=t$e({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=n$e({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=r$e({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=i$e({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(A),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=u5(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=u5(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=u5(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?k6(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?W3:Z3).scaleTo(p5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?W3:Z3).scaleBy(p5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!f8(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var h5;(function(e){e.Line=`line`,e.Handle=`handle`})(h5||={});function o$e({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function g5(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function _5(e,t){return Math.max(0,t-e)}function v5(e,t){return Math.max(0,e-t)}function y5(e,t,n){return Math.max(0,t-e,e-n)}function b5(e,t){return e?!t:t}function s$e(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=y5(E,h,g),j=y5(D,_,v);if(o){let e=0,t=0;c&&w<0?e=_5(y+w+O,o[0][0]):!c&&w>0&&(e=v5(y+E+O,o[1][0])),l&&T<0?t=_5(b+T+k,o[0][1]):!l&&T>0&&(t=v5(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=v5(y+w,s[0][0]):!c&&w<0&&(e=_5(y+E,s[1][0])),l&&T>0?t=v5(b+T,s[0][1]):!l&&T<0&&(t=_5(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=y5(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?v5(b+k+E/C,o[1][1])*C:_5(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?_5(b+E/C,s[1][1])*C:v5(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=y5(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?v5(y+D*C+O,o[1][0])/C:_5(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?_5(y+D*C,s[1][0])/C:v5(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(b5(c,l)?-w:w)/C:w=(b5(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var x5={width:0,height:0,x:0,y:0},c$e={...x5,pointerX:0,pointerY:0,aspectRatio:1};function l$e(e){return[[0,0],[e.measured.width,e.measured.height]]}function u$e(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function d$e({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=e3(e),o={controlDirection:g5(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...x5},h={...c$e};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:g5(e)};let g,_=null,v=[],y,b,x,S=!1,C=l3().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=w8(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?l$e(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=u$e(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=w8(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=s$e(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=o$e({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var S5=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},f$e=e=>e?S5(e):S5,{useDebugValue:p$e}=C.default,{useSyncExternalStoreWithSelector:m$e}=GC.default,h$e=e=>e;function C5(e,t=h$e,n){let r=m$e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p$e(r),r}var w5=(e,t)=>{let n=f$e(e),r=(e,r=t)=>C5(n,e,r);return Object.assign(r,n),r},g$e=(e,t)=>e?w5(e,t):w5;function T5(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var E5=(0,C.createContext)(null),_$e=E5.Provider,D5=P6.error001();function O5(e,t){let n=(0,C.useContext)(E5);if(n===null)throw Error(D5);return C5(n,e,t)}function k5(){let e=(0,C.useContext)(E5);if(e===null)throw Error(D5);return(0,C.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var A5={display:`none`},v$e={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},j5=`react-flow__node-desc`,M5=`react-flow__edge-desc`,y$e=`react-flow__aria-live`,b$e=e=>e.ariaLiveMessage,x$e=e=>e.ariaLabelConfig;function S$e({rfId:e}){let t=O5(b$e);return(0,G.jsx)(`div`,{id:`${y$e}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:v$e,children:t})}function C$e({rfId:e,disableKeyboardA11y:t}){let n=O5(x$e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`${j5}-${e}`,style:A5,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,G.jsx)(`div`,{id:`${M5}-${e}`,style:A5,children:n[`edge.a11yDescription.default`]}),!t&&(0,G.jsx)(S$e,{rfId:e})]})}var N5=(0,C.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,G.jsx)(`div`,{className:A4([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));N5.displayName=`Panel`;function w$e({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,G.jsx)(N5,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,G.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var T$e=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},P5=e=>e.id;function E$e(e,t){return T5(e.selectedNodes.map(P5),t.selectedNodes.map(P5))&&T5(e.selectedEdges.map(P5),t.selectedEdges.map(P5))}function D$e({onSelectionChange:e}){let t=k5(),{selectedNodes:n,selectedEdges:r}=O5(T$e,E$e);return(0,C.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var O$e=e=>!!e.onSelectionChangeHandlers;function k$e({onSelectionChange:e}){let t=O5(O$e);return e||t?(0,G.jsx)(D$e,{onSelectionChange:e}):null}var F5=typeof window<`u`?C.useLayoutEffect:C.useEffect,I5=[0,0],A$e={x:0,y:0,zoom:1},L5=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],j$e=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),R5={translateExtent:F6,nodeOrigin:I5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function M$e(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=O5(j$e,T5),l=k5();F5(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=R5,s()}),[]);let u=(0,C.useRef)(R5);return F5(()=>{for(let s of L5){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:CQe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},L5.map(t=>e[t])),null}function z5(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function N$e(e){let[t,n]=(0,C.useState)(e===`system`?null:e);return(0,C.useEffect)(()=>{if(e!==`system`){n(e);return}let t=z5(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?z5()?.matches?`dark`:`light`:t}var B5=typeof document<`u`?document:null;function V5(e=null,t={target:B5,actInsideInputWithModifier:!0}){let[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(!1),a=(0,C.useRef)(new Set([])),[o,s]=(0,C.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
459
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Y2(J2(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Y2(J2(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function Q2(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new W2||null,prettyErrors:t}}function hqe(e,t={}){let{lineCounter:n,prettyErrors:r}=Q2(t),i=new Z2(n?.addNewLine),a=new k2(t),o=Array.from(a.compose(i.parse(e)));if(r&&n)for(let t of o)t.errors.forEach(d2(e,n)),t.warnings.forEach(d2(e,n));return o.length>0?o:Object.assign([],{empty:!0},a.streamInfo())}function $2(e,t={}){let{lineCounter:n,prettyErrors:r}=Q2(t),i=new Z2(n?.addNewLine),a=new k2(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new l2(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(d2(e,n)),o.warnings.forEach(d2(e,n))),o}function gqe(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=$2(e,n);if(!i)return null;if(i.warnings.forEach(e=>a0(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function _qe(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return d1(e)&&!r?e.toString(n):new o2(e,r,n).toString(n)}var vqe=c({Alias:()=>I1,CST:()=>lqe,Composer:()=>k2,Document:()=>o2,Lexer:()=>U2,LineCounter:()=>W2,Pair:()=>f0,Parser:()=>Z2,Scalar:()=>z1,Schema:()=>a2,YAMLError:()=>c2,YAMLMap:()=>g0,YAMLParseError:()=>l2,YAMLSeq:()=>v0,YAMLWarning:()=>u2,isAlias:()=>u1,isCollection:()=>g1,isDocument:()=>d1,isMap:()=>f1,isNode:()=>_1,isPair:()=>p1,isScalar:()=>m1,isSeq:()=>h1,parse:()=>gqe,parseAllDocuments:()=>hqe,parseDocument:()=>$2,stringify:()=>_qe,visit:()=>S1,visitAsync:()=>w1});function yqe(e){let t=null;try{t=vqe.parse(e.doc.toString())}catch{}let n=gq(e,fq.YAML);return{data:t,pointers:n}}var e4=e=>{switch(e){case fq.JSON:return oKe;case fq.JSON5:return cKe;case fq.YAML:return yqe}};function bqe(e){return Object.entries(e)}function t4(e,t){if(typeof e==`string`||typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>t4(e,t));if(e instanceof Map){let n=new Map;for(let[r,i]of e){let e=r,a=t4(i,t);n.set(e,a)}return n}if(e instanceof Set){let n=new Set;for(let r of e){let e=t4(r,t);n.add(e)}return n}let n={};function r(e,r,i,a){i===e&&a===r?n[i]=t4(r,t):n[i]=a}for(let[n,i]of bqe(e)){let e=t(n,i);if(e.length===2&&typeof e[0]==`string`)r(n,i,e[0],e[1]);else for(let[t,a]of e)r(n,i,t,a)}return n}var xqe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Sqe=class{constructor(){this.completions=new Map,this.reservedKeys=new Set}reserve(e){this.reservedKeys.add(e)}add(e){this.reservedKeys.has(e.label)||this.completions.set(e.label,e)}};function n4(e){return!(!e||Fq(e)||e.name===`UnknownPropertyError`||e.type===`undefined`)}var Cqe=class{constructor(e){this.opts=e,this.originalSchema=null,this.schema=null,this.laxSchema=null,this.mode=fq.JSON,this.mode=e.mode??fq.JSON,this.parser=this.opts?.jsonParser??e4(this.mode)}doComplete(e){let t=kq(e.state);if(this.originalSchema!==t&&(this.schema=a4(t,t)??t,this.laxSchema=Tqe(this.schema)),!this.schema||!this.laxSchema)return[];cq.log(`xxx`,`trying with original schema`);let n=this.doCompleteForSchema(e,this.schema);return n.options.length===0?(cq.log(`xxx`,`no completions with original schema, trying with lax schema`),this.doCompleteForSchema(e,this.laxSchema)):n}doCompleteForSchema(e,t){let n={from:e.pos,to:e.pos,options:[],filter:!1},r=e.state.doc.sliceString(0),i=_q(e.state,e.pos),a=e.state.sliceDoc(i.from,e.pos).replace(/^(["'])/,``);if(cq.log(`xxx`,`node`,i,`prefix`,a,`ctx`,e),!(xq(i,this.mode)||Sq(i,this.mode))&&!e.explicit)return cq.log(`xxx`,`no completions for non-word/primitive`,i),n;let o=yq(e.state.doc,i),s=yq(e.state.doc,i,!1);if(i&&(xq(i,this.mode)||Sq(i,this.mode)))n.from=i.from,n.to=i.to;else{let t=e.matchBefore(/[A-Za-z0-9._]*/),a=e.pos-o.length;cq.log(`xxx`,`overwriteStart after`,a,`ctx.pos`,e.pos,`word`,t,`currentWord`,o,`=>`,r[a-1],`..`,r[a],`..`,r),n.from=i.name===lq.INVALID?t?.from??e.pos:a,n.to=e.pos}let c=new Sqe,l=!0,u=Dq(i,lq.PROPERTY_NAME,this.mode);if(u&&(cq.log(`xxx`,`closestPropertyNameNode`,u,`node`,i),i=u),Sq(i,this.mode)){cq.log(`xxx`,`isPropertyNameNode`,i);let e=i.parent;if(e){let t=Tq(e,this.mode);l=!t||t.name===lq.INVALID&&t.from-t.to===0||(t.parent?Cq(t.parent).length<=1:!1),cq.log(`xxx`,`addValue`,l,Tq(e,this.mode),i),i=Dq(e,lq.OBJECT,this.mode)??null}}if(cq.log(`xxx`,i,o,e,`node at pos`,_q(e.state,e.pos)),i&&[lq.OBJECT,lq.JSON_TEXT].includes(pq(i.name,this.mode))&&(Sq(_q(e.state,e.pos),this.mode)||u)){if(i.from===e.pos)return cq.log(`xxx`,`no completions for just before opening brace`),n;this.getPropertyCompletions(t,e,i,c,l,s)}else{let n=this.getValueCompletions(t,e,{},c);cq.log(`xxx`,`getValueCompletions res`,n)}return n.options=Array.from(c.completions.values()).filter(e=>vq(e.label).startsWith(a)),cq.log(`xxx`,`result`,n,`prefix`,a,`collector.completions`,c.completions,`reservedKeys`,c.reservedKeys),n}applySnippetCompletion(e){return wLe(typeof e.apply==`string`?e.apply:e.label,e)}getPropertyCompletions(e,t,n,r,i,a){let o=oRe(n,lq.PROPERTY,this.mode);cq.log(`xxx`,`getPropertyCompletions`,n,t,o),o.forEach(e=>{let n=yq(t.state.doc,wq(e,lq.PROPERTY_NAME,this.mode));r.reserve(vq(n))});let s=this.getSchemas(e,t);cq.log(`xxx`,`propertyCompletion schemas`,s),s.forEach(t=>{if(typeof t!=`object`)return;let n=t.properties;n&&Object.entries(n).forEach(([t,n])=>{if(typeof n==`object`){let o=n.description??``,s=n.type??``,c=Array.isArray(s)?s.toString():s,l={label:t,apply:this.getInsertTextForProperty(t,i,a,e,n),type:`property`,detail:c,info:()=>IY(`div`,{inner:t1(o)})};r.add(this.applySnippetCompletion(l))}});let o=t.propertyNames;if(typeof o==`object`&&(o.enum&&o.enum.forEach(t=>{let n=t?.toString();if(n){let t={label:n,apply:this.getInsertTextForProperty(n,i,a,e),type:`property`};r.add(this.applySnippetCompletion(t))}}),o.const)){let t=o.const.toString(),n={label:t,apply:this.getInsertTextForProperty(t,i,a,e),type:`property`};r.add(this.applySnippetCompletion(n))}})}getInsertTextForProperty(e,t,n,r,i){i&&=a4(i,r);let a=this.getInsertTextForPropertyName(e,n);if(!t)return a;a+=`: `;let o,s=0;if(typeof i==`object`){if(i.default!==void 0)o||=this.getInsertTextForGuessedValue(i.default,``),s++;else if(i.enum&&(!o&&i.enum.length===1&&(o=this.getInsertTextForGuessedValue(i.enum[0],``)),s+=i.enum.length),i.const!==void 0&&(o||=this.getInsertTextForGuessedValue(i.const,``),s++),Array.isArray(i.examples)&&i.examples.length&&(o||=this.getInsertTextForGuessedValue(i.examples[0],``),s+=i.examples.length),o===void 0&&s===0){let e=Array.isArray(i.type)?i.type[0]:i.type;switch(e||(i.properties?e=`object`:i.items&&(e=`array`)),e){case`boolean`:o=`#{}`;break;case`string`:o=this.getInsertTextForString(``);break;case`object`:switch(this.mode){case fq.JSON5:o=`{#{}}`;break;case fq.YAML:o=`#{}`;break;default:o=`{#{}}`;break}break;case`array`:o=`[#{}]`;break;case`number`:case`integer`:o=`#{0}`;break;case`null`:o=`#{null}`;break;default:o=`#{}`;break}}}return(!o||s>1)&&(cq.log(`xxx`,`value`,o,`nValueProposals`,s,i),o=`#{}`),a+o}getInsertTextForPropertyName(e,t){switch(this.mode){case fq.JSON5:case fq.YAML:return t.startsWith(`"`)?`"${e}"`:t.startsWith(`'`)?`'${e}'`:e;default:return`"${e}"`}}getInsertTextForString(e,t=`#`){switch(this.mode){case fq.JSON5:return`'${t}{${e}}'`;case fq.YAML:return`${t}{${e}}`;default:return`"${t}{${e}}"`}}getInsertTextForGuessedValue(e,t=``){switch(typeof e){case`object`:return e===null?"${null}"+t:this.getInsertTextForValue(e,t);case`string`:{let n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),this.getInsertTextForString(n,`$`)+t}case`number`:case`boolean`:return"${"+JSON.stringify(e)+`}`+t}return this.getInsertTextForValue(e,t)}getInsertTextForPlainText(e){return e.replace(/[\\$}]/g,`\\$&`)}getInsertTextForValue(e,t){let n=JSON.stringify(e,null,` `);return n===`{}`?`{#{}}`+t:n===`[]`?`[#{}]`+t:this.getInsertTextForPlainText(n+t)}getValueCompletions(e,t,n,r){let i=ZH(t.state).resolveInner(t.pos,-1),a=null,o;if(cq.log(`xxx`,`getValueCompletions`,i,t),i&&xq(i,this.mode)&&(a=i,i=i.parent),!i){this.addSchemaValueCompletions(e,n,r);return}if(pq(i.name,this.mode)===lq.PROPERTY){let e=wq(i,lq.PROPERTY_NAME,this.mode);e&&(o=yq(t.state.doc,e),i=i.parent)}if(cq.log(`xxx`,`node`,i,`parentKey`,o),i&&(o!==void 0||pq(i.name,this.mode)===lq.ARRAY)){let s=this.getSchemas(e,t);for(let e of s){if(typeof e!=`object`)return;if(pq(i.name,this.mode)===lq.ARRAY&&e.items){let t=r;if(e.uniqueItems&&(t=Object.assign(Object.assign({},t),{add(e){t.completions.has(e.label)||r.add(e)},reserve(e){r.reserve(e)}})),Array.isArray(e.items)){let r=0;if(a){let e=Eq(i,a,this.mode);e>=0&&(r=e)}let o=e.items[r];o&&this.addSchemaValueCompletions(o,n,t)}else this.addSchemaValueCompletions(e.items,n,t)}if((e.type==null||e.type!==`object`)&&this.addSchemaValueCompletions(e,n,r),o!==void 0){let t=!1;if(e.properties){let i=e.properties[o];i&&(t=!0,this.addSchemaValueCompletions(i,n,r))}if(e.patternProperties&&!t){for(let i of Object.keys(e.patternProperties))if(this.extendedRegExp(i)?.test(o)){t=!0;let a=e.patternProperties[i];a&&this.addSchemaValueCompletions(a,n,r)}}if(e.additionalProperties&&!t){let t=e.additionalProperties;this.addSchemaValueCompletions(t,n,r)}}n.boolean&&(this.addBooleanValueCompletion(!0,r),this.addBooleanValueCompletion(!1,r)),n.null&&this.addNullValueCompletion(r)}}return{valuePrefix:a?yq(t.state.doc,a,!0,!1):``}}addSchemaValueCompletions(e,t,n){typeof e==`object`&&(this.addEnumValueCompletions(e,n),this.addDefaultValueCompletions(e,n),this.collectTypes(e,t),Array.isArray(e.allOf)&&e.allOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.anyOf)&&e.anyOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)),Array.isArray(e.oneOf)&&e.oneOf.forEach(e=>this.addSchemaValueCompletions(e,t,n)))}addDefaultValueCompletions(e,t,n=0){let r=!1;if(e.default!==void 0){let i=e.type,a=e.default;for(let e=n;e>0;e--)a=[a],i=`array`;let o=Object.assign(Object.assign({type:i?.toString()},this.getAppliedValue(a)),{detail:`Default value`});t.add(o),r=!0}Array.isArray(e.examples)&&e.examples.forEach(i=>{let a=e.type,o=i;for(let e=n;e>0;e--)o=[o],a=`array`;t.add(Object.assign({type:a?.toString()},this.getAppliedValue(o))),r=!0}),!r&&typeof e.items==`object`&&!Array.isArray(e.items)&&n<5&&this.addDefaultValueCompletions(e.items,t,n+1)}addEnumValueCompletions(e,t){if(e.const!==void 0&&t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(e.const)),{info:e.description})),Array.isArray(e.enum))for(let n=0,r=e.enum.length;n<r;n++){let r=e.enum[n];t.add(Object.assign(Object.assign({type:e.type?.toString()},this.getAppliedValue(r)),{info:e.description}))}}addBooleanValueCompletion(e,t){t.add({type:`boolean`,label:e?`true`:`false`})}addNullValueCompletion(e){e.add({type:`null`,label:`null`})}collectTypes(e,t){if(Array.isArray(e.enum)||e.const!==void 0)return;let n=e.type;Array.isArray(n)?n.forEach(e=>t[e]=!0):n&&(t[n]=!0)}getSchemas(e,t){let{data:n}=this.parser(t.state),r=new FY(e),i=hq(t.state,t.pos,-1,this.mode);if(i===``&&(i=void 0),i!=null&&i.endsWith(`/`)){i=i.substring(0,i.length-1);let t=r4(e,n,i);if(t!=null)return[t]}let a=i?.replace(/\/[^/]*$/,``);a===``&&(a=void 0);let o=r4(e,n,a),s=i?.split(`/`).pop(),c=s==null||s in(o?.properties??{}),l=r.getSchema({pointer:i,data:n??void 0});return!c&&l?.type===`null`&&this.mode===`yaml`&&(l=void 0),cq.log(`xxxx`,`draft.getSchema`,l,`data`,n,`pointer`,i,`pointerPointsToKnownProperty`,c),Fq(l)&&(l=l.data?.schema),!n4(l)&&o?[o]:(n4(l)||(l=r.getSchema({pointer:a}),i=a),cq.log(`xxx`,`pointer..`,JSON.stringify(i)),!n4(l)&&(!i||i===`/`)&&(l=a4(e,e)??e),cq.log(`xxx`,`subSchema..`,l),l?Array.isArray(l.allOf)?[l,...l.allOf.map(t=>a4(t,e))]:Array.isArray(l.oneOf)?[l,...l.oneOf.map(t=>a4(t,e))]:Array.isArray(l.anyOf)?[l,...l.anyOf.map(t=>a4(t,e))]:[l]:[])}getAppliedValue(e){let t=vq(JSON.stringify(e));switch(this.mode){case fq.JSON5:return{label:t,apply:iRe(JSON.stringify(e))};case fq.YAML:return{label:t,apply:t};default:return{label:t,apply:JSON.stringify(e)}}}getValueFromLabel(e){return JSON.parse(e)}extendedRegExp(e){let t=``;e.startsWith(`(?i)`)&&(e=e.substring(4),t=`i`);try{return new RegExp(e,t+`u`)}catch{try{return new RegExp(e,t)}catch{return}}}};function wqe(e={}){let t=new Cqe(e);return function(e){return t.doComplete(e)}}function Tqe(e){return t4(e,(e,t)=>e===`additionalProperties`&&t===!1||e===`required`&&Array.isArray(t)||e===`unevaluatedProperties`&&t===!1||e===`unevaluatedItems`&&t===!1?[]:[e,t])}function r4(e,t,n){let r=new FY(e),i=r.getSchema({pointer:n,data:t??void 0});if(!n4(i))return;let a=i4(r,i),o={};for(let e of a){let i=Dqe(n,e),a=r.getSchema({pointer:i,data:t??void 0});n4(a)&&Object.assign(o,{[e]:a})}if(a.length===0||Object.keys(o).length===0)return;let s=i,{allOf:c,anyOf:l,oneOf:u}=s,d=xqe(s,[`allOf`,`anyOf`,`oneOf`]);return Object.assign(Object.assign({},d),{properties:o})}function i4(e,t){if(t=a4(t,e.rootSchema),typeof t!=`object`||!t)return[];let n=[];function r(t){let r=i4(e,t);n.push(...r)}if(typeof t.properties==`object`&&t.properties!=null&&n.push(...Object.keys(t.properties)),typeof t.then==`object`&&t.then!=null&&r(t.then),Array.isArray(t.allOf))for(let e of t.allOf)r(e);if(Array.isArray(t.anyOf))for(let e of t.anyOf)r(e);if(Array.isArray(t.oneOf))for(let e of t.oneOf)r(e);return n}function a4(e,t){if(typeof e==`object`&&e.$ref){let n=Eqe(t,e.$ref);if(typeof n==`object`){let t=Object.assign(Object.assign({},e),n);return Reflect.deleteProperty(t,`$ref`),t}}return e}function Eqe(e,t){let n=t.split(`/`),r=e;return n.forEach(t=>{if(t){if(t===`#`){r=e;return}typeof r==`object`&&(r=r[t])}}),r}function Dqe(e,t){return e===void 0?`/${t}`:`${e}/${t}`}var o4=(e,t)=>{let n=e.length>2,r=e.map((n,r)=>{let i="`"+(t?t(n):n)+"`";return r===e.length-1?`or `+i:i});return n?r.join(`, `):r.join(` `)},Oqe=e=>e?.data?.pointer&&e?.data?.pointer!==`#`?e.data.pointer.slice(1):e?.data?.property?`/${e.data.property}`:``,kqe=e=>e.startState.field(Oq)!==e.state.field(Oq);function Aqe(e){let t=new Mqe(e);return e=>t.doValidation(e)}var jqe=[`NoAdditionalPropertiesError`,`RequiredPropertyError`,`InvalidPropertyNameError`,`ForbiddenPropertyError`,`UndefinedValueError`],Mqe=class{constructor(e){this.options=e,this.schema=null,this.mode=fq.JSON,this.rewriteError=e=>{let t=e?.data?.errors;return e.code===`one-of-error`&&t?.length?`Expected one of ${o4(t,e=>e.data.expected)}`:e.code===`type-error`?`Expected \`${e?.data?.expected&&Array.isArray(e?.data?.expected)?o4(e?.data?.expected):e?.data?.expected}\` but received \`${e?.data?.received}\``:e.message.replaceAll("in `#` ",``).replaceAll("at `#`",``).replaceAll(`/`,`.`).replaceAll(`#.`,``)},this.mode=this.options?.mode??fq.JSON,this.parser=this.options?.jsonParser??e4(this.mode)}get schemaTitle(){return this.schema?.getSchema()?.title??`json-schema`}doValidation(e){let t=kq(e.state);if(!t||(this.schema=new jY(t),!this.schema)||!e.state.doc.toString()?.length)return[];let n=this.parser(e.state);if(n.data==null)return[];let r=[];try{r=this.schema.validate(n.data)}catch{}return cq.log(`xxx`,`validation errors`,r,n.data),r.length?r.reduce((e,t)=>{let r=()=>{let n=this.rewriteError(t);e.push({from:0,to:0,message:n,severity:`error`,source:this.schemaTitle,renderMessage:()=>{let e=IY(`div`,{});return e.innerHTML=t1(n),e}})},i=Oqe(t),a=n.pointers.get(i);if(t.name===`MaxPropertiesError`||t.name===`MinPropertiesError`||i===``)r();else if(a){let n=jqe.includes(t.name),r=this.rewriteError(t),i=n?a.keyFrom:a.valueFrom,o=n?a.keyTo:a.valueTo;o!==void 0&&i!==void 0&&e.push({from:i,to:o,message:r,renderMessage:()=>{let e=IY(`div`,{});return e.innerHTML=t1(r),e},severity:`error`,source:this.schemaTitle})}else r();return e},[]):[]}};function Nqe(e){let t=new Fqe(e);return async function(e,n,r){return t.doHover(e,n,r)}}function Pqe(e){if(e.type)return e.$ref?`${e.$ref} (${e.type})`:e.type;if(e.$ref)return`${e.$ref}`}function s4(e,t,n){return`${t}: ${o4(e[t].map(e=>{try{let{data:t}=n.resolveRef({data:e,pointer:e.$ref});return Pqe(t||e)}catch{return e.type}}))}`}var Fqe=class{constructor(e){this.opts=e,this.schema=null,this.mode=fq.JSON,this.opts=Object.assign({parser:JSON.parse},this.opts),this.mode=this.opts?.mode??fq.JSON}getDataForCursor(e,t,n){let r=kq(e.state);if(!r)return null;this.schema=new jY(r);let i=hq(e.state,t,n,this.mode),a;try{a=this.opts.parser(e.state.doc.toString())}catch{}if(!i)return null;let o=this.schema.getSchema({pointer:i,data:a,withSchemaWarning:!0});return Fq(o)&&(o=o?.data.schema.$ref?this.schema.resolveRef(o):o?.data.schema),{schema:o,pointer:i}}formatMessage(e){let{message:t,typeInfo:n}=e;return t?IY(`div`,{class:`cm6-json-schema-hover`},[IY(`div`,{class:`cm6-json-schema-hover--description`,inner:t1(t,!1)}),IY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[IY(`div`,{class:`cm6-json-schema-hover--code`,inner:t1(n,!1)})])]):IY(`div`,{class:`cm6-json-schema-hover`},[IY(`div`,{class:`cm6-json-schema-hover--code-wrapper`},[IY(`code`,{class:`cm6-json-schema-hover--code`,inner:t1(n,!1)})])])}getHoverTexts(e,t){let n=``,r=null,{schema:i}=e;return i.oneOf&&(n=s4(i,`oneOf`,t)),i.anyOf&&(n=s4(i,`anyOf`,t)),i.allOf&&(n=s4(i,`allOf`,t)),i.type&&(n=Array.isArray(i.type)?o4(i.type):i.type),i.$ref&&(n=` Reference: ${i.$ref}`),i.enum&&(n=`\`enum\`: ${o4(i.enum)}`),i.format&&(n+=`\`format\`: ${i.format}`),i.pattern&&(n+=`\`pattern\`: ${i.pattern}`),i.description&&(r=i.description),{message:r,typeInfo:n}}async doHover(e,t,n){let r=t,i=t;try{let a=this.getDataForCursor(e,t,n);if(cq.log(`cursorData`,a),!a?.schema)return null;let o=(this.opts?.getHoverTexts??this.getHoverTexts)(a,this.schema),s=(this.opts?.formatHover??this.formatMessage)(o);return{pos:r,end:i,arrow:!0,above:!0,create:e=>({dom:s})}}catch(e){return cq.log(e),null}}},Iqe=e=>(0,G.jsx)($v,{disablePadding:!0,children:e.validationErrors.map((e,t)=>(0,G.jsx)(ny,{disableGutters:!0,disablePadding:!0,children:(0,G.jsxs)(Hv,{direction:`row`,spacing:1,children:[(0,G.jsx)(Q,{variant:`body2`,children:`•`}),(0,G.jsx)(Q,{variant:`caption`,children:e.instancePath.length===0?`/`:e.instancePath}),(0,G.jsx)(Q,{variant:`body2`,children:e.message})]})},t.toString()))}),c4=e=>{let t;try{t=JSON.parse(e)}catch{t=void 0}return t};function Lqe({schema:e,customValidate:t}){let n=(0,C.useMemo)(()=>new cF.default({allErrors:!0}),[]);return(0,C.useCallback)(r=>{let i=[];return n.validate(e,r),i.push(...n.errors??[]),i.push(...t?.(r)??[]),i},[n,e,t])}var Rqe=e=>{let t=zqe(),[n,r]=(0,C.useState)(()=>JSON.stringify(e.value,null,2)),i=Lqe(e),[a,o]=(0,C.useState)([]);(0,C.useEffect)(()=>{o(i(e.value))},[i,e.value]);let s=e.onChange,c=(0,C.useCallback)(e=>{let t=c4(e),n=i(t);s(t,n.length===0),r(e),o(n)},[i,s]),l=()=>{let e=c4(n);e&&r(JSON.stringify(e,null,2))};return(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Z,{position:`relative`,children:[(0,G.jsx)(oq,{value:n,onChange:e=>c(e),extensions:[MPe(),tW(APe(),{delay:100}),tW(Aqe(),{delay:100,needsRefresh:kqe}),UU.data.of({autocomplete:wqe({mode:`json4`})}),DH(Nqe()),lRe(e.schema)],theme:t,height:`400px`}),(0,G.jsx)(mv,{sx:{position:`absolute`,right:`0`,bottom:`0`},onClick:()=>l(),children:`Prettify`})]}),a.length>0&&(0,G.jsx)(Uh,{severity:`error`,variant:`outlined`,children:(0,G.jsx)(Iqe,{validationErrors:a})})]})};function zqe(){return wm().palette.mode===`dark`?eFe:XPe}var Bqe=[{value:``,label:`Auto (based on domain/name)`},{value:`light`,label:`💡 Light`},{value:`switch`,label:`🔌 Switch`},{value:`climate`,label:`🌡️ Climate`},{value:`cover`,label:`🪟 Cover`},{value:`fan`,label:`🌀 Fan`},{value:`lock`,label:`🔒 Lock`},{value:`sensor`,label:`📊 Sensor`},{value:`media_player`,label:`📺 Media Player`},{value:`vacuum`,label:`🧹 Vacuum`},{value:`remote`,label:`🎮 Remote`},{value:`humidifier`,label:`💧 Humidifier`},{value:`speaker`,label:`🔊 Speaker`},{value:`garage`,label:`🚗 Garage`},{value:`door`,label:`🚪 Door`},{value:`window`,label:`🪟 Window`},{value:`motion`,label:`🏃 Motion`},{value:`battery`,label:`🔋 Battery`},{value:`power`,label:`⚡ Power`},{value:`camera`,label:`📷 Camera`},{value:`default`,label:`🔗 Default`}],Vqe=({bridgeId:e,selectedIcon:t,onIconChange:n})=>{let r=(0,C.useRef)(null),[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null);(0,C.useEffect)(()=>{e&&wE(e).then(t=>{a(t),t&&s(`${TE(e)}?t=${Date.now()}`)}).catch(()=>{a(!1)})},[e]);let f=(0,C.useCallback)(async t=>{let i=t.target.files?.[0];if(!(!i||!e)){d(null),l(!0);try{await kge(e,i),a(!0),s(`${TE(e)}?t=${Date.now()}`),n(void 0)}catch(e){d(e instanceof Error?e.message:`Upload failed`)}finally{l(!1),r.current&&(r.current.value=``)}}},[e,n]),p=(0,C.useCallback)(async()=>{if(e){d(null);try{await Age(e),a(!1),s(null)}catch(e){d(e instanceof Error?e.message:`Delete failed`)}}},[e]),m=(0,C.useCallback)(e=>{n(e===``?void 0:e)},[n]);return(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(kv,{fullWidth:!0,size:`small`,children:[(0,G.jsx)(Bx,{id:`icon-select-label`,children:`Bridge Icon`}),(0,G.jsx)(SS,{labelId:`icon-select-label`,value:t??``,label:`Bridge Icon`,onChange:e=>m(e.target.value),disabled:i,children:Bqe.map(e=>(0,G.jsx)(CS,{value:e.value,children:e.label},e.value))}),(0,G.jsx)(TS,{children:i?`Custom icon is set. Delete it to use preset icons.`:`Select a preset icon or upload a custom image`})]}),e&&(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,gutterBottom:!0,children:`Custom Icon`}),(0,G.jsxs)(Hv,{direction:`row`,spacing:2,alignItems:`center`,children:[i&&o&&(0,G.jsx)(Z,{component:`img`,src:o,alt:`Custom bridge icon`,sx:{width:48,height:48,objectFit:`contain`,borderRadius:1,border:`1px solid`,borderColor:`divider`}}),(0,G.jsx)(`input`,{ref:r,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/svg+xml`,style:{display:`none`},onChange:f}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(Uhe,{}),onClick:()=>r.current?.click(),disabled:c,children:c?`Uploading...`:`Upload Image`}),i&&(0,G.jsx)(mv,{variant:`outlined`,size:`small`,color:`error`,startIcon:(0,G.jsx)(LS,{}),onClick:p,children:`Delete`})]}),u&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:1},children:u}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,display:`block`},children:`Supported formats: PNG, JPG, GIF, WebP, SVG (max 5MB)`})]}),!e&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:`Save the bridge first to upload a custom icon.`})]})},l4={light:`Light`,switch:`On/Off Plug-in Unit`,lock:`Door Lock`,fan:`Fan`,binary_sensor:`Sensor`,sensor:`Sensor`,cover:`Window Covering`,climate:`Thermostat`,media_player:`Speaker / Video Player`,vacuum:`Robot Vacuum Cleaner`,humidifier:`Humidifier`,valve:`Water Valve`,alarm_control_panel:`On/Off Plug-in Unit`,event:`Generic Switch`,button:`Generic Switch`,input_button:`Generic Switch`,automation:`On/Off Switch`,script:`On/Off Switch`,scene:`On/Off Switch`,remote:`On/Off`,water_heater:`Water Heater`,input_boolean:`On/Off Plug-in Unit`,select:`Mode Select`,input_select:`Mode Select`,siren:`On/Off Plug-in Unit`,weather:`Sensor`},u4=e=>{try{return JSON.parse(e)}catch{return}};function Hqe({filter:e}){let[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useRef)(null),u=(0,C.useRef)(``),d=(0,C.useCallback)(async()=>{n(!0),o(null);try{let t=await fetch(`api/matter/filter-preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),n=await t.text(),r=u4(n);if(!t.ok){let e=typeof r==`object`&&r&&`error`in r?String(r.error):n||`Failed to fetch preview`;throw Error(e)}i(r??u4(n)),c(!0)}catch(e){o(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},[e]);(0,C.useEffect)(()=>{if(!(e.include.length>0&&e.include.some(e=>e.type&&e.value))){i(null),c(!1);return}let t=JSON.stringify(e);if(t!==u.current)return u.current=t,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{d()},800),()=>{l.current&&clearTimeout(l.current)}},[e,d]);let f=r?r.entities.reduce((e,t)=>(e[t.domain]=(e[t.domain]||0)+1,e),{}):{},p=[];if(r){r.entities.some(e=>e.domain===`vacuum`)&&p.push(`This filter includes a vacuum. Consider using Server Mode (standalone device node) for Apple Home/Alexa compatibility.`),r.total>50&&p.push(`${r.total} entities is a large number. Consider splitting across multiple bridges for better stability.`);let e=Object.keys(f).filter(e=>!l4[e]);e.length>0&&p.push(`Unsupported domains will be skipped: ${e.join(`, `)}`)}return(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(mv,{variant:`outlined`,startIcon:t?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(uge,{}),onClick:d,disabled:t,size:`small`,children:t?`Loading...`:`Preview Matching Entities`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mt:1},children:a}),(0,G.jsx)(Zv,{in:s&&r!==null,children:r&&(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsxs)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:[r.total,` entities match`]}),r.truncated&&(0,G.jsx)(Ev,{label:`Showing first 100`,size:`small`,color:`warning`,variant:`outlined`})]}),p.length>0&&(0,G.jsx)(Hv,{spacing:.5,sx:{mb:1.5},children:p.map(e=>(0,G.jsx)(Uh,{severity:`warning`,variant:`outlined`,icon:e.includes(`vacuum`)?(0,G.jsx)(uv,{fontSize:`small`}):(0,G.jsx)(Sb,{fontSize:`small`}),sx:{py:0},children:(0,G.jsx)(Q,{variant:`caption`,children:e})},e))}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mb:2,children:Object.entries(f).sort((e,t)=>t[1]-e[1]).map(([e,t])=>(0,G.jsx)(Ev,{label:`${e}: ${t}${l4[e]?` → ${l4[e]}`:``}`,size:`small`,variant:`outlined`,color:l4[e]?`default`:`warning`},e))}),(0,G.jsx)($v,{dense:!0,sx:{maxHeight:200,overflow:`auto`,bgcolor:`background.paper`,borderRadius:1,border:1,borderColor:`divider`},children:r.entities.map(e=>(0,G.jsx)(ny,{divider:!0,children:(0,G.jsx)(oy,{primary:e.friendly_name||e.entity_id,secondary:`${e.entity_id}${l4[e.domain]?` → ${l4[e.domain]}`:``}`,primaryTypographyProps:{variant:`body2`},secondaryTypographyProps:{variant:`caption`,fontFamily:`monospace`}})},e.entity_id))}),(0,G.jsx)(mv,{size:`small`,onClick:()=>c(!1),sx:{mt:1},children:`Hide Preview`})]})})]})}var Uqe=hF().ObjectFieldTemplate;function Wqe(e){return(e.fieldPathId?.$id??``)===`root_filter`?(0,G.jsx)(Gqe,{...e}):(0,G.jsx)(Uqe,{...e})}function Gqe(e){let t=(e.formData?.include?.length??0)+(e.formData?.exclude?.length??0),[n,r]=(0,C.useState)(t>0);return(0,G.jsxs)(iC,{expanded:n,onChange:(e,t)=>r(t),variant:`outlined`,disableGutters:!0,sx:{borderRadius:2,"&::before":{display:`none`},overflow:`hidden`},children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),sx:{px:2,"& .MuiAccordionSummary-content":{alignItems:`center`,gap:1.5}},children:[(0,G.jsx)(_b,{fontSize:`small`,color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,children:`Entity Filters`}),(0,G.jsx)(Lx,{badgeContent:t,color:`primary`,sx:{ml:1},max:99,children:(0,G.jsx)(Z,{})}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{ml:1},children:n?`Click to collapse`:`${t} rule${t===1?``:`s`} configured`})]}),(0,G.jsx)(aC,{sx:{px:2,pb:2},children:e.properties.map(e=>(0,G.jsx)(`div`,{children:e.content},e.name))})]})}function Kqe(e){let t=(0,C.useRef)(e),n=t.current;return t.current=e,n}function d4(e){let{items:t,canAdd:n,onAddClick:r,title:i,formData:a}=e,o=a??[],[s,c]=(0,C.useState)(()=>new Set),[l,u]=(0,C.useState)(``),d=Kqe(o.length);(0,C.useEffect)(()=>{if(o.length>d){let e=o.length-1,t=o[e];!t?.type&&!t?.value&&c(t=>new Set([...t,e]))}},[o,d]);let f=(0,C.useCallback)(e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),p=(0,C.useMemo)(()=>{if(!l.trim())return null;let e=l.toLowerCase(),t=[];for(let n=0;n<o.length;n++){let r=o[n],i=r?.type??``,a=r?.value??``;(i.toLowerCase().includes(e)||a.toLowerCase().includes(e))&&t.push(n)}return new Set(t)},[l,o]),m=(0,C.useMemo)(()=>{let e=Array.from({length:t.length},(e,t)=>t);return p?e.filter(e=>p.has(e)):e},[t.length,p]);return(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,children:i}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Ev,{label:t.length,size:`small`,color:`default`,sx:{height:22,fontSize:`0.75rem`}}),n&&(0,G.jsx)(mv,{size:`small`,startIcon:(0,G.jsx)(fb,{}),onClick:r,children:`Add`})]})]}),t.length>3&&(0,G.jsx)(ES,{size:`small`,fullWidth:!0,placeholder:`Search rules...`,value:l,onChange:e=>u(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(fF,{position:`start`,children:(0,G.jsx)(hE,{fontSize:`small`,color:`action`})})}},sx:{mb:1}}),p&&m.length===0&&(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,py:2,children:`No matching rules`}),(0,G.jsx)(Hv,{spacing:.5,children:m.map(e=>{let n=o[e],r=n?.type??``,i=n?.value??``,a=s.has(e);return(0,G.jsxs)(Z,{sx:{border:1,borderColor:`divider`,borderRadius:1,overflow:`hidden`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,sx:{px:1.5,py:.75,cursor:`pointer`,"&:hover":{bgcolor:`action.hover`},bgcolor:a?`action.selected`:`transparent`},onClick:()=>f(e),children:[a?(0,G.jsx)(jhe,{fontSize:`small`,color:`action`}):(0,G.jsx)(Nhe,{fontSize:`small`,color:`action`}),r||i?(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,ml:.5,flex:1,minWidth:0,children:[(0,G.jsx)(Ev,{label:r,size:`small`,variant:`outlined`,sx:{height:22,fontSize:`0.75rem`,flexShrink:0}}),(0,G.jsx)(Q,{variant:`body2`,noWrap:!0,sx:{flex:1,minWidth:0},children:i})]}):(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,ml:.5,fontStyle:`italic`,children:`New rule (click to configure)`})]}),(0,G.jsx)(Zv,{in:a,children:(0,G.jsx)(Z,{sx:{px:2,pb:1.5,pt:.5},children:t[e]})})]},e)})})]})}var qqe=new Set([``,`pattern`,`regex`]);function Jqe(e){let{schema:t,formData:n,onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=n??{},c=s.type??``,l=s.value??``,u=i||a,d=t.properties??{},f=(d.type?.oneOf??[]).filter(e=>typeof e.const==`string`),p=d.value?.title??`Value`,m=f.find(e=>e.const===c),h=(0,C.useCallback)(e=>r({...s,type:e},o.path),[s,r,o]),g=(0,C.useCallback)(e=>r({...s,value:e},o.path),[s,r,o]),_=qqe.has(c)&&!u;return(0,G.jsxs)(Hv,{spacing:2,sx:{pt:1},children:[(0,G.jsxs)(kv,{fullWidth:!0,size:`small`,disabled:u,children:[(0,G.jsx)(Bx,{id:`${o.path}-type`,children:`Type`}),(0,G.jsx)(SS,{labelId:`${o.path}-type`,label:`Type`,value:c,onChange:e=>h(e.target.value),children:f.map(e=>(0,G.jsx)(CS,{value:e.const,children:e.title??e.const},e.const))})]}),m?.description&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:m.description}),_?(0,G.jsx)(XS,{value:l,onChange:g,label:p,placeholder:`sensor.living_room_*`,helperText:`Search or type an entity ID. Wildcards and regex still work.`,margin:`none`}):(0,G.jsx)(ES,{fullWidth:!0,size:`small`,label:p,value:l,disabled:u,onChange:e=>g(e.target.value),helperText:d.value?.description})]})}function Yqe(e){let{schema:t,formData:n={},onChange:r,disabled:i,readonly:a,fieldPathId:o}=e,s=t.properties??{},c=(0,C.useCallback)((e,t)=>{r({...n,[e]:t},o.path)},[n,r,o]);return(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:`Feature Flags`}),(0,G.jsx)(Fv,{container:!0,spacing:2,children:Object.entries(s).map(([e,t])=>{let r=n[e]??t.default??!1;return(0,G.jsx)(Fv,{size:{xs:12,sm:6,lg:4},children:(0,G.jsx)(hv,{variant:`outlined`,sx:{height:`100%`,opacity:t.title?.toLowerCase().includes(`deprecated`)??!1?.6:1,transition:`border-color 0.2s, box-shadow 0.2s`,borderColor:r?`primary.main`:`divider`,"&:hover":{transform:`none`,boxShadow:`none`}},children:(0,G.jsx)(_v,{onClick:()=>{!i&&!a&&c(e,!r)},disabled:i||a,sx:{height:`100%`},children:(0,G.jsxs)(vv,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:1,children:[(0,G.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,G.jsx)(Q,{variant:`subtitle2`,fontWeight:600,sx:{lineHeight:1.3},children:t.title??e}),r&&(0,G.jsx)(Ev,{label:`Active`,size:`small`,color:`primary`,variant:`outlined`,sx:{mt:.5,height:20,fontSize:`0.7rem`}})]}),(0,G.jsx)(KS,{checked:r,size:`small`,disabled:i||a,tabIndex:-1,onClick:e=>e.stopPropagation(),onChange:t=>c(e,t.target.checked)})]}),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{mt:1,lineHeight:1.4,flex:1},children:t.description})]})})})},e)})})]})}var f4=e=>{let{t}=ws(),[n,r]=(0,C.useState)(`FIELDS_EDITOR`),i=()=>{r(n===`FIELDS_EDITOR`?`JSON_EDITOR`:`FIELDS_EDITOR`)},[a,o]=(0,C.useState)(e.bridge),[s,c]=(0,C.useState)(!0),l=(0,C.useCallback)(t=>{let n=t;if(!n?.port)return[];let r=e.usedPorts[n.port];return r!==void 0&&r!==e.bridgeId?[{instancePath:`/port`,message:`Port is already used by bridge with id ${r}`}]:[]},[e.bridgeId,e.usedPorts]),u=(e,t)=>{let n=e=>e?.icon;o(t=>{let r=n(t);return r==null?{...e}:{...e,icon:r}}),c(t)},d=(0,C.useCallback)(e=>{o(t=>{if(e!=null)return{...t,icon:e};let{icon:n,...r}=t??{};return r})},[]),f=(0,C.useMemo)(()=>{let e=a?.featureFlags,t=[];return e?.serverMode&&t.push({severity:`warning`,message:`Server Mode is enabled. The node carries up to 10 devices; the first entity is the primary and drives the node name and type. More than one device is experimental.`}),e?.serverMode&&e?.vacuumOnOff===!1&&t.push({severity:`warning`,message:`Server Mode with Vacuum OnOff disabled: Alexa REQUIRES the OnOff cluster (PowerController) for robotic vacuums. Without it, the vacuum commissions but never appears in Alexa. Only disable this for Apple Home.`}),!e?.serverMode&&e?.vacuumOnOff&&t.push({severity:`warning`,message:`Vacuum OnOff is enabled in bridge mode. This adds a non-standard cluster to the RVC device type which may cause issues with Apple Home and Google Home.`}),e?.autoForceSync&&e?.autoComposedDevices&&t.push({severity:`warning`,message:`Auto Force Sync with Auto Composed Devices increases network traffic. Composed devices have more clusters, so each sync cycle sends more data.`}),t},[a]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Uh,{severity:`warning`,variant:`outlined`,children:[`Please consult`,` `,(0,G.jsx)(Gv,{href:J9.faq.bridgeConfig,target:`_blank`,children:`the documentation`}),` `,`for proper bridge configurations.`,` `,(0,G.jsx)(`strong`,{children:`Especially if you are using labels, see the "Labels" section.`})]}),(0,G.jsxs)(Uh,{severity:`info`,variant:`outlined`,children:[(0,G.jsx)(`strong`,{children:`Community tip:`}),` Users have reported that bridges with a large number of devices can become unstable depending on the controller. If you experience connectivity issues, consider splitting your devices across multiple bridges.`]}),f.map(e=>(0,G.jsx)(Uh,{severity:e.severity,variant:`outlined`,children:e.message},e.message)),(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(mv,{onClick:()=>i(),title:t(n===`FIELDS_EDITOR`?`bridge.jsonEditor`:`bridge.formEditor`),children:n===`FIELDS_EDITOR`?(0,G.jsx)(hge,{}):(0,G.jsx)(rge,{})})}),n===`FIELDS_EDITOR`&&(0,G.jsx)(qke,{value:a??{},onChange:u,schema:sv,uiSchema:{icon:{"ui:widget":`hidden`},featureFlags:{"ui:field":`featureFlags`},filter:{include:{"ui:options":{ArrayFieldTemplate:d4},items:{"ui:field":`entityFilterRule`}},exclude:{"ui:options":{ArrayFieldTemplate:d4},items:{"ui:field":`entityFilterRule`}}}},customValidate:l,templates:{ObjectFieldTemplate:Wqe},fields:{featureFlags:Yqe,entityFilterRule:Jqe}}),n===`JSON_EDITOR`&&(0,G.jsx)(Rqe,{value:a??{},onChange:u,schema:sv,customValidate:l}),a?.filter&&(0,G.jsx)(Hqe,{filter:a.filter}),(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsxs)(vv,{children:[(0,G.jsx)(Q,{variant:`subtitle1`,gutterBottom:!0,fontWeight:600,children:t(`bridge.iconLabel`)}),(0,G.jsx)(Vqe,{bridgeId:e.bridgeId,selectedIcon:a?.icon,onIconChange:d})]})}),(0,G.jsxs)(Fv,{container:!0,children:[(0,G.jsx)(Fv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(mv,{fullWidth:!0,variant:`outlined`,color:`error`,onClick:e.onCancel,children:t(`common.cancel`)})}),(0,G.jsx)(Fv,{size:{xs:0,sm:4,md:6},sx:{display:{xs:`none`,sm:`block`}}}),(0,G.jsx)(Fv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(mv,{fullWidth:!0,variant:`outlined`,disabled:!s,onClick:async()=>{s&&await e.onSave(a)},children:t(`common.save`)})})]})]})]})},Xqe={name:``,featureFlags:{},filter:{include:[],exclude:[]}};function Zqe(e){let t=5540;for(;e[t];)t++;return t}var Qqe=()=>{let{t:e}=ws(),t=qv(),n=Nr(),[r,i]=(0,C.useState)(),a=!!RT().content?.length,o=zT(),s=(0,C.useCallback)(e=>{i(e?.id)},[]),c=(0,C.useMemo)(()=>{if(!o)return;let e=Zqe(o);if(r){let t=ev.find(e=>e.id===r);if(t)return{name:t.name,port:e,filter:{...t.filter},featureFlags:{...t.featureFlags},icon:t.icon}}return{...Xqe,port:e}},[o,r]),l=VT(),u=()=>{n(-1)};return!c||!o?e(`common.loading`):(0,G.jsxs)(Hv,{spacing:4,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:e(`common.create`),to:J9.createBridge}]}),a&&(0,G.jsx)(Uh,{severity:`info`,variant:`outlined`,children:(0,G.jsxs)(Q,{children:[`Did you know that you can connect the same bridge with multiple assistants?`,` `,(0,G.jsx)(Gv,{href:J9.faq.multiFabric,target:`_blank`,children:`Learn more.`})]})}),(0,G.jsx)(zE,{selectedTemplate:r,onSelect:s}),(0,G.jsx)(f4,{bridge:c,usedPorts:o,onSave:async n=>{await l({...n}).then(()=>t.show({message:e(`bridge.saveSuccess`),severity:`success`})).then(()=>u()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:u},r??`custom`)]})},$qe=()=>{let{t:e}=ws(),t=qv(),n=Nr(),{bridgeId:r}=Lr(),{content:i,isLoading:a}=BT(r),o=zT(),s=lhe(),c=(0,C.useMemo)(()=>{if(!(a||!i))return{name:i.name,port:i.port,filter:i.filter,...i.countryCode!=null&&{countryCode:i.countryCode},...i.featureFlags!=null&&{featureFlags:i.featureFlags},...i.icon!=null&&{icon:i.icon},...i.priority!=null&&{priority:i.priority},...i.serialNumberSuffix!=null&&{serialNumberSuffix:i.serialNumberSuffix},...i.uniqueIdSuffix!=null&&{uniqueIdSuffix:i.uniqueIdSuffix}}},[a,i]),l=()=>{n(-1)};return a||!o?e(`common.loading`):!i||!c?e(`notFound.title`):(0,G.jsxs)(Hv,{spacing:4,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:i.name,to:J9.bridge(r)},{name:e(`common.edit`),to:J9.editBridge(r)}]}),(0,G.jsx)(f4,{bridgeId:r,bridge:c,usedPorts:o,onSave:async n=>{await s({...n,id:r}).then(()=>t.show({message:e(`bridge.updateSuccess`),severity:`success`})).then(()=>l()).catch(e=>t.show({message:e.message,severity:`error`}))},onCancel:l})]})};async function eJe(){let e=await fetch(`api/backup/snapshots`);return await M_(e,`Failed to fetch backups`),j_(e)}async function tJe(){let e=await fetch(`api/backup/snapshots/create`,{method:`POST`});return await M_(e,`Failed to create backup`),j_(e)}async function nJe(e){let t=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/download`);if(!t.ok)throw Error(`Failed to download backup`);let n=await t.blob(),r=window.URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i)}async function rJe(e,t){let n=await fetch(`api/backup/snapshots/${encodeURIComponent(e)}/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({overwriteExisting:!0,includeMappings:!0,restoreIdentity:!0,...t})});return await M_(n,`Failed to restore backup`),j_(n)}async function iJe(e){await M_(await fetch(`api/backup/snapshots/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete backup`)}async function aJe(){let e=await fetch(`api/backup/settings`);return await M_(e,`Failed to fetch backup settings`),j_(e)}async function oJe(e){let t=await fetch(`api/backup/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return await M_(t,`Failed to update backup settings`),j_(t)}function sJe(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function p4(){let{t:e}=ws(),[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(new Set),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(!0),[h,g]=(0,C.useState)(!0),[_,v]=(0,C.useState)(!1),[y,b]=(0,C.useState)(!1),[x,S]=(0,C.useState)(null),w=(0,C.useRef)(null),[T,E]=(0,C.useState)([]),[D,O]=(0,C.useState)(!0),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(null),[F,I]=(0,C.useState)(!1),L=(0,C.useCallback)(async()=>{try{O(!0);let[e,t]=await Promise.all([eJe(),aJe()]);E(e),A(t)}catch(e){i(e instanceof Error?e.message:`Failed to load backups`)}finally{O(!1)}},[]);(0,C.useEffect)(()=>{L()},[L]);let R=async()=>{I(!0),i(null);try{await tJe(),o(e(`backup.snapshotCreated`)),await L()}catch(e){i(e instanceof Error?e.message:`Failed to create backup`)}finally{I(!1)}},ee=async e=>{try{await nJe(e)}catch(e){i(e instanceof Error?e.message:`Failed to download backup`)}},z=async t=>{n(!0),i(null);try{let n=await rJe(t);n.errors.length>0?i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`):o(e(`backup.snapshotRestored`,{bridges:n.bridgesRestored,mappings:n.mappingsRestored,identities:n.identitiesRestored})),M(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Failed to restore backup`)}finally{n(!1)}},te=async e=>{try{await iJe(e),P(null),await L()}catch(e){i(e instanceof Error?e.message:`Failed to delete backup`)}},B=async e=>{try{A(await oJe(e))}catch(e){i(e instanceof Error?e.message:`Failed to update settings`)}},V=async(t=!1)=>{n(!0),i(null);try{let n=await fetch(t?`api/backup/download?includeIdentity=true`:`api/backup/download`);if(!n.ok)throw Error(`Failed to create backup`);let r=await n.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=n.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]||`hamh-backup.zip`,document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(i),document.body.removeChild(a),o(e(`backup.downloadSuccess`))}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}},ne=async e=>{let t=e.target.files?.[0];if(t){S(t),n(!0),i(null);try{let e=new FormData;e.append(`file`,t);let n=await fetch(`api/backup/restore/preview`,{method:`POST`,body:e});if(!n.ok){let e=await n.text(),t=`Failed to parse backup`;try{let n=JSON.parse(e);n.error&&(t=n.error)}catch{e&&(t=`${t} (HTTP ${n.status}: ${e.slice(0,120)})`)}throw Error(t)}let r=await n.json();c(r),u(new Set(r.bridges.map(e=>e.id))),v(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1),w.current&&(w.current.value=``)}}},re=async()=>{if(x){n(!0),i(null);try{let e=new FormData;e.append(`file`,x),e.append(`options`,JSON.stringify({bridgeIds:Array.from(l),overwriteExisting:d,includeMappings:p,restoreIdentity:h&&s?.includesIdentity}));let t=await fetch(`api/backup/restore`,{method:`POST`,body:e});if(!t.ok){let e=await t.text(),n=`Failed to restore backup`;try{let t=JSON.parse(e);t.error&&(n=t.error)}catch{e&&(n=`${n} (HTTP ${t.status}: ${e.slice(0,120)})`)}throw Error(n)}let n=await t.json();if(n.errors.length>0)i(`Restored ${n.bridgesRestored} bridges with ${n.errors.length} errors`);else{let e=[`Restored ${n.bridgesRestored} bridges`];n.mappingsRestored>0&&e.push(`${n.mappingsRestored} entity mappings`),n.identitiesRestored>0&&e.push(`${n.identitiesRestored} identities`),o(`${e.join(`, `)}!`)}v(!1),c(null),S(null),n.restartRequired&&b(!0)}catch(e){i(e instanceof Error?e.message:`Unknown error`)}finally{n(!1)}}},ie=e=>{let t=new Set(l);t.has(e)?t.delete(e):t.add(e),u(t)};return(0,G.jsxs)(hv,{children:[(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,children:[(0,G.jsx)(YT,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.title`)]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`backup.description`)}),r&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},onClose:()=>i(null),children:r}),a&&(0,G.jsx)(Uh,{severity:`success`,sx:{mb:2},onClose:()=>o(null),children:a}),(0,G.jsxs)(Fv,{container:!0,spacing:2,children:[(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(YT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.configBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.configBackupNote`)})]}),(0,G.jsx)(mv,{variant:`contained`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(YT,{}),onClick:()=>V(!1),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.configBackup`)})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(gE,{color:`warning`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.fullBackup`)})]}),(0,G.jsxs)(Z,{sx:{flexGrow:1},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupDesc`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.fullBackupWarning`)})]}),(0,G.jsx)(mv,{variant:`contained`,color:`warning`,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(YT,{}),onClick:()=>V(!0),disabled:t,fullWidth:!0,sx:{mt:2},children:e(`backup.fullBackup`)})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2,height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(pE,{color:`info`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.restoreFromBackup`)})]}),(0,G.jsx)(Z,{sx:{flexGrow:1},children:(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`backup.restoreDesc`)})}),(0,G.jsxs)(mv,{variant:`outlined`,color:`info`,startIcon:(0,G.jsx)(pE,{}),component:`label`,disabled:t,fullWidth:!0,sx:{mt:2},children:[e(`backup.restoreFromBackup`),(0,G.jsx)(`input`,{ref:w,type:`file`,accept:`.zip`,hidden:!0,onChange:ne})]})]})})]}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(YT,{color:`primary`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.storedBackups`)}),T.length>0&&(0,G.jsx)(Ev,{label:T.length,size:`small`,color:`primary`,variant:`outlined`})]}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:F?(0,G.jsx)(Rh,{size:16,color:`inherit`}):(0,G.jsx)(fb,{}),onClick:R,disabled:F,children:e(`backup.createSnapshot`)})]}),D?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:2,children:(0,G.jsx)(Rh,{size:24})}):T.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:2},children:e(`backup.noSnapshots`)}):(0,G.jsx)($v,{dense:!0,children:T.map(t=>(0,G.jsxs)(ny,{secondaryAction:(0,G.jsxs)(Z,{display:`flex`,gap:.5,children:[(0,G.jsx)(db,{title:e(`backup.downloadSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>ee(t.filename),children:(0,G.jsx)(PT,{fontSize:`small`})})}),(0,G.jsx)(db,{title:e(`backup.restoreSnapshot`),children:(0,G.jsx)(Bh,{size:`small`,color:`warning`,onClick:()=>M(t.filename),children:(0,G.jsx)(pE,{fontSize:`small`})})}),(0,G.jsx)(db,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:()=>P(t.filename),children:(0,G.jsx)(LS,{fontSize:`small`})})})]}),children:[(0,G.jsx)(iy,{sx:{minWidth:36},children:(0,G.jsx)(YT,{fontSize:`small`,color:t.auto?`action`:`primary`})}),(0,G.jsx)(oy,{primary:(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`v`,t.version]}),(0,G.jsx)(Ev,{label:t.auto?e(`backup.auto`):e(`backup.manual`),size:`small`,variant:`outlined`,color:t.auto?`default`:`primary`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:sJe(t.sizeBytes)})]}),secondary:new Date(t.createdAt).toLocaleString()})]},t.filename))}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:2,children:[(0,G.jsx)(FT,{color:`action`}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`backup.settings`)})]}),k&&(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,maxWidth:400},children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(KS,{checked:k.autoBackup,onChange:e=>B({autoBackup:e.target.checked})}),label:e(`backup.autoBackupLabel`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:-1},children:e(`backup.autoBackupDesc`)}),(0,G.jsx)(ES,{label:e(`backup.retentionCount`),type:`number`,size:`small`,value:k.backupRetentionCount,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=100&&B({backupRetentionCount:t})},inputProps:{min:1,max:100},helperText:e(`backup.retentionCountDesc`),sx:{maxWidth:200}})]})]}),(0,G.jsxs)(Rb,{open:_,onClose:()=>v(!1),maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:e(`backup.restoreTitle`)}),(0,G.jsx)(Bb,{children:s&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,gutterBottom:!0,children:[`Backup created: `,new Date(s.createdAt).toLocaleString()]}),s.includesIdentity&&(0,G.jsx)(Uh,{severity:`info`,sx:{mt:1},children:`This backup includes Matter identity data (keypairs, fabric credentials). Restoring identities allows bridges to reconnect without re-commissioning.`}),(0,G.jsxs)(Q,{variant:`subtitle2`,sx:{mt:2,mb:1},children:[e(`backup.selectBridges`),`:`]}),(0,G.jsx)($v,{dense:!0,children:s.bridges.map(e=>(0,G.jsxs)(ny,{onClick:()=>ie(e.id),sx:{cursor:`pointer`},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(Cv,{edge:`start`,checked:l.has(e.id),tabIndex:-1,disableRipple:!0})}),(0,G.jsx)(oy,{primary:e.name,secondary:(0,G.jsxs)(G.Fragment,{children:[`Port: `,e.port,e.hasMappings&&` • ${e.mappingCount} entity mappings`,e.exists&&(0,G.jsx)(Q,{component:`span`,color:`warning.main`,sx:{ml:1},children:`(exists)`})]})})]},e.id))}),(0,G.jsxs)(Z,{sx:{mt:2},children:[(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:d,onChange:e=>f(e.target.checked)}),label:e(`backup.overwriteExisting`)}),(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:p,onChange:e=>m(e.target.checked)}),label:e(`backup.includeMappings`)}),s?.includesIdentity&&(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{checked:h,onChange:e=>g(e.target.checked)}),label:e(`backup.restoreIdentities`)})]})]})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>v(!1),children:e(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:re,disabled:t||l.size===0,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(Rb,{open:y,onClose:()=>b(!1),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(fE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.restartRequired`)]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Q,{children:e(`backup.restartMessage`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:e(`backup.restartNote`)})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>b(!1),children:e(`common.later`)}),(0,G.jsx)(mv,{variant:`contained`,color:`warning`,onClick:async()=>{n(!0);try{await fetch(`api/backup/restart`,{method:`POST`}),o(`Application is restarting...`)}catch(e){i(e instanceof Error?e.message:`Failed to restart`)}finally{n(!1),b(!1)}},disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):(0,G.jsx)(fE,{}),children:e(`backup.restartNow`)})]})]}),(0,G.jsxs)(Rb,{open:j!==null,onClose:()=>M(null),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(pE,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmRestore`)]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Q,{children:e(`backup.confirmRestoreMessage`,{filename:j})}),(0,G.jsx)(Uh,{severity:`warning`,sx:{mt:2},children:e(`backup.restoreWarning`)})]}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>M(null),children:e(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,color:`warning`,onClick:()=>j&&z(j),disabled:t,startIcon:t?(0,G.jsx)(Rh,{size:20,color:`inherit`}):null,children:e(`backup.restore`)})]})]}),(0,G.jsxs)(Rb,{open:N!==null,onClose:()=>P(null),children:[(0,G.jsxs)(Vb,{children:[(0,G.jsx)(LS,{sx:{mr:1,verticalAlign:`middle`}}),e(`backup.confirmDelete`)]}),(0,G.jsx)(Bb,{children:(0,G.jsx)(Q,{children:e(`backup.confirmDeleteMessage`,{filename:N})})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:()=>P(null),children:e(`common.cancel`)}),(0,G.jsx)(mv,{variant:`contained`,color:`error`,onClick:()=>N&&te(N),children:e(`common.delete`)})]})]})]})}function cJe(e,t){return e.map(e=>{let n=t.filter(t=>t.fabricIndex===e.fabricIndex),r=n.reduce((e,t)=>e+t.subscriptionCount,0),i=n.map(e=>e.lastActiveMsAgo).filter(e=>e!=null),a=i.length?Math.min(...i):null,o=r>0&&a!=null&&a>12e4;return{fabricIndex:e.fabricIndex,rootVendorId:e.rootVendorId,label:e.label,ecosystem:Wre(e.rootVendorId),connected:n.length>0,stale:o,subscriptions:r,sessions:n.length,lastActiveMsAgo:a}})}function lJe({fabrics:e,sessions:t}){let{t:n}=ws(),r=cJe(e,t);return r.length===0?null:(0,G.jsx)(hv,{variant:`outlined`,children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1.5,children:[(0,G.jsx)(iE,{fontSize:`small`,color:`action`}),(0,G.jsx)(Q,{variant:`h6`,children:n(`health.fabricHealth`)})]}),(0,G.jsx)(Hv,{spacing:1,children:r.map(e=>{let t=e.connected?e.stale?{label:n(`health.stale`),color:`warning`}:{label:n(`health.connected`),color:`success`}:{label:n(`health.offline`),color:`default`};return(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1,children:[(0,G.jsx)(Ev,{size:`small`,color:t.color,label:t.label,sx:{minWidth:88}}),(0,G.jsxs)(Q,{variant:`body2`,sx:{fontWeight:600},children:[xx(e.rootVendorId),e.label?` (${e.label})`:``]}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[n(`health.subscriptions`),`: `,e.subscriptions,e.lastActiveMsAgo==null?``:` | ${n(`health.lastActiveAgo`,{seconds:Math.round(e.lastActiveMsAgo/1e3)})}`]})]},e.fabricIndex)})})]})})}var uJe=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function dJe(e={}){let{t}=ws(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!0),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(`name`),[u,d]=(0,C.useState)(`asc`),f=e.sortField??c,p=e.sortDirection??u,m=e.onSortFieldChange??l,h=e.onSortDirectionChange??d,g=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/health/detailed`);e.ok?(r(await e.json()),s(null)):s(t(`health.fetchFailed`))}catch{s(t(`health.connectionError`))}finally{a(!1)}},[t]);(0,C.useEffect)(()=>{g();let e=setInterval(g,1e4);return()=>clearInterval(e)},[g]);let _=(0,C.useCallback)(async()=>{try{let e=await fetch(`api/diagnostic/export`);if(e.ok){let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.headers.get(`Content-Disposition`)?.match(/filename="(.+)"/)?.[1]??`hamh-diagnostic-${new Date().toISOString().replace(/[:.]/g,`-`)}.json`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}}catch{s(t(`health.exportFailed`))}},[t]),v=async e=>{try{await fetch(`api/matter/bridges/${e}/actions/restart`,{method:`POST`}),g()}catch{s(t(`health.restartFailed`))}};return i?(0,G.jsx)(Z,{display:`flex`,justifyContent:`center`,p:4,children:(0,G.jsx)(Rh,{})}):o||!n?(0,G.jsx)(Uh,{severity:`error`,sx:{m:2},children:o??t(`health.unableToLoad`)}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[n.status===`healthy`?(0,G.jsx)(lv,{color:`success`}):n.status===`degraded`?(0,G.jsx)(Yv,{color:`warning`}):(0,G.jsx)(Cx,{color:`error`}),(0,G.jsx)(Q,{variant:`h5`,children:t(`health.systemHealth`)}),(0,G.jsx)(Ev,{label:n.status.toUpperCase(),color:n.status===`healthy`?`success`:n.status===`degraded`?`warning`:`error`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(XT,{}),onClick:_,children:t(`health.exportDiagnostic`)}),(0,G.jsx)(db,{title:t(`common.refresh`),children:(0,G.jsx)(Bh,{onClick:g,"aria-label":`Refresh health data`,children:(0,G.jsx)(dE,{})})})]})]}),(0,G.jsxs)(Fv,{container:!0,spacing:2,children:[(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.version`)}),(0,G.jsx)(Q,{variant:`h6`,children:n.version})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.uptime`)}),(0,G.jsx)(Q,{variant:`h6`,children:uJe(n.uptime)})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:4},children:(0,G.jsxs)(Wm,{sx:{p:2},children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:t(`health.homeAssistant`)}),(0,G.jsx)(Ev,{label:n.services.homeAssistant.connected?t(`health.connected`):t(`health.disconnected`),color:n.services.homeAssistant.connected?`success`:`error`,size:`small`})]})})]}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(sE,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.bridgeStatus`)}),(0,G.jsx)(Ev,{label:`${n.services.bridges.running}/${n.services.bridges.total} ${t(`common.running`)}`,size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(Mx,{fontSize:`small`,color:`action`}),(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:120},children:[(0,G.jsx)(Bx,{children:t(`health.sortBy`)}),(0,G.jsxs)(SS,{value:f,label:t(`health.sortBy`),onChange:e=>m(e.target.value),children:[(0,G.jsx)(CS,{value:`name`,children:t(`common.name`)}),(0,G.jsx)(CS,{value:`created`,children:t(`health.created`)})]})]}),(0,G.jsx)(db,{title:t(p===`asc`?`health.ascending`:`health.descending`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>h(p===`asc`?`desc`:`asc`),"aria-label":`Sort ${p===`asc`?`descending`:`ascending`}`,children:p===`asc`?(0,G.jsx)(qT,{fontSize:`small`}):(0,G.jsx)(KT,{fontSize:`small`})})})]})]}),(0,G.jsx)(Fv,{container:!0,spacing:2,alignItems:`stretch`,children:[...n.bridgeDetails].sort((e,t)=>{let n=0;return n=f===`name`?e.name.localeCompare(t.name):e.id.localeCompare(t.id),p===`asc`?n:-n}).map(e=>(0,G.jsx)(Fv,{size:{xs:12,sm:6,md:6,lg:4,xl:3},sx:{display:`flex`},children:(0,G.jsx)(hv,{variant:`outlined`,sx:{width:`100%`,height:`100%`,minWidth:280,maxWidth:480,display:`flex`,flexDirection:`column`,borderColor:e.status===`running`?`success.main`:e.status===`failed`?`error.main`:`warning.main`},children:(0,G.jsxs)(vv,{sx:{flex:1,display:`flex`,flexDirection:`column`,p:2,"&:last-child":{pb:2}},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,flexShrink:0,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,minWidth:0,children:[(0,G.jsx)(mb,{}),(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,noWrap:!0,sx:{maxWidth:140},children:e.name})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:.5,flexShrink:0,children:[(0,G.jsx)(Ev,{label:e.status.toUpperCase(),color:e.status===`running`?`success`:e.status===`failed`?`error`:`warning`,size:`small`}),e.status===`failed`&&(0,G.jsx)(db,{title:t(`bridge.restart`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>v(e.id),children:(0,G.jsx)(Phe,{})})})]})]}),e.statusReason&&(0,G.jsx)(Q,{variant:`body2`,color:`error`,sx:{mt:1,flexShrink:0},children:e.statusReason}),(0,G.jsx)(Z,{sx:{mt:`auto`,pt:1,flexShrink:0},children:(0,G.jsxs)(Z,{display:`flex`,flexWrap:`wrap`,gap:.5,alignItems:`center`,children:[(0,G.jsx)(Ev,{label:`${t(`common.port`)} ${e.port}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(Ev,{label:`${e.deviceCount} ${t(`common.devices`)}`,size:`small`,variant:`outlined`,color:`default`}),(0,G.jsx)(Ev,{label:`${e.fabricCount} ${t(`common.fabrics`)}`,size:`small`,variant:`outlined`,color:`default`}),e.failedEntityCount>0&&(0,G.jsx)(Ev,{label:`${e.failedEntityCount} failed`,color:`error`,size:`small`})]})}),e.connectivity&&e.status===`running`&&(0,G.jsx)(Z,{sx:{mt:1,flexShrink:0},children:(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.sessions`),`:`,` `,e.connectivity.totalSessions,` |`,` `,t(`health.subscriptions`),`:`,` `,e.connectivity.totalSubscriptions,e.connectivity.fabricSummary&&e.connectivity.fabricSummary.length>1&&` (${e.connectivity.fabricSummary.length} ${t(`health.fabrics`)})`]})}),e.fabrics.length>0&&(0,G.jsxs)(Z,{sx:{mt:1,flexShrink:0},children:[(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[t(`health.connectedTo`),`:`]}),(0,G.jsx)(Z,{display:`flex`,gap:.5,flexWrap:`wrap`,mt:.5,children:e.fabrics.map(e=>(0,G.jsx)(db,{title:(0,G.jsxs)(Z,{sx:{fontSize:`0.75rem`},children:[(0,G.jsxs)(`div`,{children:[`Fabric #`,e.fabricIndex]}),(0,G.jsxs)(`div`,{children:[`Vendor: `,xx(e.rootVendorId),` `,`(0x`,e.rootVendorId.toString(16).toUpperCase().padStart(4,`0`),`)`]}),(0,G.jsxs)(`div`,{children:[`Fabric ID: `,e.fabricId]}),(0,G.jsxs)(`div`,{children:[`Node ID: `,e.nodeId]}),(0,G.jsxs)(`div`,{children:[`Root Node ID: `,e.rootNodeId]})]}),children:(0,G.jsx)(Ev,{icon:(0,G.jsx)(Sx,{fabric:e}),label:e.label||xx(e.rootVendorId),size:`small`,variant:`outlined`})},e.fabricIndex))})]}),e.connectivity&&e.status===`running`&&(0,G.jsx)(Z,{sx:{mt:1,flexShrink:0},children:(0,G.jsx)(lJe,{fabrics:e.fabrics,sessions:e.connectivity.sessions})}),(()=>{let n=(e.entityDiagnostics??[]).filter(e=>e.status===`failed`);return n.length>0?(0,G.jsxs)(Uh,{severity:`error`,sx:{mt:1,flexShrink:0,py:0},children:[(0,G.jsxs)(Q,{variant:`caption`,component:`div`,children:[t(`health.failedDevicesTitle`,`Devices that failed to start:`),` `,`(`,n.length,`)`]}),(0,G.jsx)(Z,{sx:{maxHeight:160,overflowY:`auto`},children:n.map(e=>(0,G.jsxs)(Q,{variant:`caption`,component:`div`,color:`text.secondary`,children:[e.entityId,e.reason?`: ${e.reason}`:``,e.failedAt?` (${cx(e.failedAt)})`:``]},e.entityId))})]}):null})(),e.controllerWarnings&&e.controllerWarnings.length>0&&(0,G.jsxs)(Uh,{severity:`warning`,sx:{mt:1,flexShrink:0,py:0},children:[(0,G.jsxs)(Q,{variant:`caption`,component:`div`,children:[t(`health.controllerWarningsTitle`,`Some devices may not show up in a connected controller:`),` `,`(`,e.controllerWarnings.length,`)`]}),(0,G.jsx)(Z,{sx:{maxHeight:160,overflowY:`auto`},children:e.controllerWarnings.map(e=>(0,G.jsxs)(Q,{variant:`caption`,component:`div`,color:`text.secondary`,children:[e.entityId,` on `,e.controllerLabel,e.note?` (${e.note})`:``]},`${e.entityId}:${e.deviceTypeId}:${e.controller}`))})]})]})})},e.id))}),n.recovery.enabled&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,mb:1,children:[(0,G.jsx)(Phe,{}),(0,G.jsx)(Q,{variant:`h6`,children:t(`health.autoRecovery`)}),(0,G.jsx)(Ev,{label:t(`common.enabled`),color:`success`,size:`small`})]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[t(`health.recoveryAttempts`),`: `,n.recovery.recoveryCount,n.recovery.lastRecoveryAttempt&&` | Last attempt: ${new Date(n.recovery.lastRecoveryAttempt).toLocaleString()}`]}),n.recovery.history&&n.recovery.history.length>0&&(0,G.jsx)(Z,{sx:{mt:1},children:[...n.recovery.history].reverse().map((e,t)=>(0,G.jsxs)(Q,{variant:`caption`,component:`div`,color:`text.secondary`,children:[cx(e.timestamp),`: `,e.bridgeName,` (`,e.outcome,`)`]},`${e.timestamp}:${e.bridgeId}:${t}`))})]}),(0,G.jsx)(Ub,{sx:{my:3}}),(0,G.jsx)(p4,{})]})}var m4=e=>e===`pass`?`success`:e===`warn`?`warning`:`error`;function fJe(){let{t:e}=ws(),[t,n]=(0,C.useState)(null),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),l=(0,C.useCallback)(async()=>{i(!0),o(null);try{let t=await fetch(`api/network`);t.ok?n(await t.json()):o(e(`health.fetchFailed`))}catch{o(e(`health.connectionError`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{l()},[l]);let u=t?.checks.filter(e=>e.status===`pass`).length??0,d=t?.checks.filter(e=>e.status===`warn`).length??0,f=t?.checks.filter(e=>e.status===`fail`).length??0;return(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:1,children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:`bold`,children:e(`health.networkDiagnostics`)}),(0,G.jsx)(mv,{size:`small`,onClick:l,disabled:r,children:r?(0,G.jsx)(Rh,{size:16}):e(`health.refresh`)})]}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:1},children:a}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:1.5,flexWrap:`wrap`,children:[u>0&&(0,G.jsx)(Ev,{label:`${u} ${e(`health.checksPassed`)}`,color:`success`,size:`small`,variant:`outlined`}),d>0&&(0,G.jsx)(Ev,{label:`${d} ${e(`health.checksWarning`)}`,color:`warning`,size:`small`,variant:`outlined`}),f>0&&(0,G.jsx)(Ev,{label:`${f} ${e(`health.checksFailed`)}`,color:`error`,size:`small`,variant:`outlined`}),(0,G.jsx)(Ev,{label:t.matterConfig.boundInterface?`mDNS: ${t.matterConfig.boundInterface}`:`mDNS: all interfaces`,size:`small`,variant:`outlined`}),(0,G.jsx)(Ev,{label:`IPv4: ${t.matterConfig.ipv4Enabled?`on`:`off`}`,size:`small`,variant:`outlined`})]}),t.checks.filter(e=>e.status!==`pass`).map(e=>(0,G.jsxs)(Uh,{severity:m4(e.status),sx:{mb:1},children:[(0,G.jsx)(`strong`,{children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.5},children:e.detail})]},e.name)),(0,G.jsx)(mv,{size:`small`,onClick:()=>c(!s),sx:{mt:.5},children:e(s?`health.hideDetails`:`health.showDetails`)}),(0,G.jsxs)(Zv,{in:s,children:[(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:1,mb:.5},children:e(`health.allChecks`)}),(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:e(`health.check`)}),(0,G.jsx)(mC,{children:e(`health.statusLabel`)}),(0,G.jsx)(mC,{children:e(`health.message`)})]})}),(0,G.jsx)(pC,{children:t.checks.map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,children:e.name})}),(0,G.jsx)(mC,{children:(0,G.jsx)(Ev,{label:e.status,color:m4(e.status),size:`small`})}),(0,G.jsxs)(mC,{children:[(0,G.jsx)(Q,{variant:`body2`,children:e.message}),e.detail&&(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,display:`block`,children:e.detail})]})]},e.name))})]}),(0,G.jsx)(Q,{variant:`subtitle2`,sx:{mt:2,mb:.5},children:e(`health.networkInterfaces`)}),(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:e(`health.interfaceName`)}),(0,G.jsx)(mC,{children:`IPv4`}),(0,G.jsx)(mC,{children:`IPv6`}),(0,G.jsx)(mC,{children:`MAC`})]})}),(0,G.jsx)(pC,{children:t.interfaces.filter(e=>!e.internal).map(e=>(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{children:e.name}),(0,G.jsx)(mC,{children:e.ipv4.join(`, `)||`-`}),(0,G.jsx)(mC,{children:(0,G.jsx)(Q,{variant:`body2`,sx:{wordBreak:`break-all`,maxWidth:240},children:e.ipv6.join(`, `)||`-`})}),(0,G.jsx)(mC,{children:e.mac})]},e.name))})]})]})]})]})}var h4=`hamh-translation-overrides`;function g4(e,t=``){let n={};for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(n,g4(i,e)):n[e]=String(i??``)}return n}function _4(e){let t={};for(let[n,r]of Object.entries(e)){let e=n.split(`.`),i=t;for(let t=0;t<e.length-1;t++)e[t]in i||(i[e[t]]={}),i=i[e[t]];i[e[e.length-1]]=r}return t}function v4(e){try{let t=localStorage.getItem(h4);return t?JSON.parse(t)[e]??{}:{}}catch{return{}}}function y4(e,t){try{let n=localStorage.getItem(h4),r=n?JSON.parse(n):{};Object.keys(t).length===0?delete r[e]:r[e]=t,localStorage.setItem(h4,JSON.stringify(r))}catch{}}var b4=`hamh-custom-languages`;function pJe(){try{let e=localStorage.getItem(b4);return e?JSON.parse(e):[]}catch{return[]}}function x4(e){localStorage.setItem(b4,JSON.stringify(e))}var S4=[{code:`de`,name:`Deutsch`},{code:`fr`,name:`Français`},{code:`es`,name:`Español`},{code:`it`,name:`Italiano`},{code:`zh`,name:`中文`},{code:`zh-TW`,name:`繁體中文`},{code:`ja`,name:`日本語`},{code:`th`,name:`ไทย`},{code:`sv`,name:`Svenska`},{code:`tr`,name:`Türkçe`},{code:`ru`,name:`Русский`}];function mJe(){let{t:e,i18n:t}=ws(),n=t.language??`en`,r=S4.some(e=>e.code===n)?n:n.split(`-`)[0]??`en`,[i,a]=(0,C.useState)(()=>r===`en`?`de`:r),[o,s]=(0,C.useState)(``),[c,l]=(0,C.useState)(()=>v4(i)),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(`all`),[m,h]=(0,C.useState)(pJe),[g,_]=(0,C.useState)(!1),[v,y]=(0,C.useState)(``),[b,x]=(0,C.useState)(``),[S,w]=(0,C.useState)(``),[T,E]=(0,C.useState)(``),D=(0,C.useMemo)(()=>[...S4,...m],[m]),O=(0,C.useCallback)(e=>m.some(t=>t.code===e),[m]),k=(0,C.useMemo)(()=>g4(Es),[]),A=(0,C.useMemo)(()=>{let e=t.getResourceBundle(i,`translation`);return e?g4(e):{}},[i,t]),j=(0,C.useMemo)(()=>Object.keys(k).map(e=>({key:e,section:e.split(`.`)[0],enValue:k[e],currentValue:c[e]??A[e]??``,isOverridden:e in c})),[k,A,c]),M=(0,C.useMemo)(()=>{let e=j;if(o){let t=o.toLowerCase();e=e.filter(e=>e.key.toLowerCase().includes(t)||e.enValue.toLowerCase().includes(t)||e.currentValue.toLowerCase().includes(t))}return f===`missing`?e=e.filter(e=>!e.currentValue):f===`edited`&&(e=e.filter(e=>e.isOverridden)),e},[j,o,f]),N=(0,C.useMemo)(()=>[...new Set(M.map(e=>e.section))],[M]),P=Object.keys(k).length,F=j.filter(e=>e.currentValue).length,I=Object.keys(c).length,L=P>0?F/P*100:0;(0,C.useEffect)(()=>{l(v4(i))},[i]);let R=(0,C.useCallback)(e=>{l(e),y4(i,e);let n=t.getResourceBundle(i,`translation`),r=n?g4(n):{},a={};for(let[t,n]of Object.entries(e))n&&n!==r[t]&&(a[t]=n);if(Object.keys(a).length>0){let e=_4({...r,...a});t.addResourceBundle(i,`translation`,e,!0,!0)}},[i,t]),ee=(0,C.useCallback)((e,t)=>{let n={...c,[e]:t};t||delete n[e],R(n)},[c,R]),z=(0,C.useCallback)(e=>{let t={...c};delete t[e],R(t)},[c,R]),te=(0,C.useCallback)(()=>{R({})},[R]),B=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=_4(e),n=JSON.stringify(t,null,2),r=new Blob([n],{type:`application/json`}),a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=`${i}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},[k,A,c,i]),V=(0,C.useCallback)(()=>{let e={};for(let t of Object.keys(k))e[t]=c[t]??A[t]??``;let t=_4(e);navigator.clipboard.writeText(JSON.stringify(t,null,2)),d(!0),setTimeout(()=>d(!1),2e3)},[k,A,c]),ne=(0,C.useCallback)(()=>{let n=v.trim().toLowerCase(),r=b.trim();if(!n){w(e(`translationEditor.codeRequired`));return}if(!r){w(e(`translationEditor.nameRequired`));return}if(S4.some(e=>e.code===n)||m.some(e=>e.code===n)||n===`en`){w(e(`translationEditor.languageExists`));return}let i=[...m,{code:n,name:r}];h(i),x4(i),t.addResourceBundle(n,`translation`,{},!0,!0),a(n),_(!1),y(``),x(``),w(``)},[v,b,m,t,e]),re=(0,C.useCallback)(()=>{if(!O(i))return;let e=m.filter(e=>e.code!==i);h(e),x4(e),y4(i,{}),a(S4[0].code)},[i,m,O]),ie=(0,C.useCallback)(()=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.json`,t.onchange=()=>{let n=t.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{try{let t=JSON.parse(r.result);if(typeof t!=`object`||!t)throw Error();let n=g4(t),i=new Set(Object.keys(k)),a={},o=0;for(let[e,t]of Object.entries(n))i.has(e)&&t&&(a[e]=t,o++);R({...c,...a}),E(e(`translationEditor.importSuccess`,{count:o}))}catch{E(e(`translationEditor.importFailed`))}},r.readAsText(n)},t.click()},[k,c,R,e]);return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,flexWrap:`wrap`,gap:1,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(_ge,{}),(0,G.jsx)(Q,{variant:`h5`,children:e(`translationEditor.title`)})]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:140},children:[(0,G.jsx)(Bx,{children:e(`translationEditor.editLanguage`)}),(0,G.jsx)(SS,{value:i,label:e(`translationEditor.editLanguage`),onChange:e=>a(e.target.value),children:D.map(e=>(0,G.jsxs)(CS,{value:e.code,children:[(0,G.jsx)(oy,{primary:e.name}),O(e.code)&&(0,G.jsx)(iy,{sx:{minWidth:`auto`,ml:1},children:(0,G.jsx)($T,{fontSize:`small`,color:`disabled`})})]},e.code))})]}),(0,G.jsx)(db,{title:e(`translationEditor.addLanguage`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>_(e=>!e),children:(0,G.jsx)(fb,{fontSize:`small`})})}),O(i)&&(0,G.jsx)(db,{title:e(`translationEditor.removeLanguage`),children:(0,G.jsx)(Bh,{size:`small`,color:`error`,onClick:re,children:(0,G.jsx)($T,{fontSize:`small`})})})]})]}),(0,G.jsx)(Zv,{in:g,children:(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,alignItems:`flex-start`,flexWrap:`wrap`,children:[(0,G.jsx)(ES,{size:`small`,label:e(`translationEditor.newLanguageCode`),value:v,onChange:e=>y(e.target.value),error:!!S,sx:{width:180}}),(0,G.jsx)(ES,{size:`small`,label:e(`translationEditor.newLanguageName`),value:b,onChange:e=>x(e.target.value),sx:{width:220}}),(0,G.jsx)(mv,{variant:`contained`,size:`small`,onClick:ne,children:e(`translationEditor.addLanguageButton`)}),S&&(0,G.jsx)(Q,{variant:`caption`,color:`error`,sx:{mt:.5},children:S})]})}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:2},children:e(`translationEditor.info`)}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,mb:2,flexWrap:`wrap`,children:[(0,G.jsxs)(Z,{sx:{flexGrow:1,minWidth:200},children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:.5,children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`translationEditor.progress`,{translated:F,total:P})}),(0,G.jsxs)(Q,{variant:`body2`,fontWeight:600,children:[Math.round(L),`%`]})]}),(0,G.jsx)(Vv,{variant:`determinate`,value:L,sx:{height:8,borderRadius:4}})]}),I>0&&(0,G.jsx)(Ev,{label:e(`translationEditor.localEdits`,{count:I}),color:`primary`,size:`small`})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:2,flexWrap:`wrap`,children:[(0,G.jsx)(ES,{size:`small`,placeholder:e(`translationEditor.searchPlaceholder`),value:o,onChange:e=>s(e.target.value),sx:{flexGrow:1,minWidth:200},slotProps:{input:{startAdornment:(0,G.jsx)(fF,{position:`start`,children:(0,G.jsx)(hE,{fontSize:`small`})})}}}),(0,G.jsx)(kv,{size:`small`,sx:{minWidth:130},children:(0,G.jsxs)(SS,{value:f,onChange:e=>p(e.target.value),children:[(0,G.jsx)(CS,{value:`all`,children:e(`translationEditor.filterAll`)}),(0,G.jsx)(CS,{value:`missing`,children:e(`translationEditor.filterMissing`)}),(0,G.jsx)(CS,{value:`edited`,children:e(`translationEditor.filterEdited`)})]})})]}),(0,G.jsxs)(Z,{display:`flex`,gap:1,mb:3,flexWrap:`wrap`,children:[(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(SE,{}),onClick:B,children:e(`translationEditor.exportJson`)}),(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(PT,{}),onClick:ie,children:e(`translationEditor.importJson`)}),(0,G.jsx)(db,{title:u?e(`translationEditor.copied`):``,children:(0,G.jsx)(mv,{variant:`outlined`,size:`small`,startIcon:(0,G.jsx)(pb,{}),onClick:V,children:e(`translationEditor.copyJson`)})}),I>0&&(0,G.jsx)(mv,{variant:`outlined`,size:`small`,color:`warning`,startIcon:(0,G.jsx)(pE,{}),onClick:te,children:e(`translationEditor.resetAll`)})]}),N.map(t=>(0,G.jsxs)(Z,{sx:{mb:3},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:600,sx:{mb:1,textTransform:`capitalize`},children:t}),(0,G.jsx)(Ub,{sx:{mb:1.5}}),M.filter(e=>e.section===t).map(t=>(0,G.jsxs)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`1fr 1fr auto`},gap:1,mb:1.5,alignItems:`start`},children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:`monospace`},children:t.key}),(0,G.jsx)(Q,{variant:`body2`,sx:{mt:.25},children:t.enValue})]}),(0,G.jsx)(ES,{size:`small`,fullWidth:!0,multiline:t.enValue.length>60,minRows:1,maxRows:4,value:t.currentValue,onChange:e=>ee(t.key,e.target.value),placeholder:t.enValue,sx:{"& .MuiOutlinedInput-root":t.isOverridden?{borderColor:`primary.main`,"& fieldset":{borderColor:`primary.main`,borderWidth:2}}:{}}}),t.isOverridden&&(0,G.jsx)(db,{title:e(`translationEditor.resetKey`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>z(t.key),children:(0,G.jsx)(pE,{fontSize:`small`})})})]},t.key))]},t)),M.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,sx:{textAlign:`center`,py:4},children:e(`translationEditor.noResults`)}),(0,G.jsx)($h,{open:!!T,autoHideDuration:3e3,onClose:()=>E(``),message:T})]})}var C4=e=>{let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(1)} ${t[r]}`},w4=e=>{let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`},hJe=()=>{let[e,t]=(0,C.useState)(null),[n,r]=(0,C.useState)(!0),[i,a]=(0,C.useState)(!0);if((0,C.useEffect)(()=>{let e=null,n=async()=>{try{let n=await fetch(`api/system/info`);n.ok?(t(await n.json()),a(!0)):n.status===404&&(a(!1),e&&=(clearInterval(e),null))}catch{}finally{r(!1)}};return n(),e=setInterval(n,3e4),()=>{e&&clearInterval(e)}},[]),!i)return null;if(n)return(0,G.jsx)(hv,{children:(0,G.jsx)(vv,{children:(0,G.jsx)(Q,{children:`Loading system information...`})})});if(!e)return(0,G.jsx)(hv,{children:(0,G.jsx)(vv,{children:(0,G.jsx)(Q,{color:`error`,children:`Failed to load system information`})})});let o=e.memory.used/e.memory.total*100,s=e.storage.used/e.storage.total*100;return(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Q,{variant:`h6`,gutterBottom:!0,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(Whe,{}),`System Information`]}),(0,G.jsxs)(Fv,{container:!0,spacing:3,children:[(0,G.jsx)(Fv,{size:{xs:12,md:6},children:(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`Application`}),(0,G.jsxs)(Hv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Version:`}),(0,G.jsx)(Ev,{label:e.version,size:`small`,color:`primary`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Environment:`}),(0,G.jsx)(Ev,{label:e.environment,size:`small`,variant:`outlined`,color:e.environment===`Home Assistant Add-on`?`success`:`default`})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Node.js:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.nodeVersion})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Process Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:w4(e.process.uptime)})]})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`subtitle2`,color:`text.secondary`,children:`System`}),(0,G.jsxs)(Hv,{spacing:1,sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Hostname:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e.hostname})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`Platform:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[e.platform,` (`,e.arch,`)`]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`CPU:`}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,sx:{maxWidth:200,textAlign:`right`},noWrap:!0,title:e.cpuModel,children:[e.cpuCount,`x`,` `,e.cpuModel.split(`@`)[0].trim()]})]}),(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`},children:[(0,G.jsx)(Q,{variant:`body2`,children:`System Uptime:`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:w4(e.uptime)})]})]})]})]})}),(0,G.jsx)(Fv,{size:{xs:12,md:6},children:(0,G.jsxs)(Hv,{spacing:2,children:[(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(sE,{}),`Memory Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[C4(e.memory.used),` /`,` `,C4(e.memory.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[o.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${o}%`,backgroundColor:o>80?`error.main`:o>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(sE,{}),`HAMH Process Memory`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:.5},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[`RSS: `,C4(e.process.rss)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[`Heap: `,C4(e.process.heapUsed),` /`,` `,C4(e.process.heapSizeLimit)]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${Math.min(e.process.heapUsed/e.process.heapSizeLimit*100,100)}%`,backgroundColor:e.process.heapUsed/e.process.heapSizeLimit>.85?`error.main`:e.process.heapUsed/e.process.heapSizeLimit>.6?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]}),(0,G.jsxs)(Z,{children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(mge,{}),`Storage Usage`]}),(0,G.jsxs)(Z,{sx:{mt:1},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,mb:1},children:[(0,G.jsxs)(Q,{variant:`body2`,children:[C4(e.storage.used),` /`,` `,C4(e.storage.total)]}),(0,G.jsxs)(Q,{variant:`body2`,color:`text.secondary`,children:[s.toFixed(1),`%`]})]}),(0,G.jsx)(Z,{sx:{height:8,backgroundColor:`action.hover`,borderRadius:4,overflow:`hidden`},children:(0,G.jsx)(Z,{sx:{height:`100%`,width:`${s}%`,backgroundColor:s>80?`error.main`:s>60?`warning.main`:`success.main`,transition:`width 0.3s ease`}})})]})]})]})}),(0,G.jsxs)(Fv,{size:{xs:12},children:[(0,G.jsxs)(Q,{variant:`subtitle2`,color:`text.secondary`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(oge,{}),`Network Interfaces`]}),(0,G.jsx)(Hv,{spacing:1,sx:{mt:1},children:e.network.interfaces.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(Q,{variant:`body2`,children:e.name}),(0,G.jsx)(Ev,{label:`${e.address} (${e.family})`,size:`small`,variant:`outlined`})]},`${e.name}-${e.address}`))})]})]})]})})},gJe=200;function _Je(){let[e,t]=(0,C.useState)([]),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useRef)(void 0),c=(0,C.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;let e=window.location.protocol===`https:`?`wss:`:`ws:`,n=document.querySelector(`base`)?.href||window.location.origin,i=new URL(n),l=`${e}//${i.host}${i.pathname}api/ws`.replace(/\/+/g,`/`).replace(`:/`,`://`),u=new WebSocket(l);o.current=u,u.onopen=()=>{a(!0),u.send(JSON.stringify({type:`subscribe_diagnostics`}))},u.onmessage=e=>{try{let n=JSON.parse(e.data);if(n.type===`diagnostic_event`){let e=n.data;t(t=>{let n=[...t,e];return n.length>gJe?n.slice(-200):n})}else if(n.type===`diagnostic_snapshot`){let e=n.data;r(e),t(e.recentEvents??[])}}catch{}},u.onclose=()=>{a(!1),o.current=null,s.current=setTimeout(c,3e3)},u.onerror=()=>u.close()},[]);return(0,C.useEffect)(()=>(c(),()=>{clearTimeout(s.current),o.current&&(o.current.send(JSON.stringify({type:`unsubscribe_diagnostics`})),o.current.close())}),[c]),{events:e,snapshot:n,connected:i,clearEvents:(0,C.useCallback)(()=>t([]),[])}}function T4(e){let t=e.replace(`#`,``),n=Number.parseInt(t.substring(0,2),16)/255,r=Number.parseInt(t.substring(2,4),16)/255,i=Number.parseInt(t.substring(4,6),16)/255;return .2126*(n<=.03928?n/12.92:((n+.055)/1.055)**2.4)+.7152*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.0722*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)>.179?`#000`:`#fff`}var E4={state_update:`#4caf50`,command_received:`#2196f3`,entity_error:`#f44336`,session_opened:`#ff9800`,session_closed:`#9e9e9e`,subscription_changed:`#9c27b0`,bridge_started:`#00bcd4`,bridge_stopped:`#795548`,entity_warning:`#ff9800`},D4={state_update:`diagnostics.stateUpdate`,command_received:`diagnostics.command`,entity_error:`diagnostics.entityError`,session_opened:`diagnostics.sessionOpen`,session_closed:`diagnostics.sessionClose`,subscription_changed:`diagnostics.subscription`,bridge_started:`diagnostics.bridgeStart`,bridge_stopped:`diagnostics.bridgeStop`,entity_warning:`diagnostics.entityWarning`};function vJe(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}var O4=Object.keys(E4);function yJe({sortField:e,sortDirection:t}={}){let{t:n}=ws(),r=wm(),{events:i,snapshot:a,connected:o,clearEvents:s}=_Je(),[c,l]=(0,C.useState)(new Set(O4)),[u,d]=(0,C.useState)(!1),f=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},p=i.filter(e=>c.has(e.type)),m=(0,C.useMemo)(()=>{let n=a?.bridges??[];return e?[...n].sort((n,r)=>{let i=0;return i=e===`name`?n.bridgeName.localeCompare(r.bridgeName):n.bridgeId.localeCompare(r.bridgeId),t===`desc`?-i:i}):n},[a?.bridges,e,t]),h={};for(let e of i)h[e.type]=(h[e.type]??0)+1;return(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,justifyContent:`space-between`,mb:2,children:[(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:1,children:[(0,G.jsx)(gge,{}),(0,G.jsx)(Q,{variant:`h6`,children:n(`diagnostics.title`)}),(0,G.jsx)(Ev,{icon:(0,G.jsx)(Xhe,{sx:{fontSize:10,color:o?r.palette.success.main:r.palette.error.main}}),label:n(o?`common.live`:`common.offline`),size:`small`,variant:`outlined`})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,alignItems:`center`,children:[(0,G.jsx)(db,{title:n(`diagnostics.filterEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>d(e=>!e),color:u?`primary`:`default`,children:(0,G.jsx)(_b,{})})}),(0,G.jsx)(db,{title:n(`diagnostics.clearEvents`),children:(0,G.jsx)(Bh,{size:`small`,onClick:s,children:(0,G.jsx)(Hhe,{})})})]})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,flexWrap:`wrap`,sx:{mb:2,gap:.5},children:[O4.map(e=>{let t=h[e]??0;if(t===0&&!u)return null;let r=E4[e];return(0,G.jsx)(Ev,{label:`${n(D4[e])}: ${t}`,size:`small`,sx:{bgcolor:c.has(e)?r:`action.disabledBackground`,color:c.has(e)?T4(r):`text.disabled`,fontSize:`0.7rem`,height:22,cursor:`pointer`,opacity:c.has(e)?1:.5},onClick:()=>f(e)},e)}),a?.system&&(0,G.jsx)(Ev,{label:`Total: ${a.system.eventCount}`,size:`small`,variant:`outlined`,sx:{fontSize:`0.7rem`,height:22}})]}),(0,G.jsx)(Zv,{in:u,children:(0,G.jsx)(Wm,{variant:`outlined`,sx:{p:1.5,mb:2},children:(0,G.jsx)(Fv,{container:!0,spacing:0,children:O4.map(e=>{let t=E4[e];return(0,G.jsx)(Fv,{size:{xs:6,sm:4,md:3},children:(0,G.jsx)(Pv,{control:(0,G.jsx)(Cv,{size:`small`,checked:c.has(e),onChange:()=>f(e),sx:{color:t,"&.Mui-checked":{color:t}}}),label:(0,G.jsx)(Q,{variant:`caption`,children:n(D4[e])})})},e)})})})}),m.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Fv,{container:!0,spacing:1,sx:{mb:2},children:m.map(e=>(0,G.jsx)(bJe,{bridge:e},e.bridgeId))}),(0,G.jsx)(Ub,{sx:{mb:2}})]}),(0,G.jsx)(Z,{sx:{maxHeight:400,overflow:`auto`,bgcolor:`background.default`,borderRadius:1,p:1},children:p.length===0?(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{textAlign:`center`,py:4},children:i.length===0?`Waiting for diagnostic events…`:n(`diagnostics.noEvents`)}):p.map(e=>{let t=E4[e.type];return(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,py:.4,px:.5,minWidth:0,borderBottom:`1px solid`,borderColor:`divider`,"&:hover":{bgcolor:`action.hover`},"&:last-child":{borderBottom:`none`}},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.secondary`,whiteSpace:`nowrap`,fontFamily:`monospace`,fontSize:`0.72rem`,minWidth:85,pt:.1},children:vJe(e.timestamp)}),(0,G.jsx)(Ev,{label:D4[e.type]?n(D4[e.type]):e.type,size:`small`,sx:{bgcolor:t??`#757575`,color:T4(t??`#757575`),fontSize:`0.62rem`,fontWeight:600,height:18,minWidth:90}}),e.bridgeName&&(0,G.jsxs)(Q,{variant:`caption`,sx:{color:`primary.main`,fontWeight:600,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:140,flexShrink:0},children:[`[`,e.bridgeName,`]`]}),e.entityId&&(0,G.jsx)(Q,{variant:`caption`,sx:{color:`warning.main`,fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:`0.72rem`,maxWidth:220,flexShrink:1},children:e.entityId}),(0,G.jsx)(Q,{variant:`caption`,sx:{color:`text.primary`,flex:1,wordBreak:`break-word`,fontSize:`0.72rem`},children:e.message})]},e.id)})})]})})}function bJe({bridge:e}){let[t,n]=(0,C.useState)(!1);return(0,G.jsx)(Fv,{size:{xs:12,sm:6},children:(0,G.jsxs)(Wm,{variant:`outlined`,sx:{p:1.5,overflow:`hidden`,minWidth:0},children:[(0,G.jsxs)(Z,{display:`flex`,justifyContent:`space-between`,alignItems:`center`,sx:{cursor:`pointer`},onClick:()=>n(e=>!e),children:[(0,G.jsxs)(Z,{sx:{minWidth:0,overflow:`hidden`},children:[(0,G.jsx)(Q,{variant:`body2`,fontWeight:500,noWrap:!0,children:e.bridgeName}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:[e.entityCount,` devices · `,e.sessionCount,` sessions`]})]}),(0,G.jsxs)(Hv,{direction:`row`,spacing:.5,alignItems:`center`,flexWrap:`wrap`,justifyContent:`flex-end`,sx:{flexShrink:0,ml:1},children:[Object.entries(e.featureFlags).filter(([,e])=>e).map(([e])=>(0,G.jsx)(Ev,{label:e.replace(/^auto/,``).replace(/([A-Z])/g,` $1`).trim(),size:`small`,variant:`outlined`,sx:{fontSize:`0.6rem`,height:18}},e)),(0,G.jsx)(Ev,{label:e.status,size:`small`,color:e.status===`running`?`success`:e.status===`failed`?`error`:`default`,sx:{height:20}}),(0,G.jsx)($S,{sx:{transform:t?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`,fontSize:18,color:`text.secondary`}})]})]}),(0,G.jsx)(Zv,{in:t,children:(0,G.jsx)(Z,{sx:{mt:1,maxHeight:200,overflow:`auto`},children:e.entities.map(e=>(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`baseline`,gap:.5,py:.3,borderBottom:`1px solid`,borderColor:`divider`},children:[(0,G.jsx)(Q,{variant:`caption`,sx:{fontFamily:`monospace`,fontSize:`0.68rem`,minWidth:180,flexShrink:0,color:e.available?`text.primary`:`error.main`},noWrap:!0,children:e.entityId}),(0,G.jsx)(Z,{display:`flex`,gap:.3,flexWrap:`wrap`,children:e.matterClusters.map(e=>(0,G.jsx)(Ev,{label:e,size:`small`,variant:`outlined`,sx:{fontSize:`0.58rem`,height:16,"& .MuiChip-label":{px:.5}}},e))})]},e.entityId))})})]})})}var xJe=()=>{let[e,t]=(0,C.useState)(`name`),[n,r]=(0,C.useState)(`asc`);return(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:3},children:[(0,G.jsx)(dJe,{sortField:e,sortDirection:n,onSortFieldChange:t,onSortDirectionChange:r}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(yJe,{sortField:e,sortDirection:n})}),(0,G.jsx)(Z,{sx:{px:2},children:(0,G.jsx)(fJe,{})}),(0,G.jsx)(Z,{sx:{px:2,pb:2},children:(0,G.jsx)(hJe,{})}),(0,G.jsx)(Ub,{}),(0,G.jsx)(mJe,{})]})};async function SJe(){let e=await fetch(`api/matter/labels?_s=${Date.now()}`);return await M_(e,`Failed to fetch labels`),j_(e)}async function CJe(){let e=await fetch(`api/matter/areas?_s=${Date.now()}`);return await M_(e,`Failed to fetch areas`),j_(e)}async function wJe(){let e=await fetch(`api/matter/filter-values?_s=${Date.now()}`);return await M_(e,`Failed to fetch filter values`),j_(e)}var k4=({values:e,copiedId:t,onCopy:n,searchable:r})=>{let[i,a]=(0,C.useState)(``),o=(0,C.useMemo)(()=>{if(!i)return e;let t=i.toLowerCase();return e.filter(e=>e.toLowerCase().includes(t))},[e,i]);return e.length===0?(0,G.jsx)(Z,{sx:{p:2,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,variant:`body2`,children:`No values found.`})}):(0,G.jsxs)(Z,{children:[r&&e.length>10&&(0,G.jsx)(Z,{sx:{px:2,pt:1,pb:.5},children:(0,G.jsx)(ES,{size:`small`,fullWidth:!0,placeholder:`Search...`,value:i,onChange:e=>a(e.target.value),slotProps:{input:{startAdornment:(0,G.jsx)(fF,{position:`start`,children:(0,G.jsx)(hE,{fontSize:`small`})})}}})}),(0,G.jsxs)(Z,{sx:{p:1.5,display:`flex`,flexWrap:`wrap`,gap:.75},children:[o.map(e=>(0,G.jsx)(Ev,{label:e,size:`small`,variant:t===e?`filled`:`outlined`,color:t===e?`success`:`default`,onClick:()=>n(e),sx:{fontFamily:`monospace`,fontSize:`0.8rem`}},e)),i&&o.length===0&&(0,G.jsxs)(Q,{color:`text.secondary`,variant:`body2`,sx:{p:1},children:[`No matches for "`,i,`"`]})]})]})},TJe=()=>{let{t:e}=ws(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)([]),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(null),[d,f]=(0,C.useState)(null),p=(0,C.useCallback)(async()=>{c(!0);try{let[e,t,r]=await Promise.all([SJe(),CJe(),wJe()]);n(e),i(t),o(r),u(null)}catch(t){u(t instanceof Error?t.message:e(`labels.loadFailed`))}finally{c(!1)}},[e]);(0,C.useEffect)(()=>{p()},[p]);let m=e=>{navigator.clipboard.writeText(e),f(e),setTimeout(()=>f(null),2e3)};return s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,sx:{mb:3},children:[(0,G.jsx)(_b,{sx:{mr:1,verticalAlign:`middle`}}),e(`labels.title`)]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:e(`labels.info`)}),l&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:l}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)(aE,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.labelsSection`),` (`,t.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.labelsHint`)}),(0,G.jsx)(hv,{sx:{mb:4},children:t.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noLabels`)})}):(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.labelId`)}),(0,G.jsx)(mC,{width:48})]})}),(0,G.jsx)(pC,{children:t.map(t=>(0,G.jsxs)(bC,{hover:!0,children:[(0,G.jsxs)(mC,{children:[t.color&&(0,G.jsx)(Z,{component:`span`,sx:{display:`inline-block`,width:12,height:12,borderRadius:`50%`,backgroundColor:t.color,mr:1,verticalAlign:`middle`}}),t.name]}),(0,G.jsx)(mC,{children:(0,G.jsx)(`code`,{children:t.label_id})}),(0,G.jsx)(mC,{children:(0,G.jsx)(db,{title:d===t.label_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.label_id),children:(0,G.jsx)(pb,{fontSize:`small`})})})})]},t.label_id))})]})})}),(0,G.jsxs)(Q,{variant:`h6`,sx:{mb:1},children:[(0,G.jsx)(DT,{sx:{mr:.5,fontSize:20,verticalAlign:`middle`}}),e(`labels.areasSection`),` (`,r.length,`)`]}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:e(`labels.areasHint`)}),(0,G.jsx)(hv,{sx:{mb:4},children:r.length===0?(0,G.jsx)(Z,{sx:{p:3,textAlign:`center`},children:(0,G.jsx)(Q,{color:`text.secondary`,children:e(`labels.noAreas`)})}):(0,G.jsx)(hC,{children:(0,G.jsxs)(uC,{size:`small`,children:[(0,G.jsx)(_C,{children:(0,G.jsxs)(bC,{children:[(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.displayName`)}),(0,G.jsx)(mC,{sx:{fontWeight:`bold`},children:e(`labels.areaId`)}),(0,G.jsx)(mC,{width:48})]})}),(0,G.jsx)(pC,{children:r.map(t=>(0,G.jsxs)(bC,{hover:!0,children:[(0,G.jsx)(mC,{children:t.name}),(0,G.jsx)(mC,{children:(0,G.jsx)(`code`,{children:t.area_id})}),(0,G.jsx)(mC,{children:(0,G.jsx)(db,{title:d===t.area_id?e(`common.copied`):e(`common.copyId`),children:(0,G.jsx)(Bh,{size:`small`,onClick:()=>m(t.area_id),children:(0,G.jsx)(pb,{fontSize:`small`})})})})]},t.area_id))})]})})}),a&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{variant:`h6`,sx:{mb:2},children:e(`labels.otherFilterValues`)}),(0,G.jsxs)(iC,{defaultExpanded:!0,children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(bge,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.domains`),` (`,a.domains.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.domainsHint`)}),(0,G.jsx)(k4,{values:a.domains,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(tE,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.platforms`),` (`,a.platforms.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.platformsHint`)}),(0,G.jsx)(k4,{values:a.platforms,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(zhe,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.entityCategories`),` (`,a.entityCategories.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.entityCategoriesHint`)}),(0,G.jsx)(k4,{values:a.entityCategories,copiedId:d,onCopy:m})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(zhe,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceClasses`),` (`,a.deviceClasses.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceClassesHint`)}),(0,G.jsx)(k4,{values:a.deviceClasses,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(mb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.deviceNames`),` (`,a.deviceNames.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.deviceNamesHint`)}),(0,G.jsx)(k4,{values:a.deviceNames,copiedId:d,onCopy:m,searchable:!0})]})]}),(0,G.jsxs)(iC,{children:[(0,G.jsxs)(sC,{expandIcon:(0,G.jsx)($S,{}),children:[(0,G.jsx)(mb,{sx:{mr:1}}),(0,G.jsxs)(Q,{children:[e(`labels.productNames`),` (`,a.productNames.length,`)`]})]}),(0,G.jsxs)(aC,{sx:{p:0},children:[(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{px:2,pb:1},children:e(`labels.productNamesHint`)}),(0,G.jsx)(k4,{values:a.productNames,copiedId:d,onCopy:m,searchable:!0})]})]})]})]})};async function EJe(){let e=await fetch(`api/lock-credentials`);return await M_(e,`Failed to fetch lock credentials`),j_(e)}async function DJe(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return await M_(n,`Failed to update lock credential`),j_(n)}async function OJe(e,t){let n=await fetch(`api/lock-credentials/${encodeURIComponent(e)}/enabled`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:t})});return await M_(n,`Failed to toggle credential`),j_(n)}async function kJe(e){await M_(await fetch(`api/lock-credentials/${encodeURIComponent(e)}`,{method:`DELETE`}),`Failed to delete lock credential`)}var AJe=({open:e,onClose:t,onSave:n,initialEntityId:r=``,initialName:i=``,isEdit:a=!1})=>{let{t:o}=ws(),[s,c]=(0,C.useState)(r),[l,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(i),[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{e&&(c(r),f(i),u(``),m(``))},[e,r,i]),(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`sm`,fullWidth:!0,children:[(0,G.jsx)(Vb,{children:o(a?`lockCredentials.editCredential`:`lockCredentials.addCredential`)}),(0,G.jsx)(Bb,{children:(0,G.jsxs)(Z,{sx:{display:`flex`,flexDirection:`column`,gap:2,mt:1},children:[p&&(0,G.jsx)(Uh,{severity:`error`,children:p}),(0,G.jsx)(ES,{label:o(`lockCredentials.lockEntityId`),placeholder:`lock.front_door`,value:s,onChange:e=>c(e.target.value),disabled:a,fullWidth:!0,helperText:o(`lockCredentials.lockEntityHelperText`)}),(0,G.jsx)(ES,{label:o(`lockCredentials.pinCode`),type:`password`,placeholder:`1234`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,8)),fullWidth:!0,helperText:`4-8 digit PIN code for this lock`,inputProps:{inputMode:`numeric`,pattern:`[0-9]*`}}),(0,G.jsx)(ES,{label:o(`lockCredentials.nameOptional`),placeholder:o(`lockCredentials.namePlaceholder`),value:d,onChange:e=>f(e.target.value),fullWidth:!0,helperText:o(`lockCredentials.nameHelperText`)})]})}),(0,G.jsxs)(zb,{children:[(0,G.jsx)(mv,{onClick:t,disabled:h,children:o(`common.cancel`)}),(0,G.jsx)(mv,{onClick:async()=>{if(!s.trim()){m(o(`lockCredentials.entityRequired`));return}if(!l||l.length<4||l.length>8){m(o(`lockCredentials.pinLength`));return}if(!/^\d+$/.test(l)){m(o(`lockCredentials.pinDigitsOnly`));return}g(!0);try{await n(s.trim(),l,d.trim()),t()}catch(e){m(e instanceof Error?e.message:o(`lockCredentials.saveFailed`))}finally{g(!1)}},variant:`contained`,disabled:h,startIcon:h?(0,G.jsx)(Rh,{size:16}):(0,G.jsx)(mE,{}),children:o(`common.save`)})]})]})},jJe=()=>{let{t:e}=ws(),[t,n]=(0,C.useState)([]),[r,i]=(0,C.useState)(!0),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(null),d=(0,C.useCallback)(async()=>{i(!0);try{n((await EJe()).credentials),o(null)}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.loadFailed`))}finally{i(!1)}},[e]);(0,C.useEffect)(()=>{d()},[d]);let f=async(e,t,n)=>{await DJe(e,{entityId:e,pinCode:t,name:n||void 0,enabled:!0}),await d()},[p,m]=(0,C.useState)(null),h=async t=>{m(null);try{await kJe(t),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.deleteFailed`))}},g=async t=>{try{await OJe(t.entityId,!t.enabled),await d()}catch(t){o(t instanceof Error?t.message:e(`lockCredentials.updateFailed`))}},_=e=>{u(e),c(!0)},v=()=>{u(null),c(!0)};return(0,G.jsxs)(Z,{sx:{p:2},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:3},children:[(0,G.jsxs)(Q,{variant:`h5`,component:`h1`,children:[(0,G.jsx)(ET,{sx:{mr:1,verticalAlign:`middle`}}),e(`lockCredentials.title`)]}),(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(fb,{}),onClick:v,children:e(`lockCredentials.addCredential`)})]}),(0,G.jsx)(Uh,{severity:`info`,sx:{mb:3},children:`Configure PIN codes for locks that require authentication for remote lock/unlock operations. The PIN will be sent with lock/unlock commands to Matter locks.`}),a&&(0,G.jsx)(Uh,{severity:`error`,sx:{mb:2},children:a}),r?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Rh,{})}):t.length===0?(0,G.jsx)(hv,{children:(0,G.jsxs)(vv,{sx:{textAlign:`center`,py:4},children:[(0,G.jsx)(ET,{sx:{fontSize:48,color:`text.secondary`,mb:2}}),(0,G.jsx)(Q,{variant:`h6`,color:`text.secondary`,children:`No lock credentials configured`}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,sx:{mb:2},children:`Add a PIN code for your Matter locks to enable remote lock/unlock`}),(0,G.jsx)(mv,{variant:`outlined`,startIcon:(0,G.jsx)(fb,{}),onClick:v,children:`Add Your First Credential`})]})}):(0,G.jsx)(hv,{children:(0,G.jsx)($v,{children:t.map((n,r)=>(0,G.jsxs)(ny,{divider:r<t.length-1,onClick:()=>_(n),sx:{cursor:`pointer`,"&:hover":{bgcolor:`action.hover`}},children:[(0,G.jsx)(iy,{children:(0,G.jsx)(ET,{color:n.enabled?`primary`:`disabled`})}),(0,G.jsx)(oy,{primary:n.name||n.entityId,secondary:(0,G.jsxs)(G.Fragment,{children:[n.name&&(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,children:n.entityId}),(0,G.jsx)(Q,{component:`span`,variant:`body2`,color:`text.secondary`,sx:{ml:n.name?2:0},children:`PIN: ****`})]})}),(0,G.jsxs)(ty,{children:[(0,G.jsx)(db,{title:n.enabled?e(`lockCredentials.disable`):e(`lockCredentials.enable`),children:(0,G.jsx)(KS,{edge:`end`,checked:n.enabled,onChange:e=>{e.stopPropagation(),g(n)}})}),(0,G.jsx)(db,{title:e(`common.delete`),children:(0,G.jsx)(Bh,{edge:`end`,onClick:e=>{e.stopPropagation(),m(n.entityId)},sx:{ml:1},children:(0,G.jsx)(LS,{})})})]})]},n.entityId))})}),(0,G.jsx)(AJe,{open:s,onClose:()=>c(!1),onSave:f,initialEntityId:l?.entityId,initialName:l?.name,isEdit:!!l}),(0,G.jsx)(WT,{open:p!==null,title:e(`lockCredentials.confirmDeleteTitle`),message:e(`lockCredentials.confirmDeleteMessage`,{entity:p??``}),confirmLabel:e(`common.delete`),confirmColor:`error`,onConfirm:()=>{p&&h(p)},onCancel:()=>m(null)})]})},MJe=()=>{let e=Nr(),{t}=ws();return(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(fge,{color:`disabled`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:t(`notFound.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:t(`notFound.description`)}),(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(rE,{}),onClick:()=>e(J9.dashboard),children:t(`notFound.backToDashboard`)})]})};function A4(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=A4(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var NJe={value:()=>{}};function j4(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new M4(n)}function M4(e){this._=e}function PJe(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}M4.prototype=j4.prototype={constructor:M4,on:function(e,t){var n=this._,r=PJe(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=FJe(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=N4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=N4(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new M4(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function FJe(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function N4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=NJe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var P4={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function F4(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),P4.hasOwnProperty(t)?{space:P4[t],local:e}:e}function IJe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function LJe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function I4(e){var t=F4(e);return(t.local?LJe:IJe)(t)}function RJe(){}function L4(e){return e==null?RJe:function(){return this.querySelector(e)}}function zJe(e){typeof e!=`function`&&(e=L4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new Q4(r,this._parents)}function BJe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function VJe(){return[]}function R4(e){return e==null?VJe:function(){return this.querySelectorAll(e)}}function HJe(e){return function(){return BJe(e.apply(this,arguments))}}function UJe(e){e=typeof e==`function`?HJe(e):R4(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new Q4(r,i)}function z4(e){return function(){return this.matches(e)}}function B4(e){return function(t){return t.matches(e)}}var WJe=Array.prototype.find;function GJe(e){return function(){return WJe.call(this.children,e)}}function KJe(){return this.firstElementChild}function qJe(e){return this.select(e==null?KJe:GJe(typeof e==`function`?e:B4(e)))}var JJe=Array.prototype.filter;function YJe(){return Array.from(this.children)}function XJe(e){return function(){return JJe.call(this.children,e)}}function ZJe(e){return this.selectAll(e==null?YJe:XJe(typeof e==`function`?e:B4(e)))}function QJe(e){typeof e!=`function`&&(e=z4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Q4(r,this._parents)}function V4(e){return Array(e.length)}function $Je(){return new Q4(this._enter||this._groups.map(V4),this._parents)}function H4(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}H4.prototype={constructor:H4,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function eYe(e){return function(){return e}}function tYe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new H4(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function nYe(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new H4(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function rYe(e){return e.__data__}function iYe(e,t){if(!arguments.length)return Array.from(this,rYe);var n=t?nYe:tYe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=eYe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=aYe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new Q4(o,r),o._enter=s,o._exit=c,o}function aYe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function oYe(){return new Q4(this._exit||this._groups.map(V4),this._parents)}function sYe(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function cYe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new Q4(s,this._parents)}function lYe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function uYe(e){e||=dYe;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new Q4(i,this._parents).order()}function dYe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fYe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pYe(){return Array.from(this)}function mYe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function hYe(){let e=0;for(let t of this)++e;return e}function gYe(){return!this.node()}function _Ye(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function vYe(e){return function(){this.removeAttribute(e)}}function yYe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function bYe(e,t){return function(){this.setAttribute(e,t)}}function xYe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function SYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function CYe(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function wYe(e,t){var n=F4(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?yYe:vYe:typeof t==`function`?n.local?CYe:SYe:n.local?xYe:bYe)(n,t))}function U4(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function TYe(e){return function(){this.style.removeProperty(e)}}function EYe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function DYe(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function OYe(e,t,n){return arguments.length>1?this.each((t==null?TYe:typeof t==`function`?DYe:EYe)(e,t,n??``)):W4(this.node(),e)}function W4(e,t){return e.style.getPropertyValue(t)||U4(e).getComputedStyle(e,null).getPropertyValue(t)}function kYe(e){return function(){delete this[e]}}function AYe(e,t){return function(){this[e]=t}}function jYe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function MYe(e,t){return arguments.length>1?this.each((t==null?kYe:typeof t==`function`?jYe:AYe)(e,t)):this.node()[e]}function G4(e){return e.trim().split(/^|\s+/)}function K4(e){return e.classList||new q4(e)}function q4(e){this._node=e,this._names=G4(e.getAttribute(`class`)||``)}q4.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function J4(e,t){for(var n=K4(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Y4(e,t){for(var n=K4(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function NYe(e){return function(){J4(this,e)}}function PYe(e){return function(){Y4(this,e)}}function FYe(e,t){return function(){(t.apply(this,arguments)?J4:Y4)(this,e)}}function IYe(e,t){var n=G4(e+``);if(arguments.length<2){for(var r=K4(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?FYe:t?NYe:PYe)(n,t))}function LYe(){this.textContent=``}function RYe(e){return function(){this.textContent=e}}function zYe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function BYe(e){return arguments.length?this.each(e==null?LYe:(typeof e==`function`?zYe:RYe)(e)):this.node().textContent}function VYe(){this.innerHTML=``}function HYe(e){return function(){this.innerHTML=e}}function UYe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function WYe(e){return arguments.length?this.each(e==null?VYe:(typeof e==`function`?UYe:HYe)(e)):this.node().innerHTML}function GYe(){this.nextSibling&&this.parentNode.appendChild(this)}function KYe(){return this.each(GYe)}function qYe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function JYe(){return this.each(qYe)}function YYe(e){var t=typeof e==`function`?e:I4(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function XYe(){return null}function ZYe(e,t){var n=typeof e==`function`?e:I4(e),r=t==null?XYe:typeof t==`function`?t:L4(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function QYe(){var e=this.parentNode;e&&e.removeChild(this)}function $Ye(){return this.each(QYe)}function eXe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tXe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nXe(e){return this.select(e?tXe:eXe)}function rXe(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function iXe(e){return function(t){e.call(this,t,this.__data__)}}function aXe(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function oXe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function sXe(e,t,n){return function(){var r=this.__on,i,a=iXe(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function cXe(e,t,n){var r=aXe(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?sXe:oXe,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function X4(e,t,n){var r=U4(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function lXe(e,t){return function(){return X4(this,e,t)}}function uXe(e,t){return function(){return X4(this,e,t.apply(this,arguments))}}function dXe(e,t){return this.each((typeof t==`function`?uXe:lXe)(e,t))}function*fXe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var Z4=[null];function Q4(e,t){this._groups=e,this._parents=t}function $4(){return new Q4([[document.documentElement]],Z4)}function pXe(){return this}Q4.prototype=$4.prototype={constructor:Q4,select:zJe,selectAll:UJe,selectChild:qJe,selectChildren:ZJe,filter:QJe,data:iYe,enter:$Je,exit:oYe,join:sYe,merge:cYe,selection:pXe,order:lYe,sort:uYe,call:fYe,nodes:pYe,node:mYe,size:hYe,empty:gYe,each:_Ye,attr:wYe,style:OYe,property:MYe,classed:IYe,text:BYe,html:WYe,raise:KYe,lower:JYe,append:YYe,insert:ZYe,remove:$Ye,clone:nXe,datum:rXe,on:cXe,dispatch:dXe,[Symbol.iterator]:fXe};function e3(e){return typeof e==`string`?new Q4([[document.querySelector(e)]],[document.documentElement]):new Q4([[e]],Z4)}function mXe(e){let t;for(;t=e.sourceEvent;)e=t;return e}function t3(e,t){if(e=mXe(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var hXe={passive:!1},n3={capture:!0,passive:!1};function r3(e){e.stopImmediatePropagation()}function i3(e){e.preventDefault(),e.stopImmediatePropagation()}function a3(e){var t=e.document.documentElement,n=e3(e).on(`dragstart.drag`,i3,n3);`onselectstart`in t?n.on(`selectstart.drag`,i3,n3):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function o3(e,t){var n=e.document.documentElement,r=e3(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,i3,n3),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var s3=e=>()=>e;function c3(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}c3.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function gXe(e){return!e.ctrlKey&&!e.button}function _Xe(){return this.parentNode}function vXe(e,t){return t??{x:e.x,y:e.y}}function yXe(){return navigator.maxTouchPoints||`ontouchstart`in this}function l3(){var e=gXe,t=_Xe,n=vXe,r=yXe,i={},a=j4(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,hXe).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(e3(n.view).on(`mousemove.drag`,m,n3).on(`mouseup.drag`,h,n3),a3(n.view),r3(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(i3(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){e3(e.view).on(`mousemove.drag mouseup.drag`,null),o3(e.view,l),i3(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(r3(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(i3(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(r3(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=t3(l||r,t),p,m,h;if((h=n.call(e,new c3(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=t3(l||a,t),_=o;break}u.call(r,e,new c3(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:s3(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:s3(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:s3(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:s3(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function u3(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function d3(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function f3(){}var p3=.7,m3=1/p3,h3=`\\s*([+-]?\\d+)\\s*`,g3=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,_3=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,bXe=/^#([0-9a-f]{3,8})$/,xXe=RegExp(`^rgb\\(${h3},${h3},${h3}\\)$`),SXe=RegExp(`^rgb\\(${_3},${_3},${_3}\\)$`),CXe=RegExp(`^rgba\\(${h3},${h3},${h3},${g3}\\)$`),wXe=RegExp(`^rgba\\(${_3},${_3},${_3},${g3}\\)$`),TXe=RegExp(`^hsl\\(${g3},${_3},${_3}\\)$`),EXe=RegExp(`^hsla\\(${g3},${_3},${_3},${g3}\\)$`),v3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};u3(f3,x3,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:y3,formatHex:y3,formatHex8:DXe,formatHsl:OXe,formatRgb:b3,toString:b3});function y3(){return this.rgb().formatHex()}function DXe(){return this.rgb().formatHex8()}function OXe(){return M3(this).formatHsl()}function b3(){return this.rgb().formatRgb()}function x3(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=bXe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?S3(t):n===3?new T3(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?C3(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?C3(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xXe.exec(e))?new T3(t[1],t[2],t[3],1):(t=SXe.exec(e))?new T3(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=CXe.exec(e))?C3(t[1],t[2],t[3],t[4]):(t=wXe.exec(e))?C3(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=TXe.exec(e))?j3(t[1],t[2]/100,t[3]/100,1):(t=EXe.exec(e))?j3(t[1],t[2]/100,t[3]/100,t[4]):v3.hasOwnProperty(e)?S3(v3[e]):e===`transparent`?new T3(NaN,NaN,NaN,0):null}function S3(e){return new T3(e>>16&255,e>>8&255,e&255,1)}function C3(e,t,n,r){return r<=0&&(e=t=n=NaN),new T3(e,t,n,r)}function kXe(e){return e instanceof f3||(e=x3(e)),e?(e=e.rgb(),new T3(e.r,e.g,e.b,e.opacity)):new T3}function w3(e,t,n,r){return arguments.length===1?kXe(e):new T3(e,t,n,r??1)}function T3(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}u3(T3,w3,d3(f3,{brighter(e){return e=e==null?m3:m3**+e,new T3(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?p3:p3**+e,new T3(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new T3(k3(this.r),k3(this.g),k3(this.b),O3(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:E3,formatHex:E3,formatHex8:AXe,formatRgb:D3,toString:D3}));function E3(){return`#${A3(this.r)}${A3(this.g)}${A3(this.b)}`}function AXe(){return`#${A3(this.r)}${A3(this.g)}${A3(this.b)}${A3((isNaN(this.opacity)?1:this.opacity)*255)}`}function D3(){let e=O3(this.opacity);return`${e===1?`rgb(`:`rgba(`}${k3(this.r)}, ${k3(this.g)}, ${k3(this.b)}${e===1?`)`:`, ${e})`}`}function O3(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function k3(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function A3(e){return e=k3(e),(e<16?`0`:``)+e.toString(16)}function j3(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new N3(e,t,n,r)}function M3(e){if(e instanceof N3)return new N3(e.h,e.s,e.l,e.opacity);if(e instanceof f3||(e=x3(e)),!e)return new N3;if(e instanceof N3)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new N3(o,s,c,e.opacity)}function jXe(e,t,n,r){return arguments.length===1?M3(e):new N3(e,t,n,r??1)}function N3(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}u3(N3,jXe,d3(f3,{brighter(e){return e=e==null?m3:m3**+e,new N3(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?p3:p3**+e,new N3(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new T3(I3(e>=240?e-240:e+120,i,r),I3(e,i,r),I3(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new N3(P3(this.h),F3(this.s),F3(this.l),O3(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=O3(this.opacity);return`${e===1?`hsl(`:`hsla(`}${P3(this.h)}, ${F3(this.s)*100}%, ${F3(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function P3(e){return e=(e||0)%360,e<0?e+360:e}function F3(e){return Math.max(0,Math.min(1,e||0))}function I3(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var L3=e=>()=>e;function MXe(e,t){return function(n){return e+n*t}}function NXe(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function PXe(e){return(e=+e)==1?R3:function(t,n){return n-t?NXe(t,n,e):L3(isNaN(t)?n:t)}}function R3(e,t){var n=t-e;return n?MXe(e,n):L3(isNaN(e)?t:e)}var z3=(function e(t){var n=PXe(t);function r(e,t){var r=n((e=w3(e)).r,(t=w3(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=R3(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function FXe(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function IXe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function LXe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=W3(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function RXe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function B3(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zXe(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=W3(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var V3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,H3=new RegExp(V3.source,`g`);function BXe(e){return function(){return e}}function VXe(e){return function(t){return e(t)+``}}function U3(e,t){var n=V3.lastIndex=H3.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=V3.exec(e))&&(i=H3.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:B3(r,i)})),n=H3.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?VXe(c[0].x):BXe(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function W3(e,t){var n=typeof t,r;return t==null||n===`boolean`?L3(t):(n===`number`?B3:n===`string`?(r=x3(t))?(t=r,z3):U3:t instanceof x3?z3:t instanceof Date?RXe:IXe(t)?FXe:Array.isArray(t)?LXe:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?zXe:B3)(e,t)}var G3=180/Math.PI,K3={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function q3(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*G3,skewX:Math.atan(c)*G3,scaleX:o,scaleY:s}}var J3;function HXe(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?K3:q3(t.a,t.b,t.c,t.d,t.e,t.f)}function UXe(e){return e==null||(J3||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),J3.setAttribute(`transform`,e),!(e=J3.transform.baseVal.consolidate()))?K3:(e=e.matrix,q3(e.a,e.b,e.c,e.d,e.e,e.f))}function Y3(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:B3(e,i)},{i:c-2,x:B3(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:B3(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:B3(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:B3(e,n)},{i:s-2,x:B3(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var WXe=Y3(HXe,`px, `,`px)`,`deg)`),GXe=Y3(UXe,`, `,`)`,`)`),KXe=1e-12;function X3(e){return((e=Math.exp(e))+1/e)/2}function qXe(e){return((e=Math.exp(e))-1/e)/2}function JXe(e){return((e=Math.exp(2*e))-1)/(e+1)}var Z3=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<KXe)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=X3(y),c=s/(n*g)*(i*JXe(t*r+y)-qXe(y));return[a+c*d,o+c*f,s*i/X3(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),Q3=0,$3=0,e6=0,t6=1e3,n6,r6,i6=0,a6=0,o6=0,s6=typeof performance==`object`&&performance.now?performance:Date,c6=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function l6(){return a6||=(c6(YXe),s6.now()+o6)}function YXe(){a6=0}function u6(){this._call=this._time=this._next=null}u6.prototype=d6.prototype={constructor:u6,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?l6():+n)+(t==null?0:+t),!this._next&&r6!==this&&(r6?r6._next=this:n6=this,r6=this),this._call=e,this._time=n,p6()},stop:function(){this._call&&(this._call=null,this._time=1/0,p6())}};function d6(e,t,n){var r=new u6;return r.restart(e,t,n),r}function XXe(){l6(),++Q3;for(var e=n6,t;e;)(t=a6-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Q3}function f6(){a6=(i6=s6.now())+o6,Q3=$3=0;try{XXe()}finally{Q3=0,QXe(),a6=0}}function ZXe(){var e=s6.now(),t=e-i6;t>t6&&(o6-=t,i6=e)}function QXe(){for(var e,t=n6,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:n6=n);r6=e,p6(r)}function p6(e){Q3||($3&&=clearTimeout($3),e-a6>24?(e<1/0&&($3=setTimeout(f6,e-s6.now()-o6)),e6&&=clearInterval(e6)):(e6||=(i6=s6.now(),setInterval(ZXe,t6)),Q3=1,c6(f6)))}function m6(e,t,n){var r=new u6;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var $Xe=j4(`start`,`end`,`cancel`,`interrupt`),eZe=[];function h6(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;tZe(e,n,{name:t,index:r,group:i,on:$Xe,tween:eZe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function g6(e,t){var n=v6(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function _6(e,t){var n=v6(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function v6(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function tZe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=d6(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return m6(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(m6(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function y6(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function nZe(e){return this.each(function(){y6(this,e)})}function rZe(e,t){var n,r;return function(){var i=_6(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function iZe(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=_6(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function aZe(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=v6(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?rZe:iZe)(n,e,t))}function b6(e,t,n){var r=e._id;return e.each(function(){var e=_6(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return v6(e,r).value[t]}}function x6(e,t){var n;return(typeof t==`number`?B3:t instanceof x3?z3:(n=x3(t))?(t=n,z3):U3)(e,t)}function oZe(e){return function(){this.removeAttribute(e)}}function sZe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cZe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function lZe(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function uZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function dZe(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function fZe(e,t){var n=F4(e),r=n===`transform`?GXe:x6;return this.attrTween(e,typeof t==`function`?(n.local?dZe:uZe)(n,r,b6(this,`attr.`+e,t)):t==null?(n.local?sZe:oZe)(n):(n.local?lZe:cZe)(n,r,t))}function pZe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mZe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&mZe(e,i)),n}return i._value=t,i}function gZe(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&pZe(e,i)),n}return i._value=t,i}function _Ze(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=F4(e);return this.tween(n,(r.local?hZe:gZe)(r,t))}function vZe(e,t){return function(){g6(this,e).delay=+t.apply(this,arguments)}}function yZe(e,t){return t=+t,function(){g6(this,e).delay=t}}function bZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?vZe:yZe)(t,e)):v6(this.node(),t).delay}function xZe(e,t){return function(){_6(this,e).duration=+t.apply(this,arguments)}}function SZe(e,t){return t=+t,function(){_6(this,e).duration=t}}function CZe(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?xZe:SZe)(t,e)):v6(this.node(),t).duration}function wZe(e,t){if(typeof t!=`function`)throw Error();return function(){_6(this,e).ease=t}}function TZe(e){var t=this._id;return arguments.length?this.each(wZe(t,e)):v6(this.node(),t).ease}function EZe(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();_6(this,e).ease=n}}function DZe(e){if(typeof e!=`function`)throw Error();return this.each(EZe(this._id,e))}function OZe(e){typeof e!=`function`&&(e=z4(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new C6(r,this._parents,this._name,this._id)}function kZe(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new C6(o,this._parents,this._name,this._id)}function AZe(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function jZe(e,t,n){var r,i,a=AZe(t)?g6:_6;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function MZe(e,t){var n=this._id;return arguments.length<2?v6(this.node(),n).on.on(e):this.each(jZe(n,e,t))}function NZe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function PZe(){return this.on(`end.remove`,NZe(this._id))}function FZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=L4(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,h6(l[f],t,n,f,l,v6(u,n)));return new C6(a,this._parents,t,n)}function IZe(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=R4(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=v6(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&h6(p,t,n,h,f,m);a.push(f),o.push(u)}return new C6(a,o,t,n)}var LZe=$4.prototype.constructor;function RZe(){return new LZe(this._groups,this._parents)}function zZe(e,t){var n,r,i;return function(){var a=W4(this,e),o=(this.style.removeProperty(e),W4(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function S6(e){return function(){this.style.removeProperty(e)}}function BZe(e,t,n){var r,i=n+``,a;return function(){var o=W4(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function VZe(e,t,n){var r,i,a;return function(){var o=W4(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),W4(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function HZe(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=_6(this,e),l=c.on,u=c.value[a]==null?s||=S6(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function UZe(e,t,n){var r=(e+=``)==`transform`?WXe:x6;return t==null?this.styleTween(e,zZe(e,r)).on(`end.style.`+e,S6(e)):typeof t==`function`?this.styleTween(e,VZe(e,r,b6(this,`style.`+e,t))).each(HZe(this._id,e)):this.styleTween(e,BZe(e,r,t),n).on(`end.style.`+e,null)}function WZe(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function GZe(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&WZe(e,a,n)),r}return a._value=t,a}function KZe(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,GZe(e,t,n??``))}function qZe(e){return function(){this.textContent=e}}function JZe(e){return function(){var t=e(this);this.textContent=t??``}}function YZe(e){return this.tween(`text`,typeof e==`function`?JZe(b6(this,`text`,e)):qZe(e==null?``:e+``))}function XZe(e){return function(t){this.textContent=e.call(this,t)}}function ZZe(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&XZe(r)),t}return r._value=e,r}function QZe(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,ZZe(e))}function $Ze(){for(var e=this._name,t=this._id,n=w6(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=v6(c,t);h6(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new C6(r,this._parents,e,n)}function eQe(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=_6(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var tQe=0;function C6(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function nQe(e){return $4().transition(e)}function w6(){return++tQe}var T6=$4.prototype;C6.prototype=nQe.prototype={constructor:C6,select:FZe,selectAll:IZe,selectChild:T6.selectChild,selectChildren:T6.selectChildren,filter:OZe,merge:kZe,selection:RZe,transition:$Ze,call:T6.call,nodes:T6.nodes,node:T6.node,size:T6.size,empty:T6.empty,each:T6.each,on:MZe,attr:fZe,attrTween:_Ze,style:UZe,styleTween:KZe,text:YZe,textTween:QZe,remove:PZe,tween:aZe,delay:bZe,duration:CZe,ease:TZe,easeVarying:DZe,end:eQe,[Symbol.iterator]:T6[Symbol.iterator]};function rQe(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var iQe={time:null,delay:0,duration:250,ease:rQe};function aQe(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function oQe(e){var t,n;e instanceof C6?(t=e._id,e=e._name):(t=w6(),(n=iQe).time=l6(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&h6(c,e,t,l,o,n||aQe(c,t));return new C6(r,this._parents,e,t)}$4.prototype.interrupt=nZe,$4.prototype.transition=oQe;var E6=e=>()=>e;function sQe(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function D6(e,t,n){this.k=e,this.x=t,this.y=n}D6.prototype={constructor:D6,scale:function(e){return e===1?this:new D6(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new D6(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var O6=new D6(1,0,0);k6.prototype=D6.prototype;function k6(e){for(;!e.__zoom;)if(!(e=e.parentNode))return O6;return e.__zoom}function A6(e){e.stopImmediatePropagation()}function j6(e){e.preventDefault(),e.stopImmediatePropagation()}function cQe(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function lQe(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function M6(){return this.__zoom||O6}function uQe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function dQe(){return navigator.maxTouchPoints||`ontouchstart`in this}function fQe(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function N6(){var e=cQe,t=lQe,n=fQe,r=uQe,i=dQe,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Z3,l=j4(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,M6).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,M6),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(O6.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new D6(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new D6(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new D6(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=e3(this.that).datum();l.call(e,this.that,new sQe(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=t3(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],y6(this),s.start();j6(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=e3(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=t3(t,i),l=t.clientX,u=t.clientY;a3(t.view),A6(t),a.mouse=[c,this.__zoom.invert(c)],y6(this),a.start();function d(e){if(j6(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=t3(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),o3(e.view,a.moved),j6(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=t3(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);j6(r),s>0?e3(this).transition().duration(s).call(x,d,c,r):e3(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(A6(t),s=0;s<i;++s)c=r[s],l=t3(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),y6(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(j6(e),s=0;s<a;++s)c=i[s],l=t3(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(A6(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=t3(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=e3(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:E6(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:E6(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:E6(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:E6([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var P6={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},F6=[[-1/0,-1/0],[1/0,1/0]],I6=[`Enter`,` `,`Escape`],L6={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},R6;(function(e){e.Strict=`strict`,e.Loose=`loose`})(R6||={});var z6;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(z6||={});var B6;(function(e){e.Partial=`partial`,e.Full=`full`})(B6||={});var V6={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},H6;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(H6||={});var U6;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(U6||={});var W6;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(W6||={});var G6={[W6.Left]:W6.Right,[W6.Right]:W6.Left,[W6.Top]:W6.Bottom,[W6.Bottom]:W6.Top};function K6(e){return e===null?null:e?`valid`:`invalid`}var q6=e=>`id`in e&&`source`in e&&`target`in e,pQe=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),J6=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Y6=(e,t=[0,0])=>{let{width:n,height:r}=b8(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},mQe=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:o8(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):J6(n)?n:t.nodeLookup.get(n.id)),i8(e,i?c8(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),X6=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=i8(n,c8(e)),r=!0)}),r?o8(n):{x:0,y:0,width:0,height:0}},Z6=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...m8(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=u8(s,s8(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},hQe=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function gQe(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function _Qe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=_8(X6(gQe(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function Q6({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,P6.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&y8(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=y8(d)?e8(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,P6.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function vQe({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=hQe(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var $6=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),e8=(e={x:0,y:0},t,n)=>({x:$6(e.x,t[0][0],t[1][0]-(n?.width??0)),y:$6(e.y,t[0][1],t[1][1]-(n?.height??0))});function t8(e,t,n){let{width:r,height:i}=b8(n),{x:a,y:o}=n.internals.positionAbsolute;return e8(e,[[a,o],[a+r,o+i]],t)}var n8=(e,t,n)=>e<t?$6(Math.abs(e-t),1,t)/t:e>n?-$6(Math.abs(e-n),1,t)/t:0,r8=(e,t,n=15,r=40)=>[n8(e.x,r,t.width-r)*n,n8(e.y,r,t.height-r)*n],i8=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),a8=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),o8=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),s8=(e,t=[0,0])=>{let{x:n,y:r}=J6(e)?e.internals.positionAbsolute:Y6(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},c8=(e,t=[0,0])=>{let{x:n,y:r}=J6(e)?e.internals.positionAbsolute:Y6(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},l8=(e,t)=>o8(i8(a8(e),a8(t))),u8=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},d8=e=>f8(e.width)&&f8(e.height)&&f8(e.x)&&f8(e.y),f8=e=>!isNaN(e)&&isFinite(e),yQe=(e,t)=>{},p8=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),m8=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?p8(s,o):s},h8=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function g8(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function bQe(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=g8(e,n),i=g8(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=g8(e.top??e.y??0,n),i=g8(e.bottom??e.y??0,n),a=g8(e.left??e.x??0,t),o=g8(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function xQe(e,t,n,r,i,a){let{x:o,y:s}=h8(e,[t,n,r]),{x:c,y:l}=h8({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var _8=(e,t,n,r,i,a)=>{let o=bQe(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=$6(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=xQe(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},v8=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function y8(e){return e!=null&&e!==`parent`}function b8(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function x8(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function S8(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function C8(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function SQe(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function CQe(e){return{...L6,...e||{}}}function w8(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=k8(e),s=m8({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?p8(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var T8=e=>({width:e.offsetWidth,height:e.offsetHeight}),E8=e=>e?.getRootNode?.()||window?.document,wQe=[`INPUT`,`SELECT`,`TEXTAREA`];function D8(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?wQe.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var O8=e=>`clientX`in e,k8=(e,t)=>{let n=O8(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},A8=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...T8(t)}})};function j8({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function M8(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function N8({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case W6.Left:return[t-M8(t-r,a),n];case W6.Right:return[t+M8(r-t,a),n];case W6.Top:return[t,n-M8(n-i,a)];case W6.Bottom:return[t,n+M8(i-n,a)]}}function P8({sourceX:e,sourceY:t,sourcePosition:n=W6.Bottom,targetX:r,targetY:i,targetPosition:a=W6.Top,curvature:o=.25}){let[s,c]=N8({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=N8({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=j8({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function F8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function TQe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function EQe({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=i8(c8(e),c8(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),u8({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},o8(a))>0}var DQe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,OQe=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),kQe=(e,t,n={})=>{if(!e.source||!e.target)return P6.error006(),t;let r=n.getEdgeId||DQe,i;return i=q6(e)?{...e}:{...e,id:r(e)},OQe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function I8({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=F8({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var L8={[W6.Left]:{x:-1,y:0},[W6.Right]:{x:1,y:0},[W6.Top]:{x:0,y:-1},[W6.Bottom]:{x:0,y:1}},AQe=({source:e,sourcePosition:t=W6.Bottom,target:n})=>t===W6.Left||t===W6.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},R8=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function jQe({source:e,sourcePosition:t=W6.Bottom,target:n,targetPosition:r=W6.Top,center:i,offset:a,stepPosition:o}){let s=L8[t],c=L8[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=AQe({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=F8({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function MQe(e,t,n,r){let i=Math.min(R8(e,t)/2,R8(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function z8({sourceX:e,sourceY:t,sourcePosition:n=W6.Bottom,targetX:r,targetY:i,targetPosition:a=W6.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=jQe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=MQe(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function B8(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function NQe(e){let{sourceNode:t,targetNode:n}=e;if(!B8(t)||!B8(n))return null;let r=t.internals.handleBounds||V8(t.handles),i=n.internals.handleBounds||V8(n.handles),a=U8(r?.source??[],e.sourceHandle),o=U8(e.connectionMode===R6.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,P6.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||W6.Bottom,c=o?.position||W6.Top,l=H8(t,a,s),u=H8(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function V8(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function H8(e,t,n=W6.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??b8(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case W6.Top:return{x:i+o/2,y:a};case W6.Right:return{x:i+o,y:a+s/2};case W6.Bottom:return{x:i+o/2,y:a+s};case W6.Left:return{x:i,y:a+s/2}}}function U8(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function W8(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function PQe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=W8(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var G8=1e3,FQe=10,K8={nodeOrigin:[0,0],nodeExtent:F6,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},IQe={...K8,checkEquality:!0};function q8(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function LQe(e,t,n){let r=q8(K8,n);for(let n of e.values())if(n.parentId)X8(n,e,t,r);else{let e=e8(Y6(n,r.nodeOrigin),y8(n.extent)?n.extent:r.nodeExtent,b8(n));n.internals.positionAbsolute=e}}function RQe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function J8(e){return e===`manual`}function Y8(e,t,n,r={}){let i=q8(IQe,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!J8(i.zIndexMode)?G8:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=e8(Y6(u,i.nodeOrigin),y8(u.extent)?u.extent:i.nodeExtent,b8(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:RQe(u,e),z:Z8(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&X8(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function zQe(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function X8(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=q8(K8,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zQe(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*FQe),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=BQe(e,u,o,s,a&&!J8(c)?G8:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Z8(e,t,n){let r=f8(e.zIndex)?e.zIndex:0;return J8(n)?r:r+(e.selected?t:0)}function BQe(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=b8(e),l=Y6(e,n),u=y8(e.extent)?e8(l,e.extent,c):l,d=e8({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=t8(d,c,t));let f=Z8(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Q8(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=l8(a.get(n.parentId)?.expandedRect??s8(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=b8(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function VQe(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=T8(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=y8(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=t8(h,s,t.get(e.parentId)):m&&(h=e8(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:A8(`source`,r.nodeElement,p,d,e.id),target:A8(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&X8(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:s8(g,i)}))}}if(f.length>0){let e=Q8(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function HQe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function $8(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function e5(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;$8(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),$8(`target`,s,c,e,i,o),t.set(r.id,r)}}function t5(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:t5(n,t):!1}function n5(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function UQe(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!t5(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function r5({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function WQe({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=p8(a,t);return{x:o.x-a.x,y:o.y-a.y}}function GQe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=e3(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?a8(X6(s)):null,x=v&&l?WQe({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:p8(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=Q6({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=r5({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=r8(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=w8(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=UQe(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=r5({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=l3().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=w8(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=k8(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=w8(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=k8(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=k8(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=r5({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!n5(t,`.${g}`,v))&&(!_||n5(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function KQe(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())u8(i,s8(e))>0&&r.push(e);return r}var qQe=250;function JQe(e,t,n,r){let i=[],a=1/0,o=KQe(e,n,t+qQe);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=H8(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function i5(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...H8(o,c,c.position,!0)}:c}function a5(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function YQe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var o5=()=>!0;function XQe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=o5,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=E8(e.target),E=0,D,{x:O,y:k}=k8(e),A=a5(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=i5(i,A,r,c,t);if(!N)return;let P=k8(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=r8(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},te=c.get(i),B={inProgress:!0,isValid:null,from:H8(te,z,W6.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:te,to:P,toHandle:null,toPosition:G6[z.position],toNode:null,pointer:P};function V(){M=!0,y(B),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&V();function ne(e){if(!M){let{x:t,y:n}=k8(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;V()}if(!x()||!z){re(e);return}let a=b();P=k8(e,j),D=JQe(m8(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=s5(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=YQe(!!D,s.isValid);let u=c.get(i),f=u?H8(u,z,W6.Left,!0):B.from,p={...B,from:f,isValid:L,to:s.toHandle&&L?h8({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:G6[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),B=p}function re(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=B,r={...n,toPosition:B.toHandle?B.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,R=null,T.removeEventListener(`mousemove`,ne),T.removeEventListener(`mouseup`,re),T.removeEventListener(`touchmove`,ne),T.removeEventListener(`touchend`,re)}}T.addEventListener(`mousemove`,ne),T.addEventListener(`mouseup`,re),T.addEventListener(`touchmove`,ne),T.addEventListener(`touchend`,re)}function s5(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=o5,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=k8(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=a5(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===R6.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=i5(t,e,a,u,n,!0)}return _}var c5={onPointerDown:XQe,isValid:s5};function ZQe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=e3(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&v8()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=N6().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:t3}}var l5=e=>({x:e.x,y:e.y,zoom:e.k}),u5=({x:e,y:t,zoom:n})=>O6.translate(e,t).scale(n),d5=(e,t)=>e.target.closest(`.${t}`),f5=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),QQe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,p5=(e,t=0,n=QQe,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},m5=e=>{let t=e.ctrlKey&&v8()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $Qe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(d5(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=t3(u),t=d*2**m5(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===z6.Vertical?0:u.deltaX*f,m=i===z6.Horizontal?0:u.deltaY*f;!v8()&&u.shiftKey&&i!==z6.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=l5(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function e$e({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=d5(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function t$e({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=l5(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function n$e({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&f5(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,l5(a.transform))}}function r$e({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&f5(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=l5(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function i$e({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(d5(d,`${l}-flow__node`)||d5(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||d5(d,s)&&m||d5(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function a$e({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=N6().scaleExtent([t,n]).translateExtent(r),f=e3(e).call(d);v({x:i.x,y:i.y,zoom:$6(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(m5);function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?W3:Z3).transform(p5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!f8(E)||E<0?0:E);let k=O?$Qe({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):e$e({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(f.on(`wheel.zoom`,k,{passive:!1}),!r){let e=t$e({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,e);let t=n$e({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,t);let r=r$e({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,r)}let A=i$e({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(A),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=u5(e),i=d?.constrain()(r,t,n);return i&&await h(i),new Promise(e=>e(i))}async function y(e,t){let n=u5(e);return await h(n,t),new Promise(e=>e(n))}function b(e){if(f){let t=u5(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?k6(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?W3:Z3).scaleTo(p5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?W3:Z3).scaleBy(p5(f,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!f8(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var h5;(function(e){e.Line=`line`,e.Handle=`handle`})(h5||={});function o$e({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function g5(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function _5(e,t){return Math.max(0,t-e)}function v5(e,t){return Math.max(0,e-t)}function y5(e,t,n){return Math.max(0,t-e,e-n)}function b5(e,t){return e?!t:t}function s$e(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=y5(E,h,g),j=y5(D,_,v);if(o){let e=0,t=0;c&&w<0?e=_5(y+w+O,o[0][0]):!c&&w>0&&(e=v5(y+E+O,o[1][0])),l&&T<0?t=_5(b+T+k,o[0][1]):!l&&T>0&&(t=v5(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=v5(y+w,s[0][0]):!c&&w<0&&(e=_5(y+E,s[1][0])),l&&T>0?t=v5(b+T,s[0][1]):!l&&T<0&&(t=_5(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=y5(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?v5(b+k+E/C,o[1][1])*C:_5(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?_5(b+E/C,s[1][1])*C:v5(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=y5(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?v5(y+D*C+O,o[1][0])/C:_5(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?_5(y+D*C,s[1][0])/C:v5(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(b5(c,l)?-w:w)/C:w=(b5(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var x5={width:0,height:0,x:0,y:0},c$e={...x5,pointerX:0,pointerY:0,aspectRatio:1};function l$e(e){return[[0,0],[e.measured.width,e.measured.height]]}function u$e(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function d$e({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=e3(e),o={controlDirection:g5(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...x5},h={...c$e};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:g5(e)};let g,_=null,v=[],y,b,x,S=!1,C=l3().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=w8(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?l$e(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=u$e(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=w8(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=s$e(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=o$e({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var S5=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},f$e=e=>e?S5(e):S5,{useDebugValue:p$e}=C.default,{useSyncExternalStoreWithSelector:m$e}=GC.default,h$e=e=>e;function C5(e,t=h$e,n){let r=m$e(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p$e(r),r}var w5=(e,t)=>{let n=f$e(e),r=(e,r=t)=>C5(n,e,r);return Object.assign(r,n),r},g$e=(e,t)=>e?w5(e,t):w5;function T5(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var E5=(0,C.createContext)(null),_$e=E5.Provider,D5=P6.error001();function O5(e,t){let n=(0,C.useContext)(E5);if(n===null)throw Error(D5);return C5(n,e,t)}function k5(){let e=(0,C.useContext)(E5);if(e===null)throw Error(D5);return(0,C.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var A5={display:`none`},v$e={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},j5=`react-flow__node-desc`,M5=`react-flow__edge-desc`,y$e=`react-flow__aria-live`,b$e=e=>e.ariaLiveMessage,x$e=e=>e.ariaLabelConfig;function S$e({rfId:e}){let t=O5(b$e);return(0,G.jsx)(`div`,{id:`${y$e}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:v$e,children:t})}function C$e({rfId:e,disableKeyboardA11y:t}){let n=O5(x$e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`${j5}-${e}`,style:A5,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,G.jsx)(`div`,{id:`${M5}-${e}`,style:A5,children:n[`edge.a11yDescription.default`]}),!t&&(0,G.jsx)(S$e,{rfId:e})]})}var N5=(0,C.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,G.jsx)(`div`,{className:A4([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));N5.displayName=`Panel`;function w$e({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,G.jsx)(N5,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,G.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var T$e=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},P5=e=>e.id;function E$e(e,t){return T5(e.selectedNodes.map(P5),t.selectedNodes.map(P5))&&T5(e.selectedEdges.map(P5),t.selectedEdges.map(P5))}function D$e({onSelectionChange:e}){let t=k5(),{selectedNodes:n,selectedEdges:r}=O5(T$e,E$e);return(0,C.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var O$e=e=>!!e.onSelectionChangeHandlers;function k$e({onSelectionChange:e}){let t=O5(O$e);return e||t?(0,G.jsx)(D$e,{onSelectionChange:e}):null}var F5=typeof window<`u`?C.useLayoutEffect:C.useEffect,I5=[0,0],A$e={x:0,y:0,zoom:1},L5=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],j$e=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),R5={translateExtent:F6,nodeOrigin:I5,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function M$e(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=O5(j$e,T5),l=k5();F5(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=R5,s()}),[]);let u=(0,C.useRef)(R5);return F5(()=>{for(let s of L5){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:CQe(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},L5.map(t=>e[t])),null}function z5(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function N$e(e){let[t,n]=(0,C.useState)(e===`system`?null:e);return(0,C.useEffect)(()=>{if(e!==`system`){n(e);return}let t=z5(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?z5()?.matches?`dark`:`light`:t}var B5=typeof document<`u`?document:null;function V5(e=null,t={target:B5,actInsideInputWithModifier:!0}){let[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(!1),a=(0,C.useRef)(new Set([])),[o,s]=(0,C.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
460
460
|
`).replace(`
|
|
461
461
|
|
|
462
462
|
`,`
|
|
@@ -466,4 +466,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
466
466
|
To pick up a draggable item, press the space bar.
|
|
467
467
|
While dragging, use the arrow keys to move the item.
|
|
468
468
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
469
|
-
`},V2e={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 H2e(e){let{announcements:t=V2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=B2e}=e,{announce:a,announcement:o}=I2e(),s=f9(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),R2e((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(P2e,{id:r,value:i.draggable}),C.createElement(F2e,{id:s,announcement:o}));return n?(0,ka.createPortal)(u,n):u}var v9;(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`})(v9||={});function y9(){}function U2e(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function W2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var b9=Object.freeze({x:0,y:0});function G2e(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function K2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function q2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function J2e(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Y2e(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function X2e(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Z2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=X2e(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=G2e(X2e(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(K2e)},Q2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=J2e(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=J2e(r),o=i.reduce((e,t,r)=>e+G2e(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(K2e)};function $2e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var e4e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(q2e)};function t4e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function n4e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:b9}function r4e(e){return function(t){return[...arguments].slice(1).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})}}var i4e=r4e(1);function a4e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function o4e(e,t,n){let r=a4e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var s4e={ignoreTransform:!1};function x9(e,t){t===void 0&&(t=s4e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=t9(e).getComputedStyle(e);t&&(n=o4e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function c4e(e){return x9(e,{ignoreTransform:!0})}function l4e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function u4e(e,t){return t===void 0&&(t=t9(e).getComputedStyle(e)),t.position===`fixed`}function d4e(e,t){t===void 0&&(t=t9(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function S9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(n9(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!r9(i)||E2e(i)||n.includes(i))return n;let a=t9(e).getComputedStyle(i);return i!==e&&d4e(i,a)&&n.push(i),u4e(i,a)?n:r(i.parentNode)}return e?r(e):n}function f4e(e){let[t]=S9(e,1);return t??null}function C9(e){return!Q7||!e?null:$7(e)?e:e9(e)?n9(e)||e===i9(e).scrollingElement?window:r9(e)?e:null:null}function p4e(e){return $7(e)?e.scrollX:e.scrollLeft}function m4e(e){return $7(e)?e.scrollY:e.scrollTop}function w9(e){return{x:p4e(e),y:m4e(e)}}var T9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(T9||={});function h4e(e){return!Q7||!e?!1:e===document.scrollingElement}function g4e(e){let t={x:0,y:0},n=h4e(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}}var _4e={x:.2,y:.2};function v4e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=_4e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=g4e(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=T9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=T9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=T9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=T9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function y4e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function b4e(e){return e.reduce((e,t)=>p9(e,w9(t)),b9)}function x4e(e){return e.reduce((e,t)=>e+p4e(t),0)}function S4e(e){return e.reduce((e,t)=>e+m4e(t),0)}function C4e(e,t){if(t===void 0&&(t=x9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);f4e(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var w4e=[[`x`,[`left`,`right`],x4e],[`y`,[`top`,`bottom`],S4e]],E9=class{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;let n=S9(t),r=b4e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of w4e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},D9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function T4e(e){let{EventTarget:t}=t9(e);return e instanceof t?e:i9(e)}function O9(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?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:!1}var k9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(k9||={});function E4e(e){e.preventDefault()}function D4e(e){e.stopPropagation()}var A9;(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`})(A9||={});var O4e={start:[A9.Space,A9.Enter],cancel:[A9.Esc],end:[A9.Space,A9.Enter,A9.Tab]},k4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case A9.Right:return{...n,x:n.x+25};case A9.Left:return{...n,x:n.x-25};case A9.Down:return{...n,y:n.y+25};case A9.Up:return{...n,y:n.y-25}}},j9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new D9(i9(t)),this.windowListeners=new D9(t9(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(k9.Resize,this.handleCancel),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(k9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&C4e(n),t(b9)}handleKeyDown(e){if(h9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=O4e,coordinateGetter:a=k4e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:b9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=m9(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=g4e(n),p=y4e(n),m={x:Math.min(i===A9.Right?p.right-p.width/2:p.right,Math.max(i===A9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===A9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===A9.Down?p.top:p.top+p.height/2,u.y))},h=i===A9.Right&&!s||i===A9.Left&&!c,g=i===A9.Down&&!l||i===A9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===A9.Right&&e<=d.x||i===A9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===A9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===A9.Down&&e<=d.y||i===A9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===A9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,p9(m9(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};j9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=O4e,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function A4e(e){return!!(e&&`distance`in e)}function j4e(e){return!!(e&&`delay`in e)}var M9=class{constructor(e,t,n){n===void 0&&(n=T4e(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;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=i9(i),this.documentListeners=new D9(this.document),this.listeners=new D9(n),this.windowListeners=new D9(t9(i)),this.initialCoordinates=g9(r)??b9,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(){let{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(k9.Resize,this.handleCancel),this.windowListeners.add(k9.DragStart,E4e),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),this.windowListeners.add(k9.ContextMenu,E4e),this.documentListeners.add(k9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(j4e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(A4e(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(k9.Click,D4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(k9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=g9(e)??b9,s=m9(n,o);if(!t&&a){if(A4e(a)){if(a.tolerance!=null&&O9(s,a.tolerance))return this.handleCancel();if(O9(s,a.distance))return this.handleStart()}if(j4e(a)&&O9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===A9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},M4e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},N9=class extends M9{constructor(e){let{event:t}=e,n=i9(t.target);super(e,M4e,n)}};N9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var N4e={move:{name:`mousemove`},end:{name:`mouseup`}},P4e;(function(e){e[e.RightClick=2]=`RightClick`})(P4e||={});var F4e=class extends M9{constructor(e){super(e,N4e,i9(e.event.target))}};F4e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===P4e.RightClick?!1:(r?.({event:n}),!0)}}];var P9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},I4e=class extends M9{constructor(e){super(e,P9)}static setup(){return window.addEventListener(P9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(P9.move.name,e)};function e(){}}};I4e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var F9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(F9||={});var I9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(I9||={});function L4e(e){let{acceleration:t,activator:n=F9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=I9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=z4e({delta:d,disabled:!a}),[m,h]=D2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case F9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case F9.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===I9.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=v4e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var R4e={x:{[T9.Backward]:!1,[T9.Forward]:!1},y:{[T9.Backward]:!1,[T9.Forward]:!1}};function z4e(e){let{delta:t,disabled:n}=e,r=u9(t);return c9(e=>{if(n||!r||!e)return R4e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[T9.Backward]:e.x[T9.Backward]||i.x===-1,[T9.Forward]:e.x[T9.Forward]||i.x===1},y:{[T9.Backward]:e.y[T9.Backward]||i.y===-1,[T9.Forward]:e.y[T9.Forward]||i.y===1}}},[n,t,r])}function B4e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return c9(e=>t==null?null:r??e??null,[r,t])}function V4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var L9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(L9||={});var H4e;(function(e){e.Optimized=`optimized`})(H4e||={});var U4e=new Map;function W4e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=s9(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=c9(t=>{if(d&&!n)return U4e;if(!t||t===U4e||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new E9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case L9.Always:return!1;case L9.BeforeDragging:return n;default:return!n}}}function G4e(e,t){return c9(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function K4e(e,t){return G4e(e,t)}function q4e(e){let{callback:t,disabled:n}=e,r=o9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function R9(e){let{callback:t,disabled:n}=e,r=o9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function J4e(e){return new E9(x9(e),e)}function Y4e(e,t,n){t===void 0&&(t=J4e);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=q4e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=R9({callback:a});return a9(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function X4e(e){return n4e(e,G4e(e))}var Z4e=[];function Q4e(e){let t=(0,C.useRef)(e),n=c9(n=>e?n&&n!==Z4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:S9(e):Z4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function $4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=C9(e.target);t&&n(e=>e?(e.set(t,w9(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=C9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,w9(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{C9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>p9(e,t),b9):b4e(e):b9,[e,t])}function e3e(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==b9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?m9(e,n.current):b9}function t3e(e){(0,C.useEffect)(()=>{if(!Q7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function n3e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function r3e(e){return(0,C.useMemo)(()=>e?l4e(e):null,[e])}var i3e=[];function a3e(e,t){t===void 0&&(t=x9);let[n]=e,r=r3e(n?t9(n):null),[i,a]=(0,C.useState)(i3e);function o(){a(()=>e.length?e.map(e=>h4e(e)?r:new E9(t(e),e)):i3e)}let s=R9({callback:o});return a9(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function o3e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return r9(t)?t:e}function s3e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=R9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(r9(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=l9((0,C.useCallback)(e=>{let n=o3e(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var c3e=[{sensor:N9,options:{}},{sensor:j9,options:{}}],l3e={current:{}},z9={draggable:{measure:c4e},droppable:{measure:c4e,strategy:L9.WhileDragging,frequency:H4e.Optimized},dragOverlay:{measure:x9}},B9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},u3e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new B9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:y9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:z9,measureDroppableContainers:y9,windowRect:null,measuringScheduled:!1},d3e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:y9,draggableNodes:new Map,over:null,measureDroppableContainers:y9},V9=(0,C.createContext)(d3e),f3e=(0,C.createContext)(u3e);function p3e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new B9}}}function m3e(e,t){switch(t.type){case v9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case v9.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case v9.DragEnd:case v9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case v9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new B9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case v9.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new B9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case v9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new B9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function h3e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(V9),a=u9(r),o=u9(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!h9(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=M2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function g3e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function _3e(e){return(0,C.useMemo)(()=>({draggable:{...z9.draggable,...e?.draggable},droppable:{...z9.droppable,...e?.droppable},dragOverlay:{...z9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function v3e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;a9(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=n4e(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=f4e(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var y3e=(0,C.createContext)({...b9,scaleX:1,scaleY:1}),H9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(H9||={});var b3e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=c3e,collisionDetection:o=e4e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(m3e,void 0,p3e),[f,p]=z2e(),[m,h]=(0,C.useState)(H9.Uninitialized),g=m===H9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??l3e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=s9(l,Object.values(l)),j=f9(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=_3e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=W4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=B4e(v,_),R=(0,C.useMemo)(()=>O?g9(O):null,[O]),ee=Te(),z=K4e(L,N.draggable.measure);v3e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=Y4e(L,N.draggable.measure,z),B=Y4e(L?L.parentElement:null),V=(0,C.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),re=s3e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=X4e(oe?null:te),ce=r3e(ie?t9(ie):null),le=Q4e(g?ne??L:null),ue=a3e(le),H=g3e(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:te,containerNodeRect:B,draggingNodeRect:ae,over:V.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),de=R?p9(R,y):null,fe=$4e(le),U=e3e(fe),pe=e3e(fe,[te]),me=p9(H,U),W=ae?i4e(ae,H):null,he=w&&W?o({active:w,collisionRect:W,droppableRects:P,droppableContainers:M,pointerCoordinates:de}):null,ge=Y2e(he,`id`),[_e,ve]=(0,C.useState)(null),ye=t4e(oe?H:p9(H,pe),_e?.rect??null,te),be=(0,C.useRef)(null),xe=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ka.unstable_batchedUpdates)(()=>{r?.(i),h(H9.Initializing),d({type:v9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(be.current),k(a)})},onMove(e){d({type:v9.DragMove,coordinates:e})},onEnd:o(v9.DragEnd),onCancel:o(v9.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===v9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=v9.DragCancel)}T.current=null,(0,ka.unstable_batchedUpdates)(()=>{d({type:e}),h(H9.Uninitialized),ve(null),D(null),k(null),be.current=null;let t=e===v9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=V4e(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,xe(n,t))},[v,xe]));t3e(a),a9(()=>{te&&m===H9.Initializing&&h(H9.Initialized)},[te,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,ka.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ka.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),a9(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:W,collisions:he,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:_e,scrollableAncestors:le,scrollAdjustedTranslate:me},S.current={initial:ae,translated:W}},[w,L,he,W,v,ie,ae,P,b,_e,le,me]),L4e({...ee,delta:y,draggingRect:W,pointerCoordinates:de,scrollableAncestors:le,scrollableAncestorRects:ue});let Ce=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:he,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:_e,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,he,B,re,v,b,P,_e,F,le,ue,N,I,ce]),we=(0,C.useMemo)(()=>({activatorEvent:O,activators:Se,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:F}),[O,Se,w,te,d,j,v,_e,F]);return C.createElement(L2e.Provider,{value:p},C.createElement(V9.Provider,{value:we},C.createElement(f3e.Provider,{value:Ce},C.createElement(y3e.Provider,{value:ye},i)),C.createElement(h3e,{disabled:n?.restoreFocus===!1})),C.createElement(H2e,{...n,hiddenTextDescribedById:j}));function Te(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),x3e=(0,C.createContext)(null),S3e=`button`,C3e=`Draggable`;function w3e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=f9(C3e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(V9),{role:p=S3e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?y3e:x3e),[v,y]=l9(),[b,x]=l9(),S=n3e(o,t),w=s9(n);return a9(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===S3e?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function T3e(){return(0,C.useContext)(f3e)}var E3e=`Droppable`,D3e={timeout:25};function O3e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=f9(E3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(V9),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...D3e,...i},_=s9(h??r),v=R9({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=l9((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=s9(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:v9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:v9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:v9.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function U9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function k3e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function W9(e){return e!==null&&e>=0}function A3e(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}function j3e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var M3e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=U9(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},G9={scaleX:1,scaleY:1},N3e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...G9}:null}let s=P3e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...G9}:r<t&&r>=a?{x:0,y:o.height+s,...G9}:{x:0,y:0,...G9}};function P3e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var F3e=`Sortable`,I3e=C.createContext({activeIndex:-1,containerId:F3e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:M3e,disabled:{draggable:!1,droppable:!1}});function L3e(e){let{children:t,id:n,items:r,strategy:i=M3e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=T3e(),d=f9(F3e,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!A3e(p,_.current),y=g!==-1&&h===-1||v,b=j3e(a);a9(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:k3e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(I3e.Provider,{value:x},t)}var R3e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return U9(n,r,i).indexOf(t)},z3e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},B3e={duration:200,easing:`ease`},V3e=`transform`,H3e=_9.Transition.toString({property:V3e,duration:0,easing:`linear`}),U3e={roleDescription:`sortable`};function W3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return a9(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=x9(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)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function G3e(e){let{animateLayoutChanges:t=z3e,attributes:n,disabled:r,data:i,getNewIndex:a=R3e,id:o,strategy:s,resizeObserverConfig:c,transition:l=B3e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(I3e),y=K3e(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=O3e({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=w3e({id:o,data:x,attributes:{...U3e,...n},disabled:y.draggable}),R=T2e(D,M),ee=!!O,z=ee&&!m&&W9(f)&&W9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=W9(f)&&W9(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,re=(0,C.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),ie=u!==re.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=W3e({disabled:!ae,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ee&&re.current.newIndex!==V&&(re.current.newIndex=V),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[ee,V,d,u]),(0,C.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:x,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??B,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return H3e;if(!(te&&!h9(k)||!l)&&(ee||ae))return _9.Transition.toString({...l,property:V3e})}}function K3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function K9(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var q3e=[A9.Down,A9.Right,A9.Up,A9.Left],J3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(q3e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case A9.Down:r.top<a.top&&t.push(n);break;case A9.Up:r.top>a.top&&t.push(n);break;case A9.Left:r.left>a.left&&t.push(n);break;case A9.Right:r.left<a.left&&t.push(n);break}});let c=Q2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Y2e(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=S9(c).some((e,t)=>s[t]!==e),i=Y3e(e,t),a=X3e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:m9(u,l)}}}};function Y3e(e,t){return!K9(e)||!K9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function X3e(e,t){return!K9(e)||!K9(t)||!Y3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Z3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=G3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{wE(e.id).then(l)},[e.id]),(0,G.jsx)(hv,{ref:i,style:{transform:_9.Transform.toString(a),transition:o,opacity:s?.5:1},variant:`outlined`,sx:{cursor:`grab`,"&:active":{cursor:`grabbing`},bgcolor:s?`action.selected`:`background.paper`,width:`fit-content`},children:(0,G.jsxs)(vv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,G.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,G.jsx)(Jhe,{})}),(0,G.jsx)(Ev,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,G.jsx)(Z,{component:`img`,src:TE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(wb,{sx:{bgcolor:jE(e),width:40,height:40,boxShadow:2},children:(0,G.jsx)(AE(e),{sx:{fontSize:24}})}),(0,G.jsxs)(Z,{sx:{flex:1},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},Q3e=()=>{let{t:e}=ws(),t=qv(),{content:n,isLoading:r}=RT(),i=dhe(),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1);(0,C.useEffect)(()=>{n&&(o([...n].sort((e,t)=>(e.priority??100)-(t.priority??100))),c(!1))},[n]);let l=W2e(U2e(N9),U2e(j9,{coordinateGetter:J3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>U9(e,e.findIndex(e=>e.id===t.id),e.findIndex(e=>e.id===n.id))),c(!0))},[]),d=(0,C.useCallback)(async()=>{let n=a.map((e,t)=>({id:e.id,priority:(t+1)*10}));try{await i(n),t.show({message:e(`startup.saveSuccess`),severity:`success`}),c(!1)}catch(n){t.show({message:n instanceof Error?n.message:e(`startup.saveFailed`),severity:`error`})}},[a,i,t,e]),f=(0,C.useMemo)(()=>a.map(e=>e.id),[a]);return r?(0,G.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,G.jsxs)(Hv,{spacing:3,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:e(`startup.title`),to:J9.startup}]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsx)(uv,{color:`primary`,fontSize:`large`}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,G.jsx)(Uh,{severity:`info`,action:(0,G.jsx)(mv,{color:`inherit`,size:`small`,startIcon:(0,G.jsx)(mE,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,G.jsx)(b3e,{sensors:l,collisionDetection:Z2e,onDragEnd:u,children:(0,G.jsx)(L3e,{items:f,strategy:N3e,children:(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsx)(Z3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(mE,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},q9=`https://riddix.github.io/home-assistant-matter-hub`,J9={dashboard:`/`,bridges:`/bridges`,bridge:e=>`/bridges/${e}`,createBridge:`/bridges/create`,areaSetup:`/bridges/area-setup`,editBridge:e=>`/bridges/${e}/edit`,devices:`/devices`,standaloneDevices:`/standalone-devices`,networkMap:`/network-map`,health:`/health`,labels:`/labels`,lockCredentials:`/lock-credentials`,plugins:`/plugins`,settings:`/settings`,startup:`/startup`,githubRepository:`https://github.com/riddix/home-assistant-matter-hub/`,documentation:q9,support:`${q9}/support`,faq:{multiFabric:`${q9}/connect-multiple-fabrics`,bridgeConfig:`${q9}/bridge-configuration`}},$3e=[{path:``,element:(0,G.jsx)(Ire,{}),children:[{path:``,element:(0,G.jsx)(h_e,{})},{path:J9.bridges,element:(0,G.jsx)(l_e,{})},{path:J9.createBridge,element:(0,G.jsx)(Qqe,{})},{path:J9.areaSetup,element:(0,G.jsx)(Lae,{})},{path:J9.bridge(`:bridgeId`),element:(0,G.jsx)(Dhe,{})},{path:J9.editBridge(`:bridgeId`),element:(0,G.jsx)($qe,{})},{path:J9.devices,element:(0,G.jsx)(P_e,{})},{path:J9.standaloneDevices,element:(0,G.jsx)(w2e,{})},{path:J9.networkMap,element:(0,G.jsx)(L0e,{})},{path:J9.health,element:(0,G.jsx)(xJe,{})},{path:J9.labels,element:(0,G.jsx)(TJe,{})},{path:J9.lockCredentials,element:(0,G.jsx)(jJe,{})},{path:J9.plugins,element:(0,G.jsx)(l2e,{})},{path:J9.settings,element:(0,G.jsx)(y2e,{})},{path:J9.startup,element:(0,G.jsx)(Q3e,{})},{path:`*`,element:(0,G.jsx)(MJe,{})}]}],e6e=D_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(V_.pending,e=>{e.items.isLoading=!0}).addCase(V_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(V_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(H_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(W_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(G_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(U_.fulfilled,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.meta.arg);n!==-1&&e.items.content.splice(n,1)}}).addCase(K_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(q_,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.payload.id);n===-1?e.items.content.push(t.payload):e.items.content[n]=t.payload}})}),t6e=D_({byBridge:{}},e=>{e.addCase(UT.pending,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(UT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(UT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)})}),Y9=D_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(UT.pending,e=>{e.isLoading=!0}).addCase(UT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(UT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),n6e=lre({reducer:{bridges:e6e,devices:t6e}}),X9=Op({createStyledComponent:J(`div`,{name:`MuiContainer`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`maxWidth${Y(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>km({props:e,name:`MuiContainer`})});function r6e(e){return Jd(`MuiToolbar`,e)}Yd(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var i6e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return Cp({root:[`root`,!n&&`gutters`,r]},r6e,t)},a6e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Fm(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(`sm`)]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:`dense`},style:{minHeight:48}},{props:{variant:`regular`},style:e.mixins.toolbar}]}))),o6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o};return(0,G.jsx)(a6e,{as:i,className:K(i6e(c).root,r),ref:t,ownerState:c,...s})}),s6e=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t.componentStack)}render(){return this.state.hasError?(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(gb,{color:`error`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:Gs.t(`errorBoundary.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Gs.t(`errorBoundary.fallbackMessage`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Gs.t(`errorBoundary.reload`)})]}):this.props.children}};function c6e(e){return Jd(`MuiFab`,e)}var l6e=Yd(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),u6e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=Cp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},c6e,r);return{...r,...a}},d6e=J(Nh,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>Dm(e)||e===`classes`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,t[Y(n.size)],t[n.color]]}})(Fm(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),borderRadius:`50%`,padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:`none`},[`&.${l6e.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:`small`},style:{width:40,height:40}},{props:{size:`medium`},style:{width:48,height:48}},{props:{variant:`extended`},style:{borderRadius:48/2,padding:`0 16px`,width:`auto`,minHeight:`auto`,minWidth:48,height:48}},{props:{variant:`extended`,size:`small`},style:{width:`auto`,padding:`0 8px`,borderRadius:34/2,minWidth:34,height:34}},{props:{variant:`extended`,size:`medium`},style:{width:`auto`,padding:`0 16px`,borderRadius:40/2,minWidth:40,height:40}},{props:{color:`inherit`},style:{color:`inherit`}}]})),Fm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Um([`dark`,`contrastText`])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Fm(({theme:e})=>({[`&.${l6e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),f6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFab`}),{children:r,className:i,color:a=`default`,component:o=`button`,disabled:s=!1,disableFocusRipple:c=!1,focusVisibleClassName:l,size:u=`large`,variant:d=`circular`,...f}=n,p={...n,color:a,component:o,disabled:s,disableFocusRipple:c,size:u,variant:d},m=u6e(p);return(0,G.jsx)(d6e,{className:K(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:K(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),p6e=[{code:`en`,flag:`🇬🇧`,name:`English`},{code:`de`,flag:`🇩🇪`,name:`Deutsch`},{code:`fr`,flag:`🇫🇷`,name:`Français`},{code:`es`,flag:`🇪🇸`,name:`Español`},{code:`it`,flag:`🇮🇹`,name:`Italiano`},{code:`hu`,flag:`🇭🇺`,name:`Magyar`},{code:`zh`,flag:`🇨🇳`,name:`中文`},{code:`zh-TW`,flag:`🇹🇼`,name:`繁體中文`},{code:`ja`,flag:`🇯🇵`,name:`日本語`},{code:`th`,flag:`🇹🇭`,name:`ไทย`},{code:`sv`,flag:`🇸🇪`,name:`Svenska`},{code:`tr`,flag:`🇹🇷`,name:`Türkçe`},{code:`ru`,flag:`🇷🇺`,name:`Русский`}],m6e=`hamh-custom-languages`;function h6e(){try{let e=localStorage.getItem(m6e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var g6e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function _6e(){let{t:e,i18n:t}=ws(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...p6e,...h6e()],[]),o=t.language??`en`,s=a.some(e=>e.code===o)?o:o.split(`-`)[0]??`en`,c=(0,C.useCallback)(()=>{r(e=>!e)},[]),l=(0,C.useCallback)(e=>{t.changeLanguage(e),r(!1)},[t]);return(0,G.jsx)(Kh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,G.jsxs)(Z,{children:[(0,G.jsx)(f6e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,G.jsx)(tge,{})}),(0,G.jsx)(ab,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,G.jsx)(jb,{...t,timeout:200,children:(0,G.jsxs)(Wm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,G.jsxs)(Z,{onClick:()=>l(e.code),sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,cursor:`pointer`,bgcolor:s===e.code?`action.selected`:`transparent`,"&:hover":{bgcolor:`action.hover`},transition:`background-color 0.15s`},children:[(0,G.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,G.jsx)(Ub,{}),(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,G.jsx)(Jv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,G.jsx)(Gv,{href:g6e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var v6e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.793`,private:!1,type:`module`,bin:{"home-assistant-matter-hub":`./dist/backend/cli.js`},author:{name:`riddix`,url:`https://github.com/riddix`},keywords:[`home-assistant`,`homeassistant`,`home`,`assistant`,`apple home`,`google home`,`apple`,`google`,`alexa`,`matter`,`matter.js`,`matterjs`,`project-chip`,`smart`,`smarthome`,`smart-home`],bugs:{url:`https://github.com/riddix/home-assistant-matter-hub/issues`},license:`Apache-2.0`,repository:`github:riddix/home-assistant-matter-hub`,scripts:{cleanup:`npx rimraf node_modules dist pack LICENSE README.md`,build:`node build.js`,bundle:`pnpm pack --out package.tgz`,postbuild:`pnpm run bundle`,test:`vitest run`,prestart:`pnpm run build`,start:`dotenvx run -f ../../.env -- ./dist/backend/cli.js start`},dependencies:{"@matter/main":`0.17.3`,"@matter/nodejs":`0.17.3`,"@matter/general":`0.17.3`,"@matter/types":`0.17.3`,ajv:`8.18.0`,archiver:`7.0.1`,color:`5.0.3`,debounce:`3.0.0`,express:`5.2.1`,"express-basic-auth":`1.2.1`,"express-ip-access-control":`1.1.3`,"home-assistant-js-websocket":`9.6.0`,"lodash-es":`4.18.1`,multer:`2.2.0`,nocache:`4.0.0`,unzipper:`0.12.3`,werift:`0.22.4`,ws:`8.21.0`,yargs:`18.0.0`},devDependencies:{"@home-assistant-matter-hub/backend":`workspace:*`,"@home-assistant-matter-hub/frontend":`workspace:*`,"@home-assistant-matter-hub/common":`workspace:*`,"@types/lodash-es":`^4.17.12`},overrides:{minimatch:`9.0.7`,"path-to-regexp":`^8.4.0`,glob:`^13.0.0`},nx:{targets:{start:{cache:!1,dependsOn:[`build`]},pack:{cache:!0,dependsOn:[`build`],outputs:[`{projectRoot}/pack`]},build:{inputs:[`^default`,`default`,`{workspaceRoot}/README.md`,`{workspaceRoot}/LICENSE`],outputs:[`{projectRoot}/dist`,`{projectRoot}/README.md`,`{projectRoot}/LICENSE`]}}}};function y6e(){let e=`2.1.0-alpha.793`,[t,n]=(0,C.useState)(null);(0,C.useEffect)(()=>{fetch(`api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.version&&n(e.version)}).catch(()=>{})},[]);let r=(0,C.useMemo)(()=>t?e!==t:!1,[t]);return(0,C.useMemo)(()=>({name:v6e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var b6e=()=>{let{t:e}=ws(),t=[{name:e(`footer.github`),url:J9.githubRepository},{name:e(`footer.documentation`),url:J9.documentation},{name:e(`footer.support`),url:J9.support}];return(0,G.jsxs)(X9,{sx:{mt:16,mb:4},children:[(0,G.jsx)(Ub,{sx:{mt:4,mb:4}}),(0,G.jsx)(Fv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,G.jsx)(Fv,{size:{xs:12,sm:`auto`},children:(0,G.jsx)(mv,{fullWidth:!0,size:`small`,variant:`outlined`,component:Gv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function x6e(e){return Jd(`MuiAppBar`,e)}Yd(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var S6e=e=>{let{color:t,position:n,classes:r}=e;return Cp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},x6e,r)},C6e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,w6e=J(Wm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({display:`flex`,flexDirection:`column`,width:`100%`,boxSizing:`border-box`,flexShrink:0,variants:[{props:{position:`fixed`},style:{position:`fixed`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0,"@media print":{position:`absolute`}}},{props:{position:`absolute`},style:{position:`absolute`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`sticky`},style:{position:`sticky`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`static`},style:{position:`static`}},{props:{position:`relative`},style:{position:`relative`}},{props:{color:`inherit`},style:{"--AppBar-color":`inherit`,color:`var(--AppBar-color)`}},{props:{color:`default`},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles(`dark`,{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?C6e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?C6e(e.vars.palette.AppBar.darkColor,`var(--AppBar-color)`):null})}},{props:{color:`transparent`},style:{"--AppBar-background":`transparent`,"--AppBar-color":`inherit`,backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundImage:`none`})}}]}))),T6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a};return(0,G.jsx)(w6e,{square:!0,component:`header`,ownerState:c,elevation:4,className:K(S6e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),E6e={visibility:`hidden`};function D6e(e,t,n){let r=n&&n.getBoundingClientRect(),i=eh(t),a=t.style.transform,o=t.style.transition;t.style.transition=``,t.style.transform=``;let s=t.getBoundingClientRect(),c=i.getComputedStyle(t).getPropertyValue(`transform`);t.style.transform=a,t.style.transition=o;let l=0,u=0;if(c&&c!==`none`&&typeof c==`string`){let e=c.split(`(`)[1].split(`)`)[0].split(`,`);l=parseInt(e[4],10),u=parseInt(e[5],10)}return e===`left`?r?`translateX(${r.right+l-s.left}px)`:`translateX(${i.innerWidth+l-s.left}px)`:e===`right`?r?`translateX(-${s.right-r.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?r?`translateY(${r.bottom+u-s.top}px)`:`translateY(${i.innerHeight+u-s.top}px)`:r?`translateY(-${s.top-r.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function O6e(e){return typeof e==`function`?e():e}function Z9(e,t,n){let r=D6e(e,t,O6e(n));r&&(t.style.transform=r)}var k6e=C.forwardRef(function(e,t){let n=wm(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,direction:l=`down`,easing:u=r,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,style:v,timeout:y=i,...b}=e,x=C.useRef(null),S=ch(Wh(s),x,t),w=Jh(x,(e,t)=>{Z9(l,e,c),qh(e),f&&f(e,t)}),T=Jh(x,(e,t)=>{let r=Xh({timeout:y,style:v,easing:u},{mode:`enter`});e.style.transition=n.transitions.create(`transform`,r),e.style.transform=`none`,m&&m(e,t)}),E=Jh(x,p),D=Jh(x,_),O=Jh(x,e=>{let t=Xh({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Z9(l,e,c),h&&h(e)}),k=Jh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Z9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Ym(()=>{x.current&&Z9(l,x.current,c)}),t=eh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,G.jsx)(wh,{nodeRef:x,onEnter:w,onEntered:E,onEntering:T,onExit:O,onExited:k,onExiting:D,addEndListener:A,appear:o,in:d,timeout:y,...b,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!d?v||s.props.style?{visibility:`hidden`,...v,...s.props.style}:E6e:v&&s.props.style?{...v,...s.props.style}:v||s.props.style,C.cloneElement(s,{ref:S,style:r,...n})}})});function A6e(e){return Jd(`MuiDrawer`,e)}Yd(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var j6e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},M6e=e=>{let{classes:t,anchor:n,variant:r}=e;return Cp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},A6e,t)},N6e=J(Fb,{name:`MuiDrawer`,slot:`Root`,overridesResolver:j6e})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),P6e=J(`div`,{shouldForwardProp:Dm,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:j6e})({flex:`0 0 auto`}),F6e=J(Wm,{name:`MuiDrawer`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${Y(n.anchor)}`],n.variant!==`temporary`&&t[`paperAnchorDocked${Y(n.anchor)}`]]}})(Fm(({theme:e})=>({overflowY:`auto`,display:`flex`,flexDirection:`column`,height:`100%`,flex:`1 0 auto`,zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:`touch`,position:`fixed`,top:0,outline:0,variants:[{props:{anchor:`left`},style:{left:0}},{props:{anchor:`top`},style:{top:0,left:0,right:0,height:`auto`,maxHeight:`100%`}},{props:{anchor:`right`},style:{right:0}},{props:{anchor:`bottom`},style:{top:`auto`,left:0,bottom:0,right:0,height:`auto`,maxHeight:`100%`}},{props:({ownerState:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),I6e={left:`right`,right:`left`,top:`down`,bottom:`up`};function L6e(e){return[`left`,`right`].includes(e)}function R6e({direction:e},t){return e===`rtl`&&L6e(t)?I6e[t]:t}var z6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiDrawer`}),r=wm(),i=Uf(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,BackdropProps:s,children:c,className:l,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:f,...p}={},onClose:m,open:h=!1,PaperProps:g={},SlideProps:_,TransitionComponent:v,transitionDuration:y=a,variant:b=`temporary`,slots:x={},slotProps:S={},...w}=n,T=C.useRef(!1);C.useEffect(()=>{T.current=!0},[]);let E=R6e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=M6e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:lh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Hm(`root`,{ref:t,elementType:N6e,className:K(k.root,k.modal,l),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...A,...w,...p},additionalProps:{open:h,onClose:m,hideBackdrop:d,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[N,P]=Hm(`paper`,{elementType:F6e,shouldForwardComponentProp:!0,className:K(k.paper,g.className),ownerState:O,externalForwardedProps:A,additionalProps:{elevation:b===`temporary`?u:0,square:!0,...b===`temporary`&&{role:`dialog`,"aria-modal":`true`}}}),[F,I]=Hm(`docked`,{elementType:P6e,ref:t,className:K(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Hm(`transition`,{elementType:k6e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:I6e[E],timeout:y,appear:T.current}}),ee=(0,G.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,G.jsx)(F,{...I,children:ee});let z=(0,G.jsx)(L,{...R,children:ee});return b===`persistent`?(0,G.jsx)(F,{...I,children:z}):(0,G.jsx)(j,{...M,children:z})}),B6e=_f({themeId:Cm}),V6e={error:Cx,warn:Yv,info:vb,debug:XT},H6e=({open:e,onClose:t})=>{let{t:n}=ws(),r=wm(),i=(0,C.useMemo)(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(`error,warn,info`.split(`,`)),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(!0),h=(0,C.useCallback)(async()=>{try{let e=new URLSearchParams({level:l.join(`,`),limit:`500`,...d&&{search:d}}),t=await fetch(`api/logs?${e}`);t.ok&&o((await t.json()).entries)}catch(e){console.error(`Failed to fetch logs:`,e)}finally{c(!1)}},[l,d]);(0,C.useEffect)(()=>{e&&h()},[e,h]),(0,C.useEffect)(()=>{if(!p||!e)return;let t=setInterval(h,5e3);return()=>clearInterval(t)},[p,e,h]);let g=e=>{u(Array.isArray(e.target.value)?e.target.value:[e.target.value])},_=e=>{f(e.target.value)},v=async()=>{try{await fetch(`api/logs`,{method:`DELETE`}),o([])}catch(e){console.error(`Failed to clear logs:`,e)}},y=e=>(0,G.jsx)(V6e[e]||vb,{sx:{fontSize:16,color:i[e]}});return(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,G.jsxs)(Vb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(XT,{}),n(`logs.title`),(0,G.jsx)(Z,{sx:{flexGrow:1}}),(0,G.jsx)(db,{title:n(`logs.autoRefresh`),children:(0,G.jsx)(Ev,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,G.jsx)(Bh,{onClick:t,children:(0,G.jsx)(QT,{})})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Hv,{spacing:2,sx:{mb:2},children:(0,G.jsxs)(Hv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:n(`logs.logLevel`)}),(0,G.jsxs)(SS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,G.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,G.jsx)(Ev,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,G.jsx)(CS,{value:`error`,children:n(`logs.error`)}),(0,G.jsx)(CS,{value:`warn`,children:n(`logs.warning`)}),(0,G.jsx)(CS,{value:`info`,children:n(`logs.info`)}),(0,G.jsx)(CS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,G.jsx)(ES,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,G.jsx)(mv,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,G.jsx)(mv,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,G.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,G.jsx)(Ev,{label:e.level.toUpperCase(),size:`small`,sx:{backgroundColor:i[e.level],color:r.palette.getContrastText(i[e.level]??r.palette.grey[500]),fontSize:`0.7rem`,height:20}})]}),(0,G.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,G.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,G.jsx)(zb,{children:(0,G.jsx)(mv,{onClick:t,children:n(`common.close`)})})]})};function Q9(){let{t:e}=ws(),{isConnected:t}=Z_(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`api/health`);e.ok?(r(await e.json()),a(!1)):a(!0)}catch{a(!0)}};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let o=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`},s=n?.status===`healthy`&&!i,c=n?.services?.bridges,l=c&&c.total>0&&c.running===c.total,u=c&&c.total===0,d=n?(0,G.jsxs)(Z,{sx:{p:.5},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`nav.bridges`),`:`]}),` `,n.services.bridges.running??0,`/`,n.services.bridges.total??0,` `,e(`common.running`).toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e(`common.stopped`).toLowerCase()})`]}),n.services?.homeAssistant&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,G.jsx)(db,{title:d,arrow:!0,children:(0,G.jsx)(Ev,{icon:i||!s?(0,G.jsx)(Cx,{fontSize:`small`}):l?(0,G.jsx)(lv,{fontSize:`small`}):(0,G.jsx)(xb,{fontSize:`small`}),label:e(i?`status.error`:s?t?u?`status.noBridges`:l?`common.online`:`common.starting`:`common.offline`:`status.unhealthy`),color:i||!s?`error`:!l||!t?`warning`:`success`,size:`small`,variant:`filled`,sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:`inherit`}}})})}var U6e=e=>(0,G.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsxs)(`g`,{style:{display:`inline`},children:[(0,G.jsx)(`path`,{style:{fill:`#18bcf2`,fillOpacity:1,strokeWidth:.266194},d:`m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z`}),(0,G.jsx)(`path`,{style:{fill:`#ffffff`,fillOpacity:1,strokeWidth:.175841},d:`m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z`})]})}),W6e=e=>{let t=y6e();return(0,G.jsxs)(Z,{component:ua,to:J9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,G.jsx)(U6e,{style:{height:`40px`}}),(0,G.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,G.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},G6e=()=>{let e=B6e(`(min-width:600px)`),{mode:t,setMode:n}=Pm(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Nr(),c=Ar(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=ws(),f=[{label:d(`dashboard.title`),icon:(0,G.jsx)(rE,{}),to:J9.dashboard},{label:d(`nav.bridges`),icon:(0,G.jsx)(iE,{}),to:J9.bridges},{label:d(`nav.devices`),icon:(0,G.jsx)(mb,{}),to:J9.devices},{label:d(`nav.standaloneDevices`,`Standalone Devices`),icon:(0,G.jsx)(dge,{}),to:J9.standaloneDevices},{label:d(`nav.networkMap`),icon:(0,G.jsx)(GT,{}),to:J9.networkMap},{label:d(`nav.startupOrder`),icon:(0,G.jsx)(uv,{}),to:J9.startup},{label:d(`nav.lockCredentials`),icon:(0,G.jsx)(ET,{}),to:J9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,G.jsx)(aE,{}),to:J9.labels},{label:`Plugins`,icon:(0,G.jsx)(tE,{}),to:J9.plugins},{label:d(`nav.settings`),icon:(0,G.jsx)(FT,{}),to:J9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,G.jsx)(ige,{}):(0,G.jsx)(Ghe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,G.jsx)(XT,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,G.jsx)(kx,{}),to:J9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,G.jsxs)(Z,{children:[(0,G.jsx)(T6e,{sx:{height:`72px`},children:(0,G.jsx)(o6e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,G.jsxs)(X9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(W6e,{large:e}),e?(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{component:ua,to:e.to,sx:{color:`inherit`,bgcolor:l(e.to)?`rgba(255,255,255,0.15)`:`transparent`,borderRadius:1},children:e.icon})},e.label):(0,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,G.jsx)(Q9,{})]}):(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,G.jsx)(Q9,{}),(0,G.jsx)(Bh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,G.jsx)(age,{})})]})]})})}),(0,G.jsx)(z6e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,G.jsx)($v,{sx:{width:250},children:f.map(e=>(0,G.jsxs)(eoe,{selected:l(e.to),onClick:()=>p(e),children:[(0,G.jsx)(iy,{children:e.icon}),(0,G.jsx)(oy,{primary:e.label})]},e.label))})}),(0,G.jsx)(H6e,{open:r,onClose:()=>i(!1)})]})},K6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=y6e(),{isConnected:r}=Z_();return(0,G.jsxs)(Z,{children:[(0,G.jsx)(G6e,{}),(0,G.jsx)(o6e,{}),e&&(0,G.jsxs)(Uh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,G.jsx)(mv,{color:`inherit`,size:`small`,onClick:()=>window.location.reload(),children:`Reload`}),children:[`Version mismatch: frontend `,t,`, backend `,n,`. Please reload to get the latest UI.`]}),!r&&(0,G.jsx)(Uh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,G.jsx)(X9,{sx:{p:2},children:(0,G.jsx)(s6e,{children:(0,G.jsx)(_i,{})})}),(0,G.jsx)(b6e,{}),(0,G.jsx)(_6e,{})]})},q6e=xm({colorSchemes:{light:{palette:{primary:{main:`#1976d2`,light:`#42a5f5`,dark:`#1565c0`},secondary:{main:`#9c27b0`,light:`#ba68c8`,dark:`#7b1fa2`},background:{default:`#f5f5f5`,paper:`#ffffff`}}},dark:{palette:{primary:{main:`#90caf9`,light:`#e3f2fd`,dark:`#42a5f5`},secondary:{main:`#ce93d8`,light:`#f3e5f5`,dark:`#ab47bc`},background:{default:`#121212`,paper:`#1e1e1e`}}}},typography:{fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,"&:hover":{transform:`translateY(-2px)`,boxShadow:`0 4px 20px rgba(0,0,0,0.12)`}}}},MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:`none`}}}}}),$9=document.getElementsByTagName(`base`)[0]?.href?.replace(/\/$/,``);$9?.startsWith(`http`)&&($9=new URL($9).pathname);var J6e=oa([{path:`/`,element:(0,G.jsx)(K6e,{}),children:$3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(C.StrictMode,{children:(0,G.jsx)(L,{store:n6e,children:(0,G.jsxs)(ite,{theme:q6e,children:[(0,G.jsx)(Qee,{}),(0,G.jsx)(Tm,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:`initial !important`,flexGrow:1}}}),(0,G.jsx)(Fre,{children:(0,G.jsx)(xne,{children:(0,G.jsx)(Aa,{router:J6e})})})]})})}));
|
|
469
|
+
`},V2e={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 H2e(e){let{announcements:t=V2e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=B2e}=e,{announce:a,announcement:o}=I2e(),s=f9(`DndLiveRegion`),[c,l]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{l(!0)},[]),R2e((0,C.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=C.createElement(C.Fragment,null,C.createElement(P2e,{id:r,value:i.draggable}),C.createElement(F2e,{id:s,announcement:o}));return n?(0,ka.createPortal)(u,n):u}var v9;(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`})(v9||={});function y9(){}function U2e(e,t){return(0,C.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function W2e(){var e=[...arguments];return(0,C.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var b9=Object.freeze({x:0,y:0});function G2e(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function K2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function q2e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function J2e(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Y2e(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function X2e(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Z2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=X2e(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=G2e(X2e(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(K2e)},Q2e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=J2e(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=J2e(r),o=i.reduce((e,t,r)=>e+G2e(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(K2e)};function $2e(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var e4e=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=$2e(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(q2e)};function t4e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function n4e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:b9}function r4e(e){return function(t){return[...arguments].slice(1).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})}}var i4e=r4e(1);function a4e(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function o4e(e,t,n){let r=a4e(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var s4e={ignoreTransform:!1};function x9(e,t){t===void 0&&(t=s4e);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=t9(e).getComputedStyle(e);t&&(n=o4e(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function c4e(e){return x9(e,{ignoreTransform:!0})}function l4e(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function u4e(e,t){return t===void 0&&(t=t9(e).getComputedStyle(e)),t.position===`fixed`}function d4e(e,t){t===void 0&&(t=t9(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function S9(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(n9(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!r9(i)||E2e(i)||n.includes(i))return n;let a=t9(e).getComputedStyle(i);return i!==e&&d4e(i,a)&&n.push(i),u4e(i,a)?n:r(i.parentNode)}return e?r(e):n}function f4e(e){let[t]=S9(e,1);return t??null}function C9(e){return!Q7||!e?null:$7(e)?e:e9(e)?n9(e)||e===i9(e).scrollingElement?window:r9(e)?e:null:null}function p4e(e){return $7(e)?e.scrollX:e.scrollLeft}function m4e(e){return $7(e)?e.scrollY:e.scrollTop}function w9(e){return{x:p4e(e),y:m4e(e)}}var T9;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(T9||={});function h4e(e){return!Q7||!e?!1:e===document.scrollingElement}function g4e(e){let t={x:0,y:0},n=h4e(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}}var _4e={x:.2,y:.2};function v4e(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=_4e);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=g4e(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=T9.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=T9.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=T9.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=T9.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function y4e(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function b4e(e){return e.reduce((e,t)=>p9(e,w9(t)),b9)}function x4e(e){return e.reduce((e,t)=>e+p4e(t),0)}function S4e(e){return e.reduce((e,t)=>e+m4e(t),0)}function C4e(e,t){if(t===void 0&&(t=x9),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);f4e(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var w4e=[[`x`,[`left`,`right`],x4e],[`y`,[`top`,`bottom`],S4e]],E9=class{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;let n=S9(t),r=b4e(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of w4e)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},D9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function T4e(e){let{EventTarget:t}=t9(e);return e instanceof t?e:i9(e)}function O9(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?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:!1}var k9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(k9||={});function E4e(e){e.preventDefault()}function D4e(e){e.stopPropagation()}var A9;(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`})(A9||={});var O4e={start:[A9.Space,A9.Enter],cancel:[A9.Esc],end:[A9.Space,A9.Enter,A9.Tab]},k4e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case A9.Right:return{...n,x:n.x+25};case A9.Left:return{...n,x:n.x-25};case A9.Down:return{...n,y:n.y+25};case A9.Up:return{...n,y:n.y-25}}},j9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new D9(i9(t)),this.windowListeners=new D9(t9(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(k9.Resize,this.handleCancel),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(k9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&C4e(n),t(b9)}handleKeyDown(e){if(h9(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=O4e,coordinateGetter:a=k4e,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:b9;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=m9(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=g4e(n),p=y4e(n),m={x:Math.min(i===A9.Right?p.right-p.width/2:p.right,Math.max(i===A9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===A9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===A9.Down?p.top:p.top+p.height/2,u.y))},h=i===A9.Right&&!s||i===A9.Left&&!c,g=i===A9.Down&&!l||i===A9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===A9.Right&&e<=d.x||i===A9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===A9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===A9.Down&&e<=d.y||i===A9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===A9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,p9(m9(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};j9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=O4e,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function A4e(e){return!!(e&&`distance`in e)}function j4e(e){return!!(e&&`delay`in e)}var M9=class{constructor(e,t,n){n===void 0&&(n=T4e(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;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=i9(i),this.documentListeners=new D9(this.document),this.listeners=new D9(n),this.windowListeners=new D9(t9(i)),this.initialCoordinates=g9(r)??b9,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(){let{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(k9.Resize,this.handleCancel),this.windowListeners.add(k9.DragStart,E4e),this.windowListeners.add(k9.VisibilityChange,this.handleCancel),this.windowListeners.add(k9.ContextMenu,E4e),this.documentListeners.add(k9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(j4e(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(A4e(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(k9.Click,D4e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(k9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=g9(e)??b9,s=m9(n,o);if(!t&&a){if(A4e(a)){if(a.tolerance!=null&&O9(s,a.tolerance))return this.handleCancel();if(O9(s,a.distance))return this.handleStart()}if(j4e(a)&&O9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===A9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},M4e={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},N9=class extends M9{constructor(e){let{event:t}=e,n=i9(t.target);super(e,M4e,n)}};N9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var N4e={move:{name:`mousemove`},end:{name:`mouseup`}},P4e;(function(e){e[e.RightClick=2]=`RightClick`})(P4e||={});var F4e=class extends M9{constructor(e){super(e,N4e,i9(e.event.target))}};F4e.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===P4e.RightClick?!1:(r?.({event:n}),!0)}}];var P9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},I4e=class extends M9{constructor(e){super(e,P9)}static setup(){return window.addEventListener(P9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(P9.move.name,e)};function e(){}}};I4e.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var F9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(F9||={});var I9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(I9||={});function L4e(e){let{acceleration:t,activator:n=F9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=I9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=z4e({delta:d,disabled:!a}),[m,h]=D2e(),g=(0,C.useRef)({x:0,y:0}),_=(0,C.useRef)({x:0,y:0}),v=(0,C.useMemo)(()=>{switch(n){case F9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case F9.DraggableRect:return i}},[n,i,c]),y=(0,C.useRef)(null),b=(0,C.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,C.useMemo)(()=>s===I9.TreeOrder?[...l].reverse():l,[s,l]);(0,C.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=v4e(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var R4e={x:{[T9.Backward]:!1,[T9.Forward]:!1},y:{[T9.Backward]:!1,[T9.Forward]:!1}};function z4e(e){let{delta:t,disabled:n}=e,r=u9(t);return c9(e=>{if(n||!r||!e)return R4e;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[T9.Backward]:e.x[T9.Backward]||i.x===-1,[T9.Forward]:e.x[T9.Forward]||i.x===1},y:{[T9.Backward]:e.y[T9.Backward]||i.y===-1,[T9.Forward]:e.y[T9.Forward]||i.y===1}}},[n,t,r])}function B4e(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return c9(e=>t==null?null:r??e??null,[r,t])}function V4e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var L9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(L9||={});var H4e;(function(e){e.Optimized=`optimized`})(H4e||={});var U4e=new Map;function W4e(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,C.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,C.useRef)(e),d=g(),f=s9(d),p=(0,C.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,C.useRef)(null),h=c9(t=>{if(d&&!n)return U4e;if(!t||t===U4e||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new E9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,C.useEffect)(()=>{u.current=e},[e]),(0,C.useEffect)(()=>{d||p()},[n,d]),(0,C.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,C.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case L9.Always:return!1;case L9.BeforeDragging:return n;default:return!n}}}function G4e(e,t){return c9(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function K4e(e,t){return G4e(e,t)}function q4e(e){let{callback:t,disabled:n}=e,r=o9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function R9(e){let{callback:t,disabled:n}=e,r=o9(t),i=(0,C.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,C.useEffect)(()=>()=>i?.disconnect(),[i]),i}function J4e(e){return new E9(x9(e),e)}function Y4e(e,t,n){t===void 0&&(t=J4e);let[r,i]=(0,C.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=q4e({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=R9({callback:a});return a9(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function X4e(e){return n4e(e,G4e(e))}var Z4e=[];function Q4e(e){let t=(0,C.useRef)(e),n=c9(n=>e?n&&n!==Z4e&&e&&t.current&&e.parentNode===t.current.parentNode?n:S9(e):Z4e,[e]);return(0,C.useEffect)(()=>{t.current=e},[e]),n}function $4e(e){let[t,n]=(0,C.useState)(null),r=(0,C.useRef)(e),i=(0,C.useCallback)(e=>{let t=C9(e.target);t&&n(e=>e?(e.set(t,w9(t)),new Map(e)):null)},[]);return(0,C.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=C9(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,w9(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{C9(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,C.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>p9(e,t),b9):b4e(e):b9,[e,t])}function e3e(e,t){t===void 0&&(t=[]);let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{n.current=null},t),(0,C.useEffect)(()=>{let t=e!==b9;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?m9(e,n.current):b9}function t3e(e){(0,C.useEffect)(()=>{if(!Q7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function n3e(e,t){return(0,C.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function r3e(e){return(0,C.useMemo)(()=>e?l4e(e):null,[e])}var i3e=[];function a3e(e,t){t===void 0&&(t=x9);let[n]=e,r=r3e(n?t9(n):null),[i,a]=(0,C.useState)(i3e);function o(){a(()=>e.length?e.map(e=>h4e(e)?r:new E9(t(e),e)):i3e)}let s=R9({callback:o});return a9(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function o3e(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return r9(t)?t:e}function s3e(e){let{measure:t}=e,[n,r]=(0,C.useState)(null),i=R9({callback:(0,C.useCallback)(e=>{for(let{target:n}of e)if(r9(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=l9((0,C.useCallback)(e=>{let n=o3e(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,C.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var c3e=[{sensor:N9,options:{}},{sensor:j9,options:{}}],l3e={current:{}},z9={draggable:{measure:c4e},droppable:{measure:c4e,strategy:L9.WhileDragging,frequency:H4e.Optimized},dragOverlay:{measure:x9}},B9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},u3e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new B9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:y9},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:z9,measureDroppableContainers:y9,windowRect:null,measuringScheduled:!1},d3e={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:y9,draggableNodes:new Map,over:null,measureDroppableContainers:y9},V9=(0,C.createContext)(d3e),f3e=(0,C.createContext)(u3e);function p3e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new B9}}}function m3e(e,t){switch(t.type){case v9.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case v9.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case v9.DragEnd:case v9.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case v9.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new B9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case v9.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new B9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case v9.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new B9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function h3e(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,C.useContext)(V9),a=u9(r),o=u9(n?.id);return(0,C.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!h9(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=M2e(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function g3e(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function _3e(e){return(0,C.useMemo)(()=>({draggable:{...z9.draggable,...e?.draggable},droppable:{...z9.droppable,...e?.droppable},dragOverlay:{...z9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function v3e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,C.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;a9(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=n4e(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=f4e(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var y3e=(0,C.createContext)({...b9,scaleX:1,scaleY:1}),H9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(H9||={});var b3e=(0,C.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=c3e,collisionDetection:o=e4e,measuring:s,modifiers:c,...l}=e,[u,d]=(0,C.useReducer)(m3e,void 0,p3e),[f,p]=z2e(),[m,h]=(0,C.useState)(H9.Uninitialized),g=m===H9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,C.useRef)({initial:null,translated:null}),w=(0,C.useMemo)(()=>_==null?null:{id:_,data:x?.data??l3e,rect:S},[_,x]),T=(0,C.useRef)(null),[E,D]=(0,C.useState)(null),[O,k]=(0,C.useState)(null),A=s9(l,Object.values(l)),j=f9(`DndDescribedBy`,t),M=(0,C.useMemo)(()=>b.getEnabled(),[b]),N=_3e(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=W4e(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=B4e(v,_),R=(0,C.useMemo)(()=>O?g9(O):null,[O]),ee=Te(),z=K4e(L,N.draggable.measure);v3e({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let te=Y4e(L,N.draggable.measure,z),B=Y4e(L?L.parentElement:null),V=(0,C.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),re=s3e({measure:N.dragOverlay.measure}),ie=re.nodeRef.current??L,ae=g?re.rect??te:null,oe=!!(re.nodeRef.current&&re.rect),se=X4e(oe?null:te),ce=r3e(ie?t9(ie):null),le=Q4e(g?ne??L:null),ue=a3e(le),H=g3e(c,{transform:{x:y.x-se.x,y:y.y-se.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:te,containerNodeRect:B,draggingNodeRect:ae,over:V.current.over,overlayNodeRect:re.rect,scrollableAncestors:le,scrollableAncestorRects:ue,windowRect:ce}),de=R?p9(R,y):null,fe=$4e(le),U=e3e(fe),pe=e3e(fe,[te]),me=p9(H,U),W=ae?i4e(ae,H):null,he=w&&W?o({active:w,collisionRect:W,droppableRects:P,droppableContainers:M,pointerCoordinates:de}):null,ge=Y2e(he,`id`),[_e,ve]=(0,C.useState)(null),ye=t4e(oe?H:p9(H,pe),_e?.rect??null,te),be=(0,C.useRef)(null),xe=(0,C.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ka.unstable_batchedUpdates)(()=>{r?.(i),h(H9.Initializing),d({type:v9.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(be.current),k(a)})},onMove(e){d({type:v9.DragMove,coordinates:e})},onEnd:o(v9.DragEnd),onCancel:o(v9.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===v9.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=v9.DragCancel)}T.current=null,(0,ka.unstable_batchedUpdates)(()=>{d({type:e}),h(H9.Uninitialized),ve(null),D(null),k(null),be.current=null;let t=e===v9.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=V4e(a,(0,C.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,xe(n,t))},[v,xe]));t3e(a),a9(()=>{te&&m===H9.Initializing&&h(H9.Initialized)},[te,m]),(0,C.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,ka.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,C.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ka.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),a9(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:W,collisions:he,droppableRects:P,draggableNodes:v,draggingNode:ie,draggingNodeRect:ae,droppableContainers:b,over:_e,scrollableAncestors:le,scrollAdjustedTranslate:me},S.current={initial:ae,translated:W}},[w,L,he,W,v,ie,ae,P,b,_e,le,me]),L4e({...ee,delta:y,draggingRect:W,pointerCoordinates:de,scrollableAncestors:le,scrollableAncestorRects:ue});let Ce=(0,C.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:te,activatorEvent:O,collisions:he,containerNodeRect:B,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:P,over:_e,measureDroppableContainers:F,scrollableAncestors:le,scrollableAncestorRects:ue,measuringConfiguration:N,measuringScheduled:I,windowRect:ce}),[w,L,te,O,he,B,re,v,b,P,_e,F,le,ue,N,I,ce]),we=(0,C.useMemo)(()=>({activatorEvent:O,activators:Se,active:w,activeNodeRect:te,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:_e,measureDroppableContainers:F}),[O,Se,w,te,d,j,v,_e,F]);return C.createElement(L2e.Provider,{value:p},C.createElement(V9.Provider,{value:we},C.createElement(f3e.Provider,{value:Ce},C.createElement(y3e.Provider,{value:ye},i)),C.createElement(h3e,{disabled:n?.restoreFocus===!1})),C.createElement(H2e,{...n,hiddenTextDescribedById:j}));function Te(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),x3e=(0,C.createContext)(null),S3e=`button`,C3e=`Draggable`;function w3e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=f9(C3e),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,C.useContext)(V9),{role:p=S3e,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,C.useContext)(g?y3e:x3e),[v,y]=l9(),[b,x]=l9(),S=n3e(o,t),w=s9(n);return a9(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,C.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===S3e?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function T3e(){return(0,C.useContext)(f3e)}var E3e=`Droppable`,D3e={timeout:25};function O3e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=f9(E3e),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,C.useContext)(V9),u=(0,C.useRef)({disabled:n}),d=(0,C.useRef)(!1),f=(0,C.useRef)(null),p=(0,C.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...D3e,...i},_=s9(h??r),v=R9({callback:(0,C.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=l9((0,C.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=s9(t);return(0,C.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,C.useEffect)(()=>(s({type:v9.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:v9.UnregisterDroppable,key:a,id:r})),[r]),(0,C.useEffect)(()=>{n!==u.current.disabled&&(s({type:v9.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function U9(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function k3e(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function W9(e){return e!==null&&e>=0}function A3e(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}function j3e(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var M3e=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=U9(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},G9={scaleX:1,scaleY:1},N3e=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...G9}:null}let s=P3e(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...G9}:r<t&&r>=a?{x:0,y:o.height+s,...G9}:{x:0,y:0,...G9}};function P3e(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var F3e=`Sortable`,I3e=C.createContext({activeIndex:-1,containerId:F3e,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:M3e,disabled:{draggable:!1,droppable:!1}});function L3e(e){let{children:t,id:n,items:r,strategy:i=M3e,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=T3e(),d=f9(F3e,n),f=s.rect!==null,p=(0,C.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,C.useRef)(p),v=!A3e(p,_.current),y=g!==-1&&h===-1||v,b=j3e(a);a9(()=>{v&&m&&u(p)},[v,p,m,u]),(0,C.useEffect)(()=>{_.current=p},[p]);let x=(0,C.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:k3e(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return C.createElement(I3e.Provider,{value:x},t)}var R3e=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return U9(n,r,i).indexOf(t)},z3e=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},B3e={duration:200,easing:`ease`},V3e=`transform`,H3e=_9.Transition.toString({property:V3e,duration:0,easing:`linear`}),U3e={roleDescription:`sortable`};function W3e(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,C.useState)(null),s=(0,C.useRef)(n);return a9(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=x9(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)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,C.useEffect)(()=>{a&&o(null)},[a]),a}function G3e(e){let{animateLayoutChanges:t=z3e,attributes:n,disabled:r,data:i,getNewIndex:a=R3e,id:o,strategy:s,resizeObserverConfig:c,transition:l=B3e}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,C.useContext)(I3e),y=K3e(r,p),b=u.indexOf(o),x=(0,C.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,C.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=O3e({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=w3e({id:o,data:x,attributes:{...U3e,...n},disabled:y.draggable}),R=T2e(D,M),ee=!!O,z=ee&&!m&&W9(f)&&W9(g),te=!_&&P,B=z?(te&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=W9(f)&&W9(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,re=(0,C.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),ie=u!==re.current.items,ae=t({active:O,containerId:d,isDragging:P,isSorting:ee,id:o,index:b,items:u,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:l,wasDragging:re.current.activeId!=null}),oe=W3e({disabled:!ae,index:b,node:T,rect:w});return(0,C.useEffect)(()=>{ee&&re.current.newIndex!==V&&(re.current.newIndex=V),d!==re.current.containerId&&(re.current.containerId=d),u!==re.current.items&&(re.current.items=u)},[ee,V,d,u]),(0,C.useEffect)(()=>{if(ne===re.current.activeId)return;if(ne!=null&&re.current.activeId==null){re.current.activeId=ne;return}let e=setTimeout(()=>{re.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:x,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:ee,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:oe??B,transition:se()};function se(){if(oe||ie&&re.current.newIndex===b)return H3e;if(!(te&&!h9(k)||!l)&&(ee||ae))return _9.Transition.toString({...l,property:V3e})}}function K3e(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function K9(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var q3e=[A9.Down,A9.Right,A9.Up,A9.Left],J3e=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(q3e.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case A9.Down:r.top<a.top&&t.push(n);break;case A9.Up:r.top>a.top&&t.push(n);break;case A9.Left:r.left>a.left&&t.push(n);break;case A9.Right:r.left<a.left&&t.push(n);break}});let c=Q2e({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Y2e(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=S9(c).some((e,t)=>s[t]!==e),i=Y3e(e,t),a=X3e(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:m9(u,l)}}}};function Y3e(e,t){return!K9(e)||!K9(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function X3e(e,t){return!K9(e)||!K9(t)||!Y3e(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Z3e=({bridge:e,index:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=G3e({id:e.id}),[c,l]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{wE(e.id).then(l)},[e.id]),(0,G.jsx)(hv,{ref:i,style:{transform:_9.Transform.toString(a),transition:o,opacity:s?.5:1},variant:`outlined`,sx:{cursor:`grab`,"&:active":{cursor:`grabbing`},bgcolor:s?`action.selected`:`background.paper`,width:`fit-content`},children:(0,G.jsxs)(vv,{sx:{display:`flex`,alignItems:`center`,gap:1.5,py:1,"&:last-child":{pb:1}},children:[(0,G.jsx)(Z,{...n,...r,sx:{display:`flex`,alignItems:`center`,color:`text.secondary`},children:(0,G.jsx)(Jhe,{})}),(0,G.jsx)(Ev,{label:t+1,size:`small`,color:`primary`,sx:{minWidth:32,fontWeight:`bold`}}),c?(0,G.jsx)(Z,{component:`img`,src:TE(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:`50%`,objectFit:`cover`,boxShadow:2}}):(0,G.jsx)(wb,{sx:{bgcolor:jE(e),width:40,height:40,boxShadow:2},children:(0,G.jsx)(AE(e),{sx:{fontSize:24}})}),(0,G.jsxs)(Z,{sx:{flex:1},children:[(0,G.jsx)(Q,{variant:`subtitle1`,fontWeight:500,children:e.name}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,children:[`Port: `,e.port,` • Priority: `,e.priority??100]})]})]})})},Q3e=()=>{let{t:e}=ws(),t=qv(),{content:n,isLoading:r}=RT(),i=dhe(),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!1);(0,C.useEffect)(()=>{n&&(o([...n].sort((e,t)=>(e.priority??100)-(t.priority??100))),c(!1))},[n]);let l=W2e(U2e(N9),U2e(j9,{coordinateGetter:J3e})),u=(0,C.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&(o(e=>U9(e,e.findIndex(e=>e.id===t.id),e.findIndex(e=>e.id===n.id))),c(!0))},[]),d=(0,C.useCallback)(async()=>{let n=a.map((e,t)=>({id:e.id,priority:(t+1)*10}));try{await i(n),t.show({message:e(`startup.saveSuccess`),severity:`success`}),c(!1)}catch(n){t.show({message:n instanceof Error?n.message:e(`startup.saveFailed`),severity:`error`})}},[a,i,t,e]),f=(0,C.useMemo)(()=>a.map(e=>e.id),[a]);return r?(0,G.jsxs)(Q,{children:[e(`common.loading`),`...`]}):(0,G.jsxs)(Hv,{spacing:3,children:[(0,G.jsx)(Kv,{items:[{name:e(`nav.bridges`),to:J9.bridges},{name:e(`startup.title`),to:J9.startup}]}),(0,G.jsxs)(Z,{display:`flex`,alignItems:`center`,gap:2,children:[(0,G.jsx)(uv,{color:`primary`,fontSize:`large`}),(0,G.jsxs)(Z,{children:[(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:e(`startup.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,children:e(`startup.description`)})]})]}),s&&(0,G.jsx)(Uh,{severity:`info`,action:(0,G.jsx)(mv,{color:`inherit`,size:`small`,startIcon:(0,G.jsx)(mE,{}),onClick:d,children:e(`startup.saveChanges`)}),children:e(`startup.unsavedChanges`)}),(0,G.jsx)(b3e,{sensors:l,collisionDetection:Z2e,onDragEnd:u,children:(0,G.jsx)(L3e,{items:f,strategy:N3e,children:(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsx)(Z3e,{bridge:e,index:t},e.id))})})}),a.length===0&&(0,G.jsx)(Q,{color:`text.secondary`,textAlign:`center`,py:4,children:e(`startup.noBridges`)}),s&&a.length>0&&(0,G.jsx)(Z,{display:`flex`,justifyContent:`flex-end`,children:(0,G.jsx)(mv,{variant:`contained`,startIcon:(0,G.jsx)(mE,{}),onClick:d,children:e(`startup.saveOrder`)})})]})},q9=`https://riddix.github.io/home-assistant-matter-hub`,J9={dashboard:`/`,bridges:`/bridges`,bridge:e=>`/bridges/${e}`,createBridge:`/bridges/create`,areaSetup:`/bridges/area-setup`,editBridge:e=>`/bridges/${e}/edit`,devices:`/devices`,standaloneDevices:`/standalone-devices`,networkMap:`/network-map`,health:`/health`,labels:`/labels`,lockCredentials:`/lock-credentials`,plugins:`/plugins`,settings:`/settings`,startup:`/startup`,githubRepository:`https://github.com/riddix/home-assistant-matter-hub/`,documentation:q9,support:`${q9}/support`,faq:{multiFabric:`${q9}/connect-multiple-fabrics`,bridgeConfig:`${q9}/bridge-configuration`}},$3e=[{path:``,element:(0,G.jsx)(Ire,{}),children:[{path:``,element:(0,G.jsx)(h_e,{})},{path:J9.bridges,element:(0,G.jsx)(l_e,{})},{path:J9.createBridge,element:(0,G.jsx)(Qqe,{})},{path:J9.areaSetup,element:(0,G.jsx)(Lae,{})},{path:J9.bridge(`:bridgeId`),element:(0,G.jsx)(Dhe,{})},{path:J9.editBridge(`:bridgeId`),element:(0,G.jsx)($qe,{})},{path:J9.devices,element:(0,G.jsx)(P_e,{})},{path:J9.standaloneDevices,element:(0,G.jsx)(w2e,{})},{path:J9.networkMap,element:(0,G.jsx)(L0e,{})},{path:J9.health,element:(0,G.jsx)(xJe,{})},{path:J9.labels,element:(0,G.jsx)(TJe,{})},{path:J9.lockCredentials,element:(0,G.jsx)(jJe,{})},{path:J9.plugins,element:(0,G.jsx)(l2e,{})},{path:J9.settings,element:(0,G.jsx)(y2e,{})},{path:J9.startup,element:(0,G.jsx)(Q3e,{})},{path:`*`,element:(0,G.jsx)(MJe,{})}]}],e6e=D_({items:{isInitialized:!1,isLoading:!1}},e=>{e.addCase(V_.pending,e=>{e.items.isLoading=!0}).addCase(V_.rejected,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=void 0,e.items.error=t.error}).addCase(V_.fulfilled,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(H_.fulfilled,(e,t)=>{e.items.content?.push(t.payload)}).addCase(W_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(G_.fulfilled,(e,t)=>{let n=e.items.content?.findIndex(e=>e.id===t.payload.id)??-1;n!==-1&&(e.items.content[n]=t.payload)}).addCase(U_.fulfilled,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.meta.arg);n!==-1&&e.items.content.splice(n,1)}}).addCase(K_,(e,t)=>{e.items.isInitialized=!0,e.items.isLoading=!1,e.items.content=t.payload,e.items.error=void 0}).addCase(q_,(e,t)=>{if(e.items.content){let n=e.items.content.findIndex(e=>e.id===t.payload.id);n===-1?e.items.content.push(t.payload):e.items.content[n]=t.payload}})}),t6e=D_({byBridge:{}},e=>{e.addCase(UT.pending,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(UT.rejected,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)}).addCase(UT.fulfilled,(e,t)=>{e.byBridge[t.meta.arg]=Y9(e.byBridge[t.meta.arg],t)})}),Y9=D_({isInitialized:!1,isLoading:!1,content:void 0,error:void 0},e=>{e.addCase(UT.pending,e=>{e.isLoading=!0}).addCase(UT.rejected,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=void 0,e.error=t.error}).addCase(UT.fulfilled,(e,t)=>{e.isInitialized=!0,e.isLoading=!1,e.content=t.payload,e.error=void 0})}),n6e=lre({reducer:{bridges:e6e,devices:t6e}}),X9=Op({createStyledComponent:J(`div`,{name:`MuiContainer`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`maxWidth${Y(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>km({props:e,name:`MuiContainer`})});function r6e(e){return Jd(`MuiToolbar`,e)}Yd(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var i6e=e=>{let{classes:t,disableGutters:n,variant:r}=e;return Cp({root:[`root`,!n&&`gutters`,r]},r6e,t)},a6e=J(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Fm(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(`sm`)]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:`dense`},style:{minHeight:48}},{props:{variant:`regular`},style:e.mixins.toolbar}]}))),o6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o};return(0,G.jsx)(a6e,{as:i,className:K(i6e(c).root,r),ref:t,ownerState:c,...s})}),s6e=class extends C.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught:`,e,t.componentStack)}render(){return this.state.hasError?(0,G.jsxs)(Z,{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,minHeight:`60vh`,gap:2,p:4,children:[(0,G.jsx)(gb,{color:`error`,sx:{fontSize:64}}),(0,G.jsx)(Q,{variant:`h5`,fontWeight:600,children:Gs.t(`errorBoundary.title`)}),(0,G.jsx)(Q,{variant:`body2`,color:`text.secondary`,textAlign:`center`,maxWidth:480,children:this.state.error?.message??Gs.t(`errorBoundary.fallbackMessage`)}),(0,G.jsx)(mv,{variant:`contained`,onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:Gs.t(`errorBoundary.reload`)})]}):this.props.children}};function c6e(e){return Jd(`MuiFab`,e)}var l6e=Yd(`MuiFab`,[`root`,`primary`,`secondary`,`extended`,`circular`,`focusVisible`,`disabled`,`colorInherit`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`info`,`error`,`warning`,`success`]),u6e=e=>{let{color:t,variant:n,classes:r,size:i}=e,a=Cp({root:[`root`,n,`size${Y(i)}`,t===`inherit`?`colorInherit`:t]},c6e,r);return{...r,...a}},d6e=J(Nh,{name:`MuiFab`,slot:`Root`,shouldForwardProp:e=>Dm(e)||e===`classes`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Y(n.size)}`],n.color===`inherit`&&t.colorInherit,t[Y(n.size)],t[n.color]]}})(Fm(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create([`background-color`,`box-shadow`,`border-color`],{duration:e.transitions.duration.short}),borderRadius:`50%`,padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:`none`},[`&.${l6e.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:`small`},style:{width:40,height:40}},{props:{size:`medium`},style:{width:48,height:48}},{props:{variant:`extended`},style:{borderRadius:48/2,padding:`0 16px`,width:`auto`,minHeight:`auto`,minWidth:48,height:48}},{props:{variant:`extended`,size:`small`},style:{width:`auto`,padding:`0 8px`,borderRadius:34/2,minWidth:34,height:34}},{props:{variant:`extended`,size:`medium`},style:{width:`auto`,padding:`0 16px`,borderRadius:40/2,minWidth:40,height:40}},{props:{color:`inherit`},style:{color:`inherit`}}]})),Fm(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Um([`dark`,`contrastText`])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Fm(({theme:e})=>({[`&.${l6e.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),f6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiFab`}),{children:r,className:i,color:a=`default`,component:o=`button`,disabled:s=!1,disableFocusRipple:c=!1,focusVisibleClassName:l,size:u=`large`,variant:d=`circular`,...f}=n,p={...n,color:a,component:o,disabled:s,disableFocusRipple:c,size:u,variant:d},m=u6e(p);return(0,G.jsx)(d6e,{className:K(m.root,i),component:o,disabled:s,focusRipple:!c,focusVisibleClassName:K(m.focusVisible,l),ownerState:p,ref:t,...f,classes:m,children:r})}),p6e=[{code:`en`,flag:`🇬🇧`,name:`English`},{code:`de`,flag:`🇩🇪`,name:`Deutsch`},{code:`fr`,flag:`🇫🇷`,name:`Français`},{code:`es`,flag:`🇪🇸`,name:`Español`},{code:`it`,flag:`🇮🇹`,name:`Italiano`},{code:`hu`,flag:`🇭🇺`,name:`Magyar`},{code:`zh`,flag:`🇨🇳`,name:`中文`},{code:`zh-TW`,flag:`🇹🇼`,name:`繁體中文`},{code:`ja`,flag:`🇯🇵`,name:`日本語`},{code:`th`,flag:`🇹🇭`,name:`ไทย`},{code:`sv`,flag:`🇸🇪`,name:`Svenska`},{code:`tr`,flag:`🇹🇷`,name:`Türkçe`},{code:`ru`,flag:`🇷🇺`,name:`Русский`}],m6e=`hamh-custom-languages`;function h6e(){try{let e=localStorage.getItem(m6e);return e?JSON.parse(e).map(e=>({code:e.code,flag:`🌐`,name:e.name})):[]}catch{return[]}}var g6e=`https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement`;function _6e(){let{t:e,i18n:t}=ws(),[n,r]=(0,C.useState)(!1),i=(0,C.useRef)(null),a=(0,C.useMemo)(()=>[...p6e,...h6e()],[]),o=t.language??`en`,s=a.some(e=>e.code===o)?o:o.split(`-`)[0]??`en`,c=(0,C.useCallback)(()=>{r(e=>!e)},[]),l=(0,C.useCallback)(e=>{t.changeLanguage(e),r(!1)},[t]);return(0,G.jsx)(Kh,{onClickAway:(0,C.useCallback)(()=>{r(!1)},[]),children:(0,G.jsxs)(Z,{children:[(0,G.jsx)(f6e,{ref:i,size:`small`,color:`primary`,onClick:c,"aria-label":`Change language`,sx:{position:`fixed`,bottom:24,right:24,zIndex:1300},children:(0,G.jsx)(tge,{})}),(0,G.jsx)(ab,{open:n,anchorEl:i.current,placement:`top-end`,transition:!0,sx:{zIndex:1300},children:({TransitionProps:t})=>(0,G.jsx)(jb,{...t,timeout:200,children:(0,G.jsxs)(Wm,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:`hidden`},children:[a.map(e=>(0,G.jsxs)(Z,{onClick:()=>l(e.code),sx:{display:`flex`,alignItems:`center`,gap:1.5,px:2,py:1,cursor:`pointer`,bgcolor:s===e.code?`action.selected`:`transparent`,"&:hover":{bgcolor:`action.hover`},transition:`background-color 0.15s`},children:[(0,G.jsx)(Q,{sx:{fontSize:`1.4rem`,lineHeight:1,userSelect:`none`},children:e.flag}),(0,G.jsx)(Q,{variant:`body2`,fontWeight:s===e.code?600:400,children:e.name})]},e.code)),(0,G.jsx)(Ub,{}),(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`flex-start`,gap:.75,px:2,py:1},children:[(0,G.jsx)(Jv,{sx:{fontSize:14,mt:.25,color:`text.secondary`}}),(0,G.jsxs)(Q,{variant:`caption`,color:`text.secondary`,sx:{lineHeight:1.4},children:[e(`languageSwitcher.disclaimer`),` `,(0,G.jsx)(Gv,{href:g6e,target:`_blank`,rel:`noopener`,sx:{fontSize:`inherit`},children:e(`languageSwitcher.contribute`)})]})]})]})})})]})})}var v6e={name:`home-assistant-matter-hub`,description:``,version:`2.1.0-alpha.795`,private:!1,type:`module`,bin:{"home-assistant-matter-hub":`./dist/backend/cli.js`},author:{name:`riddix`,url:`https://github.com/riddix`},keywords:[`home-assistant`,`homeassistant`,`home`,`assistant`,`apple home`,`google home`,`apple`,`google`,`alexa`,`matter`,`matter.js`,`matterjs`,`project-chip`,`smart`,`smarthome`,`smart-home`],bugs:{url:`https://github.com/riddix/home-assistant-matter-hub/issues`},license:`Apache-2.0`,repository:`github:riddix/home-assistant-matter-hub`,scripts:{cleanup:`npx rimraf node_modules dist pack LICENSE README.md`,build:`node build.js`,bundle:`pnpm pack --out package.tgz`,postbuild:`pnpm run bundle`,test:`vitest run`,prestart:`pnpm run build`,start:`dotenvx run -f ../../.env -- ./dist/backend/cli.js start`},dependencies:{"@matter/main":`0.17.3`,"@matter/nodejs":`0.17.3`,"@matter/general":`0.17.3`,"@matter/types":`0.17.3`,ajv:`8.18.0`,archiver:`7.0.1`,color:`5.0.3`,debounce:`3.0.0`,express:`5.2.1`,"express-basic-auth":`1.2.1`,"express-ip-access-control":`1.1.3`,"home-assistant-js-websocket":`9.6.0`,"lodash-es":`4.18.1`,multer:`2.2.0`,nocache:`4.0.0`,unzipper:`0.12.3`,werift:`0.22.4`,ws:`8.21.0`,yargs:`18.0.0`},devDependencies:{"@home-assistant-matter-hub/backend":`workspace:*`,"@home-assistant-matter-hub/frontend":`workspace:*`,"@home-assistant-matter-hub/common":`workspace:*`,"@types/lodash-es":`^4.17.12`},overrides:{minimatch:`9.0.7`,"path-to-regexp":`^8.4.0`,glob:`^13.0.0`},nx:{targets:{start:{cache:!1,dependsOn:[`build`]},pack:{cache:!0,dependsOn:[`build`],outputs:[`{projectRoot}/pack`]},build:{inputs:[`^default`,`default`,`{workspaceRoot}/README.md`,`{workspaceRoot}/LICENSE`],outputs:[`{projectRoot}/dist`,`{projectRoot}/README.md`,`{projectRoot}/LICENSE`]}}}};function y6e(){let e=`2.1.0-alpha.795`,[t,n]=(0,C.useState)(null);(0,C.useEffect)(()=>{fetch(`api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.version&&n(e.version)}).catch(()=>{})},[]);let r=(0,C.useMemo)(()=>t?e!==t:!1,[t]);return(0,C.useMemo)(()=>({name:v6e.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}var b6e=()=>{let{t:e}=ws(),t=[{name:e(`footer.github`),url:J9.githubRepository},{name:e(`footer.documentation`),url:J9.documentation},{name:e(`footer.support`),url:J9.support}];return(0,G.jsxs)(X9,{sx:{mt:16,mb:4},children:[(0,G.jsx)(Ub,{sx:{mt:4,mb:4}}),(0,G.jsx)(Fv,{container:!0,spacing:2,justifyContent:`center`,children:t.map((e,t)=>(0,G.jsx)(Fv,{size:{xs:12,sm:`auto`},children:(0,G.jsx)(mv,{fullWidth:!0,size:`small`,variant:`outlined`,component:Gv,href:e.url,target:`_blank`,children:e.name})},t.toString()))})]})};function x6e(e){return Jd(`MuiAppBar`,e)}Yd(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var S6e=e=>{let{color:t,position:n,classes:r}=e;return Cp({root:[`root`,`color${Y(t)}`,`position${Y(n)}`]},x6e,r)},C6e=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,w6e=J(Wm,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${Y(n.position)}`],t[`color${Y(n.color)}`]]}})(Fm(({theme:e})=>({display:`flex`,flexDirection:`column`,width:`100%`,boxSizing:`border-box`,flexShrink:0,variants:[{props:{position:`fixed`},style:{position:`fixed`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0,"@media print":{position:`absolute`}}},{props:{position:`absolute`},style:{position:`absolute`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`sticky`},style:{position:`sticky`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`static`},style:{position:`static`}},{props:{position:`relative`},style:{position:`relative`}},{props:{color:`inherit`},style:{"--AppBar-color":`inherit`,color:`var(--AppBar-color)`}},{props:{color:`default`},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles(`dark`,{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Um([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?C6e(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?C6e(e.vars.palette.AppBar.darkColor,`var(--AppBar-color)`):null})}},{props:{color:`transparent`},style:{"--AppBar-background":`transparent`,"--AppBar-color":`inherit`,backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundImage:`none`})}}]}))),T6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a};return(0,G.jsx)(w6e,{square:!0,component:`header`,ownerState:c,elevation:4,className:K(S6e(c).root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})}),E6e={visibility:`hidden`};function D6e(e,t,n){let r=n&&n.getBoundingClientRect(),i=eh(t),a=t.style.transform,o=t.style.transition;t.style.transition=``,t.style.transform=``;let s=t.getBoundingClientRect(),c=i.getComputedStyle(t).getPropertyValue(`transform`);t.style.transform=a,t.style.transition=o;let l=0,u=0;if(c&&c!==`none`&&typeof c==`string`){let e=c.split(`(`)[1].split(`)`)[0].split(`,`);l=parseInt(e[4],10),u=parseInt(e[5],10)}return e===`left`?r?`translateX(${r.right+l-s.left}px)`:`translateX(${i.innerWidth+l-s.left}px)`:e===`right`?r?`translateX(-${s.right-r.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?r?`translateY(${r.bottom+u-s.top}px)`:`translateY(${i.innerHeight+u-s.top}px)`:r?`translateY(-${s.top-r.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function O6e(e){return typeof e==`function`?e():e}function Z9(e,t,n){let r=D6e(e,t,O6e(n));r&&(t.style.transform=r)}var k6e=C.forwardRef(function(e,t){let n=wm(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,direction:l=`down`,easing:u=r,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,style:v,timeout:y=i,...b}=e,x=C.useRef(null),S=ch(Wh(s),x,t),w=Jh(x,(e,t)=>{Z9(l,e,c),qh(e),f&&f(e,t)}),T=Jh(x,(e,t)=>{let r=Xh({timeout:y,style:v,easing:u},{mode:`enter`});e.style.transition=n.transitions.create(`transform`,r),e.style.transform=`none`,m&&m(e,t)}),E=Jh(x,p),D=Jh(x,_),O=Jh(x,e=>{let t=Xh({timeout:y,style:v,easing:u},{mode:`exit`});e.style.transition=n.transitions.create(`transform`,t),Z9(l,e,c),h&&h(e)}),k=Jh(x,e=>{e.style.transition=``,g&&g(e)}),A=e=>{a&&a(x.current,e)},j=C.useCallback(()=>{x.current&&Z9(l,x.current,c)},[l,c]);return C.useEffect(()=>{if(d||l===`down`||l===`right`)return;let e=Ym(()=>{x.current&&Z9(l,x.current,c)}),t=eh(x.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[l,d,c]),C.useEffect(()=>{d||j()},[d,j]),(0,G.jsx)(wh,{nodeRef:x,onEnter:w,onEntered:E,onEntering:T,onExit:O,onExited:k,onExiting:D,addEndListener:A,appear:o,in:d,timeout:y,...b,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!d?v||s.props.style?{visibility:`hidden`,...v,...s.props.style}:E6e:v&&s.props.style?{...v,...s.props.style}:v||s.props.style,C.cloneElement(s,{ref:S,style:r,...n})}})});function A6e(e){return Jd(`MuiDrawer`,e)}Yd(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`paperAnchorLeft`,`paperAnchorRight`,`paperAnchorTop`,`paperAnchorBottom`,`paperAnchorDockedLeft`,`paperAnchorDockedRight`,`paperAnchorDockedTop`,`paperAnchorDockedBottom`,`modal`]);var j6e=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},M6e=e=>{let{classes:t,anchor:n,variant:r}=e;return Cp({root:[`root`,`anchor${Y(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`,`paperAnchor${Y(n)}`,r!==`temporary`&&`paperAnchorDocked${Y(n)}`]},A6e,t)},N6e=J(Fb,{name:`MuiDrawer`,slot:`Root`,overridesResolver:j6e})(Fm(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),P6e=J(`div`,{shouldForwardProp:Dm,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:j6e})({flex:`0 0 auto`}),F6e=J(Wm,{name:`MuiDrawer`,slot:`Paper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.paper,t[`paperAnchor${Y(n.anchor)}`],n.variant!==`temporary`&&t[`paperAnchorDocked${Y(n.anchor)}`]]}})(Fm(({theme:e})=>({overflowY:`auto`,display:`flex`,flexDirection:`column`,height:`100%`,flex:`1 0 auto`,zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:`touch`,position:`fixed`,top:0,outline:0,variants:[{props:{anchor:`left`},style:{left:0}},{props:{anchor:`top`},style:{top:0,left:0,right:0,height:`auto`,maxHeight:`100%`}},{props:{anchor:`right`},style:{right:0}},{props:{anchor:`bottom`},style:{top:`auto`,left:0,bottom:0,right:0,height:`auto`,maxHeight:`100%`}},{props:({ownerState:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),I6e={left:`right`,right:`left`,top:`down`,bottom:`up`};function L6e(e){return[`left`,`right`].includes(e)}function R6e({direction:e},t){return e===`rtl`&&L6e(t)?I6e[t]:t}var z6e=C.forwardRef(function(e,t){let n=km({props:e,name:`MuiDrawer`}),r=wm(),i=Uf(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,BackdropProps:s,children:c,className:l,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:f,...p}={},onClose:m,open:h=!1,PaperProps:g={},SlideProps:_,TransitionComponent:v,transitionDuration:y=a,variant:b=`temporary`,slots:x={},slotProps:S={},...w}=n,T=C.useRef(!1);C.useEffect(()=>{T.current=!0},[]);let E=R6e({direction:i?`rtl`:`ltr`},o),D=o,O={...n,anchor:D,elevation:u,open:h,variant:b,...w},k=M6e(O),A={slots:{transition:v,...x},slotProps:{paper:g,transition:_,...S,backdrop:lh(S.backdrop||{...s,...f},{transitionDuration:y})}},[j,M]=Hm(`root`,{ref:t,elementType:N6e,className:K(k.root,k.modal,l),shouldForwardComponentProp:!0,ownerState:O,externalForwardedProps:{...A,...w,...p},additionalProps:{open:h,onClose:m,hideBackdrop:d,slots:{backdrop:A.slots.backdrop},slotProps:{backdrop:A.slotProps.backdrop}}}),[N,P]=Hm(`paper`,{elementType:F6e,shouldForwardComponentProp:!0,className:K(k.paper,g.className),ownerState:O,externalForwardedProps:A,additionalProps:{elevation:b===`temporary`?u:0,square:!0,...b===`temporary`&&{role:`dialog`,"aria-modal":`true`}}}),[F,I]=Hm(`docked`,{elementType:P6e,ref:t,className:K(k.root,k.docked,l),ownerState:O,externalForwardedProps:A,additionalProps:w}),[L,R]=Hm(`transition`,{elementType:k6e,ownerState:O,externalForwardedProps:A,additionalProps:{in:h,direction:I6e[E],timeout:y,appear:T.current}}),ee=(0,G.jsx)(N,{...P,children:c});if(b===`permanent`)return(0,G.jsx)(F,{...I,children:ee});let z=(0,G.jsx)(L,{...R,children:ee});return b===`persistent`?(0,G.jsx)(F,{...I,children:z}):(0,G.jsx)(j,{...M,children:z})}),B6e=_f({themeId:Cm}),V6e={error:Cx,warn:Yv,info:vb,debug:XT},H6e=({open:e,onClose:t})=>{let{t:n}=ws(),r=wm(),i=(0,C.useMemo)(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[a,o]=(0,C.useState)([]),[s,c]=(0,C.useState)(!0),[l,u]=(0,C.useState)(`error,warn,info`.split(`,`)),[d,f]=(0,C.useState)(``),[p,m]=(0,C.useState)(!0),h=(0,C.useCallback)(async()=>{try{let e=new URLSearchParams({level:l.join(`,`),limit:`500`,...d&&{search:d}}),t=await fetch(`api/logs?${e}`);t.ok&&o((await t.json()).entries)}catch(e){console.error(`Failed to fetch logs:`,e)}finally{c(!1)}},[l,d]);(0,C.useEffect)(()=>{e&&h()},[e,h]),(0,C.useEffect)(()=>{if(!p||!e)return;let t=setInterval(h,5e3);return()=>clearInterval(t)},[p,e,h]);let g=e=>{u(Array.isArray(e.target.value)?e.target.value:[e.target.value])},_=e=>{f(e.target.value)},v=async()=>{try{await fetch(`api/logs`,{method:`DELETE`}),o([])}catch(e){console.error(`Failed to clear logs:`,e)}},y=e=>(0,G.jsx)(V6e[e]||vb,{sx:{fontSize:16,color:i[e]}});return(0,G.jsxs)(Rb,{open:e,onClose:t,maxWidth:`lg`,fullWidth:!0,children:[(0,G.jsxs)(Vb,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,G.jsx)(XT,{}),n(`logs.title`),(0,G.jsx)(Z,{sx:{flexGrow:1}}),(0,G.jsx)(db,{title:n(`logs.autoRefresh`),children:(0,G.jsx)(Ev,{label:p?`Auto`:`Manual`,color:p?`success`:`default`,size:`small`,onClick:()=>m(!p),sx:{cursor:`pointer`}})}),(0,G.jsx)(Bh,{onClick:t,children:(0,G.jsx)(QT,{})})]}),(0,G.jsxs)(Bb,{children:[(0,G.jsx)(Hv,{spacing:2,sx:{mb:2},children:(0,G.jsxs)(Hv,{direction:`row`,spacing:2,alignItems:`center`,children:[(0,G.jsxs)(kv,{size:`small`,sx:{minWidth:200},children:[(0,G.jsx)(Bx,{children:n(`logs.logLevel`)}),(0,G.jsxs)(SS,{value:l,label:n(`logs.logLevel`),onChange:g,multiple:!0,renderValue:e=>(0,G.jsx)(Z,{sx:{display:`flex`,flexWrap:`wrap`,gap:.5},children:(Array.isArray(e)?e:[e]).map(e=>(0,G.jsx)(Ev,{label:e.toUpperCase(),size:`small`,sx:{backgroundColor:i[e],color:`white`}},e))}),children:[(0,G.jsx)(CS,{value:`error`,children:n(`logs.error`)}),(0,G.jsx)(CS,{value:`warn`,children:n(`logs.warning`)}),(0,G.jsx)(CS,{value:`info`,children:n(`logs.info`)}),(0,G.jsx)(CS,{value:`debug`,children:n(`logs.debug`)})]})]}),(0,G.jsx)(ES,{size:`small`,placeholder:n(`logs.searchPlaceholder`),value:d,onChange:_,sx:{flexGrow:1}}),(0,G.jsx)(mv,{variant:`outlined`,onClick:h,children:n(`common.refresh`)}),(0,G.jsx)(mv,{variant:`outlined`,color:`error`,onClick:v,children:n(`common.delete`)})]})}),(0,G.jsx)(Z,{sx:{height:400,overflow:`auto`,backgroundColor:`background.paper`,border:1,borderColor:`divider`,borderRadius:1,p:1},children:s?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsxs)(Q,{children:[n(`common.loading`),`...`]})}):a.length===0?(0,G.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,p:4},children:(0,G.jsx)(Q,{color:`text.secondary`,children:n(`logs.noResults`)})}):(0,G.jsx)(Hv,{spacing:1,children:a.map((e,t)=>(0,G.jsxs)(Z,{sx:{p:1,borderRadius:1,backgroundColor:`action.hover`,fontFamily:`monospace`,fontSize:`0.875rem`,wordBreak:`break-all`},children:[(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,mb:.5},children:[y(e.level),(0,G.jsx)(Q,{variant:`caption`,color:`text.secondary`,children:new Date(e.timestamp).toLocaleString()}),(0,G.jsx)(Ev,{label:e.level.toUpperCase(),size:`small`,sx:{backgroundColor:i[e.level],color:r.palette.getContrastText(i[e.level]??r.palette.grey[500]),fontSize:`0.7rem`,height:20}})]}),(0,G.jsx)(Q,{sx:{ml:3},children:e.message}),e.context&&(0,G.jsx)(Q,{sx:{ml:3,color:`text.secondary`,fontSize:`0.8rem`},children:JSON.stringify(e.context,null,2)})]},`${e.timestamp}-${e.level}-${t}`))})})]}),(0,G.jsx)(zb,{children:(0,G.jsx)(mv,{onClick:t,children:n(`common.close`)})})]})};function Q9(){let{t:e}=ws(),{isConnected:t}=Z_(),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`api/health`);e.ok?(r(await e.json()),a(!1)):a(!0)}catch{a(!0)}};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]);let o=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`},s=n?.status===`healthy`&&!i,c=n?.services?.bridges,l=c&&c.total>0&&c.running===c.total,u=c&&c.total===0,d=n?(0,G.jsxs)(Z,{sx:{p:.5},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.version`),`:`]}),` `,n.version??e(`status.unknown`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.uptime`),`:`]}),` `,o(n.uptime??0)]}),n.services?.bridges&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`nav.bridges`),`:`]}),` `,n.services.bridges.running??0,`/`,n.services.bridges.total??0,` `,e(`common.running`).toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e(`common.stopped`).toLowerCase()})`]}),n.services?.homeAssistant&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`strong`,{children:[e(`health.homeAssistant`),`:`]}),` `,n.services.homeAssistant.connected?e(`health.connected`):e(`health.disconnected`)]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`strong`,{children:`WebSocket:`}),` `,e(t?`health.connected`:`health.disconnected`)]})]}):e(`status.loadingHealth`);return(0,G.jsx)(db,{title:d,arrow:!0,children:(0,G.jsx)(Ev,{icon:i||!s?(0,G.jsx)(Cx,{fontSize:`small`}):l?(0,G.jsx)(lv,{fontSize:`small`}):(0,G.jsx)(xb,{fontSize:`small`}),label:e(i?`status.error`:s?t?u?`status.noBridges`:l?`common.online`:`common.starting`:`common.offline`:`status.unhealthy`),color:i||!s?`error`:!l||!t?`warning`:`success`,size:`small`,variant:`filled`,sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:`inherit`}}})})}var U6e=e=>(0,G.jsx)(`svg`,{viewBox:`0 0 91 89`,xmlSpace:`preserve`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,G.jsxs)(`g`,{style:{display:`inline`},children:[(0,G.jsx)(`path`,{style:{fill:`#18bcf2`,fillOpacity:1,strokeWidth:.266194},d:`m 49.149143,1.473171 38.513568,38.536435 c 0,0 1.248354,1.186052 2.207681,3.092371 0.959329,1.906323 1.10864,4.600698 1.10864,4.600698 v 36.786372 c 0,0 -0.01549,1.748506 -1.49842,3.050572 -1.482931,1.302064 -3.333077,1.362947 -3.333077,1.362947 l -81.325658,7.7e-5 c 0,0 -1.7523855,-0.0091 -3.17112,-1.352526 C -0.07808495,85.913164 0.05953025,84.487808 0.05953025,84.487808 V 47.704546 c 0,0 -0.0018381,-2.218618 0.95921785,-4.315832 0.9610554,-2.097209 2.3010618,-3.355005 2.3010618,-3.355005 L 41.545959,1.4719546 c 0,0 1.465224,-1.46837077 3.753488,-1.46837077 2.288268,0 3.849696,1.46958717 3.849696,1.46958717 z`}),(0,G.jsx)(`path`,{style:{fill:`#ffffff`,fillOpacity:1,strokeWidth:.175841},d:`m 31.689717,32.051124 c 2.813363,2.331095 6.157331,3.89845 9.721813,4.556421 V 17.180647 l 3.873694,-2.282955 3.870527,2.282955 V 36.60772 c 3.565364,-0.658847 6.910387,-2.226204 9.725159,-4.556417 l 7.032345,4.154609 c -11.437354,11.557779 -29.852321,11.557779 -41.290025,0 z m 8.546732,49.60988 C 44.314996,65.760441 35.09933,49.470196 19.574984,45.139543 v 8.312381 c 3.383916,1.32244 6.386113,3.496288 8.728705,6.320026 L 11.83076,69.485301 v 4.56907 l 3.873697,2.270836 16.469936,-9.713534 c 1.224356,3.48294 1.56683,7.225375 0.996449,10.879778 z M 70.977694,45.139543 c -15.515726,4.34014 -24.72189,20.626696 -20.643519,36.521461 l 7.047658,-4.15742 c -0.569325,-3.654411 -0.2265,-7.3965 0.996449,-10.87979 l 16.457611,9.701233 3.870711,-2.283125 v -4.55677 L 62.233673,59.77195 c 2.342772,-2.822684 5.34497,-4.996533 8.728708,-6.320026 z`})]})}),W6e=e=>{let t=y6e();return(0,G.jsxs)(Z,{component:ua,to:J9.dashboard,sx:{display:`flex`,alignItems:`center`,justifyContent:e.large?`flex-start`:`center`,flexGrow:1,textDecoration:`none`,color:`inherit`},children:[(0,G.jsx)(U6e,{style:{height:`40px`}}),(0,G.jsx)(Q,{variant:`inherit`,component:`span`,sx:{mr:1,ml:1},children:t.name.split(`-`).map(Y).join(`-`)}),e.large&&(0,G.jsx)(Q,{variant:`caption`,component:`span`,children:t.version})]})},G6e=()=>{let e=B6e(`(min-width:600px)`),{mode:t,setMode:n}=Pm(),[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=Nr(),c=Ar(),l=e=>e?e===`/`?c.pathname===`/`:c.pathname.startsWith(e):!1,u=()=>{n(t===`dark`?`light`:`dark`)},{t:d}=ws(),f=[{label:d(`dashboard.title`),icon:(0,G.jsx)(rE,{}),to:J9.dashboard},{label:d(`nav.bridges`),icon:(0,G.jsx)(iE,{}),to:J9.bridges},{label:d(`nav.devices`),icon:(0,G.jsx)(mb,{}),to:J9.devices},{label:d(`nav.standaloneDevices`,`Standalone Devices`),icon:(0,G.jsx)(dge,{}),to:J9.standaloneDevices},{label:d(`nav.networkMap`),icon:(0,G.jsx)(GT,{}),to:J9.networkMap},{label:d(`nav.startupOrder`),icon:(0,G.jsx)(uv,{}),to:J9.startup},{label:d(`nav.lockCredentials`),icon:(0,G.jsx)(ET,{}),to:J9.lockCredentials},{label:d(`nav.filterReference`),icon:(0,G.jsx)(aE,{}),to:J9.labels},{label:`Plugins`,icon:(0,G.jsx)(tE,{}),to:J9.plugins},{label:d(`nav.settings`),icon:(0,G.jsx)(FT,{}),to:J9.settings},{label:d(t===`dark`?`nav.lightMode`:`nav.darkMode`),icon:t===`dark`?(0,G.jsx)(ige,{}):(0,G.jsx)(Ghe,{}),onClick:u},{label:d(`nav.systemLogs`),icon:(0,G.jsx)(XT,{}),onClick:()=>i(!0)},{label:d(`nav.health`),icon:(0,G.jsx)(kx,{}),to:J9.health}],p=e=>{o(!1),e.onClick?e.onClick():e.to&&s(e.to)};return(0,G.jsxs)(Z,{children:[(0,G.jsx)(T6e,{sx:{height:`72px`},children:(0,G.jsx)(o6e,{sx:{paddingLeft:`0 !important`,paddingRight:`0 !important`},children:(0,G.jsxs)(X9,{sx:{padding:2,height:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,G.jsx)(W6e,{large:e}),e?(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[f.map(e=>e.to?(0,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{component:ua,to:e.to,sx:{color:`inherit`,bgcolor:l(e.to)?`rgba(255,255,255,0.15)`:`transparent`,borderRadius:1},children:e.icon})},e.label):(0,G.jsx)(db,{title:e.label,children:(0,G.jsx)(Bh,{onClick:e.onClick,sx:{color:`inherit`},children:e.icon})},e.label)),(0,G.jsx)(Q9,{})]}):(0,G.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[(0,G.jsx)(Q9,{}),(0,G.jsx)(Bh,{onClick:()=>o(!0),sx:{color:`inherit`},children:(0,G.jsx)(age,{})})]})]})})}),(0,G.jsx)(z6e,{anchor:`right`,open:a,onClose:()=>o(!1),children:(0,G.jsx)($v,{sx:{width:250},children:f.map(e=>(0,G.jsxs)(eoe,{selected:l(e.to),onClick:()=>p(e),children:[(0,G.jsx)(iy,{children:e.icon}),(0,G.jsx)(oy,{primary:e.label})]},e.label))})}),(0,G.jsx)(H6e,{open:r,onClose:()=>i(!1)})]})},K6e=()=>{let{versionMismatch:e,frontendVersion:t,backendVersion:n}=y6e(),{isConnected:r}=Z_();return(0,G.jsxs)(Z,{children:[(0,G.jsx)(G6e,{}),(0,G.jsx)(o6e,{}),e&&(0,G.jsxs)(Uh,{severity:`warning`,variant:`filled`,sx:{borderRadius:0},action:(0,G.jsx)(mv,{color:`inherit`,size:`small`,onClick:()=>window.location.reload(),children:`Reload`}),children:[`Version mismatch: frontend `,t,`, backend `,n,`. Please reload to get the latest UI.`]}),!r&&(0,G.jsx)(Uh,{severity:`error`,variant:`filled`,sx:{borderRadius:0},children:`Connection lost, data may be outdated. Reconnecting…`}),(0,G.jsx)(X9,{sx:{p:2},children:(0,G.jsx)(s6e,{children:(0,G.jsx)(_i,{})})}),(0,G.jsx)(b6e,{}),(0,G.jsx)(_6e,{})]})},q6e=xm({colorSchemes:{light:{palette:{primary:{main:`#1976d2`,light:`#42a5f5`,dark:`#1565c0`},secondary:{main:`#9c27b0`,light:`#ba68c8`,dark:`#7b1fa2`},background:{default:`#f5f5f5`,paper:`#ffffff`}}},dark:{palette:{primary:{main:`#90caf9`,light:`#e3f2fd`,dark:`#42a5f5`},secondary:{main:`#ce93d8`,light:`#f3e5f5`,dark:`#ab47bc`},background:{default:`#121212`,paper:`#1e1e1e`}}}},typography:{fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,h1:{fontSize:`2.5rem`,fontWeight:500},h2:{fontSize:`2rem`,fontWeight:500},h3:{fontSize:`1.75rem`,fontWeight:500},h4:{fontSize:`1.5rem`,fontWeight:500},h5:{fontSize:`1.25rem`,fontWeight:500},h6:{fontSize:`1rem`,fontWeight:500}},shape:{borderRadius:8},components:{MuiCard:{styleOverrides:{root:{transition:`transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out`,"&:hover":{transform:`translateY(-2px)`,boxShadow:`0 4px 20px rgba(0,0,0,0.12)`}}}},MuiButton:{styleOverrides:{root:{textTransform:`none`,fontWeight:500}}},MuiChip:{styleOverrides:{root:{fontWeight:500}}},MuiAppBar:{styleOverrides:{root:{backgroundImage:`none`}}}}}),$9=document.getElementsByTagName(`base`)[0]?.href?.replace(/\/$/,``);$9?.startsWith(`http`)&&($9=new URL($9).pathname);var J6e=oa([{path:`/`,element:(0,G.jsx)(K6e,{}),children:$3e}],{basename:$9});(0,S.createRoot)(document.getElementById(`root`)).render((0,G.jsx)(C.StrictMode,{children:(0,G.jsx)(L,{store:n6e,children:(0,G.jsxs)(ite,{theme:q6e,children:[(0,G.jsx)(Qee,{}),(0,G.jsx)(Tm,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:`initial !important`,flexGrow:1}}}),(0,G.jsx)(Fre,{children:(0,G.jsx)(xne,{children:(0,G.jsx)(Aa,{router:J6e})})})]})})}));
|