@riddix/hamh 2.1.0-alpha.473 → 2.1.0-alpha.474

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.
@@ -496,4 +496,4 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
496
496
  To pick up a draggable item, press the space bar.
497
497
  While dragging, use the arrow keys to move the item.
498
498
  Press space again to drop the item in its new position, or press escape to cancel.
499
- `},mht={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 ght(e){let{announcements:t=mht,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=pht}=e;const{announce:o,announcement:s}=dht(),a=Ov("DndLiveRegion"),[l,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),fht(k.useMemo(()=>({onDragStart(d){let{active:p}=d;o(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:g}=d;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(d){let{active:p,over:g}=d;o(t.onDragOver({active:p,over:g}))},onDragEnd(d){let{active:p,over:g}=d;o(t.onDragEnd({active:p,over:g}))},onDragCancel(d){let{active:p,over:g}=d;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!l)return null;const u=Jt.createElement(Jt.Fragment,null,Jt.createElement(cht,{id:r,value:i.draggable}),Jt.createElement(uht,{id:a,announcement:s}));return n?Fd.createPortal(u,n):u}var Ui;(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"})(Ui||(Ui={}));function Q6(){}function LY(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function yht(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const xl=Object.freeze({x:0,y:0});function tue(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function bht(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function NY(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 rue(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function FY(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}}const vht=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=FY(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=tue(FY(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(nue)},xht=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=NY(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=NY(l),u=i.reduce((p,g,y)=>p+tue(c[y],g),0),d=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:d}})}}return o.sort(nue)};function Sht(e,t){const 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),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const wht=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Sht(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(bht)};function Cht(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function iue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xl}function Eht(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Aht=Eht(1);function kht(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Dht(e,t,n){const r=kht(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const _ht={ignoreTransform:!1};function Dg(e,t){t===void 0&&(t=_ht);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Cs(e).getComputedStyle(e);c&&(n=Dht(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function BY(e){return Dg(e,{ignoreTransform:!0})}function Oht(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Tht(e,t){return t===void 0&&(t=Cs(e).getComputedStyle(e)),t.position==="fixed"}function Mht(e,t){t===void 0&&(t=Cs(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function A8(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(cj(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Dv(i)||Zce(i)||n.includes(i))return n;const o=Cs(e).getComputedStyle(i);return i!==e&&Mht(i,o)&&n.push(i),Tht(i,o)?n:r(i.parentNode)}return e?r(e):n}function oue(e){const[t]=A8(e,1);return t??null}function Pk(e){return!E8||!e?null:Ag(e)?e:lj(e)?cj(e)||e===kg(e).scrollingElement?window:Dv(e)?e:null:null}function sue(e){return Ag(e)?e.scrollX:e.scrollLeft}function aue(e){return Ag(e)?e.scrollY:e.scrollTop}function BO(e){return{x:sue(e),y:aue(e)}}var no;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(no||(no={}));function lue(e){return!E8||!e?!1:e===document.scrollingElement}function cue(e){const t={x:0,y:0},n=lue(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const Rht={x:.2,y:.2};function Iht(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Rht);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=cue(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=no.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=no.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!p&&a>=t.right-b.width?(g.x=no.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!d&&s<=t.left+b.width&&(g.x=no.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function jht(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{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 uue(e){return e.reduce((t,n)=>y0(t,BO(n)),xl)}function Pht(e){return e.reduce((t,n)=>t+sue(n),0)}function $ht(e){return e.reduce((t,n)=>t+aue(n),0)}function Lht(e,t){if(t===void 0&&(t=Dg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);oue(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Nht=[["x",["left","right"],Pht],["y",["top","bottom"],$ht]];class fj{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=A8(n),i=uue(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of Nht)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Jy{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Fht(e){const{EventTarget:t}=Cs(e);return e instanceof t?e:kg(e)}function $k(e,t){const 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 ga;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ga||(ga={}));function zY(e){e.preventDefault()}function Bht(e){e.stopPropagation()}var zn;(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"})(zn||(zn={}));const due={start:[zn.Space,zn.Enter],cancel:[zn.Esc],end:[zn.Space,zn.Enter,zn.Tab]},zht=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case zn.Right:return{...n,x:n.x+25};case zn.Left:return{...n,x:n.x-25};case zn.Down:return{...n,y:n.y+25};case zn.Up:return{...n,y:n.y-25}}};class hj{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Jy(kg(n)),this.windowListeners=new Jy(Cs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ga.Resize,this.handleCancel),this.windowListeners.add(ga.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ga.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lht(r),n(xl)}handleKeyDown(t){if(dj(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=due,coordinateGetter:s=zht,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:xl;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=wb(d,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:A,maxScroll:E,minScroll:O}=cue(b),_=jht(b),T={x:Math.min(v===zn.Right?_.right-_.width/2:_.right,Math.max(v===zn.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(v===zn.Down?_.bottom-_.height/2:_.bottom,Math.max(v===zn.Down?_.top:_.top+_.height/2,d.y))},I=v===zn.Right&&!C||v===zn.Left&&!w,P=v===zn.Down&&!A||v===zn.Up&&!S;if(I&&T.x!==d.x){const N=b.scrollLeft+p.x,R=v===zn.Right&&N<=E.x||v===zn.Left&&N>=O.x;if(R&&!p.y){b.scrollTo({left:N,behavior:a});return}R?g.x=b.scrollLeft-N:g.x=v===zn.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(P&&T.y!==d.y){const N=b.scrollTop+p.y,R=v===zn.Down&&N<=E.y||v===zn.Up&&N>=O.y;if(R&&!p.x){b.scrollTo({top:N,behavior:a});return}R?g.y=b.scrollTop-N:g.y=v===zn.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,y0(wb(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}hj.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=due,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function HY(e){return!!(e&&"distance"in e)}function UY(e){return!!(e&&"delay"in e)}class pj{constructor(t,n,r){var i;r===void 0&&(r=Fht(t.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=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=kg(s),this.documentListeners=new Jy(this.document),this.listeners=new Jy(r),this.windowListeners=new Jy(Cs(s)),this.initialCoordinates=(i=FO(o))!=null?i:xl,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ga.Resize,this.handleCancel),this.windowListeners.add(ga.DragStart,zY),this.windowListeners.add(ga.VisibilityChange,this.handleCancel),this.windowListeners.add(ga.ContextMenu,zY),this.documentListeners.add(ga.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(UY(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(HY(n)){this.handlePending(n);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(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ga.Click,Bht,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ga.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=FO(t))!=null?n:xl,c=wb(i,l);if(!r&&a){if(HY(a)){if(a.tolerance!=null&&$k(c,a.tolerance))return this.handleCancel();if($k(c,a.distance))return this.handleStart()}if(UY(a)&&$k(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===zn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Hht={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class mj extends pj{constructor(t){const{event:n}=t,r=kg(n.target);super(t,Hht,r)}}mj.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Uht={move:{name:"mousemove"},end:{name:"mouseup"}};var zO;(function(e){e[e.RightClick=2]="RightClick"})(zO||(zO={}));class Vht extends pj{constructor(t){super(t,Uht,kg(t.event.target))}}Vht.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===zO.RightClick?!1:(r?.({event:n}),!0)}}];const Lk={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wht extends pj{constructor(t){super(t,Lk)}static setup(){return window.addEventListener(Lk.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lk.move.name,t)};function t(){}}}Wht.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Zy;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Zy||(Zy={}));var ew;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ew||(ew={}));function qht(e){let{acceleration:t,activator:n=Zy.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=ew.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const g=Kht({delta:d,disabled:!o}),[y,b]=iht(),v=k.useRef({x:0,y:0}),S=k.useRef({x:0,y:0}),C=k.useMemo(()=>{switch(n){case Zy.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Zy.DraggableRect:return i}},[n,i,l]),w=k.useRef(null),A=k.useCallback(()=>{const O=w.current;if(!O)return;const _=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(_,T)},[]),E=k.useMemo(()=>a===ew.TreeOrder?[...c].reverse():c,[a,c]);k.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const _=c.indexOf(O),T=u[_];if(!T)continue;const{direction:I,speed:P}=Iht(O,T,C,t,p);for(const N of["x","y"])g[N][I[N]]||(P[N]=0,I[N]=0);if(P.x>0||P.y>0){b(),w.current=O,y(A,s),v.current=P,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,A,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(p)])}const Ght={x:{[no.Backward]:!1,[no.Forward]:!1},y:{[no.Backward]:!1,[no.Forward]:!1}};function Kht(e){let{delta:t,disabled:n}=e;const r=NO(t);return _v(i=>{if(n||!r||!i)return Ght;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[no.Backward]:i.x[no.Backward]||o.x===-1,[no.Forward]:i.x[no.Forward]||o.x===1},y:{[no.Backward]:i.y[no.Backward]||o.y===-1,[no.Forward]:i.y[no.Forward]||o.y===1}}},[n,t,r])}function Yht(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return _v(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Xht(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Eb;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Eb||(Eb={}));var HO;(function(e){e.Optimized="optimized"})(HO||(HO={}));const VY=new Map;function Jht(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=k.useState(null),{frequency:a,measure:l,strategy:c}=i,u=k.useRef(e),d=v(),p=Sb(d),g=k.useCallback(function(S){S===void 0&&(S=[]),!p.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[p]),y=k.useRef(null),b=_v(S=>{if(d&&!n)return VY;if(!S||S===VY||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const A=w.node.current,E=A?new fj(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,d,l]);return k.useEffect(()=>{u.current=e},[e]),k.useEffect(()=>{d||g()},[n,d]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,d,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case Eb.Always:return!1;case Eb.BeforeDragging:return n;default:return!n}}}function fue(e,t){return _v(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zht(e,t){return fue(e,t)}function Qht(e){let{callback:t,disabled:n}=e;const r=uj(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i?.disconnect(),[i]),i}function k8(e){let{callback:t,disabled:n}=e;const r=uj(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i?.disconnect(),[i]),i}function ept(e){return new fj(Dg(e),e)}function WY(e,t,n){t===void 0&&(t=ept);const[r,i]=k.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Qht({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){o();break}}}}),a=k8({callback:o});return Tc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function tpt(e){const t=fue(e);return iue(e,t)}const qY=[];function npt(e){const t=k.useRef(e),n=_v(r=>e?r&&r!==qY&&e&&t.current&&e.parentNode===t.current.parentNode?r:A8(e):qY,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function rpt(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=Pk(o.target);s&&n(a=>a?(a.set(s,BO(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=Pk(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,BO(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=Pk(l);c?.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>y0(o,s),xl):uue(e):xl,[e,t])}function GY(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==xl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?wb(e,n.current):xl}function ipt(e){k.useEffect(()=>{if(!E8)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function opt(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function hue(e){return k.useMemo(()=>e?Oht(e):null,[e])}const KY=[];function spt(e,t){t===void 0&&(t=Dg);const[n]=e,r=hue(n?Cs(n):null),[i,o]=k.useState(KY);function s(){o(()=>e.length?e.map(l=>lue(l)?r:new fj(t(l),l)):KY)}const a=k8({callback:s});return Tc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function apt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Dv(t)?t:e}function lpt(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(c=>{for(const{target:u}of c)if(Dv(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),o=k8({callback:i}),s=k.useCallback(c=>{const u=apt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=Z6(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const cpt=[{sensor:mj,options:{}},{sensor:hj,options:{}}],upt={current:{}},J4={draggable:{measure:BY},droppable:{measure:BY,strategy:Eb.WhileDragging,frequency:HO.Optimized},dragOverlay:{measure:Dg}};class Qy extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const dpt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Q6},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:J4,measureDroppableContainers:Q6,windowRect:null,measuringScheduled:!1},fpt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Q6,draggableNodes:new Map,over:null,measureDroppableContainers:Q6},D8=k.createContext(fpt),pue=k.createContext(dpt);function hpt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qy}}}function ppt(e,t){switch(t.type){case Ui.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ui.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 Ui.DragEnd:case Ui.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ui.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Qy(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Ui.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Qy(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Ui.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Qy(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function mpt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(D8),o=NO(r),s=NO(n?.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!dj(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=aht(u);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function gpt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function ypt(e){return k.useMemo(()=>({draggable:{...J4.draggable,...e?.draggable},droppable:{...J4.droppable,...e?.droppable},dragOverlay:{...J4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bpt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Tc(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=iue(u,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=oue(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const mue=k.createContext({...xl,scaleX:1,scaleY:1});var Md;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Md||(Md={}));const vpt=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=cpt,collisionDetection:d=wht,measuring:p,modifiers:g,...y}=t;const b=k.useReducer(ppt,void 0,hpt),[v,S]=b,[C,w]=hht(),[A,E]=k.useState(Md.Uninitialized),O=A===Md.Initialized,{draggable:{active:_,nodes:T,translate:I},droppable:{containers:P}}=v,N=_!=null?T.get(_):null,R=k.useRef({initial:null,translated:null}),$=k.useMemo(()=>{var Ot;return _!=null?{id:_,data:(Ot=N?.data)!=null?Ot:upt,rect:R}:null},[_,N]),L=k.useRef(null),[z,B]=k.useState(null),[V,U]=k.useState(null),q=Sb(y,Object.values(y)),X=Ov("DndDescribedBy",s),F=k.useMemo(()=>P.getEnabled(),[P]),W=ypt(p),{droppableRects:Y,measureDroppableContainers:H,measuringScheduled:G}=Jht(F,{dragging:O,dependencies:[I.x,I.y],config:W.droppable}),J=Yht(T,_),oe=k.useMemo(()=>V?FO(V):null,[V]),Q=wr(),ie=Zht(J,W.draggable.measure);bpt({activeNode:_!=null?T.get(_):null,config:Q.layoutShiftCompensation,initialRect:ie,measure:W.draggable.measure});const ne=WY(J,W.draggable.measure,ie),Z=WY(J?J.parentElement:null),re=k.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ee=P.getNodeFor((n=re.current.over)==null?void 0:n.id),ae=lpt({measure:W.dragOverlay.measure}),fe=(r=ae.nodeRef.current)!=null?r:J,ge=O?(i=ae.rect)!=null?i:ne:null,Ie=!!(ae.nodeRef.current&&ae.rect),ve=tpt(Ie?null:ne),Xe=hue(fe?Cs(fe):null),Ne=npt(O?ee??J:null),_e=spt(Ne),Te=gpt(g,{transform:{x:I.x-ve.x,y:I.y-ve.y,scaleX:1,scaleY:1},activatorEvent:V,active:$,activeNodeRect:ne,containerNodeRect:Z,draggingNodeRect:ge,over:re.current.over,overlayNodeRect:ae.rect,scrollableAncestors:Ne,scrollableAncestorRects:_e,windowRect:Xe}),it=oe?y0(oe,I):null,Ke=rpt(Ne),ze=GY(Ke),je=GY(Ke,[ne]),He=y0(Te,ze),et=ge?Aht(ge,Te):null,st=$&&et?d({active:$,collisionRect:et,droppableRects:Y,droppableContainers:F,pointerCoordinates:it}):null,ct=rue(st,"id"),[Ze,Ft]=k.useState(null),Bt=Ie?Te:y0(Te,je),Tt=Cht(Bt,(o=Ze?.rect)!=null?o:null,ne),nr=k.useRef(null),un=k.useCallback((Ot,$t)=>{let{sensor:on,options:Fn}=$t;if(L.current==null)return;const dn=T.get(L.current);if(!dn)return;const Ct=Ot.nativeEvent,xn=new on({active:L.current,activeNode:dn,event:Ct,options:Fn,context:re,onAbort(Cr){if(!T.get(Cr))return;const{onDragAbort:ue}=q.current,pe={id:Cr};ue?.(pe),C({type:"onDragAbort",event:pe})},onPending(Cr,oi,ue,pe){if(!T.get(Cr))return;const{onDragPending:Fe}=q.current,Ue={id:Cr,constraint:oi,initialCoordinates:ue,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(Cr){const oi=L.current;if(oi==null)return;const ue=T.get(oi);if(!ue)return;const{onDragStart:pe}=q.current,Se={activatorEvent:Ct,active:{id:oi,data:ue.data,rect:R}};Fd.unstable_batchedUpdates(()=>{pe?.(Se),E(Md.Initializing),S({type:Ui.DragStart,initialCoordinates:Cr,active:oi}),C({type:"onDragStart",event:Se}),B(nr.current),U(Ct)})},onMove(Cr){S({type:Ui.DragMove,coordinates:Cr})},onEnd:ii(Ui.DragEnd),onCancel:ii(Ui.DragCancel)});nr.current=xn;function ii(Cr){return async function(){const{active:ue,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=re.current;let Ue=null;if(ue&&Fe){const{cancelDrop:vt}=q.current;Ue={activatorEvent:Ct,active:ue,collisions:pe,delta:Fe,over:Se},Cr===Ui.DragEnd&&typeof vt=="function"&&await Promise.resolve(vt(Ue))&&(Cr=Ui.DragCancel)}L.current=null,Fd.unstable_batchedUpdates(()=>{S({type:Cr}),E(Md.Uninitialized),Ft(null),B(null),U(null),nr.current=null;const vt=Cr===Ui.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const at=q.current[vt];at?.(Ue),C({type:vt,event:Ue})}})}}},[T]),dt=k.useCallback((Ot,$t)=>(on,Fn)=>{const dn=on.nativeEvent,Ct=T.get(Fn);if(L.current!==null||!Ct||dn.dndKit||dn.defaultPrevented)return;const xn={active:Ct};Ot(on,$t.options,xn)===!0&&(dn.dndKit={capturedBy:$t.sensor},L.current=Fn,un(on,$t))},[T,un]),Wt=Xht(u,dt);ipt(u),Tc(()=>{ne&&A===Md.Initializing&&E(Md.Initialized)},[ne,A]),k.useEffect(()=>{const{onDragMove:Ot}=q.current,{active:$t,activatorEvent:on,collisions:Fn,over:dn}=re.current;if(!$t||!on)return;const Ct={active:$t,activatorEvent:on,collisions:Fn,delta:{x:He.x,y:He.y},over:dn};Fd.unstable_batchedUpdates(()=>{Ot?.(Ct),C({type:"onDragMove",event:Ct})})},[He.x,He.y]),k.useEffect(()=>{const{active:Ot,activatorEvent:$t,collisions:on,droppableContainers:Fn,scrollAdjustedTranslate:dn}=re.current;if(!Ot||L.current==null||!$t||!dn)return;const{onDragOver:Ct}=q.current,xn=Fn.get(ct),ii=xn&&xn.rect.current?{id:xn.id,rect:xn.rect.current,data:xn.data,disabled:xn.disabled}:null,Cr={active:Ot,activatorEvent:$t,collisions:on,delta:{x:dn.x,y:dn.y},over:ii};Fd.unstable_batchedUpdates(()=>{Ft(ii),Ct?.(Cr),C({type:"onDragOver",event:Cr})})},[ct]),Tc(()=>{re.current={activatorEvent:V,active:$,activeNode:J,collisionRect:et,collisions:st,droppableRects:Y,draggableNodes:T,draggingNode:fe,draggingNodeRect:ge,droppableContainers:P,over:Ze,scrollableAncestors:Ne,scrollAdjustedTranslate:He},R.current={initial:ge,translated:et}},[$,J,st,et,T,fe,ge,Y,P,Ze,Ne,He]),qht({...Q,delta:I,draggingRect:et,pointerCoordinates:it,scrollableAncestors:Ne,scrollableAncestorRects:_e});const Mn=k.useMemo(()=>({active:$,activeNode:J,activeNodeRect:ne,activatorEvent:V,collisions:st,containerNodeRect:Z,dragOverlay:ae,draggableNodes:T,droppableContainers:P,droppableRects:Y,over:Ze,measureDroppableContainers:H,scrollableAncestors:Ne,scrollableAncestorRects:_e,measuringConfiguration:W,measuringScheduled:G,windowRect:Xe}),[$,J,ne,V,st,Z,ae,T,P,Y,Ze,H,Ne,_e,W,G,Xe]),Zn=k.useMemo(()=>({activatorEvent:V,activators:Wt,active:$,activeNodeRect:ne,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Ze,measureDroppableContainers:H}),[V,Wt,$,ne,S,X,T,Ze,H]);return Jt.createElement(eue.Provider,{value:w},Jt.createElement(D8.Provider,{value:Zn},Jt.createElement(pue.Provider,{value:Mn},Jt.createElement(mue.Provider,{value:Tt},c)),Jt.createElement(mpt,{disabled:a?.restoreFocus===!1})),Jt.createElement(ght,{...a,hiddenTextDescribedById:X}));function wr(){const Ot=z?.autoScrollEnabled===!1,$t=typeof l=="object"?l.enabled===!1:l===!1,on=O&&!Ot&&!$t;return typeof l=="object"?{...l,enabled:on}:{enabled:on}}}),xpt=k.createContext(null),YY="button",Spt="Draggable";function wpt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Ov(Spt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=k.useContext(D8),{role:g=YY,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=k.useContext(v?mue:xpt),[C,w]=Z6(),[A,E]=Z6(),O=opt(s,t),_=Sb(n);Tc(()=>(d.set(t,{id:t,key:o,node:C,activatorNode:A,data:_}),()=>{const I=d.get(t);I&&I.key===o&&d.delete(t)}),[d,t]);const T=k.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===YY?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Cpt(){return k.useContext(pue)}const Ept="Droppable",Apt={timeout:25};function kpt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Ov(Ept),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=k.useContext(D8),u=k.useRef({disabled:n}),d=k.useRef(!1),p=k.useRef(null),g=k.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Apt,...i},S=Sb(b??r),C=k.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=k8({callback:C,disabled:y||!s}),A=k.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[E,O]=Z6(A),_=Sb(t);return k.useEffect(()=>{!w||!E.current||(w.disconnect(),d.current=!1,w.observe(E.current))},[E,w]),k.useEffect(()=>(a({type:Ui.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:p,data:_}}),()=>a({type:Ui.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==u.current.disabled&&(a({type:Ui.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:p,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function gj(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Dpt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function Y5(e){return e!==null&&e>=0}function _pt(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 Opt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const gue=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=gj(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},X5={scaleX:1,scaleY:1},Tpt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...X5}:null}const l=Mpt(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...X5}:i<n&&i>=s?{x:0,y:a.height+l,...X5}:{x:0,y:0,...X5}};function Mpt(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const yue="Sortable",bue=Jt.createContext({activeIndex:-1,containerId:yue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gue,disabled:{draggable:!1,droppable:!1}});function Rpt(e){let{children:t,id:n,items:r,strategy:i=gue,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Cpt(),d=Ov(yue,n),p=a.rect!==null,g=k.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=k.useRef(g),C=!_pt(g,S.current),w=v!==-1&&b===-1||C,A=Opt(o);Tc(()=>{C&&y&&u(g)},[C,g,y,u]),k.useEffect(()=>{S.current=g},[g]);const E=k.useMemo(()=>({activeIndex:b,containerId:d,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:p,sortedRects:Dpt(g,l),strategy:i}),[b,d,A.draggable,A.droppable,w,g,v,l,p,i]);return Jt.createElement(bue.Provider,{value:E},t)}const Ipt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return gj(n,r,i).indexOf(t)},jpt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},Ppt={duration:200,easing:"ease"},vue="transform",$pt=Cb.Transition.toString({property:vue,duration:0,easing:"linear"}),Lpt={roleDescription:"sortable"};function Npt(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=k.useState(null),a=k.useRef(n);return Tc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=Dg(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),k.useEffect(()=>{o&&s(null)},[o]),o}function Fpt(e){let{animateLayoutChanges:t=jpt,attributes:n,disabled:r,data:i,getNewIndex:o=Ipt,id:s,strategy:a,resizeObserverConfig:l,transition:c=Ppt}=e;const{items:u,containerId:d,activeIndex:p,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=k.useContext(bue),w=Bpt(r,g),A=u.indexOf(s),E=k.useMemo(()=>({sortable:{containerId:d,index:A,items:u},...i}),[d,i,A,u]),O=k.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:T,isOver:I,setNodeRef:P}=kpt({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:N,activatorEvent:R,activeNodeRect:$,attributes:L,setNodeRef:z,listeners:B,isDragging:V,over:U,setActivatorNodeRef:q,transform:X}=wpt({id:s,data:E,attributes:{...Lpt,...n},disabled:w.draggable}),F=rht(P,z),W=!!N,Y=W&&!y&&Y5(p)&&Y5(v),H=!S&&V,G=H&&Y?X:null,oe=Y?G??(a??C)({rects:b,activeNodeRect:$,activeIndex:p,overIndex:v,index:A}):null,Q=Y5(p)&&Y5(v)?o({id:s,items:u,activeIndex:p,overIndex:v}):A,ie=N?.id,ne=k.useRef({activeId:ie,items:u,newIndex:Q,containerId:d}),Z=u!==ne.current.items,re=t({active:N,containerId:d,isDragging:V,isSorting:W,id:s,index:A,items:u,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),ee=Npt({disabled:!re,index:A,node:T,rect:_});return k.useEffect(()=>{W&&ne.current.newIndex!==Q&&(ne.current.newIndex=Q),d!==ne.current.containerId&&(ne.current.containerId=d),u!==ne.current.items&&(ne.current.items=u)},[W,Q,d,u]),k.useEffect(()=>{if(ie===ne.current.activeId)return;if(ie!=null&&ne.current.activeId==null){ne.current.activeId=ie;return}const fe=setTimeout(()=>{ne.current.activeId=ie},50);return()=>clearTimeout(fe)},[ie]),{active:N,activeIndex:p,attributes:L,data:E,rect:_,index:A,newIndex:Q,items:u,isOver:I,isSorting:W,isDragging:V,listeners:B,node:T,overIndex:v,over:U,setNodeRef:F,setActivatorNodeRef:q,setDroppableNodeRef:P,setDraggableNodeRef:z,transform:ee??oe,transition:ae()};function ae(){if(ee||Z&&ne.current.newIndex===A)return $pt;if(!(H&&!dj(R)||!c)&&(W||re))return Cb.Transition.toString({...c,property:vue})}}function Bpt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function tw(e){if(!e)return!1;const 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)}const zpt=[zn.Down,zn.Right,zn.Up,zn.Left],Hpt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(zpt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=i.get(d.id);if(p)switch(e.code){case zn.Down:r.top<p.top&&l.push(d);break;case zn.Up:r.top>p.top&&l.push(d);break;case zn.Left:r.left>p.left&&l.push(d);break;case zn.Right:r.left<p.left&&l.push(d);break}});const c=xht({collisionRect:r,droppableRects:i,droppableContainers:l});let u=rue(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const d=o.get(n.id),p=o.get(u),g=p?i.get(p.id):null,y=p?.node.current;if(y&&g&&d&&p){const v=A8(y).some((O,_)=>a[_]!==O),S=xue(d,p),C=Upt(d,p),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:wb(A,w)}}}};function xue(e,t){return!tw(e)||!tw(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Upt(e,t){return!tw(e)||!tw(t)||!xue(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Vpt=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=Fpt({id:e.id}),[l,c]=k.useState(!1);k.useEffect(()=>{oC(e.id).then(c)},[e.id]);const u={transform:Cb.Transform.toString(o),transition:s,opacity:a?.5:1};return h.jsx(Nn,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:h.jsxs(Xn,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[h.jsx(le,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:h.jsx(hke,{})}),h.jsx(gt,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?h.jsx(le,{component:"img",src:S2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(yl,{sx:{bgcolor:SM(e),width:40,height:40,boxShadow:2},children:(()=>{const d=xM(e);return h.jsx(d,{sx:{fontSize:24}})})()}),h.jsxs(le,{sx:{flex:1},children:[h.jsx(se,{variant:"subtitle1",fontWeight:500,children:e.name}),h.jsxs(se,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Wpt=()=>{const{t:e}=Qt(),t=Mc(),{content:n,isLoading:r}=ig(),i=jAe(),[o,s]=k.useState([]),[a,l]=k.useState(!1);k.useEffect(()=>{if(n){const g=[...n].sort((y,b)=>{const v=y.priority??100,S=b.priority??100;return v-S});s(g),l(!1)}},[n]);const c=yht(LY(mj),LY(hj,{coordinateGetter:Hpt})),u=k.useCallback(g=>{const{active:y,over:b}=g;b&&y.id!==b.id&&(s(v=>{const S=v.findIndex(w=>w.id===y.id),C=v.findIndex(w=>w.id===b.id);return gj(v,S,C)}),l(!0))},[]),d=k.useCallback(async()=>{const g=o.map((y,b)=>({id:y.id,priority:(b+1)*10}));try{await i(g),t.show({message:e("startup.saveSuccess"),severity:"success"}),l(!1)}catch(y){t.show({message:y instanceof Error?y.message:e("startup.saveFailed"),severity:"error"})}},[o,i,t,e]),p=k.useMemo(()=>o.map(g=>g.id),[o]);return r?h.jsxs(se,{children:[e("common.loading"),"..."]}):h.jsxs(Lt,{spacing:3,children:[h.jsx(Nb,{items:[{name:e("nav.bridges"),to:Dt.bridges},{name:e("startup.title"),to:Dt.startup}]}),h.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[h.jsx(ng,{color:"primary",fontSize:"large"}),h.jsxs(le,{children:[h.jsx(se,{variant:"h5",fontWeight:600,children:e("startup.title")}),h.jsx(se,{variant:"body2",color:"text.secondary",children:e("startup.description")})]})]}),a&&h.jsx(Ht,{severity:"info",action:h.jsx(Ye,{color:"inherit",size:"small",startIcon:h.jsx(TS,{}),onClick:d,children:e("startup.saveChanges")}),children:e("startup.unsavedChanges")}),h.jsx(vpt,{sensors:c,collisionDetection:vht,onDragEnd:u,children:h.jsx(Rpt,{items:p,strategy:Tpt,children:h.jsx(Lt,{spacing:1,children:o.map((g,y)=>h.jsx(Vpt,{bridge:g,index:y},g.id))})})}),o.length===0&&h.jsx(se,{color:"text.secondary",textAlign:"center",py:4,children:e("startup.noBridges")}),a&&o.length>0&&h.jsx(le,{display:"flex",justifyContent:"flex-end",children:h.jsx(Ye,{variant:"contained",startIcon:h.jsx(TS,{}),onClick:d,children:e("startup.saveOrder")})})]})},Nk="https://riddix.github.io/home-assistant-matter-hub",Dt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",areaSetup:"/bridges/area-setup",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:Nk,faq:{multiFabric:`${Nk}/connect-multiple-fabrics`,bridgeConfig:`${Nk}/bridge-configuration`}},qpt=[{path:"",element:h.jsx(I5e,{}),children:[{path:"",element:h.jsx(TDe,{})},{path:Dt.bridges,element:h.jsx(EDe,{})},{path:Dt.createBridge,element:h.jsx(xot,{})},{path:Dt.areaSetup,element:h.jsx(cSe,{})},{path:Dt.bridge(":bridgeId"),element:h.jsx(XAe,{})},{path:Dt.editBridge(":bridgeId"),element:h.jsx(Sot,{})},{path:Dt.devices,element:h.jsx(KDe,{})},{path:Dt.networkMap,element:h.jsx(Jft,{})},{path:Dt.health,element:h.jsx(Tot,{})},{path:Dt.labels,element:h.jsx(jot,{})},{path:Dt.lockCredentials,element:h.jsx(Bot,{})},{path:Dt.settings,element:h.jsx(nht,{})},{path:Dt.startup,element:h.jsx(Wpt,{})},{path:"*",element:h.jsx(zot,{})}]}],Gpt={items:{isInitialized:!1,isLoading:!1}},Kpt=_T(Gpt,e=>{e.addCase(Ro.pending,t=>{t.items.isLoading=!0}).addCase(Ro.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Ro.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(hZ.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(mZ.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(gZ.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(pZ.fulfilled,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.meta.arg);r!==-1&&t.items.content.splice(r,1)}}).addCase(yZ,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(bZ,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.payload.id);r!==-1?t.items.content[r]=n.payload:t.items.content.push(n.payload)}})}),Ypt={byBridge:{}},Xpt=_T(Ypt,e=>{e.addCase(Au.pending,(t,n)=>{t.byBridge[n.meta.arg]=Fk(t.byBridge[n.meta.arg],n)}).addCase(Au.rejected,(t,n)=>{t.byBridge[n.meta.arg]=Fk(t.byBridge[n.meta.arg],n)}).addCase(Au.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=Fk(t.byBridge[n.meta.arg],n)})}),Jpt={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},Fk=_T(Jpt,e=>{e.addCase(Au.pending,t=>{t.isLoading=!0}).addCase(Au.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(Au.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),Zpt=p5e({reducer:{bridges:Kpt,devices:Xpt}}),yj=Zbe({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${be(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>ot({props:e,name:"MuiContainer"})});function Qpt(e){return tt("MuiToolbar",e)}rt("MuiToolbar",["root","gutters","regular","dense"]);const emt=e=>{const{classes:t,disableGutters:n,variant:r}=e;return nt({root:["root",!n&&"gutters",r]},Qpt,t)},tmt=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(We(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.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}]}))),Sue=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=emt(c);return h.jsx(tmt,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})});class nmt extends k.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n.componentStack)}render(){return this.state.hasError?h.jsxs(le,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[h.jsx(HT,{color:"error",sx:{fontSize:64}}),h.jsx(se,{variant:"h5",fontWeight:600,children:hi.t("errorBoundary.title")}),h.jsx(se,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??hi.t("errorBoundary.fallbackMessage")}),h.jsx(Ye,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:hi.t("errorBoundary.reload")})]}):this.props.children}}function rmt(e){return tt("MuiFab",e)}const XY=rt("MuiFab",["root","primary","secondary","extended","circular","focusVisible","disabled","colorInherit","sizeSmall","sizeMedium","sizeLarge","info","error","warning","success"]),imt=e=>{const{color:t,variant:n,classes:r,size:i}=e,o={root:["root",n,`size${be(i)}`,t==="inherit"?"colorInherit":t]},s=nt(o,rmt,r);return{...r,...s}},omt=me(Ys,{name:"MuiFab",slot:"Root",shouldForwardProp:e=>$i(e)||e==="classes",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${be(n.size)}`],n.color==="inherit"&&t.colorInherit,t[be(n.size)],t[n.color]]}})(We(({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"},[`&.${XY.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"}}]})),We(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Ln(["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}}}}))]})),We(({theme:e})=>({[`&.${XY.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),smt=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiFab"}),{children:i,className:o,color:s="default",component:a="button",disabled:l=!1,disableFocusRipple:c=!1,focusVisibleClassName:u,size:d="large",variant:p="circular",...g}=r,y={...r,color:s,component:a,disabled:l,disableFocusRipple:c,size:d,variant:p},b=imt(y);return h.jsx(omt,{className:Oe(b.root,o),component:a,disabled:l,focusRipple:!c,focusVisibleClassName:Oe(b.focusVisible,u),ownerState:y,ref:n,...g,classes:b,children:i})}),amt=[{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:"zh",flag:"🇨🇳",name:"中文"},{code:"th",flag:"🇹🇭",name:"ไทย"},{code:"sv",flag:"🇸🇪",name:"Svenska"}],lmt="hamh-custom-languages";function cmt(){try{const e=localStorage.getItem(lmt);return e?JSON.parse(e).map(n=>({code:n.code,flag:"🌐",name:n.name})):[]}catch{return[]}}const umt="https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement";function dmt(){const{t:e,i18n:t}=Qt(),[n,r]=k.useState(!1),i=k.useRef(null),o=k.useMemo(()=>[...amt,...cmt()],[]),s=t.language?.split("-")[0]??"en",a=k.useCallback(()=>{r(u=>!u)},[]),l=k.useCallback(u=>{t.changeLanguage(u),r(!1)},[t]),c=k.useCallback(()=>{r(!1)},[]);return h.jsx(VJ,{onClickAway:c,children:h.jsxs(le,{children:[h.jsx(smt,{ref:i,size:"small",color:"primary",onClick:a,"aria-label":"Change language",sx:{position:"fixed",bottom:24,right:24,zIndex:1300},children:h.jsx(xke,{})}),h.jsx(zb,{open:n,anchorEl:i.current,placement:"top-end",transition:!0,sx:{zIndex:1300},children:({TransitionProps:u})=>h.jsx(wS,{...u,timeout:200,children:h.jsxs(Ur,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:"hidden"},children:[o.map(d=>h.jsxs(le,{onClick:()=>l(d.code),sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,cursor:"pointer",bgcolor:s===d.code?"action.selected":"transparent","&:hover":{bgcolor:"action.hover"},transition:"background-color 0.15s"},children:[h.jsx(se,{sx:{fontSize:"1.4rem",lineHeight:1,userSelect:"none"},children:d.flag}),h.jsx(se,{variant:"body2",fontWeight:s===d.code?600:400,children:d.name})]},d.code)),h.jsx(Vr,{}),h.jsxs(le,{sx:{display:"flex",alignItems:"flex-start",gap:.75,px:2,py:1},children:[h.jsx(IT,{sx:{fontSize:14,mt:.25,color:"text.secondary"}}),h.jsxs(se,{variant:"caption",color:"text.secondary",sx:{lineHeight:1.4},children:[e("languageSwitcher.disclaimer")," ",h.jsx(Lb,{href:umt,target:"_blank",rel:"noopener",sx:{fontSize:"inherit"},children:e("languageSwitcher.contribute")})]})]})]})})})]})})}const fmt="home-assistant-matter-hub",hmt={name:fmt};function wue(){const e="2.1.0-alpha.473",[t,n]=k.useState(null);k.useEffect(()=>{fetch("api/health").then(i=>i.ok?i.json():null).then(i=>{i?.version&&n(i.version)}).catch(()=>{})},[]);const r=k.useMemo(()=>!t||e==="0.0.0-dev"?!1:e!==t,[t]);return k.useMemo(()=>({name:hmt.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}const pmt=()=>{const{t:e}=Qt(),t=[{name:e("footer.github"),url:Dt.githubRepository},{name:e("footer.documentation"),url:Dt.documentation}];return h.jsxs(yj,{sx:{mt:16,mb:4},children:[h.jsx(Vr,{sx:{mt:4,mb:4}}),h.jsx(lt,{container:!0,spacing:2,justifyContent:"center",children:t.map((n,r)=>h.jsx(lt,{size:{xs:12,sm:"auto"},children:h.jsx(Ye,{fullWidth:!0,size:"small",variant:"outlined",component:Lb,href:n.url,target:"_blank",children:n.name})},r.toString()))})]})};function mmt(e){return tt("MuiAppBar",e)}rt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const gmt=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${be(t)}`,`position${be(n)}`]};return nt(i,mmt,r)},JY=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,ymt=me(Ur,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${be(n.position)}`],t[`color${be(n.color)}`]]}})(We(({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(Ln(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?JY(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?JY(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"})}}]}))),bmt=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=gmt(c);return h.jsx(ymt,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function vmt(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=ml(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function xmt(e){return typeof e=="function"?e():e}function J5(e,t,n){const r=xmt(n),i=vmt(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Smt=k.forwardRef(function(t,n){const r=co(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:d=i,in:p,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Ua,...O}=t,_=k.useRef(null),T=$r(Of(l),_,n),I=U=>q=>{U&&(q===void 0?U(_.current):U(_.current,q))},P=I((U,q)=>{J5(u,U,c),CT(U),g&&g(U,q)}),N=I((U,q)=>{const X=uf({timeout:A,style:w,easing:d},{mode:"enter"});U.style.webkitTransition=r.transitions.create("-webkit-transform",{...X}),U.style.transition=r.transitions.create("transform",{...X}),U.style.webkitTransform="none",U.style.transform="none",b&&b(U,q)}),R=I(y),$=I(C),L=I(U=>{const q=uf({timeout:A,style:w,easing:d},{mode:"exit"});U.style.webkitTransition=r.transitions.create("-webkit-transform",q),U.style.transition=r.transitions.create("transform",q),J5(u,U,c),v&&v(U)}),z=I(U=>{U.style.webkitTransition="",U.style.transition="",S&&S(U)}),B=U=>{s&&s(_.current,U)},V=k.useCallback(()=>{_.current&&J5(u,_.current,c)},[u,c]);return k.useEffect(()=>{if(p||u==="down"||u==="right")return;const U=vT(()=>{_.current&&J5(u,_.current,c)}),q=ml(_.current);return q.addEventListener("resize",U),()=>{U.clear(),q.removeEventListener("resize",U)}},[u,p,c]),k.useEffect(()=>{p||V()},[p,V]),h.jsx(E,{nodeRef:_,onEnter:P,onEntered:R,onEntering:N,onExit:L,onExited:z,onExiting:$,addEndListener:B,appear:a,in:p,timeout:A,...O,children:(U,{ownerState:q,...X})=>k.cloneElement(l,{ref:T,style:{visibility:U==="exited"&&!p?"hidden":void 0,...w,...l.props.style},...X})})});function wmt(e){return tt("MuiDrawer",e)}rt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Cue=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},Cmt=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${be(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${be(n)}`,r!=="temporary"&&`paperAnchorDocked${be(n)}`]};return nt(i,wmt,t)},Emt=me(WT,{name:"MuiDrawer",slot:"Root",overridesResolver:Cue})(We(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Amt=me("div",{shouldForwardProp:$i,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Cue})({flex:"0 0 auto"}),kmt=me(Ur,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${be(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${be(n.anchor)}`]]}})(We(({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:t})=>t.anchor==="left"&&t.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="top"&&t.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="right"&&t.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="bottom"&&t.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Eue={left:"right",right:"left",top:"down",bottom:"up"};function Dmt(e){return["left","right"].includes(e)}function _mt({direction:e},t){return e==="rtl"&&Dmt(t)?Eue[t]:t}const Omt=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiDrawer"}),i=co(),o=_f(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:d=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:O={},slotProps:_={},...T}=r,I=k.useRef(!1);k.useEffect(()=>{I.current=!0},[]);const P=_mt({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:d,open:v,variant:E,...T},$=Cmt(R),L={slots:{transition:w,...O},slotProps:{paper:S,transition:C,..._,backdrop:xT(_.backdrop||{...l,...g},{transitionDuration:A})}},[z,B]=ft("root",{ref:n,elementType:Emt,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...L,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:p,slots:{backdrop:L.slots.backdrop},slotProps:{backdrop:L.slotProps.backdrop}}}),[V,U]=ft("paper",{elementType:kmt,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:R,externalForwardedProps:L,additionalProps:{elevation:E==="temporary"?d:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[q,X]=ft("docked",{elementType:Amt,ref:n,className:Oe($.root,$.docked,u),ownerState:R,externalForwardedProps:L,additionalProps:T}),[F,W]=ft("transition",{elementType:Smt,ownerState:R,externalForwardedProps:L,additionalProps:{in:v,direction:Eue[P],timeout:A,appear:I.current}}),Y=h.jsx(V,{...U,children:c});if(E==="permanent")return h.jsx(q,{...X,children:Y});const H=h.jsx(F,{...W,children:Y});return E==="persistent"?h.jsx(q,{...X,children:H}):h.jsx(z,{...B,children:H})}),Tmt=wJ({themeId:Aa}),Mmt={error:Rf,warn:Lw,info:UT,debug:nC},Rmt=({open:e,onClose:t})=>{const{t:n}=Qt(),r=co(),i=k.useMemo(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[o,s]=k.useState([]),[a,l]=k.useState(!0),[c,u]=k.useState("error,warn,info".split(",")),[d,p]=k.useState(""),[g,y]=k.useState(!0),b=k.useCallback(async()=>{try{const A=new URLSearchParams({level:c.join(","),limit:"500",...d&&{search:d}}),E=await fetch(`api/logs?${A}`);if(E.ok){const O=await E.json();s(O.entries)}}catch(A){console.error("Failed to fetch logs:",A)}finally{l(!1)}},[c,d]);k.useEffect(()=>{e&&b()},[e,b]),k.useEffect(()=>{if(!g||!e)return;const A=setInterval(b,5e3);return()=>clearInterval(A)},[g,e,b]);const v=A=>{u(Array.isArray(A.target.value)?A.target.value:[A.target.value])},S=A=>{p(A.target.value)},C=async()=>{try{await fetch("api/logs",{method:"DELETE"}),s([])}catch(A){console.error("Failed to clear logs:",A)}},w=A=>{const E=Mmt[A]||UT;return h.jsx(E,{sx:{fontSize:16,color:i[A]}})};return h.jsxs(Zs,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(ea,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(nC,{}),n("logs.title"),h.jsx(le,{sx:{flexGrow:1}}),h.jsx(Ut,{title:n("logs.autoRefresh"),children:h.jsx(gt,{label:g?"Auto":"Manual",color:g?"success":"default",size:"small",onClick:()=>y(!g),sx:{cursor:"pointer"}})}),h.jsx(Kt,{onClick:t,children:h.jsx(GQ,{})})]}),h.jsxs(Qs,{children:[h.jsx(Lt,{spacing:2,sx:{mb:2},children:h.jsxs(Lt,{direction:"row",spacing:2,alignItems:"center",children:[h.jsxs(hs,{size:"small",sx:{minWidth:200},children:[h.jsx(ul,{children:n("logs.logLevel")}),h.jsxs(us,{value:c,label:n("logs.logLevel"),onChange:v,multiple:!0,renderValue:A=>h.jsx(le,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(A)?A:[A]).map(E=>h.jsx(gt,{label:E.toUpperCase(),size:"small",sx:{backgroundColor:i[E],color:"white"}},E))}),children:[h.jsx(Un,{value:"error",children:n("logs.error")}),h.jsx(Un,{value:"warn",children:n("logs.warning")}),h.jsx(Un,{value:"info",children:n("logs.info")}),h.jsx(Un,{value:"debug",children:n("logs.debug")})]})]}),h.jsx(lr,{size:"small",placeholder:n("logs.searchPlaceholder"),value:d,onChange:S,sx:{flexGrow:1}}),h.jsx(Ye,{variant:"outlined",onClick:b,children:n("common.refresh")}),h.jsx(Ye,{variant:"outlined",color:"error",onClick:C,children:n("common.delete")})]})}),h.jsx(le,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:a?h.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsxs(se,{children:[n("common.loading"),"..."]})}):o.length===0?h.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(se,{color:"text.secondary",children:n("logs.noResults")})}):h.jsx(Lt,{spacing:1,children:o.map((A,E)=>h.jsxs(le,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[h.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[w(A.level),h.jsx(se,{variant:"caption",color:"text.secondary",children:new Date(A.timestamp).toLocaleString()}),h.jsx(gt,{label:A.level.toUpperCase(),size:"small",sx:{backgroundColor:i[A.level],color:r.palette.getContrastText(i[A.level]??r.palette.grey[500]),fontSize:"0.7rem",height:20}})]}),h.jsx(se,{sx:{ml:3},children:A.message}),A.context&&h.jsx(se,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(A.context,null,2)})]},`${A.timestamp}-${A.level}-${E}`))})})]}),h.jsx(Ia,{children:h.jsx(Ye,{onClick:t,children:n("common.close")})})]})};function ZY(){const{t:e}=Qt(),{isConnected:t}=xZ(),[n,r]=k.useState(null),[i,o]=k.useState(!1);k.useEffect(()=>{const b=async()=>{try{const S=await fetch("api/health");if(S.ok){const C=await S.json();r(C),o(!1)}else o(!0)}catch{o(!0)}};b();const v=setInterval(b,3e4);return()=>clearInterval(v)},[]);const s=b=>{const v=Math.floor(b/3600),S=Math.floor(b%3600/60);return v>0?`${v}h ${S}m`:`${S}m`},a=n?.status==="healthy"&&!i,l=n?.services?.bridges,c=l&&l.total>0&&l.running===l.total,u=l&&l.total===0,d=n?h.jsxs(le,{sx:{p:.5},children:[h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.version"),":"]})," ",n.version??e("status.unknown")]}),h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.uptime"),":"]})," ",s(n.uptime??0)]}),n.services?.bridges&&h.jsxs("div",{children:[h.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&&h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.homeAssistant"),":"]})," ",n.services.homeAssistant.connected?e("health.connected"):e("health.disconnected")]}),h.jsxs("div",{children:[h.jsx("strong",{children:"WebSocket:"})," ",e(t?"health.connected":"health.disconnected")]})]}):e("status.loadingHealth"),p=()=>i||!a?h.jsx(Rf,{fontSize:"small"}):c?h.jsx(Va,{fontSize:"small"}):h.jsx(zw,{fontSize:"small"}),g=()=>i||!a?"error":!c||!t?"warning":"success",y=()=>e(i?"status.error":a?t?u?"status.noBridges":c?"common.online":"common.starting":"common.offline":"status.unhealthy");return h.jsx(Ut,{title:d,arrow:!0,children:h.jsx(gt,{icon:p(),label:y(),color:g(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Imt=e=>k.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("g",{style:{display:"inline"}},k.createElement("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"}),k.createElement("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"}))),jmt=e=>{const t=wue();return h.jsxs(le,{component:Ec,to:Dt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[h.jsx(Imt,{style:{height:"40px"}}),h.jsx(se,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(be).join("-")}),e.large&&h.jsx(se,{variant:"caption",component:"span",children:t.version})]})},Pmt=()=>{const e=Tmt("(min-width:600px)"),{mode:t,setMode:n}=Aw(),[r,i]=k.useState(!1),[o,s]=k.useState(!1),a=zu(),l=kf(),c=y=>y?y==="/"?l.pathname==="/":l.pathname.startsWith(y):!1,u=()=>{n(t==="dark"?"light":"dark")},{t:d}=Qt(),p=[{label:d("dashboard.title"),icon:h.jsx(hM,{}),to:Dt.dashboard},{label:d("nav.bridges"),icon:h.jsx(Oy,{}),to:Dt.bridges},{label:d("nav.devices"),icon:h.jsx(Js,{}),to:Dt.devices},{label:d("nav.networkMap"),icon:h.jsx(uM,{}),to:Dt.networkMap},{label:d("nav.startupOrder"),icon:h.jsx(ng,{}),to:Dt.startup},{label:d("nav.lockCredentials"),icon:h.jsx(Eu,{}),to:Dt.lockCredentials},{label:d("nav.filterReference"),icon:h.jsx(pM,{}),to:Dt.labels},{label:d("nav.settings"),icon:h.jsx(Vb,{}),to:Dt.settings},{label:d(t==="dark"?"nav.lightMode":"nav.darkMode"),icon:t==="dark"?h.jsx(wke,{}):h.jsx(uke,{}),onClick:u},{label:d("nav.systemLogs"),icon:h.jsx(nC,{}),onClick:()=>i(!0)},{label:d("nav.health"),icon:h.jsx(GT,{}),to:Dt.health}],g=y=>{s(!1),y.onClick?y.onClick():y.to&&a(y.to)};return h.jsxs(le,{children:[h.jsx(bmt,{sx:{height:"72px"},children:h.jsx(Sue,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:h.jsxs(yj,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx(jmt,{large:e}),e?h.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.map(y=>y.to?h.jsx(Ut,{title:y.label,children:h.jsx(Kt,{component:Ec,to:y.to,sx:{color:"inherit",bgcolor:c(y.to)?"rgba(255,255,255,0.15)":"transparent",borderRadius:1},children:y.icon})},y.label):h.jsx(Ut,{title:y.label,children:h.jsx(Kt,{onClick:y.onClick,sx:{color:"inherit"},children:y.icon})},y.label)),h.jsx(ZY,{})]}):h.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(ZY,{}),h.jsx(Kt,{onClick:()=>s(!0),sx:{color:"inherit"},children:h.jsx(Cke,{})})]})]})})}),h.jsx(Omt,{anchor:"right",open:o,onClose:()=>s(!1),children:h.jsx(Cl,{sx:{width:250},children:p.map(y=>h.jsxs(kSe,{selected:c(y.to),onClick:()=>g(y),children:[h.jsx(xa,{children:y.icon}),h.jsx(Vs,{primary:y.label})]},y.label))})}),h.jsx(Rmt,{open:r,onClose:()=>i(!1)})]})},$mt=()=>{const{versionMismatch:e,frontendVersion:t,backendVersion:n}=wue(),{isConnected:r}=xZ();return h.jsxs(le,{children:[h.jsx(Pmt,{}),h.jsx(Sue,{}),e&&h.jsxs(Ht,{severity:"warning",variant:"filled",sx:{borderRadius:0},action:h.jsx(Ye,{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&&h.jsx(Ht,{severity:"error",variant:"filled",sx:{borderRadius:0},children:"Connection lost — data may be outdated. Reconnecting…"}),h.jsx(yj,{sx:{p:2},children:h.jsx(nmt,{children:h.jsx(OX,{})})}),h.jsx(pmt,{}),h.jsx(dmt,{})]})},Lmt=ww({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"}}}}});let Z4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");Z4?.startsWith("http")&&(Z4=new URL(Z4).pathname);const Nmt=Sme([{path:"/",element:h.jsx($mt,{}),children:qpt}],{basename:Z4});Ffe.createRoot(document.getElementById("root")).render(h.jsx(k.StrictMode,{children:h.jsx(nhe,{store:Zpt,children:h.jsxs(cxe,{theme:Lmt,children:[h.jsx(ixe,{}),h.jsx(LJ,{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}}}),h.jsx(R5e,{children:h.jsx(C3e,{children:h.jsx(Ime,{router:Nmt})})})]})})}));
499
+ `},mht={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 ght(e){let{announcements:t=mht,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=pht}=e;const{announce:o,announcement:s}=dht(),a=Ov("DndLiveRegion"),[l,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),fht(k.useMemo(()=>({onDragStart(d){let{active:p}=d;o(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:g}=d;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(d){let{active:p,over:g}=d;o(t.onDragOver({active:p,over:g}))},onDragEnd(d){let{active:p,over:g}=d;o(t.onDragEnd({active:p,over:g}))},onDragCancel(d){let{active:p,over:g}=d;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!l)return null;const u=Jt.createElement(Jt.Fragment,null,Jt.createElement(cht,{id:r,value:i.draggable}),Jt.createElement(uht,{id:a,announcement:s}));return n?Fd.createPortal(u,n):u}var Ui;(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"})(Ui||(Ui={}));function Q6(){}function LY(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function yht(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const xl=Object.freeze({x:0,y:0});function tue(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function bht(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function NY(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 rue(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function FY(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}}const vht=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=FY(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=tue(FY(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(nue)},xht=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=NY(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=NY(l),u=i.reduce((p,g,y)=>p+tue(c[y],g),0),d=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:d}})}}return o.sort(nue)};function Sht(e,t){const 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),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const wht=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Sht(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(bht)};function Cht(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function iue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xl}function Eht(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return i.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Aht=Eht(1);function kht(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Dht(e,t,n){const r=kht(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const _ht={ignoreTransform:!1};function Dg(e,t){t===void 0&&(t=_ht);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Cs(e).getComputedStyle(e);c&&(n=Dht(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function BY(e){return Dg(e,{ignoreTransform:!0})}function Oht(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Tht(e,t){return t===void 0&&(t=Cs(e).getComputedStyle(e)),t.position==="fixed"}function Mht(e,t){t===void 0&&(t=Cs(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function A8(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(cj(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Dv(i)||Zce(i)||n.includes(i))return n;const o=Cs(e).getComputedStyle(i);return i!==e&&Mht(i,o)&&n.push(i),Tht(i,o)?n:r(i.parentNode)}return e?r(e):n}function oue(e){const[t]=A8(e,1);return t??null}function Pk(e){return!E8||!e?null:Ag(e)?e:lj(e)?cj(e)||e===kg(e).scrollingElement?window:Dv(e)?e:null:null}function sue(e){return Ag(e)?e.scrollX:e.scrollLeft}function aue(e){return Ag(e)?e.scrollY:e.scrollTop}function BO(e){return{x:sue(e),y:aue(e)}}var no;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(no||(no={}));function lue(e){return!E8||!e?!1:e===document.scrollingElement}function cue(e){const t={x:0,y:0},n=lue(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const Rht={x:.2,y:.2};function Iht(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Rht);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=cue(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=no.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=no.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!p&&a>=t.right-b.width?(g.x=no.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!d&&s<=t.left+b.width&&(g.x=no.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function jht(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{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 uue(e){return e.reduce((t,n)=>y0(t,BO(n)),xl)}function Pht(e){return e.reduce((t,n)=>t+sue(n),0)}function $ht(e){return e.reduce((t,n)=>t+aue(n),0)}function Lht(e,t){if(t===void 0&&(t=Dg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);oue(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Nht=[["x",["left","right"],Pht],["y",["top","bottom"],$ht]];class fj{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=A8(n),i=uue(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of Nht)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Jy{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Fht(e){const{EventTarget:t}=Cs(e);return e instanceof t?e:kg(e)}function $k(e,t){const 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 ga;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ga||(ga={}));function zY(e){e.preventDefault()}function Bht(e){e.stopPropagation()}var zn;(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"})(zn||(zn={}));const due={start:[zn.Space,zn.Enter],cancel:[zn.Esc],end:[zn.Space,zn.Enter,zn.Tab]},zht=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case zn.Right:return{...n,x:n.x+25};case zn.Left:return{...n,x:n.x-25};case zn.Down:return{...n,y:n.y+25};case zn.Up:return{...n,y:n.y-25}}};class hj{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Jy(kg(n)),this.windowListeners=new Jy(Cs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ga.Resize,this.handleCancel),this.windowListeners.add(ga.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ga.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Lht(r),n(xl)}handleKeyDown(t){if(dj(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=due,coordinateGetter:s=zht,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:xl;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=wb(d,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:A,maxScroll:E,minScroll:O}=cue(b),_=jht(b),T={x:Math.min(v===zn.Right?_.right-_.width/2:_.right,Math.max(v===zn.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(v===zn.Down?_.bottom-_.height/2:_.bottom,Math.max(v===zn.Down?_.top:_.top+_.height/2,d.y))},I=v===zn.Right&&!C||v===zn.Left&&!w,P=v===zn.Down&&!A||v===zn.Up&&!S;if(I&&T.x!==d.x){const N=b.scrollLeft+p.x,R=v===zn.Right&&N<=E.x||v===zn.Left&&N>=O.x;if(R&&!p.y){b.scrollTo({left:N,behavior:a});return}R?g.x=b.scrollLeft-N:g.x=v===zn.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(P&&T.y!==d.y){const N=b.scrollTop+p.y,R=v===zn.Down&&N<=E.y||v===zn.Up&&N>=O.y;if(R&&!p.x){b.scrollTo({top:N,behavior:a});return}R?g.y=b.scrollTop-N:g.y=v===zn.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,y0(wb(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}hj.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=due,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function HY(e){return!!(e&&"distance"in e)}function UY(e){return!!(e&&"delay"in e)}class pj{constructor(t,n,r){var i;r===void 0&&(r=Fht(t.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=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=kg(s),this.documentListeners=new Jy(this.document),this.listeners=new Jy(r),this.windowListeners=new Jy(Cs(s)),this.initialCoordinates=(i=FO(o))!=null?i:xl,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ga.Resize,this.handleCancel),this.windowListeners.add(ga.DragStart,zY),this.windowListeners.add(ga.VisibilityChange,this.handleCancel),this.windowListeners.add(ga.ContextMenu,zY),this.documentListeners.add(ga.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(UY(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(HY(n)){this.handlePending(n);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(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ga.Click,Bht,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ga.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=FO(t))!=null?n:xl,c=wb(i,l);if(!r&&a){if(HY(a)){if(a.tolerance!=null&&$k(c,a.tolerance))return this.handleCancel();if($k(c,a.distance))return this.handleStart()}if(UY(a)&&$k(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===zn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Hht={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class mj extends pj{constructor(t){const{event:n}=t,r=kg(n.target);super(t,Hht,r)}}mj.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Uht={move:{name:"mousemove"},end:{name:"mouseup"}};var zO;(function(e){e[e.RightClick=2]="RightClick"})(zO||(zO={}));class Vht extends pj{constructor(t){super(t,Uht,kg(t.event.target))}}Vht.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===zO.RightClick?!1:(r?.({event:n}),!0)}}];const Lk={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wht extends pj{constructor(t){super(t,Lk)}static setup(){return window.addEventListener(Lk.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lk.move.name,t)};function t(){}}}Wht.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Zy;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Zy||(Zy={}));var ew;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ew||(ew={}));function qht(e){let{acceleration:t,activator:n=Zy.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=ew.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const g=Kht({delta:d,disabled:!o}),[y,b]=iht(),v=k.useRef({x:0,y:0}),S=k.useRef({x:0,y:0}),C=k.useMemo(()=>{switch(n){case Zy.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Zy.DraggableRect:return i}},[n,i,l]),w=k.useRef(null),A=k.useCallback(()=>{const O=w.current;if(!O)return;const _=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(_,T)},[]),E=k.useMemo(()=>a===ew.TreeOrder?[...c].reverse():c,[a,c]);k.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const _=c.indexOf(O),T=u[_];if(!T)continue;const{direction:I,speed:P}=Iht(O,T,C,t,p);for(const N of["x","y"])g[N][I[N]]||(P[N]=0,I[N]=0);if(P.x>0||P.y>0){b(),w.current=O,y(A,s),v.current=P,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,A,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(p)])}const Ght={x:{[no.Backward]:!1,[no.Forward]:!1},y:{[no.Backward]:!1,[no.Forward]:!1}};function Kht(e){let{delta:t,disabled:n}=e;const r=NO(t);return _v(i=>{if(n||!r||!i)return Ght;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[no.Backward]:i.x[no.Backward]||o.x===-1,[no.Forward]:i.x[no.Forward]||o.x===1},y:{[no.Backward]:i.y[no.Backward]||o.y===-1,[no.Forward]:i.y[no.Forward]||o.y===1}}},[n,t,r])}function Yht(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return _v(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Xht(e,t){return k.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var Eb;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Eb||(Eb={}));var HO;(function(e){e.Optimized="optimized"})(HO||(HO={}));const VY=new Map;function Jht(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=k.useState(null),{frequency:a,measure:l,strategy:c}=i,u=k.useRef(e),d=v(),p=Sb(d),g=k.useCallback(function(S){S===void 0&&(S=[]),!p.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[p]),y=k.useRef(null),b=_v(S=>{if(d&&!n)return VY;if(!S||S===VY||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const A=w.node.current,E=A?new fj(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,d,l]);return k.useEffect(()=>{u.current=e},[e]),k.useEffect(()=>{d||g()},[n,d]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{d||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,d,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case Eb.Always:return!1;case Eb.BeforeDragging:return n;default:return!n}}}function fue(e,t){return _v(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Zht(e,t){return fue(e,t)}function Qht(e){let{callback:t,disabled:n}=e;const r=uj(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return k.useEffect(()=>()=>i?.disconnect(),[i]),i}function k8(e){let{callback:t,disabled:n}=e;const r=uj(t),i=k.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return k.useEffect(()=>()=>i?.disconnect(),[i]),i}function ept(e){return new fj(Dg(e),e)}function WY(e,t,n){t===void 0&&(t=ept);const[r,i]=k.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=Qht({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){o();break}}}}),a=k8({callback:o});return Tc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function tpt(e){const t=fue(e);return iue(e,t)}const qY=[];function npt(e){const t=k.useRef(e),n=_v(r=>e?r&&r!==qY&&e&&t.current&&e.parentNode===t.current.parentNode?r:A8(e):qY,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function rpt(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=Pk(o.target);s&&n(a=>a?(a.set(s,BO(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=Pk(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,BO(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=Pk(l);c?.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>y0(o,s),xl):uue(e):xl,[e,t])}function GY(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==xl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?wb(e,n.current):xl}function ipt(e){k.useEffect(()=>{if(!E8)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function opt(e,t){return k.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function hue(e){return k.useMemo(()=>e?Oht(e):null,[e])}const KY=[];function spt(e,t){t===void 0&&(t=Dg);const[n]=e,r=hue(n?Cs(n):null),[i,o]=k.useState(KY);function s(){o(()=>e.length?e.map(l=>lue(l)?r:new fj(t(l),l)):KY)}const a=k8({callback:s});return Tc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function apt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Dv(t)?t:e}function lpt(e){let{measure:t}=e;const[n,r]=k.useState(null),i=k.useCallback(c=>{for(const{target:u}of c)if(Dv(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),o=k8({callback:i}),s=k.useCallback(c=>{const u=apt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=Z6(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const cpt=[{sensor:mj,options:{}},{sensor:hj,options:{}}],upt={current:{}},J4={draggable:{measure:BY},droppable:{measure:BY,strategy:Eb.WhileDragging,frequency:HO.Optimized},dragOverlay:{measure:Dg}};class Qy extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const dpt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qy,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Q6},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:J4,measureDroppableContainers:Q6,windowRect:null,measuringScheduled:!1},fpt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Q6,draggableNodes:new Map,over:null,measureDroppableContainers:Q6},D8=k.createContext(fpt),pue=k.createContext(dpt);function hpt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qy}}}function ppt(e,t){switch(t.type){case Ui.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ui.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 Ui.DragEnd:case Ui.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ui.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Qy(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Ui.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Qy(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Ui.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Qy(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function mpt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(D8),o=NO(r),s=NO(n?.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!dj(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=aht(u);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function gpt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function ypt(e){return k.useMemo(()=>({draggable:{...J4.draggable,...e?.draggable},droppable:{...J4.droppable,...e?.droppable},dragOverlay:{...J4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function bpt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=k.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Tc(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=iue(u,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=oue(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const mue=k.createContext({...xl,scaleX:1,scaleY:1});var Md;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Md||(Md={}));const vpt=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=cpt,collisionDetection:d=wht,measuring:p,modifiers:g,...y}=t;const b=k.useReducer(ppt,void 0,hpt),[v,S]=b,[C,w]=hht(),[A,E]=k.useState(Md.Uninitialized),O=A===Md.Initialized,{draggable:{active:_,nodes:T,translate:I},droppable:{containers:P}}=v,N=_!=null?T.get(_):null,R=k.useRef({initial:null,translated:null}),$=k.useMemo(()=>{var Ot;return _!=null?{id:_,data:(Ot=N?.data)!=null?Ot:upt,rect:R}:null},[_,N]),L=k.useRef(null),[z,B]=k.useState(null),[V,U]=k.useState(null),q=Sb(y,Object.values(y)),X=Ov("DndDescribedBy",s),F=k.useMemo(()=>P.getEnabled(),[P]),W=ypt(p),{droppableRects:Y,measureDroppableContainers:H,measuringScheduled:G}=Jht(F,{dragging:O,dependencies:[I.x,I.y],config:W.droppable}),J=Yht(T,_),oe=k.useMemo(()=>V?FO(V):null,[V]),Q=wr(),ie=Zht(J,W.draggable.measure);bpt({activeNode:_!=null?T.get(_):null,config:Q.layoutShiftCompensation,initialRect:ie,measure:W.draggable.measure});const ne=WY(J,W.draggable.measure,ie),Z=WY(J?J.parentElement:null),re=k.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ee=P.getNodeFor((n=re.current.over)==null?void 0:n.id),ae=lpt({measure:W.dragOverlay.measure}),fe=(r=ae.nodeRef.current)!=null?r:J,ge=O?(i=ae.rect)!=null?i:ne:null,Ie=!!(ae.nodeRef.current&&ae.rect),ve=tpt(Ie?null:ne),Xe=hue(fe?Cs(fe):null),Ne=npt(O?ee??J:null),_e=spt(Ne),Te=gpt(g,{transform:{x:I.x-ve.x,y:I.y-ve.y,scaleX:1,scaleY:1},activatorEvent:V,active:$,activeNodeRect:ne,containerNodeRect:Z,draggingNodeRect:ge,over:re.current.over,overlayNodeRect:ae.rect,scrollableAncestors:Ne,scrollableAncestorRects:_e,windowRect:Xe}),it=oe?y0(oe,I):null,Ke=rpt(Ne),ze=GY(Ke),je=GY(Ke,[ne]),He=y0(Te,ze),et=ge?Aht(ge,Te):null,st=$&&et?d({active:$,collisionRect:et,droppableRects:Y,droppableContainers:F,pointerCoordinates:it}):null,ct=rue(st,"id"),[Ze,Ft]=k.useState(null),Bt=Ie?Te:y0(Te,je),Tt=Cht(Bt,(o=Ze?.rect)!=null?o:null,ne),nr=k.useRef(null),un=k.useCallback((Ot,$t)=>{let{sensor:on,options:Fn}=$t;if(L.current==null)return;const dn=T.get(L.current);if(!dn)return;const Ct=Ot.nativeEvent,xn=new on({active:L.current,activeNode:dn,event:Ct,options:Fn,context:re,onAbort(Cr){if(!T.get(Cr))return;const{onDragAbort:ue}=q.current,pe={id:Cr};ue?.(pe),C({type:"onDragAbort",event:pe})},onPending(Cr,oi,ue,pe){if(!T.get(Cr))return;const{onDragPending:Fe}=q.current,Ue={id:Cr,constraint:oi,initialCoordinates:ue,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(Cr){const oi=L.current;if(oi==null)return;const ue=T.get(oi);if(!ue)return;const{onDragStart:pe}=q.current,Se={activatorEvent:Ct,active:{id:oi,data:ue.data,rect:R}};Fd.unstable_batchedUpdates(()=>{pe?.(Se),E(Md.Initializing),S({type:Ui.DragStart,initialCoordinates:Cr,active:oi}),C({type:"onDragStart",event:Se}),B(nr.current),U(Ct)})},onMove(Cr){S({type:Ui.DragMove,coordinates:Cr})},onEnd:ii(Ui.DragEnd),onCancel:ii(Ui.DragCancel)});nr.current=xn;function ii(Cr){return async function(){const{active:ue,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=re.current;let Ue=null;if(ue&&Fe){const{cancelDrop:vt}=q.current;Ue={activatorEvent:Ct,active:ue,collisions:pe,delta:Fe,over:Se},Cr===Ui.DragEnd&&typeof vt=="function"&&await Promise.resolve(vt(Ue))&&(Cr=Ui.DragCancel)}L.current=null,Fd.unstable_batchedUpdates(()=>{S({type:Cr}),E(Md.Uninitialized),Ft(null),B(null),U(null),nr.current=null;const vt=Cr===Ui.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const at=q.current[vt];at?.(Ue),C({type:vt,event:Ue})}})}}},[T]),dt=k.useCallback((Ot,$t)=>(on,Fn)=>{const dn=on.nativeEvent,Ct=T.get(Fn);if(L.current!==null||!Ct||dn.dndKit||dn.defaultPrevented)return;const xn={active:Ct};Ot(on,$t.options,xn)===!0&&(dn.dndKit={capturedBy:$t.sensor},L.current=Fn,un(on,$t))},[T,un]),Wt=Xht(u,dt);ipt(u),Tc(()=>{ne&&A===Md.Initializing&&E(Md.Initialized)},[ne,A]),k.useEffect(()=>{const{onDragMove:Ot}=q.current,{active:$t,activatorEvent:on,collisions:Fn,over:dn}=re.current;if(!$t||!on)return;const Ct={active:$t,activatorEvent:on,collisions:Fn,delta:{x:He.x,y:He.y},over:dn};Fd.unstable_batchedUpdates(()=>{Ot?.(Ct),C({type:"onDragMove",event:Ct})})},[He.x,He.y]),k.useEffect(()=>{const{active:Ot,activatorEvent:$t,collisions:on,droppableContainers:Fn,scrollAdjustedTranslate:dn}=re.current;if(!Ot||L.current==null||!$t||!dn)return;const{onDragOver:Ct}=q.current,xn=Fn.get(ct),ii=xn&&xn.rect.current?{id:xn.id,rect:xn.rect.current,data:xn.data,disabled:xn.disabled}:null,Cr={active:Ot,activatorEvent:$t,collisions:on,delta:{x:dn.x,y:dn.y},over:ii};Fd.unstable_batchedUpdates(()=>{Ft(ii),Ct?.(Cr),C({type:"onDragOver",event:Cr})})},[ct]),Tc(()=>{re.current={activatorEvent:V,active:$,activeNode:J,collisionRect:et,collisions:st,droppableRects:Y,draggableNodes:T,draggingNode:fe,draggingNodeRect:ge,droppableContainers:P,over:Ze,scrollableAncestors:Ne,scrollAdjustedTranslate:He},R.current={initial:ge,translated:et}},[$,J,st,et,T,fe,ge,Y,P,Ze,Ne,He]),qht({...Q,delta:I,draggingRect:et,pointerCoordinates:it,scrollableAncestors:Ne,scrollableAncestorRects:_e});const Mn=k.useMemo(()=>({active:$,activeNode:J,activeNodeRect:ne,activatorEvent:V,collisions:st,containerNodeRect:Z,dragOverlay:ae,draggableNodes:T,droppableContainers:P,droppableRects:Y,over:Ze,measureDroppableContainers:H,scrollableAncestors:Ne,scrollableAncestorRects:_e,measuringConfiguration:W,measuringScheduled:G,windowRect:Xe}),[$,J,ne,V,st,Z,ae,T,P,Y,Ze,H,Ne,_e,W,G,Xe]),Zn=k.useMemo(()=>({activatorEvent:V,activators:Wt,active:$,activeNodeRect:ne,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Ze,measureDroppableContainers:H}),[V,Wt,$,ne,S,X,T,Ze,H]);return Jt.createElement(eue.Provider,{value:w},Jt.createElement(D8.Provider,{value:Zn},Jt.createElement(pue.Provider,{value:Mn},Jt.createElement(mue.Provider,{value:Tt},c)),Jt.createElement(mpt,{disabled:a?.restoreFocus===!1})),Jt.createElement(ght,{...a,hiddenTextDescribedById:X}));function wr(){const Ot=z?.autoScrollEnabled===!1,$t=typeof l=="object"?l.enabled===!1:l===!1,on=O&&!Ot&&!$t;return typeof l=="object"?{...l,enabled:on}:{enabled:on}}}),xpt=k.createContext(null),YY="button",Spt="Draggable";function wpt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Ov(Spt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=k.useContext(D8),{role:g=YY,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=k.useContext(v?mue:xpt),[C,w]=Z6(),[A,E]=Z6(),O=opt(s,t),_=Sb(n);Tc(()=>(d.set(t,{id:t,key:o,node:C,activatorNode:A,data:_}),()=>{const I=d.get(t);I&&I.key===o&&d.delete(t)}),[d,t]);const T=k.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===YY?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Cpt(){return k.useContext(pue)}const Ept="Droppable",Apt={timeout:25};function kpt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Ov(Ept),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=k.useContext(D8),u=k.useRef({disabled:n}),d=k.useRef(!1),p=k.useRef(null),g=k.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Apt,...i},S=Sb(b??r),C=k.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=k8({callback:C,disabled:y||!s}),A=k.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[E,O]=Z6(A),_=Sb(t);return k.useEffect(()=>{!w||!E.current||(w.disconnect(),d.current=!1,w.observe(E.current))},[E,w]),k.useEffect(()=>(a({type:Ui.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:p,data:_}}),()=>a({type:Ui.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==u.current.disabled&&(a({type:Ui.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:p,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function gj(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Dpt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function Y5(e){return e!==null&&e>=0}function _pt(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 Opt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const gue=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=gj(t,r,n),s=t[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},X5={scaleX:1,scaleY:1},Tpt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...X5}:null}const l=Mpt(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...X5}:i<n&&i>=s?{x:0,y:a.height+l,...X5}:{x:0,y:0,...X5}};function Mpt(e,t,n){const r=e[t],i=e[t-1],o=e[t+1];return r?n<t?i?r.top-(i.top+i.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const yue="Sortable",bue=Jt.createContext({activeIndex:-1,containerId:yue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gue,disabled:{draggable:!1,droppable:!1}});function Rpt(e){let{children:t,id:n,items:r,strategy:i=gue,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Cpt(),d=Ov(yue,n),p=a.rect!==null,g=k.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=k.useRef(g),C=!_pt(g,S.current),w=v!==-1&&b===-1||C,A=Opt(o);Tc(()=>{C&&y&&u(g)},[C,g,y,u]),k.useEffect(()=>{S.current=g},[g]);const E=k.useMemo(()=>({activeIndex:b,containerId:d,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:p,sortedRects:Dpt(g,l),strategy:i}),[b,d,A.draggable,A.droppable,w,g,v,l,p,i]);return Jt.createElement(bue.Provider,{value:E},t)}const Ipt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return gj(n,r,i).indexOf(t)},jpt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},Ppt={duration:200,easing:"ease"},vue="transform",$pt=Cb.Transition.toString({property:vue,duration:0,easing:"linear"}),Lpt={roleDescription:"sortable"};function Npt(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=k.useState(null),a=k.useRef(n);return Tc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=Dg(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),k.useEffect(()=>{o&&s(null)},[o]),o}function Fpt(e){let{animateLayoutChanges:t=jpt,attributes:n,disabled:r,data:i,getNewIndex:o=Ipt,id:s,strategy:a,resizeObserverConfig:l,transition:c=Ppt}=e;const{items:u,containerId:d,activeIndex:p,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=k.useContext(bue),w=Bpt(r,g),A=u.indexOf(s),E=k.useMemo(()=>({sortable:{containerId:d,index:A,items:u},...i}),[d,i,A,u]),O=k.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:T,isOver:I,setNodeRef:P}=kpt({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:N,activatorEvent:R,activeNodeRect:$,attributes:L,setNodeRef:z,listeners:B,isDragging:V,over:U,setActivatorNodeRef:q,transform:X}=wpt({id:s,data:E,attributes:{...Lpt,...n},disabled:w.draggable}),F=rht(P,z),W=!!N,Y=W&&!y&&Y5(p)&&Y5(v),H=!S&&V,G=H&&Y?X:null,oe=Y?G??(a??C)({rects:b,activeNodeRect:$,activeIndex:p,overIndex:v,index:A}):null,Q=Y5(p)&&Y5(v)?o({id:s,items:u,activeIndex:p,overIndex:v}):A,ie=N?.id,ne=k.useRef({activeId:ie,items:u,newIndex:Q,containerId:d}),Z=u!==ne.current.items,re=t({active:N,containerId:d,isDragging:V,isSorting:W,id:s,index:A,items:u,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:c,wasDragging:ne.current.activeId!=null}),ee=Npt({disabled:!re,index:A,node:T,rect:_});return k.useEffect(()=>{W&&ne.current.newIndex!==Q&&(ne.current.newIndex=Q),d!==ne.current.containerId&&(ne.current.containerId=d),u!==ne.current.items&&(ne.current.items=u)},[W,Q,d,u]),k.useEffect(()=>{if(ie===ne.current.activeId)return;if(ie!=null&&ne.current.activeId==null){ne.current.activeId=ie;return}const fe=setTimeout(()=>{ne.current.activeId=ie},50);return()=>clearTimeout(fe)},[ie]),{active:N,activeIndex:p,attributes:L,data:E,rect:_,index:A,newIndex:Q,items:u,isOver:I,isSorting:W,isDragging:V,listeners:B,node:T,overIndex:v,over:U,setNodeRef:F,setActivatorNodeRef:q,setDroppableNodeRef:P,setDraggableNodeRef:z,transform:ee??oe,transition:ae()};function ae(){if(ee||Z&&ne.current.newIndex===A)return $pt;if(!(H&&!dj(R)||!c)&&(W||re))return Cb.Transition.toString({...c,property:vue})}}function Bpt(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function tw(e){if(!e)return!1;const 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)}const zpt=[zn.Down,zn.Right,zn.Up,zn.Left],Hpt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(zpt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=i.get(d.id);if(p)switch(e.code){case zn.Down:r.top<p.top&&l.push(d);break;case zn.Up:r.top>p.top&&l.push(d);break;case zn.Left:r.left>p.left&&l.push(d);break;case zn.Right:r.left<p.left&&l.push(d);break}});const c=xht({collisionRect:r,droppableRects:i,droppableContainers:l});let u=rue(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const d=o.get(n.id),p=o.get(u),g=p?i.get(p.id):null,y=p?.node.current;if(y&&g&&d&&p){const v=A8(y).some((O,_)=>a[_]!==O),S=xue(d,p),C=Upt(d,p),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},A={x:g.left,y:g.top};return w.x&&w.y?A:wb(A,w)}}}};function xue(e,t){return!tw(e)||!tw(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Upt(e,t){return!tw(e)||!tw(t)||!xue(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Vpt=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=Fpt({id:e.id}),[l,c]=k.useState(!1);k.useEffect(()=>{oC(e.id).then(c)},[e.id]);const u={transform:Cb.Transform.toString(o),transition:s,opacity:a?.5:1};return h.jsx(Nn,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:h.jsxs(Xn,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[h.jsx(le,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:h.jsx(hke,{})}),h.jsx(gt,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?h.jsx(le,{component:"img",src:S2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(yl,{sx:{bgcolor:SM(e),width:40,height:40,boxShadow:2},children:(()=>{const d=xM(e);return h.jsx(d,{sx:{fontSize:24}})})()}),h.jsxs(le,{sx:{flex:1},children:[h.jsx(se,{variant:"subtitle1",fontWeight:500,children:e.name}),h.jsxs(se,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Wpt=()=>{const{t:e}=Qt(),t=Mc(),{content:n,isLoading:r}=ig(),i=jAe(),[o,s]=k.useState([]),[a,l]=k.useState(!1);k.useEffect(()=>{if(n){const g=[...n].sort((y,b)=>{const v=y.priority??100,S=b.priority??100;return v-S});s(g),l(!1)}},[n]);const c=yht(LY(mj),LY(hj,{coordinateGetter:Hpt})),u=k.useCallback(g=>{const{active:y,over:b}=g;b&&y.id!==b.id&&(s(v=>{const S=v.findIndex(w=>w.id===y.id),C=v.findIndex(w=>w.id===b.id);return gj(v,S,C)}),l(!0))},[]),d=k.useCallback(async()=>{const g=o.map((y,b)=>({id:y.id,priority:(b+1)*10}));try{await i(g),t.show({message:e("startup.saveSuccess"),severity:"success"}),l(!1)}catch(y){t.show({message:y instanceof Error?y.message:e("startup.saveFailed"),severity:"error"})}},[o,i,t,e]),p=k.useMemo(()=>o.map(g=>g.id),[o]);return r?h.jsxs(se,{children:[e("common.loading"),"..."]}):h.jsxs(Lt,{spacing:3,children:[h.jsx(Nb,{items:[{name:e("nav.bridges"),to:Dt.bridges},{name:e("startup.title"),to:Dt.startup}]}),h.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[h.jsx(ng,{color:"primary",fontSize:"large"}),h.jsxs(le,{children:[h.jsx(se,{variant:"h5",fontWeight:600,children:e("startup.title")}),h.jsx(se,{variant:"body2",color:"text.secondary",children:e("startup.description")})]})]}),a&&h.jsx(Ht,{severity:"info",action:h.jsx(Ye,{color:"inherit",size:"small",startIcon:h.jsx(TS,{}),onClick:d,children:e("startup.saveChanges")}),children:e("startup.unsavedChanges")}),h.jsx(vpt,{sensors:c,collisionDetection:vht,onDragEnd:u,children:h.jsx(Rpt,{items:p,strategy:Tpt,children:h.jsx(Lt,{spacing:1,children:o.map((g,y)=>h.jsx(Vpt,{bridge:g,index:y},g.id))})})}),o.length===0&&h.jsx(se,{color:"text.secondary",textAlign:"center",py:4,children:e("startup.noBridges")}),a&&o.length>0&&h.jsx(le,{display:"flex",justifyContent:"flex-end",children:h.jsx(Ye,{variant:"contained",startIcon:h.jsx(TS,{}),onClick:d,children:e("startup.saveOrder")})})]})},Nk="https://riddix.github.io/home-assistant-matter-hub",Dt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",areaSetup:"/bridges/area-setup",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:Nk,faq:{multiFabric:`${Nk}/connect-multiple-fabrics`,bridgeConfig:`${Nk}/bridge-configuration`}},qpt=[{path:"",element:h.jsx(I5e,{}),children:[{path:"",element:h.jsx(TDe,{})},{path:Dt.bridges,element:h.jsx(EDe,{})},{path:Dt.createBridge,element:h.jsx(xot,{})},{path:Dt.areaSetup,element:h.jsx(cSe,{})},{path:Dt.bridge(":bridgeId"),element:h.jsx(XAe,{})},{path:Dt.editBridge(":bridgeId"),element:h.jsx(Sot,{})},{path:Dt.devices,element:h.jsx(KDe,{})},{path:Dt.networkMap,element:h.jsx(Jft,{})},{path:Dt.health,element:h.jsx(Tot,{})},{path:Dt.labels,element:h.jsx(jot,{})},{path:Dt.lockCredentials,element:h.jsx(Bot,{})},{path:Dt.settings,element:h.jsx(nht,{})},{path:Dt.startup,element:h.jsx(Wpt,{})},{path:"*",element:h.jsx(zot,{})}]}],Gpt={items:{isInitialized:!1,isLoading:!1}},Kpt=_T(Gpt,e=>{e.addCase(Ro.pending,t=>{t.items.isLoading=!0}).addCase(Ro.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Ro.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(hZ.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(mZ.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(gZ.fulfilled,(t,n)=>{const r=t.items.content?.findIndex(i=>i.id===n.payload.id)??-1;r!==-1&&(t.items.content[r]=n.payload)}).addCase(pZ.fulfilled,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.meta.arg);r!==-1&&t.items.content.splice(r,1)}}).addCase(yZ,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(bZ,(t,n)=>{if(t.items.content){const r=t.items.content.findIndex(i=>i.id===n.payload.id);r!==-1?t.items.content[r]=n.payload:t.items.content.push(n.payload)}})}),Ypt={byBridge:{}},Xpt=_T(Ypt,e=>{e.addCase(Au.pending,(t,n)=>{t.byBridge[n.meta.arg]=Fk(t.byBridge[n.meta.arg],n)}).addCase(Au.rejected,(t,n)=>{t.byBridge[n.meta.arg]=Fk(t.byBridge[n.meta.arg],n)}).addCase(Au.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=Fk(t.byBridge[n.meta.arg],n)})}),Jpt={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},Fk=_T(Jpt,e=>{e.addCase(Au.pending,t=>{t.isLoading=!0}).addCase(Au.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(Au.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),Zpt=p5e({reducer:{bridges:Kpt,devices:Xpt}}),yj=Zbe({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${be(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>ot({props:e,name:"MuiContainer"})});function Qpt(e){return tt("MuiToolbar",e)}rt("MuiToolbar",["root","gutters","regular","dense"]);const emt=e=>{const{classes:t,disableGutters:n,variant:r}=e;return nt({root:["root",!n&&"gutters",r]},Qpt,t)},tmt=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(We(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:t})=>!t.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}]}))),Sue=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=emt(c);return h.jsx(tmt,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})});class nmt extends k.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n.componentStack)}render(){return this.state.hasError?h.jsxs(le,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[h.jsx(HT,{color:"error",sx:{fontSize:64}}),h.jsx(se,{variant:"h5",fontWeight:600,children:hi.t("errorBoundary.title")}),h.jsx(se,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??hi.t("errorBoundary.fallbackMessage")}),h.jsx(Ye,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:hi.t("errorBoundary.reload")})]}):this.props.children}}function rmt(e){return tt("MuiFab",e)}const XY=rt("MuiFab",["root","primary","secondary","extended","circular","focusVisible","disabled","colorInherit","sizeSmall","sizeMedium","sizeLarge","info","error","warning","success"]),imt=e=>{const{color:t,variant:n,classes:r,size:i}=e,o={root:["root",n,`size${be(i)}`,t==="inherit"?"colorInherit":t]},s=nt(o,rmt,r);return{...r,...s}},omt=me(Ys,{name:"MuiFab",slot:"Root",shouldForwardProp:e=>$i(e)||e==="classes",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${be(n.size)}`],n.color==="inherit"&&t.colorInherit,t[be(n.size)],t[n.color]]}})(We(({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"},[`&.${XY.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"}}]})),We(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Ln(["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}}}}))]})),We(({theme:e})=>({[`&.${XY.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),smt=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiFab"}),{children:i,className:o,color:s="default",component:a="button",disabled:l=!1,disableFocusRipple:c=!1,focusVisibleClassName:u,size:d="large",variant:p="circular",...g}=r,y={...r,color:s,component:a,disabled:l,disableFocusRipple:c,size:d,variant:p},b=imt(y);return h.jsx(omt,{className:Oe(b.root,o),component:a,disabled:l,focusRipple:!c,focusVisibleClassName:Oe(b.focusVisible,u),ownerState:y,ref:n,...g,classes:b,children:i})}),amt=[{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:"zh",flag:"🇨🇳",name:"中文"},{code:"th",flag:"🇹🇭",name:"ไทย"},{code:"sv",flag:"🇸🇪",name:"Svenska"}],lmt="hamh-custom-languages";function cmt(){try{const e=localStorage.getItem(lmt);return e?JSON.parse(e).map(n=>({code:n.code,flag:"🌐",name:n.name})):[]}catch{return[]}}const umt="https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement";function dmt(){const{t:e,i18n:t}=Qt(),[n,r]=k.useState(!1),i=k.useRef(null),o=k.useMemo(()=>[...amt,...cmt()],[]),s=t.language?.split("-")[0]??"en",a=k.useCallback(()=>{r(u=>!u)},[]),l=k.useCallback(u=>{t.changeLanguage(u),r(!1)},[t]),c=k.useCallback(()=>{r(!1)},[]);return h.jsx(VJ,{onClickAway:c,children:h.jsxs(le,{children:[h.jsx(smt,{ref:i,size:"small",color:"primary",onClick:a,"aria-label":"Change language",sx:{position:"fixed",bottom:24,right:24,zIndex:1300},children:h.jsx(xke,{})}),h.jsx(zb,{open:n,anchorEl:i.current,placement:"top-end",transition:!0,sx:{zIndex:1300},children:({TransitionProps:u})=>h.jsx(wS,{...u,timeout:200,children:h.jsxs(Ur,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:"hidden"},children:[o.map(d=>h.jsxs(le,{onClick:()=>l(d.code),sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,cursor:"pointer",bgcolor:s===d.code?"action.selected":"transparent","&:hover":{bgcolor:"action.hover"},transition:"background-color 0.15s"},children:[h.jsx(se,{sx:{fontSize:"1.4rem",lineHeight:1,userSelect:"none"},children:d.flag}),h.jsx(se,{variant:"body2",fontWeight:s===d.code?600:400,children:d.name})]},d.code)),h.jsx(Vr,{}),h.jsxs(le,{sx:{display:"flex",alignItems:"flex-start",gap:.75,px:2,py:1},children:[h.jsx(IT,{sx:{fontSize:14,mt:.25,color:"text.secondary"}}),h.jsxs(se,{variant:"caption",color:"text.secondary",sx:{lineHeight:1.4},children:[e("languageSwitcher.disclaimer")," ",h.jsx(Lb,{href:umt,target:"_blank",rel:"noopener",sx:{fontSize:"inherit"},children:e("languageSwitcher.contribute")})]})]})]})})})]})})}const fmt="home-assistant-matter-hub",hmt={name:fmt};function wue(){const e="2.1.0-alpha.474",[t,n]=k.useState(null);k.useEffect(()=>{fetch("api/health").then(i=>i.ok?i.json():null).then(i=>{i?.version&&n(i.version)}).catch(()=>{})},[]);const r=k.useMemo(()=>!t||e==="0.0.0-dev"?!1:e!==t,[t]);return k.useMemo(()=>({name:hmt.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}const pmt=()=>{const{t:e}=Qt(),t=[{name:e("footer.github"),url:Dt.githubRepository},{name:e("footer.documentation"),url:Dt.documentation}];return h.jsxs(yj,{sx:{mt:16,mb:4},children:[h.jsx(Vr,{sx:{mt:4,mb:4}}),h.jsx(lt,{container:!0,spacing:2,justifyContent:"center",children:t.map((n,r)=>h.jsx(lt,{size:{xs:12,sm:"auto"},children:h.jsx(Ye,{fullWidth:!0,size:"small",variant:"outlined",component:Lb,href:n.url,target:"_blank",children:n.name})},r.toString()))})]})};function mmt(e){return tt("MuiAppBar",e)}rt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const gmt=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${be(t)}`,`position${be(n)}`]};return nt(i,mmt,r)},JY=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,ymt=me(Ur,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${be(n.position)}`],t[`color${be(n.color)}`]]}})(We(({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(Ln(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?JY(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?JY(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"})}}]}))),bmt=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=gmt(c);return h.jsx(ymt,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function vmt(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=ml(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function xmt(e){return typeof e=="function"?e():e}function J5(e,t,n){const r=xmt(n),i=vmt(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Smt=k.forwardRef(function(t,n){const r=co(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:d=i,in:p,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Ua,...O}=t,_=k.useRef(null),T=$r(Of(l),_,n),I=U=>q=>{U&&(q===void 0?U(_.current):U(_.current,q))},P=I((U,q)=>{J5(u,U,c),CT(U),g&&g(U,q)}),N=I((U,q)=>{const X=uf({timeout:A,style:w,easing:d},{mode:"enter"});U.style.webkitTransition=r.transitions.create("-webkit-transform",{...X}),U.style.transition=r.transitions.create("transform",{...X}),U.style.webkitTransform="none",U.style.transform="none",b&&b(U,q)}),R=I(y),$=I(C),L=I(U=>{const q=uf({timeout:A,style:w,easing:d},{mode:"exit"});U.style.webkitTransition=r.transitions.create("-webkit-transform",q),U.style.transition=r.transitions.create("transform",q),J5(u,U,c),v&&v(U)}),z=I(U=>{U.style.webkitTransition="",U.style.transition="",S&&S(U)}),B=U=>{s&&s(_.current,U)},V=k.useCallback(()=>{_.current&&J5(u,_.current,c)},[u,c]);return k.useEffect(()=>{if(p||u==="down"||u==="right")return;const U=vT(()=>{_.current&&J5(u,_.current,c)}),q=ml(_.current);return q.addEventListener("resize",U),()=>{U.clear(),q.removeEventListener("resize",U)}},[u,p,c]),k.useEffect(()=>{p||V()},[p,V]),h.jsx(E,{nodeRef:_,onEnter:P,onEntered:R,onEntering:N,onExit:L,onExited:z,onExiting:$,addEndListener:B,appear:a,in:p,timeout:A,...O,children:(U,{ownerState:q,...X})=>k.cloneElement(l,{ref:T,style:{visibility:U==="exited"&&!p?"hidden":void 0,...w,...l.props.style},...X})})});function wmt(e){return tt("MuiDrawer",e)}rt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Cue=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},Cmt=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${be(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${be(n)}`,r!=="temporary"&&`paperAnchorDocked${be(n)}`]};return nt(i,wmt,t)},Emt=me(WT,{name:"MuiDrawer",slot:"Root",overridesResolver:Cue})(We(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),Amt=me("div",{shouldForwardProp:$i,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Cue})({flex:"0 0 auto"}),kmt=me(Ur,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${be(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${be(n.anchor)}`]]}})(We(({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:t})=>t.anchor==="left"&&t.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="top"&&t.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="right"&&t.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>t.anchor==="bottom"&&t.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Eue={left:"right",right:"left",top:"down",bottom:"up"};function Dmt(e){return["left","right"].includes(e)}function _mt({direction:e},t){return e==="rtl"&&Dmt(t)?Eue[t]:t}const Omt=k.forwardRef(function(t,n){const r=ot({props:t,name:"MuiDrawer"}),i=co(),o=_f(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:d=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:O={},slotProps:_={},...T}=r,I=k.useRef(!1);k.useEffect(()=>{I.current=!0},[]);const P=_mt({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:d,open:v,variant:E,...T},$=Cmt(R),L={slots:{transition:w,...O},slotProps:{paper:S,transition:C,..._,backdrop:xT(_.backdrop||{...l,...g},{transitionDuration:A})}},[z,B]=ft("root",{ref:n,elementType:Emt,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...L,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:p,slots:{backdrop:L.slots.backdrop},slotProps:{backdrop:L.slotProps.backdrop}}}),[V,U]=ft("paper",{elementType:kmt,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:R,externalForwardedProps:L,additionalProps:{elevation:E==="temporary"?d:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[q,X]=ft("docked",{elementType:Amt,ref:n,className:Oe($.root,$.docked,u),ownerState:R,externalForwardedProps:L,additionalProps:T}),[F,W]=ft("transition",{elementType:Smt,ownerState:R,externalForwardedProps:L,additionalProps:{in:v,direction:Eue[P],timeout:A,appear:I.current}}),Y=h.jsx(V,{...U,children:c});if(E==="permanent")return h.jsx(q,{...X,children:Y});const H=h.jsx(F,{...W,children:Y});return E==="persistent"?h.jsx(q,{...X,children:H}):h.jsx(z,{...B,children:H})}),Tmt=wJ({themeId:Aa}),Mmt={error:Rf,warn:Lw,info:UT,debug:nC},Rmt=({open:e,onClose:t})=>{const{t:n}=Qt(),r=co(),i=k.useMemo(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[o,s]=k.useState([]),[a,l]=k.useState(!0),[c,u]=k.useState("error,warn,info".split(",")),[d,p]=k.useState(""),[g,y]=k.useState(!0),b=k.useCallback(async()=>{try{const A=new URLSearchParams({level:c.join(","),limit:"500",...d&&{search:d}}),E=await fetch(`api/logs?${A}`);if(E.ok){const O=await E.json();s(O.entries)}}catch(A){console.error("Failed to fetch logs:",A)}finally{l(!1)}},[c,d]);k.useEffect(()=>{e&&b()},[e,b]),k.useEffect(()=>{if(!g||!e)return;const A=setInterval(b,5e3);return()=>clearInterval(A)},[g,e,b]);const v=A=>{u(Array.isArray(A.target.value)?A.target.value:[A.target.value])},S=A=>{p(A.target.value)},C=async()=>{try{await fetch("api/logs",{method:"DELETE"}),s([])}catch(A){console.error("Failed to clear logs:",A)}},w=A=>{const E=Mmt[A]||UT;return h.jsx(E,{sx:{fontSize:16,color:i[A]}})};return h.jsxs(Zs,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(ea,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(nC,{}),n("logs.title"),h.jsx(le,{sx:{flexGrow:1}}),h.jsx(Ut,{title:n("logs.autoRefresh"),children:h.jsx(gt,{label:g?"Auto":"Manual",color:g?"success":"default",size:"small",onClick:()=>y(!g),sx:{cursor:"pointer"}})}),h.jsx(Kt,{onClick:t,children:h.jsx(GQ,{})})]}),h.jsxs(Qs,{children:[h.jsx(Lt,{spacing:2,sx:{mb:2},children:h.jsxs(Lt,{direction:"row",spacing:2,alignItems:"center",children:[h.jsxs(hs,{size:"small",sx:{minWidth:200},children:[h.jsx(ul,{children:n("logs.logLevel")}),h.jsxs(us,{value:c,label:n("logs.logLevel"),onChange:v,multiple:!0,renderValue:A=>h.jsx(le,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(A)?A:[A]).map(E=>h.jsx(gt,{label:E.toUpperCase(),size:"small",sx:{backgroundColor:i[E],color:"white"}},E))}),children:[h.jsx(Un,{value:"error",children:n("logs.error")}),h.jsx(Un,{value:"warn",children:n("logs.warning")}),h.jsx(Un,{value:"info",children:n("logs.info")}),h.jsx(Un,{value:"debug",children:n("logs.debug")})]})]}),h.jsx(lr,{size:"small",placeholder:n("logs.searchPlaceholder"),value:d,onChange:S,sx:{flexGrow:1}}),h.jsx(Ye,{variant:"outlined",onClick:b,children:n("common.refresh")}),h.jsx(Ye,{variant:"outlined",color:"error",onClick:C,children:n("common.delete")})]})}),h.jsx(le,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:a?h.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsxs(se,{children:[n("common.loading"),"..."]})}):o.length===0?h.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(se,{color:"text.secondary",children:n("logs.noResults")})}):h.jsx(Lt,{spacing:1,children:o.map((A,E)=>h.jsxs(le,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[h.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[w(A.level),h.jsx(se,{variant:"caption",color:"text.secondary",children:new Date(A.timestamp).toLocaleString()}),h.jsx(gt,{label:A.level.toUpperCase(),size:"small",sx:{backgroundColor:i[A.level],color:r.palette.getContrastText(i[A.level]??r.palette.grey[500]),fontSize:"0.7rem",height:20}})]}),h.jsx(se,{sx:{ml:3},children:A.message}),A.context&&h.jsx(se,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(A.context,null,2)})]},`${A.timestamp}-${A.level}-${E}`))})})]}),h.jsx(Ia,{children:h.jsx(Ye,{onClick:t,children:n("common.close")})})]})};function ZY(){const{t:e}=Qt(),{isConnected:t}=xZ(),[n,r]=k.useState(null),[i,o]=k.useState(!1);k.useEffect(()=>{const b=async()=>{try{const S=await fetch("api/health");if(S.ok){const C=await S.json();r(C),o(!1)}else o(!0)}catch{o(!0)}};b();const v=setInterval(b,3e4);return()=>clearInterval(v)},[]);const s=b=>{const v=Math.floor(b/3600),S=Math.floor(b%3600/60);return v>0?`${v}h ${S}m`:`${S}m`},a=n?.status==="healthy"&&!i,l=n?.services?.bridges,c=l&&l.total>0&&l.running===l.total,u=l&&l.total===0,d=n?h.jsxs(le,{sx:{p:.5},children:[h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.version"),":"]})," ",n.version??e("status.unknown")]}),h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.uptime"),":"]})," ",s(n.uptime??0)]}),n.services?.bridges&&h.jsxs("div",{children:[h.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&&h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.homeAssistant"),":"]})," ",n.services.homeAssistant.connected?e("health.connected"):e("health.disconnected")]}),h.jsxs("div",{children:[h.jsx("strong",{children:"WebSocket:"})," ",e(t?"health.connected":"health.disconnected")]})]}):e("status.loadingHealth"),p=()=>i||!a?h.jsx(Rf,{fontSize:"small"}):c?h.jsx(Va,{fontSize:"small"}):h.jsx(zw,{fontSize:"small"}),g=()=>i||!a?"error":!c||!t?"warning":"success",y=()=>e(i?"status.error":a?t?u?"status.noBridges":c?"common.online":"common.starting":"common.offline":"status.unhealthy");return h.jsx(Ut,{title:d,arrow:!0,children:h.jsx(gt,{icon:p(),label:y(),color:g(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Imt=e=>k.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("g",{style:{display:"inline"}},k.createElement("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"}),k.createElement("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"}))),jmt=e=>{const t=wue();return h.jsxs(le,{component:Ec,to:Dt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[h.jsx(Imt,{style:{height:"40px"}}),h.jsx(se,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(be).join("-")}),e.large&&h.jsx(se,{variant:"caption",component:"span",children:t.version})]})},Pmt=()=>{const e=Tmt("(min-width:600px)"),{mode:t,setMode:n}=Aw(),[r,i]=k.useState(!1),[o,s]=k.useState(!1),a=zu(),l=kf(),c=y=>y?y==="/"?l.pathname==="/":l.pathname.startsWith(y):!1,u=()=>{n(t==="dark"?"light":"dark")},{t:d}=Qt(),p=[{label:d("dashboard.title"),icon:h.jsx(hM,{}),to:Dt.dashboard},{label:d("nav.bridges"),icon:h.jsx(Oy,{}),to:Dt.bridges},{label:d("nav.devices"),icon:h.jsx(Js,{}),to:Dt.devices},{label:d("nav.networkMap"),icon:h.jsx(uM,{}),to:Dt.networkMap},{label:d("nav.startupOrder"),icon:h.jsx(ng,{}),to:Dt.startup},{label:d("nav.lockCredentials"),icon:h.jsx(Eu,{}),to:Dt.lockCredentials},{label:d("nav.filterReference"),icon:h.jsx(pM,{}),to:Dt.labels},{label:d("nav.settings"),icon:h.jsx(Vb,{}),to:Dt.settings},{label:d(t==="dark"?"nav.lightMode":"nav.darkMode"),icon:t==="dark"?h.jsx(wke,{}):h.jsx(uke,{}),onClick:u},{label:d("nav.systemLogs"),icon:h.jsx(nC,{}),onClick:()=>i(!0)},{label:d("nav.health"),icon:h.jsx(GT,{}),to:Dt.health}],g=y=>{s(!1),y.onClick?y.onClick():y.to&&a(y.to)};return h.jsxs(le,{children:[h.jsx(bmt,{sx:{height:"72px"},children:h.jsx(Sue,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:h.jsxs(yj,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx(jmt,{large:e}),e?h.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.map(y=>y.to?h.jsx(Ut,{title:y.label,children:h.jsx(Kt,{component:Ec,to:y.to,sx:{color:"inherit",bgcolor:c(y.to)?"rgba(255,255,255,0.15)":"transparent",borderRadius:1},children:y.icon})},y.label):h.jsx(Ut,{title:y.label,children:h.jsx(Kt,{onClick:y.onClick,sx:{color:"inherit"},children:y.icon})},y.label)),h.jsx(ZY,{})]}):h.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(ZY,{}),h.jsx(Kt,{onClick:()=>s(!0),sx:{color:"inherit"},children:h.jsx(Cke,{})})]})]})})}),h.jsx(Omt,{anchor:"right",open:o,onClose:()=>s(!1),children:h.jsx(Cl,{sx:{width:250},children:p.map(y=>h.jsxs(kSe,{selected:c(y.to),onClick:()=>g(y),children:[h.jsx(xa,{children:y.icon}),h.jsx(Vs,{primary:y.label})]},y.label))})}),h.jsx(Rmt,{open:r,onClose:()=>i(!1)})]})},$mt=()=>{const{versionMismatch:e,frontendVersion:t,backendVersion:n}=wue(),{isConnected:r}=xZ();return h.jsxs(le,{children:[h.jsx(Pmt,{}),h.jsx(Sue,{}),e&&h.jsxs(Ht,{severity:"warning",variant:"filled",sx:{borderRadius:0},action:h.jsx(Ye,{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&&h.jsx(Ht,{severity:"error",variant:"filled",sx:{borderRadius:0},children:"Connection lost — data may be outdated. Reconnecting…"}),h.jsx(yj,{sx:{p:2},children:h.jsx(nmt,{children:h.jsx(OX,{})})}),h.jsx(pmt,{}),h.jsx(dmt,{})]})},Lmt=ww({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"}}}}});let Z4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");Z4?.startsWith("http")&&(Z4=new URL(Z4).pathname);const Nmt=Sme([{path:"/",element:h.jsx($mt,{}),children:qpt}],{basename:Z4});Ffe.createRoot(document.getElementById("root")).render(h.jsx(k.StrictMode,{children:h.jsx(nhe,{store:Zpt,children:h.jsxs(cxe,{theme:Lmt,children:[h.jsx(ixe,{}),h.jsx(LJ,{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}}}),h.jsx(R5e,{children:h.jsx(C3e,{children:h.jsx(Ime,{router:Nmt})})})]})})}));
@@ -8,7 +8,7 @@
8
8
  <!-- BASE -->
9
9
  <base href="/" />
10
10
  <!-- /BASE -->
11
- <script type="module" crossorigin src="./assets/index-Ek5DnVXd.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-CCbI2Fjq.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="./assets/index-BNdBOwwe.css">
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riddix/hamh",
3
3
  "description": "",
4
- "version": "2.1.0-alpha.473",
4
+ "version": "2.1.0-alpha.474",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "bin": {
@@ -57,9 +57,9 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/lodash-es": "^4.17.12",
60
- "@home-assistant-matter-hub/backend": "2.1.0-alpha.473",
61
- "@home-assistant-matter-hub/common": "2.1.0-alpha.473",
62
- "@home-assistant-matter-hub/frontend": "2.1.0-alpha.473"
60
+ "@home-assistant-matter-hub/backend": "2.1.0-alpha.474",
61
+ "@home-assistant-matter-hub/frontend": "2.1.0-alpha.474",
62
+ "@home-assistant-matter-hub/common": "2.1.0-alpha.474"
63
63
  },
64
64
  "nx": {
65
65
  "targets": {