@riddix/hamh 2.1.0-alpha.458 β†’ 2.1.0-alpha.459

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -437,6 +437,7 @@ Thank you to everyone who helps improve this project by reporting issues!
437
437
  | πŸ’Ž [@nicoodeimos](https://github.com/nicoodeimos) | πŸ’Ž [@ustari28](https://github.com/ustari28) | πŸ’Ž Markus MΓΌller ([@Dingosworld](https://github.com/Dingosworld)) |
438
438
  | πŸ’Ž StefanS | πŸ’Ž Manny B. | πŸ’Ž Bonjon |
439
439
  | πŸ’Ž TobiR | πŸ’Ž Franz Huber | πŸ’Ž Michele Larese de Prata |
440
+ | πŸ’Ž [@CNCB](https://github.com/CNCB) | πŸ’Ž [@pelican1997](https://github.com/pelican1997) | |
440
441
 
441
442
  πŸ™ *...and anonymous supporters who prefer not to be named.*
442
443
 
@@ -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
- `},Alt={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 klt(e){let{announcements:t=Alt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Elt}=e;const{announce:o,announcement:s}=Slt(),a=hv("DndLiveRegion"),[l,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),wlt(k.useMemo(()=>({onDragStart(f){let{active:p}=f;o(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:g}=f;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(f){let{active:p,over:g}=f;o(t.onDragOver({active:p,over:g}))},onDragEnd(f){let{active:p,over:g}=f;o(t.onDragEnd({active:p,over:g}))},onDragCancel(f){let{active:p,over:g}=f;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!l)return null;const u=Kt.createElement(Kt.Fragment,null,Kt.createElement(vlt,{id:r,value:i.draggable}),Kt.createElement(xlt,{id:a,announcement:s}));return n?jd.createPortal(u,n):u}var Fi;(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"})(Fi||(Fi={}));function TS(){}function $K(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _lt(){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 gl=Object.freeze({x:0,y:0});function zle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hle(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Dlt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function LK(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 Ule(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function NK(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 Olt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=NK(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=zle(NK(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Hle)},Tlt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=LK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=LK(l),u=i.reduce((p,g,y)=>p+zle(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(Hle)};function Mlt(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,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Rlt=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=Mlt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Dlt)};function Ilt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Vle(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:gl}function jlt(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 Plt=jlt(1);function $lt(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 Llt(e,t,n){const r=$lt(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,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const Nlt={ignoreTransform:!1};function bg(e,t){t===void 0&&(t=Nlt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=bs(e).getComputedStyle(e);c&&(n=Llt(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 FK(e){return bg(e,{ignoreTransform:!0})}function Flt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Blt(e,t){return t===void 0&&(t=bs(e).getComputedStyle(e)),t.position==="fixed"}function zlt(e,t){t===void 0&&(t=bs(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 t8(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(MI(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!dv(i)||Nle(i)||n.includes(i))return n;const o=bs(e).getComputedStyle(i);return i!==e&&zlt(i,o)&&n.push(i),Blt(i,o)?n:r(i.parentNode)}return e?r(e):n}function Wle(e){const[t]=t8(e,1);return t??null}function sk(e){return!e8||!e?null:gg(e)?e:TI(e)?MI(e)||e===yg(e).scrollingElement?window:dv(e)?e:null:null}function qle(e){return gg(e)?e.scrollX:e.scrollLeft}function Gle(e){return gg(e)?e.scrollY:e.scrollTop}function cO(e){return{x:qle(e),y:Gle(e)}}var Qi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Qi||(Qi={}));function Kle(e){return!e8||!e?!1:e===document.scrollingElement}function Yle(e){const t={x:0,y:0},n=Kle(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 Hlt={x:.2,y:.2};function Ult(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Hlt);const{isTop:c,isBottom:u,isLeft:f,isRight:p}=Yle(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=Qi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=Qi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!p&&a>=t.right-b.width?(g.x=Qi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Qi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function Vlt(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 Xle(e){return e.reduce((t,n)=>cm(t,cO(n)),gl)}function Wlt(e){return e.reduce((t,n)=>t+qle(n),0)}function qlt(e){return e.reduce((t,n)=>t+Gle(n),0)}function Glt(e,t){if(t===void 0&&(t=bg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Wle(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Klt=[["x",["left","right"],Wlt],["y",["top","bottom"],qlt]];class jI{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=t8(n),i=Xle(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of Klt)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 Ny{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 Ylt(e){const{EventTarget:t}=bs(e);return e instanceof t?e:yg(e)}function ak(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 la;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(la||(la={}));function BK(e){e.preventDefault()}function Xlt(e){e.stopPropagation()}var Nn;(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"})(Nn||(Nn={}));const Zle={start:[Nn.Space,Nn.Enter],cancel:[Nn.Esc],end:[Nn.Space,Nn.Enter,Nn.Tab]},Zlt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Nn.Right:return{...n,x:n.x+25};case Nn.Left:return{...n,x:n.x-25};case Nn.Down:return{...n,y:n.y+25};case Nn.Up:return{...n,y:n.y-25}}};class PI{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 Ny(yg(n)),this.windowListeners=new Ny(bs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(la.Resize,this.handleCancel),this.windowListeners.add(la.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(la.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Glt(r),n(gl)}handleKeyDown(t){if(II(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Zle,coordinateGetter:s=Zlt,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}:gl;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const p=lb(f,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:D}=Yle(b),O=Vlt(b),T={x:Math.min(v===Nn.Right?O.right-O.width/2:O.right,Math.max(v===Nn.Right?O.left:O.left+O.width/2,f.x)),y:Math.min(v===Nn.Down?O.bottom-O.height/2:O.bottom,Math.max(v===Nn.Down?O.top:O.top+O.height/2,f.y))},I=v===Nn.Right&&!C||v===Nn.Left&&!w,L=v===Nn.Down&&!A||v===Nn.Up&&!S;if(I&&T.x!==f.x){const $=b.scrollLeft+p.x,R=v===Nn.Right&&$<=E.x||v===Nn.Left&&$>=D.x;if(R&&!p.y){b.scrollTo({left:$,behavior:a});return}R?g.x=b.scrollLeft-$:g.x=v===Nn.Right?b.scrollLeft-E.x:b.scrollLeft-D.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(L&&T.y!==f.y){const $=b.scrollTop+p.y,R=v===Nn.Down&&$<=E.y||v===Nn.Up&&$>=D.y;if(R&&!p.x){b.scrollTo({top:$,behavior:a});return}R?g.y=b.scrollTop-$:g.y=v===Nn.Down?b.scrollTop-E.y:b.scrollTop-D.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,cm(lb(f,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()}}PI.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Zle,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 zK(e){return!!(e&&"distance"in e)}function HK(e){return!!(e&&"delay"in e)}class $I{constructor(t,n,r){var i;r===void 0&&(r=Ylt(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=yg(s),this.documentListeners=new Ny(this.document),this.listeners=new Ny(r),this.windowListeners=new Ny(bs(s)),this.initialCoordinates=(i=lO(o))!=null?i:gl,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(la.Resize,this.handleCancel),this.windowListeners.add(la.DragStart,BK),this.windowListeners.add(la.VisibilityChange,this.handleCancel),this.windowListeners.add(la.ContextMenu,BK),this.documentListeners.add(la.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(HK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(zK(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(la.Click,Xlt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(la.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=lO(t))!=null?n:gl,c=lb(i,l);if(!r&&a){if(zK(a)){if(a.tolerance!=null&&ak(c,a.tolerance))return this.handleCancel();if(ak(c,a.distance))return this.handleStart()}if(HK(a)&&ak(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===Nn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Jlt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class LI extends $I{constructor(t){const{event:n}=t,r=yg(n.target);super(t,Jlt,r)}}LI.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 Qlt={move:{name:"mousemove"},end:{name:"mouseup"}};var uO;(function(e){e[e.RightClick=2]="RightClick"})(uO||(uO={}));class ect extends $I{constructor(t){super(t,Qlt,yg(t.event.target))}}ect.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===uO.RightClick?!1:(r?.({event:n}),!0)}}];const lk={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tct extends $I{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(){}}}tct.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 Fy;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Fy||(Fy={}));var MS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(MS||(MS={}));function nct(e){let{acceleration:t,activator:n=Fy.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=MS.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:p}=e;const g=ict({delta:f,disabled:!o}),[y,b]=plt(),v=k.useRef({x:0,y:0}),S=k.useRef({x:0,y:0}),C=k.useMemo(()=>{switch(n){case Fy.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Fy.DraggableRect:return i}},[n,i,l]),w=k.useRef(null),A=k.useCallback(()=>{const D=w.current;if(!D)return;const O=v.current.x*S.current.x,T=v.current.y*S.current.y;D.scrollBy(O,T)},[]),E=k.useMemo(()=>a===MS.TreeOrder?[...c].reverse():c,[a,c]);k.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const D of E){if(r?.(D)===!1)continue;const O=c.indexOf(D),T=u[O];if(!T)continue;const{direction:I,speed:L}=Ult(D,T,C,t,p);for(const $ of["x","y"])g[$][I[$]]||(L[$]=0,I[$]=0);if(L.x>0||L.y>0){b(),w.current=D,y(A,s),v.current=L,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 rct={x:{[Qi.Backward]:!1,[Qi.Forward]:!1},y:{[Qi.Backward]:!1,[Qi.Forward]:!1}};function ict(e){let{delta:t,disabled:n}=e;const r=aO(t);return fv(i=>{if(n||!r||!i)return rct;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Qi.Backward]:i.x[Qi.Backward]||o.x===-1,[Qi.Forward]:i.x[Qi.Forward]||o.x===1},y:{[Qi.Backward]:i.y[Qi.Backward]||o.y===-1,[Qi.Forward]:i.y[Qi.Forward]||o.y===1}}},[n,t,r])}function oct(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return fv(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function sct(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 ub;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ub||(ub={}));var dO;(function(e){e.Optimized="optimized"})(dO||(dO={}));const UK=new Map;function act(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),f=v(),p=ab(f),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=fv(S=>{if(f&&!n)return UK;if(!S||S===UK||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 jI(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return k.useEffect(()=>{u.current=e},[e]),k.useEffect(()=>{f||g()},[n,f]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case ub.Always:return!1;case ub.BeforeDragging:return n;default:return!n}}}function Jle(e,t){return fv(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lct(e,t){return Jle(e,t)}function cct(e){let{callback:t,disabled:n}=e;const r=RI(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 n8(e){let{callback:t,disabled:n}=e;const r=RI(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 uct(e){return new jI(bg(e),e)}function VK(e,t,n){t===void 0&&(t=uct);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=cct({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=n8({callback:o});return kc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function dct(e){const t=Jle(e);return Vle(e,t)}const WK=[];function fct(e){const t=k.useRef(e),n=fv(r=>e?r&&r!==WK&&e&&t.current&&e.parentNode===t.current.parentNode?r:t8(e):WK,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function hct(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=sk(o.target);s&&n(a=>a?(a.set(s,cO(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=sk(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,cO(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=sk(l);c?.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>cm(o,s),gl):Xle(e):gl,[e,t])}function qK(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==gl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lb(e,n.current):gl}function pct(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 mct(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 Qle(e){return k.useMemo(()=>e?Flt(e):null,[e])}const GK=[];function gct(e,t){t===void 0&&(t=bg);const[n]=e,r=Qle(n?bs(n):null),[i,o]=k.useState(GK);function s(){o(()=>e.length?e.map(l=>Kle(l)?r:new jI(t(l),l)):GK)}const a=n8({callback:s});return kc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function yct(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return dv(t)?t:e}function bct(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(f=>{const p=t(u);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),o=n8({callback:i}),s=k.useCallback(c=>{const u=yct(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=OS(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const vct=[{sensor:LI,options:{}},{sensor:PI,options:{}}],xct={current:{}},I4={draggable:{measure:FK},droppable:{measure:FK,strategy:ub.WhileDragging,frequency:dO.Optimized},dragOverlay:{measure:bg}};class By 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 Sct={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new By,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:TS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:I4,measureDroppableContainers:TS,windowRect:null,measuringScheduled:!1},wct={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:TS,draggableNodes:new Map,over:null,measureDroppableContainers:TS},r8=k.createContext(wct),ece=k.createContext(Sct);function Cct(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new By}}}function Ect(e,t){switch(t.type){case Fi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Fi.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 Fi.DragEnd:case Fi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Fi.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new By(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Fi.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 By(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Fi.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new By(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Act(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(r8),o=aO(r),s=aO(n?.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!II(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 f=ylt(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function kct(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function _ct(e){return k.useMemo(()=>({draggable:{...I4.draggable,...e?.draggable},droppable:{...I4.droppable,...e?.droppable},dragOverlay:{...I4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Dct(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;kc(()=>{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),f=Vle(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Wle(c);p&&p.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const tce=k.createContext({...gl,scaleX:1,scaleY:1});var kd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(kd||(kd={}));const Oct=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=vct,collisionDetection:f=Rlt,measuring:p,modifiers:g,...y}=t;const b=k.useReducer(Ect,void 0,Cct),[v,S]=b,[C,w]=Clt(),[A,E]=k.useState(kd.Uninitialized),D=A===kd.Initialized,{draggable:{active:O,nodes:T,translate:I},droppable:{containers:L}}=v,$=O!=null?T.get(O):null,R=k.useRef({initial:null,translated:null}),F=k.useMemo(()=>{var Ot;return O!=null?{id:O,data:(Ot=$?.data)!=null?Ot:xct,rect:R}:null},[O,$]),P=k.useRef(null),[z,N]=k.useState(null),[V,U]=k.useState(null),K=ab(y,Object.values(y)),X=hv("DndDescribedBy",s),B=k.useMemo(()=>L.getEnabled(),[L]),W=_ct(p),{droppableRects:q,measureDroppableContainers:H,measuringScheduled:Y}=act(B,{dragging:D,dependencies:[I.x,I.y],config:W.droppable}),J=oct(T,O),ne=k.useMemo(()=>V?lO(V):null,[V]),ee=vr(),re=lct(J,W.draggable.measure);Dct({activeNode:O!=null?T.get(O):null,config:ee.layoutShiftCompensation,initialRect:re,measure:W.draggable.measure});const le=VK(J,W.draggable.measure,re),te=VK(J?J.parentElement:null),Z=k.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=L.getNodeFor((n=Z.current.over)==null?void 0:n.id),ae=bct({measure:W.dragOverlay.measure}),fe=(r=ae.nodeRef.current)!=null?r:J,be=D?(i=ae.rect)!=null?i:le:null,De=!!(ae.nodeRef.current&&ae.rect),Oe=dct(De?null:le),Ke=Qle(fe?bs(fe):null),xe=fct(D?oe??J:null),Le=gct(xe),Me=kct(g,{transform:{x:I.x-Oe.x,y:I.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:V,active:F,activeNodeRect:le,containerNodeRect:te,draggingNodeRect:be,over:Z.current.over,overlayNodeRect:ae.rect,scrollableAncestors:xe,scrollableAncestorRects:Le,windowRect:Ke}),mt=ne?cm(ne,I):null,yt=hct(xe),ze=qK(yt),je=qK(yt,[le]),He=cm(Me,ze),Je=be?Plt(be,Me):null,rt=F&&Je?f({active:F,collisionRect:Je,droppableRects:q,droppableContainers:B,pointerCoordinates:mt}):null,at=Ule(rt,"id"),[Xe,Ft]=k.useState(null),Bt=De?Me:cm(Me,je),Tt=Ilt(Bt,(o=Xe?.rect)!=null?o:null,le),Qn=k.useRef(null),ln=k.useCallback((Ot,$t)=>{let{sensor:nn,options:$n}=$t;if(P.current==null)return;const cn=T.get(P.current);if(!cn)return;const Ct=Ot.nativeEvent,bn=new nn({active:P.current,activeNode:cn,event:Ct,options:$n,context:Z,onAbort(xr){if(!T.get(xr))return;const{onDragAbort:ue}=K.current,pe={id:xr};ue?.(pe),C({type:"onDragAbort",event:pe})},onPending(xr,ni,ue,pe){if(!T.get(xr))return;const{onDragPending:Fe}=K.current,Ue={id:xr,constraint:ni,initialCoordinates:ue,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(xr){const ni=P.current;if(ni==null)return;const ue=T.get(ni);if(!ue)return;const{onDragStart:pe}=K.current,Se={activatorEvent:Ct,active:{id:ni,data:ue.data,rect:R}};jd.unstable_batchedUpdates(()=>{pe?.(Se),E(kd.Initializing),S({type:Fi.DragStart,initialCoordinates:xr,active:ni}),C({type:"onDragStart",event:Se}),N(Qn.current),U(Ct)})},onMove(xr){S({type:Fi.DragMove,coordinates:xr})},onEnd:ti(Fi.DragEnd),onCancel:ti(Fi.DragCancel)});Qn.current=bn;function ti(xr){return async function(){const{active:ue,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=Z.current;let Ue=null;if(ue&&Fe){const{cancelDrop:vt}=K.current;Ue={activatorEvent:Ct,active:ue,collisions:pe,delta:Fe,over:Se},xr===Fi.DragEnd&&typeof vt=="function"&&await Promise.resolve(vt(Ue))&&(xr=Fi.DragCancel)}P.current=null,jd.unstable_batchedUpdates(()=>{S({type:xr}),E(kd.Uninitialized),Ft(null),N(null),U(null),Qn.current=null;const vt=xr===Fi.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const it=K.current[vt];it?.(Ue),C({type:vt,event:Ue})}})}}},[T]),ct=k.useCallback((Ot,$t)=>(nn,$n)=>{const cn=nn.nativeEvent,Ct=T.get($n);if(P.current!==null||!Ct||cn.dndKit||cn.defaultPrevented)return;const bn={active:Ct};Ot(nn,$t.options,bn)===!0&&(cn.dndKit={capturedBy:$t.sensor},P.current=$n,ln(nn,$t))},[T,ln]),Vt=sct(u,ct);pct(u),kc(()=>{le&&A===kd.Initializing&&E(kd.Initialized)},[le,A]),k.useEffect(()=>{const{onDragMove:Ot}=K.current,{active:$t,activatorEvent:nn,collisions:$n,over:cn}=Z.current;if(!$t||!nn)return;const Ct={active:$t,activatorEvent:nn,collisions:$n,delta:{x:He.x,y:He.y},over:cn};jd.unstable_batchedUpdates(()=>{Ot?.(Ct),C({type:"onDragMove",event:Ct})})},[He.x,He.y]),k.useEffect(()=>{const{active:Ot,activatorEvent:$t,collisions:nn,droppableContainers:$n,scrollAdjustedTranslate:cn}=Z.current;if(!Ot||P.current==null||!$t||!cn)return;const{onDragOver:Ct}=K.current,bn=$n.get(at),ti=bn&&bn.rect.current?{id:bn.id,rect:bn.rect.current,data:bn.data,disabled:bn.disabled}:null,xr={active:Ot,activatorEvent:$t,collisions:nn,delta:{x:cn.x,y:cn.y},over:ti};jd.unstable_batchedUpdates(()=>{Ft(ti),Ct?.(xr),C({type:"onDragOver",event:xr})})},[at]),kc(()=>{Z.current={activatorEvent:V,active:F,activeNode:J,collisionRect:Je,collisions:rt,droppableRects:q,draggableNodes:T,draggingNode:fe,draggingNodeRect:be,droppableContainers:L,over:Xe,scrollableAncestors:xe,scrollAdjustedTranslate:He},R.current={initial:be,translated:Je}},[F,J,rt,Je,T,fe,be,q,L,Xe,xe,He]),nct({...ee,delta:I,draggingRect:Je,pointerCoordinates:mt,scrollableAncestors:xe,scrollableAncestorRects:Le});const On=k.useMemo(()=>({active:F,activeNode:J,activeNodeRect:le,activatorEvent:V,collisions:rt,containerNodeRect:te,dragOverlay:ae,draggableNodes:T,droppableContainers:L,droppableRects:q,over:Xe,measureDroppableContainers:H,scrollableAncestors:xe,scrollableAncestorRects:Le,measuringConfiguration:W,measuringScheduled:Y,windowRect:Ke}),[F,J,le,V,rt,te,ae,T,L,q,Xe,H,xe,Le,W,Y,Ke]),Yn=k.useMemo(()=>({activatorEvent:V,activators:Vt,active:F,activeNodeRect:le,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Xe,measureDroppableContainers:H}),[V,Vt,F,le,S,X,T,Xe,H]);return Kt.createElement(Ble.Provider,{value:w},Kt.createElement(r8.Provider,{value:Yn},Kt.createElement(ece.Provider,{value:On},Kt.createElement(tce.Provider,{value:Tt},c)),Kt.createElement(Act,{disabled:a?.restoreFocus===!1})),Kt.createElement(klt,{...a,hiddenTextDescribedById:X}));function vr(){const Ot=z?.autoScrollEnabled===!1,$t=typeof l=="object"?l.enabled===!1:l===!1,nn=D&&!Ot&&!$t;return typeof l=="object"?{...l,enabled:nn}:{enabled:nn}}}),Tct=k.createContext(null),KK="button",Mct="Draggable";function Rct(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=hv(Mct),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:p}=k.useContext(r8),{role:g=KK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=k.useContext(v?tce:Tct),[C,w]=OS(),[A,E]=OS(),D=mct(s,t),O=ab(n);kc(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:O}),()=>{const I=f.get(t);I&&I.key===o&&f.delete(t)}),[f,t]);const T=k.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===KK?!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:D,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Ict(){return k.useContext(ece)}const jct="Droppable",Pct={timeout:25};function $ct(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=hv(jct),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=k.useContext(r8),u=k.useRef({disabled:n}),f=k.useRef(!1),p=k.useRef(null),g=k.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Pct,...i},S=ab(b??r),C=k.useCallback(()=>{if(!f.current){f.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=n8({callback:C,disabled:y||!s}),A=k.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),f.current=!1),T&&w.observe(T))},[w]),[E,D]=OS(A),O=ab(t);return k.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),k.useEffect(()=>(a({type:Fi.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:p,data:O}}),()=>a({type:Fi.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==u.current.disabled&&(a({type:Fi.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:D}}function NI(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Lct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function M5(e){return e!==null&&e>=0}function Nct(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 Fct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const nce=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=NI(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}},R5={scaleX:1,scaleY:1},Bct=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,...R5}:null}const l=zct(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...R5}:i<n&&i>=s?{x:0,y:a.height+l,...R5}:{x:0,y:0,...R5}};function zct(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 rce="Sortable",ice=Kt.createContext({activeIndex:-1,containerId:rce,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nce,disabled:{draggable:!1,droppable:!1}});function Hct(e){let{children:t,id:n,items:r,strategy:i=nce,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Ict(),f=hv(rce,n),p=a.rect!==null,g=k.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=k.useRef(g),C=!Nct(g,S.current),w=v!==-1&&b===-1||C,A=Fct(o);kc(()=>{C&&y&&u(g)},[C,g,y,u]),k.useEffect(()=>{S.current=g},[g]);const E=k.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:p,sortedRects:Lct(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,p,i]);return Kt.createElement(ice.Provider,{value:E},t)}const Uct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return NI(n,r,i).indexOf(t)},Vct=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},Wct={duration:200,easing:"ease"},oce="transform",qct=cb.Transition.toString({property:oce,duration:0,easing:"linear"}),Gct={roleDescription:"sortable"};function Kct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=k.useState(null),a=k.useRef(n);return kc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=bg(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 Yct(e){let{animateLayoutChanges:t=Vct,attributes:n,disabled:r,data:i,getNewIndex:o=Uct,id:s,strategy:a,resizeObserverConfig:l,transition:c=Wct}=e;const{items:u,containerId:f,activeIndex:p,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=k.useContext(ice),w=Xct(r,g),A=u.indexOf(s),E=k.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...i}),[f,i,A,u]),D=k.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:O,node:T,isOver:I,setNodeRef:L}=$ct({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...l}}),{active:$,activatorEvent:R,activeNodeRect:F,attributes:P,setNodeRef:z,listeners:N,isDragging:V,over:U,setActivatorNodeRef:K,transform:X}=Rct({id:s,data:E,attributes:{...Gct,...n},disabled:w.draggable}),B=hlt(L,z),W=!!$,q=W&&!y&&M5(p)&&M5(v),H=!S&&V,Y=H&&q?X:null,ne=q?Y??(a??C)({rects:b,activeNodeRect:F,activeIndex:p,overIndex:v,index:A}):null,ee=M5(p)&&M5(v)?o({id:s,items:u,activeIndex:p,overIndex:v}):A,re=$?.id,le=k.useRef({activeId:re,items:u,newIndex:ee,containerId:f}),te=u!==le.current.items,Z=t({active:$,containerId:f,isDragging:V,isSorting:W,id:s,index:A,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:c,wasDragging:le.current.activeId!=null}),oe=Kct({disabled:!Z,index:A,node:T,rect:O});return k.useEffect(()=>{W&&le.current.newIndex!==ee&&(le.current.newIndex=ee),f!==le.current.containerId&&(le.current.containerId=f),u!==le.current.items&&(le.current.items=u)},[W,ee,f,u]),k.useEffect(()=>{if(re===le.current.activeId)return;if(re!=null&&le.current.activeId==null){le.current.activeId=re;return}const fe=setTimeout(()=>{le.current.activeId=re},50);return()=>clearTimeout(fe)},[re]),{active:$,activeIndex:p,attributes:P,data:E,rect:O,index:A,newIndex:ee,items:u,isOver:I,isSorting:W,isDragging:V,listeners:N,node:T,overIndex:v,over:U,setNodeRef:B,setActivatorNodeRef:K,setDroppableNodeRef:L,setDraggableNodeRef:z,transform:oe??ne,transition:ae()};function ae(){if(oe||te&&le.current.newIndex===A)return qct;if(!(H&&!II(R)||!c)&&(W||Z))return cb.Transition.toString({...c,property:oce})}}function Xct(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 RS(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 Zct=[Nn.Down,Nn.Right,Nn.Up,Nn.Left],Jct=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(Zct.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=i.get(f.id);if(p)switch(e.code){case Nn.Down:r.top<p.top&&l.push(f);break;case Nn.Up:r.top>p.top&&l.push(f);break;case Nn.Left:r.left>p.left&&l.push(f);break;case Nn.Right:r.left<p.left&&l.push(f);break}});const c=Tlt({collisionRect:r,droppableRects:i,droppableContainers:l});let u=Ule(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const f=o.get(n.id),p=o.get(u),g=p?i.get(p.id):null,y=p?.node.current;if(y&&g&&f&&p){const v=t8(y).some((D,O)=>a[O]!==D),S=sce(f,p),C=Qct(f,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:lb(A,w)}}}};function sce(e,t){return!RS(e)||!RS(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Qct(e,t){return!RS(e)||!RS(t)||!sce(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const eut=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=Yct({id:e.id}),[l,c]=k.useState(!1);k.useEffect(()=>{$w(e.id).then(c)},[e.id]);const u={transform:cb.Transform.toString(o),transition:s,opacity:a?.5:1};return h.jsx(Pn,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:h.jsxs(Gn,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[h.jsx(se,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:h.jsx(D8e,{})}),h.jsx(pt,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?h.jsx(se,{component:"img",src:a2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(hl,{sx:{bgcolor:HT(e),width:40,height:40,boxShadow:2},children:(()=>{const f=zT(e);return h.jsx(f,{sx:{fontSize:24}})})()}),h.jsxs(se,{sx:{flex:1},children:[h.jsx(ie,{variant:"subtitle1",fontWeight:500,children:e.name}),h.jsxs(ie,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," β€’ Priority: ",e.priority??100]})]})]})})},tut=()=>{const e=_c(),{content:t,isLoading:n}=Ym(),r=YCe(),[i,o]=k.useState([]),[s,a]=k.useState(!1);k.useEffect(()=>{if(t){const p=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(p),a(!1)}},[t]);const l=_lt($K(LI),$K(PI,{coordinateGetter:Jct})),c=k.useCallback(p=>{const{active:g,over:y}=p;y&&g.id!==y.id&&(o(b=>{const v=b.findIndex(C=>C.id===g.id),S=b.findIndex(C=>C.id===y.id);return NI(b,v,S)}),a(!0))},[]),u=k.useCallback(async()=>{const p=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(p),e.show({message:"Startup order saved successfully",severity:"success"}),a(!1)}catch(g){e.show({message:g instanceof Error?g.message:"Failed to save startup order",severity:"error"})}},[i,r,e]),f=k.useMemo(()=>i.map(p=>p.id),[i]);return n?h.jsx(ie,{children:"Loading..."}):h.jsxs(Lt,{spacing:3,children:[h.jsx(Cb,{items:[{name:"Bridges",to:_t.bridges},{name:"Startup Order",to:_t.startup}]}),h.jsxs(se,{display:"flex",alignItems:"center",gap:2,children:[h.jsx(Gm,{color:"primary",fontSize:"large"}),h.jsxs(se,{children:[h.jsx(ie,{variant:"h5",fontWeight:600,children:"Startup Order"}),h.jsx(ie,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&h.jsx(Ht,{severity:"info",action:h.jsx(tt,{color:"inherit",size:"small",startIcon:h.jsx(a6,{}),onClick:u,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),h.jsx(Oct,{sensors:l,collisionDetection:Olt,onDragEnd:c,children:h.jsx(Hct,{items:f,strategy:Bct,children:h.jsx(Lt,{spacing:1,children:i.map((p,g)=>h.jsx(eut,{bridge:p,index:g},p.id))})})}),i.length===0&&h.jsx(ie,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&h.jsx(se,{display:"flex",justifyContent:"flex-end",children:h.jsx(tt,{variant:"contained",startIcon:h.jsx(a6,{}),onClick:u,children:"Save Startup Order"})})]})},ck="https://riddix.github.io/home-assistant-matter-hub",_t={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:ck,faq:{multiFabric:`${ck}/connect-multiple-fabrics`,bridgeConfig:`${ck}/bridge-configuration`}},nut=[{path:"",element:h.jsx(q2e,{}),children:[{path:"",element:h.jsx(H9e,{})},{path:_t.bridges,element:h.jsx($9e,{})},{path:_t.createBridge,element:h.jsx(Ret,{})},{path:_t.areaSetup,element:h.jsx(wve,{})},{path:_t.bridge(":bridgeId"),element:h.jsx(d8e,{})},{path:_t.editBridge(":bridgeId"),element:h.jsx(Iet,{})},{path:_t.devices,element:h.jsx(s7e,{})},{path:_t.networkMap,element:h.jsx(alt,{})},{path:_t.health,element:h.jsx(Bet,{})},{path:_t.labels,element:h.jsx(Vet,{})},{path:_t.lockCredentials,element:h.jsx(Xet,{})},{path:_t.settings,element:h.jsx(flt,{})},{path:_t.startup,element:h.jsx(tut,{})},{path:"*",element:h.jsx(Zet,{})}]}],rut={items:{isInitialized:!1,isLoading:!1}},iut=JO(rut,e=>{e.addCase(Oo.pending,t=>{t.items.isLoading=!0}).addCase(Oo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Oo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(XX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(JX.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(QX.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(ZX.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(eZ,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(tZ,(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)}})}),out={byBridge:{}},sut=JO(out,e=>{e.addCase(Su.pending,(t,n)=>{t.byBridge[n.meta.arg]=uk(t.byBridge[n.meta.arg],n)}).addCase(Su.rejected,(t,n)=>{t.byBridge[n.meta.arg]=uk(t.byBridge[n.meta.arg],n)}).addCase(Su.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=uk(t.byBridge[n.meta.arg],n)})}),aut={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},uk=JO(aut,e=>{e.addCase(Su.pending,t=>{t.isLoading=!0}).addCase(Su.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(Su.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),lut=_2e({reducer:{bridges:iut,devices:sut}}),FI=uge({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ye(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>st({props:e,name:"MuiContainer"})});function cut(e){return Qe("MuiToolbar",e)}nt("MuiToolbar",["root","gutters","regular","dense"]);const uut=e=>{const{classes:t,disableGutters:n,variant:r}=e;return et({root:["root",!n&&"gutters",r]},cut,t)},dut=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ge(({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}]}))),ace=k.forwardRef(function(t,n){const r=st({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=uut(c);return h.jsx(dut,{as:o,className:Te(u.root,i),ref:n,ownerState:c,...l})});class fut 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(se,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[h.jsx(uT,{color:"error",sx:{fontSize:64}}),h.jsx(ie,{variant:"h5",fontWeight:600,children:"Something went wrong"}),h.jsx(ie,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??"An unexpected error occurred."}),h.jsx(tt,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:"Reload Page"})]}):this.props.children}}const hut="home-assistant-matter-hub",put={name:hut};function lce(){const e="2.1.0-alpha.458",[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:put.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}const mut=[{name:"GitHub",url:_t.githubRepository},{name:"Documentation",url:_t.documentation}],gut=()=>h.jsxs(FI,{sx:{mt:16,mb:4},children:[h.jsx(ui,{sx:{mt:4,mb:4}}),h.jsx(ot,{container:!0,spacing:2,justifyContent:"center",children:mut.map((e,t)=>h.jsx(ot,{size:{xs:12,sm:"auto"},children:h.jsx(tt,{fullWidth:!0,size:"small",variant:"outlined",component:fw,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function yut(e){return Qe("MuiAppBar",e)}nt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const but=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return et(i,yut,r)},YK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,vut=me(Wr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(Ge(({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(Bn(["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?YK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?YK(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"})}}]}))),xut=k.forwardRef(function(t,n){const r=st({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=but(c);return h.jsx(vut,{square:!0,component:"header",ownerState:c,elevation:4,className:Te(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function Sut(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=ul(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 wut(e){return typeof e=="function"?e():e}function I5(e,t,n){const r=wut(n),i=Sut(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Cut=k.forwardRef(function(t,n){const r=so(),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:f=i,in:p,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Na,...D}=t,O=k.useRef(null),T=jr(Ef(l),O,n),I=U=>K=>{U&&(K===void 0?U(O.current):U(O.current,K))},L=I((U,K)=>{I5(u,U,c),qO(U),g&&g(U,K)}),$=I((U,K)=>{const X=rf({timeout:A,style:w,easing:f},{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,K)}),R=I(y),F=I(C),P=I(U=>{const K=rf({timeout:A,style:w,easing:f},{mode:"exit"});U.style.webkitTransition=r.transitions.create("-webkit-transform",K),U.style.transition=r.transitions.create("transform",K),I5(u,U,c),v&&v(U)}),z=I(U=>{U.style.webkitTransition="",U.style.transition="",S&&S(U)}),N=U=>{s&&s(O.current,U)},V=k.useCallback(()=>{O.current&&I5(u,O.current,c)},[u,c]);return k.useEffect(()=>{if(p||u==="down"||u==="right")return;const U=HO(()=>{O.current&&I5(u,O.current,c)}),K=ul(O.current);return K.addEventListener("resize",U),()=>{U.clear(),K.removeEventListener("resize",U)}},[u,p,c]),k.useEffect(()=>{p||V()},[p,V]),h.jsx(E,{nodeRef:O,onEnter:L,onEntered:R,onEntering:$,onExit:P,onExited:z,onExiting:F,addEndListener:N,appear:a,in:p,timeout:A,...D,children:(U,{ownerState:K,...X})=>k.cloneElement(l,{ref:T,style:{visibility:U==="exited"&&!p?"hidden":void 0,...w,...l.props.style},...X})})});function Eut(e){return Qe("MuiDrawer",e)}nt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const cce=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},Aut=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ye(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ye(n)}`,r!=="temporary"&&`paperAnchorDocked${ye(n)}`]};return et(i,Eut,t)},kut=me(hT,{name:"MuiDrawer",slot:"Root",overridesResolver:cce})(Ge(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),_ut=me("div",{shouldForwardProp:Hi,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:cce})({flex:"0 0 auto"}),Dut=me(Wr,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ye(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ye(n.anchor)}`]]}})(Ge(({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}`}}]}))),uce={left:"right",right:"left",top:"down",bottom:"up"};function Out(e){return["left","right"].includes(e)}function Tut({direction:e},t){return e==="rtl"&&Out(t)?uce[t]:t}const Mut=k.forwardRef(function(t,n){const r=st({props:t,name:"MuiDrawer"}),i=so(),o=Cf(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:f=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:D={},slotProps:O={},...T}=r,I=k.useRef(!1);k.useEffect(()=>{I.current=!0},[]);const L=Tut({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:f,open:v,variant:E,...T},F=Aut(R),P={slots:{transition:w,...D},slotProps:{paper:S,transition:C,...O,backdrop:UO(O.backdrop||{...l,...g},{transitionDuration:A})}},[z,N]=ut("root",{ref:n,elementType:kut,className:Te(F.root,F.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...P,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:p,slots:{backdrop:P.slots.backdrop},slotProps:{backdrop:P.slotProps.backdrop}}}),[V,U]=ut("paper",{elementType:Dut,shouldForwardComponentProp:!0,className:Te(F.paper,S.className),ownerState:R,externalForwardedProps:P,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[K,X]=ut("docked",{elementType:_ut,ref:n,className:Te(F.root,F.docked,u),ownerState:R,externalForwardedProps:P,additionalProps:T}),[B,W]=ut("transition",{elementType:Cut,ownerState:R,externalForwardedProps:P,additionalProps:{in:v,direction:uce[L],timeout:A,appear:I.current}}),q=h.jsx(V,{...U,children:c});if(E==="permanent")return h.jsx(K,{...X,children:q});const H=h.jsx(B,{...W,children:q});return E==="persistent"?h.jsx(K,{...X,children:H}):h.jsx(z,{...N,children:H})}),Rut=sX({themeId:ba}),Iut={error:_f,warn:hw,info:dT,debug:Iw},jut=({open:e,onClose:t})=>{const n=so(),r=k.useMemo(()=>({error:n.palette.error.main,warn:n.palette.warning.main,info:n.palette.info.main,debug:n.palette.secondary.main}),[n]),[i,o]=k.useState([]),[s,a]=k.useState(!0),[l,c]=k.useState("error,warn,info".split(",")),[u,f]=k.useState(""),[p,g]=k.useState(!0),y=k.useCallback(async()=>{try{const w=new URLSearchParams({level:l.join(","),limit:"500",...u&&{search:u}}),A=await fetch(`api/logs?${w}`);if(A.ok){const E=await A.json();o(E.entries)}}catch(w){console.error("Failed to fetch logs:",w)}finally{a(!1)}},[l,u]);k.useEffect(()=>{e&&y()},[e,y]),k.useEffect(()=>{if(!p||!e)return;const w=setInterval(y,5e3);return()=>clearInterval(w)},[p,e,y]);const b=w=>{c(Array.isArray(w.target.value)?w.target.value:[w.target.value])},v=w=>{f(w.target.value)},S=async()=>{try{await fetch("api/logs",{method:"DELETE"}),o([])}catch(w){console.error("Failed to clear logs:",w)}},C=w=>{const A=Iut[w]||dT;return h.jsx(A,{sx:{fontSize:16,color:r[w]}})};return h.jsxs(Vs,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(qs,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(Iw,{}),"System Logs",h.jsx(se,{sx:{flexGrow:1}}),h.jsx(Qt,{title:"Auto Refresh",children:h.jsx(pt,{label:p?"Auto":"Manual",color:p?"success":"default",size:"small",onClick:()=>g(!p),sx:{cursor:"pointer"}})}),h.jsx(tn,{onClick:t,children:h.jsx(IJ,{})})]}),h.jsxs(Ws,{children:[h.jsx(Lt,{spacing:2,sx:{mb:2},children:h.jsxs(Lt,{direction:"row",spacing:2,alignItems:"center",children:[h.jsxs(va,{size:"small",sx:{minWidth:200},children:[h.jsx(mc,{children:"Log Level"}),h.jsxs(ha,{value:l,label:"Log Level",onChange:b,multiple:!0,renderValue:w=>h.jsx(se,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(w)?w:[w]).map(A=>h.jsx(pt,{label:A.toUpperCase(),size:"small",sx:{backgroundColor:r[A],color:"white"}},A))}),children:[h.jsx(rr,{value:"error",children:"Error"}),h.jsx(rr,{value:"warn",children:"Warning"}),h.jsx(rr,{value:"info",children:"Info"}),h.jsx(rr,{value:"debug",children:"Debug"})]})]}),h.jsx(Rr,{size:"small",placeholder:"Search logs...",value:u,onChange:v,sx:{flexGrow:1}}),h.jsx(tt,{variant:"outlined",onClick:y,children:"Refresh"}),h.jsx(tt,{variant:"outlined",color:"error",onClick:S,children:"Clear"})]})}),h.jsx(se,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:s?h.jsx(se,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(ie,{children:"Loading logs..."})}):i.length===0?h.jsx(se,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(ie,{color:"text.secondary",children:"No logs found"})}):h.jsx(Lt,{spacing:1,children:i.map((w,A)=>h.jsxs(se,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[C(w.level),h.jsx(ie,{variant:"caption",color:"text.secondary",children:new Date(w.timestamp).toLocaleString()}),h.jsx(pt,{label:w.level.toUpperCase(),size:"small",sx:{backgroundColor:r[w.level],color:n.palette.getContrastText(r[w.level]??n.palette.grey[500]),fontSize:"0.7rem",height:20}})]}),h.jsx(ie,{sx:{ml:3},children:w.message}),w.context&&h.jsx(ie,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(w.context,null,2)})]},`${w.timestamp}-${w.level}-${A}`))})})]}),h.jsx(Da,{children:h.jsx(tt,{onClick:t,children:"Close"})})]})};function XK(){const{isConnected:e}=rZ(),[t,n]=k.useState(null),[r,i]=k.useState(!1);k.useEffect(()=>{const y=async()=>{try{const v=await fetch("api/health");if(v.ok){const S=await v.json();n(S),i(!1)}else i(!0)}catch{i(!0)}};y();const b=setInterval(y,3e4);return()=>clearInterval(b)},[]);const o=y=>{const b=Math.floor(y/3600),v=Math.floor(y%3600/60);return b>0?`${b}h ${v}m`:`${v}m`},s=t?.status==="healthy"&&!r,a=t?.services?.bridges,l=a&&a.total>0&&a.running===a.total,c=a&&a.total===0,u=t?h.jsxs(se,{sx:{p:.5},children:[h.jsxs("div",{children:[h.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),h.jsxs("div",{children:[h.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&h.jsxs("div",{children:[h.jsx("strong",{children:"Bridges:"})," ",t.services.bridges.running??0,"/",t.services.bridges.total??0," running",(t.services.bridges.stopped??0)>0&&` (${t.services.bridges.stopped} stopped)`]}),t.services?.homeAssistant&&h.jsxs("div",{children:[h.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),h.jsxs("div",{children:[h.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?h.jsx(_f,{fontSize:"small"}):l?h.jsx(Fa,{fontSize:"small"}):h.jsx(bw,{fontSize:"small"}),p=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?c?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return h.jsx(Qt,{title:u,arrow:!0,children:h.jsx(pt,{icon:f(),label:g(),color:p(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Put=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"}))),$ut=e=>{const t=lce();return h.jsxs(se,{component:xc,to:_t.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[h.jsx(Put,{style:{height:"40px"}}),h.jsx(ie,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&h.jsx(ie,{variant:"caption",component:"span",children:t.version})]})},Lut=()=>{const e=Rut("(min-width:600px)"),{mode:t,setMode:n}=tw(),[r,i]=k.useState(!1),[o,s]=k.useState(!1),a=$u(),l=Sf(),c=g=>g?g==="/"?l.pathname==="/":l.pathname.startsWith(g):!1,u=()=>{n(t==="dark"?"light":"dark")},f=[{label:"Dashboard",icon:h.jsx(PT,{}),to:_t.dashboard},{label:"Bridges",icon:h.jsx(gy,{}),to:_t.bridges},{label:"All Devices",icon:h.jsx(Us,{}),to:_t.devices},{label:"Network Map",icon:h.jsx(RT,{}),to:_t.networkMap},{label:"Startup Order",icon:h.jsx(Gm,{}),to:_t.startup},{label:"Lock Credentials",icon:h.jsx(xu,{}),to:_t.lockCredentials},{label:"Filter Reference",icon:h.jsx($T,{}),to:_t.labels},{label:"Settings",icon:h.jsx(Db,{}),to:_t.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?h.jsx($8e,{}):h.jsx(A8e,{}),onClick:u},{label:"System Logs",icon:h.jsx(Iw,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:h.jsx(mT,{}),to:_t.health}],p=g=>{s(!1),g.onClick?g.onClick():g.to&&a(g.to)};return h.jsxs(se,{children:[h.jsx(xut,{sx:{height:"72px"},children:h.jsx(ace,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:h.jsxs(FI,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx($ut,{large:e}),e?h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:1},children:[f.map(g=>g.to?h.jsx(Qt,{title:g.label,children:h.jsx(tn,{component:xc,to:g.to,sx:{color:"inherit",bgcolor:c(g.to)?"rgba(255,255,255,0.15)":"transparent",borderRadius:1},children:g.icon})},g.label):h.jsx(Qt,{title:g.label,children:h.jsx(tn,{onClick:g.onClick,sx:{color:"inherit"},children:g.icon})},g.label)),h.jsx(XK,{})]}):h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(XK,{}),h.jsx(tn,{onClick:()=>s(!0),sx:{color:"inherit"},children:h.jsx(L8e,{})})]})]})})}),h.jsx(Mut,{anchor:"right",open:o,onClose:()=>s(!1),children:h.jsx(vl,{sx:{width:250},children:f.map(g=>h.jsxs(Fve,{selected:c(g.to),onClick:()=>p(g),children:[h.jsx(Qa,{children:g.icon}),h.jsx(fa,{primary:g.label})]},g.label))})}),h.jsx(jut,{open:r,onClose:()=>i(!1)})]})},Nut=()=>{const{versionMismatch:e,frontendVersion:t,backendVersion:n}=lce(),{isConnected:r}=rZ();return h.jsxs(se,{children:[h.jsx(Lut,{}),h.jsx(ace,{}),e&&h.jsxs(Ht,{severity:"warning",variant:"filled",sx:{borderRadius:0},action:h.jsx(tt,{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(FI,{sx:{p:2},children:h.jsx(fut,{children:h.jsx(_Y,{})})}),h.jsx(gut,{})]})},Fut=JS({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 j4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");j4?.startsWith("http")&&(j4=new URL(j4).pathname);const But=ape([{path:"/",element:h.jsx(Nut,{}),children:nut}],{basename:j4});Ade.createRoot(document.getElementById("root")).render(h.jsx(k.StrictMode,{children:h.jsx(Hde,{store:lut,children:h.jsxs(S1e,{theme:Fut,children:[h.jsx(g1e,{}),h.jsx(SX,{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(W2e,{children:h.jsx($ye,{children:h.jsx(vpe,{router:But})})})]})})}));
499
+ `},Alt={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 klt(e){let{announcements:t=Alt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Elt}=e;const{announce:o,announcement:s}=Slt(),a=hv("DndLiveRegion"),[l,c]=k.useState(!1);if(k.useEffect(()=>{c(!0)},[]),wlt(k.useMemo(()=>({onDragStart(f){let{active:p}=f;o(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:g}=f;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(f){let{active:p,over:g}=f;o(t.onDragOver({active:p,over:g}))},onDragEnd(f){let{active:p,over:g}=f;o(t.onDragEnd({active:p,over:g}))},onDragCancel(f){let{active:p,over:g}=f;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!l)return null;const u=Kt.createElement(Kt.Fragment,null,Kt.createElement(vlt,{id:r,value:i.draggable}),Kt.createElement(xlt,{id:a,announcement:s}));return n?jd.createPortal(u,n):u}var Fi;(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"})(Fi||(Fi={}));function TS(){}function $K(e,t){return k.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _lt(){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 gl=Object.freeze({x:0,y:0});function zle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hle(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Dlt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function LK(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 Ule(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function NK(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 Olt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=NK(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=zle(NK(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(Hle)},Tlt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=LK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=LK(l),u=i.reduce((p,g,y)=>p+zle(c[y],g),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(Hle)};function Mlt(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,f=u/(l+c-u);return Number(f.toFixed(4))}return 0}const Rlt=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=Mlt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Dlt)};function Ilt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Vle(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:gl}function jlt(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 Plt=jlt(1);function $lt(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 Llt(e,t,n){const r=$lt(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,f=o?e.height/o:e.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const Nlt={ignoreTransform:!1};function bg(e,t){t===void 0&&(t=Nlt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=bs(e).getComputedStyle(e);c&&(n=Llt(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 FK(e){return bg(e,{ignoreTransform:!0})}function Flt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Blt(e,t){return t===void 0&&(t=bs(e).getComputedStyle(e)),t.position==="fixed"}function zlt(e,t){t===void 0&&(t=bs(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 t8(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(MI(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!dv(i)||Nle(i)||n.includes(i))return n;const o=bs(e).getComputedStyle(i);return i!==e&&zlt(i,o)&&n.push(i),Blt(i,o)?n:r(i.parentNode)}return e?r(e):n}function Wle(e){const[t]=t8(e,1);return t??null}function sk(e){return!e8||!e?null:gg(e)?e:TI(e)?MI(e)||e===yg(e).scrollingElement?window:dv(e)?e:null:null}function qle(e){return gg(e)?e.scrollX:e.scrollLeft}function Gle(e){return gg(e)?e.scrollY:e.scrollTop}function cO(e){return{x:qle(e),y:Gle(e)}}var Qi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Qi||(Qi={}));function Kle(e){return!e8||!e?!1:e===document.scrollingElement}function Yle(e){const t={x:0,y:0},n=Kle(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 Hlt={x:.2,y:.2};function Ult(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Hlt);const{isTop:c,isBottom:u,isLeft:f,isRight:p}=Yle(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=Qi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=Qi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!p&&a>=t.right-b.width?(g.x=Qi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Qi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function Vlt(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 Xle(e){return e.reduce((t,n)=>cm(t,cO(n)),gl)}function Wlt(e){return e.reduce((t,n)=>t+qle(n),0)}function qlt(e){return e.reduce((t,n)=>t+Gle(n),0)}function Glt(e,t){if(t===void 0&&(t=bg),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);Wle(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Klt=[["x",["left","right"],Wlt],["y",["top","bottom"],qlt]];class jI{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=t8(n),i=Xle(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of Klt)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 Ny{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 Ylt(e){const{EventTarget:t}=bs(e);return e instanceof t?e:yg(e)}function ak(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 la;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(la||(la={}));function BK(e){e.preventDefault()}function Xlt(e){e.stopPropagation()}var Nn;(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"})(Nn||(Nn={}));const Zle={start:[Nn.Space,Nn.Enter],cancel:[Nn.Esc],end:[Nn.Space,Nn.Enter,Nn.Tab]},Zlt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Nn.Right:return{...n,x:n.x+25};case Nn.Left:return{...n,x:n.x-25};case Nn.Down:return{...n,y:n.y+25};case Nn.Up:return{...n,y:n.y-25}}};class PI{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 Ny(yg(n)),this.windowListeners=new Ny(bs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(la.Resize,this.handleCancel),this.windowListeners.add(la.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(la.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Glt(r),n(gl)}handleKeyDown(t){if(II(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Zle,coordinateGetter:s=Zlt,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}:gl;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(t,{active:n,context:r.current,currentCoordinates:u});if(f){const p=lb(f,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:D}=Yle(b),O=Vlt(b),T={x:Math.min(v===Nn.Right?O.right-O.width/2:O.right,Math.max(v===Nn.Right?O.left:O.left+O.width/2,f.x)),y:Math.min(v===Nn.Down?O.bottom-O.height/2:O.bottom,Math.max(v===Nn.Down?O.top:O.top+O.height/2,f.y))},I=v===Nn.Right&&!C||v===Nn.Left&&!w,L=v===Nn.Down&&!A||v===Nn.Up&&!S;if(I&&T.x!==f.x){const $=b.scrollLeft+p.x,R=v===Nn.Right&&$<=E.x||v===Nn.Left&&$>=D.x;if(R&&!p.y){b.scrollTo({left:$,behavior:a});return}R?g.x=b.scrollLeft-$:g.x=v===Nn.Right?b.scrollLeft-E.x:b.scrollLeft-D.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(L&&T.y!==f.y){const $=b.scrollTop+p.y,R=v===Nn.Down&&$<=E.y||v===Nn.Up&&$>=D.y;if(R&&!p.x){b.scrollTo({top:$,behavior:a});return}R?g.y=b.scrollTop-$:g.y=v===Nn.Down?b.scrollTop-E.y:b.scrollTop-D.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,cm(lb(f,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()}}PI.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Zle,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 zK(e){return!!(e&&"distance"in e)}function HK(e){return!!(e&&"delay"in e)}class $I{constructor(t,n,r){var i;r===void 0&&(r=Ylt(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=yg(s),this.documentListeners=new Ny(this.document),this.listeners=new Ny(r),this.windowListeners=new Ny(bs(s)),this.initialCoordinates=(i=lO(o))!=null?i:gl,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(la.Resize,this.handleCancel),this.windowListeners.add(la.DragStart,BK),this.windowListeners.add(la.VisibilityChange,this.handleCancel),this.windowListeners.add(la.ContextMenu,BK),this.documentListeners.add(la.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(HK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(zK(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(la.Click,Xlt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(la.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=lO(t))!=null?n:gl,c=lb(i,l);if(!r&&a){if(zK(a)){if(a.tolerance!=null&&ak(c,a.tolerance))return this.handleCancel();if(ak(c,a.distance))return this.handleStart()}if(HK(a)&&ak(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===Nn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Jlt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class LI extends $I{constructor(t){const{event:n}=t,r=yg(n.target);super(t,Jlt,r)}}LI.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 Qlt={move:{name:"mousemove"},end:{name:"mouseup"}};var uO;(function(e){e[e.RightClick=2]="RightClick"})(uO||(uO={}));class ect extends $I{constructor(t){super(t,Qlt,yg(t.event.target))}}ect.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===uO.RightClick?!1:(r?.({event:n}),!0)}}];const lk={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tct extends $I{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(){}}}tct.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 Fy;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Fy||(Fy={}));var MS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(MS||(MS={}));function nct(e){let{acceleration:t,activator:n=Fy.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=MS.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:p}=e;const g=ict({delta:f,disabled:!o}),[y,b]=plt(),v=k.useRef({x:0,y:0}),S=k.useRef({x:0,y:0}),C=k.useMemo(()=>{switch(n){case Fy.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Fy.DraggableRect:return i}},[n,i,l]),w=k.useRef(null),A=k.useCallback(()=>{const D=w.current;if(!D)return;const O=v.current.x*S.current.x,T=v.current.y*S.current.y;D.scrollBy(O,T)},[]),E=k.useMemo(()=>a===MS.TreeOrder?[...c].reverse():c,[a,c]);k.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const D of E){if(r?.(D)===!1)continue;const O=c.indexOf(D),T=u[O];if(!T)continue;const{direction:I,speed:L}=Ult(D,T,C,t,p);for(const $ of["x","y"])g[$][I[$]]||(L[$]=0,I[$]=0);if(L.x>0||L.y>0){b(),w.current=D,y(A,s),v.current=L,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 rct={x:{[Qi.Backward]:!1,[Qi.Forward]:!1},y:{[Qi.Backward]:!1,[Qi.Forward]:!1}};function ict(e){let{delta:t,disabled:n}=e;const r=aO(t);return fv(i=>{if(n||!r||!i)return rct;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Qi.Backward]:i.x[Qi.Backward]||o.x===-1,[Qi.Forward]:i.x[Qi.Forward]||o.x===1},y:{[Qi.Backward]:i.y[Qi.Backward]||o.y===-1,[Qi.Forward]:i.y[Qi.Forward]||o.y===1}}},[n,t,r])}function oct(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return fv(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function sct(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 ub;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ub||(ub={}));var dO;(function(e){e.Optimized="optimized"})(dO||(dO={}));const UK=new Map;function act(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),f=v(),p=ab(f),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=fv(S=>{if(f&&!n)return UK;if(!S||S===UK||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 jI(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return k.useEffect(()=>{u.current=e},[e]),k.useEffect(()=>{f||g()},[n,f]),k.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),k.useEffect(()=>{f||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,f,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case ub.Always:return!1;case ub.BeforeDragging:return n;default:return!n}}}function Jle(e,t){return fv(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lct(e,t){return Jle(e,t)}function cct(e){let{callback:t,disabled:n}=e;const r=RI(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 n8(e){let{callback:t,disabled:n}=e;const r=RI(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 uct(e){return new jI(bg(e),e)}function VK(e,t,n){t===void 0&&(t=uct);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=cct({callback(l){if(e)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=n8({callback:o});return kc(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function dct(e){const t=Jle(e);return Vle(e,t)}const WK=[];function fct(e){const t=k.useRef(e),n=fv(r=>e?r&&r!==WK&&e&&t.current&&e.parentNode===t.current.parentNode?r:t8(e):WK,[e]);return k.useEffect(()=>{t.current=e},[e]),n}function hct(e){const[t,n]=k.useState(null),r=k.useRef(e),i=k.useCallback(o=>{const s=sk(o.target);s&&n(a=>a?(a.set(s,cO(s)),new Map(a)):null)},[]);return k.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=sk(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,cO(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=sk(l);c?.removeEventListener("scroll",i)})}},[i,e]),k.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>cm(o,s),gl):Xle(e):gl,[e,t])}function qK(e,t){t===void 0&&(t=[]);const n=k.useRef(null);return k.useEffect(()=>{n.current=null},t),k.useEffect(()=>{const r=e!==gl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lb(e,n.current):gl}function pct(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 mct(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 Qle(e){return k.useMemo(()=>e?Flt(e):null,[e])}const GK=[];function gct(e,t){t===void 0&&(t=bg);const[n]=e,r=Qle(n?bs(n):null),[i,o]=k.useState(GK);function s(){o(()=>e.length?e.map(l=>Kle(l)?r:new jI(t(l),l)):GK)}const a=n8({callback:s});return kc(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function yct(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return dv(t)?t:e}function bct(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(f=>{const p=t(u);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),o=n8({callback:i}),s=k.useCallback(c=>{const u=yct(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=OS(s);return k.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const vct=[{sensor:LI,options:{}},{sensor:PI,options:{}}],xct={current:{}},I4={draggable:{measure:FK},droppable:{measure:FK,strategy:ub.WhileDragging,frequency:dO.Optimized},dragOverlay:{measure:bg}};class By 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 Sct={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new By,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:TS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:I4,measureDroppableContainers:TS,windowRect:null,measuringScheduled:!1},wct={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:TS,draggableNodes:new Map,over:null,measureDroppableContainers:TS},r8=k.createContext(wct),ece=k.createContext(Sct);function Cct(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new By}}}function Ect(e,t){switch(t.type){case Fi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Fi.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 Fi.DragEnd:case Fi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Fi.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new By(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Fi.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 By(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Fi.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new By(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Act(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=k.useContext(r8),o=aO(r),s=aO(n?.id);return k.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!II(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 f=ylt(u);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function kct(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function _ct(e){return k.useMemo(()=>({draggable:{...I4.draggable,...e?.draggable},droppable:{...I4.droppable,...e?.droppable},dragOverlay:{...I4.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Dct(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;kc(()=>{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),f=Vle(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Wle(c);p&&p.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const tce=k.createContext({...gl,scaleX:1,scaleY:1});var kd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(kd||(kd={}));const Oct=k.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=vct,collisionDetection:f=Rlt,measuring:p,modifiers:g,...y}=t;const b=k.useReducer(Ect,void 0,Cct),[v,S]=b,[C,w]=Clt(),[A,E]=k.useState(kd.Uninitialized),D=A===kd.Initialized,{draggable:{active:O,nodes:T,translate:I},droppable:{containers:L}}=v,$=O!=null?T.get(O):null,R=k.useRef({initial:null,translated:null}),F=k.useMemo(()=>{var Ot;return O!=null?{id:O,data:(Ot=$?.data)!=null?Ot:xct,rect:R}:null},[O,$]),P=k.useRef(null),[z,N]=k.useState(null),[V,U]=k.useState(null),K=ab(y,Object.values(y)),X=hv("DndDescribedBy",s),B=k.useMemo(()=>L.getEnabled(),[L]),W=_ct(p),{droppableRects:q,measureDroppableContainers:H,measuringScheduled:Y}=act(B,{dragging:D,dependencies:[I.x,I.y],config:W.droppable}),J=oct(T,O),ne=k.useMemo(()=>V?lO(V):null,[V]),ee=vr(),re=lct(J,W.draggable.measure);Dct({activeNode:O!=null?T.get(O):null,config:ee.layoutShiftCompensation,initialRect:re,measure:W.draggable.measure});const le=VK(J,W.draggable.measure,re),te=VK(J?J.parentElement:null),Z=k.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=L.getNodeFor((n=Z.current.over)==null?void 0:n.id),ae=bct({measure:W.dragOverlay.measure}),fe=(r=ae.nodeRef.current)!=null?r:J,be=D?(i=ae.rect)!=null?i:le:null,De=!!(ae.nodeRef.current&&ae.rect),Oe=dct(De?null:le),Ke=Qle(fe?bs(fe):null),xe=fct(D?oe??J:null),Le=gct(xe),Me=kct(g,{transform:{x:I.x-Oe.x,y:I.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:V,active:F,activeNodeRect:le,containerNodeRect:te,draggingNodeRect:be,over:Z.current.over,overlayNodeRect:ae.rect,scrollableAncestors:xe,scrollableAncestorRects:Le,windowRect:Ke}),mt=ne?cm(ne,I):null,yt=hct(xe),ze=qK(yt),je=qK(yt,[le]),He=cm(Me,ze),Je=be?Plt(be,Me):null,rt=F&&Je?f({active:F,collisionRect:Je,droppableRects:q,droppableContainers:B,pointerCoordinates:mt}):null,at=Ule(rt,"id"),[Xe,Ft]=k.useState(null),Bt=De?Me:cm(Me,je),Tt=Ilt(Bt,(o=Xe?.rect)!=null?o:null,le),Qn=k.useRef(null),ln=k.useCallback((Ot,$t)=>{let{sensor:nn,options:$n}=$t;if(P.current==null)return;const cn=T.get(P.current);if(!cn)return;const Ct=Ot.nativeEvent,bn=new nn({active:P.current,activeNode:cn,event:Ct,options:$n,context:Z,onAbort(xr){if(!T.get(xr))return;const{onDragAbort:ue}=K.current,pe={id:xr};ue?.(pe),C({type:"onDragAbort",event:pe})},onPending(xr,ni,ue,pe){if(!T.get(xr))return;const{onDragPending:Fe}=K.current,Ue={id:xr,constraint:ni,initialCoordinates:ue,offset:pe};Fe?.(Ue),C({type:"onDragPending",event:Ue})},onStart(xr){const ni=P.current;if(ni==null)return;const ue=T.get(ni);if(!ue)return;const{onDragStart:pe}=K.current,Se={activatorEvent:Ct,active:{id:ni,data:ue.data,rect:R}};jd.unstable_batchedUpdates(()=>{pe?.(Se),E(kd.Initializing),S({type:Fi.DragStart,initialCoordinates:xr,active:ni}),C({type:"onDragStart",event:Se}),N(Qn.current),U(Ct)})},onMove(xr){S({type:Fi.DragMove,coordinates:xr})},onEnd:ti(Fi.DragEnd),onCancel:ti(Fi.DragCancel)});Qn.current=bn;function ti(xr){return async function(){const{active:ue,collisions:pe,over:Se,scrollAdjustedTranslate:Fe}=Z.current;let Ue=null;if(ue&&Fe){const{cancelDrop:vt}=K.current;Ue={activatorEvent:Ct,active:ue,collisions:pe,delta:Fe,over:Se},xr===Fi.DragEnd&&typeof vt=="function"&&await Promise.resolve(vt(Ue))&&(xr=Fi.DragCancel)}P.current=null,jd.unstable_batchedUpdates(()=>{S({type:xr}),E(kd.Uninitialized),Ft(null),N(null),U(null),Qn.current=null;const vt=xr===Fi.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const it=K.current[vt];it?.(Ue),C({type:vt,event:Ue})}})}}},[T]),ct=k.useCallback((Ot,$t)=>(nn,$n)=>{const cn=nn.nativeEvent,Ct=T.get($n);if(P.current!==null||!Ct||cn.dndKit||cn.defaultPrevented)return;const bn={active:Ct};Ot(nn,$t.options,bn)===!0&&(cn.dndKit={capturedBy:$t.sensor},P.current=$n,ln(nn,$t))},[T,ln]),Vt=sct(u,ct);pct(u),kc(()=>{le&&A===kd.Initializing&&E(kd.Initialized)},[le,A]),k.useEffect(()=>{const{onDragMove:Ot}=K.current,{active:$t,activatorEvent:nn,collisions:$n,over:cn}=Z.current;if(!$t||!nn)return;const Ct={active:$t,activatorEvent:nn,collisions:$n,delta:{x:He.x,y:He.y},over:cn};jd.unstable_batchedUpdates(()=>{Ot?.(Ct),C({type:"onDragMove",event:Ct})})},[He.x,He.y]),k.useEffect(()=>{const{active:Ot,activatorEvent:$t,collisions:nn,droppableContainers:$n,scrollAdjustedTranslate:cn}=Z.current;if(!Ot||P.current==null||!$t||!cn)return;const{onDragOver:Ct}=K.current,bn=$n.get(at),ti=bn&&bn.rect.current?{id:bn.id,rect:bn.rect.current,data:bn.data,disabled:bn.disabled}:null,xr={active:Ot,activatorEvent:$t,collisions:nn,delta:{x:cn.x,y:cn.y},over:ti};jd.unstable_batchedUpdates(()=>{Ft(ti),Ct?.(xr),C({type:"onDragOver",event:xr})})},[at]),kc(()=>{Z.current={activatorEvent:V,active:F,activeNode:J,collisionRect:Je,collisions:rt,droppableRects:q,draggableNodes:T,draggingNode:fe,draggingNodeRect:be,droppableContainers:L,over:Xe,scrollableAncestors:xe,scrollAdjustedTranslate:He},R.current={initial:be,translated:Je}},[F,J,rt,Je,T,fe,be,q,L,Xe,xe,He]),nct({...ee,delta:I,draggingRect:Je,pointerCoordinates:mt,scrollableAncestors:xe,scrollableAncestorRects:Le});const On=k.useMemo(()=>({active:F,activeNode:J,activeNodeRect:le,activatorEvent:V,collisions:rt,containerNodeRect:te,dragOverlay:ae,draggableNodes:T,droppableContainers:L,droppableRects:q,over:Xe,measureDroppableContainers:H,scrollableAncestors:xe,scrollableAncestorRects:Le,measuringConfiguration:W,measuringScheduled:Y,windowRect:Ke}),[F,J,le,V,rt,te,ae,T,L,q,Xe,H,xe,Le,W,Y,Ke]),Yn=k.useMemo(()=>({activatorEvent:V,activators:Vt,active:F,activeNodeRect:le,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Xe,measureDroppableContainers:H}),[V,Vt,F,le,S,X,T,Xe,H]);return Kt.createElement(Ble.Provider,{value:w},Kt.createElement(r8.Provider,{value:Yn},Kt.createElement(ece.Provider,{value:On},Kt.createElement(tce.Provider,{value:Tt},c)),Kt.createElement(Act,{disabled:a?.restoreFocus===!1})),Kt.createElement(klt,{...a,hiddenTextDescribedById:X}));function vr(){const Ot=z?.autoScrollEnabled===!1,$t=typeof l=="object"?l.enabled===!1:l===!1,nn=D&&!Ot&&!$t;return typeof l=="object"?{...l,enabled:nn}:{enabled:nn}}}),Tct=k.createContext(null),KK="button",Mct="Draggable";function Rct(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=hv(Mct),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:p}=k.useContext(r8),{role:g=KK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=k.useContext(v?tce:Tct),[C,w]=OS(),[A,E]=OS(),D=mct(s,t),O=ab(n);kc(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:O}),()=>{const I=f.get(t);I&&I.key===o&&f.delete(t)}),[f,t]);const T=k.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===KK?!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:D,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Ict(){return k.useContext(ece)}const jct="Droppable",Pct={timeout:25};function $ct(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=hv(jct),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=k.useContext(r8),u=k.useRef({disabled:n}),f=k.useRef(!1),p=k.useRef(null),g=k.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Pct,...i},S=ab(b??r),C=k.useCallback(()=>{if(!f.current){f.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=n8({callback:C,disabled:y||!s}),A=k.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),f.current=!1),T&&w.observe(T))},[w]),[E,D]=OS(A),O=ab(t);return k.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),k.useEffect(()=>(a({type:Fi.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:p,data:O}}),()=>a({type:Fi.UnregisterDroppable,key:o,id:r})),[r]),k.useEffect(()=>{n!==u.current.disabled&&(a({type:Fi.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:D}}function NI(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Lct(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function M5(e){return e!==null&&e>=0}function Nct(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 Fct(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const nce=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=NI(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}},R5={scaleX:1,scaleY:1},Bct=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,...R5}:null}const l=zct(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...R5}:i<n&&i>=s?{x:0,y:a.height+l,...R5}:{x:0,y:0,...R5}};function zct(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 rce="Sortable",ice=Kt.createContext({activeIndex:-1,containerId:rce,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:nce,disabled:{draggable:!1,droppable:!1}});function Hct(e){let{children:t,id:n,items:r,strategy:i=nce,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Ict(),f=hv(rce,n),p=a.rect!==null,g=k.useMemo(()=>r.map(D=>typeof D=="object"&&"id"in D?D.id:D),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=k.useRef(g),C=!Nct(g,S.current),w=v!==-1&&b===-1||C,A=Fct(o);kc(()=>{C&&y&&u(g)},[C,g,y,u]),k.useEffect(()=>{S.current=g},[g]);const E=k.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:p,sortedRects:Lct(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,p,i]);return Kt.createElement(ice.Provider,{value:E},t)}const Uct=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return NI(n,r,i).indexOf(t)},Vct=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},Wct={duration:200,easing:"ease"},oce="transform",qct=cb.Transition.toString({property:oce,duration:0,easing:"linear"}),Gct={roleDescription:"sortable"};function Kct(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=k.useState(null),a=k.useRef(n);return kc(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=bg(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 Yct(e){let{animateLayoutChanges:t=Vct,attributes:n,disabled:r,data:i,getNewIndex:o=Uct,id:s,strategy:a,resizeObserverConfig:l,transition:c=Wct}=e;const{items:u,containerId:f,activeIndex:p,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=k.useContext(ice),w=Xct(r,g),A=u.indexOf(s),E=k.useMemo(()=>({sortable:{containerId:f,index:A,items:u},...i}),[f,i,A,u]),D=k.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:O,node:T,isOver:I,setNodeRef:L}=$ct({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:D,...l}}),{active:$,activatorEvent:R,activeNodeRect:F,attributes:P,setNodeRef:z,listeners:N,isDragging:V,over:U,setActivatorNodeRef:K,transform:X}=Rct({id:s,data:E,attributes:{...Gct,...n},disabled:w.draggable}),B=hlt(L,z),W=!!$,q=W&&!y&&M5(p)&&M5(v),H=!S&&V,Y=H&&q?X:null,ne=q?Y??(a??C)({rects:b,activeNodeRect:F,activeIndex:p,overIndex:v,index:A}):null,ee=M5(p)&&M5(v)?o({id:s,items:u,activeIndex:p,overIndex:v}):A,re=$?.id,le=k.useRef({activeId:re,items:u,newIndex:ee,containerId:f}),te=u!==le.current.items,Z=t({active:$,containerId:f,isDragging:V,isSorting:W,id:s,index:A,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:c,wasDragging:le.current.activeId!=null}),oe=Kct({disabled:!Z,index:A,node:T,rect:O});return k.useEffect(()=>{W&&le.current.newIndex!==ee&&(le.current.newIndex=ee),f!==le.current.containerId&&(le.current.containerId=f),u!==le.current.items&&(le.current.items=u)},[W,ee,f,u]),k.useEffect(()=>{if(re===le.current.activeId)return;if(re!=null&&le.current.activeId==null){le.current.activeId=re;return}const fe=setTimeout(()=>{le.current.activeId=re},50);return()=>clearTimeout(fe)},[re]),{active:$,activeIndex:p,attributes:P,data:E,rect:O,index:A,newIndex:ee,items:u,isOver:I,isSorting:W,isDragging:V,listeners:N,node:T,overIndex:v,over:U,setNodeRef:B,setActivatorNodeRef:K,setDroppableNodeRef:L,setDraggableNodeRef:z,transform:oe??ne,transition:ae()};function ae(){if(oe||te&&le.current.newIndex===A)return qct;if(!(H&&!II(R)||!c)&&(W||Z))return cb.Transition.toString({...c,property:oce})}}function Xct(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 RS(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 Zct=[Nn.Down,Nn.Right,Nn.Up,Nn.Left],Jct=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(Zct.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=i.get(f.id);if(p)switch(e.code){case Nn.Down:r.top<p.top&&l.push(f);break;case Nn.Up:r.top>p.top&&l.push(f);break;case Nn.Left:r.left>p.left&&l.push(f);break;case Nn.Right:r.left<p.left&&l.push(f);break}});const c=Tlt({collisionRect:r,droppableRects:i,droppableContainers:l});let u=Ule(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const f=o.get(n.id),p=o.get(u),g=p?i.get(p.id):null,y=p?.node.current;if(y&&g&&f&&p){const v=t8(y).some((D,O)=>a[O]!==D),S=sce(f,p),C=Qct(f,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:lb(A,w)}}}};function sce(e,t){return!RS(e)||!RS(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Qct(e,t){return!RS(e)||!RS(t)||!sce(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const eut=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=Yct({id:e.id}),[l,c]=k.useState(!1);k.useEffect(()=>{$w(e.id).then(c)},[e.id]);const u={transform:cb.Transform.toString(o),transition:s,opacity:a?.5:1};return h.jsx(Pn,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:h.jsxs(Gn,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[h.jsx(se,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:h.jsx(D8e,{})}),h.jsx(pt,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?h.jsx(se,{component:"img",src:a2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(hl,{sx:{bgcolor:HT(e),width:40,height:40,boxShadow:2},children:(()=>{const f=zT(e);return h.jsx(f,{sx:{fontSize:24}})})()}),h.jsxs(se,{sx:{flex:1},children:[h.jsx(ie,{variant:"subtitle1",fontWeight:500,children:e.name}),h.jsxs(ie,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," β€’ Priority: ",e.priority??100]})]})]})})},tut=()=>{const e=_c(),{content:t,isLoading:n}=Ym(),r=YCe(),[i,o]=k.useState([]),[s,a]=k.useState(!1);k.useEffect(()=>{if(t){const p=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(p),a(!1)}},[t]);const l=_lt($K(LI),$K(PI,{coordinateGetter:Jct})),c=k.useCallback(p=>{const{active:g,over:y}=p;y&&g.id!==y.id&&(o(b=>{const v=b.findIndex(C=>C.id===g.id),S=b.findIndex(C=>C.id===y.id);return NI(b,v,S)}),a(!0))},[]),u=k.useCallback(async()=>{const p=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(p),e.show({message:"Startup order saved successfully",severity:"success"}),a(!1)}catch(g){e.show({message:g instanceof Error?g.message:"Failed to save startup order",severity:"error"})}},[i,r,e]),f=k.useMemo(()=>i.map(p=>p.id),[i]);return n?h.jsx(ie,{children:"Loading..."}):h.jsxs(Lt,{spacing:3,children:[h.jsx(Cb,{items:[{name:"Bridges",to:_t.bridges},{name:"Startup Order",to:_t.startup}]}),h.jsxs(se,{display:"flex",alignItems:"center",gap:2,children:[h.jsx(Gm,{color:"primary",fontSize:"large"}),h.jsxs(se,{children:[h.jsx(ie,{variant:"h5",fontWeight:600,children:"Startup Order"}),h.jsx(ie,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&h.jsx(Ht,{severity:"info",action:h.jsx(tt,{color:"inherit",size:"small",startIcon:h.jsx(a6,{}),onClick:u,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),h.jsx(Oct,{sensors:l,collisionDetection:Olt,onDragEnd:c,children:h.jsx(Hct,{items:f,strategy:Bct,children:h.jsx(Lt,{spacing:1,children:i.map((p,g)=>h.jsx(eut,{bridge:p,index:g},p.id))})})}),i.length===0&&h.jsx(ie,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&h.jsx(se,{display:"flex",justifyContent:"flex-end",children:h.jsx(tt,{variant:"contained",startIcon:h.jsx(a6,{}),onClick:u,children:"Save Startup Order"})})]})},ck="https://riddix.github.io/home-assistant-matter-hub",_t={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:ck,faq:{multiFabric:`${ck}/connect-multiple-fabrics`,bridgeConfig:`${ck}/bridge-configuration`}},nut=[{path:"",element:h.jsx(q2e,{}),children:[{path:"",element:h.jsx(H9e,{})},{path:_t.bridges,element:h.jsx($9e,{})},{path:_t.createBridge,element:h.jsx(Ret,{})},{path:_t.areaSetup,element:h.jsx(wve,{})},{path:_t.bridge(":bridgeId"),element:h.jsx(d8e,{})},{path:_t.editBridge(":bridgeId"),element:h.jsx(Iet,{})},{path:_t.devices,element:h.jsx(s7e,{})},{path:_t.networkMap,element:h.jsx(alt,{})},{path:_t.health,element:h.jsx(Bet,{})},{path:_t.labels,element:h.jsx(Vet,{})},{path:_t.lockCredentials,element:h.jsx(Xet,{})},{path:_t.settings,element:h.jsx(flt,{})},{path:_t.startup,element:h.jsx(tut,{})},{path:"*",element:h.jsx(Zet,{})}]}],rut={items:{isInitialized:!1,isLoading:!1}},iut=JO(rut,e=>{e.addCase(Oo.pending,t=>{t.items.isLoading=!0}).addCase(Oo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Oo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(XX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(JX.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(QX.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(ZX.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(eZ,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(tZ,(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)}})}),out={byBridge:{}},sut=JO(out,e=>{e.addCase(Su.pending,(t,n)=>{t.byBridge[n.meta.arg]=uk(t.byBridge[n.meta.arg],n)}).addCase(Su.rejected,(t,n)=>{t.byBridge[n.meta.arg]=uk(t.byBridge[n.meta.arg],n)}).addCase(Su.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=uk(t.byBridge[n.meta.arg],n)})}),aut={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},uk=JO(aut,e=>{e.addCase(Su.pending,t=>{t.isLoading=!0}).addCase(Su.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(Su.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),lut=_2e({reducer:{bridges:iut,devices:sut}}),FI=uge({createStyledComponent:me("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ye(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>st({props:e,name:"MuiContainer"})});function cut(e){return Qe("MuiToolbar",e)}nt("MuiToolbar",["root","gutters","regular","dense"]);const uut=e=>{const{classes:t,disableGutters:n,variant:r}=e;return et({root:["root",!n&&"gutters",r]},cut,t)},dut=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ge(({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}]}))),ace=k.forwardRef(function(t,n){const r=st({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=uut(c);return h.jsx(dut,{as:o,className:Te(u.root,i),ref:n,ownerState:c,...l})});class fut 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(se,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[h.jsx(uT,{color:"error",sx:{fontSize:64}}),h.jsx(ie,{variant:"h5",fontWeight:600,children:"Something went wrong"}),h.jsx(ie,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??"An unexpected error occurred."}),h.jsx(tt,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:"Reload Page"})]}):this.props.children}}const hut="home-assistant-matter-hub",put={name:hut};function lce(){const e="2.1.0-alpha.459",[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:put.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}const mut=[{name:"GitHub",url:_t.githubRepository},{name:"Documentation",url:_t.documentation}],gut=()=>h.jsxs(FI,{sx:{mt:16,mb:4},children:[h.jsx(ui,{sx:{mt:4,mb:4}}),h.jsx(ot,{container:!0,spacing:2,justifyContent:"center",children:mut.map((e,t)=>h.jsx(ot,{size:{xs:12,sm:"auto"},children:h.jsx(tt,{fullWidth:!0,size:"small",variant:"outlined",component:fw,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function yut(e){return Qe("MuiAppBar",e)}nt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const but=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return et(i,yut,r)},YK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,vut=me(Wr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(Ge(({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(Bn(["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?YK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?YK(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"})}}]}))),xut=k.forwardRef(function(t,n){const r=st({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=but(c);return h.jsx(vut,{square:!0,component:"header",ownerState:c,elevation:4,className:Te(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function Sut(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=ul(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 wut(e){return typeof e=="function"?e():e}function I5(e,t,n){const r=wut(n),i=Sut(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const Cut=k.forwardRef(function(t,n){const r=so(),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:f=i,in:p,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Na,...D}=t,O=k.useRef(null),T=jr(Ef(l),O,n),I=U=>K=>{U&&(K===void 0?U(O.current):U(O.current,K))},L=I((U,K)=>{I5(u,U,c),qO(U),g&&g(U,K)}),$=I((U,K)=>{const X=rf({timeout:A,style:w,easing:f},{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,K)}),R=I(y),F=I(C),P=I(U=>{const K=rf({timeout:A,style:w,easing:f},{mode:"exit"});U.style.webkitTransition=r.transitions.create("-webkit-transform",K),U.style.transition=r.transitions.create("transform",K),I5(u,U,c),v&&v(U)}),z=I(U=>{U.style.webkitTransition="",U.style.transition="",S&&S(U)}),N=U=>{s&&s(O.current,U)},V=k.useCallback(()=>{O.current&&I5(u,O.current,c)},[u,c]);return k.useEffect(()=>{if(p||u==="down"||u==="right")return;const U=HO(()=>{O.current&&I5(u,O.current,c)}),K=ul(O.current);return K.addEventListener("resize",U),()=>{U.clear(),K.removeEventListener("resize",U)}},[u,p,c]),k.useEffect(()=>{p||V()},[p,V]),h.jsx(E,{nodeRef:O,onEnter:L,onEntered:R,onEntering:$,onExit:P,onExited:z,onExiting:F,addEndListener:N,appear:a,in:p,timeout:A,...D,children:(U,{ownerState:K,...X})=>k.cloneElement(l,{ref:T,style:{visibility:U==="exited"&&!p?"hidden":void 0,...w,...l.props.style},...X})})});function Eut(e){return Qe("MuiDrawer",e)}nt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const cce=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},Aut=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ye(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ye(n)}`,r!=="temporary"&&`paperAnchorDocked${ye(n)}`]};return et(i,Eut,t)},kut=me(hT,{name:"MuiDrawer",slot:"Root",overridesResolver:cce})(Ge(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),_ut=me("div",{shouldForwardProp:Hi,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:cce})({flex:"0 0 auto"}),Dut=me(Wr,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ye(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ye(n.anchor)}`]]}})(Ge(({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}`}}]}))),uce={left:"right",right:"left",top:"down",bottom:"up"};function Out(e){return["left","right"].includes(e)}function Tut({direction:e},t){return e==="rtl"&&Out(t)?uce[t]:t}const Mut=k.forwardRef(function(t,n){const r=st({props:t,name:"MuiDrawer"}),i=so(),o=Cf(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:f=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:D={},slotProps:O={},...T}=r,I=k.useRef(!1);k.useEffect(()=>{I.current=!0},[]);const L=Tut({direction:o?"rtl":"ltr"},a),R={...r,anchor:a,elevation:f,open:v,variant:E,...T},F=Aut(R),P={slots:{transition:w,...D},slotProps:{paper:S,transition:C,...O,backdrop:UO(O.backdrop||{...l,...g},{transitionDuration:A})}},[z,N]=ut("root",{ref:n,elementType:kut,className:Te(F.root,F.modal,u),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...P,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:p,slots:{backdrop:P.slots.backdrop},slotProps:{backdrop:P.slotProps.backdrop}}}),[V,U]=ut("paper",{elementType:Dut,shouldForwardComponentProp:!0,className:Te(F.paper,S.className),ownerState:R,externalForwardedProps:P,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[K,X]=ut("docked",{elementType:_ut,ref:n,className:Te(F.root,F.docked,u),ownerState:R,externalForwardedProps:P,additionalProps:T}),[B,W]=ut("transition",{elementType:Cut,ownerState:R,externalForwardedProps:P,additionalProps:{in:v,direction:uce[L],timeout:A,appear:I.current}}),q=h.jsx(V,{...U,children:c});if(E==="permanent")return h.jsx(K,{...X,children:q});const H=h.jsx(B,{...W,children:q});return E==="persistent"?h.jsx(K,{...X,children:H}):h.jsx(z,{...N,children:H})}),Rut=sX({themeId:ba}),Iut={error:_f,warn:hw,info:dT,debug:Iw},jut=({open:e,onClose:t})=>{const n=so(),r=k.useMemo(()=>({error:n.palette.error.main,warn:n.palette.warning.main,info:n.palette.info.main,debug:n.palette.secondary.main}),[n]),[i,o]=k.useState([]),[s,a]=k.useState(!0),[l,c]=k.useState("error,warn,info".split(",")),[u,f]=k.useState(""),[p,g]=k.useState(!0),y=k.useCallback(async()=>{try{const w=new URLSearchParams({level:l.join(","),limit:"500",...u&&{search:u}}),A=await fetch(`api/logs?${w}`);if(A.ok){const E=await A.json();o(E.entries)}}catch(w){console.error("Failed to fetch logs:",w)}finally{a(!1)}},[l,u]);k.useEffect(()=>{e&&y()},[e,y]),k.useEffect(()=>{if(!p||!e)return;const w=setInterval(y,5e3);return()=>clearInterval(w)},[p,e,y]);const b=w=>{c(Array.isArray(w.target.value)?w.target.value:[w.target.value])},v=w=>{f(w.target.value)},S=async()=>{try{await fetch("api/logs",{method:"DELETE"}),o([])}catch(w){console.error("Failed to clear logs:",w)}},C=w=>{const A=Iut[w]||dT;return h.jsx(A,{sx:{fontSize:16,color:r[w]}})};return h.jsxs(Vs,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(qs,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(Iw,{}),"System Logs",h.jsx(se,{sx:{flexGrow:1}}),h.jsx(Qt,{title:"Auto Refresh",children:h.jsx(pt,{label:p?"Auto":"Manual",color:p?"success":"default",size:"small",onClick:()=>g(!p),sx:{cursor:"pointer"}})}),h.jsx(tn,{onClick:t,children:h.jsx(IJ,{})})]}),h.jsxs(Ws,{children:[h.jsx(Lt,{spacing:2,sx:{mb:2},children:h.jsxs(Lt,{direction:"row",spacing:2,alignItems:"center",children:[h.jsxs(va,{size:"small",sx:{minWidth:200},children:[h.jsx(mc,{children:"Log Level"}),h.jsxs(ha,{value:l,label:"Log Level",onChange:b,multiple:!0,renderValue:w=>h.jsx(se,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(w)?w:[w]).map(A=>h.jsx(pt,{label:A.toUpperCase(),size:"small",sx:{backgroundColor:r[A],color:"white"}},A))}),children:[h.jsx(rr,{value:"error",children:"Error"}),h.jsx(rr,{value:"warn",children:"Warning"}),h.jsx(rr,{value:"info",children:"Info"}),h.jsx(rr,{value:"debug",children:"Debug"})]})]}),h.jsx(Rr,{size:"small",placeholder:"Search logs...",value:u,onChange:v,sx:{flexGrow:1}}),h.jsx(tt,{variant:"outlined",onClick:y,children:"Refresh"}),h.jsx(tt,{variant:"outlined",color:"error",onClick:S,children:"Clear"})]})}),h.jsx(se,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:s?h.jsx(se,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(ie,{children:"Loading logs..."})}):i.length===0?h.jsx(se,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(ie,{color:"text.secondary",children:"No logs found"})}):h.jsx(Lt,{spacing:1,children:i.map((w,A)=>h.jsxs(se,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[C(w.level),h.jsx(ie,{variant:"caption",color:"text.secondary",children:new Date(w.timestamp).toLocaleString()}),h.jsx(pt,{label:w.level.toUpperCase(),size:"small",sx:{backgroundColor:r[w.level],color:n.palette.getContrastText(r[w.level]??n.palette.grey[500]),fontSize:"0.7rem",height:20}})]}),h.jsx(ie,{sx:{ml:3},children:w.message}),w.context&&h.jsx(ie,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(w.context,null,2)})]},`${w.timestamp}-${w.level}-${A}`))})})]}),h.jsx(Da,{children:h.jsx(tt,{onClick:t,children:"Close"})})]})};function XK(){const{isConnected:e}=rZ(),[t,n]=k.useState(null),[r,i]=k.useState(!1);k.useEffect(()=>{const y=async()=>{try{const v=await fetch("api/health");if(v.ok){const S=await v.json();n(S),i(!1)}else i(!0)}catch{i(!0)}};y();const b=setInterval(y,3e4);return()=>clearInterval(b)},[]);const o=y=>{const b=Math.floor(y/3600),v=Math.floor(y%3600/60);return b>0?`${b}h ${v}m`:`${v}m`},s=t?.status==="healthy"&&!r,a=t?.services?.bridges,l=a&&a.total>0&&a.running===a.total,c=a&&a.total===0,u=t?h.jsxs(se,{sx:{p:.5},children:[h.jsxs("div",{children:[h.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),h.jsxs("div",{children:[h.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&h.jsxs("div",{children:[h.jsx("strong",{children:"Bridges:"})," ",t.services.bridges.running??0,"/",t.services.bridges.total??0," running",(t.services.bridges.stopped??0)>0&&` (${t.services.bridges.stopped} stopped)`]}),t.services?.homeAssistant&&h.jsxs("div",{children:[h.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),h.jsxs("div",{children:[h.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?h.jsx(_f,{fontSize:"small"}):l?h.jsx(Fa,{fontSize:"small"}):h.jsx(bw,{fontSize:"small"}),p=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?c?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return h.jsx(Qt,{title:u,arrow:!0,children:h.jsx(pt,{icon:f(),label:g(),color:p(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Put=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"}))),$ut=e=>{const t=lce();return h.jsxs(se,{component:xc,to:_t.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[h.jsx(Put,{style:{height:"40px"}}),h.jsx(ie,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&h.jsx(ie,{variant:"caption",component:"span",children:t.version})]})},Lut=()=>{const e=Rut("(min-width:600px)"),{mode:t,setMode:n}=tw(),[r,i]=k.useState(!1),[o,s]=k.useState(!1),a=$u(),l=Sf(),c=g=>g?g==="/"?l.pathname==="/":l.pathname.startsWith(g):!1,u=()=>{n(t==="dark"?"light":"dark")},f=[{label:"Dashboard",icon:h.jsx(PT,{}),to:_t.dashboard},{label:"Bridges",icon:h.jsx(gy,{}),to:_t.bridges},{label:"All Devices",icon:h.jsx(Us,{}),to:_t.devices},{label:"Network Map",icon:h.jsx(RT,{}),to:_t.networkMap},{label:"Startup Order",icon:h.jsx(Gm,{}),to:_t.startup},{label:"Lock Credentials",icon:h.jsx(xu,{}),to:_t.lockCredentials},{label:"Filter Reference",icon:h.jsx($T,{}),to:_t.labels},{label:"Settings",icon:h.jsx(Db,{}),to:_t.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?h.jsx($8e,{}):h.jsx(A8e,{}),onClick:u},{label:"System Logs",icon:h.jsx(Iw,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:h.jsx(mT,{}),to:_t.health}],p=g=>{s(!1),g.onClick?g.onClick():g.to&&a(g.to)};return h.jsxs(se,{children:[h.jsx(xut,{sx:{height:"72px"},children:h.jsx(ace,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:h.jsxs(FI,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx($ut,{large:e}),e?h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:1},children:[f.map(g=>g.to?h.jsx(Qt,{title:g.label,children:h.jsx(tn,{component:xc,to:g.to,sx:{color:"inherit",bgcolor:c(g.to)?"rgba(255,255,255,0.15)":"transparent",borderRadius:1},children:g.icon})},g.label):h.jsx(Qt,{title:g.label,children:h.jsx(tn,{onClick:g.onClick,sx:{color:"inherit"},children:g.icon})},g.label)),h.jsx(XK,{})]}):h.jsxs(se,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(XK,{}),h.jsx(tn,{onClick:()=>s(!0),sx:{color:"inherit"},children:h.jsx(L8e,{})})]})]})})}),h.jsx(Mut,{anchor:"right",open:o,onClose:()=>s(!1),children:h.jsx(vl,{sx:{width:250},children:f.map(g=>h.jsxs(Fve,{selected:c(g.to),onClick:()=>p(g),children:[h.jsx(Qa,{children:g.icon}),h.jsx(fa,{primary:g.label})]},g.label))})}),h.jsx(jut,{open:r,onClose:()=>i(!1)})]})},Nut=()=>{const{versionMismatch:e,frontendVersion:t,backendVersion:n}=lce(),{isConnected:r}=rZ();return h.jsxs(se,{children:[h.jsx(Lut,{}),h.jsx(ace,{}),e&&h.jsxs(Ht,{severity:"warning",variant:"filled",sx:{borderRadius:0},action:h.jsx(tt,{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(FI,{sx:{p:2},children:h.jsx(fut,{children:h.jsx(_Y,{})})}),h.jsx(gut,{})]})},Fut=JS({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 j4=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");j4?.startsWith("http")&&(j4=new URL(j4).pathname);const But=ape([{path:"/",element:h.jsx(Nut,{}),children:nut}],{basename:j4});Ade.createRoot(document.getElementById("root")).render(h.jsx(k.StrictMode,{children:h.jsx(Hde,{store:lut,children:h.jsxs(S1e,{theme:Fut,children:[h.jsx(g1e,{}),h.jsx(SX,{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(W2e,{children:h.jsx($ye,{children:h.jsx(vpe,{router:But})})})]})})}));
@@ -8,7 +8,7 @@
8
8
  <!-- BASE -->
9
9
  <base href="/" />
10
10
  <!-- /BASE -->
11
- <script type="module" crossorigin src="./assets/index-DH46MeHL.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-3_k-_Epd.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.458",
4
+ "version": "2.1.0-alpha.459",
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.458",
61
- "@home-assistant-matter-hub/frontend": "2.1.0-alpha.458",
62
- "@home-assistant-matter-hub/common": "2.1.0-alpha.458"
60
+ "@home-assistant-matter-hub/backend": "2.1.0-alpha.459",
61
+ "@home-assistant-matter-hub/frontend": "2.1.0-alpha.459",
62
+ "@home-assistant-matter-hub/common": "2.1.0-alpha.459"
63
63
  },
64
64
  "nx": {
65
65
  "targets": {