@riddix/hamh 2.1.0-alpha.384 → 2.1.0-alpha.385
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.
|
@@ -204,7 +204,7 @@ export default theme;`}function AF(e){return typeof e=="number"?`${(e*100).toFix
|
|
|
204
204
|
`));if(i[e]!=null||r[e]!=null&&r[e].parentId!==t)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${e}"`].join(`
|
|
205
205
|
`))}const uAe=[],St={domStructure:dn(e=>e.domStructure),disabledItemFocusable:dn(e=>e.disabledItemsFocusable),itemMetaLookup:dn(e=>e.itemMetaLookup),itemOrderedChildrenIdsLookup:dn(e=>e.itemOrderedChildrenIdsLookup),itemMeta:dn((e,t)=>e.itemMetaLookup[t??Ja]??null),itemOrderedChildrenIds:dn((e,t)=>e.itemOrderedChildrenIdsLookup[t??Ja]??uAe),itemModel:dn((e,t)=>e.itemModelLookup[t]),isItemDisabled:dn((e,t)=>YC(e.itemMetaLookup,t)),itemIndex:dn((e,t)=>{const n=e.itemMetaLookup[t];return n==null?-1:e.itemChildrenIndexesLookup[n.parentId??Ja][n.id]}),itemParentId:dn((e,t)=>e.itemMetaLookup[t]?.parentId??null),itemDepth:dn((e,t)=>e.itemMetaLookup[t]?.depth??0),canItemBeFocused:dn((e,t)=>e.disabledItemsFocusable||!YC(e.itemMetaLookup,t)),itemChildrenIndentation:dn(e=>e.itemChildrenIndentation)};class Nw{constructor(t){this.store=t}static shouldRebuildItemsState=(t,n)=>["items","isItemDisabled","isItemSelectionDisabled","getItemId","getItemLabel","getItemChildren"].some(r=>{const i=r;return t[i]!==n[i]});static buildItemsStateIfNeeded=t=>{const n={},r={},i={},o={};function s(a,l,u){const c=l??Ja,{metaLookup:f,modelLookup:h,orderedChildrenIds:g,childrenIndexes:y,itemsChildren:b}=EB({storeParameters:t,items:a,parentId:l,depth:u,isItemExpandable:(v,S)=>!!S&&S.length>0,otherItemsMetaLookup:n});Object.assign(n,f),Object.assign(r,h),i[c]=g,o[c]=y;for(const v of b)s(v.children||[],v.id,u+1)}return s(t.items,null,0),{itemMetaLookup:n,itemModelLookup:r,itemOrderedChildrenIdsLookup:i,itemChildrenIndexesLookup:o}};getItem=t=>St.itemModel(this.store.state,t);getItemTree=()=>{const t=n=>{const r=St.itemModel(this.store.state,n),i=dt({},r),o=St.itemOrderedChildrenIds(this.store.state,n);return o.length>0?i.children=o.map(t):delete i.children,i};return St.itemOrderedChildrenIds(this.store.state,null).map(t)};getItemOrderedChildrenIds=t=>St.itemOrderedChildrenIds(this.store.state,t);getParentId=t=>St.itemMeta(this.store.state,t)?.parentId||null;setIsItemDisabled=({itemId:t,shouldBeDisabled:n})=>{if(!this.store.state.itemMetaLookup[t])return;const r=dt({},this.store.state.itemMetaLookup);r[t]=dt({},r[t],{disabled:n??!r[t].disabled}),this.store.set("itemMetaLookup",r)};buildPublicAPI=()=>({getItem:this.getItem,getItemDOMElement:this.getItemDOMElement,getItemOrderedChildrenIds:this.getItemOrderedChildrenIds,getItemTree:this.getItemTree,getParentId:this.getParentId,setIsItemDisabled:this.setIsItemDisabled});getItemDOMElement=t=>{const n=St.itemMeta(this.store.state,t);if(n==null)return null;const r=bv.treeItemIdAttribute(this.store.state,t,n.idAttribute);return document.getElementById(r)};setItemChildren=({items:t,parentId:n,getChildrenCount:r})=>{const i=n??Ja,o=n==null?-1:St.itemDepth(this.store.state,n),{metaLookup:s,modelLookup:a,orderedChildrenIds:l,childrenIndexes:u}=EB({storeParameters:this.store.parameters,items:t,parentId:n,depth:o+1,isItemExpandable:r?c=>r(c)!==0:()=>!1,otherItemsMetaLookup:St.itemMetaLookup(this.store.state)});this.store.update({itemModelLookup:dt({},this.store.state.itemModelLookup,a),itemMetaLookup:dt({},this.store.state.itemMetaLookup,s),itemOrderedChildrenIdsLookup:dt({},this.store.state.itemOrderedChildrenIdsLookup,{[i]:l}),itemChildrenIndexesLookup:dt({},this.store.state.itemChildrenIndexesLookup,{[i]:u})})};removeChildren=t=>{const n=this.store.state.itemMetaLookup,r=Object.keys(n).reduce((a,l)=>{const u=n[l];return u.parentId===t?a:dt({},a,{[u.id]:u})},{}),i=dt({},this.store.state.itemOrderedChildrenIdsLookup),o=dt({},this.store.state.itemChildrenIndexesLookup),s=t??Ja;delete o[s],delete i[s],this.store.update({itemMetaLookup:r,itemOrderedChildrenIdsLookup:i,itemChildrenIndexesLookup:o})};handleItemClick=(t,n)=>{this.store.parameters.onItemClick?.(t,n)}}const zJ=yv(e=>e.selectedItems,e=>Array.isArray(e)?e:e!=null?[e]:[]),AB=yv(zJ,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),N4=dn((e,t)=>e.itemMetaLookup[t]?.selectable??!0),Un={selectedItemsRaw:dn(e=>e.selectedItems),selectedItems:zJ,selectedItemsMap:AB,enabled:dn(e=>!e.disableSelection),isMultiSelectEnabled:dn(e=>e.multiSelect),isCheckboxSelectionEnabled:dn(e=>e.checkboxSelection),propagationRules:dn(e=>e.selectionPropagation),isItemSelected:dn(AB,(e,t)=>e.has(t)),isFeatureEnabledForItem:dn(N4,e=>!e.disableSelection,(e,t,n)=>t&&e),canItemBeSelected:dn(St.isItemDisabled,N4,e=>!e.disableSelection,(e,t,n,r)=>n&&!e&&t),isItemSelectable:N4},cAe=dn((e,t)=>{if(Un.isItemSelected(e,t))return"checked";let n=!1,r=!1;const i=s=>{s!==t&&(Un.isItemSelected(e,s)?n=!0:r=!0),St.itemOrderedChildrenIds(e,s).forEach(i)};return i(t),Un.propagationRules(e).parents?n&&r?"indeterminate":n&&!r?"checked":"empty":n?"indeterminate":"empty"}),dAe=({props:e})=>{const{itemId:t}=e,{store:n}=Ug(),r=Xr(n,Un.isCheckboxSelectionEnabled),i=Xr(n,Un.isFeatureEnabledForItem,t),o=Xr(n,Un.canItemBeSelected,t),s=Xr(n,cAe,t);return{propsEnhancers:{root:()=>{let a;return s==="checked"?a=!0:s==="indeterminate"?a="mixed":o?a=!1:a=void 0,{"aria-checked":a}},checkbox:({externalEventHandlers:a,interactions:l})=>({tabIndex:-1,onChange:c=>{a.onChange?.(c),!c.defaultMuiPrevented&&Un.canItemBeSelected(n.state,t)&&l.handleCheckboxSelection(c)},visible:r&&i,disabled:!o,checked:s==="checked",indeterminate:s==="indeterminate"})}}},L4=yv(e=>e.expandedItems,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),hi={expandedItemsRaw:dn(e=>e.expandedItems),expandedItemsMap:L4,flatList:yv(St.itemOrderedChildrenIdsLookup,L4,(e,t)=>{function n(r){if(!t.has(r))return[r];const i=[r],o=e[r]||[];for(const s of o)i.push(...n(s));return i}return(e[Ja]??[]).flatMap(n)}),triggerSlot:dn(e=>e.expansionTrigger),isItemExpanded:dn(L4,(e,t)=>e.has(t)),isItemExpandable:dn(St.itemMeta,(e,t)=>e?.expandable??!1)},W6=(e,t)=>{let n=t.length-1;for(;n>=0&&!St.canItemBeFocused(e,t[n]);)n-=1;if(n!==-1)return t[n]},UJ=(e,t)=>{const n=St.itemMeta(e,t);if(!n)return null;const r=St.itemOrderedChildrenIds(e,n.parentId),i=St.itemIndex(e,t);if(i===0)return n.parentId;let o=i-1;for(;!St.canItemBeFocused(e,r[o])&&o>=0;)o-=1;if(o===-1)return n.parentId==null?null:UJ(e,n.parentId);let s=r[o],a=W6(e,St.itemOrderedChildrenIds(e,s));for(;hi.isItemExpanded(e,s)&&a!=null;)s=a,a=W6(e,St.itemOrderedChildrenIds(e,s));return s},Lw=(e,t)=>{if(hi.isItemExpanded(e,t)){const r=St.itemOrderedChildrenIds(e,t).find(i=>St.canItemBeFocused(e,i));if(r!=null)return r}let n=St.itemMeta(e,t);for(;n!=null;){const r=St.itemOrderedChildrenIds(e,n.parentId),i=St.itemIndex(e,n.id);if(i<r.length-1){let o=i+1;for(;!St.canItemBeFocused(e,r[o])&&o<r.length-1;)o+=1;if(St.canItemBeFocused(e,r[o]))return r[o]}n=St.itemMeta(e,n.parentId)}return null},HJ=e=>{let t=null;for(;t==null||hi.isItemExpanded(e,t);){const n=St.itemOrderedChildrenIds(e,t),r=W6(e,n);if(r==null)return t;t=r}return t},XC=e=>St.itemOrderedChildrenIds(e,null).find(t=>St.canItemBeFocused(e,t)),VJ=(e,t,n)=>{if(t===n)return[t,n];const r=St.itemMeta(e,t),i=St.itemMeta(e,n);if(!r||!i)return[t,n];if(r.parentId===i.id||i.parentId===r.id)return i.parentId===r.id?[r.id,i.id]:[i.id,r.id];const o=[r.id],s=[i.id];let a=r.parentId,l=i.parentId,u=s.indexOf(a)!==-1,c=o.indexOf(l)!==-1,f=!0,h=!0;for(;!c&&!u;)f&&(o.push(a),u=s.indexOf(a)!==-1,f=a!==null,!u&&f&&(a=St.itemParentId(e,a))),h&&!u&&(s.push(l),c=o.indexOf(l)!==-1,h=l!==null,!c&&h&&(l=St.itemParentId(e,l)));const g=u?a:l,y=St.itemOrderedChildrenIds(e,g),b=o[o.indexOf(g)-1],v=s[s.indexOf(g)-1];return y.indexOf(b)<y.indexOf(v)?[t,n]:[n,t]},fAe=(e,t,n)=>{const r=l=>{if(hi.isItemExpandable(e,l)&&hi.isItemExpanded(e,l))return St.itemOrderedChildrenIds(e,l)[0];let u=St.itemMeta(e,l);for(;u!=null;){const c=St.itemOrderedChildrenIds(e,u.parentId),f=St.itemIndex(e,u.id);if(f<c.length-1)return c[f+1];u=u.parentId?St.itemMeta(e,u.parentId):null}throw new Error("Invalid range")},[i,o]=VJ(e,t,n),s=[i];let a=i;for(;a!==o;)a=r(a),St.isItemDisabled(e,a)||s.push(a);return s},hAe=e=>{let t=XC(e);const n=[];for(;t!=null;)n.push(t),t=Lw(e,t);return n},q6=(e,t)=>t!==e.closest('*[role="treeitem"]');class pAe{lastSelectedItem=null;lastSelectedRange={};constructor(t){this.store=t,t.itemPluginManager.register(dAe,null)}setSelectedItems=(t,n,r)=>{const{selectionPropagation:i=u1,selectedItems:o,onItemSelectionToggle:s,onSelectedItemsChange:a}=this.store.parameters,l=Un.selectedItemsRaw(this.store.state);let u;const c=Un.isMultiSelectEnabled(this.store.state);if(c&&(i.descendants||i.parents)?u=mAe({store:this.store,selectionPropagation:i,newModel:n,oldModel:l,additionalItemsToPropagate:r}):u=n,s)if(c){const f=WJ({store:this.store,newModel:u,oldModel:l});s&&(f.added.forEach(h=>{s(t,h,!0)}),f.removed.forEach(h=>{s(t,h,!1)}))}else u!==l&&(l!=null&&s(t,l,!1),u!=null&&s(t,u,!0));o===void 0&&this.store.set("selectedItems",u),a?.(t,u)};selectRange=(t,[n,r])=>{if(!Un.isMultiSelectEnabled(this.store.state))return;let o=Un.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length>0&&(o=o.filter(u=>!this.lastSelectedRange[u]));const s=Fw(o),a=fAe(this.store.state,n,r).filter(u=>Un.isItemSelectable(this.store.state,u)),l=a.filter(u=>!s[u]);o=o.concat(l),this.setSelectedItems(t,o),this.lastSelectedRange=Fw(a)};buildPublicAPI=()=>({setItemSelection:this.setItemSelection});setItemSelection=({itemId:t,event:n=null,keepExistingSelection:r=!1,shouldBeSelected:i})=>{if(!Un.enabled(this.store.state))return;let o;const s=Un.isMultiSelectEnabled(this.store.state);if(r){const a=Un.selectedItems(this.store.state),l=Un.isItemSelected(this.store.state,t);l&&(i===!1||i==null)?o=a.filter(u=>u!==t):!l&&(i===!0||i==null)?o=[t].concat(a):o=a}else i===!1||i==null&&Un.isItemSelected(this.store.state,t)?o=s?[]:null:o=s?[t]:t;this.setSelectedItems(n,o,[t]),this.lastSelectedItem=t,this.lastSelectedRange={}};selectAllNavigableItems=t=>{if(!Un.isMultiSelectEnabled(this.store.state))return;const r=hAe(this.store.state);this.setSelectedItems(t,r),this.lastSelectedRange=Fw(r)};expandSelectionRange=(t,n)=>{if(this.lastSelectedItem!=null){const[r,i]=VJ(this.store.state,n,this.lastSelectedItem);this.selectRange(t,[r,i])}};selectRangeFromStartToItem=(t,n)=>{this.selectRange(t,[XC(this.store.state),n])};selectRangeFromItemToEnd=(t,n)=>{this.selectRange(t,[n,HJ(this.store.state)])};selectItemFromArrowNavigation=(t,n,r)=>{if(!Un.isMultiSelectEnabled(this.store.state))return;let o=Un.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length===0?(o.push(r),this.lastSelectedRange={[n]:!0,[r]:!0}):(this.lastSelectedRange[n]||(this.lastSelectedRange={}),this.lastSelectedRange[r]?(o=o.filter(s=>s!==n),delete this.lastSelectedRange[n]):(o.push(r),this.lastSelectedRange[r]=!0)),this.setSelectedItems(t,o)}}function mAe({store:e,selectionPropagation:t,newModel:n,oldModel:r,additionalItemsToPropagate:i}){if(!t.descendants&&!t.parents)return n;let o=!1;const s=Fw(n),a=WJ({store:e,newModel:n,oldModel:r});return i?.forEach(l=>{s[l]?a.added.includes(l)||a.added.push(l):a.removed.includes(l)||a.removed.push(l)}),a.added.forEach(l=>{if(t.descendants){const u=c=>{c!==l&&(o=!0,s[c]=!0),St.itemOrderedChildrenIds(e.state,c).forEach(u)};u(l)}if(t.parents){const u=f=>s[f]?St.itemOrderedChildrenIds(e.state,f).every(u):!1,c=f=>{const h=St.itemParentId(e.state,f);if(h==null)return;St.itemOrderedChildrenIds(e.state,h).every(u)&&(o=!0,s[h]=!0,c(h))};c(l)}}),a.removed.forEach(l=>{if(t.parents){let u=St.itemParentId(e.state,l);for(;u!=null;)s[u]&&(o=!0,delete s[u]),u=St.itemParentId(e.state,u)}if(t.descendants){const u=c=>{c!==l&&(o=!0,delete s[c]),St.itemOrderedChildrenIds(e.state,c).forEach(u)};u(l)}}),o?Object.keys(s):n}function WJ({store:e,oldModel:t,newModel:n}){const r=new Map;return n.forEach(i=>{r.set(i,!0)}),{added:n.filter(i=>!Un.isItemSelected(e.state,i)),removed:t.filter(i=>!r.has(i))}}function Fw(e){const t={};return e.forEach(n=>{t[n]=!0}),t}function gAe(e,t,n){const r=Xr(e,bv.treeId),i=Xr(e,St.itemChildrenIndentation),o=Xr(e,Un.isMultiSelectEnabled);return s=>dt({ref:n,role:"tree",id:r,"aria-multiselectable":o},t,s,{style:dt({},t.style,{"--TreeView-itemChildrenIndentation":typeof i=="number"?`${i}px`:i}),onFocus:a=>{s.onFocus?.(a),e.focus.handleRootFocus(a)},onBlur:a=>{s.onBlur?.(a),e.focus.handleRootBlur(a)}})}function yAe(e){return e.replace(/["\\]/g,"\\$&")}const qJ=O.createContext(null);function GJ(e){const{children:t,itemId:n=null,idAttribute:r}=e,{store:i,rootRef:o}=Ug(),s=O.useRef(new Map);O.useEffect(()=>{if(!o.current)return;const l=St.itemOrderedChildrenIds(i.state,n??null)??[],u=yAe(r??o.current.id);if(n!=null){const g=o.current.querySelector(`*[id="${u}"][role="treeitem"]`);if(g&&g.getAttribute("aria-expanded")==="false")return}const c=o.current.querySelectorAll(`${n==null?"":`*[id="${u}"] `}[role="treeitem"]:not(*[id="${u}"] [role="treeitem"] [role="treeitem"])`),f=Array.from(c).map(g=>s.current.get(g.id));(f.length!==l.length||f.some((g,y)=>g!==l[y]))&&i.jsxItems.setJSXItemsOrderedChildrenIds(n??null,f)});const a=O.useMemo(()=>({registerChild:(l,u)=>s.current.set(l,u),unregisterChild:l=>s.current.delete(l),parentId:n}),[n]);return m.jsx(qJ.Provider,{value:a,children:t})}const JC=O.createContext(()=>-1),bAe=()=>{},G6=typeof document<"u"?O.useLayoutEffect:bAe,vAe=[];function xAe(e){O.useEffect(e,vAe)}function SAe(e,t){const n=ff(),r=uM(()=>new e(dt({},t,{isRtl:n}))).current;return G6(()=>r.updateStateFromParameters(dt({},t,{isRtl:n})),[r,n,t]),xAe(r.disposeEffect),r}class wAe{maxListeners=20;warnOnce=!1;events={};on(t,n,r={}){let i=this.events[t];i||(i={highPriority:new Map,regular:new Map},this.events[t]=i),r.isFirst?i.highPriority.set(n,!0):i.regular.set(n,!0)}removeListener(t,n){this.events[t]&&(this.events[t].regular.delete(n),this.events[t].highPriority.delete(n))}removeAllListeners(){this.events={}}emit(t,...n){const r=this.events[t];if(!r)return;const i=Array.from(r.highPriority.keys()),o=Array.from(r.regular.keys());for(let s=i.length-1;s>=0;s-=1){const a=i[s];r.highPriority.has(a)&&a.apply(this,n)}for(let s=0;s<o.length;s+=1){const a=o[s];r.regular.has(a)&&a.apply(this,n)}}once(t,n){const r=this;this.on(t,function i(...o){r.removeListener(t,i),n.apply(r,o)})}}const CAe=({isItemEditable:e,expansionTrigger:t})=>t||(e?"iconContainer":"content");function KJ(e){return{disabledItemsFocusable:e.disabledItemsFocusable??!1,domStructure:"nested",itemChildrenIndentation:e.itemChildrenIndentation??"12px",providedTreeId:e.id,expansionTrigger:CAe({isItemEditable:e.isItemEditable,expansionTrigger:e.expansionTrigger}),disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,selectionPropagation:e.selectionPropagation??u1}}function kB(e,t,n){return e!==void 0?e:t!==void 0?t:n}function EAe(e){return dt({treeId:void 0,focusedItemId:null},KJ(e),Nw.buildItemsStateIfNeeded(e),{expandedItems:kB(e.expandedItems,e.defaultExpandedItems,[]),selectedItems:kB(e.selectedItems,e.defaultSelectedItems,e.multiSelect?V6:null)})}let _B=0;const AAe=()=>(_B+=1,`mui-tree-view-${_B}`);class kAe{timeoutIds=new Map;intervalIds=new Map;startTimeout=(t,n,r)=>{this.clearTimeout(t);const i=setTimeout(()=>{this.timeoutIds.delete(t),r()},n);this.timeoutIds.set(t,i)};startInterval=(t,n,r)=>{this.clearTimeout(t);const i=setInterval(r,n);this.intervalIds.set(t,i)};clearTimeout=t=>{const n=this.timeoutIds.get(t);n!=null&&(clearTimeout(n),this.timeoutIds.delete(t))};clearInterval=t=>{const n=this.intervalIds.get(t);n!=null&&(clearInterval(n),this.intervalIds.delete(t))};clearAll=()=>{this.timeoutIds.forEach(clearTimeout),this.timeoutIds.clear(),this.intervalIds.forEach(clearInterval),this.intervalIds.clear()}}class _Ae{constructor(t){this.store=t}setExpandedItems=(t,n)=>{this.store.parameters.expandedItems===void 0&&this.store.set("expandedItems",n),this.store.parameters.onExpandedItemsChange?.(t,n)};isItemExpanded=t=>hi.isItemExpanded(this.store.state,t);buildPublicAPI=()=>({isItemExpanded:this.isItemExpanded,setItemExpansion:this.setItemExpansion});setItemExpansion=({itemId:t,event:n=null,shouldBeExpanded:r})=>{const i=hi.isItemExpanded(this.store.state,t),o=r??!i;if(i===o)return;const s={isExpansionPrevented:!1,shouldBeExpanded:o,itemId:t};this.store.publishEvent("beforeItemToggleExpansion",s,n),!s.isExpansionPrevented&&this.applyItemExpansion({itemId:t,event:n,shouldBeExpanded:o})};applyItemExpansion=({itemId:t,event:n,shouldBeExpanded:r})=>{const i=hi.expandedItemsRaw(this.store.state);let o;r?o=[t].concat(i):o=i.filter(s=>s!==t),this.store.parameters.onItemExpansionToggle?.(n,t,r),this.setExpandedItems(n,o)};expandAllSiblings=(t,n)=>{const r=St.itemMeta(this.store.state,n);if(r==null)return;const o=St.itemOrderedChildrenIds(this.store.state,r.parentId).filter(a=>hi.isItemExpandable(this.store.state,a)&&!hi.isItemExpanded(this.store.state,a)),s=hi.expandedItemsRaw(this.store.state).concat(o);o.length>0&&(this.store.parameters.onItemExpansionToggle&&o.forEach(a=>{this.store.parameters.onItemExpansionToggle(t,a,!0)}),this.setExpandedItems(t,s))};addExpandableItems=t=>{const n=dt({},this.store.state.itemMetaLookup);for(const r of t)n[r]=dt({},n[r],{expandable:!0});this.store.set("itemMetaLookup",n)}}const bm={isItemEditable:dn(e=>e.isItemEditable,St.itemModel,(e,t,n)=>!t||e==null?!1:typeof e=="boolean"?e:e(t)),isItemBeingEdited:dn((e,t)=>t==null?!1:e.editedItemId===t),isAnyItemBeingEdited:dn(e=>!!e.editedItemId)},DAe=500;class OAe{typeaheadQuery="";constructor(t){this.store=t,this.labelMap=DB(St.itemMetaLookup(this.store.state)),this.store.registerStoreEffect(St.itemMetaLookup,(n,r)=>{this.store.shouldIgnoreItemsStateUpdate()||(this.labelMap=DB(r))})}canToggleItemSelection=t=>Un.canItemBeSelected(this.store.state,t);canToggleItemExpansion=t=>!St.isItemDisabled(this.store.state,t)&&hi.isItemExpandable(this.store.state,t);getFirstItemMatchingTypeaheadQuery=(t,n)=>{const r=u=>{const c=Lw(this.store.state,u);return c===null?XC(this.store.state):c},i=u=>{let c=null;const f={};let h=u.length>1?t:r(t);for(;c==null&&!f[h];)this.labelMap[h]?.startsWith(u)?c=h:(f[h]=!0,h=r(h));return c},o=n.toLowerCase(),s=`${this.typeaheadQuery}${o}`,a=i(s);if(a!=null)return this.typeaheadQuery=s,a;const l=i(o);return l!=null?(this.typeaheadQuery=o,l):(this.typeaheadQuery="",null)};updateLabelMap=t=>{this.labelMap=t(this.labelMap)};handleItemKeyDown=async(t,n)=>{if(t.defaultMuiPrevented||t.altKey||q6(t.target,t.currentTarget))return;const r=t.ctrlKey||t.metaKey,i=t.key,o=Un.isMultiSelectEnabled(this.store.state);switch(!0){case(i===" "&&this.canToggleItemSelection(n)):{t.preventDefault(),o&&t.shiftKey?this.store.selection.expandSelectionRange(t,n):this.store.selection.setItemSelection({event:t,itemId:n,keepExistingSelection:o,shouldBeSelected:void 0});break}case i==="Enter":{this.store.labelEditing?.setEditedItem&&bm.isItemEditable(this.store.state,n)&&!bm.isItemBeingEdited(this.store.state,n)?this.store.labelEditing.setEditedItem(n):this.canToggleItemExpansion(n)?(this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault()):this.canToggleItemSelection(n)&&(o?(t.preventDefault(),this.store.selection.setItemSelection({event:t,itemId:n,keepExistingSelection:!0})):Un.isItemSelected(this.store.state,n)||(this.store.selection.setItemSelection({event:t,itemId:n}),t.preventDefault()));break}case i==="ArrowDown":{const s=Lw(this.store.state,n);s&&(t.preventDefault(),this.store.focus.focusItem(t,s),o&&t.shiftKey&&this.canToggleItemSelection(s)&&this.store.selection.selectItemFromArrowNavigation(t,n,s));break}case i==="ArrowUp":{const s=UJ(this.store.state,n);s&&(t.preventDefault(),this.store.focus.focusItem(t,s),o&&t.shiftKey&&this.canToggleItemSelection(s)&&this.store.selection.selectItemFromArrowNavigation(t,n,s));break}case(i==="ArrowRight"&&!this.store.parameters.isRtl||i==="ArrowLeft"&&this.store.parameters.isRtl):{if(r)return;if(hi.isItemExpanded(this.store.state,n)){const s=Lw(this.store.state,n);s&&(this.store.focus.focusItem(t,s),t.preventDefault())}else this.canToggleItemExpansion(n)&&(this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault());break}case(i==="ArrowLeft"&&!this.store.parameters.isRtl||i==="ArrowRight"&&this.store.parameters.isRtl):{if(r)return;if(this.canToggleItemExpansion(n)&&hi.isItemExpanded(this.store.state,n))this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault();else{const s=St.itemParentId(this.store.state,n);s&&(this.store.focus.focusItem(t,s),t.preventDefault())}break}case i==="Home":{this.canToggleItemSelection(n)&&o&&r&&t.shiftKey?this.store.selection.selectRangeFromStartToItem(t,n):this.store.focus.focusItem(t,XC(this.store.state)),t.preventDefault();break}case i==="End":{this.canToggleItemSelection(n)&&o&&r&&t.shiftKey?this.store.selection.selectRangeFromItemToEnd(t,n):this.store.focus.focusItem(t,HJ(this.store.state)),t.preventDefault();break}case i==="*":{this.store.expansion.expandAllSiblings(t,n),t.preventDefault();break}case(String.fromCharCode(t.keyCode)==="A"&&r&&o&&Un.enabled(this.store.state)):{this.store.selection.selectAllNavigableItems(t),t.preventDefault();break}case(!r&&!t.shiftKey&&TAe(i)):{this.store.timeoutManager.clearTimeout("typeahead");const s=this.getFirstItemMatchingTypeaheadQuery(n,i);s!=null?(this.store.focus.focusItem(t,s),t.preventDefault()):this.typeaheadQuery="",this.store.timeoutManager.startTimeout("typeahead",DAe,()=>{this.typeaheadQuery=""});break}}}}function TAe(e){return!!e&&e.length===1&&!!e.match(/\S/)}function DB(e){const t={},n=r=>{t[r.id]=r.label.toLowerCase()};return Object.values(e).forEach(n),t}const OB=yv(Un.selectedItems,hi.expandedItemsMap,St.itemMetaLookup,St.disabledItemFocusable,e=>St.itemOrderedChildrenIds(e,null),(e,t,n,r,i)=>{const o=e.find(a=>{if(!r&&YC(n,a))return!1;const l=n[a];return l&&(l.parentId==null||t.has(l.parentId))});if(o!=null)return o;const s=i.find(a=>r||!YC(n,a));return s??null}),ih={defaultFocusableItemId:OB,isItemTheDefaultFocusableItem:dn(OB,(e,t)=>e===t),focusedItemId:dn(e=>e.focusedItemId),isItemFocused:dn((e,t)=>e.focusedItemId===t)};class RAe{constructor(t){this.store=t,this.store.registerStoreEffect(St.itemMetaLookup,()=>{const n=ih.focusedItemId(t.state);if(n==null||!!St.itemMeta(t.state,n))return;const i=ih.defaultFocusableItemId(t.state);if(i==null){this.setFocusedItemId(null);return}this.applyItemFocus(null,i)})}setFocusedItemId=t=>{ih.focusedItemId(this.store.state)!==t&&this.store.set("focusedItemId",t)};applyItemFocus=(t,n)=>{this.store.items.getItemDOMElement(n)?.focus(),this.setFocusedItemId(n),this.store.parameters.onItemFocus?.(t,n)};buildPublicAPI=()=>({focusItem:this.focusItem});focusItem=(t,n)=>{const r=St.itemMeta(this.store.state,n);r&&(r.parentId==null||hi.isItemExpanded(this.store.state,r.parentId))&&this.applyItemFocus(t,n)};removeFocusedItem=()=>{const t=ih.focusedItemId(this.store.state);if(t==null)return;if(St.itemMeta(this.store.state,t)){const r=this.store.items.getItemDOMElement(t);r&&r.blur()}this.setFocusedItemId(null)};handleRootFocus=t=>{if(t.defaultMuiPrevented)return;const n=ih.defaultFocusableItemId(this.store.state);t.target===t.currentTarget&&n!=null&&this.applyItemFocus(t,n)};handleRootBlur=t=>{t.defaultMuiPrevented||this.setFocusedItemId(null)}}class IAe{itemPlugins=[];itemWrappers=[];register=(t,n)=>{this.itemPlugins.push(t),n&&this.itemWrappers.push(n)};listPlugins=()=>this.itemPlugins;listWrappers=()=>this.itemWrappers}class MAe extends cM{initialParameters=null;eventManager=new wAe;timeoutManager=new kAe;itemPluginManager=new IAe;constructor(t,n,r){const i=EAe(t),o=r.getInitialState(i,t);super(o),this.parameters=t,this.instanceName=n,this.mapper=r,this.items=new Nw(this),this.focus=new RAe(this),this.expansion=new _Ae(this),this.selection=new pAe(this),this.keyboardNavigation=new OAe(this)}buildPublicAPI(){return dt({},this.items.buildPublicAPI(),this.focus.buildPublicAPI(),this.expansion.buildPublicAPI(),this.selection.buildPublicAPI())}updateStateFromParameters(t){const n=(o,s,a)=>{t[s]!==void 0&&(o[s]=t[s])},r=KJ(t);n(r,"expandedItems"),n(r,"selectedItems"),(this.state.providedTreeId!==t.id||this.state.treeId===void 0)&&(r.treeId=AAe()),!this.mapper.shouldIgnoreItemsStateUpdate(t)&&Nw.shouldRebuildItemsState(t,this.parameters)&&Object.assign(r,Nw.buildItemsStateIfNeeded(t));const i=this.mapper.updateStateFromParameters(r,t,n);this.update(i),this.parameters=t}disposeEffect=()=>this.timeoutManager.clearAll;shouldIgnoreItemsStateUpdate=()=>this.mapper.shouldIgnoreItemsStateUpdate(this.parameters);registerStoreEffect=(t,n)=>{let r=t(this.state);this.subscribe(i=>{const o=t(i);o!==r&&(n(r,o),r=o)})};publishEvent=(t,n,r)=>{PAe(r)&&r.isPropagationStopped()||this.eventManager.emit(t,n,r)};subscribeEvent=(t,n)=>{this.eventManager.on(t,n)}}function PAe(e){return e?.isPropagationStopped!==void 0}const TB={isEmpty:dn(e=>e.lazyLoadedItems==null?!0:Object.keys(e.lazyLoadedItems.loading).length===0&&Object.keys(e.lazyLoadedItems.errors).length===0),isItemLoading:dn((e,t)=>e.lazyLoadedItems?.loading[t??Ja]??!1),itemHasError:dn((e,t)=>!!e.lazyLoadedItems?.errors[t??Ja]),itemError:dn((e,t)=>e.lazyLoadedItems?.errors[t??Ja])},dM=e=>Array.isArray(e)?e.length>0&&e.some(dM):!!e,jAe=({itemId:e,children:t})=>{const{store:n,publicAPI:r}=Ug(),i=Xr(n,hi.isItemExpandable,e),o=Xr(n,TB.isItemLoading,e),s=Xr(n,TB.itemHasError,e),a=dM(t)||i,l=Xr(n,hi.isItemExpanded,e),u=Xr(n,ih.isItemFocused,e),c=Xr(n,Un.isItemSelected,e),f=Xr(n,St.isItemDisabled,e),h=Xr(n,bm.isItemBeingEdited,e),g=Xr(n,bm.isItemEditable,e),y={expandable:a,expanded:l,focused:u,selected:c,disabled:f,editing:h,editable:g,loading:o,error:s},b=_=>{if(y.disabled)return;y.focused||n.focus.focusItem(_,e);const D=Un.isMultiSelectEnabled(n.state)&&(_.shiftKey||_.ctrlKey||_.metaKey);y.expandable&&!(D&&hi.isItemExpanded(n.state,e))&&n.expansion.setItemExpansion({event:_,itemId:e})},v=_=>{if(!Un.canItemBeSelected(n.state,e))return;!y.focused&&!y.editing&&n.focus.focusItem(_,e),Un.isMultiSelectEnabled(n.state)&&(_.shiftKey||_.ctrlKey||_.metaKey)?_.shiftKey?n.selection.expandSelectionRange(_,e):n.selection.setItemSelection({event:_,itemId:e,keepExistingSelection:!0}):n.selection.setItemSelection({event:_,itemId:e,shouldBeSelected:!0})},S=_=>{const D=_.nativeEvent.shiftKey,T=Un.isMultiSelectEnabled(n.state);T&&D?n.selection.expandSelectionRange(_,e):n.selection.setItemSelection({event:_,itemId:e,keepExistingSelection:T,shouldBeSelected:_.target.checked})},C=()=>{n.labelEditing&&(h?n.labelEditing.setEditedItem(null):n.labelEditing.setEditedItem(e))};return{interactions:{handleExpansion:b,handleSelection:v,handleCheckboxSelection:S,toggleItemEditing:C,handleSaveItemLabel:(_,D)=>{n.labelEditing&&bm.isItemBeingEdited(n.state,e)&&(n.labelEditing.updateItemLabel(e,D),C(),n.focus.focusItem(_,e))},handleCancelItemLabelEditing:_=>{n.labelEditing&&bm.isItemBeingEdited(n.state,e)&&(C(),n.focus.focusItem(_,e))}},status:y,publicAPI:r}},$Ae=({props:e,rootRef:t,contentRef:n})=>{const{store:r}=Ug(),{children:i,disabled:o=!1,disableSelection:s=!1,label:a,itemId:l,id:u}=e,c=O.useContext(qJ);if(c==null)throw new Error(["MUI X: Could not find the Tree View Children Item context.","It looks like you rendered your component outside of a SimpleTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
206
206
|
`));const{registerChild:f,unregisterChild:h,parentId:g}=c,y=dM(i),b=O.useRef(null),v=KC(b,n),S=Xr(r,bv.treeItemIdAttribute,l,u);return G6(()=>(f(S,l),()=>{h(S),h(S)}),[r,f,h,S,l]),G6(()=>r.jsxItems.insertJSXItem({id:l,idAttribute:u,parentId:g,expandable:y,disabled:o,selectable:!s}),[r,g,l,y,o,s,u]),O.useEffect(()=>{if(a)return r.jsxItems.mapLabelFromJSX(l,(b.current?.textContent??"").toLowerCase())},[r,l,a]),{contentRef:v,rootRef:t}},NAe=({children:e,itemId:t,idAttribute:n})=>{const r=O.useContext(JC);return m.jsx(GJ,{itemId:t,idAttribute:n,children:m.jsx(JC.Provider,{value:r+1,children:e})})};class LAe{constructor(t){this.store=t,t.itemPluginManager.register($Ae,NAe)}insertJSXItem=t=>{if(this.store.state.itemMetaLookup[t.id]!=null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${t.id}"`].join(`
|
|
207
|
-
`));return this.store.update({itemMetaLookup:dt({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:dt({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=dt({},this.store.state.itemMetaLookup),r=dt({},this.store.state.itemModelLookup);delete n[t.id],delete r[t.id],this.store.update({itemMetaLookup:n,itemModelLookup:r})}};mapLabelFromJSX=(t,n)=>(this.store.keyboardNavigation.updateLabelMap(r=>(r[t]=n,r)),()=>{this.store.keyboardNavigation.updateLabelMap(r=>{const i=dt({},r);return delete i[t],i})});setJSXItemsOrderedChildrenIds=(t,n)=>{const r=t??Ja;this.store.update({itemOrderedChildrenIdsLookup:dt({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:n}),itemChildrenIndexesLookup:dt({},this.store.state.itemChildrenIndexesLookup,{[r]:BJ(n)})})}}const FAe={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class BAe extends MAe{jsxItems=new LAe(this);constructor(t){super(dt({},t,{items:V6}),"SimpleTreeView",FAe)}updateStateFromParameters(t){super.updateStateFromParameters(dt({},t,{items:V6}))}}const zAe=PJ(),UAe=e=>{const{classes:t}=e;return O.useMemo(()=>Ze({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},VEe,t),[t])},HAe=me("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),VAe=O.forwardRef(function(t,n){const r=zAe({props:t,name:"MuiSimpleTreeView"}),{slots:i,slotProps:o,apiRef:s,parameters:a,forwardedProps:l}=YEe(r),u=SAe(BAe,a),c=O.useRef(null),f=KC(n,c),h=gAe(u,l,f),g=UAe(r),y=i?.root??HAe,b=Yr({elementType:y,externalSlotProps:o?.root,className:g.root,getSlotProps:h,ownerState:r});return m.jsx(GEe,{store:u,classes:g,slots:i,slotProps:o,apiRef:s,rootRef:c,children:m.jsx(GJ,{itemId:null,idAttribute:null,children:m.jsx(JC.Provider,{value:0,children:m.jsx(y,dt({},b))})})})}),WAe=De(m.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),qAe=De(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),GAe=De(m.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function KAe(e){return Qe("MuiCheckbox",e)}const F4=tt("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),YAe=e=>{const{classes:t,indeterminate:n,color:r,size:i}=e,o={root:["root",n&&"indeterminate",`color${ye(r)}`,`size${ye(i)}`]},s=Ze(o,KAe,t);return{...t,...s}},XAe=me(aM,{shouldForwardProp:e=>ro(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${ye(n.size)}`],n.color!=="default"&&t[`color${ye(n.color)}`]]}})(qe(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ln()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ln()).map(([t])=>({props:{color:t},style:{[`&.${F4.checked}, &.${F4.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${F4.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),JAe=m.jsx(qAe,{}),QAe=m.jsx(WAe,{}),ZAe=m.jsx(GAe,{}),Wl=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiCheckbox"}),{checkedIcon:i=JAe,color:o="primary",icon:s=QAe,indeterminate:a=!1,indeterminateIcon:l=ZAe,inputProps:u,size:c="medium",disableRipple:f=!1,className:h,slots:g={},slotProps:y={},...b}=r,v=a?l:s,S=a?l:i,C={...r,disableRipple:f,color:o,indeterminate:a,size:c},w=YAe(C),A=y.input??u,[E,_]=ut("root",{ref:n,elementType:XAe,className:Oe(w.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...b},ownerState:C,additionalProps:{type:"checkbox",icon:O.cloneElement(v,{fontSize:v.props.fontSize??c}),checkedIcon:O.cloneElement(S,{fontSize:S.props.fontSize??c}),disableRipple:f,slots:g,slotProps:{input:OI(typeof A=="function"?A(C):A,{"data-indeterminate":a})}}});return m.jsx(E,{..._,classes:w})}),e3e=(e,t,n)=>typeof n=="function"?n(e,t):n,t3e=e=>{const{runItemPlugins:t,publicAPI:n,store:r}=Ug(),i=O.useContext(JC),o=Xr(r,e3e,e.itemId,i),{id:s,itemId:a,label:l,children:u,rootRef:c}=e,{rootRef:f,contentRef:h,propsEnhancers:g}=t(e),{interactions:y,status:b}=jAe({itemId:a,children:u}),v=O.useRef(null),S=O.useRef(null),C=KC(c,f,v),w=KC(h,S),A=O.useRef(null),E=Xr(r,Un.isCheckboxSelectionEnabled),_=Xr(r,bv.treeItemIdAttribute,a,s),D=Xr(r,ih.isItemTheDefaultFocusableItem,a),T={rootRefObject:v,contentRefObject:S,interactions:y},M=J=>Q=>{J.onFocus?.(Q),!Q.defaultMuiPrevented&&!b.focused&&St.canItemBeFocused(r.state,a)&&Q.currentTarget===Q.target&&r.focus.focusItem(Q,a)},L=J=>Q=>{if(J.onBlur?.(Q),Q.defaultMuiPrevented)return;const ie=r.items.getItemDOMElement(a);b.editing||Q.relatedTarget&&q6(Q.relatedTarget,ie)&&(Q.target&&Q.target?.dataset?.element==="labelInput"&&q6(Q.target,ie)||Q.relatedTarget?.dataset?.element==="labelInput")||r.focus.removeFocusedItem()},j=J=>Q=>{J.onKeyDown?.(Q),!(Q.defaultMuiPrevented||Q.target?.dataset?.element==="labelInput")&&r.keyboardNavigation.handleItemKeyDown(Q,a)},I=J=>Q=>{J.onDoubleClick?.(Q),!Q.defaultMuiPrevented&&y.toggleItemEditing()},N=J=>Q=>{J.onClick?.(Q),r.items.handleItemClick(Q,a),!(Q.defaultMuiPrevented||A.current?.contains(Q.target))&&(hi.triggerSlot(r.state)==="content"&&y.handleExpansion(Q),E||y.handleSelection(Q))},$=J=>Q=>{J.onMouseDown?.(Q),!Q.defaultMuiPrevented&&(Q.shiftKey||Q.ctrlKey||Q.metaKey||b.disabled)&&Q.preventDefault()},z=J=>Q=>{J.onClick?.(Q),!Q.defaultMuiPrevented&&hi.triggerSlot(r.state)==="iconContainer"&&y.handleExpansion(Q)};return{getContextProviderProps:()=>({itemId:a,id:s}),getRootProps:(J={})=>{const Q=dt({},Yi(e),Yi(J)),ie=dt({},Q,{ref:C,role:"treeitem",tabIndex:D?0:-1,id:_,"aria-expanded":b.expandable?b.expanded:void 0,"aria-disabled":b.disabled||void 0},J,{style:dt({},J.style??{},{"--TreeView-itemDepth":o}),onFocus:M(Q),onBlur:L(Q),onKeyDown:j(Q)}),ue=g.root?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ie,ue)},getContentProps:(J={})=>{const Q=Yi(J),ie=dt({},Q,J,{ref:w,onClick:N(Q),onMouseDown:$(Q),status:b});["expanded","selected","focused","disabled","editing","editable"].forEach(te=>{b[te]&&(ie[`data-${te}`]="")});const ue=g.content?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ie,ue)},getGroupTransitionProps:(J={})=>{const Q=Yi(J);return dt({},Q,{unmountOnExit:!0,component:"ul",role:"group",in:b.expanded,children:u},J)},getIconContainerProps:(J={})=>{const Q=Yi(J);return dt({},Q,J,{onClick:z(Q)})},getCheckboxProps:(J={})=>{const Q=Yi(J),ie=dt({},Q,{ref:A,"aria-hidden":!0},J),ue=g.checkbox?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ie,ue)},getLabelProps:(J={})=>{const Q=dt({},Yi(J)),ie=dt({},Q,{children:l},J,{onDoubleClick:I(Q)}),ue=g.label?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ue,ie)},getLabelInputProps:(J={})=>{const Q=Yi(J),ie=g.labelInput?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},J,ie)},getDragAndDropOverlayProps:(J={})=>{const Q=Yi(J),ie=g.dragAndDropOverlay?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},J,ie)},getErrorContainerProps:(J={})=>{const Q=Yi(J);return dt({},Q,J)},getLoadingContainerProps:(J={})=>{const Q=Yi(J);return dt({size:"12px",thickness:6},Q,J)},rootRef:C,status:b,publicAPI:n}};function n3e(e){return Qe("MuiTreeItem",e)}tt("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const r3e=De(m.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),i3e=De(m.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),o3e=["ownerState"];function B4(e,t,n){return e!==void 0?e:t!==void 0?t:n}function s3e(e){const{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:o}=NJ(),s={collapseIcon:B4(t?.collapseIcon,i.collapseIcon,i3e),expandIcon:B4(t?.expandIcon,i.expandIcon,r3e),endIcon:B4(t?.endIcon,i.endIcon),icon:t?.icon};let a;s?.icon?a="icon":r.expandable?r.expanded?a="collapseIcon":a="expandIcon":a="endIcon";const l=s[a],u=Yr({elementType:l,externalSlotProps:f=>dt({},DC(o[a],f),DC(n?.[a],f)),ownerState:{}}),c=Jh(u,o3e);return l?m.jsx(l,dt({},c)):null}const a3e=me("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>Mm(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Ul(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function l3e(e){return e.action==null?null:m.jsx(a3e,dt({},e))}function u3e(e){const{children:t,itemId:n,id:r}=e,{wrapItem:i,store:o}=Ug(),s=Xr(o,bv.treeItemIdAttribute,n,r);return m.jsx(O.Fragment,{children:i({children:t,itemId:n,store:o,idAttribute:s})})}const c3e=me("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>dt({},e.typography.body1,{width:"100%",backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),d3e=["visible"],f3e=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],h3e=PJ(),p3e=me("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),m3e=me("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>Mm(e)&&e!=="status"})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent",cursor:"auto"},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),g3e=me("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>Mm(e)&&e!=="editable"})(({theme:e})=>dt({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),y3e=me("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),b3e=me(ca,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),v3e=me("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),x3e=me(Ur,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),S3e=me(O.forwardRef((e,t)=>{const{visible:n}=e,r=Jh(e,d3e);return n?m.jsx(Wl,dt({},r,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),w3e=e=>{const{classes:t}=NJ(),n=dt({},e,{root:Oe(e?.root,t.root),content:Oe(e?.content,t.itemContent),iconContainer:Oe(e?.iconContainer,t.itemIconContainer),checkbox:Oe(e?.checkbox,t.itemCheckbox),label:Oe(e?.label,t.itemLabel),groupTransition:Oe(e?.groupTransition,t.itemGroupTransition),labelInput:Oe(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:Oe(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:Oe(e?.errorIcon,t.itemErrorIcon),loadingIcon:Oe(e?.loadingIcon,t.itemLoadingIcon)});return Ze({root:["root"],content:["content"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],groupTransition:["groupTransition"],labelInput:["labelInput"],dragAndDropOverlay:["dragAndDropOverlay"],errorIcon:["errorIcon"],loadingIcon:["loadingIcon"],expanded:["expanded"],editing:["editing"],editable:["editable"],selected:["selected"],focused:["focused"],disabled:["disabled"]},n3e,n)},C3e=O.forwardRef(function(t,n){const r=h3e({props:t,name:"MuiTreeItem"}),{id:i,itemId:o,label:s,disabled:a,disableSelection:l,children:u,slots:c={},slotProps:f={},classes:h}=r,g=Jh(r,f3e),{getContextProviderProps:y,getRootProps:b,getContentProps:v,getIconContainerProps:S,getCheckboxProps:C,getLabelProps:w,getGroupTransitionProps:A,getLabelInputProps:E,getDragAndDropOverlayProps:_,getErrorContainerProps:D,getLoadingContainerProps:T,status:M}=t3e({id:i,itemId:o,children:u,label:s,disabled:a,disableSelection:l}),L=w3e(h),j=c.root??p3e,I=Yr({elementType:j,getSlotProps:b,externalForwardedProps:g,externalSlotProps:f.root,additionalProps:{ref:n},ownerState:{},className:L.root}),N=c.content??m3e,$=Yr({elementType:N,getSlotProps:v,externalSlotProps:f.content,ownerState:{},className:Oe(L.content,M.expanded&&L.expanded,M.selected&&L.selected,M.focused&&L.focused,M.disabled&&L.disabled,M.editing&&L.editing,M.editable&&L.editable)}),z=c.iconContainer??y3e,F=Yr({elementType:z,getSlotProps:S,externalSlotProps:f.iconContainer,ownerState:{},className:L.iconContainer}),G=c.label??g3e,V=Yr({elementType:G,getSlotProps:w,externalSlotProps:f.label,ownerState:{},className:L.label}),H=c.checkbox??S3e,X=Yr({elementType:H,getSlotProps:C,externalSlotProps:f.checkbox,ownerState:{},className:L.checkbox}),B=c.groupTransition??void 0,W=Yr({elementType:B,getSlotProps:A,externalSlotProps:f.groupTransition,ownerState:{},className:L.groupTransition}),Y=c.labelInput??c3e,U=Yr({elementType:Y,getSlotProps:E,externalSlotProps:f.labelInput,ownerState:{},className:L.labelInput}),K=c.dragAndDropOverlay??l3e,Z=Yr({elementType:K,getSlotProps:_,externalSlotProps:f.dragAndDropOverlay,ownerState:{},className:L.dragAndDropOverlay}),J=c.errorIcon??v3e,Q=Yr({elementType:J,getSlotProps:D,externalSlotProps:f.errorIcon,ownerState:{},className:L.errorIcon}),ie=c.loadingIcon??x3e,ue=Yr({elementType:ie,getSlotProps:T,externalSlotProps:f.loadingIcon,ownerState:{},className:L.loadingIcon});return m.jsx(u3e,dt({},y(),{children:m.jsxs(j,dt({},I,{children:[m.jsxs(N,dt({},$,{children:[m.jsxs(z,dt({},F,{children:[M.error&&m.jsx(J,dt({},Q)),M.loading?m.jsx(ie,dt({},ue)):m.jsx(s3e,{status:M,slots:c,slotProps:f})]})),m.jsx(H,dt({},X)),M.editing?m.jsx(Y,dt({},U)):m.jsx(G,dt({},V)),m.jsx(K,dt({},Z))]})),u&&m.jsx(b3e,dt({as:B},W))]}))}))}),YJ=De(m.jsx("path",{d:"M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22z"})),v3=De(m.jsx("path",{d:"M20 19V3H4v16H2v2h20v-2zM16 9h2v2h-2zm-2 2H6V9h8zm4-4h-2V5h2zm-4-2v2H6V5zM6 19v-6h8v1.82c-.45.32-.75.84-.75 1.43 0 .97.78 1.75 1.75 1.75s1.75-.78 1.75-1.75c0-.59-.3-1.12-.75-1.43V13h2v6z"})),E3e=De(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"})),fM=De(m.jsx("path",{d:"m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5z"})),A3e=De(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5M9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8m6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),k3e=De(m.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"})),x3=De(m.jsx("path",{d:"M9 21c0 .5.4 1 1 1h4c.6 0 1-.5 1-1v-1H9zm3-19C8.1 2 5 5.1 5 9c0 2.4 1.2 4.5 3 5.7V17c0 .5.4 1 1 1h6c.6 0 1-.5 1-1v-2.3c1.8-1.3 3-3.4 3-5.7 0-3.9-3.1-7-7-7"})),su=De(m.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),XJ=De(m.jsx("path",{d:"M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z"})),_3e=De(m.jsx("path",{d:"M12 11c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3m0 1c-1.84 0-3.56.5-5.03 1.37-.61.35-.97 1.02-.97 1.72V17h12v-1.91c0-.7-.36-1.36-.97-1.72C15.56 12.5 13.84 12 12 12m9.23-3.85 1.85-.77c-1.22-2.91-3.55-5.25-6.46-6.46l-.77 1.85c2.42 1.02 4.36 2.96 5.38 5.38M8.15 2.77 7.38.92C4.47 2.14 2.14 4.47.92 7.38l1.85.77c1.02-2.42 2.96-4.36 5.38-5.38M2.77 15.85l-1.85.77c1.22 2.91 3.55 5.25 6.46 6.46l.77-1.85c-2.42-1.02-4.36-2.96-5.38-5.38m13.08 5.38.77 1.85c2.91-1.22 5.25-3.55 6.46-6.46l-1.85-.77c-1.02 2.42-2.96 4.36-5.38 5.38"})),Bw=De(m.jsx("path",{d:"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13"})),S3=De(m.jsx("path",{d:"M17 2H7c-1.1 0-2 .9-2 2v16c0 1.1.9 1.99 2 1.99L17 22c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-5 2c1.1 0 2 .9 2 2s-.9 2-2 2c-1.11 0-2-.9-2-2s.89-2 2-2m0 16c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),w3=De(m.jsx("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4m-4-2V5c0-.55.45-1 1-1s1 .45 1 1v1h-1v1h1v2h-1v1h1v1z"})),D3e=De(m.jsx("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5m0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3"})),O3e=De(m.jsx("path",{d:"M12 3 2 12h3v8h14v-8h3zm0 13c-1.1 0-2-.9-2-2s2-4 2-4 2 2.9 2 4-.9 2-2 2"})),hM=De(m.jsx("path",{d:"M12 2c-5.33 4.55-8 8.48-8 11.8 0 4.98 3.8 8.2 8 8.2s8-3.22 8-8.2c0-3.32-2.67-7.25-8-11.8M7.83 14c.37 0 .67.26.74.62.41 2.22 2.28 2.98 3.64 2.87.43-.02.79.32.79.75 0 .4-.32.73-.72.75-2.13.13-4.62-1.09-5.19-4.12-.08-.45.28-.87.74-.87"})),T3e=De([m.jsx("path",{d:"M4 3h6v2H4zM1 7h5v2H1zm2 12h5v2H3zm10.73-8.39c.75.23 1.3.78 1.57 1.46l4.27-7.11c.65-1.08.3-2.48-.78-3.13-.87-.52-1.99-.41-2.73.29l-3.43 3.21c-.4.37-.63.9-.63 1.45v3.93c.36-.15.98-.33 1.73-.1m-3.12 1.66c.16-.52.48-.96.89-1.27H3.28C2.02 11 1 12.02 1 13.28c0 1.02.67 1.91 1.65 2.19l4.51 1.29c.53.15 1.1.08 1.58-.21l2.69-1.61c-.77-.62-1.13-1.67-.82-2.67m11.6 6.34-2.28-4.1c-.27-.48-.73-.83-1.26-.97l-3.18-.8c.03.32 0 .66-.1.99-.32 1.06-1.28 1.77-2.39 1.77-.61 0-.99-.22-1-.22V21c-1.1 0-2 .9-2 2h6c0-1.1-.9-2-2-2v-4.28l4.61 4.61c.89.89 2.33.89 3.22 0 .72-.72.88-1.83.38-2.72"},"0"),m.jsx("path",{d:"M12.56 14.43c.79.24 1.63-.2 1.87-1 .24-.79-.2-1.63-1-1.87-.79-.24-1.63.2-1.87 1-.24.79.21 1.63 1 1.87"},"1")]),R3e=({endpoint:e})=>{const t=O.useMemo(()=>{switch(e.type.name){case"RootNode":return m.jsx(fM,{});case"Aggregator":return m.jsx(A3e,{});case"OnOffPlugInUnit":return m.jsx(D3e,{});case"OnOffLight":case"ExtendedColorLight":case"ColorTemperatureLight":case"DimmableLight":return m.jsx(x3,{});case"TemperatureSensor":return m.jsx(w3,{});case"Thermostat":return m.jsx(YJ,{});case"Fan":return m.jsx(T3e,{});case"OnOffSensor":return m.jsx(E3e,{});case"HumiditySensor":return m.jsx(hM,{});case"WindowCovering":return m.jsx(v3,{});case"DoorLock":return m.jsx(su,{});case"OccupancySensor":return m.jsx(_3e,{});case"ContactSensor":return m.jsx(XJ,{});case"WaterLeakDetector":return m.jsx(O3e,{});case"Speaker":return m.jsx(S3,{});case"RoboticVacuumCleaner":return m.jsx(Bw,{});default:return m.jsx(k3e,{})}},[e]);return m.jsx(bn,{title:`${e.type.name} (${e.type.id})`,children:t})},I3e=e=>{const[t,n]=O.useState(()=>P3e(e.endpoint)),r=i=>{let o;i&&(o=j3e(i,e.endpoint)),e.onSelected(o)};return m.jsx(VAe,{expandedItems:t,onExpandedItemsChange:(i,o)=>n(o),onSelectedItemsChange:(i,o)=>r(o),children:m.jsx(JJ,{endpoint:e.endpoint,sortBy:e.sortBy})})},JJ=e=>{const t=O.useMemo(()=>{const n=[...e.endpoint.parts];switch(e.sortBy){case"name":return n.sort((r,i)=>{const o=Ps(r.state)??r.id.local,s=Ps(i.state)??i.id.local;return o.localeCompare(s)});case"type":return n.sort((r,i)=>{const o=r.type?.name??"",s=i.type?.name??"";return o.localeCompare(s)});default:return n.sort((r,i)=>r.endpoint-i.endpoint)}},[e.endpoint.parts,e.sortBy]);return m.jsx(C3e,{itemId:e.endpoint.id.global,label:m.jsx(M3e,{endpoint:e.endpoint}),children:t.map(n=>m.jsx(JJ,{endpoint:n,sortBy:e.sortBy},n.id.global))})},M3e=e=>m.jsxs(le,{display:"flex",children:[m.jsx(R3e,{endpoint:e.endpoint}),m.jsx(le,{marginLeft:1,component:"span",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:m.jsx($Se,{endpoint:e.endpoint})})]});function P3e(e){const t=[e.id.global],n=[e];for(;n.length>0;){const r=n.shift();r.parts.length===1&&t.push(r.parts[0].id.global),n.push(...r.parts)}return t}function j3e(e,t){const n=[t];for(;n.length>0;){const r=n.shift();if(r.id.global===e)return r;n.push(...r.parts)}}const K6=e=>{const t=e.parts??[];return t.length===0?[e]:t.flatMap(n=>K6(n))},$3e=e=>{const[t,n]=O.useState(void 0),[r,i]=O.useState("name"),[o,s]=O.useState("cards"),[a,l]=O.useState(""),[u,c]=O.useState(!1),[f,h]=O.useState(!1),[g,y]=O.useState(!1),[b,v]=O.useState(""),[S,C]=O.useState(),[w,A]=O.useState({open:!1,message:"",severity:"success"}),E=O.useCallback(async(j,I)=>{if(I){v(j);try{const $=(await oM(I)).mappings.find(z=>z.entityId===j);C($)}catch{C(void 0)}y(!0)}},[]),_=O.useCallback(async j=>{if(!(!e.bridgeId||!b))try{await sM(e.bridgeId,b,j),A({open:!0,message:`Mapping saved for ${b}. Restart the bridge to apply changes.`,severity:"success"}),y(!1),e.onMappingSaved?.()}catch(I){A({open:!0,message:`Failed to save mapping: ${I}`,severity:"error"})}},[e.bridgeId,b,e.onMappingSaved]),D=O.useCallback(j=>{const N=j.state.homeAssistantEntity?.entity?.state?.state;return N==="unavailable"||N==="unknown"},[]),T=O.useMemo(()=>K6(e.endpoint).filter(D).length,[e.endpoint,D]),M=O.useMemo(()=>[...K6(e.endpoint).filter(N=>{if(f&&!D(N))return!1;const $=Ps(N.state)??N.id.local,z=N.type.name,F=a.toLowerCase();return $.toLowerCase().includes(F)||z.toLowerCase().includes(F)})].sort((N,$)=>{const z=Ps(N.state)??N.id.local,F=Ps($.state)??$.id.local;switch(r){case"name":return z.localeCompare(F);case"endpoint":return N.id.local.localeCompare($.id.local);case"type":return N.type.name.localeCompare($.type.name);default:return 0}}),[e.endpoint,a,r,f,D]),L=j=>{n(j),c(!0)};return m.jsxs(le,{children:[m.jsxs(le,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,gap:2,flexWrap:"wrap",children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[m.jsxs(re,{variant:"h6",component:"span",children:["Endpoints (",M.length,")"]}),m.jsx(bn,{title:"View All Devices",children:m.jsx(Fn,{component:Dc,to:jt.devices,size:"small",color:"primary",children:m.jsx(ss,{})})})]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[m.jsx(zr,{size:"small",placeholder:"Search endpoints...",value:a,onChange:j=>l(j.target.value),sx:{flexGrow:1,maxWidth:300}}),T>0&&m.jsx(bn,{title:f?"Show all entities":`Show ${T} unavailable`,children:m.jsx(Fn,{size:"small",color:f?"warning":"default",onClick:()=>h(j=>!j),children:m.jsx(xJ,{badgeContent:T,color:"warning",max:99,children:m.jsx(Kd,{})})})}),m.jsxs(Xa,{size:"small",sx:{minWidth:120},children:[m.jsx(cc,{id:"sort-label",children:m.jsxs(le,{display:"flex",alignItems:"center",gap:.5,children:[m.jsx(vJ,{fontSize:"small"})," Sort"]})}),m.jsxs(Ha,{labelId:"sort-label",value:r,label:"Sort",onChange:j=>i(j.target.value),children:[m.jsx(rr,{value:"name",children:"Name"}),m.jsx(rr,{value:"endpoint",children:"Endpoint ID"}),m.jsx(rr,{value:"type",children:"Type"})]})]}),m.jsxs(yCe,{value:o,exclusive:!0,onChange:(j,I)=>I&&s(I),size:"small",children:[m.jsx(iB,{value:"cards",children:m.jsx(bn,{title:"Card View",children:m.jsx(FSe,{})})}),m.jsx(iB,{value:"tree",children:m.jsx(bn,{title:"Tree View",children:m.jsx(BSe,{})})})]})]})]}),o==="cards"?m.jsx(et,{container:!0,spacing:2,children:M.map(j=>m.jsx(et,{size:{xs:12,sm:6,lg:4},children:m.jsx(RJ,{endpoint:j,bridgeId:e.bridgeId,onClick:()=>L(j),onEditMapping:e.bridgeId?E:void 0})},j.id.global))}):m.jsxs(et,{container:!0,spacing:2,children:[m.jsx(et,{size:{xs:12,md:4},children:m.jsx(I3e,{endpoint:e.endpoint,onSelected:n,sortBy:r})}),m.jsx(et,{size:{xs:12,md:8},children:t&&m.jsx(gB,{endpoint:t})})]}),m.jsxs(vc,{open:u,onClose:()=>c(!1),maxWidth:"md",fullWidth:!0,children:[m.jsx(Sc,{children:t&&(Ps(t.state)??t.id.local)}),m.jsx(xc,{children:t&&m.jsx(gB,{endpoint:t})})]}),e.bridgeId&&m.jsx(lM,{open:g,onClose:()=>y(!1),entityId:b,domain:b.split(".")[0]||"",currentMapping:S,onSave:_}),m.jsx(MI,{open:w.open,autoHideDuration:6e3,onClose:()=>A({...w,open:!1}),children:m.jsx(kn,{onClose:()=>A({...w,open:!1}),severity:w.severity,sx:{width:"100%"},children:w.message})})]})},C3=De(m.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}));function N3e({bridgeId:e}){const[t,n]=O.useState(null),[r,i]=O.useState(!0),[o,s]=O.useState(!1),[a,l]=O.useState(null),u=O.useCallback(async()=>{try{const v=await oM(e);n(v)}catch{console.error("Failed to load entity mappings")}finally{i(!1)}},[e]);O.useEffect(()=>{u()},[u]);const c=O.useCallback(()=>{l({entityId:"",domain:""}),s(!0)},[]),f=O.useCallback((v,S)=>{const C=v.split(".")[0]||"";l({entityId:v,domain:C,config:S}),s(!0)},[]),h=O.useCallback(async v=>{try{await bCe(e,v),await u()}catch{console.error("Failed to delete entity mapping")}},[e,u]),g=O.useCallback(async v=>{if(v.entityId)try{await sM(e,v.entityId,v),s(!1),l(null),await u()}catch{console.error("Failed to save entity mapping")}},[e,u]),y=O.useCallback(()=>{s(!1),l(null)},[]),b=t?.mappings??[];return m.jsxs(er,{children:[m.jsxs(gr,{children:[m.jsxs(le,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[m.jsxs(re,{variant:"h6",children:[m.jsx(C3,{sx:{mr:1,verticalAlign:"middle"}}),"Entity Mappings"]}),m.jsx(Tt,{variant:"outlined",size:"small",onClick:c,children:"Add Mapping"})]}),r&&m.jsx(re,{color:"text.secondary",children:"Loading..."}),!r&&b.length===0&&m.jsx(re,{color:"text.secondary",children:"No custom entity mappings configured. Use mappings to override Matter device types, set custom names, or disable specific entities."}),!r&&b.length>0&&m.jsx(cg,{children:m.jsxs(lg,{size:"small",children:[m.jsx(GC,{children:m.jsxs(Ts,{children:[m.jsx(Rn,{children:"Entity ID"}),m.jsx(Rn,{children:"Device Type"}),m.jsx(Rn,{children:"Custom Name"}),m.jsx(Rn,{children:"Status"}),m.jsx(Rn,{align:"right",children:"Actions"})]})}),m.jsx(ug,{children:b.map(v=>m.jsxs(Ts,{children:[m.jsx(Rn,{children:m.jsx(re,{variant:"body2",fontFamily:"monospace",children:v.entityId})}),m.jsx(Rn,{children:v.matterDeviceType||m.jsx(re,{color:"text.secondary",variant:"body2",children:"Auto"})}),m.jsx(Rn,{children:v.customName||m.jsx(re,{color:"text.secondary",variant:"body2",children:"—"})}),m.jsx(Rn,{children:v.disabled?m.jsx(Ct,{label:"Disabled",color:"error",size:"small"}):m.jsx(Ct,{label:"Enabled",color:"success",size:"small"})}),m.jsxs(Rn,{align:"right",children:[m.jsx(Fn,{size:"small",onClick:()=>f(v.entityId,v),children:m.jsx(l3,{fontSize:"small"})}),m.jsx(Fn,{size:"small",onClick:()=>h(v.entityId),children:m.jsx(zg,{fontSize:"small"})})]})]},v.entityId))})]})})]}),a&&m.jsx(lM,{open:o,entityId:a.entityId,domain:a.domain,currentMapping:a.config,onSave:g,onClose:y})]})}const L3e=e=>e.bridges,pM=n3([L3e],e=>e.items),F3e=e=>n3([pM],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(r=>r.id===e)})),B3e=n3([pM],e=>{if(!e.isInitialized)return;const t={};return(e.content?.map(r=>[r.port,r.id])??[]).forEach(([r,i])=>{t[r]=i}),t});function Hg(){return Bg(pM)}function QJ(){return Bg(B3e)}function ZJ(e){const t=O.useMemo(()=>F3e(e),[e]);return Bg(t)}function z3e(){const e=zs();return O.useCallback(async t=>{const n=await e(RX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function U3e(){const e=zs();return O.useCallback(async t=>{const n=await e(MX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function H3e(){const e=zs();return O.useCallback(async t=>{const n=await e(PX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function V3e(){const e=zs();return O.useCallback(async t=>{const n=await e(IX(t));if(n.meta.requestStatus==="rejected")throw n.error},[e])}function W3e(){const e=zs();return O.useCallback(async t=>{await abe(t),await e(Fo())},[e])}function q3e(){const e=zs();return O.useCallback(async t=>{const n=await TX(t);return await e(Fo()),n},[e])}const G3e=e=>e.devices,K3e=e=>n3([G3e],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function Y3e(e){const t=O.useMemo(()=>K3e(e),[e]);return Bg(t)}function X3e(e,t){const[n,r]=O.useState(e);return O.useEffect(()=>{let i=e;t();const o=setInterval(()=>{i--,i===0&&(t(),i=e),r(i)},1e3);return()=>clearInterval(o)},[e,t]),n}async function J3e(e){return await(await fetch(`api/matter/bridges/${e}/devices`)).json()}const dc=Fg("devices/load",J3e),Q3e=De(m.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),Z3e=De(m.jsx("path",{d:"M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93"})),eke=({bridge:e})=>{const[t,n]=O.useState(null),r=!!t,i=Xh(),o=Tc(),s=H3e(),a=V3e(),l=q3e(),u=y=>n(y.currentTarget),c=()=>n(null),f=async()=>{c(),await l(e).then(y=>o.show({message:`Synced ${y.syncedCount} devices to controllers`,severity:"success"})).catch(y=>o.show({message:`Failed to sync: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},h=async()=>{c(),await s(e).then(()=>o.show({message:"Bridge Reset successfully",severity:"success"})).catch(y=>o.show({message:`Failed to reset bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},g=async()=>{c(),await a(e).then(()=>o.show({message:"Bridge deleted successfully",severity:"success"})).then(()=>i(jt.bridges)).catch(y=>o.show({message:`Failed to delete bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))};return m.jsxs(m.Fragment,{children:[m.jsx(Fn,{onClick:u,children:m.jsx(Q3e,{})}),m.jsxs(CJ,{open:r,onClose:c,anchorEl:t,children:[m.jsxs(rr,{component:Dc,to:jt.editBridge(e),children:[m.jsx(Hl,{children:m.jsx(l3,{fontSize:"small"})}),m.jsx(Ua,{children:"Edit"})]}),m.jsx(Di,{}),m.jsxs(rr,{onClick:f,children:[m.jsx(Hl,{children:m.jsx(c3,{fontSize:"small"})}),m.jsx(Ua,{children:"Force Sync"})]}),m.jsxs(rr,{onClick:h,children:[m.jsx(Hl,{children:m.jsx(Z3e,{fontSize:"small"})}),m.jsx(Ua,{children:"Factory Reset"})]}),m.jsxs(rr,{onClick:g,children:[m.jsx(Hl,{children:m.jsx(zg,{fontSize:"small"})}),m.jsx(Ua,{children:"Delete"})]})]})]})},tke=O.memo(fSe),nke=({failedEntities:e})=>{const[t,n]=O.useState(!1);return!e||e.length===0?null:m.jsxs(kn,{severity:"warning",sx:{cursor:"pointer"},onClick:()=>n(!t),children:[m.jsxs(re,{variant:"body2",children:[m.jsxs("strong",{children:[e.length," entity/entities could not be loaded."]})," ","Click to ",t?"hide":"show"," details."]}),m.jsx(ca,{in:t,children:m.jsx(bu,{dense:!0,sx:{mt:1},children:e.map(r=>m.jsxs(pf,{sx:{py:0},children:[m.jsx(Hl,{sx:{minWidth:32},children:m.jsx(r3,{color:"warning",fontSize:"small"})}),m.jsx(Ua,{primary:r.entityId,secondary:r.reason,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},r.entityId))})})]})},rke=()=>{const e=Tc(),t=zs(),{bridgeId:n}=aY(),[r,i]=O.useState(0),o=O.useCallback(()=>{i(g=>g+1)},[]),s=O.useCallback(()=>{t(dc(n))},[t,n]),a=X3e(10,s),{content:l,isLoading:u,error:c}=ZJ(n),{content:f,error:h}=Y3e(n);return O.useEffect(()=>{c&&e.show({message:c.message??"Failed to load Bridge details",severity:"error"})},[c,e]),O.useEffect(()=>{h?.message&&e.show({message:h.message,severity:"error"})},[h,e]),!l&&u?"Loading":l?m.jsxs(zt,{spacing:4,children:[m.jsx(a3,{items:[{name:"Bridges",to:jt.bridges},{name:l.name,to:jt.bridge(n)}]}),m.jsxs(le,{display:"flex",justifyContent:"space-between",children:[m.jsxs(re,{variant:"h4",children:[l.name," ",m.jsx(mJ,{status:l.status})]}),m.jsx(eke,{bridge:n})]}),m.jsx(CSe,{status:l.status,reason:l.statusReason}),l.failedEntities&&l.failedEntities.length>0&&m.jsx(nke,{failedEntities:l.failedEntities}),m.jsx(ike,{bridge:l,devices:f}),m.jsx(tke,{bridge:l}),f&&m.jsx(LSe,{devices:f}),m.jsx(N3e,{bridgeId:n},r),f&&m.jsxs(zt,{spacing:2,children:[m.jsx(le,{display:"flex",justifyContent:"flex-end",alignItems:"center",children:a!=null&&m.jsx(bn,{title:"New devices and changes on labels are discovered every 30 seconds.",children:m.jsxs(re,{variant:"body2",color:"textSecondary",children:["Refreshing states in ",a-1," seconds..."]})})}),m.jsx($3e,{endpoint:f,bridgeId:n,onMappingSaved:o})]})]}):"Not found"};function eQ(e){return e.type.name==="RoboticVacuumCleaner"?!0:e.parts.some(eQ)}function tQ(e){if(e.type.name==="Aggregator")return e.parts.length;let t=0;for(const n of e.parts)t+=tQ(n);return t}const ike=({bridge:e,devices:t})=>{const n=Tc(),[r,i]=O.useState(!1),o=O.useMemo(()=>!t||e.featureFlags?.serverMode?!1:eQ(t),[t,e.featureFlags?.serverMode]),s=O.useMemo(()=>t?tQ(t)===1:!1,[t]),a=async()=>{i(!0);try{await OX({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),n.show({message:"Server Mode enabled. The bridge will restart with your vacuum as a standalone device.",severity:"success"})}catch(l){n.show({message:`Failed to enable Server Mode: ${l instanceof Error?l.message:String(l)}`,severity:"error"})}finally{i(!1)}};return o?m.jsxs(kn,{severity:"warning",icon:m.jsx(rg,{}),action:s?m.jsx(Tt,{color:"warning",size:"small",variant:"outlined",onClick:a,disabled:r,startIcon:r?m.jsx(Ur,{size:16}):void 0,sx:{whiteSpace:"nowrap"},children:r?"Enabling...":"Enable Server Mode"}):void 0,children:[m.jsx(UC,{children:"Server Mode Recommended for Robot Vacuums"}),m.jsxs(re,{variant:"body2",children:["This bridge contains a robot vacuum in ",m.jsx("strong",{children:"bridged mode"}),". Apple Home and Alexa will show the bridge as an additional device, resulting in duplicate entries. Enable ",m.jsx("strong",{children:"Server Mode"})," to expose the vacuum as a standalone Matter device for full Siri/Alexa voice command support and no duplicates."]}),!s&&m.jsxs(re,{variant:"body2",sx:{mt:1},children:[m.jsx("strong",{children:"Note:"})," Server Mode requires the vacuum to be the only device on this bridge. Please remove other entities from this bridge first, then enable Server Mode in the bridge settings."]})]}):null},QC=De(m.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z"})),oke=De(m.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),mM=De(m.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),ske=De(m.jsx("path",{d:"m7 10 5 5 5-5z"})),ake=De(m.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),lke=De(m.jsx("path",{d:"m10 17 5-5-5-5z"})),gM=De(m.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),nQ=De(m.jsx("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"})),RB=De(m.jsx("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"})),R2=De(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),uke=De(m.jsxs(O.Fragment,{children:[m.jsx("path",{fillOpacity:".3",d:"M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h10V5.33z"}),m.jsx("path",{d:"M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"})]})),cke=De(m.jsx("path",{d:"M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66s.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21"})),E3=De(m.jsx("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"})),dke=De([m.jsx("path",{d:"M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"},"0"),m.jsx("path",{d:"m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"},"1")]),fke=De(m.jsx("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3m0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7m18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11m20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"})),IB=De([m.jsx("path",{d:"m12 2-5.5 9h11z"},"0"),m.jsx("circle",{cx:"17.5",cy:"17.5",r:"4.5"},"1"),m.jsx("path",{d:"M3 13.5h8v8H3z"},"2")]),hke=De(m.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),yM=De(m.jsx("path",{d:"M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5m3 10h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3z"})),pke=De(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),mke=De(m.jsx("path",{d:"M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z"})),gke=De(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),yke=De(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),bke=De(m.jsx("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"})),vke=De(m.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),xke=De(m.jsx("path",{d:"M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z"})),Ske=De(m.jsx("path",{d:"M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z"})),wke=De(m.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),Cke=De(m.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),Eke=De([m.jsx("path",{d:"M21 14c0-.55-.45-1-1-1h-2v2h2c.55 0 1-.45 1-1m-1 3h-2v2h2c.55 0 1-.45 1-1s-.45-1-1-1m-8-3h-2v4h2c0 1.1.9 2 2 2h3v-8h-3c-1.1 0-2 .9-2 2"},"0"),m.jsx("path",{d:"M5 13c0-1.1.9-2 2-2h1.5c1.93 0 3.5-1.57 3.5-3.5S10.43 4 8.5 4H5c-.55 0-1 .45-1 1s.45 1 1 1h3.5c.83 0 1.5.67 1.5 1.5S9.33 9 8.5 9H7c-2.21 0-4 1.79-4 4s1.79 4 4 4h2v-2H7c-1.1 0-2-.9-2-2"},"1")]),py=De(m.jsx("path",{d:"M17 10H7v2h10zm2-7h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14zm-5-5H7v2h7z"})),Ake=De(m.jsx("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"})),kke=De(m.jsx("circle",{cx:"12",cy:"12",r:"8"})),_ke=De(m.jsx("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"})),Dke=De(m.jsx("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"})),bM=De([m.jsx("circle",{cx:"15",cy:"13",r:"1"},"0"),m.jsx("circle",{cx:"9",cy:"13",r:"1"},"1"),m.jsx("path",{d:"m8.33 7.5-.66 2h8.66l-.66-2z"},"2"),m.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15.69c0 .45-.35.81-.78.81h-.44c-.44 0-.78-.36-.78-.81V16.5H7v1.19c0 .45-.35.81-.78.81h-.44c-.43 0-.78-.36-.78-.81v-6.5c.82-2.47 1.34-4.03 1.56-4.69.05-.16.12-.29.19-.4.02-.02.03-.04.05-.06.38-.53.92-.54.92-.54h8.56s.54.01.92.53c.02.03.03.05.05.07.07.11.14.24.19.4.22.66.74 2.23 1.56 4.69z"},"3")]),Y6=De(m.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})),Oke=De(m.jsx("path",{d:"M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z"})),c1=De(m.jsx("path",{d:"M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77Q17.34 17 18 17c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z"})),ZC=De(m.jsx("path",{d:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"})),Tke=De(m.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9H9V9h10zm-4 4H9v-2h6zm4-8H9V5h10z"})),Rke=De(m.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),rQ=De(m.jsx("path",{d:"M15 9H9v6h6zm-2 4h-2v-2h2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2zm-4 6H7V7h10z"})),Ike=De(m.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"})),Mke=De(m.jsx("path",{d:"M12 14.67 3.41 6.09 2 7.5l8.5 8.5H4v2h16v-2h-6.5l5.15-5.15c.26.1.55.15.85.15 1.38 0 2.5-1.12 2.5-2.5S20.88 6 19.5 6 17 7.12 17 8.5c0 .35.07.67.2.97z"})),Pke=De(m.jsx("path",{d:"M8 5v14l11-7z"})),vM=De(m.jsx("path",{d:"M13 3h-2v10h2zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83"})),jke=De(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),xM=De(m.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"})),eE=De(m.jsx("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"})),MB=De(m.jsx("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z"})),tE=De(m.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),iQ=De(m.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),oQ=De(m.jsx("path",{d:"M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z"})),Q1=De(m.jsx("path",{d:"M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12s.45 2.1 1.17 2.83zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12s-.45 2.1-1.17 2.83zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12M6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65"})),SM=De(m.jsx("path",{d:"M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1m-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05M12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0"})),$ke=De(m.jsx("path",{d:"M6 6h12v12H6z"})),Nke=De(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 14H8V8h8z"})),Lke=De(m.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),Fke=De(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"})),Bke=De(m.jsx("path",{d:"M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2"})),wM=De(m.jsx("path",{d:"M22 14c0-1.95-1.4-3.57-3.25-3.92L17.4 6.05C17 4.82 15.85 4 14.56 4H9.44C8.15 4 7 4.82 6.6 6.05L5.81 8.4 4.41 7l.29-.29c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0l-2 2c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l.3-.3 1.79 1.79C3.18 10.72 2 12.22 2 14c0 1.5.83 2.79 2.05 3.48C4.28 18.9 5.51 20 7 20c1.3 0 2.4-.84 2.82-2h4.37c.41 1.16 1.51 2 2.82 2 1.49 0 2.72-1.1 2.95-2.52C21.17 16.79 22 15.5 22 14M7 18c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-8H7.41l-.02-.02 1.1-3.3c.14-.41.52-.68.95-.68H11zm2-4h1.56c.43 0 .81.27.95.68l1.1 3.32H13zm4 12c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"})),CM=De(m.jsx("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2m0 14H3V5h18z"})),zke=De(m.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),Uke=De(m.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),Hke=De(m.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"})),Vke=De(m.jsx("path",{d:"M11 11V3H5c-1.1 0-2 .9-2 2v6zm2 0h8V5c0-1.1-.9-2-2-2h-6zm-2 2H3v6c0 1.1.9 2 2 2h6zm2 0v8h6c1.1 0 2-.9 2-2v-6z"}));async function Wke(){const e=await fetch("api/bridges/export");if(!e.ok)throw new Error(`Failed to export bridges: ${e.statusText}`);const t=await e.blob(),r=e.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split("T")[0]}.json`;Kke(t,r)}async function qke(e){const t=await fetch("api/bridges/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`Failed to preview import: ${t.statusText}`);return t.json()}async function Gke(e,t){const n=await fetch("api/bridges/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,options:t})});if(!n.ok)throw new Error(`Failed to import bridges: ${n.statusText}`);return n.json()}function Kke(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Yke({open:e,file:t,onClose:n,onImported:r}){const[i,o]=O.useState(null),[s,a]=O.useState(new Set),[l,u]=O.useState(!1),[c,f]=O.useState(null),[h,g]=O.useState(null),[y,b]=O.useState(!1),[v,S]=O.useState(null);O.useEffect(()=>{if(!e||!t){o(null),a(new Set),f(null),g(null),S(null);return}const _=new FileReader;_.onload=async D=>{try{const T=JSON.parse(D.target?.result);f(T);const M=await qke(T);o(M),a(new Set(M.bridges.map(L=>L.id)))}catch{g("Failed to parse import file. Please select a valid export file.")}},_.readAsText(t)},[e,t]);const C=O.useCallback(_=>{a(D=>{const T=new Set(D);return T.has(_)?T.delete(_):T.add(_),T})},[]),w=O.useCallback(()=>{i&&a(new Set(i.bridges.map(_=>_.id)))},[i]),A=O.useCallback(()=>{a(new Set)},[]),E=O.useCallback(async()=>{if(c){b(!0);try{const _=await Gke(c,{bridgeIds:Array.from(s),overwriteExisting:l}),D=[];_.imported>0&&D.push(`${_.imported} bridge(s) imported`),_.skipped>0&&D.push(`${_.skipped} skipped (already exist)`),_.errors.length>0&&D.push(`${_.errors.length} failed`),S(D.join(", ")),r()}catch(_){g(_ instanceof Error?_.message:"Import failed")}finally{b(!1)}}},[c,s,l,r]);return m.jsxs(vc,{open:e,onClose:n,maxWidth:"sm",fullWidth:!0,children:[m.jsx(Sc,{children:"Import Bridges"}),m.jsxs(xc,{children:[h&&m.jsx(kn,{severity:"error",sx:{mb:2},children:h}),v&&m.jsx(kn,{severity:"success",sx:{mb:2},children:v}),i&&!v&&m.jsxs(m.Fragment,{children:[i.migrated&&m.jsxs(kn,{severity:"info",sx:{mb:2},children:["This export is from an older version (",i.sourceVersion,"). Bridges will be migrated to the current format during import."]}),m.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Exported on ",new Date(i.exportedAt).toLocaleString(),i.sourceVersion&&!i.migrated&&m.jsxs(m.Fragment,{children:[" • Format: ",i.sourceVersion]})]}),m.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16},children:[m.jsx(Tt,{size:"small",onClick:w,children:"Select All"}),m.jsx(Tt,{size:"small",onClick:A,children:"Select None"})]}),m.jsx(bu,{dense:!0,children:i.bridges.map(_=>m.jsxs(pf,{disablePadding:!0,children:[m.jsx(Hl,{children:m.jsx(Wl,{edge:"start",checked:s.has(_.id),onChange:()=>C(_.id)})}),m.jsx(Ua,{primary:_.name,secondary:m.jsxs(m.Fragment,{children:["Port ",_.port," • ",_.entityCount," filter rules",_.exists&&m.jsxs("span",{style:{color:"orange"},children:[" ","• Already exists"]})]})})]},_.id))}),m.jsx(Ns,{control:m.jsx(Ih,{checked:l,onChange:_=>u(_.target.checked)}),label:"Overwrite existing bridges"})]})]}),m.jsxs(Yd,{children:[m.jsx(Tt,{onClick:n,children:v?"Close":"Cancel"}),!v&&m.jsx(Tt,{onClick:E,variant:"contained",disabled:y||s.size===0,children:y?"Importing...":`Import ${s.size} Bridge(s)`})]})]})}function Xke(e){return Qe("MuiCardActionArea",e)}const z4=tt("MuiCardActionArea",["root","focusVisible","focusHighlight"]),Jke=e=>{const{classes:t}=e;return Ze({root:["root"],focusHighlight:["focusHighlight"]},Xke,t)},Qke=me(ma,{name:"MuiCardActionArea",slot:"Root"})(qe(({theme:e})=>({display:"block",textAlign:"inherit",borderRadius:"inherit",width:"100%",[`&:hover .${z4.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${z4.focusVisible} .${z4.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),Zke=me("span",{name:"MuiCardActionArea",slot:"FocusHighlight"})(qe(({theme:e})=>({overflow:"hidden",pointerEvents:"none",position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:"inherit",opacity:0,backgroundColor:"currentcolor",transition:e.transitions.create("opacity",{duration:e.transitions.duration.short})}))),Vg=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiCardActionArea"}),{children:i,className:o,focusVisibleClassName:s,slots:a={},slotProps:l={},...u}=r,c=r,f=Jke(c),h={slots:a,slotProps:l},[g,y]=ut("root",{elementType:Qke,externalForwardedProps:{...h,...u},shouldForwardComponentProp:!0,ownerState:c,ref:n,className:Oe(f.root,o),additionalProps:{focusVisibleClassName:Oe(s,f.focusVisible)}}),[b,v]=ut("focusHighlight",{elementType:Zke,externalForwardedProps:h,ownerState:c,className:f.focusHighlight});return m.jsxs(g,{...y,children:[i,m.jsx(b,{...v})]})}),A3="api/bridge-icons";async function e_e(e,t){const n=new FormData;n.append("icon",t);const r=await fetch(`${A3}/${e}`,{method:"POST",body:n});if(!r.ok){const i=await r.json();throw new Error(i.error||"Failed to upload icon")}return r.json()}async function t_e(e){const t=await fetch(`${A3}/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to delete icon")}}async function k3(e){return(await fetch(`${A3}/${e}`,{method:"HEAD"})).ok}function Z1(e){return`${A3}/${e}`}const PB={light:x3,switch:vM,climate:w3,cover:v3,fan:wM,lock:su,sensor:Q1,media_player:CM,vacuum:yM,remote:SM,humidifier:hM,speaker:S3,garage:bM,door:Ske,window:Vke,motion:xke,battery:uke,power:cke,camera:dke,default:fM},jB={light:x3,switch:vM,climate:w3,cover:v3,fan:wM,lock:su,sensor:Q1,binary_sensor:Q1,media_player:CM,vacuum:yM,remote:SM,humidifier:hM,input_boolean:Eke,input_button:py,button:py,scene:py,script:py,automation:py,speaker:S3,air_quality:YJ,garage:bM},$B={light:"warning.main",switch:"info.main",climate:"error.main",cover:"success.main",fan:"info.light",lock:"secondary.main",sensor:"primary.main",binary_sensor:"primary.main",media_player:"secondary.main",vacuum:"success.main",remote:"warning.main",humidifier:"info.main"},sQ=e=>e.filter.include.find(n=>n.type===Ar.Domain)?.value??null,n_e=e=>{const t=e.toLowerCase();if(t.includes("lamp")||t.includes("light")||t.includes("ljus"))return x3;if(t.includes("vacuum")||t.includes("dammsug"))return yM;if(t.includes("thermo")||t.includes("climate")||t.includes("värme"))return w3;if(t.includes("sensor"))return Q1;if(t.includes("cover")||t.includes("blind")||t.includes("rullgardin")||t.includes("jalousie"))return v3;if(t.includes("remote")||t.includes("fjärr"))return SM;if(t.includes("lock")||t.includes("lås"))return su;if(t.includes("fan")||t.includes("fläkt"))return wM;if(t.includes("tv")||t.includes("media"))return CM;if(t.includes("speaker")||t.includes("högtalare"))return S3;if(t.includes("switch")||t.includes("brytare"))return vM;if(t.includes("garage"))return bM},EM=e=>{if(e.icon&&PB[e.icon])return PB[e.icon];const t=sQ(e);if(t&&jB[t])return jB[t];const n=n_e(e.name);return n||(e.deviceCount===0?ss:fM)},AM=e=>{const t=sQ(e);return t&&$B[t]?$B[t]:e.deviceCount===0?"text.disabled":"primary.main"},r_e=({bridge:e})=>{const t=e.commissioning?.fabrics.length??0,n=EM(e),r=AM(e),[i,o]=O.useState(!1);return O.useEffect(()=>{k3(e.id).then(o)},[e.id]),m.jsx(er,{variant:"elevation",sx:{height:"100%",transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-4px)",boxShadow:4}},children:m.jsx(Vg,{component:Dc,to:jt.bridge(e.id),sx:{height:"100%"},children:m.jsx(gr,{children:m.jsxs(le,{display:"flex",alignItems:"flex-start",gap:2,children:[i?m.jsx(le,{component:"img",src:Z1(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:m.jsx(n,{sx:{fontSize:32}})}),m.jsxs(le,{flexGrow:1,minWidth:0,children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(re,{variant:"h6",component:"div",noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),m.jsx(mJ,{status:e.status})]}),m.jsxs(zt,{spacing:1,mb:2,children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(ss,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:[e.deviceCount," devices"]})]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(JX,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:[t," fabric",t!==1?"s":""]})]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(Q1,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:["Port ",e.port]})]})]})]})]})})})})},i_e=({bridges:e})=>{const t=O.useMemo(()=>[...e].sort((n,r)=>n.name.localeCompare(r.name,void 0,{sensitivity:"base"})),[e]);return m.jsx(et,{container:!0,spacing:2,children:t.map(n=>m.jsx(et,{size:{xs:12,sm:6,lg:4},children:m.jsx(r_e,{bridge:n})},n.id))})},_3=O.createContext({}),kM=O.createContext({});function o_e(e){return Qe("MuiStep",e)}tt("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);const s_e=e=>{const{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return Ze({root:["root",n,r&&"alternativeLabel",i&&"completed"]},o_e,t)},a_e=me("div",{name:"MuiStep",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({variants:[{props:{orientation:"horizontal"},style:{paddingLeft:8,paddingRight:8}},{props:{alternativeLabel:!0},style:{flex:1,position:"relative"}}]}),l_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStep"}),{active:i,children:o,className:s,component:a="div",completed:l,disabled:u,expanded:c=!1,index:f,last:h,...g}=r,{activeStep:y,connector:b,alternativeLabel:v,orientation:S,nonLinear:C}=O.useContext(_3);let[w=!1,A=!1,E=!1]=[i,l,u];y===f?w=i!==void 0?i:!0:!C&&y>f?A=l!==void 0?l:!0:!C&&y<f&&(E=u!==void 0?u:!0);const _=O.useMemo(()=>({index:f,last:h,expanded:c,icon:f+1,active:w,completed:A,disabled:E}),[f,h,c,w,A,E]),D={...r,active:w,orientation:S,alternativeLabel:v,completed:A,disabled:E,expanded:c,component:a},T=s_e(D),M=m.jsxs(a_e,{as:a,className:Oe(T.root,s),ref:n,ownerState:D,...g,children:[b&&v&&f!==0?b:null,o]});return m.jsx(kM.Provider,{value:_,children:b&&!v&&f!==0?m.jsxs(O.Fragment,{children:[b,M]}):M})}),u_e=De(m.jsx("path",{d:"M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z"})),c_e=De(m.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function d_e(e){return Qe("MuiStepIcon",e)}const U4=tt("MuiStepIcon",["root","active","completed","error","text"]);var NB;const f_e=e=>{const{classes:t,active:n,completed:r,error:i}=e;return Ze({root:["root",n&&"active",r&&"completed",i&&"error"],text:["text"]},d_e,t)},H4=me(OC,{name:"MuiStepIcon",slot:"Root"})(qe(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${U4.completed}`]:{color:(e.vars||e).palette.primary.main},[`&.${U4.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${U4.error}`]:{color:(e.vars||e).palette.error.main}}))),h_e=me("text",{name:"MuiStepIcon",slot:"Text"})(qe(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),p_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepIcon"}),{active:i=!1,className:o,completed:s=!1,error:a=!1,icon:l,...u}=r,c={...r,active:i,completed:s,error:a},f=f_e(c);if(typeof l=="number"||typeof l=="string"){const h=Oe(o,f.root);return a?m.jsx(H4,{as:c_e,className:h,ref:n,ownerState:c,...u}):s?m.jsx(H4,{as:u_e,className:h,ref:n,ownerState:c,...u}):m.jsxs(H4,{className:h,ref:n,ownerState:c,...u,children:[NB||(NB=m.jsx("circle",{cx:"12",cy:"12",r:"12"})),m.jsx(h_e,{className:f.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:c,children:l})]})}return l});function m_e(e){return Qe("MuiStepLabel",e)}const Od=tt("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),g_e=e=>{const{classes:t,orientation:n,active:r,completed:i,error:o,disabled:s,alternativeLabel:a}=e;return Ze({root:["root",n,o&&"error",s&&"disabled",a&&"alternativeLabel"],label:["label",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],iconContainer:["iconContainer",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],labelContainer:["labelContainer",a&&"alternativeLabel"]},m_e,t)},y_e=me("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:"flex",alignItems:"center",[`&.${Od.alternativeLabel}`]:{flexDirection:"column"},[`&.${Od.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),b_e=me("span",{name:"MuiStepLabel",slot:"Label"})(qe(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${Od.active}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Od.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Od.alternativeLabel}`]:{marginTop:16},[`&.${Od.error}`]:{color:(e.vars||e).palette.error.main}}))),v_e=me("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${Od.alternativeLabel}`]:{paddingRight:0}}),x_e=me("span",{name:"MuiStepLabel",slot:"LabelContainer"})(qe(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${Od.alternativeLabel}`]:{textAlign:"center"}}))),aQ=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepLabel"}),{children:i,className:o,componentsProps:s={},error:a=!1,icon:l,optional:u,slots:c={},slotProps:f={},StepIconComponent:h,StepIconProps:g,...y}=r,{alternativeLabel:b,orientation:v}=O.useContext(_3),{active:S,disabled:C,completed:w,icon:A}=O.useContext(kM),E=l||A;let _=h;E&&!_&&(_=p_e);const D={...r,active:S,alternativeLabel:b,completed:w,disabled:C,error:a,orientation:v},T=g_e(D),M={slots:c,slotProps:{stepIcon:g,...s,...f}},[L,j]=ut("root",{elementType:y_e,externalForwardedProps:{...M,...y},ownerState:D,ref:n,className:Oe(T.root,o)}),[I,N]=ut("label",{elementType:b_e,externalForwardedProps:M,ownerState:D}),[$,z]=ut("stepIcon",{elementType:_,externalForwardedProps:M,ownerState:D});return m.jsxs(L,{...j,children:[E||$?m.jsx(v_e,{className:T.iconContainer,ownerState:D,children:m.jsx($,{completed:w,active:S,error:a,icon:E,...z})}):null,m.jsxs(x_e,{className:T.labelContainer,ownerState:D,children:[i?m.jsx(I,{...N,className:Oe(T.label,N?.className),children:i}):null,u]})]})});aQ.muiName="StepLabel";function S_e(e){return Qe("MuiStepper",e)}tt("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);function w_e(e){return Qe("MuiStepConnector",e)}tt("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);const C_e=e=>{const{classes:t,orientation:n,alternativeLabel:r,active:i,completed:o,disabled:s}=e,a={root:["root",n,r&&"alternativeLabel",i&&"active",o&&"completed",s&&"disabled"],line:["line",`line${ye(n)}`]};return Ze(a,w_e,t)},E_e=me("div",{name:"MuiStepConnector",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({flex:"1 1 auto",variants:[{props:{orientation:"vertical"},style:{marginLeft:12}},{props:{alternativeLabel:!0},style:{position:"absolute",top:12,left:"calc(-50% + 20px)",right:"calc(50% + 20px)"}}]}),A_e=me("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.line,t[`line${ye(n.orientation)}`]]}})(qe(({theme:e})=>{const t=e.palette.mode==="light"?e.palette.grey[400]:e.palette.grey[600];return{display:"block",borderColor:e.vars?e.vars.palette.StepConnector.border:t,variants:[{props:{orientation:"horizontal"},style:{borderTopStyle:"solid",borderTopWidth:1}},{props:{orientation:"vertical"},style:{borderLeftStyle:"solid",borderLeftWidth:1,minHeight:24}}]}})),k_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepConnector"}),{className:i,...o}=r,{alternativeLabel:s,orientation:a="horizontal"}=O.useContext(_3),{active:l,disabled:u,completed:c}=O.useContext(kM),f={...r,alternativeLabel:s,orientation:a,active:l,completed:c,disabled:u},h=C_e(f);return m.jsx(E_e,{className:Oe(h.root,i),ref:n,ownerState:f,...o,children:m.jsx(A_e,{className:h.line,ownerState:f})})}),__e=e=>{const{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return Ze({root:["root",t,n&&"nonLinear",r&&"alternativeLabel"]},S_e,i)},D_e=me("div",{name:"MuiStepper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.nonLinear&&t.nonLinear]}})({display:"flex",variants:[{props:{orientation:"horizontal"},style:{flexDirection:"row",alignItems:"center"}},{props:{orientation:"vertical"},style:{flexDirection:"column"}},{props:{alternativeLabel:!0},style:{alignItems:"flex-start"}}]}),O_e=m.jsx(k_e,{}),T_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepper"}),{activeStep:i=0,alternativeLabel:o=!1,children:s,className:a,component:l="div",connector:u=O_e,nonLinear:c=!1,orientation:f="horizontal",...h}=r,g={...r,nonLinear:c,alternativeLabel:o,orientation:f,component:l},y=__e(g),b=O.Children.toArray(s).filter(Boolean),v=b.map((C,w)=>O.cloneElement(C,{index:w,last:w+1===b.length,...C.props})),S=O.useMemo(()=>({activeStep:i,alternativeLabel:o,connector:u,nonLinear:c,orientation:f}),[i,o,u,c,f]);return m.jsx(_3.Provider,{value:S,children:m.jsx(D_e,{as:l,ownerState:g,className:Oe(y.root,a),ref:n,...h,children:v})})}),LB={light:"💡",switch:"🔌",sensor:"📊",climate:"🌡️",lock:"🔒",vacuum:"🤖",media_player:"🎵",cover:"🪟",remote:"⚡",default:"🏠"};function lQ({selectedTemplate:e,onSelect:t}){return m.jsxs(le,{children:[m.jsx(re,{variant:"subtitle1",gutterBottom:!0,fontWeight:600,children:"Start from a Template (optional)"}),m.jsx(re,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Choose a preset to pre-fill the bridge configuration with recommended settings. You can customize everything afterwards."}),m.jsx(et,{container:!0,spacing:1.5,children:pJ.map(n=>{const r=e===n.id;return m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(er,{variant:"outlined",sx:{height:"100%",borderColor:r?"primary.main":"divider",borderWidth:r?2:1,bgcolor:r?"action.selected":"background.paper",transition:"all 0.15s ease"},children:m.jsx(Vg,{onClick:()=>t(r?null:n),sx:{height:"100%",p:0},children:m.jsxs(gr,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[m.jsx(re,{fontSize:20,children:LB[n.icon]??LB.default}),m.jsx(re,{variant:"subtitle2",sx:{flexGrow:1},children:n.name}),r&&m.jsx(Rc,{color:"primary",sx:{fontSize:18}})]}),m.jsx(re,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.description}),n.featureFlags?.serverMode&&m.jsx(Ct,{label:"Server Mode",size:"small",color:"warning",variant:"outlined",sx:{mt:.5,height:20,fontSize:"0.65rem"}}),n.featureFlags?.autoForceSync&&m.jsx(Ct,{label:"Auto Force Sync",size:"small",color:"info",variant:"outlined",sx:{mt:.5,ml:.5,height:20,fontSize:"0.65rem"}})]})})})},n.id)})})]})}const V4=["Template","Bridge Info","Entity Filter","Feature Flags","Review & Create"],R_e=[{key:"autoComposedDevices",label:"Auto Compose Devices",description:"Combine related entities (battery, humidity, pressure, power, energy) from the same HA device into a single Matter endpoint."},{key:"autoForceSync",label:"Auto Force Sync",description:"Periodically push all device states to controllers. Recommended for Google Home and Alexa to prevent devices from going offline."},{key:"coverSwapOpenClose",label:"Invert Cover Direction",description:"Swap open/close direction for covers. Use this if your covers show the wrong position in Matter controllers."},{key:"includeHiddenEntities",label:"Include Hidden Entities",description:"Also expose entities that are marked as hidden in Home Assistant."}];function uQ({open:e,onClose:t,onComplete:n}){const[r,i]=O.useState(0),[o,s]=O.useState(!1),[a,l]=O.useState(5540),[u,c]=O.useState([]),[f,h]=O.useState(),[g,y]=O.useState({name:"",port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[b,v]=O.useState(!0),[S,C]=O.useState("*"),[w,A]=O.useState(""),[E,_]=O.useState(null),D=O.useCallback(async()=>{try{const H=await fetch("api/matter/next-port");if(H.ok){const X=await H.json();l(X.port),y(B=>({...B,port:X.port}))}}catch{}},[]);O.useEffect(()=>{e&&(D(),i(0),c([]),h(void 0),y({name:"",port:a,serverMode:!1,filter:{include:[],exclude:[]}}),v(!0),C("*"),A(""),_(null))},[e,D,a]);const T=O.useCallback(H=>{if(h(H??void 0),H){y(W=>({...W,name:H.name,serverMode:H.featureFlags?.serverMode??!1,icon:H.icon,featureFlags:H.featureFlags,filter:{...H.filter}}));const X=H.filter.include;if(X.length>0)if(v(!1),H.featureFlags?.serverMode){const W=X.map(Y=>Y.type===Ar.Domain?`${Y.value}.*`:Y.value);C(W.join(", "))}else C(X.map(W=>W.value).join(", "));const B=H.filter.exclude;A(B.map(W=>W.value).join(", "))}else y(X=>({...X,name:"",serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),v(!0),C("*"),A("")},[]),M=()=>{if(r===0&&_(null),r===1){if(!g.name.trim()){_("Please enter a bridge name");return}_(null)}if(r===2){let H,X;if(f&&!g.serverMode)H=[...f.filter.include],X=[...f.filter.exclude];else{const B=b?[S||"*"]:S.split(",").map(Y=>Y.trim()).filter(Boolean),W=w.split(",").map(Y=>Y.trim()).filter(Boolean);H=B.map(Y=>({type:Ar.Pattern,value:Y})),X=W.map(Y=>({type:Ar.Pattern,value:Y}))}y(B=>({...B,filter:{include:H,exclude:X}}))}i(H=>H+1)},L=()=>{i(H=>H-1),_(null)},j=async()=>{await I();const H=a+u.length+1;c(X=>[...X,g]),h(void 0),y({name:"",port:H,serverMode:!1,filter:{include:[],exclude:[]}}),i(0),v(!0),C("*"),A("")},I=async()=>{s(!0),_(null);try{const H={...g.featureFlags,...g.serverMode?{serverMode:!0}:{}},X=Object.keys(H).length>0,B={name:g.name,port:g.port,filter:g.filter,featureFlags:X?H:void 0,icon:g.icon};return await DX(B),!0}catch(H){return _(H instanceof Error?H.message:"Failed to create bridge"),!1}finally{s(!1)}},N=async()=>{await I()&&(n(),t())},$=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:"Choose a template to get started quickly, or skip to create a custom bridge."}),m.jsx(le,{sx:{mt:2},children:m.jsx(lQ,{selectedTemplate:f?.id,onSelect:T})})]}),z=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:f?`Template "${f.name}" applied. Customize the name and port below.`:"Give your bridge a name and port."}),m.jsx(zr,{fullWidth:!0,label:"Bridge Name",value:g.name,onChange:H=>y(X=>({...X,name:H.target.value})),margin:"normal",placeholder:"e.g., Living Room, Kitchen, All Lights",error:!!E,helperText:E}),m.jsx(zr,{fullWidth:!0,label:"Port",type:"number",value:g.port,onChange:H=>y(X=>({...X,port:parseInt(H.target.value,10)||5540})),margin:"normal",helperText:"Automatically assigned to next available port"}),m.jsx(bn,{title:"Required for Robot Vacuums to work with Apple Home (Siri) and Alexa. Server Mode bridges support only ONE device.",placement:"right",children:m.jsx(Ns,{control:m.jsx(Wl,{checked:g.serverMode,onChange:H=>y(X=>({...X,serverMode:H.target.checked})),icon:m.jsx(Bw,{}),checkedIcon:m.jsx(Bw,{color:"primary"})}),label:"Server Mode (for Robot Vacuums)",sx:{mt:1}})}),g.serverMode&&m.jsxs(kn,{severity:"info",sx:{mt:1},children:[m.jsx("strong",{children:"Server Mode enabled:"})," This bridge will expose a single device as a standalone Matter device. Add only ONE device (e.g., your vacuum) to this bridge. This is required for Apple Home Siri commands and Alexa discovery."]}),u.length>0&&m.jsxs(le,{sx:{mt:2},children:[m.jsxs(re,{variant:"subtitle2",color:"text.secondary",children:["Bridges to create (",u.length,"):"]}),m.jsx(le,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:u.map(H=>m.jsx(Ct,{label:`${H.name} (:${H.port})`,size:"small"},H.port))})]})]}),F=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:f?`Filter is pre-configured from the "${f.name}" template. You can adjust it below.`:"Configure which entities should be included in this bridge."}),g.serverMode&&m.jsxs(kn,{severity:"warning",sx:{mt:1,mb:1},children:["Server Mode requires exactly ",m.jsx("strong",{children:"one"})," entity. Change the filter to match only your device (e.g., ",m.jsx("code",{children:"vacuum.my_vacuum"}),")."]}),!f&&m.jsx(Ns,{control:m.jsx(Ih,{checked:b,onChange:H=>v(H.target.checked)}),label:"Include all entities (wildcard)"}),m.jsx(zr,{fullWidth:!0,label:g.serverMode?"Entity ID":b&&!f?"Include Pattern":"Entity Filters",value:f&&!g.serverMode?f.filter.include.map(H=>`${H.type}:${H.value}`).join(", "):S,onChange:H=>C(H.target.value),margin:"normal",placeholder:b?"* or light.*, switch.*":"light.living_room, switch.kitchen",helperText:g.serverMode?"Server Mode supports only ONE device. Enter the exact entity ID (e.g., vacuum.my_vacuum).":f?"Pre-configured by template. Edit in the full editor after creation.":b?"Use * for all, or patterns like light.*, switch.*":"Enter specific entity IDs separated by commas",disabled:!!f&&!g.serverMode}),!f&&m.jsx(zr,{fullWidth:!0,label:"Exclude Patterns (optional)",value:w,onChange:H=>A(H.target.value),margin:"normal",placeholder:"sensor.*, binary_sensor.*",helperText:"Patterns to exclude, comma-separated"})]}),G=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:"Configure optional feature flags for this bridge."}),R_e.map(H=>m.jsxs(le,{sx:{mt:1},children:[m.jsx(Ns,{control:m.jsx(Ih,{checked:g.featureFlags?.[H.key]===!0,onChange:X=>y(B=>({...B,featureFlags:{...B.featureFlags,[H.key]:X.target.checked}}))}),label:H.label}),m.jsx(re,{variant:"caption",color:"text.secondary",display:"block",sx:{ml:7,mt:-.5},children:H.description})]},H.key))]}),V=()=>{const H=Object.entries(g.featureFlags??{}).filter(([,X])=>X===!0);return m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:"Review your bridge configuration:"}),m.jsx(er,{variant:"outlined",sx:{mt:2},children:m.jsxs(gr,{children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(ss,{}),m.jsx(re,{variant:"h6",children:g.name})]}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:["Port: ",g.port]}),f&&m.jsx(Ct,{label:`Template: ${f.name}`,size:"small",color:"info",variant:"outlined",sx:{mt:1,mr:.5}}),g.serverMode&&m.jsx(Ct,{icon:m.jsx(Bw,{}),label:"Server Mode",color:"primary",size:"small",sx:{mt:1}}),H.length>0&&m.jsx(le,{display:"flex",gap:.5,flexWrap:"wrap",mt:1,children:H.filter(([X])=>X!=="serverMode").map(([X])=>m.jsx(Ct,{label:X,size:"small",variant:"outlined",sx:{fontSize:"0.7rem",height:22}},X))}),m.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["Include:"," ",g.filter.include.length>0?g.filter.include.map(X=>`${X.type}:${X.value}`).join(", "):S||"*"]}),E&&m.jsx(re,{variant:"body2",color:"error",sx:{mt:1},children:E}),(w||g.filter.exclude.length>0)&&m.jsxs(re,{variant:"body2",color:"text.secondary",children:["Exclude:"," ",g.filter.exclude.length>0?g.filter.exclude.map(X=>X.value).join(", "):w]})]})}),u.length>0&&m.jsx(le,{sx:{mt:2},children:m.jsxs(re,{variant:"subtitle2",children:[u.length," bridge(s) already created in this session"]})})]})};return m.jsxs(vc,{open:e,onClose:t,maxWidth:"md",fullWidth:!0,children:[m.jsx(Sc,{children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(C3,{}),m.jsx("span",{children:"Bridge Setup Wizard"})]})}),m.jsxs(xc,{children:[m.jsx(T_e,{activeStep:r,sx:{mt:1},children:V4.map(H=>m.jsx(l_e,{children:m.jsx(aQ,{children:H})},H))}),r===0&&$(),r===1&&z(),r===2&&F(),r===3&&G(),r===4&&V()]}),m.jsxs(Yd,{sx:{px:3,pb:2},children:[m.jsx(Tt,{onClick:t,disabled:o,children:"Cancel"}),m.jsx(le,{sx:{flex:1}}),r>0&&m.jsx(Tt,{onClick:L,startIcon:m.jsx(oke,{}),disabled:o,children:"Back"}),r<V4.length-1&&m.jsx(Tt,{variant:"contained",onClick:M,endIcon:m.jsx(ake,{}),disabled:o,children:r===0&&!f?"Skip Template":"Next"}),r===V4.length-1&&m.jsxs(m.Fragment,{children:[m.jsx(Tt,{variant:"outlined",onClick:j,startIcon:m.jsx(fu,{}),disabled:o,children:"Add Another"}),m.jsx(Tt,{variant:"contained",onClick:N,startIcon:o?m.jsx(Ur,{size:16}):m.jsx(hke,{}),disabled:o,children:o?"Creating...":"Create Bridge"})]})]})]})}const I_e=()=>{const e=Tc(),t=zs(),{content:n,isLoading:r,error:i}=Hg(),[o,s]=O.useState(null),[a,l]=O.useState(!1),[u,c]=O.useState(!1),[f,h]=O.useState(!1),g=O.useRef(null),y=O.useCallback(async()=>{try{await Wke()}catch(A){e.show({message:A instanceof Error?A.message:"Export failed",severity:"error"})}},[e]),b=O.useCallback(()=>{g.current?.click()},[]),v=O.useCallback(A=>{const E=A.target.files?.[0];E&&(s(E),l(!0)),A.target.value=""},[]),S=O.useCallback(()=>{l(!1),s(null)},[]),C=O.useCallback(()=>{t(Fo())},[t]),w=O.useCallback(async A=>{h(!0);try{const E={start:"Started",stop:"Stopped",restart:"Restarted"},D=await{start:lbe,stop:ube,restart:cbe}[A]();e.show({message:`${E[A]} ${D.count} bridge(s)`,severity:"success"}),t(Fo())}catch(E){e.show({message:E instanceof Error?E.message:`${A} failed`,severity:"error"})}finally{h(!1)}},[e,t]);return O.useEffect(()=>{i&&e.show({message:i.message??"Could not load bridges",severity:"error"})},[i,e]),m.jsxs(m.Fragment,{children:[m.jsx(KI,{sx:A=>({zIndex:A.zIndex.drawer+1}),open:r||f,children:(r||f)&&m.jsx(Ur,{color:"inherit"})}),m.jsx(zt,{spacing:4,children:n&&m.jsxs(m.Fragment,{children:[m.jsxs(le,{display:"flex",justifyContent:"end",flexWrap:"wrap",gap:1,paddingTop:{xs:1,sm:0},children:[n.length>=1&&m.jsxs(m.Fragment,{children:[m.jsx(Tt,{onClick:()=>w("start"),startIcon:m.jsx(Pke,{}),variant:"outlined",size:"small",color:"success",disabled:f,children:"Start All"}),m.jsx(Tt,{onClick:()=>w("stop"),startIcon:m.jsx($ke,{}),variant:"outlined",size:"small",color:"error",disabled:f,children:"Stop All"}),m.jsx(Tt,{onClick:()=>w("restart"),startIcon:m.jsx(eE,{}),variant:"outlined",size:"small",color:"warning",disabled:f,children:"Restart All"}),m.jsx(Di,{orientation:"vertical",flexItem:!0})]}),m.jsx(Tt,{onClick:b,startIcon:m.jsx(wke,{}),variant:"outlined",children:"Import"}),m.jsx(Tt,{onClick:y,startIcon:m.jsx(Uke,{}),variant:"outlined",disabled:n.length===0,children:"Export All"}),m.jsx(Tt,{onClick:()=>c(!0),startIcon:m.jsx(nQ,{}),variant:"outlined",children:"Wizard"}),m.jsx(Tt,{component:Dc,to:jt.createBridge,endIcon:m.jsx(fu,{}),variant:"outlined",children:"Create new bridge"}),m.jsx("input",{type:"file",ref:g,onChange:v,accept:".json",style:{display:"none"}})]}),m.jsx(i_e,{bridges:n})]})}),m.jsx(Yke,{open:a,file:o,onClose:S,onImported:C}),m.jsx(uQ,{open:u,onClose:()=>c(!1),onComplete:()=>t(Fo())})]})},M_e=e=>{const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function I2({title:e,value:t,icon:n,color:r,subtitle:i,onClick:o}){const s=m.jsx(gr,{sx:{py:2,"&:last-child":{pb:2}},children:m.jsxs(le,{display:"flex",sx:{flexDirection:{xs:"column",sm:"row"},alignItems:"center",gap:{xs:1,sm:2},textAlign:{xs:"center",sm:"left"}},children:[m.jsx(rl,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),m.jsxs(le,{sx:{minWidth:0},children:[m.jsx(re,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:"1.5rem",sm:"2.125rem"}},children:t}),m.jsx(re,{variant:"body2",color:"text.secondary",noWrap:!0,children:e}),i&&m.jsx(re,{variant:"caption",color:"text.secondary",noWrap:!0,children:i})]})]})});return m.jsx(er,{variant:"outlined",sx:{height:"100%"},children:o?m.jsx(Vg,{onClick:o,sx:{height:"100%"},children:s}):s})}function P_e({bridge:e,onClick:t}){const{content:n}=Hg(),r=n?.find(a=>a.id===e.id),[i,o]=O.useState(!1);O.useEffect(()=>{k3(e.id).then(o)},[e.id]);const s=e.status==="running"?"success":e.status==="failed"?"error":"default";return m.jsx(er,{variant:"outlined",children:m.jsx(Vg,{onClick:t,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1.5,children:[i?m.jsx(le,{component:"img",src:Z1(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:"50%",objectFit:"cover"}}):r&&m.jsx(rl,{sx:{bgcolor:AM(r),width:36,height:36},children:(()=>{const a=EM(r);return m.jsx(a,{sx:{fontSize:20}})})()}),m.jsxs(le,{flex:1,minWidth:0,children:[m.jsx(re,{variant:"subtitle2",noWrap:!0,children:e.name}),m.jsxs(zt,{direction:"row",spacing:.5,alignItems:"center",children:[m.jsx(Ct,{label:e.status,size:"small",color:s,sx:{height:18,fontSize:"0.65rem"}}),m.jsxs(re,{variant:"caption",color:"text.secondary",children:[e.deviceCount," devices"]}),e.fabricCount>0&&m.jsxs(re,{variant:"caption",color:"text.secondary",children:["· ",e.fabricCount," fabrics"]})]})]}),e.failedEntityCount>0&&m.jsx(Ct,{icon:m.jsx(r3,{sx:{fontSize:14}}),label:e.failedEntityCount,size:"small",color:"warning",variant:"outlined",sx:{height:22}})]})})})})}function Uf({title:e,icon:t,onClick:n}){return m.jsx(er,{variant:"outlined",children:m.jsx(Vg,{onClick:n,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1.5,children:[m.jsx(rl,{sx:{bgcolor:"action.selected",color:"text.secondary",width:36,height:36},children:t}),m.jsx(re,{variant:"subtitle2",children:e})]})})})})}const j_e=()=>{const e=Xh(),t=zs(),[n,r]=O.useState(null),[i,o]=O.useState(!0),[s,a]=O.useState(!1),l=O.useCallback(async()=>{try{const y=await fetch("api/health/detailed");y.ok&&r(await y.json())}catch{}finally{o(!1)}},[]);O.useEffect(()=>{l();const y=setInterval(l,15e3);return()=>clearInterval(y)},[l]);const u=O.useMemo(()=>n?.bridgeDetails.reduce((y,b)=>y+b.deviceCount,0)??0,[n]),c=O.useMemo(()=>n?.bridgeDetails?n.bridgeDetails.reduce((y,b)=>y+b.fabricCount,0):0,[n]),f=O.useMemo(()=>n?.bridgeDetails.reduce((y,b)=>y+b.failedEntityCount,0)??0,[n]);if(i)return m.jsx(le,{display:"flex",justifyContent:"center",p:8,children:m.jsx(Ur,{})});const h=n?.services.bridges,g=n?.services.homeAssistant.connected??!1;return m.jsxs(le,{sx:{p:2},children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:2,mb:3,children:[m.jsx(Y6,{color:"primary",fontSize:"large"}),m.jsx(re,{variant:"h5",fontWeight:600,children:"Dashboard"})]}),m.jsxs(Nr,{variant:"outlined",sx:{mb:3,p:2,bgcolor:"background.default"},children:[m.jsx(re,{variant:"caption",color:"text.secondary",sx:{mb:1,display:"block"},children:"Navigation"}),m.jsxs(et,{container:!0,spacing:1,children:[m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(Y6,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Dashboard"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(c1,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Bridges"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(ss,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"All Devices"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(QC,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Network Map"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(rg,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Startup Order"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(su,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Lock Credentials"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(ZC,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Filter Reference"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(WC,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Health Dashboard"})]})})]})]}),m.jsxs(et,{container:!0,spacing:2,sx:{mb:3},children:[m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"Bridges",value:h?.total??0,icon:m.jsx(c1,{}),color:"#4caf50",subtitle:h?`${h.running} running${h.failed>0?` · ${h.failed} failed`:""}`:void 0,onClick:()=>e(jt.bridges)})}),m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"Devices",value:u,icon:m.jsx(ss,{}),color:"#2196f3",subtitle:f>0?`${f} failed`:void 0,onClick:()=>e(jt.devices)})}),m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"Fabrics",value:c,icon:m.jsx(J1,{}),color:"#9c27b0",onClick:()=>e(jt.networkMap)})}),m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"HA Connection",value:g?"Online":"Offline",icon:g?m.jsx(Rc,{}):m.jsx(gf,{}),color:g?"#4caf50":"#f44336",subtitle:n?.uptime!=null?`Uptime ${M_e(n.uptime)}`:void 0})})]}),m.jsx(Di,{sx:{mb:3}}),m.jsx(le,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,flexWrap:"wrap",gap:1,children:m.jsx(re,{variant:"h6",children:"Bridges"})}),m.jsxs(zt,{direction:"row",spacing:1.5,sx:{mb:2},flexWrap:"wrap",useFlexGap:!0,children:[m.jsx(Tt,{variant:"contained",startIcon:m.jsx(nQ,{}),onClick:()=>a(!0),size:"large",children:"Bridge Wizard"}),m.jsx(Tt,{variant:"outlined",startIcon:m.jsx(fu,{}),onClick:()=>e(jt.createBridge),size:"large",children:"Create Bridge"})]}),n?.bridgeDetails&&n.bridgeDetails.length>0?m.jsx(et,{container:!0,spacing:1.5,children:[...n.bridgeDetails].sort((y,b)=>y.name.localeCompare(b.name,void 0,{sensitivity:"base"})).map(y=>m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(P_e,{bridge:y,onClick:()=>e(jt.bridge(y.id))})},y.id))}):m.jsx(er,{variant:"outlined",children:m.jsx(gr,{sx:{textAlign:"center",py:4},children:m.jsx(re,{color:"text.secondary",children:"No bridges configured yet. Use the Bridge Wizard or create one manually."})})}),m.jsx(Di,{sx:{my:3}}),m.jsx(re,{variant:"h6",sx:{mb:2},children:"Quick Navigation"}),m.jsxs(et,{container:!0,spacing:1.5,children:[m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Bridges",icon:m.jsx(c1,{sx:{fontSize:20}}),onClick:()=>e(jt.bridges)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"All Devices",icon:m.jsx(ss,{sx:{fontSize:20}}),onClick:()=>e(jt.devices)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Network Map",icon:m.jsx(QC,{sx:{fontSize:20}}),onClick:()=>e(jt.networkMap)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Health Dashboard",icon:m.jsx(WC,{sx:{fontSize:20}}),onClick:()=>e(jt.health)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Startup Order",icon:m.jsx(rg,{sx:{fontSize:20}}),onClick:()=>e(jt.startup)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Lock Credentials",icon:m.jsx(su,{sx:{fontSize:20}}),onClick:()=>e(jt.lockCredentials)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Filter Reference",icon:m.jsx(ZC,{sx:{fontSize:20}}),onClick:()=>e(jt.labels)})})]}),m.jsx(uQ,{open:s,onClose:()=>a(!1),onComplete:()=>{t(Fo()),l()}})]})};function $_e(e){return Qe("MuiPagination",e)}tt("MuiPagination",["root","ul","outlined","text"]);function N_e(e={}){const{boundaryCount:t=1,componentName:n="usePagination",count:r=1,defaultPage:i=1,disabled:o=!1,hideNextButton:s=!1,hidePrevButton:a=!1,onChange:l,page:u,showFirstButton:c=!1,showLastButton:f=!1,siblingCount:h=1,...g}=e,[y,b]=Ka({controlled:u,default:i,name:n,state:"page"}),v=(M,L)=>{u||b(L),l&&l(M,L)},S=(M,L)=>{const j=L-M+1;return Array.from({length:j},(I,N)=>M+N)},C=S(1,Math.min(t,r)),w=S(Math.max(r-t+1,t+1),r),A=Math.max(Math.min(y-h,r-t-h*2-1),t+2),E=Math.min(Math.max(y+h,t+h*2+2),r-t-1),_=[...c?["first"]:[],...a?[]:["previous"],...C,...A>t+2?["start-ellipsis"]:t+1<r-t?[t+1]:[],...S(A,E),...E<r-t-1?["end-ellipsis"]:r-t>t?[r-t]:[],...w,...s?[]:["next"],...f?["last"]:[]],D=M=>{switch(M){case"first":return 1;case"previous":return y-1;case"next":return y+1;case"last":return r;default:return null}};return{items:_.map(M=>typeof M=="number"?{onClick:L=>{v(L,M)},type:"page",page:M,selected:M===y,disabled:o,"aria-current":M===y?"page":void 0}:{onClick:L=>{v(L,D(M))},type:M,page:D(M),selected:!1,disabled:o||!M.includes("ellipsis")&&(M==="next"||M==="last"?y>=r:y<=1)}),...g}}function L_e(e){return Qe("MuiPaginationItem",e)}const Ro=tt("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),F_e=De(m.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),B_e=De(m.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),z_e=De(m.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),U_e=De(m.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),cQ=(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ye(n.size)}`],n.variant==="text"&&t[`text${ye(n.color)}`],n.variant==="outlined"&&t[`outlined${ye(n.color)}`],n.shape==="rounded"&&t.rounded,n.type==="page"&&t.page,(n.type==="start-ellipsis"||n.type==="end-ellipsis")&&t.ellipsis,(n.type==="previous"||n.type==="next")&&t.previousNext,(n.type==="first"||n.type==="last")&&t.firstLast]},H_e=e=>{const{classes:t,color:n,disabled:r,selected:i,size:o,shape:s,type:a,variant:l}=e,u={root:["root",`size${ye(o)}`,l,s,n!=="standard"&&`color${ye(n)}`,n!=="standard"&&`${l}${ye(n)}`,r&&"disabled",i&&"selected",{page:"page",first:"firstLast",last:"firstLast","start-ellipsis":"ellipsis","end-ellipsis":"ellipsis",previous:"previousNext",next:"previousNext"}[a]],icon:["icon"]};return Ze(u,L_e,t)},V_e=me("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver:cQ})(qe(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,height:"auto",[`&.${Ro.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}}]}))),W_e=me(ma,{name:"MuiPaginationItem",slot:"Root",overridesResolver:cQ})(qe(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,height:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,[`&.${Ro.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Ro.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},transition:e.transitions.create(["color","background-color"],{duration:e.transitions.duration.short}),"&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Ro.selected}`]:{backgroundColor:(e.vars||e).palette.action.selected,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Ro.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${Ro.disabled}`]:{opacity:1,color:(e.vars||e).palette.action.disabled,backgroundColor:(e.vars||e).palette.action.selected}},variants:[{props:{size:"small"},style:{minWidth:26,height:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,height:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}},{props:{shape:"rounded"},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:{variant:"outlined"},style:{border:e.vars?`1px solid ${e.alpha(e.vars.palette.common.onBackground,.23)}`:`1px solid ${e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${Ro.selected}`]:{[`&.${Ro.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${Ro.selected}`]:{[`&.${Ro.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Ln(["dark","contrastText"])).map(([t])=>({props:{variant:"text",color:t},style:{[`&.${Ro.selected}`]:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}},[`&.${Ro.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${Ro.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Ln(["light"])).map(([t])=>({props:{variant:"outlined",color:t},style:{[`&.${Ro.selected}`]:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.5)}`,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.activatedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Ro.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),q_e=me("div",{name:"MuiPaginationItem",slot:"Icon"})(qe(({theme:e})=>({fontSize:e.typography.pxToRem(20),margin:"0 -8px",variants:[{props:{size:"small"},style:{fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{fontSize:e.typography.pxToRem(22)}}]}))),G_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiPaginationItem"}),{className:i,color:o="standard",component:s,components:a={},disabled:l=!1,page:u,selected:c=!1,shape:f="circular",size:h="medium",slots:g={},slotProps:y={},type:b="page",variant:v="text",...S}=r,C={...r,color:o,disabled:l,selected:c,shape:f,size:h,type:b,variant:v},w=ff(),A=H_e(C),E={slots:{previous:g.previous??a.previous,next:g.next??a.next,first:g.first??a.first,last:g.last??a.last},slotProps:y},[_,D]=ut("previous",{elementType:z_e,externalForwardedProps:E,ownerState:C}),[T,M]=ut("next",{elementType:U_e,externalForwardedProps:E,ownerState:C}),[L,j]=ut("first",{elementType:F_e,externalForwardedProps:E,ownerState:C}),[I,N]=ut("last",{elementType:B_e,externalForwardedProps:E,ownerState:C}),$=w?{previous:"next",next:"previous",first:"last",last:"first"}[b]:b,z={previous:_,next:T,first:L,last:I}[$],F={previous:D,next:M,first:j,last:N}[$];return b==="start-ellipsis"||b==="end-ellipsis"?m.jsx(V_e,{ref:n,ownerState:C,className:Oe(A.root,i),children:"…"}):m.jsxs(W_e,{ref:n,ownerState:C,component:s,disabled:l,className:Oe(A.root,i),...S,children:[b==="page"&&u,z?m.jsx(q_e,{...F,className:A.icon,as:z}):null]})}),K_e=e=>{const{classes:t,variant:n}=e;return Ze({root:["root",n],ul:["ul"]},$_e,t)},Y_e=me("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),X_e=me("ul",{name:"MuiPagination",slot:"Ul"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"});function J_e(e,t,n){return e==="page"?`${n?"":"Go to "}page ${t}`:`Go to ${e} page`}const Q_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiPagination"}),{boundaryCount:i=1,className:o,color:s="standard",count:a=1,defaultPage:l=1,disabled:u=!1,getItemAriaLabel:c=J_e,hideNextButton:f=!1,hidePrevButton:h=!1,onChange:g,page:y,renderItem:b=L=>m.jsx(G_e,{...L}),shape:v="circular",showFirstButton:S=!1,showLastButton:C=!1,siblingCount:w=1,size:A="medium",variant:E="text",..._}=r,{items:D}=N_e({...r,componentName:"Pagination"}),T={...r,boundaryCount:i,color:s,count:a,defaultPage:l,disabled:u,getItemAriaLabel:c,hideNextButton:f,hidePrevButton:h,renderItem:b,shape:v,showFirstButton:S,showLastButton:C,siblingCount:w,size:A,variant:E},M=K_e(T);return m.jsx(Y_e,{"aria-label":"pagination navigation",className:Oe(M.root,o),ownerState:T,ref:n,..._,children:m.jsx(X_e,{className:M.ul,ownerState:T,children:D.map((L,j)=>m.jsx("li",{children:b({...L,color:s,"aria-label":c(L.type,L.page,L.selected),shape:v,size:A,variant:E})},j))})})}),FB=[10,25,50,100],BB="hamh-devices-page-size",Z_e=()=>{const e=zs(),{content:t,isLoading:n}=Hg(),[r,i]=O.useState(""),[o,s]=O.useState(""),[a,l]=O.useState(""),[u,c]=O.useState("name"),[f,h]=O.useState("asc"),[g,y]=O.useState(1),[b,v]=O.useState(()=>{const J=localStorage.getItem(BB);if(!J)return 12;if(J==="all")return 0;const Q=parseInt(J,10);return Q>0?Q:12}),[S,C]=O.useState(""),w=O.useCallback(J=>{v(J),localStorage.setItem(BB,J===0?"all":String(J)),y(1)},[]),[A,E]=O.useState(!1),[_,D]=O.useState(""),[T,M]=O.useState(""),[L,j]=O.useState(),[I,N]=O.useState({open:!1,message:"",severity:"success"});O.useEffect(()=>{e(Fo())},[e]),O.useEffect(()=>{t&&t.forEach(J=>{e(dc(J.id))})},[e,t]);const $=Bg(J=>J.devices.byBridge),z=O.useCallback((J,Q,ie)=>{const ue=[];if(!J.parts||J.parts.length===0)J.endpoint!==0&&ue.push({bridgeId:Q,bridgeName:ie,endpoint:J});else for(const te of J.parts)ue.push(...z(te,Q,ie));return ue},[]),F=O.useMemo(()=>{const J=[];return(t||[]).forEach(Q=>{const ue=$[Q.id]?.content;ue&&J.push(...z(ue,Q.id,Q.name))}),J},[t,$,z]),G=n||t&&t.length>0&&F.length===0,V=O.useMemo(()=>F.filter(J=>{const Q=Ps(J.endpoint.state)??J.endpoint.id.local,ie=J.endpoint.type.name,ue=Q.toLowerCase().includes(r.toLowerCase())||J.bridgeName.toLowerCase().includes(r.toLowerCase())||ie.toLowerCase().includes(r.toLowerCase()),te=!o||J.bridgeId===o;return ue&&te&&(!a||ie===a)}),[F,r,o,a]),H=O.useMemo(()=>[...V].sort((Q,ie)=>{const ue=Ps(Q.endpoint.state)??Q.endpoint.id.local,te=Ps(ie.endpoint.state)??ie.endpoint.id.local;let ne=0;switch(u){case"name":ne=ue.localeCompare(te);break;case"type":ne=Q.endpoint.type.name.localeCompare(ie.endpoint.type.name),ne===0&&(ne=ue.localeCompare(te));break;case"bridge":ne=Q.bridgeName.localeCompare(ie.bridgeName),ne===0&&(ne=ue.localeCompare(te));break}return f==="asc"?ne:-ne}),[V,u,f]),X=b===0?1:Math.ceil(H.length/b),B=b===0?H:H.slice((g-1)*b,g*b),W=O.useMemo(()=>{const J=new Set(F.map(Q=>Q.endpoint.type.name));return Array.from(J).sort()},[F]),Y=O.useMemo(()=>t?[...t].sort((J,Q)=>{const ie=J.name.localeCompare(Q.name);return f==="asc"?ie:-ie}):[],[t,f]),U=O.useCallback(()=>{e(Fo())},[e]),K=O.useCallback(async(J,Q)=>{D(J),M(Q);try{const ue=(await oM(Q)).mappings.find(te=>te.entityId===J);j(ue)}catch{j(void 0)}E(!0)},[]),Z=O.useCallback(async J=>{if(!(!T||!_))try{await sM(T,_,J),N({open:!0,message:`Mapping saved for ${_}. Restart the bridge to apply changes.`,severity:"success"}),E(!1)}catch(Q){N({open:!0,message:`Failed to save mapping: ${Q}`,severity:"error"})}},[T,_]);return G?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(Ur,{})}):m.jsxs(le,{sx:{p:2},children:[m.jsxs(re,{variant:"h4",gutterBottom:!0,sx:{display:"flex",alignItems:"center",gap:2},children:[m.jsx(ss,{}),"All Devices",m.jsx(Tt,{variant:"outlined",startIcon:m.jsx(xM,{}),onClick:U,sx:{ml:"auto"},children:"Refresh"})]}),m.jsx(er,{sx:{mb:3},children:m.jsx(gr,{children:m.jsxs(zt,{spacing:2,direction:{xs:"column",md:"row"},alignItems:{md:"center"},children:[m.jsx(zr,{label:"Search devices...",value:r,onChange:J=>i(J.target.value),sx:{flexGrow:1}}),m.jsxs(Xa,{sx:{minWidth:200},children:[m.jsx(cc,{children:"Bridge"}),m.jsxs(Ha,{value:o,label:"Bridge",onChange:J=>s(J.target.value),children:[m.jsx(rr,{value:"",children:"All Bridges"}),Y.map(J=>m.jsx(rr,{value:J.id,children:J.name},J.id))]})]}),m.jsxs(Xa,{sx:{minWidth:200},children:[m.jsx(cc,{children:"Device Type"}),m.jsxs(Ha,{value:a,label:"Device Type",onChange:J=>l(J.target.value),children:[m.jsx(rr,{value:"",children:"All Types"}),W.map(J=>m.jsx(rr,{value:J,children:J},J))]})]}),m.jsxs(Xa,{sx:{minWidth:150},children:[m.jsx(cc,{children:"Sort By"}),m.jsxs(Ha,{value:u,label:"Sort By",onChange:J=>c(J.target.value),children:[m.jsx(rr,{value:"bridge",children:"Bridge"}),m.jsx(rr,{value:"type",children:"Device Type"}),m.jsx(rr,{value:"name",children:"Name"})]})]}),m.jsx(bn,{title:f==="asc"?"Ascending":"Descending",children:m.jsx(Fn,{onClick:()=>h(J=>J==="asc"?"desc":"asc"),color:"primary",children:f==="asc"?m.jsx(gM,{}):m.jsx(mM,{})})})]})})}),m.jsx(et,{container:!0,spacing:2,children:B.map(J=>m.jsx(et,{size:{xs:12,sm:6,lg:4},children:m.jsx(RJ,{endpoint:J.endpoint,bridgeName:J.bridgeName,bridgeId:J.bridgeId,onEditMapping:K})},`${J.bridgeId}-${J.endpoint.id.global}`))}),m.jsxs(le,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:3,gap:2,flexWrap:"wrap"},children:[m.jsxs(zt,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:"Per page:"}),m.jsxs(Ha,{value:b===0?"all":FB.includes(b)?String(b):"",onChange:J=>{const Q=J.target.value;C(""),w(Q==="all"?0:parseInt(Q,10))},displayEmpty:!0,renderValue:J=>J==="all"?"All":J===""?String(b):J,size:"small",sx:{minWidth:80},children:[FB.map(J=>m.jsx(rr,{value:String(J),children:J},J)),m.jsx(rr,{value:"all",children:"All"})]}),m.jsx(zr,{size:"small",type:"number",placeholder:"Custom",value:S,onChange:J=>C(J.target.value),onBlur:()=>{const J=parseInt(S,10);J>0&&w(J),C("")},onKeyDown:J=>{if(J.key==="Enter"){const Q=parseInt(S,10);Q>0&&w(Q),C("")}},slotProps:{htmlInput:{min:1,style:{textAlign:"center"}}},sx:{width:80}})]}),X>1&&m.jsx(Q_e,{count:X,page:g,onChange:(J,Q)=>y(Q),color:"primary"}),m.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:V.length===F.length?`${F.length} device${F.length!==1?"s":""}`:`${V.length} of ${F.length} devices`})]}),V.length===0&&m.jsxs(le,{sx:{textAlign:"center",py:8},children:[m.jsx(re,{variant:"h6",color:"text.secondary",children:"No devices found"}),m.jsx(re,{variant:"body2",color:"text.secondary",children:"Try adjusting your filters or check if any bridges are running"})]}),m.jsx(lM,{open:A,entityId:_,domain:_.split(".")[0]||"",currentMapping:L,onSave:Z,onClose:()=>E(!1)}),m.jsx(MI,{open:I.open,autoHideDuration:6e3,onClose:()=>N(J=>({...J,open:!1})),children:m.jsx(kn,{onClose:()=>N(J=>({...J,open:!1})),severity:I.severity,sx:{width:"100%"},children:I.message})})]})};function fn(e){return typeof e!="object"||e===null||typeof e.lastModified=="number"&&typeof File<"u"&&e instanceof File||typeof e.getMonth=="function"&&typeof Date<"u"&&e instanceof Date?!1:!Array.isArray(e)}function e5e(e){return e.additionalItems===!0&&console.warn("additionalItems=true is currently not supported"),fn(e.additionalItems)}function zB(e){if(e==="")return;if(e===null)return null;if(/\.$/.test(e)||/\.0$/.test(e)||/\.\d*0$/.test(e))return e;const t=Number(e);return typeof t=="number"&&!Number.isNaN(t)?t:e}const fc="__additional_property",eb="additionalProperties",wc="allOf",Mn="anyOf",ba="const",D3="default",_M="dependencies",t5e="enum",po="__errors",pr="$id",DM="if",Mh="items",n5e="_$junk_option_schema_id$_",zw="$name",nn="oneOf",X6="patternProperties",Hn="properties",W4="readonly",dQ="required",nE="submitButtonOptions",mr="$ref",zy="$schema",fQ="root",hQ="_",r5e=["discriminator","propertyName"],UB="formContext",i5e="layoutGridLookupMap",OM="__rjsf_additionalProperties",pQ="__rjsf_rootSchema",o5e="ui:field",TM="ui:widget",jd="ui:options",J6="ui:globalOptions",s5e="ui:definitions",a5e="https://json-schema.org/draft/2019-09/schema",Uw="https://json-schema.org/draft/2020-12/schema";function $t(e={},t={}){return e?Object.keys(e).filter(n=>n.indexOf("ui:")===0).reduce((n,r)=>{const i=e[r];return r===TM&&fn(i)?(console.error("Setting options via ui:widget object is no longer supported, use ui:options instead"),n):r===jd&&fn(i)?{...n,...i}:{...n,[r.substring(3)]:i}},{...t}):{...t}}function mQ(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;const{expandable:r=!0}=$t(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var gQ=typeof global=="object"&&global&&global.Object===Object&&global,l5e=typeof self=="object"&&self&&self.Object===Object&&self,vu=gQ||l5e||Function("return this")(),va=vu.Symbol,yQ=Object.prototype,u5e=yQ.hasOwnProperty,c5e=yQ.toString,my=va?va.toStringTag:void 0;function d5e(e){var t=u5e.call(e,my),n=e[my];try{e[my]=void 0;var r=!0}catch{}var i=c5e.call(e);return r&&(t?e[my]=n:delete e[my]),i}var f5e=Object.prototype,h5e=f5e.toString;function p5e(e){return h5e.call(e)}var m5e="[object Null]",g5e="[object Undefined]",HB=va?va.toStringTag:void 0;function Ic(e){return e==null?e===void 0?g5e:m5e:HB&&HB in Object(e)?d5e(e):p5e(e)}function bQ(e,t){return function(n){return e(t(n))}}var O3=bQ(Object.getPrototypeOf,Object);function xa(e){return e!=null&&typeof e=="object"}var y5e="[object Object]",b5e=Function.prototype,v5e=Object.prototype,vQ=b5e.toString,x5e=v5e.hasOwnProperty,S5e=vQ.call(Object);function Xd(e){if(!xa(e)||Ic(e)!=y5e)return!1;var t=O3(e);if(t===null)return!0;var n=x5e.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&vQ.call(n)==S5e}function Q6(e){const t={[po]:[],addError(n){this[po].push(n)}};if(Array.isArray(e))return e.reduce((n,r,i)=>({...n,[i]:Q6(r)}),t);if(Xd(e)){const n=e;return Object.keys(n).reduce((r,i)=>({...r,[i]:Q6(n[i])}),t)}return t}function w5e(){this.__data__=[],this.size=0}function vv(e,t){return e===t||e!==e&&t!==t}function T3(e,t){for(var n=e.length;n--;)if(vv(e[n][0],t))return n;return-1}var C5e=Array.prototype,E5e=C5e.splice;function A5e(e){var t=this.__data__,n=T3(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():E5e.call(t,n,1),--this.size,!0}function k5e(e){var t=this.__data__,n=T3(t,e);return n<0?void 0:t[n][1]}function _5e(e){return T3(this.__data__,e)>-1}function D5e(e,t){var n=this.__data__,r=T3(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Mc(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Mc.prototype.clear=w5e;Mc.prototype.delete=A5e;Mc.prototype.get=k5e;Mc.prototype.has=_5e;Mc.prototype.set=D5e;function O5e(){this.__data__=new Mc,this.size=0}function T5e(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function R5e(e){return this.__data__.get(e)}function I5e(e){return this.__data__.has(e)}function Bn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var M5e="[object AsyncFunction]",P5e="[object Function]",j5e="[object GeneratorFunction]",$5e="[object Proxy]";function xv(e){if(!Bn(e))return!1;var t=Ic(e);return t==P5e||t==j5e||t==M5e||t==$5e}var q4=vu["__core-js_shared__"],VB=(function(){var e=/[^.]+$/.exec(q4&&q4.keys&&q4.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function N5e(e){return!!VB&&VB in e}var L5e=Function.prototype,F5e=L5e.toString;function Qh(e){if(e!=null){try{return F5e.call(e)}catch{}try{return e+""}catch{}}return""}var B5e=/[\\^$.*+?()[\]{}|]/g,z5e=/^\[object .+?Constructor\]$/,U5e=Function.prototype,H5e=Object.prototype,V5e=U5e.toString,W5e=H5e.hasOwnProperty,q5e=RegExp("^"+V5e.call(W5e).replace(B5e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G5e(e){if(!Bn(e)||N5e(e))return!1;var t=xv(e)?q5e:z5e;return t.test(Qh(e))}function K5e(e,t){return e?.[t]}function Zh(e,t){var n=K5e(e,t);return G5e(n)?n:void 0}var tb=Zh(vu,"Map"),nb=Zh(Object,"create");function Y5e(){this.__data__=nb?nb(null):{},this.size=0}function X5e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var J5e="__lodash_hash_undefined__",Q5e=Object.prototype,Z5e=Q5e.hasOwnProperty;function e4e(e){var t=this.__data__;if(nb){var n=t[e];return n===J5e?void 0:n}return Z5e.call(t,e)?t[e]:void 0}var t4e=Object.prototype,n4e=t4e.hasOwnProperty;function r4e(e){var t=this.__data__;return nb?t[e]!==void 0:n4e.call(t,e)}var i4e="__lodash_hash_undefined__";function o4e(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=nb&&t===void 0?i4e:t,this}function Ph(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ph.prototype.clear=Y5e;Ph.prototype.delete=X5e;Ph.prototype.get=e4e;Ph.prototype.has=r4e;Ph.prototype.set=o4e;function s4e(){this.size=0,this.__data__={hash:new Ph,map:new(tb||Mc),string:new Ph}}function a4e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function R3(e,t){var n=e.__data__;return a4e(t)?n[typeof t=="string"?"string":"hash"]:n.map}function l4e(e){var t=R3(this,e).delete(e);return this.size-=t?1:0,t}function u4e(e){return R3(this,e).get(e)}function c4e(e){return R3(this,e).has(e)}function d4e(e,t){var n=R3(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Pc(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pc.prototype.clear=s4e;Pc.prototype.delete=l4e;Pc.prototype.get=u4e;Pc.prototype.has=c4e;Pc.prototype.set=d4e;var f4e=200;function h4e(e,t){var n=this.__data__;if(n instanceof Mc){var r=n.__data__;if(!tb||r.length<f4e-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pc(r)}return n.set(e,t),this.size=n.size,this}function Qa(e){var t=this.__data__=new Mc(e);this.size=t.size}Qa.prototype.clear=O5e;Qa.prototype.delete=T5e;Qa.prototype.get=R5e;Qa.prototype.has=I5e;Qa.prototype.set=h4e;var p4e="__lodash_hash_undefined__";function m4e(e){return this.__data__.set(e,p4e),this}function g4e(e){return this.__data__.has(e)}function jh(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Pc;++t<n;)this.add(e[t])}jh.prototype.add=jh.prototype.push=m4e;jh.prototype.has=g4e;function y4e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function rb(e,t){return e.has(t)}var b4e=1,v4e=2;function xQ(e,t,n,r,i,o){var s=n&b4e,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var f=-1,h=!0,g=n&v4e?new jh:void 0;for(o.set(e,t),o.set(t,e);++f<a;){var y=e[f],b=t[f];if(r)var v=s?r(b,y,f,t,e,o):r(y,b,f,e,t,o);if(v!==void 0){if(v)continue;h=!1;break}if(g){if(!y4e(t,function(S,C){if(!rb(g,C)&&(y===S||i(y,S,n,r,o)))return g.push(C)})){h=!1;break}}else if(!(y===b||i(y,b,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var rE=vu.Uint8Array;function x4e(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function RM(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var S4e=1,w4e=2,C4e="[object Boolean]",E4e="[object Date]",A4e="[object Error]",k4e="[object Map]",_4e="[object Number]",D4e="[object RegExp]",O4e="[object Set]",T4e="[object String]",R4e="[object Symbol]",I4e="[object ArrayBuffer]",M4e="[object DataView]",WB=va?va.prototype:void 0,G4=WB?WB.valueOf:void 0;function P4e(e,t,n,r,i,o,s){switch(n){case M4e:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case I4e:return!(e.byteLength!=t.byteLength||!o(new rE(e),new rE(t)));case C4e:case E4e:case _4e:return vv(+e,+t);case A4e:return e.name==t.name&&e.message==t.message;case D4e:case T4e:return e==t+"";case k4e:var a=x4e;case O4e:var l=r&S4e;if(a||(a=RM),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;r|=w4e,s.set(e,t);var c=xQ(a(e),a(t),r,i,o,s);return s.delete(e),c;case R4e:if(G4)return G4.call(e)==G4.call(t)}return!1}function IM(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Fi=Array.isArray;function SQ(e,t,n){var r=t(e);return Fi(e)?r:IM(r,n(e))}function j4e(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function wQ(){return[]}var $4e=Object.prototype,N4e=$4e.propertyIsEnumerable,qB=Object.getOwnPropertySymbols,MM=qB?function(e){return e==null?[]:(e=Object(e),j4e(qB(e),function(t){return N4e.call(e,t)}))}:wQ;function CQ(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var L4e="[object Arguments]";function GB(e){return xa(e)&&Ic(e)==L4e}var EQ=Object.prototype,F4e=EQ.hasOwnProperty,B4e=EQ.propertyIsEnumerable,dg=GB((function(){return arguments})())?GB:function(e){return xa(e)&&F4e.call(e,"callee")&&!B4e.call(e,"callee")};function z4e(){return!1}var AQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,KB=AQ&&typeof module=="object"&&module&&!module.nodeType&&module,U4e=KB&&KB.exports===AQ,YB=U4e?vu.Buffer:void 0,H4e=YB?YB.isBuffer:void 0,$h=H4e||z4e,V4e=9007199254740991,W4e=/^(?:0|[1-9]\d*)$/;function I3(e,t){var n=typeof e;return t=t??V4e,!!t&&(n=="number"||n!="symbol"&&W4e.test(e))&&e>-1&&e%1==0&&e<t}var q4e=9007199254740991;function PM(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=q4e}var G4e="[object Arguments]",K4e="[object Array]",Y4e="[object Boolean]",X4e="[object Date]",J4e="[object Error]",Q4e="[object Function]",Z4e="[object Map]",eDe="[object Number]",tDe="[object Object]",nDe="[object RegExp]",rDe="[object Set]",iDe="[object String]",oDe="[object WeakMap]",sDe="[object ArrayBuffer]",aDe="[object DataView]",lDe="[object Float32Array]",uDe="[object Float64Array]",cDe="[object Int8Array]",dDe="[object Int16Array]",fDe="[object Int32Array]",hDe="[object Uint8Array]",pDe="[object Uint8ClampedArray]",mDe="[object Uint16Array]",gDe="[object Uint32Array]",$r={};$r[lDe]=$r[uDe]=$r[cDe]=$r[dDe]=$r[fDe]=$r[hDe]=$r[pDe]=$r[mDe]=$r[gDe]=!0;$r[G4e]=$r[K4e]=$r[sDe]=$r[Y4e]=$r[aDe]=$r[X4e]=$r[J4e]=$r[Q4e]=$r[Z4e]=$r[eDe]=$r[tDe]=$r[nDe]=$r[rDe]=$r[iDe]=$r[oDe]=!1;function yDe(e){return xa(e)&&PM(e.length)&&!!$r[Ic(e)]}function jM(e){return function(t){return e(t)}}var kQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,d1=kQ&&typeof module=="object"&&module&&!module.nodeType&&module,bDe=d1&&d1.exports===kQ,K4=bDe&&gQ.process,fg=(function(){try{var e=d1&&d1.require&&d1.require("util").types;return e||K4&&K4.binding&&K4.binding("util")}catch{}})(),XB=fg&&fg.isTypedArray,Sv=XB?jM(XB):yDe,vDe=Object.prototype,xDe=vDe.hasOwnProperty;function _Q(e,t){var n=Fi(e),r=!n&&dg(e),i=!n&&!r&&$h(e),o=!n&&!r&&!i&&Sv(e),s=n||r||i||o,a=s?CQ(e.length,String):[],l=a.length;for(var u in e)(t||xDe.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||I3(u,l)))&&a.push(u);return a}var SDe=Object.prototype;function M3(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||SDe;return e===n}var wDe=bQ(Object.keys,Object),CDe=Object.prototype,EDe=CDe.hasOwnProperty;function DQ(e){if(!M3(e))return wDe(e);var t=[];for(var n in Object(e))EDe.call(e,n)&&n!="constructor"&&t.push(n);return t}function ep(e){return e!=null&&PM(e.length)&&!xv(e)}function Fa(e){return ep(e)?_Q(e):DQ(e)}function Z6(e){return SQ(e,Fa,MM)}var ADe=1,kDe=Object.prototype,_De=kDe.hasOwnProperty;function DDe(e,t,n,r,i,o){var s=n&ADe,a=Z6(e),l=a.length,u=Z6(t),c=u.length;if(l!=c&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in t:_De.call(t,h)))return!1}var g=o.get(e),y=o.get(t);if(g&&y)return g==t&&y==e;var b=!0;o.set(e,t),o.set(t,e);for(var v=s;++f<l;){h=a[f];var S=e[h],C=t[h];if(r)var w=s?r(C,S,h,t,e,o):r(S,C,h,e,t,o);if(!(w===void 0?S===C||i(S,C,n,r,o):w)){b=!1;break}v||(v=h=="constructor")}if(b&&!v){var A=e.constructor,E=t.constructor;A!=E&&"constructor"in e&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof E=="function"&&E instanceof E)&&(b=!1)}return o.delete(e),o.delete(t),b}var eT=Zh(vu,"DataView"),tT=Zh(vu,"Promise"),jm=Zh(vu,"Set"),nT=Zh(vu,"WeakMap"),JB="[object Map]",ODe="[object Object]",QB="[object Promise]",ZB="[object Set]",ez="[object WeakMap]",tz="[object DataView]",TDe=Qh(eT),RDe=Qh(tb),IDe=Qh(tT),MDe=Qh(jm),PDe=Qh(nT),ra=Ic;(eT&&ra(new eT(new ArrayBuffer(1)))!=tz||tb&&ra(new tb)!=JB||tT&&ra(tT.resolve())!=QB||jm&&ra(new jm)!=ZB||nT&&ra(new nT)!=ez)&&(ra=function(e){var t=Ic(e),n=t==ODe?e.constructor:void 0,r=n?Qh(n):"";if(r)switch(r){case TDe:return tz;case RDe:return JB;case IDe:return QB;case MDe:return ZB;case PDe:return ez}return t});var jDe=1,nz="[object Arguments]",rz="[object Array]",M2="[object Object]",$De=Object.prototype,iz=$De.hasOwnProperty;function NDe(e,t,n,r,i,o){var s=Fi(e),a=Fi(t),l=s?rz:ra(e),u=a?rz:ra(t);l=l==nz?M2:l,u=u==nz?M2:u;var c=l==M2,f=u==M2,h=l==u;if(h&&$h(e)){if(!$h(t))return!1;s=!0,c=!1}if(h&&!c)return o||(o=new Qa),s||Sv(e)?xQ(e,t,n,r,i,o):P4e(e,t,l,n,r,i,o);if(!(n&jDe)){var g=c&&iz.call(e,"__wrapped__"),y=f&&iz.call(t,"__wrapped__");if(g||y){var b=g?e.value():e,v=y?t.value():t;return o||(o=new Qa),i(b,v,n,r,o)}}return h?(o||(o=new Qa),DDe(e,t,n,r,i,o)):!1}function wv(e,t,n,r,i){return e===t?!0:e==null||t==null||!xa(e)&&!xa(t)?e!==e&&t!==t:NDe(e,t,n,r,wv,i)}function LDe(e,t,n){n=typeof n=="function"?n:void 0;var r=n?n(e,t):void 0;return r===void 0?wv(e,t,void 0,n):!!r}function _r(e,t){return LDe(e,t,(n,r)=>{if(typeof n=="function"&&typeof r=="function")return!0})}var FDe="[object Symbol]";function Cv(e){return typeof e=="symbol"||xa(e)&&Ic(e)==FDe}var BDe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zDe=/^\w*$/;function $M(e,t){if(Fi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Cv(e)?!0:zDe.test(e)||!BDe.test(e)||t!=null&&e in Object(t)}var UDe="Expected a function";function NM(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(UDe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(NM.Cache||Pc),n}NM.Cache=Pc;var HDe=500;function VDe(e){var t=NM(e,function(r){return n.size===HDe&&n.clear(),r}),n=t.cache;return t}var WDe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qDe=/\\(\\)?/g,OQ=VDe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(WDe,function(n,r,i,o){t.push(i?o.replace(qDe,"$1"):r||n)}),t});function Wg(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var oz=va?va.prototype:void 0,sz=oz?oz.toString:void 0;function TQ(e){if(typeof e=="string")return e;if(Fi(e))return Wg(e,TQ)+"";if(Cv(e))return sz?sz.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function LM(e){return e==null?"":TQ(e)}function qg(e,t){return Fi(e)?e:$M(e,t)?[e]:OQ(LM(e))}function tp(e){if(typeof e=="string"||Cv(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function P3(e,t){t=qg(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[tp(t[n++])];return n&&n==r?e:void 0}function Ve(e,t,n){var r=e==null?void 0:P3(e,t);return r===void 0?n:r}var GDe=Object.prototype,KDe=GDe.hasOwnProperty;function YDe(e,t){return e!=null&&KDe.call(e,t)}function RQ(e,t,n){t=qg(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=tp(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&PM(i)&&I3(s,i)&&(Fi(e)||dg(e)))}function In(e,t){return e!=null&&RQ(e,t,YDe)}function ib(e,t){return wv(e,t)}var iE=(function(){try{var e=Zh(Object,"defineProperty");return e({},"",{}),e}catch{}})();function FM(e,t,n){t=="__proto__"&&iE?iE(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var XDe=Object.prototype,JDe=XDe.hasOwnProperty;function BM(e,t,n){var r=e[t];(!(JDe.call(e,t)&&vv(r,n))||n===void 0&&!(t in e))&&FM(e,t,n)}function zM(e,t,n,r){if(!Bn(e))return e;t=qg(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=tp(t[i]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var c=a[l];u=r?r(c,l,a):void 0,u===void 0&&(u=Bn(c)?c:I3(t[i+1])?[]:{})}BM(a,l,u),a=a[l]}return e}function ur(e,t,n){return e==null?e:zM(e,t,n)}function j3(e){return e}function IQ(e){return typeof e=="function"?e:j3}var QDe=/\s/;function ZDe(e){for(var t=e.length;t--&&QDe.test(e.charAt(t)););return t}var eOe=/^\s+/;function tOe(e){return e&&e.slice(0,ZDe(e)+1).replace(eOe,"")}var az=NaN,nOe=/^[-+]0x[0-9a-f]+$/i,rOe=/^0b[01]+$/i,iOe=/^0o[0-7]+$/i,oOe=parseInt;function sOe(e){if(typeof e=="number")return e;if(Cv(e))return az;if(Bn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Bn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=tOe(e);var n=rOe.test(e);return n||iOe.test(e)?oOe(e.slice(2),n?2:8):nOe.test(e)?az:+e}var lz=1/0,aOe=17976931348623157e292;function lOe(e){if(!e)return e===0?e:0;if(e=sOe(e),e===lz||e===-lz){var t=e<0?-1:1;return t*aOe}return e===e?e:0}function MQ(e){var t=lOe(e),n=t%1;return t===t?n?t-n:t:0}var uOe=9007199254740991,Y4=4294967295,cOe=Math.min;function PQ(e,t){if(e=MQ(e),e<1||e>uOe)return[];var n=Y4,r=cOe(e,Y4);t=IQ(t),e-=Y4;for(var i=CQ(r,t);++n<e;)t(n);return i}function UM(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var uz=Object.create,jQ=(function(){function e(){}return function(t){if(!Bn(t))return{};if(uz)return uz(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function dOe(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var l=s[++i];if(n(o[l],l,o)===!1)break}return t}}var $Q=dOe();function NQ(e,t){return e&&$Q(e,t,Fa)}var fOe=1,hOe=2;function pOe(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],l=e[a],u=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var c=new Qa,f;if(!(f===void 0?wv(u,l,fOe|hOe,r,c):f))return!1}}return!0}function LQ(e){return e===e&&!Bn(e)}function mOe(e){for(var t=Fa(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,LQ(i)]}return t}function FQ(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function gOe(e){var t=mOe(e);return t.length==1&&t[0][2]?FQ(t[0][0],t[0][1]):function(n){return n===e||pOe(n,e,t)}}function yOe(e,t){return e!=null&&t in Object(e)}function BQ(e,t){return e!=null&&RQ(e,t,yOe)}var bOe=1,vOe=2;function xOe(e,t){return $M(e)&&LQ(t)?FQ(tp(e),t):function(n){var r=Ve(n,e);return r===void 0&&r===t?BQ(n,e):wv(t,r,bOe|vOe)}}function SOe(e){return function(t){return t?.[e]}}function wOe(e){return function(t){return P3(t,e)}}function COe(e){return $M(e)?SOe(tp(e)):wOe(e)}function HM(e){return typeof e=="function"?e:e==null?j3:typeof e=="object"?Fi(e)?xOe(e[0],e[1]):gOe(e):COe(e)}function EOe(e,t,n){var r=Fi(e),i=r||$h(e)||Sv(e);if(t=HM(t),n==null){var o=e&&e.constructor;i?n=r?new o:[]:Bn(e)?n=xv(o)?jQ(O3(e)):{}:n={}}return(i?UM:NQ)(e,function(s,a,l){return t(n,s,a,l)}),n}function rT(e,t,n){(n!==void 0&&!vv(e[t],n)||n===void 0&&!(t in e))&&FM(e,t,n)}var zQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,cz=zQ&&typeof module=="object"&&module&&!module.nodeType&&module,AOe=cz&&cz.exports===zQ,dz=AOe?vu.Buffer:void 0,fz=dz?dz.allocUnsafe:void 0;function UQ(e,t){if(t)return e.slice();var n=e.length,r=fz?fz(n):new e.constructor(n);return e.copy(r),r}function VM(e){var t=new e.constructor(e.byteLength);return new rE(t).set(new rE(e)),t}function HQ(e,t){var n=t?VM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function WM(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function VQ(e){return typeof e.constructor=="function"&&!M3(e)?jQ(O3(e)):{}}function ob(e){return xa(e)&&ep(e)}function iT(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Gg(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],l=void 0;l===void 0&&(l=e[a]),i?FM(n,a,l):BM(n,a,l)}return n}function kOe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var _Oe=Object.prototype,DOe=_Oe.hasOwnProperty;function OOe(e){if(!Bn(e))return kOe(e);var t=M3(e),n=[];for(var r in e)r=="constructor"&&(t||!DOe.call(e,r))||n.push(r);return n}function Ev(e){return ep(e)?_Q(e,!0):OOe(e)}function TOe(e){return Gg(e,Ev(e))}function ROe(e,t,n,r,i,o,s){var a=iT(e,n),l=iT(t,n),u=s.get(l);if(u){rT(e,n,u);return}var c=o?o(a,l,n+"",e,t,s):void 0,f=c===void 0;if(f){var h=Fi(l),g=!h&&$h(l),y=!h&&!g&&Sv(l);c=l,h||g||y?Fi(a)?c=a:ob(a)?c=WM(a):g?(f=!1,c=UQ(l,!0)):y?(f=!1,c=HQ(l,!0)):c=[]:Xd(l)||dg(l)?(c=a,dg(a)?c=TOe(a):(!Bn(a)||xv(a))&&(c=VQ(l))):f=!1}f&&(s.set(l,c),i(c,l,r,o,s),s.delete(l)),rT(e,n,c)}function WQ(e,t,n,r,i){e!==t&&$Q(t,function(o,s){if(i||(i=new Qa),Bn(o))ROe(e,t,s,n,WQ,r,i);else{var a=r?r(iT(e,s),o,s+"",e,t,i):void 0;a===void 0&&(a=o),rT(e,s,a)}},Ev)}function IOe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hz=Math.max;function qQ(e,t,n){return t=hz(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=hz(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),IOe(e,this,a)}}function MOe(e){return function(){return e}}var POe=iE?function(e,t){return iE(e,"toString",{configurable:!0,enumerable:!1,value:MOe(t),writable:!0})}:j3,jOe=800,$Oe=16,NOe=Date.now;function LOe(e){var t=0,n=0;return function(){var r=NOe(),i=$Oe-(r-n);if(n=r,i>0){if(++t>=jOe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var GQ=LOe(POe);function $3(e,t){return GQ(qQ(e,t,j3),e+"")}function FOe(e,t,n){if(!Bn(n))return!1;var r=typeof t;return(r=="number"?ep(n)&&I3(t,n.length):r=="string"&&t in n)?vv(n[t],e):!1}function BOe(e){return $3(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&FOe(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t})}var zOe=BOe(function(e,t,n){WQ(e,t,n)}),pz=va?va.isConcatSpreadable:void 0;function UOe(e){return Fi(e)||dg(e)||!!(pz&&e&&e[pz])}function Av(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=UOe),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Av(a,t-1,n,r,i):IM(i,a):r||(i[i.length]=a)}return i}var HOe=1/0;function VOe(e){var t=e==null?0:e.length;return t?Av(e,HOe):[]}function WOe(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function qOe(e){return e!==e}function GOe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function KQ(e,t,n){return t===t?GOe(e,t,n):WOe(e,qOe,n)}function qM(e,t){var n=e==null?0:e.length;return!!n&&KQ(e,t,0)>-1}function Hw(){}var KOe=1/0,YOe=jm&&1/RM(new jm([,-0]))[1]==KOe?function(e){return new jm(e)}:Hw,XOe=200;function YQ(e,t,n){var r=-1,i=qM,o=e.length,s=!0,a=[],l=a;if(o>=XOe){var u=YOe(e);if(u)return RM(u);s=!1,i=rb,l=new jh}else l=a;e:for(;++r<o;){var c=e[r],f=c;if(c=c!==0?c:0,s&&f===f){for(var h=l.length;h--;)if(l[h]===f)continue e;a.push(c)}else i(l,f,n)||(l!==a&&l.push(f),a.push(c))}return a}function XQ(e){return e&&e.length?YQ(e):[]}var JOe="[object Map]",QOe="[object Set]",ZOe=Object.prototype,e6e=ZOe.hasOwnProperty;function gi(e){if(e==null)return!0;if(ep(e)&&(Fi(e)||typeof e=="string"||typeof e.splice=="function"||$h(e)||Sv(e)||dg(e)))return!e.length;var t=ra(e);if(t==JOe||t==QOe)return!e.size;if(M3(e))return!DQ(e).length;for(var n in e)if(e6e.call(e,n))return!1;return!0}const t6e=Object.prototype;function Uy(e){for(const t in e)if(t6e.hasOwnProperty.call(e,t))return!1;return!0}const n6e=["array","boolean","integer","null","number","object","string"];new Set(n6e);const r6e=["$defs","definitions","properties","patternProperties","dependencies"];new Set(r6e);const i6e=["items","allOf","oneOf","anyOf"];new Set(i6e);const o6e=["items","additionalItems","additionalProperties","propertyNames","contains","if","then","else","not"];new Set(o6e);function Vw(e){return typeof e=="object"}function Tl(e){return Vw(e)?Uy(e):e===!0}function vm(e,t){return e<t?-1:e>t?1:0}function X4(e,t){const n=e.length;if(n===0)return t;let r=t.length;if(r===0)return e;if(n<r){const o=e;e=t,t=o,r=n}const i=new Set(e);for(let o=0;o<r;o++)i.add(t[o]);return Array.from(i)}function s6e(e,t){const n=[];if(e.length===0||t.length===0)return n;if(e.length>t.length){const i=e;e=t,t=i}const r=new Set(t);for(let i=0;i<e.length&&r.size>0;i++){const o=e[i];r.delete(o)&&n.push(o)}return n}function mz(e){return e.length===0}function J4(e){return(t,n)=>{const r=t.length-n.length;if(r!==0)return r;for(let i=0;i<t.length;i++)if(t[i]!==n[i]){const o=e(t[i],n[i]);if(o!==0)return o}return 0}}function JQ(e,{threshold:t=12}={}){return n=>{const r=n.length;if(r===0)return n;if(r<=t){const s=[];let a=0;e:for(let l=0;l<r;l++){const u=n[l];for(let c=0;c<a;c++)if(e(u,s[c])===0)continue e;a=s.push(u)}return s}const i=n.slice().sort(e);let o=0;for(let s=1;s<r;s++)e(i[o],i[s])!==0&&++o!==s&&(i[o]=i[s]);return i.length=o+1,i}}function a6e(e){return(t,n)=>{const r=[];let i=t.length,o=n.length;if(i===0||o===0)return r;if(i>o){const c=t;t=n,n=c;const f=i;i=o,o=f}const s=[...t].sort(e),a=[...n].sort(e);let l=0,u=0;for(;l<i&&u<o;){const c=e(s[l],a[u]);c===0?((r.length===0||e(r[r.length-1],s[l])!==0)&&r.push(s[l]),l++,u++):c<0?l++:u++}return r}}function l6e(e,t){return n=>{if(e.has(n))return e.get(n);const r=t(n);return e.set(n,r),r}}const gz=l6e,QQ=()=>0,u6e=e=>e===void 0,c6e=e=>typeof e!="object",yz={boolean:0,number:1,string:2};function d6e(e,t){const n=typeof e,r=typeof t;return n===r?vm(e,t):yz[n]-yz[r]}function f6e(e,t){const n=e.length;if(n===0)return t;const r=t.length;if(r===0)return e;if(r>n){const s=e;e=t,t=s}const i=new Set(e),o=t.length;for(let s=0;s<o;s++){const a=t[s];i.has(a)||e.push(a)}return e}function N3(e,t,n=QQ){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function cm(e){return N3(u6e,e)}function cd(e,t){return N3(n=>n===void 0||e(n),t)}function Q4(e,t){return N3(Array.isArray,e,t)}const wi=cm(vm),Z4=cd(e=>e===0,(e,t)=>e-t);function h6e({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){const n=gz(t,b=>Object.keys(b).sort());function r(b){return(v,S)=>{const C=n(v),w=n(S),A=Math.min(C.length,w.length);for(let E=0;E<A;E++){const _=vm(C[E],w[E]);if(_!==0)return _}if(C.length!==w.length)return C.length-w.length;for(let E=0;E<A;E++){const _=C[E],D=b(v[_],S[_]);if(D!==0)return D}return 0}}function i(b){const v=J4(b),S=gz(e,JQ(b,{threshold:0}));return(C,w)=>v(S(C),S(w))}const o=i(vm);function s(b,v){if(Vw(b)){if(Vw(v)){const S=Object.keys(b),C=Object.keys(v),w=f6e(S,C),A=w.length;for(let E=0;E<A;E++){const _=w[E];if(b[_]===v[_])continue;const T=(y[_]??a)(b[_],v[_]);if(T!==0)return T}return 0}return v===!0&&Uy(b)?0:1}return Vw(v)?b===!0&&Uy(v)?0:-1:vm(b,v)}const a=cm(u),l=N3(c6e,Q4(r(a),J4(u)),d6e);function u(b,v){return b===null?-1:v===null?1:l(b,v)}const c=cm(s),f=cd(Uy,r(c)),h=cm(i(s)),g=cd(Tl,s),y={$id:wi,$comment:wi,$defs:f,$ref:wi,$schema:wi,const:a,contains:c,contentEncoding:wi,contentMediaType:wi,default:a,definitions:f,description:wi,else:c,examples:a,exclusiveMaximum:wi,exclusiveMinimum:wi,format:wi,if:c,maximum:wi,maxItems:wi,maxLength:wi,maxProperties:wi,minimum:wi,multipleOf:wi,not:c,pattern:wi,propertyNames:c,readOnly:wi,then:c,title:wi,writeOnly:wi,uniqueItems:cd(b=>b===!1,QQ),minLength:Z4,minItems:Z4,minProperties:Z4,required:cd(mz,o),enum:cd(mz,i(u)),type:cm((b,v)=>{const S=Array.isArray(b),C=Array.isArray(v);return!S&&!C?vm(b,v):o(S?b:[b],C?v:[v])}),items:cd(b=>!Array.isArray(b)&&Tl(b),Q4(s,J4(s))),anyOf:h,allOf:h,oneOf:h,properties:f,patternProperties:f,additionalProperties:g,additionalItems:g,dependencies:cd(Uy,r(cm(Q4(s,o))))};return{compareSchemaValues:u,compareSchemaDefinitions:s}}function bz(e){return e}const ZQ=(e,t)=>e?ZQ(t%e,e):t,p6e=(e,t)=>Math.abs(e*t)/ZQ(e,t);function m6e(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function*eD(e,t,n){const r=e.length,i=t.length;if(r>0&&i>0)for(let o=0;o<r;o++){const s=e[o];for(let a=0;a<i;a++)yield n(s,t[a])}}function tD(e,t){return e||t}function vz(e){return(t,n)=>{const r={...t},i=Object.keys(n),o=i.length;for(let s=0;s<o;s++){const a=i[s];r[a]=t[a]===void 0?n[a]:e(t[a],n[a])}return r}}function g6e(e){const t=new Map;for(const n of e)for(const r of n[0])t.set(r,n[1]);return t}function Hf(e,t,n){n===void 0||Tl(n)?delete e[t]:e[t]=n}const y6e=["properties","patternProperties","additionalProperties"];function xz(e){const t=Object.keys(e),n=t.length,r=[];for(let i=0;i<n;i++){const o=t[i];r.push({regExp:new RegExp(o),schema:e[o]})}return[r,t]}const Sz=[[],[]];function wz(e,t,n){const r=n.length;for(let i=0;i<r;i++){const o=n[i];if(!o.regExp.test(t))continue;const s=o.schema;if(s===!1)return!0;e.push(s)}return!1}const b6e=["items","additionalItems"],v6e=["if","then","else"];function Cz(e,t){return t.if!==void 0&&(e.if=t.if),t.then!==void 0&&(e.then=t.then),t.else!==void 0&&(e.else=t.else),e}function nD(e,t){if(e===t)return e;switch(e){case"number":if(t==="integer")return"integer";case"integer":if(t==="number")return"integer";default:return}}function Vf(e,t,n){return[e,t,n]}function x6e(e){const t=new Map;for(const[n,r,i]of e){const o=s=>{if(!i(s))throw new Error(`Schema keys '${n}' and '${r}' are conflicting (${n}: ${JSON.stringify(s[n])}, ${r}: ${JSON.stringify(s[r])})`)};for(const s of[[n,r],[r,n]]){let a=t.get(s[0]);a===void 0&&(a=[],t.set(s[0],a)),a.push({oppositeKey:s[1],check:o})}}return t}const S6e=[Vf("minimum","maximum",e=>e.maximum>=e.minimum),Vf("exclusiveMinimum","maximum",e=>e.maximum>e.exclusiveMinimum),Vf("minimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.minimum),Vf("exclusiveMinimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.exclusiveMinimum),Vf("minLength","maxLength",e=>e.maxLength>=e.minLength),Vf("minItems","maxItems",e=>e.maxItems>=e.minItems),Vf("minProperties","maxProperties",e=>e.maxProperties>=e.minProperties)];function w6e({mergePatterns:e=m6e,isSubRegExp:t=Object.is,intersectJson:n=s6e,deduplicateJsonSchemaDef:r=bz,defaultMerger:i=bz,assigners:o=[],checks:s=S6e,mergers:a}={}){function l(A){const E=A.length;let _=A[0];for(let D=1;D<E;D++){const T=S(_,A[D]);if(T===!1)return!1;Tl(T)||(_=T)}return _}function u(A,E,_,D,T,M,L){if(A.length=0,_===!1)return!1;if(A.push(_),T!==void 0){if(T===!1)return!1;A.push(T)}if(wz(A,E,M))return!1;const I=A.length<2;if(L===!1){if(I)return;if(wz(A,E,D))return!1}else I&&L!==void 0&&A.push(L);return A.length===1?A[0]:l(A)}function c(A,E,_,D,T,M){const L=_.length;if(L>0&&T!==!1)if(M)Object.assign(A,E);else for(let j=0;j<L;j++){const I=_[j];D.has(I)||(A[I]=S(E[I],T))}return A}const f=(A,{properties:E={},patternProperties:_,additionalProperties:D=!0},{properties:T={},patternProperties:M,additionalProperties:L=!0})=>{const j=Tl(D),I=Tl(L);if(j&&I)return Hf(A,"properties",C(E,T)),Hf(A,"patternProperties",_&&M?C(_,M):_??M),delete A.additionalProperties,A;const N=S(D,L);Hf(A,"additionalProperties",N);const $={},z=Object.keys(E),F=z.length,[G,V]=_?xz(_):Sz,[H,X]=M?xz(M):Sz,B=[],W=new Set,Y=I?void 0:L;for(let ie=0;ie<F;ie++){const ue=z[ie];W.add(ue);const te=u(B,ue,E[ue],G,T[ue],H,Y);te!==void 0&&($[ue]=te)}const U=Object.keys(T),K=U.length,Z=j?void 0:D;for(let ie=0;ie<K;ie++){const ue=U[ie];if(W.has(ue))continue;const te=u(B,ue,T[ue],H,void 0,G,Z);te!==void 0&&($[ue]=te)}Hf(A,"properties",$);let J={};const Q=new Set;if(V.length>0&&X.length>0){const ie=eD(V,X,(ue,te)=>{t(ue,te)&&Q.add(ue),t(te,ue)&&Q.add(te),J[e(ue,te)]=S(_[ue],M[te])});for(;!ie.next().done;);}return J=c(J,_,V,Q,L,I),J=c(J,M,X,Q,D,j),Hf(A,"patternProperties",J),A},h=(A,{items:E=[],additionalItems:_},{items:D=[],additionalItems:T})=>{const M=Array.isArray(E),L=Array.isArray(D),j=[];if(A.items=j,M&&L){const[I,N,$]=E.length<D.length?[E.length,_,D]:[D.length,T,E];let z=0;for(;z<I;z++)j.push(S(E[z],D[z]));if(N===!1)A.additionalItems=!1;else{const F=N===void 0||Tl(N);for(;z<$.length;z++)j.push(F?$[z]:S($[z],N));Hf(A,"additionalItems",_!==void 0&&T!==void 0?S(_,T):_??T)}}else if(M||L){const[I,N,$]=M?[E,D,_]:[D,E,T];Hf(A,"additionalItems",$&&S($,N));for(let z=0;z<I.length;z++)j.push(S(I[z],N))}else delete A.additionalItems,A.items=S(E,D);return A},g=(A,E,_)=>{Cz(A,E);const D=Cz({},_);return A.allOf===void 0?A.allOf=[D]:A.allOf=A.allOf.concat(D),A};function y(A,E){return r(Array.from(eD(A,E,S)))}const b=g6e([[y6e,f],[b6e,h],[v6e,g],...o]),v=x6e(s);function S(A,E){if(A===!1||E===!1)return!1;if(Tl(A))return Tl(E)?!0:E;if(Tl(E))return A;let _={...A};const D=new Set,T=new Set,M=Object.keys(E),L=M.length;for(let j=0;j<L;j++){const I=M[j],N=E[I];if(N===void 0)continue;const $=v.get(I);if($!==void 0){const V=$.length;for(let H=0;H<V;H++){const X=$[H];A[X.oppositeKey]!==void 0&&T.add(X.check)}}const z=A[I];if(z===void 0){_[I]=N;continue}const F=b.get(I);if(F){D.add(F);continue}const G=w[I]??i;_[I]=G(z,N)}for(const j of D)_=j(_,A,E);for(const j of T)j(_);return _}const C=vz(S),w={$id:i,$ref:i,$schema:i,$comment:i,$defs:C,definitions:C,type:(A,E)=>{if(A===E)return A;const _=Array.isArray(A),D=Array.isArray(E);if(!_&&!D){const T=nD(A,E);if(T!==void 0)return T}else if(_||D){const T=new Set;if(_&&D)for(const L of eD(A,E,nD))L!==void 0&&T.add(L);else{const L=_?A:E,j=_?E:A,I=L.length;for(let N=0;N<I;N++){const $=nD(j,L[N]);$!==void 0&&T.add($)}}const M=T.size;if(M===1)return T.values().next().value;if(M>1)return Array.from(T)}throw new Error(`It is not possible to create an intersection of the following incompatible types: ${A.toString()}, ${E.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(A,E)=>{const _=r([A,E]);return _.length===1?_[0]:{anyOf:_}},pattern:e,readOnly:tD,writeOnly:tD,enum:(A,E)=>{const _=n(A,E);if(_.length===0)throw new Error(`Intersection of the following enums is empty: "${JSON.stringify(A)}", "${JSON.stringify(E)}"`);return _},anyOf:y,oneOf:y,allOf:(A,E)=>r(A.concat(E)),propertyNames:S,contains:S,dependencies:vz((A,E)=>Array.isArray(A)?Array.isArray(E)?X4(A,E):S(E,{required:A}):Array.isArray(E)?S(A,{required:E}):S(A,E)),examples:(A,E)=>{if(!Array.isArray(A)||!Array.isArray(E))throw new Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(A)}" and "${JSON.stringify(E)}"`);return X4(A,E)},multipleOf:(A,E)=>{let _=1;for(;!Number.isInteger(A)||!Number.isInteger(E);)_*=10,A*=10,E*=10;return p6e(A,E)/_},exclusiveMaximum:Math.min,maximum:Math.min,maxItems:Math.min,maxLength:Math.min,maxProperties:Math.min,exclusiveMinimum:Math.max,minimum:Math.max,minItems:Math.max,minLength:Math.max,minProperties:Math.max,uniqueItems:tD,required:X4,...a};return{mergeSchemaDefinitions:S,mergeArrayOfSchemaDefinitions:l}}function C6e(e){const t=[],n=[e];for(;n.length>0;){const r=n.pop();if(typeof r=="boolean"||r.allOf===void 0){t.push(r);continue}const{allOf:i,...o}=r;t.push(o);for(let s=i.length-1;s>=0;s--)n.push(i[s])}return t}function E6e(e){return t=>e(C6e(t))}var gy={},Ez;function A6e(){if(Ez)return gy;Ez=1;var e=/~/,t=/~[01]/g;function n(u){switch(u){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+u)}function r(u){return e.test(u)?u.replace(t,n):u}function i(u,c,f){for(var h,g,y=1,b=c.length;y<b;){if(c[y]==="constructor"||c[y]==="prototype"||c[y]==="__proto__")return u;if(h=r(c[y++]),g=b>y,typeof u[h]>"u"&&(Array.isArray(u)&&h==="-"&&(h=u.length),g&&(c[y]!==""&&c[y]<1/0||c[y]==="-"?u[h]=[]:u[h]={})),!g)break;u=u[h]}var v=u[h];return f===void 0?delete u[h]:u[h]=f,v}function o(u){if(typeof u=="string"){if(u=u.split("/"),u[0]==="")return u;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(u)){for(const c of u)if(typeof c!="string"&&typeof c!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return u}throw new Error("Invalid JSON pointer.")}function s(u,c){if(typeof u!="object")throw new Error("Invalid input object.");c=o(c);var f=c.length;if(f===1)return u;for(var h=1;h<f;){if(u=u[r(c[h++])],f===h)return u;if(typeof u!="object"||u===null)return}}function a(u,c,f){if(typeof u!="object")throw new Error("Invalid input object.");if(c=o(c),c.length===0)throw new Error("Invalid JSON pointer for set.");return i(u,c,f)}function l(u){var c=o(u);return{get:function(f){return s(f,c)},set:function(f,h){return a(f,c,h)}}}return gy.get=s,gy.set=a,gy.compile=l,gy}var k6e=A6e();const rD=cs(k6e);function _6e(e,t){return e&&Gg(t,Fa(t),e)}function D6e(e,t){return e&&Gg(t,Ev(t),e)}function O6e(e,t){return Gg(e,MM(e),t)}var T6e=Object.getOwnPropertySymbols,eZ=T6e?function(e){for(var t=[];e;)IM(t,MM(e)),e=O3(e);return t}:wQ;function R6e(e,t){return Gg(e,eZ(e),t)}function GM(e){return SQ(e,Ev,eZ)}var I6e=Object.prototype,M6e=I6e.hasOwnProperty;function P6e(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&M6e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function j6e(e,t){var n=t?VM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var $6e=/\w*$/;function N6e(e){var t=new e.constructor(e.source,$6e.exec(e));return t.lastIndex=e.lastIndex,t}var Az=va?va.prototype:void 0,kz=Az?Az.valueOf:void 0;function L6e(e){return kz?Object(kz.call(e)):{}}var F6e="[object Boolean]",B6e="[object Date]",z6e="[object Map]",U6e="[object Number]",H6e="[object RegExp]",V6e="[object Set]",W6e="[object String]",q6e="[object Symbol]",G6e="[object ArrayBuffer]",K6e="[object DataView]",Y6e="[object Float32Array]",X6e="[object Float64Array]",J6e="[object Int8Array]",Q6e="[object Int16Array]",Z6e="[object Int32Array]",eTe="[object Uint8Array]",tTe="[object Uint8ClampedArray]",nTe="[object Uint16Array]",rTe="[object Uint32Array]";function iTe(e,t,n){var r=e.constructor;switch(t){case G6e:return VM(e);case F6e:case B6e:return new r(+e);case K6e:return j6e(e,n);case Y6e:case X6e:case J6e:case Q6e:case Z6e:case eTe:case tTe:case nTe:case rTe:return HQ(e,n);case z6e:return new r;case U6e:case W6e:return new r(e);case H6e:return N6e(e);case V6e:return new r;case q6e:return L6e(e)}}var oTe="[object Map]";function sTe(e){return xa(e)&&ra(e)==oTe}var _z=fg&&fg.isMap,aTe=_z?jM(_z):sTe,lTe="[object Set]";function uTe(e){return xa(e)&&ra(e)==lTe}var Dz=fg&&fg.isSet,cTe=Dz?jM(Dz):uTe,dTe=1,fTe=2,hTe=4,tZ="[object Arguments]",pTe="[object Array]",mTe="[object Boolean]",gTe="[object Date]",yTe="[object Error]",nZ="[object Function]",bTe="[object GeneratorFunction]",vTe="[object Map]",xTe="[object Number]",rZ="[object Object]",STe="[object RegExp]",wTe="[object Set]",CTe="[object String]",ETe="[object Symbol]",ATe="[object WeakMap]",kTe="[object ArrayBuffer]",_Te="[object DataView]",DTe="[object Float32Array]",OTe="[object Float64Array]",TTe="[object Int8Array]",RTe="[object Int16Array]",ITe="[object Int32Array]",MTe="[object Uint8Array]",PTe="[object Uint8ClampedArray]",jTe="[object Uint16Array]",$Te="[object Uint32Array]",Er={};Er[tZ]=Er[pTe]=Er[kTe]=Er[_Te]=Er[mTe]=Er[gTe]=Er[DTe]=Er[OTe]=Er[TTe]=Er[RTe]=Er[ITe]=Er[vTe]=Er[xTe]=Er[rZ]=Er[STe]=Er[wTe]=Er[CTe]=Er[ETe]=Er[MTe]=Er[PTe]=Er[jTe]=Er[$Te]=!0;Er[yTe]=Er[nZ]=Er[ATe]=!1;function f1(e,t,n,r,i,o){var s,a=t&dTe,l=t&fTe,u=t&hTe;if(n&&(s=i?n(e,r,i,o):n(e)),s!==void 0)return s;if(!Bn(e))return e;var c=Fi(e);if(c){if(s=P6e(e),!a)return WM(e,s)}else{var f=ra(e),h=f==nZ||f==bTe;if($h(e))return UQ(e,a);if(f==rZ||f==tZ||h&&!i){if(s=l||h?{}:VQ(e),!a)return l?R6e(e,D6e(s,e)):O6e(e,_6e(s,e))}else{if(!Er[f])return i?e:{};s=iTe(e,f,a)}}o||(o=new Qa);var g=o.get(e);if(g)return g;o.set(e,s),cTe(e)?e.forEach(function(v){s.add(f1(v,t,n,v,e,o))}):aTe(e)&&e.forEach(function(v,S){s.set(S,f1(v,t,n,S,e,o))});var y=u?l?GM:Z6:l?Ev:Fa,b=c?void 0:y(e);return UM(b||e,function(v,S){b&&(S=v,v=e[S]),BM(s,S,f1(v,t,n,S,e,o))}),s}function iZ(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function NTe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function LTe(e,t){return t.length<2?e:P3(e,NTe(t,0,-1))}var FTe=Object.prototype,BTe=FTe.hasOwnProperty;function oZ(e,t){t=qg(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!="object"&&typeof e!="function";++n<r;){var o=t[n];if(typeof o=="string"){if(o==="__proto__"&&!BTe.call(e,"__proto__"))return!1;if(o==="constructor"&&n+1<r&&typeof t[n+1]=="string"&&t[n+1]==="prototype"){if(i&&n===0)continue;return!1}}}var s=LTe(e,t);return s==null||delete s[tp(iZ(t))]}function zTe(e){return Xd(e)?void 0:e}function oT(e){var t=e==null?0:e.length;return t?Av(e,1):[]}function sZ(e){return GQ(qQ(e,void 0,oT),e+"")}var UTe=1,HTe=2,VTe=4,sb=sZ(function(e,t){var n={};if(e==null)return n;var r=!1;t=Wg(t,function(o){return o=qg(o,e),r||(r=o.length>1),o}),Gg(e,GM(e),n),r&&(n=f1(n,UTe|HTe|VTe,zTe));for(var i=t.length;i--;)oZ(n,t[i]);return n}),yy={exports:{}},iD,Oz;function aZ(){if(Oz)return iD;Oz=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(h){let g="",y=0,b=0;for(b=0;b<h.length;b++)if(y=h[b].charCodeAt(0),y!==48){if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b];break}for(b+=1;b<h.length;b++){if(y=h[b].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b]}return g}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function o(h,g,y){if(h.length){const b=n(h);if(b!=="")g.push(b);else return y.error=!0,!1;h.length=0}return!0}function s(h){let g=0;const y={error:!1,address:"",zone:""},b=[],v=[];let S=!1,C=!1,w=o;for(let A=0;A<h.length;A++){const E=h[A];if(!(E==="["||E==="]"))if(E===":"){if(S===!0&&(C=!0),!w(v,b,y))break;if(++g>7){y.error=!0;break}A>0&&h[A-1]===":"&&(S=!0),b.push(":");continue}else if(E==="%"){if(!w(v,b,y))break;w=i}else{v.push(E);continue}}return v.length&&(w===i?y.zone=v.join(""):C?b.push(v.join("")):b.push(n(v))),y.address=b.join(""),y}function a(h){if(l(h,":")<2)return{host:h,isIPV6:!1};const g=s(h);if(g.error)return{host:h,isIPV6:!1};{let y=g.address,b=g.address;return g.zone&&(y+="%"+g.zone,b+="%25"+g.zone),{host:y,isIPV6:!0,escapedHost:b}}}function l(h,g){let y=0;for(let b=0;b<h.length;b++)h[b]===g&&y++;return y}function u(h){let g=h;const y=[];let b=-1,v=0;for(;v=g.length;){if(v===1){if(g===".")break;if(g==="/"){y.push("/");break}else{y.push(g);break}}else if(v===2){if(g[0]==="."){if(g[1]===".")break;if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&(g[1]==="."||g[1]==="/")){y.push("/");break}}else if(v===3&&g==="/.."){y.length!==0&&y.pop(),y.push("/");break}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."&&g[3]==="/"){g=g.slice(3),y.length!==0&&y.pop();continue}}if((b=g.indexOf("/",1))===-1){y.push(g);break}else y.push(g.slice(0,b)),g=g.slice(b)}return y.join("")}function c(h,g){const y=g!==!0?escape:unescape;return h.scheme!==void 0&&(h.scheme=y(h.scheme)),h.userinfo!==void 0&&(h.userinfo=y(h.userinfo)),h.host!==void 0&&(h.host=y(h.host)),h.path!==void 0&&(h.path=y(h.path)),h.query!==void 0&&(h.query=y(h.query)),h.fragment!==void 0&&(h.fragment=y(h.fragment)),h}function f(h){const g=[];if(h.userinfo!==void 0&&(g.push(h.userinfo),g.push("@")),h.host!==void 0){let y=unescape(h.host);if(!t(y)){const b=a(y);b.isIPV6===!0?y=`[${b.escapedHost}]`:y=h.host}g.push(y)}return(typeof h.port=="number"||typeof h.port=="string")&&(g.push(":"),g.push(String(h.port))),g.length?g.join(""):void 0}return iD={nonSimpleDomain:r,recomposeAuthority:f,normalizeComponentEncoding:c,removeDotSegments:u,isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:n},iD}var oD,Tz;function WTe(){if(Tz)return oD;Tz=1;const{isUUID:e}=aZ(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(E){return n.indexOf(E)!==-1}function i(E){return E.secure===!0?!0:E.secure===!1?!1:E.scheme?E.scheme.length===3&&(E.scheme[0]==="w"||E.scheme[0]==="W")&&(E.scheme[1]==="s"||E.scheme[1]==="S")&&(E.scheme[2]==="s"||E.scheme[2]==="S"):!1}function o(E){return E.host||(E.error=E.error||"HTTP URIs must have a host."),E}function s(E){const _=String(E.scheme).toLowerCase()==="https";return(E.port===(_?443:80)||E.port==="")&&(E.port=void 0),E.path||(E.path="/"),E}function a(E){return E.secure=i(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E}function l(E){if((E.port===(i(E)?443:80)||E.port==="")&&(E.port=void 0),typeof E.secure=="boolean"&&(E.scheme=E.secure?"wss":"ws",E.secure=void 0),E.resourceName){const[_,D]=E.resourceName.split("?");E.path=_&&_!=="/"?_:void 0,E.query=D,E.resourceName=void 0}return E.fragment=void 0,E}function u(E,_){if(!E.path)return E.error="URN can not be parsed",E;const D=E.path.match(t);if(D){const T=_.scheme||E.scheme||"urn";E.nid=D[1].toLowerCase(),E.nss=D[2];const M=`${T}:${_.nid||E.nid}`,L=A(M);E.path=void 0,L&&(E=L.parse(E,_))}else E.error=E.error||"URN can not be parsed.";return E}function c(E,_){if(E.nid===void 0)throw new Error("URN without nid cannot be serialized");const D=_.scheme||E.scheme||"urn",T=E.nid.toLowerCase(),M=`${D}:${_.nid||T}`,L=A(M);L&&(E=L.serialize(E,_));const j=E,I=E.nss;return j.path=`${T||_.nid}:${I}`,_.skipEscape=!0,j}function f(E,_){const D=E;return D.uuid=D.nss,D.nss=void 0,!_.tolerant&&(!D.uuid||!e(D.uuid))&&(D.error=D.error||"UUID is not valid."),D}function h(E){const _=E;return _.nss=(E.uuid||"").toLowerCase(),_}const g={scheme:"http",domainHost:!0,parse:o,serialize:s},y={scheme:"https",domainHost:g.domainHost,parse:o,serialize:s},b={scheme:"ws",domainHost:!0,parse:a,serialize:l},v={scheme:"wss",domainHost:b.domainHost,parse:b.parse,serialize:b.serialize},w={http:g,https:y,ws:b,wss:v,urn:{scheme:"urn",parse:u,serialize:c,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:f,serialize:h,skipNormalize:!0}};Object.setPrototypeOf(w,null);function A(E){return E&&(w[E]||w[E.toLowerCase()])||void 0}return oD={wsIsSecure:i,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:A},oD}var Rz;function lZ(){if(Rz)return yy.exports;Rz=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:i,nonSimpleDomain:o}=aZ(),{SCHEMES:s,getSchemeHandler:a}=WTe();function l(v,S){return typeof v=="string"?v=h(y(v,S),S):typeof v=="object"&&(v=y(h(v,S),S)),v}function u(v,S,C){const w=C?Object.assign({scheme:"null"},C):{scheme:"null"},A=c(y(v,w),y(S,w),w,!0);return w.skipEscape=!0,h(A,w)}function c(v,S,C,w){const A={};return w||(v=y(h(v,C),C),S=y(h(S,C),C)),C=C||{},!C.tolerant&&S.scheme?(A.scheme=S.scheme,A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.path?(S.path[0]==="/"?A.path=t(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?A.path="/"+S.path:v.path?A.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:A.path=S.path,A.path=t(A.path)),A.query=S.query):(A.path=v.path,S.query!==void 0?A.query=S.query:A.query=v.query),A.userinfo=v.userinfo,A.host=v.host,A.port=v.port),A.scheme=v.scheme),A.fragment=S.fragment,A}function f(v,S,C){return typeof v=="string"?(v=unescape(v),v=h(r(y(v,C),!0),{...C,skipEscape:!0})):typeof v=="object"&&(v=h(r(v,!0),{...C,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=h(r(y(S,C),!0),{...C,skipEscape:!0})):typeof S=="object"&&(S=h(r(S,!0),{...C,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function h(v,S){const C={host:v.host,scheme:v.scheme,userinfo:v.userinfo,port:v.port,path:v.path,query:v.query,nid:v.nid,nss:v.nss,uuid:v.uuid,fragment:v.fragment,reference:v.reference,resourceName:v.resourceName,secure:v.secure,error:""},w=Object.assign({},S),A=[],E=a(w.scheme||C.scheme);E&&E.serialize&&E.serialize(C,w),C.path!==void 0&&(w.skipEscape?C.path=unescape(C.path):(C.path=escape(C.path),C.scheme!==void 0&&(C.path=C.path.split("%3A").join(":")))),w.reference!=="suffix"&&C.scheme&&A.push(C.scheme,":");const _=n(C);if(_!==void 0&&(w.reference!=="suffix"&&A.push("//"),A.push(_),C.path&&C.path[0]!=="/"&&A.push("/")),C.path!==void 0){let D=C.path;!w.absolutePath&&(!E||!E.absolutePath)&&(D=t(D)),_===void 0&&D[0]==="/"&&D[1]==="/"&&(D="/%2F"+D.slice(2)),A.push(D)}return C.query!==void 0&&A.push("?",C.query),C.fragment!==void 0&&A.push("#",C.fragment),A.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(v,S){const C=Object.assign({},S),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let A=!1;C.reference==="suffix"&&(C.scheme?v=C.scheme+":"+v:v="//"+v);const E=v.match(g);if(E){if(w.scheme=E[1],w.userinfo=E[3],w.host=E[4],w.port=parseInt(E[5],10),w.path=E[6]||"",w.query=E[7],w.fragment=E[8],isNaN(w.port)&&(w.port=E[5]),w.host)if(i(w.host)===!1){const T=e(w.host);w.host=T.host.toLowerCase(),A=T.isIPV6}else A=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",C.reference&&C.reference!=="suffix"&&C.reference!==w.reference&&(w.error=w.error||"URI is not a "+C.reference+" reference.");const _=a(C.scheme||w.scheme);if(!C.unicodeSupport&&(!_||!_.unicodeSupport)&&w.host&&(C.domainHost||_&&_.domainHost)&&A===!1&&o(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(D){w.error=w.error||"Host's domain name can not be converted to ASCII: "+D}(!_||_&&!_.skipNormalize)&&(v.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),_&&_.parse&&_.parse(w,C)}else w.error=w.error||"URI can not be parsed.";return w}const b={SCHEMES:s,normalize:l,resolve:u,resolveComponent:c,equal:f,serialize:h,parse:y};return yy.exports=b,yy.exports.default=b,yy.exports.fastUri=b,yy.exports}var qTe=lZ();const KM=cs(qTe);function oE(e,t){if(pr in e&&KM.equal(e[pr],t))return e;for(const n of Object.values(e))if(Array.isArray(n)){for(const r of n)if(Bn(r)){const i=oE(r,t);if(i!==void 0)return i}}else if(Bn(n)){const r=oE(n,t);if(r!==void 0)return r}}function sT(e,t){const n=Ve(e,pr,t);mr in e&&(e={...e,[mr]:KM.resolve(n,e[mr])});for(const[r,i]of Object.entries(e))Array.isArray(i)?e={...e,[r]:i.map(o=>Bn(o)?sT(o,n):o)}:Bn(i)&&(e={...e,[r]:sT(i,n)});return e}function YM(e,t){const n=t[e];return[sb(t,[e]),n]}function uZ(e,t={},n=[],r=Ve(t,[pr])){const i=e||"";let o;if(i.startsWith("#")){const a=decodeURIComponent(i.substring(1));r===void 0||pr in t&&t[pr]===r?o=rD.get(t,a):t[zy]===Uw&&(o=oE(t,r.replace(/\/$/,"")),o!==void 0&&(o=rD.get(o,a)))}else if(t[zy]===Uw){const a=r?KM.resolve(r,i):i,[l,...u]=a.replace(/#\/?$/,"").split("#");o=oE(t,l.replace(/\/$/,"")),o!==void 0&&(r=o[pr],gi(u)||(o=rD.get(o,decodeURIComponent(u.join("#")))))}if(o===void 0)throw new Error(`Could not find a definition for ${e}.`);const s=o[mr];if(s){if(n.includes(s)){if(n.length===1)throw new Error(`Definition for ${e} is a circular reference`);const[c,...f]=n,h=[...f,i,c].join(" -> ");throw new Error(`Definition for ${c} contains a circular reference through ${h}`)}const[a,l]=YM(mr,o),u=uZ(l,t,[...n,i],r);return Object.keys(a).length>0?t[zy]===a5e||t[zy]===Uw?{[wc]:[a,u]}:{...a,...u}:u}return o}function XM(e,t={},n=Ve(t,[pr])){return uZ(e,t,[],n)}var GTe="[object String]";function Jd(e){return typeof e=="string"||!Fi(e)&&xa(e)&&Ic(e)==GTe}function hu(e){let t;const n=Ve(e,r5e);return Jd(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function ab(e){return Array.isArray(e)?"array":typeof e=="string"?"string":e==null?"null":typeof e=="boolean"?"boolean":isNaN(e)?typeof e=="object"?"object":"string":"number"}var KTe=$3(function(e){return YQ(Av(e,1,ob,!0))});function il(e){let{type:t}=e;return!t&&e.const?ab(e.const):!t&&e.enum?"string":!t&&(e.properties||e.additionalProperties||e.patternProperties)?"object":(Array.isArray(t)&&(t.length===2&&t.includes("null")?t=t.find(n=>n!=="null"):t=t[0]),t)}function Cc(e,t){const n=Object.assign({},e);return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];return e&&i in e&&fn(s)?r[i]=Cc(o,s):e&&t&&(il(e)==="object"||il(t)==="object")&&i===dQ&&Array.isArray(o)&&Array.isArray(s)?r[i]=KTe(o,s):r[i]=s,r},n)}var YTe="[object Number]";function cZ(e){return typeof e=="number"||xa(e)&&Ic(e)==YTe}function dZ(e,t,n){var r;if(e&&n){const i=Ve(e,n);if(i===void 0)return;for(let o=0;o<t.length;o++){const s=t[o],a=Ve(s,[Hn,n],{});if(!(a.type==="object"||a.type==="array")&&(a.const===i||!((r=a.enum)===null||r===void 0)&&r.includes(i)))return o}}}function JM(e,t,n,r,i){if(t===void 0)return 0;const o=dZ(t,n,i);if(cZ(o))return o;for(let s=0;s<n.length;s++){const a=n[s];if(i&&In(a,[Hn,i])){const l=Ve(t,i),u=Ve(a,[Hn,i],{});if(e.isValid(u,l,r))return s}else if(a[Hn]){const l={anyOf:Object.keys(a[Hn]).map(c=>({required:[c]}))};let u;if(a.anyOf){const{...c}=a;c.allOf?c.allOf=c.allOf.slice():c.allOf=[],c.allOf.push(l),u=c}else u=Object.assign({},a,l);if(delete u.required,e.isValid(u,t,r))return s}else if(e.isValid(a,t,r))return s}return 0}function yo(e,t,n={},r,i,o=!1){return ql(e,t,n,r,void 0,void 0,i,o)[0]}function XTe(e,t,n,r,i,o,s){const{if:a,then:l,else:u,...c}=t,f=e.isValid(a,o||{},n);let h=[c],g=[];if(r)l&&typeof l!="boolean"&&(g=g.concat(ql(e,l,n,o,r,i,s))),u&&typeof u!="boolean"&&(g=g.concat(ql(e,u,n,o,r,i,s)));else{const y=f?l:u;y&&typeof y!="boolean"&&(g=g.concat(ql(e,y,n,o,r,i,s)))}return g.length&&(h=g.map(y=>Cc(c,y))),h.flatMap(y=>ql(e,y,n,o,r,i,s))}function fZ(e){return e.reduce((n,r)=>r.length>1?r.flatMap(i=>PQ(n.length,o=>[...n[o]].concat(i))):(n.forEach(i=>i.push(r[0])),n),[[]])}function hZ(e,t){return Object.keys(e.patternProperties).filter(n=>RegExp(n).test(t)).reduce((n,r)=>(ur(n,[r],e.patternProperties[r]),n),{})}function JTe(e,t,n,r,i,o,s,a){const l=pZ(e,t,n,r,i,o,s,a);if(l.length>1||l[0]!==t)return l;if(_M in t)return mZ(e,t,n,r,i,o,s).flatMap(c=>ql(e,c,n,o,r,i,s));if(wc in t&&Array.isArray(t[wc])){const u=t.allOf.map(f=>ql(e,f,n,o,r,i,s));return fZ(u).map(f=>({...t,allOf:f}))}return[t]}function pZ(e,t,n,r,i,o,s,a){const l=$m(t,n,i,void 0,a);return l!==t?ql(e,l,n,o,r,i,s,a):[t]}function $m(e,t,n,r,i){if(!fn(e))return e;let o=e;if(mr in o){const{$ref:s,...a}=o;if(n.includes(s))return o;n.push(s),o={...XM(s,t,r),...a},pr in o&&(r=o[pr])}if(Hn in o){const s=[],a=EOe(o[Hn],(l,u,c)=>{const f=[...n];l[c]=$m(u,t,f,r,i),s.push(f)},{});zOe(n,XQ(VOe(s))),o={...o,[Hn]:a}}if(Mh in o&&!Array.isArray(o.items)&&typeof o.items!="boolean"&&(o={...o,items:$m(o.items,t,n,r,i)}),i){let s,a;Mn in e&&Array.isArray(e[Mn])?(s=Mn,a=o[Mn]):nn in e&&Array.isArray(e[nn])&&(s=nn,a=o[nn]),s&&a&&(o={...o,[s]:a.map(l=>$m(l,t,n,r,i))})}return _r(e,o)?e:o}function QTe(e,t,n,r,i){const o={...t,properties:{...t.properties}},s=r&&fn(r)?r:{};return Object.keys(s).forEach(a=>{if(!(a in o.properties)){if(X6 in o){const l=hZ(o,a);if(!gi(l)){o.properties[a]=yo(e,{[wc]:Object.values(l)},n,Ve(s,[a]),i),ur(o.properties,[a,fc],!0);return}}if(eb in o&&o.additionalProperties!==!1){let l;typeof o.additionalProperties!="boolean"?mr in o.additionalProperties?l=yo(e,{[mr]:Ve(o.additionalProperties,[mr])},n,s,i):"type"in o.additionalProperties?l={...o.additionalProperties}:Mn in o.additionalProperties||nn in o.additionalProperties?l={type:"object",...o.additionalProperties}:l={type:ab(Ve(s,[a]))}:l={type:ab(Ve(s,[a]))},o.properties[a]=l,ur(o.properties,[a,fc],!0)}else o.properties[a]={type:"null"},ur(o.properties,[a,fc],!0)}}),o}const{compareSchemaDefinitions:ZTe,compareSchemaValues:eRe}=h6e(),{mergeArrayOfSchemaDefinitions:tRe}=w6e({intersectJson:a6e(eRe),deduplicateJsonSchemaDef:JQ(ZTe)}),nRe=E6e(tRe);function rRe(e){return nRe(e)}function ql(e,t,n,r,i=!1,o=[],s,a){return fn(t)?JTe(e,t,n,i,o,r,s,a).flatMap(u=>{var c;let f=u;if(DM in f)return XTe(e,f,n,i,o,r,s);if(wc in f){if(i){const{allOf:g,...y}=f;return[...g,y]}try{const g=[],y=[];(c=f.allOf)===null||c===void 0||c.forEach(b=>{typeof b=="object"&&b.contains?g.push(b):y.push(b)}),g.length&&(f={...f,allOf:y}),f=s?s(f):rRe(f),g.length&&(f.allOf=g)}catch(g){console.warn(`could not merge subschemas in allOf:
|
|
207
|
+
`));return this.store.update({itemMetaLookup:dt({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:dt({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=dt({},this.store.state.itemMetaLookup),r=dt({},this.store.state.itemModelLookup);delete n[t.id],delete r[t.id],this.store.update({itemMetaLookup:n,itemModelLookup:r})}};mapLabelFromJSX=(t,n)=>(this.store.keyboardNavigation.updateLabelMap(r=>(r[t]=n,r)),()=>{this.store.keyboardNavigation.updateLabelMap(r=>{const i=dt({},r);return delete i[t],i})});setJSXItemsOrderedChildrenIds=(t,n)=>{const r=t??Ja;this.store.update({itemOrderedChildrenIdsLookup:dt({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:n}),itemChildrenIndexesLookup:dt({},this.store.state.itemChildrenIndexesLookup,{[r]:BJ(n)})})}}const FAe={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class BAe extends MAe{jsxItems=new LAe(this);constructor(t){super(dt({},t,{items:V6}),"SimpleTreeView",FAe)}updateStateFromParameters(t){super.updateStateFromParameters(dt({},t,{items:V6}))}}const zAe=PJ(),UAe=e=>{const{classes:t}=e;return O.useMemo(()=>Ze({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},VEe,t),[t])},HAe=me("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),VAe=O.forwardRef(function(t,n){const r=zAe({props:t,name:"MuiSimpleTreeView"}),{slots:i,slotProps:o,apiRef:s,parameters:a,forwardedProps:l}=YEe(r),u=SAe(BAe,a),c=O.useRef(null),f=KC(n,c),h=gAe(u,l,f),g=UAe(r),y=i?.root??HAe,b=Yr({elementType:y,externalSlotProps:o?.root,className:g.root,getSlotProps:h,ownerState:r});return m.jsx(GEe,{store:u,classes:g,slots:i,slotProps:o,apiRef:s,rootRef:c,children:m.jsx(GJ,{itemId:null,idAttribute:null,children:m.jsx(JC.Provider,{value:0,children:m.jsx(y,dt({},b))})})})}),WAe=De(m.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),qAe=De(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),GAe=De(m.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function KAe(e){return Qe("MuiCheckbox",e)}const F4=tt("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),YAe=e=>{const{classes:t,indeterminate:n,color:r,size:i}=e,o={root:["root",n&&"indeterminate",`color${ye(r)}`,`size${ye(i)}`]},s=Ze(o,KAe,t);return{...t,...s}},XAe=me(aM,{shouldForwardProp:e=>ro(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${ye(n.size)}`],n.color!=="default"&&t[`color${ye(n.color)}`]]}})(qe(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ln()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ln()).map(([t])=>({props:{color:t},style:{[`&.${F4.checked}, &.${F4.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${F4.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),JAe=m.jsx(qAe,{}),QAe=m.jsx(WAe,{}),ZAe=m.jsx(GAe,{}),Wl=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiCheckbox"}),{checkedIcon:i=JAe,color:o="primary",icon:s=QAe,indeterminate:a=!1,indeterminateIcon:l=ZAe,inputProps:u,size:c="medium",disableRipple:f=!1,className:h,slots:g={},slotProps:y={},...b}=r,v=a?l:s,S=a?l:i,C={...r,disableRipple:f,color:o,indeterminate:a,size:c},w=YAe(C),A=y.input??u,[E,_]=ut("root",{ref:n,elementType:XAe,className:Oe(w.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...b},ownerState:C,additionalProps:{type:"checkbox",icon:O.cloneElement(v,{fontSize:v.props.fontSize??c}),checkedIcon:O.cloneElement(S,{fontSize:S.props.fontSize??c}),disableRipple:f,slots:g,slotProps:{input:OI(typeof A=="function"?A(C):A,{"data-indeterminate":a})}}});return m.jsx(E,{..._,classes:w})}),e3e=(e,t,n)=>typeof n=="function"?n(e,t):n,t3e=e=>{const{runItemPlugins:t,publicAPI:n,store:r}=Ug(),i=O.useContext(JC),o=Xr(r,e3e,e.itemId,i),{id:s,itemId:a,label:l,children:u,rootRef:c}=e,{rootRef:f,contentRef:h,propsEnhancers:g}=t(e),{interactions:y,status:b}=jAe({itemId:a,children:u}),v=O.useRef(null),S=O.useRef(null),C=KC(c,f,v),w=KC(h,S),A=O.useRef(null),E=Xr(r,Un.isCheckboxSelectionEnabled),_=Xr(r,bv.treeItemIdAttribute,a,s),D=Xr(r,ih.isItemTheDefaultFocusableItem,a),T={rootRefObject:v,contentRefObject:S,interactions:y},M=J=>Q=>{J.onFocus?.(Q),!Q.defaultMuiPrevented&&!b.focused&&St.canItemBeFocused(r.state,a)&&Q.currentTarget===Q.target&&r.focus.focusItem(Q,a)},L=J=>Q=>{if(J.onBlur?.(Q),Q.defaultMuiPrevented)return;const ie=r.items.getItemDOMElement(a);b.editing||Q.relatedTarget&&q6(Q.relatedTarget,ie)&&(Q.target&&Q.target?.dataset?.element==="labelInput"&&q6(Q.target,ie)||Q.relatedTarget?.dataset?.element==="labelInput")||r.focus.removeFocusedItem()},j=J=>Q=>{J.onKeyDown?.(Q),!(Q.defaultMuiPrevented||Q.target?.dataset?.element==="labelInput")&&r.keyboardNavigation.handleItemKeyDown(Q,a)},I=J=>Q=>{J.onDoubleClick?.(Q),!Q.defaultMuiPrevented&&y.toggleItemEditing()},N=J=>Q=>{J.onClick?.(Q),r.items.handleItemClick(Q,a),!(Q.defaultMuiPrevented||A.current?.contains(Q.target))&&(hi.triggerSlot(r.state)==="content"&&y.handleExpansion(Q),E||y.handleSelection(Q))},$=J=>Q=>{J.onMouseDown?.(Q),!Q.defaultMuiPrevented&&(Q.shiftKey||Q.ctrlKey||Q.metaKey||b.disabled)&&Q.preventDefault()},z=J=>Q=>{J.onClick?.(Q),!Q.defaultMuiPrevented&&hi.triggerSlot(r.state)==="iconContainer"&&y.handleExpansion(Q)};return{getContextProviderProps:()=>({itemId:a,id:s}),getRootProps:(J={})=>{const Q=dt({},Yi(e),Yi(J)),ie=dt({},Q,{ref:C,role:"treeitem",tabIndex:D?0:-1,id:_,"aria-expanded":b.expandable?b.expanded:void 0,"aria-disabled":b.disabled||void 0},J,{style:dt({},J.style??{},{"--TreeView-itemDepth":o}),onFocus:M(Q),onBlur:L(Q),onKeyDown:j(Q)}),ue=g.root?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ie,ue)},getContentProps:(J={})=>{const Q=Yi(J),ie=dt({},Q,J,{ref:w,onClick:N(Q),onMouseDown:$(Q),status:b});["expanded","selected","focused","disabled","editing","editable"].forEach(te=>{b[te]&&(ie[`data-${te}`]="")});const ue=g.content?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ie,ue)},getGroupTransitionProps:(J={})=>{const Q=Yi(J);return dt({},Q,{unmountOnExit:!0,component:"ul",role:"group",in:b.expanded,children:u},J)},getIconContainerProps:(J={})=>{const Q=Yi(J);return dt({},Q,J,{onClick:z(Q)})},getCheckboxProps:(J={})=>{const Q=Yi(J),ie=dt({},Q,{ref:A,"aria-hidden":!0},J),ue=g.checkbox?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ie,ue)},getLabelProps:(J={})=>{const Q=dt({},Yi(J)),ie=dt({},Q,{children:l},J,{onDoubleClick:I(Q)}),ue=g.label?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},ue,ie)},getLabelInputProps:(J={})=>{const Q=Yi(J),ie=g.labelInput?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},J,ie)},getDragAndDropOverlayProps:(J={})=>{const Q=Yi(J),ie=g.dragAndDropOverlay?.(dt({},T,{externalEventHandlers:Q}))??{};return dt({},J,ie)},getErrorContainerProps:(J={})=>{const Q=Yi(J);return dt({},Q,J)},getLoadingContainerProps:(J={})=>{const Q=Yi(J);return dt({size:"12px",thickness:6},Q,J)},rootRef:C,status:b,publicAPI:n}};function n3e(e){return Qe("MuiTreeItem",e)}tt("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const r3e=De(m.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),i3e=De(m.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),o3e=["ownerState"];function B4(e,t,n){return e!==void 0?e:t!==void 0?t:n}function s3e(e){const{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:o}=NJ(),s={collapseIcon:B4(t?.collapseIcon,i.collapseIcon,i3e),expandIcon:B4(t?.expandIcon,i.expandIcon,r3e),endIcon:B4(t?.endIcon,i.endIcon),icon:t?.icon};let a;s?.icon?a="icon":r.expandable?r.expanded?a="collapseIcon":a="expandIcon":a="endIcon";const l=s[a],u=Yr({elementType:l,externalSlotProps:f=>dt({},DC(o[a],f),DC(n?.[a],f)),ownerState:{}}),c=Jh(u,o3e);return l?m.jsx(l,dt({},c)):null}const a3e=me("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>Mm(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Ul(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function l3e(e){return e.action==null?null:m.jsx(a3e,dt({},e))}function u3e(e){const{children:t,itemId:n,id:r}=e,{wrapItem:i,store:o}=Ug(),s=Xr(o,bv.treeItemIdAttribute,n,r);return m.jsx(O.Fragment,{children:i({children:t,itemId:n,store:o,idAttribute:s})})}const c3e=me("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>dt({},e.typography.body1,{width:"100%",backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),d3e=["visible"],f3e=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],h3e=PJ(),p3e=me("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),m3e=me("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>Mm(e)&&e!=="status"})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent",cursor:"auto"},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Ul(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),g3e=me("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>Mm(e)&&e!=="editable"})(({theme:e})=>dt({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),y3e=me("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),b3e=me(ca,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),v3e=me("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),x3e=me(Ur,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),S3e=me(O.forwardRef((e,t)=>{const{visible:n}=e,r=Jh(e,d3e);return n?m.jsx(Wl,dt({},r,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),w3e=e=>{const{classes:t}=NJ(),n=dt({},e,{root:Oe(e?.root,t.root),content:Oe(e?.content,t.itemContent),iconContainer:Oe(e?.iconContainer,t.itemIconContainer),checkbox:Oe(e?.checkbox,t.itemCheckbox),label:Oe(e?.label,t.itemLabel),groupTransition:Oe(e?.groupTransition,t.itemGroupTransition),labelInput:Oe(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:Oe(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:Oe(e?.errorIcon,t.itemErrorIcon),loadingIcon:Oe(e?.loadingIcon,t.itemLoadingIcon)});return Ze({root:["root"],content:["content"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],groupTransition:["groupTransition"],labelInput:["labelInput"],dragAndDropOverlay:["dragAndDropOverlay"],errorIcon:["errorIcon"],loadingIcon:["loadingIcon"],expanded:["expanded"],editing:["editing"],editable:["editable"],selected:["selected"],focused:["focused"],disabled:["disabled"]},n3e,n)},C3e=O.forwardRef(function(t,n){const r=h3e({props:t,name:"MuiTreeItem"}),{id:i,itemId:o,label:s,disabled:a,disableSelection:l,children:u,slots:c={},slotProps:f={},classes:h}=r,g=Jh(r,f3e),{getContextProviderProps:y,getRootProps:b,getContentProps:v,getIconContainerProps:S,getCheckboxProps:C,getLabelProps:w,getGroupTransitionProps:A,getLabelInputProps:E,getDragAndDropOverlayProps:_,getErrorContainerProps:D,getLoadingContainerProps:T,status:M}=t3e({id:i,itemId:o,children:u,label:s,disabled:a,disableSelection:l}),L=w3e(h),j=c.root??p3e,I=Yr({elementType:j,getSlotProps:b,externalForwardedProps:g,externalSlotProps:f.root,additionalProps:{ref:n},ownerState:{},className:L.root}),N=c.content??m3e,$=Yr({elementType:N,getSlotProps:v,externalSlotProps:f.content,ownerState:{},className:Oe(L.content,M.expanded&&L.expanded,M.selected&&L.selected,M.focused&&L.focused,M.disabled&&L.disabled,M.editing&&L.editing,M.editable&&L.editable)}),z=c.iconContainer??y3e,F=Yr({elementType:z,getSlotProps:S,externalSlotProps:f.iconContainer,ownerState:{},className:L.iconContainer}),G=c.label??g3e,V=Yr({elementType:G,getSlotProps:w,externalSlotProps:f.label,ownerState:{},className:L.label}),H=c.checkbox??S3e,X=Yr({elementType:H,getSlotProps:C,externalSlotProps:f.checkbox,ownerState:{},className:L.checkbox}),B=c.groupTransition??void 0,W=Yr({elementType:B,getSlotProps:A,externalSlotProps:f.groupTransition,ownerState:{},className:L.groupTransition}),Y=c.labelInput??c3e,U=Yr({elementType:Y,getSlotProps:E,externalSlotProps:f.labelInput,ownerState:{},className:L.labelInput}),K=c.dragAndDropOverlay??l3e,Z=Yr({elementType:K,getSlotProps:_,externalSlotProps:f.dragAndDropOverlay,ownerState:{},className:L.dragAndDropOverlay}),J=c.errorIcon??v3e,Q=Yr({elementType:J,getSlotProps:D,externalSlotProps:f.errorIcon,ownerState:{},className:L.errorIcon}),ie=c.loadingIcon??x3e,ue=Yr({elementType:ie,getSlotProps:T,externalSlotProps:f.loadingIcon,ownerState:{},className:L.loadingIcon});return m.jsx(u3e,dt({},y(),{children:m.jsxs(j,dt({},I,{children:[m.jsxs(N,dt({},$,{children:[m.jsxs(z,dt({},F,{children:[M.error&&m.jsx(J,dt({},Q)),M.loading?m.jsx(ie,dt({},ue)):m.jsx(s3e,{status:M,slots:c,slotProps:f})]})),m.jsx(H,dt({},X)),M.editing?m.jsx(Y,dt({},U)):m.jsx(G,dt({},V)),m.jsx(K,dt({},Z))]})),u&&m.jsx(b3e,dt({as:B},W))]}))}))}),YJ=De(m.jsx("path",{d:"M22 11h-4.17l3.24-3.24-1.41-1.42L15 11h-2V9l4.66-4.66-1.42-1.41L13 6.17V2h-2v4.17L7.76 2.93 6.34 4.34 11 9v2H9L4.34 6.34 2.93 7.76 6.17 11H2v2h4.17l-3.24 3.24 1.41 1.42L9 13h2v2l-4.66 4.66 1.42 1.41L11 17.83V22h2v-4.17l3.24 3.24 1.42-1.41L13 15v-2h2l4.66 4.66 1.41-1.42L17.83 13H22z"})),v3=De(m.jsx("path",{d:"M20 19V3H4v16H2v2h20v-2zM16 9h2v2h-2zm-2 2H6V9h8zm4-4h-2V5h2zm-4-2v2H6V5zM6 19v-6h8v1.82c-.45.32-.75.84-.75 1.43 0 .97.78 1.75 1.75 1.75s1.75-.78 1.75-1.75c0-.59-.3-1.12-.75-1.43V13h2v6z"})),E3e=De(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"})),fM=De(m.jsx("path",{d:"m17 16-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5z"})),A3e=De(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5M9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8m6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),k3e=De(m.jsx("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"})),x3=De(m.jsx("path",{d:"M9 21c0 .5.4 1 1 1h4c.6 0 1-.5 1-1v-1H9zm3-19C8.1 2 5 5.1 5 9c0 2.4 1.2 4.5 3 5.7V17c0 .5.4 1 1 1h6c.6 0 1-.5 1-1v-2.3c1.8-1.3 3-3.4 3-5.7 0-3.9-3.1-7-7-7"})),su=De(m.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),XJ=De(m.jsx("path",{d:"M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z"})),_3e=De(m.jsx("path",{d:"M12 11c1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3 1.34 3 3 3m0 1c-1.84 0-3.56.5-5.03 1.37-.61.35-.97 1.02-.97 1.72V17h12v-1.91c0-.7-.36-1.36-.97-1.72C15.56 12.5 13.84 12 12 12m9.23-3.85 1.85-.77c-1.22-2.91-3.55-5.25-6.46-6.46l-.77 1.85c2.42 1.02 4.36 2.96 5.38 5.38M8.15 2.77 7.38.92C4.47 2.14 2.14 4.47.92 7.38l1.85.77c1.02-2.42 2.96-4.36 5.38-5.38M2.77 15.85l-1.85.77c1.22 2.91 3.55 5.25 6.46 6.46l.77-1.85c-2.42-1.02-4.36-2.96-5.38-5.38m13.08 5.38.77 1.85c2.91-1.22 5.25-3.55 6.46-6.46l-1.85-.77c-1.02 2.42-2.96 4.36-5.38 5.38"})),Bw=De(m.jsx("path",{d:"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13"})),S3=De(m.jsx("path",{d:"M17 2H7c-1.1 0-2 .9-2 2v16c0 1.1.9 1.99 2 1.99L17 22c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-5 2c1.1 0 2 .9 2 2s-.9 2-2 2c-1.11 0-2-.9-2-2s.89-2 2-2m0 16c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),w3=De(m.jsx("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4m-4-2V5c0-.55.45-1 1-1s1 .45 1 1v1h-1v1h1v2h-1v1h1v1z"})),D3e=De(m.jsx("path",{d:"M17 7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h10c2.76 0 5-2.24 5-5s-2.24-5-5-5m0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3"})),O3e=De(m.jsx("path",{d:"M12 3 2 12h3v8h14v-8h3zm0 13c-1.1 0-2-.9-2-2s2-4 2-4 2 2.9 2 4-.9 2-2 2"})),hM=De(m.jsx("path",{d:"M12 2c-5.33 4.55-8 8.48-8 11.8 0 4.98 3.8 8.2 8 8.2s8-3.22 8-8.2c0-3.32-2.67-7.25-8-11.8M7.83 14c.37 0 .67.26.74.62.41 2.22 2.28 2.98 3.64 2.87.43-.02.79.32.79.75 0 .4-.32.73-.72.75-2.13.13-4.62-1.09-5.19-4.12-.08-.45.28-.87.74-.87"})),T3e=De([m.jsx("path",{d:"M4 3h6v2H4zM1 7h5v2H1zm2 12h5v2H3zm10.73-8.39c.75.23 1.3.78 1.57 1.46l4.27-7.11c.65-1.08.3-2.48-.78-3.13-.87-.52-1.99-.41-2.73.29l-3.43 3.21c-.4.37-.63.9-.63 1.45v3.93c.36-.15.98-.33 1.73-.1m-3.12 1.66c.16-.52.48-.96.89-1.27H3.28C2.02 11 1 12.02 1 13.28c0 1.02.67 1.91 1.65 2.19l4.51 1.29c.53.15 1.1.08 1.58-.21l2.69-1.61c-.77-.62-1.13-1.67-.82-2.67m11.6 6.34-2.28-4.1c-.27-.48-.73-.83-1.26-.97l-3.18-.8c.03.32 0 .66-.1.99-.32 1.06-1.28 1.77-2.39 1.77-.61 0-.99-.22-1-.22V21c-1.1 0-2 .9-2 2h6c0-1.1-.9-2-2-2v-4.28l4.61 4.61c.89.89 2.33.89 3.22 0 .72-.72.88-1.83.38-2.72"},"0"),m.jsx("path",{d:"M12.56 14.43c.79.24 1.63-.2 1.87-1 .24-.79-.2-1.63-1-1.87-.79-.24-1.63.2-1.87 1-.24.79.21 1.63 1 1.87"},"1")]),R3e=({endpoint:e})=>{const t=O.useMemo(()=>{switch(e.type.name){case"RootNode":return m.jsx(fM,{});case"Aggregator":return m.jsx(A3e,{});case"OnOffPlugInUnit":return m.jsx(D3e,{});case"OnOffLight":case"ExtendedColorLight":case"ColorTemperatureLight":case"DimmableLight":return m.jsx(x3,{});case"TemperatureSensor":return m.jsx(w3,{});case"Thermostat":return m.jsx(YJ,{});case"Fan":return m.jsx(T3e,{});case"OnOffSensor":return m.jsx(E3e,{});case"HumiditySensor":return m.jsx(hM,{});case"WindowCovering":return m.jsx(v3,{});case"DoorLock":return m.jsx(su,{});case"OccupancySensor":return m.jsx(_3e,{});case"ContactSensor":return m.jsx(XJ,{});case"WaterLeakDetector":return m.jsx(O3e,{});case"Speaker":return m.jsx(S3,{});case"RoboticVacuumCleaner":return m.jsx(Bw,{});default:return m.jsx(k3e,{})}},[e]);return m.jsx(bn,{title:`${e.type.name} (${e.type.id})`,children:t})},I3e=e=>{const[t,n]=O.useState(()=>P3e(e.endpoint)),r=i=>{let o;i&&(o=j3e(i,e.endpoint)),e.onSelected(o)};return m.jsx(VAe,{expandedItems:t,onExpandedItemsChange:(i,o)=>n(o),onSelectedItemsChange:(i,o)=>r(o),children:m.jsx(JJ,{endpoint:e.endpoint,sortBy:e.sortBy})})},JJ=e=>{const t=O.useMemo(()=>{const n=[...e.endpoint.parts];switch(e.sortBy){case"name":return n.sort((r,i)=>{const o=Ps(r.state)??r.id.local,s=Ps(i.state)??i.id.local;return o.localeCompare(s)});case"type":return n.sort((r,i)=>{const o=r.type?.name??"",s=i.type?.name??"";return o.localeCompare(s)});default:return n.sort((r,i)=>r.endpoint-i.endpoint)}},[e.endpoint.parts,e.sortBy]);return m.jsx(C3e,{itemId:e.endpoint.id.global,label:m.jsx(M3e,{endpoint:e.endpoint}),children:t.map(n=>m.jsx(JJ,{endpoint:n,sortBy:e.sortBy},n.id.global))})},M3e=e=>m.jsxs(le,{display:"flex",children:[m.jsx(R3e,{endpoint:e.endpoint}),m.jsx(le,{marginLeft:1,component:"span",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:m.jsx($Se,{endpoint:e.endpoint})})]});function P3e(e){const t=[e.id.global],n=[e];for(;n.length>0;){const r=n.shift();r.parts.length===1&&t.push(r.parts[0].id.global),n.push(...r.parts)}return t}function j3e(e,t){const n=[t];for(;n.length>0;){const r=n.shift();if(r.id.global===e)return r;n.push(...r.parts)}}const K6=e=>{const t=e.parts??[];return t.length===0?[e]:t.flatMap(n=>K6(n))},$3e=e=>{const[t,n]=O.useState(void 0),[r,i]=O.useState("name"),[o,s]=O.useState("cards"),[a,l]=O.useState(""),[u,c]=O.useState(!1),[f,h]=O.useState(!1),[g,y]=O.useState(!1),[b,v]=O.useState(""),[S,C]=O.useState(),[w,A]=O.useState({open:!1,message:"",severity:"success"}),E=O.useCallback(async(j,I)=>{if(I){v(j);try{const $=(await oM(I)).mappings.find(z=>z.entityId===j);C($)}catch{C(void 0)}y(!0)}},[]),_=O.useCallback(async j=>{if(!(!e.bridgeId||!b))try{await sM(e.bridgeId,b,j),A({open:!0,message:`Mapping saved for ${b}. Restart the bridge to apply changes.`,severity:"success"}),y(!1),e.onMappingSaved?.()}catch(I){A({open:!0,message:`Failed to save mapping: ${I}`,severity:"error"})}},[e.bridgeId,b,e.onMappingSaved]),D=O.useCallback(j=>{const N=j.state.homeAssistantEntity?.entity?.state?.state;return N==="unavailable"||N==="unknown"},[]),T=O.useMemo(()=>K6(e.endpoint).filter(D).length,[e.endpoint,D]),M=O.useMemo(()=>[...K6(e.endpoint).filter(N=>{if(f&&!D(N))return!1;const $=Ps(N.state)??N.id.local,z=N.type.name,F=a.toLowerCase();return $.toLowerCase().includes(F)||z.toLowerCase().includes(F)})].sort((N,$)=>{const z=Ps(N.state)??N.id.local,F=Ps($.state)??$.id.local;switch(r){case"name":return z.localeCompare(F);case"endpoint":return N.id.local.localeCompare($.id.local);case"type":return N.type.name.localeCompare($.type.name);default:return 0}}),[e.endpoint,a,r,f,D]),L=j=>{n(j),c(!0)};return m.jsxs(le,{children:[m.jsxs(le,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,gap:2,flexWrap:"wrap",children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[m.jsxs(re,{variant:"h6",component:"span",children:["Endpoints (",M.length,")"]}),m.jsx(bn,{title:"View All Devices",children:m.jsx(Fn,{component:Dc,to:jt.devices,size:"small",color:"primary",children:m.jsx(ss,{})})})]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[m.jsx(zr,{size:"small",placeholder:"Search endpoints...",value:a,onChange:j=>l(j.target.value),sx:{flexGrow:1,maxWidth:300}}),T>0&&m.jsx(bn,{title:f?"Show all entities":`Show ${T} unavailable`,children:m.jsx(Fn,{size:"small",color:f?"warning":"default",onClick:()=>h(j=>!j),children:m.jsx(xJ,{badgeContent:T,color:"warning",max:99,children:m.jsx(Kd,{})})})}),m.jsxs(Xa,{size:"small",sx:{minWidth:120},children:[m.jsx(cc,{id:"sort-label",children:m.jsxs(le,{display:"flex",alignItems:"center",gap:.5,children:[m.jsx(vJ,{fontSize:"small"})," Sort"]})}),m.jsxs(Ha,{labelId:"sort-label",value:r,label:"Sort",onChange:j=>i(j.target.value),children:[m.jsx(rr,{value:"name",children:"Name"}),m.jsx(rr,{value:"endpoint",children:"Endpoint ID"}),m.jsx(rr,{value:"type",children:"Type"})]})]}),m.jsxs(yCe,{value:o,exclusive:!0,onChange:(j,I)=>I&&s(I),size:"small",children:[m.jsx(iB,{value:"cards",children:m.jsx(bn,{title:"Card View",children:m.jsx(FSe,{})})}),m.jsx(iB,{value:"tree",children:m.jsx(bn,{title:"Tree View",children:m.jsx(BSe,{})})})]})]})]}),o==="cards"?m.jsx(et,{container:!0,spacing:2,children:M.map(j=>m.jsx(et,{size:{xs:12,sm:6,lg:4},children:m.jsx(RJ,{endpoint:j,bridgeId:e.bridgeId,onClick:()=>L(j),onEditMapping:e.bridgeId?E:void 0})},j.id.global))}):m.jsxs(et,{container:!0,spacing:2,children:[m.jsx(et,{size:{xs:12,md:4},children:m.jsx(I3e,{endpoint:e.endpoint,onSelected:n,sortBy:r})}),m.jsx(et,{size:{xs:12,md:8},children:t&&m.jsx(gB,{endpoint:t})})]}),m.jsxs(vc,{open:u,onClose:()=>c(!1),maxWidth:"md",fullWidth:!0,children:[m.jsx(Sc,{children:t&&(Ps(t.state)??t.id.local)}),m.jsx(xc,{children:t&&m.jsx(gB,{endpoint:t})})]}),e.bridgeId&&m.jsx(lM,{open:g,onClose:()=>y(!1),entityId:b,domain:b.split(".")[0]||"",currentMapping:S,onSave:_}),m.jsx(MI,{open:w.open,autoHideDuration:6e3,onClose:()=>A({...w,open:!1}),children:m.jsx(kn,{onClose:()=>A({...w,open:!1}),severity:w.severity,sx:{width:"100%"},children:w.message})})]})},C3=De(m.jsx("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}));function N3e({bridgeId:e}){const[t,n]=O.useState(null),[r,i]=O.useState(!0),[o,s]=O.useState(!1),[a,l]=O.useState(null),u=O.useCallback(async()=>{try{const v=await oM(e);n(v)}catch{console.error("Failed to load entity mappings")}finally{i(!1)}},[e]);O.useEffect(()=>{u()},[u]);const c=O.useCallback(()=>{l({entityId:"",domain:""}),s(!0)},[]),f=O.useCallback((v,S)=>{const C=v.split(".")[0]||"";l({entityId:v,domain:C,config:S}),s(!0)},[]),h=O.useCallback(async v=>{try{await bCe(e,v),await u()}catch{console.error("Failed to delete entity mapping")}},[e,u]),g=O.useCallback(async v=>{if(v.entityId)try{await sM(e,v.entityId,v),s(!1),l(null),await u()}catch{console.error("Failed to save entity mapping")}},[e,u]),y=O.useCallback(()=>{s(!1),l(null)},[]),b=t?.mappings??[];return m.jsxs(er,{children:[m.jsxs(gr,{children:[m.jsxs(le,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[m.jsxs(re,{variant:"h6",children:[m.jsx(C3,{sx:{mr:1,verticalAlign:"middle"}}),"Entity Mappings"]}),m.jsx(Tt,{variant:"outlined",size:"small",onClick:c,children:"Add Mapping"})]}),r&&m.jsx(re,{color:"text.secondary",children:"Loading..."}),!r&&b.length===0&&m.jsx(re,{color:"text.secondary",children:"No custom entity mappings configured. Use mappings to override Matter device types, set custom names, or disable specific entities."}),!r&&b.length>0&&m.jsx(cg,{children:m.jsxs(lg,{size:"small",children:[m.jsx(GC,{children:m.jsxs(Ts,{children:[m.jsx(Rn,{children:"Entity ID"}),m.jsx(Rn,{children:"Device Type"}),m.jsx(Rn,{children:"Custom Name"}),m.jsx(Rn,{children:"Status"}),m.jsx(Rn,{align:"right",children:"Actions"})]})}),m.jsx(ug,{children:b.map(v=>m.jsxs(Ts,{children:[m.jsx(Rn,{children:m.jsx(re,{variant:"body2",fontFamily:"monospace",children:v.entityId})}),m.jsx(Rn,{children:v.matterDeviceType||m.jsx(re,{color:"text.secondary",variant:"body2",children:"Auto"})}),m.jsx(Rn,{children:v.customName||m.jsx(re,{color:"text.secondary",variant:"body2",children:"—"})}),m.jsx(Rn,{children:v.disabled?m.jsx(Ct,{label:"Disabled",color:"error",size:"small"}):m.jsx(Ct,{label:"Enabled",color:"success",size:"small"})}),m.jsxs(Rn,{align:"right",children:[m.jsx(Fn,{size:"small",onClick:()=>f(v.entityId,v),children:m.jsx(l3,{fontSize:"small"})}),m.jsx(Fn,{size:"small",onClick:()=>h(v.entityId),children:m.jsx(zg,{fontSize:"small"})})]})]},v.entityId))})]})})]}),a&&m.jsx(lM,{open:o,entityId:a.entityId,domain:a.domain,currentMapping:a.config,onSave:g,onClose:y})]})}const L3e=e=>e.bridges,pM=n3([L3e],e=>e.items),F3e=e=>n3([pM],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(r=>r.id===e)})),B3e=n3([pM],e=>{if(!e.isInitialized)return;const t={};return(e.content?.map(r=>[r.port,r.id])??[]).forEach(([r,i])=>{t[r]=i}),t});function Hg(){return Bg(pM)}function QJ(){return Bg(B3e)}function ZJ(e){const t=O.useMemo(()=>F3e(e),[e]);return Bg(t)}function z3e(){const e=zs();return O.useCallback(async t=>{const n=await e(RX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function U3e(){const e=zs();return O.useCallback(async t=>{const n=await e(MX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function H3e(){const e=zs();return O.useCallback(async t=>{const n=await e(PX(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function V3e(){const e=zs();return O.useCallback(async t=>{const n=await e(IX(t));if(n.meta.requestStatus==="rejected")throw n.error},[e])}function W3e(){const e=zs();return O.useCallback(async t=>{await abe(t),await e(Fo())},[e])}function q3e(){const e=zs();return O.useCallback(async t=>{const n=await TX(t);return await e(Fo()),n},[e])}const G3e=e=>e.devices,K3e=e=>n3([G3e],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function Y3e(e){const t=O.useMemo(()=>K3e(e),[e]);return Bg(t)}function X3e(e,t){const[n,r]=O.useState(e);return O.useEffect(()=>{let i=e;t();const o=setInterval(()=>{i--,i===0&&(t(),i=e),r(i)},1e3);return()=>clearInterval(o)},[e,t]),n}async function J3e(e){return await(await fetch(`api/matter/bridges/${e}/devices`)).json()}const dc=Fg("devices/load",J3e),Q3e=De(m.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),Z3e=De(m.jsx("path",{d:"M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93"})),eke=({bridge:e})=>{const[t,n]=O.useState(null),r=!!t,i=Xh(),o=Tc(),s=H3e(),a=V3e(),l=q3e(),u=y=>n(y.currentTarget),c=()=>n(null),f=async()=>{c(),await l(e).then(y=>o.show({message:`Synced ${y.syncedCount} devices to controllers`,severity:"success"})).catch(y=>o.show({message:`Failed to sync: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},h=async()=>{c(),await s(e).then(()=>o.show({message:"Bridge Reset successfully",severity:"success"})).catch(y=>o.show({message:`Failed to reset bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))},g=async()=>{c(),await a(e).then(()=>o.show({message:"Bridge deleted successfully",severity:"success"})).then(()=>i(jt.bridges)).catch(y=>o.show({message:`Failed to delete bridge: ${y?.message??JSON.stringify(y)}`,severity:"error"}))};return m.jsxs(m.Fragment,{children:[m.jsx(Fn,{onClick:u,children:m.jsx(Q3e,{})}),m.jsxs(CJ,{open:r,onClose:c,anchorEl:t,children:[m.jsxs(rr,{component:Dc,to:jt.editBridge(e),children:[m.jsx(Hl,{children:m.jsx(l3,{fontSize:"small"})}),m.jsx(Ua,{children:"Edit"})]}),m.jsx(Di,{}),m.jsxs(rr,{onClick:f,children:[m.jsx(Hl,{children:m.jsx(c3,{fontSize:"small"})}),m.jsx(Ua,{children:"Force Sync"})]}),m.jsxs(rr,{onClick:h,children:[m.jsx(Hl,{children:m.jsx(Z3e,{fontSize:"small"})}),m.jsx(Ua,{children:"Factory Reset"})]}),m.jsxs(rr,{onClick:g,children:[m.jsx(Hl,{children:m.jsx(zg,{fontSize:"small"})}),m.jsx(Ua,{children:"Delete"})]})]})]})},tke=O.memo(fSe),nke=({failedEntities:e})=>{const[t,n]=O.useState(!1);return!e||e.length===0?null:m.jsxs(kn,{severity:"warning",sx:{cursor:"pointer"},onClick:()=>n(!t),children:[m.jsxs(re,{variant:"body2",children:[m.jsxs("strong",{children:[e.length," entity/entities could not be loaded."]})," ","Click to ",t?"hide":"show"," details."]}),m.jsx(ca,{in:t,children:m.jsx(bu,{dense:!0,sx:{mt:1},children:e.map(r=>m.jsxs(pf,{sx:{py:0},children:[m.jsx(Hl,{sx:{minWidth:32},children:m.jsx(r3,{color:"warning",fontSize:"small"})}),m.jsx(Ua,{primary:r.entityId,secondary:r.reason,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},r.entityId))})})]})},rke=()=>{const e=Tc(),t=zs(),{bridgeId:n}=aY(),[r,i]=O.useState(0),o=O.useCallback(()=>{i(g=>g+1)},[]),s=O.useCallback(()=>{t(dc(n))},[t,n]),a=X3e(10,s),{content:l,isLoading:u,error:c}=ZJ(n),{content:f,error:h}=Y3e(n);return O.useEffect(()=>{c&&e.show({message:c.message??"Failed to load Bridge details",severity:"error"})},[c,e]),O.useEffect(()=>{h?.message&&e.show({message:h.message,severity:"error"})},[h,e]),!l&&u?"Loading":l?m.jsxs(zt,{spacing:4,children:[m.jsx(a3,{items:[{name:"Bridges",to:jt.bridges},{name:l.name,to:jt.bridge(n)}]}),m.jsxs(le,{display:"flex",justifyContent:"space-between",children:[m.jsxs(re,{variant:"h4",children:[l.name," ",m.jsx(mJ,{status:l.status})]}),m.jsx(eke,{bridge:n})]}),m.jsx(CSe,{status:l.status,reason:l.statusReason}),l.failedEntities&&l.failedEntities.length>0&&m.jsx(nke,{failedEntities:l.failedEntities}),m.jsx(ike,{bridge:l,devices:f}),m.jsx(tke,{bridge:l}),f&&m.jsx(LSe,{devices:f}),m.jsx(N3e,{bridgeId:n},r),f&&m.jsxs(zt,{spacing:2,children:[m.jsx(le,{display:"flex",justifyContent:"flex-end",alignItems:"center",children:a!=null&&m.jsx(bn,{title:"New devices and changes on labels are discovered every 30 seconds.",children:m.jsxs(re,{variant:"body2",color:"textSecondary",children:["Refreshing states in ",a-1," seconds..."]})})}),m.jsx($3e,{endpoint:f,bridgeId:n,onMappingSaved:o})]})]}):"Not found"};function eQ(e){return e.type.name==="RoboticVacuumCleaner"?!0:e.parts.some(eQ)}function tQ(e){if(e.type.name==="Aggregator")return e.parts.length;let t=0;for(const n of e.parts)t+=tQ(n);return t}const ike=({bridge:e,devices:t})=>{const n=Tc(),[r,i]=O.useState(!1),o=O.useMemo(()=>{if(!t||e.featureFlags?.serverMode||!eQ(t))return!1;const l=e.commissioning?.fabrics??[];if(l.length===0)return!0;const u=new Set([4937,4631,4448]);return l.some(c=>u.has(c.rootVendorId))},[t,e.featureFlags?.serverMode,e.commissioning?.fabrics]),s=O.useMemo(()=>t?tQ(t)===1:!1,[t]),a=async()=>{i(!0);try{await OX({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),n.show({message:"Server Mode enabled. The bridge will restart with your vacuum as a standalone device.",severity:"success"})}catch(l){n.show({message:`Failed to enable Server Mode: ${l instanceof Error?l.message:String(l)}`,severity:"error"})}finally{i(!1)}};return o?m.jsxs(kn,{severity:"warning",icon:m.jsx(rg,{}),action:s?m.jsx(Tt,{color:"warning",size:"small",variant:"outlined",onClick:a,disabled:r,startIcon:r?m.jsx(Ur,{size:16}):void 0,sx:{whiteSpace:"nowrap"},children:r?"Enabling...":"Enable Server Mode"}):void 0,children:[m.jsx(UC,{children:"Server Mode Recommended for Robot Vacuums"}),m.jsxs(re,{variant:"body2",children:["This bridge contains a robot vacuum in ",m.jsx("strong",{children:"bridged mode"}),". Apple Home and Alexa will show the bridge as an additional device, resulting in duplicate entries. Enable ",m.jsx("strong",{children:"Server Mode"})," to expose the vacuum as a standalone Matter device for full Siri/Alexa voice command support and no duplicates."]}),!s&&m.jsxs(re,{variant:"body2",sx:{mt:1},children:[m.jsx("strong",{children:"Note:"})," Server Mode requires the vacuum to be the only device on this bridge. Please remove other entities from this bridge first, then enable Server Mode in the bridge settings."]})]}):null},QC=De(m.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z"})),oke=De(m.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"})),mM=De(m.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),ske=De(m.jsx("path",{d:"m7 10 5 5 5-5z"})),ake=De(m.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),lke=De(m.jsx("path",{d:"m10 17 5-5-5-5z"})),gM=De(m.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),nQ=De(m.jsx("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"})),RB=De(m.jsx("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"})),R2=De(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),uke=De(m.jsxs(O.Fragment,{children:[m.jsx("path",{fillOpacity:".3",d:"M17 5.33C17 4.6 16.4 4 15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33V9h10V5.33z"}),m.jsx("path",{d:"M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"})]})),cke=De(m.jsx("path",{d:"M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66s.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21"})),E3=De(m.jsx("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20zm-6 8h-4v-2h4zm0-4h-4v-2h4z"})),dke=De([m.jsx("path",{d:"M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"},"0"),m.jsx("path",{d:"m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"},"1")]),fke=De(m.jsx("path",{d:"M1 18v3h3c0-1.66-1.34-3-3-3m0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7m18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11m20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"})),IB=De([m.jsx("path",{d:"m12 2-5.5 9h11z"},"0"),m.jsx("circle",{cx:"17.5",cy:"17.5",r:"4.5"},"1"),m.jsx("path",{d:"M3 13.5h8v8H3z"},"2")]),hke=De(m.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),yM=De(m.jsx("path",{d:"M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5m3 10h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3z"})),pke=De(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),mke=De(m.jsx("path",{d:"M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z"})),gke=De(m.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),yke=De(m.jsx("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"})),bke=De(m.jsx("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"})),vke=De(m.jsx("path",{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),xke=De(m.jsx("path",{d:"M13.49 5.48c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m-3.6 13.9 1-4.4 2.1 2v6h2v-7.5l-2.1-2 .6-3c1.3 1.5 3.3 2.5 5.5 2.5v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1l-5.2 2.2v4.7h2v-3.4l1.8-.7-1.6 8.1-4.9-1-.4 2z"})),Ske=De(m.jsx("path",{d:"M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z"})),wke=De(m.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),Cke=De(m.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),Eke=De([m.jsx("path",{d:"M21 14c0-.55-.45-1-1-1h-2v2h2c.55 0 1-.45 1-1m-1 3h-2v2h2c.55 0 1-.45 1-1s-.45-1-1-1m-8-3h-2v4h2c0 1.1.9 2 2 2h3v-8h-3c-1.1 0-2 .9-2 2"},"0"),m.jsx("path",{d:"M5 13c0-1.1.9-2 2-2h1.5c1.93 0 3.5-1.57 3.5-3.5S10.43 4 8.5 4H5c-.55 0-1 .45-1 1s.45 1 1 1h3.5c.83 0 1.5.67 1.5 1.5S9.33 9 8.5 9H7c-2.21 0-4 1.79-4 4s1.79 4 4 4h2v-2H7c-1.1 0-2-.9-2-2"},"1")]),py=De(m.jsx("path",{d:"M17 10H7v2h10zm2-7h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14zm-5-5H7v2h7z"})),Ake=De(m.jsx("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"})),kke=De(m.jsx("circle",{cx:"12",cy:"12",r:"8"})),_ke=De(m.jsx("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"})),Dke=De(m.jsx("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"})),bM=De([m.jsx("circle",{cx:"15",cy:"13",r:"1"},"0"),m.jsx("circle",{cx:"9",cy:"13",r:"1"},"1"),m.jsx("path",{d:"m8.33 7.5-.66 2h8.66l-.66-2z"},"2"),m.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 15.69c0 .45-.35.81-.78.81h-.44c-.44 0-.78-.36-.78-.81V16.5H7v1.19c0 .45-.35.81-.78.81h-.44c-.43 0-.78-.36-.78-.81v-6.5c.82-2.47 1.34-4.03 1.56-4.69.05-.16.12-.29.19-.4.02-.02.03-.04.05-.06.38-.53.92-.54.92-.54h8.56s.54.01.92.53c.02.03.03.05.05.07.07.11.14.24.19.4.22.66.74 2.23 1.56 4.69z"},"3")]),Y6=De(m.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})),Oke=De(m.jsx("path",{d:"M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2zm10 14.5V20H8v-3.5l4-4zm-4-5-4-4V4h8v3.5z"})),c1=De(m.jsx("path",{d:"M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77Q17.34 17 18 17c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z"})),ZC=De(m.jsx("path",{d:"M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"})),Tke=De(m.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-1 9H9V9h10zm-4 4H9v-2h6zm4-8H9V5h10z"})),Rke=De(m.jsx("path",{d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),rQ=De(m.jsx("path",{d:"M15 9H9v6h6zm-2 4h-2v-2h2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2zm-4 6H7V7h10z"})),Ike=De(m.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"})),Mke=De(m.jsx("path",{d:"M12 14.67 3.41 6.09 2 7.5l8.5 8.5H4v2h16v-2h-6.5l5.15-5.15c.26.1.55.15.85.15 1.38 0 2.5-1.12 2.5-2.5S20.88 6 19.5 6 17 7.12 17 8.5c0 .35.07.67.2.97z"})),Pke=De(m.jsx("path",{d:"M8 5v14l11-7z"})),vM=De(m.jsx("path",{d:"M13 3h-2v10h2zm4.83 2.17-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83"})),jke=De(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.89-2-2-2m0 16H5V7h14zm-5.5-6c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5M12 9c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5"})),xM=De(m.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"})),eE=De(m.jsx("path",{d:"M12 5V2L8 6l4 4V7c3.31 0 6 2.69 6 6 0 2.97-2.17 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93 0-4.42-3.58-8-8-8m-6 8c0-1.65.67-3.15 1.76-4.24L6.34 7.34C4.9 8.79 4 10.79 4 13c0 4.08 3.05 7.44 7 7.93v-2.02c-2.83-.48-5-2.94-5-5.91"})),MB=De(m.jsx("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9m-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8z"})),tE=De(m.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),iQ=De(m.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),oQ=De(m.jsx("path",{d:"M12 1 3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z"})),Q1=De(m.jsx("path",{d:"M7.76 16.24C6.67 15.16 6 13.66 6 12s.67-3.16 1.76-4.24l1.42 1.42C8.45 9.9 8 10.9 8 12s.45 2.1 1.17 2.83zm8.48 0C17.33 15.16 18 13.66 18 12s-.67-3.16-1.76-4.24l-1.42 1.42C15.55 9.9 16 10.9 16 12s-.45 2.1-1.17 2.83zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m8 2c0 2.21-.9 4.21-2.35 5.65l1.42 1.42C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07l-1.42 1.42C19.1 7.79 20 9.79 20 12M6.35 6.35 4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.42-1.42C4.9 16.21 4 14.21 4 12s.9-4.21 2.35-5.65"})),SM=De(m.jsx("path",{d:"M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1m-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05M12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0"})),$ke=De(m.jsx("path",{d:"M6 6h12v12H6z"})),Nke=De(m.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 14H8V8h8z"})),Lke=De(m.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),Fke=De(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"})),Bke=De(m.jsx("path",{d:"M23 8c0 1.1-.9 2-2 2-.18 0-.35-.02-.51-.07l-3.56 3.55c.05.16.07.34.07.52 0 1.1-.9 2-2 2s-2-.9-2-2c0-.18.02-.36.07-.52l-2.55-2.55c-.16.05-.34.07-.52.07s-.36-.02-.52-.07l-4.55 4.56c.05.16.07.33.07.51 0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2c.18 0 .35.02.51.07l4.56-4.55C8.02 9.36 8 9.18 8 9c0-1.1.9-2 2-2s2 .9 2 2c0 .18-.02.36-.07.52l2.55 2.55c.16-.05.34-.07.52-.07s.36.02.52.07l3.55-3.56C19.02 8.35 19 8.18 19 8c0-1.1.9-2 2-2s2 .9 2 2"})),wM=De(m.jsx("path",{d:"M22 14c0-1.95-1.4-3.57-3.25-3.92L17.4 6.05C17 4.82 15.85 4 14.56 4H9.44C8.15 4 7 4.82 6.6 6.05L5.81 8.4 4.41 7l.29-.29c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0l-2 2c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l.3-.3 1.79 1.79C3.18 10.72 2 12.22 2 14c0 1.5.83 2.79 2.05 3.48C4.28 18.9 5.51 20 7 20c1.3 0 2.4-.84 2.82-2h4.37c.41 1.16 1.51 2 2.82 2 1.49 0 2.72-1.1 2.95-2.52C21.17 16.79 22 15.5 22 14M7 18c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m4-8H7.41l-.02-.02 1.1-3.3c.14-.41.52-.68.95-.68H11zm2-4h1.56c.43 0 .81.27.95.68l1.1 3.32H13zm4 12c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"})),CM=De(m.jsx("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2m0 14H3V5h18z"})),zke=De(m.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),Uke=De(m.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),Hke=De(m.jsx("path",{d:"M14.67 5v6.5H9.33V5zm1 6.5H21V5h-5.33zm-1 7.5v-6.5H9.33V19zm1-6.5V19H21v-6.5zm-7.34 0H3V19h5.33zm0-1V5H3v6.5z"})),Vke=De(m.jsx("path",{d:"M11 11V3H5c-1.1 0-2 .9-2 2v6zm2 0h8V5c0-1.1-.9-2-2-2h-6zm-2 2H3v6c0 1.1.9 2 2 2h6zm2 0v8h6c1.1 0 2-.9 2-2v-6z"}));async function Wke(){const e=await fetch("api/bridges/export");if(!e.ok)throw new Error(`Failed to export bridges: ${e.statusText}`);const t=await e.blob(),r=e.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split("T")[0]}.json`;Kke(t,r)}async function qke(e){const t=await fetch("api/bridges/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`Failed to preview import: ${t.statusText}`);return t.json()}async function Gke(e,t){const n=await fetch("api/bridges/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,options:t})});if(!n.ok)throw new Error(`Failed to import bridges: ${n.statusText}`);return n.json()}function Kke(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Yke({open:e,file:t,onClose:n,onImported:r}){const[i,o]=O.useState(null),[s,a]=O.useState(new Set),[l,u]=O.useState(!1),[c,f]=O.useState(null),[h,g]=O.useState(null),[y,b]=O.useState(!1),[v,S]=O.useState(null);O.useEffect(()=>{if(!e||!t){o(null),a(new Set),f(null),g(null),S(null);return}const _=new FileReader;_.onload=async D=>{try{const T=JSON.parse(D.target?.result);f(T);const M=await qke(T);o(M),a(new Set(M.bridges.map(L=>L.id)))}catch{g("Failed to parse import file. Please select a valid export file.")}},_.readAsText(t)},[e,t]);const C=O.useCallback(_=>{a(D=>{const T=new Set(D);return T.has(_)?T.delete(_):T.add(_),T})},[]),w=O.useCallback(()=>{i&&a(new Set(i.bridges.map(_=>_.id)))},[i]),A=O.useCallback(()=>{a(new Set)},[]),E=O.useCallback(async()=>{if(c){b(!0);try{const _=await Gke(c,{bridgeIds:Array.from(s),overwriteExisting:l}),D=[];_.imported>0&&D.push(`${_.imported} bridge(s) imported`),_.skipped>0&&D.push(`${_.skipped} skipped (already exist)`),_.errors.length>0&&D.push(`${_.errors.length} failed`),S(D.join(", ")),r()}catch(_){g(_ instanceof Error?_.message:"Import failed")}finally{b(!1)}}},[c,s,l,r]);return m.jsxs(vc,{open:e,onClose:n,maxWidth:"sm",fullWidth:!0,children:[m.jsx(Sc,{children:"Import Bridges"}),m.jsxs(xc,{children:[h&&m.jsx(kn,{severity:"error",sx:{mb:2},children:h}),v&&m.jsx(kn,{severity:"success",sx:{mb:2},children:v}),i&&!v&&m.jsxs(m.Fragment,{children:[i.migrated&&m.jsxs(kn,{severity:"info",sx:{mb:2},children:["This export is from an older version (",i.sourceVersion,"). Bridges will be migrated to the current format during import."]}),m.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Exported on ",new Date(i.exportedAt).toLocaleString(),i.sourceVersion&&!i.migrated&&m.jsxs(m.Fragment,{children:[" • Format: ",i.sourceVersion]})]}),m.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16},children:[m.jsx(Tt,{size:"small",onClick:w,children:"Select All"}),m.jsx(Tt,{size:"small",onClick:A,children:"Select None"})]}),m.jsx(bu,{dense:!0,children:i.bridges.map(_=>m.jsxs(pf,{disablePadding:!0,children:[m.jsx(Hl,{children:m.jsx(Wl,{edge:"start",checked:s.has(_.id),onChange:()=>C(_.id)})}),m.jsx(Ua,{primary:_.name,secondary:m.jsxs(m.Fragment,{children:["Port ",_.port," • ",_.entityCount," filter rules",_.exists&&m.jsxs("span",{style:{color:"orange"},children:[" ","• Already exists"]})]})})]},_.id))}),m.jsx(Ns,{control:m.jsx(Ih,{checked:l,onChange:_=>u(_.target.checked)}),label:"Overwrite existing bridges"})]})]}),m.jsxs(Yd,{children:[m.jsx(Tt,{onClick:n,children:v?"Close":"Cancel"}),!v&&m.jsx(Tt,{onClick:E,variant:"contained",disabled:y||s.size===0,children:y?"Importing...":`Import ${s.size} Bridge(s)`})]})]})}function Xke(e){return Qe("MuiCardActionArea",e)}const z4=tt("MuiCardActionArea",["root","focusVisible","focusHighlight"]),Jke=e=>{const{classes:t}=e;return Ze({root:["root"],focusHighlight:["focusHighlight"]},Xke,t)},Qke=me(ma,{name:"MuiCardActionArea",slot:"Root"})(qe(({theme:e})=>({display:"block",textAlign:"inherit",borderRadius:"inherit",width:"100%",[`&:hover .${z4.focusHighlight}`]:{opacity:(e.vars||e).palette.action.hoverOpacity,"@media (hover: none)":{opacity:0}},[`&.${z4.focusVisible} .${z4.focusHighlight}`]:{opacity:(e.vars||e).palette.action.focusOpacity}}))),Zke=me("span",{name:"MuiCardActionArea",slot:"FocusHighlight"})(qe(({theme:e})=>({overflow:"hidden",pointerEvents:"none",position:"absolute",top:0,right:0,bottom:0,left:0,borderRadius:"inherit",opacity:0,backgroundColor:"currentcolor",transition:e.transitions.create("opacity",{duration:e.transitions.duration.short})}))),Vg=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiCardActionArea"}),{children:i,className:o,focusVisibleClassName:s,slots:a={},slotProps:l={},...u}=r,c=r,f=Jke(c),h={slots:a,slotProps:l},[g,y]=ut("root",{elementType:Qke,externalForwardedProps:{...h,...u},shouldForwardComponentProp:!0,ownerState:c,ref:n,className:Oe(f.root,o),additionalProps:{focusVisibleClassName:Oe(s,f.focusVisible)}}),[b,v]=ut("focusHighlight",{elementType:Zke,externalForwardedProps:h,ownerState:c,className:f.focusHighlight});return m.jsxs(g,{...y,children:[i,m.jsx(b,{...v})]})}),A3="api/bridge-icons";async function e_e(e,t){const n=new FormData;n.append("icon",t);const r=await fetch(`${A3}/${e}`,{method:"POST",body:n});if(!r.ok){const i=await r.json();throw new Error(i.error||"Failed to upload icon")}return r.json()}async function t_e(e){const t=await fetch(`${A3}/${e}`,{method:"DELETE"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to delete icon")}}async function k3(e){return(await fetch(`${A3}/${e}`,{method:"HEAD"})).ok}function Z1(e){return`${A3}/${e}`}const PB={light:x3,switch:vM,climate:w3,cover:v3,fan:wM,lock:su,sensor:Q1,media_player:CM,vacuum:yM,remote:SM,humidifier:hM,speaker:S3,garage:bM,door:Ske,window:Vke,motion:xke,battery:uke,power:cke,camera:dke,default:fM},jB={light:x3,switch:vM,climate:w3,cover:v3,fan:wM,lock:su,sensor:Q1,binary_sensor:Q1,media_player:CM,vacuum:yM,remote:SM,humidifier:hM,input_boolean:Eke,input_button:py,button:py,scene:py,script:py,automation:py,speaker:S3,air_quality:YJ,garage:bM},$B={light:"warning.main",switch:"info.main",climate:"error.main",cover:"success.main",fan:"info.light",lock:"secondary.main",sensor:"primary.main",binary_sensor:"primary.main",media_player:"secondary.main",vacuum:"success.main",remote:"warning.main",humidifier:"info.main"},sQ=e=>e.filter.include.find(n=>n.type===Ar.Domain)?.value??null,n_e=e=>{const t=e.toLowerCase();if(t.includes("lamp")||t.includes("light")||t.includes("ljus"))return x3;if(t.includes("vacuum")||t.includes("dammsug"))return yM;if(t.includes("thermo")||t.includes("climate")||t.includes("värme"))return w3;if(t.includes("sensor"))return Q1;if(t.includes("cover")||t.includes("blind")||t.includes("rullgardin")||t.includes("jalousie"))return v3;if(t.includes("remote")||t.includes("fjärr"))return SM;if(t.includes("lock")||t.includes("lås"))return su;if(t.includes("fan")||t.includes("fläkt"))return wM;if(t.includes("tv")||t.includes("media"))return CM;if(t.includes("speaker")||t.includes("högtalare"))return S3;if(t.includes("switch")||t.includes("brytare"))return vM;if(t.includes("garage"))return bM},EM=e=>{if(e.icon&&PB[e.icon])return PB[e.icon];const t=sQ(e);if(t&&jB[t])return jB[t];const n=n_e(e.name);return n||(e.deviceCount===0?ss:fM)},AM=e=>{const t=sQ(e);return t&&$B[t]?$B[t]:e.deviceCount===0?"text.disabled":"primary.main"},r_e=({bridge:e})=>{const t=e.commissioning?.fabrics.length??0,n=EM(e),r=AM(e),[i,o]=O.useState(!1);return O.useEffect(()=>{k3(e.id).then(o)},[e.id]),m.jsx(er,{variant:"elevation",sx:{height:"100%",transition:"transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out","&:hover":{transform:"translateY(-4px)",boxShadow:4}},children:m.jsx(Vg,{component:Dc,to:jt.bridge(e.id),sx:{height:"100%"},children:m.jsx(gr,{children:m.jsxs(le,{display:"flex",alignItems:"flex-start",gap:2,children:[i?m.jsx(le,{component:"img",src:Z1(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:m.jsx(n,{sx:{fontSize:32}})}),m.jsxs(le,{flexGrow:1,minWidth:0,children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(re,{variant:"h6",component:"div",noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),m.jsx(mJ,{status:e.status})]}),m.jsxs(zt,{spacing:1,mb:2,children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(ss,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:[e.deviceCount," devices"]})]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(JX,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:[t," fabric",t!==1?"s":""]})]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(Q1,{sx:{fontSize:16,color:"text.secondary"}}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:["Port ",e.port]})]})]})]})]})})})})},i_e=({bridges:e})=>{const t=O.useMemo(()=>[...e].sort((n,r)=>n.name.localeCompare(r.name,void 0,{sensitivity:"base"})),[e]);return m.jsx(et,{container:!0,spacing:2,children:t.map(n=>m.jsx(et,{size:{xs:12,sm:6,lg:4},children:m.jsx(r_e,{bridge:n})},n.id))})},_3=O.createContext({}),kM=O.createContext({});function o_e(e){return Qe("MuiStep",e)}tt("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);const s_e=e=>{const{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return Ze({root:["root",n,r&&"alternativeLabel",i&&"completed"]},o_e,t)},a_e=me("div",{name:"MuiStep",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({variants:[{props:{orientation:"horizontal"},style:{paddingLeft:8,paddingRight:8}},{props:{alternativeLabel:!0},style:{flex:1,position:"relative"}}]}),l_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStep"}),{active:i,children:o,className:s,component:a="div",completed:l,disabled:u,expanded:c=!1,index:f,last:h,...g}=r,{activeStep:y,connector:b,alternativeLabel:v,orientation:S,nonLinear:C}=O.useContext(_3);let[w=!1,A=!1,E=!1]=[i,l,u];y===f?w=i!==void 0?i:!0:!C&&y>f?A=l!==void 0?l:!0:!C&&y<f&&(E=u!==void 0?u:!0);const _=O.useMemo(()=>({index:f,last:h,expanded:c,icon:f+1,active:w,completed:A,disabled:E}),[f,h,c,w,A,E]),D={...r,active:w,orientation:S,alternativeLabel:v,completed:A,disabled:E,expanded:c,component:a},T=s_e(D),M=m.jsxs(a_e,{as:a,className:Oe(T.root,s),ref:n,ownerState:D,...g,children:[b&&v&&f!==0?b:null,o]});return m.jsx(kM.Provider,{value:_,children:b&&!v&&f!==0?m.jsxs(O.Fragment,{children:[b,M]}):M})}),u_e=De(m.jsx("path",{d:"M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z"})),c_e=De(m.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function d_e(e){return Qe("MuiStepIcon",e)}const U4=tt("MuiStepIcon",["root","active","completed","error","text"]);var NB;const f_e=e=>{const{classes:t,active:n,completed:r,error:i}=e;return Ze({root:["root",n&&"active",r&&"completed",i&&"error"],text:["text"]},d_e,t)},H4=me(OC,{name:"MuiStepIcon",slot:"Root"})(qe(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${U4.completed}`]:{color:(e.vars||e).palette.primary.main},[`&.${U4.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${U4.error}`]:{color:(e.vars||e).palette.error.main}}))),h_e=me("text",{name:"MuiStepIcon",slot:"Text"})(qe(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),p_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepIcon"}),{active:i=!1,className:o,completed:s=!1,error:a=!1,icon:l,...u}=r,c={...r,active:i,completed:s,error:a},f=f_e(c);if(typeof l=="number"||typeof l=="string"){const h=Oe(o,f.root);return a?m.jsx(H4,{as:c_e,className:h,ref:n,ownerState:c,...u}):s?m.jsx(H4,{as:u_e,className:h,ref:n,ownerState:c,...u}):m.jsxs(H4,{className:h,ref:n,ownerState:c,...u,children:[NB||(NB=m.jsx("circle",{cx:"12",cy:"12",r:"12"})),m.jsx(h_e,{className:f.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:c,children:l})]})}return l});function m_e(e){return Qe("MuiStepLabel",e)}const Od=tt("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),g_e=e=>{const{classes:t,orientation:n,active:r,completed:i,error:o,disabled:s,alternativeLabel:a}=e;return Ze({root:["root",n,o&&"error",s&&"disabled",a&&"alternativeLabel"],label:["label",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],iconContainer:["iconContainer",r&&"active",i&&"completed",o&&"error",s&&"disabled",a&&"alternativeLabel"],labelContainer:["labelContainer",a&&"alternativeLabel"]},m_e,t)},y_e=me("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:"flex",alignItems:"center",[`&.${Od.alternativeLabel}`]:{flexDirection:"column"},[`&.${Od.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),b_e=me("span",{name:"MuiStepLabel",slot:"Label"})(qe(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${Od.active}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Od.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Od.alternativeLabel}`]:{marginTop:16},[`&.${Od.error}`]:{color:(e.vars||e).palette.error.main}}))),v_e=me("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${Od.alternativeLabel}`]:{paddingRight:0}}),x_e=me("span",{name:"MuiStepLabel",slot:"LabelContainer"})(qe(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${Od.alternativeLabel}`]:{textAlign:"center"}}))),aQ=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepLabel"}),{children:i,className:o,componentsProps:s={},error:a=!1,icon:l,optional:u,slots:c={},slotProps:f={},StepIconComponent:h,StepIconProps:g,...y}=r,{alternativeLabel:b,orientation:v}=O.useContext(_3),{active:S,disabled:C,completed:w,icon:A}=O.useContext(kM),E=l||A;let _=h;E&&!_&&(_=p_e);const D={...r,active:S,alternativeLabel:b,completed:w,disabled:C,error:a,orientation:v},T=g_e(D),M={slots:c,slotProps:{stepIcon:g,...s,...f}},[L,j]=ut("root",{elementType:y_e,externalForwardedProps:{...M,...y},ownerState:D,ref:n,className:Oe(T.root,o)}),[I,N]=ut("label",{elementType:b_e,externalForwardedProps:M,ownerState:D}),[$,z]=ut("stepIcon",{elementType:_,externalForwardedProps:M,ownerState:D});return m.jsxs(L,{...j,children:[E||$?m.jsx(v_e,{className:T.iconContainer,ownerState:D,children:m.jsx($,{completed:w,active:S,error:a,icon:E,...z})}):null,m.jsxs(x_e,{className:T.labelContainer,ownerState:D,children:[i?m.jsx(I,{...N,className:Oe(T.label,N?.className),children:i}):null,u]})]})});aQ.muiName="StepLabel";function S_e(e){return Qe("MuiStepper",e)}tt("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);function w_e(e){return Qe("MuiStepConnector",e)}tt("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);const C_e=e=>{const{classes:t,orientation:n,alternativeLabel:r,active:i,completed:o,disabled:s}=e,a={root:["root",n,r&&"alternativeLabel",i&&"active",o&&"completed",s&&"disabled"],line:["line",`line${ye(n)}`]};return Ze(a,w_e,t)},E_e=me("div",{name:"MuiStepConnector",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.completed&&t.completed]}})({flex:"1 1 auto",variants:[{props:{orientation:"vertical"},style:{marginLeft:12}},{props:{alternativeLabel:!0},style:{position:"absolute",top:12,left:"calc(-50% + 20px)",right:"calc(50% + 20px)"}}]}),A_e=me("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.line,t[`line${ye(n.orientation)}`]]}})(qe(({theme:e})=>{const t=e.palette.mode==="light"?e.palette.grey[400]:e.palette.grey[600];return{display:"block",borderColor:e.vars?e.vars.palette.StepConnector.border:t,variants:[{props:{orientation:"horizontal"},style:{borderTopStyle:"solid",borderTopWidth:1}},{props:{orientation:"vertical"},style:{borderLeftStyle:"solid",borderLeftWidth:1,minHeight:24}}]}})),k_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepConnector"}),{className:i,...o}=r,{alternativeLabel:s,orientation:a="horizontal"}=O.useContext(_3),{active:l,disabled:u,completed:c}=O.useContext(kM),f={...r,alternativeLabel:s,orientation:a,active:l,completed:c,disabled:u},h=C_e(f);return m.jsx(E_e,{className:Oe(h.root,i),ref:n,ownerState:f,...o,children:m.jsx(A_e,{className:h.line,ownerState:f})})}),__e=e=>{const{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return Ze({root:["root",t,n&&"nonLinear",r&&"alternativeLabel"]},S_e,i)},D_e=me("div",{name:"MuiStepper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.alternativeLabel&&t.alternativeLabel,n.nonLinear&&t.nonLinear]}})({display:"flex",variants:[{props:{orientation:"horizontal"},style:{flexDirection:"row",alignItems:"center"}},{props:{orientation:"vertical"},style:{flexDirection:"column"}},{props:{alternativeLabel:!0},style:{alignItems:"flex-start"}}]}),O_e=m.jsx(k_e,{}),T_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiStepper"}),{activeStep:i=0,alternativeLabel:o=!1,children:s,className:a,component:l="div",connector:u=O_e,nonLinear:c=!1,orientation:f="horizontal",...h}=r,g={...r,nonLinear:c,alternativeLabel:o,orientation:f,component:l},y=__e(g),b=O.Children.toArray(s).filter(Boolean),v=b.map((C,w)=>O.cloneElement(C,{index:w,last:w+1===b.length,...C.props})),S=O.useMemo(()=>({activeStep:i,alternativeLabel:o,connector:u,nonLinear:c,orientation:f}),[i,o,u,c,f]);return m.jsx(_3.Provider,{value:S,children:m.jsx(D_e,{as:l,ownerState:g,className:Oe(y.root,a),ref:n,...h,children:v})})}),LB={light:"💡",switch:"🔌",sensor:"📊",climate:"🌡️",lock:"🔒",vacuum:"🤖",media_player:"🎵",cover:"🪟",remote:"⚡",default:"🏠"};function lQ({selectedTemplate:e,onSelect:t}){return m.jsxs(le,{children:[m.jsx(re,{variant:"subtitle1",gutterBottom:!0,fontWeight:600,children:"Start from a Template (optional)"}),m.jsx(re,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"Choose a preset to pre-fill the bridge configuration with recommended settings. You can customize everything afterwards."}),m.jsx(et,{container:!0,spacing:1.5,children:pJ.map(n=>{const r=e===n.id;return m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(er,{variant:"outlined",sx:{height:"100%",borderColor:r?"primary.main":"divider",borderWidth:r?2:1,bgcolor:r?"action.selected":"background.paper",transition:"all 0.15s ease"},children:m.jsx(Vg,{onClick:()=>t(r?null:n),sx:{height:"100%",p:0},children:m.jsxs(gr,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[m.jsx(re,{fontSize:20,children:LB[n.icon]??LB.default}),m.jsx(re,{variant:"subtitle2",sx:{flexGrow:1},children:n.name}),r&&m.jsx(Rc,{color:"primary",sx:{fontSize:18}})]}),m.jsx(re,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.description}),n.featureFlags?.serverMode&&m.jsx(Ct,{label:"Server Mode",size:"small",color:"warning",variant:"outlined",sx:{mt:.5,height:20,fontSize:"0.65rem"}}),n.featureFlags?.autoForceSync&&m.jsx(Ct,{label:"Auto Force Sync",size:"small",color:"info",variant:"outlined",sx:{mt:.5,ml:.5,height:20,fontSize:"0.65rem"}})]})})})},n.id)})})]})}const V4=["Template","Bridge Info","Entity Filter","Feature Flags","Review & Create"],R_e=[{key:"autoComposedDevices",label:"Auto Compose Devices",description:"Combine related entities (battery, humidity, pressure, power, energy) from the same HA device into a single Matter endpoint."},{key:"autoForceSync",label:"Auto Force Sync",description:"Periodically push all device states to controllers. Recommended for Google Home and Alexa to prevent devices from going offline."},{key:"coverSwapOpenClose",label:"Invert Cover Direction",description:"Swap open/close direction for covers. Use this if your covers show the wrong position in Matter controllers."},{key:"includeHiddenEntities",label:"Include Hidden Entities",description:"Also expose entities that are marked as hidden in Home Assistant."}];function uQ({open:e,onClose:t,onComplete:n}){const[r,i]=O.useState(0),[o,s]=O.useState(!1),[a,l]=O.useState(5540),[u,c]=O.useState([]),[f,h]=O.useState(),[g,y]=O.useState({name:"",port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[b,v]=O.useState(!0),[S,C]=O.useState("*"),[w,A]=O.useState(""),[E,_]=O.useState(null),D=O.useCallback(async()=>{try{const H=await fetch("api/matter/next-port");if(H.ok){const X=await H.json();l(X.port),y(B=>({...B,port:X.port}))}}catch{}},[]);O.useEffect(()=>{e&&(D(),i(0),c([]),h(void 0),y({name:"",port:a,serverMode:!1,filter:{include:[],exclude:[]}}),v(!0),C("*"),A(""),_(null))},[e,D,a]);const T=O.useCallback(H=>{if(h(H??void 0),H){y(W=>({...W,name:H.name,serverMode:H.featureFlags?.serverMode??!1,icon:H.icon,featureFlags:H.featureFlags,filter:{...H.filter}}));const X=H.filter.include;if(X.length>0)if(v(!1),H.featureFlags?.serverMode){const W=X.map(Y=>Y.type===Ar.Domain?`${Y.value}.*`:Y.value);C(W.join(", "))}else C(X.map(W=>W.value).join(", "));const B=H.filter.exclude;A(B.map(W=>W.value).join(", "))}else y(X=>({...X,name:"",serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),v(!0),C("*"),A("")},[]),M=()=>{if(r===0&&_(null),r===1){if(!g.name.trim()){_("Please enter a bridge name");return}_(null)}if(r===2){let H,X;if(f&&!g.serverMode)H=[...f.filter.include],X=[...f.filter.exclude];else{const B=b?[S||"*"]:S.split(",").map(Y=>Y.trim()).filter(Boolean),W=w.split(",").map(Y=>Y.trim()).filter(Boolean);H=B.map(Y=>({type:Ar.Pattern,value:Y})),X=W.map(Y=>({type:Ar.Pattern,value:Y}))}y(B=>({...B,filter:{include:H,exclude:X}}))}i(H=>H+1)},L=()=>{i(H=>H-1),_(null)},j=async()=>{await I();const H=a+u.length+1;c(X=>[...X,g]),h(void 0),y({name:"",port:H,serverMode:!1,filter:{include:[],exclude:[]}}),i(0),v(!0),C("*"),A("")},I=async()=>{s(!0),_(null);try{const H={...g.featureFlags,...g.serverMode?{serverMode:!0}:{}},X=Object.keys(H).length>0,B={name:g.name,port:g.port,filter:g.filter,featureFlags:X?H:void 0,icon:g.icon};return await DX(B),!0}catch(H){return _(H instanceof Error?H.message:"Failed to create bridge"),!1}finally{s(!1)}},N=async()=>{await I()&&(n(),t())},$=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:"Choose a template to get started quickly, or skip to create a custom bridge."}),m.jsx(le,{sx:{mt:2},children:m.jsx(lQ,{selectedTemplate:f?.id,onSelect:T})})]}),z=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:f?`Template "${f.name}" applied. Customize the name and port below.`:"Give your bridge a name and port."}),m.jsx(zr,{fullWidth:!0,label:"Bridge Name",value:g.name,onChange:H=>y(X=>({...X,name:H.target.value})),margin:"normal",placeholder:"e.g., Living Room, Kitchen, All Lights",error:!!E,helperText:E}),m.jsx(zr,{fullWidth:!0,label:"Port",type:"number",value:g.port,onChange:H=>y(X=>({...X,port:parseInt(H.target.value,10)||5540})),margin:"normal",helperText:"Automatically assigned to next available port"}),m.jsx(bn,{title:"Required for Robot Vacuums to work with Apple Home (Siri) and Alexa. Server Mode bridges support only ONE device.",placement:"right",children:m.jsx(Ns,{control:m.jsx(Wl,{checked:g.serverMode,onChange:H=>y(X=>({...X,serverMode:H.target.checked})),icon:m.jsx(Bw,{}),checkedIcon:m.jsx(Bw,{color:"primary"})}),label:"Server Mode (for Robot Vacuums)",sx:{mt:1}})}),g.serverMode&&m.jsxs(kn,{severity:"info",sx:{mt:1},children:[m.jsx("strong",{children:"Server Mode enabled:"})," This bridge will expose a single device as a standalone Matter device. Add only ONE device (e.g., your vacuum) to this bridge. This is required for Apple Home Siri commands and Alexa discovery."]}),u.length>0&&m.jsxs(le,{sx:{mt:2},children:[m.jsxs(re,{variant:"subtitle2",color:"text.secondary",children:["Bridges to create (",u.length,"):"]}),m.jsx(le,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:u.map(H=>m.jsx(Ct,{label:`${H.name} (:${H.port})`,size:"small"},H.port))})]})]}),F=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:f?`Filter is pre-configured from the "${f.name}" template. You can adjust it below.`:"Configure which entities should be included in this bridge."}),g.serverMode&&m.jsxs(kn,{severity:"warning",sx:{mt:1,mb:1},children:["Server Mode requires exactly ",m.jsx("strong",{children:"one"})," entity. Change the filter to match only your device (e.g., ",m.jsx("code",{children:"vacuum.my_vacuum"}),")."]}),!f&&m.jsx(Ns,{control:m.jsx(Ih,{checked:b,onChange:H=>v(H.target.checked)}),label:"Include all entities (wildcard)"}),m.jsx(zr,{fullWidth:!0,label:g.serverMode?"Entity ID":b&&!f?"Include Pattern":"Entity Filters",value:f&&!g.serverMode?f.filter.include.map(H=>`${H.type}:${H.value}`).join(", "):S,onChange:H=>C(H.target.value),margin:"normal",placeholder:b?"* or light.*, switch.*":"light.living_room, switch.kitchen",helperText:g.serverMode?"Server Mode supports only ONE device. Enter the exact entity ID (e.g., vacuum.my_vacuum).":f?"Pre-configured by template. Edit in the full editor after creation.":b?"Use * for all, or patterns like light.*, switch.*":"Enter specific entity IDs separated by commas",disabled:!!f&&!g.serverMode}),!f&&m.jsx(zr,{fullWidth:!0,label:"Exclude Patterns (optional)",value:w,onChange:H=>A(H.target.value),margin:"normal",placeholder:"sensor.*, binary_sensor.*",helperText:"Patterns to exclude, comma-separated"})]}),G=()=>m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:"Configure optional feature flags for this bridge."}),R_e.map(H=>m.jsxs(le,{sx:{mt:1},children:[m.jsx(Ns,{control:m.jsx(Ih,{checked:g.featureFlags?.[H.key]===!0,onChange:X=>y(B=>({...B,featureFlags:{...B.featureFlags,[H.key]:X.target.checked}}))}),label:H.label}),m.jsx(re,{variant:"caption",color:"text.secondary",display:"block",sx:{ml:7,mt:-.5},children:H.description})]},H.key))]}),V=()=>{const H=Object.entries(g.featureFlags??{}).filter(([,X])=>X===!0);return m.jsxs(le,{sx:{mt:2},children:[m.jsx(re,{variant:"body1",gutterBottom:!0,children:"Review your bridge configuration:"}),m.jsx(er,{variant:"outlined",sx:{mt:2},children:m.jsxs(gr,{children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:1,mb:1,children:[m.jsx(ss,{}),m.jsx(re,{variant:"h6",children:g.name})]}),m.jsxs(re,{variant:"body2",color:"text.secondary",children:["Port: ",g.port]}),f&&m.jsx(Ct,{label:`Template: ${f.name}`,size:"small",color:"info",variant:"outlined",sx:{mt:1,mr:.5}}),g.serverMode&&m.jsx(Ct,{icon:m.jsx(Bw,{}),label:"Server Mode",color:"primary",size:"small",sx:{mt:1}}),H.length>0&&m.jsx(le,{display:"flex",gap:.5,flexWrap:"wrap",mt:1,children:H.filter(([X])=>X!=="serverMode").map(([X])=>m.jsx(Ct,{label:X,size:"small",variant:"outlined",sx:{fontSize:"0.7rem",height:22}},X))}),m.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["Include:"," ",g.filter.include.length>0?g.filter.include.map(X=>`${X.type}:${X.value}`).join(", "):S||"*"]}),E&&m.jsx(re,{variant:"body2",color:"error",sx:{mt:1},children:E}),(w||g.filter.exclude.length>0)&&m.jsxs(re,{variant:"body2",color:"text.secondary",children:["Exclude:"," ",g.filter.exclude.length>0?g.filter.exclude.map(X=>X.value).join(", "):w]})]})}),u.length>0&&m.jsx(le,{sx:{mt:2},children:m.jsxs(re,{variant:"subtitle2",children:[u.length," bridge(s) already created in this session"]})})]})};return m.jsxs(vc,{open:e,onClose:t,maxWidth:"md",fullWidth:!0,children:[m.jsx(Sc,{children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(C3,{}),m.jsx("span",{children:"Bridge Setup Wizard"})]})}),m.jsxs(xc,{children:[m.jsx(T_e,{activeStep:r,sx:{mt:1},children:V4.map(H=>m.jsx(l_e,{children:m.jsx(aQ,{children:H})},H))}),r===0&&$(),r===1&&z(),r===2&&F(),r===3&&G(),r===4&&V()]}),m.jsxs(Yd,{sx:{px:3,pb:2},children:[m.jsx(Tt,{onClick:t,disabled:o,children:"Cancel"}),m.jsx(le,{sx:{flex:1}}),r>0&&m.jsx(Tt,{onClick:L,startIcon:m.jsx(oke,{}),disabled:o,children:"Back"}),r<V4.length-1&&m.jsx(Tt,{variant:"contained",onClick:M,endIcon:m.jsx(ake,{}),disabled:o,children:r===0&&!f?"Skip Template":"Next"}),r===V4.length-1&&m.jsxs(m.Fragment,{children:[m.jsx(Tt,{variant:"outlined",onClick:j,startIcon:m.jsx(fu,{}),disabled:o,children:"Add Another"}),m.jsx(Tt,{variant:"contained",onClick:N,startIcon:o?m.jsx(Ur,{size:16}):m.jsx(hke,{}),disabled:o,children:o?"Creating...":"Create Bridge"})]})]})]})}const I_e=()=>{const e=Tc(),t=zs(),{content:n,isLoading:r,error:i}=Hg(),[o,s]=O.useState(null),[a,l]=O.useState(!1),[u,c]=O.useState(!1),[f,h]=O.useState(!1),g=O.useRef(null),y=O.useCallback(async()=>{try{await Wke()}catch(A){e.show({message:A instanceof Error?A.message:"Export failed",severity:"error"})}},[e]),b=O.useCallback(()=>{g.current?.click()},[]),v=O.useCallback(A=>{const E=A.target.files?.[0];E&&(s(E),l(!0)),A.target.value=""},[]),S=O.useCallback(()=>{l(!1),s(null)},[]),C=O.useCallback(()=>{t(Fo())},[t]),w=O.useCallback(async A=>{h(!0);try{const E={start:"Started",stop:"Stopped",restart:"Restarted"},D=await{start:lbe,stop:ube,restart:cbe}[A]();e.show({message:`${E[A]} ${D.count} bridge(s)`,severity:"success"}),t(Fo())}catch(E){e.show({message:E instanceof Error?E.message:`${A} failed`,severity:"error"})}finally{h(!1)}},[e,t]);return O.useEffect(()=>{i&&e.show({message:i.message??"Could not load bridges",severity:"error"})},[i,e]),m.jsxs(m.Fragment,{children:[m.jsx(KI,{sx:A=>({zIndex:A.zIndex.drawer+1}),open:r||f,children:(r||f)&&m.jsx(Ur,{color:"inherit"})}),m.jsx(zt,{spacing:4,children:n&&m.jsxs(m.Fragment,{children:[m.jsxs(le,{display:"flex",justifyContent:"end",flexWrap:"wrap",gap:1,paddingTop:{xs:1,sm:0},children:[n.length>=1&&m.jsxs(m.Fragment,{children:[m.jsx(Tt,{onClick:()=>w("start"),startIcon:m.jsx(Pke,{}),variant:"outlined",size:"small",color:"success",disabled:f,children:"Start All"}),m.jsx(Tt,{onClick:()=>w("stop"),startIcon:m.jsx($ke,{}),variant:"outlined",size:"small",color:"error",disabled:f,children:"Stop All"}),m.jsx(Tt,{onClick:()=>w("restart"),startIcon:m.jsx(eE,{}),variant:"outlined",size:"small",color:"warning",disabled:f,children:"Restart All"}),m.jsx(Di,{orientation:"vertical",flexItem:!0})]}),m.jsx(Tt,{onClick:b,startIcon:m.jsx(wke,{}),variant:"outlined",children:"Import"}),m.jsx(Tt,{onClick:y,startIcon:m.jsx(Uke,{}),variant:"outlined",disabled:n.length===0,children:"Export All"}),m.jsx(Tt,{onClick:()=>c(!0),startIcon:m.jsx(nQ,{}),variant:"outlined",children:"Wizard"}),m.jsx(Tt,{component:Dc,to:jt.createBridge,endIcon:m.jsx(fu,{}),variant:"outlined",children:"Create new bridge"}),m.jsx("input",{type:"file",ref:g,onChange:v,accept:".json",style:{display:"none"}})]}),m.jsx(i_e,{bridges:n})]})}),m.jsx(Yke,{open:a,file:o,onClose:S,onImported:C}),m.jsx(uQ,{open:u,onClose:()=>c(!1),onComplete:()=>t(Fo())})]})},M_e=e=>{const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`};function I2({title:e,value:t,icon:n,color:r,subtitle:i,onClick:o}){const s=m.jsx(gr,{sx:{py:2,"&:last-child":{pb:2}},children:m.jsxs(le,{display:"flex",sx:{flexDirection:{xs:"column",sm:"row"},alignItems:"center",gap:{xs:1,sm:2},textAlign:{xs:"center",sm:"left"}},children:[m.jsx(rl,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),m.jsxs(le,{sx:{minWidth:0},children:[m.jsx(re,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:"1.5rem",sm:"2.125rem"}},children:t}),m.jsx(re,{variant:"body2",color:"text.secondary",noWrap:!0,children:e}),i&&m.jsx(re,{variant:"caption",color:"text.secondary",noWrap:!0,children:i})]})]})});return m.jsx(er,{variant:"outlined",sx:{height:"100%"},children:o?m.jsx(Vg,{onClick:o,sx:{height:"100%"},children:s}):s})}function P_e({bridge:e,onClick:t}){const{content:n}=Hg(),r=n?.find(a=>a.id===e.id),[i,o]=O.useState(!1);O.useEffect(()=>{k3(e.id).then(o)},[e.id]);const s=e.status==="running"?"success":e.status==="failed"?"error":"default";return m.jsx(er,{variant:"outlined",children:m.jsx(Vg,{onClick:t,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1.5,children:[i?m.jsx(le,{component:"img",src:Z1(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:"50%",objectFit:"cover"}}):r&&m.jsx(rl,{sx:{bgcolor:AM(r),width:36,height:36},children:(()=>{const a=EM(r);return m.jsx(a,{sx:{fontSize:20}})})()}),m.jsxs(le,{flex:1,minWidth:0,children:[m.jsx(re,{variant:"subtitle2",noWrap:!0,children:e.name}),m.jsxs(zt,{direction:"row",spacing:.5,alignItems:"center",children:[m.jsx(Ct,{label:e.status,size:"small",color:s,sx:{height:18,fontSize:"0.65rem"}}),m.jsxs(re,{variant:"caption",color:"text.secondary",children:[e.deviceCount," devices"]}),e.fabricCount>0&&m.jsxs(re,{variant:"caption",color:"text.secondary",children:["· ",e.fabricCount," fabrics"]})]})]}),e.failedEntityCount>0&&m.jsx(Ct,{icon:m.jsx(r3,{sx:{fontSize:14}}),label:e.failedEntityCount,size:"small",color:"warning",variant:"outlined",sx:{height:22}})]})})})})}function Uf({title:e,icon:t,onClick:n}){return m.jsx(er,{variant:"outlined",children:m.jsx(Vg,{onClick:n,children:m.jsx(gr,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1.5,children:[m.jsx(rl,{sx:{bgcolor:"action.selected",color:"text.secondary",width:36,height:36},children:t}),m.jsx(re,{variant:"subtitle2",children:e})]})})})})}const j_e=()=>{const e=Xh(),t=zs(),[n,r]=O.useState(null),[i,o]=O.useState(!0),[s,a]=O.useState(!1),l=O.useCallback(async()=>{try{const y=await fetch("api/health/detailed");y.ok&&r(await y.json())}catch{}finally{o(!1)}},[]);O.useEffect(()=>{l();const y=setInterval(l,15e3);return()=>clearInterval(y)},[l]);const u=O.useMemo(()=>n?.bridgeDetails.reduce((y,b)=>y+b.deviceCount,0)??0,[n]),c=O.useMemo(()=>n?.bridgeDetails?n.bridgeDetails.reduce((y,b)=>y+b.fabricCount,0):0,[n]),f=O.useMemo(()=>n?.bridgeDetails.reduce((y,b)=>y+b.failedEntityCount,0)??0,[n]);if(i)return m.jsx(le,{display:"flex",justifyContent:"center",p:8,children:m.jsx(Ur,{})});const h=n?.services.bridges,g=n?.services.homeAssistant.connected??!1;return m.jsxs(le,{sx:{p:2},children:[m.jsxs(le,{display:"flex",alignItems:"center",gap:2,mb:3,children:[m.jsx(Y6,{color:"primary",fontSize:"large"}),m.jsx(re,{variant:"h5",fontWeight:600,children:"Dashboard"})]}),m.jsxs(Nr,{variant:"outlined",sx:{mb:3,p:2,bgcolor:"background.default"},children:[m.jsx(re,{variant:"caption",color:"text.secondary",sx:{mb:1,display:"block"},children:"Navigation"}),m.jsxs(et,{container:!0,spacing:1,children:[m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(Y6,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Dashboard"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(c1,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Bridges"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(ss,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"All Devices"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(QC,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Network Map"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(rg,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Startup Order"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(su,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Lock Credentials"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(ZC,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Filter Reference"})]})}),m.jsx(et,{size:{xs:6,sm:4,md:2},children:m.jsxs(le,{display:"flex",alignItems:"center",gap:1,children:[m.jsx(WC,{sx:{fontSize:18,color:"text.secondary"}}),m.jsx(re,{variant:"body2",children:"Health Dashboard"})]})})]})]}),m.jsxs(et,{container:!0,spacing:2,sx:{mb:3},children:[m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"Bridges",value:h?.total??0,icon:m.jsx(c1,{}),color:"#4caf50",subtitle:h?`${h.running} running${h.failed>0?` · ${h.failed} failed`:""}`:void 0,onClick:()=>e(jt.bridges)})}),m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"Devices",value:u,icon:m.jsx(ss,{}),color:"#2196f3",subtitle:f>0?`${f} failed`:void 0,onClick:()=>e(jt.devices)})}),m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"Fabrics",value:c,icon:m.jsx(J1,{}),color:"#9c27b0",onClick:()=>e(jt.networkMap)})}),m.jsx(et,{size:{xs:6,sm:3},children:m.jsx(I2,{title:"HA Connection",value:g?"Online":"Offline",icon:g?m.jsx(Rc,{}):m.jsx(gf,{}),color:g?"#4caf50":"#f44336",subtitle:n?.uptime!=null?`Uptime ${M_e(n.uptime)}`:void 0})})]}),m.jsx(Di,{sx:{mb:3}}),m.jsx(le,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,flexWrap:"wrap",gap:1,children:m.jsx(re,{variant:"h6",children:"Bridges"})}),m.jsxs(zt,{direction:"row",spacing:1.5,sx:{mb:2},flexWrap:"wrap",useFlexGap:!0,children:[m.jsx(Tt,{variant:"contained",startIcon:m.jsx(nQ,{}),onClick:()=>a(!0),size:"large",children:"Bridge Wizard"}),m.jsx(Tt,{variant:"outlined",startIcon:m.jsx(fu,{}),onClick:()=>e(jt.createBridge),size:"large",children:"Create Bridge"})]}),n?.bridgeDetails&&n.bridgeDetails.length>0?m.jsx(et,{container:!0,spacing:1.5,children:[...n.bridgeDetails].sort((y,b)=>y.name.localeCompare(b.name,void 0,{sensitivity:"base"})).map(y=>m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(P_e,{bridge:y,onClick:()=>e(jt.bridge(y.id))})},y.id))}):m.jsx(er,{variant:"outlined",children:m.jsx(gr,{sx:{textAlign:"center",py:4},children:m.jsx(re,{color:"text.secondary",children:"No bridges configured yet. Use the Bridge Wizard or create one manually."})})}),m.jsx(Di,{sx:{my:3}}),m.jsx(re,{variant:"h6",sx:{mb:2},children:"Quick Navigation"}),m.jsxs(et,{container:!0,spacing:1.5,children:[m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Bridges",icon:m.jsx(c1,{sx:{fontSize:20}}),onClick:()=>e(jt.bridges)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"All Devices",icon:m.jsx(ss,{sx:{fontSize:20}}),onClick:()=>e(jt.devices)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Network Map",icon:m.jsx(QC,{sx:{fontSize:20}}),onClick:()=>e(jt.networkMap)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Health Dashboard",icon:m.jsx(WC,{sx:{fontSize:20}}),onClick:()=>e(jt.health)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Startup Order",icon:m.jsx(rg,{sx:{fontSize:20}}),onClick:()=>e(jt.startup)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Lock Credentials",icon:m.jsx(su,{sx:{fontSize:20}}),onClick:()=>e(jt.lockCredentials)})}),m.jsx(et,{size:{xs:12,sm:6,md:4},children:m.jsx(Uf,{title:"Filter Reference",icon:m.jsx(ZC,{sx:{fontSize:20}}),onClick:()=>e(jt.labels)})})]}),m.jsx(uQ,{open:s,onClose:()=>a(!1),onComplete:()=>{t(Fo()),l()}})]})};function $_e(e){return Qe("MuiPagination",e)}tt("MuiPagination",["root","ul","outlined","text"]);function N_e(e={}){const{boundaryCount:t=1,componentName:n="usePagination",count:r=1,defaultPage:i=1,disabled:o=!1,hideNextButton:s=!1,hidePrevButton:a=!1,onChange:l,page:u,showFirstButton:c=!1,showLastButton:f=!1,siblingCount:h=1,...g}=e,[y,b]=Ka({controlled:u,default:i,name:n,state:"page"}),v=(M,L)=>{u||b(L),l&&l(M,L)},S=(M,L)=>{const j=L-M+1;return Array.from({length:j},(I,N)=>M+N)},C=S(1,Math.min(t,r)),w=S(Math.max(r-t+1,t+1),r),A=Math.max(Math.min(y-h,r-t-h*2-1),t+2),E=Math.min(Math.max(y+h,t+h*2+2),r-t-1),_=[...c?["first"]:[],...a?[]:["previous"],...C,...A>t+2?["start-ellipsis"]:t+1<r-t?[t+1]:[],...S(A,E),...E<r-t-1?["end-ellipsis"]:r-t>t?[r-t]:[],...w,...s?[]:["next"],...f?["last"]:[]],D=M=>{switch(M){case"first":return 1;case"previous":return y-1;case"next":return y+1;case"last":return r;default:return null}};return{items:_.map(M=>typeof M=="number"?{onClick:L=>{v(L,M)},type:"page",page:M,selected:M===y,disabled:o,"aria-current":M===y?"page":void 0}:{onClick:L=>{v(L,D(M))},type:M,page:D(M),selected:!1,disabled:o||!M.includes("ellipsis")&&(M==="next"||M==="last"?y>=r:y<=1)}),...g}}function L_e(e){return Qe("MuiPaginationItem",e)}const Ro=tt("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),F_e=De(m.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),B_e=De(m.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),z_e=De(m.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),U_e=De(m.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),cQ=(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ye(n.size)}`],n.variant==="text"&&t[`text${ye(n.color)}`],n.variant==="outlined"&&t[`outlined${ye(n.color)}`],n.shape==="rounded"&&t.rounded,n.type==="page"&&t.page,(n.type==="start-ellipsis"||n.type==="end-ellipsis")&&t.ellipsis,(n.type==="previous"||n.type==="next")&&t.previousNext,(n.type==="first"||n.type==="last")&&t.firstLast]},H_e=e=>{const{classes:t,color:n,disabled:r,selected:i,size:o,shape:s,type:a,variant:l}=e,u={root:["root",`size${ye(o)}`,l,s,n!=="standard"&&`color${ye(n)}`,n!=="standard"&&`${l}${ye(n)}`,r&&"disabled",i&&"selected",{page:"page",first:"firstLast",last:"firstLast","start-ellipsis":"ellipsis","end-ellipsis":"ellipsis",previous:"previousNext",next:"previousNext"}[a]],icon:["icon"]};return Ze(u,L_e,t)},V_e=me("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver:cQ})(qe(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,height:"auto",[`&.${Ro.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}}]}))),W_e=me(ma,{name:"MuiPaginationItem",slot:"Root",overridesResolver:cQ})(qe(({theme:e})=>({...e.typography.body2,borderRadius:32/2,textAlign:"center",boxSizing:"border-box",minWidth:32,height:32,padding:"0 6px",margin:"0 3px",color:(e.vars||e).palette.text.primary,[`&.${Ro.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Ro.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},transition:e.transitions.create(["color","background-color"],{duration:e.transitions.duration.short}),"&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Ro.selected}`]:{backgroundColor:(e.vars||e).palette.action.selected,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Ro.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${Ro.disabled}`]:{opacity:1,color:(e.vars||e).palette.action.disabled,backgroundColor:(e.vars||e).palette.action.selected}},variants:[{props:{size:"small"},style:{minWidth:26,height:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,height:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}},{props:{shape:"rounded"},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:{variant:"outlined"},style:{border:e.vars?`1px solid ${e.alpha(e.vars.palette.common.onBackground,.23)}`:`1px solid ${e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"}`,[`&.${Ro.selected}`]:{[`&.${Ro.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${Ro.selected}`]:{[`&.${Ro.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Ln(["dark","contrastText"])).map(([t])=>({props:{variant:"text",color:t},style:{[`&.${Ro.selected}`]:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}},[`&.${Ro.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${Ro.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Ln(["light"])).map(([t])=>({props:{variant:"outlined",color:t},style:{[`&.${Ro.selected}`]:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.5)}`,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.activatedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Ro.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),q_e=me("div",{name:"MuiPaginationItem",slot:"Icon"})(qe(({theme:e})=>({fontSize:e.typography.pxToRem(20),margin:"0 -8px",variants:[{props:{size:"small"},style:{fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{fontSize:e.typography.pxToRem(22)}}]}))),G_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiPaginationItem"}),{className:i,color:o="standard",component:s,components:a={},disabled:l=!1,page:u,selected:c=!1,shape:f="circular",size:h="medium",slots:g={},slotProps:y={},type:b="page",variant:v="text",...S}=r,C={...r,color:o,disabled:l,selected:c,shape:f,size:h,type:b,variant:v},w=ff(),A=H_e(C),E={slots:{previous:g.previous??a.previous,next:g.next??a.next,first:g.first??a.first,last:g.last??a.last},slotProps:y},[_,D]=ut("previous",{elementType:z_e,externalForwardedProps:E,ownerState:C}),[T,M]=ut("next",{elementType:U_e,externalForwardedProps:E,ownerState:C}),[L,j]=ut("first",{elementType:F_e,externalForwardedProps:E,ownerState:C}),[I,N]=ut("last",{elementType:B_e,externalForwardedProps:E,ownerState:C}),$=w?{previous:"next",next:"previous",first:"last",last:"first"}[b]:b,z={previous:_,next:T,first:L,last:I}[$],F={previous:D,next:M,first:j,last:N}[$];return b==="start-ellipsis"||b==="end-ellipsis"?m.jsx(V_e,{ref:n,ownerState:C,className:Oe(A.root,i),children:"…"}):m.jsxs(W_e,{ref:n,ownerState:C,component:s,disabled:l,className:Oe(A.root,i),...S,children:[b==="page"&&u,z?m.jsx(q_e,{...F,className:A.icon,as:z}):null]})}),K_e=e=>{const{classes:t,variant:n}=e;return Ze({root:["root",n],ul:["ul"]},$_e,t)},Y_e=me("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),X_e=me("ul",{name:"MuiPagination",slot:"Ul"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"});function J_e(e,t,n){return e==="page"?`${n?"":"Go to "}page ${t}`:`Go to ${e} page`}const Q_e=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiPagination"}),{boundaryCount:i=1,className:o,color:s="standard",count:a=1,defaultPage:l=1,disabled:u=!1,getItemAriaLabel:c=J_e,hideNextButton:f=!1,hidePrevButton:h=!1,onChange:g,page:y,renderItem:b=L=>m.jsx(G_e,{...L}),shape:v="circular",showFirstButton:S=!1,showLastButton:C=!1,siblingCount:w=1,size:A="medium",variant:E="text",..._}=r,{items:D}=N_e({...r,componentName:"Pagination"}),T={...r,boundaryCount:i,color:s,count:a,defaultPage:l,disabled:u,getItemAriaLabel:c,hideNextButton:f,hidePrevButton:h,renderItem:b,shape:v,showFirstButton:S,showLastButton:C,siblingCount:w,size:A,variant:E},M=K_e(T);return m.jsx(Y_e,{"aria-label":"pagination navigation",className:Oe(M.root,o),ownerState:T,ref:n,..._,children:m.jsx(X_e,{className:M.ul,ownerState:T,children:D.map((L,j)=>m.jsx("li",{children:b({...L,color:s,"aria-label":c(L.type,L.page,L.selected),shape:v,size:A,variant:E})},j))})})}),FB=[10,25,50,100],BB="hamh-devices-page-size",Z_e=()=>{const e=zs(),{content:t,isLoading:n}=Hg(),[r,i]=O.useState(""),[o,s]=O.useState(""),[a,l]=O.useState(""),[u,c]=O.useState("name"),[f,h]=O.useState("asc"),[g,y]=O.useState(1),[b,v]=O.useState(()=>{const J=localStorage.getItem(BB);if(!J)return 12;if(J==="all")return 0;const Q=parseInt(J,10);return Q>0?Q:12}),[S,C]=O.useState(""),w=O.useCallback(J=>{v(J),localStorage.setItem(BB,J===0?"all":String(J)),y(1)},[]),[A,E]=O.useState(!1),[_,D]=O.useState(""),[T,M]=O.useState(""),[L,j]=O.useState(),[I,N]=O.useState({open:!1,message:"",severity:"success"});O.useEffect(()=>{e(Fo())},[e]),O.useEffect(()=>{t&&t.forEach(J=>{e(dc(J.id))})},[e,t]);const $=Bg(J=>J.devices.byBridge),z=O.useCallback((J,Q,ie)=>{const ue=[];if(!J.parts||J.parts.length===0)J.endpoint!==0&&ue.push({bridgeId:Q,bridgeName:ie,endpoint:J});else for(const te of J.parts)ue.push(...z(te,Q,ie));return ue},[]),F=O.useMemo(()=>{const J=[];return(t||[]).forEach(Q=>{const ue=$[Q.id]?.content;ue&&J.push(...z(ue,Q.id,Q.name))}),J},[t,$,z]),G=n||t&&t.length>0&&F.length===0,V=O.useMemo(()=>F.filter(J=>{const Q=Ps(J.endpoint.state)??J.endpoint.id.local,ie=J.endpoint.type.name,ue=Q.toLowerCase().includes(r.toLowerCase())||J.bridgeName.toLowerCase().includes(r.toLowerCase())||ie.toLowerCase().includes(r.toLowerCase()),te=!o||J.bridgeId===o;return ue&&te&&(!a||ie===a)}),[F,r,o,a]),H=O.useMemo(()=>[...V].sort((Q,ie)=>{const ue=Ps(Q.endpoint.state)??Q.endpoint.id.local,te=Ps(ie.endpoint.state)??ie.endpoint.id.local;let ne=0;switch(u){case"name":ne=ue.localeCompare(te);break;case"type":ne=Q.endpoint.type.name.localeCompare(ie.endpoint.type.name),ne===0&&(ne=ue.localeCompare(te));break;case"bridge":ne=Q.bridgeName.localeCompare(ie.bridgeName),ne===0&&(ne=ue.localeCompare(te));break}return f==="asc"?ne:-ne}),[V,u,f]),X=b===0?1:Math.ceil(H.length/b),B=b===0?H:H.slice((g-1)*b,g*b),W=O.useMemo(()=>{const J=new Set(F.map(Q=>Q.endpoint.type.name));return Array.from(J).sort()},[F]),Y=O.useMemo(()=>t?[...t].sort((J,Q)=>{const ie=J.name.localeCompare(Q.name);return f==="asc"?ie:-ie}):[],[t,f]),U=O.useCallback(()=>{e(Fo())},[e]),K=O.useCallback(async(J,Q)=>{D(J),M(Q);try{const ue=(await oM(Q)).mappings.find(te=>te.entityId===J);j(ue)}catch{j(void 0)}E(!0)},[]),Z=O.useCallback(async J=>{if(!(!T||!_))try{await sM(T,_,J),N({open:!0,message:`Mapping saved for ${_}. Restart the bridge to apply changes.`,severity:"success"}),E(!1)}catch(Q){N({open:!0,message:`Failed to save mapping: ${Q}`,severity:"error"})}},[T,_]);return G?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(Ur,{})}):m.jsxs(le,{sx:{p:2},children:[m.jsxs(re,{variant:"h4",gutterBottom:!0,sx:{display:"flex",alignItems:"center",gap:2},children:[m.jsx(ss,{}),"All Devices",m.jsx(Tt,{variant:"outlined",startIcon:m.jsx(xM,{}),onClick:U,sx:{ml:"auto"},children:"Refresh"})]}),m.jsx(er,{sx:{mb:3},children:m.jsx(gr,{children:m.jsxs(zt,{spacing:2,direction:{xs:"column",md:"row"},alignItems:{md:"center"},children:[m.jsx(zr,{label:"Search devices...",value:r,onChange:J=>i(J.target.value),sx:{flexGrow:1}}),m.jsxs(Xa,{sx:{minWidth:200},children:[m.jsx(cc,{children:"Bridge"}),m.jsxs(Ha,{value:o,label:"Bridge",onChange:J=>s(J.target.value),children:[m.jsx(rr,{value:"",children:"All Bridges"}),Y.map(J=>m.jsx(rr,{value:J.id,children:J.name},J.id))]})]}),m.jsxs(Xa,{sx:{minWidth:200},children:[m.jsx(cc,{children:"Device Type"}),m.jsxs(Ha,{value:a,label:"Device Type",onChange:J=>l(J.target.value),children:[m.jsx(rr,{value:"",children:"All Types"}),W.map(J=>m.jsx(rr,{value:J,children:J},J))]})]}),m.jsxs(Xa,{sx:{minWidth:150},children:[m.jsx(cc,{children:"Sort By"}),m.jsxs(Ha,{value:u,label:"Sort By",onChange:J=>c(J.target.value),children:[m.jsx(rr,{value:"bridge",children:"Bridge"}),m.jsx(rr,{value:"type",children:"Device Type"}),m.jsx(rr,{value:"name",children:"Name"})]})]}),m.jsx(bn,{title:f==="asc"?"Ascending":"Descending",children:m.jsx(Fn,{onClick:()=>h(J=>J==="asc"?"desc":"asc"),color:"primary",children:f==="asc"?m.jsx(gM,{}):m.jsx(mM,{})})})]})})}),m.jsx(et,{container:!0,spacing:2,children:B.map(J=>m.jsx(et,{size:{xs:12,sm:6,lg:4},children:m.jsx(RJ,{endpoint:J.endpoint,bridgeName:J.bridgeName,bridgeId:J.bridgeId,onEditMapping:K})},`${J.bridgeId}-${J.endpoint.id.global}`))}),m.jsxs(le,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:3,gap:2,flexWrap:"wrap"},children:[m.jsxs(zt,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:"Per page:"}),m.jsxs(Ha,{value:b===0?"all":FB.includes(b)?String(b):"",onChange:J=>{const Q=J.target.value;C(""),w(Q==="all"?0:parseInt(Q,10))},displayEmpty:!0,renderValue:J=>J==="all"?"All":J===""?String(b):J,size:"small",sx:{minWidth:80},children:[FB.map(J=>m.jsx(rr,{value:String(J),children:J},J)),m.jsx(rr,{value:"all",children:"All"})]}),m.jsx(zr,{size:"small",type:"number",placeholder:"Custom",value:S,onChange:J=>C(J.target.value),onBlur:()=>{const J=parseInt(S,10);J>0&&w(J),C("")},onKeyDown:J=>{if(J.key==="Enter"){const Q=parseInt(S,10);Q>0&&w(Q),C("")}},slotProps:{htmlInput:{min:1,style:{textAlign:"center"}}},sx:{width:80}})]}),X>1&&m.jsx(Q_e,{count:X,page:g,onChange:(J,Q)=>y(Q),color:"primary"}),m.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:V.length===F.length?`${F.length} device${F.length!==1?"s":""}`:`${V.length} of ${F.length} devices`})]}),V.length===0&&m.jsxs(le,{sx:{textAlign:"center",py:8},children:[m.jsx(re,{variant:"h6",color:"text.secondary",children:"No devices found"}),m.jsx(re,{variant:"body2",color:"text.secondary",children:"Try adjusting your filters or check if any bridges are running"})]}),m.jsx(lM,{open:A,entityId:_,domain:_.split(".")[0]||"",currentMapping:L,onSave:Z,onClose:()=>E(!1)}),m.jsx(MI,{open:I.open,autoHideDuration:6e3,onClose:()=>N(J=>({...J,open:!1})),children:m.jsx(kn,{onClose:()=>N(J=>({...J,open:!1})),severity:I.severity,sx:{width:"100%"},children:I.message})})]})};function fn(e){return typeof e!="object"||e===null||typeof e.lastModified=="number"&&typeof File<"u"&&e instanceof File||typeof e.getMonth=="function"&&typeof Date<"u"&&e instanceof Date?!1:!Array.isArray(e)}function e5e(e){return e.additionalItems===!0&&console.warn("additionalItems=true is currently not supported"),fn(e.additionalItems)}function zB(e){if(e==="")return;if(e===null)return null;if(/\.$/.test(e)||/\.0$/.test(e)||/\.\d*0$/.test(e))return e;const t=Number(e);return typeof t=="number"&&!Number.isNaN(t)?t:e}const fc="__additional_property",eb="additionalProperties",wc="allOf",Mn="anyOf",ba="const",D3="default",_M="dependencies",t5e="enum",po="__errors",pr="$id",DM="if",Mh="items",n5e="_$junk_option_schema_id$_",zw="$name",nn="oneOf",X6="patternProperties",Hn="properties",W4="readonly",dQ="required",nE="submitButtonOptions",mr="$ref",zy="$schema",fQ="root",hQ="_",r5e=["discriminator","propertyName"],UB="formContext",i5e="layoutGridLookupMap",OM="__rjsf_additionalProperties",pQ="__rjsf_rootSchema",o5e="ui:field",TM="ui:widget",jd="ui:options",J6="ui:globalOptions",s5e="ui:definitions",a5e="https://json-schema.org/draft/2019-09/schema",Uw="https://json-schema.org/draft/2020-12/schema";function $t(e={},t={}){return e?Object.keys(e).filter(n=>n.indexOf("ui:")===0).reduce((n,r)=>{const i=e[r];return r===TM&&fn(i)?(console.error("Setting options via ui:widget object is no longer supported, use ui:options instead"),n):r===jd&&fn(i)?{...n,...i}:{...n,[r.substring(3)]:i}},{...t}):{...t}}function mQ(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;const{expandable:r=!0}=$t(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var gQ=typeof global=="object"&&global&&global.Object===Object&&global,l5e=typeof self=="object"&&self&&self.Object===Object&&self,vu=gQ||l5e||Function("return this")(),va=vu.Symbol,yQ=Object.prototype,u5e=yQ.hasOwnProperty,c5e=yQ.toString,my=va?va.toStringTag:void 0;function d5e(e){var t=u5e.call(e,my),n=e[my];try{e[my]=void 0;var r=!0}catch{}var i=c5e.call(e);return r&&(t?e[my]=n:delete e[my]),i}var f5e=Object.prototype,h5e=f5e.toString;function p5e(e){return h5e.call(e)}var m5e="[object Null]",g5e="[object Undefined]",HB=va?va.toStringTag:void 0;function Ic(e){return e==null?e===void 0?g5e:m5e:HB&&HB in Object(e)?d5e(e):p5e(e)}function bQ(e,t){return function(n){return e(t(n))}}var O3=bQ(Object.getPrototypeOf,Object);function xa(e){return e!=null&&typeof e=="object"}var y5e="[object Object]",b5e=Function.prototype,v5e=Object.prototype,vQ=b5e.toString,x5e=v5e.hasOwnProperty,S5e=vQ.call(Object);function Xd(e){if(!xa(e)||Ic(e)!=y5e)return!1;var t=O3(e);if(t===null)return!0;var n=x5e.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&vQ.call(n)==S5e}function Q6(e){const t={[po]:[],addError(n){this[po].push(n)}};if(Array.isArray(e))return e.reduce((n,r,i)=>({...n,[i]:Q6(r)}),t);if(Xd(e)){const n=e;return Object.keys(n).reduce((r,i)=>({...r,[i]:Q6(n[i])}),t)}return t}function w5e(){this.__data__=[],this.size=0}function vv(e,t){return e===t||e!==e&&t!==t}function T3(e,t){for(var n=e.length;n--;)if(vv(e[n][0],t))return n;return-1}var C5e=Array.prototype,E5e=C5e.splice;function A5e(e){var t=this.__data__,n=T3(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():E5e.call(t,n,1),--this.size,!0}function k5e(e){var t=this.__data__,n=T3(t,e);return n<0?void 0:t[n][1]}function _5e(e){return T3(this.__data__,e)>-1}function D5e(e,t){var n=this.__data__,r=T3(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Mc(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Mc.prototype.clear=w5e;Mc.prototype.delete=A5e;Mc.prototype.get=k5e;Mc.prototype.has=_5e;Mc.prototype.set=D5e;function O5e(){this.__data__=new Mc,this.size=0}function T5e(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function R5e(e){return this.__data__.get(e)}function I5e(e){return this.__data__.has(e)}function Bn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var M5e="[object AsyncFunction]",P5e="[object Function]",j5e="[object GeneratorFunction]",$5e="[object Proxy]";function xv(e){if(!Bn(e))return!1;var t=Ic(e);return t==P5e||t==j5e||t==M5e||t==$5e}var q4=vu["__core-js_shared__"],VB=(function(){var e=/[^.]+$/.exec(q4&&q4.keys&&q4.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function N5e(e){return!!VB&&VB in e}var L5e=Function.prototype,F5e=L5e.toString;function Qh(e){if(e!=null){try{return F5e.call(e)}catch{}try{return e+""}catch{}}return""}var B5e=/[\\^$.*+?()[\]{}|]/g,z5e=/^\[object .+?Constructor\]$/,U5e=Function.prototype,H5e=Object.prototype,V5e=U5e.toString,W5e=H5e.hasOwnProperty,q5e=RegExp("^"+V5e.call(W5e).replace(B5e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G5e(e){if(!Bn(e)||N5e(e))return!1;var t=xv(e)?q5e:z5e;return t.test(Qh(e))}function K5e(e,t){return e?.[t]}function Zh(e,t){var n=K5e(e,t);return G5e(n)?n:void 0}var tb=Zh(vu,"Map"),nb=Zh(Object,"create");function Y5e(){this.__data__=nb?nb(null):{},this.size=0}function X5e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var J5e="__lodash_hash_undefined__",Q5e=Object.prototype,Z5e=Q5e.hasOwnProperty;function e4e(e){var t=this.__data__;if(nb){var n=t[e];return n===J5e?void 0:n}return Z5e.call(t,e)?t[e]:void 0}var t4e=Object.prototype,n4e=t4e.hasOwnProperty;function r4e(e){var t=this.__data__;return nb?t[e]!==void 0:n4e.call(t,e)}var i4e="__lodash_hash_undefined__";function o4e(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=nb&&t===void 0?i4e:t,this}function Ph(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ph.prototype.clear=Y5e;Ph.prototype.delete=X5e;Ph.prototype.get=e4e;Ph.prototype.has=r4e;Ph.prototype.set=o4e;function s4e(){this.size=0,this.__data__={hash:new Ph,map:new(tb||Mc),string:new Ph}}function a4e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function R3(e,t){var n=e.__data__;return a4e(t)?n[typeof t=="string"?"string":"hash"]:n.map}function l4e(e){var t=R3(this,e).delete(e);return this.size-=t?1:0,t}function u4e(e){return R3(this,e).get(e)}function c4e(e){return R3(this,e).has(e)}function d4e(e,t){var n=R3(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Pc(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Pc.prototype.clear=s4e;Pc.prototype.delete=l4e;Pc.prototype.get=u4e;Pc.prototype.has=c4e;Pc.prototype.set=d4e;var f4e=200;function h4e(e,t){var n=this.__data__;if(n instanceof Mc){var r=n.__data__;if(!tb||r.length<f4e-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pc(r)}return n.set(e,t),this.size=n.size,this}function Qa(e){var t=this.__data__=new Mc(e);this.size=t.size}Qa.prototype.clear=O5e;Qa.prototype.delete=T5e;Qa.prototype.get=R5e;Qa.prototype.has=I5e;Qa.prototype.set=h4e;var p4e="__lodash_hash_undefined__";function m4e(e){return this.__data__.set(e,p4e),this}function g4e(e){return this.__data__.has(e)}function jh(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Pc;++t<n;)this.add(e[t])}jh.prototype.add=jh.prototype.push=m4e;jh.prototype.has=g4e;function y4e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function rb(e,t){return e.has(t)}var b4e=1,v4e=2;function xQ(e,t,n,r,i,o){var s=n&b4e,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var f=-1,h=!0,g=n&v4e?new jh:void 0;for(o.set(e,t),o.set(t,e);++f<a;){var y=e[f],b=t[f];if(r)var v=s?r(b,y,f,t,e,o):r(y,b,f,e,t,o);if(v!==void 0){if(v)continue;h=!1;break}if(g){if(!y4e(t,function(S,C){if(!rb(g,C)&&(y===S||i(y,S,n,r,o)))return g.push(C)})){h=!1;break}}else if(!(y===b||i(y,b,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var rE=vu.Uint8Array;function x4e(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function RM(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var S4e=1,w4e=2,C4e="[object Boolean]",E4e="[object Date]",A4e="[object Error]",k4e="[object Map]",_4e="[object Number]",D4e="[object RegExp]",O4e="[object Set]",T4e="[object String]",R4e="[object Symbol]",I4e="[object ArrayBuffer]",M4e="[object DataView]",WB=va?va.prototype:void 0,G4=WB?WB.valueOf:void 0;function P4e(e,t,n,r,i,o,s){switch(n){case M4e:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case I4e:return!(e.byteLength!=t.byteLength||!o(new rE(e),new rE(t)));case C4e:case E4e:case _4e:return vv(+e,+t);case A4e:return e.name==t.name&&e.message==t.message;case D4e:case T4e:return e==t+"";case k4e:var a=x4e;case O4e:var l=r&S4e;if(a||(a=RM),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;r|=w4e,s.set(e,t);var c=xQ(a(e),a(t),r,i,o,s);return s.delete(e),c;case R4e:if(G4)return G4.call(e)==G4.call(t)}return!1}function IM(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Fi=Array.isArray;function SQ(e,t,n){var r=t(e);return Fi(e)?r:IM(r,n(e))}function j4e(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function wQ(){return[]}var $4e=Object.prototype,N4e=$4e.propertyIsEnumerable,qB=Object.getOwnPropertySymbols,MM=qB?function(e){return e==null?[]:(e=Object(e),j4e(qB(e),function(t){return N4e.call(e,t)}))}:wQ;function CQ(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var L4e="[object Arguments]";function GB(e){return xa(e)&&Ic(e)==L4e}var EQ=Object.prototype,F4e=EQ.hasOwnProperty,B4e=EQ.propertyIsEnumerable,dg=GB((function(){return arguments})())?GB:function(e){return xa(e)&&F4e.call(e,"callee")&&!B4e.call(e,"callee")};function z4e(){return!1}var AQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,KB=AQ&&typeof module=="object"&&module&&!module.nodeType&&module,U4e=KB&&KB.exports===AQ,YB=U4e?vu.Buffer:void 0,H4e=YB?YB.isBuffer:void 0,$h=H4e||z4e,V4e=9007199254740991,W4e=/^(?:0|[1-9]\d*)$/;function I3(e,t){var n=typeof e;return t=t??V4e,!!t&&(n=="number"||n!="symbol"&&W4e.test(e))&&e>-1&&e%1==0&&e<t}var q4e=9007199254740991;function PM(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=q4e}var G4e="[object Arguments]",K4e="[object Array]",Y4e="[object Boolean]",X4e="[object Date]",J4e="[object Error]",Q4e="[object Function]",Z4e="[object Map]",eDe="[object Number]",tDe="[object Object]",nDe="[object RegExp]",rDe="[object Set]",iDe="[object String]",oDe="[object WeakMap]",sDe="[object ArrayBuffer]",aDe="[object DataView]",lDe="[object Float32Array]",uDe="[object Float64Array]",cDe="[object Int8Array]",dDe="[object Int16Array]",fDe="[object Int32Array]",hDe="[object Uint8Array]",pDe="[object Uint8ClampedArray]",mDe="[object Uint16Array]",gDe="[object Uint32Array]",$r={};$r[lDe]=$r[uDe]=$r[cDe]=$r[dDe]=$r[fDe]=$r[hDe]=$r[pDe]=$r[mDe]=$r[gDe]=!0;$r[G4e]=$r[K4e]=$r[sDe]=$r[Y4e]=$r[aDe]=$r[X4e]=$r[J4e]=$r[Q4e]=$r[Z4e]=$r[eDe]=$r[tDe]=$r[nDe]=$r[rDe]=$r[iDe]=$r[oDe]=!1;function yDe(e){return xa(e)&&PM(e.length)&&!!$r[Ic(e)]}function jM(e){return function(t){return e(t)}}var kQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,d1=kQ&&typeof module=="object"&&module&&!module.nodeType&&module,bDe=d1&&d1.exports===kQ,K4=bDe&&gQ.process,fg=(function(){try{var e=d1&&d1.require&&d1.require("util").types;return e||K4&&K4.binding&&K4.binding("util")}catch{}})(),XB=fg&&fg.isTypedArray,Sv=XB?jM(XB):yDe,vDe=Object.prototype,xDe=vDe.hasOwnProperty;function _Q(e,t){var n=Fi(e),r=!n&&dg(e),i=!n&&!r&&$h(e),o=!n&&!r&&!i&&Sv(e),s=n||r||i||o,a=s?CQ(e.length,String):[],l=a.length;for(var u in e)(t||xDe.call(e,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||I3(u,l)))&&a.push(u);return a}var SDe=Object.prototype;function M3(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||SDe;return e===n}var wDe=bQ(Object.keys,Object),CDe=Object.prototype,EDe=CDe.hasOwnProperty;function DQ(e){if(!M3(e))return wDe(e);var t=[];for(var n in Object(e))EDe.call(e,n)&&n!="constructor"&&t.push(n);return t}function ep(e){return e!=null&&PM(e.length)&&!xv(e)}function Fa(e){return ep(e)?_Q(e):DQ(e)}function Z6(e){return SQ(e,Fa,MM)}var ADe=1,kDe=Object.prototype,_De=kDe.hasOwnProperty;function DDe(e,t,n,r,i,o){var s=n&ADe,a=Z6(e),l=a.length,u=Z6(t),c=u.length;if(l!=c&&!s)return!1;for(var f=l;f--;){var h=a[f];if(!(s?h in t:_De.call(t,h)))return!1}var g=o.get(e),y=o.get(t);if(g&&y)return g==t&&y==e;var b=!0;o.set(e,t),o.set(t,e);for(var v=s;++f<l;){h=a[f];var S=e[h],C=t[h];if(r)var w=s?r(C,S,h,t,e,o):r(S,C,h,e,t,o);if(!(w===void 0?S===C||i(S,C,n,r,o):w)){b=!1;break}v||(v=h=="constructor")}if(b&&!v){var A=e.constructor,E=t.constructor;A!=E&&"constructor"in e&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof E=="function"&&E instanceof E)&&(b=!1)}return o.delete(e),o.delete(t),b}var eT=Zh(vu,"DataView"),tT=Zh(vu,"Promise"),jm=Zh(vu,"Set"),nT=Zh(vu,"WeakMap"),JB="[object Map]",ODe="[object Object]",QB="[object Promise]",ZB="[object Set]",ez="[object WeakMap]",tz="[object DataView]",TDe=Qh(eT),RDe=Qh(tb),IDe=Qh(tT),MDe=Qh(jm),PDe=Qh(nT),ra=Ic;(eT&&ra(new eT(new ArrayBuffer(1)))!=tz||tb&&ra(new tb)!=JB||tT&&ra(tT.resolve())!=QB||jm&&ra(new jm)!=ZB||nT&&ra(new nT)!=ez)&&(ra=function(e){var t=Ic(e),n=t==ODe?e.constructor:void 0,r=n?Qh(n):"";if(r)switch(r){case TDe:return tz;case RDe:return JB;case IDe:return QB;case MDe:return ZB;case PDe:return ez}return t});var jDe=1,nz="[object Arguments]",rz="[object Array]",M2="[object Object]",$De=Object.prototype,iz=$De.hasOwnProperty;function NDe(e,t,n,r,i,o){var s=Fi(e),a=Fi(t),l=s?rz:ra(e),u=a?rz:ra(t);l=l==nz?M2:l,u=u==nz?M2:u;var c=l==M2,f=u==M2,h=l==u;if(h&&$h(e)){if(!$h(t))return!1;s=!0,c=!1}if(h&&!c)return o||(o=new Qa),s||Sv(e)?xQ(e,t,n,r,i,o):P4e(e,t,l,n,r,i,o);if(!(n&jDe)){var g=c&&iz.call(e,"__wrapped__"),y=f&&iz.call(t,"__wrapped__");if(g||y){var b=g?e.value():e,v=y?t.value():t;return o||(o=new Qa),i(b,v,n,r,o)}}return h?(o||(o=new Qa),DDe(e,t,n,r,i,o)):!1}function wv(e,t,n,r,i){return e===t?!0:e==null||t==null||!xa(e)&&!xa(t)?e!==e&&t!==t:NDe(e,t,n,r,wv,i)}function LDe(e,t,n){n=typeof n=="function"?n:void 0;var r=n?n(e,t):void 0;return r===void 0?wv(e,t,void 0,n):!!r}function _r(e,t){return LDe(e,t,(n,r)=>{if(typeof n=="function"&&typeof r=="function")return!0})}var FDe="[object Symbol]";function Cv(e){return typeof e=="symbol"||xa(e)&&Ic(e)==FDe}var BDe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zDe=/^\w*$/;function $M(e,t){if(Fi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Cv(e)?!0:zDe.test(e)||!BDe.test(e)||t!=null&&e in Object(t)}var UDe="Expected a function";function NM(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(UDe);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(NM.Cache||Pc),n}NM.Cache=Pc;var HDe=500;function VDe(e){var t=NM(e,function(r){return n.size===HDe&&n.clear(),r}),n=t.cache;return t}var WDe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qDe=/\\(\\)?/g,OQ=VDe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(WDe,function(n,r,i,o){t.push(i?o.replace(qDe,"$1"):r||n)}),t});function Wg(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var oz=va?va.prototype:void 0,sz=oz?oz.toString:void 0;function TQ(e){if(typeof e=="string")return e;if(Fi(e))return Wg(e,TQ)+"";if(Cv(e))return sz?sz.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function LM(e){return e==null?"":TQ(e)}function qg(e,t){return Fi(e)?e:$M(e,t)?[e]:OQ(LM(e))}function tp(e){if(typeof e=="string"||Cv(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function P3(e,t){t=qg(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[tp(t[n++])];return n&&n==r?e:void 0}function Ve(e,t,n){var r=e==null?void 0:P3(e,t);return r===void 0?n:r}var GDe=Object.prototype,KDe=GDe.hasOwnProperty;function YDe(e,t){return e!=null&&KDe.call(e,t)}function RQ(e,t,n){t=qg(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=tp(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&PM(i)&&I3(s,i)&&(Fi(e)||dg(e)))}function In(e,t){return e!=null&&RQ(e,t,YDe)}function ib(e,t){return wv(e,t)}var iE=(function(){try{var e=Zh(Object,"defineProperty");return e({},"",{}),e}catch{}})();function FM(e,t,n){t=="__proto__"&&iE?iE(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var XDe=Object.prototype,JDe=XDe.hasOwnProperty;function BM(e,t,n){var r=e[t];(!(JDe.call(e,t)&&vv(r,n))||n===void 0&&!(t in e))&&FM(e,t,n)}function zM(e,t,n,r){if(!Bn(e))return e;t=qg(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=tp(t[i]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var c=a[l];u=r?r(c,l,a):void 0,u===void 0&&(u=Bn(c)?c:I3(t[i+1])?[]:{})}BM(a,l,u),a=a[l]}return e}function ur(e,t,n){return e==null?e:zM(e,t,n)}function j3(e){return e}function IQ(e){return typeof e=="function"?e:j3}var QDe=/\s/;function ZDe(e){for(var t=e.length;t--&&QDe.test(e.charAt(t)););return t}var eOe=/^\s+/;function tOe(e){return e&&e.slice(0,ZDe(e)+1).replace(eOe,"")}var az=NaN,nOe=/^[-+]0x[0-9a-f]+$/i,rOe=/^0b[01]+$/i,iOe=/^0o[0-7]+$/i,oOe=parseInt;function sOe(e){if(typeof e=="number")return e;if(Cv(e))return az;if(Bn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Bn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=tOe(e);var n=rOe.test(e);return n||iOe.test(e)?oOe(e.slice(2),n?2:8):nOe.test(e)?az:+e}var lz=1/0,aOe=17976931348623157e292;function lOe(e){if(!e)return e===0?e:0;if(e=sOe(e),e===lz||e===-lz){var t=e<0?-1:1;return t*aOe}return e===e?e:0}function MQ(e){var t=lOe(e),n=t%1;return t===t?n?t-n:t:0}var uOe=9007199254740991,Y4=4294967295,cOe=Math.min;function PQ(e,t){if(e=MQ(e),e<1||e>uOe)return[];var n=Y4,r=cOe(e,Y4);t=IQ(t),e-=Y4;for(var i=CQ(r,t);++n<e;)t(n);return i}function UM(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var uz=Object.create,jQ=(function(){function e(){}return function(t){if(!Bn(t))return{};if(uz)return uz(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function dOe(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var l=s[++i];if(n(o[l],l,o)===!1)break}return t}}var $Q=dOe();function NQ(e,t){return e&&$Q(e,t,Fa)}var fOe=1,hOe=2;function pOe(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],l=e[a],u=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var c=new Qa,f;if(!(f===void 0?wv(u,l,fOe|hOe,r,c):f))return!1}}return!0}function LQ(e){return e===e&&!Bn(e)}function mOe(e){for(var t=Fa(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,LQ(i)]}return t}function FQ(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function gOe(e){var t=mOe(e);return t.length==1&&t[0][2]?FQ(t[0][0],t[0][1]):function(n){return n===e||pOe(n,e,t)}}function yOe(e,t){return e!=null&&t in Object(e)}function BQ(e,t){return e!=null&&RQ(e,t,yOe)}var bOe=1,vOe=2;function xOe(e,t){return $M(e)&&LQ(t)?FQ(tp(e),t):function(n){var r=Ve(n,e);return r===void 0&&r===t?BQ(n,e):wv(t,r,bOe|vOe)}}function SOe(e){return function(t){return t?.[e]}}function wOe(e){return function(t){return P3(t,e)}}function COe(e){return $M(e)?SOe(tp(e)):wOe(e)}function HM(e){return typeof e=="function"?e:e==null?j3:typeof e=="object"?Fi(e)?xOe(e[0],e[1]):gOe(e):COe(e)}function EOe(e,t,n){var r=Fi(e),i=r||$h(e)||Sv(e);if(t=HM(t),n==null){var o=e&&e.constructor;i?n=r?new o:[]:Bn(e)?n=xv(o)?jQ(O3(e)):{}:n={}}return(i?UM:NQ)(e,function(s,a,l){return t(n,s,a,l)}),n}function rT(e,t,n){(n!==void 0&&!vv(e[t],n)||n===void 0&&!(t in e))&&FM(e,t,n)}var zQ=typeof exports=="object"&&exports&&!exports.nodeType&&exports,cz=zQ&&typeof module=="object"&&module&&!module.nodeType&&module,AOe=cz&&cz.exports===zQ,dz=AOe?vu.Buffer:void 0,fz=dz?dz.allocUnsafe:void 0;function UQ(e,t){if(t)return e.slice();var n=e.length,r=fz?fz(n):new e.constructor(n);return e.copy(r),r}function VM(e){var t=new e.constructor(e.byteLength);return new rE(t).set(new rE(e)),t}function HQ(e,t){var n=t?VM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function WM(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function VQ(e){return typeof e.constructor=="function"&&!M3(e)?jQ(O3(e)):{}}function ob(e){return xa(e)&&ep(e)}function iT(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Gg(e,t,n,r){var i=!n;n||(n={});for(var o=-1,s=t.length;++o<s;){var a=t[o],l=void 0;l===void 0&&(l=e[a]),i?FM(n,a,l):BM(n,a,l)}return n}function kOe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var _Oe=Object.prototype,DOe=_Oe.hasOwnProperty;function OOe(e){if(!Bn(e))return kOe(e);var t=M3(e),n=[];for(var r in e)r=="constructor"&&(t||!DOe.call(e,r))||n.push(r);return n}function Ev(e){return ep(e)?_Q(e,!0):OOe(e)}function TOe(e){return Gg(e,Ev(e))}function ROe(e,t,n,r,i,o,s){var a=iT(e,n),l=iT(t,n),u=s.get(l);if(u){rT(e,n,u);return}var c=o?o(a,l,n+"",e,t,s):void 0,f=c===void 0;if(f){var h=Fi(l),g=!h&&$h(l),y=!h&&!g&&Sv(l);c=l,h||g||y?Fi(a)?c=a:ob(a)?c=WM(a):g?(f=!1,c=UQ(l,!0)):y?(f=!1,c=HQ(l,!0)):c=[]:Xd(l)||dg(l)?(c=a,dg(a)?c=TOe(a):(!Bn(a)||xv(a))&&(c=VQ(l))):f=!1}f&&(s.set(l,c),i(c,l,r,o,s),s.delete(l)),rT(e,n,c)}function WQ(e,t,n,r,i){e!==t&&$Q(t,function(o,s){if(i||(i=new Qa),Bn(o))ROe(e,t,s,n,WQ,r,i);else{var a=r?r(iT(e,s),o,s+"",e,t,i):void 0;a===void 0&&(a=o),rT(e,s,a)}},Ev)}function IOe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hz=Math.max;function qQ(e,t,n){return t=hz(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=hz(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),IOe(e,this,a)}}function MOe(e){return function(){return e}}var POe=iE?function(e,t){return iE(e,"toString",{configurable:!0,enumerable:!1,value:MOe(t),writable:!0})}:j3,jOe=800,$Oe=16,NOe=Date.now;function LOe(e){var t=0,n=0;return function(){var r=NOe(),i=$Oe-(r-n);if(n=r,i>0){if(++t>=jOe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var GQ=LOe(POe);function $3(e,t){return GQ(qQ(e,t,j3),e+"")}function FOe(e,t,n){if(!Bn(n))return!1;var r=typeof t;return(r=="number"?ep(n)&&I3(t,n.length):r=="string"&&t in n)?vv(n[t],e):!1}function BOe(e){return $3(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&FOe(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r<i;){var a=n[r];a&&e(t,a,r,o)}return t})}var zOe=BOe(function(e,t,n){WQ(e,t,n)}),pz=va?va.isConcatSpreadable:void 0;function UOe(e){return Fi(e)||dg(e)||!!(pz&&e&&e[pz])}function Av(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=UOe),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Av(a,t-1,n,r,i):IM(i,a):r||(i[i.length]=a)}return i}var HOe=1/0;function VOe(e){var t=e==null?0:e.length;return t?Av(e,HOe):[]}function WOe(e,t,n,r){for(var i=e.length,o=n+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function qOe(e){return e!==e}function GOe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function KQ(e,t,n){return t===t?GOe(e,t,n):WOe(e,qOe,n)}function qM(e,t){var n=e==null?0:e.length;return!!n&&KQ(e,t,0)>-1}function Hw(){}var KOe=1/0,YOe=jm&&1/RM(new jm([,-0]))[1]==KOe?function(e){return new jm(e)}:Hw,XOe=200;function YQ(e,t,n){var r=-1,i=qM,o=e.length,s=!0,a=[],l=a;if(o>=XOe){var u=YOe(e);if(u)return RM(u);s=!1,i=rb,l=new jh}else l=a;e:for(;++r<o;){var c=e[r],f=c;if(c=c!==0?c:0,s&&f===f){for(var h=l.length;h--;)if(l[h]===f)continue e;a.push(c)}else i(l,f,n)||(l!==a&&l.push(f),a.push(c))}return a}function XQ(e){return e&&e.length?YQ(e):[]}var JOe="[object Map]",QOe="[object Set]",ZOe=Object.prototype,e6e=ZOe.hasOwnProperty;function gi(e){if(e==null)return!0;if(ep(e)&&(Fi(e)||typeof e=="string"||typeof e.splice=="function"||$h(e)||Sv(e)||dg(e)))return!e.length;var t=ra(e);if(t==JOe||t==QOe)return!e.size;if(M3(e))return!DQ(e).length;for(var n in e)if(e6e.call(e,n))return!1;return!0}const t6e=Object.prototype;function Uy(e){for(const t in e)if(t6e.hasOwnProperty.call(e,t))return!1;return!0}const n6e=["array","boolean","integer","null","number","object","string"];new Set(n6e);const r6e=["$defs","definitions","properties","patternProperties","dependencies"];new Set(r6e);const i6e=["items","allOf","oneOf","anyOf"];new Set(i6e);const o6e=["items","additionalItems","additionalProperties","propertyNames","contains","if","then","else","not"];new Set(o6e);function Vw(e){return typeof e=="object"}function Tl(e){return Vw(e)?Uy(e):e===!0}function vm(e,t){return e<t?-1:e>t?1:0}function X4(e,t){const n=e.length;if(n===0)return t;let r=t.length;if(r===0)return e;if(n<r){const o=e;e=t,t=o,r=n}const i=new Set(e);for(let o=0;o<r;o++)i.add(t[o]);return Array.from(i)}function s6e(e,t){const n=[];if(e.length===0||t.length===0)return n;if(e.length>t.length){const i=e;e=t,t=i}const r=new Set(t);for(let i=0;i<e.length&&r.size>0;i++){const o=e[i];r.delete(o)&&n.push(o)}return n}function mz(e){return e.length===0}function J4(e){return(t,n)=>{const r=t.length-n.length;if(r!==0)return r;for(let i=0;i<t.length;i++)if(t[i]!==n[i]){const o=e(t[i],n[i]);if(o!==0)return o}return 0}}function JQ(e,{threshold:t=12}={}){return n=>{const r=n.length;if(r===0)return n;if(r<=t){const s=[];let a=0;e:for(let l=0;l<r;l++){const u=n[l];for(let c=0;c<a;c++)if(e(u,s[c])===0)continue e;a=s.push(u)}return s}const i=n.slice().sort(e);let o=0;for(let s=1;s<r;s++)e(i[o],i[s])!==0&&++o!==s&&(i[o]=i[s]);return i.length=o+1,i}}function a6e(e){return(t,n)=>{const r=[];let i=t.length,o=n.length;if(i===0||o===0)return r;if(i>o){const c=t;t=n,n=c;const f=i;i=o,o=f}const s=[...t].sort(e),a=[...n].sort(e);let l=0,u=0;for(;l<i&&u<o;){const c=e(s[l],a[u]);c===0?((r.length===0||e(r[r.length-1],s[l])!==0)&&r.push(s[l]),l++,u++):c<0?l++:u++}return r}}function l6e(e,t){return n=>{if(e.has(n))return e.get(n);const r=t(n);return e.set(n,r),r}}const gz=l6e,QQ=()=>0,u6e=e=>e===void 0,c6e=e=>typeof e!="object",yz={boolean:0,number:1,string:2};function d6e(e,t){const n=typeof e,r=typeof t;return n===r?vm(e,t):yz[n]-yz[r]}function f6e(e,t){const n=e.length;if(n===0)return t;const r=t.length;if(r===0)return e;if(r>n){const s=e;e=t,t=s}const i=new Set(e),o=t.length;for(let s=0;s<o;s++){const a=t[s];i.has(a)||e.push(a)}return e}function N3(e,t,n=QQ){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function cm(e){return N3(u6e,e)}function cd(e,t){return N3(n=>n===void 0||e(n),t)}function Q4(e,t){return N3(Array.isArray,e,t)}const wi=cm(vm),Z4=cd(e=>e===0,(e,t)=>e-t);function h6e({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){const n=gz(t,b=>Object.keys(b).sort());function r(b){return(v,S)=>{const C=n(v),w=n(S),A=Math.min(C.length,w.length);for(let E=0;E<A;E++){const _=vm(C[E],w[E]);if(_!==0)return _}if(C.length!==w.length)return C.length-w.length;for(let E=0;E<A;E++){const _=C[E],D=b(v[_],S[_]);if(D!==0)return D}return 0}}function i(b){const v=J4(b),S=gz(e,JQ(b,{threshold:0}));return(C,w)=>v(S(C),S(w))}const o=i(vm);function s(b,v){if(Vw(b)){if(Vw(v)){const S=Object.keys(b),C=Object.keys(v),w=f6e(S,C),A=w.length;for(let E=0;E<A;E++){const _=w[E];if(b[_]===v[_])continue;const T=(y[_]??a)(b[_],v[_]);if(T!==0)return T}return 0}return v===!0&&Uy(b)?0:1}return Vw(v)?b===!0&&Uy(v)?0:-1:vm(b,v)}const a=cm(u),l=N3(c6e,Q4(r(a),J4(u)),d6e);function u(b,v){return b===null?-1:v===null?1:l(b,v)}const c=cm(s),f=cd(Uy,r(c)),h=cm(i(s)),g=cd(Tl,s),y={$id:wi,$comment:wi,$defs:f,$ref:wi,$schema:wi,const:a,contains:c,contentEncoding:wi,contentMediaType:wi,default:a,definitions:f,description:wi,else:c,examples:a,exclusiveMaximum:wi,exclusiveMinimum:wi,format:wi,if:c,maximum:wi,maxItems:wi,maxLength:wi,maxProperties:wi,minimum:wi,multipleOf:wi,not:c,pattern:wi,propertyNames:c,readOnly:wi,then:c,title:wi,writeOnly:wi,uniqueItems:cd(b=>b===!1,QQ),minLength:Z4,minItems:Z4,minProperties:Z4,required:cd(mz,o),enum:cd(mz,i(u)),type:cm((b,v)=>{const S=Array.isArray(b),C=Array.isArray(v);return!S&&!C?vm(b,v):o(S?b:[b],C?v:[v])}),items:cd(b=>!Array.isArray(b)&&Tl(b),Q4(s,J4(s))),anyOf:h,allOf:h,oneOf:h,properties:f,patternProperties:f,additionalProperties:g,additionalItems:g,dependencies:cd(Uy,r(cm(Q4(s,o))))};return{compareSchemaValues:u,compareSchemaDefinitions:s}}function bz(e){return e}const ZQ=(e,t)=>e?ZQ(t%e,e):t,p6e=(e,t)=>Math.abs(e*t)/ZQ(e,t);function m6e(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function*eD(e,t,n){const r=e.length,i=t.length;if(r>0&&i>0)for(let o=0;o<r;o++){const s=e[o];for(let a=0;a<i;a++)yield n(s,t[a])}}function tD(e,t){return e||t}function vz(e){return(t,n)=>{const r={...t},i=Object.keys(n),o=i.length;for(let s=0;s<o;s++){const a=i[s];r[a]=t[a]===void 0?n[a]:e(t[a],n[a])}return r}}function g6e(e){const t=new Map;for(const n of e)for(const r of n[0])t.set(r,n[1]);return t}function Hf(e,t,n){n===void 0||Tl(n)?delete e[t]:e[t]=n}const y6e=["properties","patternProperties","additionalProperties"];function xz(e){const t=Object.keys(e),n=t.length,r=[];for(let i=0;i<n;i++){const o=t[i];r.push({regExp:new RegExp(o),schema:e[o]})}return[r,t]}const Sz=[[],[]];function wz(e,t,n){const r=n.length;for(let i=0;i<r;i++){const o=n[i];if(!o.regExp.test(t))continue;const s=o.schema;if(s===!1)return!0;e.push(s)}return!1}const b6e=["items","additionalItems"],v6e=["if","then","else"];function Cz(e,t){return t.if!==void 0&&(e.if=t.if),t.then!==void 0&&(e.then=t.then),t.else!==void 0&&(e.else=t.else),e}function nD(e,t){if(e===t)return e;switch(e){case"number":if(t==="integer")return"integer";case"integer":if(t==="number")return"integer";default:return}}function Vf(e,t,n){return[e,t,n]}function x6e(e){const t=new Map;for(const[n,r,i]of e){const o=s=>{if(!i(s))throw new Error(`Schema keys '${n}' and '${r}' are conflicting (${n}: ${JSON.stringify(s[n])}, ${r}: ${JSON.stringify(s[r])})`)};for(const s of[[n,r],[r,n]]){let a=t.get(s[0]);a===void 0&&(a=[],t.set(s[0],a)),a.push({oppositeKey:s[1],check:o})}}return t}const S6e=[Vf("minimum","maximum",e=>e.maximum>=e.minimum),Vf("exclusiveMinimum","maximum",e=>e.maximum>e.exclusiveMinimum),Vf("minimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.minimum),Vf("exclusiveMinimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.exclusiveMinimum),Vf("minLength","maxLength",e=>e.maxLength>=e.minLength),Vf("minItems","maxItems",e=>e.maxItems>=e.minItems),Vf("minProperties","maxProperties",e=>e.maxProperties>=e.minProperties)];function w6e({mergePatterns:e=m6e,isSubRegExp:t=Object.is,intersectJson:n=s6e,deduplicateJsonSchemaDef:r=bz,defaultMerger:i=bz,assigners:o=[],checks:s=S6e,mergers:a}={}){function l(A){const E=A.length;let _=A[0];for(let D=1;D<E;D++){const T=S(_,A[D]);if(T===!1)return!1;Tl(T)||(_=T)}return _}function u(A,E,_,D,T,M,L){if(A.length=0,_===!1)return!1;if(A.push(_),T!==void 0){if(T===!1)return!1;A.push(T)}if(wz(A,E,M))return!1;const I=A.length<2;if(L===!1){if(I)return;if(wz(A,E,D))return!1}else I&&L!==void 0&&A.push(L);return A.length===1?A[0]:l(A)}function c(A,E,_,D,T,M){const L=_.length;if(L>0&&T!==!1)if(M)Object.assign(A,E);else for(let j=0;j<L;j++){const I=_[j];D.has(I)||(A[I]=S(E[I],T))}return A}const f=(A,{properties:E={},patternProperties:_,additionalProperties:D=!0},{properties:T={},patternProperties:M,additionalProperties:L=!0})=>{const j=Tl(D),I=Tl(L);if(j&&I)return Hf(A,"properties",C(E,T)),Hf(A,"patternProperties",_&&M?C(_,M):_??M),delete A.additionalProperties,A;const N=S(D,L);Hf(A,"additionalProperties",N);const $={},z=Object.keys(E),F=z.length,[G,V]=_?xz(_):Sz,[H,X]=M?xz(M):Sz,B=[],W=new Set,Y=I?void 0:L;for(let ie=0;ie<F;ie++){const ue=z[ie];W.add(ue);const te=u(B,ue,E[ue],G,T[ue],H,Y);te!==void 0&&($[ue]=te)}const U=Object.keys(T),K=U.length,Z=j?void 0:D;for(let ie=0;ie<K;ie++){const ue=U[ie];if(W.has(ue))continue;const te=u(B,ue,T[ue],H,void 0,G,Z);te!==void 0&&($[ue]=te)}Hf(A,"properties",$);let J={};const Q=new Set;if(V.length>0&&X.length>0){const ie=eD(V,X,(ue,te)=>{t(ue,te)&&Q.add(ue),t(te,ue)&&Q.add(te),J[e(ue,te)]=S(_[ue],M[te])});for(;!ie.next().done;);}return J=c(J,_,V,Q,L,I),J=c(J,M,X,Q,D,j),Hf(A,"patternProperties",J),A},h=(A,{items:E=[],additionalItems:_},{items:D=[],additionalItems:T})=>{const M=Array.isArray(E),L=Array.isArray(D),j=[];if(A.items=j,M&&L){const[I,N,$]=E.length<D.length?[E.length,_,D]:[D.length,T,E];let z=0;for(;z<I;z++)j.push(S(E[z],D[z]));if(N===!1)A.additionalItems=!1;else{const F=N===void 0||Tl(N);for(;z<$.length;z++)j.push(F?$[z]:S($[z],N));Hf(A,"additionalItems",_!==void 0&&T!==void 0?S(_,T):_??T)}}else if(M||L){const[I,N,$]=M?[E,D,_]:[D,E,T];Hf(A,"additionalItems",$&&S($,N));for(let z=0;z<I.length;z++)j.push(S(I[z],N))}else delete A.additionalItems,A.items=S(E,D);return A},g=(A,E,_)=>{Cz(A,E);const D=Cz({},_);return A.allOf===void 0?A.allOf=[D]:A.allOf=A.allOf.concat(D),A};function y(A,E){return r(Array.from(eD(A,E,S)))}const b=g6e([[y6e,f],[b6e,h],[v6e,g],...o]),v=x6e(s);function S(A,E){if(A===!1||E===!1)return!1;if(Tl(A))return Tl(E)?!0:E;if(Tl(E))return A;let _={...A};const D=new Set,T=new Set,M=Object.keys(E),L=M.length;for(let j=0;j<L;j++){const I=M[j],N=E[I];if(N===void 0)continue;const $=v.get(I);if($!==void 0){const V=$.length;for(let H=0;H<V;H++){const X=$[H];A[X.oppositeKey]!==void 0&&T.add(X.check)}}const z=A[I];if(z===void 0){_[I]=N;continue}const F=b.get(I);if(F){D.add(F);continue}const G=w[I]??i;_[I]=G(z,N)}for(const j of D)_=j(_,A,E);for(const j of T)j(_);return _}const C=vz(S),w={$id:i,$ref:i,$schema:i,$comment:i,$defs:C,definitions:C,type:(A,E)=>{if(A===E)return A;const _=Array.isArray(A),D=Array.isArray(E);if(!_&&!D){const T=nD(A,E);if(T!==void 0)return T}else if(_||D){const T=new Set;if(_&&D)for(const L of eD(A,E,nD))L!==void 0&&T.add(L);else{const L=_?A:E,j=_?E:A,I=L.length;for(let N=0;N<I;N++){const $=nD(j,L[N]);$!==void 0&&T.add($)}}const M=T.size;if(M===1)return T.values().next().value;if(M>1)return Array.from(T)}throw new Error(`It is not possible to create an intersection of the following incompatible types: ${A.toString()}, ${E.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(A,E)=>{const _=r([A,E]);return _.length===1?_[0]:{anyOf:_}},pattern:e,readOnly:tD,writeOnly:tD,enum:(A,E)=>{const _=n(A,E);if(_.length===0)throw new Error(`Intersection of the following enums is empty: "${JSON.stringify(A)}", "${JSON.stringify(E)}"`);return _},anyOf:y,oneOf:y,allOf:(A,E)=>r(A.concat(E)),propertyNames:S,contains:S,dependencies:vz((A,E)=>Array.isArray(A)?Array.isArray(E)?X4(A,E):S(E,{required:A}):Array.isArray(E)?S(A,{required:E}):S(A,E)),examples:(A,E)=>{if(!Array.isArray(A)||!Array.isArray(E))throw new Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(A)}" and "${JSON.stringify(E)}"`);return X4(A,E)},multipleOf:(A,E)=>{let _=1;for(;!Number.isInteger(A)||!Number.isInteger(E);)_*=10,A*=10,E*=10;return p6e(A,E)/_},exclusiveMaximum:Math.min,maximum:Math.min,maxItems:Math.min,maxLength:Math.min,maxProperties:Math.min,exclusiveMinimum:Math.max,minimum:Math.max,minItems:Math.max,minLength:Math.max,minProperties:Math.max,uniqueItems:tD,required:X4,...a};return{mergeSchemaDefinitions:S,mergeArrayOfSchemaDefinitions:l}}function C6e(e){const t=[],n=[e];for(;n.length>0;){const r=n.pop();if(typeof r=="boolean"||r.allOf===void 0){t.push(r);continue}const{allOf:i,...o}=r;t.push(o);for(let s=i.length-1;s>=0;s--)n.push(i[s])}return t}function E6e(e){return t=>e(C6e(t))}var gy={},Ez;function A6e(){if(Ez)return gy;Ez=1;var e=/~/,t=/~[01]/g;function n(u){switch(u){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+u)}function r(u){return e.test(u)?u.replace(t,n):u}function i(u,c,f){for(var h,g,y=1,b=c.length;y<b;){if(c[y]==="constructor"||c[y]==="prototype"||c[y]==="__proto__")return u;if(h=r(c[y++]),g=b>y,typeof u[h]>"u"&&(Array.isArray(u)&&h==="-"&&(h=u.length),g&&(c[y]!==""&&c[y]<1/0||c[y]==="-"?u[h]=[]:u[h]={})),!g)break;u=u[h]}var v=u[h];return f===void 0?delete u[h]:u[h]=f,v}function o(u){if(typeof u=="string"){if(u=u.split("/"),u[0]==="")return u;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(u)){for(const c of u)if(typeof c!="string"&&typeof c!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return u}throw new Error("Invalid JSON pointer.")}function s(u,c){if(typeof u!="object")throw new Error("Invalid input object.");c=o(c);var f=c.length;if(f===1)return u;for(var h=1;h<f;){if(u=u[r(c[h++])],f===h)return u;if(typeof u!="object"||u===null)return}}function a(u,c,f){if(typeof u!="object")throw new Error("Invalid input object.");if(c=o(c),c.length===0)throw new Error("Invalid JSON pointer for set.");return i(u,c,f)}function l(u){var c=o(u);return{get:function(f){return s(f,c)},set:function(f,h){return a(f,c,h)}}}return gy.get=s,gy.set=a,gy.compile=l,gy}var k6e=A6e();const rD=cs(k6e);function _6e(e,t){return e&&Gg(t,Fa(t),e)}function D6e(e,t){return e&&Gg(t,Ev(t),e)}function O6e(e,t){return Gg(e,MM(e),t)}var T6e=Object.getOwnPropertySymbols,eZ=T6e?function(e){for(var t=[];e;)IM(t,MM(e)),e=O3(e);return t}:wQ;function R6e(e,t){return Gg(e,eZ(e),t)}function GM(e){return SQ(e,Ev,eZ)}var I6e=Object.prototype,M6e=I6e.hasOwnProperty;function P6e(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&M6e.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function j6e(e,t){var n=t?VM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var $6e=/\w*$/;function N6e(e){var t=new e.constructor(e.source,$6e.exec(e));return t.lastIndex=e.lastIndex,t}var Az=va?va.prototype:void 0,kz=Az?Az.valueOf:void 0;function L6e(e){return kz?Object(kz.call(e)):{}}var F6e="[object Boolean]",B6e="[object Date]",z6e="[object Map]",U6e="[object Number]",H6e="[object RegExp]",V6e="[object Set]",W6e="[object String]",q6e="[object Symbol]",G6e="[object ArrayBuffer]",K6e="[object DataView]",Y6e="[object Float32Array]",X6e="[object Float64Array]",J6e="[object Int8Array]",Q6e="[object Int16Array]",Z6e="[object Int32Array]",eTe="[object Uint8Array]",tTe="[object Uint8ClampedArray]",nTe="[object Uint16Array]",rTe="[object Uint32Array]";function iTe(e,t,n){var r=e.constructor;switch(t){case G6e:return VM(e);case F6e:case B6e:return new r(+e);case K6e:return j6e(e,n);case Y6e:case X6e:case J6e:case Q6e:case Z6e:case eTe:case tTe:case nTe:case rTe:return HQ(e,n);case z6e:return new r;case U6e:case W6e:return new r(e);case H6e:return N6e(e);case V6e:return new r;case q6e:return L6e(e)}}var oTe="[object Map]";function sTe(e){return xa(e)&&ra(e)==oTe}var _z=fg&&fg.isMap,aTe=_z?jM(_z):sTe,lTe="[object Set]";function uTe(e){return xa(e)&&ra(e)==lTe}var Dz=fg&&fg.isSet,cTe=Dz?jM(Dz):uTe,dTe=1,fTe=2,hTe=4,tZ="[object Arguments]",pTe="[object Array]",mTe="[object Boolean]",gTe="[object Date]",yTe="[object Error]",nZ="[object Function]",bTe="[object GeneratorFunction]",vTe="[object Map]",xTe="[object Number]",rZ="[object Object]",STe="[object RegExp]",wTe="[object Set]",CTe="[object String]",ETe="[object Symbol]",ATe="[object WeakMap]",kTe="[object ArrayBuffer]",_Te="[object DataView]",DTe="[object Float32Array]",OTe="[object Float64Array]",TTe="[object Int8Array]",RTe="[object Int16Array]",ITe="[object Int32Array]",MTe="[object Uint8Array]",PTe="[object Uint8ClampedArray]",jTe="[object Uint16Array]",$Te="[object Uint32Array]",Er={};Er[tZ]=Er[pTe]=Er[kTe]=Er[_Te]=Er[mTe]=Er[gTe]=Er[DTe]=Er[OTe]=Er[TTe]=Er[RTe]=Er[ITe]=Er[vTe]=Er[xTe]=Er[rZ]=Er[STe]=Er[wTe]=Er[CTe]=Er[ETe]=Er[MTe]=Er[PTe]=Er[jTe]=Er[$Te]=!0;Er[yTe]=Er[nZ]=Er[ATe]=!1;function f1(e,t,n,r,i,o){var s,a=t&dTe,l=t&fTe,u=t&hTe;if(n&&(s=i?n(e,r,i,o):n(e)),s!==void 0)return s;if(!Bn(e))return e;var c=Fi(e);if(c){if(s=P6e(e),!a)return WM(e,s)}else{var f=ra(e),h=f==nZ||f==bTe;if($h(e))return UQ(e,a);if(f==rZ||f==tZ||h&&!i){if(s=l||h?{}:VQ(e),!a)return l?R6e(e,D6e(s,e)):O6e(e,_6e(s,e))}else{if(!Er[f])return i?e:{};s=iTe(e,f,a)}}o||(o=new Qa);var g=o.get(e);if(g)return g;o.set(e,s),cTe(e)?e.forEach(function(v){s.add(f1(v,t,n,v,e,o))}):aTe(e)&&e.forEach(function(v,S){s.set(S,f1(v,t,n,S,e,o))});var y=u?l?GM:Z6:l?Ev:Fa,b=c?void 0:y(e);return UM(b||e,function(v,S){b&&(S=v,v=e[S]),BM(s,S,f1(v,t,n,S,e,o))}),s}function iZ(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function NTe(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function LTe(e,t){return t.length<2?e:P3(e,NTe(t,0,-1))}var FTe=Object.prototype,BTe=FTe.hasOwnProperty;function oZ(e,t){t=qg(t,e);var n=-1,r=t.length;if(!r)return!0;for(var i=e==null||typeof e!="object"&&typeof e!="function";++n<r;){var o=t[n];if(typeof o=="string"){if(o==="__proto__"&&!BTe.call(e,"__proto__"))return!1;if(o==="constructor"&&n+1<r&&typeof t[n+1]=="string"&&t[n+1]==="prototype"){if(i&&n===0)continue;return!1}}}var s=LTe(e,t);return s==null||delete s[tp(iZ(t))]}function zTe(e){return Xd(e)?void 0:e}function oT(e){var t=e==null?0:e.length;return t?Av(e,1):[]}function sZ(e){return GQ(qQ(e,void 0,oT),e+"")}var UTe=1,HTe=2,VTe=4,sb=sZ(function(e,t){var n={};if(e==null)return n;var r=!1;t=Wg(t,function(o){return o=qg(o,e),r||(r=o.length>1),o}),Gg(e,GM(e),n),r&&(n=f1(n,UTe|HTe|VTe,zTe));for(var i=t.length;i--;)oZ(n,t[i]);return n}),yy={exports:{}},iD,Oz;function aZ(){if(Oz)return iD;Oz=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(h){let g="",y=0,b=0;for(b=0;b<h.length;b++)if(y=h[b].charCodeAt(0),y!==48){if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b];break}for(b+=1;b<h.length;b++){if(y=h[b].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=h[b]}return g}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function o(h,g,y){if(h.length){const b=n(h);if(b!=="")g.push(b);else return y.error=!0,!1;h.length=0}return!0}function s(h){let g=0;const y={error:!1,address:"",zone:""},b=[],v=[];let S=!1,C=!1,w=o;for(let A=0;A<h.length;A++){const E=h[A];if(!(E==="["||E==="]"))if(E===":"){if(S===!0&&(C=!0),!w(v,b,y))break;if(++g>7){y.error=!0;break}A>0&&h[A-1]===":"&&(S=!0),b.push(":");continue}else if(E==="%"){if(!w(v,b,y))break;w=i}else{v.push(E);continue}}return v.length&&(w===i?y.zone=v.join(""):C?b.push(v.join("")):b.push(n(v))),y.address=b.join(""),y}function a(h){if(l(h,":")<2)return{host:h,isIPV6:!1};const g=s(h);if(g.error)return{host:h,isIPV6:!1};{let y=g.address,b=g.address;return g.zone&&(y+="%"+g.zone,b+="%25"+g.zone),{host:y,isIPV6:!0,escapedHost:b}}}function l(h,g){let y=0;for(let b=0;b<h.length;b++)h[b]===g&&y++;return y}function u(h){let g=h;const y=[];let b=-1,v=0;for(;v=g.length;){if(v===1){if(g===".")break;if(g==="/"){y.push("/");break}else{y.push(g);break}}else if(v===2){if(g[0]==="."){if(g[1]===".")break;if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&(g[1]==="."||g[1]==="/")){y.push("/");break}}else if(v===3&&g==="/.."){y.length!==0&&y.pop(),y.push("/");break}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."&&g[3]==="/"){g=g.slice(3),y.length!==0&&y.pop();continue}}if((b=g.indexOf("/",1))===-1){y.push(g);break}else y.push(g.slice(0,b)),g=g.slice(b)}return y.join("")}function c(h,g){const y=g!==!0?escape:unescape;return h.scheme!==void 0&&(h.scheme=y(h.scheme)),h.userinfo!==void 0&&(h.userinfo=y(h.userinfo)),h.host!==void 0&&(h.host=y(h.host)),h.path!==void 0&&(h.path=y(h.path)),h.query!==void 0&&(h.query=y(h.query)),h.fragment!==void 0&&(h.fragment=y(h.fragment)),h}function f(h){const g=[];if(h.userinfo!==void 0&&(g.push(h.userinfo),g.push("@")),h.host!==void 0){let y=unescape(h.host);if(!t(y)){const b=a(y);b.isIPV6===!0?y=`[${b.escapedHost}]`:y=h.host}g.push(y)}return(typeof h.port=="number"||typeof h.port=="string")&&(g.push(":"),g.push(String(h.port))),g.length?g.join(""):void 0}return iD={nonSimpleDomain:r,recomposeAuthority:f,normalizeComponentEncoding:c,removeDotSegments:u,isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:n},iD}var oD,Tz;function WTe(){if(Tz)return oD;Tz=1;const{isUUID:e}=aZ(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function r(E){return n.indexOf(E)!==-1}function i(E){return E.secure===!0?!0:E.secure===!1?!1:E.scheme?E.scheme.length===3&&(E.scheme[0]==="w"||E.scheme[0]==="W")&&(E.scheme[1]==="s"||E.scheme[1]==="S")&&(E.scheme[2]==="s"||E.scheme[2]==="S"):!1}function o(E){return E.host||(E.error=E.error||"HTTP URIs must have a host."),E}function s(E){const _=String(E.scheme).toLowerCase()==="https";return(E.port===(_?443:80)||E.port==="")&&(E.port=void 0),E.path||(E.path="/"),E}function a(E){return E.secure=i(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E}function l(E){if((E.port===(i(E)?443:80)||E.port==="")&&(E.port=void 0),typeof E.secure=="boolean"&&(E.scheme=E.secure?"wss":"ws",E.secure=void 0),E.resourceName){const[_,D]=E.resourceName.split("?");E.path=_&&_!=="/"?_:void 0,E.query=D,E.resourceName=void 0}return E.fragment=void 0,E}function u(E,_){if(!E.path)return E.error="URN can not be parsed",E;const D=E.path.match(t);if(D){const T=_.scheme||E.scheme||"urn";E.nid=D[1].toLowerCase(),E.nss=D[2];const M=`${T}:${_.nid||E.nid}`,L=A(M);E.path=void 0,L&&(E=L.parse(E,_))}else E.error=E.error||"URN can not be parsed.";return E}function c(E,_){if(E.nid===void 0)throw new Error("URN without nid cannot be serialized");const D=_.scheme||E.scheme||"urn",T=E.nid.toLowerCase(),M=`${D}:${_.nid||T}`,L=A(M);L&&(E=L.serialize(E,_));const j=E,I=E.nss;return j.path=`${T||_.nid}:${I}`,_.skipEscape=!0,j}function f(E,_){const D=E;return D.uuid=D.nss,D.nss=void 0,!_.tolerant&&(!D.uuid||!e(D.uuid))&&(D.error=D.error||"UUID is not valid."),D}function h(E){const _=E;return _.nss=(E.uuid||"").toLowerCase(),_}const g={scheme:"http",domainHost:!0,parse:o,serialize:s},y={scheme:"https",domainHost:g.domainHost,parse:o,serialize:s},b={scheme:"ws",domainHost:!0,parse:a,serialize:l},v={scheme:"wss",domainHost:b.domainHost,parse:b.parse,serialize:b.serialize},w={http:g,https:y,ws:b,wss:v,urn:{scheme:"urn",parse:u,serialize:c,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:f,serialize:h,skipNormalize:!0}};Object.setPrototypeOf(w,null);function A(E){return E&&(w[E]||w[E.toLowerCase()])||void 0}return oD={wsIsSecure:i,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:A},oD}var Rz;function lZ(){if(Rz)return yy.exports;Rz=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:i,nonSimpleDomain:o}=aZ(),{SCHEMES:s,getSchemeHandler:a}=WTe();function l(v,S){return typeof v=="string"?v=h(y(v,S),S):typeof v=="object"&&(v=y(h(v,S),S)),v}function u(v,S,C){const w=C?Object.assign({scheme:"null"},C):{scheme:"null"},A=c(y(v,w),y(S,w),w,!0);return w.skipEscape=!0,h(A,w)}function c(v,S,C,w){const A={};return w||(v=y(h(v,C),C),S=y(h(S,C),C)),C=C||{},!C.tolerant&&S.scheme?(A.scheme=S.scheme,A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(A.userinfo=S.userinfo,A.host=S.host,A.port=S.port,A.path=t(S.path||""),A.query=S.query):(S.path?(S.path[0]==="/"?A.path=t(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?A.path="/"+S.path:v.path?A.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:A.path=S.path,A.path=t(A.path)),A.query=S.query):(A.path=v.path,S.query!==void 0?A.query=S.query:A.query=v.query),A.userinfo=v.userinfo,A.host=v.host,A.port=v.port),A.scheme=v.scheme),A.fragment=S.fragment,A}function f(v,S,C){return typeof v=="string"?(v=unescape(v),v=h(r(y(v,C),!0),{...C,skipEscape:!0})):typeof v=="object"&&(v=h(r(v,!0),{...C,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=h(r(y(S,C),!0),{...C,skipEscape:!0})):typeof S=="object"&&(S=h(r(S,!0),{...C,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function h(v,S){const C={host:v.host,scheme:v.scheme,userinfo:v.userinfo,port:v.port,path:v.path,query:v.query,nid:v.nid,nss:v.nss,uuid:v.uuid,fragment:v.fragment,reference:v.reference,resourceName:v.resourceName,secure:v.secure,error:""},w=Object.assign({},S),A=[],E=a(w.scheme||C.scheme);E&&E.serialize&&E.serialize(C,w),C.path!==void 0&&(w.skipEscape?C.path=unescape(C.path):(C.path=escape(C.path),C.scheme!==void 0&&(C.path=C.path.split("%3A").join(":")))),w.reference!=="suffix"&&C.scheme&&A.push(C.scheme,":");const _=n(C);if(_!==void 0&&(w.reference!=="suffix"&&A.push("//"),A.push(_),C.path&&C.path[0]!=="/"&&A.push("/")),C.path!==void 0){let D=C.path;!w.absolutePath&&(!E||!E.absolutePath)&&(D=t(D)),_===void 0&&D[0]==="/"&&D[1]==="/"&&(D="/%2F"+D.slice(2)),A.push(D)}return C.query!==void 0&&A.push("?",C.query),C.fragment!==void 0&&A.push("#",C.fragment),A.join("")}const g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function y(v,S){const C=Object.assign({},S),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let A=!1;C.reference==="suffix"&&(C.scheme?v=C.scheme+":"+v:v="//"+v);const E=v.match(g);if(E){if(w.scheme=E[1],w.userinfo=E[3],w.host=E[4],w.port=parseInt(E[5],10),w.path=E[6]||"",w.query=E[7],w.fragment=E[8],isNaN(w.port)&&(w.port=E[5]),w.host)if(i(w.host)===!1){const T=e(w.host);w.host=T.host.toLowerCase(),A=T.isIPV6}else A=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",C.reference&&C.reference!=="suffix"&&C.reference!==w.reference&&(w.error=w.error||"URI is not a "+C.reference+" reference.");const _=a(C.scheme||w.scheme);if(!C.unicodeSupport&&(!_||!_.unicodeSupport)&&w.host&&(C.domainHost||_&&_.domainHost)&&A===!1&&o(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(D){w.error=w.error||"Host's domain name can not be converted to ASCII: "+D}(!_||_&&!_.skipNormalize)&&(v.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),_&&_.parse&&_.parse(w,C)}else w.error=w.error||"URI can not be parsed.";return w}const b={SCHEMES:s,normalize:l,resolve:u,resolveComponent:c,equal:f,serialize:h,parse:y};return yy.exports=b,yy.exports.default=b,yy.exports.fastUri=b,yy.exports}var qTe=lZ();const KM=cs(qTe);function oE(e,t){if(pr in e&&KM.equal(e[pr],t))return e;for(const n of Object.values(e))if(Array.isArray(n)){for(const r of n)if(Bn(r)){const i=oE(r,t);if(i!==void 0)return i}}else if(Bn(n)){const r=oE(n,t);if(r!==void 0)return r}}function sT(e,t){const n=Ve(e,pr,t);mr in e&&(e={...e,[mr]:KM.resolve(n,e[mr])});for(const[r,i]of Object.entries(e))Array.isArray(i)?e={...e,[r]:i.map(o=>Bn(o)?sT(o,n):o)}:Bn(i)&&(e={...e,[r]:sT(i,n)});return e}function YM(e,t){const n=t[e];return[sb(t,[e]),n]}function uZ(e,t={},n=[],r=Ve(t,[pr])){const i=e||"";let o;if(i.startsWith("#")){const a=decodeURIComponent(i.substring(1));r===void 0||pr in t&&t[pr]===r?o=rD.get(t,a):t[zy]===Uw&&(o=oE(t,r.replace(/\/$/,"")),o!==void 0&&(o=rD.get(o,a)))}else if(t[zy]===Uw){const a=r?KM.resolve(r,i):i,[l,...u]=a.replace(/#\/?$/,"").split("#");o=oE(t,l.replace(/\/$/,"")),o!==void 0&&(r=o[pr],gi(u)||(o=rD.get(o,decodeURIComponent(u.join("#")))))}if(o===void 0)throw new Error(`Could not find a definition for ${e}.`);const s=o[mr];if(s){if(n.includes(s)){if(n.length===1)throw new Error(`Definition for ${e} is a circular reference`);const[c,...f]=n,h=[...f,i,c].join(" -> ");throw new Error(`Definition for ${c} contains a circular reference through ${h}`)}const[a,l]=YM(mr,o),u=uZ(l,t,[...n,i],r);return Object.keys(a).length>0?t[zy]===a5e||t[zy]===Uw?{[wc]:[a,u]}:{...a,...u}:u}return o}function XM(e,t={},n=Ve(t,[pr])){return uZ(e,t,[],n)}var GTe="[object String]";function Jd(e){return typeof e=="string"||!Fi(e)&&xa(e)&&Ic(e)==GTe}function hu(e){let t;const n=Ve(e,r5e);return Jd(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function ab(e){return Array.isArray(e)?"array":typeof e=="string"?"string":e==null?"null":typeof e=="boolean"?"boolean":isNaN(e)?typeof e=="object"?"object":"string":"number"}var KTe=$3(function(e){return YQ(Av(e,1,ob,!0))});function il(e){let{type:t}=e;return!t&&e.const?ab(e.const):!t&&e.enum?"string":!t&&(e.properties||e.additionalProperties||e.patternProperties)?"object":(Array.isArray(t)&&(t.length===2&&t.includes("null")?t=t.find(n=>n!=="null"):t=t[0]),t)}function Cc(e,t){const n=Object.assign({},e);return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];return e&&i in e&&fn(s)?r[i]=Cc(o,s):e&&t&&(il(e)==="object"||il(t)==="object")&&i===dQ&&Array.isArray(o)&&Array.isArray(s)?r[i]=KTe(o,s):r[i]=s,r},n)}var YTe="[object Number]";function cZ(e){return typeof e=="number"||xa(e)&&Ic(e)==YTe}function dZ(e,t,n){var r;if(e&&n){const i=Ve(e,n);if(i===void 0)return;for(let o=0;o<t.length;o++){const s=t[o],a=Ve(s,[Hn,n],{});if(!(a.type==="object"||a.type==="array")&&(a.const===i||!((r=a.enum)===null||r===void 0)&&r.includes(i)))return o}}}function JM(e,t,n,r,i){if(t===void 0)return 0;const o=dZ(t,n,i);if(cZ(o))return o;for(let s=0;s<n.length;s++){const a=n[s];if(i&&In(a,[Hn,i])){const l=Ve(t,i),u=Ve(a,[Hn,i],{});if(e.isValid(u,l,r))return s}else if(a[Hn]){const l={anyOf:Object.keys(a[Hn]).map(c=>({required:[c]}))};let u;if(a.anyOf){const{...c}=a;c.allOf?c.allOf=c.allOf.slice():c.allOf=[],c.allOf.push(l),u=c}else u=Object.assign({},a,l);if(delete u.required,e.isValid(u,t,r))return s}else if(e.isValid(a,t,r))return s}return 0}function yo(e,t,n={},r,i,o=!1){return ql(e,t,n,r,void 0,void 0,i,o)[0]}function XTe(e,t,n,r,i,o,s){const{if:a,then:l,else:u,...c}=t,f=e.isValid(a,o||{},n);let h=[c],g=[];if(r)l&&typeof l!="boolean"&&(g=g.concat(ql(e,l,n,o,r,i,s))),u&&typeof u!="boolean"&&(g=g.concat(ql(e,u,n,o,r,i,s)));else{const y=f?l:u;y&&typeof y!="boolean"&&(g=g.concat(ql(e,y,n,o,r,i,s)))}return g.length&&(h=g.map(y=>Cc(c,y))),h.flatMap(y=>ql(e,y,n,o,r,i,s))}function fZ(e){return e.reduce((n,r)=>r.length>1?r.flatMap(i=>PQ(n.length,o=>[...n[o]].concat(i))):(n.forEach(i=>i.push(r[0])),n),[[]])}function hZ(e,t){return Object.keys(e.patternProperties).filter(n=>RegExp(n).test(t)).reduce((n,r)=>(ur(n,[r],e.patternProperties[r]),n),{})}function JTe(e,t,n,r,i,o,s,a){const l=pZ(e,t,n,r,i,o,s,a);if(l.length>1||l[0]!==t)return l;if(_M in t)return mZ(e,t,n,r,i,o,s).flatMap(c=>ql(e,c,n,o,r,i,s));if(wc in t&&Array.isArray(t[wc])){const u=t.allOf.map(f=>ql(e,f,n,o,r,i,s));return fZ(u).map(f=>({...t,allOf:f}))}return[t]}function pZ(e,t,n,r,i,o,s,a){const l=$m(t,n,i,void 0,a);return l!==t?ql(e,l,n,o,r,i,s,a):[t]}function $m(e,t,n,r,i){if(!fn(e))return e;let o=e;if(mr in o){const{$ref:s,...a}=o;if(n.includes(s))return o;n.push(s),o={...XM(s,t,r),...a},pr in o&&(r=o[pr])}if(Hn in o){const s=[],a=EOe(o[Hn],(l,u,c)=>{const f=[...n];l[c]=$m(u,t,f,r,i),s.push(f)},{});zOe(n,XQ(VOe(s))),o={...o,[Hn]:a}}if(Mh in o&&!Array.isArray(o.items)&&typeof o.items!="boolean"&&(o={...o,items:$m(o.items,t,n,r,i)}),i){let s,a;Mn in e&&Array.isArray(e[Mn])?(s=Mn,a=o[Mn]):nn in e&&Array.isArray(e[nn])&&(s=nn,a=o[nn]),s&&a&&(o={...o,[s]:a.map(l=>$m(l,t,n,r,i))})}return _r(e,o)?e:o}function QTe(e,t,n,r,i){const o={...t,properties:{...t.properties}},s=r&&fn(r)?r:{};return Object.keys(s).forEach(a=>{if(!(a in o.properties)){if(X6 in o){const l=hZ(o,a);if(!gi(l)){o.properties[a]=yo(e,{[wc]:Object.values(l)},n,Ve(s,[a]),i),ur(o.properties,[a,fc],!0);return}}if(eb in o&&o.additionalProperties!==!1){let l;typeof o.additionalProperties!="boolean"?mr in o.additionalProperties?l=yo(e,{[mr]:Ve(o.additionalProperties,[mr])},n,s,i):"type"in o.additionalProperties?l={...o.additionalProperties}:Mn in o.additionalProperties||nn in o.additionalProperties?l={type:"object",...o.additionalProperties}:l={type:ab(Ve(s,[a]))}:l={type:ab(Ve(s,[a]))},o.properties[a]=l,ur(o.properties,[a,fc],!0)}else o.properties[a]={type:"null"},ur(o.properties,[a,fc],!0)}}),o}const{compareSchemaDefinitions:ZTe,compareSchemaValues:eRe}=h6e(),{mergeArrayOfSchemaDefinitions:tRe}=w6e({intersectJson:a6e(eRe),deduplicateJsonSchemaDef:JQ(ZTe)}),nRe=E6e(tRe);function rRe(e){return nRe(e)}function ql(e,t,n,r,i=!1,o=[],s,a){return fn(t)?JTe(e,t,n,i,o,r,s,a).flatMap(u=>{var c;let f=u;if(DM in f)return XTe(e,f,n,i,o,r,s);if(wc in f){if(i){const{allOf:g,...y}=f;return[...g,y]}try{const g=[],y=[];(c=f.allOf)===null||c===void 0||c.forEach(b=>{typeof b=="object"&&b.contains?g.push(b):y.push(b)}),g.length&&(f={...f,allOf:y}),f=s?s(f):rRe(f),g.length&&(f.allOf=g)}catch(g){console.warn(`could not merge subschemas in allOf:
|
|
208
208
|
`,g);const{allOf:y,...b}=f;return b}}return Hn in f&&X6 in f&&(f=Object.keys(f.properties).reduce((g,y)=>{const b=hZ(g,y);return gi(b)||(g.properties[y]=yo(e,{allOf:[g.properties[y],...Object.values(b)]},n,Ve(r,[y]),s)),g},{...f,properties:{...f.properties}})),X6 in f||eb in f&&f.additionalProperties!==!1?QTe(e,f,n,r,s):f}):[{}]}function iRe(e,t,n,r,i){let o;const{oneOf:s,anyOf:a,...l}=t;if(Array.isArray(s)?o=s:Array.isArray(a)&&(o=a),o){const u=i===void 0&&r?{}:i,c=hu(t);o=o.map(h=>$m(h,n,[]));const f=JM(e,u,o,n,c);if(r)return o.map(h=>Cc(l,h));t=Cc(l,o[f])}return[t]}function mZ(e,t,n,r,i,o,s){const{dependencies:a,...l}=t;return iRe(e,l,n,r,o).flatMap(c=>gZ(e,a,c,n,r,i,o,s))}function gZ(e,t,n,r,i,o,s,a){let l=[n];for(const u in t){if(!i&&Ve(s,[u])===void 0||n.properties&&!(u in n.properties))continue;const[c,f]=YM(u,t);return Array.isArray(f)?l[0]=oRe(n,f):fn(f)&&(l=sRe(e,n,r,u,f,i,o,s,a)),l.flatMap(h=>gZ(e,c,h,r,i,o,s,a))}return l}function oRe(e,t){if(!t)return e;const n=Array.isArray(e.required)?Array.from(new Set([...e.required,...t])):t;return{...e,required:n}}function sRe(e,t,n,r,i,o,s,a,l){return ql(e,i,n,a,o,s,l).flatMap(c=>{const{oneOf:f,...h}=c;if(t=Cc(t,h),f===void 0)return t;const g=f.map(b=>typeof b=="boolean"||!(mr in b)?[b]:pZ(e,b,n,o,s,a));return fZ(g).flatMap(b=>aRe(e,t,n,r,b,o,s,a,l))})}function aRe(e,t,n,r,i,o,s,a,l){const u=i.filter(c=>{if(typeof c=="boolean"||!c||!c.properties)return!1;const{[r]:f}=c.properties;if(f){const h={type:"object",properties:{[r]:f}};return e.isValid(h,a,n)||o}return!1});return!o&&u.length!==1?(console.warn("ignoring oneOf in dependencies because there isn't exactly one subschema that is valid"),[t]):u.flatMap(c=>{const f=c,[h]=YM(r,f.properties),g={...f,properties:h};return ql(e,g,n,a,o,s,l).map(b=>Cc(t,b))})}function Hy(e,t,n,r,i,o={},s){if(Array.isArray(n[i])){const l=hu(n)||r,u=n[i].map(f=>yo(e,f,t,o,s)),c=Ve(o,l);if(c!==void 0)return u.find(f=>ib(Ve(f,[Hn,l,D3],Ve(f,[Hn,l,ba])),c))}}function yZ(e,t,n,r,i){let o=n;if(In(n,mr)&&(o=yo(e,n,t,void 0,i)),gi(r))return o;const s=Array.isArray(r)?r:r.split("."),[a,...l]=s;if(a&&In(o,a))return o=Ve(o,a),yZ(e,t,o,l,i)}function Ww(e,t,n,r,i,o){const s=yZ(e,t,n,r,o);return s===void 0?i:s}const Iz={title:"!@#$_UNKNOWN_$#@!"};function lRe(e,t,n,r,i={},o){const s=Array.isArray(r)?[...r]:r.split(".");let a=n;const l=s.pop();s.length&&s.forEach(h=>{a=Ww(e,t,a,[Hn,h],{},o),In(a,nn)?a=Hy(e,t,a,l,nn,Ve(i,h),o):In(a,Mn)&&(a=Hy(e,t,a,l,Mn,Ve(i,h),o))}),In(a,nn)?a=Hy(e,t,a,l,nn,i,o):In(a,Mn)&&(a=Hy(e,t,a,l,Mn,i,o));let u=Ww(e,t,a,[Hn,l],Iz,o);u===Iz&&(u=void 0);const c=Ww(e,t,a,dQ,[],o);let f;return u&&Array.isArray(c)&&(f=c.includes(l)),{field:u,isRequired:f}}function uRe(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function cRe(e,t){return function(n,r){if(n==null)return n;if(!ep(n))return e(n,r);for(var i=n.length,o=-1,s=Object(n);++o<i&&r(s[o],o,s)!==!1;);return n}}var bZ=cRe(NQ);function dRe(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}function fRe(e,t,n){var r=Fi(e)?uRe:dRe,i=arguments.length<3;return r(e,HM(t),n,i,bZ)}const hRe={type:"object",$id:n5e,properties:{__not_really_there__:{type:"number"}}};function aT(e,t,n,r,i){let o=0;return n&&(Bn(n.properties)?o+=fRe(n.properties,(s,a,l)=>{const u=Ve(r,l);if(typeof a=="boolean")return s;if(In(a,mr)){const c=yo(e,a,t,u,i);return s+aT(e,t,c,u||{},i)}if((In(a,nn)||In(a,Mn))&&u){const c=In(a,nn)?nn:Mn,f=hu(a);return s+lb(e,t,u,Ve(a,c),-1,f,i)}if(a.type==="object")return Bn(u)&&(s+=1),s+aT(e,t,a,u,i);if(a.type===ab(u)){let c=s+1;return a.default?c+=u===a.default?1:-1:a.const&&(c+=u===a.const?1:-1),c}return s},0):Jd(n.type)&&n.type===ab(r)&&(o+=1)),o}function lb(e,t,n,r,i=-1,o,s){const a=r.map(h=>$m(h,t,[])),l=dZ(n,r,o);if(cZ(l))return l;const u=a.reduce((h,g,y)=>(JM(e,n,[hRe,g],t,o)===1&&h.push(y),h),[]);if(u.length===1)return u[0];u.length||PQ(a.length,h=>u.push(h));const c=new Set,{bestIndex:f}=u.reduce((h,g)=>{const{bestScore:y}=h,b=a[g],v=aT(e,t,b,n,s);return c.add(v),v>y?{bestIndex:g,bestScore:v}:h},{bestIndex:i,bestScore:0});return c.size===1&&i>=0?i:f}function QM(e){return Array.isArray(e.items)&&e.items.length>0&&e.items.every(t=>fn(t))}function sE(e){return e==null}function ub(e,t,n=!1,r=!1,i=!1){if(Array.isArray(t)){const o=Array.isArray(e)?e:[],s=i?o:t,a=i?t:o,l=s.map((u,c)=>a[c]!==void 0?ub(o[c],t[c],n,r,i):u);return(n||i)&&l.length<a.length&&l.push(...a.slice(l.length)),l}if(fn(t)){const o=Object.assign({},e);return Object.keys(t).reduce((s,a)=>{var l;const u=Ve(t,a),c=fn(e)&&a in e,f=a in t,h=(l=Ve(e,a))!==null&&l!==void 0?l:{},g=c&&Object.entries(h).some(([,v])=>fn(v)),y=c&&fn(Ve(e,a)),b=f&&fn(u);return y&&b&&!g?(s[a]={...Ve(e,a),...u},s):(s[a]=ub(Ve(e,a),u,n,r,i&&(c||!f)),s)},o)}return r&&(e!==void 0&&sE(t)||typeof t=="number"&&isNaN(t))||i&&!sE(t)?e:t}function Nh(e,t,n=!1){return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];if(e&&i in e&&fn(s))r[i]=Nh(o,s,n);else if(n&&Array.isArray(o)&&Array.isArray(s)){let a=s;n==="preventDuplicates"&&(a=s.reduce((l,u)=>(o.includes(u)||l.push(u),l),[])),r[i]=o.concat(a)}else r[i]=s;return r},Object.assign({},e))}function vZ(e){return Array.isArray(e.enum)&&e.enum.length===1||ba in e}function ZM(e,t,n={},r){const i=yo(e,t,n,void 0,r),o=i.oneOf||i.anyOf;return Array.isArray(i.enum)?!0:Array.isArray(o)?o.every(s=>typeof s!="boolean"&&vZ(s)):!1}function eP(e,t,n,r){return!t.uniqueItems||!t.items||typeof t.items=="boolean"?!1:ZM(e,t.items,n,r)}function xZ(e){const t=e[ba],n=il(e);return fn(t)&&Jd(t?.$data)&&n!=="object"&&n!=="array"}function pRe(e){if(t5e in e&&Array.isArray(e.enum)&&e.enum.length===1)return e.enum[0];if(ba in e)return e.const;throw new Error("schema cannot be inferred as a constant")}function hg(e,t){if(e.enum){let o;if(t){const{enumNames:s}=$t(t);o=s}return e.enum.map((s,a)=>({label:o?.[a]||String(s),value:s}))}let n,r;e.anyOf?(n=e.anyOf,r=t?.anyOf):e.oneOf&&(n=e.oneOf,r=t?.oneOf);let i=hu(e);if(t){const{optionsSchemaSelector:o=i}=$t(t);i=o}return n&&n.map((o,s)=>{const{title:a}=$t(r?.[s]),l=o;let u,c=a;if(i){const f=Ve(l,[Hn,i],{});u=Ve(f,D3,Ve(f,ba)),c=c||f?.title||l.title||String(u)}else u=pRe(l),c=c||l.title||String(u);return{schema:l,label:c,value:u}})}const mRe=["string","number","integer","boolean","null"];var pg;(function(e){e[e.Ignore=0]="Ignore",e[e.Invert=1]="Invert",e[e.Fallback=2]="Fallback"})(pg||(pg={}));function sD(e,t=pg.Ignore,n=-1){if(n>=0){if(Array.isArray(e.items)&&n<e.items.length){const r=e.items[n];if(typeof r!="boolean")return r}}else if(e.items&&!Array.isArray(e.items)&&typeof e.items!="boolean")return e.items;return t!==pg.Ignore&&fn(e.additionalItems)?e.additionalItems:{}}function SZ(e,t){const{default:n,type:r}=e;return Array.isArray(r)&&r.includes("null")&&gi(t)&&n===null?null:t}function Mz(e,t,n,r,i,o=[],s={},a=!1,l=!1){const{emptyObjectFields:u="populateAllDefaults"}=s;if(r===!0||a)e[t]=n;else if(r==="excludeObjectChildren")(l&&n!==void 0||!fn(n)||!gi(n))&&(e[t]=n);else if(u!=="skipDefaults"){const c=i===void 0?o.includes(t):i;fn(n)?u==="skipEmptyDefaults"?gi(n)||(e[t]=n):(!gi(n)||o.includes(t))&&(c||u!=="populateRequiredDefaults")&&(e[t]=n):n!==void 0&&(u==="populateAllDefaults"||u==="skipEmptyDefaults"||c&&o.includes(t))&&(e[t]=n)}}function $d(e,t,n={}){const{parentDefaults:r,rawFormData:i,rootSchema:o={},includeUndefinedValues:s=!1,_recurseList:a=[],experimental_defaultFormStateBehavior:l=void 0,experimental_customMergeAllOf:u=void 0,required:c,shouldMergeDefaultsIntoFormData:f=!1,initialDefaultsGenerated:h}=n;let g=fn(i)?i:{};const y=fn(t)?t:{};let b=r,v=null,S=l,C=a;if(y[ba]!==void 0&&l?.constAsDefaults!=="never"&&!xZ(y))b=y[ba];else if(fn(b)&&fn(y.default)&&!y[Mn]&&!y[nn]&&!y[mr])b=Nh(b,y.default);else if(D3 in y&&!y[Mn]&&!y[nn]&&!y[mr])b=y.default;else if(mr in y){const E=y[mr];a.includes(E)||(C=a.concat(E),v=XM(E,o));const _=i===void 0||fn(i)&&gi(i);v&&!b&&_&&(b=y.default),f&&v&&!fn(i)&&(g=i)}else if(_M in y){const E={...Pz(e,y,n,b),...g};v=mZ(e,y,o,!1,[],E,u)[0]}else if(QM(y))b=y.items.map((E,_)=>$d(e,E,{rootSchema:o,includeUndefinedValues:s,_recurseList:a,experimental_defaultFormStateBehavior:l,experimental_customMergeAllOf:u,parentDefaults:Array.isArray(r)?r[_]:void 0,rawFormData:g,required:c,shouldMergeDefaultsIntoFormData:f}));else if(nn in y){const{oneOf:E,..._}=y;if(E.length===0)return;const D=hu(y),{type:T="null"}=_;!Array.isArray(T)&&mRe.includes(T)&&S?.constAsDefaults==="skipOneOf"&&(S={...S,constAsDefaults:"never"}),v=E[lb(e,o,i??y.default,E,0,D,u)],v=Cc(_,v)}else if(Mn in y){const{anyOf:E,..._}=y;if(E.length===0)return;const D=hu(y);v=E[lb(e,o,i??y.default,E,0,D,u)],v=Cc(_,v)}if(v)return $d(e,v,{rootSchema:o,includeUndefinedValues:s,_recurseList:C,experimental_defaultFormStateBehavior:S,experimental_customMergeAllOf:u,parentDefaults:b,rawFormData:i??g,required:c,shouldMergeDefaultsIntoFormData:f,initialDefaultsGenerated:h});b===void 0&&(b=y.default);const w=Pz(e,y,n,b);let A=w??b;if(f){const{arrayMinItems:E={}}=l||{},{mergeExtraDefaults:_}=E,D=gRe(e,y,o,i,l,u);(!fn(i)||wc in y)&&(A=ub(A,D,_,!0))}return A}function gRe(e,t,n,r,i,o){const s=!vZ(t)&&ZM(e,t,n,o);let a=r;if(s){const u=hg(t);a=u?.some(f=>_r(f.value,r))?r:void 0}return t[ba]&&i?.constAsDefaults==="always"&&(a=t.const),a}function yRe(e,t,{rawFormData:n,rootSchema:r={},includeUndefinedValues:i=!1,_recurseList:o=[],experimental_defaultFormStateBehavior:s=void 0,experimental_customMergeAllOf:a=void 0,required:l,shouldMergeDefaultsIntoFormData:u,initialDefaultsGenerated:c}={},f){{const h=fn(n)?n:{},g=t,b=s?.allOf==="populateDefaults"&&wc in g||s?.emptyObjectFields!=="skipEmptyDefaults"&&DM in g?yo(e,g,r,h,a):g,v=b[ba],S=Object.keys(b.properties||{}).reduce((C,w)=>{var A;const E=Ve(b,[Hn,w],{}),_=fn(v)&&v[w]!==void 0,D=(fn(E)&&ba in E||_)&&s?.constAsDefaults!=="never"&&!xZ(E),T=$d(e,E,{rootSchema:r,_recurseList:o,experimental_defaultFormStateBehavior:s,experimental_customMergeAllOf:a,includeUndefinedValues:i===!0,parentDefaults:Ve(f,[w]),rawFormData:Ve(h,[w]),required:(A=b.required)===null||A===void 0?void 0:A.includes(w),shouldMergeDefaultsIntoFormData:u,initialDefaultsGenerated:c});return Mz(C,w,T,i,l,b.required,s,D,E?.type==="null"),C},{});if(b.additionalProperties&&!c){const C=fn(b.additionalProperties)?b.additionalProperties:{},w=new Set;fn(f)&&Object.keys(f).filter(E=>!b.properties||!b.properties[E]).forEach(E=>w.add(E));const A=[];Object.keys(h).filter(E=>!b.properties||!b.properties[E]).forEach(E=>{w.add(E),A.push(E)}),w.forEach(E=>{var _;const D=$d(e,C,{rootSchema:r,_recurseList:o,experimental_defaultFormStateBehavior:s,experimental_customMergeAllOf:a,includeUndefinedValues:i===!0,parentDefaults:Ve(f,[E]),rawFormData:Ve(h,[E]),required:(_=b.required)===null||_===void 0?void 0:_.includes(E),shouldMergeDefaultsIntoFormData:u,initialDefaultsGenerated:c});Mz(S,E,D,i,l,A)})}return SZ(t,S)}}function bRe(e,t,{rawFormData:n,rootSchema:r={},_recurseList:i=[],experimental_defaultFormStateBehavior:o=void 0,experimental_customMergeAllOf:s=void 0,required:a,requiredAsRoot:l=!1,shouldMergeDefaultsIntoFormData:u,initialDefaultsGenerated:c}={},f){var h,g;const y=t,b=(h=o?.arrayMinItems)!==null&&h!==void 0?h:{},{populate:v,mergeExtraDefaults:S}=b,C=v==="never",w=v==="requiredOnly",A=v==="all"||!C&&!w,E=(g=b?.computeSkipPopulate)!==null&&g!==void 0?g:(()=>!1),D=o?.emptyObjectFields==="skipEmptyDefaults"?void 0:[];if(Array.isArray(f)&&(f=f.map((j,I)=>{const N=sD(y,pg.Fallback,I),$=Array.isArray(n)?n[I]:void 0;return $d(e,N,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,parentDefaults:j,rawFormData:$,required:a,shouldMergeDefaultsIntoFormData:u,initialDefaultsGenerated:c})})),Array.isArray(n)){const j=sD(y);if(C)f=n;else{const I=n.map(($,z)=>$d(e,j,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,rawFormData:$,parentDefaults:Ve(f,[z]),required:a,shouldMergeDefaultsIntoFormData:u,initialDefaultsGenerated:c}));f=ub(f,I,(w&&a||A)&&S)}}if((fn(y)&&ba in y&&o?.constAsDefaults!=="never")===!1){if(C)return f??D;if(w&&!a)return f||void 0}let M;const L=Array.isArray(f)?f.length:0;if(!y.minItems||eP(e,y,r,s)||E(e,y,r)||y.minItems<=L)M=f||!a&&!l?f:D;else{const j=f||[],I=sD(y,pg.Invert),N=I.default,$=Array.from({length:y.minItems-L},()=>$d(e,I,{parentDefaults:N,rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,required:a,shouldMergeDefaultsIntoFormData:u}));M=j.concat($)}return SZ(t,M)}function Pz(e,t,n={},r){switch(il(t)){case"object":return yRe(e,t,n,r);case"array":return bRe(e,t,n,r)}}function wZ(e,t,n,r,i=!1,o,s,a){if(!fn(t))throw new Error("Invalid schema: "+t);const l=yo(e,t,r,n,s),u=$d(e,l,{rootSchema:r,includeUndefinedValues:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,rawFormData:n,shouldMergeDefaultsIntoFormData:!0,initialDefaultsGenerated:a,requiredAsRoot:!0});if(l.type!=="object"&&fn(l.default))return{...u,...n};if(fn(n)||Array.isArray(n)){const{mergeDefaultsIntoFormData:c}=o||{};return ub(u,n,!0,c==="useDefaultIfFormDataUndefined",!0)}return u}function CZ(e={}){return"widget"in $t(e)&&$t(e).widget!=="hidden"}function EZ(e,t,n={},r,i){if(n[TM]==="files")return!0;if(t.items){const o=yo(e,t.items,r,void 0,i);return o.type==="string"&&o.format==="data-url"}return!1}function vRe(e,t,n={},r,i,o){const s=$t(n,i),{label:a=!0}=s;let l=!!a;if(l){const u=il(t),c=Ve(t,fc,!1);u==="array"&&(l=c||eP(e,t,r,o)||EZ(e,t,n,r,o)||CZ(n)),u==="object"&&(l=c),u==="boolean"&&n&&!n[TM]&&(l=!1),n&&n[o5e]&&(l=!1)}return l}function AZ(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=P3(e,s);n(a,s)&&zM(o,qg(s,e),a)}return o}function xRe(e,t){return AZ(e,t,function(n,r){return BQ(e,r)})}var kZ=sZ(function(e,t){return e==null?{}:xRe(e,t)});function Zf(e,t,n,r,i,o=[],s){if(mr in t||_M in t||wc in t||DM in t){const l=yo(e,t,r,i,s);if(o.findIndex(c=>_r(c,l))===-1)return Zf(e,l,n,r,i,o.concat(l),s)}let a={[zw]:n.replace(/^\./,"")};if(nn in t||Mn in t){const l=nn in t?t.oneOf:t.anyOf,u=hu(t),c=lb(e,r,i,l,0,u,s),f=l[c];a={...a,...Zf(e,f,n,r,i,o,s)}}if(eb in t&&t[eb]!==!1&&ur(a,OM,!0),Mh in t&&Array.isArray(i)){const{items:l,additionalItems:u}=t;Array.isArray(l)?i.forEach((c,f)=>{l[f]?a[f]=Zf(e,l[f],`${n}.${f}`,r,c,o,s):u?a[f]=Zf(e,u,`${n}.${f}`,r,c,o,s):console.warn(`Unable to generate path schema for "${n}.${f}". No schema defined for it`)}):i.forEach((c,f)=>{a[f]=Zf(e,l,`${n}.${f}`,r,c,o,s)})}else if(Hn in t)for(const l in t.properties){const u=Ve(t,[Hn,l],{});a[l]=Zf(e,u,`${n}.${l}`,r,Ve(i,[l]),o,s)}return a}function _Z(e,t,n="",r,i,o){return Zf(e,t,n,r,i,void 0,o)}function DZ(e,t){if(t.length===0&&typeof e!="object")return e;const n=kZ(e,t);return Array.isArray(e)?Object.keys(n).map(r=>n[r]):n}function OZ(e,t){const n=(i,o)=>typeof i!="object"||gi(i)||o&&!gi(i),r=(i,o=[],s=[[]])=>{const a=Object.keys(i);return a.forEach(l=>{const u=i[l];if(typeof u=="object"){const c=s.map(f=>[...f,l]);u[OM]&&u[zw]!==""?o.push(u[zw]):r(u,o,c)}else l===zw&&u!==""&&s.forEach(c=>{const f=Ve(t,c),h=a.length===1;(n(f,h)||Array.isArray(f)&&f.every(g=>n(g,h)))&&o.push(c)})}),o};return r(e)}function SRe(e,t,n={},r){const i=yo(e,t,n,r),o=_Z(e,i,"",n,r),a=OZ(o,r).map(l=>Array.isArray(l)?l.join("."):l);return DZ(r,a)}const Kp=Symbol("no Value");function lT(e,t,n,r,i={},o){let s;if(In(n,Hn)){const a={};if(In(r,Hn)){const c=Ve(r,Hn,{});Object.keys(c).forEach(f=>{In(i,f)&&(a[f]=void 0)})}const l=Object.keys(Ve(n,Hn,{})),u={};l.forEach(c=>{const f=Ve(i,c);let h=Ve(r,[Hn,c],{}),g=Ve(n,[Hn,c],{});In(h,mr)&&(h=yo(e,h,t,f,o)),In(g,mr)&&(g=yo(e,g,t,f,o));const y=Ve(h,"type"),b=Ve(g,"type");if(!y||y===b)if(In(a,c)&&delete a[c],b==="object"||b==="array"&&Array.isArray(f)){const v=lT(e,t,g,h,f,o);(v!==void 0||b==="array")&&(u[c]=v)}else{const v=Ve(g,"default",Kp),S=Ve(h,"default",Kp);v!==Kp&&v!==f&&(S===f?a[c]=v:Ve(g,"readOnly")===!0&&(a[c]=void 0));const C=Ve(g,"const",Kp),w=Ve(h,"const",Kp);C!==Kp&&C!==f&&(a[c]=w===f?C:void 0)}}),s={...typeof i=="string"||Array.isArray(i)?void 0:i,...a,...u}}else if(Ve(r,"type")==="array"&&Ve(n,"type")==="array"&&Array.isArray(i)){let a=Ve(r,"items"),l=Ve(n,"items");if(typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)){In(a,mr)&&(a=yo(e,a,t,i,o)),In(l,mr)&&(l=yo(e,l,t,i,o));const u=Ve(a,"type"),c=Ve(l,"type");if(!u||u===c){const f=Ve(n,"maxItems",-1);c==="object"?s=i.reduce((h,g)=>{const y=lT(e,t,l,a,g,o);return y!==void 0&&(f<0||h.length<f)&&h.push(y),h},[]):s=f>0&&i.length>f?i.slice(0,f):i}}else typeof a=="boolean"&&typeof l=="boolean"&&a===l&&(s=i)}return s}class wRe{constructor(t,n,r,i){n&&n[zy]===Uw?this.rootSchema=sT(n,Ve(n,pr,"#")):this.rootSchema=n,this.validator=t,this.experimental_defaultFormStateBehavior=r,this.experimental_customMergeAllOf=i}getRootSchema(){return this.rootSchema}getValidator(){return this.validator}doesSchemaUtilsDiffer(t,n,r={},i){return!t||!n?!1:this.validator!==t||!_r(this.rootSchema,n)||!_r(this.experimental_defaultFormStateBehavior,r)||this.experimental_customMergeAllOf!==i}findFieldInSchema(t,n,r){return lRe(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}findSelectedOptionInXxxOf(t,n,r,i){return Hy(this.validator,this.rootSchema,t,n,r,i,this.experimental_customMergeAllOf)}getDefaultFormState(t,n,r=!1,i){return wZ(this.validator,t,n,this.rootSchema,r,this.experimental_defaultFormStateBehavior,this.experimental_customMergeAllOf,i)}getDisplayLabel(t,n,r){return vRe(this.validator,t,n,this.rootSchema,r,this.experimental_customMergeAllOf)}getClosestMatchingOption(t,n,r,i){return lb(this.validator,this.rootSchema,t,n,r,i,this.experimental_customMergeAllOf)}getFirstMatchingOption(t,n,r){return JM(this.validator,t,n,this.rootSchema,r)}getFromSchema(t,n,r){return Ww(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}isFilesArray(t,n){return EZ(this.validator,t,n,this.rootSchema,this.experimental_customMergeAllOf)}isMultiSelect(t){return eP(this.validator,t,this.rootSchema,this.experimental_customMergeAllOf)}isSelect(t){return ZM(this.validator,t,this.rootSchema,this.experimental_customMergeAllOf)}omitExtraData(t,n){return SRe(this.validator,t,this.rootSchema,n)}retrieveSchema(t,n,r){return yo(this.validator,t,this.rootSchema,n,this.experimental_customMergeAllOf,r)}sanitizeDataForNewSchema(t,n,r){return lT(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}toPathSchema(t,n,r){return _Z(this.validator,t,n,this.rootSchema,r,this.experimental_customMergeAllOf)}}function CRe(e,t,n={},r){return new wRe(e,t,n,r)}function ERe(e){var t;if(e.indexOf("data:")===-1)throw new Error("File is invalid: URI must be a dataURI");const r=e.slice(5).split(";base64,");if(r.length!==2)throw new Error("File is invalid: dataURI must be base64");const[i,o]=r,[s,...a]=i.split(";"),l=s||"",u=decodeURI(((t=a.map(c=>c.split("=")).find(([c])=>c==="name"))===null||t===void 0?void 0:t[1])||"unknown");try{const c=atob(o),f=new Array(c.length);for(let g=0;g<c.length;g++)f[g]=c.charCodeAt(g);return{blob:new window.Blob([new Uint8Array(f)],{type:l}),name:u}}catch(c){throw new Error("File is invalid: "+c.message)}}function dd(e,t){let n=String(e);for(;n.length<t;)n="0"+n;return n}function TZ(e,t){if(e<=0&&t<=0)e=new Date().getFullYear()+e,t=new Date().getFullYear()+t;else if(e<0||t<0)throw new Error(`Both start (${e}) and stop (${t}) must both be <= 0 or > 0, got one of each`);if(e>t)return TZ(t,e).reverse();const n=[];for(let r=e;r<=t;r++)n.push({value:r,label:dd(r,2)});return n}function jz(e,t){if(Object.is(e,t))return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++){const o=n[i];if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1}return!0}function ARe(e,t){let n=e;if(Array.isArray(t)){const r=n.split(/(%\d)/);t.forEach((i,o)=>{const s=r.findIndex(a=>a===`%${o+1}`);s>=0&&(r[s]=i)}),n=r.join("")}return n}function kRe(e,t){return ARe(e,t)}function no(e,t=[],n){if(Array.isArray(e))return e.map(o=>no(o,t)).filter(o=>o!==n);const r=e===""||e===null?-1:Number(e),i=t[r];return i?i.value:n}function RZ(e,t,n=[]){const r=no(e,n);return Array.isArray(t)?t.filter(i=>!_r(i,r)):_r(r,t)?void 0:t}function L3(e,t){return Array.isArray(t)?t.some(n=>_r(n,e)):_r(t,e)}function tP(e,t=[],n=!1){const r=t.map((i,o)=>L3(i.value,e)?String(o):void 0).filter(i=>typeof i<"u");return n?r:r[0]}function IZ(e,t,n=[]){const r=no(e,n);if(!sE(r)){const i=n.findIndex(a=>r===a.value),o=n.map(({value:a})=>a);return t.slice(0,i).concat(r,t.slice(i)).sort((a,l)=>+(o.indexOf(a)>o.indexOf(l)))}return t}var _Re=1,DRe=4;function nP(e){return f1(e,_Re|DRe)}function ORe(e,t,n,r){return r=typeof r=="function"?r:void 0,e==null?e:zM(e,t,n,r)}class MZ{constructor(t){this.errorSchema={},this.resetAllErrors(t)}get ErrorSchema(){return this.errorSchema}getOrCreateErrorBlock(t){let r=Array.isArray(t)&&t.length>0||typeof t=="string"?Ve(this.errorSchema,t):this.errorSchema;return!r&&t&&(r={},ORe(this.errorSchema,t,r,Object)),r}resetAllErrors(t){return this.errorSchema=t?nP(t):{},this}addErrors(t,n){const r=this.getOrCreateErrorBlock(n);let i=Ve(r,po);return Array.isArray(i)||(i=[],r[po]=i),Array.isArray(t)?ur(r,po,[...new Set([...i,...t])]):ur(r,po,[...new Set([...i,t])]),this}setErrors(t,n){const r=this.getOrCreateErrorBlock(n),i=Array.isArray(t)?[...new Set([...t])]:[t];return ur(r,po,i),this}clearErrors(t){const n=this.getOrCreateErrorBlock(t);return ur(n,po,[]),this}}function TRe(e,t){if(e==null)return{};var n=Wg(GM(e),function(r){return[r]});return t=HM(t),AZ(e,n,function(r,i){return t(r,i[0])})}var RRe=200;function IRe(e,t,n,r){var i=-1,o=qM,s=!0,a=e.length,l=[],u=t.length;if(!a)return l;t.length>=RRe&&(o=rb,s=!1,t=new jh(t));e:for(;++i<a;){var c=e[i],f=c;if(c=c!==0?c:0,s&&f===f){for(var h=u;h--;)if(t[h]===f)continue e;l.push(c)}else o(t,f,r)||l.push(c)}return l}var MRe=$3(function(e,t){return ob(e)?IRe(e,Av(t,1,ob,!0)):[]});function $z(e,t){const n=Xd(e),r=Xd(t);if(e===t||!n&&!r)return[];if(n&&!r)return Fa(e);if(!n&&r)return Fa(t);{const i=Fa(TRe(e,(s,a)=>!_r(s,Ve(t,a)))),o=MRe(Fa(t),Fa(e));return[...i,...o]}}function PRe(e,t,n=[1900,new Date().getFullYear()+2],r="YMD"){const{day:i,month:o,year:s,hour:a,minute:l,second:u}=e,c={type:"day",range:[1,31],value:i},f={type:"month",range:[1,12],value:o},h={type:"year",range:n,value:s},g=[];switch(r){case"MDY":g.push(f,c,h);break;case"DMY":g.push(c,f,h);break;default:g.push(h,f,c)}return t&&g.push({type:"hour",range:[0,23],value:a},{type:"minute",range:[0,59],value:l},{type:"second",range:[0,59],value:u}),g}function PZ(e){const t={};return e.multipleOf&&(t.step=e.multipleOf),(e.minimum||e.minimum===0)&&(t.min=e.minimum),(e.maximum||e.maximum===0)&&(t.max=e.maximum),t}function jZ(e,t,n={},r=!0){const i={type:t||"text",...PZ(e)};return n.inputType?i.type=n.inputType:t||(e.type==="number"?(i.type="number",r&&i.step===void 0&&(i.step="any")):e.type==="integer"&&(i.type="number",i.step===void 0&&(i.step=1))),n.autocomplete&&(i.autoComplete=n.autocomplete),n.accept&&(i.accept=n.accept),i}const Nz={props:{disabled:!1},submitText:"Submit",norender:!1};function $Z(e={}){const t=$t(e);if(t&&t[nE]){const n=t[nE];return{...Nz,...n}}return Nz}function Bt(e,t,n={}){const{templates:r}=t;if(e==="ButtonTemplates")return r[e];if(Object.hasOwn(n,e)&&typeof n[e]=="string"&&Object.hasOwn(r,n[e])){const i=n[e];return r[i]}return n[e]||r[e]}var jRe=0;function NZ(e){var t=++jRe;return LM(e)+t}function rP(){if(typeof process>"u"||Ve(process,"env.NODE_ENV")!=="test")return{};const e=new Map;return new Proxy({},{get(t,n){return e.has(n)||e.set(n,NZ("test-id-")),e.get(n)}})}var aD={exports:{}},nr={};var Lz;function $Re(){if(Lz)return nr;Lz=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function b(v){if(typeof v=="object"&&v!==null){var S=v.$$typeof;switch(S){case e:switch(v=v.type,v){case n:case i:case r:case u:case c:return v;default:switch(v=v&&v.$$typeof,v){case a:case s:case l:case h:case f:case o:return v;default:return S}}case t:return S}}}return nr.ContextConsumer=s,nr.ContextProvider=o,nr.Element=e,nr.ForwardRef=l,nr.Fragment=n,nr.Lazy=h,nr.Memo=f,nr.Portal=t,nr.Profiler=i,nr.StrictMode=r,nr.Suspense=u,nr.SuspenseList=c,nr.isAsyncMode=function(){return!1},nr.isConcurrentMode=function(){return!1},nr.isContextConsumer=function(v){return b(v)===s},nr.isContextProvider=function(v){return b(v)===o},nr.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},nr.isForwardRef=function(v){return b(v)===l},nr.isFragment=function(v){return b(v)===n},nr.isLazy=function(v){return b(v)===h},nr.isMemo=function(v){return b(v)===f},nr.isPortal=function(v){return b(v)===t},nr.isProfiler=function(v){return b(v)===i},nr.isStrictMode=function(v){return b(v)===r},nr.isSuspense=function(v){return b(v)===u},nr.isSuspenseList=function(v){return b(v)===c},nr.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===n||v===i||v===r||v===u||v===c||v===g||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===f||v.$$typeof===o||v.$$typeof===s||v.$$typeof===l||v.$$typeof===y||v.getModuleId!==void 0)},nr.typeOf=b,nr}var Fz;function NRe(){return Fz||(Fz=1,aD.exports=$Re()),aD.exports}var LRe=NRe();const Bz=cs(LRe),lD={boolean:{checkbox:"CheckboxWidget",radio:"RadioWidget",select:"SelectWidget",hidden:"HiddenWidget"},string:{text:"TextWidget",password:"PasswordWidget",email:"EmailWidget",hostname:"TextWidget",ipv4:"TextWidget",ipv6:"TextWidget",uri:"URLWidget","data-url":"FileWidget",radio:"RadioWidget",select:"SelectWidget",textarea:"TextareaWidget",hidden:"HiddenWidget",date:"DateWidget",datetime:"DateTimeWidget","date-time":"DateTimeWidget","alt-date":"AltDateWidget","alt-datetime":"AltDateTimeWidget",time:"TimeWidget",color:"ColorWidget",file:"FileWidget"},number:{text:"TextWidget",select:"SelectWidget",updown:"UpDownWidget",range:"RangeWidget",radio:"RadioWidget",hidden:"HiddenWidget"},integer:{text:"TextWidget",select:"SelectWidget",updown:"UpDownWidget",range:"RangeWidget",radio:"RadioWidget",hidden:"HiddenWidget"},array:{select:"SelectWidget",checkboxes:"CheckboxesWidget",files:"FileWidget",hidden:"HiddenWidget"}};function FRe(e){let t=Ve(e,"MergedWidget");if(!t){const n=e.defaultProps&&e.defaultProps.options||{};t=({options:r,...i})=>m.jsx(e,{options:{...n,...r},...i}),ur(e,"MergedWidget",t)}return t}function pu(e,t,n={}){const r=il(e);if(typeof t=="function"||t&&Bz.isForwardRef(O.createElement(t))||Bz.isMemo(t))return FRe(t);if(typeof t!="string")throw new Error(`Unsupported widget definition: ${typeof t} in schema: ${JSON.stringify(e)}`);if(t in n){const i=n[t];return pu(e,i,n)}if(typeof r=="string"){if(!(r in lD))throw new Error(`No widget for type '${r}' in schema: ${JSON.stringify(e)}`);if(t in lD[r]){const i=n[lD[r][t]];return pu(e,i,n)}}throw new Error(`No widget '${t}' for type '${r}' in schema: ${JSON.stringify(e)}`)}function BRe(e){let t=0;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return t.toString(16)}function zRe(e){const t=new Set;return JSON.stringify(e,(n,r)=>(t.add(n),r)),JSON.stringify(e,Array.from(t).sort())}function Gl(e){return BRe(zRe(e))}function URe(e){return Gl(e)}function HRe(e,t,n={}){try{return pu(e,t,n),!0}catch(r){const i=r;if(i.message&&(i.message.startsWith("No widget")||i.message.startsWith("Unsupported widget")))return!1;throw r}}function np(e,t){return`${Jd(e)?e:e[pr]}__${t}`}function rp(e){return np(e,"description")}function iP(e){return np(e,"error")}function F3(e){return np(e,"examples")}function oP(e){return np(e,"help")}function B3(e){return np(e,"title")}function Us(e,t=!1){const n=t?` ${F3(e)}`:"";return`${iP(e)} ${rp(e)} ${oP(e)}${n}`}function z3(e,t){return`${e}-${t}`}function Kl(e,t){return np(e,t)}function uD(e,t){return np(e,`optional${t}`)}function Kg(e){return!sE(e)&&(!Bn(e)||Array.isArray(e)||!gi(e))}function VRe(e,t){const{rootSchema:n,schemaUtils:r}=e;if(ib(t,n))return!0;if(mr in n){const i=r.retrieveSchema(n);return ib(t,i)}return!1}function ip(e,t,n){return t?n:e}function WRe(e){return e?new Date(e).toJSON():void 0}function sP(e,t,n){const r=[i5e];return In(e,UB)&&r.unshift(UB),Ve(e,[...r,t],n)}function qRe(e,t){if(!Array.isArray(t))return e;const n=c=>c.reduce((f,h)=>(f[h]=!0,f),{}),r=c=>c.length>1?`properties '${c.join("', '")}'`:`property '${c[0]}'`,i=n(e),o=t.filter(c=>c==="*"||i[c]),s=n(o),a=e.filter(c=>!s[c]),l=o.indexOf("*");if(l===-1){if(a.length)throw new Error(`uiSchema order list does not contain ${r(a)}`);return o}if(l!==o.lastIndexOf("*"))throw new Error("uiSchema order list contains more than one wildcard item");const u=[...o];return u.splice(l,1,...a),u}function cD(e,t=!0){if(!e)return{year:-1,month:-1,day:-1,hour:t?-1:0,minute:t?-1:0,second:t?-1:0};const n=new Date(e);if(Number.isNaN(n.getTime()))throw new Error("Unable to parse date "+e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:t?n.getUTCHours():0,minute:t?n.getUTCMinutes():0,second:t?n.getUTCSeconds():0}}const GRe=[Mh,eb],KRe=[nn,Mn,wc];function qw(e,t,n,r=new Set){const{rootSchema:i,uiSchemaDefinitions:o}=n;let s={...t},a=e;const l=e[mr],u=l&&r.has(l);if(l){if(r.add(l),o&&l in o&&(s=Nh(o[l],s)),u)return s;try{a=XM(l,i)}catch{a=e}}const c=a[Hn];if(c&&fn(c))for(const[f,h]of Object.entries(c)){const g=s[f]||{},y=qw(h,g,n,new Set(r));Object.keys(y).length>0&&(s[f]=y)}for(const f of GRe){const h=a[f];if(h&&fn(h)&&!Array.isArray(h)){const g=s[f];if(typeof g!="function"){const b=qw(h,g||{},n,new Set(r));Object.keys(b).length>0&&(s[f]=b)}}}for(const f of KRe){const h=a[f];if(Array.isArray(h)&&h.length>0){const g=s[f],y=Array.isArray(g)?[...g]:[];let b=!1;for(let v=0;v<h.length;v++){const S=h[v],C=y[v]||{},w=qw(S,C,n,new Set(r));Object.keys(w).length>0&&(y[v]=w,b=!0)}b&&(s[f]=y)}}return s}function YRe(e,t,n){var r;const i=e[mr],o=i?(r=n.uiSchemaDefinitions)===null||r===void 0?void 0:r[i]:void 0;return o?!t||Object.keys(t).length===0?{...o}:Nh(o,t):t||{}}function h1(e){if(e.const||e.enum&&e.enum.length===1&&e.enum[0]===!0)return!0;if(e.anyOf&&e.anyOf.length===1)return h1(e.anyOf[0]);if(e.oneOf&&e.oneOf.length===1)return h1(e.oneOf[0]);if(e.allOf){const t=n=>h1(n);return e.allOf.some(t)}return!1}function LZ(e,t,n,r="customDeep"){if(r==="always")return!0;if(r==="shallow"){const{props:s,state:a}=e;return!jz(s,t)||!jz(a,n)}const{props:i,state:o}=e;return!_r(i,t)||!_r(o,n)}function zz(e){const t=XQ(e.map(n=>Bn(n)?il(n):void 0).flat().filter(n=>n!==void 0));return t.length===1?t[0]:t}function kv(e,t,n,r){const{enableOptionalDataFieldForType:i=[]}=$t(r,e.globalUiOptions);let o;return Mn in t&&Array.isArray(t[Mn])?o=zz(t[Mn]):nn in t&&Array.isArray(t[nn])?o=zz(t[nn]):o=il(t),!VRe(e,t)&&!n&&!!o&&!Array.isArray(o)&&!!i.find(s=>s===o)}function Uz(e,t=!0){const{year:n,month:r,day:i,hour:o=0,minute:s=0,second:a=0}=e,l=Date.UTC(n,r-1,i,o,s,a),u=new Date(l).toJSON();return t?u:u.slice(0,10)}function aP(e,t=[]){if(!e)return[];let n=[];return po in e&&(n=n.concat(e[po].map(r=>{const i=`.${t.join(".")}`;return{property:i,message:r,stack:`${i} ${r}`}}))),Object.keys(e).reduce((r,i)=>{if(i!==po){const o=e[i];Xd(o)&&(r=r.concat(aP(o,[...t,i])))}return r},n)}function FZ(e){return Fi(e)?Wg(e,tp):Cv(e)?[e]:WM(OQ(LM(e)))}function XRe(e){const t=new MZ;return e.length&&e.forEach(n=>{const{property:r,message:i}=n,o=r==="."?[]:FZ(r);o.length>0&&o[0]===""&&o.splice(0,1),i&&t.addErrors(i,o)}),t.ErrorSchema}function Sa(e,t,n,r){const i=Array.isArray(n)?n:n?.path,o=e===""?[]:[e],s=i?i.concat(...o):o,a=[t.idPrefix,...s].join(t.idSeparator);let l;return t.nameGenerator&&s.length>0&&(l=t.nameGenerator(s,t.idPrefix,r)),{path:s,[pr]:a,...l!==void 0&&{name:l}}}function BZ(e){return Object.keys(e).reduce((t,n)=>{if(n==="addError")return t;{const r=e[n];return Xd(r)?{...t,[n]:BZ(r)}:{...t,[n]:r}}},{})}function JRe(e){return Object.values(e).every(t=>t!==-1)}function QRe(e){const{className:t="form-control",type:n,range:r,value:i,select:o,rootId:s,name:a,disabled:l,readonly:u,autofocus:c,registry:f,onBlur:h,onFocus:g}=e,y=`${s}_${n}`,{SelectWidget:b}=f.widgets,v=O.useCallback(S=>o(n,S),[o,n]);return m.jsx(b,{schema:{type:"integer"},id:y,name:a,className:t,options:{enumOptions:TZ(r[0],r[1])},placeholder:n,value:i,disabled:l,readonly:u,autofocus:c,onChange:v,onBlur:h,onFocus:g,registry:f,label:"","aria-describedby":Us(s)})}function ZRe(e){const{time:t=!1,disabled:n=!1,readonly:r=!1,options:i,onChange:o,value:s}=e,[a,l]=O.useState(cD(s,t));O.useEffect(()=>{l(cD(s,t))},[t,s]);const u=O.useCallback((g,y)=>{const b={...a,[g]:typeof y>"u"?-1:y};JRe(b)?o(Uz(b,t)):l(b)},[a,o,t]),c=O.useCallback(g=>{g.preventDefault(),!(n||r)&&o(void 0)},[n,r,o]),f=O.useCallback(g=>{if(g.preventDefault(),n||r)return;const y=cD(new Date().toJSON(),t);o(Uz(y,t))},[n,r,t,o]);return{elements:O.useMemo(()=>PRe(a,t,i.yearsRange,i.format),[a,t,i.yearsRange,i.format]),handleChange:u,handleClear:c,handleSetNow:f}}function op(e){const t=O.useRef(e);return ib(e,t.current)||(t.current=e),t.current}function eIe(e,t){return e.replace(";base64",`;name=${encodeURIComponent(t)};base64`)}function tIe(e){const{name:t,size:n,type:r}=e;return new Promise((i,o)=>{const s=new window.FileReader;s.onerror=o,s.onload=a=>{var l;typeof((l=a.target)===null||l===void 0?void 0:l.result)=="string"?i({dataURL:eIe(a.target.result,t),name:t,size:n,type:r}):i({dataURL:null,name:t,size:n,type:r})},s.readAsDataURL(e)})}function nIe(e){return Promise.all(Array.from(e).map(tIe))}function Hz(e){return e.reduce((t,n)=>{if(!n)return t;try{const{blob:r,name:i}=ERe(n);return[...t,{dataURL:n,name:i,size:r.size,type:r.type}]}catch{return t}},[])}function rIe(e,t,n=!1){const r=O.useMemo(()=>n&&e?Array.isArray(e)?e:[e]:[],[e,n]),i=O.useMemo(()=>Array.isArray(e)?Hz(e):Hz([e||""]),[e]),o=O.useCallback(a=>{nIe(a).then(l=>{const u=l.map(c=>c.dataURL||null);t(n?r.concat(...u):u[0])})},[r,n,t]),s=O.useCallback(a=>{if(n){const l=r.filter((u,c)=>c!==a);t(l)}else t(void 0)},[r,n,t]);return{filesInfo:i,handleChange:o,handleRemove:s}}function iIe(e){if(!e)return"";const t=new Date(e),n=dd(t.getFullYear(),4),r=dd(t.getMonth()+1,2),i=dd(t.getDate(),2),o=dd(t.getHours(),2),s=dd(t.getMinutes(),2),a=dd(t.getSeconds(),2),l=dd(t.getMilliseconds(),3);return`${n}-${r}-${i}T${o}:${s}:${a}.${l}`}function Gw(e,t,n=!1){if(!t)return e;const{errors:r,errorSchema:i}=e;let o=aP(t),s=t;return gi(i)||(s=Nh(i,t,n?"preventDuplicates":!0),o=[...r].concat(o)),{errorSchema:s,errors:o}}function oIe(e){for(const t in e){const n=e,r=n[t];t===mr&&typeof r=="string"&&r.startsWith("#")?n[t]=pQ+r:n[t]=lP(r)}return e}function sIe(e){for(let t=0;t<e.length;t++)e[t]=lP(e[t]);return e}function lP(e){return Array.isArray(e)?sIe([...e]):Bn(e)?oIe({...e}):e}var un;(function(e){e.ArrayItemTitle="Item",e.MissingItems="Missing items definition",e.EmptyArray="No items yet. Use the button below to add some.",e.YesLabel="Yes",e.NoLabel="No",e.CloseLabel="Close",e.ErrorsLabel="Errors",e.NewStringDefault="New Value",e.AddButton="Add",e.AddItemButton="Add Item",e.CopyButton="Copy",e.MoveDownButton="Move down",e.MoveUpButton="Move up",e.RemoveButton="Remove",e.NowLabel="Now",e.ClearLabel="Clear",e.AriaDateLabel="Select a date",e.PreviewLabel="Preview",e.DecrementAriaLabel="Decrease value by 1",e.IncrementAriaLabel="Increase value by 1",e.OptionalObjectAdd="Add data for optional field",e.OptionalObjectRemove="Remove data for optional field",e.OptionalObjectEmptyMsg="No data for optional field",e.Type="Type",e.Value="Value",e.ClearButton="clear input",e.UnknownFieldType="Unknown field type %1",e.OptionPrefix="Option %1",e.TitleOptionPrefix="%1 option %2",e.KeyLabel="%1 Key",e.InvalidObjectField='Invalid "%1" object field configuration: _%2_.',e.UnsupportedField="Unsupported field schema.",e.UnsupportedFieldWithId="Unsupported field schema for field `%1`.",e.UnsupportedFieldWithReason="Unsupported field schema: _%1_.",e.UnsupportedFieldWithIdAndReason="Unsupported field schema for field `%1`: _%2_.",e.FilesInfo="**%1** (%2, %3 bytes)"})(un||(un={}));function aIe(e,t){var n=Fi(e)?UM:bZ;return n(e,IQ(t))}function lIe(e,t){return e==null?!0:oZ(e,t)}function uT(){return NZ("rjsf-array-item-")}function Vz(e){return Array.isArray(e)?e.map(t=>({key:uT(),item:t})):[]}function zZ(e){return Array.isArray(e)?e.map(t=>t.item):[]}function uIe(e){return Array.isArray(e.type)?!e.type.includes("null"):e.type!=="null"}function UZ(e,t,n,r){let{addable:i}=$t(r,e.globalUiOptions);return i!==!1&&(t.maxItems!==void 0?i=n.length<t.maxItems:i=!0),i}function HZ(e,t,n,r){if(typeof e.items=="function")try{return e.items(t,n,r)}catch(i){console.error(`Error executing dynamic uiSchema.items function for item at index ${n}:`,i);return}else return e.items}function cIe(e,t){const{schemaUtils:n,globalFormOptions:r}=e;let i=t.items;return r.useFallbackUiForUnsupportedType&&!i?i={}:QM(t)&&e5e(t)&&(i=t.additionalItems),n.getDefaultFormState(i)}function dIe(e){const{schema:t,fieldPathId:n,uiSchema:r,formData:i=[],disabled:o=!1,readonly:s=!1,autofocus:a=!1,required:l=!1,placeholder:u,onBlur:c,onFocus:f,registry:h,rawErrors:g,name:y,onSelectChange:b}=e,{widgets:v,schemaUtils:S,globalFormOptions:C,globalUiOptions:w}=h,A=S.retrieveSchema(t.items,i),E=hg(A,r),{widget:_="select",title:D,...T}=$t(r,w),M=pu(t,_,v),L=D??t.title??y,j=S.getDisplayLabel(t,r,w),I=op(Sa("",C,n,!0));return m.jsx(M,{id:I[pr],name:y,multiple:!0,onChange:b,onBlur:c,onFocus:f,options:{...T,enumOptions:E},schema:t,uiSchema:r,registry:h,value:i,disabled:o,readonly:s,required:l,label:L,hideLabel:!j,placeholder:u,autofocus:a,rawErrors:g,htmlName:I.name})}function fIe(e){const{schema:t,fieldPathId:n,uiSchema:r,disabled:i=!1,readonly:o=!1,autofocus:s=!1,required:a=!1,hideError:l,placeholder:u,onBlur:c,onFocus:f,formData:h=[],registry:g,rawErrors:y,name:b,onSelectChange:v}=e,{widgets:S,schemaUtils:C,globalFormOptions:w,globalUiOptions:A}=g,{widget:E,title:_,...D}=$t(r,A),T=pu(t,E,S),M=_??t.title??b,L=C.getDisplayLabel(t,r,A),j=op(Sa("",w,n,!0));return m.jsx(T,{id:j[pr],name:b,multiple:!0,onChange:v,onBlur:c,onFocus:f,options:D,schema:t,uiSchema:r,registry:g,value:h,disabled:i,readonly:o,hideError:l,required:a,label:M,hideLabel:!L,placeholder:u,autofocus:s,rawErrors:y,htmlName:j.name})}function hIe(e){const{schema:t,uiSchema:n,fieldPathId:r,name:i,disabled:o=!1,readonly:s=!1,autofocus:a=!1,required:l=!1,onBlur:u,onFocus:c,registry:f,formData:h=[],rawErrors:g,onSelectChange:y}=e,{widgets:b,schemaUtils:v,globalFormOptions:S,globalUiOptions:C}=f,{widget:w="files",title:A,...E}=$t(n,C),_=pu(t,w,b),D=A??t.title??i,T=v.getDisplayLabel(t,n,C),M=op(Sa("",S,r,!0));return m.jsx(_,{options:E,id:M[pr],name:i,multiple:!0,onChange:y,onBlur:u,onFocus:c,schema:t,uiSchema:n,value:h,disabled:o,readonly:s,required:l,registry:f,autofocus:a,rawErrors:g,label:D,hideLabel:!T,htmlName:M.name})}function VZ(e){const{itemKey:t,index:n,name:r,disabled:i,hideError:o,readonly:s,registry:a,uiOptions:l,parentUiSchema:u,canAdd:c,canRemove:f=!0,canMoveUp:h,canMoveDown:g,itemSchema:y,itemData:b,itemUiSchema:v,itemFieldPathId:S,itemErrorSchema:C,autofocus:w,onBlur:A,onFocus:E,onChange:_,rawErrors:D,totalItems:T,title:M,handleAddItem:L,handleCopyItem:j,handleRemoveItem:I,handleReorderItems:N}=e,{schemaUtils:$,fields:{ArraySchemaField:z,SchemaField:F},globalUiOptions:G}=a,V=op(S),H=z||F,X=Bt("ArrayFieldItemTemplate",a,l),B=$.getDisplayLabel(y,v,G),{description:W}=$t(v),Y=!!W||!!y.description,{orderable:U=!0,removable:K=!0,copyable:Z=!1}=l,J={moveUp:U&&h,moveDown:U&&g,copy:Z&&c,remove:K&&f,toolbar:!1};J.toolbar=Object.keys(J).some(ce=>J[ce]);const Q=O.useCallback(ce=>{L(ce,n+1)},[L,n]),ie=O.useCallback(ce=>{j(ce,n)},[j,n]),ue=O.useCallback(ce=>{I(ce,n)},[I,n]),te=O.useCallback(ce=>{N(ce,n,n-1)},[N,n]),ne=O.useCallback(ce=>{N(ce,n,n+1)},[N,n]),oe={children:m.jsx(H,{name:r,title:M,index:n,schema:y,uiSchema:v,formData:b,errorSchema:C,fieldPathId:V,required:uIe(y),onChange:_,onBlur:A,onFocus:E,registry:a,disabled:i,readonly:s,hideError:o,autofocus:w,rawErrors:D}),buttonsProps:{fieldPathId:V,disabled:i,readonly:s,canAdd:c,hasCopy:J.copy,hasMoveUp:J.moveUp,hasMoveDown:J.moveDown,hasRemove:J.remove,index:n,totalItems:T,onAddItem:Q,onCopyItem:ie,onRemoveItem:ue,onMoveUpItem:te,onMoveDownItem:ne,registry:a,schema:y,uiSchema:v},itemKey:t,className:"rjsf-array-item",disabled:i,hasToolbar:J.toolbar,index:n,totalItems:T,readonly:s,registry:a,schema:y,uiSchema:v,parentUiSchema:u,displayLabel:B,hasDescription:Y};return m.jsx(X,{...oe})}function pIe(e){const{schema:t,uiSchema:n={},errorSchema:r,fieldPathId:i,formData:o,name:s,title:a,disabled:l=!1,readonly:u=!1,autofocus:c=!1,required:f=!1,hideError:h=!1,registry:g,onBlur:y,onFocus:b,rawErrors:v,onChange:S,keyedFormData:C,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:_}=e,D=t.title||a||s,{schemaUtils:T,fields:M,formContext:L,globalFormOptions:j,globalUiOptions:I}=g,{OptionalDataControlsField:N}=M,$=$t(n,I),z=Bn(t.items)?t.items:{},F=T.retrieveSchema(z),G=zZ(C),V=kv(g,t,f,n),H=Kg(o),X=UZ(g,t,G,n)&&(!V||H),B=H?C:[],W=V?" rjsf-optional-array-field":"",Y=e.childFieldPathId??i,U=V?m.jsx(N,{...e,fieldPathId:Y}):void 0,K={canAdd:X,items:B.map((J,Q)=>{const{key:ie,item:ue}=J,te=ue,ne=T.retrieveSchema(z,te),oe=r?r[Q]:void 0,ce=Sa(Q,j,Y),pe=HZ(n,ue,Q,L),we={itemKey:ie,index:Q,name:s&&`${s}-${Q}`,registry:g,uiOptions:$,hideError:h,readonly:u,disabled:l,required:f,title:D?`${D}-${Q+1}`:void 0,canAdd:X,canMoveUp:Q>0,canMoveDown:Q<G.length-1,itemSchema:ne,itemFieldPathId:ce,itemErrorSchema:oe,itemData:te,itemUiSchema:pe,autofocus:c&&Q===0,onBlur:y,onFocus:b,rawErrors:v,totalItems:C.length,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:_,onChange:S};return m.jsx(VZ,{...we},ie)}),className:`rjsf-field rjsf-field-array rjsf-field-array-of-${F.type}${W}`,disabled:l,fieldPathId:i,uiSchema:n,onAddClick:w,readonly:u,required:f,schema:t,title:D,formData:G,rawErrors:v,registry:g,optionalDataControl:U},Z=Bt("ArrayFieldTemplate",g,$);return m.jsx(Z,{...K})}function mIe(e){const{schema:t,uiSchema:n={},formData:r,errorSchema:i,fieldPathId:o,name:s,title:a,disabled:l=!1,readonly:u=!1,autofocus:c=!1,required:f=!1,hideError:h=!1,registry:g,onBlur:y,onFocus:b,rawErrors:v,keyedFormData:S,onChange:C,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:_}=e;let{formData:D=[]}=e;const T=t.title||a||s,{schemaUtils:M,fields:L,formContext:j,globalFormOptions:I,globalUiOptions:N}=g,$=$t(n,N),{OptionalDataControlsField:z}=L,F=kv(g,t,f,n),G=Kg(r),H=(Bn(t.items)?t.items:[]).map((Q,ie)=>M.retrieveSchema(Q,D[ie])),X=Bn(t.additionalItems)?M.retrieveSchema(t.additionalItems,r):null,B=e.childFieldPathId??o;D.length<H.length&&(D=D.concat(new Array(H.length-D.length)));const W=G?S:[],Y=F?" rjsf-optional-array-field":"",U=F?m.jsx(z,{...e,fieldPathId:B}):void 0,K=UZ(g,t,D,n)&&!!X&&(!F||G),Z={canAdd:K,className:`rjsf-field rjsf-field-array rjsf-field-array-fixed-items${Y}`,disabled:l,fieldPathId:o,formData:r,items:W.map((Q,ie)=>{const{key:ue,item:te}=Q,ne=te,oe=ie>=H.length,ce=(oe&&Bn(t.additionalItems)?M.retrieveSchema(t.additionalItems,ne):H[ie])||{},pe=Sa(ie,I,B);let we;oe?we=n.additionalItems:Array.isArray(n.items)?we=n.items[ie]:we=HZ(n,te,ie,j);const ke=i?i[ie]:void 0,Ae={index:ie,itemKey:ue,name:s&&`${s}-${ie}`,registry:g,uiOptions:$,hideError:h,readonly:u,disabled:l,required:f,title:T?`${T}-${ie+1}`:void 0,canAdd:K,canRemove:oe,canMoveUp:ie>=H.length+1,canMoveDown:oe&&ie<D.length-1,itemSchema:ce,itemData:ne,itemUiSchema:we,itemFieldPathId:pe,itemErrorSchema:ke,autofocus:c&&ie===0,onBlur:y,onFocus:b,rawErrors:v,totalItems:S.length,onChange:C,handleAddItem:w,handleCopyItem:A,handleRemoveItem:E,handleReorderItems:_};return m.jsx(VZ,{...Ae},ue)}),onAddClick:w,readonly:u,required:f,registry:g,schema:t,uiSchema:n,title:T,errorSchema:i,rawErrors:v,optionalDataControl:U},J=Bt("ArrayFieldTemplate",g,$);return m.jsx(J,{...Z})}function gIe(e=[]){const t=O.useMemo(()=>Gl(e),[e]),[n,r]=O.useState(()=>({formDataHash:t,keyedFormData:Vz(e)}));let{keyedFormData:i,formDataHash:o}=n;if(t!==o){const a=Array.isArray(e)?e:[],l=i||[];i=a.length===l.length?l.map((u,c)=>({key:u.key,item:a[c]})):Vz(a),o=t,r({formDataHash:o,keyedFormData:i})}const s=O.useCallback(a=>{const l=zZ(a),u=Gl(l);return r({formDataHash:u,keyedFormData:a}),l},[]);return{keyedFormData:i,updateKeyedFormData:s}}function yIe(e){const{schema:t,uiSchema:n,errorSchema:r,fieldPathId:i,registry:o,formData:s,onChange:a}=e,{globalFormOptions:l,schemaUtils:u,translateString:c}=o,{keyedFormData:f,updateKeyedFormData:h}=gIe(s),g=e.childFieldPathId??i,y=O.useCallback((_,D)=>{_&&_.preventDefault();let T;if(r){T={};for(const j in r){const I=parseInt(j);D===void 0||I<D?ur(T,[I],r[j]):I>=D&&ur(T,[I+1],r[j])}}const M={key:uT(),item:cIe(o,t)},L=[...f];D!==void 0?L.splice(D,0,M):L.push(M),a(h(L),g.path,T)},[f,o,t,a,h,r,g]),b=O.useCallback((_,D)=>{_&&_.preventDefault();let T;if(r){T={};for(const j in r){const I=parseInt(j);I<=D?ur(T,[I],r[j]):I>D&&ur(T,[I+1],r[j])}}const M={key:uT(),item:nP(f[D].item)},L=[...f];D!==void 0?L.splice(D+1,0,M):L.push(M),a(h(L),g.path,T)},[f,a,h,r,g]),v=O.useCallback((_,D)=>{_&&_.preventDefault();let T;if(r){T={};for(const L in r){const j=parseInt(L);j<D?ur(T,[j],r[L]):j>D&&ur(T,[j-1],r[L])}}const M=f.filter((L,j)=>j!==D);a(h(M),g.path,T)},[f,a,h,r,g]),S=O.useCallback((_,D,T)=>{_&&(_.preventDefault(),_.currentTarget.blur());let M;if(r){M={};for(const I in r){const N=parseInt(I);N==D?ur(M,[T],r[D]):N==T?ur(M,[D],r[T]):ur(M,[I],r[N])}}function L(){const I=f.slice();return I.splice(D,1),I.splice(T,0,f[D]),I}const j=L();a(h(j),g.path,M)},[f,a,h,r,g]),C=O.useCallback((_,D,T,M)=>{a(_===void 0?null:_,D,T,M)},[a]),w=O.useCallback(_=>{a(_,g.path,void 0,g?.[pr])},[a,g]),A={...e,formData:s,fieldPathId:g,onSelectChange:w},E={...e,handleAddItem:y,handleCopyItem:b,handleRemoveItem:v,handleReorderItems:S,keyedFormData:f,onChange:C};if(!(Mh in t)){if(!l.useFallbackUiForUnsupportedType){const D=$t(n),T=Bt("UnsupportedFieldTemplate",o,D);return m.jsx(T,{schema:t,fieldPathId:i,reason:c(un.MissingItems),registry:o})}const _={...t,[Mh]:{type:void 0}};A.schema=_,E.schema=_}return u.isMultiSelect(A.schema)?m.jsx(dIe,{...A}):CZ(n)?m.jsx(fIe,{...A}):QM(A.schema)?m.jsx(mIe,{...E}):u.isFilesArray(A.schema,n)?m.jsx(hIe,{...A}):m.jsx(pIe,{...E})}function bIe(e){const{schema:t,name:n,uiSchema:r,fieldPathId:i,formData:o,registry:s,required:a,disabled:l,readonly:u,hideError:c,autofocus:f,title:h,onChange:g,onFocus:y,onBlur:b,rawErrors:v}=e,{title:S}=t,{widgets:C,translateString:w,globalUiOptions:A}=s,{widget:E="checkbox",title:_,label:D=!0,enumNames:T,...M}=$t(r,A),L=pu(t,E,C),j=w(un.YesLabel),I=w(un.NoLabel);let N;const $=_??S??h??n;if(Array.isArray(t.oneOf))N=hg({oneOf:t.oneOf.map(F=>{if(Bn(F))return{...F,title:F.title||(F.const===!0?j:I)}}).filter(F=>F)},r);else{const F=t.enum??[!0,!1];!T&&F.length===2&&F.every(G=>typeof G=="boolean")?N=[{value:F[0],label:F[0]?j:I},{value:F[1],label:F[1]?j:I}]:N=hg({enum:F},r)}const z=O.useCallback((F,G,V)=>g(F,i.path,G,V),[g,i]);return m.jsx(L,{options:{...M,enumOptions:N},schema:t,uiSchema:r,id:i.$id,name:n,onChange:z,onFocus:y,onBlur:b,label:$,hideLabel:!D,value:o,required:a,disabled:l,readonly:u,hideError:c,registry:s,autofocus:f,rawErrors:v,htmlName:i.name})}function vIe(e){return{type:"string",enum:["string","number","boolean","object","array"],default:"string",title:e}}function xIe(e){const t=typeof e;return t==="string"||t==="number"||t==="boolean"?t:t==="object"?Array.isArray(e)?"array":"object":"string"}function SIe(e,t){switch(t){case"string":return String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;default:return e}}function wIe(e){const{id:t,formData:n,displayLabel:r=!0,schema:i,name:o,uiSchema:s,required:a,disabled:l=!1,readonly:u=!1,onBlur:c,onFocus:f,registry:h,fieldPathId:g,onChange:y,errorSchema:b}=e,{translateString:v,fields:S,globalFormOptions:C}=h,[w,A]=O.useState(xIe(n)),E=$t(s),_=op(Sa("__internal_type_selector",C,g)),D=v(un.Type),T=O.useMemo(()=>vIe(D),[D]),M=I=>{I!=null&&(A(I),y(SIe(n,I),g.path,b,t))};if(!C.useFallbackUiForUnsupportedType){const{reason:I=v(un.UnknownFieldType,[String(i.type)])}=e,N=Bt("UnsupportedFieldTemplate",h,E);return m.jsx(N,{schema:i,fieldPathId:g,reason:I,registry:h})}const L=Bt("FallbackFieldTemplate",h,E),{SchemaField:j}=S;return m.jsx(L,{schema:i,registry:h,typeSelector:m.jsx(j,{fieldPathId:_,name:`${o}__fallback_type`,schema:T,formData:w,onChange:M,onBlur:c,onFocus:f,registry:h,hideLabel:!r,disabled:l,readonly:u,required:a},n?Gl(n):"__empty__"),schemaField:m.jsx(j,{...e,schema:{type:w,title:v(un.Value),...w==="object"&&{additionalProperties:!0}}})})}function CIe(e,t){return Wg(t,function(n){return e[n]})}function EIe(e){return e==null?[]:CIe(e,Fa(e))}var AIe=Math.max;function kIe(e,t,n,r){e=ep(e)?e:EIe(e),n=n?MQ(n):0;var i=e.length;return n<0&&(n=AIe(i+n,0)),Jd(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&KQ(e,t,n)>-1}var _Ie=Math.min;function DIe(e,t,n){for(var r=qM,i=e[0].length,o=e.length,s=o,a=Array(o),l=1/0,u=[];s--;){var c=e[s];l=_Ie(c.length,l),a[s]=i>=120&&c.length>=120?new jh(s&&c):void 0}c=e[0];var f=-1,h=a[0];e:for(;++f<i&&u.length<l;){var g=c[f],y=g;if(g=g!==0?g:0,!(h?rb(h,y):r(u,y))){for(s=o;--s;){var b=a[s];if(!(b?rb(b,y):r(e[s],y)))continue e}h&&h.push(y),u.push(g)}}return u}function OIe(e){return ob(e)?e:[]}var Wz=$3(function(e){var t=Wg(e,OIe);return t.length&&t[0]===e[0]?DIe(t):[]});function WZ(e){return e===void 0}var Yl;(function(e){e.ROW="ui:row",e.COLUMN="ui:col",e.COLUMNS="ui:columns",e.CONDITION="ui:condition"})(Yl||(Yl={}));var p1;(function(e){e.ALL="all",e.SOME="some",e.NONE="none"})(p1||(p1={}));const TIe=/^\$lookup=(.+)/,dD="layoutGrid";function qz(e,t){return e??t}function RIe(e){return/^\d+?$/.test(e)}const Nd=rP();function IIe(e,t,n,r,i){const o=Ve(n,[J6],{}),s=Ve(n,e),a={...Ve(s,[jd],{}),...t,...o},l={...s};gi(a)||ur(l,[jd],a),gi(o)||ur(l,[J6],o);let{readonly:u}=$t(l);return(i===!0||WZ(u)&&r===!0)&&(u=!0,In(a,W4)?ur(l,[jd,W4],!0):ur(l,`ui:${W4}`,!0)),{fieldUiSchema:l,uiReadonly:u}}function MIe(e,t,n="$0m3tH1nG Un3xP3cT3d"){const r=oT([t]).sort(),i=oT([n]).sort();switch(e){case p1.ALL:return ib(r,i);case p1.SOME:return Wz(r,i).length>0;case p1.NONE:return Wz(r,i).length===0;default:return!1}}function U3(e,t,n){let r={},i=e[t];if(Xd(i)){const{children:o,className:s,...a}=i;if(i=o,s){const u=s.split(" ").map(c=>sP(n,c,c)).join(" ");r={...a,className:u}}else r=a}if(!Array.isArray(i))throw new TypeError(`Expected array for "${t}" in ${JSON.stringify(e)}`);return{children:i,gridProps:r}}function Gz(e,t,n){let r;if(RIe(n)&&e&&e?.type==="array"&&In(e,Mh)){const i=Number(n),o=e[Mh];Array.isArray(o)?i>o.length?r=iZ(o):r=o[i]:r=o,t={[pr]:t[pr],path:[...t.path.slice(0,t.path.length-1),i]}}return{rawSchema:r,fieldPathId:t}}function PIe(e,t,n,r,i){const{schemaUtils:o,globalFormOptions:s}=e;let a=n,l=i;const u=t.split("."),c=u.pop();let f=o.retrieveSchema(a,r),h=r,g=f.readOnly;u.forEach(v=>{if(l=Sa(v,s,l),In(f,Hn))a=Ve(f,[Hn,v],{});else if(f&&(In(f,nn)||In(f,Mn))){const S=In(f,nn)?nn:Mn,C=o.findSelectedOptionInXxxOf(f,v,S,h);a=Ve(C,[Hn,v],{})}else{const S=Gz(f,l,v);a=S.rawSchema??{},l=S.fieldPathId}h=Ve(h,v,{}),f=o.retrieveSchema(a,h),g=qz(f.readOnly,g)});let y,b=!1;if(gi(f)&&(f=void 0),f&&c){if(f&&(In(f,nn)||In(f,Mn))){const S=In(f,nn)?nn:Mn;f=o.findSelectedOptionInXxxOf(f,c,S,h)}l=Sa(c,s,l),b=f!==void 0&&Array.isArray(f.required)&&kIe(f.required,c);const v=Gz(f,l,c);if(v.rawSchema?(f=v.rawSchema,l=v.fieldPathId):(f=Ve(f,[Hn,c]),f=f&&o.retrieveSchema(f)),g=qz(f?.readOnly,g),f&&(In(f,nn)||In(f,Mn))){const S=In(f,nn)?nn:Mn,C=hu(f);y={options:f[S],hasDiscriminator:!!C}}}return{schema:f,isRequired:b,isReadonly:g,optionsInfo:y,fieldPathId:l}}function jIe(e,t){let n=e;return Jd(n)&&(n=sP(t,n)),xv(n)?n:null}function $Ie(e,t){let n,r=null,i={},o;if(Jd(t)||WZ(t))n=t??"";else{const{name:s="",render:a,...l}=t;n=s,i=l,gi(i)||aIe(i,(u,c)=>{if(Jd(u)){const f=TIe.exec(u);if(Array.isArray(f)&&f.length>1){const h=f[1];i[c]=sP(e,h,h)}}}),r=jIe(a,e),!s&&r&&(o=m.jsx(r,{...l,"data-testid":Nd.uiComponent}))}return{name:n,UIComponent:r,uiProps:i,rendered:o}}function H3(e){const{childrenLayoutGridSchemaId:t,...n}=e,{registry:r,schema:i,formData:o}=n,{schemaUtils:s}=r,a=s.retrieveSchema(i,o);return t.map(l=>O.createElement(uP,{...n,key:`layoutGrid-${Gl(l)}`,schema:a,layoutGridSchema:l}))}function NIe(e){const{layoutGridSchema:t,...n}=e,{formData:r,registry:i}=n,{children:o,gridProps:s}=U3(t,Yl.CONDITION,i),{operator:a,field:l="",value:u}=s,c=Ve(r,l,null);return MIe(a,c,u)?m.jsx(H3,{...n,childrenLayoutGridSchemaId:o}):null}function LIe(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=U3(t,Yl.COLUMN,r),a=$t(i),l=Bt("GridTemplate",r,a);return m.jsx(l,{column:!0,"data-testid":Nd.col,...s,children:m.jsx(H3,{...n,childrenLayoutGridSchemaId:o})})}function FIe(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=U3(t,Yl.COLUMNS,r),a=$t(i),l=Bt("GridTemplate",r,a);return o.map(u=>m.jsx(l,{column:!0,"data-testid":Nd.col,...s,children:m.jsx(H3,{...n,childrenLayoutGridSchemaId:[u]})},`column-${Gl(u)}`))}function BIe(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=U3(t,Yl.ROW,r),a=$t(i),l=Bt("GridTemplate",r,a);return m.jsx(l,{...s,"data-testid":Nd.row,children:m.jsx(H3,{...n,childrenLayoutGridSchemaId:o})})}function zIe(e){const{gridSchema:t,schema:n,uiSchema:r,errorSchema:i,fieldPathId:o,onBlur:s,onFocus:a,formData:l,readonly:u,registry:c,layoutGridSchema:f,...h}=e,{onChange:g}=h,{fields:y}=c,{SchemaField:b,LayoutMultiSchemaField:v}=y,S=$Ie(c,t),{name:C,UIComponent:w,uiProps:A}=S,{schema:E,isRequired:_,isReadonly:D,optionsInfo:T,fieldPathId:M}=PIe(c,C,n,l,o),L=op(M);if(S.rendered)return S.rendered;if(E){const j=T?.hasDiscriminator?v:b,{fieldUiSchema:I,uiReadonly:N}=IIe(C,A,r,D,u);return m.jsx(j,{"data-testid":T?.hasDiscriminator?Nd.layoutMultiSchemaField:Nd.field,...h,name:C,required:_,readonly:N,schema:E,uiSchema:I,errorSchema:Ve(i,C),fieldPathId:L,formData:Ve(l,C),onChange:g,onBlur:s,onFocus:a,options:T?.options,registry:c})}return w?m.jsx(w,{"data-testid":Nd.uiComponent,...h,name:C,required:_,formData:l,readOnly:!!D||u,errorSchema:i,uiSchema:r,schema:n,fieldPathId:o,onBlur:s,onFocus:a,registry:c,...A}):null}function uP(e){const{uiSchema:t}=e;let{layoutGridSchema:n}=e;const r=$t(t);if(!n&&dD in r&&Bn(r[dD])&&(n=r[dD]),Bn(n)){if(Yl.ROW in n)return m.jsx(BIe,{...e,layoutGridSchema:n});if(Yl.COLUMN in n)return m.jsx(LIe,{...e,layoutGridSchema:n});if(Yl.COLUMNS in n)return m.jsx(FIe,{...e,layoutGridSchema:n});if(Yl.CONDITION in n)return m.jsx(NIe,{...e,layoutGridSchema:n})}return m.jsx(zIe,{...e,gridSchema:n})}uP.TEST_IDS=Nd;function UIe(e){const{fieldPathId:t,title:n,schema:r,uiSchema:i,required:o,registry:s,name:a}=e,l=$t(i,s.globalUiOptions),{title:u}=l,{title:c}=r,f=u||n||c||a;if(!f)return null;const h=Bt("TitleFieldTemplate",s,l);return m.jsx(h,{id:B3(t),title:f,required:o,schema:r,uiSchema:i,registry:s})}function fD(e,t,n){const r="!@#!@$@#$!@$#";return e.map(({schema:o})=>o).find(o=>{const s=Ve(o,[Hn,t]);return Ve(s,D3,Ve(s,ba,r))===n})}function Kz(e,t,n,r,i){const o=t.map(l=>n.retrieveSchema(l,i));let s=e;In(e,nn)?s={...e,[nn]:o}:In(e,Mn)&&(s={...e,[Mn]:o});const a=hg(s,r);if(!a)throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(s)}`);return a}function HIe(e){const{name:t,baseType:n,disabled:r=!1,formData:i,fieldPathId:o,onBlur:s,onChange:a,options:l,onFocus:u,registry:c,uiSchema:f,schema:h,autofocus:g,readonly:y,required:b,errorSchema:v,hideError:S=!1}=e,{widgets:C,schemaUtils:w,globalUiOptions:A}=c,[E,_]=O.useState(Kz(h,l,w,f,i)),D=Ve(o,pr),T=hu(h),M=Bt("FieldErrorTemplate",c,l),L=Bt("FieldTemplate",c,l),j=Gl(h),I=Gl(l),N=f?Gl(f):"",$=i?Gl(i):"";O.useEffect(()=>{_(Kz(h,l,w,f,i))},[j,I,w,N,$]);const{widget:z=T?"radio":"select",title:F="",placeholder:G="",optionsSchemaSelector:V=T,hideError:H,...X}=$t(f);if(!V)throw new Error("No selector field provided for the LayoutMultiSchemaField");const B=Ve(i,V);let W=Ve(E[0]?.schema,[Hn,V],{});const Y=fD(E,V,B);W=W?.type?W:{...W,type:Y?.type||n};const U=pu(W,z,C),K=H===void 0?S:!!H,Z=Ve(v,[po],[]),J=sb(v,[po]),Q=w.getDisplayLabel(h,f,A),ie=ne=>{const oe=fD(E,V,ne),ce=fD(E,V,B);let pe=w.sanitizeDataForNewSchema(oe,ce,i);pe&&oe&&(pe=w.getDefaultFormState(oe,pe,"excludeObjectChildren")),pe&&ur(pe,V,ne),a(pe,o.path,void 0,D)},ue={enumOptions:E,...X},te=!K&&Z.length>0?m.jsx(M,{fieldPathId:o,schema:h,errors:Z,registry:c}):void 0;return m.jsx(L,{fieldPathId:o,id:D,schema:h,label:(F||h.title)??"",disabled:r||Array.isArray(E)&&gi(E),uiSchema:f,required:b,readonly:!!y,registry:c,displayLabel:Q,errors:te,onChange:a,onKeyRename:Hw,onKeyRenameBlur:Hw,onRemoveProperty:Hw,children:m.jsx(U,{id:D,name:t,schema:h,label:(F||h.title)??"",disabled:r||Array.isArray(E)&&gi(E),uiSchema:f,autofocus:g,readonly:y,required:b,registry:c,multiple:!1,rawErrors:Z,hideError:K,hideLabel:!Q,errorSchema:J,placeholder:G,onChange:ie,onBlur:s,onFocus:u,value:B,options:ue,htmlName:o.name})})}class Yz extends O.Component{constructor(t){super(t);const{formData:n,options:r,registry:{schemaUtils:i}}=this.props,o=r.map(s=>i.retrieveSchema(s,n));this.state={retrievedOptions:o,selectedOption:this.getMatchingOption(0,n,o)}}componentDidUpdate(t,n){const{formData:r,options:i,fieldPathId:o}=this.props,{selectedOption:s}=this.state;let a=this.state;if(!_r(t.options,i)){const{registry:{schemaUtils:l}}=this.props,u=i.map(c=>l.retrieveSchema(c,r));a={selectedOption:s,retrievedOptions:u}}if(!_r(r,t.formData)&&o.$id===t.fieldPathId.$id){const{retrievedOptions:l}=a,u=this.getMatchingOption(s,r,l);n&&u!==s&&(a={selectedOption:u,retrievedOptions:l})}a!==this.state&&this.setState(a)}getMatchingOption(t,n,r){const{schema:i,registry:{schemaUtils:o}}=this.props,s=hu(i);return o.getClosestMatchingOption(n,r,t,s)}onOptionChange=t=>{const{selectedOption:n,retrievedOptions:r}=this.state,{formData:i,onChange:o,registry:s,fieldPathId:a}=this.props,{schemaUtils:l}=s,u=t!==void 0?parseInt(t,10):-1;if(u===n)return;const c=u>=0?r[u]:void 0,f=n>=0?r[n]:void 0;let h=l.sanitizeDataForNewSchema(c,f,i);c&&(h=l.getDefaultFormState(c,h,"excludeObjectChildren")),this.setState({selectedOption:u},()=>{o(h,a.path,void 0,this.getFieldId())})};getFieldId(){const{fieldPathId:t,schema:n}=this.props;return`${t.$id}${n.oneOf?"__oneof_select":"__anyof_select"}`}render(){const{name:t,disabled:n=!1,errorSchema:r={},formData:i,onBlur:o,onFocus:s,readonly:a,required:l=!1,registry:u,schema:c,uiSchema:f}=this.props,{widgets:h,fields:g,translateString:y,globalUiOptions:b,schemaUtils:v}=u,{SchemaField:S}=g,C=Bt("MultiSchemaFieldTemplate",u,b),w=kv(u,c,l,f),A=Kg(i),{selectedOption:E,retrievedOptions:_}=this.state,{widget:D="select",placeholder:T,autofocus:M,autocomplete:L,title:j=c.title,...I}=$t(f,b),N=pu({type:"number"},D,h),$=Ve(r,po,[]),z=sb(r,[po]),F=v.getDisplayLabel(c,f,b),G=E>=0&&_[E]||null;let V;if(G){const{required:Z}=c;V=Z?Cc({required:Z},G):G}let H=[];nn in c&&f&&nn in f?Array.isArray(f[nn])?H=f[nn]:console.warn(`uiSchema.oneOf is not an array for "${j||t}"`):Mn in c&&f&&Mn in f&&(Array.isArray(f[Mn])?H=f[Mn]:console.warn(`uiSchema.anyOf is not an array for "${j||t}"`));let X=f;E>=0&&H.length>E&&(X=H[E]);const B=j?un.TitleOptionPrefix:un.OptionPrefix,W=j?[j]:[],Y=_.map((Z,J)=>{const{title:Q=Z.title}=$t(H[J]);return{label:Q||y(B,W.concat(String(J+1))),value:J}}),U=!w||A?m.jsx(N,{id:this.getFieldId(),name:`${t}${c.oneOf?"__oneof_select":"__anyof_select"}`,schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:o,onFocus:s,disabled:n||gi(Y),multiple:!1,rawErrors:$,errorSchema:z,value:E>=0?E:void 0,options:{enumOptions:Y,...I},registry:u,placeholder:T,autocomplete:L,autofocus:M,label:j??t,hideLabel:!F,readonly:a}):void 0,K=V&&V.type!=="null"&&m.jsx(S,{...this.props,schema:V,uiSchema:X})||null;return m.jsx(C,{schema:c,registry:u,uiSchema:f,selector:U,optionSchemaField:K})}}const VIe=/\.([0-9]*0)*$/,WIe=/[0.]0*$/;function qIe(e){const{registry:t,onChange:n,formData:r,value:i}=e,[o,s]=O.useState(i),{StringField:a}=t.fields;let l=r;const u=O.useCallback((c,f,h,g)=>{s(c),`${c}`.charAt(0)==="."&&(c=`0${c}`);const y=typeof c=="string"&&c.match(VIe)?zB(c.replace(WIe,"")):zB(c);n(y,f,h,g)},[n]);if(typeof o=="string"&&typeof l=="number"){const c=new RegExp(`^(${String(l).replace(".","\\.")})?\\.?0*$`);o.match(c)&&(l=o)}return m.jsx(a,{...e,formData:l,onChange:u})}function jl(){return jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jl.apply(null,arguments)}const P2=["strong","em","del","mark"],Xz=[["**",P2[0]],["__",P2[0]],["~~",P2[2]],["==",P2[3]],["*","em"],["_","em"]];function GIe(e,t){for(var n=1,r=t+1;r<e.length&&n>0;)e[r]!=="\\"?(e[r]==="["&&n++,e[r]==="]"&&n--,r++):r+=2;if(n===0&&r<e.length&&(e[r]==="("||e[r]==="[")){var i=e[r]==="("?")":"]",o=1;for(r++;r<e.length&&o>0;)e[r]!=="\\"?(e[r]==="("&&i===")"&&o++,e[r]===i&&o--,r++):r+=2;if(o===0)return r}return-1}function KIe(e,t){if(!t||!t.inline&&!t.simple)return null;var n=e[0];if(n!=="*"&&n!=="_"&&n!=="~"&&n!=="=")return null;for(var r="",i=0,o="",s=0;s<6;s++){var a=Xz[s][0];if(e.startsWith(a)&&e.length>=2*a.length){r=a,i=a.length,o=Xz[s][1];break}}if(!r)return null;for(var l=i,u=!1,c=!1,f="",h=0,g="",y=!1,b="";l<e.length;){var v=e[l];if(y)g+=v,y=!1,b=v,l++;else if(v!=="\\")if(v!=="`"||h!==0){if(v==="["&&!u&&h===0){var S=GIe(e,l);if(S!==-1){g+=e.slice(l,S),l=S,b=e[S-1];continue}}if(c)g+=v,f?v===f&&(f=""):v==='"'||v==="'"?f=v:v===">"&&(c=!1),b=v,l++;else if(v!=="<"||u){if(v===`
|
|
209
209
|
`&&b===`
|
|
210
210
|
`&&!u&&h===0)return null;if(!u&&h===0){for(var C=0;l+C<e.length&&e[l+C]===r[0];)C++;if(C>=i&&(i!==1||r!=="*"&&r!=="_"||e[l-1]!==r&&e[l+1]!==r)){var w=[e.slice(0,l+C),o,g+e.slice(l+i,l+C)];return w.index=0,w.input=e,w}}g+=v,b=v,l++}else{var A=e[l+1],E=e.indexOf(">",l);if(E!==-1){var _=e.slice(l,E+1).endsWith("/>");A==="/"?h=Math.max(0,h-1):_||h++}c=!0,g+=v,b=v,l++}}else u=!u,g+=v,b=v,l++;else g+=v,y=!0,b=v,l++}return null}const YIe=["children","options"],Jz=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),Qz={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},XIe=["style","script","pre"],JIe=["src","href","data","formAction","srcDoc","action"],QIe=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,ZIe=/\n{2,}$/,Zz=/^(\s*>[\s\S]*?)(?=\n\n|$)/,eMe=/^ *> ?/gm,tMe=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,nMe=/^ {2,}\n/,rMe=/^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/,eU=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,tU=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,iMe=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,oMe=/^(?:\n *)*\n/,sMe=/\r\n?/g,aMe=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,lMe=/^\[\^([^\]]+)]/,uMe=/\f/g,cMe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,dMe=/^\[(x|\s)\]/,nU=/^(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,rU=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,iU=/^([^\n]+)\n *(=|-)\2{2,} *\n/,cP=/^<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>/i;function fMe(e){const t=cP.exec(e);if(!t)return null;const n=t[1],r=n.toLowerCase(),i=r.length+1;let o=t[0].length;e[o]===`
|
|
@@ -480,4 +480,4 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
480
480
|
To pick up a draggable item, press the space bar.
|
|
481
481
|
While dragging, use the arrow keys to move the item.
|
|
482
482
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
483
|
-
`},yat={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 bat(e){let{announcements:t=yat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=gat}=e;const{announce:o,announcement:s}=hat(),a=rx("DndLiveRegion"),[l,u]=O.useState(!1);if(O.useEffect(()=>{u(!0)},[]),pat(O.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const c=qt.createElement(qt.Fragment,null,qt.createElement(dat,{id:r,value:i.draggable}),qt.createElement(fat,{id:a,announcement:s}));return n?_d.createPortal(c,n):c}var Ni;(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"})(Ni||(Ni={}));function wA(){}function vK(e,t){return O.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function vat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return O.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const sl=Object.freeze({x:0,y:0});function sle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ale(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xat(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function xK(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 lle(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function SK(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 Sat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=SK(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=sle(SK(l),i);o.push({id:a,data:{droppableContainer:s,value:u}})}}return o.sort(ale)},wat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=xK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=xK(l),c=i.reduce((h,g,y)=>h+sle(u[y],g),0),f=Number((c/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(ale)};function Cat(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,u=e.width*e.height,c=s*a,f=c/(l+u-c);return Number(f.toFixed(4))}return 0}const Eat=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=Cat(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(xat)};function Aat(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ule(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sl}function kat(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 _at=kat(1);function Dat(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 Oat(e,t,n){const r=Dat(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:c,height:f,top:u,right:l+c,bottom:u+f,left:l}}const Tat={ignoreTransform:!1};function h0(e,t){t===void 0&&(t=Tat);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=fs(e).getComputedStyle(e);u&&(n=Oat(n,u,c))}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 wK(e){return h0(e,{ignoreTransform:!0})}function Rat(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Iat(e,t){return t===void 0&&(t=fs(e).getComputedStyle(e)),t.position==="fixed"}function Mat(e,t){t===void 0&&(t=fs(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 Wk(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(p8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!tx(i)||rle(i)||n.includes(i))return n;const o=fs(e).getComputedStyle(i);return i!==e&&Mat(i,o)&&n.push(i),Iat(i,o)?n:r(i.parentNode)}return e?r(e):n}function cle(e){const[t]=Wk(e,1);return t??null}function KO(e){return!Vk||!e?null:d0(e)?e:h8(e)?p8(e)||e===f0(e).scrollingElement?window:tx(e)?e:null:null}function dle(e){return d0(e)?e.scrollX:e.scrollLeft}function fle(e){return d0(e)?e.scrollY:e.scrollTop}function YR(e){return{x:dle(e),y:fle(e)}}var Xi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xi||(Xi={}));function hle(e){return!Vk||!e?!1:e===document.scrollingElement}function ple(e){const t={x:0,y:0},n=hle(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 Pat={x:.2,y:.2};function jat(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Pat);const{isTop:u,isBottom:c,isLeft:f,isRight:h}=ple(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+b.height?(g.y=Xi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!c&&l>=t.bottom-b.height&&(g.y=Xi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&a>=t.right-b.width?(g.x=Xi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Xi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function $at(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 mle(e){return e.reduce((t,n)=>Zm(t,YR(n)),sl)}function Nat(e){return e.reduce((t,n)=>t+dle(n),0)}function Lat(e){return e.reduce((t,n)=>t+fle(n),0)}function Fat(e,t){if(t===void 0&&(t=h0),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);cle(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Bat=[["x",["left","right"],Nat],["y",["top","bottom"],Lat]];class y8{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=Wk(n),i=mle(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of Bat)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class I1{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 zat(e){const{EventTarget:t}=fs(e);return e instanceof t?e:f0(e)}function YO(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 ta;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ta||(ta={}));function CK(e){e.preventDefault()}function Uat(e){e.stopPropagation()}var $n;(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"})($n||($n={}));const gle={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter,$n.Tab]},Hat=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $n.Right:return{...n,x:n.x+25};case $n.Left:return{...n,x:n.x-25};case $n.Down:return{...n,y:n.y+25};case $n.Up:return{...n,y:n.y-25}}};class b8{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 I1(f0(n)),this.windowListeners=new I1(fs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ta.Resize,this.handleCancel),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ta.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Fat(r),n(sl)}handleKeyDown(t){if(g8(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=gle,coordinateGetter:s=Hat,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:u}=r.current,c=u?{x:u.left,y:u.top}:sl;this.referenceCoordinates||(this.referenceCoordinates=c);const f=s(t,{active:n,context:r.current,currentCoordinates:c});if(f){const h=ev(f,c),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:_}=ple(b),D=$at(b),T={x:Math.min(v===$n.Right?D.right-D.width/2:D.right,Math.max(v===$n.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(v===$n.Down?D.bottom-D.height/2:D.bottom,Math.max(v===$n.Down?D.top:D.top+D.height/2,f.y))},M=v===$n.Right&&!C||v===$n.Left&&!w,L=v===$n.Down&&!A||v===$n.Up&&!S;if(M&&T.x!==f.x){const j=b.scrollLeft+h.x,I=v===$n.Right&&j<=E.x||v===$n.Left&&j>=_.x;if(I&&!h.y){b.scrollTo({left:j,behavior:a});return}I?g.x=b.scrollLeft-j:g.x=v===$n.Right?b.scrollLeft-E.x:b.scrollLeft-_.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(L&&T.y!==f.y){const j=b.scrollTop+h.y,I=v===$n.Down&&j<=E.y||v===$n.Up&&j>=_.y;if(I&&!h.x){b.scrollTo({top:j,behavior:a});return}I?g.y=b.scrollTop-j:g.y=v===$n.Down?b.scrollTop-E.y:b.scrollTop-_.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,Zm(ev(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()}}b8.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=gle,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 EK(e){return!!(e&&"distance"in e)}function AK(e){return!!(e&&"delay"in e)}class v8{constructor(t,n,r){var i;r===void 0&&(r=zat(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=f0(s),this.documentListeners=new I1(this.document),this.listeners=new I1(r),this.windowListeners=new I1(fs(s)),this.initialCoordinates=(i=KR(o))!=null?i:sl,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(ta.Resize,this.handleCancel),this.windowListeners.add(ta.DragStart,CK),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),this.windowListeners.add(ta.ContextMenu,CK),this.documentListeners.add(ta.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(AK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(EK(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(ta.Click,Uat,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ta.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=KR(t))!=null?n:sl,u=ev(i,l);if(!r&&a){if(EK(a)){if(a.tolerance!=null&&YO(u,a.tolerance))return this.handleCancel();if(YO(u,a.distance))return this.handleStart()}if(AK(a)&&YO(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);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===$n.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Vat={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class x8 extends v8{constructor(t){const{event:n}=t,r=f0(n.target);super(t,Vat,r)}}x8.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 Wat={move:{name:"mousemove"},end:{name:"mouseup"}};var XR;(function(e){e[e.RightClick=2]="RightClick"})(XR||(XR={}));class qat extends v8{constructor(t){super(t,Wat,f0(t.event.target))}}qat.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===XR.RightClick?!1:(r?.({event:n}),!0)}}];const XO={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Gat extends v8{constructor(t){super(t,XO)}static setup(){return window.addEventListener(XO.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(XO.move.name,t)};function t(){}}}Gat.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 M1;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(M1||(M1={}));var CA;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(CA||(CA={}));function Kat(e){let{acceleration:t,activator:n=M1.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=CA.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:f,threshold:h}=e;const g=Xat({delta:f,disabled:!o}),[y,b]=sat(),v=O.useRef({x:0,y:0}),S=O.useRef({x:0,y:0}),C=O.useMemo(()=>{switch(n){case M1.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case M1.DraggableRect:return i}},[n,i,l]),w=O.useRef(null),A=O.useCallback(()=>{const _=w.current;if(!_)return;const D=v.current.x*S.current.x,T=v.current.y*S.current.y;_.scrollBy(D,T)},[]),E=O.useMemo(()=>a===CA.TreeOrder?[...u].reverse():u,[a,u]);O.useEffect(()=>{if(!o||!u.length||!C){b();return}for(const _ of E){if(r?.(_)===!1)continue;const D=u.indexOf(_),T=c[D];if(!T)continue;const{direction:M,speed:L}=jat(_,T,C,t,h);for(const j of["x","y"])g[j][M[j]]||(L[j]=0,M[j]=0);if(L.x>0||L.y>0){b(),w.current=_,y(A,s),v.current=L,S.current=M;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,u,E,c,JSON.stringify(h)])}const Yat={x:{[Xi.Backward]:!1,[Xi.Forward]:!1},y:{[Xi.Backward]:!1,[Xi.Forward]:!1}};function Xat(e){let{delta:t,disabled:n}=e;const r=GR(t);return nx(i=>{if(n||!r||!i)return Yat;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xi.Backward]:i.x[Xi.Backward]||o.x===-1,[Xi.Forward]:i.x[Xi.Forward]||o.x===1},y:{[Xi.Backward]:i.y[Xi.Backward]||o.y===-1,[Xi.Forward]:i.y[Xi.Forward]||o.y===1}}},[n,t,r])}function Jat(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return nx(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Qat(e,t){return O.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 nv;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(nv||(nv={}));var JR;(function(e){e.Optimized="optimized"})(JR||(JR={}));const kK=new Map;function Zat(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=O.useState(null),{frequency:a,measure:l,strategy:u}=i,c=O.useRef(e),f=v(),h=Zb(f),g=O.useCallback(function(S){S===void 0&&(S=[]),!h.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[h]),y=O.useRef(null),b=nx(S=>{if(f&&!n)return kK;if(!S||S===kK||c.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 y8(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return O.useEffect(()=>{c.current=e},[e]),O.useEffect(()=>{f||g()},[n,f]),O.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),O.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(u){case nv.Always:return!1;case nv.BeforeDragging:return n;default:return!n}}}function yle(e,t){return nx(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function elt(e,t){return yle(e,t)}function tlt(e){let{callback:t,disabled:n}=e;const r=m8(t),i=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return O.useEffect(()=>()=>i?.disconnect(),[i]),i}function qk(e){let{callback:t,disabled:n}=e;const r=m8(t),i=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return O.useEffect(()=>()=>i?.disconnect(),[i]),i}function nlt(e){return new y8(h0(e),e)}function _K(e,t,n){t===void 0&&(t=nlt);const[r,i]=O.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}const s=tlt({callback(l){if(e)for(const u of l){const{type:c,target:f}=u;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=qk({callback:o});return yu(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function rlt(e){const t=yle(e);return ule(e,t)}const DK=[];function ilt(e){const t=O.useRef(e),n=nx(r=>e?r&&r!==DK&&e&&t.current&&e.parentNode===t.current.parentNode?r:Wk(e):DK,[e]);return O.useEffect(()=>{t.current=e},[e]),n}function olt(e){const[t,n]=O.useState(null),r=O.useRef(e),i=O.useCallback(o=>{const s=KO(o.target);s&&n(a=>a?(a.set(s,YR(s)),new Map(a)):null)},[]);return O.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=KO(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,YR(u)]):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 u=KO(l);u?.removeEventListener("scroll",i)})}},[i,e]),O.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>Zm(o,s),sl):mle(e):sl,[e,t])}function OK(e,t){t===void 0&&(t=[]);const n=O.useRef(null);return O.useEffect(()=>{n.current=null},t),O.useEffect(()=>{const r=e!==sl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ev(e,n.current):sl}function slt(e){O.useEffect(()=>{if(!Vk)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 alt(e,t){return O.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function ble(e){return O.useMemo(()=>e?Rat(e):null,[e])}const TK=[];function llt(e,t){t===void 0&&(t=h0);const[n]=e,r=ble(n?fs(n):null),[i,o]=O.useState(TK);function s(){o(()=>e.length?e.map(l=>hle(l)?r:new y8(t(l),l)):TK)}const a=qk({callback:s});return yu(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function ult(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tx(t)?t:e}function clt(e){let{measure:t}=e;const[n,r]=O.useState(null),i=O.useCallback(u=>{for(const{target:c}of u)if(tx(c)){r(f=>{const h=t(c);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=qk({callback:i}),s=O.useCallback(u=>{const c=ult(u);o?.disconnect(),c&&o?.observe(c),r(c?t(c):null)},[t,o]),[a,l]=SA(s);return O.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const dlt=[{sensor:x8,options:{}},{sensor:b8,options:{}}],flt={current:{}},wC={draggable:{measure:wK},droppable:{measure:wK,strategy:nv.WhileDragging,frequency:JR.Optimized},dragOverlay:{measure:h0}};class P1 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 hlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new P1,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wA},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wC,measureDroppableContainers:wA,windowRect:null,measuringScheduled:!1},plt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wA,draggableNodes:new Map,over:null,measureDroppableContainers:wA},Gk=O.createContext(plt),vle=O.createContext(hlt);function mlt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new P1}}}function glt(e,t){switch(t.type){case Ni.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ni.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 Ni.DragEnd:case Ni.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ni.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new P1(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Ni.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 P1(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Ni.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new P1(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function ylt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=O.useContext(Gk),o=GR(r),s=GR(n?.id);return O.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!g8(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const f=uat(c);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function blt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function vlt(e){return O.useMemo(()=>({draggable:{...wC.draggable,...e?.draggable},droppable:{...wC.droppable,...e?.droppable},dragOverlay:{...wC.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xlt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=O.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;yu(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const c=n(u),f=ule(c,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=cle(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const xle=O.createContext({...sl,scaleX:1,scaleY:1});var vd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(vd||(vd={}));const Slt=O.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=dlt,collisionDetection:f=Eat,measuring:h,modifiers:g,...y}=t;const b=O.useReducer(glt,void 0,mlt),[v,S]=b,[C,w]=mat(),[A,E]=O.useState(vd.Uninitialized),_=A===vd.Initialized,{draggable:{active:D,nodes:T,translate:M},droppable:{containers:L}}=v,j=D!=null?T.get(D):null,I=O.useRef({initial:null,translated:null}),N=O.useMemo(()=>{var kt;return D!=null?{id:D,data:(kt=j?.data)!=null?kt:flt,rect:I}:null},[D,j]),$=O.useRef(null),[z,F]=O.useState(null),[G,V]=O.useState(null),H=Zb(y,Object.values(y)),X=rx("DndDescribedBy",s),B=O.useMemo(()=>L.getEnabled(),[L]),W=vlt(h),{droppableRects:Y,measureDroppableContainers:U,measuringScheduled:K}=Zat(B,{dragging:_,dependencies:[M.x,M.y],config:W.droppable}),Z=Jat(T,D),J=O.useMemo(()=>G?KR(G):null,[G]),Q=yr(),ie=elt(Z,W.draggable.measure);xlt({activeNode:D!=null?T.get(D):null,config:Q.layoutShiftCompensation,initialRect:ie,measure:W.draggable.measure});const ue=_K(Z,W.draggable.measure,ie),te=_K(Z?Z.parentElement:null),ne=O.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=L.getNodeFor((n=ne.current.over)==null?void 0:n.id),ce=clt({measure:W.dragOverlay.measure}),pe=(r=ce.nodeRef.current)!=null?r:Z,we=_?(i=ce.rect)!=null?i:ue:null,ke=!!(ce.nodeRef.current&&ce.rect),Ae=rlt(ke?null:ue),Fe=ble(pe?fs(pe):null),Me=ilt(_?oe??Z:null),st=llt(Me),Ge=blt(g,{transform:{x:M.x-Ae.x,y:M.y-Ae.y,scaleX:1,scaleY:1},activatorEvent:G,active:N,activeNodeRect:ue,containerNodeRect:te,draggingNodeRect:we,over:ne.current.over,overlayNodeRect:ce.rect,scrollableAncestors:Me,scrollableAncestorRects:st,windowRect:Fe}),Mt=J?Zm(J,M):null,pt=olt(Me),Be=OK(pt),Ie=OK(pt,[ue]),ze=Zm(Ge,Be),Je=we?_at(we,Ge):null,nt=N&&Je?f({active:N,collisionRect:Je,droppableRects:Y,droppableContainers:B,pointerCoordinates:Mt}):null,ot=lle(nt,"id"),[Ye,Nt]=O.useState(null),Lt=ke?Ge:Zm(Ge,Ie),_t=Aat(Lt,(o=Ye?.rect)!=null?o:null,ue),Xn=O.useRef(null),rn=O.useCallback((kt,Pt)=>{let{sensor:Qt,options:Pn}=Pt;if($.current==null)return;const on=T.get($.current);if(!on)return;const xt=kt.nativeEvent,pn=new Qt({active:$.current,activeNode:on,event:xt,options:Pn,context:ne,onAbort(br){if(!T.get(br))return;const{onDragAbort:ae}=H.current,he={id:br};ae?.(he),C({type:"onDragAbort",event:he})},onPending(br,ei,ae,he){if(!T.get(br))return;const{onDragPending:Ne}=H.current,Ue={id:br,constraint:ei,initialCoordinates:ae,offset:he};Ne?.(Ue),C({type:"onDragPending",event:Ue})},onStart(br){const ei=$.current;if(ei==null)return;const ae=T.get(ei);if(!ae)return;const{onDragStart:he}=H.current,ve={activatorEvent:xt,active:{id:ei,data:ae.data,rect:I}};_d.unstable_batchedUpdates(()=>{he?.(ve),E(vd.Initializing),S({type:Ni.DragStart,initialCoordinates:br,active:ei}),C({type:"onDragStart",event:ve}),F(Xn.current),V(xt)})},onMove(br){S({type:Ni.DragMove,coordinates:br})},onEnd:Zr(Ni.DragEnd),onCancel:Zr(Ni.DragCancel)});Xn.current=pn;function Zr(br){return async function(){const{active:ae,collisions:he,over:ve,scrollAdjustedTranslate:Ne}=ne.current;let Ue=null;if(ae&&Ne){const{cancelDrop:gt}=H.current;Ue={activatorEvent:xt,active:ae,collisions:he,delta:Ne,over:ve},br===Ni.DragEnd&&typeof gt=="function"&&await Promise.resolve(gt(Ue))&&(br=Ni.DragCancel)}$.current=null,_d.unstable_batchedUpdates(()=>{S({type:br}),E(vd.Uninitialized),Nt(null),F(null),V(null),Xn.current=null;const gt=br===Ni.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const rt=H.current[gt];rt?.(Ue),C({type:gt,event:Ue})}})}}},[T]),lt=O.useCallback((kt,Pt)=>(Qt,Pn)=>{const on=Qt.nativeEvent,xt=T.get(Pn);if($.current!==null||!xt||on.dndKit||on.defaultPrevented)return;const pn={active:xt};kt(Qt,Pt.options,pn)===!0&&(on.dndKit={capturedBy:Pt.sensor},$.current=Pn,rn(Qt,Pt))},[T,rn]),Ut=Qat(c,lt);slt(c),yu(()=>{ue&&A===vd.Initializing&&E(vd.Initialized)},[ue,A]),O.useEffect(()=>{const{onDragMove:kt}=H.current,{active:Pt,activatorEvent:Qt,collisions:Pn,over:on}=ne.current;if(!Pt||!Qt)return;const xt={active:Pt,activatorEvent:Qt,collisions:Pn,delta:{x:ze.x,y:ze.y},over:on};_d.unstable_batchedUpdates(()=>{kt?.(xt),C({type:"onDragMove",event:xt})})},[ze.x,ze.y]),O.useEffect(()=>{const{active:kt,activatorEvent:Pt,collisions:Qt,droppableContainers:Pn,scrollAdjustedTranslate:on}=ne.current;if(!kt||$.current==null||!Pt||!on)return;const{onDragOver:xt}=H.current,pn=Pn.get(ot),Zr=pn&&pn.rect.current?{id:pn.id,rect:pn.rect.current,data:pn.data,disabled:pn.disabled}:null,br={active:kt,activatorEvent:Pt,collisions:Qt,delta:{x:on.x,y:on.y},over:Zr};_d.unstable_batchedUpdates(()=>{Nt(Zr),xt?.(br),C({type:"onDragOver",event:br})})},[ot]),yu(()=>{ne.current={activatorEvent:G,active:N,activeNode:Z,collisionRect:Je,collisions:nt,droppableRects:Y,draggableNodes:T,draggingNode:pe,draggingNodeRect:we,droppableContainers:L,over:Ye,scrollableAncestors:Me,scrollAdjustedTranslate:ze},I.current={initial:we,translated:Je}},[N,Z,nt,Je,T,pe,we,Y,L,Ye,Me,ze]),Kat({...Q,delta:M,draggingRect:Je,pointerCoordinates:Mt,scrollableAncestors:Me,scrollableAncestorRects:st});const _n=O.useMemo(()=>({active:N,activeNode:Z,activeNodeRect:ue,activatorEvent:G,collisions:nt,containerNodeRect:te,dragOverlay:ce,draggableNodes:T,droppableContainers:L,droppableRects:Y,over:Ye,measureDroppableContainers:U,scrollableAncestors:Me,scrollableAncestorRects:st,measuringConfiguration:W,measuringScheduled:K,windowRect:Fe}),[N,Z,ue,G,nt,te,ce,T,L,Y,Ye,U,Me,st,W,K,Fe]),Gn=O.useMemo(()=>({activatorEvent:G,activators:Ut,active:N,activeNodeRect:ue,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Ye,measureDroppableContainers:U}),[G,Ut,N,ue,S,X,T,Ye,U]);return qt.createElement(ole.Provider,{value:w},qt.createElement(Gk.Provider,{value:Gn},qt.createElement(vle.Provider,{value:_n},qt.createElement(xle.Provider,{value:_t},u)),qt.createElement(ylt,{disabled:a?.restoreFocus===!1})),qt.createElement(bat,{...a,hiddenTextDescribedById:X}));function yr(){const kt=z?.autoScrollEnabled===!1,Pt=typeof l=="object"?l.enabled===!1:l===!1,Qt=_&&!kt&&!Pt;return typeof l=="object"?{...l,enabled:Qt}:{enabled:Qt}}}),wlt=O.createContext(null),RK="button",Clt="Draggable";function Elt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=rx(Clt),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:f,over:h}=O.useContext(Gk),{role:g=RK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=O.useContext(v?xle:wlt),[C,w]=SA(),[A,E]=SA(),_=alt(s,t),D=Zb(n);yu(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:D}),()=>{const M=f.get(t);M&&M.key===o&&f.delete(t)}),[f,t]);const T=O.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===RK?!0:void 0,"aria-roledescription":y,"aria-describedby":c.draggable}),[r,g,b,v,y,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:v,listeners:r?void 0:_,node:C,over:h,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Alt(){return O.useContext(vle)}const klt="Droppable",_lt={timeout:25};function Dlt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=rx(klt),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=O.useContext(Gk),c=O.useRef({disabled:n}),f=O.useRef(!1),h=O.useRef(null),g=O.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={..._lt,...i},S=Zb(b??r),C=O.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=qk({callback:C,disabled:y||!s}),A=O.useCallback((T,M)=>{w&&(M&&(w.unobserve(M),f.current=!1),T&&w.observe(T))},[w]),[E,_]=SA(A),D=Zb(t);return O.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),O.useEffect(()=>(a({type:Ni.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:h,data:D}}),()=>a({type:Ni.UnregisterDroppable,key:o,id:r})),[r]),O.useEffect(()=>{n!==c.current.disabled&&(a({type:Ni.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:E,over:l,setNodeRef:_}}function S8(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Olt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function ww(e){return e!==null&&e>=0}function Tlt(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 Rlt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Sle=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=S8(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}},Cw={scaleX:1,scaleY:1},Ilt=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 u=o[s];return u?{x:0,y:n<s?u.top+u.height-(a.top+a.height):u.top-a.top,...Cw}:null}const l=Mlt(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...Cw}:i<n&&i>=s?{x:0,y:a.height+l,...Cw}:{x:0,y:0,...Cw}};function Mlt(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 wle="Sortable",Cle=qt.createContext({activeIndex:-1,containerId:wle,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sle,disabled:{draggable:!1,droppable:!1}});function Plt(e){let{children:t,id:n,items:r,strategy:i=Sle,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:c}=Alt(),f=rx(wle,n),h=a.rect!==null,g=O.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=u?g.indexOf(u.id):-1,S=O.useRef(g),C=!Tlt(g,S.current),w=v!==-1&&b===-1||C,A=Rlt(o);yu(()=>{C&&y&&c(g)},[C,g,y,c]),O.useEffect(()=>{S.current=g},[g]);const E=O.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:h,sortedRects:Olt(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,h,i]);return qt.createElement(Cle.Provider,{value:E},t)}const jlt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return S8(n,r,i).indexOf(t)},$lt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},Nlt={duration:200,easing:"ease"},Ele="transform",Llt=tv.Transition.toString({property:Ele,duration:0,easing:"linear"}),Flt={roleDescription:"sortable"};function Blt(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=O.useState(null),a=O.useRef(n);return yu(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const u=h0(r.current,{ignoreTransform:!0}),c={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(c.x||c.y)&&s(c)}}n!==a.current&&(a.current=n)},[t,n,r,i]),O.useEffect(()=>{o&&s(null)},[o]),o}function zlt(e){let{animateLayoutChanges:t=$lt,attributes:n,disabled:r,data:i,getNewIndex:o=jlt,id:s,strategy:a,resizeObserverConfig:l,transition:u=Nlt}=e;const{items:c,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=O.useContext(Cle),w=Ult(r,g),A=c.indexOf(s),E=O.useMemo(()=>({sortable:{containerId:f,index:A,items:c},...i}),[f,i,A,c]),_=O.useMemo(()=>c.slice(c.indexOf(s)),[c,s]),{rect:D,node:T,isOver:M,setNodeRef:L}=Dlt({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...l}}),{active:j,activatorEvent:I,activeNodeRect:N,attributes:$,setNodeRef:z,listeners:F,isDragging:G,over:V,setActivatorNodeRef:H,transform:X}=Elt({id:s,data:E,attributes:{...Flt,...n},disabled:w.draggable}),B=oat(L,z),W=!!j,Y=W&&!y&&ww(h)&&ww(v),U=!S&&G,K=U&&Y?X:null,J=Y?K??(a??C)({rects:b,activeNodeRect:N,activeIndex:h,overIndex:v,index:A}):null,Q=ww(h)&&ww(v)?o({id:s,items:c,activeIndex:h,overIndex:v}):A,ie=j?.id,ue=O.useRef({activeId:ie,items:c,newIndex:Q,containerId:f}),te=c!==ue.current.items,ne=t({active:j,containerId:f,isDragging:G,isSorting:W,id:s,index:A,items:c,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:u,wasDragging:ue.current.activeId!=null}),oe=Blt({disabled:!ne,index:A,node:T,rect:D});return O.useEffect(()=>{W&&ue.current.newIndex!==Q&&(ue.current.newIndex=Q),f!==ue.current.containerId&&(ue.current.containerId=f),c!==ue.current.items&&(ue.current.items=c)},[W,Q,f,c]),O.useEffect(()=>{if(ie===ue.current.activeId)return;if(ie!=null&&ue.current.activeId==null){ue.current.activeId=ie;return}const pe=setTimeout(()=>{ue.current.activeId=ie},50);return()=>clearTimeout(pe)},[ie]),{active:j,activeIndex:h,attributes:$,data:E,rect:D,index:A,newIndex:Q,items:c,isOver:M,isSorting:W,isDragging:G,listeners:F,node:T,overIndex:v,over:V,setNodeRef:B,setActivatorNodeRef:H,setDroppableNodeRef:L,setDraggableNodeRef:z,transform:oe??J,transition:ce()};function ce(){if(oe||te&&ue.current.newIndex===A)return Llt;if(!(U&&!g8(I)||!u)&&(W||ne))return tv.Transition.toString({...u,property:Ele})}}function Ult(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 EA(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 Hlt=[$n.Down,$n.Right,$n.Up,$n.Left],Vlt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(Hlt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case $n.Down:r.top<h.top&&l.push(f);break;case $n.Up:r.top>h.top&&l.push(f);break;case $n.Left:r.left>h.left&&l.push(f);break;case $n.Right:r.left<h.left&&l.push(f);break}});const u=wat({collisionRect:r,droppableRects:i,droppableContainers:l});let c=lle(u,"id");if(c===s?.id&&u.length>1&&(c=u[1].id),c!=null){const f=o.get(n.id),h=o.get(c),g=h?i.get(h.id):null,y=h?.node.current;if(y&&g&&f&&h){const v=Wk(y).some((_,D)=>a[D]!==_),S=Ale(f,h),C=Wlt(f,h),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:ev(A,w)}}}};function Ale(e,t){return!EA(e)||!EA(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Wlt(e,t){return!EA(e)||!EA(t)||!Ale(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const qlt=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=zlt({id:e.id}),[l,u]=O.useState(!1);O.useEffect(()=>{k3(e.id).then(u)},[e.id]);const c={transform:tv.Transform.toString(o),transition:s,opacity:a?.5:1};return m.jsx(er,{ref:i,style:c,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:m.jsxs(gr,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[m.jsx(le,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:m.jsx(Cke,{})}),m.jsx(Ct,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?m.jsx(le,{component:"img",src:Z1(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:AM(e),width:40,height:40,boxShadow:2},children:(()=>{const f=EM(e);return m.jsx(f,{sx:{fontSize:24}})})()}),m.jsxs(le,{sx:{flex:1},children:[m.jsx(re,{variant:"subtitle1",fontWeight:500,children:e.name}),m.jsxs(re,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Glt=()=>{const e=Tc(),{content:t,isLoading:n}=Hg(),r=W3e(),[i,o]=O.useState([]),[s,a]=O.useState(!1);O.useEffect(()=>{if(t){const h=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(h),a(!1)}},[t]);const l=vat(vK(x8),vK(b8,{coordinateGetter:Vlt})),u=O.useCallback(h=>{const{active:g,over:y}=h;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 S8(b,v,S)}),a(!0))},[]),c=O.useCallback(async()=>{const h=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(h),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=O.useMemo(()=>i.map(h=>h.id),[i]);return n?m.jsx(re,{children:"Loading..."}):m.jsxs(zt,{spacing:3,children:[m.jsx(a3,{items:[{name:"Bridges",to:jt.bridges},{name:"Startup Order",to:jt.startup}]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[m.jsx(rg,{color:"primary",fontSize:"large"}),m.jsxs(le,{children:[m.jsx(re,{variant:"h5",fontWeight:600,children:"Startup Order"}),m.jsx(re,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&m.jsx(kn,{severity:"info",action:m.jsx(Tt,{color:"inherit",size:"small",startIcon:m.jsx(tE,{}),onClick:c,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),m.jsx(Slt,{sensors:l,collisionDetection:Sat,onDragEnd:u,children:m.jsx(Plt,{items:f,strategy:Ilt,children:m.jsx(zt,{spacing:1,children:i.map((h,g)=>m.jsx(qlt,{bridge:h,index:g},h.id))})})}),i.length===0&&m.jsx(re,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&m.jsx(le,{display:"flex",justifyContent:"flex-end",children:m.jsx(Tt,{variant:"contained",startIcon:m.jsx(tE,{}),onClick:c,children:"Save Startup Order"})})]})},JO="https://riddix.github.io/home-assistant-matter-hub",jt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",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:JO,faq:{multiFabric:`${JO}/connect-multiple-fabrics`,bridgeConfig:`${JO}/bridge-configuration`}},Klt=[{path:"",element:m.jsx(hbe,{}),children:[{path:"",element:m.jsx(j_e,{})},{path:jt.bridges,element:m.jsx(I_e,{})},{path:jt.createBridge,element:m.jsx(CZe,{})},{path:jt.bridge(":bridgeId"),element:m.jsx(rke,{})},{path:jt.editBridge(":bridgeId"),element:m.jsx(EZe,{})},{path:jt.devices,element:m.jsx(Z_e,{})},{path:jt.networkMap,element:m.jsx(eat,{})},{path:jt.health,element:m.jsx(IZe,{})},{path:jt.labels,element:m.jsx($Ze,{})},{path:jt.lockCredentials,element:m.jsx(UZe,{})},{path:jt.settings,element:m.jsx(iat,{})},{path:jt.startup,element:m.jsx(Glt,{})}]}],Ylt={items:{isInitialized:!1,isLoading:!1}},Xlt=LI(Ylt,e=>{e.addCase(Fo.pending,t=>{t.items.isLoading=!0}).addCase(Fo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Fo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(RX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(MX.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(PX.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(IX.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(jX,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase($X,(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)}})}),Jlt={byBridge:{}},Qlt=LI(Jlt,e=>{e.addCase(dc.pending,(t,n)=>{t.byBridge[n.meta.arg]=QO(t.byBridge[n.meta.arg],n)}).addCase(dc.rejected,(t,n)=>{t.byBridge[n.meta.arg]=QO(t.byBridge[n.meta.arg],n)}).addCase(dc.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=QO(t.byBridge[n.meta.arg],n)})}),Zlt={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},QO=LI(Zlt,e=>{e.addCase(dc.pending,t=>{t.isLoading=!0}).addCase(dc.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(dc.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),eut=W1e({reducer:{bridges:Xlt,devices:Qlt}}),w8=Dge({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=>it({props:e,name:"MuiContainer"})});function tut(e){return Qe("MuiToolbar",e)}tt("MuiToolbar",["root","gutters","regular","dense"]);const nut=e=>{const{classes:t,disableGutters:n,variant:r}=e;return Ze({root:["root",!n&&"gutters",r]},tut,t)},rut=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(qe(({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}]}))),kle=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,u={...r,component:o,disableGutters:s,variant:a},c=nut(u);return m.jsx(rut,{as:o,className:Oe(c.root,i),ref:n,ownerState:u,...l})}),iut=[{name:"GitHub",url:jt.githubRepository},{name:"Documentation",url:jt.documentation}],out=()=>m.jsxs(w8,{sx:{mt:16,mb:4},children:[m.jsx(Di,{sx:{mt:4,mb:4}}),m.jsx(et,{container:!0,spacing:2,justifyContent:"center",children:iut.map((e,t)=>m.jsx(et,{size:{xs:12,sm:"auto"},children:m.jsx(Tt,{fullWidth:!0,size:"small",variant:"outlined",component:s3,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function sut(e){return Qe("MuiAppBar",e)}tt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const aut=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return Ze(i,sut,r)},IK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,lut=me(Nr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(qe(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit",color:"var(--AppBar-color)"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Ln(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?IK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?IK(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"})}}]}))),uut=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,u={...r,color:o,position:a,enableColorOnDark:s},c=aut(u);return m.jsx(lut,{square:!0,component:"header",ownerState:u,elevation:4,className:Oe(c.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function cut(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=tl(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const u=o.getComputedStyle(t);s=u.getPropertyValue("-webkit-transform")||u.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const u=s.split("(")[1].split(")")[0].split(",");a=parseInt(u[4],10),l=parseInt(u[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 dut(e){return typeof e=="function"?e():e}function Ew(e,t,n){const r=dut(n),i=cut(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const fut=O.forwardRef(function(t,n){const r=_a(),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:u,direction:c="down",easing:f=i,in:h,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Da,..._}=t,D=O.useRef(null),T=Tr(hf(l),D,n),M=V=>H=>{V&&(H===void 0?V(D.current):V(D.current,H))},L=M((V,H)=>{Ew(c,V,u),II(V),g&&g(V,H)}),j=M((V,H)=>{const X=Gd({timeout:A,style:w,easing:f},{mode:"enter"});V.style.webkitTransition=r.transitions.create("-webkit-transform",{...X}),V.style.transition=r.transitions.create("transform",{...X}),V.style.webkitTransform="none",V.style.transform="none",b&&b(V,H)}),I=M(y),N=M(C),$=M(V=>{const H=Gd({timeout:A,style:w,easing:f},{mode:"exit"});V.style.webkitTransition=r.transitions.create("-webkit-transform",H),V.style.transition=r.transitions.create("transform",H),Ew(c,V,u),v&&v(V)}),z=M(V=>{V.style.webkitTransition="",V.style.transition="",S&&S(V)}),F=V=>{s&&s(D.current,V)},G=O.useCallback(()=>{D.current&&Ew(c,D.current,u)},[c,u]);return O.useEffect(()=>{if(h||c==="down"||c==="right")return;const V=DI(()=>{D.current&&Ew(c,D.current,u)}),H=tl(D.current);return H.addEventListener("resize",V),()=>{V.clear(),H.removeEventListener("resize",V)}},[c,h,u]),O.useEffect(()=>{h||G()},[h,G]),m.jsx(E,{nodeRef:D,onEnter:L,onEntered:I,onEntering:j,onExit:$,onExited:z,onExiting:N,addEndListener:F,appear:a,in:h,timeout:A,..._,children:(V,{ownerState:H,...X})=>O.cloneElement(l,{ref:T,style:{visibility:V==="exited"&&!h?"hidden":void 0,...w,...l.props.style},...X})})});function hut(e){return Qe("MuiDrawer",e)}tt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const _le=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},put=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 Ze(i,hut,t)},mut=me(YI,{name:"MuiDrawer",slot:"Root",overridesResolver:_le})(qe(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),gut=me("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:_le})({flex:"0 0 auto"}),yut=me(Nr,{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)}`]]}})(qe(({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}`}}]}))),Dle={left:"right",right:"left",top:"down",bottom:"up"};function but(e){return["left","right"].includes(e)}function vut({direction:e},t){return e==="rtl"&&but(t)?Dle[t]:t}const xut=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiDrawer"}),i=_a(),o=ff(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:u,className:c,elevation:f=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:_={},slotProps:D={},...T}=r,M=O.useRef(!1);O.useEffect(()=>{M.current=!0},[]);const L=vut({direction:o?"rtl":"ltr"},a),I={...r,anchor:a,elevation:f,open:v,variant:E,...T},N=put(I),$={slots:{transition:w,..._},slotProps:{paper:S,transition:C,...D,backdrop:OI(D.backdrop||{...l,...g},{transitionDuration:A})}},[z,F]=ut("root",{ref:n,elementType:mut,className:Oe(N.root,N.modal,c),shouldForwardComponentProp:!0,ownerState:I,externalForwardedProps:{...$,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:h,slots:{backdrop:$.slots.backdrop},slotProps:{backdrop:$.slotProps.backdrop}}}),[G,V]=ut("paper",{elementType:yut,shouldForwardComponentProp:!0,className:Oe(N.paper,S.className),ownerState:I,externalForwardedProps:$,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[H,X]=ut("docked",{elementType:gut,ref:n,className:Oe(N.root,N.docked,c),ownerState:I,externalForwardedProps:$,additionalProps:T}),[B,W]=ut("transition",{elementType:fut,ownerState:I,externalForwardedProps:$,additionalProps:{in:v,direction:Dle[L],timeout:A,appear:M.current}}),Y=m.jsx(G,{...V,children:u});if(E==="permanent")return m.jsx(H,{...X,children:Y});const U=m.jsx(B,{...W,children:Y});return E==="persistent"?m.jsx(H,{...X,children:U}):m.jsx(z,{...F,children:U})}),Sut=HY({themeId:ua}),ZO={error:"#d32f2f",warn:"#ed6c02",info:"#0288d1",debug:"#7b1fa2"},wut={error:gf,warn:r3,info:GI,debug:E3},Cut=({open:e,onClose:t})=>{const[n,r]=O.useState([]),[i,o]=O.useState(!0),[s,a]=O.useState("error,warn,info".split(",")),[l,u]=O.useState(""),[c,f]=O.useState(!0),h=O.useCallback(async()=>{try{const S=new URLSearchParams({level:s.join(","),limit:"500",...l&&{search:l}}),C=await fetch(`api/logs?${S}`);if(C.ok){const w=await C.json();r(w.entries)}}catch(S){console.error("Failed to fetch logs:",S)}finally{o(!1)}},[s,l]);O.useEffect(()=>{e&&h()},[e,h]),O.useEffect(()=>{if(!c||!e)return;const S=setInterval(h,5e3);return()=>clearInterval(S)},[c,e,h]);const g=S=>{a(Array.isArray(S.target.value)?S.target.value:[S.target.value])},y=S=>{u(S.target.value)},b=async()=>{try{await fetch("api/logs",{method:"DELETE"}),r([])}catch(S){console.error("Failed to clear logs:",S)}},v=S=>{const C=wut[S]||GI;return m.jsx(C,{sx:{fontSize:16,color:ZO[S]}})};return m.jsxs(vc,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[m.jsxs(Sc,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(E3,{}),"System Logs",m.jsx(le,{sx:{flexGrow:1}}),m.jsx(bn,{title:"Auto Refresh",children:m.jsx(Ct,{label:c?"Auto":"Manual",color:c?"success":"default",size:"small",onClick:()=>f(!c),sx:{cursor:"pointer"}})}),m.jsx(Fn,{onClick:t,children:m.jsx(gke,{})})]}),m.jsxs(xc,{children:[m.jsx(zt,{spacing:2,sx:{mb:2},children:m.jsxs(zt,{direction:"row",spacing:2,alignItems:"center",children:[m.jsxs(Xa,{size:"small",sx:{minWidth:200},children:[m.jsx(cc,{children:"Log Level"}),m.jsxs(Ha,{value:s,label:"Log Level",onChange:g,multiple:!0,renderValue:S=>m.jsx(le,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(S)?S:[S]).map(C=>m.jsx(Ct,{label:C.toUpperCase(),size:"small",sx:{backgroundColor:ZO[C],color:"white"}},C))}),children:[m.jsx(rr,{value:"error",children:"Error"}),m.jsx(rr,{value:"warn",children:"Warning"}),m.jsx(rr,{value:"info",children:"Info"}),m.jsx(rr,{value:"debug",children:"Debug"})]})]}),m.jsx(zr,{size:"small",placeholder:"Search logs...",value:l,onChange:y,sx:{flexGrow:1}}),m.jsx(Tt,{variant:"outlined",onClick:h,children:"Refresh"}),m.jsx(Tt,{variant:"outlined",color:"error",onClick:b,children:"Clear"})]})}),m.jsx(le,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:i?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(re,{children:"Loading logs..."})}):n.length===0?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(re,{color:"text.secondary",children:"No logs found"})}):m.jsx(zt,{spacing:1,children:n.map((S,C)=>m.jsxs(le,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[v(S.level),m.jsx(re,{variant:"caption",color:"text.secondary",children:new Date(S.timestamp).toLocaleString()}),m.jsx(Ct,{label:S.level.toUpperCase(),size:"small",sx:{backgroundColor:ZO[S.level],color:"white",fontSize:"0.7rem",height:20}})]}),m.jsx(re,{sx:{ml:3},children:S.message}),S.context&&m.jsx(re,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(S.context,null,2)})]},`${S.timestamp}-${S.level}-${C}`))})})]}),m.jsx(Yd,{children:m.jsx(Tt,{onClick:t,children:"Close"})})]})};function MK(){const{isConnected:e}=dbe(),[t,n]=O.useState(null),[r,i]=O.useState(!1);O.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,u=a&&a.total===0,c=t?m.jsxs(le,{sx:{p:.5},children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&m.jsxs("div",{children:[m.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&&m.jsxs("div",{children:[m.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?m.jsx(gf,{fontSize:"small"}):l?m.jsx(Rc,{fontSize:"small"}):m.jsx(c3,{fontSize:"small"}),h=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?u?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return m.jsx(bn,{title:c,arrow:!0,children:m.jsx(Ct,{icon:f(),label:g(),color:h(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Eut=e=>O.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},O.createElement("g",{style:{display:"inline"}},O.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"}),O.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"}))),Aut="home-assistant-matter-hub",kut={name:Aut};function _ut(){const[e,t]=O.useState("2.1.0-alpha.384");return O.useEffect(()=>{fetch("api/health").then(n=>n.ok?n.json():null).then(n=>{n?.version&&t(n.version)}).catch(()=>{})},[]),O.useMemo(()=>({name:kut.name,version:e}),[e])}const Dut=e=>{const t=_ut();return m.jsxs(le,{component:Dc,to:jt.bridges,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[m.jsx(Eut,{style:{height:"40px"}}),m.jsx(re,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&m.jsx(re,{variant:"caption",component:"span",children:t.version})]})},Out=()=>{const e=Sut("(min-width:600px)"),{mode:t,setMode:n}=GA(),[r,i]=O.useState(!1),[o,s]=O.useState(!1),a=Xh(),l=()=>{n(t==="dark"?"light":"dark")},u=[{label:"Dashboard",icon:m.jsx(Y6,{}),to:jt.dashboard},{label:"Bridges",icon:m.jsx(c1,{}),to:jt.bridges},{label:"All Devices",icon:m.jsx(ss,{}),to:jt.devices},{label:"Network Map",icon:m.jsx(QC,{}),to:jt.networkMap},{label:"Startup Order",icon:m.jsx(rg,{}),to:jt.startup},{label:"Lock Credentials",icon:m.jsx(su,{}),to:jt.lockCredentials},{label:"Filter Reference",icon:m.jsx(ZC,{}),to:jt.labels},{label:"Settings",icon:m.jsx(C3,{}),to:jt.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?m.jsx(Rke,{}):m.jsx(vke,{}),onClick:l},{label:"System Logs",icon:m.jsx(E3,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:m.jsx(WC,{}),to:jt.health}],c=f=>{s(!1),f.onClick?f.onClick():f.to&&a(f.to)};return m.jsxs(le,{children:[m.jsx(uut,{sx:{height:"72px"},children:m.jsx(kle,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:m.jsxs(w8,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsx(Dut,{large:e}),e?m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.map(f=>f.to?m.jsx(bn,{title:f.label,children:m.jsx(Fn,{component:Dc,to:f.to,sx:{color:"inherit"},children:f.icon})},f.label):m.jsx(bn,{title:f.label,children:m.jsx(Fn,{onClick:f.onClick,sx:{color:"inherit"},children:f.icon})},f.label)),m.jsx(MK,{})]}):m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(MK,{}),m.jsx(Fn,{onClick:()=>s(!0),sx:{color:"inherit"},children:m.jsx(Ike,{})})]})]})})}),m.jsx(xut,{anchor:"right",open:o,onClose:()=>s(!1),children:m.jsx(bu,{sx:{width:250},children:u.map(f=>m.jsxs(Wbe,{onClick:()=>c(f),children:[m.jsx(Hl,{children:f.icon}),m.jsx(Ua,{primary:f.label})]},f.label))})}),m.jsx(Cut,{open:r,onClose:()=>i(!1)})]})},Tut=()=>m.jsxs(le,{children:[m.jsx(Out,{}),m.jsx(kle,{}),m.jsx(w8,{sx:{p:2},children:m.jsx(cY,{})}),m.jsx(out,{})]}),Rut=VA({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 CC=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");CC?.startsWith("http")&&(CC=new URL(CC).pathname);const Iut=Ahe([{path:"/",element:m.jsx(Tut,{}),children:Klt}],{basename:CC});Hce.createRoot(document.getElementById("root")).render(m.jsx(O.StrictMode,{children:m.jsx(sde,{store:eut,children:m.jsxs(F0e,{theme:Rut,children:[m.jsx(P0e,{}),m.jsx(iX,{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}}}),m.jsx(fbe,{children:m.jsx(e1e,{children:m.jsx(Nhe,{router:Iut})})})]})})}));
|
|
483
|
+
`},yat={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 bat(e){let{announcements:t=yat,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=gat}=e;const{announce:o,announcement:s}=hat(),a=rx("DndLiveRegion"),[l,u]=O.useState(!1);if(O.useEffect(()=>{u(!0)},[]),pat(O.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const c=qt.createElement(qt.Fragment,null,qt.createElement(dat,{id:r,value:i.draggable}),qt.createElement(fat,{id:a,announcement:s}));return n?_d.createPortal(c,n):c}var Ni;(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"})(Ni||(Ni={}));function wA(){}function vK(e,t){return O.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function vat(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return O.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const sl=Object.freeze({x:0,y:0});function sle(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ale(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function xat(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function xK(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 lle(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function SK(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 Sat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=SK(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=sle(SK(l),i);o.push({id:a,data:{droppableContainer:s,value:u}})}}return o.sort(ale)},wat=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=xK(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=xK(l),c=i.reduce((h,g,y)=>h+sle(u[y],g),0),f=Number((c/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(ale)};function Cat(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,u=e.width*e.height,c=s*a,f=c/(l+u-c);return Number(f.toFixed(4))}return 0}const Eat=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=Cat(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(xat)};function Aat(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ule(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sl}function kat(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 _at=kat(1);function Dat(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 Oat(e,t,n){const r=Dat(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:c,height:f,top:u,right:l+c,bottom:u+f,left:l}}const Tat={ignoreTransform:!1};function h0(e,t){t===void 0&&(t=Tat);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=fs(e).getComputedStyle(e);u&&(n=Oat(n,u,c))}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 wK(e){return h0(e,{ignoreTransform:!0})}function Rat(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Iat(e,t){return t===void 0&&(t=fs(e).getComputedStyle(e)),t.position==="fixed"}function Mat(e,t){t===void 0&&(t=fs(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 Wk(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(p8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!tx(i)||rle(i)||n.includes(i))return n;const o=fs(e).getComputedStyle(i);return i!==e&&Mat(i,o)&&n.push(i),Iat(i,o)?n:r(i.parentNode)}return e?r(e):n}function cle(e){const[t]=Wk(e,1);return t??null}function KO(e){return!Vk||!e?null:d0(e)?e:h8(e)?p8(e)||e===f0(e).scrollingElement?window:tx(e)?e:null:null}function dle(e){return d0(e)?e.scrollX:e.scrollLeft}function fle(e){return d0(e)?e.scrollY:e.scrollTop}function YR(e){return{x:dle(e),y:fle(e)}}var Xi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xi||(Xi={}));function hle(e){return!Vk||!e?!1:e===document.scrollingElement}function ple(e){const t={x:0,y:0},n=hle(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 Pat={x:.2,y:.2};function jat(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Pat);const{isTop:u,isBottom:c,isLeft:f,isRight:h}=ple(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+b.height?(g.y=Xi.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!c&&l>=t.bottom-b.height&&(g.y=Xi.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!h&&a>=t.right-b.width?(g.x=Xi.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!f&&s<=t.left+b.width&&(g.x=Xi.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function $at(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 mle(e){return e.reduce((t,n)=>Zm(t,YR(n)),sl)}function Nat(e){return e.reduce((t,n)=>t+dle(n),0)}function Lat(e){return e.reduce((t,n)=>t+fle(n),0)}function Fat(e,t){if(t===void 0&&(t=h0),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);cle(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Bat=[["x",["left","right"],Nat],["y",["top","bottom"],Lat]];class y8{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=Wk(n),i=mle(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of Bat)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class I1{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 zat(e){const{EventTarget:t}=fs(e);return e instanceof t?e:f0(e)}function YO(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 ta;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ta||(ta={}));function CK(e){e.preventDefault()}function Uat(e){e.stopPropagation()}var $n;(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"})($n||($n={}));const gle={start:[$n.Space,$n.Enter],cancel:[$n.Esc],end:[$n.Space,$n.Enter,$n.Tab]},Hat=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $n.Right:return{...n,x:n.x+25};case $n.Left:return{...n,x:n.x-25};case $n.Down:return{...n,y:n.y+25};case $n.Up:return{...n,y:n.y-25}}};class b8{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 I1(f0(n)),this.windowListeners=new I1(fs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ta.Resize,this.handleCancel),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ta.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Fat(r),n(sl)}handleKeyDown(t){if(g8(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=gle,coordinateGetter:s=Hat,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:u}=r.current,c=u?{x:u.left,y:u.top}:sl;this.referenceCoordinates||(this.referenceCoordinates=c);const f=s(t,{active:n,context:r.current,currentCoordinates:c});if(f){const h=ev(f,c),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:_}=ple(b),D=$at(b),T={x:Math.min(v===$n.Right?D.right-D.width/2:D.right,Math.max(v===$n.Right?D.left:D.left+D.width/2,f.x)),y:Math.min(v===$n.Down?D.bottom-D.height/2:D.bottom,Math.max(v===$n.Down?D.top:D.top+D.height/2,f.y))},M=v===$n.Right&&!C||v===$n.Left&&!w,L=v===$n.Down&&!A||v===$n.Up&&!S;if(M&&T.x!==f.x){const j=b.scrollLeft+h.x,I=v===$n.Right&&j<=E.x||v===$n.Left&&j>=_.x;if(I&&!h.y){b.scrollTo({left:j,behavior:a});return}I?g.x=b.scrollLeft-j:g.x=v===$n.Right?b.scrollLeft-E.x:b.scrollLeft-_.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(L&&T.y!==f.y){const j=b.scrollTop+h.y,I=v===$n.Down&&j<=E.y||v===$n.Up&&j>=_.y;if(I&&!h.x){b.scrollTo({top:j,behavior:a});return}I?g.y=b.scrollTop-j:g.y=v===$n.Down?b.scrollTop-E.y:b.scrollTop-_.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,Zm(ev(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()}}b8.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=gle,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 EK(e){return!!(e&&"distance"in e)}function AK(e){return!!(e&&"delay"in e)}class v8{constructor(t,n,r){var i;r===void 0&&(r=zat(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=f0(s),this.documentListeners=new I1(this.document),this.listeners=new I1(r),this.windowListeners=new I1(fs(s)),this.initialCoordinates=(i=KR(o))!=null?i:sl,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(ta.Resize,this.handleCancel),this.windowListeners.add(ta.DragStart,CK),this.windowListeners.add(ta.VisibilityChange,this.handleCancel),this.windowListeners.add(ta.ContextMenu,CK),this.documentListeners.add(ta.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(AK(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(EK(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(ta.Click,Uat,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ta.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=KR(t))!=null?n:sl,u=ev(i,l);if(!r&&a){if(EK(a)){if(a.tolerance!=null&&YO(u,a.tolerance))return this.handleCancel();if(YO(u,a.distance))return this.handleStart()}if(AK(a)&&YO(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);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===$n.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Vat={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class x8 extends v8{constructor(t){const{event:n}=t,r=f0(n.target);super(t,Vat,r)}}x8.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 Wat={move:{name:"mousemove"},end:{name:"mouseup"}};var XR;(function(e){e[e.RightClick=2]="RightClick"})(XR||(XR={}));class qat extends v8{constructor(t){super(t,Wat,f0(t.event.target))}}qat.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===XR.RightClick?!1:(r?.({event:n}),!0)}}];const XO={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Gat extends v8{constructor(t){super(t,XO)}static setup(){return window.addEventListener(XO.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(XO.move.name,t)};function t(){}}}Gat.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 M1;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(M1||(M1={}));var CA;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(CA||(CA={}));function Kat(e){let{acceleration:t,activator:n=M1.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=CA.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:f,threshold:h}=e;const g=Xat({delta:f,disabled:!o}),[y,b]=sat(),v=O.useRef({x:0,y:0}),S=O.useRef({x:0,y:0}),C=O.useMemo(()=>{switch(n){case M1.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case M1.DraggableRect:return i}},[n,i,l]),w=O.useRef(null),A=O.useCallback(()=>{const _=w.current;if(!_)return;const D=v.current.x*S.current.x,T=v.current.y*S.current.y;_.scrollBy(D,T)},[]),E=O.useMemo(()=>a===CA.TreeOrder?[...u].reverse():u,[a,u]);O.useEffect(()=>{if(!o||!u.length||!C){b();return}for(const _ of E){if(r?.(_)===!1)continue;const D=u.indexOf(_),T=c[D];if(!T)continue;const{direction:M,speed:L}=jat(_,T,C,t,h);for(const j of["x","y"])g[j][M[j]]||(L[j]=0,M[j]=0);if(L.x>0||L.y>0){b(),w.current=_,y(A,s),v.current=L,S.current=M;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,u,E,c,JSON.stringify(h)])}const Yat={x:{[Xi.Backward]:!1,[Xi.Forward]:!1},y:{[Xi.Backward]:!1,[Xi.Forward]:!1}};function Xat(e){let{delta:t,disabled:n}=e;const r=GR(t);return nx(i=>{if(n||!r||!i)return Yat;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xi.Backward]:i.x[Xi.Backward]||o.x===-1,[Xi.Forward]:i.x[Xi.Forward]||o.x===1},y:{[Xi.Backward]:i.y[Xi.Backward]||o.y===-1,[Xi.Forward]:i.y[Xi.Forward]||o.y===1}}},[n,t,r])}function Jat(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return nx(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function Qat(e,t){return O.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 nv;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(nv||(nv={}));var JR;(function(e){e.Optimized="optimized"})(JR||(JR={}));const kK=new Map;function Zat(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=O.useState(null),{frequency:a,measure:l,strategy:u}=i,c=O.useRef(e),f=v(),h=Zb(f),g=O.useCallback(function(S){S===void 0&&(S=[]),!h.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[h]),y=O.useRef(null),b=nx(S=>{if(f&&!n)return kK;if(!S||S===kK||c.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 y8(l(A),A):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,f,l]);return O.useEffect(()=>{c.current=e},[e]),O.useEffect(()=>{f||g()},[n,f]),O.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),O.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(u){case nv.Always:return!1;case nv.BeforeDragging:return n;default:return!n}}}function yle(e,t){return nx(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function elt(e,t){return yle(e,t)}function tlt(e){let{callback:t,disabled:n}=e;const r=m8(t),i=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return O.useEffect(()=>()=>i?.disconnect(),[i]),i}function qk(e){let{callback:t,disabled:n}=e;const r=m8(t),i=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return O.useEffect(()=>()=>i?.disconnect(),[i]),i}function nlt(e){return new y8(h0(e),e)}function _K(e,t,n){t===void 0&&(t=nlt);const[r,i]=O.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c})}const s=tlt({callback(l){if(e)for(const u of l){const{type:c,target:f}=u;if(c==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=qk({callback:o});return yu(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function rlt(e){const t=yle(e);return ule(e,t)}const DK=[];function ilt(e){const t=O.useRef(e),n=nx(r=>e?r&&r!==DK&&e&&t.current&&e.parentNode===t.current.parentNode?r:Wk(e):DK,[e]);return O.useEffect(()=>{t.current=e},[e]),n}function olt(e){const[t,n]=O.useState(null),r=O.useRef(e),i=O.useCallback(o=>{const s=KO(o.target);s&&n(a=>a?(a.set(s,YR(s)),new Map(a)):null)},[]);return O.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=KO(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,YR(u)]):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 u=KO(l);u?.removeEventListener("scroll",i)})}},[i,e]),O.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>Zm(o,s),sl):mle(e):sl,[e,t])}function OK(e,t){t===void 0&&(t=[]);const n=O.useRef(null);return O.useEffect(()=>{n.current=null},t),O.useEffect(()=>{const r=e!==sl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ev(e,n.current):sl}function slt(e){O.useEffect(()=>{if(!Vk)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 alt(e,t){return O.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function ble(e){return O.useMemo(()=>e?Rat(e):null,[e])}const TK=[];function llt(e,t){t===void 0&&(t=h0);const[n]=e,r=ble(n?fs(n):null),[i,o]=O.useState(TK);function s(){o(()=>e.length?e.map(l=>hle(l)?r:new y8(t(l),l)):TK)}const a=qk({callback:s});return yu(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function ult(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tx(t)?t:e}function clt(e){let{measure:t}=e;const[n,r]=O.useState(null),i=O.useCallback(u=>{for(const{target:c}of u)if(tx(c)){r(f=>{const h=t(c);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=qk({callback:i}),s=O.useCallback(u=>{const c=ult(u);o?.disconnect(),c&&o?.observe(c),r(c?t(c):null)},[t,o]),[a,l]=SA(s);return O.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const dlt=[{sensor:x8,options:{}},{sensor:b8,options:{}}],flt={current:{}},wC={draggable:{measure:wK},droppable:{measure:wK,strategy:nv.WhileDragging,frequency:JR.Optimized},dragOverlay:{measure:h0}};class P1 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 hlt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new P1,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wA},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wC,measureDroppableContainers:wA,windowRect:null,measuringScheduled:!1},plt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wA,draggableNodes:new Map,over:null,measureDroppableContainers:wA},Gk=O.createContext(plt),vle=O.createContext(hlt);function mlt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new P1}}}function glt(e,t){switch(t.type){case Ni.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ni.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 Ni.DragEnd:case Ni.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ni.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new P1(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Ni.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 P1(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Ni.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new P1(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function ylt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=O.useContext(Gk),o=GR(r),s=GR(n?.id);return O.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!g8(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const f=uat(c);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function blt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function vlt(e){return O.useMemo(()=>({draggable:{...wC.draggable,...e?.draggable},droppable:{...wC.droppable,...e?.droppable},dragOverlay:{...wC.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xlt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=O.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;yu(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const c=n(u),f=ule(c,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=cle(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const xle=O.createContext({...sl,scaleX:1,scaleY:1});var vd;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(vd||(vd={}));const Slt=O.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=dlt,collisionDetection:f=Eat,measuring:h,modifiers:g,...y}=t;const b=O.useReducer(glt,void 0,mlt),[v,S]=b,[C,w]=mat(),[A,E]=O.useState(vd.Uninitialized),_=A===vd.Initialized,{draggable:{active:D,nodes:T,translate:M},droppable:{containers:L}}=v,j=D!=null?T.get(D):null,I=O.useRef({initial:null,translated:null}),N=O.useMemo(()=>{var kt;return D!=null?{id:D,data:(kt=j?.data)!=null?kt:flt,rect:I}:null},[D,j]),$=O.useRef(null),[z,F]=O.useState(null),[G,V]=O.useState(null),H=Zb(y,Object.values(y)),X=rx("DndDescribedBy",s),B=O.useMemo(()=>L.getEnabled(),[L]),W=vlt(h),{droppableRects:Y,measureDroppableContainers:U,measuringScheduled:K}=Zat(B,{dragging:_,dependencies:[M.x,M.y],config:W.droppable}),Z=Jat(T,D),J=O.useMemo(()=>G?KR(G):null,[G]),Q=yr(),ie=elt(Z,W.draggable.measure);xlt({activeNode:D!=null?T.get(D):null,config:Q.layoutShiftCompensation,initialRect:ie,measure:W.draggable.measure});const ue=_K(Z,W.draggable.measure,ie),te=_K(Z?Z.parentElement:null),ne=O.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=L.getNodeFor((n=ne.current.over)==null?void 0:n.id),ce=clt({measure:W.dragOverlay.measure}),pe=(r=ce.nodeRef.current)!=null?r:Z,we=_?(i=ce.rect)!=null?i:ue:null,ke=!!(ce.nodeRef.current&&ce.rect),Ae=rlt(ke?null:ue),Fe=ble(pe?fs(pe):null),Me=ilt(_?oe??Z:null),st=llt(Me),Ge=blt(g,{transform:{x:M.x-Ae.x,y:M.y-Ae.y,scaleX:1,scaleY:1},activatorEvent:G,active:N,activeNodeRect:ue,containerNodeRect:te,draggingNodeRect:we,over:ne.current.over,overlayNodeRect:ce.rect,scrollableAncestors:Me,scrollableAncestorRects:st,windowRect:Fe}),Mt=J?Zm(J,M):null,pt=olt(Me),Be=OK(pt),Ie=OK(pt,[ue]),ze=Zm(Ge,Be),Je=we?_at(we,Ge):null,nt=N&&Je?f({active:N,collisionRect:Je,droppableRects:Y,droppableContainers:B,pointerCoordinates:Mt}):null,ot=lle(nt,"id"),[Ye,Nt]=O.useState(null),Lt=ke?Ge:Zm(Ge,Ie),_t=Aat(Lt,(o=Ye?.rect)!=null?o:null,ue),Xn=O.useRef(null),rn=O.useCallback((kt,Pt)=>{let{sensor:Qt,options:Pn}=Pt;if($.current==null)return;const on=T.get($.current);if(!on)return;const xt=kt.nativeEvent,pn=new Qt({active:$.current,activeNode:on,event:xt,options:Pn,context:ne,onAbort(br){if(!T.get(br))return;const{onDragAbort:ae}=H.current,he={id:br};ae?.(he),C({type:"onDragAbort",event:he})},onPending(br,ei,ae,he){if(!T.get(br))return;const{onDragPending:Ne}=H.current,Ue={id:br,constraint:ei,initialCoordinates:ae,offset:he};Ne?.(Ue),C({type:"onDragPending",event:Ue})},onStart(br){const ei=$.current;if(ei==null)return;const ae=T.get(ei);if(!ae)return;const{onDragStart:he}=H.current,ve={activatorEvent:xt,active:{id:ei,data:ae.data,rect:I}};_d.unstable_batchedUpdates(()=>{he?.(ve),E(vd.Initializing),S({type:Ni.DragStart,initialCoordinates:br,active:ei}),C({type:"onDragStart",event:ve}),F(Xn.current),V(xt)})},onMove(br){S({type:Ni.DragMove,coordinates:br})},onEnd:Zr(Ni.DragEnd),onCancel:Zr(Ni.DragCancel)});Xn.current=pn;function Zr(br){return async function(){const{active:ae,collisions:he,over:ve,scrollAdjustedTranslate:Ne}=ne.current;let Ue=null;if(ae&&Ne){const{cancelDrop:gt}=H.current;Ue={activatorEvent:xt,active:ae,collisions:he,delta:Ne,over:ve},br===Ni.DragEnd&&typeof gt=="function"&&await Promise.resolve(gt(Ue))&&(br=Ni.DragCancel)}$.current=null,_d.unstable_batchedUpdates(()=>{S({type:br}),E(vd.Uninitialized),Nt(null),F(null),V(null),Xn.current=null;const gt=br===Ni.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const rt=H.current[gt];rt?.(Ue),C({type:gt,event:Ue})}})}}},[T]),lt=O.useCallback((kt,Pt)=>(Qt,Pn)=>{const on=Qt.nativeEvent,xt=T.get(Pn);if($.current!==null||!xt||on.dndKit||on.defaultPrevented)return;const pn={active:xt};kt(Qt,Pt.options,pn)===!0&&(on.dndKit={capturedBy:Pt.sensor},$.current=Pn,rn(Qt,Pt))},[T,rn]),Ut=Qat(c,lt);slt(c),yu(()=>{ue&&A===vd.Initializing&&E(vd.Initialized)},[ue,A]),O.useEffect(()=>{const{onDragMove:kt}=H.current,{active:Pt,activatorEvent:Qt,collisions:Pn,over:on}=ne.current;if(!Pt||!Qt)return;const xt={active:Pt,activatorEvent:Qt,collisions:Pn,delta:{x:ze.x,y:ze.y},over:on};_d.unstable_batchedUpdates(()=>{kt?.(xt),C({type:"onDragMove",event:xt})})},[ze.x,ze.y]),O.useEffect(()=>{const{active:kt,activatorEvent:Pt,collisions:Qt,droppableContainers:Pn,scrollAdjustedTranslate:on}=ne.current;if(!kt||$.current==null||!Pt||!on)return;const{onDragOver:xt}=H.current,pn=Pn.get(ot),Zr=pn&&pn.rect.current?{id:pn.id,rect:pn.rect.current,data:pn.data,disabled:pn.disabled}:null,br={active:kt,activatorEvent:Pt,collisions:Qt,delta:{x:on.x,y:on.y},over:Zr};_d.unstable_batchedUpdates(()=>{Nt(Zr),xt?.(br),C({type:"onDragOver",event:br})})},[ot]),yu(()=>{ne.current={activatorEvent:G,active:N,activeNode:Z,collisionRect:Je,collisions:nt,droppableRects:Y,draggableNodes:T,draggingNode:pe,draggingNodeRect:we,droppableContainers:L,over:Ye,scrollableAncestors:Me,scrollAdjustedTranslate:ze},I.current={initial:we,translated:Je}},[N,Z,nt,Je,T,pe,we,Y,L,Ye,Me,ze]),Kat({...Q,delta:M,draggingRect:Je,pointerCoordinates:Mt,scrollableAncestors:Me,scrollableAncestorRects:st});const _n=O.useMemo(()=>({active:N,activeNode:Z,activeNodeRect:ue,activatorEvent:G,collisions:nt,containerNodeRect:te,dragOverlay:ce,draggableNodes:T,droppableContainers:L,droppableRects:Y,over:Ye,measureDroppableContainers:U,scrollableAncestors:Me,scrollableAncestorRects:st,measuringConfiguration:W,measuringScheduled:K,windowRect:Fe}),[N,Z,ue,G,nt,te,ce,T,L,Y,Ye,U,Me,st,W,K,Fe]),Gn=O.useMemo(()=>({activatorEvent:G,activators:Ut,active:N,activeNodeRect:ue,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Ye,measureDroppableContainers:U}),[G,Ut,N,ue,S,X,T,Ye,U]);return qt.createElement(ole.Provider,{value:w},qt.createElement(Gk.Provider,{value:Gn},qt.createElement(vle.Provider,{value:_n},qt.createElement(xle.Provider,{value:_t},u)),qt.createElement(ylt,{disabled:a?.restoreFocus===!1})),qt.createElement(bat,{...a,hiddenTextDescribedById:X}));function yr(){const kt=z?.autoScrollEnabled===!1,Pt=typeof l=="object"?l.enabled===!1:l===!1,Qt=_&&!kt&&!Pt;return typeof l=="object"?{...l,enabled:Qt}:{enabled:Qt}}}),wlt=O.createContext(null),RK="button",Clt="Draggable";function Elt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=rx(Clt),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:f,over:h}=O.useContext(Gk),{role:g=RK,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=O.useContext(v?xle:wlt),[C,w]=SA(),[A,E]=SA(),_=alt(s,t),D=Zb(n);yu(()=>(f.set(t,{id:t,key:o,node:C,activatorNode:A,data:D}),()=>{const M=f.get(t);M&&M.key===o&&f.delete(t)}),[f,t]);const T=O.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===RK?!0:void 0,"aria-roledescription":y,"aria-describedby":c.draggable}),[r,g,b,v,y,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:T,isDragging:v,listeners:r?void 0:_,node:C,over:h,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Alt(){return O.useContext(vle)}const klt="Droppable",_lt={timeout:25};function Dlt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=rx(klt),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=O.useContext(Gk),c=O.useRef({disabled:n}),f=O.useRef(!1),h=O.useRef(null),g=O.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={..._lt,...i},S=Zb(b??r),C=O.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=qk({callback:C,disabled:y||!s}),A=O.useCallback((T,M)=>{w&&(M&&(w.unobserve(M),f.current=!1),T&&w.observe(T))},[w]),[E,_]=SA(A),D=Zb(t);return O.useEffect(()=>{!w||!E.current||(w.disconnect(),f.current=!1,w.observe(E.current))},[E,w]),O.useEffect(()=>(a({type:Ni.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:h,data:D}}),()=>a({type:Ni.UnregisterDroppable,key:o,id:r})),[r]),O.useEffect(()=>{n!==c.current.disabled&&(a({type:Ni.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:E,over:l,setNodeRef:_}}function S8(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Olt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function ww(e){return e!==null&&e>=0}function Tlt(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 Rlt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Sle=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=S8(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}},Cw={scaleX:1,scaleY:1},Ilt=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 u=o[s];return u?{x:0,y:n<s?u.top+u.height-(a.top+a.height):u.top-a.top,...Cw}:null}const l=Mlt(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...Cw}:i<n&&i>=s?{x:0,y:a.height+l,...Cw}:{x:0,y:0,...Cw}};function Mlt(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 wle="Sortable",Cle=qt.createContext({activeIndex:-1,containerId:wle,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Sle,disabled:{draggable:!1,droppable:!1}});function Plt(e){let{children:t,id:n,items:r,strategy:i=Sle,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:c}=Alt(),f=rx(wle,n),h=a.rect!==null,g=O.useMemo(()=>r.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=u?g.indexOf(u.id):-1,S=O.useRef(g),C=!Tlt(g,S.current),w=v!==-1&&b===-1||C,A=Rlt(o);yu(()=>{C&&y&&c(g)},[C,g,y,c]),O.useEffect(()=>{S.current=g},[g]);const E=O.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:w,items:g,overIndex:v,useDragOverlay:h,sortedRects:Olt(g,l),strategy:i}),[b,f,A.draggable,A.droppable,w,g,v,l,h,i]);return qt.createElement(Cle.Provider,{value:E},t)}const jlt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return S8(n,r,i).indexOf(t)},$lt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},Nlt={duration:200,easing:"ease"},Ele="transform",Llt=tv.Transition.toString({property:Ele,duration:0,easing:"linear"}),Flt={roleDescription:"sortable"};function Blt(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=O.useState(null),a=O.useRef(n);return yu(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const u=h0(r.current,{ignoreTransform:!0}),c={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(c.x||c.y)&&s(c)}}n!==a.current&&(a.current=n)},[t,n,r,i]),O.useEffect(()=>{o&&s(null)},[o]),o}function zlt(e){let{animateLayoutChanges:t=$lt,attributes:n,disabled:r,data:i,getNewIndex:o=jlt,id:s,strategy:a,resizeObserverConfig:l,transition:u=Nlt}=e;const{items:c,containerId:f,activeIndex:h,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=O.useContext(Cle),w=Ult(r,g),A=c.indexOf(s),E=O.useMemo(()=>({sortable:{containerId:f,index:A,items:c},...i}),[f,i,A,c]),_=O.useMemo(()=>c.slice(c.indexOf(s)),[c,s]),{rect:D,node:T,isOver:M,setNodeRef:L}=Dlt({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...l}}),{active:j,activatorEvent:I,activeNodeRect:N,attributes:$,setNodeRef:z,listeners:F,isDragging:G,over:V,setActivatorNodeRef:H,transform:X}=Elt({id:s,data:E,attributes:{...Flt,...n},disabled:w.draggable}),B=oat(L,z),W=!!j,Y=W&&!y&&ww(h)&&ww(v),U=!S&&G,K=U&&Y?X:null,J=Y?K??(a??C)({rects:b,activeNodeRect:N,activeIndex:h,overIndex:v,index:A}):null,Q=ww(h)&&ww(v)?o({id:s,items:c,activeIndex:h,overIndex:v}):A,ie=j?.id,ue=O.useRef({activeId:ie,items:c,newIndex:Q,containerId:f}),te=c!==ue.current.items,ne=t({active:j,containerId:f,isDragging:G,isSorting:W,id:s,index:A,items:c,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:u,wasDragging:ue.current.activeId!=null}),oe=Blt({disabled:!ne,index:A,node:T,rect:D});return O.useEffect(()=>{W&&ue.current.newIndex!==Q&&(ue.current.newIndex=Q),f!==ue.current.containerId&&(ue.current.containerId=f),c!==ue.current.items&&(ue.current.items=c)},[W,Q,f,c]),O.useEffect(()=>{if(ie===ue.current.activeId)return;if(ie!=null&&ue.current.activeId==null){ue.current.activeId=ie;return}const pe=setTimeout(()=>{ue.current.activeId=ie},50);return()=>clearTimeout(pe)},[ie]),{active:j,activeIndex:h,attributes:$,data:E,rect:D,index:A,newIndex:Q,items:c,isOver:M,isSorting:W,isDragging:G,listeners:F,node:T,overIndex:v,over:V,setNodeRef:B,setActivatorNodeRef:H,setDroppableNodeRef:L,setDraggableNodeRef:z,transform:oe??J,transition:ce()};function ce(){if(oe||te&&ue.current.newIndex===A)return Llt;if(!(U&&!g8(I)||!u)&&(W||ne))return tv.Transition.toString({...u,property:Ele})}}function Ult(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 EA(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 Hlt=[$n.Down,$n.Right,$n.Up,$n.Left],Vlt=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(Hlt.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case $n.Down:r.top<h.top&&l.push(f);break;case $n.Up:r.top>h.top&&l.push(f);break;case $n.Left:r.left>h.left&&l.push(f);break;case $n.Right:r.left<h.left&&l.push(f);break}});const u=wat({collisionRect:r,droppableRects:i,droppableContainers:l});let c=lle(u,"id");if(c===s?.id&&u.length>1&&(c=u[1].id),c!=null){const f=o.get(n.id),h=o.get(c),g=h?i.get(h.id):null,y=h?.node.current;if(y&&g&&f&&h){const v=Wk(y).some((_,D)=>a[D]!==_),S=Ale(f,h),C=Wlt(f,h),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:ev(A,w)}}}};function Ale(e,t){return!EA(e)||!EA(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Wlt(e,t){return!EA(e)||!EA(t)||!Ale(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const qlt=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=zlt({id:e.id}),[l,u]=O.useState(!1);O.useEffect(()=>{k3(e.id).then(u)},[e.id]);const c={transform:tv.Transform.toString(o),transition:s,opacity:a?.5:1};return m.jsx(er,{ref:i,style:c,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:m.jsxs(gr,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[m.jsx(le,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:m.jsx(Cke,{})}),m.jsx(Ct,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?m.jsx(le,{component:"img",src:Z1(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):m.jsx(rl,{sx:{bgcolor:AM(e),width:40,height:40,boxShadow:2},children:(()=>{const f=EM(e);return m.jsx(f,{sx:{fontSize:24}})})()}),m.jsxs(le,{sx:{flex:1},children:[m.jsx(re,{variant:"subtitle1",fontWeight:500,children:e.name}),m.jsxs(re,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},Glt=()=>{const e=Tc(),{content:t,isLoading:n}=Hg(),r=W3e(),[i,o]=O.useState([]),[s,a]=O.useState(!1);O.useEffect(()=>{if(t){const h=[...t].sort((g,y)=>{const b=g.priority??100,v=y.priority??100;return b-v});o(h),a(!1)}},[t]);const l=vat(vK(x8),vK(b8,{coordinateGetter:Vlt})),u=O.useCallback(h=>{const{active:g,over:y}=h;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 S8(b,v,S)}),a(!0))},[]),c=O.useCallback(async()=>{const h=i.map((g,y)=>({id:g.id,priority:(y+1)*10}));try{await r(h),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=O.useMemo(()=>i.map(h=>h.id),[i]);return n?m.jsx(re,{children:"Loading..."}):m.jsxs(zt,{spacing:3,children:[m.jsx(a3,{items:[{name:"Bridges",to:jt.bridges},{name:"Startup Order",to:jt.startup}]}),m.jsxs(le,{display:"flex",alignItems:"center",gap:2,children:[m.jsx(rg,{color:"primary",fontSize:"large"}),m.jsxs(le,{children:[m.jsx(re,{variant:"h5",fontWeight:600,children:"Startup Order"}),m.jsx(re,{variant:"body2",color:"text.secondary",children:"Drag and drop bridges to set the startup order. Lower positions start first."})]})]}),s&&m.jsx(kn,{severity:"info",action:m.jsx(Tt,{color:"inherit",size:"small",startIcon:m.jsx(tE,{}),onClick:c,children:"Save Changes"}),children:"You have unsaved changes to the startup order."}),m.jsx(Slt,{sensors:l,collisionDetection:Sat,onDragEnd:u,children:m.jsx(Plt,{items:f,strategy:Ilt,children:m.jsx(zt,{spacing:1,children:i.map((h,g)=>m.jsx(qlt,{bridge:h,index:g},h.id))})})}),i.length===0&&m.jsx(re,{color:"text.secondary",textAlign:"center",py:4,children:"No bridges configured yet."}),s&&i.length>0&&m.jsx(le,{display:"flex",justifyContent:"flex-end",children:m.jsx(Tt,{variant:"contained",startIcon:m.jsx(tE,{}),onClick:c,children:"Save Startup Order"})})]})},JO="https://riddix.github.io/home-assistant-matter-hub",jt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",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:JO,faq:{multiFabric:`${JO}/connect-multiple-fabrics`,bridgeConfig:`${JO}/bridge-configuration`}},Klt=[{path:"",element:m.jsx(hbe,{}),children:[{path:"",element:m.jsx(j_e,{})},{path:jt.bridges,element:m.jsx(I_e,{})},{path:jt.createBridge,element:m.jsx(CZe,{})},{path:jt.bridge(":bridgeId"),element:m.jsx(rke,{})},{path:jt.editBridge(":bridgeId"),element:m.jsx(EZe,{})},{path:jt.devices,element:m.jsx(Z_e,{})},{path:jt.networkMap,element:m.jsx(eat,{})},{path:jt.health,element:m.jsx(IZe,{})},{path:jt.labels,element:m.jsx($Ze,{})},{path:jt.lockCredentials,element:m.jsx(UZe,{})},{path:jt.settings,element:m.jsx(iat,{})},{path:jt.startup,element:m.jsx(Glt,{})}]}],Ylt={items:{isInitialized:!1,isLoading:!1}},Xlt=LI(Ylt,e=>{e.addCase(Fo.pending,t=>{t.items.isLoading=!0}).addCase(Fo.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(Fo.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(RX.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(MX.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(PX.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(IX.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(jX,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase($X,(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)}})}),Jlt={byBridge:{}},Qlt=LI(Jlt,e=>{e.addCase(dc.pending,(t,n)=>{t.byBridge[n.meta.arg]=QO(t.byBridge[n.meta.arg],n)}).addCase(dc.rejected,(t,n)=>{t.byBridge[n.meta.arg]=QO(t.byBridge[n.meta.arg],n)}).addCase(dc.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=QO(t.byBridge[n.meta.arg],n)})}),Zlt={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},QO=LI(Zlt,e=>{e.addCase(dc.pending,t=>{t.isLoading=!0}).addCase(dc.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(dc.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),eut=W1e({reducer:{bridges:Xlt,devices:Qlt}}),w8=Dge({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=>it({props:e,name:"MuiContainer"})});function tut(e){return Qe("MuiToolbar",e)}tt("MuiToolbar",["root","gutters","regular","dense"]);const nut=e=>{const{classes:t,disableGutters:n,variant:r}=e;return Ze({root:["root",!n&&"gutters",r]},tut,t)},rut=me("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(qe(({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}]}))),kle=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,u={...r,component:o,disableGutters:s,variant:a},c=nut(u);return m.jsx(rut,{as:o,className:Oe(c.root,i),ref:n,ownerState:u,...l})}),iut=[{name:"GitHub",url:jt.githubRepository},{name:"Documentation",url:jt.documentation}],out=()=>m.jsxs(w8,{sx:{mt:16,mb:4},children:[m.jsx(Di,{sx:{mt:4,mb:4}}),m.jsx(et,{container:!0,spacing:2,justifyContent:"center",children:iut.map((e,t)=>m.jsx(et,{size:{xs:12,sm:"auto"},children:m.jsx(Tt,{fullWidth:!0,size:"small",variant:"outlined",component:s3,href:e.url,target:"_blank",children:e.name})},t.toString()))})]});function sut(e){return Qe("MuiAppBar",e)}tt("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const aut=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ye(t)}`,`position${ye(n)}`]};return Ze(i,sut,r)},IK=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,lut=me(Nr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ye(n.position)}`],t[`color${ye(n.color)}`]]}})(qe(({theme:e})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit",color:"var(--AppBar-color)"}},{props:{color:"default"},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles("dark",{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(Ln(["contrastText"])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:t=>t.enableColorOnDark===!0&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:t=>t.enableColorOnDark===!1&&!["inherit","transparent"].includes(t.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...e.applyStyles("dark",{backgroundColor:e.vars?IK(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?IK(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"})}}]}))),uut=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,u={...r,color:o,position:a,enableColorOnDark:s},c=aut(u);return m.jsx(lut,{square:!0,component:"header",ownerState:u,elevation:4,className:Oe(c.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function cut(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=tl(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const u=o.getComputedStyle(t);s=u.getPropertyValue("-webkit-transform")||u.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const u=s.split("(")[1].split(")")[0].split(",");a=parseInt(u[4],10),l=parseInt(u[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 dut(e){return typeof e=="function"?e():e}function Ew(e,t,n){const r=dut(n),i=cut(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const fut=O.forwardRef(function(t,n){const r=_a(),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:u,direction:c="down",easing:f=i,in:h,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:A=o,TransitionComponent:E=Da,..._}=t,D=O.useRef(null),T=Tr(hf(l),D,n),M=V=>H=>{V&&(H===void 0?V(D.current):V(D.current,H))},L=M((V,H)=>{Ew(c,V,u),II(V),g&&g(V,H)}),j=M((V,H)=>{const X=Gd({timeout:A,style:w,easing:f},{mode:"enter"});V.style.webkitTransition=r.transitions.create("-webkit-transform",{...X}),V.style.transition=r.transitions.create("transform",{...X}),V.style.webkitTransform="none",V.style.transform="none",b&&b(V,H)}),I=M(y),N=M(C),$=M(V=>{const H=Gd({timeout:A,style:w,easing:f},{mode:"exit"});V.style.webkitTransition=r.transitions.create("-webkit-transform",H),V.style.transition=r.transitions.create("transform",H),Ew(c,V,u),v&&v(V)}),z=M(V=>{V.style.webkitTransition="",V.style.transition="",S&&S(V)}),F=V=>{s&&s(D.current,V)},G=O.useCallback(()=>{D.current&&Ew(c,D.current,u)},[c,u]);return O.useEffect(()=>{if(h||c==="down"||c==="right")return;const V=DI(()=>{D.current&&Ew(c,D.current,u)}),H=tl(D.current);return H.addEventListener("resize",V),()=>{V.clear(),H.removeEventListener("resize",V)}},[c,h,u]),O.useEffect(()=>{h||G()},[h,G]),m.jsx(E,{nodeRef:D,onEnter:L,onEntered:I,onEntering:j,onExit:$,onExited:z,onExiting:N,addEndListener:F,appear:a,in:h,timeout:A,..._,children:(V,{ownerState:H,...X})=>O.cloneElement(l,{ref:T,style:{visibility:V==="exited"&&!h?"hidden":void 0,...w,...l.props.style},...X})})});function hut(e){return Qe("MuiDrawer",e)}tt("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const _le=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},put=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 Ze(i,hut,t)},mut=me(YI,{name:"MuiDrawer",slot:"Root",overridesResolver:_le})(qe(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),gut=me("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:_le})({flex:"0 0 auto"}),yut=me(Nr,{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)}`]]}})(qe(({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}`}}]}))),Dle={left:"right",right:"left",top:"down",bottom:"up"};function but(e){return["left","right"].includes(e)}function vut({direction:e},t){return e==="rtl"&&but(t)?Dle[t]:t}const xut=O.forwardRef(function(t,n){const r=it({props:t,name:"MuiDrawer"}),i=_a(),o=ff(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:u,className:c,elevation:f=16,hideBackdrop:h=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:A=s,variant:E="temporary",slots:_={},slotProps:D={},...T}=r,M=O.useRef(!1);O.useEffect(()=>{M.current=!0},[]);const L=vut({direction:o?"rtl":"ltr"},a),I={...r,anchor:a,elevation:f,open:v,variant:E,...T},N=put(I),$={slots:{transition:w,..._},slotProps:{paper:S,transition:C,...D,backdrop:OI(D.backdrop||{...l,...g},{transitionDuration:A})}},[z,F]=ut("root",{ref:n,elementType:mut,className:Oe(N.root,N.modal,c),shouldForwardComponentProp:!0,ownerState:I,externalForwardedProps:{...$,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:h,slots:{backdrop:$.slots.backdrop},slotProps:{backdrop:$.slotProps.backdrop}}}),[G,V]=ut("paper",{elementType:yut,shouldForwardComponentProp:!0,className:Oe(N.paper,S.className),ownerState:I,externalForwardedProps:$,additionalProps:{elevation:E==="temporary"?f:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[H,X]=ut("docked",{elementType:gut,ref:n,className:Oe(N.root,N.docked,c),ownerState:I,externalForwardedProps:$,additionalProps:T}),[B,W]=ut("transition",{elementType:fut,ownerState:I,externalForwardedProps:$,additionalProps:{in:v,direction:Dle[L],timeout:A,appear:M.current}}),Y=m.jsx(G,{...V,children:u});if(E==="permanent")return m.jsx(H,{...X,children:Y});const U=m.jsx(B,{...W,children:Y});return E==="persistent"?m.jsx(H,{...X,children:U}):m.jsx(z,{...F,children:U})}),Sut=HY({themeId:ua}),ZO={error:"#d32f2f",warn:"#ed6c02",info:"#0288d1",debug:"#7b1fa2"},wut={error:gf,warn:r3,info:GI,debug:E3},Cut=({open:e,onClose:t})=>{const[n,r]=O.useState([]),[i,o]=O.useState(!0),[s,a]=O.useState("error,warn,info".split(",")),[l,u]=O.useState(""),[c,f]=O.useState(!0),h=O.useCallback(async()=>{try{const S=new URLSearchParams({level:s.join(","),limit:"500",...l&&{search:l}}),C=await fetch(`api/logs?${S}`);if(C.ok){const w=await C.json();r(w.entries)}}catch(S){console.error("Failed to fetch logs:",S)}finally{o(!1)}},[s,l]);O.useEffect(()=>{e&&h()},[e,h]),O.useEffect(()=>{if(!c||!e)return;const S=setInterval(h,5e3);return()=>clearInterval(S)},[c,e,h]);const g=S=>{a(Array.isArray(S.target.value)?S.target.value:[S.target.value])},y=S=>{u(S.target.value)},b=async()=>{try{await fetch("api/logs",{method:"DELETE"}),r([])}catch(S){console.error("Failed to clear logs:",S)}},v=S=>{const C=wut[S]||GI;return m.jsx(C,{sx:{fontSize:16,color:ZO[S]}})};return m.jsxs(vc,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[m.jsxs(Sc,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(E3,{}),"System Logs",m.jsx(le,{sx:{flexGrow:1}}),m.jsx(bn,{title:"Auto Refresh",children:m.jsx(Ct,{label:c?"Auto":"Manual",color:c?"success":"default",size:"small",onClick:()=>f(!c),sx:{cursor:"pointer"}})}),m.jsx(Fn,{onClick:t,children:m.jsx(gke,{})})]}),m.jsxs(xc,{children:[m.jsx(zt,{spacing:2,sx:{mb:2},children:m.jsxs(zt,{direction:"row",spacing:2,alignItems:"center",children:[m.jsxs(Xa,{size:"small",sx:{minWidth:200},children:[m.jsx(cc,{children:"Log Level"}),m.jsxs(Ha,{value:s,label:"Log Level",onChange:g,multiple:!0,renderValue:S=>m.jsx(le,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(S)?S:[S]).map(C=>m.jsx(Ct,{label:C.toUpperCase(),size:"small",sx:{backgroundColor:ZO[C],color:"white"}},C))}),children:[m.jsx(rr,{value:"error",children:"Error"}),m.jsx(rr,{value:"warn",children:"Warning"}),m.jsx(rr,{value:"info",children:"Info"}),m.jsx(rr,{value:"debug",children:"Debug"})]})]}),m.jsx(zr,{size:"small",placeholder:"Search logs...",value:l,onChange:y,sx:{flexGrow:1}}),m.jsx(Tt,{variant:"outlined",onClick:h,children:"Refresh"}),m.jsx(Tt,{variant:"outlined",color:"error",onClick:b,children:"Clear"})]})}),m.jsx(le,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:i?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(re,{children:"Loading logs..."})}):n.length===0?m.jsx(le,{sx:{display:"flex",justifyContent:"center",p:4},children:m.jsx(re,{color:"text.secondary",children:"No logs found"})}):m.jsx(zt,{spacing:1,children:n.map((S,C)=>m.jsxs(le,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[v(S.level),m.jsx(re,{variant:"caption",color:"text.secondary",children:new Date(S.timestamp).toLocaleString()}),m.jsx(Ct,{label:S.level.toUpperCase(),size:"small",sx:{backgroundColor:ZO[S.level],color:"white",fontSize:"0.7rem",height:20}})]}),m.jsx(re,{sx:{ml:3},children:S.message}),S.context&&m.jsx(re,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(S.context,null,2)})]},`${S.timestamp}-${S.level}-${C}`))})})]}),m.jsx(Yd,{children:m.jsx(Tt,{onClick:t,children:"Close"})})]})};function MK(){const{isConnected:e}=dbe(),[t,n]=O.useState(null),[r,i]=O.useState(!1);O.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,u=a&&a.total===0,c=t?m.jsxs(le,{sx:{p:.5},children:[m.jsxs("div",{children:[m.jsx("strong",{children:"Version:"})," ",t.version??"Unknown"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"Uptime:"})," ",o(t.uptime??0)]}),t.services?.bridges&&m.jsxs("div",{children:[m.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&&m.jsxs("div",{children:[m.jsx("strong",{children:"Home Assistant:"})," ",t.services.homeAssistant.connected?"Connected":"Disconnected"]}),m.jsxs("div",{children:[m.jsx("strong",{children:"WebSocket:"})," ",e?"Connected":"Disconnected"]})]}):"Loading health status...",f=()=>r||!s?m.jsx(gf,{fontSize:"small"}):l?m.jsx(Rc,{fontSize:"small"}):m.jsx(c3,{fontSize:"small"}),h=()=>r||!s?"error":!l||!e?"warning":"success",g=()=>r?"Error":s?e?u?"No Bridges":l?"Online":"Starting":"Offline":"Unhealthy";return m.jsx(bn,{title:c,arrow:!0,children:m.jsx(Ct,{icon:f(),label:g(),color:h(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Eut=e=>O.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},O.createElement("g",{style:{display:"inline"}},O.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"}),O.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"}))),Aut="home-assistant-matter-hub",kut={name:Aut};function _ut(){const[e,t]=O.useState("2.1.0-alpha.385");return O.useEffect(()=>{fetch("api/health").then(n=>n.ok?n.json():null).then(n=>{n?.version&&t(n.version)}).catch(()=>{})},[]),O.useMemo(()=>({name:kut.name,version:e}),[e])}const Dut=e=>{const t=_ut();return m.jsxs(le,{component:Dc,to:jt.bridges,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[m.jsx(Eut,{style:{height:"40px"}}),m.jsx(re,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ye).join("-")}),e.large&&m.jsx(re,{variant:"caption",component:"span",children:t.version})]})},Out=()=>{const e=Sut("(min-width:600px)"),{mode:t,setMode:n}=GA(),[r,i]=O.useState(!1),[o,s]=O.useState(!1),a=Xh(),l=()=>{n(t==="dark"?"light":"dark")},u=[{label:"Dashboard",icon:m.jsx(Y6,{}),to:jt.dashboard},{label:"Bridges",icon:m.jsx(c1,{}),to:jt.bridges},{label:"All Devices",icon:m.jsx(ss,{}),to:jt.devices},{label:"Network Map",icon:m.jsx(QC,{}),to:jt.networkMap},{label:"Startup Order",icon:m.jsx(rg,{}),to:jt.startup},{label:"Lock Credentials",icon:m.jsx(su,{}),to:jt.lockCredentials},{label:"Filter Reference",icon:m.jsx(ZC,{}),to:jt.labels},{label:"Settings",icon:m.jsx(C3,{}),to:jt.settings},{label:t==="dark"?"Light Mode":"Dark Mode",icon:t==="dark"?m.jsx(Rke,{}):m.jsx(vke,{}),onClick:l},{label:"System Logs",icon:m.jsx(E3,{}),onClick:()=>i(!0)},{label:"Health Dashboard",icon:m.jsx(WC,{}),to:jt.health}],c=f=>{s(!1),f.onClick?f.onClick():f.to&&a(f.to)};return m.jsxs(le,{children:[m.jsx(uut,{sx:{height:"72px"},children:m.jsx(kle,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:m.jsxs(w8,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsx(Dut,{large:e}),e?m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.map(f=>f.to?m.jsx(bn,{title:f.label,children:m.jsx(Fn,{component:Dc,to:f.to,sx:{color:"inherit"},children:f.icon})},f.label):m.jsx(bn,{title:f.label,children:m.jsx(Fn,{onClick:f.onClick,sx:{color:"inherit"},children:f.icon})},f.label)),m.jsx(MK,{})]}):m.jsxs(le,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(MK,{}),m.jsx(Fn,{onClick:()=>s(!0),sx:{color:"inherit"},children:m.jsx(Ike,{})})]})]})})}),m.jsx(xut,{anchor:"right",open:o,onClose:()=>s(!1),children:m.jsx(bu,{sx:{width:250},children:u.map(f=>m.jsxs(Wbe,{onClick:()=>c(f),children:[m.jsx(Hl,{children:f.icon}),m.jsx(Ua,{primary:f.label})]},f.label))})}),m.jsx(Cut,{open:r,onClose:()=>i(!1)})]})},Tut=()=>m.jsxs(le,{children:[m.jsx(Out,{}),m.jsx(kle,{}),m.jsx(w8,{sx:{p:2},children:m.jsx(cY,{})}),m.jsx(out,{})]}),Rut=VA({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 CC=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");CC?.startsWith("http")&&(CC=new URL(CC).pathname);const Iut=Ahe([{path:"/",element:m.jsx(Tut,{}),children:Klt}],{basename:CC});Hce.createRoot(document.getElementById("root")).render(m.jsx(O.StrictMode,{children:m.jsx(sde,{store:eut,children:m.jsxs(F0e,{theme:Rut,children:[m.jsx(P0e,{}),m.jsx(iX,{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}}}),m.jsx(fbe,{children:m.jsx(e1e,{children:m.jsx(Nhe,{router:Iut})})})]})})}));
|