@riddix/hamh 2.1.0-alpha.531 → 2.1.0-alpha.532

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.
@@ -220,7 +220,7 @@ export default theme;`}function JF(e){return typeof e=="number"?`${(e*100).toFix
220
220
  `));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(`
221
221
  `))}const W7e=[],Mt={domStructure:Cn(e=>e.domStructure),disabledItemFocusable:Cn(e=>e.disabledItemsFocusable),itemMetaLookup:Cn(e=>e.itemMetaLookup),itemOrderedChildrenIdsLookup:Cn(e=>e.itemOrderedChildrenIdsLookup),itemMeta:Cn((e,t)=>e.itemMetaLookup[t??yl]??null),itemOrderedChildrenIds:Cn((e,t)=>e.itemOrderedChildrenIdsLookup[t??yl]??W7e),itemModel:Cn((e,t)=>e.itemModelLookup[t]),isItemDisabled:Cn((e,t)=>IS(e.itemMetaLookup,t)),itemIndex:Cn((e,t)=>{const n=e.itemMetaLookup[t];return n==null?-1:e.itemChildrenIndexesLookup[n.parentId??yl][n.id]}),itemParentId:Cn((e,t)=>e.itemMetaLookup[t]?.parentId??null),itemDepth:Cn((e,t)=>e.itemMetaLookup[t]?.depth??0),canItemBeFocused:Cn((e,t)=>e.disabledItemsFocusable||!IS(e.itemMetaLookup,t)),itemChildrenIndentation:Cn(e=>e.itemChildrenIndentation)};class b4{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,c){const u=l??yl,{metaLookup:d,modelLookup:p,orderedChildrenIds:g,childrenIndexes:y,itemsChildren:b}=qz({storeParameters:t,items:a,parentId:l,depth:c,isItemExpandable:(v,S)=>!!S&&S.length>0,otherItemsMetaLookup:n});Object.assign(n,d),Object.assign(r,p),i[u]=g,o[u]=y;for(const v of b)s(v.children||[],v.id,c+1)}return s(t.items,null,0),{itemMetaLookup:n,itemModelLookup:r,itemOrderedChildrenIdsLookup:i,itemChildrenIndexesLookup:o}};getItem=t=>Mt.itemModel(this.store.state,t);getItemTree=()=>{const t=n=>{const r=Mt.itemModel(this.store.state,n),i=vt({},r),o=Mt.itemOrderedChildrenIds(this.store.state,n);return o.length>0?i.children=o.map(t):delete i.children,i};return Mt.itemOrderedChildrenIds(this.store.state,null).map(t)};getItemOrderedChildrenIds=t=>Mt.itemOrderedChildrenIds(this.store.state,t);getParentId=t=>Mt.itemMeta(this.store.state,t)?.parentId||null;setIsItemDisabled=({itemId:t,shouldBeDisabled:n})=>{if(!this.store.state.itemMetaLookup[t])return;const r=vt({},this.store.state.itemMetaLookup);r[t]=vt({},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=Mt.itemMeta(this.store.state,t);if(n==null)return null;const r=Jb.treeItemIdAttribute(this.store.state,t,n.idAttribute);return document.getElementById(r)};setItemChildren=({items:t,parentId:n,getChildrenCount:r})=>{const i=n??yl,o=n==null?-1:Mt.itemDepth(this.store.state,n),{metaLookup:s,modelLookup:a,orderedChildrenIds:l,childrenIndexes:c}=qz({storeParameters:this.store.parameters,items:t,parentId:n,depth:o+1,isItemExpandable:r?u=>r(u)!==0:()=>!1,otherItemsMetaLookup:Mt.itemMetaLookup(this.store.state)});this.store.update({itemModelLookup:vt({},this.store.state.itemModelLookup,a),itemMetaLookup:vt({},this.store.state.itemMetaLookup,s),itemOrderedChildrenIdsLookup:vt({},this.store.state.itemOrderedChildrenIdsLookup,{[i]:l}),itemChildrenIndexesLookup:vt({},this.store.state.itemChildrenIndexesLookup,{[i]:c})})};removeChildren=t=>{const n=this.store.state.itemMetaLookup,r=Object.keys(n).reduce((a,l)=>{const c=n[l];return c.parentId===t?a:vt({},a,{[c.id]:c})},{}),i=vt({},this.store.state.itemOrderedChildrenIdsLookup),o=vt({},this.store.state.itemChildrenIndexesLookup),s=t??yl;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 UQ=Xb(e=>e.selectedItems,e=>Array.isArray(e)?e:e!=null?[e]:[]),Gz=Xb(UQ,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),M7=Cn((e,t)=>e.itemMetaLookup[t]?.selectable??!0),tr={selectedItemsRaw:Cn(e=>e.selectedItems),selectedItems:UQ,selectedItemsMap:Gz,enabled:Cn(e=>!e.disableSelection),isMultiSelectEnabled:Cn(e=>e.multiSelect),isCheckboxSelectionEnabled:Cn(e=>e.checkboxSelection),propagationRules:Cn(e=>e.selectionPropagation),isItemSelected:Cn(Gz,(e,t)=>e.has(t)),isFeatureEnabledForItem:Cn(M7,e=>!e.disableSelection,(e,t,n)=>t&&e),canItemBeSelected:Cn(Mt.isItemDisabled,M7,e=>!e.disableSelection,(e,t,n,r)=>n&&!e&&t),isItemSelectable:M7},q7e=Cn((e,t)=>{if(tr.isItemSelected(e,t))return"checked";let n=!1,r=!1;const i=s=>{s!==t&&(tr.isItemSelected(e,s)?n=!0:r=!0),Mt.itemOrderedChildrenIds(e,s).forEach(i)};return i(t),tr.propagationRules(e).parents?n&&r?"indeterminate":n&&!r?"checked":"empty":n?"indeterminate":"empty"}),G7e=({props:e})=>{const{itemId:t}=e,{store:n}=dg(),r=ri(n,tr.isCheckboxSelectionEnabled),i=ri(n,tr.isFeatureEnabledForItem,t),o=ri(n,tr.canItemBeSelected,t),s=ri(n,q7e,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:u=>{a.onChange?.(u),!u.defaultMuiPrevented&&tr.canItemBeSelected(n.state,t)&&l.handleCheckboxSelection(u)},visible:r&&i,disabled:!o,checked:s==="checked",indeterminate:s==="indeterminate"})}}},R7=Xb(e=>e.expandedItems,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),xi={expandedItemsRaw:Cn(e=>e.expandedItems),expandedItemsMap:R7,flatList:Xb(Mt.itemOrderedChildrenIdsLookup,R7,(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[yl]??[]).flatMap(n)}),triggerSlot:Cn(e=>e.expansionTrigger),isItemExpanded:Cn(R7,(e,t)=>e.has(t)),isItemExpandable:Cn(Mt.itemMeta,(e,t)=>e?.expandable??!1)},qD=(e,t)=>{let n=t.length-1;for(;n>=0&&!Mt.canItemBeFocused(e,t[n]);)n-=1;if(n!==-1)return t[n]},VQ=(e,t)=>{const n=Mt.itemMeta(e,t);if(!n)return null;const r=Mt.itemOrderedChildrenIds(e,n.parentId),i=Mt.itemIndex(e,t);if(i===0)return n.parentId;let o=i-1;for(;!Mt.canItemBeFocused(e,r[o])&&o>=0;)o-=1;if(o===-1)return n.parentId==null?null:VQ(e,n.parentId);let s=r[o],a=qD(e,Mt.itemOrderedChildrenIds(e,s));for(;xi.isItemExpanded(e,s)&&a!=null;)s=a,a=qD(e,Mt.itemOrderedChildrenIds(e,s));return s},v4=(e,t)=>{if(xi.isItemExpanded(e,t)){const r=Mt.itemOrderedChildrenIds(e,t).find(i=>Mt.canItemBeFocused(e,i));if(r!=null)return r}let n=Mt.itemMeta(e,t);for(;n!=null;){const r=Mt.itemOrderedChildrenIds(e,n.parentId),i=Mt.itemIndex(e,n.id);if(i<r.length-1){let o=i+1;for(;!Mt.canItemBeFocused(e,r[o])&&o<r.length-1;)o+=1;if(Mt.canItemBeFocused(e,r[o]))return r[o]}n=Mt.itemMeta(e,n.parentId)}return null},WQ=e=>{let t=null;for(;t==null||xi.isItemExpanded(e,t);){const n=Mt.itemOrderedChildrenIds(e,t),r=qD(e,n);if(r==null)return t;t=r}return t},jS=e=>Mt.itemOrderedChildrenIds(e,null).find(t=>Mt.canItemBeFocused(e,t)),qQ=(e,t,n)=>{if(t===n)return[t,n];const r=Mt.itemMeta(e,t),i=Mt.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,c=s.indexOf(a)!==-1,u=o.indexOf(l)!==-1,d=!0,p=!0;for(;!u&&!c;)d&&(o.push(a),c=s.indexOf(a)!==-1,d=a!==null,!c&&d&&(a=Mt.itemParentId(e,a))),p&&!c&&(s.push(l),u=o.indexOf(l)!==-1,p=l!==null,!u&&p&&(l=Mt.itemParentId(e,l)));const g=c?a:l,y=Mt.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]},K7e=(e,t,n)=>{const r=l=>{if(xi.isItemExpandable(e,l)&&xi.isItemExpanded(e,l))return Mt.itemOrderedChildrenIds(e,l)[0];let c=Mt.itemMeta(e,l);for(;c!=null;){const u=Mt.itemOrderedChildrenIds(e,c.parentId),d=Mt.itemIndex(e,c.id);if(d<u.length-1)return u[d+1];c=c.parentId?Mt.itemMeta(e,c.parentId):null}throw new Error("Invalid range")},[i,o]=qQ(e,t,n),s=[i];let a=i;for(;a!==o;)a=r(a),Mt.isItemDisabled(e,a)||s.push(a);return s},Y7e=e=>{let t=jS(e);const n=[];for(;t!=null;)n.push(t),t=v4(e,t);return n},GD=(e,t)=>t!==e.closest('*[role="treeitem"]');class X7e{lastSelectedItem=null;lastSelectedRange={};constructor(t){this.store=t,t.itemPluginManager.register(G7e,null)}setSelectedItems=(t,n,r)=>{const{selectionPropagation:i=$y,selectedItems:o,onItemSelectionToggle:s,onSelectedItemsChange:a}=this.store.parameters,l=tr.selectedItemsRaw(this.store.state);let c;const u=tr.isMultiSelectEnabled(this.store.state);if(u&&(i.descendants||i.parents)?c=J7e({store:this.store,selectionPropagation:i,newModel:n,oldModel:l,additionalItemsToPropagate:r}):c=n,s)if(u){const d=GQ({store:this.store,newModel:c,oldModel:l});s&&(d.added.forEach(p=>{s(t,p,!0)}),d.removed.forEach(p=>{s(t,p,!1)}))}else c!==l&&(l!=null&&s(t,l,!1),c!=null&&s(t,c,!0));o===void 0&&this.store.set("selectedItems",c),a?.(t,c)};selectRange=(t,[n,r])=>{if(!tr.isMultiSelectEnabled(this.store.state))return;let o=tr.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length>0&&(o=o.filter(c=>!this.lastSelectedRange[c]));const s=x4(o),a=K7e(this.store.state,n,r).filter(c=>tr.isItemSelectable(this.store.state,c)),l=a.filter(c=>!s[c]);o=o.concat(l),this.setSelectedItems(t,o),this.lastSelectedRange=x4(a)};buildPublicAPI=()=>({setItemSelection:this.setItemSelection});setItemSelection=({itemId:t,event:n=null,keepExistingSelection:r=!1,shouldBeSelected:i})=>{if(!tr.enabled(this.store.state))return;let o;const s=tr.isMultiSelectEnabled(this.store.state);if(r){const a=tr.selectedItems(this.store.state),l=tr.isItemSelected(this.store.state,t);l&&(i===!1||i==null)?o=a.filter(c=>c!==t):!l&&(i===!0||i==null)?o=[t].concat(a):o=a}else i===!1||i==null&&tr.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(!tr.isMultiSelectEnabled(this.store.state))return;const r=Y7e(this.store.state);this.setSelectedItems(t,r),this.lastSelectedRange=x4(r)};expandSelectionRange=(t,n)=>{if(this.lastSelectedItem!=null){const[r,i]=qQ(this.store.state,n,this.lastSelectedItem);this.selectRange(t,[r,i])}};selectRangeFromStartToItem=(t,n)=>{this.selectRange(t,[jS(this.store.state),n])};selectRangeFromItemToEnd=(t,n)=>{this.selectRange(t,[n,WQ(this.store.state)])};selectItemFromArrowNavigation=(t,n,r)=>{if(!tr.isMultiSelectEnabled(this.store.state))return;let o=tr.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 J7e({store:e,selectionPropagation:t,newModel:n,oldModel:r,additionalItemsToPropagate:i}){if(!t.descendants&&!t.parents)return n;let o=!1;const s=x4(n),a=GQ({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 c=u=>{u!==l&&(o=!0,s[u]=!0),Mt.itemOrderedChildrenIds(e.state,u).forEach(c)};c(l)}if(t.parents){const c=d=>s[d]?Mt.itemOrderedChildrenIds(e.state,d).every(c):!1,u=d=>{const p=Mt.itemParentId(e.state,d);if(p==null)return;Mt.itemOrderedChildrenIds(e.state,p).every(c)&&(o=!0,s[p]=!0,u(p))};u(l)}}),a.removed.forEach(l=>{if(t.parents){let c=Mt.itemParentId(e.state,l);for(;c!=null;)s[c]&&(o=!0,delete s[c]),c=Mt.itemParentId(e.state,c)}if(t.descendants){const c=u=>{u!==l&&(o=!0,delete s[u]),Mt.itemOrderedChildrenIds(e.state,u).forEach(c)};c(l)}}),o?Object.keys(s):n}function GQ({store:e,oldModel:t,newModel:n}){const r=new Map;return n.forEach(i=>{r.set(i,!0)}),{added:n.filter(i=>!tr.isItemSelected(e.state,i)),removed:t.filter(i=>!r.has(i))}}function x4(e){const t={};return e.forEach(n=>{t[n]=!0}),t}function Z7e(e,t,n){const r=ri(e,Jb.treeId),i=ri(e,Mt.itemChildrenIndentation),o=ri(e,tr.isMultiSelectEnabled);return s=>vt({ref:n,role:"tree",id:r,"aria-multiselectable":o},t,s,{style:vt({},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 Q7e(e){return e.replace(/["\\]/g,"\\$&")}const KQ=A.createContext(null);function YQ(e){const{children:t,itemId:n=null,idAttribute:r}=e,{store:i,rootRef:o}=dg(),s=A.useRef(new Map);A.useEffect(()=>{if(!o.current)return;const l=Mt.itemOrderedChildrenIds(i.state,n??null)??[],c=Q7e(r??o.current.id);if(n!=null){const g=o.current.querySelector(`*[id="${c}"][role="treeitem"]`);if(g&&g.getAttribute("aria-expanded")==="false")return}const u=o.current.querySelectorAll(`${n==null?"":`*[id="${c}"] `}[role="treeitem"]:not(*[id="${c}"] [role="treeitem"] [role="treeitem"])`),d=Array.from(u).map(g=>s.current.get(g.id));(d.length!==l.length||d.some((g,y)=>g!==l[y]))&&i.jsxItems.setJSXItemsOrderedChildrenIds(n??null,d)});const a=A.useMemo(()=>({registerChild:(l,c)=>s.current.set(l,c),unregisterChild:l=>s.current.delete(l),parentId:n}),[n]);return h.jsx(KQ.Provider,{value:a,children:t})}const PS=A.createContext(()=>-1),eke=()=>{},KD=typeof document<"u"?A.useLayoutEffect:eke,tke=[];function nke(e){A.useEffect(e,tke)}function rke(e,t){const n=Pc(),r=pM(()=>new e(vt({},t,{isRtl:n}))).current;return KD(()=>r.updateStateFromParameters(vt({},t,{isRtl:n})),[r,n,t]),nke(r.disposeEffect),r}class ike{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 oke=({isItemEditable:e,expansionTrigger:t})=>t||(e?"iconContainer":"content");function XQ(e){return{disabledItemsFocusable:e.disabledItemsFocusable??!1,domStructure:"nested",itemChildrenIndentation:e.itemChildrenIndentation??"12px",providedTreeId:e.id,expansionTrigger:oke({isItemEditable:e.isItemEditable,expansionTrigger:e.expansionTrigger}),disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,selectionPropagation:e.selectionPropagation??$y}}function Kz(e,t,n){return e!==void 0?e:t!==void 0?t:n}function ske(e){return vt({treeId:void 0,focusedItemId:null},XQ(e),b4.buildItemsStateIfNeeded(e),{expandedItems:Kz(e.expandedItems,e.defaultExpandedItems,[]),selectedItems:Kz(e.selectedItems,e.defaultSelectedItems,e.multiSelect?WD:null)})}let Yz=0;const ake=()=>(Yz+=1,`mui-tree-view-${Yz}`);class lke{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 cke{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=>xi.isItemExpanded(this.store.state,t);buildPublicAPI=()=>({isItemExpanded:this.isItemExpanded,setItemExpansion:this.setItemExpansion});setItemExpansion=({itemId:t,event:n=null,shouldBeExpanded:r})=>{const i=xi.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=xi.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=Mt.itemMeta(this.store.state,n);if(r==null)return;const o=Mt.itemOrderedChildrenIds(this.store.state,r.parentId).filter(a=>xi.isItemExpandable(this.store.state,a)&&!xi.isItemExpanded(this.store.state,a)),s=xi.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=vt({},this.store.state.itemMetaLookup);for(const r of t)n[r]=vt({},n[r],{expandable:!0});this.store.set("itemMetaLookup",n)}}const zm={isItemEditable:Cn(e=>e.isItemEditable,Mt.itemModel,(e,t,n)=>!t||e==null?!1:typeof e=="boolean"?e:e(t)),isItemBeingEdited:Cn((e,t)=>t==null?!1:e.editedItemId===t),isAnyItemBeingEdited:Cn(e=>!!e.editedItemId)},uke=500;class dke{typeaheadQuery="";constructor(t){this.store=t,this.labelMap=Xz(Mt.itemMetaLookup(this.store.state)),this.store.registerStoreEffect(Mt.itemMetaLookup,(n,r)=>{this.store.shouldIgnoreItemsStateUpdate()||(this.labelMap=Xz(r))})}canToggleItemSelection=t=>tr.canItemBeSelected(this.store.state,t);canToggleItemExpansion=t=>!Mt.isItemDisabled(this.store.state,t)&&xi.isItemExpandable(this.store.state,t);getFirstItemMatchingTypeaheadQuery=(t,n)=>{const r=c=>{const u=v4(this.store.state,c);return u===null?jS(this.store.state):u},i=c=>{let u=null;const d={};let p=c.length>1?t:r(t);for(;u==null&&!d[p];)this.labelMap[p]?.startsWith(c)?u=p:(d[p]=!0,p=r(p));return u},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||GD(t.target,t.currentTarget))return;const r=t.ctrlKey||t.metaKey,i=t.key,o=tr.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&&zm.isItemEditable(this.store.state,n)&&!zm.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})):tr.isItemSelected(this.store.state,n)||(this.store.selection.setItemSelection({event:t,itemId:n}),t.preventDefault()));break}case i==="ArrowDown":{const s=v4(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=VQ(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(xi.isItemExpanded(this.store.state,n)){const s=v4(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)&&xi.isItemExpanded(this.store.state,n))this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault();else{const s=Mt.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,jS(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,WQ(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&&tr.enabled(this.store.state)):{this.store.selection.selectAllNavigableItems(t),t.preventDefault();break}case(!r&&!t.shiftKey&&fke(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",uke,()=>{this.typeaheadQuery=""});break}}}}function fke(e){return!!e&&e.length===1&&!!e.match(/\S/)}function Xz(e){const t={},n=r=>{t[r.id]=r.label.toLowerCase()};return Object.values(e).forEach(n),t}const Jz=Xb(tr.selectedItems,xi.expandedItemsMap,Mt.itemMetaLookup,Mt.disabledItemFocusable,e=>Mt.itemOrderedChildrenIds(e,null),(e,t,n,r,i)=>{const o=e.find(a=>{if(!r&&IS(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||!IS(n,a));return s??null}),wh={defaultFocusableItemId:Jz,isItemTheDefaultFocusableItem:Cn(Jz,(e,t)=>e===t),focusedItemId:Cn(e=>e.focusedItemId),isItemFocused:Cn((e,t)=>e.focusedItemId===t)};class hke{constructor(t){this.store=t,this.store.registerStoreEffect(Mt.itemMetaLookup,()=>{const n=wh.focusedItemId(t.state);if(n==null||!!Mt.itemMeta(t.state,n))return;const i=wh.defaultFocusableItemId(t.state);if(i==null){this.setFocusedItemId(null);return}this.applyItemFocus(null,i)})}setFocusedItemId=t=>{wh.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=Mt.itemMeta(this.store.state,n);r&&(r.parentId==null||xi.isItemExpanded(this.store.state,r.parentId))&&this.applyItemFocus(t,n)};removeFocusedItem=()=>{const t=wh.focusedItemId(this.store.state);if(t==null)return;if(Mt.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=wh.defaultFocusableItemId(this.store.state);t.target===t.currentTarget&&n!=null&&this.applyItemFocus(t,n)};handleRootBlur=t=>{t.defaultMuiPrevented||this.setFocusedItemId(null)}}class pke{itemPlugins=[];itemWrappers=[];register=(t,n)=>{this.itemPlugins.push(t),n&&this.itemWrappers.push(n)};listPlugins=()=>this.itemPlugins;listWrappers=()=>this.itemWrappers}class mke extends mM{initialParameters=null;eventManager=new ike;timeoutManager=new lke;itemPluginManager=new pke;constructor(t,n,r){const i=ske(t),o=r.getInitialState(i,t);super(o),this.parameters=t,this.instanceName=n,this.mapper=r,this.items=new b4(this),this.focus=new hke(this),this.expansion=new cke(this),this.selection=new X7e(this),this.keyboardNavigation=new dke(this)}buildPublicAPI(){return vt({},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=XQ(t);n(r,"expandedItems"),n(r,"selectedItems"),(this.state.providedTreeId!==t.id||this.state.treeId===void 0)&&(r.treeId=ake()),!this.mapper.shouldIgnoreItemsStateUpdate(t)&&b4.shouldRebuildItemsState(t,this.parameters)&&Object.assign(r,b4.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)=>{gke(r)&&r.isPropagationStopped()||this.eventManager.emit(t,n,r)};subscribeEvent=(t,n)=>{this.eventManager.on(t,n)}}function gke(e){return e?.isPropagationStopped!==void 0}const Zz={isEmpty:Cn(e=>e.lazyLoadedItems==null?!0:Object.keys(e.lazyLoadedItems.loading).length===0&&Object.keys(e.lazyLoadedItems.errors).length===0),isItemLoading:Cn((e,t)=>e.lazyLoadedItems?.loading[t??yl]??!1),itemHasError:Cn((e,t)=>!!e.lazyLoadedItems?.errors[t??yl]),itemError:Cn((e,t)=>e.lazyLoadedItems?.errors[t??yl])},gM=e=>Array.isArray(e)?e.length>0&&e.some(gM):!!e,yke=({itemId:e,children:t})=>{const{store:n,publicAPI:r}=dg(),i=ri(n,xi.isItemExpandable,e),o=ri(n,Zz.isItemLoading,e),s=ri(n,Zz.itemHasError,e),a=gM(t)||i,l=ri(n,xi.isItemExpanded,e),c=ri(n,wh.isItemFocused,e),u=ri(n,tr.isItemSelected,e),d=ri(n,Mt.isItemDisabled,e),p=ri(n,zm.isItemBeingEdited,e),g=ri(n,zm.isItemEditable,e),y={expandable:a,expanded:l,focused:c,selected:u,disabled:d,editing:p,editable:g,loading:o,error:s},b=O=>{if(y.disabled)return;y.focused||n.focus.focusItem(O,e);const _=tr.isMultiSelectEnabled(n.state)&&(O.shiftKey||O.ctrlKey||O.metaKey);y.expandable&&!(_&&xi.isItemExpanded(n.state,e))&&n.expansion.setItemExpansion({event:O,itemId:e})},v=O=>{if(!tr.canItemBeSelected(n.state,e))return;!y.focused&&!y.editing&&n.focus.focusItem(O,e),tr.isMultiSelectEnabled(n.state)&&(O.shiftKey||O.ctrlKey||O.metaKey)?O.shiftKey?n.selection.expandSelectionRange(O,e):n.selection.setItemSelection({event:O,itemId:e,keepExistingSelection:!0}):n.selection.setItemSelection({event:O,itemId:e,shouldBeSelected:!0})},S=O=>{const _=O.nativeEvent.shiftKey,T=tr.isMultiSelectEnabled(n.state);T&&_?n.selection.expandSelectionRange(O,e):n.selection.setItemSelection({event:O,itemId:e,keepExistingSelection:T,shouldBeSelected:O.target.checked})},C=()=>{n.labelEditing&&(p?n.labelEditing.setEditedItem(null):n.labelEditing.setEditedItem(e))};return{interactions:{handleExpansion:b,handleSelection:v,handleCheckboxSelection:S,toggleItemEditing:C,handleSaveItemLabel:(O,_)=>{n.labelEditing&&zm.isItemBeingEdited(n.state,e)&&(n.labelEditing.updateItemLabel(e,_),C(),n.focus.focusItem(O,e))},handleCancelItemLabelEditing:O=>{n.labelEditing&&zm.isItemBeingEdited(n.state,e)&&(C(),n.focus.focusItem(O,e))}},status:y,publicAPI:r}},bke=({props:e,rootRef:t,contentRef:n})=>{const{store:r}=dg(),{children:i,disabled:o=!1,disableSelection:s=!1,label:a,itemId:l,id:c}=e,u=A.useContext(KQ);if(u==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(`
222
222
  `));const{registerChild:d,unregisterChild:p,parentId:g}=u,y=gM(i),b=A.useRef(null),v=RS(b,n),S=ri(r,Jb.treeItemIdAttribute,l,c);return KD(()=>(d(S,l),()=>{p(S),p(S)}),[r,d,p,S,l]),KD(()=>r.jsxItems.insertJSXItem({id:l,idAttribute:c,parentId:g,expandable:y,disabled:o,selectable:!s}),[r,g,l,y,o,s,c]),A.useEffect(()=>{if(a)return r.jsxItems.mapLabelFromJSX(l,(b.current?.textContent??"").toLowerCase())},[r,l,a]),{contentRef:v,rootRef:t}},vke=({children:e,itemId:t,idAttribute:n})=>{const r=A.useContext(PS);return h.jsx(YQ,{itemId:t,idAttribute:n,children:h.jsx(PS.Provider,{value:r+1,children:e})})};class xke{constructor(t){this.store=t,t.itemPluginManager.register(bke,vke)}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(`
223
- `));return this.store.update({itemMetaLookup:vt({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:vt({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=vt({},this.store.state.itemMetaLookup),r=vt({},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=vt({},r);return delete i[t],i})});setJSXItemsOrderedChildrenIds=(t,n)=>{const r=t??yl;this.store.update({itemOrderedChildrenIdsLookup:vt({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:n}),itemChildrenIndexesLookup:vt({},this.store.state.itemChildrenIndexesLookup,{[r]:HQ(n)})})}}const Ske={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class wke extends mke{jsxItems=new xke(this);constructor(t){super(vt({},t,{items:WD}),"SimpleTreeView",Ske)}updateStateFromParameters(t){super.updateStateFromParameters(vt({},t,{items:WD}))}}const Cke=LQ(),Eke=e=>{const{classes:t}=e;return A.useMemo(()=>tt({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},_7e,t),[t])},kke=ge("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),Ake=A.forwardRef(function(t,n){const r=Cke({props:t,name:"MuiSimpleTreeView"}),{slots:i,slotProps:o,apiRef:s,parameters:a,forwardedProps:l}=I7e(r),c=rke(wke,a),u=A.useRef(null),d=RS(n,u),p=Z7e(c,l,d),g=Eke(r),y=i?.root??kke,b=Mr({elementType:y,externalSlotProps:o?.root,className:g.root,getSlotProps:p,ownerState:r});return h.jsx(M7e,{store:c,classes:g,slots:i,slotProps:o,apiRef:s,rootRef:u,children:h.jsx(YQ,{itemId:null,idAttribute:null,children:h.jsx(PS.Provider,{value:0,children:h.jsx(y,vt({},b))})})})}),Dke=(e,t,n)=>typeof n=="function"?n(e,t):n,_ke=e=>{const{runItemPlugins:t,publicAPI:n,store:r}=dg(),i=A.useContext(PS),o=ri(r,Dke,e.itemId,i),{id:s,itemId:a,label:l,children:c,rootRef:u}=e,{rootRef:d,contentRef:p,propsEnhancers:g}=t(e),{interactions:y,status:b}=yke({itemId:a,children:c}),v=A.useRef(null),S=A.useRef(null),C=RS(u,d,v),w=RS(p,S),k=A.useRef(null),E=ri(r,tr.isCheckboxSelectionEnabled),O=ri(r,Jb.treeItemIdAttribute,a,s),_=ri(r,wh.isItemTheDefaultFocusableItem,a),T={rootRefObject:v,contentRefObject:S,interactions:y},I=oe=>ee=>{oe.onFocus?.(ee),!ee.defaultMuiPrevented&&!b.focused&&Mt.canItemBeFocused(r.state,a)&&ee.currentTarget===ee.target&&r.focus.focusItem(ee,a)},P=oe=>ee=>{if(oe.onBlur?.(ee),ee.defaultMuiPrevented)return;const ie=r.items.getItemDOMElement(a);b.editing||ee.relatedTarget&&GD(ee.relatedTarget,ie)&&(ee.target&&ee.target?.dataset?.element==="labelInput"&&GD(ee.target,ie)||ee.relatedTarget?.dataset?.element==="labelInput")||r.focus.removeFocusedItem()},L=oe=>ee=>{oe.onKeyDown?.(ee),!(ee.defaultMuiPrevented||ee.target?.dataset?.element==="labelInput")&&r.keyboardNavigation.handleItemKeyDown(ee,a)},M=oe=>ee=>{oe.onDoubleClick?.(ee),!ee.defaultMuiPrevented&&y.toggleItemEditing()},$=oe=>ee=>{oe.onClick?.(ee),r.items.handleItemClick(ee,a),!(ee.defaultMuiPrevented||k.current?.contains(ee.target))&&(xi.triggerSlot(r.state)==="content"&&y.handleExpansion(ee),E||y.handleSelection(ee))},N=oe=>ee=>{oe.onMouseDown?.(ee),!ee.defaultMuiPrevented&&(ee.shiftKey||ee.ctrlKey||ee.metaKey||b.disabled)&&ee.preventDefault()},z=oe=>ee=>{oe.onClick?.(ee),!ee.defaultMuiPrevented&&xi.triggerSlot(r.state)==="iconContainer"&&y.handleExpansion(ee)};return{getContextProviderProps:()=>({itemId:a,id:s}),getRootProps:(oe={})=>{const ee=vt({},no(e),no(oe)),ie=vt({},ee,{ref:C,role:"treeitem",tabIndex:_?0:-1,id:O,"aria-expanded":b.expandable?b.expanded:void 0,"aria-disabled":b.disabled||void 0},oe,{style:vt({},oe.style??{},{"--TreeView-itemDepth":o}),onFocus:I(ee),onBlur:P(ee),onKeyDown:L(ee)}),te=g.root?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},ie,te)},getContentProps:(oe={})=>{const ee=no(oe),ie=vt({},ee,oe,{ref:w,onClick:$(ee),onMouseDown:N(ee),status:b});["expanded","selected","focused","disabled","editing","editable"].forEach(J=>{b[J]&&(ie[`data-${J}`]="")});const te=g.content?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},ie,te)},getGroupTransitionProps:(oe={})=>{const ee=no(oe);return vt({},ee,{unmountOnExit:!0,component:"ul",role:"group",in:b.expanded,children:c},oe)},getIconContainerProps:(oe={})=>{const ee=no(oe);return vt({},ee,oe,{onClick:z(ee)})},getCheckboxProps:(oe={})=>{const ee=no(oe),ie=vt({},ee,{ref:k,"aria-hidden":!0},oe),te=g.checkbox?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},ie,te)},getLabelProps:(oe={})=>{const ee=vt({},no(oe)),ie=vt({},ee,{children:l},oe,{onDoubleClick:M(ee)}),te=g.label?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},te,ie)},getLabelInputProps:(oe={})=>{const ee=no(oe),ie=g.labelInput?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},oe,ie)},getDragAndDropOverlayProps:(oe={})=>{const ee=no(oe),ie=g.dragAndDropOverlay?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},oe,ie)},getErrorContainerProps:(oe={})=>{const ee=no(oe);return vt({},ee,oe)},getLoadingContainerProps:(oe={})=>{const ee=no(oe);return vt({size:"12px",thickness:6},ee,oe)},rootRef:C,status:b,publicAPI:n}};function Oke(e){return et("MuiTreeItem",e)}it("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const Tke=Ee(h.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),Mke=Ee(h.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),Rke=["ownerState"];function I7(e,t,n){return e!==void 0?e:t!==void 0?t:n}function Ike(e){const{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:o}=BQ(),s={collapseIcon:I7(t?.collapseIcon,i.collapseIcon,Mke),expandIcon:I7(t?.expandIcon,i.expandIcon,Tke),endIcon:I7(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],c=Mr({elementType:l,externalSlotProps:d=>vt({},pS(o[a],d),pS(n?.[a],d)),ownerState:{}}),u=pp(c,Rke);return l?h.jsx(l,vt({},u)):null}const jke=ge("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>n0(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})`:ac(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 Pke(e){return e.action==null?null:h.jsx(jke,vt({},e))}function $ke(e){const{children:t,itemId:n,id:r}=e,{wrapItem:i,store:o}=dg(),s=ri(o,Jb.treeItemIdAttribute,n,r);return h.jsx(A.Fragment,{children:i({children:t,itemId:n,store:o,idAttribute:s})})}const Lke=ge("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>vt({},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}`}})),Nke=["visible"],Fke=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],Bke=LQ(),zke=ge("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),Hke=ge("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>n0(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})`:ac(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}))`:ac(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})`:ac(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}))`:ac(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),Uke=ge("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>n0(e)&&e!=="editable"})(({theme:e})=>vt({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),Vke=ge("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),Wke=ge(ia,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),qke=ge("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),Gke=ge(Jn,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),Kke=ge(A.forwardRef((e,t)=>{const{visible:n}=e,r=pp(e,Nke);return n?h.jsx(xs,vt({},r,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),Yke=e=>{const{classes:t}=BQ(),n=vt({},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 tt({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"]},Oke,n)},Xke=A.forwardRef(function(t,n){const r=Bke({props:t,name:"MuiTreeItem"}),{id:i,itemId:o,label:s,disabled:a,disableSelection:l,children:c,slots:u={},slotProps:d={},classes:p}=r,g=pp(r,Fke),{getContextProviderProps:y,getRootProps:b,getContentProps:v,getIconContainerProps:S,getCheckboxProps:C,getLabelProps:w,getGroupTransitionProps:k,getLabelInputProps:E,getDragAndDropOverlayProps:O,getErrorContainerProps:_,getLoadingContainerProps:T,status:I}=_ke({id:i,itemId:o,children:c,label:s,disabled:a,disableSelection:l}),P=Yke(p),L=u.root??zke,M=Mr({elementType:L,getSlotProps:b,externalForwardedProps:g,externalSlotProps:d.root,additionalProps:{ref:n},ownerState:{},className:P.root}),$=u.content??Hke,N=Mr({elementType:$,getSlotProps:v,externalSlotProps:d.content,ownerState:{},className:Oe(P.content,I.expanded&&P.expanded,I.selected&&P.selected,I.focused&&P.focused,I.disabled&&P.disabled,I.editing&&P.editing,I.editable&&P.editable)}),z=u.iconContainer??Vke,F=Mr({elementType:z,getSlotProps:S,externalSlotProps:d.iconContainer,ownerState:{},className:P.iconContainer}),W=u.label??Uke,V=Mr({elementType:W,getSlotProps:w,externalSlotProps:d.label,ownerState:{},className:P.label}),q=u.checkbox??Kke,X=Mr({elementType:q,getSlotProps:C,externalSlotProps:d.checkbox,ownerState:{},className:P.checkbox}),B=u.groupTransition??void 0,U=Mr({elementType:B,getSlotProps:k,externalSlotProps:d.groupTransition,ownerState:{},className:P.groupTransition}),Y=u.labelInput??Lke,H=Mr({elementType:Y,getSlotProps:E,externalSlotProps:d.labelInput,ownerState:{},className:P.labelInput}),G=u.dragAndDropOverlay??Pke,Z=Mr({elementType:G,getSlotProps:O,externalSlotProps:d.dragAndDropOverlay,ownerState:{},className:P.dragAndDropOverlay}),oe=u.errorIcon??qke,ee=Mr({elementType:oe,getSlotProps:_,externalSlotProps:d.errorIcon,ownerState:{},className:P.errorIcon}),ie=u.loadingIcon??Gke,te=Mr({elementType:ie,getSlotProps:T,externalSlotProps:d.loadingIcon,ownerState:{},className:P.loadingIcon});return h.jsx($ke,vt({},y(),{children:h.jsxs(L,vt({},M,{children:[h.jsxs($,vt({},N,{children:[h.jsxs(z,vt({},F,{children:[I.error&&h.jsx(oe,vt({},ee)),I.loading?h.jsx(ie,vt({},te)):h.jsx(Ike,{status:I,slots:u,slotProps:d})]})),h.jsx(q,vt({},X)),I.editing?h.jsx(Y,vt({},H)):h.jsx(W,vt({},V)),h.jsx(G,vt({},Z))]})),c&&h.jsx(Wke,vt({as:B},U))]}))}))}),JQ=Ee(h.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"})),rC=Ee(h.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"})),Jke=Ee(h.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"})),yM=Ee(h.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"})),Zke=Ee(h.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"})),Qke=Ee(h.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"})),iC=Ee(h.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"})),Tu=Ee(h.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"})),ZQ=Ee(h.jsx("path",{d:"M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z"})),eAe=Ee(h.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"})),S4=Ee(h.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"})),oC=Ee(h.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"})),sC=Ee(h.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"})),tAe=Ee(h.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"})),nAe=Ee(h.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"})),bM=Ee(h.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"})),rAe=Ee([h.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"),h.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")]),iAe=({endpoint:e})=>{const t=A.useMemo(()=>{switch(e.type.name){case"RootNode":return h.jsx(yM,{});case"Aggregator":return h.jsx(Zke,{});case"OnOffPlugInUnit":return h.jsx(tAe,{});case"OnOffLight":case"ExtendedColorLight":case"ColorTemperatureLight":case"DimmableLight":return h.jsx(iC,{});case"TemperatureSensor":return h.jsx(sC,{});case"Thermostat":return h.jsx(JQ,{});case"Fan":return h.jsx(rAe,{});case"OnOffSensor":return h.jsx(Jke,{});case"HumiditySensor":return h.jsx(bM,{});case"WindowCovering":return h.jsx(rC,{});case"DoorLock":return h.jsx(Tu,{});case"OccupancySensor":return h.jsx(eAe,{});case"ContactSensor":return h.jsx(ZQ,{});case"WaterLeakDetector":return h.jsx(nAe,{});case"Speaker":return h.jsx(oC,{});case"RoboticVacuumCleaner":return h.jsx(S4,{});default:return h.jsx(Qke,{})}},[e]);return h.jsx(Nt,{title:`${e.type.name} (${e.type.id})`,children:t})},oAe=e=>{const[t,n]=A.useState(()=>aAe(e.endpoint)),r=i=>{let o;i&&(o=lAe(i,e.endpoint)),e.onSelected(o)};return h.jsx(Ake,{expandedItems:t,onExpandedItemsChange:(i,o)=>n(o),onSelectedItemsChange:(i,o)=>r(o),children:h.jsx(QQ,{endpoint:e.endpoint,sortBy:e.sortBy})})},QQ=e=>{const t=A.useMemo(()=>{const n=[...e.endpoint.parts];switch(e.sortBy){case"name":return n.sort((r,i)=>{const o=ta(r.state)??r.id.local,s=ta(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 h.jsx(Xke,{itemId:e.endpoint.id.global,label:h.jsx(sAe,{endpoint:e.endpoint}),children:t.map(n=>h.jsx(QQ,{endpoint:n,sortBy:e.sortBy},n.id.global))})},sAe=e=>{const{t}=on(),n=A.useMemo(()=>{const i=e.endpoint.state.homeAssistantEntity?.entity?.state?.state;return i==="unavailable"||i==="unknown"},[e.endpoint.state]);return h.jsxs(ae,{display:"flex",alignItems:"center",children:[h.jsx(iAe,{endpoint:e.endpoint}),h.jsx(ae,{marginLeft:1,component:"span",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",sx:n?{opacity:.6}:void 0,children:h.jsx(O8e,{endpoint:e.endpoint})}),n&&h.jsx(Nt,{title:t("endpoints.entityUnavailable"),children:h.jsx(Bu,{color:"warning",sx:{fontSize:16,ml:.5,flexShrink:0}})})]})};function aAe(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 lAe(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 w4=e=>{const t=e.parts??[];return t.length===0?[e]:t.flatMap(n=>w4(n))},cAe=e=>{const{t}=on(),[n,r]=A.useState(void 0),[i,o]=A.useState("name"),[s,a]=A.useState("cards"),[l,c]=A.useState(""),[u,d]=A.useState(!1),[p,g]=A.useState(!1),[y,b]=A.useState(!1),[v,S]=A.useState(""),[C,w]=A.useState(),[k,E]=A.useState({open:!1,message:"",severity:"success"}),[O,_]=A.useState({}),T=A.useMemo(()=>{const W=w4(e.endpoint),V=[];for(const q of W){const B=q.state.homeAssistantEntity?.entity?.entity_id;B&&V.push(B)}return V},[e.endpoint]),I=A.useCallback(()=>{T.length!==0&&MQ(T).then(_).catch(()=>{})},[T]);A.useEffect(()=>{I()},[I]);const P=A.useCallback(()=>{I()},[I]),L=A.useCallback(async(W,V)=>{if(V){S(W);try{const X=(await dM(V)).mappings.find(B=>B.entityId===W);w(X)}catch{w(void 0)}b(!0)}},[]),M=A.useCallback(async W=>{if(!(!e.bridgeId||!v))try{await fM(e.bridgeId,v,W),E({open:!0,message:`Mapping saved for ${v}. Restart the bridge to apply changes.`,severity:"success"}),b(!1),e.onMappingSaved?.()}catch(V){E({open:!0,message:`Failed to save mapping: ${V}`,severity:"error"})}},[e.bridgeId,v,e.onMappingSaved]),$=A.useCallback(W=>{const q=W.state.homeAssistantEntity?.entity?.state?.state;return q==="unavailable"||q==="unknown"},[]),N=A.useMemo(()=>w4(e.endpoint).filter($).length,[e.endpoint,$]),z=A.useMemo(()=>[...w4(e.endpoint).filter(q=>{if(p&&!$(q))return!1;const X=ta(q.state)??q.id.local,B=q.type.name,U=l.toLowerCase();return X.toLowerCase().includes(U)||B.toLowerCase().includes(U)})].sort((q,X)=>{const B=ta(q.state)??q.id.local,U=ta(X.state)??X.id.local;switch(i){case"name":return B.localeCompare(U);case"endpoint":return q.id.local.localeCompare(X.id.local);case"type":return q.type.name.localeCompare(X.type.name);default:return 0}}),[e.endpoint,l,i,p,$]),F=W=>{r(W),d(!0)};return h.jsxs(ae,{children:[h.jsxs(ae,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,gap:2,flexWrap:"wrap",children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:2,children:[h.jsxs(re,{variant:"h6",component:"span",children:[t("endpoints.title")," (",z.length,")"]}),h.jsx(Nt,{title:t("endpoints.viewAll"),children:h.jsx(Wt,{component:Dc,to:Tt.devices,size:"small",color:"primary",children:h.jsx(aa,{})})})]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[h.jsx(Zn,{size:"small",placeholder:t("endpoints.searchPlaceholder"),value:l,onChange:W=>c(W.target.value),sx:{flexGrow:1,maxWidth:300}}),N>0&&h.jsx(Nt,{title:p?t("endpoints.showAll"):t("endpoints.showUnavailable",{count:N}),children:h.jsx(Wt,{size:"small",color:p?"warning":"default",onClick:()=>g(W=>!W),"aria-label":p?"Show all entities":`Show ${N} unavailable entities`,children:h.jsx(SQ,{badgeContent:N,color:"warning",max:99,children:h.jsx(Bu,{})})})}),h.jsxs(rs,{size:"small",sx:{minWidth:120},children:[h.jsx(ja,{id:"sort-label",children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:.5,children:[h.jsx(xQ,{fontSize:"small"})," ",t("endpoints.sortBy")]})}),h.jsxs(ts,{labelId:"sort-label",value:i,label:t("endpoints.sortBy"),onChange:W=>o(W.target.value),children:[h.jsx(Nn,{value:"name",children:t("endpoints.sortName")}),h.jsx(Nn,{value:"endpoint",children:t("endpoints.sortEndpoint")}),h.jsx(Nn,{value:"type",children:t("endpoints.sortType")})]})]}),h.jsxs(sEe,{value:s,exclusive:!0,onChange:(W,V)=>V&&a(V),size:"small","aria-label":"View mode",children:[h.jsx(_z,{value:"cards","aria-label":"Card view",children:h.jsx(Nt,{title:t("endpoints.cardView"),children:h.jsx(R8e,{})})}),h.jsx(_z,{value:"tree","aria-label":"Tree view",children:h.jsx(Nt,{title:t("endpoints.treeView"),children:h.jsx(I8e,{})})})]})]})]}),s==="cards"?h.jsx(dt,{container:!0,spacing:2,children:z.map(W=>h.jsx(dt,{size:{xs:12,sm:6,lg:4},children:h.jsx(IQ,{endpoint:W,bridgeId:e.bridgeId,onClick:()=>F(W),onEditMapping:e.bridgeId?L:void 0,imageInfo:O[W.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:P})},W.id.global))}):h.jsxs(dt,{container:!0,spacing:2,children:[h.jsx(dt,{size:{xs:12,md:4},children:h.jsx(oAe,{endpoint:e.endpoint,onSelected:r,sortBy:i})}),h.jsx(dt,{size:{xs:12,md:8},children:n&&h.jsx(Bz,{endpoint:n})})]}),h.jsxs(Po,{open:u,onClose:()=>d(!1),maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:n&&(ta(n.state)??n.id.local)}),h.jsx($o,{children:n&&h.jsx(Bz,{endpoint:n})})]}),e.bridgeId&&h.jsx(hM,{open:y,onClose:()=>b(!1),entityId:v,domain:v.split(".")[0]||"",currentMapping:C,onSave:M}),h.jsx(Pw,{open:k.open,autoHideDuration:6e3,onClose:()=>E({...k,open:!1}),children:h.jsx(zt,{onClose:()=>E({...k,open:!1}),severity:k.severity,sx:{width:"100%"},children:k.message})})]})},A2=Ee(h.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),fg=Ee(h.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"})),eee=Ee(h.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"}));async function uAe(e,t,n){const r=new URLSearchParams({name:t});n?.length&&r.set("entityIds",n.join(","));const i=await fetch(`api/mapping-profiles/export/${e}?${r.toString()}`);return await Mn(i,"Failed to export mapping profile"),sr(i)}async function dAe(e,t,n){const r=await fetch(`api/mapping-profiles/import/preview/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:t,availableEntityIds:n})});return await Mn(r,"Failed to preview import"),sr(r)}async function fAe(e,t,n){const r=await fetch(`api/mapping-profiles/import/apply/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:t,selectedEntityIds:n})});return await Mn(r,"Failed to apply mapping profile"),sr(r)}function hAe({bridgeId:e}){const{t}=on(),[n,r]=A.useState(null),[i,o]=A.useState(!0),[s,a]=A.useState(null),[l,c]=A.useState(null),[u,d]=A.useState(!1),[p,g]=A.useState(null),[y,b]=A.useState(null),[v,S]=A.useState(null),[C,w]=A.useState(new Set),[k,E]=A.useState(!1),[O,_]=A.useState(!1),[T,I]=A.useState(new Set),[P,L]=A.useState("Bridge Mappings"),M=A.useRef(null),$=A.useCallback(async()=>{try{const te=await dM(e);r(te),a(null)}catch{a(t("mapping.loadFailed"))}finally{o(!1)}},[e,t]);A.useEffect(()=>{$()},[$]);const N=A.useCallback(()=>{g({entityId:"",domain:""}),d(!0)},[]),z=A.useCallback((te,J)=>{const Q=te.split(".")[0]||"";g({entityId:te,domain:Q,config:J}),d(!0)},[]),F=A.useCallback(async te=>{try{await uEe(e,te),await $()}catch{a(t("mapping.deleteFailed"))}},[e,$,t]),W=A.useCallback(async te=>{if(te.entityId)try{await fM(e,te.entityId,te),d(!1),g(null),await $()}catch{a(t("mapping.saveFailed",{error:""}))}},[e,$,t]),V=A.useCallback(()=>{d(!1),g(null)},[]),q=n?.mappings??[],X=A.useCallback(()=>{const te=new Set(q.map(J=>J.entityId));I(te),L("Bridge Mappings"),_(!0)},[q]),B=A.useCallback(async()=>{try{const te=[...T],J=await uAe(e,P,te),Q=new Blob([JSON.stringify(J,null,2)],{type:"application/json"}),se=URL.createObjectURL(Q),le=document.createElement("a");le.href=se,le.download=`mapping-profile-${e.slice(0,8)}.json`,le.click(),URL.revokeObjectURL(se),_(!1)}catch{a("Failed to export mapping profile")}},[e,T,P]),U=A.useCallback(()=>{_(!1)},[]),Y=A.useCallback(te=>{I(J=>{const Q=new Set(J);return Q.has(te)?Q.delete(te):Q.add(te),Q})},[]),H=A.useCallback(()=>{I(te=>te.size===q.length?new Set:new Set(q.map(J=>J.entityId)))},[q]),G=A.useCallback(()=>{M.current?.click()},[]),Z=A.useCallback(async te=>{const J=te.target.files?.[0];if(J){te.target.value="";try{const Q=await J.text(),se=JSON.parse(Q);if(!se.version||!se.entries){a("Invalid mapping profile file");return}const le=(n?.mappings??[]).map(ye=>ye.entityId),he=await dAe(e,se,le);S(se),b(he),w(new Set(he.matches.map(ye=>ye.matchedEntityId)))}catch{a("Failed to parse mapping profile file")}}},[e,n]),oe=A.useCallback(async()=>{if(v){E(!0);try{const te=await fAe(e,v,[...C]);b(null),S(null),w(new Set),c(`Imported ${te.applied} mapping(s)${te.skipped>0?`, ${te.skipped} skipped`:""}${te.errors.length>0?`, ${te.errors.length} error(s)`:""}`),await $()}catch{a("Failed to apply mapping profile")}finally{E(!1)}}},[e,v,C,$]),ee=A.useCallback(()=>{b(null),S(null),w(new Set)},[]),ie=A.useCallback(te=>{w(J=>{const Q=new Set(J);return Q.has(te)?Q.delete(te):Q.add(te),Q})},[]);return h.jsxs(On,{children:[h.jsxs(Yn,{children:[h.jsxs(ae,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[h.jsxs(re,{variant:"h6",children:[h.jsx(fg,{sx:{mr:1,verticalAlign:"middle"}}),t("mapping.title")]}),h.jsxs(Vt,{direction:"row",spacing:1,children:[q.length>0&&h.jsx(qe,{variant:"outlined",size:"small",startIcon:h.jsx(A2,{}),onClick:X,children:t("common.export")}),h.jsx(qe,{variant:"outlined",size:"small",startIcon:h.jsx(eee,{}),onClick:G,children:t("common.import")}),h.jsx(qe,{variant:"outlined",size:"small",onClick:N,children:t("mapping.addMapping")})]}),h.jsx("input",{ref:M,type:"file",accept:".json",style:{display:"none"},onChange:Z})]}),s&&h.jsx(zt,{severity:"error",sx:{mb:2},onClose:()=>a(null),children:s}),l&&h.jsx(zt,{severity:"success",sx:{mb:2},icon:h.jsx(Ja,{}),onClose:()=>c(null),children:l}),i&&h.jsxs(re,{color:"text.secondary",children:[t("common.loading"),"..."]}),!i&&q.length===0&&h.jsx(re,{color:"text.secondary",children:t("mapping.noMappings")}),!i&&q.length>0&&h.jsx(tf,{children:h.jsxs(Qd,{size:"small",children:[h.jsx(i0,{children:h.jsxs(So,{children:[h.jsx(qt,{children:t("mapping.entityId")}),h.jsx(qt,{children:t("mapping.deviceType")}),h.jsx(qt,{children:t("mapping.customName")}),h.jsx(qt,{children:t("mapping.status")}),h.jsx(qt,{align:"right",children:t("common.actions")})]})}),h.jsx(ef,{children:q.map(te=>h.jsxs(So,{children:[h.jsx(qt,{children:h.jsx(re,{variant:"body2",fontFamily:"monospace",children:te.entityId})}),h.jsx(qt,{children:te.matterDeviceType||h.jsx(re,{color:"text.secondary",variant:"body2",children:"Auto"})}),h.jsx(qt,{children:te.customName||h.jsx(re,{color:"text.secondary",variant:"body2",children:"—"})}),h.jsx(qt,{children:te.disabled?h.jsx(ft,{label:t("common.disabled"),color:"error",size:"small"}):h.jsx(ft,{label:t("common.enabled"),color:"success",size:"small"})}),h.jsxs(qt,{align:"right",children:[h.jsx(Wt,{size:"small",onClick:()=>z(te.entityId,te),"aria-label":`Edit mapping for ${te.entityId}`,children:h.jsx(qw,{fontSize:"small"})}),h.jsx(Wt,{size:"small",onClick:()=>F(te.entityId),"aria-label":`Delete mapping for ${te.entityId}`,children:h.jsx(Pa,{fontSize:"small"})})]})]},te.entityId))})]})})]}),p&&h.jsx(hM,{open:u,entityId:p.entityId,domain:p.domain,currentMapping:p.config,onSave:W,onClose:V}),h.jsxs(Po,{open:O,onClose:U,maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:t("mapping.exportProfile")}),h.jsx($o,{children:h.jsxs(Vt,{spacing:2,sx:{mt:1},children:[h.jsx(Zn,{label:t("mapping.profileName"),size:"small",fullWidth:!0,value:P,onChange:te=>L(te.target.value)}),h.jsx(tf,{children:h.jsxs(Qd,{size:"small",children:[h.jsx(i0,{children:h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox",children:h.jsx(xs,{size:"small",checked:T.size===q.length,indeterminate:T.size>0&&T.size<q.length,onChange:H})}),h.jsx(qt,{children:t("mapping.entityId")}),h.jsx(qt,{children:t("mapping.deviceType")}),h.jsx(qt,{children:t("mapping.customName")})]})}),h.jsx(ef,{children:q.map(te=>h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox",children:h.jsx(xs,{size:"small",checked:T.has(te.entityId),onChange:()=>Y(te.entityId)})}),h.jsx(qt,{children:h.jsx(re,{variant:"body2",fontFamily:"monospace",children:te.entityId})}),h.jsx(qt,{children:te.matterDeviceType||h.jsx(re,{color:"text.secondary",variant:"body2",children:"Auto"})}),h.jsx(qt,{children:te.customName||h.jsx(re,{color:"text.secondary",variant:"body2",children:"—"})})]},te.entityId))})]})})]})}),h.jsxs(es,{children:[h.jsx(qe,{onClick:U,children:t("common.cancel")}),h.jsxs(qe,{variant:"contained",onClick:B,disabled:T.size===0,startIcon:h.jsx(A2,{}),children:[t("common.export")," ",T.size]})]})]}),h.jsxs(Po,{open:!!y,onClose:ee,maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:t("mapping.importProfile")}),h.jsx($o,{children:y&&h.jsxs(Vt,{spacing:2,sx:{mt:1},children:[h.jsxs(re,{variant:"body2",color:"text.secondary",children:["Profile: ",h.jsx("strong",{children:y.profileName})," —"," ",y.totalEntries," entries,"," ",y.matches.length," matched"]}),y.matches.length>0&&h.jsx(tf,{children:h.jsxs(Qd,{size:"small",children:[h.jsx(i0,{children:h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox"}),h.jsx(qt,{children:t("mapping.entityId")}),h.jsx(qt,{children:t("mapping.match")}),h.jsx(qt,{children:t("mapping.deviceType")}),h.jsx(qt,{children:t("mapping.existing")})]})}),h.jsx(ef,{children:y.matches.map(te=>h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox",children:h.jsx(xs,{size:"small",checked:C.has(te.matchedEntityId),onChange:()=>ie(te.matchedEntityId)})}),h.jsx(qt,{children:h.jsx(re,{variant:"body2",fontFamily:"monospace",children:te.matchedEntityId})}),h.jsx(qt,{children:h.jsx(ft,{label:te.matchType,size:"small",color:te.matchType==="exact"?"success":"default",variant:"outlined"})}),h.jsx(qt,{children:te.entry.matterDeviceType||"Auto"}),h.jsx(qt,{children:te.existingMapping?h.jsx(ft,{label:t("common.overwrite"),size:"small",color:"warning",variant:"outlined"}):h.jsx(ft,{label:t("common.new"),size:"small",color:"info",variant:"outlined"})})]},te.matchedEntityId))})]})}),y.unmatchedEntries.length>0&&h.jsxs(zt,{severity:"info",children:[y.unmatchedEntries.length," entries could not be matched to entities on this bridge."]})]})}),h.jsxs(es,{children:[h.jsx(qe,{onClick:ee,children:t("common.cancel")}),h.jsx(qe,{variant:"contained",onClick:oe,disabled:k||C.size===0,children:k?t("mapping.applying"):t("mapping.applyCount",{count:C.size})})]})]})]})}const pAe=e=>e.bridges,vM=Uw([pAe],e=>e.items),mAe=e=>Uw([vM],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(r=>r.id===e)})),gAe=Uw([vM],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 lg(vM)}function tee(){return lg(gAe)}function nee(e){const t=A.useMemo(()=>mAe(e),[e]);return lg(t)}function yAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(EZ(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function bAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(AZ(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function vAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(DZ(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function xAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(kZ(t));if(n.meta.requestStatus==="rejected")throw n.error},[e])}function SAe(){const e=Ms();return A.useCallback(async t=>{await b4e(t),await e(No())},[e])}function wAe(){const e=Ms();return A.useCallback(async t=>{const n=await xZ(t);return await e(No()),n},[e])}const CAe=e=>e.devices,EAe=e=>Uw([CAe],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function kAe(e){const t=A.useMemo(()=>EAe(e),[e]);return lg(t)}function AAe(e,t){const[n,r]=A.useState(e);return A.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 DAe(e){const t=await fetch(`api/matter/bridges/${e}/devices`);return await Mn(t,"Failed to fetch devices"),sr(t)}const Mu=ag("devices/load",DAe),_Ae=Ee(h.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"})),OAe=Ee(h.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"}));function TAe(e){return et("MuiDialogContentText",e)}it("MuiDialogContentText",["root"]);const MAe=e=>{const{classes:t}=e,r=tt({root:["root"]},TAe,t);return{...t,...r}},RAe=ge(re,{shouldForwardProp:e=>Li(e)||e==="classes",name:"MuiDialogContentText",slot:"Root"})({}),IAe=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiDialogContentText"}),{children:i,className:o,...s}=r,a=MAe(s);return h.jsx(RAe,{component:"p",variant:"body1",color:"textSecondary",ref:n,ownerState:s,className:Oe(a.root,o),...r,classes:a})});function $S({open:e,title:t,message:n,confirmLabel:r="Confirm",cancelLabel:i="Cancel",confirmColor:o="error",onConfirm:s,onCancel:a}){return h.jsxs(Po,{open:e,onClose:a,maxWidth:"xs",fullWidth:!0,children:[h.jsx(Lo,{children:t}),h.jsx($o,{children:h.jsx(IAe,{children:n})}),h.jsxs(es,{children:[h.jsx(qe,{onClick:a,autoFocus:!0,children:i}),h.jsx(qe,{onClick:s,color:o,variant:"contained",children:r})]})]})}const jAe=({bridge:e})=>{const[t,n]=A.useState(null),r=!!t,i=jc(),o=$c(),{t:s}=on(),a=vAe(),l=xAe(),c=wAe(),[u,d]=A.useState(null),p=S=>n(S.currentTarget),g=()=>n(null),y=async()=>{g(),await c(e).then(S=>o.show({message:`Synced ${S.syncedCount} devices to controllers`,severity:"success"})).catch(S=>o.show({message:`Failed to sync: ${S?.message??JSON.stringify(S)}`,severity:"error"}))},b=async()=>{d(null),await a(e).then(()=>o.show({message:s("bridge.resetSuccess"),severity:"success"})).catch(S=>o.show({message:`Failed to reset bridge: ${S?.message??JSON.stringify(S)}`,severity:"error"}))},v=async()=>{d(null),await l(e).then(()=>o.show({message:s("bridge.deleteSuccess"),severity:"success"})).then(()=>i(Tt.bridges)).catch(S=>o.show({message:`Failed to delete bridge: ${S?.message??JSON.stringify(S)}`,severity:"error"}))};return h.jsxs(h.Fragment,{children:[h.jsx(Wt,{onClick:p,children:h.jsx(_Ae,{})}),h.jsxs(EQ,{open:r,onClose:g,anchorEl:t,children:[h.jsxs(Nn,{component:Dc,to:Tt.editBridge(e),children:[h.jsx(jo,{children:h.jsx(qw,{fontSize:"small"})}),h.jsx(so,{children:s("common.edit")})]}),h.jsx(Dr,{}),h.jsxs(Nn,{onClick:y,children:[h.jsx(jo,{children:h.jsx(Kw,{fontSize:"small"})}),h.jsx(so,{children:s("bridge.forceSync")})]}),h.jsxs(Nn,{onClick:()=>{g(),d("reset")},children:[h.jsx(jo,{children:h.jsx(OAe,{fontSize:"small"})}),h.jsx(so,{children:s("bridge.factoryReset")})]}),h.jsxs(Nn,{onClick:()=>{g(),d("delete")},children:[h.jsx(jo,{children:h.jsx(Pa,{fontSize:"small"})}),h.jsx(so,{children:s("common.delete")})]})]}),h.jsx($S,{open:u==="reset",title:s("bridge.confirmResetTitle"),message:s("bridge.confirmResetMessage"),confirmLabel:s("common.reset"),confirmColor:"warning",onConfirm:b,onCancel:()=>d(null)}),h.jsx($S,{open:u==="delete",title:s("bridge.confirmDeleteTitle"),message:s("bridge.confirmDeleteMessage"),confirmLabel:s("common.delete"),confirmColor:"error",onConfirm:v,onCancel:()=>d(null)})]})},PAe=A.memo(b8e),$Ae=({failedEntities:e})=>{const{t}=on(),[n,r]=A.useState(!1);return!e||e.length===0?null:h.jsxs(zt,{severity:"warning",sx:{cursor:"pointer"},onClick:()=>r(!n),children:[h.jsxs(re,{variant:"body2",children:[h.jsx("strong",{children:t("bridge.failedEntitiesCount",{count:e.length})})," ",t(n?"bridge.clickToHide":"bridge.clickToShow")]}),h.jsx(ia,{in:n,children:h.jsx(Fo,{dense:!0,sx:{mt:1},children:e.map(i=>h.jsxs(Cs,{sx:{py:0},children:[h.jsx(jo,{sx:{minWidth:32},children:h.jsx(ug,{color:"warning",fontSize:"small"})}),h.jsx(so,{primary:i.entityId,secondary:i.reason,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},i.entityId))})})]})},LAe=()=>{const{t:e}=on(),t=$c(),n=Ms(),{bridgeId:r}=LX(),[i,o]=A.useState(0),s=A.useCallback(()=>{o(y=>y+1)},[]),a=A.useCallback(()=>{n(Mu(r))},[n,r]),l=AAe(10,a),{content:c,isLoading:u,error:d}=nee(r),{content:p,error:g}=kAe(r);return A.useEffect(()=>{d&&t.show({message:d.message??e("bridge.loadFailed"),severity:"error"})},[d,t,e]),A.useEffect(()=>{g?.message&&t.show({message:g.message,severity:"error"})},[g,t]),!c&&u?e("common.loading"):c?h.jsxs(Vt,{spacing:4,children:[h.jsx(qb,{items:[{name:e("nav.bridges"),to:Tt.bridges},{name:c.name,to:Tt.bridge(r)}]}),h.jsxs(ae,{display:"flex",justifyContent:"space-between",children:[h.jsxs(re,{variant:"h4",children:[c.name," ",h.jsx(gQ,{status:c.status})]}),h.jsx(jAe,{bridge:r})]}),h.jsx(A8e,{status:c.status,reason:c.statusReason}),c.status==="running"&&c.commissioning&&!c.commissioning.isCommissioned&&c.commissioning.fabrics.length===0&&h.jsxs(zt,{severity:"info",icon:h.jsx(UT,{}),children:[h.jsx(C2,{children:e("bridge.pairHint")}),h.jsx(re,{variant:"body2",sx:{mb:1},children:e("bridge.pairDescription")})]}),c.failedEntities&&c.failedEntities.length>0&&h.jsx($Ae,{failedEntities:c.failedEntities}),h.jsx(NAe,{bridge:c,devices:p}),h.jsx(PAe,{bridge:c}),p&&h.jsx(M8e,{devices:p}),h.jsx(hAe,{bridgeId:r},i),p&&h.jsxs(Vt,{spacing:2,children:[h.jsx(ae,{display:"flex",justifyContent:"flex-end",alignItems:"center",children:l!=null&&h.jsx(Nt,{title:e("bridge.refreshHint"),children:h.jsx(re,{variant:"body2",color:"textSecondary",children:e("bridge.refreshingStates",{seconds:l-1})})})}),h.jsx(cAe,{endpoint:p,bridgeId:r,onMappingSaved:s})]})]}):e("common.notFound")};function ree(e){return e.type.name==="RoboticVacuumCleaner"?!0:e.parts.some(ree)}function iee(e){if(e.type.name==="Aggregator")return e.parts.length;let t=0;for(const n of e.parts)t+=iee(n);return t}const NAe=({bridge:e,devices:t})=>{const{t:n}=on(),r=$c(),[i,o]=A.useState(!1),s=A.useMemo(()=>{if(!t||e.featureFlags?.serverMode||!ree(t))return!1;const c=e.commissioning?.fabrics??[];if(c.length===0)return!0;const u=new Set([4937,4631,4448]);return c.some(d=>u.has(d.rootVendorId))},[t,e.featureFlags?.serverMode,e.commissioning?.fabrics]),a=A.useMemo(()=>t?iee(t)===1:!1,[t]),l=async()=>{o(!0);try{await vZ({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),r.show({message:n("bridge.serverModeEnabled"),severity:"success"})}catch(c){r.show({message:n("bridge.serverModeEnableFailed",{error:c instanceof Error?c.message:String(c)}),severity:"error"})}finally{o(!1)}};return s?h.jsxs(zt,{severity:"warning",icon:h.jsx(cg,{}),action:a?h.jsx(qe,{color:"warning",size:"small",variant:"outlined",onClick:l,disabled:i,startIcon:i?h.jsx(Jn,{size:16}):void 0,sx:{whiteSpace:"nowrap"},children:n(i?"bridge.enabling":"bridge.enableServerMode")}):void 0,children:[h.jsx(C2,{children:n("bridge.serverModeRecommended")}),h.jsx(re,{variant:"body2",children:n("bridge.serverModeDescription")}),!a&&h.jsx(re,{variant:"body2",sx:{mt:1},children:n("bridge.serverModeSingleDeviceNote")})]}):null},xM=Ee(h.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z"})),aC=Ee(h.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),FAe=Ee(h.jsx("path",{d:"m7 10 5 5 5-5z"})),BAe=Ee(h.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),zAe=Ee(h.jsx("path",{d:"m10 17 5-5-5-5z"})),lC=Ee(h.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),YD=Ee(h.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"})),Qz=Ee(h.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"})),hm=Ee(h.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"})),HAe=Ee(h.jsxs(A.Fragment,{children:[h.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"}),h.jsx("path",{d:"M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"})]})),UAe=Ee(h.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"})),cC=Ee(h.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"})),VAe=Ee([h.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"),h.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")]),WAe=Ee(h.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"})),eH=Ee([h.jsx("path",{d:"m12 2-5.5 9h11z"},"0"),h.jsx("circle",{cx:"17.5",cy:"17.5",r:"4.5"},"1"),h.jsx("path",{d:"M3 13.5h8v8H3z"},"2")]),qAe=Ee(h.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),SM=Ee(h.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"})),GAe=Ee(h.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"})),KAe=Ee(h.jsx("path",{d:"M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z"})),LS=Ee(h.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"})),YAe=Ee(h.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"})),XAe=Ee(h.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"})),JAe=Ee(h.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"})),tH=Ee(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"})),ZAe=Ee(h.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"})),QAe=Ee(h.jsx("path",{d:"M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z"})),eDe=Ee(h.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"})),tDe=Ee([h.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"),h.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")]),F1=Ee(h.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"})),Ly=Ee(h.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"})),nDe=Ee(h.jsx("circle",{cx:"12",cy:"12",r:"8"})),rDe=Ee(h.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z"})),iDe=Ee(h.jsx("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"})),oDe=Ee(h.jsx("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"})),wM=Ee([h.jsx("circle",{cx:"15",cy:"13",r:"1"},"0"),h.jsx("circle",{cx:"9",cy:"13",r:"1"},"1"),h.jsx("path",{d:"m8.33 7.5-.66 2h8.66l-.66-2z"},"2"),h.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")]),CM=Ee(h.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})),sDe=Ee(h.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"})),Ny=Ee(h.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"})),EM=Ee(h.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"})),aDe=Ee(h.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"})),lDe=Ee(h.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"})),cDe=Ee(h.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"})),C4=Ee(h.jsx("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z"})),XD=Ee(h.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"})),uDe=Ee(h.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"})),dDe=Ee(h.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"})),fDe=Ee(h.jsx("path",{d:"m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68zm-10 5h-2v-2h2zm0-4h-2V7h2z"})),oee=Ee(h.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),see=Ee(h.jsx("path",{d:"M8 5v14l11-7z"})),hDe=Ee(h.jsx("path",{d:"M16.01 7 16 3h-2v4h-4V3H8v4h-.01C7 6.99 6 7.99 6 8.99v5.49L9.5 18v3h5v-3l3.5-3.51v-5.5c0-1-1-2-1.99-1.99"})),pDe=Ee(h.jsx("path",{d:"M18 14.49V9c0-1-1.01-2.01-2-2V3h-2v4h-4V3H8v2.48l9.51 9.5zm-1.76 1.77L7.2 7.2l-.01.01L3.98 4 2.71 5.25l3.36 3.36C6.04 8.74 6 8.87 6 9v5.48L9.5 18v3h5v-3l.48-.48L19.45 22l1.26-1.28z"})),kM=Ee(h.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"})),mDe=Ee(h.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"})),Zb=Ee(h.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"})),R0=Ee(h.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"})),Oh=Ee(h.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"})),NS=Ee(h.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"})),AM=Ee(h.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"})),gDe=Ee([h.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z"},"0"),h.jsx("path",{d:"M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z"},"1")]),aee=Ee(h.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"})),D2=Ee(h.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"})),DM=Ee(h.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"})),lee=Ee(h.jsx("path",{d:"M6 6h12v12H6z"})),yDe=Ee(h.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"})),bDe=Ee(h.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),vDe=Ee(h.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"})),xDe=Ee(h.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"})),_M=Ee(h.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"})),SDe=Ee(h.jsx("path",{d:"m12.87 15.07-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2zm-2.62 7 1.62-4.33L19.12 17z"})),wDe=Ee(h.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),OM=Ee(h.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"})),CDe=Ee(h.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"})),cee=Ee(h.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"})),EDe=Ee(h.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"})),kDe=Ee(h.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),ADe=Ee(h.jsx("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"})),DDe=Ee(h.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 _De(){const e=await fetch("api/bridges/export");await Mn(e,"Failed to export bridges");const t=await e.blob(),r=e.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split("T")[0]}.json`;MDe(t,r)}async function ODe(e){const t=await fetch("api/bridges/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Mn(t,"Failed to preview import"),sr(t)}async function TDe(e,t){const n=await fetch("api/bridges/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,options:t})});return await Mn(n,"Failed to import bridges"),sr(n)}function MDe(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 RDe({open:e,file:t,onClose:n,onImported:r}){const{t:i}=on(),[o,s]=A.useState(null),[a,l]=A.useState(new Set),[c,u]=A.useState(!1),[d,p]=A.useState(null),[g,y]=A.useState(null),[b,v]=A.useState(!1),[S,C]=A.useState(null);A.useEffect(()=>{if(!e||!t){s(null),l(new Set),p(null),y(null),C(null);return}const _=new FileReader;_.onload=async T=>{try{const I=JSON.parse(T.target?.result);p(I);const P=await ODe(I);s(P),l(new Set(P.bridges.map(L=>L.id)))}catch{y(i("bridge.importParseFailed"))}},_.readAsText(t)},[e,t,i]);const w=A.useCallback(_=>{l(T=>{const I=new Set(T);return I.has(_)?I.delete(_):I.add(_),I})},[]),k=A.useCallback(()=>{o&&l(new Set(o.bridges.map(_=>_.id)))},[o]),E=A.useCallback(()=>{l(new Set)},[]),O=A.useCallback(async()=>{if(d){v(!0);try{const _=await TDe(d,{bridgeIds:Array.from(a),overwriteExisting:c}),T=[];_.imported>0&&T.push(`${_.imported} bridge(s) imported`),_.skipped>0&&T.push(`${_.skipped} skipped (already exist)`),_.errors.length>0&&T.push(`${_.errors.length} failed`),C(T.join(", ")),r()}catch(_){y(_ instanceof Error?_.message:"Import failed")}finally{v(!1)}}},[d,a,c,r]);return h.jsxs(Po,{open:e,onClose:n,maxWidth:"sm",fullWidth:!0,children:[h.jsx(Lo,{children:i("bridge.importTitle")}),h.jsxs($o,{children:[g&&h.jsx(zt,{severity:"error",sx:{mb:2},children:g}),S&&h.jsx(zt,{severity:"success",sx:{mb:2},children:S}),o&&!S&&h.jsxs(h.Fragment,{children:[o.migrated&&h.jsxs(zt,{severity:"info",sx:{mb:2},children:["This export is from an older version (",o.sourceVersion,"). Bridges will be migrated to the current format during import."]}),h.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Exported on ",new Date(o.exportedAt).toLocaleString(),o.sourceVersion&&!o.migrated&&h.jsxs(h.Fragment,{children:[" • Format: ",o.sourceVersion]})]}),h.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16},children:[h.jsx(qe,{size:"small",onClick:k,children:i("common.selectAll")}),h.jsx(qe,{size:"small",onClick:E,children:i("common.selectNone")})]}),h.jsx(Fo,{dense:!0,children:o.bridges.map(_=>h.jsxs(Cs,{disablePadding:!0,children:[h.jsx(jo,{children:h.jsx(xs,{edge:"start",checked:a.has(_.id),onChange:()=>w(_.id)})}),h.jsx(so,{primary:_.name,secondary:h.jsxs(h.Fragment,{children:["Port ",_.port," • ",_.entityCount," filter rules",_.exists&&h.jsxs("span",{style:{color:"orange"},children:[" ","• Already exists"]})]})})]},_.id))}),h.jsx(Io,{control:h.jsx(Ou,{checked:c,onChange:_=>u(_.target.checked)}),label:i("bridge.overwriteExisting")})]})]}),h.jsxs(es,{children:[h.jsx(qe,{onClick:n,children:i(S?"common.close":"common.cancel")}),!S&&h.jsx(qe,{onClick:O,variant:"contained",disabled:b||a.size===0,children:b?i("bridge.importing"):i("bridge.importCount",{count:a.size})})]})]})}const uC="api/bridge-icons";async function IDe(e,t){const n=new FormData;n.append("icon",t);const r=await fetch(`${uC}/${e}`,{method:"POST",body:n});return await Mn(r,"Failed to upload icon"),sr(r)}async function jDe(e){const t=await fetch(`${uC}/${e}`,{method:"DELETE"});await Mn(t,"Failed to delete icon")}async function dC(e){return(await fetch(`${uC}/${e}`,{method:"HEAD"})).ok}function _2(e){return`${uC}/${e}`}const nH={light:iC,switch:kM,climate:sC,cover:rC,fan:_M,lock:Tu,sensor:D2,media_player:OM,vacuum:SM,remote:DM,humidifier:bM,speaker:oC,garage:wM,door:QAe,window:DDe,motion:ZAe,battery:HAe,power:UAe,camera:VAe,default:yM},rH={light:iC,switch:kM,climate:sC,cover:rC,fan:_M,lock:Tu,sensor:D2,binary_sensor:D2,media_player:OM,vacuum:SM,remote:DM,humidifier:bM,input_boolean:tDe,input_button:F1,button:F1,scene:F1,script:F1,automation:F1,speaker:oC,air_quality:JQ,garage:wM},iH={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"},uee=e=>e.filter.include.find(n=>n.type===Or.Domain)?.value??null,PDe=e=>{const t=e.toLowerCase();if(t.includes("lamp")||t.includes("light")||t.includes("ljus"))return iC;if(t.includes("vacuum")||t.includes("dammsug"))return SM;if(t.includes("thermo")||t.includes("climate")||t.includes("värme"))return sC;if(t.includes("sensor"))return D2;if(t.includes("cover")||t.includes("blind")||t.includes("rullgardin")||t.includes("jalousie"))return rC;if(t.includes("remote")||t.includes("fjärr"))return DM;if(t.includes("lock")||t.includes("lås"))return Tu;if(t.includes("fan")||t.includes("fläkt"))return _M;if(t.includes("tv")||t.includes("media"))return OM;if(t.includes("speaker")||t.includes("högtalare"))return oC;if(t.includes("switch")||t.includes("brytare"))return kM;if(t.includes("garage"))return wM},TM=e=>{if(e.icon&&nH[e.icon])return nH[e.icon];const t=uee(e);if(t&&rH[t])return rH[t];const n=PDe(e.name);return n||(e.deviceCount===0?aa:yM)},MM=e=>{const t=uee(e);return t&&iH[t]?iH[t]:e.deviceCount===0?"text.disabled":"primary.main"},$De=({bridge:e})=>{const t=e.commissioning?.fabrics.length??0,n=TM(e),r=MM(e),[i,o]=A.useState(!1);return A.useEffect(()=>{dC(e.id).then(o)},[e.id]),h.jsx(On,{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:h.jsx(Nu,{component:Dc,to:Tt.bridge(e.id),sx:{height:"100%"},children:h.jsx(Yn,{children:h.jsxs(ae,{display:"flex",alignItems:"flex-start",gap:2,children:[i?h.jsx(ae,{component:"img",src:_2(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(wl,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:h.jsx(n,{sx:{fontSize:32}})}),h.jsxs(ae,{flexGrow:1,minWidth:0,children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:1,children:[h.jsx(re,{variant:"h6",component:"div",noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),h.jsx(gQ,{status:e.status})]}),h.jsxs(Vt,{spacing:1,mb:2,children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(aa,{sx:{fontSize:16,color:"text.secondary"}}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:[e.deviceCount," devices"]})]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(GZ,{sx:{fontSize:16,color:"text.secondary"}}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:[t," fabric",t!==1?"s":""]})]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(D2,{sx:{fontSize:16,color:"text.secondary"}}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:["Port ",e.port]})]})]})]})]})})})})},LDe=({bridges:e})=>{const t=A.useMemo(()=>[...e].sort((n,r)=>n.name.localeCompare(r.name,void 0,{sensitivity:"base"})),[e]);return h.jsx(dt,{container:!0,spacing:2,children:t.map(n=>h.jsx(dt,{size:{xs:12,sm:6,lg:4},children:h.jsx($De,{bridge:n})},n.id))})},fC=A.createContext({}),RM=A.createContext({});function NDe(e){return et("MuiStep",e)}it("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);const FDe=e=>{const{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return tt({root:["root",n,r&&"alternativeLabel",i&&"completed"]},NDe,t)},BDe=ge("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"}}]}),zDe=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStep"}),{active:i,children:o,className:s,component:a="div",completed:l,disabled:c,expanded:u=!1,index:d,last:p,...g}=r,{activeStep:y,connector:b,alternativeLabel:v,orientation:S,nonLinear:C}=A.useContext(fC);let[w=!1,k=!1,E=!1]=[i,l,c];y===d?w=i!==void 0?i:!0:!C&&y>d?k=l!==void 0?l:!0:!C&&y<d&&(E=c!==void 0?c:!0);const O=A.useMemo(()=>({index:d,last:p,expanded:u,icon:d+1,active:w,completed:k,disabled:E}),[d,p,u,w,k,E]),_={...r,active:w,orientation:S,alternativeLabel:v,completed:k,disabled:E,expanded:u,component:a},T=FDe(_),I=h.jsxs(BDe,{as:a,className:Oe(T.root,s),ref:n,ownerState:_,...g,children:[b&&v&&d!==0?b:null,o]});return h.jsx(RM.Provider,{value:O,children:b&&!v&&d!==0?h.jsxs(A.Fragment,{children:[b,I]}):I})}),HDe=Ee(h.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"})),UDe=Ee(h.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function VDe(e){return et("MuiStepIcon",e)}const j7=it("MuiStepIcon",["root","active","completed","error","text"]);var oH;const WDe=e=>{const{classes:t,active:n,completed:r,error:i}=e;return tt({root:["root",n&&"active",r&&"completed",i&&"error"],text:["text"]},VDe,t)},P7=ge(mS,{name:"MuiStepIcon",slot:"Root"})(Ke(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${j7.completed}`]:{color:(e.vars||e).palette.primary.main},[`&.${j7.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${j7.error}`]:{color:(e.vars||e).palette.error.main}}))),qDe=ge("text",{name:"MuiStepIcon",slot:"Text"})(Ke(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),GDe=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepIcon"}),{active:i=!1,className:o,completed:s=!1,error:a=!1,icon:l,...c}=r,u={...r,active:i,completed:s,error:a},d=WDe(u);if(typeof l=="number"||typeof l=="string"){const p=Oe(o,d.root);return a?h.jsx(P7,{as:UDe,className:p,ref:n,ownerState:u,...c}):s?h.jsx(P7,{as:HDe,className:p,ref:n,ownerState:u,...c}):h.jsxs(P7,{className:p,ref:n,ownerState:u,...c,children:[oH||(oH=h.jsx("circle",{cx:"12",cy:"12",r:"12"})),h.jsx(qDe,{className:d.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:u,children:l})]})}return l});function KDe(e){return et("MuiStepLabel",e)}const qd=it("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),YDe=e=>{const{classes:t,orientation:n,active:r,completed:i,error:o,disabled:s,alternativeLabel:a}=e;return tt({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"]},KDe,t)},XDe=ge("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:"flex",alignItems:"center",[`&.${qd.alternativeLabel}`]:{flexDirection:"column"},[`&.${qd.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),JDe=ge("span",{name:"MuiStepLabel",slot:"Label"})(Ke(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${qd.active}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${qd.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${qd.alternativeLabel}`]:{marginTop:16},[`&.${qd.error}`]:{color:(e.vars||e).palette.error.main}}))),ZDe=ge("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${qd.alternativeLabel}`]:{paddingRight:0}}),QDe=ge("span",{name:"MuiStepLabel",slot:"LabelContainer"})(Ke(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${qd.alternativeLabel}`]:{textAlign:"center"}}))),dee=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepLabel"}),{children:i,className:o,componentsProps:s={},error:a=!1,icon:l,optional:c,slots:u={},slotProps:d={},StepIconComponent:p,StepIconProps:g,...y}=r,{alternativeLabel:b,orientation:v}=A.useContext(fC),{active:S,disabled:C,completed:w,icon:k}=A.useContext(RM),E=l||k;let O=p;E&&!O&&(O=GDe);const _={...r,active:S,alternativeLabel:b,completed:w,disabled:C,error:a,orientation:v},T=YDe(_),I={slots:u,slotProps:{stepIcon:g,...s,...d}},[P,L]=ut("root",{elementType:XDe,externalForwardedProps:{...I,...y},ownerState:_,ref:n,className:Oe(T.root,o)}),[M,$]=ut("label",{elementType:JDe,externalForwardedProps:I,ownerState:_}),[N,z]=ut("stepIcon",{elementType:O,externalForwardedProps:I,ownerState:_});return h.jsxs(P,{...L,children:[E||N?h.jsx(ZDe,{className:T.iconContainer,ownerState:_,children:h.jsx(N,{completed:w,active:S,error:a,icon:E,...z})}):null,h.jsxs(QDe,{className:T.labelContainer,ownerState:_,children:[i?h.jsx(M,{...$,className:Oe(T.label,$?.className),children:i}):null,c]})]})});dee.muiName="StepLabel";function e_e(e){return et("MuiStepper",e)}it("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);function t_e(e){return et("MuiStepConnector",e)}it("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);const n_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${ve(n)}`]};return tt(a,t_e,t)},r_e=ge("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)"}}]}),i_e=ge("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.line,t[`line${ve(n.orientation)}`]]}})(Ke(({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}}]}})),o_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepConnector"}),{className:i,...o}=r,{alternativeLabel:s,orientation:a="horizontal"}=A.useContext(fC),{active:l,disabled:c,completed:u}=A.useContext(RM),d={...r,alternativeLabel:s,orientation:a,active:l,completed:u,disabled:c},p=n_e(d);return h.jsx(r_e,{className:Oe(p.root,i),ref:n,ownerState:d,...o,children:h.jsx(i_e,{className:p.line,ownerState:d})})}),s_e=e=>{const{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return tt({root:["root",t,n&&"nonLinear",r&&"alternativeLabel"]},e_e,i)},a_e=ge("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"}}]}),l_e=h.jsx(o_e,{}),c_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepper"}),{activeStep:i=0,alternativeLabel:o=!1,children:s,className:a,component:l="div",connector:c=l_e,nonLinear:u=!1,orientation:d="horizontal",...p}=r,g={...r,nonLinear:u,alternativeLabel:o,orientation:d,component:l},y=s_e(g),b=A.Children.toArray(s).filter(Boolean),v=b.map((C,w)=>A.cloneElement(C,{index:w,last:w+1===b.length,...C.props})),S=A.useMemo(()=>({activeStep:i,alternativeLabel:o,connector:c,nonLinear:u,orientation:d}),[i,o,c,u,d]);return h.jsx(fC.Provider,{value:S,children:h.jsx(a_e,{as:l,ownerState:g,className:Oe(y.root,a),ref:n,...p,children:v})})}),sH={light:"💡",switch:"🔌",sensor:"📊",climate:"🌡️",lock:"🔒",vacuum:"🤖",media_player:"🎵",cover:"🪟",remote:"⚡",default:"🏠"};function fee({selectedTemplate:e,onSelect:t}){return h.jsxs(ae,{children:[h.jsx(re,{variant:"subtitle1",gutterBottom:!0,fontWeight:600,children:"Start from a Template (optional)"}),h.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."}),h.jsx(dt,{container:!0,spacing:1.5,alignItems:"flex-start",children:RZ.map(n=>{const r=e===n.id;return h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(On,{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:h.jsx(Nu,{onClick:()=>t(r?null:n),sx:{p:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"},children:h.jsxs(Yn,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[h.jsx(re,{fontSize:20,children:sH[n.icon]??sH.default}),h.jsx(re,{variant:"subtitle2",sx:{flexGrow:1},children:n.name}),r&&h.jsx(Ja,{color:"primary",sx:{fontSize:18}})]}),h.jsx(re,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:r?"none":2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.description}),n.featureFlags?.serverMode&&h.jsx(ft,{label:"Server Mode",size:"small",color:"warning",variant:"outlined",sx:{mt:.5,height:20,fontSize:"0.65rem"}}),n.featureFlags?.autoForceSync&&h.jsx(ft,{label:"Auto Force Sync",size:"small",color:"info",variant:"outlined",sx:{mt:.5,ml:.5,height:20,fontSize:"0.65rem"}})]})})})},n.id)})})]})}const u_e={apple_home:"🍏",google_home:"🏠",alexa:"🔵",multi_controller:"🔀"},$7=["bridgeWizard.stepTemplate","bridgeWizard.stepController","bridgeWizard.stepBridgeInfo","bridgeWizard.stepEntityFilter","bridgeWizard.stepFeatureFlags","bridgeWizard.stepReview"],d_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 hee({open:e,onClose:t,onComplete:n}){const{t:r}=on(),[i,o]=A.useState(0),[s,a]=A.useState(!1),[l,c]=A.useState(5540),[u,d]=A.useState([]),[p,g]=A.useState(),[y,b]=A.useState({name:"",port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[v,S]=A.useState(!0),[C,w]=A.useState("*"),[k,E]=A.useState(""),[O,_]=A.useState(null),[T,I]=A.useState(),P=A.useCallback(async()=>{try{const H=await fetch("api/matter/next-port");if(H.ok){const G=await H.json();c(G.port),b(Z=>({...Z,port:G.port}))}}catch{}},[]);A.useEffect(()=>{e&&(P(),o(0),d([]),g(void 0),b({name:"",port:l,serverMode:!1,filter:{include:[],exclude:[]}}),S(!0),w("*"),E(""),_(null),I(void 0))},[e,P,l]);const L=A.useCallback(H=>{if(g(H??void 0),H){b(oe=>({...oe,name:H.name,serverMode:H.featureFlags?.serverMode??!1,icon:H.icon,featureFlags:H.featureFlags,filter:{...H.filter}}));const G=H.filter.include;if(G.length>0)if(S(!1),H.featureFlags?.serverMode){const oe=G.map(ee=>ee.type===Or.Domain?`${ee.value}.*`:ee.value);w(oe.join(", "))}else w(G.map(oe=>oe.value).join(", "));const Z=H.filter.exclude;E(Z.map(oe=>oe.value).join(", "))}else b(G=>({...G,name:"",serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),S(!0),w("*"),E("")},[]),M=A.useCallback(H=>{I(H??void 0),H&&b(G=>({...G,featureFlags:{...G.featureFlags,...H.featureFlags}}))},[]),$=()=>{if(i===0&&_(null),i===1&&_(null),i===2){if(!y.name.trim()){_(r("bridgeWizard.nameRequired"));return}_(null)}if(i===3){let H,G;if(p&&!y.serverMode)H=[...p.filter.include],G=[...p.filter.exclude];else{const Z=v?[C||"*"]:C.split(",").map(ee=>ee.trim()).filter(Boolean),oe=k.split(",").map(ee=>ee.trim()).filter(Boolean);H=Z.map(ee=>({type:Or.Pattern,value:ee})),G=oe.map(ee=>({type:Or.Pattern,value:ee}))}b(Z=>({...Z,filter:{include:H,exclude:G}}))}o(H=>H+1)},N=()=>{o(H=>H-1),_(null)},z=async()=>{await F();const H=l+u.length+1;d(G=>[...G,y]),g(void 0),I(void 0),b({name:"",port:H,serverMode:!1,filter:{include:[],exclude:[]}}),o(0),S(!0),w("*"),E("")},F=async()=>{a(!0),_(null);try{const H={...y.featureFlags,...y.serverMode?{serverMode:!0}:{}},G=Object.keys(H).length>0,Z={name:y.name,port:y.port,filter:y.filter,featureFlags:G?H:void 0,icon:y.icon};return await FT(Z),!0}catch(H){return _(H instanceof Error?H.message:r("bridgeWizard.createFailed")),!1}finally{a(!1)}},W=async()=>{await F()&&(n(),t())},V=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:r("bridgeWizard.templateDescription")}),h.jsx(ae,{sx:{mt:2},children:h.jsx(fee,{selectedTemplate:p?.id,onSelect:L})})]}),q=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:r("bridgeWizard.controllerDescription")}),h.jsx(dt,{container:!0,spacing:1.5,sx:{mt:1},children:IZ.map(H=>{const G=T?.id===H.id;return h.jsx(dt,{size:{xs:12,sm:6},children:h.jsx(On,{variant:"outlined",sx:{borderColor:G?"primary.main":"divider",borderWidth:G?2:1,bgcolor:G?"action.selected":"background.paper",transition:"all 0.15s ease"},children:h.jsx(Nu,{onClick:()=>M(G?null:H),sx:{p:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"},children:h.jsxs(Yn,{sx:{p:1.5,"&:last-child":{pb:1.5},width:"100%"},children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[h.jsx(re,{fontSize:20,children:u_e[H.id]??"🏠"}),h.jsx(re,{variant:"subtitle2",sx:{flexGrow:1},children:H.name}),G&&h.jsx(Ja,{color:"primary",sx:{fontSize:18}})]}),h.jsx(re,{variant:"caption",color:"text.secondary",children:H.description}),G&&h.jsx(ae,{display:"flex",gap:.5,flexWrap:"wrap",mt:.5,children:Object.entries(H.featureFlags).filter(([,Z])=>Z).map(([Z])=>h.jsx(ft,{label:Z.replace(/^auto/,"").replace(/([A-Z])/g," $1").trim(),size:"small",variant:"outlined",sx:{fontSize:"0.6rem",height:18}},Z))})]})})})},H.id)})}),h.jsx(re,{variant:"caption",color:"text.secondary",sx:{mt:2,display:"block"},children:r("bridgeWizard.controllerHint")})]}),X=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:p?r("bridgeWizard.templateApplied",{name:p.name}):r("bridgeWizard.bridgeInfoDescription")}),h.jsx(Zn,{fullWidth:!0,label:r("bridgeWizard.bridgeName"),value:y.name,onChange:H=>b(G=>({...G,name:H.target.value})),margin:"normal",placeholder:"e.g., Living Room, Kitchen, All Lights",error:!!O,helperText:O}),h.jsx(Zn,{fullWidth:!0,label:r("bridgeWizard.portLabel"),type:"number",value:y.port,onChange:H=>b(G=>({...G,port:parseInt(H.target.value,10)||5540})),margin:"normal",helperText:r("bridgeWizard.portAutoAssign")}),h.jsx(Nt,{title:"Required for Robot Vacuums to work with Apple Home (Siri) and Alexa. Server Mode bridges support only ONE device.",placement:"right",children:h.jsx(Io,{control:h.jsx(xs,{checked:y.serverMode,onChange:H=>b(G=>({...G,serverMode:H.target.checked})),icon:h.jsx(S4,{}),checkedIcon:h.jsx(S4,{color:"primary"})}),label:r("bridgeWizard.serverModeLabel"),sx:{mt:1}})}),y.serverMode&&h.jsxs(zt,{severity:"info",sx:{mt:1},children:[h.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&&h.jsxs(ae,{sx:{mt:2},children:[h.jsxs(re,{variant:"subtitle2",color:"text.secondary",children:[r("bridgeWizard.bridgesToCreate",{count:u.length}),":"]}),h.jsx(ae,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:u.map(H=>h.jsx(ft,{label:`${H.name} (:${H.port})`,size:"small"},H.port))})]})]}),B=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:p?r("bridgeWizard.filterPreConfiguredFrom",{name:p.name}):r("bridgeWizard.entityFilterDescription")}),y.serverMode&&h.jsxs(zt,{severity:"warning",sx:{mt:1,mb:1},children:["Server Mode requires exactly ",h.jsx("strong",{children:"one"})," entity. Change the filter to match only your device (e.g., ",h.jsx("code",{children:"vacuum.my_vacuum"}),")."]}),!p&&h.jsx(Io,{control:h.jsx(Ou,{checked:v,onChange:H=>S(H.target.checked)}),label:r("bridgeWizard.includeAll")}),h.jsx(Zn,{fullWidth:!0,label:y.serverMode?"Entity ID":v&&!p?"Include Pattern":"Entity Filters",value:p&&!y.serverMode?p.filter.include.map(H=>`${H.type}:${H.value}`).join(", "):C,onChange:H=>w(H.target.value),margin:"normal",placeholder:v?"* or light.*, switch.*":"light.living_room, switch.kitchen",helperText:y.serverMode?"Server Mode supports only ONE device. Enter the exact entity ID (e.g., vacuum.my_vacuum).":p?"Pre-configured by template. Edit in the full editor after creation.":v?"Use * for all, or patterns like light.*, switch.*":"Enter specific entity IDs separated by commas",disabled:!!p&&!y.serverMode}),!p&&h.jsx(Zn,{fullWidth:!0,label:r("bridgeWizard.excludePatterns"),value:k,onChange:H=>E(H.target.value),margin:"normal",placeholder:"sensor.*, binary_sensor.*",helperText:r("bridgeWizard.excludeHelperText")})]}),U=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsxs(re,{variant:"body1",gutterBottom:!0,children:[r("bridgeWizard.featureFlagsDescription"),T?` ${r("bridgeWizard.recommendedFlags",{name:T.name})}`:` ${r("bridgeWizard.selectFlags")}`]}),d_e.map(H=>h.jsxs(ae,{sx:{mt:1},children:[h.jsx(Io,{control:h.jsx(Ou,{checked:y.featureFlags?.[H.key]===!0,onChange:G=>b(Z=>({...Z,featureFlags:{...Z.featureFlags,[H.key]:G.target.checked}}))}),label:H.label}),h.jsx(re,{variant:"caption",color:"text.secondary",display:"block",sx:{ml:7,mt:-.5},children:H.description})]},H.key))]}),Y=()=>{const H=Object.entries(y.featureFlags??{}).filter(([,G])=>G===!0);return h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:r("bridgeWizard.reviewDescription")}),h.jsx(On,{variant:"outlined",sx:{mt:2},children:h.jsxs(Yn,{children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:1,children:[h.jsx(aa,{}),h.jsx(re,{variant:"h6",children:y.name})]}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:[r("bridgeWizard.portLabel"),": ",y.port]}),p&&h.jsx(ft,{label:`Template: ${p.name}`,size:"small",color:"info",variant:"outlined",sx:{mt:1,mr:.5}}),y.serverMode&&h.jsx(ft,{icon:h.jsx(S4,{}),label:"Server Mode",color:"primary",size:"small",sx:{mt:1}}),H.length>0&&h.jsx(ae,{display:"flex",gap:.5,flexWrap:"wrap",mt:1,children:H.filter(([G])=>G!=="serverMode").map(([G])=>h.jsx(ft,{label:G,size:"small",variant:"outlined",sx:{fontSize:"0.7rem",height:22}},G))}),h.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["Include:"," ",y.filter.include.length>0?y.filter.include.map(G=>`${G.type}:${G.value}`).join(", "):C||"*"]}),O&&h.jsx(re,{variant:"body2",color:"error",sx:{mt:1},children:O}),(k||y.filter.exclude.length>0)&&h.jsxs(re,{variant:"body2",color:"text.secondary",children:["Exclude:"," ",y.filter.exclude.length>0?y.filter.exclude.map(G=>G.value).join(", "):k]})]})}),u.length>0&&h.jsx(ae,{sx:{mt:2},children:h.jsx(re,{variant:"subtitle2",children:r("bridgeWizard.bridgesCreated",{count:u.length})})})]})};return h.jsxs(Po,{open:e,onClose:t,maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(fg,{}),h.jsx("span",{children:r("bridgeWizard.title")})]})}),h.jsxs($o,{children:[h.jsx(c_e,{activeStep:i,sx:{mt:1},children:$7.map(H=>h.jsx(zDe,{children:h.jsx(dee,{children:r(H)})},H))}),i===0&&V(),i===1&&q(),i===2&&X(),i===3&&B(),i===4&&U(),i===5&&Y()]}),h.jsxs(es,{sx:{px:3,pb:2},children:[h.jsx(qe,{onClick:t,disabled:s,children:r("common.cancel")}),h.jsx(ae,{sx:{flex:1}}),i>0&&h.jsx(qe,{onClick:N,startIcon:h.jsx(jZ,{}),disabled:s,children:r("common.back")}),i<$7.length-1&&h.jsx(qe,{variant:"contained",onClick:$,endIcon:h.jsx(BAe,{}),disabled:s,children:r(i===0&&!p?"bridgeWizard.skipTemplate":i===1&&!T?"common.skip":"common.next")}),i===$7.length-1&&h.jsxs(h.Fragment,{children:[h.jsx(qe,{variant:"outlined",onClick:z,startIcon:h.jsx(Ds,{}),disabled:s,children:r("bridgeWizard.addAnother")}),h.jsx(qe,{variant:"contained",onClick:W,startIcon:s?h.jsx(Jn,{size:16}):h.jsx(qAe,{}),disabled:s,children:r(s?"bridgeWizard.creating":"bridgeWizard.createBridge")})]})]})]})}const f_e=()=>{const{t:e}=on(),t=$c(),n=Ms(),{content:r,isLoading:i,error:o}=hg(),[s,a]=A.useState(null),[l,c]=A.useState(!1),[u,d]=A.useState(!1),[p,g]=A.useState(!1),y=A.useRef(null),b=A.useCallback(async()=>{try{await _De()}catch(E){t.show({message:E instanceof Error?E.message:e("bridge.exportFailed"),severity:"error"})}},[t,e]),v=A.useCallback(()=>{y.current?.click()},[]),S=A.useCallback(E=>{const O=E.target.files?.[0];O&&(a(O),c(!0)),E.target.value=""},[]),C=A.useCallback(()=>{c(!1),a(null)},[]),w=A.useCallback(()=>{n(No())},[n]),k=A.useCallback(async E=>{g(!0);try{const O={start:e("bridge.actionStarted"),stop:e("bridge.actionStopped"),restart:e("bridge.actionRestarted")},T=await{start:SZ,stop:wZ,restart:CZ}[E]();t.show({message:e("bridge.actionResult",{label:O[E],count:T.count}),severity:"success"}),n(No())}catch(O){t.show({message:O instanceof Error?O.message:e("bridge.actionFailed",{action:E}),severity:"error"})}finally{g(!1)}},[t,n,e]);return A.useEffect(()=>{o&&t.show({message:o.message??e("bridge.couldNotLoad"),severity:"error"})},[o,t,e]),h.jsxs(h.Fragment,{children:[h.jsx(eM,{sx:E=>({zIndex:E.zIndex.drawer+1}),open:i||p,children:(i||p)&&h.jsx(Jn,{color:"inherit"})}),h.jsx(Vt,{spacing:4,children:r&&h.jsxs(h.Fragment,{children:[h.jsxs(ae,{display:"flex",justifyContent:"end",flexWrap:"wrap",gap:1,paddingTop:{xs:1,sm:0},children:[r.length>=1&&h.jsxs(h.Fragment,{children:[h.jsx(qe,{onClick:()=>k("start"),startIcon:h.jsx(see,{}),variant:"outlined",size:"small",color:"success",disabled:p,children:e("common.startAll")}),h.jsx(qe,{onClick:()=>k("stop"),startIcon:h.jsx(lee,{}),variant:"outlined",size:"small",color:"error",disabled:p,children:e("common.stopAll")}),h.jsx(qe,{onClick:()=>k("restart"),startIcon:h.jsx(R0,{}),variant:"outlined",size:"small",color:"warning",disabled:p,children:e("common.restartAll")}),h.jsx(Dr,{orientation:"vertical",flexItem:!0})]}),h.jsx(qe,{onClick:v,startIcon:h.jsx(A2,{}),variant:"outlined",children:e("common.import")}),h.jsx(qe,{onClick:b,startIcon:h.jsx(eee,{}),variant:"outlined",disabled:r.length===0,children:e("common.exportAll")}),h.jsx(qe,{component:Dc,to:Tt.areaSetup,startIcon:h.jsx(C4,{}),variant:"outlined",children:e("areaSetup.title")}),h.jsx(qe,{onClick:()=>d(!0),startIcon:h.jsx(YD,{}),variant:"outlined",children:e("bridgeWizard.title")}),h.jsx(qe,{component:Dc,to:Tt.createBridge,endIcon:h.jsx(Ds,{}),variant:"outlined",children:e("dashboard.createBridge")}),h.jsx("input",{type:"file",ref:y,onChange:S,accept:".json",style:{display:"none"}})]}),h.jsx(LDe,{bridges:r})]})}),h.jsx(RDe,{open:l,file:s,onClose:C,onImported:w}),h.jsx(hee,{open:u,onClose:()=>d(!1),onComplete:()=>n(No())})]})},FS=[{id:"stats",label:"Status Overview",description:"Bridge count, device count, fabric count, and HA connection status."},{id:"bridges",label:"Bridges",description:"Bridge cards with bulk actions (start/stop/restart all)."},{id:"quickNav",label:"Quick Navigation",description:"Shortcut cards to other pages (Devices, Network Map, Health, etc.)."}],pee="hamh-dashboard-widgets",BS={order:FS.map(e=>e.id),hidden:[]};function h_e(){try{const e=localStorage.getItem(pee);if(!e)return BS;const t=JSON.parse(e),n=new Set(FS.map(i=>i.id)),r=t.order.filter(i=>n.has(i));for(const i of FS)r.includes(i.id)||r.push(i.id);return{order:r,hidden:(t.hidden||[]).filter(i=>n.has(i))}}catch{return BS}}function L7(e){localStorage.setItem(pee,JSON.stringify(e))}function p_e(){const[e,t]=A.useState(h_e),n=A.useCallback(a=>!e.hidden.includes(a),[e.hidden]),r=e.order.filter(a=>!e.hidden.includes(a)),i=A.useCallback(a=>{t(l=>{const c=l.hidden.includes(a)?l.hidden.filter(d=>d!==a):[...l.hidden,a],u={...l,hidden:c};return L7(u),u})},[]),o=A.useCallback((a,l)=>{t(c=>{const u=[...c.order],d=u.indexOf(a);if(d<0)return c;const p=l==="up"?d-1:d+1;if(p<0||p>=u.length)return c;[u[d],u[p]]=[u[p],u[d]];const g={...c,order:u};return L7(g),g})},[]),s=A.useCallback(()=>{L7(BS),t(BS)},[]);return{config:e,visibleWidgets:r,isVisible:n,toggleWidget:i,moveWidget:o,resetToDefaults:s}}function m_e({open:e,config:t,onToggle:n,onMove:r,onReset:i,onClose:o}){const s=new Map(FS.map(a=>[a.id,a]));return h.jsxs(Po,{open:e,onClose:o,maxWidth:"xs",fullWidth:!0,children:[h.jsx(Lo,{children:"Customize Dashboard"}),h.jsx($o,{dividers:!0,children:h.jsx(Fo,{disablePadding:!0,children:t.order.map((a,l)=>{const c=s.get(a);if(!c)return null;const u=t.hidden.includes(a);return h.jsxs(Cs,{sx:{opacity:u?.5:1},secondaryAction:h.jsxs(h.Fragment,{children:[h.jsx(Nt,{title:"Move up",children:h.jsx("span",{children:h.jsx(Wt,{size:"small",disabled:l===0,onClick:()=>r(a,"up"),children:h.jsx(lC,{fontSize:"small"})})})}),h.jsx(Nt,{title:"Move down",children:h.jsx("span",{children:h.jsx(Wt,{size:"small",disabled:l===t.order.length-1,onClick:()=>r(a,"down"),children:h.jsx(aC,{fontSize:"small"})})})})]}),children:[h.jsx(jo,{sx:{minWidth:36},children:h.jsx(Wt,{size:"small",onClick:()=>n(a),children:u?h.jsx(ADe,{fontSize:"small"}):h.jsx(kDe,{fontSize:"small",color:"primary"})})}),h.jsx(so,{primary:c.label,secondary:c.description,secondaryTypographyProps:{variant:"caption"}})]},a)})})}),h.jsxs(es,{children:[h.jsx(qe,{startIcon:h.jsx(Oh,{}),onClick:i,color:"warning",children:"Reset"}),h.jsx(qe,{onClick:o,variant:"contained",children:"Done"})]})]})}const g_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 f3({title:e,value:t,icon:n,color:r,subtitle:i,onClick:o}){const s=h.jsx(Yn,{sx:{py:2,"&:last-child":{pb:2}},children:h.jsxs(ae,{display:"flex",sx:{flexDirection:{xs:"column",sm:"row"},alignItems:"center",gap:{xs:1,sm:2},textAlign:{xs:"center",sm:"left"}},children:[h.jsx(wl,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),h.jsxs(ae,{sx:{minWidth:0},children:[h.jsx(re,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:"1.5rem",sm:"2.125rem"}},children:t}),h.jsx(re,{variant:"body2",color:"text.secondary",noWrap:!0,children:e}),i&&h.jsx(re,{variant:"caption",color:"text.secondary",noWrap:!0,children:i})]})]})});return h.jsx(On,{variant:"outlined",sx:{height:"100%"},children:o?h.jsx(Nu,{onClick:o,sx:{height:"100%"},children:s}):s})}function y_e({bridge:e,order:t,onClick:n}){const{t:r}=on(),{content:i}=hg(),o=i?.find(c=>c.id===e.id),[s,a]=A.useState(!1);A.useEffect(()=>{dC(e.id).then(a)},[e.id]);const l=e.status==="running"?"success":e.status==="failed"?"error":"default";return h.jsx(On,{variant:"outlined",children:h.jsx(Nu,{onClick:n,children:h.jsx(Yn,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:1.5,children:[h.jsx(ft,{label:`#${t}`,size:"small",color:"primary",variant:"outlined",sx:{minWidth:28,height:22,fontSize:"0.65rem",fontWeight:"bold",flexShrink:0}}),s?h.jsx(ae,{component:"img",src:_2(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:"50%",objectFit:"cover"}}):o&&h.jsx(wl,{sx:{bgcolor:MM(o),width:36,height:36},children:(()=>{const c=TM(o);return h.jsx(c,{sx:{fontSize:20}})})()}),h.jsxs(ae,{flex:1,minWidth:0,children:[h.jsx(re,{variant:"subtitle2",noWrap:!0,children:e.name}),h.jsxs(Vt,{direction:"row",spacing:.5,alignItems:"center",children:[h.jsx(ft,{label:e.status,size:"small",color:l,sx:{height:18,fontSize:"0.65rem"}}),h.jsxs(re,{variant:"caption",color:"text.secondary",children:[e.deviceCount," ",r("common.devices").toLowerCase()]}),e.fabricCount>0&&h.jsxs(re,{variant:"caption",color:"text.secondary",children:["· ",e.fabricCount," ",r("common.fabrics").toLowerCase()]})]})]}),e.failedEntityCount>0&&h.jsx(ft,{icon:h.jsx(ug,{sx:{fontSize:14}}),label:e.failedEntityCount,size:"small",color:"warning",variant:"outlined",sx:{height:22}})]})})})})}function uu({title:e,icon:t,onClick:n}){return h.jsx(On,{variant:"outlined",children:h.jsx(Nu,{onClick:n,children:h.jsx(Yn,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:1.5,children:[h.jsx(wl,{sx:{bgcolor:"action.selected",color:"text.secondary",width:36,height:36},children:t}),h.jsx(re,{variant:"subtitle2",children:e})]})})})})}const b_e=()=>{const{t:e}=on(),t=qi(),n=jc(),r=Ms(),[i,o]=A.useState(null),[s,a]=A.useState(!0),[l,c]=A.useState(!1),[u,d]=A.useState(!1),p=A.useRef(!1),[g,y]=A.useState(!1),b=p_e(),[v,S]=A.useState(()=>localStorage.getItem("hamh-first-success-dismissed")==="true"),C=A.useCallback(async()=>{try{const I=await fetch("api/health/detailed");I.ok&&o(await I.json())}catch{}finally{a(!1)}},[]);A.useEffect(()=>{C();const I=setInterval(C,15e3);return()=>clearInterval(I)},[C]);const w=A.useMemo(()=>i?.bridgeDetails.reduce((I,P)=>I+P.deviceCount,0)??0,[i]),k=A.useMemo(()=>i?.bridgeDetails?i.bridgeDetails.reduce((I,P)=>I+P.fabricCount,0):0,[i]),E=A.useMemo(()=>i?.bridgeDetails.reduce((I,P)=>I+P.failedEntityCount,0)??0,[i]);if(s)return h.jsx(ae,{display:"flex",justifyContent:"center",p:8,children:h.jsx(Jn,{})});const O=i?.services.bridges,_=i?.services.homeAssistant.connected??!1,T=(O?.total??0)>0;return h.jsxs(ae,{sx:{p:2},children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:2,mb:3,children:[h.jsx(CM,{color:"primary",fontSize:"large"}),h.jsx(re,{variant:"h5",fontWeight:600,component:"h1",children:e("dashboard.title")}),T&&h.jsx(Wt,{size:"small",onClick:()=>y(!0),sx:{ml:"auto"},title:e("dashboard.customizeDashboard"),children:h.jsx(wDe,{})})]}),T&&k>0&&!v&&h.jsx(zt,{severity:"success",sx:{mb:2},action:h.jsx(Wt,{size:"small",color:"inherit",onClick:()=>{S(!0),localStorage.setItem("hamh-first-success-dismissed","true")},children:h.jsx(LS,{fontSize:"small"})}),children:e("dashboard.successMessage",{count:k})}),!T&&!s&&h.jsx(On,{sx:{mb:3,background:I=>`linear-gradient(135deg, ${I.palette.primary.dark}15, ${I.palette.secondary.dark}15)`,border:"1px solid",borderColor:"divider"},children:h.jsxs(Yn,{sx:{textAlign:"center",py:5,px:3},children:[h.jsx(Ny,{sx:{fontSize:56,color:"primary.main",mb:2}}),h.jsx(re,{variant:"h5",fontWeight:600,gutterBottom:!0,children:e("dashboard.welcome")}),h.jsx(re,{variant:"body1",color:"text.secondary",sx:{maxWidth:520,mx:"auto",mb:4},children:e("dashboard.welcomeDescription")}),h.jsxs(Vt,{direction:{xs:"column",sm:"row"},spacing:2,justifyContent:"center",sx:{mb:3},children:[h.jsx(qe,{variant:"contained",size:"large",startIcon:h.jsx(YD,{}),onClick:()=>c(!0),children:e("dashboard.bridgeWizard")}),h.jsx(qe,{variant:"outlined",size:"large",startIcon:h.jsx(C4,{}),onClick:()=>n(Tt.areaSetup),children:e("dashboard.setupByArea")}),h.jsx(qe,{variant:"outlined",size:"large",startIcon:h.jsx(Ds,{}),onClick:()=>n(Tt.createBridge),children:e("dashboard.manualSetup")})]}),h.jsx(qe,{size:"small",endIcon:h.jsx(oee,{sx:{fontSize:14}}),href:"https://t0bst4r.github.io/home-assistant-matter-hub/",target:"_blank",rel:"noopener",children:e("dashboard.documentation")})]})}),T&&b.visibleWidgets.map((I,P)=>h.jsxs(ae,{children:[P>0&&h.jsx(Dr,{sx:{my:3}}),I==="stats"&&h.jsxs(dt,{container:!0,spacing:2,sx:{mb:3},children:[h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("nav.bridges"),value:O?.total??0,icon:h.jsx(Ny,{}),color:t.palette.success.main,subtitle:O?`${O.running} running${O.failed>0?` · ${O.failed} failed`:""}`:void 0,onClick:()=>n(Tt.bridges)})}),h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("common.devices"),value:w,icon:h.jsx(aa,{}),color:t.palette.primary.main,subtitle:E>0?h.jsx(ft,{icon:h.jsx(ug,{sx:{fontSize:14}}),label:`${E} failed`,size:"small",color:"warning",variant:"outlined",clickable:!0,onClick:L=>{L.stopPropagation(),n(`${Tt.devices}?showFailed=true`)},sx:{height:22,fontSize:"0.7rem"}}):void 0,onClick:()=>n(Tt.devices)})}),h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("common.fabrics"),value:k,icon:h.jsx(Jh,{}),color:t.palette.secondary.main,onClick:()=>n(Tt.networkMap)})}),h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("dashboard.haConnection"),value:e(_?"common.online":"common.offline"),icon:_?h.jsx(Ja,{}):h.jsx(jf,{}),color:_?t.palette.success.main:t.palette.error.main,subtitle:i?.uptime!=null?`${e("health.uptime")} ${g_e(i.uptime)}`:void 0})})]}),I==="bridges"&&h.jsxs(h.Fragment,{children:[h.jsx(ae,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,flexWrap:"wrap",gap:1,children:h.jsx(re,{variant:"h6",children:e("nav.bridges")})}),h.jsxs(Vt,{direction:"row",spacing:1.5,sx:{mb:2},flexWrap:"wrap",useFlexGap:!0,children:[h.jsx(qe,{variant:"contained",startIcon:h.jsx(YD,{}),onClick:()=>c(!0),size:"large",children:e("dashboard.bridgeWizard")}),h.jsx(qe,{variant:"outlined",startIcon:h.jsx(Ds,{}),onClick:()=>n(Tt.createBridge),size:"large",children:e("dashboard.createBridge")}),h.jsx(qe,{variant:"outlined",startIcon:h.jsx(C4,{}),onClick:()=>n(Tt.areaSetup),size:"large",children:e("dashboard.areaSetup")}),h.jsx(Dr,{orientation:"vertical",flexItem:!0}),h.jsx(qe,{variant:"outlined",color:"success",startIcon:h.jsx(see,{}),disabled:u,onClick:async()=>{if(!p.current){p.current=!0,d(!0);try{await SZ(),await C()}finally{d(!1),p.current=!1}}},children:e("dashboard.startAll")}),h.jsx(qe,{variant:"outlined",color:"error",startIcon:h.jsx(lee,{}),disabled:u,onClick:async()=>{if(!p.current){p.current=!0,d(!0);try{await wZ(),await C()}finally{d(!1),p.current=!1}}},children:e("dashboard.stopAll")}),h.jsx(qe,{variant:"outlined",color:"warning",startIcon:h.jsx(R0,{}),disabled:u,onClick:async()=>{if(!p.current){p.current=!0,d(!0);try{await CZ(),await C()}finally{d(!1),p.current=!1}}},children:e("dashboard.restartAll")})]}),i?.bridgeDetails&&i.bridgeDetails.length>0?h.jsx(dt,{container:!0,spacing:1.5,children:[...i.bridgeDetails].sort((L,M)=>(L.priority??100)-(M.priority??100)).map((L,M)=>h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(y_e,{bridge:L,order:M+1,onClick:()=>n(Tt.bridge(L.id))})},L.id))}):h.jsx(On,{variant:"outlined",children:h.jsx(Yn,{sx:{textAlign:"center",py:4},children:h.jsx(re,{color:"text.secondary",children:e("dashboard.noBridgesHint")})})})]}),I==="quickNav"&&h.jsxs(h.Fragment,{children:[h.jsx(re,{variant:"h6",sx:{mb:2},children:e("dashboard.quickNavigation")}),h.jsxs(dt,{container:!0,spacing:1.5,children:[h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.bridges"),icon:h.jsx(Ny,{sx:{fontSize:20}}),onClick:()=>n(Tt.bridges)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.areaSetup"),icon:h.jsx(C4,{sx:{fontSize:20}}),onClick:()=>n(Tt.areaSetup)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.devices"),icon:h.jsx(aa,{sx:{fontSize:20}}),onClick:()=>n(Tt.devices)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.networkMap"),icon:h.jsx(xM,{sx:{fontSize:20}}),onClick:()=>n(Tt.networkMap)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.health"),icon:h.jsx(rM,{sx:{fontSize:20}}),onClick:()=>n(Tt.health)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.startupOrder"),icon:h.jsx(cg,{sx:{fontSize:20}}),onClick:()=>n(Tt.startup)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.lockCredentials"),icon:h.jsx(Tu,{sx:{fontSize:20}}),onClick:()=>n(Tt.lockCredentials)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.filterReference"),icon:h.jsx(EM,{sx:{fontSize:20}}),onClick:()=>n(Tt.labels)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.settings"),icon:h.jsx(fg,{sx:{fontSize:20}}),onClick:()=>n(Tt.settings)})})]})]})]},I)),h.jsx(m_e,{open:g,config:b.config,onToggle:b.toggleWidget,onMove:b.moveWidget,onReset:b.resetToDefaults,onClose:()=>y(!1)}),h.jsx(hee,{open:l,onClose:()=>c(!1),onComplete:()=>{r(No()),C()}})]})};function v_e(e){return et("MuiPagination",e)}it("MuiPagination",["root","ul","outlined","text"]);function x_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:c,showFirstButton:u=!1,showLastButton:d=!1,siblingCount:p=1,...g}=e,[y,b]=ml({controlled:c,default:i,name:n,state:"page"}),v=(I,P)=>{c||b(P),l&&l(I,P)},S=(I,P)=>{const L=P-I+1;return Array.from({length:L},(M,$)=>I+$)},C=S(1,Math.min(t,r)),w=S(Math.max(r-t+1,t+1),r),k=Math.max(Math.min(y-p,r-t-p*2-1),t+2),E=Math.min(Math.max(y+p,t+p*2+2),r-t-1),O=[...u?["first"]:[],...a?[]:["previous"],...C,...k>t+2?["start-ellipsis"]:t+1<r-t?[t+1]:[],...S(k,E),...E<r-t-1?["end-ellipsis"]:r-t>t?[r-t]:[],...w,...s?[]:["next"],...d?["last"]:[]],_=I=>{switch(I){case"first":return 1;case"previous":return y-1;case"next":return y+1;case"last":return r;default:return null}};return{items:O.map(I=>typeof I=="number"?{onClick:P=>{v(P,I)},type:"page",page:I,selected:I===y,disabled:o,"aria-current":I===y?"page":void 0}:{onClick:P=>{v(P,_(I))},type:I,page:_(I),selected:!1,disabled:o||!I.includes("ellipsis")&&(I==="next"||I==="last"?y>=r:y<=1)}),...g}}function S_e(e){return et("MuiPaginationItem",e)}const Go=it("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),w_e=Ee(h.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),C_e=Ee(h.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),E_e=Ee(h.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),k_e=Ee(h.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),mee=(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ve(n.size)}`],n.variant==="text"&&t[`text${ve(n.color)}`],n.variant==="outlined"&&t[`outlined${ve(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]},A_e=e=>{const{classes:t,color:n,disabled:r,selected:i,size:o,shape:s,type:a,variant:l}=e,c={root:["root",`size${ve(o)}`,l,s,n!=="standard"&&`color${ve(n)}`,n!=="standard"&&`${l}${ve(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 tt(c,S_e,t)},D_e=ge("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver:mee})(Ke(({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",[`&.${Go.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}}]}))),__e=ge(os,{name:"MuiPaginationItem",slot:"Root",overridesResolver:mee})(Ke(({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,[`&.${Go.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Go.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"}},[`&.${Go.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}},[`&.${Go.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${Go.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)"}`,[`&.${Go.selected}`]:{[`&.${Go.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${Go.selected}`]:{[`&.${Go.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Wn(["dark","contrastText"])).map(([t])=>({props:{variant:"text",color:t},style:{[`&.${Go.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}},[`&.${Go.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${Go.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Wn(["light"])).map(([t])=>({props:{variant:"outlined",color:t},style:{[`&.${Go.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"}},[`&.${Go.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),O_e=ge("div",{name:"MuiPaginationItem",slot:"Icon"})(Ke(({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)}}]}))),T_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiPaginationItem"}),{className:i,color:o="standard",component:s,components:a={},disabled:l=!1,page:c,selected:u=!1,shape:d="circular",size:p="medium",slots:g={},slotProps:y={},type:b="page",variant:v="text",...S}=r,C={...r,color:o,disabled:l,selected:u,shape:d,size:p,type:b,variant:v},w=Pc(),k=A_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},[O,_]=ut("previous",{elementType:E_e,externalForwardedProps:E,ownerState:C}),[T,I]=ut("next",{elementType:k_e,externalForwardedProps:E,ownerState:C}),[P,L]=ut("first",{elementType:w_e,externalForwardedProps:E,ownerState:C}),[M,$]=ut("last",{elementType:C_e,externalForwardedProps:E,ownerState:C}),N=w?{previous:"next",next:"previous",first:"last",last:"first"}[b]:b,z={previous:O,next:T,first:P,last:M}[N],F={previous:_,next:I,first:L,last:$}[N];return b==="start-ellipsis"||b==="end-ellipsis"?h.jsx(D_e,{ref:n,ownerState:C,className:Oe(k.root,i),children:"…"}):h.jsxs(__e,{ref:n,ownerState:C,component:s,disabled:l,className:Oe(k.root,i),...S,children:[b==="page"&&c,z?h.jsx(O_e,{...F,className:k.icon,as:z}):null]})}),M_e=e=>{const{classes:t,variant:n}=e;return tt({root:["root",n],ul:["ul"]},v_e,t)},R_e=ge("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),I_e=ge("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 P_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiPagination"}),{boundaryCount:i=1,className:o,color:s="standard",count:a=1,defaultPage:l=1,disabled:c=!1,getItemAriaLabel:u=j_e,hideNextButton:d=!1,hidePrevButton:p=!1,onChange:g,page:y,renderItem:b=P=>h.jsx(T_e,{...P}),shape:v="circular",showFirstButton:S=!1,showLastButton:C=!1,siblingCount:w=1,size:k="medium",variant:E="text",...O}=r,{items:_}=x_e({...r,componentName:"Pagination"}),T={...r,boundaryCount:i,color:s,count:a,defaultPage:l,disabled:c,getItemAriaLabel:u,hideNextButton:d,hidePrevButton:p,renderItem:b,shape:v,showFirstButton:S,showLastButton:C,siblingCount:w,size:k,variant:E},I=M_e(T);return h.jsx(R_e,{"aria-label":"pagination navigation",className:Oe(I.root,o),ownerState:T,ref:n,...O,children:h.jsx(I_e,{className:I.ul,ownerState:T,children:_.map((P,L)=>h.jsx("li",{children:b({...P,color:s,"aria-label":u(P.type,P.page,P.selected),shape:v,size:k,variant:E})},L))})})}),aH=[10,25,50,100],lH="hamh-devices-page-size",$_e=()=>{const{t:e}=on(),t=Ms(),{content:n,isLoading:r}=hg(),[i,o]=zme(),s=i.get("showFailed")==="true",[a,l]=A.useState(""),[c,u]=A.useState(""),[d,p]=A.useState(""),[g,y]=A.useState("name"),[b,v]=A.useState("asc"),[S,C]=A.useState(1),[w,k]=A.useState(()=>{const ue=localStorage.getItem(lH);if(!ue)return 12;if(ue==="all")return 0;const ke=parseInt(ue,10);return ke>0?ke:12}),[E,O]=A.useState(""),_=A.useCallback(ue=>{k(ue),localStorage.setItem(lH,ue===0?"all":String(ue)),C(1)},[]),[T,I]=A.useState(!1),[P,L]=A.useState(""),[M,$]=A.useState(""),[N,z]=A.useState(),[F,W]=A.useState({open:!1,message:"",severity:"success"});A.useEffect(()=>{t(No())},[t]),A.useEffect(()=>{n&&n.forEach(ue=>{t(Mu(ue.id))})},[t,n]);const V=lg(ue=>ue.devices.byBridge),q=A.useCallback((ue,ke,_e)=>{const Ue=[];if(!ue.parts||ue.parts.length===0)ue.endpoint!==0&&Ue.push({bridgeId:ke,bridgeName:_e,endpoint:ue});else for(const He of ue.parts)Ue.push(...q(He,ke,_e));return Ue},[]),X=A.useMemo(()=>{const ue=[];return(n||[]).forEach(ke=>{const Ue=V[ke.id]?.content;Ue&&ue.push(...q(Ue,ke.id,ke.name))}),ue},[n,V,q]),[B,U]=A.useState({}),Y=A.useMemo(()=>{const ue=[];for(const ke of X){const Ue=ke.endpoint.state.homeAssistantEntity?.entity?.entity_id;Ue&&ue.push(Ue)}return ue},[X]),H=A.useCallback(()=>{Y.length!==0&&MQ(Y).then(U).catch(()=>{})},[Y]);A.useEffect(()=>{H()},[H]);const G=A.useCallback(()=>{H()},[H]),Z=r||n&&n.length>0&&X.length===0,oe=A.useMemo(()=>{if(!n)return[];const ue=[];for(const ke of n)for(const _e of ke.failedEntities??[])ue.push({..._e,bridgeName:ke.name});return ue},[n]),ee=A.useCallback(()=>{o(ue=>(ue.delete("showFailed"),ue))},[o]),ie=A.useMemo(()=>X.filter(ue=>{const ke=ta(ue.endpoint.state)??ue.endpoint.id.local,_e=ue.endpoint.type.name,Ue=ke.toLowerCase().includes(a.toLowerCase())||ue.bridgeName.toLowerCase().includes(a.toLowerCase())||_e.toLowerCase().includes(a.toLowerCase()),He=!c||ue.bridgeId===c;return Ue&&He&&(!d||_e===d)}),[X,a,c,d]),te=A.useMemo(()=>[...ie].sort((ke,_e)=>{const Ue=ta(ke.endpoint.state)??ke.endpoint.id.local,He=ta(_e.endpoint.state)??_e.endpoint.id.local;let Dt=0;switch(g){case"name":Dt=Ue.localeCompare(He);break;case"type":Dt=ke.endpoint.type.name.localeCompare(_e.endpoint.type.name),Dt===0&&(Dt=Ue.localeCompare(He));break;case"bridge":Dt=ke.bridgeName.localeCompare(_e.bridgeName),Dt===0&&(Dt=Ue.localeCompare(He));break}return b==="asc"?Dt:-Dt}),[ie,g,b]),J=w===0?1:Math.ceil(te.length/w),Q=w===0?te:te.slice((S-1)*w,S*w),se=A.useMemo(()=>{const ue=new Set(X.map(ke=>ke.endpoint.type.name));return Array.from(ue).sort()},[X]),le=A.useMemo(()=>n?[...n].sort((ue,ke)=>{const _e=ue.name.localeCompare(ke.name);return b==="asc"?_e:-_e}):[],[n,b]),he=A.useCallback(()=>{t(No())},[t]),ye=A.useCallback(async(ue,ke)=>{L(ue),$(ke);try{const Ue=(await dM(ke)).mappings.find(He=>He.entityId===ue);z(Ue)}catch{z(void 0)}I(!0)},[]),Me=A.useCallback(async ue=>{if(!(!M||!P))try{await fM(M,P,ue),W({open:!0,message:e("mapping.saved",{entityId:P}),severity:"success"}),I(!1)}catch(ke){W({open:!0,message:e("mapping.saveFailed",{error:String(ke)}),severity:"error"})}},[M,P,e]);return Z?h.jsx(ae,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(Jn,{})}):h.jsxs(ae,{sx:{p:2},children:[h.jsxs(re,{variant:"h4",gutterBottom:!0,sx:{display:"flex",alignItems:"center",gap:2},children:[h.jsx(aa,{}),e("nav.devices"),h.jsx(qe,{variant:"outlined",startIcon:h.jsx(Zb,{}),onClick:he,sx:{ml:"auto"},children:e("common.refresh")})]}),s&&oe.length>0&&h.jsxs(zt,{severity:"warning",sx:{mb:3},action:h.jsx(Wt,{size:"small",color:"inherit",onClick:ee,children:h.jsx(LS,{fontSize:"small"})}),children:[h.jsx(re,{variant:"body2",fontWeight:"bold",gutterBottom:!0,children:e("devices.failedEntitiesTitle",{count:oe.length,defaultValue:`${oe.length} failed entities`})}),h.jsx(Fo,{dense:!0,disablePadding:!0,children:oe.map(ue=>h.jsxs(Cs,{sx:{py:0},children:[h.jsx(jo,{sx:{minWidth:32},children:h.jsx(ug,{color:"warning",fontSize:"small"})}),h.jsx(so,{primary:ue.entityId,secondary:`${ue.bridgeName} — ${ue.reason}`,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},`${ue.bridgeName}-${ue.entityId}`))})]}),s&&oe.length===0&&h.jsx(zt,{severity:"success",sx:{mb:3},action:h.jsx(Wt,{size:"small",color:"inherit",onClick:ee,children:h.jsx(LS,{fontSize:"small"})}),children:h.jsx(re,{variant:"body2",children:e("devices.noFailedEntities",{defaultValue:"No failed entities — all devices loaded successfully."})})}),h.jsx(On,{sx:{mb:3},children:h.jsx(Yn,{children:h.jsxs(Vt,{spacing:2,direction:{xs:"column",md:"row"},alignItems:{md:"center"},children:[h.jsx(Zn,{label:e("devices.searchPlaceholder"),value:a,onChange:ue=>l(ue.target.value),sx:{flexGrow:1}}),h.jsxs(rs,{sx:{minWidth:200},children:[h.jsx(ja,{children:e("devices.filterBridge")}),h.jsxs(ts,{value:c,label:e("devices.filterBridge"),onChange:ue=>u(ue.target.value),children:[h.jsx(Nn,{value:"",children:e("devices.allBridges")}),le.map(ue=>h.jsx(Nn,{value:ue.id,children:ue.name},ue.id))]})]}),h.jsxs(rs,{sx:{minWidth:200},children:[h.jsx(ja,{children:e("devices.filterDeviceType")}),h.jsxs(ts,{value:d,label:e("devices.filterDeviceType"),onChange:ue=>p(ue.target.value),children:[h.jsx(Nn,{value:"",children:e("devices.allTypes")}),se.map(ue=>h.jsx(Nn,{value:ue,children:ue},ue))]})]}),h.jsxs(rs,{sx:{minWidth:150},children:[h.jsx(ja,{children:e("devices.sortBy")}),h.jsxs(ts,{value:g,label:e("devices.sortBy"),onChange:ue=>y(ue.target.value),children:[h.jsx(Nn,{value:"bridge",children:e("devices.sortBridge")}),h.jsx(Nn,{value:"type",children:e("devices.sortType")}),h.jsx(Nn,{value:"name",children:e("devices.sortName")})]})]}),h.jsx(Nt,{title:e(b==="asc"?"common.ascending":"common.descending"),children:h.jsx(Wt,{onClick:()=>v(ue=>ue==="asc"?"desc":"asc"),color:"primary",children:b==="asc"?h.jsx(lC,{}):h.jsx(aC,{})})})]})})}),h.jsx(dt,{container:!0,spacing:2,children:Q.map(ue=>h.jsx(dt,{size:{xs:12,sm:6,lg:4},children:h.jsx(IQ,{endpoint:ue.endpoint,bridgeName:ue.bridgeName,bridgeId:ue.bridgeId,onEditMapping:ye,imageInfo:B[ue.endpoint.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:G})},`${ue.bridgeId}-${ue.endpoint.id.global}`))}),h.jsxs(ae,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:3,gap:2,flexWrap:"wrap"},children:[h.jsxs(Vt,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:"Per page:"}),h.jsxs(ts,{value:w===0?"all":aH.includes(w)?String(w):"",onChange:ue=>{const ke=ue.target.value;O(""),_(ke==="all"?0:parseInt(ke,10))},displayEmpty:!0,renderValue:ue=>ue==="all"?e("common.all"):ue===""?String(w):ue,size:"small",sx:{minWidth:80},children:[aH.map(ue=>h.jsx(Nn,{value:String(ue),children:ue},ue)),h.jsx(Nn,{value:"all",children:e("common.all")})]}),h.jsx(Zn,{size:"small",type:"number",placeholder:e("common.custom"),value:E,onChange:ue=>O(ue.target.value),onBlur:()=>{const ue=parseInt(E,10);ue>0&&_(ue),O("")},onKeyDown:ue=>{if(ue.key==="Enter"){const ke=parseInt(E,10);ke>0&&_(ke),O("")}},slotProps:{htmlInput:{min:1,style:{textAlign:"center"}}},sx:{width:80}})]}),J>1&&h.jsx(P_e,{count:J,page:S,onChange:(ue,ke)=>C(ke),color:"primary"}),h.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:ie.length===X.length?e("devices.deviceCount",{count:X.length}):e("devices.filteredCount",{filtered:ie.length,total:X.length})})]}),ie.length===0&&h.jsxs(ae,{sx:{textAlign:"center",py:8},children:[h.jsx(re,{variant:"h6",color:"text.secondary",children:"No devices found"}),h.jsx(re,{variant:"body2",color:"text.secondary",children:"Try adjusting your filters or check if any bridges are running"})]}),h.jsx(hM,{open:T,entityId:P,domain:P.split(".")[0]||"",currentMapping:N,onSave:Me,onClose:()=>I(!1)}),h.jsx(Pw,{open:F.open,autoHideDuration:6e3,onClose:()=>W(ue=>({...ue,open:!1})),children:h.jsx(zt,{onClose:()=>W(ue=>({...ue,open:!1})),severity:F.severity,sx:{width:"100%"},children:F.message})})]})};function En(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 L_e(e){return e.additionalItems===!0&&console.warn("additionalItems=true is currently not supported"),En(e.additionalItems)}function cH(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 Ru="__additional_property",O2="additionalProperties",zu="allOf",Vn="anyOf",za="const",hC="default",IM="dependencies",N_e="enum",wo="__errors",kr="$id",jM="if",Zh="items",F_e="_$junk_option_schema_id$_",E4="$name",gn="oneOf",JD="patternProperties",nr="properties",N7="readonly",gee="required",zS="submitButtonOptions",Ar="$ref",dy="$schema",yee="root",bee="_",B_e=["discriminator","propertyName"],uH="formContext",z_e="layoutGridLookupMap",PM="__rjsf_additionalProperties",vee="__rjsf_rootSchema",H_e="ui:field",$M="ui:widget",nf="ui:options",ZD="ui:globalOptions",U_e="ui:definitions",V_e="https://json-schema.org/draft/2019-09/schema",k4="https://json-schema.org/draft/2020-12/schema";function Kt(e={},t={}){return e?Object.keys(e).filter(n=>n.indexOf("ui:")===0).reduce((n,r)=>{const i=e[r];return r===$M&&En(i)?(console.error("Setting options via ui:widget object is no longer supported, use ui:options instead"),n):r===nf&&En(i)?{...n,...i}:{...n,[r.substring(3)]:i}},{...t}):{...t}}function xee(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;const{expandable:r=!0}=Kt(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var See=typeof global=="object"&&global&&global.Object===Object&&global,W_e=typeof self=="object"&&self&&self.Object===Object&&self,Lc=See||W_e||Function("return this")(),Ha=Lc.Symbol,wee=Object.prototype,q_e=wee.hasOwnProperty,G_e=wee.toString,B1=Ha?Ha.toStringTag:void 0;function K_e(e){var t=q_e.call(e,B1),n=e[B1];try{e[B1]=void 0;var r=!0}catch{}var i=G_e.call(e);return r&&(t?e[B1]=n:delete e[B1]),i}var Y_e=Object.prototype,X_e=Y_e.toString;function J_e(e){return X_e.call(e)}var Z_e="[object Null]",Q_e="[object Undefined]",dH=Ha?Ha.toStringTag:void 0;function Yu(e){return e==null?e===void 0?Q_e:Z_e:dH&&dH in Object(e)?K_e(e):J_e(e)}function Cee(e,t){return function(n){return e(t(n))}}var pC=Cee(Object.getPrototypeOf,Object);function Ua(e){return e!=null&&typeof e=="object"}var eOe="[object Object]",tOe=Function.prototype,nOe=Object.prototype,Eee=tOe.toString,rOe=nOe.hasOwnProperty,iOe=Eee.call(Object);function gf(e){if(!Ua(e)||Yu(e)!=eOe)return!1;var t=pC(e);if(t===null)return!0;var n=rOe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Eee.call(n)==iOe}function QD(e){const t={[wo]:[],addError(n){this[wo].push(n)}};if(Array.isArray(e))return e.reduce((n,r,i)=>({...n,[i]:QD(r)}),t);if(gf(e)){const n=e;return Object.keys(n).reduce((r,i)=>({...r,[i]:QD(n[i])}),t)}return t}function oOe(){this.__data__=[],this.size=0}function Qb(e,t){return e===t||e!==e&&t!==t}function mC(e,t){for(var n=e.length;n--;)if(Qb(e[n][0],t))return n;return-1}var sOe=Array.prototype,aOe=sOe.splice;function lOe(e){var t=this.__data__,n=mC(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():aOe.call(t,n,1),--this.size,!0}function cOe(e){var t=this.__data__,n=mC(t,e);return n<0?void 0:t[n][1]}function uOe(e){return mC(this.__data__,e)>-1}function dOe(e,t){var n=this.__data__,r=mC(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Xu(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])}}Xu.prototype.clear=oOe;Xu.prototype.delete=lOe;Xu.prototype.get=cOe;Xu.prototype.has=uOe;Xu.prototype.set=dOe;function fOe(){this.__data__=new Xu,this.size=0}function hOe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function pOe(e){return this.__data__.get(e)}function mOe(e){return this.__data__.has(e)}function Qn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gOe="[object AsyncFunction]",yOe="[object Function]",bOe="[object GeneratorFunction]",vOe="[object Proxy]";function ev(e){if(!Qn(e))return!1;var t=Yu(e);return t==yOe||t==bOe||t==gOe||t==vOe}var F7=Lc["__core-js_shared__"],fH=(function(){var e=/[^.]+$/.exec(F7&&F7.keys&&F7.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function xOe(e){return!!fH&&fH in e}var SOe=Function.prototype,wOe=SOe.toString;function mp(e){if(e!=null){try{return wOe.call(e)}catch{}try{return e+""}catch{}}return""}var COe=/[\\^$.*+?()[\]{}|]/g,EOe=/^\[object .+?Constructor\]$/,kOe=Function.prototype,AOe=Object.prototype,DOe=kOe.toString,_Oe=AOe.hasOwnProperty,OOe=RegExp("^"+DOe.call(_Oe).replace(COe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function TOe(e){if(!Qn(e)||xOe(e))return!1;var t=ev(e)?OOe:EOe;return t.test(mp(e))}function MOe(e,t){return e?.[t]}function gp(e,t){var n=MOe(e,t);return TOe(n)?n:void 0}var T2=gp(Lc,"Map"),M2=gp(Object,"create");function ROe(){this.__data__=M2?M2(null):{},this.size=0}function IOe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var jOe="__lodash_hash_undefined__",POe=Object.prototype,$Oe=POe.hasOwnProperty;function LOe(e){var t=this.__data__;if(M2){var n=t[e];return n===jOe?void 0:n}return $Oe.call(t,e)?t[e]:void 0}var NOe=Object.prototype,FOe=NOe.hasOwnProperty;function BOe(e){var t=this.__data__;return M2?t[e]!==void 0:FOe.call(t,e)}var zOe="__lodash_hash_undefined__";function HOe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=M2&&t===void 0?zOe:t,this}function Qh(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])}}Qh.prototype.clear=ROe;Qh.prototype.delete=IOe;Qh.prototype.get=LOe;Qh.prototype.has=BOe;Qh.prototype.set=HOe;function UOe(){this.size=0,this.__data__={hash:new Qh,map:new(T2||Xu),string:new Qh}}function VOe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function gC(e,t){var n=e.__data__;return VOe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function WOe(e){var t=gC(this,e).delete(e);return this.size-=t?1:0,t}function qOe(e){return gC(this,e).get(e)}function GOe(e){return gC(this,e).has(e)}function KOe(e,t){var n=gC(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Ju(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])}}Ju.prototype.clear=UOe;Ju.prototype.delete=WOe;Ju.prototype.get=qOe;Ju.prototype.has=GOe;Ju.prototype.set=KOe;var YOe=200;function XOe(e,t){var n=this.__data__;if(n instanceof Xu){var r=n.__data__;if(!T2||r.length<YOe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ju(r)}return n.set(e,t),this.size=n.size,this}function bl(e){var t=this.__data__=new Xu(e);this.size=t.size}bl.prototype.clear=fOe;bl.prototype.delete=hOe;bl.prototype.get=pOe;bl.prototype.has=mOe;bl.prototype.set=XOe;var JOe="__lodash_hash_undefined__";function ZOe(e){return this.__data__.set(e,JOe),this}function QOe(e){return this.__data__.has(e)}function ep(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ju;++t<n;)this.add(e[t])}ep.prototype.add=ep.prototype.push=ZOe;ep.prototype.has=QOe;function eTe(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 R2(e,t){return e.has(t)}var tTe=1,nTe=2;function kee(e,t,n,r,i,o){var s=n&tTe,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var d=-1,p=!0,g=n&nTe?new ep:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var y=e[d],b=t[d];if(r)var v=s?r(b,y,d,t,e,o):r(y,b,d,e,t,o);if(v!==void 0){if(v)continue;p=!1;break}if(g){if(!eTe(t,function(S,C){if(!R2(g,C)&&(y===S||i(y,S,n,r,o)))return g.push(C)})){p=!1;break}}else if(!(y===b||i(y,b,n,r,o))){p=!1;break}}return o.delete(e),o.delete(t),p}var HS=Lc.Uint8Array;function rTe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function LM(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var iTe=1,oTe=2,sTe="[object Boolean]",aTe="[object Date]",lTe="[object Error]",cTe="[object Map]",uTe="[object Number]",dTe="[object RegExp]",fTe="[object Set]",hTe="[object String]",pTe="[object Symbol]",mTe="[object ArrayBuffer]",gTe="[object DataView]",hH=Ha?Ha.prototype:void 0,B7=hH?hH.valueOf:void 0;function yTe(e,t,n,r,i,o,s){switch(n){case gTe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case mTe:return!(e.byteLength!=t.byteLength||!o(new HS(e),new HS(t)));case sTe:case aTe:case uTe:return Qb(+e,+t);case lTe:return e.name==t.name&&e.message==t.message;case dTe:case hTe:return e==t+"";case cTe:var a=rTe;case fTe:var l=r&iTe;if(a||(a=LM),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=oTe,s.set(e,t);var u=kee(a(e),a(t),r,i,o,s);return s.delete(e),u;case pTe:if(B7)return B7.call(e)==B7.call(t)}return!1}function NM(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Wi=Array.isArray;function Aee(e,t,n){var r=t(e);return Wi(e)?r:NM(r,n(e))}function bTe(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 Dee(){return[]}var vTe=Object.prototype,xTe=vTe.propertyIsEnumerable,pH=Object.getOwnPropertySymbols,FM=pH?function(e){return e==null?[]:(e=Object(e),bTe(pH(e),function(t){return xTe.call(e,t)}))}:Dee;function _ee(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var STe="[object Arguments]";function mH(e){return Ua(e)&&Yu(e)==STe}var Oee=Object.prototype,wTe=Oee.hasOwnProperty,CTe=Oee.propertyIsEnumerable,I0=mH((function(){return arguments})())?mH:function(e){return Ua(e)&&wTe.call(e,"callee")&&!CTe.call(e,"callee")};function ETe(){return!1}var Tee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gH=Tee&&typeof module=="object"&&module&&!module.nodeType&&module,kTe=gH&&gH.exports===Tee,yH=kTe?Lc.Buffer:void 0,ATe=yH?yH.isBuffer:void 0,tp=ATe||ETe,DTe=9007199254740991,_Te=/^(?:0|[1-9]\d*)$/;function yC(e,t){var n=typeof e;return t=t??DTe,!!t&&(n=="number"||n!="symbol"&&_Te.test(e))&&e>-1&&e%1==0&&e<t}var OTe=9007199254740991;function BM(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=OTe}var TTe="[object Arguments]",MTe="[object Array]",RTe="[object Boolean]",ITe="[object Date]",jTe="[object Error]",PTe="[object Function]",$Te="[object Map]",LTe="[object Number]",NTe="[object Object]",FTe="[object RegExp]",BTe="[object Set]",zTe="[object String]",HTe="[object WeakMap]",UTe="[object ArrayBuffer]",VTe="[object DataView]",WTe="[object Float32Array]",qTe="[object Float64Array]",GTe="[object Int8Array]",KTe="[object Int16Array]",YTe="[object Int32Array]",XTe="[object Uint8Array]",JTe="[object Uint8ClampedArray]",ZTe="[object Uint16Array]",QTe="[object Uint32Array]",qr={};qr[WTe]=qr[qTe]=qr[GTe]=qr[KTe]=qr[YTe]=qr[XTe]=qr[JTe]=qr[ZTe]=qr[QTe]=!0;qr[TTe]=qr[MTe]=qr[UTe]=qr[RTe]=qr[VTe]=qr[ITe]=qr[jTe]=qr[PTe]=qr[$Te]=qr[LTe]=qr[NTe]=qr[FTe]=qr[BTe]=qr[zTe]=qr[HTe]=!1;function eMe(e){return Ua(e)&&BM(e.length)&&!!qr[Yu(e)]}function zM(e){return function(t){return e(t)}}var Mee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fy=Mee&&typeof module=="object"&&module&&!module.nodeType&&module,tMe=Fy&&Fy.exports===Mee,z7=tMe&&See.process,j0=(function(){try{var e=Fy&&Fy.require&&Fy.require("util").types;return e||z7&&z7.binding&&z7.binding("util")}catch{}})(),bH=j0&&j0.isTypedArray,tv=bH?zM(bH):eMe,nMe=Object.prototype,rMe=nMe.hasOwnProperty;function Ree(e,t){var n=Wi(e),r=!n&&I0(e),i=!n&&!r&&tp(e),o=!n&&!r&&!i&&tv(e),s=n||r||i||o,a=s?_ee(e.length,String):[],l=a.length;for(var c in e)(t||rMe.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||yC(c,l)))&&a.push(c);return a}var iMe=Object.prototype;function bC(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||iMe;return e===n}var oMe=Cee(Object.keys,Object),sMe=Object.prototype,aMe=sMe.hasOwnProperty;function Iee(e){if(!bC(e))return oMe(e);var t=[];for(var n in Object(e))aMe.call(e,n)&&n!="constructor"&&t.push(n);return t}function yp(e){return e!=null&&BM(e.length)&&!ev(e)}function ll(e){return yp(e)?Ree(e):Iee(e)}function e_(e){return Aee(e,ll,FM)}var lMe=1,cMe=Object.prototype,uMe=cMe.hasOwnProperty;function dMe(e,t,n,r,i,o){var s=n&lMe,a=e_(e),l=a.length,c=e_(t),u=c.length;if(l!=u&&!s)return!1;for(var d=l;d--;){var p=a[d];if(!(s?p in t:uMe.call(t,p)))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;++d<l;){p=a[d];var S=e[p],C=t[p];if(r)var w=s?r(C,S,p,t,e,o):r(S,C,p,e,t,o);if(!(w===void 0?S===C||i(S,C,n,r,o):w)){b=!1;break}v||(v=p=="constructor")}if(b&&!v){var k=e.constructor,E=t.constructor;k!=E&&"constructor"in e&&"constructor"in t&&!(typeof k=="function"&&k instanceof k&&typeof E=="function"&&E instanceof E)&&(b=!1)}return o.delete(e),o.delete(t),b}var t_=gp(Lc,"DataView"),n_=gp(Lc,"Promise"),o0=gp(Lc,"Set"),r_=gp(Lc,"WeakMap"),vH="[object Map]",fMe="[object Object]",xH="[object Promise]",SH="[object Set]",wH="[object WeakMap]",CH="[object DataView]",hMe=mp(t_),pMe=mp(T2),mMe=mp(n_),gMe=mp(o0),yMe=mp(r_),Aa=Yu;(t_&&Aa(new t_(new ArrayBuffer(1)))!=CH||T2&&Aa(new T2)!=vH||n_&&Aa(n_.resolve())!=xH||o0&&Aa(new o0)!=SH||r_&&Aa(new r_)!=wH)&&(Aa=function(e){var t=Yu(e),n=t==fMe?e.constructor:void 0,r=n?mp(n):"";if(r)switch(r){case hMe:return CH;case pMe:return vH;case mMe:return xH;case gMe:return SH;case yMe:return wH}return t});var bMe=1,EH="[object Arguments]",kH="[object Array]",h3="[object Object]",vMe=Object.prototype,AH=vMe.hasOwnProperty;function xMe(e,t,n,r,i,o){var s=Wi(e),a=Wi(t),l=s?kH:Aa(e),c=a?kH:Aa(t);l=l==EH?h3:l,c=c==EH?h3:c;var u=l==h3,d=c==h3,p=l==c;if(p&&tp(e)){if(!tp(t))return!1;s=!0,u=!1}if(p&&!u)return o||(o=new bl),s||tv(e)?kee(e,t,n,r,i,o):yTe(e,t,l,n,r,i,o);if(!(n&bMe)){var g=u&&AH.call(e,"__wrapped__"),y=d&&AH.call(t,"__wrapped__");if(g||y){var b=g?e.value():e,v=y?t.value():t;return o||(o=new bl),i(b,v,n,r,o)}}return p?(o||(o=new bl),dMe(e,t,n,r,i,o)):!1}function nv(e,t,n,r,i){return e===t?!0:e==null||t==null||!Ua(e)&&!Ua(t)?e!==e&&t!==t:xMe(e,t,n,r,nv,i)}function SMe(e,t,n){n=typeof n=="function"?n:void 0;var r=n?n(e,t):void 0;return r===void 0?nv(e,t,void 0,n):!!r}function Lr(e,t){return SMe(e,t,(n,r)=>{if(typeof n=="function"&&typeof r=="function")return!0})}var wMe="[object Symbol]";function rv(e){return typeof e=="symbol"||Ua(e)&&Yu(e)==wMe}var CMe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,EMe=/^\w*$/;function HM(e,t){if(Wi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||rv(e)?!0:EMe.test(e)||!CMe.test(e)||t!=null&&e in Object(t)}var kMe="Expected a function";function UM(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kMe);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(UM.Cache||Ju),n}UM.Cache=Ju;var AMe=500;function DMe(e){var t=UM(e,function(r){return n.size===AMe&&n.clear(),r}),n=t.cache;return t}var _Me=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,OMe=/\\(\\)?/g,jee=DMe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(_Me,function(n,r,i,o){t.push(i?o.replace(OMe,"$1"):r||n)}),t});function pg(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 DH=Ha?Ha.prototype:void 0,_H=DH?DH.toString:void 0;function Pee(e){if(typeof e=="string")return e;if(Wi(e))return pg(e,Pee)+"";if(rv(e))return _H?_H.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function VM(e){return e==null?"":Pee(e)}function mg(e,t){return Wi(e)?e:HM(e,t)?[e]:jee(VM(e))}function bp(e){if(typeof e=="string"||rv(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function vC(e,t){t=mg(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[bp(t[n++])];return n&&n==r?e:void 0}function Xe(e,t,n){var r=e==null?void 0:vC(e,t);return r===void 0?n:r}var TMe=Object.prototype,MMe=TMe.hasOwnProperty;function RMe(e,t){return e!=null&&MMe.call(e,t)}function $ee(e,t,n){t=mg(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=bp(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&&BM(i)&&yC(s,i)&&(Wi(e)||I0(e)))}function Un(e,t){return e!=null&&$ee(e,t,RMe)}function I2(e,t){return nv(e,t)}var US=(function(){try{var e=gp(Object,"defineProperty");return e({},"",{}),e}catch{}})();function WM(e,t,n){t=="__proto__"&&US?US(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var IMe=Object.prototype,jMe=IMe.hasOwnProperty;function qM(e,t,n){var r=e[t];(!(jMe.call(e,t)&&Qb(r,n))||n===void 0&&!(t in e))&&WM(e,t,n)}function GM(e,t,n,r){if(!Qn(e))return e;t=mg(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=bp(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var u=a[l];c=r?r(u,l,a):void 0,c===void 0&&(c=Qn(u)?u:yC(t[i+1])?[]:{})}qM(a,l,c),a=a[l]}return e}function xr(e,t,n){return e==null?e:GM(e,t,n)}function xC(e){return e}function Lee(e){return typeof e=="function"?e:xC}var PMe=/\s/;function $Me(e){for(var t=e.length;t--&&PMe.test(e.charAt(t)););return t}var LMe=/^\s+/;function NMe(e){return e&&e.slice(0,$Me(e)+1).replace(LMe,"")}var OH=NaN,FMe=/^[-+]0x[0-9a-f]+$/i,BMe=/^0b[01]+$/i,zMe=/^0o[0-7]+$/i,HMe=parseInt;function UMe(e){if(typeof e=="number")return e;if(rv(e))return OH;if(Qn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Qn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=NMe(e);var n=BMe.test(e);return n||zMe.test(e)?HMe(e.slice(2),n?2:8):FMe.test(e)?OH:+e}var TH=1/0,VMe=17976931348623157e292;function WMe(e){if(!e)return e===0?e:0;if(e=UMe(e),e===TH||e===-TH){var t=e<0?-1:1;return t*VMe}return e===e?e:0}function Nee(e){var t=WMe(e),n=t%1;return t===t?n?t-n:t:0}var qMe=9007199254740991,H7=4294967295,GMe=Math.min;function Fee(e,t){if(e=Nee(e),e<1||e>qMe)return[];var n=H7,r=GMe(e,H7);t=Lee(t),e-=H7;for(var i=_ee(r,t);++n<e;)t(n);return i}function KM(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var MH=Object.create,Bee=(function(){function e(){}return function(t){if(!Qn(t))return{};if(MH)return MH(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function KMe(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 zee=KMe();function Hee(e,t){return e&&zee(e,t,ll)}var YMe=1,XMe=2;function JMe(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],c=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var u=new bl,d;if(!(d===void 0?nv(c,l,YMe|XMe,r,u):d))return!1}}return!0}function Uee(e){return e===e&&!Qn(e)}function ZMe(e){for(var t=ll(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Uee(i)]}return t}function Vee(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function QMe(e){var t=ZMe(e);return t.length==1&&t[0][2]?Vee(t[0][0],t[0][1]):function(n){return n===e||JMe(n,e,t)}}function eRe(e,t){return e!=null&&t in Object(e)}function Wee(e,t){return e!=null&&$ee(e,t,eRe)}var tRe=1,nRe=2;function rRe(e,t){return HM(e)&&Uee(t)?Vee(bp(e),t):function(n){var r=Xe(n,e);return r===void 0&&r===t?Wee(n,e):nv(t,r,tRe|nRe)}}function iRe(e){return function(t){return t?.[e]}}function oRe(e){return function(t){return vC(t,e)}}function sRe(e){return HM(e)?iRe(bp(e)):oRe(e)}function YM(e){return typeof e=="function"?e:e==null?xC:typeof e=="object"?Wi(e)?rRe(e[0],e[1]):QMe(e):sRe(e)}function aRe(e,t,n){var r=Wi(e),i=r||tp(e)||tv(e);if(t=YM(t),n==null){var o=e&&e.constructor;i?n=r?new o:[]:Qn(e)?n=ev(o)?Bee(pC(e)):{}:n={}}return(i?KM:Hee)(e,function(s,a,l){return t(n,s,a,l)}),n}function i_(e,t,n){(n!==void 0&&!Qb(e[t],n)||n===void 0&&!(t in e))&&WM(e,t,n)}var qee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,RH=qee&&typeof module=="object"&&module&&!module.nodeType&&module,lRe=RH&&RH.exports===qee,IH=lRe?Lc.Buffer:void 0,jH=IH?IH.allocUnsafe:void 0;function Gee(e,t){if(t)return e.slice();var n=e.length,r=jH?jH(n):new e.constructor(n);return e.copy(r),r}function XM(e){var t=new e.constructor(e.byteLength);return new HS(t).set(new HS(e)),t}function Kee(e,t){var n=t?XM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function JM(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function Yee(e){return typeof e.constructor=="function"&&!bC(e)?Bee(pC(e)):{}}function j2(e){return Ua(e)&&yp(e)}function o_(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?WM(n,a,l):qM(n,a,l)}return n}function cRe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var uRe=Object.prototype,dRe=uRe.hasOwnProperty;function fRe(e){if(!Qn(e))return cRe(e);var t=bC(e),n=[];for(var r in e)r=="constructor"&&(t||!dRe.call(e,r))||n.push(r);return n}function iv(e){return yp(e)?Ree(e,!0):fRe(e)}function hRe(e){return gg(e,iv(e))}function pRe(e,t,n,r,i,o,s){var a=o_(e,n),l=o_(t,n),c=s.get(l);if(c){i_(e,n,c);return}var u=o?o(a,l,n+"",e,t,s):void 0,d=u===void 0;if(d){var p=Wi(l),g=!p&&tp(l),y=!p&&!g&&tv(l);u=l,p||g||y?Wi(a)?u=a:j2(a)?u=JM(a):g?(d=!1,u=Gee(l,!0)):y?(d=!1,u=Kee(l,!0)):u=[]:gf(l)||I0(l)?(u=a,I0(a)?u=hRe(a):(!Qn(a)||ev(a))&&(u=Yee(l))):d=!1}d&&(s.set(l,u),i(u,l,r,o,s),s.delete(l)),i_(e,n,u)}function Xee(e,t,n,r,i){e!==t&&zee(t,function(o,s){if(i||(i=new bl),Qn(o))pRe(e,t,s,n,Xee,r,i);else{var a=r?r(o_(e,s),o,s+"",e,t,i):void 0;a===void 0&&(a=o),i_(e,s,a)}},iv)}function mRe(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 PH=Math.max;function Jee(e,t,n){return t=PH(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=PH(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),mRe(e,this,a)}}function gRe(e){return function(){return e}}var yRe=US?function(e,t){return US(e,"toString",{configurable:!0,enumerable:!1,value:gRe(t),writable:!0})}:xC,bRe=800,vRe=16,xRe=Date.now;function SRe(e){var t=0,n=0;return function(){var r=xRe(),i=vRe-(r-n);if(n=r,i>0){if(++t>=bRe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Zee=SRe(yRe);function SC(e,t){return Zee(Jee(e,t,xC),e+"")}function wRe(e,t,n){if(!Qn(n))return!1;var r=typeof t;return(r=="number"?yp(n)&&yC(t,n.length):r=="string"&&t in n)?Qb(n[t],e):!1}function CRe(e){return SC(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&&wRe(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 ERe=CRe(function(e,t,n){Xee(e,t,n)}),$H=Ha?Ha.isConcatSpreadable:void 0;function kRe(e){return Wi(e)||I0(e)||!!($H&&e&&e[$H])}function ov(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=kRe),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?ov(a,t-1,n,r,i):NM(i,a):r||(i[i.length]=a)}return i}var ARe=1/0;function DRe(e){var t=e==null?0:e.length;return t?ov(e,ARe):[]}function _Re(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 ORe(e){return e!==e}function TRe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Qee(e,t,n){return t===t?TRe(e,t,n):_Re(e,ORe,n)}function ZM(e,t){var n=e==null?0:e.length;return!!n&&Qee(e,t,0)>-1}function A4(){}var MRe=1/0,RRe=o0&&1/LM(new o0([,-0]))[1]==MRe?function(e){return new o0(e)}:A4,IRe=200;function ete(e,t,n){var r=-1,i=ZM,o=e.length,s=!0,a=[],l=a;if(o>=IRe){var c=RRe(e);if(c)return LM(c);s=!1,i=R2,l=new ep}else l=a;e:for(;++r<o;){var u=e[r],d=u;if(u=u!==0?u:0,s&&d===d){for(var p=l.length;p--;)if(l[p]===d)continue e;a.push(u)}else i(l,d,n)||(l!==a&&l.push(d),a.push(u))}return a}function tte(e){return e&&e.length?ete(e):[]}var jRe="[object Map]",PRe="[object Set]",$Re=Object.prototype,LRe=$Re.hasOwnProperty;function ki(e){if(e==null)return!0;if(yp(e)&&(Wi(e)||typeof e=="string"||typeof e.splice=="function"||tp(e)||tv(e)||I0(e)))return!e.length;var t=Aa(e);if(t==jRe||t==PRe)return!e.size;if(bC(e))return!Iee(e).length;for(var n in e)if(LRe.call(e,n))return!1;return!0}const NRe=Object.prototype;function fy(e){for(const t in e)if(NRe.hasOwnProperty.call(e,t))return!1;return!0}const FRe=["array","boolean","integer","null","number","object","string"];new Set(FRe);const BRe=["$defs","definitions","properties","patternProperties","dependencies"];new Set(BRe);const zRe=["items","allOf","oneOf","anyOf"];new Set(zRe);const HRe=["items","additionalItems","additionalProperties","propertyNames","contains","if","then","else","not"];new Set(HRe);function D4(e){return typeof e=="object"}function Kl(e){return D4(e)?fy(e):e===!0}function Hm(e,t){return e<t?-1:e>t?1:0}function U7(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 URe(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 LH(e){return e.length===0}function V7(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 nte(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 c=n[l];for(let u=0;u<a;u++)if(e(c,s[u])===0)continue e;a=s.push(c)}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 VRe(e){return(t,n)=>{const r=[];let i=t.length,o=n.length;if(i===0||o===0)return r;if(i>o){const u=t;t=n,n=u;const d=i;i=o,o=d}const s=[...t].sort(e),a=[...n].sort(e);let l=0,c=0;for(;l<i&&c<o;){const u=e(s[l],a[c]);u===0?((r.length===0||e(r[r.length-1],s[l])!==0)&&r.push(s[l]),l++,c++):u<0?l++:c++}return r}}function WRe(e,t){return n=>{if(e.has(n))return e.get(n);const r=t(n);return e.set(n,r),r}}const NH=WRe,rte=()=>0,qRe=e=>e===void 0,GRe=e=>typeof e!="object",FH={boolean:0,number:1,string:2};function KRe(e,t){const n=typeof e,r=typeof t;return n===r?Hm(e,t):FH[n]-FH[r]}function YRe(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 wC(e,t,n=rte){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function Mm(e){return wC(qRe,e)}function Dd(e,t){return wC(n=>n===void 0||e(n),t)}function W7(e,t){return wC(Array.isArray,e,t)}const Mi=Mm(Hm),q7=Dd(e=>e===0,(e,t)=>e-t);function XRe({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){const n=NH(t,b=>Object.keys(b).sort());function r(b){return(v,S)=>{const C=n(v),w=n(S),k=Math.min(C.length,w.length);for(let E=0;E<k;E++){const O=Hm(C[E],w[E]);if(O!==0)return O}if(C.length!==w.length)return C.length-w.length;for(let E=0;E<k;E++){const O=C[E],_=b(v[O],S[O]);if(_!==0)return _}return 0}}function i(b){const v=V7(b),S=NH(e,nte(b,{threshold:0}));return(C,w)=>v(S(C),S(w))}const o=i(Hm);function s(b,v){if(D4(b)){if(D4(v)){const S=Object.keys(b),C=Object.keys(v),w=YRe(S,C),k=w.length;for(let E=0;E<k;E++){const O=w[E];if(b[O]===v[O])continue;const T=(y[O]??a)(b[O],v[O]);if(T!==0)return T}return 0}return v===!0&&fy(b)?0:1}return D4(v)?b===!0&&fy(v)?0:-1:Hm(b,v)}const a=Mm(c),l=wC(GRe,W7(r(a),V7(c)),KRe);function c(b,v){return b===null?-1:v===null?1:l(b,v)}const u=Mm(s),d=Dd(fy,r(u)),p=Mm(i(s)),g=Dd(Kl,s),y={$id:Mi,$comment:Mi,$defs:d,$ref:Mi,$schema:Mi,const:a,contains:u,contentEncoding:Mi,contentMediaType:Mi,default:a,definitions:d,description:Mi,else:u,examples:a,exclusiveMaximum:Mi,exclusiveMinimum:Mi,format:Mi,if:u,maximum:Mi,maxItems:Mi,maxLength:Mi,maxProperties:Mi,minimum:Mi,multipleOf:Mi,not:u,pattern:Mi,propertyNames:u,readOnly:Mi,then:u,title:Mi,writeOnly:Mi,uniqueItems:Dd(b=>b===!1,rte),minLength:q7,minItems:q7,minProperties:q7,required:Dd(LH,o),enum:Dd(LH,i(c)),type:Mm((b,v)=>{const S=Array.isArray(b),C=Array.isArray(v);return!S&&!C?Hm(b,v):o(S?b:[b],C?v:[v])}),items:Dd(b=>!Array.isArray(b)&&Kl(b),W7(s,V7(s))),anyOf:p,allOf:p,oneOf:p,properties:d,patternProperties:d,additionalProperties:g,additionalItems:g,dependencies:Dd(fy,r(Mm(W7(s,o))))};return{compareSchemaValues:c,compareSchemaDefinitions:s}}function BH(e){return e}const ite=(e,t)=>e?ite(t%e,e):t,JRe=(e,t)=>Math.abs(e*t)/ite(e,t);function ZRe(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function*G7(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 K7(e,t){return e||t}function zH(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 QRe(e){const t=new Map;for(const n of e)for(const r of n[0])t.set(r,n[1]);return t}function sh(e,t,n){n===void 0||Kl(n)?delete e[t]:e[t]=n}const eIe=["properties","patternProperties","additionalProperties"];function HH(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 UH=[[],[]];function VH(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 tIe=["items","additionalItems"],nIe=["if","then","else"];function WH(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 Y7(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 ah(e,t,n){return[e,t,n]}function rIe(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 iIe=[ah("minimum","maximum",e=>e.maximum>=e.minimum),ah("exclusiveMinimum","maximum",e=>e.maximum>e.exclusiveMinimum),ah("minimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.minimum),ah("exclusiveMinimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.exclusiveMinimum),ah("minLength","maxLength",e=>e.maxLength>=e.minLength),ah("minItems","maxItems",e=>e.maxItems>=e.minItems),ah("minProperties","maxProperties",e=>e.maxProperties>=e.minProperties)];function oIe({mergePatterns:e=ZRe,isSubRegExp:t=Object.is,intersectJson:n=URe,deduplicateJsonSchemaDef:r=BH,defaultMerger:i=BH,assigners:o=[],checks:s=iIe,mergers:a}={}){function l(k){const E=k.length;let O=k[0];for(let _=1;_<E;_++){const T=S(O,k[_]);if(T===!1)return!1;Kl(T)||(O=T)}return O}function c(k,E,O,_,T,I,P){if(k.length=0,O===!1)return!1;if(k.push(O),T!==void 0){if(T===!1)return!1;k.push(T)}if(VH(k,E,I))return!1;const M=k.length<2;if(P===!1){if(M)return;if(VH(k,E,_))return!1}else M&&P!==void 0&&k.push(P);return k.length===1?k[0]:l(k)}function u(k,E,O,_,T,I){const P=O.length;if(P>0&&T!==!1)if(I)Object.assign(k,E);else for(let L=0;L<P;L++){const M=O[L];_.has(M)||(k[M]=S(E[M],T))}return k}const d=(k,{properties:E={},patternProperties:O,additionalProperties:_=!0},{properties:T={},patternProperties:I,additionalProperties:P=!0})=>{const L=Kl(_),M=Kl(P);if(L&&M)return sh(k,"properties",C(E,T)),sh(k,"patternProperties",O&&I?C(O,I):O??I),delete k.additionalProperties,k;const $=S(_,P);sh(k,"additionalProperties",$);const N={},z=Object.keys(E),F=z.length,[W,V]=O?HH(O):UH,[q,X]=I?HH(I):UH,B=[],U=new Set,Y=M?void 0:P;for(let ie=0;ie<F;ie++){const te=z[ie];U.add(te);const J=c(B,te,E[te],W,T[te],q,Y);J!==void 0&&(N[te]=J)}const H=Object.keys(T),G=H.length,Z=L?void 0:_;for(let ie=0;ie<G;ie++){const te=H[ie];if(U.has(te))continue;const J=c(B,te,T[te],q,void 0,W,Z);J!==void 0&&(N[te]=J)}sh(k,"properties",N);let oe={};const ee=new Set;if(V.length>0&&X.length>0){const ie=G7(V,X,(te,J)=>{t(te,J)&&ee.add(te),t(J,te)&&ee.add(J),oe[e(te,J)]=S(O[te],I[J])});for(;!ie.next().done;);}return oe=u(oe,O,V,ee,P,M),oe=u(oe,I,X,ee,_,L),sh(k,"patternProperties",oe),k},p=(k,{items:E=[],additionalItems:O},{items:_=[],additionalItems:T})=>{const I=Array.isArray(E),P=Array.isArray(_),L=[];if(k.items=L,I&&P){const[M,$,N]=E.length<_.length?[E.length,O,_]:[_.length,T,E];let z=0;for(;z<M;z++)L.push(S(E[z],_[z]));if($===!1)k.additionalItems=!1;else{const F=$===void 0||Kl($);for(;z<N.length;z++)L.push(F?N[z]:S(N[z],$));sh(k,"additionalItems",O!==void 0&&T!==void 0?S(O,T):O??T)}}else if(I||P){const[M,$,N]=I?[E,_,O]:[_,E,T];sh(k,"additionalItems",N&&S(N,$));for(let z=0;z<M.length;z++)L.push(S(M[z],$))}else delete k.additionalItems,k.items=S(E,_);return k},g=(k,E,O)=>{WH(k,E);const _=WH({},O);return k.allOf===void 0?k.allOf=[_]:k.allOf=k.allOf.concat(_),k};function y(k,E){return r(Array.from(G7(k,E,S)))}const b=QRe([[eIe,d],[tIe,p],[nIe,g],...o]),v=rIe(s);function S(k,E){if(k===!1||E===!1)return!1;if(Kl(k))return Kl(E)?!0:E;if(Kl(E))return k;let O={...k};const _=new Set,T=new Set,I=Object.keys(E),P=I.length;for(let L=0;L<P;L++){const M=I[L],$=E[M];if($===void 0)continue;const N=v.get(M);if(N!==void 0){const V=N.length;for(let q=0;q<V;q++){const X=N[q];k[X.oppositeKey]!==void 0&&T.add(X.check)}}const z=k[M];if(z===void 0){O[M]=$;continue}const F=b.get(M);if(F){_.add(F);continue}const W=w[M]??i;O[M]=W(z,$)}for(const L of _)O=L(O,k,E);for(const L of T)L(O);return O}const C=zH(S),w={$id:i,$ref:i,$schema:i,$comment:i,$defs:C,definitions:C,type:(k,E)=>{if(k===E)return k;const O=Array.isArray(k),_=Array.isArray(E);if(!O&&!_){const T=Y7(k,E);if(T!==void 0)return T}else if(O||_){const T=new Set;if(O&&_)for(const P of G7(k,E,Y7))P!==void 0&&T.add(P);else{const P=O?k:E,L=O?E:k,M=P.length;for(let $=0;$<M;$++){const N=Y7(L,P[$]);N!==void 0&&T.add(N)}}const I=T.size;if(I===1)return T.values().next().value;if(I>1)return Array.from(T)}throw new Error(`It is not possible to create an intersection of the following incompatible types: ${k.toString()}, ${E.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(k,E)=>{const O=r([k,E]);return O.length===1?O[0]:{anyOf:O}},pattern:e,readOnly:K7,writeOnly:K7,enum:(k,E)=>{const O=n(k,E);if(O.length===0)throw new Error(`Intersection of the following enums is empty: "${JSON.stringify(k)}", "${JSON.stringify(E)}"`);return O},anyOf:y,oneOf:y,allOf:(k,E)=>r(k.concat(E)),propertyNames:S,contains:S,dependencies:zH((k,E)=>Array.isArray(k)?Array.isArray(E)?U7(k,E):S(E,{required:k}):Array.isArray(E)?S(k,{required:E}):S(k,E)),examples:(k,E)=>{if(!Array.isArray(k)||!Array.isArray(E))throw new Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(k)}" and "${JSON.stringify(E)}"`);return U7(k,E)},multipleOf:(k,E)=>{let O=1;for(;!Number.isInteger(k)||!Number.isInteger(E);)O*=10,k*=10,E*=10;return JRe(k,E)/O},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:K7,required:U7,...a};return{mergeSchemaDefinitions:S,mergeArrayOfSchemaDefinitions:l}}function sIe(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 aIe(e){return t=>e(sIe(t))}var z1={},qH;function lIe(){if(qH)return z1;qH=1;var e=/~/,t=/~[01]/g;function n(c){switch(c){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+c)}function r(c){return e.test(c)?c.replace(t,n):c}function i(c,u,d){for(var p,g,y=1,b=u.length;y<b;){if(u[y]==="constructor"||u[y]==="prototype"||u[y]==="__proto__")return c;if(p=r(u[y++]),g=b>y,typeof c[p]>"u"&&(Array.isArray(c)&&p==="-"&&(p=c.length),g&&(u[y]!==""&&u[y]<1/0||u[y]==="-"?c[p]=[]:c[p]={})),!g)break;c=c[p]}var v=c[p];return d===void 0?delete c[p]:c[p]=d,v}function o(c){if(typeof c=="string"){if(c=c.split("/"),c[0]==="")return c;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(c)){for(const u of c)if(typeof u!="string"&&typeof u!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return c}throw new Error("Invalid JSON pointer.")}function s(c,u){if(typeof c!="object")throw new Error("Invalid input object.");u=o(u);var d=u.length;if(d===1)return c;for(var p=1;p<d;){if(c=c[r(u[p++])],d===p)return c;if(typeof c!="object"||c===null)return}}function a(c,u,d){if(typeof c!="object")throw new Error("Invalid input object.");if(u=o(u),u.length===0)throw new Error("Invalid JSON pointer for set.");return i(c,u,d)}function l(c){var u=o(c);return{get:function(d){return s(d,u)},set:function(d,p){return a(d,u,p)}}}return z1.get=s,z1.set=a,z1.compile=l,z1}var cIe=lIe();const X7=Ts(cIe);function uIe(e,t){return e&&gg(t,ll(t),e)}function dIe(e,t){return e&&gg(t,iv(t),e)}function fIe(e,t){return gg(e,FM(e),t)}var hIe=Object.getOwnPropertySymbols,ote=hIe?function(e){for(var t=[];e;)NM(t,FM(e)),e=pC(e);return t}:Dee;function pIe(e,t){return gg(e,ote(e),t)}function QM(e){return Aee(e,iv,ote)}var mIe=Object.prototype,gIe=mIe.hasOwnProperty;function yIe(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&gIe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function bIe(e,t){var n=t?XM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var vIe=/\w*$/;function xIe(e){var t=new e.constructor(e.source,vIe.exec(e));return t.lastIndex=e.lastIndex,t}var GH=Ha?Ha.prototype:void 0,KH=GH?GH.valueOf:void 0;function SIe(e){return KH?Object(KH.call(e)):{}}var wIe="[object Boolean]",CIe="[object Date]",EIe="[object Map]",kIe="[object Number]",AIe="[object RegExp]",DIe="[object Set]",_Ie="[object String]",OIe="[object Symbol]",TIe="[object ArrayBuffer]",MIe="[object DataView]",RIe="[object Float32Array]",IIe="[object Float64Array]",jIe="[object Int8Array]",PIe="[object Int16Array]",$Ie="[object Int32Array]",LIe="[object Uint8Array]",NIe="[object Uint8ClampedArray]",FIe="[object Uint16Array]",BIe="[object Uint32Array]";function zIe(e,t,n){var r=e.constructor;switch(t){case TIe:return XM(e);case wIe:case CIe:return new r(+e);case MIe:return bIe(e,n);case RIe:case IIe:case jIe:case PIe:case $Ie:case LIe:case NIe:case FIe:case BIe:return Kee(e,n);case EIe:return new r;case kIe:case _Ie:return new r(e);case AIe:return xIe(e);case DIe:return new r;case OIe:return SIe(e)}}var HIe="[object Map]";function UIe(e){return Ua(e)&&Aa(e)==HIe}var YH=j0&&j0.isMap,VIe=YH?zM(YH):UIe,WIe="[object Set]";function qIe(e){return Ua(e)&&Aa(e)==WIe}var XH=j0&&j0.isSet,GIe=XH?zM(XH):qIe,KIe=1,YIe=2,XIe=4,ste="[object Arguments]",JIe="[object Array]",ZIe="[object Boolean]",QIe="[object Date]",eje="[object Error]",ate="[object Function]",tje="[object GeneratorFunction]",nje="[object Map]",rje="[object Number]",lte="[object Object]",ije="[object RegExp]",oje="[object Set]",sje="[object String]",aje="[object Symbol]",lje="[object WeakMap]",cje="[object ArrayBuffer]",uje="[object DataView]",dje="[object Float32Array]",fje="[object Float64Array]",hje="[object Int8Array]",pje="[object Int16Array]",mje="[object Int32Array]",gje="[object Uint8Array]",yje="[object Uint8ClampedArray]",bje="[object Uint16Array]",vje="[object Uint32Array]",Pr={};Pr[ste]=Pr[JIe]=Pr[cje]=Pr[uje]=Pr[ZIe]=Pr[QIe]=Pr[dje]=Pr[fje]=Pr[hje]=Pr[pje]=Pr[mje]=Pr[nje]=Pr[rje]=Pr[lte]=Pr[ije]=Pr[oje]=Pr[sje]=Pr[aje]=Pr[gje]=Pr[yje]=Pr[bje]=Pr[vje]=!0;Pr[eje]=Pr[ate]=Pr[lje]=!1;function By(e,t,n,r,i,o){var s,a=t&KIe,l=t&YIe,c=t&XIe;if(n&&(s=i?n(e,r,i,o):n(e)),s!==void 0)return s;if(!Qn(e))return e;var u=Wi(e);if(u){if(s=yIe(e),!a)return JM(e,s)}else{var d=Aa(e),p=d==ate||d==tje;if(tp(e))return Gee(e,a);if(d==lte||d==ste||p&&!i){if(s=l||p?{}:Yee(e),!a)return l?pIe(e,dIe(s,e)):fIe(e,uIe(s,e))}else{if(!Pr[d])return i?e:{};s=zIe(e,d,a)}}o||(o=new bl);var g=o.get(e);if(g)return g;o.set(e,s),GIe(e)?e.forEach(function(v){s.add(By(v,t,n,v,e,o))}):VIe(e)&&e.forEach(function(v,S){s.set(S,By(v,t,n,S,e,o))});var y=c?l?QM:e_:l?iv:ll,b=u?void 0:y(e);return KM(b||e,function(v,S){b&&(S=v,v=e[S]),qM(s,S,By(v,t,n,S,e,o))}),s}function cte(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function xje(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 Sje(e,t){return t.length<2?e:vC(e,xje(t,0,-1))}var wje=Object.prototype,Cje=wje.hasOwnProperty;function ute(e,t){t=mg(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__"&&!Cje.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=Sje(e,t);return s==null||delete s[bp(cte(t))]}function Eje(e){return gf(e)?void 0:e}function s_(e){var t=e==null?0:e.length;return t?ov(e,1):[]}function dte(e){return Zee(Jee(e,void 0,s_),e+"")}var kje=1,Aje=2,Dje=4,P2=dte(function(e,t){var n={};if(e==null)return n;var r=!1;t=pg(t,function(o){return o=mg(o,e),r||(r=o.length>1),o}),gg(e,QM(e),n),r&&(n=By(n,kje|Aje|Dje,Eje));for(var i=t.length;i--;)ute(n,t[i]);return n}),H1={exports:{}},J7,JH;function fte(){if(JH)return J7;JH=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(p){let g="",y=0,b=0;for(b=0;b<p.length;b++)if(y=p[b].charCodeAt(0),y!==48){if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=p[b];break}for(b+=1;b<p.length;b++){if(y=p[b].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=p[b]}return g}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(p){return p.length=0,!0}function o(p,g,y){if(p.length){const b=n(p);if(b!=="")g.push(b);else return y.error=!0,!1;p.length=0}return!0}function s(p){let g=0;const y={error:!1,address:"",zone:""},b=[],v=[];let S=!1,C=!1,w=o;for(let k=0;k<p.length;k++){const E=p[k];if(!(E==="["||E==="]"))if(E===":"){if(S===!0&&(C=!0),!w(v,b,y))break;if(++g>7){y.error=!0;break}k>0&&p[k-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(p){if(l(p,":")<2)return{host:p,isIPV6:!1};const g=s(p);if(g.error)return{host:p,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(p,g){let y=0;for(let b=0;b<p.length;b++)p[b]===g&&y++;return y}function c(p){let g=p;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 u(p,g){const y=g!==!0?escape:unescape;return p.scheme!==void 0&&(p.scheme=y(p.scheme)),p.userinfo!==void 0&&(p.userinfo=y(p.userinfo)),p.host!==void 0&&(p.host=y(p.host)),p.path!==void 0&&(p.path=y(p.path)),p.query!==void 0&&(p.query=y(p.query)),p.fragment!==void 0&&(p.fragment=y(p.fragment)),p}function d(p){const g=[];if(p.userinfo!==void 0&&(g.push(p.userinfo),g.push("@")),p.host!==void 0){let y=unescape(p.host);if(!t(y)){const b=a(y);b.isIPV6===!0?y=`[${b.escapedHost}]`:y=p.host}g.push(y)}return(typeof p.port=="number"||typeof p.port=="string")&&(g.push(":"),g.push(String(p.port))),g.length?g.join(""):void 0}return J7={nonSimpleDomain:r,recomposeAuthority:d,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:n},J7}var Z7,ZH;function _je(){if(ZH)return Z7;ZH=1;const{isUUID:e}=fte(),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 O=String(E.scheme).toLowerCase()==="https";return(E.port===(O?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[O,_]=E.resourceName.split("?");E.path=O&&O!=="/"?O:void 0,E.query=_,E.resourceName=void 0}return E.fragment=void 0,E}function c(E,O){if(!E.path)return E.error="URN can not be parsed",E;const _=E.path.match(t);if(_){const T=O.scheme||E.scheme||"urn";E.nid=_[1].toLowerCase(),E.nss=_[2];const I=`${T}:${O.nid||E.nid}`,P=k(I);E.path=void 0,P&&(E=P.parse(E,O))}else E.error=E.error||"URN can not be parsed.";return E}function u(E,O){if(E.nid===void 0)throw new Error("URN without nid cannot be serialized");const _=O.scheme||E.scheme||"urn",T=E.nid.toLowerCase(),I=`${_}:${O.nid||T}`,P=k(I);P&&(E=P.serialize(E,O));const L=E,M=E.nss;return L.path=`${T||O.nid}:${M}`,O.skipEscape=!0,L}function d(E,O){const _=E;return _.uuid=_.nss,_.nss=void 0,!O.tolerant&&(!_.uuid||!e(_.uuid))&&(_.error=_.error||"UUID is not valid."),_}function p(E){const O=E;return O.nss=(E.uuid||"").toLowerCase(),O}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:c,serialize:u,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:d,serialize:p,skipNormalize:!0}};Object.setPrototypeOf(w,null);function k(E){return E&&(w[E]||w[E.toLowerCase()])||void 0}return Z7={wsIsSecure:i,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:k},Z7}var QH;function hte(){if(QH)return H1.exports;QH=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:i,nonSimpleDomain:o}=fte(),{SCHEMES:s,getSchemeHandler:a}=_je();function l(v,S){return typeof v=="string"?v=p(y(v,S),S):typeof v=="object"&&(v=y(p(v,S),S)),v}function c(v,S,C){const w=C?Object.assign({scheme:"null"},C):{scheme:"null"},k=u(y(v,w),y(S,w),w,!0);return w.skipEscape=!0,p(k,w)}function u(v,S,C,w){const k={};return w||(v=y(p(v,C),C),S=y(p(S,C),C)),C=C||{},!C.tolerant&&S.scheme?(k.scheme=S.scheme,k.userinfo=S.userinfo,k.host=S.host,k.port=S.port,k.path=t(S.path||""),k.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(k.userinfo=S.userinfo,k.host=S.host,k.port=S.port,k.path=t(S.path||""),k.query=S.query):(S.path?(S.path[0]==="/"?k.path=t(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?k.path="/"+S.path:v.path?k.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:k.path=S.path,k.path=t(k.path)),k.query=S.query):(k.path=v.path,S.query!==void 0?k.query=S.query:k.query=v.query),k.userinfo=v.userinfo,k.host=v.host,k.port=v.port),k.scheme=v.scheme),k.fragment=S.fragment,k}function d(v,S,C){return typeof v=="string"?(v=unescape(v),v=p(r(y(v,C),!0),{...C,skipEscape:!0})):typeof v=="object"&&(v=p(r(v,!0),{...C,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=p(r(y(S,C),!0),{...C,skipEscape:!0})):typeof S=="object"&&(S=p(r(S,!0),{...C,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function p(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),k=[],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&&k.push(C.scheme,":");const O=n(C);if(O!==void 0&&(w.reference!=="suffix"&&k.push("//"),k.push(O),C.path&&C.path[0]!=="/"&&k.push("/")),C.path!==void 0){let _=C.path;!w.absolutePath&&(!E||!E.absolutePath)&&(_=t(_)),O===void 0&&_[0]==="/"&&_[1]==="/"&&(_="/%2F"+_.slice(2)),k.push(_)}return C.query!==void 0&&k.push("?",C.query),C.fragment!==void 0&&k.push("#",C.fragment),k.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 k=!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(),k=T.isIPV6}else k=!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 O=a(C.scheme||w.scheme);if(!C.unicodeSupport&&(!O||!O.unicodeSupport)&&w.host&&(C.domainHost||O&&O.domainHost)&&k===!1&&o(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(_){w.error=w.error||"Host's domain name can not be converted to ASCII: "+_}(!O||O&&!O.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)))),O&&O.parse&&O.parse(w,C)}else w.error=w.error||"URI can not be parsed.";return w}const b={SCHEMES:s,normalize:l,resolve:c,resolveComponent:u,equal:d,serialize:p,parse:y};return H1.exports=b,H1.exports.default=b,H1.exports.fastUri=b,H1.exports}var Oje=hte();const eR=Ts(Oje);function VS(e,t){if(kr in e&&eR.equal(e[kr],t))return e;for(const n of Object.values(e))if(Array.isArray(n)){for(const r of n)if(Qn(r)){const i=VS(r,t);if(i!==void 0)return i}}else if(Qn(n)){const r=VS(n,t);if(r!==void 0)return r}}function a_(e,t){const n=Xe(e,kr,t);Ar in e&&(e={...e,[Ar]:eR.resolve(n,e[Ar])});for(const[r,i]of Object.entries(e))Array.isArray(i)?e={...e,[r]:i.map(o=>Qn(o)?a_(o,n):o)}:Qn(i)&&(e={...e,[r]:a_(i,n)});return e}function tR(e,t){const n=t[e];return[P2(t,[e]),n]}function pte(e,t={},n=[],r=Xe(t,[kr])){const i=e||"";let o;if(i.startsWith("#")){const a=decodeURIComponent(i.substring(1));r===void 0||kr in t&&t[kr]===r?o=X7.get(t,a):t[dy]===k4&&(o=VS(t,r.replace(/\/$/,"")),o!==void 0&&(o=X7.get(o,a)))}else if(t[dy]===k4){const a=r?eR.resolve(r,i):i,[l,...c]=a.replace(/#\/?$/,"").split("#");o=VS(t,l.replace(/\/$/,"")),o!==void 0&&(r=o[kr],ki(c)||(o=X7.get(o,decodeURIComponent(c.join("#")))))}if(o===void 0)throw new Error(`Could not find a definition for ${e}.`);const s=o[Ar];if(s){if(n.includes(s)){if(n.length===1)throw new Error(`Definition for ${e} is a circular reference`);const[u,...d]=n,p=[...d,i,u].join(" -> ");throw new Error(`Definition for ${u} contains a circular reference through ${p}`)}const[a,l]=tR(Ar,o),c=pte(l,t,[...n,i],r);return Object.keys(a).length>0?t[dy]===V_e||t[dy]===k4?{[zu]:[a,c]}:{...a,...c}:c}return o}function nR(e,t={},n=Xe(t,[kr])){return pte(e,t,[],n)}var Tje="[object String]";function yf(e){return typeof e=="string"||!Wi(e)&&Ua(e)&&Yu(e)==Tje}function Oc(e){let t;const n=Xe(e,B_e);return yf(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function $2(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 Mje=SC(function(e){return ete(ov(e,1,j2,!0))});function Cl(e){let{type:t}=e;return!t&&e.const?$2(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 Hu(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&&En(s)?r[i]=Hu(o,s):e&&t&&(Cl(e)==="object"||Cl(t)==="object")&&i===gee&&Array.isArray(o)&&Array.isArray(s)?r[i]=Mje(o,s):r[i]=s,r},n)}var Rje="[object Number]";function mte(e){return typeof e=="number"||Ua(e)&&Yu(e)==Rje}function gte(e,t,n){var r;if(e&&n){const i=Xe(e,n);if(i===void 0)return;for(let o=0;o<t.length;o++){const s=t[o],a=Xe(s,[nr,n],{});if(!(a.type==="object"||a.type==="array")&&(a.const===i||!((r=a.enum)===null||r===void 0)&&r.includes(i)))return o}}}function rR(e,t,n,r,i){if(t===void 0)return 0;const o=gte(t,n,i);if(mte(o))return o;for(let s=0;s<n.length;s++){const a=n[s];if(i&&Un(a,[nr,i])){const l=Xe(t,i),c=Xe(a,[nr,i],{});if(e.isValid(c,l,r))return s}else if(a[nr]){const l={anyOf:Object.keys(a[nr]).map(u=>({required:[u]}))};let c;if(a.anyOf){const{...u}=a;u.allOf?u.allOf=u.allOf.slice():u.allOf=[],u.allOf.push(l),c=u}else c=Object.assign({},a,l);if(delete c.required,e.isValid(c,t,r))return s}else if(e.isValid(a,t,r))return s}return 0}function ko(e,t,n={},r,i,o=!1){return cc(e,t,n,r,void 0,void 0,i,o)[0]}function Ije(e,t,n,r,i,o,s){const{if:a,then:l,else:c,...u}=t,d=e.isValid(a,o||{},n);let p=[u],g=[];if(r)l&&typeof l!="boolean"&&(g=g.concat(cc(e,l,n,o,r,i,s))),c&&typeof c!="boolean"&&(g=g.concat(cc(e,c,n,o,r,i,s)));else{const y=d?l:c;y&&typeof y!="boolean"&&(g=g.concat(cc(e,y,n,o,r,i,s)))}return g.length&&(p=g.map(y=>Hu(u,y))),p.flatMap(y=>cc(e,y,n,o,r,i,s))}function yte(e){return e.reduce((n,r)=>r.length>1?r.flatMap(i=>Fee(n.length,o=>[...n[o]].concat(i))):(n.forEach(i=>i.push(r[0])),n),[[]])}function bte(e,t){return Object.keys(e.patternProperties).filter(n=>RegExp(n).test(t)).reduce((n,r)=>(xr(n,[r],e.patternProperties[r]),n),{})}function jje(e,t,n,r,i,o,s,a){const l=vte(e,t,n,r,i,o,s,a);if(l.length>1||l[0]!==t)return l;if(IM in t)return xte(e,t,n,r,i,o,s).flatMap(u=>cc(e,u,n,o,r,i,s));if(zu in t&&Array.isArray(t[zu])){const c=t.allOf.map(d=>cc(e,d,n,o,r,i,s));return yte(c).map(d=>({...t,allOf:d}))}return[t]}function vte(e,t,n,r,i,o,s,a){const l=s0(t,n,i,void 0,a);return l!==t?cc(e,l,n,o,r,i,s,a):[t]}function s0(e,t,n,r,i){if(!En(e))return e;let o=e;if(Ar in o){const{$ref:s,...a}=o;if(n.includes(s))return o;n.push(s),o={...nR(s,t,r),...a},kr in o&&(r=o[kr])}if(nr in o){const s=[],a=aRe(o[nr],(l,c,u)=>{const d=[...n];l[u]=s0(c,t,d,r,i),s.push(d)},{});ERe(n,tte(DRe(s))),o={...o,[nr]:a}}if(Zh in o&&!Array.isArray(o.items)&&typeof o.items!="boolean"&&(o={...o,items:s0(o.items,t,n,r,i)}),i){let s,a;Vn in e&&Array.isArray(e[Vn])?(s=Vn,a=o[Vn]):gn in e&&Array.isArray(e[gn])&&(s=gn,a=o[gn]),s&&a&&(o={...o,[s]:a.map(l=>s0(l,t,n,r,i))})}return Lr(e,o)?e:o}function Pje(e,t,n,r,i){const o={...t,properties:{...t.properties}},s=r&&En(r)?r:{};return Object.keys(s).forEach(a=>{if(!(a in o.properties)){if(JD in o){const l=bte(o,a);if(!ki(l)){o.properties[a]=ko(e,{[zu]:Object.values(l)},n,Xe(s,[a]),i),xr(o.properties,[a,Ru],!0);return}}if(O2 in o&&o.additionalProperties!==!1){let l;typeof o.additionalProperties!="boolean"?Ar in o.additionalProperties?l=ko(e,{[Ar]:Xe(o.additionalProperties,[Ar])},n,s,i):"type"in o.additionalProperties?l={...o.additionalProperties}:Vn in o.additionalProperties||gn in o.additionalProperties?l={type:"object",...o.additionalProperties}:l={type:$2(Xe(s,[a]))}:l={type:$2(Xe(s,[a]))},o.properties[a]=l,xr(o.properties,[a,Ru],!0)}else o.properties[a]={type:"null"},xr(o.properties,[a,Ru],!0)}}),o}const{compareSchemaDefinitions:$je,compareSchemaValues:Lje}=XRe(),{mergeArrayOfSchemaDefinitions:Nje}=oIe({intersectJson:VRe(Lje),deduplicateJsonSchemaDef:nte($je)}),Fje=aIe(Nje);function Bje(e){return Fje(e)}function cc(e,t,n,r,i=!1,o=[],s,a){return En(t)?jje(e,t,n,i,o,r,s,a).flatMap(c=>{var u;let d=c;if(jM in d)return Ije(e,d,n,i,o,r,s);if(zu in d){if(i){const{allOf:g,...y}=d;return[...g,y]}try{const g=[],y=[];(u=d.allOf)===null||u===void 0||u.forEach(b=>{typeof b=="object"&&b.contains?g.push(b):y.push(b)}),g.length&&(d={...d,allOf:y}),d=s?s(d):Bje(d),g.length&&(d.allOf=g)}catch(g){console.warn(`could not merge subschemas in allOf:
223
+ `));return this.store.update({itemMetaLookup:vt({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:vt({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=vt({},this.store.state.itemMetaLookup),r=vt({},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=vt({},r);return delete i[t],i})});setJSXItemsOrderedChildrenIds=(t,n)=>{const r=t??yl;this.store.update({itemOrderedChildrenIdsLookup:vt({},this.store.state.itemOrderedChildrenIdsLookup,{[r]:n}),itemChildrenIndexesLookup:vt({},this.store.state.itemChildrenIndexesLookup,{[r]:HQ(n)})})}}const Ske={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class wke extends mke{jsxItems=new xke(this);constructor(t){super(vt({},t,{items:WD}),"SimpleTreeView",Ske)}updateStateFromParameters(t){super.updateStateFromParameters(vt({},t,{items:WD}))}}const Cke=LQ(),Eke=e=>{const{classes:t}=e;return A.useMemo(()=>tt({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},_7e,t),[t])},kke=ge("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),Ake=A.forwardRef(function(t,n){const r=Cke({props:t,name:"MuiSimpleTreeView"}),{slots:i,slotProps:o,apiRef:s,parameters:a,forwardedProps:l}=I7e(r),c=rke(wke,a),u=A.useRef(null),d=RS(n,u),p=Z7e(c,l,d),g=Eke(r),y=i?.root??kke,b=Mr({elementType:y,externalSlotProps:o?.root,className:g.root,getSlotProps:p,ownerState:r});return h.jsx(M7e,{store:c,classes:g,slots:i,slotProps:o,apiRef:s,rootRef:u,children:h.jsx(YQ,{itemId:null,idAttribute:null,children:h.jsx(PS.Provider,{value:0,children:h.jsx(y,vt({},b))})})})}),Dke=(e,t,n)=>typeof n=="function"?n(e,t):n,_ke=e=>{const{runItemPlugins:t,publicAPI:n,store:r}=dg(),i=A.useContext(PS),o=ri(r,Dke,e.itemId,i),{id:s,itemId:a,label:l,children:c,rootRef:u}=e,{rootRef:d,contentRef:p,propsEnhancers:g}=t(e),{interactions:y,status:b}=yke({itemId:a,children:c}),v=A.useRef(null),S=A.useRef(null),C=RS(u,d,v),w=RS(p,S),k=A.useRef(null),E=ri(r,tr.isCheckboxSelectionEnabled),O=ri(r,Jb.treeItemIdAttribute,a,s),_=ri(r,wh.isItemTheDefaultFocusableItem,a),T={rootRefObject:v,contentRefObject:S,interactions:y},I=oe=>ee=>{oe.onFocus?.(ee),!ee.defaultMuiPrevented&&!b.focused&&Mt.canItemBeFocused(r.state,a)&&ee.currentTarget===ee.target&&r.focus.focusItem(ee,a)},P=oe=>ee=>{if(oe.onBlur?.(ee),ee.defaultMuiPrevented)return;const ie=r.items.getItemDOMElement(a);b.editing||ee.relatedTarget&&GD(ee.relatedTarget,ie)&&(ee.target&&ee.target?.dataset?.element==="labelInput"&&GD(ee.target,ie)||ee.relatedTarget?.dataset?.element==="labelInput")||r.focus.removeFocusedItem()},L=oe=>ee=>{oe.onKeyDown?.(ee),!(ee.defaultMuiPrevented||ee.target?.dataset?.element==="labelInput")&&r.keyboardNavigation.handleItemKeyDown(ee,a)},M=oe=>ee=>{oe.onDoubleClick?.(ee),!ee.defaultMuiPrevented&&y.toggleItemEditing()},$=oe=>ee=>{oe.onClick?.(ee),r.items.handleItemClick(ee,a),!(ee.defaultMuiPrevented||k.current?.contains(ee.target))&&(xi.triggerSlot(r.state)==="content"&&y.handleExpansion(ee),E||y.handleSelection(ee))},N=oe=>ee=>{oe.onMouseDown?.(ee),!ee.defaultMuiPrevented&&(ee.shiftKey||ee.ctrlKey||ee.metaKey||b.disabled)&&ee.preventDefault()},z=oe=>ee=>{oe.onClick?.(ee),!ee.defaultMuiPrevented&&xi.triggerSlot(r.state)==="iconContainer"&&y.handleExpansion(ee)};return{getContextProviderProps:()=>({itemId:a,id:s}),getRootProps:(oe={})=>{const ee=vt({},no(e),no(oe)),ie=vt({},ee,{ref:C,role:"treeitem",tabIndex:_?0:-1,id:O,"aria-expanded":b.expandable?b.expanded:void 0,"aria-disabled":b.disabled||void 0},oe,{style:vt({},oe.style??{},{"--TreeView-itemDepth":o}),onFocus:I(ee),onBlur:P(ee),onKeyDown:L(ee)}),te=g.root?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},ie,te)},getContentProps:(oe={})=>{const ee=no(oe),ie=vt({},ee,oe,{ref:w,onClick:$(ee),onMouseDown:N(ee),status:b});["expanded","selected","focused","disabled","editing","editable"].forEach(J=>{b[J]&&(ie[`data-${J}`]="")});const te=g.content?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},ie,te)},getGroupTransitionProps:(oe={})=>{const ee=no(oe);return vt({},ee,{unmountOnExit:!0,component:"ul",role:"group",in:b.expanded,children:c},oe)},getIconContainerProps:(oe={})=>{const ee=no(oe);return vt({},ee,oe,{onClick:z(ee)})},getCheckboxProps:(oe={})=>{const ee=no(oe),ie=vt({},ee,{ref:k,"aria-hidden":!0},oe),te=g.checkbox?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},ie,te)},getLabelProps:(oe={})=>{const ee=vt({},no(oe)),ie=vt({},ee,{children:l},oe,{onDoubleClick:M(ee)}),te=g.label?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},te,ie)},getLabelInputProps:(oe={})=>{const ee=no(oe),ie=g.labelInput?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},oe,ie)},getDragAndDropOverlayProps:(oe={})=>{const ee=no(oe),ie=g.dragAndDropOverlay?.(vt({},T,{externalEventHandlers:ee}))??{};return vt({},oe,ie)},getErrorContainerProps:(oe={})=>{const ee=no(oe);return vt({},ee,oe)},getLoadingContainerProps:(oe={})=>{const ee=no(oe);return vt({size:"12px",thickness:6},ee,oe)},rootRef:C,status:b,publicAPI:n}};function Oke(e){return et("MuiTreeItem",e)}it("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const Tke=Ee(h.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),Mke=Ee(h.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),Rke=["ownerState"];function I7(e,t,n){return e!==void 0?e:t!==void 0?t:n}function Ike(e){const{slots:t,slotProps:n,status:r}=e,{slots:i,slotProps:o}=BQ(),s={collapseIcon:I7(t?.collapseIcon,i.collapseIcon,Mke),expandIcon:I7(t?.expandIcon,i.expandIcon,Tke),endIcon:I7(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],c=Mr({elementType:l,externalSlotProps:d=>vt({},pS(o[a],d),pS(n?.[a],d)),ownerState:{}}),u=pp(c,Rke);return l?h.jsx(l,vt({},u)):null}const jke=ge("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>n0(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})`:ac(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 Pke(e){return e.action==null?null:h.jsx(jke,vt({},e))}function $ke(e){const{children:t,itemId:n,id:r}=e,{wrapItem:i,store:o}=dg(),s=ri(o,Jb.treeItemIdAttribute,n,r);return h.jsx(A.Fragment,{children:i({children:t,itemId:n,store:o,idAttribute:s})})}const Lke=ge("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>vt({},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}`}})),Nke=["visible"],Fke=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],Bke=LQ(),zke=ge("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),Hke=ge("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>n0(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})`:ac(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}))`:ac(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})`:ac(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}))`:ac(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),Uke=ge("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>n0(e)&&e!=="editable"})(({theme:e})=>vt({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),Vke=ge("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),Wke=ge(ia,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),qke=ge("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),Gke=ge(Jn,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),Kke=ge(A.forwardRef((e,t)=>{const{visible:n}=e,r=pp(e,Nke);return n?h.jsx(xs,vt({},r,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),Yke=e=>{const{classes:t}=BQ(),n=vt({},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 tt({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"]},Oke,n)},Xke=A.forwardRef(function(t,n){const r=Bke({props:t,name:"MuiTreeItem"}),{id:i,itemId:o,label:s,disabled:a,disableSelection:l,children:c,slots:u={},slotProps:d={},classes:p}=r,g=pp(r,Fke),{getContextProviderProps:y,getRootProps:b,getContentProps:v,getIconContainerProps:S,getCheckboxProps:C,getLabelProps:w,getGroupTransitionProps:k,getLabelInputProps:E,getDragAndDropOverlayProps:O,getErrorContainerProps:_,getLoadingContainerProps:T,status:I}=_ke({id:i,itemId:o,children:c,label:s,disabled:a,disableSelection:l}),P=Yke(p),L=u.root??zke,M=Mr({elementType:L,getSlotProps:b,externalForwardedProps:g,externalSlotProps:d.root,additionalProps:{ref:n},ownerState:{},className:P.root}),$=u.content??Hke,N=Mr({elementType:$,getSlotProps:v,externalSlotProps:d.content,ownerState:{},className:Oe(P.content,I.expanded&&P.expanded,I.selected&&P.selected,I.focused&&P.focused,I.disabled&&P.disabled,I.editing&&P.editing,I.editable&&P.editable)}),z=u.iconContainer??Vke,F=Mr({elementType:z,getSlotProps:S,externalSlotProps:d.iconContainer,ownerState:{},className:P.iconContainer}),W=u.label??Uke,V=Mr({elementType:W,getSlotProps:w,externalSlotProps:d.label,ownerState:{},className:P.label}),q=u.checkbox??Kke,X=Mr({elementType:q,getSlotProps:C,externalSlotProps:d.checkbox,ownerState:{},className:P.checkbox}),B=u.groupTransition??void 0,U=Mr({elementType:B,getSlotProps:k,externalSlotProps:d.groupTransition,ownerState:{},className:P.groupTransition}),Y=u.labelInput??Lke,H=Mr({elementType:Y,getSlotProps:E,externalSlotProps:d.labelInput,ownerState:{},className:P.labelInput}),G=u.dragAndDropOverlay??Pke,Z=Mr({elementType:G,getSlotProps:O,externalSlotProps:d.dragAndDropOverlay,ownerState:{},className:P.dragAndDropOverlay}),oe=u.errorIcon??qke,ee=Mr({elementType:oe,getSlotProps:_,externalSlotProps:d.errorIcon,ownerState:{},className:P.errorIcon}),ie=u.loadingIcon??Gke,te=Mr({elementType:ie,getSlotProps:T,externalSlotProps:d.loadingIcon,ownerState:{},className:P.loadingIcon});return h.jsx($ke,vt({},y(),{children:h.jsxs(L,vt({},M,{children:[h.jsxs($,vt({},N,{children:[h.jsxs(z,vt({},F,{children:[I.error&&h.jsx(oe,vt({},ee)),I.loading?h.jsx(ie,vt({},te)):h.jsx(Ike,{status:I,slots:u,slotProps:d})]})),h.jsx(q,vt({},X)),I.editing?h.jsx(Y,vt({},H)):h.jsx(W,vt({},V)),h.jsx(G,vt({},Z))]})),c&&h.jsx(Wke,vt({as:B},U))]}))}))}),JQ=Ee(h.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"})),rC=Ee(h.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"})),Jke=Ee(h.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"})),yM=Ee(h.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"})),Zke=Ee(h.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"})),Qke=Ee(h.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"})),iC=Ee(h.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"})),Tu=Ee(h.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"})),ZQ=Ee(h.jsx("path",{d:"M14 6v15H3v-2h2V3h9v1h5v15h2v2h-4V6zm-4 5v2h2v-2z"})),eAe=Ee(h.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"})),S4=Ee(h.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"})),oC=Ee(h.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"})),sC=Ee(h.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"})),tAe=Ee(h.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"})),nAe=Ee(h.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"})),bM=Ee(h.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"})),rAe=Ee([h.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"),h.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")]),iAe=({endpoint:e})=>{const t=A.useMemo(()=>{switch(e.type.name){case"RootNode":return h.jsx(yM,{});case"Aggregator":return h.jsx(Zke,{});case"OnOffPlugInUnit":return h.jsx(tAe,{});case"OnOffLight":case"ExtendedColorLight":case"ColorTemperatureLight":case"DimmableLight":return h.jsx(iC,{});case"TemperatureSensor":return h.jsx(sC,{});case"Thermostat":return h.jsx(JQ,{});case"Fan":return h.jsx(rAe,{});case"OnOffSensor":return h.jsx(Jke,{});case"HumiditySensor":return h.jsx(bM,{});case"WindowCovering":return h.jsx(rC,{});case"DoorLock":return h.jsx(Tu,{});case"OccupancySensor":return h.jsx(eAe,{});case"ContactSensor":return h.jsx(ZQ,{});case"WaterLeakDetector":return h.jsx(nAe,{});case"Speaker":return h.jsx(oC,{});case"RoboticVacuumCleaner":return h.jsx(S4,{});default:return h.jsx(Qke,{})}},[e]);return h.jsx(Nt,{title:`${e.type.name} (${e.type.id})`,children:t})},oAe=e=>{const[t,n]=A.useState(()=>aAe(e.endpoint)),r=i=>{let o;i&&(o=lAe(i,e.endpoint)),e.onSelected(o)};return h.jsx(Ake,{expandedItems:t,onExpandedItemsChange:(i,o)=>n(o),onSelectedItemsChange:(i,o)=>r(o),children:h.jsx(QQ,{endpoint:e.endpoint,sortBy:e.sortBy})})},QQ=e=>{const t=A.useMemo(()=>{const n=[...e.endpoint.parts];switch(e.sortBy){case"name":return n.sort((r,i)=>{const o=ta(r.state)??r.id.local,s=ta(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 h.jsx(Xke,{itemId:e.endpoint.id.global,label:h.jsx(sAe,{endpoint:e.endpoint}),children:t.map(n=>h.jsx(QQ,{endpoint:n,sortBy:e.sortBy},n.id.global))})},sAe=e=>{const{t}=on(),n=A.useMemo(()=>{const i=e.endpoint.state.homeAssistantEntity?.entity?.state?.state;return i==="unavailable"||i==="unknown"},[e.endpoint.state]);return h.jsxs(ae,{display:"flex",alignItems:"center",children:[h.jsx(iAe,{endpoint:e.endpoint}),h.jsx(ae,{marginLeft:1,component:"span",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",sx:n?{opacity:.6}:void 0,children:h.jsx(O8e,{endpoint:e.endpoint})}),n&&h.jsx(Nt,{title:t("endpoints.entityUnavailable"),children:h.jsx(Bu,{color:"warning",sx:{fontSize:16,ml:.5,flexShrink:0}})})]})};function aAe(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 lAe(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 w4=e=>{const t=e.parts??[];return t.length===0?[e]:t.flatMap(n=>w4(n))},cAe=e=>{const{t}=on(),[n,r]=A.useState(void 0),[i,o]=A.useState("name"),[s,a]=A.useState("cards"),[l,c]=A.useState(""),[u,d]=A.useState(!1),[p,g]=A.useState(!1),[y,b]=A.useState(!1),[v,S]=A.useState(""),[C,w]=A.useState(),[k,E]=A.useState({open:!1,message:"",severity:"success"}),[O,_]=A.useState({}),T=A.useMemo(()=>{const W=w4(e.endpoint),V=[];for(const q of W){const B=q.state.homeAssistantEntity?.entity?.entity_id;B&&V.push(B)}return V},[e.endpoint]),I=A.useCallback(()=>{T.length!==0&&MQ(T).then(_).catch(()=>{})},[T]);A.useEffect(()=>{I()},[I]);const P=A.useCallback(()=>{I()},[I]),L=A.useCallback(async(W,V)=>{if(V){S(W);try{const X=(await dM(V)).mappings.find(B=>B.entityId===W);w(X)}catch{w(void 0)}b(!0)}},[]),M=A.useCallback(async W=>{if(!(!e.bridgeId||!v))try{await fM(e.bridgeId,v,W),E({open:!0,message:`Mapping saved for ${v}. Restart the bridge to apply changes.`,severity:"success"}),b(!1),e.onMappingSaved?.()}catch(V){E({open:!0,message:`Failed to save mapping: ${V}`,severity:"error"})}},[e.bridgeId,v,e.onMappingSaved]),$=A.useCallback(W=>{const q=W.state.homeAssistantEntity?.entity?.state?.state;return q==="unavailable"||q==="unknown"},[]),N=A.useMemo(()=>w4(e.endpoint).filter($).length,[e.endpoint,$]),z=A.useMemo(()=>[...w4(e.endpoint).filter(q=>{if(p&&!$(q))return!1;const X=ta(q.state)??q.id.local,B=q.type.name,U=l.toLowerCase();return X.toLowerCase().includes(U)||B.toLowerCase().includes(U)})].sort((q,X)=>{const B=ta(q.state)??q.id.local,U=ta(X.state)??X.id.local;switch(i){case"name":return B.localeCompare(U);case"endpoint":return q.id.local.localeCompare(X.id.local);case"type":return q.type.name.localeCompare(X.type.name);default:return 0}}),[e.endpoint,l,i,p,$]),F=W=>{r(W),d(!0)};return h.jsxs(ae,{children:[h.jsxs(ae,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,gap:2,flexWrap:"wrap",children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:2,children:[h.jsxs(re,{variant:"h6",component:"span",children:[t("endpoints.title")," (",z.length,")"]}),h.jsx(Nt,{title:t("endpoints.viewAll"),children:h.jsx(Wt,{component:Dc,to:Tt.devices,size:"small",color:"primary",children:h.jsx(aa,{})})})]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[h.jsx(Zn,{size:"small",placeholder:t("endpoints.searchPlaceholder"),value:l,onChange:W=>c(W.target.value),sx:{flexGrow:1,maxWidth:300}}),N>0&&h.jsx(Nt,{title:p?t("endpoints.showAll"):t("endpoints.showUnavailable",{count:N}),children:h.jsx(Wt,{size:"small",color:p?"warning":"default",onClick:()=>g(W=>!W),"aria-label":p?"Show all entities":`Show ${N} unavailable entities`,children:h.jsx(SQ,{badgeContent:N,color:"warning",max:99,children:h.jsx(Bu,{})})})}),h.jsxs(rs,{size:"small",sx:{minWidth:120},children:[h.jsx(ja,{id:"sort-label",children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:.5,children:[h.jsx(xQ,{fontSize:"small"})," ",t("endpoints.sortBy")]})}),h.jsxs(ts,{labelId:"sort-label",value:i,label:t("endpoints.sortBy"),onChange:W=>o(W.target.value),children:[h.jsx(Nn,{value:"name",children:t("endpoints.sortName")}),h.jsx(Nn,{value:"endpoint",children:t("endpoints.sortEndpoint")}),h.jsx(Nn,{value:"type",children:t("endpoints.sortType")})]})]}),h.jsxs(sEe,{value:s,exclusive:!0,onChange:(W,V)=>V&&a(V),size:"small","aria-label":"View mode",children:[h.jsx(_z,{value:"cards","aria-label":"Card view",children:h.jsx(Nt,{title:t("endpoints.cardView"),children:h.jsx(R8e,{})})}),h.jsx(_z,{value:"tree","aria-label":"Tree view",children:h.jsx(Nt,{title:t("endpoints.treeView"),children:h.jsx(I8e,{})})})]})]})]}),s==="cards"?h.jsx(dt,{container:!0,spacing:2,children:z.map(W=>h.jsx(dt,{size:{xs:12,sm:6,lg:4},children:h.jsx(IQ,{endpoint:W,bridgeId:e.bridgeId,onClick:()=>F(W),onEditMapping:e.bridgeId?L:void 0,imageInfo:O[W.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:P})},W.id.global))}):h.jsxs(dt,{container:!0,spacing:2,children:[h.jsx(dt,{size:{xs:12,md:4},children:h.jsx(oAe,{endpoint:e.endpoint,onSelected:r,sortBy:i})}),h.jsx(dt,{size:{xs:12,md:8},children:n&&h.jsx(Bz,{endpoint:n})})]}),h.jsxs(Po,{open:u,onClose:()=>d(!1),maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:n&&(ta(n.state)??n.id.local)}),h.jsx($o,{children:n&&h.jsx(Bz,{endpoint:n})})]}),e.bridgeId&&h.jsx(hM,{open:y,onClose:()=>b(!1),entityId:v,domain:v.split(".")[0]||"",currentMapping:C,onSave:M}),h.jsx(Pw,{open:k.open,autoHideDuration:6e3,onClose:()=>E({...k,open:!1}),children:h.jsx(zt,{onClose:()=>E({...k,open:!1}),severity:k.severity,sx:{width:"100%"},children:k.message})})]})},A2=Ee(h.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"})),fg=Ee(h.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"})),eee=Ee(h.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"}));async function uAe(e,t,n){const r=new URLSearchParams({name:t});n?.length&&r.set("entityIds",n.join(","));const i=await fetch(`api/mapping-profiles/export/${e}?${r.toString()}`);return await Mn(i,"Failed to export mapping profile"),sr(i)}async function dAe(e,t,n){const r=await fetch(`api/mapping-profiles/import/preview/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:t,availableEntityIds:n})});return await Mn(r,"Failed to preview import"),sr(r)}async function fAe(e,t,n){const r=await fetch(`api/mapping-profiles/import/apply/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:t,selectedEntityIds:n})});return await Mn(r,"Failed to apply mapping profile"),sr(r)}function hAe({bridgeId:e}){const{t}=on(),[n,r]=A.useState(null),[i,o]=A.useState(!0),[s,a]=A.useState(null),[l,c]=A.useState(null),[u,d]=A.useState(!1),[p,g]=A.useState(null),[y,b]=A.useState(null),[v,S]=A.useState(null),[C,w]=A.useState(new Set),[k,E]=A.useState(!1),[O,_]=A.useState(!1),[T,I]=A.useState(new Set),[P,L]=A.useState("Bridge Mappings"),M=A.useRef(null),$=A.useCallback(async()=>{try{const te=await dM(e);r(te),a(null)}catch{a(t("mapping.loadFailed"))}finally{o(!1)}},[e,t]);A.useEffect(()=>{$()},[$]);const N=A.useCallback(()=>{g({entityId:"",domain:""}),d(!0)},[]),z=A.useCallback((te,J)=>{const Q=te.split(".")[0]||"";g({entityId:te,domain:Q,config:J}),d(!0)},[]),F=A.useCallback(async te=>{try{await uEe(e,te),await $()}catch{a(t("mapping.deleteFailed"))}},[e,$,t]),W=A.useCallback(async te=>{if(te.entityId)try{await fM(e,te.entityId,te),d(!1),g(null),await $()}catch{a(t("mapping.saveFailed",{error:""}))}},[e,$,t]),V=A.useCallback(()=>{d(!1),g(null)},[]),q=n?.mappings??[],X=A.useCallback(()=>{const te=new Set(q.map(J=>J.entityId));I(te),L("Bridge Mappings"),_(!0)},[q]),B=A.useCallback(async()=>{try{const te=[...T],J=await uAe(e,P,te),Q=new Blob([JSON.stringify(J,null,2)],{type:"application/json"}),se=URL.createObjectURL(Q),le=document.createElement("a");le.href=se,le.download=`mapping-profile-${e.slice(0,8)}.json`,le.click(),URL.revokeObjectURL(se),_(!1)}catch{a("Failed to export mapping profile")}},[e,T,P]),U=A.useCallback(()=>{_(!1)},[]),Y=A.useCallback(te=>{I(J=>{const Q=new Set(J);return Q.has(te)?Q.delete(te):Q.add(te),Q})},[]),H=A.useCallback(()=>{I(te=>te.size===q.length?new Set:new Set(q.map(J=>J.entityId)))},[q]),G=A.useCallback(()=>{M.current?.click()},[]),Z=A.useCallback(async te=>{const J=te.target.files?.[0];if(J){te.target.value="";try{const Q=await J.text(),se=JSON.parse(Q);if(!se.version||!se.entries){a("Invalid mapping profile file");return}const le=(n?.mappings??[]).map(ye=>ye.entityId),he=await dAe(e,se,le);S(se),b(he),w(new Set(he.matches.map(ye=>ye.matchedEntityId)))}catch{a("Failed to parse mapping profile file")}}},[e,n]),oe=A.useCallback(async()=>{if(v){E(!0);try{const te=await fAe(e,v,[...C]);b(null),S(null),w(new Set),c(`Imported ${te.applied} mapping(s)${te.skipped>0?`, ${te.skipped} skipped`:""}${te.errors.length>0?`, ${te.errors.length} error(s)`:""}`),await $()}catch{a("Failed to apply mapping profile")}finally{E(!1)}}},[e,v,C,$]),ee=A.useCallback(()=>{b(null),S(null),w(new Set)},[]),ie=A.useCallback(te=>{w(J=>{const Q=new Set(J);return Q.has(te)?Q.delete(te):Q.add(te),Q})},[]);return h.jsxs(On,{children:[h.jsxs(Yn,{children:[h.jsxs(ae,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[h.jsxs(re,{variant:"h6",children:[h.jsx(fg,{sx:{mr:1,verticalAlign:"middle"}}),t("mapping.title")]}),h.jsxs(Vt,{direction:"row",spacing:1,children:[q.length>0&&h.jsx(qe,{variant:"outlined",size:"small",startIcon:h.jsx(A2,{}),onClick:X,children:t("common.export")}),h.jsx(qe,{variant:"outlined",size:"small",startIcon:h.jsx(eee,{}),onClick:G,children:t("common.import")}),h.jsx(qe,{variant:"outlined",size:"small",onClick:N,children:t("mapping.addMapping")})]}),h.jsx("input",{ref:M,type:"file",accept:".json",style:{display:"none"},onChange:Z})]}),s&&h.jsx(zt,{severity:"error",sx:{mb:2},onClose:()=>a(null),children:s}),l&&h.jsx(zt,{severity:"success",sx:{mb:2},icon:h.jsx(Ja,{}),onClose:()=>c(null),children:l}),i&&h.jsxs(re,{color:"text.secondary",children:[t("common.loading"),"..."]}),!i&&q.length===0&&h.jsx(re,{color:"text.secondary",children:t("mapping.noMappings")}),!i&&q.length>0&&h.jsx(tf,{children:h.jsxs(Qd,{size:"small",children:[h.jsx(i0,{children:h.jsxs(So,{children:[h.jsx(qt,{children:t("mapping.entityId")}),h.jsx(qt,{children:t("mapping.deviceType")}),h.jsx(qt,{children:t("mapping.customName")}),h.jsx(qt,{children:t("mapping.status")}),h.jsx(qt,{align:"right",children:t("common.actions")})]})}),h.jsx(ef,{children:q.map(te=>h.jsxs(So,{children:[h.jsx(qt,{children:h.jsx(re,{variant:"body2",fontFamily:"monospace",children:te.entityId})}),h.jsx(qt,{children:te.matterDeviceType||h.jsx(re,{color:"text.secondary",variant:"body2",children:"Auto"})}),h.jsx(qt,{children:te.customName||h.jsx(re,{color:"text.secondary",variant:"body2",children:"—"})}),h.jsx(qt,{children:te.disabled?h.jsx(ft,{label:t("common.disabled"),color:"error",size:"small"}):h.jsx(ft,{label:t("common.enabled"),color:"success",size:"small"})}),h.jsxs(qt,{align:"right",children:[h.jsx(Wt,{size:"small",onClick:()=>z(te.entityId,te),"aria-label":`Edit mapping for ${te.entityId}`,children:h.jsx(qw,{fontSize:"small"})}),h.jsx(Wt,{size:"small",onClick:()=>F(te.entityId),"aria-label":`Delete mapping for ${te.entityId}`,children:h.jsx(Pa,{fontSize:"small"})})]})]},te.entityId))})]})})]}),p&&h.jsx(hM,{open:u,entityId:p.entityId,domain:p.domain,currentMapping:p.config,onSave:W,onClose:V}),h.jsxs(Po,{open:O,onClose:U,maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:t("mapping.exportProfile")}),h.jsx($o,{children:h.jsxs(Vt,{spacing:2,sx:{mt:1},children:[h.jsx(Zn,{label:t("mapping.profileName"),size:"small",fullWidth:!0,value:P,onChange:te=>L(te.target.value)}),h.jsx(tf,{children:h.jsxs(Qd,{size:"small",children:[h.jsx(i0,{children:h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox",children:h.jsx(xs,{size:"small",checked:T.size===q.length,indeterminate:T.size>0&&T.size<q.length,onChange:H})}),h.jsx(qt,{children:t("mapping.entityId")}),h.jsx(qt,{children:t("mapping.deviceType")}),h.jsx(qt,{children:t("mapping.customName")})]})}),h.jsx(ef,{children:q.map(te=>h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox",children:h.jsx(xs,{size:"small",checked:T.has(te.entityId),onChange:()=>Y(te.entityId)})}),h.jsx(qt,{children:h.jsx(re,{variant:"body2",fontFamily:"monospace",children:te.entityId})}),h.jsx(qt,{children:te.matterDeviceType||h.jsx(re,{color:"text.secondary",variant:"body2",children:"Auto"})}),h.jsx(qt,{children:te.customName||h.jsx(re,{color:"text.secondary",variant:"body2",children:"—"})})]},te.entityId))})]})})]})}),h.jsxs(es,{children:[h.jsx(qe,{onClick:U,children:t("common.cancel")}),h.jsxs(qe,{variant:"contained",onClick:B,disabled:T.size===0,startIcon:h.jsx(A2,{}),children:[t("common.export")," ",T.size]})]})]}),h.jsxs(Po,{open:!!y,onClose:ee,maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:t("mapping.importProfile")}),h.jsx($o,{children:y&&h.jsxs(Vt,{spacing:2,sx:{mt:1},children:[h.jsxs(re,{variant:"body2",color:"text.secondary",children:["Profile: ",h.jsx("strong",{children:y.profileName})," —"," ",y.totalEntries," entries,"," ",y.matches.length," matched"]}),y.matches.length>0&&h.jsx(tf,{children:h.jsxs(Qd,{size:"small",children:[h.jsx(i0,{children:h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox"}),h.jsx(qt,{children:t("mapping.entityId")}),h.jsx(qt,{children:t("mapping.match")}),h.jsx(qt,{children:t("mapping.deviceType")}),h.jsx(qt,{children:t("mapping.existing")})]})}),h.jsx(ef,{children:y.matches.map(te=>h.jsxs(So,{children:[h.jsx(qt,{padding:"checkbox",children:h.jsx(xs,{size:"small",checked:C.has(te.matchedEntityId),onChange:()=>ie(te.matchedEntityId)})}),h.jsx(qt,{children:h.jsx(re,{variant:"body2",fontFamily:"monospace",children:te.matchedEntityId})}),h.jsx(qt,{children:h.jsx(ft,{label:te.matchType,size:"small",color:te.matchType==="exact"?"success":"default",variant:"outlined"})}),h.jsx(qt,{children:te.entry.matterDeviceType||"Auto"}),h.jsx(qt,{children:te.existingMapping?h.jsx(ft,{label:t("common.overwrite"),size:"small",color:"warning",variant:"outlined"}):h.jsx(ft,{label:t("common.new"),size:"small",color:"info",variant:"outlined"})})]},te.matchedEntityId))})]})}),y.unmatchedEntries.length>0&&h.jsxs(zt,{severity:"info",children:[y.unmatchedEntries.length," entries could not be matched to entities on this bridge."]})]})}),h.jsxs(es,{children:[h.jsx(qe,{onClick:ee,children:t("common.cancel")}),h.jsx(qe,{variant:"contained",onClick:oe,disabled:k||C.size===0,children:k?t("mapping.applying"):t("mapping.applyCount",{count:C.size})})]})]})]})}const pAe=e=>e.bridges,vM=Uw([pAe],e=>e.items),mAe=e=>Uw([vM],t=>({isInitialized:t.isInitialized,isLoading:t.isLoading,error:t.error,content:t.content?.find(r=>r.id===e)})),gAe=Uw([vM],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 lg(vM)}function tee(){return lg(gAe)}function nee(e){const t=A.useMemo(()=>mAe(e),[e]);return lg(t)}function yAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(EZ(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function bAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(AZ(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function vAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(DZ(t));if(n.meta.requestStatus==="rejected")throw n.error;return n.payload},[e])}function xAe(){const e=Ms();return A.useCallback(async t=>{const n=await e(kZ(t));if(n.meta.requestStatus==="rejected")throw n.error},[e])}function SAe(){const e=Ms();return A.useCallback(async t=>{await b4e(t),await e(No())},[e])}function wAe(){const e=Ms();return A.useCallback(async t=>{const n=await xZ(t);return await e(No()),n},[e])}const CAe=e=>e.devices,EAe=e=>Uw([CAe],t=>t.byBridge[e]??{isInitialized:!1,isLoading:!1});function kAe(e){const t=A.useMemo(()=>EAe(e),[e]);return lg(t)}function AAe(e,t){const[n,r]=A.useState(e);return A.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 DAe(e){const t=await fetch(`api/matter/bridges/${e}/devices`);return await Mn(t,"Failed to fetch devices"),sr(t)}const Mu=ag("devices/load",DAe),_Ae=Ee(h.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"})),OAe=Ee(h.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"}));function TAe(e){return et("MuiDialogContentText",e)}it("MuiDialogContentText",["root"]);const MAe=e=>{const{classes:t}=e,r=tt({root:["root"]},TAe,t);return{...t,...r}},RAe=ge(re,{shouldForwardProp:e=>Li(e)||e==="classes",name:"MuiDialogContentText",slot:"Root"})({}),IAe=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiDialogContentText"}),{children:i,className:o,...s}=r,a=MAe(s);return h.jsx(RAe,{component:"p",variant:"body1",color:"textSecondary",ref:n,ownerState:s,className:Oe(a.root,o),...r,classes:a})});function $S({open:e,title:t,message:n,confirmLabel:r="Confirm",cancelLabel:i="Cancel",confirmColor:o="error",onConfirm:s,onCancel:a}){return h.jsxs(Po,{open:e,onClose:a,maxWidth:"xs",fullWidth:!0,children:[h.jsx(Lo,{children:t}),h.jsx($o,{children:h.jsx(IAe,{children:n})}),h.jsxs(es,{children:[h.jsx(qe,{onClick:a,autoFocus:!0,children:i}),h.jsx(qe,{onClick:s,color:o,variant:"contained",children:r})]})]})}const jAe=({bridge:e})=>{const[t,n]=A.useState(null),r=!!t,i=jc(),o=$c(),{t:s}=on(),a=vAe(),l=xAe(),c=wAe(),[u,d]=A.useState(null),p=S=>n(S.currentTarget),g=()=>n(null),y=async()=>{g(),await c(e).then(S=>o.show({message:`Synced ${S.syncedCount} devices to controllers`,severity:"success"})).catch(S=>o.show({message:`Failed to sync: ${S?.message??JSON.stringify(S)}`,severity:"error"}))},b=async()=>{d(null),await a(e).then(()=>o.show({message:s("bridge.resetSuccess"),severity:"success"})).catch(S=>o.show({message:`Failed to reset bridge: ${S?.message??JSON.stringify(S)}`,severity:"error"}))},v=async()=>{d(null),await l(e).then(()=>o.show({message:s("bridge.deleteSuccess"),severity:"success"})).then(()=>i(Tt.bridges)).catch(S=>o.show({message:`Failed to delete bridge: ${S?.message??JSON.stringify(S)}`,severity:"error"}))};return h.jsxs(h.Fragment,{children:[h.jsx(Wt,{onClick:p,children:h.jsx(_Ae,{})}),h.jsxs(EQ,{open:r,onClose:g,anchorEl:t,children:[h.jsxs(Nn,{component:Dc,to:Tt.editBridge(e),children:[h.jsx(jo,{children:h.jsx(qw,{fontSize:"small"})}),h.jsx(so,{children:s("common.edit")})]}),h.jsx(Dr,{}),h.jsxs(Nn,{onClick:y,children:[h.jsx(jo,{children:h.jsx(Kw,{fontSize:"small"})}),h.jsx(so,{children:s("bridge.forceSync")})]}),h.jsxs(Nn,{onClick:()=>{g(),d("reset")},children:[h.jsx(jo,{children:h.jsx(OAe,{fontSize:"small"})}),h.jsx(so,{children:s("bridge.factoryReset")})]}),h.jsxs(Nn,{onClick:()=>{g(),d("delete")},children:[h.jsx(jo,{children:h.jsx(Pa,{fontSize:"small"})}),h.jsx(so,{children:s("common.delete")})]})]}),h.jsx($S,{open:u==="reset",title:s("bridge.confirmResetTitle"),message:s("bridge.confirmResetMessage"),confirmLabel:s("common.reset"),confirmColor:"warning",onConfirm:b,onCancel:()=>d(null)}),h.jsx($S,{open:u==="delete",title:s("bridge.confirmDeleteTitle"),message:s("bridge.confirmDeleteMessage"),confirmLabel:s("common.delete"),confirmColor:"error",onConfirm:v,onCancel:()=>d(null)})]})},PAe=A.memo(b8e),$Ae=({failedEntities:e})=>{const{t}=on(),[n,r]=A.useState(!1);return!e||e.length===0?null:h.jsxs(zt,{severity:"warning",sx:{cursor:"pointer"},onClick:()=>r(!n),children:[h.jsxs(re,{variant:"body2",children:[h.jsx("strong",{children:t("bridge.failedEntitiesCount",{count:e.length})})," ",t(n?"bridge.clickToHide":"bridge.clickToShow")]}),h.jsx(ia,{in:n,children:h.jsx(Fo,{dense:!0,sx:{mt:1},children:e.map(i=>h.jsxs(Cs,{sx:{py:0},children:[h.jsx(jo,{sx:{minWidth:32},children:h.jsx(ug,{color:"warning",fontSize:"small"})}),h.jsx(so,{primary:i.entityId,secondary:i.reason,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},i.entityId))})})]})},LAe=()=>{const{t:e}=on(),t=$c(),n=Ms(),{bridgeId:r}=LX(),[i,o]=A.useState(0),s=A.useCallback(()=>{o(y=>y+1)},[]),a=A.useCallback(()=>{n(Mu(r))},[n,r]),l=AAe(10,a),{content:c,isLoading:u,error:d}=nee(r),{content:p,error:g}=kAe(r);return A.useEffect(()=>{d&&t.show({message:d.message??e("bridge.loadFailed"),severity:"error"})},[d,t,e]),A.useEffect(()=>{g?.message&&t.show({message:g.message,severity:"error"})},[g,t]),!c&&u?e("common.loading"):c?h.jsxs(Vt,{spacing:4,children:[h.jsx(qb,{items:[{name:e("nav.bridges"),to:Tt.bridges},{name:c.name,to:Tt.bridge(r)}]}),h.jsxs(ae,{display:"flex",justifyContent:"space-between",children:[h.jsxs(re,{variant:"h4",children:[c.name," ",h.jsx(gQ,{status:c.status})]}),h.jsx(jAe,{bridge:r})]}),h.jsx(A8e,{status:c.status,reason:c.statusReason}),c.status==="running"&&c.commissioning&&!c.commissioning.isCommissioned&&c.commissioning.fabrics.length===0&&h.jsxs(zt,{severity:"info",icon:h.jsx(UT,{}),children:[h.jsx(C2,{children:e("bridge.pairHint")}),h.jsx(re,{variant:"body2",sx:{mb:1},children:e("bridge.pairDescription")})]}),c.failedEntities&&c.failedEntities.length>0&&h.jsx($Ae,{failedEntities:c.failedEntities}),h.jsx(NAe,{bridge:c,devices:p}),h.jsx(PAe,{bridge:c}),p&&h.jsx(M8e,{devices:p}),h.jsx(hAe,{bridgeId:r},i),p&&h.jsxs(Vt,{spacing:2,children:[h.jsx(ae,{display:"flex",justifyContent:"flex-end",alignItems:"center",children:l!=null&&h.jsx(Nt,{title:e("bridge.refreshHint"),children:h.jsx(re,{variant:"body2",color:"textSecondary",children:e("bridge.refreshingStates",{seconds:l-1})})})}),h.jsx(cAe,{endpoint:p,bridgeId:r,onMappingSaved:s})]})]}):e("common.notFound")};function ree(e){return e.type.name==="RoboticVacuumCleaner"?!0:e.parts.some(ree)}function iee(e){if(e.type.name==="Aggregator")return e.parts.length;let t=0;for(const n of e.parts)t+=iee(n);return t}const NAe=({bridge:e,devices:t})=>{const{t:n}=on(),r=$c(),[i,o]=A.useState(!1),s=A.useMemo(()=>{if(!t||e.featureFlags?.serverMode||!ree(t))return!1;const c=e.commissioning?.fabrics??[];if(c.length===0)return!0;const u=new Set([4937,4631,4448]);return c.some(d=>u.has(d.rootVendorId))},[t,e.featureFlags?.serverMode,e.commissioning?.fabrics]),a=A.useMemo(()=>t?iee(t)===1:!1,[t]),l=async()=>{o(!0);try{await vZ({id:e.id,name:e.name,port:e.port,filter:e.filter,featureFlags:{...e.featureFlags,serverMode:!0},icon:e.icon,priority:e.priority}),r.show({message:n("bridge.serverModeEnabled"),severity:"success"})}catch(c){r.show({message:n("bridge.serverModeEnableFailed",{error:c instanceof Error?c.message:String(c)}),severity:"error"})}finally{o(!1)}};return s?h.jsxs(zt,{severity:"warning",icon:h.jsx(cg,{}),action:a?h.jsx(qe,{color:"warning",size:"small",variant:"outlined",onClick:l,disabled:i,startIcon:i?h.jsx(Jn,{size:16}):void 0,sx:{whiteSpace:"nowrap"},children:n(i?"bridge.enabling":"bridge.enableServerMode")}):void 0,children:[h.jsx(C2,{children:n("bridge.serverModeRecommended")}),h.jsx(re,{variant:"body2",children:n("bridge.serverModeDescription")}),!a&&h.jsx(re,{variant:"body2",sx:{mt:1},children:n("bridge.serverModeSingleDeviceNote")})]}):null},xM=Ee(h.jsx("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3z"})),aC=Ee(h.jsx("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8z"})),FAe=Ee(h.jsx("path",{d:"m7 10 5 5 5-5z"})),BAe=Ee(h.jsx("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"})),zAe=Ee(h.jsx("path",{d:"m10 17 5-5-5-5z"})),lC=Ee(h.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),YD=Ee(h.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"})),Qz=Ee(h.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"})),hm=Ee(h.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"})),HAe=Ee(h.jsxs(A.Fragment,{children:[h.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"}),h.jsx("path",{d:"M7 9v11.67C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V9H7z"})]})),UAe=Ee(h.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"})),cC=Ee(h.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"})),VAe=Ee([h.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"),h.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")]),WAe=Ee(h.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"})),eH=Ee([h.jsx("path",{d:"m12 2-5.5 9h11z"},"0"),h.jsx("circle",{cx:"17.5",cy:"17.5",r:"4.5"},"1"),h.jsx("path",{d:"M3 13.5h8v8H3z"},"2")]),qAe=Ee(h.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),SM=Ee(h.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"})),GAe=Ee(h.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"})),KAe=Ee(h.jsx("path",{d:"M5 13h14v-2H5zm-2 4h14v-2H3zM7 7v2h14V7z"})),LS=Ee(h.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"})),YAe=Ee(h.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"})),XAe=Ee(h.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"})),JAe=Ee(h.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"})),tH=Ee(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"})),ZAe=Ee(h.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"})),QAe=Ee(h.jsx("path",{d:"M19 19V5c0-1.1-.9-2-2-2H7c-1.1 0-2 .9-2 2v14H3v2h18v-2zm-4-6h-2v-2h2z"})),eDe=Ee(h.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"})),tDe=Ee([h.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"),h.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")]),F1=Ee(h.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"})),Ly=Ee(h.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"})),nDe=Ee(h.jsx("circle",{cx:"12",cy:"12",r:"8"})),rDe=Ee(h.jsx("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z"})),iDe=Ee(h.jsx("path",{d:"M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z"})),oDe=Ee(h.jsx("path",{d:"M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"})),wM=Ee([h.jsx("circle",{cx:"15",cy:"13",r:"1"},"0"),h.jsx("circle",{cx:"9",cy:"13",r:"1"},"1"),h.jsx("path",{d:"m8.33 7.5-.66 2h8.66l-.66-2z"},"2"),h.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")]),CM=Ee(h.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})),sDe=Ee(h.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"})),Ny=Ee(h.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"})),EM=Ee(h.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"})),aDe=Ee(h.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"})),lDe=Ee(h.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"})),cDe=Ee(h.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"})),C4=Ee(h.jsx("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z"})),XD=Ee(h.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"})),uDe=Ee(h.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"})),dDe=Ee(h.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"})),fDe=Ee(h.jsx("path",{d:"m23 12-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68zm-10 5h-2v-2h2zm0-4h-2V7h2z"})),oee=Ee(h.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),see=Ee(h.jsx("path",{d:"M8 5v14l11-7z"})),hDe=Ee(h.jsx("path",{d:"M16.01 7 16 3h-2v4h-4V3H8v4h-.01C7 6.99 6 7.99 6 8.99v5.49L9.5 18v3h5v-3l3.5-3.51v-5.5c0-1-1-2-1.99-1.99"})),pDe=Ee(h.jsx("path",{d:"M18 14.49V9c0-1-1.01-2.01-2-2V3h-2v4h-4V3H8v2.48l9.51 9.5zm-1.76 1.77L7.2 7.2l-.01.01L3.98 4 2.71 5.25l3.36 3.36C6.04 8.74 6 8.87 6 9v5.48L9.5 18v3h5v-3l.48-.48L19.45 22l1.26-1.28z"})),kM=Ee(h.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"})),mDe=Ee(h.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"})),Zb=Ee(h.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"})),R0=Ee(h.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"})),Oh=Ee(h.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"})),NS=Ee(h.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"})),AM=Ee(h.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"})),gDe=Ee([h.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3 6.08 3 3.28 5.64 3.03 9h2.02C5.3 6.75 7.18 5 9.5 5 11.99 5 14 7.01 14 9.5S11.99 14 9.5 14c-.17 0-.33-.03-.5-.05v2.02c.17.02.33.03.5.03 1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19z"},"0"),h.jsx("path",{d:"M6.47 10.82 4 13.29l-2.47-2.47-.71.71L3.29 14 .82 16.47l.71.71L4 14.71l2.47 2.47.71-.71L4.71 14l2.47-2.47z"},"1")]),aee=Ee(h.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"})),D2=Ee(h.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"})),DM=Ee(h.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"})),lee=Ee(h.jsx("path",{d:"M6 6h12v12H6z"})),yDe=Ee(h.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"})),bDe=Ee(h.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),vDe=Ee(h.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"})),xDe=Ee(h.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"})),_M=Ee(h.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"})),SDe=Ee(h.jsx("path",{d:"m12.87 15.07-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2zm-2.62 7 1.62-4.33L19.12 17z"})),wDe=Ee(h.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),OM=Ee(h.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"})),CDe=Ee(h.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"})),cee=Ee(h.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"})),EDe=Ee(h.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"})),kDe=Ee(h.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),ADe=Ee(h.jsx("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"})),DDe=Ee(h.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 _De(){const e=await fetch("api/bridges/export");await Mn(e,"Failed to export bridges");const t=await e.blob(),r=e.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]||`hamh-bridges-${new Date().toISOString().split("T")[0]}.json`;MDe(t,r)}async function ODe(e){const t=await fetch("api/bridges/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return await Mn(t,"Failed to preview import"),sr(t)}async function TDe(e,t){const n=await fetch("api/bridges/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e,options:t})});return await Mn(n,"Failed to import bridges"),sr(n)}function MDe(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 RDe({open:e,file:t,onClose:n,onImported:r}){const{t:i}=on(),[o,s]=A.useState(null),[a,l]=A.useState(new Set),[c,u]=A.useState(!1),[d,p]=A.useState(null),[g,y]=A.useState(null),[b,v]=A.useState(!1),[S,C]=A.useState(null);A.useEffect(()=>{if(!e||!t){s(null),l(new Set),p(null),y(null),C(null);return}const _=new FileReader;_.onload=async T=>{try{const I=JSON.parse(T.target?.result);p(I);const P=await ODe(I);s(P),l(new Set(P.bridges.map(L=>L.id)))}catch{y(i("bridge.importParseFailed"))}},_.readAsText(t)},[e,t,i]);const w=A.useCallback(_=>{l(T=>{const I=new Set(T);return I.has(_)?I.delete(_):I.add(_),I})},[]),k=A.useCallback(()=>{o&&l(new Set(o.bridges.map(_=>_.id)))},[o]),E=A.useCallback(()=>{l(new Set)},[]),O=A.useCallback(async()=>{if(d){v(!0);try{const _=await TDe(d,{bridgeIds:Array.from(a),overwriteExisting:c}),T=[];_.imported>0&&T.push(`${_.imported} bridge(s) imported`),_.skipped>0&&T.push(`${_.skipped} skipped (already exist)`),_.errors.length>0&&T.push(`${_.errors.length} failed`),C(T.join(", ")),r()}catch(_){y(_ instanceof Error?_.message:"Import failed")}finally{v(!1)}}},[d,a,c,r]);return h.jsxs(Po,{open:e,onClose:n,maxWidth:"sm",fullWidth:!0,children:[h.jsx(Lo,{children:i("bridge.importTitle")}),h.jsxs($o,{children:[g&&h.jsx(zt,{severity:"error",sx:{mb:2},children:g}),S&&h.jsx(zt,{severity:"success",sx:{mb:2},children:S}),o&&!S&&h.jsxs(h.Fragment,{children:[o.migrated&&h.jsxs(zt,{severity:"info",sx:{mb:2},children:["This export is from an older version (",o.sourceVersion,"). Bridges will be migrated to the current format during import."]}),h.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Exported on ",new Date(o.exportedAt).toLocaleString(),o.sourceVersion&&!o.migrated&&h.jsxs(h.Fragment,{children:[" • Format: ",o.sourceVersion]})]}),h.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16},children:[h.jsx(qe,{size:"small",onClick:k,children:i("common.selectAll")}),h.jsx(qe,{size:"small",onClick:E,children:i("common.selectNone")})]}),h.jsx(Fo,{dense:!0,children:o.bridges.map(_=>h.jsxs(Cs,{disablePadding:!0,children:[h.jsx(jo,{children:h.jsx(xs,{edge:"start",checked:a.has(_.id),onChange:()=>w(_.id)})}),h.jsx(so,{primary:_.name,secondary:h.jsxs(h.Fragment,{children:["Port ",_.port," • ",_.entityCount," filter rules",_.exists&&h.jsxs("span",{style:{color:"orange"},children:[" ","• Already exists"]})]})})]},_.id))}),h.jsx(Io,{control:h.jsx(Ou,{checked:c,onChange:_=>u(_.target.checked)}),label:i("bridge.overwriteExisting")})]})]}),h.jsxs(es,{children:[h.jsx(qe,{onClick:n,children:i(S?"common.close":"common.cancel")}),!S&&h.jsx(qe,{onClick:O,variant:"contained",disabled:b||a.size===0,children:b?i("bridge.importing"):i("bridge.importCount",{count:a.size})})]})]})}const uC="api/bridge-icons";async function IDe(e,t){const n=new FormData;n.append("icon",t);const r=await fetch(`${uC}/${e}`,{method:"POST",body:n});return await Mn(r,"Failed to upload icon"),sr(r)}async function jDe(e){const t=await fetch(`${uC}/${e}`,{method:"DELETE"});await Mn(t,"Failed to delete icon")}async function dC(e){return(await fetch(`${uC}/${e}`,{method:"HEAD"})).ok}function _2(e){return`${uC}/${e}`}const nH={light:iC,switch:kM,climate:sC,cover:rC,fan:_M,lock:Tu,sensor:D2,media_player:OM,vacuum:SM,remote:DM,humidifier:bM,speaker:oC,garage:wM,door:QAe,window:DDe,motion:ZAe,battery:HAe,power:UAe,camera:VAe,default:yM},rH={light:iC,switch:kM,climate:sC,cover:rC,fan:_M,lock:Tu,sensor:D2,binary_sensor:D2,media_player:OM,vacuum:SM,remote:DM,humidifier:bM,input_boolean:tDe,input_button:F1,button:F1,scene:F1,script:F1,automation:F1,speaker:oC,air_quality:JQ,garage:wM},iH={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"},uee=e=>e.filter.include.find(n=>n.type===Or.Domain)?.value??null,PDe=e=>{const t=e.toLowerCase();if(t.includes("lamp")||t.includes("light")||t.includes("ljus"))return iC;if(t.includes("vacuum")||t.includes("dammsug"))return SM;if(t.includes("thermo")||t.includes("climate")||t.includes("värme"))return sC;if(t.includes("sensor"))return D2;if(t.includes("cover")||t.includes("blind")||t.includes("rullgardin")||t.includes("jalousie"))return rC;if(t.includes("remote")||t.includes("fjärr"))return DM;if(t.includes("lock")||t.includes("lås"))return Tu;if(t.includes("fan")||t.includes("fläkt"))return _M;if(t.includes("tv")||t.includes("media"))return OM;if(t.includes("speaker")||t.includes("högtalare"))return oC;if(t.includes("switch")||t.includes("brytare"))return kM;if(t.includes("garage"))return wM},TM=e=>{if(e.icon&&nH[e.icon])return nH[e.icon];const t=uee(e);if(t&&rH[t])return rH[t];const n=PDe(e.name);return n||(e.deviceCount===0?aa:yM)},MM=e=>{const t=uee(e);return t&&iH[t]?iH[t]:e.deviceCount===0?"text.disabled":"primary.main"},$De=({bridge:e})=>{const t=e.commissioning?.fabrics.length??0,n=TM(e),r=MM(e),[i,o]=A.useState(!1);return A.useEffect(()=>{dC(e.id).then(o)},[e.id]),h.jsx(On,{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:h.jsx(Nu,{component:Dc,to:Tt.bridge(e.id),sx:{height:"100%"},children:h.jsx(Yn,{children:h.jsxs(ae,{display:"flex",alignItems:"flex-start",gap:2,children:[i?h.jsx(ae,{component:"img",src:_2(e.id),alt:e.name,sx:{width:56,height:56,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(wl,{sx:{bgcolor:r,width:56,height:56,boxShadow:2},children:h.jsx(n,{sx:{fontSize:32}})}),h.jsxs(ae,{flexGrow:1,minWidth:0,children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:1,children:[h.jsx(re,{variant:"h6",component:"div",noWrap:!0,sx:{flexGrow:1,fontWeight:600},children:e.name}),h.jsx(gQ,{status:e.status})]}),h.jsxs(Vt,{spacing:1,mb:2,children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(aa,{sx:{fontSize:16,color:"text.secondary"}}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:[e.deviceCount," devices"]})]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(GZ,{sx:{fontSize:16,color:"text.secondary"}}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:[t," fabric",t!==1?"s":""]})]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(D2,{sx:{fontSize:16,color:"text.secondary"}}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:["Port ",e.port]})]})]})]})]})})})})},LDe=({bridges:e})=>{const t=A.useMemo(()=>[...e].sort((n,r)=>n.name.localeCompare(r.name,void 0,{sensitivity:"base"})),[e]);return h.jsx(dt,{container:!0,spacing:2,children:t.map(n=>h.jsx(dt,{size:{xs:12,sm:6,lg:4},children:h.jsx($De,{bridge:n})},n.id))})},fC=A.createContext({}),RM=A.createContext({});function NDe(e){return et("MuiStep",e)}it("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);const FDe=e=>{const{classes:t,orientation:n,alternativeLabel:r,completed:i}=e;return tt({root:["root",n,r&&"alternativeLabel",i&&"completed"]},NDe,t)},BDe=ge("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"}}]}),zDe=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStep"}),{active:i,children:o,className:s,component:a="div",completed:l,disabled:c,expanded:u=!1,index:d,last:p,...g}=r,{activeStep:y,connector:b,alternativeLabel:v,orientation:S,nonLinear:C}=A.useContext(fC);let[w=!1,k=!1,E=!1]=[i,l,c];y===d?w=i!==void 0?i:!0:!C&&y>d?k=l!==void 0?l:!0:!C&&y<d&&(E=c!==void 0?c:!0);const O=A.useMemo(()=>({index:d,last:p,expanded:u,icon:d+1,active:w,completed:k,disabled:E}),[d,p,u,w,k,E]),_={...r,active:w,orientation:S,alternativeLabel:v,completed:k,disabled:E,expanded:u,component:a},T=FDe(_),I=h.jsxs(BDe,{as:a,className:Oe(T.root,s),ref:n,ownerState:_,...g,children:[b&&v&&d!==0?b:null,o]});return h.jsx(RM.Provider,{value:O,children:b&&!v&&d!==0?h.jsxs(A.Fragment,{children:[b,I]}):I})}),HDe=Ee(h.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"})),UDe=Ee(h.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function VDe(e){return et("MuiStepIcon",e)}const j7=it("MuiStepIcon",["root","active","completed","error","text"]);var oH;const WDe=e=>{const{classes:t,active:n,completed:r,error:i}=e;return tt({root:["root",n&&"active",r&&"completed",i&&"error"],text:["text"]},VDe,t)},P7=ge(mS,{name:"MuiStepIcon",slot:"Root"})(Ke(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${j7.completed}`]:{color:(e.vars||e).palette.primary.main},[`&.${j7.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${j7.error}`]:{color:(e.vars||e).palette.error.main}}))),qDe=ge("text",{name:"MuiStepIcon",slot:"Text"})(Ke(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),GDe=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepIcon"}),{active:i=!1,className:o,completed:s=!1,error:a=!1,icon:l,...c}=r,u={...r,active:i,completed:s,error:a},d=WDe(u);if(typeof l=="number"||typeof l=="string"){const p=Oe(o,d.root);return a?h.jsx(P7,{as:UDe,className:p,ref:n,ownerState:u,...c}):s?h.jsx(P7,{as:HDe,className:p,ref:n,ownerState:u,...c}):h.jsxs(P7,{className:p,ref:n,ownerState:u,...c,children:[oH||(oH=h.jsx("circle",{cx:"12",cy:"12",r:"12"})),h.jsx(qDe,{className:d.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:u,children:l})]})}return l});function KDe(e){return et("MuiStepLabel",e)}const qd=it("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),YDe=e=>{const{classes:t,orientation:n,active:r,completed:i,error:o,disabled:s,alternativeLabel:a}=e;return tt({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"]},KDe,t)},XDe=ge("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation]]}})({display:"flex",alignItems:"center",[`&.${qd.alternativeLabel}`]:{flexDirection:"column"},[`&.${qd.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),JDe=ge("span",{name:"MuiStepLabel",slot:"Label"})(Ke(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${qd.active}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${qd.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${qd.alternativeLabel}`]:{marginTop:16},[`&.${qd.error}`]:{color:(e.vars||e).palette.error.main}}))),ZDe=ge("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${qd.alternativeLabel}`]:{paddingRight:0}}),QDe=ge("span",{name:"MuiStepLabel",slot:"LabelContainer"})(Ke(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${qd.alternativeLabel}`]:{textAlign:"center"}}))),dee=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepLabel"}),{children:i,className:o,componentsProps:s={},error:a=!1,icon:l,optional:c,slots:u={},slotProps:d={},StepIconComponent:p,StepIconProps:g,...y}=r,{alternativeLabel:b,orientation:v}=A.useContext(fC),{active:S,disabled:C,completed:w,icon:k}=A.useContext(RM),E=l||k;let O=p;E&&!O&&(O=GDe);const _={...r,active:S,alternativeLabel:b,completed:w,disabled:C,error:a,orientation:v},T=YDe(_),I={slots:u,slotProps:{stepIcon:g,...s,...d}},[P,L]=ut("root",{elementType:XDe,externalForwardedProps:{...I,...y},ownerState:_,ref:n,className:Oe(T.root,o)}),[M,$]=ut("label",{elementType:JDe,externalForwardedProps:I,ownerState:_}),[N,z]=ut("stepIcon",{elementType:O,externalForwardedProps:I,ownerState:_});return h.jsxs(P,{...L,children:[E||N?h.jsx(ZDe,{className:T.iconContainer,ownerState:_,children:h.jsx(N,{completed:w,active:S,error:a,icon:E,...z})}):null,h.jsxs(QDe,{className:T.labelContainer,ownerState:_,children:[i?h.jsx(M,{...$,className:Oe(T.label,$?.className),children:i}):null,c]})]})});dee.muiName="StepLabel";function e_e(e){return et("MuiStepper",e)}it("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);function t_e(e){return et("MuiStepConnector",e)}it("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);const n_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${ve(n)}`]};return tt(a,t_e,t)},r_e=ge("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)"}}]}),i_e=ge("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.line,t[`line${ve(n.orientation)}`]]}})(Ke(({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}}]}})),o_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepConnector"}),{className:i,...o}=r,{alternativeLabel:s,orientation:a="horizontal"}=A.useContext(fC),{active:l,disabled:c,completed:u}=A.useContext(RM),d={...r,alternativeLabel:s,orientation:a,active:l,completed:u,disabled:c},p=n_e(d);return h.jsx(r_e,{className:Oe(p.root,i),ref:n,ownerState:d,...o,children:h.jsx(i_e,{className:p.line,ownerState:d})})}),s_e=e=>{const{orientation:t,nonLinear:n,alternativeLabel:r,classes:i}=e;return tt({root:["root",t,n&&"nonLinear",r&&"alternativeLabel"]},e_e,i)},a_e=ge("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"}}]}),l_e=h.jsx(o_e,{}),c_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiStepper"}),{activeStep:i=0,alternativeLabel:o=!1,children:s,className:a,component:l="div",connector:c=l_e,nonLinear:u=!1,orientation:d="horizontal",...p}=r,g={...r,nonLinear:u,alternativeLabel:o,orientation:d,component:l},y=s_e(g),b=A.Children.toArray(s).filter(Boolean),v=b.map((C,w)=>A.cloneElement(C,{index:w,last:w+1===b.length,...C.props})),S=A.useMemo(()=>({activeStep:i,alternativeLabel:o,connector:c,nonLinear:u,orientation:d}),[i,o,c,u,d]);return h.jsx(fC.Provider,{value:S,children:h.jsx(a_e,{as:l,ownerState:g,className:Oe(y.root,a),ref:n,...p,children:v})})}),sH={light:"💡",switch:"🔌",sensor:"📊",climate:"🌡️",lock:"🔒",vacuum:"🤖",media_player:"🎵",cover:"🪟",remote:"⚡",default:"🏠"};function fee({selectedTemplate:e,onSelect:t}){return h.jsxs(ae,{children:[h.jsx(re,{variant:"subtitle1",gutterBottom:!0,fontWeight:600,children:"Start from a Template (optional)"}),h.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."}),h.jsx(dt,{container:!0,spacing:1.5,alignItems:"flex-start",children:RZ.map(n=>{const r=e===n.id;return h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(On,{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:h.jsx(Nu,{onClick:()=>t(r?null:n),sx:{p:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"},children:h.jsxs(Yn,{sx:{p:1.5,"&:last-child":{pb:1.5}},children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[h.jsx(re,{fontSize:20,children:sH[n.icon]??sH.default}),h.jsx(re,{variant:"subtitle2",sx:{flexGrow:1},children:n.name}),r&&h.jsx(Ja,{color:"primary",sx:{fontSize:18}})]}),h.jsx(re,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:r?"none":2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:n.description}),n.featureFlags?.serverMode&&h.jsx(ft,{label:"Server Mode",size:"small",color:"warning",variant:"outlined",sx:{mt:.5,height:20,fontSize:"0.65rem"}}),n.featureFlags?.autoForceSync&&h.jsx(ft,{label:"Auto Force Sync",size:"small",color:"info",variant:"outlined",sx:{mt:.5,ml:.5,height:20,fontSize:"0.65rem"}})]})})})},n.id)})})]})}const u_e={apple_home:"🍏",google_home:"🏠",alexa:"🔵",multi_controller:"🔀"},$7=["bridgeWizard.stepTemplate","bridgeWizard.stepController","bridgeWizard.stepBridgeInfo","bridgeWizard.stepEntityFilter","bridgeWizard.stepFeatureFlags","bridgeWizard.stepReview"],d_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 hee({open:e,onClose:t,onComplete:n}){const{t:r}=on(),[i,o]=A.useState(0),[s,a]=A.useState(!1),[l,c]=A.useState(5540),[u,d]=A.useState([]),[p,g]=A.useState(),[y,b]=A.useState({name:"",port:5540,serverMode:!1,filter:{include:[],exclude:[]}}),[v,S]=A.useState(!0),[C,w]=A.useState("*"),[k,E]=A.useState(""),[O,_]=A.useState(null),[T,I]=A.useState(),P=A.useCallback(async()=>{try{const H=await fetch("api/matter/next-port");if(H.ok){const G=await H.json();c(G.port),b(Z=>({...Z,port:G.port}))}}catch{}},[]);A.useEffect(()=>{e&&(P(),o(0),d([]),g(void 0),b({name:"",port:l,serverMode:!1,filter:{include:[],exclude:[]}}),S(!0),w("*"),E(""),_(null),I(void 0))},[e,P,l]);const L=A.useCallback(H=>{if(g(H??void 0),H){b(oe=>({...oe,name:H.name,serverMode:H.featureFlags?.serverMode??!1,icon:H.icon,featureFlags:H.featureFlags,filter:{...H.filter}}));const G=H.filter.include;if(G.length>0)if(S(!1),H.featureFlags?.serverMode){const oe=G.map(ee=>ee.type===Or.Domain?`${ee.value}.*`:ee.value);w(oe.join(", "))}else w(G.map(oe=>oe.value).join(", "));const Z=H.filter.exclude;E(Z.map(oe=>oe.value).join(", "))}else b(G=>({...G,name:"",serverMode:!1,icon:void 0,featureFlags:void 0,filter:{include:[],exclude:[]}})),S(!0),w("*"),E("")},[]),M=A.useCallback(H=>{I(H??void 0),H&&b(G=>({...G,featureFlags:{...G.featureFlags,...H.featureFlags}}))},[]),$=()=>{if(i===0&&_(null),i===1&&_(null),i===2){if(!y.name.trim()){_(r("bridgeWizard.nameRequired"));return}_(null)}if(i===3){let H,G;if(p&&!y.serverMode)H=[...p.filter.include],G=[...p.filter.exclude];else{const Z=v?[C||"*"]:C.split(",").map(ee=>ee.trim()).filter(Boolean),oe=k.split(",").map(ee=>ee.trim()).filter(Boolean);H=Z.map(ee=>({type:Or.Pattern,value:ee})),G=oe.map(ee=>({type:Or.Pattern,value:ee}))}b(Z=>({...Z,filter:{include:H,exclude:G}}))}o(H=>H+1)},N=()=>{o(H=>H-1),_(null)},z=async()=>{await F();const H=l+u.length+1;d(G=>[...G,y]),g(void 0),I(void 0),b({name:"",port:H,serverMode:!1,filter:{include:[],exclude:[]}}),o(0),S(!0),w("*"),E("")},F=async()=>{a(!0),_(null);try{const H={...y.featureFlags,...y.serverMode?{serverMode:!0}:{}},G=Object.keys(H).length>0,Z={name:y.name,port:y.port,filter:y.filter,featureFlags:G?H:void 0,icon:y.icon};return await FT(Z),!0}catch(H){return _(H instanceof Error?H.message:r("bridgeWizard.createFailed")),!1}finally{a(!1)}},W=async()=>{await F()&&(n(),t())},V=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:r("bridgeWizard.templateDescription")}),h.jsx(ae,{sx:{mt:2},children:h.jsx(fee,{selectedTemplate:p?.id,onSelect:L})})]}),q=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:r("bridgeWizard.controllerDescription")}),h.jsx(dt,{container:!0,spacing:1.5,sx:{mt:1},children:IZ.map(H=>{const G=T?.id===H.id;return h.jsx(dt,{size:{xs:12,sm:6},children:h.jsx(On,{variant:"outlined",sx:{borderColor:G?"primary.main":"divider",borderWidth:G?2:1,bgcolor:G?"action.selected":"background.paper",transition:"all 0.15s ease"},children:h.jsx(Nu,{onClick:()=>M(G?null:H),sx:{p:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start"},children:h.jsxs(Yn,{sx:{p:1.5,"&:last-child":{pb:1.5},width:"100%"},children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:.5,children:[h.jsx(re,{fontSize:20,children:u_e[H.id]??"🏠"}),h.jsx(re,{variant:"subtitle2",sx:{flexGrow:1},children:H.name}),G&&h.jsx(Ja,{color:"primary",sx:{fontSize:18}})]}),h.jsx(re,{variant:"caption",color:"text.secondary",children:H.description}),G&&h.jsx(ae,{display:"flex",gap:.5,flexWrap:"wrap",mt:.5,children:Object.entries(H.featureFlags).filter(([,Z])=>Z).map(([Z])=>h.jsx(ft,{label:Z.replace(/^auto/,"").replace(/([A-Z])/g," $1").trim(),size:"small",variant:"outlined",sx:{fontSize:"0.6rem",height:18}},Z))})]})})})},H.id)})}),h.jsx(re,{variant:"caption",color:"text.secondary",sx:{mt:2,display:"block"},children:r("bridgeWizard.controllerHint")})]}),X=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:p?r("bridgeWizard.templateApplied",{name:p.name}):r("bridgeWizard.bridgeInfoDescription")}),h.jsx(Zn,{fullWidth:!0,label:r("bridgeWizard.bridgeName"),value:y.name,onChange:H=>b(G=>({...G,name:H.target.value})),margin:"normal",placeholder:"e.g., Living Room, Kitchen, All Lights",error:!!O,helperText:O}),h.jsx(Zn,{fullWidth:!0,label:r("bridgeWizard.portLabel"),type:"number",value:y.port,onChange:H=>b(G=>({...G,port:parseInt(H.target.value,10)||5540})),margin:"normal",helperText:r("bridgeWizard.portAutoAssign")}),h.jsx(Nt,{title:"Required for Robot Vacuums to work with Apple Home (Siri) and Alexa. Server Mode bridges support only ONE device.",placement:"right",children:h.jsx(Io,{control:h.jsx(xs,{checked:y.serverMode,onChange:H=>b(G=>({...G,serverMode:H.target.checked})),icon:h.jsx(S4,{}),checkedIcon:h.jsx(S4,{color:"primary"})}),label:r("bridgeWizard.serverModeLabel"),sx:{mt:1}})}),y.serverMode&&h.jsxs(zt,{severity:"info",sx:{mt:1},children:[h.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&&h.jsxs(ae,{sx:{mt:2},children:[h.jsxs(re,{variant:"subtitle2",color:"text.secondary",children:[r("bridgeWizard.bridgesToCreate",{count:u.length}),":"]}),h.jsx(ae,{display:"flex",gap:1,flexWrap:"wrap",mt:1,children:u.map(H=>h.jsx(ft,{label:`${H.name} (:${H.port})`,size:"small"},H.port))})]})]}),B=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:p?r("bridgeWizard.filterPreConfiguredFrom",{name:p.name}):r("bridgeWizard.entityFilterDescription")}),y.serverMode&&h.jsxs(zt,{severity:"warning",sx:{mt:1,mb:1},children:["Server Mode requires exactly ",h.jsx("strong",{children:"one"})," entity. Change the filter to match only your device (e.g., ",h.jsx("code",{children:"vacuum.my_vacuum"}),")."]}),!p&&h.jsx(Io,{control:h.jsx(Ou,{checked:v,onChange:H=>S(H.target.checked)}),label:r("bridgeWizard.includeAll")}),h.jsx(Zn,{fullWidth:!0,label:y.serverMode?"Entity ID":v&&!p?"Include Pattern":"Entity Filters",value:p&&!y.serverMode?p.filter.include.map(H=>`${H.type}:${H.value}`).join(", "):C,onChange:H=>w(H.target.value),margin:"normal",placeholder:v?"* or light.*, switch.*":"light.living_room, switch.kitchen",helperText:y.serverMode?"Server Mode supports only ONE device. Enter the exact entity ID (e.g., vacuum.my_vacuum).":p?"Pre-configured by template. Edit in the full editor after creation.":v?"Use * for all, or patterns like light.*, switch.*":"Enter specific entity IDs separated by commas",disabled:!!p&&!y.serverMode}),!p&&h.jsx(Zn,{fullWidth:!0,label:r("bridgeWizard.excludePatterns"),value:k,onChange:H=>E(H.target.value),margin:"normal",placeholder:"sensor.*, binary_sensor.*",helperText:r("bridgeWizard.excludeHelperText")})]}),U=()=>h.jsxs(ae,{sx:{mt:2},children:[h.jsxs(re,{variant:"body1",gutterBottom:!0,children:[r("bridgeWizard.featureFlagsDescription"),T?` ${r("bridgeWizard.recommendedFlags",{name:T.name})}`:` ${r("bridgeWizard.selectFlags")}`]}),d_e.map(H=>h.jsxs(ae,{sx:{mt:1},children:[h.jsx(Io,{control:h.jsx(Ou,{checked:y.featureFlags?.[H.key]===!0,onChange:G=>b(Z=>({...Z,featureFlags:{...Z.featureFlags,[H.key]:G.target.checked}}))}),label:H.label}),h.jsx(re,{variant:"caption",color:"text.secondary",display:"block",sx:{ml:7,mt:-.5},children:H.description})]},H.key))]}),Y=()=>{const H=Object.entries(y.featureFlags??{}).filter(([,G])=>G===!0);return h.jsxs(ae,{sx:{mt:2},children:[h.jsx(re,{variant:"body1",gutterBottom:!0,children:r("bridgeWizard.reviewDescription")}),h.jsx(On,{variant:"outlined",sx:{mt:2},children:h.jsxs(Yn,{children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,mb:1,children:[h.jsx(aa,{}),h.jsx(re,{variant:"h6",children:y.name})]}),h.jsxs(re,{variant:"body2",color:"text.secondary",children:[r("bridgeWizard.portLabel"),": ",y.port]}),p&&h.jsx(ft,{label:`Template: ${p.name}`,size:"small",color:"info",variant:"outlined",sx:{mt:1,mr:.5}}),y.serverMode&&h.jsx(ft,{icon:h.jsx(S4,{}),label:"Server Mode",color:"primary",size:"small",sx:{mt:1}}),H.length>0&&h.jsx(ae,{display:"flex",gap:.5,flexWrap:"wrap",mt:1,children:H.filter(([G])=>G!=="serverMode").map(([G])=>h.jsx(ft,{label:G,size:"small",variant:"outlined",sx:{fontSize:"0.7rem",height:22}},G))}),h.jsxs(re,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["Include:"," ",y.filter.include.length>0?y.filter.include.map(G=>`${G.type}:${G.value}`).join(", "):C||"*"]}),O&&h.jsx(re,{variant:"body2",color:"error",sx:{mt:1},children:O}),(k||y.filter.exclude.length>0)&&h.jsxs(re,{variant:"body2",color:"text.secondary",children:["Exclude:"," ",y.filter.exclude.length>0?y.filter.exclude.map(G=>G.value).join(", "):k]})]})}),u.length>0&&h.jsx(ae,{sx:{mt:2},children:h.jsx(re,{variant:"subtitle2",children:r("bridgeWizard.bridgesCreated",{count:u.length})})})]})};return h.jsxs(Po,{open:e,onClose:t,maxWidth:"md",fullWidth:!0,children:[h.jsx(Lo,{children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:1,children:[h.jsx(fg,{}),h.jsx("span",{children:r("bridgeWizard.title")})]})}),h.jsxs($o,{children:[h.jsx(c_e,{activeStep:i,sx:{mt:1},children:$7.map(H=>h.jsx(zDe,{children:h.jsx(dee,{children:r(H)})},H))}),i===0&&V(),i===1&&q(),i===2&&X(),i===3&&B(),i===4&&U(),i===5&&Y()]}),h.jsxs(es,{sx:{px:3,pb:2},children:[h.jsx(qe,{onClick:t,disabled:s,children:r("common.cancel")}),h.jsx(ae,{sx:{flex:1}}),i>0&&h.jsx(qe,{onClick:N,startIcon:h.jsx(jZ,{}),disabled:s,children:r("common.back")}),i<$7.length-1&&h.jsx(qe,{variant:"contained",onClick:$,endIcon:h.jsx(BAe,{}),disabled:s,children:r(i===0&&!p?"bridgeWizard.skipTemplate":i===1&&!T?"common.skip":"common.next")}),i===$7.length-1&&h.jsxs(h.Fragment,{children:[h.jsx(qe,{variant:"outlined",onClick:z,startIcon:h.jsx(Ds,{}),disabled:s,children:r("bridgeWizard.addAnother")}),h.jsx(qe,{variant:"contained",onClick:W,startIcon:s?h.jsx(Jn,{size:16}):h.jsx(qAe,{}),disabled:s,children:r(s?"bridgeWizard.creating":"bridgeWizard.createBridge")})]})]})]})}const f_e=()=>{const{t:e}=on(),t=$c(),n=Ms(),{content:r,isLoading:i,error:o}=hg(),[s,a]=A.useState(null),[l,c]=A.useState(!1),[u,d]=A.useState(!1),[p,g]=A.useState(!1),y=A.useRef(null),b=A.useCallback(async()=>{try{await _De()}catch(E){t.show({message:E instanceof Error?E.message:e("bridge.exportFailed"),severity:"error"})}},[t,e]),v=A.useCallback(()=>{y.current?.click()},[]),S=A.useCallback(E=>{const O=E.target.files?.[0];O&&(a(O),c(!0)),E.target.value=""},[]),C=A.useCallback(()=>{c(!1),a(null)},[]),w=A.useCallback(()=>{n(No())},[n]),k=A.useCallback(async E=>{g(!0);try{const O={start:e("bridge.actionStarted"),stop:e("bridge.actionStopped"),restart:e("bridge.actionRestarted")},T=await{start:SZ,stop:wZ,restart:CZ}[E]();t.show({message:e("bridge.actionResult",{label:O[E],count:T.count}),severity:"success"}),n(No())}catch(O){t.show({message:O instanceof Error?O.message:e("bridge.actionFailed",{action:E}),severity:"error"})}finally{g(!1)}},[t,n,e]);return A.useEffect(()=>{o&&t.show({message:o.message??e("bridge.couldNotLoad"),severity:"error"})},[o,t,e]),h.jsxs(h.Fragment,{children:[h.jsx(eM,{sx:E=>({zIndex:E.zIndex.drawer+1}),open:i||p,children:(i||p)&&h.jsx(Jn,{color:"inherit"})}),h.jsx(Vt,{spacing:4,children:r&&h.jsxs(h.Fragment,{children:[h.jsxs(ae,{display:"flex",justifyContent:"end",flexWrap:"wrap",gap:1,paddingTop:{xs:1,sm:0},children:[r.length>=1&&h.jsxs(h.Fragment,{children:[h.jsx(qe,{onClick:()=>k("start"),startIcon:h.jsx(see,{}),variant:"outlined",size:"small",color:"success",disabled:p,children:e("common.startAll")}),h.jsx(qe,{onClick:()=>k("stop"),startIcon:h.jsx(lee,{}),variant:"outlined",size:"small",color:"error",disabled:p,children:e("common.stopAll")}),h.jsx(qe,{onClick:()=>k("restart"),startIcon:h.jsx(R0,{}),variant:"outlined",size:"small",color:"warning",disabled:p,children:e("common.restartAll")}),h.jsx(Dr,{orientation:"vertical",flexItem:!0})]}),h.jsx(qe,{onClick:v,startIcon:h.jsx(eee,{}),variant:"outlined",children:e("common.import")}),h.jsx(qe,{onClick:b,startIcon:h.jsx(A2,{}),variant:"outlined",disabled:r.length===0,children:e("common.exportAll")}),h.jsx(qe,{component:Dc,to:Tt.areaSetup,startIcon:h.jsx(C4,{}),variant:"outlined",children:e("areaSetup.title")}),h.jsx(qe,{onClick:()=>d(!0),startIcon:h.jsx(YD,{}),variant:"outlined",children:e("bridgeWizard.title")}),h.jsx(qe,{component:Dc,to:Tt.createBridge,endIcon:h.jsx(Ds,{}),variant:"outlined",children:e("dashboard.createBridge")}),h.jsx("input",{type:"file",ref:y,onChange:S,accept:".json",style:{display:"none"}})]}),h.jsx(LDe,{bridges:r})]})}),h.jsx(RDe,{open:l,file:s,onClose:C,onImported:w}),h.jsx(hee,{open:u,onClose:()=>d(!1),onComplete:()=>n(No())})]})},FS=[{id:"stats",label:"Status Overview",description:"Bridge count, device count, fabric count, and HA connection status."},{id:"bridges",label:"Bridges",description:"Bridge cards with bulk actions (start/stop/restart all)."},{id:"quickNav",label:"Quick Navigation",description:"Shortcut cards to other pages (Devices, Network Map, Health, etc.)."}],pee="hamh-dashboard-widgets",BS={order:FS.map(e=>e.id),hidden:[]};function h_e(){try{const e=localStorage.getItem(pee);if(!e)return BS;const t=JSON.parse(e),n=new Set(FS.map(i=>i.id)),r=t.order.filter(i=>n.has(i));for(const i of FS)r.includes(i.id)||r.push(i.id);return{order:r,hidden:(t.hidden||[]).filter(i=>n.has(i))}}catch{return BS}}function L7(e){localStorage.setItem(pee,JSON.stringify(e))}function p_e(){const[e,t]=A.useState(h_e),n=A.useCallback(a=>!e.hidden.includes(a),[e.hidden]),r=e.order.filter(a=>!e.hidden.includes(a)),i=A.useCallback(a=>{t(l=>{const c=l.hidden.includes(a)?l.hidden.filter(d=>d!==a):[...l.hidden,a],u={...l,hidden:c};return L7(u),u})},[]),o=A.useCallback((a,l)=>{t(c=>{const u=[...c.order],d=u.indexOf(a);if(d<0)return c;const p=l==="up"?d-1:d+1;if(p<0||p>=u.length)return c;[u[d],u[p]]=[u[p],u[d]];const g={...c,order:u};return L7(g),g})},[]),s=A.useCallback(()=>{L7(BS),t(BS)},[]);return{config:e,visibleWidgets:r,isVisible:n,toggleWidget:i,moveWidget:o,resetToDefaults:s}}function m_e({open:e,config:t,onToggle:n,onMove:r,onReset:i,onClose:o}){const s=new Map(FS.map(a=>[a.id,a]));return h.jsxs(Po,{open:e,onClose:o,maxWidth:"xs",fullWidth:!0,children:[h.jsx(Lo,{children:"Customize Dashboard"}),h.jsx($o,{dividers:!0,children:h.jsx(Fo,{disablePadding:!0,children:t.order.map((a,l)=>{const c=s.get(a);if(!c)return null;const u=t.hidden.includes(a);return h.jsxs(Cs,{sx:{opacity:u?.5:1},secondaryAction:h.jsxs(h.Fragment,{children:[h.jsx(Nt,{title:"Move up",children:h.jsx("span",{children:h.jsx(Wt,{size:"small",disabled:l===0,onClick:()=>r(a,"up"),children:h.jsx(lC,{fontSize:"small"})})})}),h.jsx(Nt,{title:"Move down",children:h.jsx("span",{children:h.jsx(Wt,{size:"small",disabled:l===t.order.length-1,onClick:()=>r(a,"down"),children:h.jsx(aC,{fontSize:"small"})})})})]}),children:[h.jsx(jo,{sx:{minWidth:36},children:h.jsx(Wt,{size:"small",onClick:()=>n(a),children:u?h.jsx(ADe,{fontSize:"small"}):h.jsx(kDe,{fontSize:"small",color:"primary"})})}),h.jsx(so,{primary:c.label,secondary:c.description,secondaryTypographyProps:{variant:"caption"}})]},a)})})}),h.jsxs(es,{children:[h.jsx(qe,{startIcon:h.jsx(Oh,{}),onClick:i,color:"warning",children:"Reset"}),h.jsx(qe,{onClick:o,variant:"contained",children:"Done"})]})]})}const g_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 f3({title:e,value:t,icon:n,color:r,subtitle:i,onClick:o}){const s=h.jsx(Yn,{sx:{py:2,"&:last-child":{pb:2}},children:h.jsxs(ae,{display:"flex",sx:{flexDirection:{xs:"column",sm:"row"},alignItems:"center",gap:{xs:1,sm:2},textAlign:{xs:"center",sm:"left"}},children:[h.jsx(wl,{sx:{bgcolor:`${r}20`,color:r,width:{xs:40,sm:48},height:{xs:40,sm:48},flexShrink:0},children:n}),h.jsxs(ae,{sx:{minWidth:0},children:[h.jsx(re,{fontWeight:700,lineHeight:1.1,noWrap:!0,sx:{fontSize:{xs:"1.5rem",sm:"2.125rem"}},children:t}),h.jsx(re,{variant:"body2",color:"text.secondary",noWrap:!0,children:e}),i&&h.jsx(re,{variant:"caption",color:"text.secondary",noWrap:!0,children:i})]})]})});return h.jsx(On,{variant:"outlined",sx:{height:"100%"},children:o?h.jsx(Nu,{onClick:o,sx:{height:"100%"},children:s}):s})}function y_e({bridge:e,order:t,onClick:n}){const{t:r}=on(),{content:i}=hg(),o=i?.find(c=>c.id===e.id),[s,a]=A.useState(!1);A.useEffect(()=>{dC(e.id).then(a)},[e.id]);const l=e.status==="running"?"success":e.status==="failed"?"error":"default";return h.jsx(On,{variant:"outlined",children:h.jsx(Nu,{onClick:n,children:h.jsx(Yn,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:1.5,children:[h.jsx(ft,{label:`#${t}`,size:"small",color:"primary",variant:"outlined",sx:{minWidth:28,height:22,fontSize:"0.65rem",fontWeight:"bold",flexShrink:0}}),s?h.jsx(ae,{component:"img",src:_2(e.id),alt:e.name,sx:{width:36,height:36,borderRadius:"50%",objectFit:"cover"}}):o&&h.jsx(wl,{sx:{bgcolor:MM(o),width:36,height:36},children:(()=>{const c=TM(o);return h.jsx(c,{sx:{fontSize:20}})})()}),h.jsxs(ae,{flex:1,minWidth:0,children:[h.jsx(re,{variant:"subtitle2",noWrap:!0,children:e.name}),h.jsxs(Vt,{direction:"row",spacing:.5,alignItems:"center",children:[h.jsx(ft,{label:e.status,size:"small",color:l,sx:{height:18,fontSize:"0.65rem"}}),h.jsxs(re,{variant:"caption",color:"text.secondary",children:[e.deviceCount," ",r("common.devices").toLowerCase()]}),e.fabricCount>0&&h.jsxs(re,{variant:"caption",color:"text.secondary",children:["· ",e.fabricCount," ",r("common.fabrics").toLowerCase()]})]})]}),e.failedEntityCount>0&&h.jsx(ft,{icon:h.jsx(ug,{sx:{fontSize:14}}),label:e.failedEntityCount,size:"small",color:"warning",variant:"outlined",sx:{height:22}})]})})})})}function uu({title:e,icon:t,onClick:n}){return h.jsx(On,{variant:"outlined",children:h.jsx(Nu,{onClick:n,children:h.jsx(Yn,{sx:{py:1.5,"&:last-child":{pb:1.5}},children:h.jsxs(ae,{display:"flex",alignItems:"center",gap:1.5,children:[h.jsx(wl,{sx:{bgcolor:"action.selected",color:"text.secondary",width:36,height:36},children:t}),h.jsx(re,{variant:"subtitle2",children:e})]})})})})}const b_e=()=>{const{t:e}=on(),t=qi(),n=jc(),r=Ms(),[i,o]=A.useState(null),[s,a]=A.useState(!0),[l,c]=A.useState(!1),[u,d]=A.useState(!1),p=A.useRef(!1),[g,y]=A.useState(!1),b=p_e(),[v,S]=A.useState(()=>localStorage.getItem("hamh-first-success-dismissed")==="true"),C=A.useCallback(async()=>{try{const I=await fetch("api/health/detailed");I.ok&&o(await I.json())}catch{}finally{a(!1)}},[]);A.useEffect(()=>{C();const I=setInterval(C,15e3);return()=>clearInterval(I)},[C]);const w=A.useMemo(()=>i?.bridgeDetails.reduce((I,P)=>I+P.deviceCount,0)??0,[i]),k=A.useMemo(()=>i?.bridgeDetails?i.bridgeDetails.reduce((I,P)=>I+P.fabricCount,0):0,[i]),E=A.useMemo(()=>i?.bridgeDetails.reduce((I,P)=>I+P.failedEntityCount,0)??0,[i]);if(s)return h.jsx(ae,{display:"flex",justifyContent:"center",p:8,children:h.jsx(Jn,{})});const O=i?.services.bridges,_=i?.services.homeAssistant.connected??!1,T=(O?.total??0)>0;return h.jsxs(ae,{sx:{p:2},children:[h.jsxs(ae,{display:"flex",alignItems:"center",gap:2,mb:3,children:[h.jsx(CM,{color:"primary",fontSize:"large"}),h.jsx(re,{variant:"h5",fontWeight:600,component:"h1",children:e("dashboard.title")}),T&&h.jsx(Wt,{size:"small",onClick:()=>y(!0),sx:{ml:"auto"},title:e("dashboard.customizeDashboard"),children:h.jsx(wDe,{})})]}),T&&k>0&&!v&&h.jsx(zt,{severity:"success",sx:{mb:2},action:h.jsx(Wt,{size:"small",color:"inherit",onClick:()=>{S(!0),localStorage.setItem("hamh-first-success-dismissed","true")},children:h.jsx(LS,{fontSize:"small"})}),children:e("dashboard.successMessage",{count:k})}),!T&&!s&&h.jsx(On,{sx:{mb:3,background:I=>`linear-gradient(135deg, ${I.palette.primary.dark}15, ${I.palette.secondary.dark}15)`,border:"1px solid",borderColor:"divider"},children:h.jsxs(Yn,{sx:{textAlign:"center",py:5,px:3},children:[h.jsx(Ny,{sx:{fontSize:56,color:"primary.main",mb:2}}),h.jsx(re,{variant:"h5",fontWeight:600,gutterBottom:!0,children:e("dashboard.welcome")}),h.jsx(re,{variant:"body1",color:"text.secondary",sx:{maxWidth:520,mx:"auto",mb:4},children:e("dashboard.welcomeDescription")}),h.jsxs(Vt,{direction:{xs:"column",sm:"row"},spacing:2,justifyContent:"center",sx:{mb:3},children:[h.jsx(qe,{variant:"contained",size:"large",startIcon:h.jsx(YD,{}),onClick:()=>c(!0),children:e("dashboard.bridgeWizard")}),h.jsx(qe,{variant:"outlined",size:"large",startIcon:h.jsx(C4,{}),onClick:()=>n(Tt.areaSetup),children:e("dashboard.setupByArea")}),h.jsx(qe,{variant:"outlined",size:"large",startIcon:h.jsx(Ds,{}),onClick:()=>n(Tt.createBridge),children:e("dashboard.manualSetup")})]}),h.jsx(qe,{size:"small",endIcon:h.jsx(oee,{sx:{fontSize:14}}),href:"https://t0bst4r.github.io/home-assistant-matter-hub/",target:"_blank",rel:"noopener",children:e("dashboard.documentation")})]})}),T&&b.visibleWidgets.map((I,P)=>h.jsxs(ae,{children:[P>0&&h.jsx(Dr,{sx:{my:3}}),I==="stats"&&h.jsxs(dt,{container:!0,spacing:2,sx:{mb:3},children:[h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("nav.bridges"),value:O?.total??0,icon:h.jsx(Ny,{}),color:t.palette.success.main,subtitle:O?`${O.running} running${O.failed>0?` · ${O.failed} failed`:""}`:void 0,onClick:()=>n(Tt.bridges)})}),h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("common.devices"),value:w,icon:h.jsx(aa,{}),color:t.palette.primary.main,subtitle:E>0?h.jsx(ft,{icon:h.jsx(ug,{sx:{fontSize:14}}),label:`${E} failed`,size:"small",color:"warning",variant:"outlined",clickable:!0,onClick:L=>{L.stopPropagation(),n(`${Tt.devices}?showFailed=true`)},sx:{height:22,fontSize:"0.7rem"}}):void 0,onClick:()=>n(Tt.devices)})}),h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("common.fabrics"),value:k,icon:h.jsx(Jh,{}),color:t.palette.secondary.main,onClick:()=>n(Tt.networkMap)})}),h.jsx(dt,{size:{xs:6,sm:3},children:h.jsx(f3,{title:e("dashboard.haConnection"),value:e(_?"common.online":"common.offline"),icon:_?h.jsx(Ja,{}):h.jsx(jf,{}),color:_?t.palette.success.main:t.palette.error.main,subtitle:i?.uptime!=null?`${e("health.uptime")} ${g_e(i.uptime)}`:void 0})})]}),I==="bridges"&&h.jsxs(h.Fragment,{children:[h.jsx(ae,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,flexWrap:"wrap",gap:1,children:h.jsx(re,{variant:"h6",children:e("nav.bridges")})}),h.jsxs(Vt,{direction:"row",spacing:1.5,sx:{mb:2},flexWrap:"wrap",useFlexGap:!0,children:[h.jsx(qe,{variant:"contained",startIcon:h.jsx(YD,{}),onClick:()=>c(!0),size:"large",children:e("dashboard.bridgeWizard")}),h.jsx(qe,{variant:"outlined",startIcon:h.jsx(Ds,{}),onClick:()=>n(Tt.createBridge),size:"large",children:e("dashboard.createBridge")}),h.jsx(qe,{variant:"outlined",startIcon:h.jsx(C4,{}),onClick:()=>n(Tt.areaSetup),size:"large",children:e("dashboard.areaSetup")}),h.jsx(Dr,{orientation:"vertical",flexItem:!0}),h.jsx(qe,{variant:"outlined",color:"success",startIcon:h.jsx(see,{}),disabled:u,onClick:async()=>{if(!p.current){p.current=!0,d(!0);try{await SZ(),await C()}finally{d(!1),p.current=!1}}},children:e("dashboard.startAll")}),h.jsx(qe,{variant:"outlined",color:"error",startIcon:h.jsx(lee,{}),disabled:u,onClick:async()=>{if(!p.current){p.current=!0,d(!0);try{await wZ(),await C()}finally{d(!1),p.current=!1}}},children:e("dashboard.stopAll")}),h.jsx(qe,{variant:"outlined",color:"warning",startIcon:h.jsx(R0,{}),disabled:u,onClick:async()=>{if(!p.current){p.current=!0,d(!0);try{await CZ(),await C()}finally{d(!1),p.current=!1}}},children:e("dashboard.restartAll")})]}),i?.bridgeDetails&&i.bridgeDetails.length>0?h.jsx(dt,{container:!0,spacing:1.5,children:[...i.bridgeDetails].sort((L,M)=>(L.priority??100)-(M.priority??100)).map((L,M)=>h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(y_e,{bridge:L,order:M+1,onClick:()=>n(Tt.bridge(L.id))})},L.id))}):h.jsx(On,{variant:"outlined",children:h.jsx(Yn,{sx:{textAlign:"center",py:4},children:h.jsx(re,{color:"text.secondary",children:e("dashboard.noBridgesHint")})})})]}),I==="quickNav"&&h.jsxs(h.Fragment,{children:[h.jsx(re,{variant:"h6",sx:{mb:2},children:e("dashboard.quickNavigation")}),h.jsxs(dt,{container:!0,spacing:1.5,children:[h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.bridges"),icon:h.jsx(Ny,{sx:{fontSize:20}}),onClick:()=>n(Tt.bridges)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.areaSetup"),icon:h.jsx(C4,{sx:{fontSize:20}}),onClick:()=>n(Tt.areaSetup)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.devices"),icon:h.jsx(aa,{sx:{fontSize:20}}),onClick:()=>n(Tt.devices)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.networkMap"),icon:h.jsx(xM,{sx:{fontSize:20}}),onClick:()=>n(Tt.networkMap)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.health"),icon:h.jsx(rM,{sx:{fontSize:20}}),onClick:()=>n(Tt.health)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.startupOrder"),icon:h.jsx(cg,{sx:{fontSize:20}}),onClick:()=>n(Tt.startup)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.lockCredentials"),icon:h.jsx(Tu,{sx:{fontSize:20}}),onClick:()=>n(Tt.lockCredentials)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("dashboard.filterReference"),icon:h.jsx(EM,{sx:{fontSize:20}}),onClick:()=>n(Tt.labels)})}),h.jsx(dt,{size:{xs:12,sm:6,md:4},children:h.jsx(uu,{title:e("nav.settings"),icon:h.jsx(fg,{sx:{fontSize:20}}),onClick:()=>n(Tt.settings)})})]})]})]},I)),h.jsx(m_e,{open:g,config:b.config,onToggle:b.toggleWidget,onMove:b.moveWidget,onReset:b.resetToDefaults,onClose:()=>y(!1)}),h.jsx(hee,{open:l,onClose:()=>c(!1),onComplete:()=>{r(No()),C()}})]})};function v_e(e){return et("MuiPagination",e)}it("MuiPagination",["root","ul","outlined","text"]);function x_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:c,showFirstButton:u=!1,showLastButton:d=!1,siblingCount:p=1,...g}=e,[y,b]=ml({controlled:c,default:i,name:n,state:"page"}),v=(I,P)=>{c||b(P),l&&l(I,P)},S=(I,P)=>{const L=P-I+1;return Array.from({length:L},(M,$)=>I+$)},C=S(1,Math.min(t,r)),w=S(Math.max(r-t+1,t+1),r),k=Math.max(Math.min(y-p,r-t-p*2-1),t+2),E=Math.min(Math.max(y+p,t+p*2+2),r-t-1),O=[...u?["first"]:[],...a?[]:["previous"],...C,...k>t+2?["start-ellipsis"]:t+1<r-t?[t+1]:[],...S(k,E),...E<r-t-1?["end-ellipsis"]:r-t>t?[r-t]:[],...w,...s?[]:["next"],...d?["last"]:[]],_=I=>{switch(I){case"first":return 1;case"previous":return y-1;case"next":return y+1;case"last":return r;default:return null}};return{items:O.map(I=>typeof I=="number"?{onClick:P=>{v(P,I)},type:"page",page:I,selected:I===y,disabled:o,"aria-current":I===y?"page":void 0}:{onClick:P=>{v(P,_(I))},type:I,page:_(I),selected:!1,disabled:o||!I.includes("ellipsis")&&(I==="next"||I==="last"?y>=r:y<=1)}),...g}}function S_e(e){return et("MuiPaginationItem",e)}const Go=it("MuiPaginationItem",["root","page","sizeSmall","sizeLarge","text","textPrimary","textSecondary","outlined","outlinedPrimary","outlinedSecondary","rounded","ellipsis","firstLast","previousNext","focusVisible","disabled","selected","icon","colorPrimary","colorSecondary"]),w_e=Ee(h.jsx("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"})),C_e=Ee(h.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})),E_e=Ee(h.jsx("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),k_e=Ee(h.jsx("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),mee=(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ve(n.size)}`],n.variant==="text"&&t[`text${ve(n.color)}`],n.variant==="outlined"&&t[`outlined${ve(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]},A_e=e=>{const{classes:t,color:n,disabled:r,selected:i,size:o,shape:s,type:a,variant:l}=e,c={root:["root",`size${ve(o)}`,l,s,n!=="standard"&&`color${ve(n)}`,n!=="standard"&&`${l}${ve(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 tt(c,S_e,t)},D_e=ge("div",{name:"MuiPaginationItem",slot:"Root",overridesResolver:mee})(Ke(({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",[`&.${Go.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:{size:"small"},style:{minWidth:26,borderRadius:26/2,margin:"0 1px",padding:"0 4px"}},{props:{size:"large"},style:{minWidth:40,borderRadius:40/2,padding:"0 10px",fontSize:e.typography.pxToRem(15)}}]}))),__e=ge(os,{name:"MuiPaginationItem",slot:"Root",overridesResolver:mee})(Ke(({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,[`&.${Go.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Go.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"}},[`&.${Go.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}},[`&.${Go.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},[`&.${Go.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)"}`,[`&.${Go.selected}`]:{[`&.${Go.disabled}`]:{borderColor:(e.vars||e).palette.action.disabledBackground,color:(e.vars||e).palette.action.disabled}}}},{props:{variant:"text"},style:{[`&.${Go.selected}`]:{[`&.${Go.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}},...Object.entries(e.palette).filter(Wn(["dark","contrastText"])).map(([t])=>({props:{variant:"text",color:t},style:{[`&.${Go.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}},[`&.${Go.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark},[`&.${Go.disabled}`]:{color:(e.vars||e).palette.action.disabled}}}})),...Object.entries(e.palette).filter(Wn(["light"])).map(([t])=>({props:{variant:"outlined",color:t},style:{[`&.${Go.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"}},[`&.${Go.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.activatedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))]}))),O_e=ge("div",{name:"MuiPaginationItem",slot:"Icon"})(Ke(({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)}}]}))),T_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiPaginationItem"}),{className:i,color:o="standard",component:s,components:a={},disabled:l=!1,page:c,selected:u=!1,shape:d="circular",size:p="medium",slots:g={},slotProps:y={},type:b="page",variant:v="text",...S}=r,C={...r,color:o,disabled:l,selected:u,shape:d,size:p,type:b,variant:v},w=Pc(),k=A_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},[O,_]=ut("previous",{elementType:E_e,externalForwardedProps:E,ownerState:C}),[T,I]=ut("next",{elementType:k_e,externalForwardedProps:E,ownerState:C}),[P,L]=ut("first",{elementType:w_e,externalForwardedProps:E,ownerState:C}),[M,$]=ut("last",{elementType:C_e,externalForwardedProps:E,ownerState:C}),N=w?{previous:"next",next:"previous",first:"last",last:"first"}[b]:b,z={previous:O,next:T,first:P,last:M}[N],F={previous:_,next:I,first:L,last:$}[N];return b==="start-ellipsis"||b==="end-ellipsis"?h.jsx(D_e,{ref:n,ownerState:C,className:Oe(k.root,i),children:"…"}):h.jsxs(__e,{ref:n,ownerState:C,component:s,disabled:l,className:Oe(k.root,i),...S,children:[b==="page"&&c,z?h.jsx(O_e,{...F,className:k.icon,as:z}):null]})}),M_e=e=>{const{classes:t,variant:n}=e;return tt({root:["root",n],ul:["ul"]},v_e,t)},R_e=ge("nav",{name:"MuiPagination",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})({}),I_e=ge("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 P_e=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiPagination"}),{boundaryCount:i=1,className:o,color:s="standard",count:a=1,defaultPage:l=1,disabled:c=!1,getItemAriaLabel:u=j_e,hideNextButton:d=!1,hidePrevButton:p=!1,onChange:g,page:y,renderItem:b=P=>h.jsx(T_e,{...P}),shape:v="circular",showFirstButton:S=!1,showLastButton:C=!1,siblingCount:w=1,size:k="medium",variant:E="text",...O}=r,{items:_}=x_e({...r,componentName:"Pagination"}),T={...r,boundaryCount:i,color:s,count:a,defaultPage:l,disabled:c,getItemAriaLabel:u,hideNextButton:d,hidePrevButton:p,renderItem:b,shape:v,showFirstButton:S,showLastButton:C,siblingCount:w,size:k,variant:E},I=M_e(T);return h.jsx(R_e,{"aria-label":"pagination navigation",className:Oe(I.root,o),ownerState:T,ref:n,...O,children:h.jsx(I_e,{className:I.ul,ownerState:T,children:_.map((P,L)=>h.jsx("li",{children:b({...P,color:s,"aria-label":u(P.type,P.page,P.selected),shape:v,size:k,variant:E})},L))})})}),aH=[10,25,50,100],lH="hamh-devices-page-size",$_e=()=>{const{t:e}=on(),t=Ms(),{content:n,isLoading:r}=hg(),[i,o]=zme(),s=i.get("showFailed")==="true",[a,l]=A.useState(""),[c,u]=A.useState(""),[d,p]=A.useState(""),[g,y]=A.useState("name"),[b,v]=A.useState("asc"),[S,C]=A.useState(1),[w,k]=A.useState(()=>{const ue=localStorage.getItem(lH);if(!ue)return 12;if(ue==="all")return 0;const ke=parseInt(ue,10);return ke>0?ke:12}),[E,O]=A.useState(""),_=A.useCallback(ue=>{k(ue),localStorage.setItem(lH,ue===0?"all":String(ue)),C(1)},[]),[T,I]=A.useState(!1),[P,L]=A.useState(""),[M,$]=A.useState(""),[N,z]=A.useState(),[F,W]=A.useState({open:!1,message:"",severity:"success"});A.useEffect(()=>{t(No())},[t]),A.useEffect(()=>{n&&n.forEach(ue=>{t(Mu(ue.id))})},[t,n]);const V=lg(ue=>ue.devices.byBridge),q=A.useCallback((ue,ke,_e)=>{const Ue=[];if(!ue.parts||ue.parts.length===0)ue.endpoint!==0&&Ue.push({bridgeId:ke,bridgeName:_e,endpoint:ue});else for(const He of ue.parts)Ue.push(...q(He,ke,_e));return Ue},[]),X=A.useMemo(()=>{const ue=[];return(n||[]).forEach(ke=>{const Ue=V[ke.id]?.content;Ue&&ue.push(...q(Ue,ke.id,ke.name))}),ue},[n,V,q]),[B,U]=A.useState({}),Y=A.useMemo(()=>{const ue=[];for(const ke of X){const Ue=ke.endpoint.state.homeAssistantEntity?.entity?.entity_id;Ue&&ue.push(Ue)}return ue},[X]),H=A.useCallback(()=>{Y.length!==0&&MQ(Y).then(U).catch(()=>{})},[Y]);A.useEffect(()=>{H()},[H]);const G=A.useCallback(()=>{H()},[H]),Z=r||n&&n.length>0&&X.length===0,oe=A.useMemo(()=>{if(!n)return[];const ue=[];for(const ke of n)for(const _e of ke.failedEntities??[])ue.push({..._e,bridgeName:ke.name});return ue},[n]),ee=A.useCallback(()=>{o(ue=>(ue.delete("showFailed"),ue))},[o]),ie=A.useMemo(()=>X.filter(ue=>{const ke=ta(ue.endpoint.state)??ue.endpoint.id.local,_e=ue.endpoint.type.name,Ue=ke.toLowerCase().includes(a.toLowerCase())||ue.bridgeName.toLowerCase().includes(a.toLowerCase())||_e.toLowerCase().includes(a.toLowerCase()),He=!c||ue.bridgeId===c;return Ue&&He&&(!d||_e===d)}),[X,a,c,d]),te=A.useMemo(()=>[...ie].sort((ke,_e)=>{const Ue=ta(ke.endpoint.state)??ke.endpoint.id.local,He=ta(_e.endpoint.state)??_e.endpoint.id.local;let Dt=0;switch(g){case"name":Dt=Ue.localeCompare(He);break;case"type":Dt=ke.endpoint.type.name.localeCompare(_e.endpoint.type.name),Dt===0&&(Dt=Ue.localeCompare(He));break;case"bridge":Dt=ke.bridgeName.localeCompare(_e.bridgeName),Dt===0&&(Dt=Ue.localeCompare(He));break}return b==="asc"?Dt:-Dt}),[ie,g,b]),J=w===0?1:Math.ceil(te.length/w),Q=w===0?te:te.slice((S-1)*w,S*w),se=A.useMemo(()=>{const ue=new Set(X.map(ke=>ke.endpoint.type.name));return Array.from(ue).sort()},[X]),le=A.useMemo(()=>n?[...n].sort((ue,ke)=>{const _e=ue.name.localeCompare(ke.name);return b==="asc"?_e:-_e}):[],[n,b]),he=A.useCallback(()=>{t(No())},[t]),ye=A.useCallback(async(ue,ke)=>{L(ue),$(ke);try{const Ue=(await dM(ke)).mappings.find(He=>He.entityId===ue);z(Ue)}catch{z(void 0)}I(!0)},[]),Me=A.useCallback(async ue=>{if(!(!M||!P))try{await fM(M,P,ue),W({open:!0,message:e("mapping.saved",{entityId:P}),severity:"success"}),I(!1)}catch(ke){W({open:!0,message:e("mapping.saveFailed",{error:String(ke)}),severity:"error"})}},[M,P,e]);return Z?h.jsx(ae,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(Jn,{})}):h.jsxs(ae,{sx:{p:2},children:[h.jsxs(re,{variant:"h4",gutterBottom:!0,sx:{display:"flex",alignItems:"center",gap:2},children:[h.jsx(aa,{}),e("nav.devices"),h.jsx(qe,{variant:"outlined",startIcon:h.jsx(Zb,{}),onClick:he,sx:{ml:"auto"},children:e("common.refresh")})]}),s&&oe.length>0&&h.jsxs(zt,{severity:"warning",sx:{mb:3},action:h.jsx(Wt,{size:"small",color:"inherit",onClick:ee,children:h.jsx(LS,{fontSize:"small"})}),children:[h.jsx(re,{variant:"body2",fontWeight:"bold",gutterBottom:!0,children:e("devices.failedEntitiesTitle",{count:oe.length,defaultValue:`${oe.length} failed entities`})}),h.jsx(Fo,{dense:!0,disablePadding:!0,children:oe.map(ue=>h.jsxs(Cs,{sx:{py:0},children:[h.jsx(jo,{sx:{minWidth:32},children:h.jsx(ug,{color:"warning",fontSize:"small"})}),h.jsx(so,{primary:ue.entityId,secondary:`${ue.bridgeName} — ${ue.reason}`,primaryTypographyProps:{variant:"body2",fontWeight:"bold"},secondaryTypographyProps:{variant:"caption"}})]},`${ue.bridgeName}-${ue.entityId}`))})]}),s&&oe.length===0&&h.jsx(zt,{severity:"success",sx:{mb:3},action:h.jsx(Wt,{size:"small",color:"inherit",onClick:ee,children:h.jsx(LS,{fontSize:"small"})}),children:h.jsx(re,{variant:"body2",children:e("devices.noFailedEntities",{defaultValue:"No failed entities — all devices loaded successfully."})})}),h.jsx(On,{sx:{mb:3},children:h.jsx(Yn,{children:h.jsxs(Vt,{spacing:2,direction:{xs:"column",md:"row"},alignItems:{md:"center"},children:[h.jsx(Zn,{label:e("devices.searchPlaceholder"),value:a,onChange:ue=>l(ue.target.value),sx:{flexGrow:1}}),h.jsxs(rs,{sx:{minWidth:200},children:[h.jsx(ja,{children:e("devices.filterBridge")}),h.jsxs(ts,{value:c,label:e("devices.filterBridge"),onChange:ue=>u(ue.target.value),children:[h.jsx(Nn,{value:"",children:e("devices.allBridges")}),le.map(ue=>h.jsx(Nn,{value:ue.id,children:ue.name},ue.id))]})]}),h.jsxs(rs,{sx:{minWidth:200},children:[h.jsx(ja,{children:e("devices.filterDeviceType")}),h.jsxs(ts,{value:d,label:e("devices.filterDeviceType"),onChange:ue=>p(ue.target.value),children:[h.jsx(Nn,{value:"",children:e("devices.allTypes")}),se.map(ue=>h.jsx(Nn,{value:ue,children:ue},ue))]})]}),h.jsxs(rs,{sx:{minWidth:150},children:[h.jsx(ja,{children:e("devices.sortBy")}),h.jsxs(ts,{value:g,label:e("devices.sortBy"),onChange:ue=>y(ue.target.value),children:[h.jsx(Nn,{value:"bridge",children:e("devices.sortBridge")}),h.jsx(Nn,{value:"type",children:e("devices.sortType")}),h.jsx(Nn,{value:"name",children:e("devices.sortName")})]})]}),h.jsx(Nt,{title:e(b==="asc"?"common.ascending":"common.descending"),children:h.jsx(Wt,{onClick:()=>v(ue=>ue==="asc"?"desc":"asc"),color:"primary",children:b==="asc"?h.jsx(lC,{}):h.jsx(aC,{})})})]})})}),h.jsx(dt,{container:!0,spacing:2,children:Q.map(ue=>h.jsx(dt,{size:{xs:12,sm:6,lg:4},children:h.jsx(IQ,{endpoint:ue.endpoint,bridgeName:ue.bridgeName,bridgeId:ue.bridgeId,onEditMapping:ye,imageInfo:B[ue.endpoint.state.homeAssistantEntity?.entity?.entity_id??""],onImageChanged:G})},`${ue.bridgeId}-${ue.endpoint.id.global}`))}),h.jsxs(ae,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:3,gap:2,flexWrap:"wrap"},children:[h.jsxs(Vt,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:"Per page:"}),h.jsxs(ts,{value:w===0?"all":aH.includes(w)?String(w):"",onChange:ue=>{const ke=ue.target.value;O(""),_(ke==="all"?0:parseInt(ke,10))},displayEmpty:!0,renderValue:ue=>ue==="all"?e("common.all"):ue===""?String(w):ue,size:"small",sx:{minWidth:80},children:[aH.map(ue=>h.jsx(Nn,{value:String(ue),children:ue},ue)),h.jsx(Nn,{value:"all",children:e("common.all")})]}),h.jsx(Zn,{size:"small",type:"number",placeholder:e("common.custom"),value:E,onChange:ue=>O(ue.target.value),onBlur:()=>{const ue=parseInt(E,10);ue>0&&_(ue),O("")},onKeyDown:ue=>{if(ue.key==="Enter"){const ke=parseInt(E,10);ke>0&&_(ke),O("")}},slotProps:{htmlInput:{min:1,style:{textAlign:"center"}}},sx:{width:80}})]}),J>1&&h.jsx(P_e,{count:J,page:S,onChange:(ue,ke)=>C(ke),color:"primary"}),h.jsx(re,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:ie.length===X.length?e("devices.deviceCount",{count:X.length}):e("devices.filteredCount",{filtered:ie.length,total:X.length})})]}),ie.length===0&&h.jsxs(ae,{sx:{textAlign:"center",py:8},children:[h.jsx(re,{variant:"h6",color:"text.secondary",children:"No devices found"}),h.jsx(re,{variant:"body2",color:"text.secondary",children:"Try adjusting your filters or check if any bridges are running"})]}),h.jsx(hM,{open:T,entityId:P,domain:P.split(".")[0]||"",currentMapping:N,onSave:Me,onClose:()=>I(!1)}),h.jsx(Pw,{open:F.open,autoHideDuration:6e3,onClose:()=>W(ue=>({...ue,open:!1})),children:h.jsx(zt,{onClose:()=>W(ue=>({...ue,open:!1})),severity:F.severity,sx:{width:"100%"},children:F.message})})]})};function En(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 L_e(e){return e.additionalItems===!0&&console.warn("additionalItems=true is currently not supported"),En(e.additionalItems)}function cH(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 Ru="__additional_property",O2="additionalProperties",zu="allOf",Vn="anyOf",za="const",hC="default",IM="dependencies",N_e="enum",wo="__errors",kr="$id",jM="if",Zh="items",F_e="_$junk_option_schema_id$_",E4="$name",gn="oneOf",JD="patternProperties",nr="properties",N7="readonly",gee="required",zS="submitButtonOptions",Ar="$ref",dy="$schema",yee="root",bee="_",B_e=["discriminator","propertyName"],uH="formContext",z_e="layoutGridLookupMap",PM="__rjsf_additionalProperties",vee="__rjsf_rootSchema",H_e="ui:field",$M="ui:widget",nf="ui:options",ZD="ui:globalOptions",U_e="ui:definitions",V_e="https://json-schema.org/draft/2019-09/schema",k4="https://json-schema.org/draft/2020-12/schema";function Kt(e={},t={}){return e?Object.keys(e).filter(n=>n.indexOf("ui:")===0).reduce((n,r)=>{const i=e[r];return r===$M&&En(i)?(console.error("Setting options via ui:widget object is no longer supported, use ui:options instead"),n):r===nf&&En(i)?{...n,...i}:{...n,[r.substring(3)]:i}},{...t}):{...t}}function xee(e,t={},n){if(!(e.additionalProperties||e.patternProperties))return!1;const{expandable:r=!0}=Kt(t);return r===!1?r:e.maxProperties!==void 0&&n?Object.keys(n).length<e.maxProperties:!0}var See=typeof global=="object"&&global&&global.Object===Object&&global,W_e=typeof self=="object"&&self&&self.Object===Object&&self,Lc=See||W_e||Function("return this")(),Ha=Lc.Symbol,wee=Object.prototype,q_e=wee.hasOwnProperty,G_e=wee.toString,B1=Ha?Ha.toStringTag:void 0;function K_e(e){var t=q_e.call(e,B1),n=e[B1];try{e[B1]=void 0;var r=!0}catch{}var i=G_e.call(e);return r&&(t?e[B1]=n:delete e[B1]),i}var Y_e=Object.prototype,X_e=Y_e.toString;function J_e(e){return X_e.call(e)}var Z_e="[object Null]",Q_e="[object Undefined]",dH=Ha?Ha.toStringTag:void 0;function Yu(e){return e==null?e===void 0?Q_e:Z_e:dH&&dH in Object(e)?K_e(e):J_e(e)}function Cee(e,t){return function(n){return e(t(n))}}var pC=Cee(Object.getPrototypeOf,Object);function Ua(e){return e!=null&&typeof e=="object"}var eOe="[object Object]",tOe=Function.prototype,nOe=Object.prototype,Eee=tOe.toString,rOe=nOe.hasOwnProperty,iOe=Eee.call(Object);function gf(e){if(!Ua(e)||Yu(e)!=eOe)return!1;var t=pC(e);if(t===null)return!0;var n=rOe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Eee.call(n)==iOe}function QD(e){const t={[wo]:[],addError(n){this[wo].push(n)}};if(Array.isArray(e))return e.reduce((n,r,i)=>({...n,[i]:QD(r)}),t);if(gf(e)){const n=e;return Object.keys(n).reduce((r,i)=>({...r,[i]:QD(n[i])}),t)}return t}function oOe(){this.__data__=[],this.size=0}function Qb(e,t){return e===t||e!==e&&t!==t}function mC(e,t){for(var n=e.length;n--;)if(Qb(e[n][0],t))return n;return-1}var sOe=Array.prototype,aOe=sOe.splice;function lOe(e){var t=this.__data__,n=mC(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():aOe.call(t,n,1),--this.size,!0}function cOe(e){var t=this.__data__,n=mC(t,e);return n<0?void 0:t[n][1]}function uOe(e){return mC(this.__data__,e)>-1}function dOe(e,t){var n=this.__data__,r=mC(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Xu(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])}}Xu.prototype.clear=oOe;Xu.prototype.delete=lOe;Xu.prototype.get=cOe;Xu.prototype.has=uOe;Xu.prototype.set=dOe;function fOe(){this.__data__=new Xu,this.size=0}function hOe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function pOe(e){return this.__data__.get(e)}function mOe(e){return this.__data__.has(e)}function Qn(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gOe="[object AsyncFunction]",yOe="[object Function]",bOe="[object GeneratorFunction]",vOe="[object Proxy]";function ev(e){if(!Qn(e))return!1;var t=Yu(e);return t==yOe||t==bOe||t==gOe||t==vOe}var F7=Lc["__core-js_shared__"],fH=(function(){var e=/[^.]+$/.exec(F7&&F7.keys&&F7.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function xOe(e){return!!fH&&fH in e}var SOe=Function.prototype,wOe=SOe.toString;function mp(e){if(e!=null){try{return wOe.call(e)}catch{}try{return e+""}catch{}}return""}var COe=/[\\^$.*+?()[\]{}|]/g,EOe=/^\[object .+?Constructor\]$/,kOe=Function.prototype,AOe=Object.prototype,DOe=kOe.toString,_Oe=AOe.hasOwnProperty,OOe=RegExp("^"+DOe.call(_Oe).replace(COe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function TOe(e){if(!Qn(e)||xOe(e))return!1;var t=ev(e)?OOe:EOe;return t.test(mp(e))}function MOe(e,t){return e?.[t]}function gp(e,t){var n=MOe(e,t);return TOe(n)?n:void 0}var T2=gp(Lc,"Map"),M2=gp(Object,"create");function ROe(){this.__data__=M2?M2(null):{},this.size=0}function IOe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var jOe="__lodash_hash_undefined__",POe=Object.prototype,$Oe=POe.hasOwnProperty;function LOe(e){var t=this.__data__;if(M2){var n=t[e];return n===jOe?void 0:n}return $Oe.call(t,e)?t[e]:void 0}var NOe=Object.prototype,FOe=NOe.hasOwnProperty;function BOe(e){var t=this.__data__;return M2?t[e]!==void 0:FOe.call(t,e)}var zOe="__lodash_hash_undefined__";function HOe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=M2&&t===void 0?zOe:t,this}function Qh(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])}}Qh.prototype.clear=ROe;Qh.prototype.delete=IOe;Qh.prototype.get=LOe;Qh.prototype.has=BOe;Qh.prototype.set=HOe;function UOe(){this.size=0,this.__data__={hash:new Qh,map:new(T2||Xu),string:new Qh}}function VOe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function gC(e,t){var n=e.__data__;return VOe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function WOe(e){var t=gC(this,e).delete(e);return this.size-=t?1:0,t}function qOe(e){return gC(this,e).get(e)}function GOe(e){return gC(this,e).has(e)}function KOe(e,t){var n=gC(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Ju(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])}}Ju.prototype.clear=UOe;Ju.prototype.delete=WOe;Ju.prototype.get=qOe;Ju.prototype.has=GOe;Ju.prototype.set=KOe;var YOe=200;function XOe(e,t){var n=this.__data__;if(n instanceof Xu){var r=n.__data__;if(!T2||r.length<YOe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ju(r)}return n.set(e,t),this.size=n.size,this}function bl(e){var t=this.__data__=new Xu(e);this.size=t.size}bl.prototype.clear=fOe;bl.prototype.delete=hOe;bl.prototype.get=pOe;bl.prototype.has=mOe;bl.prototype.set=XOe;var JOe="__lodash_hash_undefined__";function ZOe(e){return this.__data__.set(e,JOe),this}function QOe(e){return this.__data__.has(e)}function ep(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ju;++t<n;)this.add(e[t])}ep.prototype.add=ep.prototype.push=ZOe;ep.prototype.has=QOe;function eTe(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 R2(e,t){return e.has(t)}var tTe=1,nTe=2;function kee(e,t,n,r,i,o){var s=n&tTe,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var d=-1,p=!0,g=n&nTe?new ep:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var y=e[d],b=t[d];if(r)var v=s?r(b,y,d,t,e,o):r(y,b,d,e,t,o);if(v!==void 0){if(v)continue;p=!1;break}if(g){if(!eTe(t,function(S,C){if(!R2(g,C)&&(y===S||i(y,S,n,r,o)))return g.push(C)})){p=!1;break}}else if(!(y===b||i(y,b,n,r,o))){p=!1;break}}return o.delete(e),o.delete(t),p}var HS=Lc.Uint8Array;function rTe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function LM(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var iTe=1,oTe=2,sTe="[object Boolean]",aTe="[object Date]",lTe="[object Error]",cTe="[object Map]",uTe="[object Number]",dTe="[object RegExp]",fTe="[object Set]",hTe="[object String]",pTe="[object Symbol]",mTe="[object ArrayBuffer]",gTe="[object DataView]",hH=Ha?Ha.prototype:void 0,B7=hH?hH.valueOf:void 0;function yTe(e,t,n,r,i,o,s){switch(n){case gTe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case mTe:return!(e.byteLength!=t.byteLength||!o(new HS(e),new HS(t)));case sTe:case aTe:case uTe:return Qb(+e,+t);case lTe:return e.name==t.name&&e.message==t.message;case dTe:case hTe:return e==t+"";case cTe:var a=rTe;case fTe:var l=r&iTe;if(a||(a=LM),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=oTe,s.set(e,t);var u=kee(a(e),a(t),r,i,o,s);return s.delete(e),u;case pTe:if(B7)return B7.call(e)==B7.call(t)}return!1}function NM(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Wi=Array.isArray;function Aee(e,t,n){var r=t(e);return Wi(e)?r:NM(r,n(e))}function bTe(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 Dee(){return[]}var vTe=Object.prototype,xTe=vTe.propertyIsEnumerable,pH=Object.getOwnPropertySymbols,FM=pH?function(e){return e==null?[]:(e=Object(e),bTe(pH(e),function(t){return xTe.call(e,t)}))}:Dee;function _ee(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var STe="[object Arguments]";function mH(e){return Ua(e)&&Yu(e)==STe}var Oee=Object.prototype,wTe=Oee.hasOwnProperty,CTe=Oee.propertyIsEnumerable,I0=mH((function(){return arguments})())?mH:function(e){return Ua(e)&&wTe.call(e,"callee")&&!CTe.call(e,"callee")};function ETe(){return!1}var Tee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gH=Tee&&typeof module=="object"&&module&&!module.nodeType&&module,kTe=gH&&gH.exports===Tee,yH=kTe?Lc.Buffer:void 0,ATe=yH?yH.isBuffer:void 0,tp=ATe||ETe,DTe=9007199254740991,_Te=/^(?:0|[1-9]\d*)$/;function yC(e,t){var n=typeof e;return t=t??DTe,!!t&&(n=="number"||n!="symbol"&&_Te.test(e))&&e>-1&&e%1==0&&e<t}var OTe=9007199254740991;function BM(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=OTe}var TTe="[object Arguments]",MTe="[object Array]",RTe="[object Boolean]",ITe="[object Date]",jTe="[object Error]",PTe="[object Function]",$Te="[object Map]",LTe="[object Number]",NTe="[object Object]",FTe="[object RegExp]",BTe="[object Set]",zTe="[object String]",HTe="[object WeakMap]",UTe="[object ArrayBuffer]",VTe="[object DataView]",WTe="[object Float32Array]",qTe="[object Float64Array]",GTe="[object Int8Array]",KTe="[object Int16Array]",YTe="[object Int32Array]",XTe="[object Uint8Array]",JTe="[object Uint8ClampedArray]",ZTe="[object Uint16Array]",QTe="[object Uint32Array]",qr={};qr[WTe]=qr[qTe]=qr[GTe]=qr[KTe]=qr[YTe]=qr[XTe]=qr[JTe]=qr[ZTe]=qr[QTe]=!0;qr[TTe]=qr[MTe]=qr[UTe]=qr[RTe]=qr[VTe]=qr[ITe]=qr[jTe]=qr[PTe]=qr[$Te]=qr[LTe]=qr[NTe]=qr[FTe]=qr[BTe]=qr[zTe]=qr[HTe]=!1;function eMe(e){return Ua(e)&&BM(e.length)&&!!qr[Yu(e)]}function zM(e){return function(t){return e(t)}}var Mee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fy=Mee&&typeof module=="object"&&module&&!module.nodeType&&module,tMe=Fy&&Fy.exports===Mee,z7=tMe&&See.process,j0=(function(){try{var e=Fy&&Fy.require&&Fy.require("util").types;return e||z7&&z7.binding&&z7.binding("util")}catch{}})(),bH=j0&&j0.isTypedArray,tv=bH?zM(bH):eMe,nMe=Object.prototype,rMe=nMe.hasOwnProperty;function Ree(e,t){var n=Wi(e),r=!n&&I0(e),i=!n&&!r&&tp(e),o=!n&&!r&&!i&&tv(e),s=n||r||i||o,a=s?_ee(e.length,String):[],l=a.length;for(var c in e)(t||rMe.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||yC(c,l)))&&a.push(c);return a}var iMe=Object.prototype;function bC(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||iMe;return e===n}var oMe=Cee(Object.keys,Object),sMe=Object.prototype,aMe=sMe.hasOwnProperty;function Iee(e){if(!bC(e))return oMe(e);var t=[];for(var n in Object(e))aMe.call(e,n)&&n!="constructor"&&t.push(n);return t}function yp(e){return e!=null&&BM(e.length)&&!ev(e)}function ll(e){return yp(e)?Ree(e):Iee(e)}function e_(e){return Aee(e,ll,FM)}var lMe=1,cMe=Object.prototype,uMe=cMe.hasOwnProperty;function dMe(e,t,n,r,i,o){var s=n&lMe,a=e_(e),l=a.length,c=e_(t),u=c.length;if(l!=u&&!s)return!1;for(var d=l;d--;){var p=a[d];if(!(s?p in t:uMe.call(t,p)))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;++d<l;){p=a[d];var S=e[p],C=t[p];if(r)var w=s?r(C,S,p,t,e,o):r(S,C,p,e,t,o);if(!(w===void 0?S===C||i(S,C,n,r,o):w)){b=!1;break}v||(v=p=="constructor")}if(b&&!v){var k=e.constructor,E=t.constructor;k!=E&&"constructor"in e&&"constructor"in t&&!(typeof k=="function"&&k instanceof k&&typeof E=="function"&&E instanceof E)&&(b=!1)}return o.delete(e),o.delete(t),b}var t_=gp(Lc,"DataView"),n_=gp(Lc,"Promise"),o0=gp(Lc,"Set"),r_=gp(Lc,"WeakMap"),vH="[object Map]",fMe="[object Object]",xH="[object Promise]",SH="[object Set]",wH="[object WeakMap]",CH="[object DataView]",hMe=mp(t_),pMe=mp(T2),mMe=mp(n_),gMe=mp(o0),yMe=mp(r_),Aa=Yu;(t_&&Aa(new t_(new ArrayBuffer(1)))!=CH||T2&&Aa(new T2)!=vH||n_&&Aa(n_.resolve())!=xH||o0&&Aa(new o0)!=SH||r_&&Aa(new r_)!=wH)&&(Aa=function(e){var t=Yu(e),n=t==fMe?e.constructor:void 0,r=n?mp(n):"";if(r)switch(r){case hMe:return CH;case pMe:return vH;case mMe:return xH;case gMe:return SH;case yMe:return wH}return t});var bMe=1,EH="[object Arguments]",kH="[object Array]",h3="[object Object]",vMe=Object.prototype,AH=vMe.hasOwnProperty;function xMe(e,t,n,r,i,o){var s=Wi(e),a=Wi(t),l=s?kH:Aa(e),c=a?kH:Aa(t);l=l==EH?h3:l,c=c==EH?h3:c;var u=l==h3,d=c==h3,p=l==c;if(p&&tp(e)){if(!tp(t))return!1;s=!0,u=!1}if(p&&!u)return o||(o=new bl),s||tv(e)?kee(e,t,n,r,i,o):yTe(e,t,l,n,r,i,o);if(!(n&bMe)){var g=u&&AH.call(e,"__wrapped__"),y=d&&AH.call(t,"__wrapped__");if(g||y){var b=g?e.value():e,v=y?t.value():t;return o||(o=new bl),i(b,v,n,r,o)}}return p?(o||(o=new bl),dMe(e,t,n,r,i,o)):!1}function nv(e,t,n,r,i){return e===t?!0:e==null||t==null||!Ua(e)&&!Ua(t)?e!==e&&t!==t:xMe(e,t,n,r,nv,i)}function SMe(e,t,n){n=typeof n=="function"?n:void 0;var r=n?n(e,t):void 0;return r===void 0?nv(e,t,void 0,n):!!r}function Lr(e,t){return SMe(e,t,(n,r)=>{if(typeof n=="function"&&typeof r=="function")return!0})}var wMe="[object Symbol]";function rv(e){return typeof e=="symbol"||Ua(e)&&Yu(e)==wMe}var CMe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,EMe=/^\w*$/;function HM(e,t){if(Wi(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||rv(e)?!0:EMe.test(e)||!CMe.test(e)||t!=null&&e in Object(t)}var kMe="Expected a function";function UM(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kMe);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(UM.Cache||Ju),n}UM.Cache=Ju;var AMe=500;function DMe(e){var t=UM(e,function(r){return n.size===AMe&&n.clear(),r}),n=t.cache;return t}var _Me=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,OMe=/\\(\\)?/g,jee=DMe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(_Me,function(n,r,i,o){t.push(i?o.replace(OMe,"$1"):r||n)}),t});function pg(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 DH=Ha?Ha.prototype:void 0,_H=DH?DH.toString:void 0;function Pee(e){if(typeof e=="string")return e;if(Wi(e))return pg(e,Pee)+"";if(rv(e))return _H?_H.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function VM(e){return e==null?"":Pee(e)}function mg(e,t){return Wi(e)?e:HM(e,t)?[e]:jee(VM(e))}function bp(e){if(typeof e=="string"||rv(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function vC(e,t){t=mg(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[bp(t[n++])];return n&&n==r?e:void 0}function Xe(e,t,n){var r=e==null?void 0:vC(e,t);return r===void 0?n:r}var TMe=Object.prototype,MMe=TMe.hasOwnProperty;function RMe(e,t){return e!=null&&MMe.call(e,t)}function $ee(e,t,n){t=mg(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=bp(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&&BM(i)&&yC(s,i)&&(Wi(e)||I0(e)))}function Un(e,t){return e!=null&&$ee(e,t,RMe)}function I2(e,t){return nv(e,t)}var US=(function(){try{var e=gp(Object,"defineProperty");return e({},"",{}),e}catch{}})();function WM(e,t,n){t=="__proto__"&&US?US(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var IMe=Object.prototype,jMe=IMe.hasOwnProperty;function qM(e,t,n){var r=e[t];(!(jMe.call(e,t)&&Qb(r,n))||n===void 0&&!(t in e))&&WM(e,t,n)}function GM(e,t,n,r){if(!Qn(e))return e;t=mg(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=bp(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var u=a[l];c=r?r(u,l,a):void 0,c===void 0&&(c=Qn(u)?u:yC(t[i+1])?[]:{})}qM(a,l,c),a=a[l]}return e}function xr(e,t,n){return e==null?e:GM(e,t,n)}function xC(e){return e}function Lee(e){return typeof e=="function"?e:xC}var PMe=/\s/;function $Me(e){for(var t=e.length;t--&&PMe.test(e.charAt(t)););return t}var LMe=/^\s+/;function NMe(e){return e&&e.slice(0,$Me(e)+1).replace(LMe,"")}var OH=NaN,FMe=/^[-+]0x[0-9a-f]+$/i,BMe=/^0b[01]+$/i,zMe=/^0o[0-7]+$/i,HMe=parseInt;function UMe(e){if(typeof e=="number")return e;if(rv(e))return OH;if(Qn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Qn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=NMe(e);var n=BMe.test(e);return n||zMe.test(e)?HMe(e.slice(2),n?2:8):FMe.test(e)?OH:+e}var TH=1/0,VMe=17976931348623157e292;function WMe(e){if(!e)return e===0?e:0;if(e=UMe(e),e===TH||e===-TH){var t=e<0?-1:1;return t*VMe}return e===e?e:0}function Nee(e){var t=WMe(e),n=t%1;return t===t?n?t-n:t:0}var qMe=9007199254740991,H7=4294967295,GMe=Math.min;function Fee(e,t){if(e=Nee(e),e<1||e>qMe)return[];var n=H7,r=GMe(e,H7);t=Lee(t),e-=H7;for(var i=_ee(r,t);++n<e;)t(n);return i}function KM(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var MH=Object.create,Bee=(function(){function e(){}return function(t){if(!Qn(t))return{};if(MH)return MH(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function KMe(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 zee=KMe();function Hee(e,t){return e&&zee(e,t,ll)}var YMe=1,XMe=2;function JMe(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],c=s[1];if(s[2]){if(l===void 0&&!(a in e))return!1}else{var u=new bl,d;if(!(d===void 0?nv(c,l,YMe|XMe,r,u):d))return!1}}return!0}function Uee(e){return e===e&&!Qn(e)}function ZMe(e){for(var t=ll(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Uee(i)]}return t}function Vee(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function QMe(e){var t=ZMe(e);return t.length==1&&t[0][2]?Vee(t[0][0],t[0][1]):function(n){return n===e||JMe(n,e,t)}}function eRe(e,t){return e!=null&&t in Object(e)}function Wee(e,t){return e!=null&&$ee(e,t,eRe)}var tRe=1,nRe=2;function rRe(e,t){return HM(e)&&Uee(t)?Vee(bp(e),t):function(n){var r=Xe(n,e);return r===void 0&&r===t?Wee(n,e):nv(t,r,tRe|nRe)}}function iRe(e){return function(t){return t?.[e]}}function oRe(e){return function(t){return vC(t,e)}}function sRe(e){return HM(e)?iRe(bp(e)):oRe(e)}function YM(e){return typeof e=="function"?e:e==null?xC:typeof e=="object"?Wi(e)?rRe(e[0],e[1]):QMe(e):sRe(e)}function aRe(e,t,n){var r=Wi(e),i=r||tp(e)||tv(e);if(t=YM(t),n==null){var o=e&&e.constructor;i?n=r?new o:[]:Qn(e)?n=ev(o)?Bee(pC(e)):{}:n={}}return(i?KM:Hee)(e,function(s,a,l){return t(n,s,a,l)}),n}function i_(e,t,n){(n!==void 0&&!Qb(e[t],n)||n===void 0&&!(t in e))&&WM(e,t,n)}var qee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,RH=qee&&typeof module=="object"&&module&&!module.nodeType&&module,lRe=RH&&RH.exports===qee,IH=lRe?Lc.Buffer:void 0,jH=IH?IH.allocUnsafe:void 0;function Gee(e,t){if(t)return e.slice();var n=e.length,r=jH?jH(n):new e.constructor(n);return e.copy(r),r}function XM(e){var t=new e.constructor(e.byteLength);return new HS(t).set(new HS(e)),t}function Kee(e,t){var n=t?XM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function JM(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}function Yee(e){return typeof e.constructor=="function"&&!bC(e)?Bee(pC(e)):{}}function j2(e){return Ua(e)&&yp(e)}function o_(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?WM(n,a,l):qM(n,a,l)}return n}function cRe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var uRe=Object.prototype,dRe=uRe.hasOwnProperty;function fRe(e){if(!Qn(e))return cRe(e);var t=bC(e),n=[];for(var r in e)r=="constructor"&&(t||!dRe.call(e,r))||n.push(r);return n}function iv(e){return yp(e)?Ree(e,!0):fRe(e)}function hRe(e){return gg(e,iv(e))}function pRe(e,t,n,r,i,o,s){var a=o_(e,n),l=o_(t,n),c=s.get(l);if(c){i_(e,n,c);return}var u=o?o(a,l,n+"",e,t,s):void 0,d=u===void 0;if(d){var p=Wi(l),g=!p&&tp(l),y=!p&&!g&&tv(l);u=l,p||g||y?Wi(a)?u=a:j2(a)?u=JM(a):g?(d=!1,u=Gee(l,!0)):y?(d=!1,u=Kee(l,!0)):u=[]:gf(l)||I0(l)?(u=a,I0(a)?u=hRe(a):(!Qn(a)||ev(a))&&(u=Yee(l))):d=!1}d&&(s.set(l,u),i(u,l,r,o,s),s.delete(l)),i_(e,n,u)}function Xee(e,t,n,r,i){e!==t&&zee(t,function(o,s){if(i||(i=new bl),Qn(o))pRe(e,t,s,n,Xee,r,i);else{var a=r?r(o_(e,s),o,s+"",e,t,i):void 0;a===void 0&&(a=o),i_(e,s,a)}},iv)}function mRe(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 PH=Math.max;function Jee(e,t,n){return t=PH(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=PH(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),mRe(e,this,a)}}function gRe(e){return function(){return e}}var yRe=US?function(e,t){return US(e,"toString",{configurable:!0,enumerable:!1,value:gRe(t),writable:!0})}:xC,bRe=800,vRe=16,xRe=Date.now;function SRe(e){var t=0,n=0;return function(){var r=xRe(),i=vRe-(r-n);if(n=r,i>0){if(++t>=bRe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Zee=SRe(yRe);function SC(e,t){return Zee(Jee(e,t,xC),e+"")}function wRe(e,t,n){if(!Qn(n))return!1;var r=typeof t;return(r=="number"?yp(n)&&yC(t,n.length):r=="string"&&t in n)?Qb(n[t],e):!1}function CRe(e){return SC(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&&wRe(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 ERe=CRe(function(e,t,n){Xee(e,t,n)}),$H=Ha?Ha.isConcatSpreadable:void 0;function kRe(e){return Wi(e)||I0(e)||!!($H&&e&&e[$H])}function ov(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=kRe),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?ov(a,t-1,n,r,i):NM(i,a):r||(i[i.length]=a)}return i}var ARe=1/0;function DRe(e){var t=e==null?0:e.length;return t?ov(e,ARe):[]}function _Re(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 ORe(e){return e!==e}function TRe(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function Qee(e,t,n){return t===t?TRe(e,t,n):_Re(e,ORe,n)}function ZM(e,t){var n=e==null?0:e.length;return!!n&&Qee(e,t,0)>-1}function A4(){}var MRe=1/0,RRe=o0&&1/LM(new o0([,-0]))[1]==MRe?function(e){return new o0(e)}:A4,IRe=200;function ete(e,t,n){var r=-1,i=ZM,o=e.length,s=!0,a=[],l=a;if(o>=IRe){var c=RRe(e);if(c)return LM(c);s=!1,i=R2,l=new ep}else l=a;e:for(;++r<o;){var u=e[r],d=u;if(u=u!==0?u:0,s&&d===d){for(var p=l.length;p--;)if(l[p]===d)continue e;a.push(u)}else i(l,d,n)||(l!==a&&l.push(d),a.push(u))}return a}function tte(e){return e&&e.length?ete(e):[]}var jRe="[object Map]",PRe="[object Set]",$Re=Object.prototype,LRe=$Re.hasOwnProperty;function ki(e){if(e==null)return!0;if(yp(e)&&(Wi(e)||typeof e=="string"||typeof e.splice=="function"||tp(e)||tv(e)||I0(e)))return!e.length;var t=Aa(e);if(t==jRe||t==PRe)return!e.size;if(bC(e))return!Iee(e).length;for(var n in e)if(LRe.call(e,n))return!1;return!0}const NRe=Object.prototype;function fy(e){for(const t in e)if(NRe.hasOwnProperty.call(e,t))return!1;return!0}const FRe=["array","boolean","integer","null","number","object","string"];new Set(FRe);const BRe=["$defs","definitions","properties","patternProperties","dependencies"];new Set(BRe);const zRe=["items","allOf","oneOf","anyOf"];new Set(zRe);const HRe=["items","additionalItems","additionalProperties","propertyNames","contains","if","then","else","not"];new Set(HRe);function D4(e){return typeof e=="object"}function Kl(e){return D4(e)?fy(e):e===!0}function Hm(e,t){return e<t?-1:e>t?1:0}function U7(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 URe(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 LH(e){return e.length===0}function V7(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 nte(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 c=n[l];for(let u=0;u<a;u++)if(e(c,s[u])===0)continue e;a=s.push(c)}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 VRe(e){return(t,n)=>{const r=[];let i=t.length,o=n.length;if(i===0||o===0)return r;if(i>o){const u=t;t=n,n=u;const d=i;i=o,o=d}const s=[...t].sort(e),a=[...n].sort(e);let l=0,c=0;for(;l<i&&c<o;){const u=e(s[l],a[c]);u===0?((r.length===0||e(r[r.length-1],s[l])!==0)&&r.push(s[l]),l++,c++):u<0?l++:c++}return r}}function WRe(e,t){return n=>{if(e.has(n))return e.get(n);const r=t(n);return e.set(n,r),r}}const NH=WRe,rte=()=>0,qRe=e=>e===void 0,GRe=e=>typeof e!="object",FH={boolean:0,number:1,string:2};function KRe(e,t){const n=typeof e,r=typeof t;return n===r?Hm(e,t):FH[n]-FH[r]}function YRe(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 wC(e,t,n=rte){return(r,i)=>e(r)?e(i)?n(r,i):-1:e(i)?1:t(r,i)}function Mm(e){return wC(qRe,e)}function Dd(e,t){return wC(n=>n===void 0||e(n),t)}function W7(e,t){return wC(Array.isArray,e,t)}const Mi=Mm(Hm),q7=Dd(e=>e===0,(e,t)=>e-t);function XRe({deduplicationCache:e=new WeakMap,sortedKeysCache:t=new WeakMap}={}){const n=NH(t,b=>Object.keys(b).sort());function r(b){return(v,S)=>{const C=n(v),w=n(S),k=Math.min(C.length,w.length);for(let E=0;E<k;E++){const O=Hm(C[E],w[E]);if(O!==0)return O}if(C.length!==w.length)return C.length-w.length;for(let E=0;E<k;E++){const O=C[E],_=b(v[O],S[O]);if(_!==0)return _}return 0}}function i(b){const v=V7(b),S=NH(e,nte(b,{threshold:0}));return(C,w)=>v(S(C),S(w))}const o=i(Hm);function s(b,v){if(D4(b)){if(D4(v)){const S=Object.keys(b),C=Object.keys(v),w=YRe(S,C),k=w.length;for(let E=0;E<k;E++){const O=w[E];if(b[O]===v[O])continue;const T=(y[O]??a)(b[O],v[O]);if(T!==0)return T}return 0}return v===!0&&fy(b)?0:1}return D4(v)?b===!0&&fy(v)?0:-1:Hm(b,v)}const a=Mm(c),l=wC(GRe,W7(r(a),V7(c)),KRe);function c(b,v){return b===null?-1:v===null?1:l(b,v)}const u=Mm(s),d=Dd(fy,r(u)),p=Mm(i(s)),g=Dd(Kl,s),y={$id:Mi,$comment:Mi,$defs:d,$ref:Mi,$schema:Mi,const:a,contains:u,contentEncoding:Mi,contentMediaType:Mi,default:a,definitions:d,description:Mi,else:u,examples:a,exclusiveMaximum:Mi,exclusiveMinimum:Mi,format:Mi,if:u,maximum:Mi,maxItems:Mi,maxLength:Mi,maxProperties:Mi,minimum:Mi,multipleOf:Mi,not:u,pattern:Mi,propertyNames:u,readOnly:Mi,then:u,title:Mi,writeOnly:Mi,uniqueItems:Dd(b=>b===!1,rte),minLength:q7,minItems:q7,minProperties:q7,required:Dd(LH,o),enum:Dd(LH,i(c)),type:Mm((b,v)=>{const S=Array.isArray(b),C=Array.isArray(v);return!S&&!C?Hm(b,v):o(S?b:[b],C?v:[v])}),items:Dd(b=>!Array.isArray(b)&&Kl(b),W7(s,V7(s))),anyOf:p,allOf:p,oneOf:p,properties:d,patternProperties:d,additionalProperties:g,additionalItems:g,dependencies:Dd(fy,r(Mm(W7(s,o))))};return{compareSchemaValues:c,compareSchemaDefinitions:s}}function BH(e){return e}const ite=(e,t)=>e?ite(t%e,e):t,JRe=(e,t)=>Math.abs(e*t)/ite(e,t);function ZRe(e,t){return e===t?e:`^(?=.*(?:${e}))(?=.*(?:${t})).*$`}function*G7(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 K7(e,t){return e||t}function zH(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 QRe(e){const t=new Map;for(const n of e)for(const r of n[0])t.set(r,n[1]);return t}function sh(e,t,n){n===void 0||Kl(n)?delete e[t]:e[t]=n}const eIe=["properties","patternProperties","additionalProperties"];function HH(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 UH=[[],[]];function VH(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 tIe=["items","additionalItems"],nIe=["if","then","else"];function WH(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 Y7(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 ah(e,t,n){return[e,t,n]}function rIe(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 iIe=[ah("minimum","maximum",e=>e.maximum>=e.minimum),ah("exclusiveMinimum","maximum",e=>e.maximum>e.exclusiveMinimum),ah("minimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.minimum),ah("exclusiveMinimum","exclusiveMaximum",e=>e.exclusiveMaximum>e.exclusiveMinimum),ah("minLength","maxLength",e=>e.maxLength>=e.minLength),ah("minItems","maxItems",e=>e.maxItems>=e.minItems),ah("minProperties","maxProperties",e=>e.maxProperties>=e.minProperties)];function oIe({mergePatterns:e=ZRe,isSubRegExp:t=Object.is,intersectJson:n=URe,deduplicateJsonSchemaDef:r=BH,defaultMerger:i=BH,assigners:o=[],checks:s=iIe,mergers:a}={}){function l(k){const E=k.length;let O=k[0];for(let _=1;_<E;_++){const T=S(O,k[_]);if(T===!1)return!1;Kl(T)||(O=T)}return O}function c(k,E,O,_,T,I,P){if(k.length=0,O===!1)return!1;if(k.push(O),T!==void 0){if(T===!1)return!1;k.push(T)}if(VH(k,E,I))return!1;const M=k.length<2;if(P===!1){if(M)return;if(VH(k,E,_))return!1}else M&&P!==void 0&&k.push(P);return k.length===1?k[0]:l(k)}function u(k,E,O,_,T,I){const P=O.length;if(P>0&&T!==!1)if(I)Object.assign(k,E);else for(let L=0;L<P;L++){const M=O[L];_.has(M)||(k[M]=S(E[M],T))}return k}const d=(k,{properties:E={},patternProperties:O,additionalProperties:_=!0},{properties:T={},patternProperties:I,additionalProperties:P=!0})=>{const L=Kl(_),M=Kl(P);if(L&&M)return sh(k,"properties",C(E,T)),sh(k,"patternProperties",O&&I?C(O,I):O??I),delete k.additionalProperties,k;const $=S(_,P);sh(k,"additionalProperties",$);const N={},z=Object.keys(E),F=z.length,[W,V]=O?HH(O):UH,[q,X]=I?HH(I):UH,B=[],U=new Set,Y=M?void 0:P;for(let ie=0;ie<F;ie++){const te=z[ie];U.add(te);const J=c(B,te,E[te],W,T[te],q,Y);J!==void 0&&(N[te]=J)}const H=Object.keys(T),G=H.length,Z=L?void 0:_;for(let ie=0;ie<G;ie++){const te=H[ie];if(U.has(te))continue;const J=c(B,te,T[te],q,void 0,W,Z);J!==void 0&&(N[te]=J)}sh(k,"properties",N);let oe={};const ee=new Set;if(V.length>0&&X.length>0){const ie=G7(V,X,(te,J)=>{t(te,J)&&ee.add(te),t(J,te)&&ee.add(J),oe[e(te,J)]=S(O[te],I[J])});for(;!ie.next().done;);}return oe=u(oe,O,V,ee,P,M),oe=u(oe,I,X,ee,_,L),sh(k,"patternProperties",oe),k},p=(k,{items:E=[],additionalItems:O},{items:_=[],additionalItems:T})=>{const I=Array.isArray(E),P=Array.isArray(_),L=[];if(k.items=L,I&&P){const[M,$,N]=E.length<_.length?[E.length,O,_]:[_.length,T,E];let z=0;for(;z<M;z++)L.push(S(E[z],_[z]));if($===!1)k.additionalItems=!1;else{const F=$===void 0||Kl($);for(;z<N.length;z++)L.push(F?N[z]:S(N[z],$));sh(k,"additionalItems",O!==void 0&&T!==void 0?S(O,T):O??T)}}else if(I||P){const[M,$,N]=I?[E,_,O]:[_,E,T];sh(k,"additionalItems",N&&S(N,$));for(let z=0;z<M.length;z++)L.push(S(M[z],$))}else delete k.additionalItems,k.items=S(E,_);return k},g=(k,E,O)=>{WH(k,E);const _=WH({},O);return k.allOf===void 0?k.allOf=[_]:k.allOf=k.allOf.concat(_),k};function y(k,E){return r(Array.from(G7(k,E,S)))}const b=QRe([[eIe,d],[tIe,p],[nIe,g],...o]),v=rIe(s);function S(k,E){if(k===!1||E===!1)return!1;if(Kl(k))return Kl(E)?!0:E;if(Kl(E))return k;let O={...k};const _=new Set,T=new Set,I=Object.keys(E),P=I.length;for(let L=0;L<P;L++){const M=I[L],$=E[M];if($===void 0)continue;const N=v.get(M);if(N!==void 0){const V=N.length;for(let q=0;q<V;q++){const X=N[q];k[X.oppositeKey]!==void 0&&T.add(X.check)}}const z=k[M];if(z===void 0){O[M]=$;continue}const F=b.get(M);if(F){_.add(F);continue}const W=w[M]??i;O[M]=W(z,$)}for(const L of _)O=L(O,k,E);for(const L of T)L(O);return O}const C=zH(S),w={$id:i,$ref:i,$schema:i,$comment:i,$defs:C,definitions:C,type:(k,E)=>{if(k===E)return k;const O=Array.isArray(k),_=Array.isArray(E);if(!O&&!_){const T=Y7(k,E);if(T!==void 0)return T}else if(O||_){const T=new Set;if(O&&_)for(const P of G7(k,E,Y7))P!==void 0&&T.add(P);else{const P=O?k:E,L=O?E:k,M=P.length;for(let $=0;$<M;$++){const N=Y7(L,P[$]);N!==void 0&&T.add(N)}}const I=T.size;if(I===1)return T.values().next().value;if(I>1)return Array.from(T)}throw new Error(`It is not possible to create an intersection of the following incompatible types: ${k.toString()}, ${E.toString()}`)},default:i,description:i,title:i,const:i,format:i,contentEncoding:i,contentMediaType:i,not:(k,E)=>{const O=r([k,E]);return O.length===1?O[0]:{anyOf:O}},pattern:e,readOnly:K7,writeOnly:K7,enum:(k,E)=>{const O=n(k,E);if(O.length===0)throw new Error(`Intersection of the following enums is empty: "${JSON.stringify(k)}", "${JSON.stringify(E)}"`);return O},anyOf:y,oneOf:y,allOf:(k,E)=>r(k.concat(E)),propertyNames:S,contains:S,dependencies:zH((k,E)=>Array.isArray(k)?Array.isArray(E)?U7(k,E):S(E,{required:k}):Array.isArray(E)?S(k,{required:E}):S(k,E)),examples:(k,E)=>{if(!Array.isArray(k)||!Array.isArray(E))throw new Error(`Value of the 'examples' field should be an array, but got "${JSON.stringify(k)}" and "${JSON.stringify(E)}"`);return U7(k,E)},multipleOf:(k,E)=>{let O=1;for(;!Number.isInteger(k)||!Number.isInteger(E);)O*=10,k*=10,E*=10;return JRe(k,E)/O},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:K7,required:U7,...a};return{mergeSchemaDefinitions:S,mergeArrayOfSchemaDefinitions:l}}function sIe(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 aIe(e){return t=>e(sIe(t))}var z1={},qH;function lIe(){if(qH)return z1;qH=1;var e=/~/,t=/~[01]/g;function n(c){switch(c){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+c)}function r(c){return e.test(c)?c.replace(t,n):c}function i(c,u,d){for(var p,g,y=1,b=u.length;y<b;){if(u[y]==="constructor"||u[y]==="prototype"||u[y]==="__proto__")return c;if(p=r(u[y++]),g=b>y,typeof c[p]>"u"&&(Array.isArray(c)&&p==="-"&&(p=c.length),g&&(u[y]!==""&&u[y]<1/0||u[y]==="-"?c[p]=[]:c[p]={})),!g)break;c=c[p]}var v=c[p];return d===void 0?delete c[p]:c[p]=d,v}function o(c){if(typeof c=="string"){if(c=c.split("/"),c[0]==="")return c;throw new Error("Invalid JSON pointer.")}else if(Array.isArray(c)){for(const u of c)if(typeof u!="string"&&typeof u!="number")throw new Error("Invalid JSON pointer. Must be of type string or number.");return c}throw new Error("Invalid JSON pointer.")}function s(c,u){if(typeof c!="object")throw new Error("Invalid input object.");u=o(u);var d=u.length;if(d===1)return c;for(var p=1;p<d;){if(c=c[r(u[p++])],d===p)return c;if(typeof c!="object"||c===null)return}}function a(c,u,d){if(typeof c!="object")throw new Error("Invalid input object.");if(u=o(u),u.length===0)throw new Error("Invalid JSON pointer for set.");return i(c,u,d)}function l(c){var u=o(c);return{get:function(d){return s(d,u)},set:function(d,p){return a(d,u,p)}}}return z1.get=s,z1.set=a,z1.compile=l,z1}var cIe=lIe();const X7=Ts(cIe);function uIe(e,t){return e&&gg(t,ll(t),e)}function dIe(e,t){return e&&gg(t,iv(t),e)}function fIe(e,t){return gg(e,FM(e),t)}var hIe=Object.getOwnPropertySymbols,ote=hIe?function(e){for(var t=[];e;)NM(t,FM(e)),e=pC(e);return t}:Dee;function pIe(e,t){return gg(e,ote(e),t)}function QM(e){return Aee(e,iv,ote)}var mIe=Object.prototype,gIe=mIe.hasOwnProperty;function yIe(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&gIe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function bIe(e,t){var n=t?XM(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var vIe=/\w*$/;function xIe(e){var t=new e.constructor(e.source,vIe.exec(e));return t.lastIndex=e.lastIndex,t}var GH=Ha?Ha.prototype:void 0,KH=GH?GH.valueOf:void 0;function SIe(e){return KH?Object(KH.call(e)):{}}var wIe="[object Boolean]",CIe="[object Date]",EIe="[object Map]",kIe="[object Number]",AIe="[object RegExp]",DIe="[object Set]",_Ie="[object String]",OIe="[object Symbol]",TIe="[object ArrayBuffer]",MIe="[object DataView]",RIe="[object Float32Array]",IIe="[object Float64Array]",jIe="[object Int8Array]",PIe="[object Int16Array]",$Ie="[object Int32Array]",LIe="[object Uint8Array]",NIe="[object Uint8ClampedArray]",FIe="[object Uint16Array]",BIe="[object Uint32Array]";function zIe(e,t,n){var r=e.constructor;switch(t){case TIe:return XM(e);case wIe:case CIe:return new r(+e);case MIe:return bIe(e,n);case RIe:case IIe:case jIe:case PIe:case $Ie:case LIe:case NIe:case FIe:case BIe:return Kee(e,n);case EIe:return new r;case kIe:case _Ie:return new r(e);case AIe:return xIe(e);case DIe:return new r;case OIe:return SIe(e)}}var HIe="[object Map]";function UIe(e){return Ua(e)&&Aa(e)==HIe}var YH=j0&&j0.isMap,VIe=YH?zM(YH):UIe,WIe="[object Set]";function qIe(e){return Ua(e)&&Aa(e)==WIe}var XH=j0&&j0.isSet,GIe=XH?zM(XH):qIe,KIe=1,YIe=2,XIe=4,ste="[object Arguments]",JIe="[object Array]",ZIe="[object Boolean]",QIe="[object Date]",eje="[object Error]",ate="[object Function]",tje="[object GeneratorFunction]",nje="[object Map]",rje="[object Number]",lte="[object Object]",ije="[object RegExp]",oje="[object Set]",sje="[object String]",aje="[object Symbol]",lje="[object WeakMap]",cje="[object ArrayBuffer]",uje="[object DataView]",dje="[object Float32Array]",fje="[object Float64Array]",hje="[object Int8Array]",pje="[object Int16Array]",mje="[object Int32Array]",gje="[object Uint8Array]",yje="[object Uint8ClampedArray]",bje="[object Uint16Array]",vje="[object Uint32Array]",Pr={};Pr[ste]=Pr[JIe]=Pr[cje]=Pr[uje]=Pr[ZIe]=Pr[QIe]=Pr[dje]=Pr[fje]=Pr[hje]=Pr[pje]=Pr[mje]=Pr[nje]=Pr[rje]=Pr[lte]=Pr[ije]=Pr[oje]=Pr[sje]=Pr[aje]=Pr[gje]=Pr[yje]=Pr[bje]=Pr[vje]=!0;Pr[eje]=Pr[ate]=Pr[lje]=!1;function By(e,t,n,r,i,o){var s,a=t&KIe,l=t&YIe,c=t&XIe;if(n&&(s=i?n(e,r,i,o):n(e)),s!==void 0)return s;if(!Qn(e))return e;var u=Wi(e);if(u){if(s=yIe(e),!a)return JM(e,s)}else{var d=Aa(e),p=d==ate||d==tje;if(tp(e))return Gee(e,a);if(d==lte||d==ste||p&&!i){if(s=l||p?{}:Yee(e),!a)return l?pIe(e,dIe(s,e)):fIe(e,uIe(s,e))}else{if(!Pr[d])return i?e:{};s=zIe(e,d,a)}}o||(o=new bl);var g=o.get(e);if(g)return g;o.set(e,s),GIe(e)?e.forEach(function(v){s.add(By(v,t,n,v,e,o))}):VIe(e)&&e.forEach(function(v,S){s.set(S,By(v,t,n,S,e,o))});var y=c?l?QM:e_:l?iv:ll,b=u?void 0:y(e);return KM(b||e,function(v,S){b&&(S=v,v=e[S]),qM(s,S,By(v,t,n,S,e,o))}),s}function cte(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function xje(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 Sje(e,t){return t.length<2?e:vC(e,xje(t,0,-1))}var wje=Object.prototype,Cje=wje.hasOwnProperty;function ute(e,t){t=mg(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__"&&!Cje.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=Sje(e,t);return s==null||delete s[bp(cte(t))]}function Eje(e){return gf(e)?void 0:e}function s_(e){var t=e==null?0:e.length;return t?ov(e,1):[]}function dte(e){return Zee(Jee(e,void 0,s_),e+"")}var kje=1,Aje=2,Dje=4,P2=dte(function(e,t){var n={};if(e==null)return n;var r=!1;t=pg(t,function(o){return o=mg(o,e),r||(r=o.length>1),o}),gg(e,QM(e),n),r&&(n=By(n,kje|Aje|Dje,Eje));for(var i=t.length;i--;)ute(n,t[i]);return n}),H1={exports:{}},J7,JH;function fte(){if(JH)return J7;JH=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(p){let g="",y=0,b=0;for(b=0;b<p.length;b++)if(y=p[b].charCodeAt(0),y!==48){if(!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=p[b];break}for(b+=1;b<p.length;b++){if(y=p[b].charCodeAt(0),!(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102))return"";g+=p[b]}return g}const r=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(p){return p.length=0,!0}function o(p,g,y){if(p.length){const b=n(p);if(b!=="")g.push(b);else return y.error=!0,!1;p.length=0}return!0}function s(p){let g=0;const y={error:!1,address:"",zone:""},b=[],v=[];let S=!1,C=!1,w=o;for(let k=0;k<p.length;k++){const E=p[k];if(!(E==="["||E==="]"))if(E===":"){if(S===!0&&(C=!0),!w(v,b,y))break;if(++g>7){y.error=!0;break}k>0&&p[k-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(p){if(l(p,":")<2)return{host:p,isIPV6:!1};const g=s(p);if(g.error)return{host:p,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(p,g){let y=0;for(let b=0;b<p.length;b++)p[b]===g&&y++;return y}function c(p){let g=p;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 u(p,g){const y=g!==!0?escape:unescape;return p.scheme!==void 0&&(p.scheme=y(p.scheme)),p.userinfo!==void 0&&(p.userinfo=y(p.userinfo)),p.host!==void 0&&(p.host=y(p.host)),p.path!==void 0&&(p.path=y(p.path)),p.query!==void 0&&(p.query=y(p.query)),p.fragment!==void 0&&(p.fragment=y(p.fragment)),p}function d(p){const g=[];if(p.userinfo!==void 0&&(g.push(p.userinfo),g.push("@")),p.host!==void 0){let y=unescape(p.host);if(!t(y)){const b=a(y);b.isIPV6===!0?y=`[${b.escapedHost}]`:y=p.host}g.push(y)}return(typeof p.port=="number"||typeof p.port=="string")&&(g.push(":"),g.push(String(p.port))),g.length?g.join(""):void 0}return J7={nonSimpleDomain:r,recomposeAuthority:d,normalizeComponentEncoding:u,removeDotSegments:c,isIPv4:t,isUUID:e,normalizeIPv6:a,stringArrayToHexStripped:n},J7}var Z7,ZH;function _je(){if(ZH)return Z7;ZH=1;const{isUUID:e}=fte(),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 O=String(E.scheme).toLowerCase()==="https";return(E.port===(O?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[O,_]=E.resourceName.split("?");E.path=O&&O!=="/"?O:void 0,E.query=_,E.resourceName=void 0}return E.fragment=void 0,E}function c(E,O){if(!E.path)return E.error="URN can not be parsed",E;const _=E.path.match(t);if(_){const T=O.scheme||E.scheme||"urn";E.nid=_[1].toLowerCase(),E.nss=_[2];const I=`${T}:${O.nid||E.nid}`,P=k(I);E.path=void 0,P&&(E=P.parse(E,O))}else E.error=E.error||"URN can not be parsed.";return E}function u(E,O){if(E.nid===void 0)throw new Error("URN without nid cannot be serialized");const _=O.scheme||E.scheme||"urn",T=E.nid.toLowerCase(),I=`${_}:${O.nid||T}`,P=k(I);P&&(E=P.serialize(E,O));const L=E,M=E.nss;return L.path=`${T||O.nid}:${M}`,O.skipEscape=!0,L}function d(E,O){const _=E;return _.uuid=_.nss,_.nss=void 0,!O.tolerant&&(!_.uuid||!e(_.uuid))&&(_.error=_.error||"UUID is not valid."),_}function p(E){const O=E;return O.nss=(E.uuid||"").toLowerCase(),O}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:c,serialize:u,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:d,serialize:p,skipNormalize:!0}};Object.setPrototypeOf(w,null);function k(E){return E&&(w[E]||w[E.toLowerCase()])||void 0}return Z7={wsIsSecure:i,SCHEMES:w,isValidSchemeName:r,getSchemeHandler:k},Z7}var QH;function hte(){if(QH)return H1.exports;QH=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:n,normalizeComponentEncoding:r,isIPv4:i,nonSimpleDomain:o}=fte(),{SCHEMES:s,getSchemeHandler:a}=_je();function l(v,S){return typeof v=="string"?v=p(y(v,S),S):typeof v=="object"&&(v=y(p(v,S),S)),v}function c(v,S,C){const w=C?Object.assign({scheme:"null"},C):{scheme:"null"},k=u(y(v,w),y(S,w),w,!0);return w.skipEscape=!0,p(k,w)}function u(v,S,C,w){const k={};return w||(v=y(p(v,C),C),S=y(p(S,C),C)),C=C||{},!C.tolerant&&S.scheme?(k.scheme=S.scheme,k.userinfo=S.userinfo,k.host=S.host,k.port=S.port,k.path=t(S.path||""),k.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(k.userinfo=S.userinfo,k.host=S.host,k.port=S.port,k.path=t(S.path||""),k.query=S.query):(S.path?(S.path[0]==="/"?k.path=t(S.path):((v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)&&!v.path?k.path="/"+S.path:v.path?k.path=v.path.slice(0,v.path.lastIndexOf("/")+1)+S.path:k.path=S.path,k.path=t(k.path)),k.query=S.query):(k.path=v.path,S.query!==void 0?k.query=S.query:k.query=v.query),k.userinfo=v.userinfo,k.host=v.host,k.port=v.port),k.scheme=v.scheme),k.fragment=S.fragment,k}function d(v,S,C){return typeof v=="string"?(v=unescape(v),v=p(r(y(v,C),!0),{...C,skipEscape:!0})):typeof v=="object"&&(v=p(r(v,!0),{...C,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=p(r(y(S,C),!0),{...C,skipEscape:!0})):typeof S=="object"&&(S=p(r(S,!0),{...C,skipEscape:!0})),v.toLowerCase()===S.toLowerCase()}function p(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),k=[],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&&k.push(C.scheme,":");const O=n(C);if(O!==void 0&&(w.reference!=="suffix"&&k.push("//"),k.push(O),C.path&&C.path[0]!=="/"&&k.push("/")),C.path!==void 0){let _=C.path;!w.absolutePath&&(!E||!E.absolutePath)&&(_=t(_)),O===void 0&&_[0]==="/"&&_[1]==="/"&&(_="/%2F"+_.slice(2)),k.push(_)}return C.query!==void 0&&k.push("?",C.query),C.fragment!==void 0&&k.push("#",C.fragment),k.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 k=!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(),k=T.isIPV6}else k=!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 O=a(C.scheme||w.scheme);if(!C.unicodeSupport&&(!O||!O.unicodeSupport)&&w.host&&(C.domainHost||O&&O.domainHost)&&k===!1&&o(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(_){w.error=w.error||"Host's domain name can not be converted to ASCII: "+_}(!O||O&&!O.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)))),O&&O.parse&&O.parse(w,C)}else w.error=w.error||"URI can not be parsed.";return w}const b={SCHEMES:s,normalize:l,resolve:c,resolveComponent:u,equal:d,serialize:p,parse:y};return H1.exports=b,H1.exports.default=b,H1.exports.fastUri=b,H1.exports}var Oje=hte();const eR=Ts(Oje);function VS(e,t){if(kr in e&&eR.equal(e[kr],t))return e;for(const n of Object.values(e))if(Array.isArray(n)){for(const r of n)if(Qn(r)){const i=VS(r,t);if(i!==void 0)return i}}else if(Qn(n)){const r=VS(n,t);if(r!==void 0)return r}}function a_(e,t){const n=Xe(e,kr,t);Ar in e&&(e={...e,[Ar]:eR.resolve(n,e[Ar])});for(const[r,i]of Object.entries(e))Array.isArray(i)?e={...e,[r]:i.map(o=>Qn(o)?a_(o,n):o)}:Qn(i)&&(e={...e,[r]:a_(i,n)});return e}function tR(e,t){const n=t[e];return[P2(t,[e]),n]}function pte(e,t={},n=[],r=Xe(t,[kr])){const i=e||"";let o;if(i.startsWith("#")){const a=decodeURIComponent(i.substring(1));r===void 0||kr in t&&t[kr]===r?o=X7.get(t,a):t[dy]===k4&&(o=VS(t,r.replace(/\/$/,"")),o!==void 0&&(o=X7.get(o,a)))}else if(t[dy]===k4){const a=r?eR.resolve(r,i):i,[l,...c]=a.replace(/#\/?$/,"").split("#");o=VS(t,l.replace(/\/$/,"")),o!==void 0&&(r=o[kr],ki(c)||(o=X7.get(o,decodeURIComponent(c.join("#")))))}if(o===void 0)throw new Error(`Could not find a definition for ${e}.`);const s=o[Ar];if(s){if(n.includes(s)){if(n.length===1)throw new Error(`Definition for ${e} is a circular reference`);const[u,...d]=n,p=[...d,i,u].join(" -> ");throw new Error(`Definition for ${u} contains a circular reference through ${p}`)}const[a,l]=tR(Ar,o),c=pte(l,t,[...n,i],r);return Object.keys(a).length>0?t[dy]===V_e||t[dy]===k4?{[zu]:[a,c]}:{...a,...c}:c}return o}function nR(e,t={},n=Xe(t,[kr])){return pte(e,t,[],n)}var Tje="[object String]";function yf(e){return typeof e=="string"||!Wi(e)&&Ua(e)&&Yu(e)==Tje}function Oc(e){let t;const n=Xe(e,B_e);return yf(n)?t=n:n!==void 0&&console.warn(`Expecting discriminator to be a string, got "${typeof n}" instead`),t}function $2(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 Mje=SC(function(e){return ete(ov(e,1,j2,!0))});function Cl(e){let{type:t}=e;return!t&&e.const?$2(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 Hu(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&&En(s)?r[i]=Hu(o,s):e&&t&&(Cl(e)==="object"||Cl(t)==="object")&&i===gee&&Array.isArray(o)&&Array.isArray(s)?r[i]=Mje(o,s):r[i]=s,r},n)}var Rje="[object Number]";function mte(e){return typeof e=="number"||Ua(e)&&Yu(e)==Rje}function gte(e,t,n){var r;if(e&&n){const i=Xe(e,n);if(i===void 0)return;for(let o=0;o<t.length;o++){const s=t[o],a=Xe(s,[nr,n],{});if(!(a.type==="object"||a.type==="array")&&(a.const===i||!((r=a.enum)===null||r===void 0)&&r.includes(i)))return o}}}function rR(e,t,n,r,i){if(t===void 0)return 0;const o=gte(t,n,i);if(mte(o))return o;for(let s=0;s<n.length;s++){const a=n[s];if(i&&Un(a,[nr,i])){const l=Xe(t,i),c=Xe(a,[nr,i],{});if(e.isValid(c,l,r))return s}else if(a[nr]){const l={anyOf:Object.keys(a[nr]).map(u=>({required:[u]}))};let c;if(a.anyOf){const{...u}=a;u.allOf?u.allOf=u.allOf.slice():u.allOf=[],u.allOf.push(l),c=u}else c=Object.assign({},a,l);if(delete c.required,e.isValid(c,t,r))return s}else if(e.isValid(a,t,r))return s}return 0}function ko(e,t,n={},r,i,o=!1){return cc(e,t,n,r,void 0,void 0,i,o)[0]}function Ije(e,t,n,r,i,o,s){const{if:a,then:l,else:c,...u}=t,d=e.isValid(a,o||{},n);let p=[u],g=[];if(r)l&&typeof l!="boolean"&&(g=g.concat(cc(e,l,n,o,r,i,s))),c&&typeof c!="boolean"&&(g=g.concat(cc(e,c,n,o,r,i,s)));else{const y=d?l:c;y&&typeof y!="boolean"&&(g=g.concat(cc(e,y,n,o,r,i,s)))}return g.length&&(p=g.map(y=>Hu(u,y))),p.flatMap(y=>cc(e,y,n,o,r,i,s))}function yte(e){return e.reduce((n,r)=>r.length>1?r.flatMap(i=>Fee(n.length,o=>[...n[o]].concat(i))):(n.forEach(i=>i.push(r[0])),n),[[]])}function bte(e,t){return Object.keys(e.patternProperties).filter(n=>RegExp(n).test(t)).reduce((n,r)=>(xr(n,[r],e.patternProperties[r]),n),{})}function jje(e,t,n,r,i,o,s,a){const l=vte(e,t,n,r,i,o,s,a);if(l.length>1||l[0]!==t)return l;if(IM in t)return xte(e,t,n,r,i,o,s).flatMap(u=>cc(e,u,n,o,r,i,s));if(zu in t&&Array.isArray(t[zu])){const c=t.allOf.map(d=>cc(e,d,n,o,r,i,s));return yte(c).map(d=>({...t,allOf:d}))}return[t]}function vte(e,t,n,r,i,o,s,a){const l=s0(t,n,i,void 0,a);return l!==t?cc(e,l,n,o,r,i,s,a):[t]}function s0(e,t,n,r,i){if(!En(e))return e;let o=e;if(Ar in o){const{$ref:s,...a}=o;if(n.includes(s))return o;n.push(s),o={...nR(s,t,r),...a},kr in o&&(r=o[kr])}if(nr in o){const s=[],a=aRe(o[nr],(l,c,u)=>{const d=[...n];l[u]=s0(c,t,d,r,i),s.push(d)},{});ERe(n,tte(DRe(s))),o={...o,[nr]:a}}if(Zh in o&&!Array.isArray(o.items)&&typeof o.items!="boolean"&&(o={...o,items:s0(o.items,t,n,r,i)}),i){let s,a;Vn in e&&Array.isArray(e[Vn])?(s=Vn,a=o[Vn]):gn in e&&Array.isArray(e[gn])&&(s=gn,a=o[gn]),s&&a&&(o={...o,[s]:a.map(l=>s0(l,t,n,r,i))})}return Lr(e,o)?e:o}function Pje(e,t,n,r,i){const o={...t,properties:{...t.properties}},s=r&&En(r)?r:{};return Object.keys(s).forEach(a=>{if(!(a in o.properties)){if(JD in o){const l=bte(o,a);if(!ki(l)){o.properties[a]=ko(e,{[zu]:Object.values(l)},n,Xe(s,[a]),i),xr(o.properties,[a,Ru],!0);return}}if(O2 in o&&o.additionalProperties!==!1){let l;typeof o.additionalProperties!="boolean"?Ar in o.additionalProperties?l=ko(e,{[Ar]:Xe(o.additionalProperties,[Ar])},n,s,i):"type"in o.additionalProperties?l={...o.additionalProperties}:Vn in o.additionalProperties||gn in o.additionalProperties?l={type:"object",...o.additionalProperties}:l={type:$2(Xe(s,[a]))}:l={type:$2(Xe(s,[a]))},o.properties[a]=l,xr(o.properties,[a,Ru],!0)}else o.properties[a]={type:"null"},xr(o.properties,[a,Ru],!0)}}),o}const{compareSchemaDefinitions:$je,compareSchemaValues:Lje}=XRe(),{mergeArrayOfSchemaDefinitions:Nje}=oIe({intersectJson:VRe(Lje),deduplicateJsonSchemaDef:nte($je)}),Fje=aIe(Nje);function Bje(e){return Fje(e)}function cc(e,t,n,r,i=!1,o=[],s,a){return En(t)?jje(e,t,n,i,o,r,s,a).flatMap(c=>{var u;let d=c;if(jM in d)return Ije(e,d,n,i,o,r,s);if(zu in d){if(i){const{allOf:g,...y}=d;return[...g,y]}try{const g=[],y=[];(u=d.allOf)===null||u===void 0||u.forEach(b=>{typeof b=="object"&&b.contains?g.push(b):y.push(b)}),g.length&&(d={...d,allOf:y}),d=s?s(d):Bje(d),g.length&&(d.allOf=g)}catch(g){console.warn(`could not merge subschemas in allOf:
224
224
  `,g);const{allOf:y,...b}=d;return b}}return nr in d&&JD in d&&(d=Object.keys(d.properties).reduce((g,y)=>{const b=bte(g,y);return ki(b)||(g.properties[y]=ko(e,{allOf:[g.properties[y],...Object.values(b)]},n,Xe(r,[y]),s)),g},{...d,properties:{...d.properties}})),JD in d||O2 in d&&d.additionalProperties!==!1?Pje(e,d,n,r,s):d}):[{}]}function zje(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 c=i===void 0&&r?{}:i,u=Oc(t);o=o.map(p=>s0(p,n,[]));const d=rR(e,c,o,n,u);if(r)return o.map(p=>Hu(l,p));t=Hu(l,o[d])}return[t]}function xte(e,t,n,r,i,o,s){const{dependencies:a,...l}=t;return zje(e,l,n,r,o).flatMap(u=>Ste(e,a,u,n,r,i,o,s))}function Ste(e,t,n,r,i,o,s,a){let l=[n];for(const c in t){if(!i&&Xe(s,[c])===void 0||n.properties&&!(c in n.properties))continue;const[u,d]=tR(c,t);return Array.isArray(d)?l[0]=Hje(n,d):En(d)&&(l=Uje(e,n,r,c,d,i,o,s,a)),l.flatMap(p=>Ste(e,u,p,r,i,o,s,a))}return l}function Hje(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 Uje(e,t,n,r,i,o,s,a,l){return cc(e,i,n,a,o,s,l).flatMap(u=>{const{oneOf:d,...p}=u;if(t=Hu(t,p),d===void 0)return t;const g=d.map(b=>typeof b=="boolean"||!(Ar in b)?[b]:vte(e,b,n,o,s,a));return yte(g).flatMap(b=>Vje(e,t,n,r,b,o,s,a,l))})}function Vje(e,t,n,r,i,o,s,a,l){const c=i.filter(u=>{if(typeof u=="boolean"||!u||!u.properties)return!1;const{[r]:d}=u.properties;if(d){const p={type:"object",properties:{[r]:d}};return e.isValid(p,a,n)||o}return!1});return!o&&c.length!==1?(console.warn("ignoring oneOf in dependencies because there isn't exactly one subschema that is valid"),[t]):c.flatMap(u=>{const d=u,[p]=tR(r,d.properties),g={...d,properties:p};return cc(e,g,n,a,o,s,l).map(b=>Hu(t,b))})}function hy(e,t,n,r,i,o={},s){if(Array.isArray(n[i])){const l=Oc(n)||r,c=n[i].map(d=>ko(e,d,t,o,s)),u=Xe(o,l);if(u!==void 0)return c.find(d=>I2(Xe(d,[nr,l,hC],Xe(d,[nr,l,za])),u))}}function wte(e,t,n,r,i){let o=n;if(Un(n,Ar)&&(o=ko(e,n,t,void 0,i)),ki(r))return o;const s=Array.isArray(r)?r:r.split("."),[a,...l]=s;if(a&&Un(o,a))return o=Xe(o,a),wte(e,t,o,l,i)}function _4(e,t,n,r,i,o){const s=wte(e,t,n,r,o);return s===void 0?i:s}const eU={title:"!@#$_UNKNOWN_$#@!"};function Wje(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(p=>{a=_4(e,t,a,[nr,p],{},o),Un(a,gn)?a=hy(e,t,a,l,gn,Xe(i,p),o):Un(a,Vn)&&(a=hy(e,t,a,l,Vn,Xe(i,p),o))}),Un(a,gn)?a=hy(e,t,a,l,gn,i,o):Un(a,Vn)&&(a=hy(e,t,a,l,Vn,i,o));let c=_4(e,t,a,[nr,l],eU,o);c===eU&&(c=void 0);const u=_4(e,t,a,gee,[],o);let d;return c&&Array.isArray(u)&&(d=u.includes(l)),{field:c,isRequired:d}}function qje(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 Gje(e,t){return function(n,r){if(n==null)return n;if(!yp(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 Cte=Gje(Hee);function Kje(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}function Yje(e,t,n){var r=Wi(e)?qje:Kje,i=arguments.length<3;return r(e,YM(t),n,i,Cte)}const Xje={type:"object",$id:F_e,properties:{__not_really_there__:{type:"number"}}};function l_(e,t,n,r,i){let o=0;return n&&(Qn(n.properties)?o+=Yje(n.properties,(s,a,l)=>{const c=Xe(r,l);if(typeof a=="boolean")return s;if(Un(a,Ar)){const u=ko(e,a,t,c,i);return s+l_(e,t,u,c||{},i)}if((Un(a,gn)||Un(a,Vn))&&c){const u=Un(a,gn)?gn:Vn,d=Oc(a);return s+L2(e,t,c,Xe(a,u),-1,d,i)}if(a.type==="object")return Qn(c)&&(s+=1),s+l_(e,t,a,c,i);if(a.type===$2(c)){let u=s+1;return a.default?u+=c===a.default?1:-1:a.const&&(u+=c===a.const?1:-1),u}return s},0):yf(n.type)&&n.type===$2(r)&&(o+=1)),o}function L2(e,t,n,r,i=-1,o,s){const a=r.map(p=>s0(p,t,[])),l=gte(n,r,o);if(mte(l))return l;const c=a.reduce((p,g,y)=>(rR(e,n,[Xje,g],t,o)===1&&p.push(y),p),[]);if(c.length===1)return c[0];c.length||Fee(a.length,p=>c.push(p));const u=new Set,{bestIndex:d}=c.reduce((p,g)=>{const{bestScore:y}=p,b=a[g],v=l_(e,t,b,n,s);return u.add(v),v>y?{bestIndex:g,bestScore:v}:p},{bestIndex:i,bestScore:0});return u.size===1&&i>=0?i:d}function iR(e){return Array.isArray(e.items)&&e.items.length>0&&e.items.every(t=>En(t))}function WS(e){return e==null}function N2(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((c,u)=>a[u]!==void 0?N2(o[u],t[u],n,r,i):c);return(n||i)&&l.length<a.length&&l.push(...a.slice(l.length)),l}if(En(t)){const o=Object.assign({},e);return Object.keys(t).reduce((s,a)=>{var l;const c=Xe(t,a),u=En(e)&&a in e,d=a in t,p=(l=Xe(e,a))!==null&&l!==void 0?l:{},g=u&&Object.entries(p).some(([,v])=>En(v)),y=u&&En(Xe(e,a)),b=d&&En(c);return y&&b&&!g?(s[a]={...Xe(e,a),...c},s):(s[a]=N2(Xe(e,a),c,n,r,i&&(u||!d)),s)},o)}return r&&(e!==void 0&&WS(t)||typeof t=="number"&&isNaN(t))||i&&!WS(t)?e:t}function np(e,t,n=!1){return Object.keys(t).reduce((r,i)=>{const o=e?e[i]:{},s=t[i];if(e&&i in e&&En(s))r[i]=np(o,s,n);else if(n&&Array.isArray(o)&&Array.isArray(s)){let a=s;n==="preventDuplicates"&&(a=s.reduce((l,c)=>(o.includes(c)||l.push(c),l),[])),r[i]=o.concat(a)}else r[i]=s;return r},Object.assign({},e))}function Ete(e){return Array.isArray(e.enum)&&e.enum.length===1||za in e}function oR(e,t,n={},r){const i=ko(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"&&Ete(s)):!1}function sR(e,t,n,r){return!t.uniqueItems||!t.items||typeof t.items=="boolean"?!1:oR(e,t.items,n,r)}function kte(e){const t=e[za],n=Cl(e);return En(t)&&yf(t?.$data)&&n!=="object"&&n!=="array"}function Jje(e){if(N_e in e&&Array.isArray(e.enum)&&e.enum.length===1)return e.enum[0];if(za in e)return e.const;throw new Error("schema cannot be inferred as a constant")}function P0(e,t){if(e.enum){let o;if(t){const{enumNames:s}=Kt(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=Oc(e);if(t){const{optionsSchemaSelector:o=i}=Kt(t);i=o}return n&&n.map((o,s)=>{const{title:a}=Kt(r?.[s]),l=o;let c,u=a;if(i){const d=Xe(l,[nr,i],{});c=Xe(d,hC,Xe(d,za)),u=u||d?.title||l.title||String(c)}else c=Jje(l),u=u||l.title||String(c);return{schema:l,label:u,value:c}})}const Zje=["string","number","integer","boolean","null"];var $0;(function(e){e[e.Ignore=0]="Ignore",e[e.Invert=1]="Invert",e[e.Fallback=2]="Fallback"})($0||($0={}));function Q7(e,t=$0.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!==$0.Ignore&&En(e.additionalItems)?e.additionalItems:{}}function Ate(e,t){const{default:n,type:r}=e;return Array.isArray(r)&&r.includes("null")&&ki(t)&&n===null?null:t}function tU(e,t,n,r,i,o=[],s={},a=!1,l=!1){const{emptyObjectFields:c="populateAllDefaults"}=s;if(r===!0||a)e[t]=n;else if(r==="excludeObjectChildren")(l&&n!==void 0||!En(n)||!ki(n))&&(e[t]=n);else if(c!=="skipDefaults"){const u=i===void 0?o.includes(t):i;En(n)?c==="skipEmptyDefaults"?ki(n)||(e[t]=n):(!ki(n)||o.includes(t))&&(u||c!=="populateRequiredDefaults")&&(e[t]=n):n!==void 0&&(c==="populateAllDefaults"||c==="skipEmptyDefaults"||u&&o.includes(t))&&(e[t]=n)}}function rf(e,t,n={}){const{parentDefaults:r,rawFormData:i,rootSchema:o={},includeUndefinedValues:s=!1,_recurseList:a=[],experimental_defaultFormStateBehavior:l=void 0,experimental_customMergeAllOf:c=void 0,required:u,shouldMergeDefaultsIntoFormData:d=!1,initialDefaultsGenerated:p}=n;let g=En(i)?i:{};const y=En(t)?t:{};let b=r,v=null,S=l,C=a;if(y[za]!==void 0&&l?.constAsDefaults!=="never"&&!kte(y))b=y[za];else if(En(b)&&En(y.default)&&!y[Vn]&&!y[gn]&&!y[Ar])b=np(b,y.default);else if(hC in y&&!y[Vn]&&!y[gn]&&!y[Ar])b=y.default;else if(Ar in y){const E=y[Ar];a.includes(E)||(C=a.concat(E),v=nR(E,o));const O=i===void 0||En(i)&&ki(i);v&&!b&&O&&(b=y.default),d&&v&&!En(i)&&(g=i)}else if(IM in y){const E={...nU(e,y,n,b),...g};v=xte(e,y,o,!1,[],E,c)[0]}else if(iR(y))b=y.items.map((E,O)=>rf(e,E,{rootSchema:o,includeUndefinedValues:s,_recurseList:a,experimental_defaultFormStateBehavior:l,experimental_customMergeAllOf:c,parentDefaults:Array.isArray(r)?r[O]:void 0,rawFormData:g,required:u,shouldMergeDefaultsIntoFormData:d}));else if(gn in y){const{oneOf:E,...O}=y;if(E.length===0)return;const _=Oc(y),{type:T="null"}=O;!Array.isArray(T)&&Zje.includes(T)&&S?.constAsDefaults==="skipOneOf"&&(S={...S,constAsDefaults:"never"}),v=E[L2(e,o,i??y.default,E,0,_,c)],v=Hu(O,v)}else if(Vn in y){const{anyOf:E,...O}=y;if(E.length===0)return;const _=Oc(y);v=E[L2(e,o,i??y.default,E,0,_,c)],v=Hu(O,v)}if(v)return rf(e,v,{rootSchema:o,includeUndefinedValues:s,_recurseList:C,experimental_defaultFormStateBehavior:S,experimental_customMergeAllOf:c,parentDefaults:b,rawFormData:i??g,required:u,shouldMergeDefaultsIntoFormData:d,initialDefaultsGenerated:p});b===void 0&&(b=y.default);const w=nU(e,y,n,b);let k=w??b;if(d){const{arrayMinItems:E={}}=l||{},{mergeExtraDefaults:O}=E,_=Qje(e,y,o,i,l,c);(!En(i)||zu in y)&&(k=N2(k,_,O,!0))}return k}function Qje(e,t,n,r,i,o){const s=!Ete(t)&&oR(e,t,n,o);let a=r;if(s){const c=P0(t);a=c?.some(d=>Lr(d.value,r))?r:void 0}return t[za]&&i?.constAsDefaults==="always"&&(a=t.const),a}function ePe(e,t,{rawFormData:n,rootSchema:r={},includeUndefinedValues:i=!1,_recurseList:o=[],experimental_defaultFormStateBehavior:s=void 0,experimental_customMergeAllOf:a=void 0,required:l,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u}={},d){{const p=En(n)?n:{},g=t,b=s?.allOf==="populateDefaults"&&zu in g||s?.emptyObjectFields!=="skipEmptyDefaults"&&jM in g?ko(e,g,r,p,a):g,v=b[za],S=Object.keys(b.properties||{}).reduce((C,w)=>{var k;const E=Xe(b,[nr,w],{}),O=En(v)&&v[w]!==void 0,_=(En(E)&&za in E||O)&&s?.constAsDefaults!=="never"&&!kte(E),T=rf(e,E,{rootSchema:r,_recurseList:o,experimental_defaultFormStateBehavior:s,experimental_customMergeAllOf:a,includeUndefinedValues:i===!0,parentDefaults:Xe(d,[w]),rawFormData:Xe(p,[w]),required:(k=b.required)===null||k===void 0?void 0:k.includes(w),shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u});return tU(C,w,T,i,l,b.required,s,_,E?.type==="null"),C},{});if(b.additionalProperties&&!u){const C=En(b.additionalProperties)?b.additionalProperties:{},w=new Set;En(d)&&Object.keys(d).filter(E=>!b.properties||!b.properties[E]).forEach(E=>w.add(E));const k=[];Object.keys(p).filter(E=>!b.properties||!b.properties[E]).forEach(E=>{w.add(E),k.push(E)}),w.forEach(E=>{var O;const _=rf(e,C,{rootSchema:r,_recurseList:o,experimental_defaultFormStateBehavior:s,experimental_customMergeAllOf:a,includeUndefinedValues:i===!0,parentDefaults:Xe(d,[E]),rawFormData:Xe(p,[E]),required:(O=b.required)===null||O===void 0?void 0:O.includes(E),shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u});tU(S,E,_,i,l,k)})}return Ate(t,S)}}function tPe(e,t,{rawFormData:n,rootSchema:r={},_recurseList:i=[],experimental_defaultFormStateBehavior:o=void 0,experimental_customMergeAllOf:s=void 0,required:a,requiredAsRoot:l=!1,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u}={},d){var p,g;const y=t,b=(p=o?.arrayMinItems)!==null&&p!==void 0?p:{},{populate:v,mergeExtraDefaults:S}=b,C=v==="never",w=v==="requiredOnly",k=v==="all"||!C&&!w,E=(g=b?.computeSkipPopulate)!==null&&g!==void 0?g:(()=>!1),_=o?.emptyObjectFields==="skipEmptyDefaults"?void 0:[];if(Array.isArray(d)&&(d=d.map((L,M)=>{const $=Q7(y,$0.Fallback,M),N=Array.isArray(n)?n[M]:void 0;return rf(e,$,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,parentDefaults:L,rawFormData:N,required:a,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u})})),Array.isArray(n)){const L=Q7(y);if(C)d=n;else{const M=n.map((N,z)=>rf(e,L,{rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,rawFormData:N,parentDefaults:Xe(d,[z]),required:a,shouldMergeDefaultsIntoFormData:c,initialDefaultsGenerated:u}));d=N2(d,M,(w&&a||k)&&S)}}if((En(y)&&za in y&&o?.constAsDefaults!=="never")===!1){if(C)return d??_;if(w&&!a)return d||void 0}let I;const P=Array.isArray(d)?d.length:0;if(!y.minItems||sR(e,y,r,s)||E(e,y,r)||y.minItems<=P)I=d||!a&&!l?d:_;else{const L=d||[],M=Q7(y,$0.Invert),$=M.default,N=Array.from({length:y.minItems-P},()=>rf(e,M,{parentDefaults:$,rootSchema:r,_recurseList:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,required:a,shouldMergeDefaultsIntoFormData:c}));I=L.concat(N)}return Ate(t,I)}function nU(e,t,n={},r){switch(Cl(t)){case"object":return ePe(e,t,n,r);case"array":return tPe(e,t,n,r)}}function Dte(e,t,n,r,i=!1,o,s,a){if(!En(t))throw new Error("Invalid schema: "+t);const l=ko(e,t,r,n,s),c=rf(e,l,{rootSchema:r,includeUndefinedValues:i,experimental_defaultFormStateBehavior:o,experimental_customMergeAllOf:s,rawFormData:n,shouldMergeDefaultsIntoFormData:!0,initialDefaultsGenerated:a,requiredAsRoot:!0});if(l.type!=="object"&&En(l.default))return{...c,...n};if(En(n)||Array.isArray(n)){const{mergeDefaultsIntoFormData:u}=o||{};return N2(c,n,!0,u==="useDefaultIfFormDataUndefined",!0)}return c}function _te(e={}){return"widget"in Kt(e)&&Kt(e).widget!=="hidden"}function Ote(e,t,n={},r,i){if(n[$M]==="files")return!0;if(t.items){const o=ko(e,t.items,r,void 0,i);return o.type==="string"&&o.format==="data-url"}return!1}function nPe(e,t,n={},r,i,o){const s=Kt(n,i),{label:a=!0}=s;let l=!!a;if(l){const c=Cl(t),u=Xe(t,Ru,!1);c==="array"&&(l=u||sR(e,t,r,o)||Ote(e,t,n,r,o)||_te(n)),c==="object"&&(l=u),c==="boolean"&&n&&!n[$M]&&(l=!1),n&&n[H_e]&&(l=!1)}return l}function Tte(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=vC(e,s);n(a,s)&&GM(o,mg(s,e),a)}return o}function rPe(e,t){return Tte(e,t,function(n,r){return Wee(e,r)})}var Mte=dte(function(e,t){return e==null?{}:rPe(e,t)});function yh(e,t,n,r,i,o=[],s){if(Ar in t||IM in t||zu in t||jM in t){const l=ko(e,t,r,i,s);if(o.findIndex(u=>Lr(u,l))===-1)return yh(e,l,n,r,i,o.concat(l),s)}let a={[E4]:n.replace(/^\./,"")};if(gn in t||Vn in t){const l=gn in t?t.oneOf:t.anyOf,c=Oc(t),u=L2(e,r,i,l,0,c,s),d=l[u];a={...a,...yh(e,d,n,r,i,o,s)}}if(O2 in t&&t[O2]!==!1&&xr(a,PM,!0),Zh in t&&Array.isArray(i)){const{items:l,additionalItems:c}=t;Array.isArray(l)?i.forEach((u,d)=>{l[d]?a[d]=yh(e,l[d],`${n}.${d}`,r,u,o,s):c?a[d]=yh(e,c,`${n}.${d}`,r,u,o,s):console.warn(`Unable to generate path schema for "${n}.${d}". No schema defined for it`)}):i.forEach((u,d)=>{a[d]=yh(e,l,`${n}.${d}`,r,u,o,s)})}else if(nr in t)for(const l in t.properties){const c=Xe(t,[nr,l],{});a[l]=yh(e,c,`${n}.${l}`,r,Xe(i,[l]),o,s)}return a}function Rte(e,t,n="",r,i,o){return yh(e,t,n,r,i,void 0,o)}function Ite(e,t){if(t.length===0&&typeof e!="object")return e;const n=Mte(e,t);return Array.isArray(e)?Object.keys(n).map(r=>n[r]):n}function jte(e,t){const n=(i,o)=>typeof i!="object"||ki(i)||o&&!ki(i),r=(i,o=[],s=[[]])=>{const a=Object.keys(i);return a.forEach(l=>{const c=i[l];if(typeof c=="object"){const u=s.map(d=>[...d,l]);c[PM]&&c[E4]!==""?o.push(c[E4]):r(c,o,u)}else l===E4&&c!==""&&s.forEach(u=>{const d=Xe(t,u),p=a.length===1;(n(d,p)||Array.isArray(d)&&d.every(g=>n(g,p)))&&o.push(u)})}),o};return r(e)}function iPe(e,t,n={},r){const i=ko(e,t,n,r),o=Rte(e,i,"",n,r),a=jte(o,r).map(l=>Array.isArray(l)?l.join("."):l);return Ite(r,a)}const pm=Symbol("no Value");function c_(e,t,n,r,i={},o){let s;if(Un(n,nr)){const a={};if(Un(r,nr)){const u=Xe(r,nr,{});Object.keys(u).forEach(d=>{Un(i,d)&&(a[d]=void 0)})}const l=Object.keys(Xe(n,nr,{})),c={};l.forEach(u=>{const d=Xe(i,u);let p=Xe(r,[nr,u],{}),g=Xe(n,[nr,u],{});Un(p,Ar)&&(p=ko(e,p,t,d,o)),Un(g,Ar)&&(g=ko(e,g,t,d,o));const y=Xe(p,"type"),b=Xe(g,"type");if(!y||y===b)if(Un(a,u)&&delete a[u],b==="object"||b==="array"&&Array.isArray(d)){const v=c_(e,t,g,p,d,o);(v!==void 0||b==="array")&&(c[u]=v)}else{const v=Xe(g,"default",pm),S=Xe(p,"default",pm);v!==pm&&v!==d&&(S===d?a[u]=v:Xe(g,"readOnly")===!0&&(a[u]=void 0));const C=Xe(g,"const",pm),w=Xe(p,"const",pm);C!==pm&&C!==d&&(a[u]=w===d?C:void 0)}}),s={...typeof i=="string"||Array.isArray(i)?void 0:i,...a,...c}}else if(Xe(r,"type")==="array"&&Xe(n,"type")==="array"&&Array.isArray(i)){let a=Xe(r,"items"),l=Xe(n,"items");if(typeof a=="object"&&typeof l=="object"&&!Array.isArray(a)&&!Array.isArray(l)){Un(a,Ar)&&(a=ko(e,a,t,i,o)),Un(l,Ar)&&(l=ko(e,l,t,i,o));const c=Xe(a,"type"),u=Xe(l,"type");if(!c||c===u){const d=Xe(n,"maxItems",-1);u==="object"?s=i.reduce((p,g)=>{const y=c_(e,t,l,a,g,o);return y!==void 0&&(d<0||p.length<d)&&p.push(y),p},[]):s=d>0&&i.length>d?i.slice(0,d):i}}else typeof a=="boolean"&&typeof l=="boolean"&&a===l&&(s=i)}return s}class oPe{constructor(t,n,r,i){n&&n[dy]===k4?this.rootSchema=a_(n,Xe(n,kr,"#")):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||!Lr(this.rootSchema,n)||!Lr(this.experimental_defaultFormStateBehavior,r)||this.experimental_customMergeAllOf!==i}findFieldInSchema(t,n,r){return Wje(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 Dte(this.validator,t,n,this.rootSchema,r,this.experimental_defaultFormStateBehavior,this.experimental_customMergeAllOf,i)}getDisplayLabel(t,n,r){return nPe(this.validator,t,n,this.rootSchema,r,this.experimental_customMergeAllOf)}getClosestMatchingOption(t,n,r,i){return L2(this.validator,this.rootSchema,t,n,r,i,this.experimental_customMergeAllOf)}getFirstMatchingOption(t,n,r){return rR(this.validator,t,n,this.rootSchema,r)}getFromSchema(t,n,r){return _4(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}isFilesArray(t,n){return Ote(this.validator,t,n,this.rootSchema,this.experimental_customMergeAllOf)}isMultiSelect(t){return sR(this.validator,t,this.rootSchema,this.experimental_customMergeAllOf)}isSelect(t){return oR(this.validator,t,this.rootSchema,this.experimental_customMergeAllOf)}omitExtraData(t,n){return iPe(this.validator,t,this.rootSchema,n)}retrieveSchema(t,n,r){return ko(this.validator,t,this.rootSchema,n,this.experimental_customMergeAllOf,r)}sanitizeDataForNewSchema(t,n,r){return c_(this.validator,this.rootSchema,t,n,r,this.experimental_customMergeAllOf)}toPathSchema(t,n,r){return Rte(this.validator,t,n,this.rootSchema,r,this.experimental_customMergeAllOf)}}function sPe(e,t,n={},r){return new oPe(e,t,n,r)}function aPe(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||"",c=decodeURI(((t=a.map(u=>u.split("=")).find(([u])=>u==="name"))===null||t===void 0?void 0:t[1])||"unknown");try{const u=atob(o),d=new Array(u.length);for(let g=0;g<u.length;g++)d[g]=u.charCodeAt(g);return{blob:new window.Blob([new Uint8Array(d)],{type:l}),name:c}}catch(u){throw new Error("File is invalid: "+u.message)}}function _d(e,t){let n=String(e);for(;n.length<t;)n="0"+n;return n}function Pte(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 Pte(t,e).reverse();const n=[];for(let r=e;r<=t;r++)n.push({value:r,label:_d(r,2)});return n}function rU(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 lPe(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 cPe(e,t){return lPe(e,t)}function uo(e,t=[],n){if(Array.isArray(e))return e.map(o=>uo(o,t)).filter(o=>o!==n);const r=e===""||e===null?-1:Number(e),i=t[r];return i?i.value:n}function $te(e,t,n=[]){const r=uo(e,n);return Array.isArray(t)?t.filter(i=>!Lr(i,r)):Lr(r,t)?void 0:t}function CC(e,t){return Array.isArray(t)?t.some(n=>Lr(n,e)):Lr(t,e)}function aR(e,t=[],n=!1){const r=t.map((i,o)=>CC(i.value,e)?String(o):void 0).filter(i=>typeof i<"u");return n?r:r[0]}function Lte(e,t,n=[]){const r=uo(e,n);if(!WS(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 uPe=1,dPe=4;function lR(e){return By(e,uPe|dPe)}function fPe(e,t,n,r){return r=typeof r=="function"?r:void 0,e==null?e:GM(e,t,n,r)}class Nte{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"?Xe(this.errorSchema,t):this.errorSchema;return!r&&t&&(r={},fPe(this.errorSchema,t,r,Object)),r}resetAllErrors(t){return this.errorSchema=t?lR(t):{},this}addErrors(t,n){const r=this.getOrCreateErrorBlock(n);let i=Xe(r,wo);return Array.isArray(i)||(i=[],r[wo]=i),Array.isArray(t)?xr(r,wo,[...new Set([...i,...t])]):xr(r,wo,[...new Set([...i,t])]),this}setErrors(t,n){const r=this.getOrCreateErrorBlock(n),i=Array.isArray(t)?[...new Set([...t])]:[t];return xr(r,wo,i),this}clearErrors(t){const n=this.getOrCreateErrorBlock(t);return xr(n,wo,[]),this}}function hPe(e,t){if(e==null)return{};var n=pg(QM(e),function(r){return[r]});return t=YM(t),Tte(e,n,function(r,i){return t(r,i[0])})}var pPe=200;function mPe(e,t,n,r){var i=-1,o=ZM,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;t.length>=pPe&&(o=R2,s=!1,t=new ep(t));e:for(;++i<a;){var u=e[i],d=u;if(u=u!==0?u:0,s&&d===d){for(var p=c;p--;)if(t[p]===d)continue e;l.push(u)}else o(t,d,r)||l.push(u)}return l}var gPe=SC(function(e,t){return j2(e)?mPe(e,ov(t,1,j2,!0)):[]});function iU(e,t){const n=gf(e),r=gf(t);if(e===t||!n&&!r)return[];if(n&&!r)return ll(e);if(!n&&r)return ll(t);{const i=ll(hPe(e,(s,a)=>!Lr(s,Xe(t,a)))),o=gPe(ll(t),ll(e));return[...i,...o]}}function yPe(e,t,n=[1900,new Date().getFullYear()+2],r="YMD"){const{day:i,month:o,year:s,hour:a,minute:l,second:c}=e,u={type:"day",range:[1,31],value:i},d={type:"month",range:[1,12],value:o},p={type:"year",range:n,value:s},g=[];switch(r){case"MDY":g.push(d,u,p);break;case"DMY":g.push(u,d,p);break;default:g.push(p,d,u)}return t&&g.push({type:"hour",range:[0,23],value:a},{type:"minute",range:[0,59],value:l},{type:"second",range:[0,59],value:c}),g}function Fte(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 Bte(e,t,n={},r=!0){const i={type:t||"text",...Fte(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 oU={props:{disabled:!1},submitText:"Submit",norender:!1};function zte(e={}){const t=Kt(e);if(t&&t[zS]){const n=t[zS];return{...oU,...n}}return oU}function Jt(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 bPe=0;function Hte(e){var t=++bPe;return VM(e)+t}function cR(){if(typeof process>"u"||Xe(process,"env.NODE_ENV")!=="test")return{};const e=new Map;return new Proxy({},{get(t,n){return e.has(n)||e.set(n,Hte("test-id-")),e.get(n)}})}var ek={exports:{}},hr={};var sU;function vPe(){if(sU)return hr;sU=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"),c=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=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 c:case u:return v;default:switch(v=v&&v.$$typeof,v){case a:case s:case l:case p:case d:case o:return v;default:return S}}case t:return S}}}return hr.ContextConsumer=s,hr.ContextProvider=o,hr.Element=e,hr.ForwardRef=l,hr.Fragment=n,hr.Lazy=p,hr.Memo=d,hr.Portal=t,hr.Profiler=i,hr.StrictMode=r,hr.Suspense=c,hr.SuspenseList=u,hr.isAsyncMode=function(){return!1},hr.isConcurrentMode=function(){return!1},hr.isContextConsumer=function(v){return b(v)===s},hr.isContextProvider=function(v){return b(v)===o},hr.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},hr.isForwardRef=function(v){return b(v)===l},hr.isFragment=function(v){return b(v)===n},hr.isLazy=function(v){return b(v)===p},hr.isMemo=function(v){return b(v)===d},hr.isPortal=function(v){return b(v)===t},hr.isProfiler=function(v){return b(v)===i},hr.isStrictMode=function(v){return b(v)===r},hr.isSuspense=function(v){return b(v)===c},hr.isSuspenseList=function(v){return b(v)===u},hr.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===n||v===i||v===r||v===c||v===u||v===g||typeof v=="object"&&v!==null&&(v.$$typeof===p||v.$$typeof===d||v.$$typeof===o||v.$$typeof===s||v.$$typeof===l||v.$$typeof===y||v.getModuleId!==void 0)},hr.typeOf=b,hr}var aU;function xPe(){return aU||(aU=1,ek.exports=vPe()),ek.exports}var SPe=xPe();const lU=Ts(SPe),tk={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 wPe(e){let t=Xe(e,"MergedWidget");if(!t){const n=e.defaultProps&&e.defaultProps.options||{};t=({options:r,...i})=>h.jsx(e,{options:{...n,...r},...i}),xr(e,"MergedWidget",t)}return t}function Tc(e,t,n={}){const r=Cl(e);if(typeof t=="function"||t&&lU.isForwardRef(A.createElement(t))||lU.isMemo(t))return wPe(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 Tc(e,i,n)}if(typeof r=="string"){if(!(r in tk))throw new Error(`No widget for type '${r}' in schema: ${JSON.stringify(e)}`);if(t in tk[r]){const i=n[tk[r][t]];return Tc(e,i,n)}}throw new Error(`No widget '${t}' for type '${r}' in schema: ${JSON.stringify(e)}`)}function CPe(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 EPe(e){const t=new Set;return JSON.stringify(e,(n,r)=>(t.add(n),r)),JSON.stringify(e,Array.from(t).sort())}function uc(e){return CPe(EPe(e))}function kPe(e){return uc(e)}function APe(e,t,n={}){try{return Tc(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 vp(e,t){return`${yf(e)?e:e[kr]}__${t}`}function xp(e){return vp(e,"description")}function uR(e){return vp(e,"error")}function EC(e){return vp(e,"examples")}function dR(e){return vp(e,"help")}function kC(e){return vp(e,"title")}function ua(e,t=!1){const n=t?` ${EC(e)}`:"";return`${uR(e)} ${xp(e)} ${dR(e)}${n}`}function AC(e,t){return`${e}-${t}`}function dc(e,t){return vp(e,t)}function nk(e,t){return vp(e,`optional${t}`)}function yg(e){return!WS(e)&&(!Qn(e)||Array.isArray(e)||!ki(e))}function DPe(e,t){const{rootSchema:n,schemaUtils:r}=e;if(I2(t,n))return!0;if(Ar in n){const i=r.retrieveSchema(n);return I2(t,i)}return!1}function Sp(e,t,n){return t?n:e}function _Pe(e){return e?new Date(e).toJSON():void 0}function fR(e,t,n){const r=[z_e];return Un(e,uH)&&r.unshift(uH),Xe(e,[...r,t],n)}function OPe(e,t){if(!Array.isArray(t))return e;const n=u=>u.reduce((d,p)=>(d[p]=!0,d),{}),r=u=>u.length>1?`properties '${u.join("', '")}'`:`property '${u[0]}'`,i=n(e),o=t.filter(u=>u==="*"||i[u]),s=n(o),a=e.filter(u=>!s[u]),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 c=[...o];return c.splice(l,1,...a),c}function rk(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 TPe=[Zh,O2],MPe=[gn,Vn,zu];function O4(e,t,n,r=new Set){const{rootSchema:i,uiSchemaDefinitions:o}=n;let s={...t},a=e;const l=e[Ar],c=l&&r.has(l);if(l){if(r.add(l),o&&l in o&&(s=np(o[l],s)),c)return s;try{a=nR(l,i)}catch{a=e}}const u=a[nr];if(u&&En(u))for(const[d,p]of Object.entries(u)){const g=s[d]||{},y=O4(p,g,n,new Set(r));Object.keys(y).length>0&&(s[d]=y)}for(const d of TPe){const p=a[d];if(p&&En(p)&&!Array.isArray(p)){const g=s[d];if(typeof g!="function"){const b=O4(p,g||{},n,new Set(r));Object.keys(b).length>0&&(s[d]=b)}}}for(const d of MPe){const p=a[d];if(Array.isArray(p)&&p.length>0){const g=s[d],y=Array.isArray(g)?[...g]:[];let b=!1;for(let v=0;v<p.length;v++){const S=p[v],C=y[v]||{},w=O4(S,C,n,new Set(r));Object.keys(w).length>0&&(y[v]=w,b=!0)}b&&(s[d]=y)}}return s}function RPe(e,t,n){var r;const i=e[Ar],o=i?(r=n.uiSchemaDefinitions)===null||r===void 0?void 0:r[i]:void 0;return o?!t||Object.keys(t).length===0?{...o}:np(o,t):t||{}}function zy(e){if(e.const||e.enum&&e.enum.length===1&&e.enum[0]===!0)return!0;if(e.anyOf&&e.anyOf.length===1)return zy(e.anyOf[0]);if(e.oneOf&&e.oneOf.length===1)return zy(e.oneOf[0]);if(e.allOf){const t=n=>zy(n);return e.allOf.some(t)}return!1}function Ute(e,t,n,r="customDeep"){if(r==="always")return!0;if(r==="shallow"){const{props:s,state:a}=e;return!rU(s,t)||!rU(a,n)}const{props:i,state:o}=e;return!Lr(i,t)||!Lr(o,n)}function cU(e){const t=tte(e.map(n=>Qn(n)?Cl(n):void 0).flat().filter(n=>n!==void 0));return t.length===1?t[0]:t}function sv(e,t,n,r){const{enableOptionalDataFieldForType:i=[]}=Kt(r,e.globalUiOptions);let o;return Vn in t&&Array.isArray(t[Vn])?o=cU(t[Vn]):gn in t&&Array.isArray(t[gn])?o=cU(t[gn]):o=Cl(t),!DPe(e,t)&&!n&&!!o&&!Array.isArray(o)&&!!i.find(s=>s===o)}function uU(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),c=new Date(l).toJSON();return t?c:c.slice(0,10)}function hR(e,t=[]){if(!e)return[];let n=[];return wo in e&&(n=n.concat(e[wo].map(r=>{const i=`.${t.join(".")}`;return{property:i,message:r,stack:`${i} ${r}`}}))),Object.keys(e).reduce((r,i)=>{if(i!==wo){const o=e[i];gf(o)&&(r=r.concat(hR(o,[...t,i])))}return r},n)}function Vte(e){return Wi(e)?pg(e,bp):rv(e)?[e]:JM(jee(VM(e)))}function IPe(e){const t=new Nte;return e.length&&e.forEach(n=>{const{property:r,message:i}=n,o=r==="."?[]:Vte(r);o.length>0&&o[0]===""&&o.splice(0,1),i&&t.addErrors(i,o)}),t.ErrorSchema}function Va(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,[kr]:a,...l!==void 0&&{name:l}}}function Wte(e){return Object.keys(e).reduce((t,n)=>{if(n==="addError")return t;{const r=e[n];return gf(r)?{...t,[n]:Wte(r)}:{...t,[n]:r}}},{})}function jPe(e){return Object.values(e).every(t=>t!==-1)}function PPe(e){const{className:t="form-control",type:n,range:r,value:i,select:o,rootId:s,name:a,disabled:l,readonly:c,autofocus:u,registry:d,onBlur:p,onFocus:g}=e,y=`${s}_${n}`,{SelectWidget:b}=d.widgets,v=A.useCallback(S=>o(n,S),[o,n]);return h.jsx(b,{schema:{type:"integer"},id:y,name:a,className:t,options:{enumOptions:Pte(r[0],r[1])},placeholder:n,value:i,disabled:l,readonly:c,autofocus:u,onChange:v,onBlur:p,onFocus:g,registry:d,label:"","aria-describedby":ua(s)})}function $Pe(e){const{time:t=!1,disabled:n=!1,readonly:r=!1,options:i,onChange:o,value:s}=e,[a,l]=A.useState(rk(s,t));A.useEffect(()=>{l(rk(s,t))},[t,s]);const c=A.useCallback((g,y)=>{const b={...a,[g]:typeof y>"u"?-1:y};jPe(b)?o(uU(b,t)):l(b)},[a,o,t]),u=A.useCallback(g=>{g.preventDefault(),!(n||r)&&o(void 0)},[n,r,o]),d=A.useCallback(g=>{if(g.preventDefault(),n||r)return;const y=rk(new Date().toJSON(),t);o(uU(y,t))},[n,r,t,o]);return{elements:A.useMemo(()=>yPe(a,t,i.yearsRange,i.format),[a,t,i.yearsRange,i.format]),handleChange:c,handleClear:u,handleSetNow:d}}function wp(e){const t=A.useRef(e);return I2(e,t.current)||(t.current=e),t.current}function LPe(e,t){return e.replace(";base64",`;name=${encodeURIComponent(t)};base64`)}function NPe(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:LPe(a.target.result,t),name:t,size:n,type:r}):i({dataURL:null,name:t,size:n,type:r})},s.readAsDataURL(e)})}function FPe(e){return Promise.all(Array.from(e).map(NPe))}function dU(e){return e.reduce((t,n)=>{if(!n)return t;try{const{blob:r,name:i}=aPe(n);return[...t,{dataURL:n,name:i,size:r.size,type:r.type}]}catch{return t}},[])}function BPe(e,t,n=!1){const r=A.useMemo(()=>n&&e?Array.isArray(e)?e:[e]:[],[e,n]),i=A.useMemo(()=>Array.isArray(e)?dU(e):dU([e||""]),[e]),o=A.useCallback(a=>{FPe(a).then(l=>{const c=l.map(u=>u.dataURL||null);t(n?r.concat(...c):c[0])})},[r,n,t]),s=A.useCallback(a=>{if(n){const l=r.filter((c,u)=>u!==a);t(l)}else t(void 0)},[r,n,t]);return{filesInfo:i,handleChange:o,handleRemove:s}}function zPe(e){if(!e)return"";const t=new Date(e),n=_d(t.getFullYear(),4),r=_d(t.getMonth()+1,2),i=_d(t.getDate(),2),o=_d(t.getHours(),2),s=_d(t.getMinutes(),2),a=_d(t.getSeconds(),2),l=_d(t.getMilliseconds(),3);return`${n}-${r}-${i}T${o}:${s}:${a}.${l}`}function T4(e,t,n=!1){if(!t)return e;const{errors:r,errorSchema:i}=e;let o=hR(t),s=t;return ki(i)||(s=np(i,t,n?"preventDuplicates":!0),o=[...r].concat(o)),{errorSchema:s,errors:o}}function HPe(e){for(const t in e){const n=e,r=n[t];t===Ar&&typeof r=="string"&&r.startsWith("#")?n[t]=vee+r:n[t]=pR(r)}return e}function UPe(e){for(let t=0;t<e.length;t++)e[t]=pR(e[t]);return e}function pR(e){return Array.isArray(e)?UPe([...e]):Qn(e)?HPe({...e}):e}var Sn;(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)"})(Sn||(Sn={}));function VPe(e,t){var n=Wi(e)?KM:Cte;return n(e,Lee(t))}function WPe(e,t){return e==null?!0:ute(e,t)}function u_(){return Hte("rjsf-array-item-")}function fU(e){return Array.isArray(e)?e.map(t=>({key:u_(),item:t})):[]}function qte(e){return Array.isArray(e)?e.map(t=>t.item):[]}function qPe(e){return Array.isArray(e.type)?!e.type.includes("null"):e.type!=="null"}function Gte(e,t,n,r){let{addable:i}=Kt(r,e.globalUiOptions);return i!==!1&&(t.maxItems!==void 0?i=n.length<t.maxItems:i=!0),i}function Kte(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 GPe(e,t){const{schemaUtils:n,globalFormOptions:r}=e;let i=t.items;return r.useFallbackUiForUnsupportedType&&!i?i={}:iR(t)&&L_e(t)&&(i=t.additionalItems),n.getDefaultFormState(i)}function KPe(e){const{schema:t,fieldPathId:n,uiSchema:r,formData:i=[],disabled:o=!1,readonly:s=!1,autofocus:a=!1,required:l=!1,placeholder:c,onBlur:u,onFocus:d,registry:p,rawErrors:g,name:y,onSelectChange:b}=e,{widgets:v,schemaUtils:S,globalFormOptions:C,globalUiOptions:w}=p,k=S.retrieveSchema(t.items,i),E=P0(k,r),{widget:O="select",title:_,...T}=Kt(r,w),I=Tc(t,O,v),P=_??t.title??y,L=S.getDisplayLabel(t,r,w),M=wp(Va("",C,n,!0));return h.jsx(I,{id:M[kr],name:y,multiple:!0,onChange:b,onBlur:u,onFocus:d,options:{...T,enumOptions:E},schema:t,uiSchema:r,registry:p,value:i,disabled:o,readonly:s,required:l,label:P,hideLabel:!L,placeholder:c,autofocus:a,rawErrors:g,htmlName:M.name})}function YPe(e){const{schema:t,fieldPathId:n,uiSchema:r,disabled:i=!1,readonly:o=!1,autofocus:s=!1,required:a=!1,hideError:l,placeholder:c,onBlur:u,onFocus:d,formData:p=[],registry:g,rawErrors:y,name:b,onSelectChange:v}=e,{widgets:S,schemaUtils:C,globalFormOptions:w,globalUiOptions:k}=g,{widget:E,title:O,..._}=Kt(r,k),T=Tc(t,E,S),I=O??t.title??b,P=C.getDisplayLabel(t,r,k),L=wp(Va("",w,n,!0));return h.jsx(T,{id:L[kr],name:b,multiple:!0,onChange:v,onBlur:u,onFocus:d,options:_,schema:t,uiSchema:r,registry:g,value:p,disabled:i,readonly:o,hideError:l,required:a,label:I,hideLabel:!P,placeholder:c,autofocus:s,rawErrors:y,htmlName:L.name})}function XPe(e){const{schema:t,uiSchema:n,fieldPathId:r,name:i,disabled:o=!1,readonly:s=!1,autofocus:a=!1,required:l=!1,onBlur:c,onFocus:u,registry:d,formData:p=[],rawErrors:g,onSelectChange:y}=e,{widgets:b,schemaUtils:v,globalFormOptions:S,globalUiOptions:C}=d,{widget:w="files",title:k,...E}=Kt(n,C),O=Tc(t,w,b),_=k??t.title??i,T=v.getDisplayLabel(t,n,C),I=wp(Va("",S,r,!0));return h.jsx(O,{options:E,id:I[kr],name:i,multiple:!0,onChange:y,onBlur:c,onFocus:u,schema:t,uiSchema:n,value:p,disabled:o,readonly:s,required:l,registry:d,autofocus:a,rawErrors:g,label:_,hideLabel:!T,htmlName:I.name})}function Yte(e){const{itemKey:t,index:n,name:r,disabled:i,hideError:o,readonly:s,registry:a,uiOptions:l,parentUiSchema:c,canAdd:u,canRemove:d=!0,canMoveUp:p,canMoveDown:g,itemSchema:y,itemData:b,itemUiSchema:v,itemFieldPathId:S,itemErrorSchema:C,autofocus:w,onBlur:k,onFocus:E,onChange:O,rawErrors:_,totalItems:T,title:I,handleAddItem:P,handleCopyItem:L,handleRemoveItem:M,handleReorderItems:$}=e,{schemaUtils:N,fields:{ArraySchemaField:z,SchemaField:F},globalUiOptions:W}=a,V=wp(S),q=z||F,X=Jt("ArrayFieldItemTemplate",a,l),B=N.getDisplayLabel(y,v,W),{description:U}=Kt(v),Y=!!U||!!y.description,{orderable:H=!0,removable:G=!0,copyable:Z=!1}=l,oe={moveUp:H&&p,moveDown:H&&g,copy:Z&&u,remove:G&&d,toolbar:!1};oe.toolbar=Object.keys(oe).some(le=>oe[le]);const ee=A.useCallback(le=>{P(le,n+1)},[P,n]),ie=A.useCallback(le=>{L(le,n)},[L,n]),te=A.useCallback(le=>{M(le,n)},[M,n]),J=A.useCallback(le=>{$(le,n,n-1)},[$,n]),Q=A.useCallback(le=>{$(le,n,n+1)},[$,n]),se={children:h.jsx(q,{name:r,title:I,index:n,schema:y,uiSchema:v,formData:b,errorSchema:C,fieldPathId:V,required:qPe(y),onChange:O,onBlur:k,onFocus:E,registry:a,disabled:i,readonly:s,hideError:o,autofocus:w,rawErrors:_}),buttonsProps:{fieldPathId:V,disabled:i,readonly:s,canAdd:u,hasCopy:oe.copy,hasMoveUp:oe.moveUp,hasMoveDown:oe.moveDown,hasRemove:oe.remove,index:n,totalItems:T,onAddItem:ee,onCopyItem:ie,onRemoveItem:te,onMoveUpItem:J,onMoveDownItem:Q,registry:a,schema:y,uiSchema:v},itemKey:t,className:"rjsf-array-item",disabled:i,hasToolbar:oe.toolbar,index:n,totalItems:T,readonly:s,registry:a,schema:y,uiSchema:v,parentUiSchema:c,displayLabel:B,hasDescription:Y};return h.jsx(X,{...se})}function JPe(e){const{schema:t,uiSchema:n={},errorSchema:r,fieldPathId:i,formData:o,name:s,title:a,disabled:l=!1,readonly:c=!1,autofocus:u=!1,required:d=!1,hideError:p=!1,registry:g,onBlur:y,onFocus:b,rawErrors:v,onChange:S,keyedFormData:C,handleAddItem:w,handleCopyItem:k,handleRemoveItem:E,handleReorderItems:O}=e,_=t.title||a||s,{schemaUtils:T,fields:I,formContext:P,globalFormOptions:L,globalUiOptions:M}=g,{OptionalDataControlsField:$}=I,N=Kt(n,M),z=Qn(t.items)?t.items:{},F=T.retrieveSchema(z),W=qte(C),V=sv(g,t,d,n),q=yg(o),X=Gte(g,t,W,n)&&(!V||q),B=q?C:[],U=V?" rjsf-optional-array-field":"",Y=e.childFieldPathId??i,H=V?h.jsx($,{...e,fieldPathId:Y}):void 0,G={canAdd:X,items:B.map((oe,ee)=>{const{key:ie,item:te}=oe,J=te,Q=T.retrieveSchema(z,J),se=r?r[ee]:void 0,le=Va(ee,L,Y),he=Kte(n,te,ee,P),ye={itemKey:ie,index:ee,name:s&&`${s}-${ee}`,registry:g,uiOptions:N,hideError:p,readonly:c,disabled:l,required:d,title:_?`${_}-${ee+1}`:void 0,canAdd:X,canMoveUp:ee>0,canMoveDown:ee<W.length-1,itemSchema:Q,itemFieldPathId:le,itemErrorSchema:se,itemData:J,itemUiSchema:he,autofocus:u&&ee===0,onBlur:y,onFocus:b,rawErrors:v,totalItems:C.length,handleAddItem:w,handleCopyItem:k,handleRemoveItem:E,handleReorderItems:O,onChange:S};return h.jsx(Yte,{...ye},ie)}),className:`rjsf-field rjsf-field-array rjsf-field-array-of-${F.type}${U}`,disabled:l,fieldPathId:i,uiSchema:n,onAddClick:w,readonly:c,required:d,schema:t,title:_,formData:W,rawErrors:v,registry:g,optionalDataControl:H},Z=Jt("ArrayFieldTemplate",g,N);return h.jsx(Z,{...G})}function ZPe(e){const{schema:t,uiSchema:n={},formData:r,errorSchema:i,fieldPathId:o,name:s,title:a,disabled:l=!1,readonly:c=!1,autofocus:u=!1,required:d=!1,hideError:p=!1,registry:g,onBlur:y,onFocus:b,rawErrors:v,keyedFormData:S,onChange:C,handleAddItem:w,handleCopyItem:k,handleRemoveItem:E,handleReorderItems:O}=e;let{formData:_=[]}=e;const T=t.title||a||s,{schemaUtils:I,fields:P,formContext:L,globalFormOptions:M,globalUiOptions:$}=g,N=Kt(n,$),{OptionalDataControlsField:z}=P,F=sv(g,t,d,n),W=yg(r),q=(Qn(t.items)?t.items:[]).map((ee,ie)=>I.retrieveSchema(ee,_[ie])),X=Qn(t.additionalItems)?I.retrieveSchema(t.additionalItems,r):null,B=e.childFieldPathId??o;_.length<q.length&&(_=_.concat(new Array(q.length-_.length)));const U=W?S:[],Y=F?" rjsf-optional-array-field":"",H=F?h.jsx(z,{...e,fieldPathId:B}):void 0,G=Gte(g,t,_,n)&&!!X&&(!F||W),Z={canAdd:G,className:`rjsf-field rjsf-field-array rjsf-field-array-fixed-items${Y}`,disabled:l,fieldPathId:o,formData:r,items:U.map((ee,ie)=>{const{key:te,item:J}=ee,Q=J,se=ie>=q.length,le=(se&&Qn(t.additionalItems)?I.retrieveSchema(t.additionalItems,Q):q[ie])||{},he=Va(ie,M,B);let ye;se?ye=n.additionalItems:Array.isArray(n.items)?ye=n.items[ie]:ye=Kte(n,J,ie,L);const Me=i?i[ie]:void 0,ue={index:ie,itemKey:te,name:s&&`${s}-${ie}`,registry:g,uiOptions:N,hideError:p,readonly:c,disabled:l,required:d,title:T?`${T}-${ie+1}`:void 0,canAdd:G,canRemove:se,canMoveUp:ie>=q.length+1,canMoveDown:se&&ie<_.length-1,itemSchema:le,itemData:Q,itemUiSchema:ye,itemFieldPathId:he,itemErrorSchema:Me,autofocus:u&&ie===0,onBlur:y,onFocus:b,rawErrors:v,totalItems:S.length,onChange:C,handleAddItem:w,handleCopyItem:k,handleRemoveItem:E,handleReorderItems:O};return h.jsx(Yte,{...ue},te)}),onAddClick:w,readonly:c,required:d,registry:g,schema:t,uiSchema:n,title:T,errorSchema:i,rawErrors:v,optionalDataControl:H},oe=Jt("ArrayFieldTemplate",g,N);return h.jsx(oe,{...Z})}function QPe(e=[]){const t=A.useMemo(()=>uc(e),[e]),[n,r]=A.useState(()=>({formDataHash:t,keyedFormData:fU(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((c,u)=>({key:c.key,item:a[u]})):fU(a),o=t,r({formDataHash:o,keyedFormData:i})}const s=A.useCallback(a=>{const l=qte(a),c=uc(l);return r({formDataHash:c,keyedFormData:a}),l},[]);return{keyedFormData:i,updateKeyedFormData:s}}function e$e(e){const{schema:t,uiSchema:n,errorSchema:r,fieldPathId:i,registry:o,formData:s,onChange:a}=e,{globalFormOptions:l,schemaUtils:c,translateString:u}=o,{keyedFormData:d,updateKeyedFormData:p}=QPe(s),g=e.childFieldPathId??i,y=A.useCallback((O,_)=>{O&&O.preventDefault();let T;if(r){T={};for(const L in r){const M=parseInt(L);_===void 0||M<_?xr(T,[M],r[L]):M>=_&&xr(T,[M+1],r[L])}}const I={key:u_(),item:GPe(o,t)},P=[...d];_!==void 0?P.splice(_,0,I):P.push(I),a(p(P),g.path,T)},[d,o,t,a,p,r,g]),b=A.useCallback((O,_)=>{O&&O.preventDefault();let T;if(r){T={};for(const L in r){const M=parseInt(L);M<=_?xr(T,[M],r[L]):M>_&&xr(T,[M+1],r[L])}}const I={key:u_(),item:lR(d[_].item)},P=[...d];_!==void 0?P.splice(_+1,0,I):P.push(I),a(p(P),g.path,T)},[d,a,p,r,g]),v=A.useCallback((O,_)=>{O&&O.preventDefault();let T;if(r){T={};for(const P in r){const L=parseInt(P);L<_?xr(T,[L],r[P]):L>_&&xr(T,[L-1],r[P])}}const I=d.filter((P,L)=>L!==_);a(p(I),g.path,T)},[d,a,p,r,g]),S=A.useCallback((O,_,T)=>{O&&(O.preventDefault(),O.currentTarget.blur());let I;if(r){I={};for(const M in r){const $=parseInt(M);$==_?xr(I,[T],r[_]):$==T?xr(I,[_],r[T]):xr(I,[M],r[$])}}function P(){const M=d.slice();return M.splice(_,1),M.splice(T,0,d[_]),M}const L=P();a(p(L),g.path,I)},[d,a,p,r,g]),C=A.useCallback((O,_,T,I)=>{a(O===void 0?null:O,_,T,I)},[a]),w=A.useCallback(O=>{a(O,g.path,void 0,g?.[kr])},[a,g]),k={...e,formData:s,fieldPathId:g,onSelectChange:w},E={...e,handleAddItem:y,handleCopyItem:b,handleRemoveItem:v,handleReorderItems:S,keyedFormData:d,onChange:C};if(!(Zh in t)){if(!l.useFallbackUiForUnsupportedType){const _=Kt(n),T=Jt("UnsupportedFieldTemplate",o,_);return h.jsx(T,{schema:t,fieldPathId:i,reason:u(Sn.MissingItems),registry:o})}const O={...t,[Zh]:{type:void 0}};k.schema=O,E.schema=O}return c.isMultiSelect(k.schema)?h.jsx(KPe,{...k}):_te(n)?h.jsx(YPe,{...k}):iR(k.schema)?h.jsx(ZPe,{...E}):c.isFilesArray(k.schema,n)?h.jsx(XPe,{...k}):h.jsx(JPe,{...E})}function t$e(e){const{schema:t,name:n,uiSchema:r,fieldPathId:i,formData:o,registry:s,required:a,disabled:l,readonly:c,hideError:u,autofocus:d,title:p,onChange:g,onFocus:y,onBlur:b,rawErrors:v}=e,{title:S}=t,{widgets:C,translateString:w,globalUiOptions:k}=s,{widget:E="checkbox",title:O,label:_=!0,enumNames:T,...I}=Kt(r,k),P=Tc(t,E,C),L=w(Sn.YesLabel),M=w(Sn.NoLabel);let $;const N=O??S??p??n;if(Array.isArray(t.oneOf))$=P0({oneOf:t.oneOf.map(F=>{if(Qn(F))return{...F,title:F.title||(F.const===!0?L:M)}}).filter(F=>F)},r);else{const F=t.enum??[!0,!1];!T&&F.length===2&&F.every(W=>typeof W=="boolean")?$=[{value:F[0],label:F[0]?L:M},{value:F[1],label:F[1]?L:M}]:$=P0({enum:F},r)}const z=A.useCallback((F,W,V)=>g(F,i.path,W,V),[g,i]);return h.jsx(P,{options:{...I,enumOptions:$},schema:t,uiSchema:r,id:i.$id,name:n,onChange:z,onFocus:y,onBlur:b,label:N,hideLabel:!_,value:o,required:a,disabled:l,readonly:c,hideError:u,registry:s,autofocus:d,rawErrors:v,htmlName:i.name})}function n$e(e){return{type:"string",enum:["string","number","boolean","object","array"],default:"string",title:e}}function r$e(e){const t=typeof e;return t==="string"||t==="number"||t==="boolean"?t:t==="object"?Array.isArray(e)?"array":"object":"string"}function i$e(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 o$e(e){const{id:t,formData:n,displayLabel:r=!0,schema:i,name:o,uiSchema:s,required:a,disabled:l=!1,readonly:c=!1,onBlur:u,onFocus:d,registry:p,fieldPathId:g,onChange:y,errorSchema:b}=e,{translateString:v,fields:S,globalFormOptions:C}=p,[w,k]=A.useState(r$e(n)),E=Kt(s),O=wp(Va("__internal_type_selector",C,g)),_=v(Sn.Type),T=A.useMemo(()=>n$e(_),[_]),I=M=>{M!=null&&(k(M),y(i$e(n,M),g.path,b,t))};if(!C.useFallbackUiForUnsupportedType){const{reason:M=v(Sn.UnknownFieldType,[String(i.type)])}=e,$=Jt("UnsupportedFieldTemplate",p,E);return h.jsx($,{schema:i,fieldPathId:g,reason:M,registry:p})}const P=Jt("FallbackFieldTemplate",p,E),{SchemaField:L}=S;return h.jsx(P,{schema:i,registry:p,typeSelector:h.jsx(L,{fieldPathId:O,name:`${o}__fallback_type`,schema:T,formData:w,onChange:I,onBlur:u,onFocus:d,registry:p,hideLabel:!r,disabled:l,readonly:c,required:a},n?uc(n):"__empty__"),schemaField:h.jsx(L,{...e,schema:{type:w,title:v(Sn.Value),...w==="object"&&{additionalProperties:!0}}})})}function s$e(e,t){return pg(t,function(n){return e[n]})}function a$e(e){return e==null?[]:s$e(e,ll(e))}var l$e=Math.max;function c$e(e,t,n,r){e=yp(e)?e:a$e(e),n=n?Nee(n):0;var i=e.length;return n<0&&(n=l$e(i+n,0)),yf(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Qee(e,t,n)>-1}var u$e=Math.min;function d$e(e,t,n){for(var r=ZM,i=e[0].length,o=e.length,s=o,a=Array(o),l=1/0,c=[];s--;){var u=e[s];l=u$e(u.length,l),a[s]=i>=120&&u.length>=120?new ep(s&&u):void 0}u=e[0];var d=-1,p=a[0];e:for(;++d<i&&c.length<l;){var g=u[d],y=g;if(g=g!==0?g:0,!(p?R2(p,y):r(c,y))){for(s=o;--s;){var b=a[s];if(!(b?R2(b,y):r(e[s],y)))continue e}p&&p.push(y),c.push(g)}}return c}function f$e(e){return j2(e)?e:[]}var hU=SC(function(e){var t=pg(e,f$e);return t.length&&t[0]===e[0]?d$e(t):[]});function Xte(e){return e===void 0}var fc;(function(e){e.ROW="ui:row",e.COLUMN="ui:col",e.COLUMNS="ui:columns",e.CONDITION="ui:condition"})(fc||(fc={}));var Hy;(function(e){e.ALL="all",e.SOME="some",e.NONE="none"})(Hy||(Hy={}));const h$e=/^\$lookup=(.+)/,ik="layoutGrid";function pU(e,t){return e??t}function p$e(e){return/^\d+?$/.test(e)}const of=cR();function m$e(e,t,n,r,i){const o=Xe(n,[ZD],{}),s=Xe(n,e),a={...Xe(s,[nf],{}),...t,...o},l={...s};ki(a)||xr(l,[nf],a),ki(o)||xr(l,[ZD],o);let{readonly:c}=Kt(l);return(i===!0||Xte(c)&&r===!0)&&(c=!0,Un(a,N7)?xr(l,[nf,N7],!0):xr(l,`ui:${N7}`,!0)),{fieldUiSchema:l,uiReadonly:c}}function g$e(e,t,n="$0m3tH1nG Un3xP3cT3d"){const r=s_([t]).sort(),i=s_([n]).sort();switch(e){case Hy.ALL:return I2(r,i);case Hy.SOME:return hU(r,i).length>0;case Hy.NONE:return hU(r,i).length===0;default:return!1}}function DC(e,t,n){let r={},i=e[t];if(gf(i)){const{children:o,className:s,...a}=i;if(i=o,s){const c=s.split(" ").map(u=>fR(n,u,u)).join(" ");r={...a,className:c}}else r=a}if(!Array.isArray(i))throw new TypeError(`Expected array for "${t}" in ${JSON.stringify(e)}`);return{children:i,gridProps:r}}function mU(e,t,n){let r;if(p$e(n)&&e&&e?.type==="array"&&Un(e,Zh)){const i=Number(n),o=e[Zh];Array.isArray(o)?i>o.length?r=cte(o):r=o[i]:r=o,t={[kr]:t[kr],path:[...t.path.slice(0,t.path.length-1),i]}}return{rawSchema:r,fieldPathId:t}}function y$e(e,t,n,r,i){const{schemaUtils:o,globalFormOptions:s}=e;let a=n,l=i;const c=t.split("."),u=c.pop();let d=o.retrieveSchema(a,r),p=r,g=d.readOnly;c.forEach(v=>{if(l=Va(v,s,l),Un(d,nr))a=Xe(d,[nr,v],{});else if(d&&(Un(d,gn)||Un(d,Vn))){const S=Un(d,gn)?gn:Vn,C=o.findSelectedOptionInXxxOf(d,v,S,p);a=Xe(C,[nr,v],{})}else{const S=mU(d,l,v);a=S.rawSchema??{},l=S.fieldPathId}p=Xe(p,v,{}),d=o.retrieveSchema(a,p),g=pU(d.readOnly,g)});let y,b=!1;if(ki(d)&&(d=void 0),d&&u){if(d&&(Un(d,gn)||Un(d,Vn))){const S=Un(d,gn)?gn:Vn;d=o.findSelectedOptionInXxxOf(d,u,S,p)}l=Va(u,s,l),b=d!==void 0&&Array.isArray(d.required)&&c$e(d.required,u);const v=mU(d,l,u);if(v.rawSchema?(d=v.rawSchema,l=v.fieldPathId):(d=Xe(d,[nr,u]),d=d&&o.retrieveSchema(d)),g=pU(d?.readOnly,g),d&&(Un(d,gn)||Un(d,Vn))){const S=Un(d,gn)?gn:Vn,C=Oc(d);y={options:d[S],hasDiscriminator:!!C}}}return{schema:d,isRequired:b,isReadonly:g,optionsInfo:y,fieldPathId:l}}function b$e(e,t){let n=e;return yf(n)&&(n=fR(t,n)),ev(n)?n:null}function v$e(e,t){let n,r=null,i={},o;if(yf(t)||Xte(t))n=t??"";else{const{name:s="",render:a,...l}=t;n=s,i=l,ki(i)||VPe(i,(c,u)=>{if(yf(c)){const d=h$e.exec(c);if(Array.isArray(d)&&d.length>1){const p=d[1];i[u]=fR(e,p,p)}}}),r=b$e(a,e),!s&&r&&(o=h.jsx(r,{...l,"data-testid":of.uiComponent}))}return{name:n,UIComponent:r,uiProps:i,rendered:o}}function _C(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=>A.createElement(mR,{...n,key:`layoutGrid-${uc(l)}`,schema:a,layoutGridSchema:l}))}function x$e(e){const{layoutGridSchema:t,...n}=e,{formData:r,registry:i}=n,{children:o,gridProps:s}=DC(t,fc.CONDITION,i),{operator:a,field:l="",value:c}=s,u=Xe(r,l,null);return g$e(a,u,c)?h.jsx(_C,{...n,childrenLayoutGridSchemaId:o}):null}function S$e(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=DC(t,fc.COLUMN,r),a=Kt(i),l=Jt("GridTemplate",r,a);return h.jsx(l,{column:!0,"data-testid":of.col,...s,children:h.jsx(_C,{...n,childrenLayoutGridSchemaId:o})})}function w$e(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=DC(t,fc.COLUMNS,r),a=Kt(i),l=Jt("GridTemplate",r,a);return o.map(c=>h.jsx(l,{column:!0,"data-testid":of.col,...s,children:h.jsx(_C,{...n,childrenLayoutGridSchemaId:[c]})},`column-${uc(c)}`))}function C$e(e){const{layoutGridSchema:t,...n}=e,{registry:r,uiSchema:i}=n,{children:o,gridProps:s}=DC(t,fc.ROW,r),a=Kt(i),l=Jt("GridTemplate",r,a);return h.jsx(l,{...s,"data-testid":of.row,children:h.jsx(_C,{...n,childrenLayoutGridSchemaId:o})})}function E$e(e){const{gridSchema:t,schema:n,uiSchema:r,errorSchema:i,fieldPathId:o,onBlur:s,onFocus:a,formData:l,readonly:c,registry:u,layoutGridSchema:d,...p}=e,{onChange:g}=p,{fields:y}=u,{SchemaField:b,LayoutMultiSchemaField:v}=y,S=v$e(u,t),{name:C,UIComponent:w,uiProps:k}=S,{schema:E,isRequired:O,isReadonly:_,optionsInfo:T,fieldPathId:I}=y$e(u,C,n,l,o),P=wp(I);if(S.rendered)return S.rendered;if(E){const L=T?.hasDiscriminator?v:b,{fieldUiSchema:M,uiReadonly:$}=m$e(C,k,r,_,c);return h.jsx(L,{"data-testid":T?.hasDiscriminator?of.layoutMultiSchemaField:of.field,...p,name:C,required:O,readonly:$,schema:E,uiSchema:M,errorSchema:Xe(i,C),fieldPathId:P,formData:Xe(l,C),onChange:g,onBlur:s,onFocus:a,options:T?.options,registry:u})}return w?h.jsx(w,{"data-testid":of.uiComponent,...p,name:C,required:O,formData:l,readOnly:!!_||c,errorSchema:i,uiSchema:r,schema:n,fieldPathId:o,onBlur:s,onFocus:a,registry:u,...k}):null}function mR(e){const{uiSchema:t}=e;let{layoutGridSchema:n}=e;const r=Kt(t);if(!n&&ik in r&&Qn(r[ik])&&(n=r[ik]),Qn(n)){if(fc.ROW in n)return h.jsx(C$e,{...e,layoutGridSchema:n});if(fc.COLUMN in n)return h.jsx(S$e,{...e,layoutGridSchema:n});if(fc.COLUMNS in n)return h.jsx(w$e,{...e,layoutGridSchema:n});if(fc.CONDITION in n)return h.jsx(x$e,{...e,layoutGridSchema:n})}return h.jsx(E$e,{...e,gridSchema:n})}mR.TEST_IDS=of;function k$e(e){const{fieldPathId:t,title:n,schema:r,uiSchema:i,required:o,registry:s,name:a}=e,l=Kt(i,s.globalUiOptions),{title:c}=l,{title:u}=r,d=c||n||u||a;if(!d)return null;const p=Jt("TitleFieldTemplate",s,l);return h.jsx(p,{id:kC(t),title:d,required:o,schema:r,uiSchema:i,registry:s})}function ok(e,t,n){const r="!@#!@$@#$!@$#";return e.map(({schema:o})=>o).find(o=>{const s=Xe(o,[nr,t]);return Xe(s,hC,Xe(s,za,r))===n})}function gU(e,t,n,r,i){const o=t.map(l=>n.retrieveSchema(l,i));let s=e;Un(e,gn)?s={...e,[gn]:o}:Un(e,Vn)&&(s={...e,[Vn]:o});const a=P0(s,r);if(!a)throw new Error(`No enumOptions were computed from the schema ${JSON.stringify(s)}`);return a}function A$e(e){const{name:t,baseType:n,disabled:r=!1,formData:i,fieldPathId:o,onBlur:s,onChange:a,options:l,onFocus:c,registry:u,uiSchema:d,schema:p,autofocus:g,readonly:y,required:b,errorSchema:v,hideError:S=!1}=e,{widgets:C,schemaUtils:w,globalUiOptions:k}=u,[E,O]=A.useState(gU(p,l,w,d,i)),_=Xe(o,kr),T=Oc(p),I=Jt("FieldErrorTemplate",u,l),P=Jt("FieldTemplate",u,l),L=uc(p),M=uc(l),$=d?uc(d):"",N=i?uc(i):"";A.useEffect(()=>{O(gU(p,l,w,d,i))},[L,M,w,$,N]);const{widget:z=T?"radio":"select",title:F="",placeholder:W="",optionsSchemaSelector:V=T,hideError:q,...X}=Kt(d);if(!V)throw new Error("No selector field provided for the LayoutMultiSchemaField");const B=Xe(i,V);let U=Xe(E[0]?.schema,[nr,V],{});const Y=ok(E,V,B);U=U?.type?U:{...U,type:Y?.type||n};const H=Tc(U,z,C),G=q===void 0?S:!!q,Z=Xe(v,[wo],[]),oe=P2(v,[wo]),ee=w.getDisplayLabel(p,d,k),ie=Q=>{const se=ok(E,V,Q),le=ok(E,V,B);let he=w.sanitizeDataForNewSchema(se,le,i);he&&se&&(he=w.getDefaultFormState(se,he,"excludeObjectChildren")),he&&xr(he,V,Q),a(he,o.path,void 0,_)},te={enumOptions:E,...X},J=!G&&Z.length>0?h.jsx(I,{fieldPathId:o,schema:p,errors:Z,registry:u}):void 0;return h.jsx(P,{fieldPathId:o,id:_,schema:p,label:(F||p.title)??"",disabled:r||Array.isArray(E)&&ki(E),uiSchema:d,required:b,readonly:!!y,registry:u,displayLabel:ee,errors:J,onChange:a,onKeyRename:A4,onKeyRenameBlur:A4,onRemoveProperty:A4,children:h.jsx(H,{id:_,name:t,schema:p,label:(F||p.title)??"",disabled:r||Array.isArray(E)&&ki(E),uiSchema:d,autofocus:g,readonly:y,required:b,registry:u,multiple:!1,rawErrors:Z,hideError:G,hideLabel:!ee,errorSchema:oe,placeholder:W,onChange:ie,onBlur:s,onFocus:c,value:B,options:te,htmlName:o.name})})}class yU extends A.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(!Lr(t.options,i)){const{registry:{schemaUtils:l}}=this.props,c=i.map(u=>l.retrieveSchema(u,r));a={selectedOption:s,retrievedOptions:c}}if(!Lr(r,t.formData)&&o.$id===t.fieldPathId.$id){const{retrievedOptions:l}=a,c=this.getMatchingOption(s,r,l);n&&c!==s&&(a={selectedOption:c,retrievedOptions:l})}a!==this.state&&this.setState(a)}getMatchingOption(t,n,r){const{schema:i,registry:{schemaUtils:o}}=this.props,s=Oc(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,c=t!==void 0?parseInt(t,10):-1;if(c===n)return;const u=c>=0?r[c]:void 0,d=n>=0?r[n]:void 0;let p=l.sanitizeDataForNewSchema(u,d,i);u&&(p=l.getDefaultFormState(u,p,"excludeObjectChildren")),this.setState({selectedOption:c},()=>{o(p,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:c,schema:u,uiSchema:d}=this.props,{widgets:p,fields:g,translateString:y,globalUiOptions:b,schemaUtils:v}=c,{SchemaField:S}=g,C=Jt("MultiSchemaFieldTemplate",c,b),w=sv(c,u,l,d),k=yg(i),{selectedOption:E,retrievedOptions:O}=this.state,{widget:_="select",placeholder:T,autofocus:I,autocomplete:P,title:L=u.title,...M}=Kt(d,b),$=Tc({type:"number"},_,p),N=Xe(r,wo,[]),z=P2(r,[wo]),F=v.getDisplayLabel(u,d,b),W=E>=0&&O[E]||null;let V;if(W){const{required:Z}=u;V=Z?Hu({required:Z},W):W}let q=[];gn in u&&d&&gn in d?Array.isArray(d[gn])?q=d[gn]:console.warn(`uiSchema.oneOf is not an array for "${L||t}"`):Vn in u&&d&&Vn in d&&(Array.isArray(d[Vn])?q=d[Vn]:console.warn(`uiSchema.anyOf is not an array for "${L||t}"`));let X=d;E>=0&&q.length>E&&(X=q[E]);const B=L?Sn.TitleOptionPrefix:Sn.OptionPrefix,U=L?[L]:[],Y=O.map((Z,oe)=>{const{title:ee=Z.title}=Kt(q[oe]);return{label:ee||y(B,U.concat(String(oe+1))),value:oe}}),H=!w||k?h.jsx($,{id:this.getFieldId(),name:`${t}${u.oneOf?"__oneof_select":"__anyof_select"}`,schema:{type:"number",default:0},onChange:this.onOptionChange,onBlur:o,onFocus:s,disabled:n||ki(Y),multiple:!1,rawErrors:N,errorSchema:z,value:E>=0?E:void 0,options:{enumOptions:Y,...M},registry:c,placeholder:T,autocomplete:P,autofocus:I,label:L??t,hideLabel:!F,readonly:a}):void 0,G=V&&V.type!=="null"&&h.jsx(S,{...this.props,schema:V,uiSchema:X})||null;return h.jsx(C,{schema:u,registry:c,uiSchema:d,selector:H,optionSchemaField:G})}}const D$e=/\.([0-9]*0)*$/,_$e=/[0.]0*$/;function O$e(e){const{registry:t,onChange:n,formData:r,value:i}=e,[o,s]=A.useState(i),{StringField:a}=t.fields;let l=r;const c=A.useCallback((u,d,p,g)=>{s(u),`${u}`.charAt(0)==="."&&(u=`0${u}`);const y=typeof u=="string"&&u.match(D$e)?cH(u.replace(_$e,"")):cH(u);n(y,d,p,g)},[n]);if(typeof o=="string"&&typeof l=="number"){const u=new RegExp(`^(${String(l).replace(".","\\.")})?\\.?0*$`);o.match(u)&&(l=o)}return h.jsx(a,{...e,formData:l,onChange:c})}function Ql(){return Ql=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},Ql.apply(null,arguments)}const p3=["strong","em","del","mark"],bU=[["**",p3[0]],["__",p3[0]],["~~",p3[2]],["==",p3[3]],["*","em"],["_","em"]];function T$e(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 M$e(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=bU[s][0];if(e.startsWith(a)&&e.length>=2*a.length){r=a,i=a.length,o=bU[s][1];break}}if(!r)return null;for(var l=i,c=!1,u=!1,d="",p=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!=="`"||p!==0){if(v==="["&&!c&&p===0){var S=T$e(e,l);if(S!==-1){g+=e.slice(l,S),l=S,b=e[S-1];continue}}if(u)g+=v,d?v===d&&(d=""):v==='"'||v==="'"?d=v:v===">"&&(u=!1),b=v,l++;else if(v!=="<"||c){if(v===`
225
225
  `&&b===`
226
226
  `&&!c&&p===0)return null;if(!c&&p===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 k=e[l+1],E=e.indexOf(">",l);if(E!==-1){var O=e.slice(l,E+1).endsWith("/>");k==="/"?p=Math.max(0,p-1):O||p++}u=!0,g+=v,b=v,l++}}else c=!c,g+=v,b=v,l++;else g+=v,y=!0,b=v,l++}return null}const R$e=["children","options"],vU=["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"}),xU={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},I$e=["style","script","pre"],j$e=["src","href","data","formAction","srcDoc","action"],P$e=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,$$e=/\n{2,}$/,SU=/^(\s*>[\s\S]*?)(?=\n\n|$)/,L$e=/^ *> ?/gm,N$e=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,F$e=/^ {2,}\n/,B$e=/^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/,wU=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,CU=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,z$e=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,H$e=/^(?:\n *)*\n/,U$e=/\r\n?/g,V$e=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,W$e=/^\[\^([^\]]+)]/,q$e=/\f/g,G$e=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,K$e=/^\[(x|\s)\]/,EU=/^(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,kU=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,AU=/^([^\n]+)\n *(=|-)\2{2,} *\n/,gR=/^<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>/i;function Y$e(e){const t=gR.exec(e);if(!t)return null;const n=t[1],r=n.toLowerCase(),i=r.length+1;let o=t[0].length;e[o]===`
@@ -496,4 +496,4 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
496
496
  To pick up a draggable item, press the space bar.
497
497
  While dragging, use the arrow keys to move the item.
498
498
  Press space again to drop the item in its new position, or press escape to cancel.
499
- `},jpt={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 Ppt(e){let{announcements:t=jpt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ipt}=e;const{announce:o,announcement:s}=Tpt(),a=Lv("DndLiveRegion"),[l,c]=A.useState(!1);if(A.useEffect(()=>{c(!0)},[]),Mpt(A.useMemo(()=>({onDragStart(d){let{active:p}=d;o(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:g}=d;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(d){let{active:p,over:g}=d;o(t.onDragOver({active:p,over:g}))},onDragEnd(d){let{active:p,over:g}=d;o(t.onDragEnd({active:p,over:g}))},onDragCancel(d){let{active:p,over:g}=d;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!l)return null;const u=nn.createElement(nn.Fragment,null,nn.createElement(_pt,{id:r,value:i.draggable}),nn.createElement(Opt,{id:a,announcement:s}));return n?Vd.createPortal(u,n):u}var Vi;(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"})(Vi||(Vi={}));function aw(){}function KY(e,t){return A.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function $pt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return A.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const kl=Object.freeze({x:0,y:0});function hue(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Lpt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function YY(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 mue(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function XY(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 Npt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=XY(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=hue(XY(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(pue)},Fpt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=YY(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=YY(l),u=i.reduce((p,g,y)=>p+hue(c[y],g),0),d=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:d}})}}return o.sort(pue)};function Bpt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const zpt=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=Bpt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Lpt)};function Hpt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function gue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:kl}function Upt(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 Vpt=Upt(1);function Wpt(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 qpt(e,t,n){const r=Wpt(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const Gpt={ignoreTransform:!1};function $g(e,t){t===void 0&&(t=Gpt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Is(e).getComputedStyle(e);c&&(n=qpt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function JY(e){return $g(e,{ignoreTransform:!0})}function Kpt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ypt(e,t){return t===void 0&&(t=Is(e).getComputedStyle(e)),t.position==="fixed"}function Xpt(e,t){t===void 0&&(t=Is(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 M8(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(vj(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Pv(i)||uue(i)||n.includes(i))return n;const o=Is(e).getComputedStyle(i);return i!==e&&Xpt(i,o)&&n.push(i),Ypt(i,o)?n:r(i.parentNode)}return e?r(e):n}function yue(e){const[t]=M8(e,1);return t??null}function WA(e){return!T8||!e?null:jg(e)?e:bj(e)?vj(e)||e===Pg(e).scrollingElement?window:Pv(e)?e:null:null}function bue(e){return jg(e)?e.scrollX:e.scrollLeft}function vue(e){return jg(e)?e.scrollY:e.scrollTop}function JO(e){return{x:bue(e),y:vue(e)}}var ro;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ro||(ro={}));function xue(e){return!T8||!e?!1:e===document.scrollingElement}function Sue(e){const t={x:0,y:0},n=xue(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 Jpt={x:.2,y:.2};function Zpt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Jpt);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=Sue(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=ro.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=ro.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!p&&a>=t.right-b.width?(g.x=ro.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!d&&s<=t.left+b.width&&(g.x=ro.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function Qpt(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 wue(e){return e.reduce((t,n)=>C0(t,JO(n)),kl)}function emt(e){return e.reduce((t,n)=>t+bue(n),0)}function tmt(e){return e.reduce((t,n)=>t+vue(n),0)}function nmt(e,t){if(t===void 0&&(t=$g),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);yue(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rmt=[["x",["left","right"],emt],["y",["top","bottom"],tmt]];class wj{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=M8(n),i=wue(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of rmt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class s2{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 imt(e){const{EventTarget:t}=Is(e);return e instanceof t?e:Pg(e)}function qA(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 Ea;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ea||(Ea={}));function ZY(e){e.preventDefault()}function omt(e){e.stopPropagation()}var Gn;(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"})(Gn||(Gn={}));const Cue={start:[Gn.Space,Gn.Enter],cancel:[Gn.Esc],end:[Gn.Space,Gn.Enter,Gn.Tab]},smt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Gn.Right:return{...n,x:n.x+25};case Gn.Left:return{...n,x:n.x-25};case Gn.Down:return{...n,y:n.y+25};case Gn.Up:return{...n,y:n.y-25}}};class Cj{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 s2(Pg(n)),this.windowListeners=new s2(Is(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ea.Resize,this.handleCancel),this.windowListeners.add(Ea.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ea.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&nmt(r),n(kl)}handleKeyDown(t){if(Sj(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Cue,coordinateGetter:s=smt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:kl;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=Ob(d,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:k,maxScroll:E,minScroll:O}=Sue(b),_=Qpt(b),T={x:Math.min(v===Gn.Right?_.right-_.width/2:_.right,Math.max(v===Gn.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(v===Gn.Down?_.bottom-_.height/2:_.bottom,Math.max(v===Gn.Down?_.top:_.top+_.height/2,d.y))},I=v===Gn.Right&&!C||v===Gn.Left&&!w,P=v===Gn.Down&&!k||v===Gn.Up&&!S;if(I&&T.x!==d.x){const L=b.scrollLeft+p.x,M=v===Gn.Right&&L<=E.x||v===Gn.Left&&L>=O.x;if(M&&!p.y){b.scrollTo({left:L,behavior:a});return}M?g.x=b.scrollLeft-L:g.x=v===Gn.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(P&&T.y!==d.y){const L=b.scrollTop+p.y,M=v===Gn.Down&&L<=E.y||v===Gn.Up&&L>=O.y;if(M&&!p.x){b.scrollTo({top:L,behavior:a});return}M?g.y=b.scrollTop-L:g.y=v===Gn.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,C0(Ob(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Cj.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Cue,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 QY(e){return!!(e&&"distance"in e)}function eX(e){return!!(e&&"delay"in e)}class Ej{constructor(t,n,r){var i;r===void 0&&(r=imt(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=Pg(s),this.documentListeners=new s2(this.document),this.listeners=new s2(r),this.windowListeners=new s2(Is(s)),this.initialCoordinates=(i=XO(o))!=null?i:kl,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(Ea.Resize,this.handleCancel),this.windowListeners.add(Ea.DragStart,ZY),this.windowListeners.add(Ea.VisibilityChange,this.handleCancel),this.windowListeners.add(Ea.ContextMenu,ZY),this.documentListeners.add(Ea.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(eX(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(QY(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(Ea.Click,omt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ea.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=XO(t))!=null?n:kl,c=Ob(i,l);if(!r&&a){if(QY(a)){if(a.tolerance!=null&&qA(c,a.tolerance))return this.handleCancel();if(qA(c,a.distance))return this.handleStart()}if(eX(a)&&qA(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Gn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const amt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kj extends Ej{constructor(t){const{event:n}=t,r=Pg(n.target);super(t,amt,r)}}kj.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 lmt={move:{name:"mousemove"},end:{name:"mouseup"}};var ZO;(function(e){e[e.RightClick=2]="RightClick"})(ZO||(ZO={}));class cmt extends Ej{constructor(t){super(t,lmt,Pg(t.event.target))}}cmt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ZO.RightClick?!1:(r?.({event:n}),!0)}}];const GA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class umt extends Ej{constructor(t){super(t,GA)}static setup(){return window.addEventListener(GA.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(GA.move.name,t)};function t(){}}}umt.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 a2;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(a2||(a2={}));var lw;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(lw||(lw={}));function dmt(e){let{acceleration:t,activator:n=a2.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=lw.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const g=hmt({delta:d,disabled:!o}),[y,b]=Cpt(),v=A.useRef({x:0,y:0}),S=A.useRef({x:0,y:0}),C=A.useMemo(()=>{switch(n){case a2.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case a2.DraggableRect:return i}},[n,i,l]),w=A.useRef(null),k=A.useCallback(()=>{const O=w.current;if(!O)return;const _=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(_,T)},[]),E=A.useMemo(()=>a===lw.TreeOrder?[...c].reverse():c,[a,c]);A.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const _=c.indexOf(O),T=u[_];if(!T)continue;const{direction:I,speed:P}=Zpt(O,T,C,t,p);for(const L of["x","y"])g[L][I[L]]||(P[L]=0,I[L]=0);if(P.x>0||P.y>0){b(),w.current=O,y(k,s),v.current=P,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,k,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(p)])}const fmt={x:{[ro.Backward]:!1,[ro.Forward]:!1},y:{[ro.Backward]:!1,[ro.Forward]:!1}};function hmt(e){let{delta:t,disabled:n}=e;const r=YO(t);return $v(i=>{if(n||!r||!i)return fmt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ro.Backward]:i.x[ro.Backward]||o.x===-1,[ro.Forward]:i.x[ro.Forward]||o.x===1},y:{[ro.Backward]:i.y[ro.Backward]||o.y===-1,[ro.Forward]:i.y[ro.Forward]||o.y===1}}},[n,t,r])}function pmt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return $v(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function mmt(e,t){return A.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 Mb;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Mb||(Mb={}));var QO;(function(e){e.Optimized="optimized"})(QO||(QO={}));const tX=new Map;function gmt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=A.useState(null),{frequency:a,measure:l,strategy:c}=i,u=A.useRef(e),d=v(),p=_b(d),g=A.useCallback(function(S){S===void 0&&(S=[]),!p.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[p]),y=A.useRef(null),b=$v(S=>{if(d&&!n)return tX;if(!S||S===tX||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const k=w.node.current,E=k?new wj(l(k),k):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,d,l]);return A.useEffect(()=>{u.current=e},[e]),A.useEffect(()=>{d||g()},[n,d]),A.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),A.useEffect(()=>{d||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,d,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case Mb.Always:return!1;case Mb.BeforeDragging:return n;default:return!n}}}function Eue(e,t){return $v(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ymt(e,t){return Eue(e,t)}function bmt(e){let{callback:t,disabled:n}=e;const r=xj(t),i=A.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return A.useEffect(()=>()=>i?.disconnect(),[i]),i}function R8(e){let{callback:t,disabled:n}=e;const r=xj(t),i=A.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return A.useEffect(()=>()=>i?.disconnect(),[i]),i}function vmt(e){return new wj($g(e),e)}function nX(e,t,n){t===void 0&&(t=vmt);const[r,i]=A.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=bmt({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){o();break}}}}),a=R8({callback:o});return Ic(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function xmt(e){const t=Eue(e);return gue(e,t)}const rX=[];function Smt(e){const t=A.useRef(e),n=$v(r=>e?r&&r!==rX&&e&&t.current&&e.parentNode===t.current.parentNode?r:M8(e):rX,[e]);return A.useEffect(()=>{t.current=e},[e]),n}function wmt(e){const[t,n]=A.useState(null),r=A.useRef(e),i=A.useCallback(o=>{const s=WA(o.target);s&&n(a=>a?(a.set(s,JO(s)),new Map(a)):null)},[]);return A.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=WA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,JO(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=WA(l);c?.removeEventListener("scroll",i)})}},[i,e]),A.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>C0(o,s),kl):wue(e):kl,[e,t])}function iX(e,t){t===void 0&&(t=[]);const n=A.useRef(null);return A.useEffect(()=>{n.current=null},t),A.useEffect(()=>{const r=e!==kl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ob(e,n.current):kl}function Cmt(e){A.useEffect(()=>{if(!T8)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 Emt(e,t){return A.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function kue(e){return A.useMemo(()=>e?Kpt(e):null,[e])}const oX=[];function kmt(e,t){t===void 0&&(t=$g);const[n]=e,r=kue(n?Is(n):null),[i,o]=A.useState(oX);function s(){o(()=>e.length?e.map(l=>xue(l)?r:new wj(t(l),l)):oX)}const a=R8({callback:s});return Ic(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Amt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Pv(t)?t:e}function Dmt(e){let{measure:t}=e;const[n,r]=A.useState(null),i=A.useCallback(c=>{for(const{target:u}of c)if(Pv(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),o=R8({callback:i}),s=A.useCallback(c=>{const u=Amt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=sw(s);return A.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const _mt=[{sensor:kj,options:{}},{sensor:Cj,options:{}}],Omt={current:{}},oS={draggable:{measure:JY},droppable:{measure:JY,strategy:Mb.WhileDragging,frequency:QO.Optimized},dragOverlay:{measure:$g}};class l2 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 Tmt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new l2,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:aw},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oS,measureDroppableContainers:aw,windowRect:null,measuringScheduled:!1},Mmt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:aw,draggableNodes:new Map,over:null,measureDroppableContainers:aw},I8=A.createContext(Mmt),Aue=A.createContext(Tmt);function Rmt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new l2}}}function Imt(e,t){switch(t.type){case Vi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vi.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 Vi.DragEnd:case Vi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vi.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new l2(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vi.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 l2(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Vi.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new l2(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function jmt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=A.useContext(I8),o=YO(r),s=YO(n?.id);return A.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!Sj(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=Apt(u);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function Pmt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function $mt(e){return A.useMemo(()=>({draggable:{...oS.draggable,...e?.draggable},droppable:{...oS.droppable,...e?.droppable},dragOverlay:{...oS.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Lmt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=A.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Ic(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=gue(u,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=yue(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const Due=A.createContext({...kl,scaleX:1,scaleY:1});var $d;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($d||($d={}));const Nmt=A.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=_mt,collisionDetection:d=zpt,measuring:p,modifiers:g,...y}=t;const b=A.useReducer(Imt,void 0,Rmt),[v,S]=b,[C,w]=Rpt(),[k,E]=A.useState($d.Uninitialized),O=k===$d.Initialized,{draggable:{active:_,nodes:T,translate:I},droppable:{containers:P}}=v,L=_!=null?T.get(_):null,M=A.useRef({initial:null,translated:null}),$=A.useMemo(()=>{var jt;return _!=null?{id:_,data:(jt=L?.data)!=null?jt:Omt,rect:M}:null},[_,L]),N=A.useRef(null),[z,F]=A.useState(null),[W,V]=A.useState(null),q=_b(y,Object.values(y)),X=Lv("DndDescribedBy",s),B=A.useMemo(()=>P.getEnabled(),[P]),U=$mt(p),{droppableRects:Y,measureDroppableContainers:H,measuringScheduled:G}=gmt(B,{dragging:O,dependencies:[I.x,I.y],config:U.droppable}),Z=pmt(T,_),oe=A.useMemo(()=>W?XO(W):null,[W]),ee=pr(),ie=ymt(Z,U.draggable.measure);Lmt({activeNode:_!=null?T.get(_):null,config:ee.layoutShiftCompensation,initialRect:ie,measure:U.draggable.measure});const te=nX(Z,U.draggable.measure,ie),J=nX(Z?Z.parentElement:null),Q=A.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=P.getNodeFor((n=Q.current.over)==null?void 0:n.id),le=Dmt({measure:U.dragOverlay.measure}),he=(r=le.nodeRef.current)!=null?r:Z,ye=O?(i=le.rect)!=null?i:te:null,Me=!!(le.nodeRef.current&&le.rect),ue=xmt(Me?null:te),ke=kue(he?Is(he):null),_e=Smt(O?se??Z:null),Ue=kmt(_e),He=Pmt(g,{transform:{x:I.x-ue.x,y:I.y-ue.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:te,containerNodeRect:J,draggingNodeRect:ye,over:Q.current.over,overlayNodeRect:le.rect,scrollableAncestors:_e,scrollableAncestorRects:Ue,windowRect:ke}),Dt=oe?C0(oe,I):null,yt=wmt(_e),Be=iX(yt),Re=iX(yt,[te]),Ve=C0(He,Be),Qe=ye?Vpt(ye,He):null,ot=$&&Qe?d({active:$,collisionRect:Qe,droppableRects:Y,droppableContainers:B,pointerCoordinates:Dt}):null,lt=mue(ot,"id"),[Je,$t]=A.useState(null),Pe=Me?He:C0(He,Re),Ge=Hpt(Pe,(o=Je?.rect)!=null?o:null,te),mt=A.useRef(null),Ct=A.useCallback((jt,Ht)=>{let{sensor:sn,options:Rn}=Ht;if(N.current==null)return;const un=T.get(N.current);if(!un)return;const _t=jt.nativeEvent,yn=new sn({active:N.current,activeNode:un,event:_t,options:Rn,context:Q,onAbort(gt){if(!T.get(gt))return;const{onDragAbort:ce}=q.current,pe={id:gt};ce?.(pe),C({type:"onDragAbort",event:pe})},onPending(gt,Gt,ce,pe){if(!T.get(gt))return;const{onDragPending:$e}=q.current,We={id:gt,constraint:Gt,initialCoordinates:ce,offset:pe};$e?.(We),C({type:"onDragPending",event:We})},onStart(gt){const Gt=N.current;if(Gt==null)return;const ce=T.get(Gt);if(!ce)return;const{onDragStart:pe}=q.current,xe={activatorEvent:_t,active:{id:Gt,data:ce.data,rect:M}};Vd.unstable_batchedUpdates(()=>{pe?.(xe),E($d.Initializing),S({type:Vi.DragStart,initialCoordinates:gt,active:Gt}),C({type:"onDragStart",event:xe}),F(mt.current),V(_t)})},onMove(gt){S({type:Vi.DragMove,coordinates:gt})},onEnd:ct(Vi.DragEnd),onCancel:ct(Vi.DragCancel)});mt.current=yn;function ct(gt){return async function(){const{active:ce,collisions:pe,over:xe,scrollAdjustedTranslate:$e}=Q.current;let We=null;if(ce&&$e){const{cancelDrop:St}=q.current;We={activatorEvent:_t,active:ce,collisions:pe,delta:$e,over:xe},gt===Vi.DragEnd&&typeof St=="function"&&await Promise.resolve(St(We))&&(gt=Vi.DragCancel)}N.current=null,Vd.unstable_batchedUpdates(()=>{S({type:gt}),E($d.Uninitialized),$t(null),F(null),V(null),mt.current=null;const St=gt===Vi.DragEnd?"onDragEnd":"onDragCancel";if(We){const st=q.current[St];st?.(We),C({type:St,event:We})}})}}},[T]),ht=A.useCallback((jt,Ht)=>(sn,Rn)=>{const un=sn.nativeEvent,_t=T.get(Rn);if(N.current!==null||!_t||un.dndKit||un.defaultPrevented)return;const yn={active:_t};jt(sn,Ht.options,yn)===!0&&(un.dndKit={capturedBy:Ht.sensor},N.current=Rn,Ct(sn,Ht))},[T,Ct]),Xt=mmt(u,ht);Cmt(u),Ic(()=>{te&&k===$d.Initializing&&E($d.Initialized)},[te,k]),A.useEffect(()=>{const{onDragMove:jt}=q.current,{active:Ht,activatorEvent:sn,collisions:Rn,over:un}=Q.current;if(!Ht||!sn)return;const _t={active:Ht,activatorEvent:sn,collisions:Rn,delta:{x:Ve.x,y:Ve.y},over:un};Vd.unstable_batchedUpdates(()=>{jt?.(_t),C({type:"onDragMove",event:_t})})},[Ve.x,Ve.y]),A.useEffect(()=>{const{active:jt,activatorEvent:Ht,collisions:sn,droppableContainers:Rn,scrollAdjustedTranslate:un}=Q.current;if(!jt||N.current==null||!Ht||!un)return;const{onDragOver:_t}=q.current,yn=Rn.get(lt),ct=yn&&yn.rect.current?{id:yn.id,rect:yn.rect.current,data:yn.data,disabled:yn.disabled}:null,gt={active:jt,activatorEvent:Ht,collisions:sn,delta:{x:un.x,y:un.y},over:ct};Vd.unstable_batchedUpdates(()=>{$t(ct),_t?.(gt),C({type:"onDragOver",event:gt})})},[lt]),Ic(()=>{Q.current={activatorEvent:W,active:$,activeNode:Z,collisionRect:Qe,collisions:ot,droppableRects:Y,draggableNodes:T,draggingNode:he,draggingNodeRect:ye,droppableContainers:P,over:Je,scrollableAncestors:_e,scrollAdjustedTranslate:Ve},M.current={initial:ye,translated:Qe}},[$,Z,ot,Qe,T,he,ye,Y,P,Je,_e,Ve]),dmt({...ee,delta:I,draggingRect:Qe,pointerCoordinates:Dt,scrollableAncestors:_e,scrollableAncestorRects:Ue});const fn=A.useMemo(()=>({active:$,activeNode:Z,activeNodeRect:te,activatorEvent:W,collisions:ot,containerNodeRect:J,dragOverlay:le,draggableNodes:T,droppableContainers:P,droppableRects:Y,over:Je,measureDroppableContainers:H,scrollableAncestors:_e,scrollableAncestorRects:Ue,measuringConfiguration:U,measuringScheduled:G,windowRect:ke}),[$,Z,te,W,ot,J,le,T,P,Y,Je,H,_e,Ue,U,G,ke]),Xn=A.useMemo(()=>({activatorEvent:W,activators:Xt,active:$,activeNodeRect:te,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Je,measureDroppableContainers:H}),[W,Xt,$,te,S,X,T,Je,H]);return nn.createElement(fue.Provider,{value:w},nn.createElement(I8.Provider,{value:Xn},nn.createElement(Aue.Provider,{value:fn},nn.createElement(Due.Provider,{value:Ge},c)),nn.createElement(jmt,{disabled:a?.restoreFocus===!1})),nn.createElement(Ppt,{...a,hiddenTextDescribedById:X}));function pr(){const jt=z?.autoScrollEnabled===!1,Ht=typeof l=="object"?l.enabled===!1:l===!1,sn=O&&!jt&&!Ht;return typeof l=="object"?{...l,enabled:sn}:{enabled:sn}}}),Fmt=A.createContext(null),sX="button",Bmt="Draggable";function zmt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Lv(Bmt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=A.useContext(I8),{role:g=sX,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=A.useContext(v?Due:Fmt),[C,w]=sw(),[k,E]=sw(),O=Emt(s,t),_=_b(n);Ic(()=>(d.set(t,{id:t,key:o,node:C,activatorNode:k,data:_}),()=>{const I=d.get(t);I&&I.key===o&&d.delete(t)}),[d,t]);const T=A.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===sX?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Hmt(){return A.useContext(Aue)}const Umt="Droppable",Vmt={timeout:25};function Wmt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Lv(Umt),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=A.useContext(I8),u=A.useRef({disabled:n}),d=A.useRef(!1),p=A.useRef(null),g=A.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Vmt,...i},S=_b(b??r),C=A.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=R8({callback:C,disabled:y||!s}),k=A.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[E,O]=sw(k),_=_b(t);return A.useEffect(()=>{!w||!E.current||(w.disconnect(),d.current=!1,w.observe(E.current))},[E,w]),A.useEffect(()=>(a({type:Vi.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:p,data:_}}),()=>a({type:Vi.UnregisterDroppable,key:o,id:r})),[r]),A.useEffect(()=>{n!==u.current.disabled&&(a({type:Vi.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:p,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function Aj(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function qmt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function r4(e){return e!==null&&e>=0}function Gmt(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 Kmt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const _ue=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Aj(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}},i4={scaleX:1,scaleY:1},Ymt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...i4}:null}const l=Xmt(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...i4}:i<n&&i>=s?{x:0,y:a.height+l,...i4}:{x:0,y:0,...i4}};function Xmt(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 Oue="Sortable",Tue=nn.createContext({activeIndex:-1,containerId:Oue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_ue,disabled:{draggable:!1,droppable:!1}});function Jmt(e){let{children:t,id:n,items:r,strategy:i=_ue,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Hmt(),d=Lv(Oue,n),p=a.rect!==null,g=A.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=A.useRef(g),C=!Gmt(g,S.current),w=v!==-1&&b===-1||C,k=Kmt(o);Ic(()=>{C&&y&&u(g)},[C,g,y,u]),A.useEffect(()=>{S.current=g},[g]);const E=A.useMemo(()=>({activeIndex:b,containerId:d,disabled:k,disableTransforms:w,items:g,overIndex:v,useDragOverlay:p,sortedRects:qmt(g,l),strategy:i}),[b,d,k.draggable,k.droppable,w,g,v,l,p,i]);return nn.createElement(Tue.Provider,{value:E},t)}const Zmt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Aj(n,r,i).indexOf(t)},Qmt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},e0t={duration:200,easing:"ease"},Mue="transform",t0t=Tb.Transition.toString({property:Mue,duration:0,easing:"linear"}),n0t={roleDescription:"sortable"};function r0t(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=A.useState(null),a=A.useRef(n);return Ic(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=$g(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),A.useEffect(()=>{o&&s(null)},[o]),o}function i0t(e){let{animateLayoutChanges:t=Qmt,attributes:n,disabled:r,data:i,getNewIndex:o=Zmt,id:s,strategy:a,resizeObserverConfig:l,transition:c=e0t}=e;const{items:u,containerId:d,activeIndex:p,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=A.useContext(Tue),w=o0t(r,g),k=u.indexOf(s),E=A.useMemo(()=>({sortable:{containerId:d,index:k,items:u},...i}),[d,i,k,u]),O=A.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:T,isOver:I,setNodeRef:P}=Wmt({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:L,activatorEvent:M,activeNodeRect:$,attributes:N,setNodeRef:z,listeners:F,isDragging:W,over:V,setActivatorNodeRef:q,transform:X}=zmt({id:s,data:E,attributes:{...n0t,...n},disabled:w.draggable}),B=wpt(P,z),U=!!L,Y=U&&!y&&r4(p)&&r4(v),H=!S&&W,G=H&&Y?X:null,oe=Y?G??(a??C)({rects:b,activeNodeRect:$,activeIndex:p,overIndex:v,index:k}):null,ee=r4(p)&&r4(v)?o({id:s,items:u,activeIndex:p,overIndex:v}):k,ie=L?.id,te=A.useRef({activeId:ie,items:u,newIndex:ee,containerId:d}),J=u!==te.current.items,Q=t({active:L,containerId:d,isDragging:W,isSorting:U,id:s,index:k,items:u,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:c,wasDragging:te.current.activeId!=null}),se=r0t({disabled:!Q,index:k,node:T,rect:_});return A.useEffect(()=>{U&&te.current.newIndex!==ee&&(te.current.newIndex=ee),d!==te.current.containerId&&(te.current.containerId=d),u!==te.current.items&&(te.current.items=u)},[U,ee,d,u]),A.useEffect(()=>{if(ie===te.current.activeId)return;if(ie!=null&&te.current.activeId==null){te.current.activeId=ie;return}const he=setTimeout(()=>{te.current.activeId=ie},50);return()=>clearTimeout(he)},[ie]),{active:L,activeIndex:p,attributes:N,data:E,rect:_,index:k,newIndex:ee,items:u,isOver:I,isSorting:U,isDragging:W,listeners:F,node:T,overIndex:v,over:V,setNodeRef:B,setActivatorNodeRef:q,setDroppableNodeRef:P,setDraggableNodeRef:z,transform:se??oe,transition:le()};function le(){if(se||J&&te.current.newIndex===k)return t0t;if(!(H&&!Sj(M)||!c)&&(U||Q))return Tb.Transition.toString({...c,property:Mue})}}function o0t(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 cw(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 s0t=[Gn.Down,Gn.Right,Gn.Up,Gn.Left],a0t=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(s0t.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=i.get(d.id);if(p)switch(e.code){case Gn.Down:r.top<p.top&&l.push(d);break;case Gn.Up:r.top>p.top&&l.push(d);break;case Gn.Left:r.left>p.left&&l.push(d);break;case Gn.Right:r.left<p.left&&l.push(d);break}});const c=Fpt({collisionRect:r,droppableRects:i,droppableContainers:l});let u=mue(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const d=o.get(n.id),p=o.get(u),g=p?i.get(p.id):null,y=p?.node.current;if(y&&g&&d&&p){const v=M8(y).some((O,_)=>a[_]!==O),S=Rue(d,p),C=l0t(d,p),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},k={x:g.left,y:g.top};return w.x&&w.y?k:Ob(k,w)}}}};function Rue(e,t){return!cw(e)||!cw(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l0t(e,t){return!cw(e)||!cw(t)||!Rue(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const c0t=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=i0t({id:e.id}),[l,c]=A.useState(!1);A.useEffect(()=>{dC(e.id).then(c)},[e.id]);const u={transform:Tb.Transform.toString(o),transition:s,opacity:a?.5:1};return h.jsx(On,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:h.jsxs(Yn,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[h.jsx(ae,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:h.jsx(eDe,{})}),h.jsx(ft,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?h.jsx(ae,{component:"img",src:_2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(wl,{sx:{bgcolor:MM(e),width:40,height:40,boxShadow:2},children:(()=>{const d=TM(e);return h.jsx(d,{sx:{fontSize:24}})})()}),h.jsxs(ae,{sx:{flex:1},children:[h.jsx(re,{variant:"subtitle1",fontWeight:500,children:e.name}),h.jsxs(re,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},u0t=()=>{const{t:e}=on(),t=$c(),{content:n,isLoading:r}=hg(),i=SAe(),[o,s]=A.useState([]),[a,l]=A.useState(!1);A.useEffect(()=>{if(n){const g=[...n].sort((y,b)=>{const v=y.priority??100,S=b.priority??100;return v-S});s(g),l(!1)}},[n]);const c=$pt(KY(kj),KY(Cj,{coordinateGetter:a0t})),u=A.useCallback(g=>{const{active:y,over:b}=g;b&&y.id!==b.id&&(s(v=>{const S=v.findIndex(w=>w.id===y.id),C=v.findIndex(w=>w.id===b.id);return Aj(v,S,C)}),l(!0))},[]),d=A.useCallback(async()=>{const g=o.map((y,b)=>({id:y.id,priority:(b+1)*10}));try{await i(g),t.show({message:e("startup.saveSuccess"),severity:"success"}),l(!1)}catch(y){t.show({message:y instanceof Error?y.message:e("startup.saveFailed"),severity:"error"})}},[o,i,t,e]),p=A.useMemo(()=>o.map(g=>g.id),[o]);return r?h.jsxs(re,{children:[e("common.loading"),"..."]}):h.jsxs(Vt,{spacing:3,children:[h.jsx(qb,{items:[{name:e("nav.bridges"),to:Tt.bridges},{name:e("startup.title"),to:Tt.startup}]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:2,children:[h.jsx(cg,{color:"primary",fontSize:"large"}),h.jsxs(ae,{children:[h.jsx(re,{variant:"h5",fontWeight:600,children:e("startup.title")}),h.jsx(re,{variant:"body2",color:"text.secondary",children:e("startup.description")})]})]}),a&&h.jsx(zt,{severity:"info",action:h.jsx(qe,{color:"inherit",size:"small",startIcon:h.jsx(NS,{}),onClick:d,children:e("startup.saveChanges")}),children:e("startup.unsavedChanges")}),h.jsx(Nmt,{sensors:c,collisionDetection:Npt,onDragEnd:u,children:h.jsx(Jmt,{items:p,strategy:Ymt,children:h.jsx(Vt,{spacing:1,children:o.map((g,y)=>h.jsx(c0t,{bridge:g,index:y},g.id))})})}),o.length===0&&h.jsx(re,{color:"text.secondary",textAlign:"center",py:4,children:e("startup.noBridges")}),a&&o.length>0&&h.jsx(ae,{display:"flex",justifyContent:"flex-end",children:h.jsx(qe,{variant:"contained",startIcon:h.jsx(NS,{}),onClick:d,children:e("startup.saveOrder")})})]})},KA="https://riddix.github.io/home-assistant-matter-hub",Tt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",areaSetup:"/bridges/area-setup",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",plugins:"/plugins",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:KA,faq:{multiFabric:`${KA}/connect-multiple-fabrics`,bridgeConfig:`${KA}/bridge-configuration`}},d0t=[{path:"",element:h.jsx(x4e,{}),children:[{path:"",element:h.jsx(b_e,{})},{path:Tt.bridges,element:h.jsx(f_e,{})},{path:Tt.createBridge,element:h.jsx(lst,{})},{path:Tt.areaSetup,element:h.jsx(XSe,{})},{path:Tt.bridge(":bridgeId"),element:h.jsx(LAe,{})},{path:Tt.editBridge(":bridgeId"),element:h.jsx(cst,{})},{path:Tt.devices,element:h.jsx($_e,{})},{path:Tt.networkMap,element:h.jsx(Ght,{})},{path:Tt.health,element:h.jsx(Ast,{})},{path:Tt.labels,element:h.jsx(Tst,{})},{path:Tt.lockCredentials,element:h.jsx($st,{})},{path:Tt.plugins,element:h.jsx(gpt,{})},{path:Tt.settings,element:h.jsx(Spt,{})},{path:Tt.startup,element:h.jsx(u0t,{})},{path:"*",element:h.jsx(Lst,{})}]}],f0t={items:{isInitialized:!1,isLoading:!1}},h0t=NT(f0t,e=>{e.addCase(No.pending,t=>{t.items.isLoading=!0}).addCase(No.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(No.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(EZ.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(AZ.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(DZ.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(kZ.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(_Z,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(OZ,(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)}})}),p0t={byBridge:{}},m0t=NT(p0t,e=>{e.addCase(Mu.pending,(t,n)=>{t.byBridge[n.meta.arg]=YA(t.byBridge[n.meta.arg],n)}).addCase(Mu.rejected,(t,n)=>{t.byBridge[n.meta.arg]=YA(t.byBridge[n.meta.arg],n)}).addCase(Mu.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=YA(t.byBridge[n.meta.arg],n)})}),g0t={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},YA=NT(g0t,e=>{e.addCase(Mu.pending,t=>{t.isLoading=!0}).addCase(Mu.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(Mu.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),y0t=t4e({reducer:{bridges:h0t,devices:m0t}}),Dj=Fve({createStyledComponent:ge("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ve(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>at({props:e,name:"MuiContainer"})});function b0t(e){return et("MuiToolbar",e)}it("MuiToolbar",["root","gutters","regular","dense"]);const v0t=e=>{const{classes:t,disableGutters:n,variant:r}=e;return tt({root:["root",!n&&"gutters",r]},b0t,t)},x0t=ge("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ke(({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}]}))),Iue=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=v0t(c);return h.jsx(x0t,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})});class S0t extends A.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n.componentStack)}render(){return this.state.hasError?h.jsxs(ae,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[h.jsx(ZT,{color:"error",sx:{fontSize:64}}),h.jsx(re,{variant:"h5",fontWeight:600,children:pi.t("errorBoundary.title")}),h.jsx(re,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??pi.t("errorBoundary.fallbackMessage")}),h.jsx(qe,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:pi.t("errorBoundary.reload")})]}):this.props.children}}function w0t(e){return et("MuiFab",e)}const aX=it("MuiFab",["root","primary","secondary","extended","circular","focusVisible","disabled","colorInherit","sizeSmall","sizeMedium","sizeLarge","info","error","warning","success"]),C0t=e=>{const{color:t,variant:n,classes:r,size:i}=e,o={root:["root",n,`size${ve(i)}`,t==="inherit"?"colorInherit":t]},s=tt(o,w0t,r);return{...r,...s}},E0t=ge(os,{name:"MuiFab",slot:"Root",shouldForwardProp:e=>Li(e)||e==="classes",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ve(n.size)}`],n.color==="inherit"&&t.colorInherit,t[ve(n.size)],t[n.color]]}})(Ke(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create(["background-color","box-shadow","border-color"],{duration:e.transitions.duration.short}),borderRadius:"50%",padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:"none"},[`&.${aX.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:"small"},style:{width:40,height:40}},{props:{size:"medium"},style:{width:48,height:48}},{props:{variant:"extended"},style:{borderRadius:48/2,padding:"0 16px",width:"auto",minHeight:"auto",minWidth:48,height:48}},{props:{variant:"extended",size:"small"},style:{width:"auto",padding:"0 8px",borderRadius:34/2,minWidth:34,height:34}},{props:{variant:"extended",size:"medium"},style:{width:"auto",padding:"0 16px",borderRadius:40/2,minWidth:40,height:40}},{props:{color:"inherit"},style:{color:"inherit"}}]})),Ke(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Wn(["dark","contrastText"])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Ke(({theme:e})=>({[`&.${aX.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),k0t=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiFab"}),{children:i,className:o,color:s="default",component:a="button",disabled:l=!1,disableFocusRipple:c=!1,focusVisibleClassName:u,size:d="large",variant:p="circular",...g}=r,y={...r,color:s,component:a,disabled:l,disableFocusRipple:c,size:d,variant:p},b=C0t(y);return h.jsx(E0t,{className:Oe(b.root,o),component:a,disabled:l,focusRipple:!c,focusVisibleClassName:Oe(b.focusVisible,u),ownerState:y,ref:n,...g,classes:b,children:i})}),A0t=[{code:"en",flag:"🇬🇧",name:"English"},{code:"de",flag:"🇩🇪",name:"Deutsch"},{code:"fr",flag:"🇫🇷",name:"Français"},{code:"es",flag:"🇪🇸",name:"Español"},{code:"it",flag:"🇮🇹",name:"Italiano"},{code:"zh",flag:"🇨🇳",name:"中文"},{code:"th",flag:"🇹🇭",name:"ไทย"},{code:"sv",flag:"🇸🇪",name:"Svenska"},{code:"tr",flag:"🇹🇷",name:"Türkçe"}],D0t="hamh-custom-languages";function _0t(){try{const e=localStorage.getItem(D0t);return e?JSON.parse(e).map(n=>({code:n.code,flag:"🌐",name:n.name})):[]}catch{return[]}}const O0t="https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement";function T0t(){const{t:e,i18n:t}=on(),[n,r]=A.useState(!1),i=A.useRef(null),o=A.useMemo(()=>[...A0t,..._0t()],[]),s=t.language?.split("-")[0]??"en",a=A.useCallback(()=>{r(u=>!u)},[]),l=A.useCallback(u=>{t.changeLanguage(u),r(!1)},[t]),c=A.useCallback(()=>{r(!1)},[]);return h.jsx(tZ,{onClickAway:c,children:h.jsxs(ae,{children:[h.jsx(k0t,{ref:i,size:"small",color:"primary",onClick:a,"aria-label":"Change language",sx:{position:"fixed",bottom:24,right:24,zIndex:1300},children:h.jsx(aDe,{})}),h.jsx(Yb,{open:n,anchorEl:i.current,placement:"top-end",transition:!0,sx:{zIndex:1300},children:({TransitionProps:u})=>h.jsx(TS,{...u,timeout:200,children:h.jsxs(Gr,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:"hidden"},children:[o.map(d=>h.jsxs(ae,{onClick:()=>l(d.code),sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,cursor:"pointer",bgcolor:s===d.code?"action.selected":"transparent","&:hover":{bgcolor:"action.hover"},transition:"background-color 0.15s"},children:[h.jsx(re,{sx:{fontSize:"1.4rem",lineHeight:1,userSelect:"none"},children:d.flag}),h.jsx(re,{variant:"body2",fontWeight:s===d.code?600:400,children:d.name})]},d.code)),h.jsx(Dr,{}),h.jsxs(ae,{sx:{display:"flex",alignItems:"flex-start",gap:.75,px:2,py:1},children:[h.jsx(UT,{sx:{fontSize:14,mt:.25,color:"text.secondary"}}),h.jsxs(re,{variant:"caption",color:"text.secondary",sx:{lineHeight:1.4},children:[e("languageSwitcher.disclaimer")," ",h.jsx(Wb,{href:O0t,target:"_blank",rel:"noopener",sx:{fontSize:"inherit"},children:e("languageSwitcher.contribute")})]})]})]})})})]})})}const M0t="home-assistant-matter-hub",R0t={name:M0t};function jue(){const e="2.1.0-alpha.531",[t,n]=A.useState(null);A.useEffect(()=>{fetch("api/health").then(i=>i.ok?i.json():null).then(i=>{i?.version&&n(i.version)}).catch(()=>{})},[]);const r=A.useMemo(()=>!t||e==="0.0.0-dev"?!1:e!==t,[t]);return A.useMemo(()=>({name:R0t.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}const I0t=()=>{const{t:e}=on(),t=[{name:e("footer.github"),url:Tt.githubRepository},{name:e("footer.documentation"),url:Tt.documentation}];return h.jsxs(Dj,{sx:{mt:16,mb:4},children:[h.jsx(Dr,{sx:{mt:4,mb:4}}),h.jsx(dt,{container:!0,spacing:2,justifyContent:"center",children:t.map((n,r)=>h.jsx(dt,{size:{xs:12,sm:"auto"},children:h.jsx(qe,{fullWidth:!0,size:"small",variant:"outlined",component:Wb,href:n.url,target:"_blank",children:n.name})},r.toString()))})]})};function j0t(e){return et("MuiAppBar",e)}it("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const P0t=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ve(t)}`,`position${ve(n)}`]};return tt(i,j0t,r)},lX=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,$0t=ge(Gr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ve(n.position)}`],t[`color${ve(n.color)}`]]}})(Ke(({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(Wn(["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?lX(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?lX(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"})}}]}))),L0t=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=P0t(c);return h.jsx($0t,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function N0t(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=oa(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function F0t(e){return typeof e=="function"?e():e}function o4(e,t,n){const r=F0t(n),i=N0t(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const B0t=A.forwardRef(function(t,n){const r=qi(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:d=i,in:p,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:k=o,TransitionComponent:E=Xa,...O}=t,_=A.useRef(null),T=Br(Mf(l),_,n),I=V=>q=>{V&&(q===void 0?V(_.current):V(_.current,q))},P=I((V,q)=>{o4(u,V,c),IT(V),g&&g(V,q)}),L=I((V,q)=>{const X=mf({timeout:k,style:w,easing:d},{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,q)}),M=I(y),$=I(C),N=I(V=>{const q=mf({timeout:k,style:w,easing:d},{mode:"exit"});V.style.webkitTransition=r.transitions.create("-webkit-transform",q),V.style.transition=r.transitions.create("transform",q),o4(u,V,c),v&&v(V)}),z=I(V=>{V.style.webkitTransition="",V.style.transition="",S&&S(V)}),F=V=>{s&&s(_.current,V)},W=A.useCallback(()=>{_.current&&o4(u,_.current,c)},[u,c]);return A.useEffect(()=>{if(p||u==="down"||u==="right")return;const V=Ub(()=>{_.current&&o4(u,_.current,c)}),q=oa(_.current);return q.addEventListener("resize",V),()=>{V.clear(),q.removeEventListener("resize",V)}},[u,p,c]),A.useEffect(()=>{p||W()},[p,W]),h.jsx(E,{nodeRef:_,onEnter:P,onEntered:M,onEntering:L,onExit:N,onExited:z,onExiting:$,addEndListener:F,appear:a,in:p,timeout:k,...O,children:(V,{ownerState:q,...X})=>A.cloneElement(l,{ref:T,style:{visibility:V==="exited"&&!p?"hidden":void 0,...w,...l.props.style},...X})})});function z0t(e){return et("MuiDrawer",e)}it("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Pue=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},H0t=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ve(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ve(n)}`,r!=="temporary"&&`paperAnchorDocked${ve(n)}`]};return tt(i,z0t,t)},U0t=ge(tM,{name:"MuiDrawer",slot:"Root",overridesResolver:Pue})(Ke(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),V0t=ge("div",{shouldForwardProp:Li,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Pue})({flex:"0 0 auto"}),W0t=ge(Gr,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ve(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ve(n.anchor)}`]]}})(Ke(({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}`}}]}))),$ue={left:"right",right:"left",top:"down",bottom:"up"};function q0t(e){return["left","right"].includes(e)}function G0t({direction:e},t){return e==="rtl"&&q0t(t)?$ue[t]:t}const K0t=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiDrawer"}),i=qi(),o=Pc(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:d=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:k=s,variant:E="temporary",slots:O={},slotProps:_={},...T}=r,I=A.useRef(!1);A.useEffect(()=>{I.current=!0},[]);const P=G0t({direction:o?"rtl":"ltr"},a),M={...r,anchor:a,elevation:d,open:v,variant:E,...T},$=H0t(M),N={slots:{transition:w,...O},slotProps:{paper:S,transition:C,..._,backdrop:TT(_.backdrop||{...l,...g},{transitionDuration:k})}},[z,F]=ut("root",{ref:n,elementType:U0t,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:M,externalForwardedProps:{...N,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:p,slots:{backdrop:N.slots.backdrop},slotProps:{backdrop:N.slotProps.backdrop}}}),[W,V]=ut("paper",{elementType:W0t,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:M,externalForwardedProps:N,additionalProps:{elevation:E==="temporary"?d:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[q,X]=ut("docked",{elementType:V0t,ref:n,className:Oe($.root,$.docked,u),ownerState:M,externalForwardedProps:N,additionalProps:T}),[B,U]=ut("transition",{elementType:B0t,ownerState:M,externalForwardedProps:N,additionalProps:{in:v,direction:$ue[P],timeout:k,appear:I.current}}),Y=h.jsx(W,{...V,children:c});if(E==="permanent")return h.jsx(q,{...X,children:Y});const H=h.jsx(B,{...U,children:Y});return E==="persistent"?h.jsx(q,{...X,children:H}):h.jsx(z,{...F,children:H})}),Y0t=IJ({themeId:Ra}),X0t={error:jf,warn:ug,info:QT,debug:cC},J0t=({open:e,onClose:t})=>{const{t:n}=on(),r=qi(),i=A.useMemo(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[o,s]=A.useState([]),[a,l]=A.useState(!0),[c,u]=A.useState("error,warn,info".split(",")),[d,p]=A.useState(""),[g,y]=A.useState(!0),b=A.useCallback(async()=>{try{const k=new URLSearchParams({level:c.join(","),limit:"500",...d&&{search:d}}),E=await fetch(`api/logs?${k}`);if(E.ok){const O=await E.json();s(O.entries)}}catch(k){console.error("Failed to fetch logs:",k)}finally{l(!1)}},[c,d]);A.useEffect(()=>{e&&b()},[e,b]),A.useEffect(()=>{if(!g||!e)return;const k=setInterval(b,5e3);return()=>clearInterval(k)},[g,e,b]);const v=k=>{u(Array.isArray(k.target.value)?k.target.value:[k.target.value])},S=k=>{p(k.target.value)},C=async()=>{try{await fetch("api/logs",{method:"DELETE"}),s([])}catch(k){console.error("Failed to clear logs:",k)}},w=k=>{const E=X0t[k]||QT;return h.jsx(E,{sx:{fontSize:16,color:i[k]}})};return h.jsxs(Po,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(Lo,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(cC,{}),n("logs.title"),h.jsx(ae,{sx:{flexGrow:1}}),h.jsx(Nt,{title:n("logs.autoRefresh"),children:h.jsx(ft,{label:g?"Auto":"Manual",color:g?"success":"default",size:"small",onClick:()=>y(!g),sx:{cursor:"pointer"}})}),h.jsx(Wt,{onClick:t,children:h.jsx(LS,{})})]}),h.jsxs($o,{children:[h.jsx(Vt,{spacing:2,sx:{mb:2},children:h.jsxs(Vt,{direction:"row",spacing:2,alignItems:"center",children:[h.jsxs(rs,{size:"small",sx:{minWidth:200},children:[h.jsx(ja,{children:n("logs.logLevel")}),h.jsxs(ts,{value:c,label:n("logs.logLevel"),onChange:v,multiple:!0,renderValue:k=>h.jsx(ae,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(k)?k:[k]).map(E=>h.jsx(ft,{label:E.toUpperCase(),size:"small",sx:{backgroundColor:i[E],color:"white"}},E))}),children:[h.jsx(Nn,{value:"error",children:n("logs.error")}),h.jsx(Nn,{value:"warn",children:n("logs.warning")}),h.jsx(Nn,{value:"info",children:n("logs.info")}),h.jsx(Nn,{value:"debug",children:n("logs.debug")})]})]}),h.jsx(Zn,{size:"small",placeholder:n("logs.searchPlaceholder"),value:d,onChange:S,sx:{flexGrow:1}}),h.jsx(qe,{variant:"outlined",onClick:b,children:n("common.refresh")}),h.jsx(qe,{variant:"outlined",color:"error",onClick:C,children:n("common.delete")})]})}),h.jsx(ae,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:a?h.jsx(ae,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsxs(re,{children:[n("common.loading"),"..."]})}):o.length===0?h.jsx(ae,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(re,{color:"text.secondary",children:n("logs.noResults")})}):h.jsx(Vt,{spacing:1,children:o.map((k,E)=>h.jsxs(ae,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[h.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[w(k.level),h.jsx(re,{variant:"caption",color:"text.secondary",children:new Date(k.timestamp).toLocaleString()}),h.jsx(ft,{label:k.level.toUpperCase(),size:"small",sx:{backgroundColor:i[k.level],color:r.palette.getContrastText(i[k.level]??r.palette.grey[500]),fontSize:"0.7rem",height:20}})]}),h.jsx(re,{sx:{ml:3},children:k.message}),k.context&&h.jsx(re,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(k.context,null,2)})]},`${k.timestamp}-${k.level}-${E}`))})})]}),h.jsx(es,{children:h.jsx(qe,{onClick:t,children:n("common.close")})})]})};function cX(){const{t:e}=on(),{isConnected:t}=MZ(),[n,r]=A.useState(null),[i,o]=A.useState(!1);A.useEffect(()=>{const b=async()=>{try{const S=await fetch("api/health");if(S.ok){const C=await S.json();r(C),o(!1)}else o(!0)}catch{o(!0)}};b();const v=setInterval(b,3e4);return()=>clearInterval(v)},[]);const s=b=>{const v=Math.floor(b/3600),S=Math.floor(b%3600/60);return v>0?`${v}h ${S}m`:`${S}m`},a=n?.status==="healthy"&&!i,l=n?.services?.bridges,c=l&&l.total>0&&l.running===l.total,u=l&&l.total===0,d=n?h.jsxs(ae,{sx:{p:.5},children:[h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.version"),":"]})," ",n.version??e("status.unknown")]}),h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.uptime"),":"]})," ",s(n.uptime??0)]}),n.services?.bridges&&h.jsxs("div",{children:[h.jsxs("strong",{children:[e("nav.bridges"),":"]})," ",n.services.bridges.running??0,"/",n.services.bridges.total??0," ",e("common.running").toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e("common.stopped").toLowerCase()})`]}),n.services?.homeAssistant&&h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.homeAssistant"),":"]})," ",n.services.homeAssistant.connected?e("health.connected"):e("health.disconnected")]}),h.jsxs("div",{children:[h.jsx("strong",{children:"WebSocket:"})," ",e(t?"health.connected":"health.disconnected")]})]}):e("status.loadingHealth"),p=()=>i||!a?h.jsx(jf,{fontSize:"small"}):c?h.jsx(Ja,{fontSize:"small"}):h.jsx(Kw,{fontSize:"small"}),g=()=>i||!a?"error":!c||!t?"warning":"success",y=()=>e(i?"status.error":a?t?u?"status.noBridges":c?"common.online":"common.starting":"common.offline":"status.unhealthy");return h.jsx(Nt,{title:d,arrow:!0,children:h.jsx(ft,{icon:p(),label:y(),color:g(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Z0t=e=>A.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("g",{style:{display:"inline"}},A.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"}),A.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"}))),Q0t=e=>{const t=jue();return h.jsxs(ae,{component:Dc,to:Tt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[h.jsx(Z0t,{style:{height:"40px"}}),h.jsx(re,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ve).join("-")}),e.large&&h.jsx(re,{variant:"caption",component:"span",children:t.version})]})},egt=()=>{const e=Y0t("(min-width:600px)"),{mode:t,setMode:n}=Iw(),[r,i]=A.useState(!1),[o,s]=A.useState(!1),a=jc(),l=Gu(),c=y=>y?y==="/"?l.pathname==="/":l.pathname.startsWith(y):!1,u=()=>{n(t==="dark"?"light":"dark")},{t:d}=on(),p=[{label:d("dashboard.title"),icon:h.jsx(CM,{}),to:Tt.dashboard},{label:d("nav.bridges"),icon:h.jsx(Ny,{}),to:Tt.bridges},{label:d("nav.devices"),icon:h.jsx(aa,{}),to:Tt.devices},{label:d("nav.networkMap"),icon:h.jsx(xM,{}),to:Tt.networkMap},{label:d("nav.startupOrder"),icon:h.jsx(cg,{}),to:Tt.startup},{label:d("nav.lockCredentials"),icon:h.jsx(Tu,{}),to:Tt.lockCredentials},{label:d("nav.filterReference"),icon:h.jsx(EM,{}),to:Tt.labels},{label:"Plugins",icon:h.jsx(Ly,{}),to:Tt.plugins},{label:d("nav.settings"),icon:h.jsx(fg,{}),to:Tt.settings},{label:d(t==="dark"?"nav.lightMode":"nav.darkMode"),icon:t==="dark"?h.jsx(cDe,{}):h.jsx(JAe,{}),onClick:u},{label:d("nav.systemLogs"),icon:h.jsx(cC,{}),onClick:()=>i(!0)},{label:d("nav.health"),icon:h.jsx(rM,{}),to:Tt.health}],g=y=>{s(!1),y.onClick?y.onClick():y.to&&a(y.to)};return h.jsxs(ae,{children:[h.jsx(L0t,{sx:{height:"72px"},children:h.jsx(Iue,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:h.jsxs(Dj,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx(Q0t,{large:e}),e?h.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.map(y=>y.to?h.jsx(Nt,{title:y.label,children:h.jsx(Wt,{component:Dc,to:y.to,sx:{color:"inherit",bgcolor:c(y.to)?"rgba(255,255,255,0.15)":"transparent",borderRadius:1},children:y.icon})},y.label):h.jsx(Nt,{title:y.label,children:h.jsx(Wt,{onClick:y.onClick,sx:{color:"inherit"},children:y.icon})},y.label)),h.jsx(cX,{})]}):h.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(cX,{}),h.jsx(Wt,{onClick:()=>s(!0),sx:{color:"inherit"},children:h.jsx(uDe,{})})]})]})})}),h.jsx(K0t,{anchor:"right",open:o,onClose:()=>s(!1),children:h.jsx(Fo,{sx:{width:250},children:p.map(y=>h.jsxs(h6e,{selected:c(y.to),onClick:()=>g(y),children:[h.jsx(jo,{children:y.icon}),h.jsx(so,{primary:y.label})]},y.label))})}),h.jsx(J0t,{open:r,onClose:()=>i(!1)})]})},tgt=()=>{const{versionMismatch:e,frontendVersion:t,backendVersion:n}=jue(),{isConnected:r}=MZ();return h.jsxs(ae,{children:[h.jsx(egt,{}),h.jsx(Iue,{}),e&&h.jsxs(zt,{severity:"warning",variant:"filled",sx:{borderRadius:0},action:h.jsx(qe,{color:"inherit",size:"small",onClick:()=>window.location.reload(),children:"Reload"}),children:["Version mismatch: frontend ",t,", backend ",n,". Please reload to get the latest UI."]}),!r&&h.jsx(zt,{severity:"error",variant:"filled",sx:{borderRadius:0},children:"Connection lost — data may be outdated. Reconnecting…"}),h.jsx(Dj,{sx:{p:2},children:h.jsx(S0t,{children:h.jsx(BX,{})})}),h.jsx(I0t,{}),h.jsx(T0t,{})]})},ngt=Tw({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 sS=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");sS?.startsWith("http")&&(sS=new URL(sS).pathname);const rgt=jme([{path:"/",element:h.jsx(tgt,{}),children:d0t}],{basename:sS});Jfe.createRoot(document.getElementById("root")).render(h.jsx(A.StrictMode,{children:h.jsx(phe,{store:y0t,children:h.jsxs(Xxe,{theme:ngt,children:[h.jsx(Wxe,{}),h.jsx(KJ,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:"initial !important",flexGrow:1}}}),h.jsx(v4e,{children:h.jsx(u5e,{children:h.jsx(Gme,{router:rgt})})})]})})}));
499
+ `},jpt={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 Ppt(e){let{announcements:t=jpt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ipt}=e;const{announce:o,announcement:s}=Tpt(),a=Lv("DndLiveRegion"),[l,c]=A.useState(!1);if(A.useEffect(()=>{c(!0)},[]),Mpt(A.useMemo(()=>({onDragStart(d){let{active:p}=d;o(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:g}=d;t.onDragMove&&o(t.onDragMove({active:p,over:g}))},onDragOver(d){let{active:p,over:g}=d;o(t.onDragOver({active:p,over:g}))},onDragEnd(d){let{active:p,over:g}=d;o(t.onDragEnd({active:p,over:g}))},onDragCancel(d){let{active:p,over:g}=d;o(t.onDragCancel({active:p,over:g}))}}),[o,t])),!l)return null;const u=nn.createElement(nn.Fragment,null,nn.createElement(_pt,{id:r,value:i.draggable}),nn.createElement(Opt,{id:a,announcement:s}));return n?Vd.createPortal(u,n):u}var Vi;(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"})(Vi||(Vi={}));function aw(){}function KY(e,t){return A.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function $pt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return A.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const kl=Object.freeze({x:0,y:0});function hue(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Lpt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function YY(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 mue(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function XY(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 Npt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=XY(t,t.left,t.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=hue(XY(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(pue)},Fpt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=YY(t),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=YY(l),u=i.reduce((p,g,y)=>p+hue(c[y],g),0),d=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:d}})}}return o.sort(pue)};function Bpt(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r<i&&n<o){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const zpt=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=Bpt(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(Lpt)};function Hpt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function gue(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:kl}function Upt(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 Vpt=Upt(1);function Wpt(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 qpt(e,t,n){const r=Wpt(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),c=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const Gpt={ignoreTransform:!1};function $g(e,t){t===void 0&&(t=Gpt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Is(e).getComputedStyle(e);c&&(n=qpt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function JY(e){return $g(e,{ignoreTransform:!0})}function Kpt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ypt(e,t){return t===void 0&&(t=Is(e).getComputedStyle(e)),t.position==="fixed"}function Xpt(e,t){t===void 0&&(t=Is(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 M8(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(vj(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Pv(i)||uue(i)||n.includes(i))return n;const o=Is(e).getComputedStyle(i);return i!==e&&Xpt(i,o)&&n.push(i),Ypt(i,o)?n:r(i.parentNode)}return e?r(e):n}function yue(e){const[t]=M8(e,1);return t??null}function WA(e){return!T8||!e?null:jg(e)?e:bj(e)?vj(e)||e===Pg(e).scrollingElement?window:Pv(e)?e:null:null}function bue(e){return jg(e)?e.scrollX:e.scrollLeft}function vue(e){return jg(e)?e.scrollY:e.scrollTop}function JO(e){return{x:bue(e),y:vue(e)}}var ro;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ro||(ro={}));function xue(e){return!T8||!e?!1:e===document.scrollingElement}function Sue(e){const t={x:0,y:0},n=xue(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 Jpt={x:.2,y:.2};function Zpt(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Jpt);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=Sue(e),g={x:0,y:0},y={x:0,y:0},b={height:t.height*i.y,width:t.width*i.x};return!c&&o<=t.top+b.height?(g.y=ro.Backward,y.y=r*Math.abs((t.top+b.height-o)/b.height)):!u&&l>=t.bottom-b.height&&(g.y=ro.Forward,y.y=r*Math.abs((t.bottom-b.height-l)/b.height)),!p&&a>=t.right-b.width?(g.x=ro.Forward,y.x=r*Math.abs((t.right-b.width-a)/b.width)):!d&&s<=t.left+b.width&&(g.x=ro.Backward,y.x=r*Math.abs((t.left+b.width-s)/b.width)),{direction:g,speed:y}}function Qpt(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 wue(e){return e.reduce((t,n)=>C0(t,JO(n)),kl)}function emt(e){return e.reduce((t,n)=>t+bue(n),0)}function tmt(e){return e.reduce((t,n)=>t+vue(n),0)}function nmt(e,t){if(t===void 0&&(t=$g),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);yue(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rmt=[["x",["left","right"],emt],["y",["top","bottom"],tmt]];class wj{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=M8(n),i=wue(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of rmt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class s2{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 imt(e){const{EventTarget:t}=Is(e);return e instanceof t?e:Pg(e)}function qA(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 Ea;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ea||(Ea={}));function ZY(e){e.preventDefault()}function omt(e){e.stopPropagation()}var Gn;(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"})(Gn||(Gn={}));const Cue={start:[Gn.Space,Gn.Enter],cancel:[Gn.Esc],end:[Gn.Space,Gn.Enter,Gn.Tab]},smt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Gn.Right:return{...n,x:n.x+25};case Gn.Left:return{...n,x:n.x-25};case Gn.Down:return{...n,y:n.y+25};case Gn.Up:return{...n,y:n.y-25}}};class Cj{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 s2(Pg(n)),this.windowListeners=new s2(Is(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ea.Resize,this.handleCancel),this.windowListeners.add(Ea.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ea.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&nmt(r),n(kl)}handleKeyDown(t){if(Sj(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=Cue,coordinateGetter:s=smt,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:kl;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=Ob(d,u),g={x:0,y:0},{scrollableAncestors:y}=r.current;for(const b of y){const v=t.code,{isTop:S,isRight:C,isLeft:w,isBottom:k,maxScroll:E,minScroll:O}=Sue(b),_=Qpt(b),T={x:Math.min(v===Gn.Right?_.right-_.width/2:_.right,Math.max(v===Gn.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(v===Gn.Down?_.bottom-_.height/2:_.bottom,Math.max(v===Gn.Down?_.top:_.top+_.height/2,d.y))},I=v===Gn.Right&&!C||v===Gn.Left&&!w,P=v===Gn.Down&&!k||v===Gn.Up&&!S;if(I&&T.x!==d.x){const L=b.scrollLeft+p.x,M=v===Gn.Right&&L<=E.x||v===Gn.Left&&L>=O.x;if(M&&!p.y){b.scrollTo({left:L,behavior:a});return}M?g.x=b.scrollLeft-L:g.x=v===Gn.Right?b.scrollLeft-E.x:b.scrollLeft-O.x,g.x&&b.scrollBy({left:-g.x,behavior:a});break}else if(P&&T.y!==d.y){const L=b.scrollTop+p.y,M=v===Gn.Down&&L<=E.y||v===Gn.Up&&L>=O.y;if(M&&!p.x){b.scrollTo({top:L,behavior:a});return}M?g.y=b.scrollTop-L:g.y=v===Gn.Down?b.scrollTop-E.y:b.scrollTop-O.y,g.y&&b.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,C0(Ob(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Cj.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Cue,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 QY(e){return!!(e&&"distance"in e)}function eX(e){return!!(e&&"delay"in e)}class Ej{constructor(t,n,r){var i;r===void 0&&(r=imt(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=Pg(s),this.documentListeners=new s2(this.document),this.listeners=new s2(r),this.windowListeners=new s2(Is(s)),this.initialCoordinates=(i=XO(o))!=null?i:kl,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(Ea.Resize,this.handleCancel),this.windowListeners.add(Ea.DragStart,ZY),this.windowListeners.add(Ea.VisibilityChange,this.handleCancel),this.windowListeners.add(Ea.ContextMenu,ZY),this.documentListeners.add(Ea.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(eX(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(QY(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(Ea.Click,omt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ea.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=XO(t))!=null?n:kl,c=Ob(i,l);if(!r&&a){if(QY(a)){if(a.tolerance!=null&&qA(c,a.tolerance))return this.handleCancel();if(qA(c,a.distance))return this.handleStart()}if(eX(a)&&qA(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Gn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const amt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kj extends Ej{constructor(t){const{event:n}=t,r=Pg(n.target);super(t,amt,r)}}kj.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 lmt={move:{name:"mousemove"},end:{name:"mouseup"}};var ZO;(function(e){e[e.RightClick=2]="RightClick"})(ZO||(ZO={}));class cmt extends Ej{constructor(t){super(t,lmt,Pg(t.event.target))}}cmt.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ZO.RightClick?!1:(r?.({event:n}),!0)}}];const GA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class umt extends Ej{constructor(t){super(t,GA)}static setup(){return window.addEventListener(GA.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(GA.move.name,t)};function t(){}}}umt.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 a2;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(a2||(a2={}));var lw;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(lw||(lw={}));function dmt(e){let{acceleration:t,activator:n=a2.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=lw.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const g=hmt({delta:d,disabled:!o}),[y,b]=Cpt(),v=A.useRef({x:0,y:0}),S=A.useRef({x:0,y:0}),C=A.useMemo(()=>{switch(n){case a2.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case a2.DraggableRect:return i}},[n,i,l]),w=A.useRef(null),k=A.useCallback(()=>{const O=w.current;if(!O)return;const _=v.current.x*S.current.x,T=v.current.y*S.current.y;O.scrollBy(_,T)},[]),E=A.useMemo(()=>a===lw.TreeOrder?[...c].reverse():c,[a,c]);A.useEffect(()=>{if(!o||!c.length||!C){b();return}for(const O of E){if(r?.(O)===!1)continue;const _=c.indexOf(O),T=u[_];if(!T)continue;const{direction:I,speed:P}=Zpt(O,T,C,t,p);for(const L of["x","y"])g[L][I[L]]||(P[L]=0,I[L]=0);if(P.x>0||P.y>0){b(),w.current=O,y(k,s),v.current=P,S.current=I;return}}v.current={x:0,y:0},S.current={x:0,y:0},b()},[t,k,r,b,o,s,JSON.stringify(C),JSON.stringify(g),y,c,E,u,JSON.stringify(p)])}const fmt={x:{[ro.Backward]:!1,[ro.Forward]:!1},y:{[ro.Backward]:!1,[ro.Forward]:!1}};function hmt(e){let{delta:t,disabled:n}=e;const r=YO(t);return $v(i=>{if(n||!r||!i)return fmt;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ro.Backward]:i.x[ro.Backward]||o.x===-1,[ro.Forward]:i.x[ro.Forward]||o.x===1},y:{[ro.Backward]:i.y[ro.Backward]||o.y===-1,[ro.Forward]:i.y[ro.Forward]||o.y===1}}},[n,t,r])}function pmt(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return $v(i=>{var o;return t==null?null:(o=r??i)!=null?o:null},[r,t])}function mmt(e,t){return A.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 Mb;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Mb||(Mb={}));var QO;(function(e){e.Optimized="optimized"})(QO||(QO={}));const tX=new Map;function gmt(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=A.useState(null),{frequency:a,measure:l,strategy:c}=i,u=A.useRef(e),d=v(),p=_b(d),g=A.useCallback(function(S){S===void 0&&(S=[]),!p.current&&s(C=>C===null?S:C.concat(S.filter(w=>!C.includes(w))))},[p]),y=A.useRef(null),b=$v(S=>{if(d&&!n)return tX;if(!S||S===tX||u.current!==e||o!=null){const C=new Map;for(let w of e){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){C.set(w.id,w.rect.current);continue}const k=w.node.current,E=k?new wj(l(k),k):null;w.rect.current=E,E&&C.set(w.id,E)}return C}return S},[e,o,n,d,l]);return A.useEffect(()=>{u.current=e},[e]),A.useEffect(()=>{d||g()},[n,d]),A.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),A.useEffect(()=>{d||typeof a!="number"||y.current!==null||(y.current=setTimeout(()=>{g(),y.current=null},a))},[a,d,g,...r]),{droppableRects:b,measureDroppableContainers:g,measuringScheduled:o!=null};function v(){switch(c){case Mb.Always:return!1;case Mb.BeforeDragging:return n;default:return!n}}}function Eue(e,t){return $v(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ymt(e,t){return Eue(e,t)}function bmt(e){let{callback:t,disabled:n}=e;const r=xj(t),i=A.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return A.useEffect(()=>()=>i?.disconnect(),[i]),i}function R8(e){let{callback:t,disabled:n}=e;const r=xj(t),i=A.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return A.useEffect(()=>()=>i?.disconnect(),[i]),i}function vmt(e){return new wj($g(e),e)}function nX(e,t,n){t===void 0&&(t=vmt);const[r,i]=A.useState(null);function o(){i(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=bmt({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){o();break}}}}),a=R8({callback:o});return Ic(()=>{o(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function xmt(e){const t=Eue(e);return gue(e,t)}const rX=[];function Smt(e){const t=A.useRef(e),n=$v(r=>e?r&&r!==rX&&e&&t.current&&e.parentNode===t.current.parentNode?r:M8(e):rX,[e]);return A.useEffect(()=>{t.current=e},[e]),n}function wmt(e){const[t,n]=A.useState(null),r=A.useRef(e),i=A.useCallback(o=>{const s=WA(o.target);s&&n(a=>a?(a.set(s,JO(s)),new Map(a)):null)},[]);return A.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const c=WA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,JO(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const c=WA(l);c?.removeEventListener("scroll",i)})}},[i,e]),A.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>C0(o,s),kl):wue(e):kl,[e,t])}function iX(e,t){t===void 0&&(t=[]);const n=A.useRef(null);return A.useEffect(()=>{n.current=null},t),A.useEffect(()=>{const r=e!==kl;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ob(e,n.current):kl}function Cmt(e){A.useEffect(()=>{if(!T8)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 Emt(e,t){return A.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function kue(e){return A.useMemo(()=>e?Kpt(e):null,[e])}const oX=[];function kmt(e,t){t===void 0&&(t=$g);const[n]=e,r=kue(n?Is(n):null),[i,o]=A.useState(oX);function s(){o(()=>e.length?e.map(l=>xue(l)?r:new wj(t(l),l)):oX)}const a=R8({callback:s});return Ic(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),i}function Amt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Pv(t)?t:e}function Dmt(e){let{measure:t}=e;const[n,r]=A.useState(null),i=A.useCallback(c=>{for(const{target:u}of c)if(Pv(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),o=R8({callback:i}),s=A.useCallback(c=>{const u=Amt(c);o?.disconnect(),u&&o?.observe(u),r(u?t(u):null)},[t,o]),[a,l]=sw(s);return A.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const _mt=[{sensor:kj,options:{}},{sensor:Cj,options:{}}],Omt={current:{}},oS={draggable:{measure:JY},droppable:{measure:JY,strategy:Mb.WhileDragging,frequency:QO.Optimized},dragOverlay:{measure:$g}};class l2 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 Tmt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new l2,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:aw},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:oS,measureDroppableContainers:aw,windowRect:null,measuringScheduled:!1},Mmt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:aw,draggableNodes:new Map,over:null,measureDroppableContainers:aw},I8=A.createContext(Mmt),Aue=A.createContext(Tmt);function Rmt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new l2}}}function Imt(e,t){switch(t.type){case Vi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vi.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 Vi.DragEnd:case Vi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vi.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new l2(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vi.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 l2(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Vi.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new l2(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function jmt(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=A.useContext(I8),o=YO(r),s=YO(n?.id);return A.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!Sj(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=Apt(u);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function Pmt(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function $mt(e){return A.useMemo(()=>({draggable:{...oS.draggable,...e?.draggable},droppable:{...oS.droppable,...e?.droppable},dragOverlay:{...oS.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Lmt(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=A.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Ic(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=gue(u,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=yue(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const Due=A.createContext({...kl,scaleX:1,scaleY:1});var $d;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($d||($d={}));const Nmt=A.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=_mt,collisionDetection:d=zpt,measuring:p,modifiers:g,...y}=t;const b=A.useReducer(Imt,void 0,Rmt),[v,S]=b,[C,w]=Rpt(),[k,E]=A.useState($d.Uninitialized),O=k===$d.Initialized,{draggable:{active:_,nodes:T,translate:I},droppable:{containers:P}}=v,L=_!=null?T.get(_):null,M=A.useRef({initial:null,translated:null}),$=A.useMemo(()=>{var jt;return _!=null?{id:_,data:(jt=L?.data)!=null?jt:Omt,rect:M}:null},[_,L]),N=A.useRef(null),[z,F]=A.useState(null),[W,V]=A.useState(null),q=_b(y,Object.values(y)),X=Lv("DndDescribedBy",s),B=A.useMemo(()=>P.getEnabled(),[P]),U=$mt(p),{droppableRects:Y,measureDroppableContainers:H,measuringScheduled:G}=gmt(B,{dragging:O,dependencies:[I.x,I.y],config:U.droppable}),Z=pmt(T,_),oe=A.useMemo(()=>W?XO(W):null,[W]),ee=pr(),ie=ymt(Z,U.draggable.measure);Lmt({activeNode:_!=null?T.get(_):null,config:ee.layoutShiftCompensation,initialRect:ie,measure:U.draggable.measure});const te=nX(Z,U.draggable.measure,ie),J=nX(Z?Z.parentElement:null),Q=A.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:Y,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=P.getNodeFor((n=Q.current.over)==null?void 0:n.id),le=Dmt({measure:U.dragOverlay.measure}),he=(r=le.nodeRef.current)!=null?r:Z,ye=O?(i=le.rect)!=null?i:te:null,Me=!!(le.nodeRef.current&&le.rect),ue=xmt(Me?null:te),ke=kue(he?Is(he):null),_e=Smt(O?se??Z:null),Ue=kmt(_e),He=Pmt(g,{transform:{x:I.x-ue.x,y:I.y-ue.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:te,containerNodeRect:J,draggingNodeRect:ye,over:Q.current.over,overlayNodeRect:le.rect,scrollableAncestors:_e,scrollableAncestorRects:Ue,windowRect:ke}),Dt=oe?C0(oe,I):null,yt=wmt(_e),Be=iX(yt),Re=iX(yt,[te]),Ve=C0(He,Be),Qe=ye?Vpt(ye,He):null,ot=$&&Qe?d({active:$,collisionRect:Qe,droppableRects:Y,droppableContainers:B,pointerCoordinates:Dt}):null,lt=mue(ot,"id"),[Je,$t]=A.useState(null),Pe=Me?He:C0(He,Re),Ge=Hpt(Pe,(o=Je?.rect)!=null?o:null,te),mt=A.useRef(null),Ct=A.useCallback((jt,Ht)=>{let{sensor:sn,options:Rn}=Ht;if(N.current==null)return;const un=T.get(N.current);if(!un)return;const _t=jt.nativeEvent,yn=new sn({active:N.current,activeNode:un,event:_t,options:Rn,context:Q,onAbort(gt){if(!T.get(gt))return;const{onDragAbort:ce}=q.current,pe={id:gt};ce?.(pe),C({type:"onDragAbort",event:pe})},onPending(gt,Gt,ce,pe){if(!T.get(gt))return;const{onDragPending:$e}=q.current,We={id:gt,constraint:Gt,initialCoordinates:ce,offset:pe};$e?.(We),C({type:"onDragPending",event:We})},onStart(gt){const Gt=N.current;if(Gt==null)return;const ce=T.get(Gt);if(!ce)return;const{onDragStart:pe}=q.current,xe={activatorEvent:_t,active:{id:Gt,data:ce.data,rect:M}};Vd.unstable_batchedUpdates(()=>{pe?.(xe),E($d.Initializing),S({type:Vi.DragStart,initialCoordinates:gt,active:Gt}),C({type:"onDragStart",event:xe}),F(mt.current),V(_t)})},onMove(gt){S({type:Vi.DragMove,coordinates:gt})},onEnd:ct(Vi.DragEnd),onCancel:ct(Vi.DragCancel)});mt.current=yn;function ct(gt){return async function(){const{active:ce,collisions:pe,over:xe,scrollAdjustedTranslate:$e}=Q.current;let We=null;if(ce&&$e){const{cancelDrop:St}=q.current;We={activatorEvent:_t,active:ce,collisions:pe,delta:$e,over:xe},gt===Vi.DragEnd&&typeof St=="function"&&await Promise.resolve(St(We))&&(gt=Vi.DragCancel)}N.current=null,Vd.unstable_batchedUpdates(()=>{S({type:gt}),E($d.Uninitialized),$t(null),F(null),V(null),mt.current=null;const St=gt===Vi.DragEnd?"onDragEnd":"onDragCancel";if(We){const st=q.current[St];st?.(We),C({type:St,event:We})}})}}},[T]),ht=A.useCallback((jt,Ht)=>(sn,Rn)=>{const un=sn.nativeEvent,_t=T.get(Rn);if(N.current!==null||!_t||un.dndKit||un.defaultPrevented)return;const yn={active:_t};jt(sn,Ht.options,yn)===!0&&(un.dndKit={capturedBy:Ht.sensor},N.current=Rn,Ct(sn,Ht))},[T,Ct]),Xt=mmt(u,ht);Cmt(u),Ic(()=>{te&&k===$d.Initializing&&E($d.Initialized)},[te,k]),A.useEffect(()=>{const{onDragMove:jt}=q.current,{active:Ht,activatorEvent:sn,collisions:Rn,over:un}=Q.current;if(!Ht||!sn)return;const _t={active:Ht,activatorEvent:sn,collisions:Rn,delta:{x:Ve.x,y:Ve.y},over:un};Vd.unstable_batchedUpdates(()=>{jt?.(_t),C({type:"onDragMove",event:_t})})},[Ve.x,Ve.y]),A.useEffect(()=>{const{active:jt,activatorEvent:Ht,collisions:sn,droppableContainers:Rn,scrollAdjustedTranslate:un}=Q.current;if(!jt||N.current==null||!Ht||!un)return;const{onDragOver:_t}=q.current,yn=Rn.get(lt),ct=yn&&yn.rect.current?{id:yn.id,rect:yn.rect.current,data:yn.data,disabled:yn.disabled}:null,gt={active:jt,activatorEvent:Ht,collisions:sn,delta:{x:un.x,y:un.y},over:ct};Vd.unstable_batchedUpdates(()=>{$t(ct),_t?.(gt),C({type:"onDragOver",event:gt})})},[lt]),Ic(()=>{Q.current={activatorEvent:W,active:$,activeNode:Z,collisionRect:Qe,collisions:ot,droppableRects:Y,draggableNodes:T,draggingNode:he,draggingNodeRect:ye,droppableContainers:P,over:Je,scrollableAncestors:_e,scrollAdjustedTranslate:Ve},M.current={initial:ye,translated:Qe}},[$,Z,ot,Qe,T,he,ye,Y,P,Je,_e,Ve]),dmt({...ee,delta:I,draggingRect:Qe,pointerCoordinates:Dt,scrollableAncestors:_e,scrollableAncestorRects:Ue});const fn=A.useMemo(()=>({active:$,activeNode:Z,activeNodeRect:te,activatorEvent:W,collisions:ot,containerNodeRect:J,dragOverlay:le,draggableNodes:T,droppableContainers:P,droppableRects:Y,over:Je,measureDroppableContainers:H,scrollableAncestors:_e,scrollableAncestorRects:Ue,measuringConfiguration:U,measuringScheduled:G,windowRect:ke}),[$,Z,te,W,ot,J,le,T,P,Y,Je,H,_e,Ue,U,G,ke]),Xn=A.useMemo(()=>({activatorEvent:W,activators:Xt,active:$,activeNodeRect:te,ariaDescribedById:{draggable:X},dispatch:S,draggableNodes:T,over:Je,measureDroppableContainers:H}),[W,Xt,$,te,S,X,T,Je,H]);return nn.createElement(fue.Provider,{value:w},nn.createElement(I8.Provider,{value:Xn},nn.createElement(Aue.Provider,{value:fn},nn.createElement(Due.Provider,{value:Ge},c)),nn.createElement(jmt,{disabled:a?.restoreFocus===!1})),nn.createElement(Ppt,{...a,hiddenTextDescribedById:X}));function pr(){const jt=z?.autoScrollEnabled===!1,Ht=typeof l=="object"?l.enabled===!1:l===!1,sn=O&&!jt&&!Ht;return typeof l=="object"?{...l,enabled:sn}:{enabled:sn}}}),Fmt=A.createContext(null),sX="button",Bmt="Draggable";function zmt(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=Lv(Bmt),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=A.useContext(I8),{role:g=sX,roleDescription:y="draggable",tabIndex:b=0}=i??{},v=l?.id===t,S=A.useContext(v?Due:Fmt),[C,w]=sw(),[k,E]=sw(),O=Emt(s,t),_=_b(n);Ic(()=>(d.set(t,{id:t,key:o,node:C,activatorNode:k,data:_}),()=>{const I=d.get(t);I&&I.key===o&&d.delete(t)}),[d,t]);const T=A.useMemo(()=>({role:g,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&g===sX?!0:void 0,"aria-roledescription":y,"aria-describedby":u.draggable}),[r,g,b,v,y,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:v,listeners:r?void 0:O,node:C,over:p,setNodeRef:w,setActivatorNodeRef:E,transform:S}}function Hmt(){return A.useContext(Aue)}const Umt="Droppable",Vmt={timeout:25};function Wmt(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=Lv(Umt),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=A.useContext(I8),u=A.useRef({disabled:n}),d=A.useRef(!1),p=A.useRef(null),g=A.useRef(null),{disabled:y,updateMeasurementsFor:b,timeout:v}={...Vmt,...i},S=_b(b??r),C=A.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),g.current=null},v)},[v]),w=R8({callback:C,disabled:y||!s}),k=A.useCallback((T,I)=>{w&&(I&&(w.unobserve(I),d.current=!1),T&&w.observe(T))},[w]),[E,O]=sw(k),_=_b(t);return A.useEffect(()=>{!w||!E.current||(w.disconnect(),d.current=!1,w.observe(E.current))},[E,w]),A.useEffect(()=>(a({type:Vi.RegisterDroppable,element:{id:r,key:o,disabled:n,node:E,rect:p,data:_}}),()=>a({type:Vi.UnregisterDroppable,key:o,id:r})),[r]),A.useEffect(()=>{n!==u.current.disabled&&(a({type:Vi.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:p,isOver:l?.id===r,node:E,over:l,setNodeRef:O}}function Aj(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function qmt(e,t){return e.reduce((n,r,i)=>{const o=t.get(r);return o&&(n[i]=o),n},Array(e.length))}function r4(e){return e!==null&&e>=0}function Gmt(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 Kmt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const _ue=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const o=Aj(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}},i4={scaleX:1,scaleY:1},Ymt=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=e;const a=(t=o[n])!=null?t:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...i4}:null}const l=Xmt(o,i,n);return i>n&&i<=s?{x:0,y:-a.height-l,...i4}:i<n&&i>=s?{x:0,y:a.height+l,...i4}:{x:0,y:0,...i4}};function Xmt(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 Oue="Sortable",Tue=nn.createContext({activeIndex:-1,containerId:Oue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:_ue,disabled:{draggable:!1,droppable:!1}});function Jmt(e){let{children:t,id:n,items:r,strategy:i=_ue,disabled:o=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=Hmt(),d=Lv(Oue,n),p=a.rect!==null,g=A.useMemo(()=>r.map(O=>typeof O=="object"&&"id"in O?O.id:O),[r]),y=s!=null,b=s?g.indexOf(s.id):-1,v=c?g.indexOf(c.id):-1,S=A.useRef(g),C=!Gmt(g,S.current),w=v!==-1&&b===-1||C,k=Kmt(o);Ic(()=>{C&&y&&u(g)},[C,g,y,u]),A.useEffect(()=>{S.current=g},[g]);const E=A.useMemo(()=>({activeIndex:b,containerId:d,disabled:k,disableTransforms:w,items:g,overIndex:v,useDragOverlay:p,sortedRects:qmt(g,l),strategy:i}),[b,d,k.draggable,k.droppable,w,g,v,l,p,i]);return nn.createElement(Tue.Provider,{value:E},t)}const Zmt=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Aj(n,r,i).indexOf(t)},Qmt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&t===l},e0t={duration:200,easing:"ease"},Mue="transform",t0t=Tb.Transition.toString({property:Mue,duration:0,easing:"linear"}),n0t={roleDescription:"sortable"};function r0t(e){let{disabled:t,index:n,node:r,rect:i}=e;const[o,s]=A.useState(null),a=A.useRef(n);return Ic(()=>{if(!t&&n!==a.current&&r.current){const l=i.current;if(l){const c=$g(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,i]),A.useEffect(()=>{o&&s(null)},[o]),o}function i0t(e){let{animateLayoutChanges:t=Qmt,attributes:n,disabled:r,data:i,getNewIndex:o=Zmt,id:s,strategy:a,resizeObserverConfig:l,transition:c=e0t}=e;const{items:u,containerId:d,activeIndex:p,disabled:g,disableTransforms:y,sortedRects:b,overIndex:v,useDragOverlay:S,strategy:C}=A.useContext(Tue),w=o0t(r,g),k=u.indexOf(s),E=A.useMemo(()=>({sortable:{containerId:d,index:k,items:u},...i}),[d,i,k,u]),O=A.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:T,isOver:I,setNodeRef:P}=Wmt({id:s,data:E,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...l}}),{active:L,activatorEvent:M,activeNodeRect:$,attributes:N,setNodeRef:z,listeners:F,isDragging:W,over:V,setActivatorNodeRef:q,transform:X}=zmt({id:s,data:E,attributes:{...n0t,...n},disabled:w.draggable}),B=wpt(P,z),U=!!L,Y=U&&!y&&r4(p)&&r4(v),H=!S&&W,G=H&&Y?X:null,oe=Y?G??(a??C)({rects:b,activeNodeRect:$,activeIndex:p,overIndex:v,index:k}):null,ee=r4(p)&&r4(v)?o({id:s,items:u,activeIndex:p,overIndex:v}):k,ie=L?.id,te=A.useRef({activeId:ie,items:u,newIndex:ee,containerId:d}),J=u!==te.current.items,Q=t({active:L,containerId:d,isDragging:W,isSorting:U,id:s,index:k,items:u,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:c,wasDragging:te.current.activeId!=null}),se=r0t({disabled:!Q,index:k,node:T,rect:_});return A.useEffect(()=>{U&&te.current.newIndex!==ee&&(te.current.newIndex=ee),d!==te.current.containerId&&(te.current.containerId=d),u!==te.current.items&&(te.current.items=u)},[U,ee,d,u]),A.useEffect(()=>{if(ie===te.current.activeId)return;if(ie!=null&&te.current.activeId==null){te.current.activeId=ie;return}const he=setTimeout(()=>{te.current.activeId=ie},50);return()=>clearTimeout(he)},[ie]),{active:L,activeIndex:p,attributes:N,data:E,rect:_,index:k,newIndex:ee,items:u,isOver:I,isSorting:U,isDragging:W,listeners:F,node:T,overIndex:v,over:V,setNodeRef:B,setActivatorNodeRef:q,setDroppableNodeRef:P,setDraggableNodeRef:z,transform:se??oe,transition:le()};function le(){if(se||J&&te.current.newIndex===k)return t0t;if(!(H&&!Sj(M)||!c)&&(U||Q))return Tb.Transition.toString({...c,property:Mue})}}function o0t(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 cw(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 s0t=[Gn.Down,Gn.Right,Gn.Up,Gn.Left],a0t=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=t;if(s0t.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=i.get(d.id);if(p)switch(e.code){case Gn.Down:r.top<p.top&&l.push(d);break;case Gn.Up:r.top>p.top&&l.push(d);break;case Gn.Left:r.left>p.left&&l.push(d);break;case Gn.Right:r.left<p.left&&l.push(d);break}});const c=Fpt({collisionRect:r,droppableRects:i,droppableContainers:l});let u=mue(c,"id");if(u===s?.id&&c.length>1&&(u=c[1].id),u!=null){const d=o.get(n.id),p=o.get(u),g=p?i.get(p.id):null,y=p?.node.current;if(y&&g&&d&&p){const v=M8(y).some((O,_)=>a[_]!==O),S=Rue(d,p),C=l0t(d,p),w=v||!S?{x:0,y:0}:{x:C?r.width-g.width:0,y:C?r.height-g.height:0},k={x:g.left,y:g.top};return w.x&&w.y?k:Ob(k,w)}}}};function Rue(e,t){return!cw(e)||!cw(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function l0t(e,t){return!cw(e)||!cw(t)||!Rue(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const c0t=({bridge:e,index:t})=>{const{attributes:n,listeners:r,setNodeRef:i,transform:o,transition:s,isDragging:a}=i0t({id:e.id}),[l,c]=A.useState(!1);A.useEffect(()=>{dC(e.id).then(c)},[e.id]);const u={transform:Tb.Transform.toString(o),transition:s,opacity:a?.5:1};return h.jsx(On,{ref:i,style:u,variant:"outlined",sx:{cursor:"grab","&:active":{cursor:"grabbing"},bgcolor:a?"action.selected":"background.paper",width:"fit-content"},children:h.jsxs(Yn,{sx:{display:"flex",alignItems:"center",gap:1.5,py:1,"&:last-child":{pb:1}},children:[h.jsx(ae,{...n,...r,sx:{display:"flex",alignItems:"center",color:"text.secondary"},children:h.jsx(eDe,{})}),h.jsx(ft,{label:t+1,size:"small",color:"primary",sx:{minWidth:32,fontWeight:"bold"}}),l?h.jsx(ae,{component:"img",src:_2(e.id),alt:e.name,sx:{width:40,height:40,borderRadius:"50%",objectFit:"cover",boxShadow:2}}):h.jsx(wl,{sx:{bgcolor:MM(e),width:40,height:40,boxShadow:2},children:(()=>{const d=TM(e);return h.jsx(d,{sx:{fontSize:24}})})()}),h.jsxs(ae,{sx:{flex:1},children:[h.jsx(re,{variant:"subtitle1",fontWeight:500,children:e.name}),h.jsxs(re,{variant:"caption",color:"text.secondary",children:["Port: ",e.port," • Priority: ",e.priority??100]})]})]})})},u0t=()=>{const{t:e}=on(),t=$c(),{content:n,isLoading:r}=hg(),i=SAe(),[o,s]=A.useState([]),[a,l]=A.useState(!1);A.useEffect(()=>{if(n){const g=[...n].sort((y,b)=>{const v=y.priority??100,S=b.priority??100;return v-S});s(g),l(!1)}},[n]);const c=$pt(KY(kj),KY(Cj,{coordinateGetter:a0t})),u=A.useCallback(g=>{const{active:y,over:b}=g;b&&y.id!==b.id&&(s(v=>{const S=v.findIndex(w=>w.id===y.id),C=v.findIndex(w=>w.id===b.id);return Aj(v,S,C)}),l(!0))},[]),d=A.useCallback(async()=>{const g=o.map((y,b)=>({id:y.id,priority:(b+1)*10}));try{await i(g),t.show({message:e("startup.saveSuccess"),severity:"success"}),l(!1)}catch(y){t.show({message:y instanceof Error?y.message:e("startup.saveFailed"),severity:"error"})}},[o,i,t,e]),p=A.useMemo(()=>o.map(g=>g.id),[o]);return r?h.jsxs(re,{children:[e("common.loading"),"..."]}):h.jsxs(Vt,{spacing:3,children:[h.jsx(qb,{items:[{name:e("nav.bridges"),to:Tt.bridges},{name:e("startup.title"),to:Tt.startup}]}),h.jsxs(ae,{display:"flex",alignItems:"center",gap:2,children:[h.jsx(cg,{color:"primary",fontSize:"large"}),h.jsxs(ae,{children:[h.jsx(re,{variant:"h5",fontWeight:600,children:e("startup.title")}),h.jsx(re,{variant:"body2",color:"text.secondary",children:e("startup.description")})]})]}),a&&h.jsx(zt,{severity:"info",action:h.jsx(qe,{color:"inherit",size:"small",startIcon:h.jsx(NS,{}),onClick:d,children:e("startup.saveChanges")}),children:e("startup.unsavedChanges")}),h.jsx(Nmt,{sensors:c,collisionDetection:Npt,onDragEnd:u,children:h.jsx(Jmt,{items:p,strategy:Ymt,children:h.jsx(Vt,{spacing:1,children:o.map((g,y)=>h.jsx(c0t,{bridge:g,index:y},g.id))})})}),o.length===0&&h.jsx(re,{color:"text.secondary",textAlign:"center",py:4,children:e("startup.noBridges")}),a&&o.length>0&&h.jsx(ae,{display:"flex",justifyContent:"flex-end",children:h.jsx(qe,{variant:"contained",startIcon:h.jsx(NS,{}),onClick:d,children:e("startup.saveOrder")})})]})},KA="https://riddix.github.io/home-assistant-matter-hub",Tt={dashboard:"/",bridges:"/bridges",bridge:e=>`/bridges/${e}`,createBridge:"/bridges/create",areaSetup:"/bridges/area-setup",editBridge:e=>`/bridges/${e}/edit`,devices:"/devices",networkMap:"/network-map",health:"/health",labels:"/labels",lockCredentials:"/lock-credentials",plugins:"/plugins",settings:"/settings",startup:"/startup",githubRepository:"https://github.com/riddix/home-assistant-matter-hub/",documentation:KA,faq:{multiFabric:`${KA}/connect-multiple-fabrics`,bridgeConfig:`${KA}/bridge-configuration`}},d0t=[{path:"",element:h.jsx(x4e,{}),children:[{path:"",element:h.jsx(b_e,{})},{path:Tt.bridges,element:h.jsx(f_e,{})},{path:Tt.createBridge,element:h.jsx(lst,{})},{path:Tt.areaSetup,element:h.jsx(XSe,{})},{path:Tt.bridge(":bridgeId"),element:h.jsx(LAe,{})},{path:Tt.editBridge(":bridgeId"),element:h.jsx(cst,{})},{path:Tt.devices,element:h.jsx($_e,{})},{path:Tt.networkMap,element:h.jsx(Ght,{})},{path:Tt.health,element:h.jsx(Ast,{})},{path:Tt.labels,element:h.jsx(Tst,{})},{path:Tt.lockCredentials,element:h.jsx($st,{})},{path:Tt.plugins,element:h.jsx(gpt,{})},{path:Tt.settings,element:h.jsx(Spt,{})},{path:Tt.startup,element:h.jsx(u0t,{})},{path:"*",element:h.jsx(Lst,{})}]}],f0t={items:{isInitialized:!1,isLoading:!1}},h0t=NT(f0t,e=>{e.addCase(No.pending,t=>{t.items.isLoading=!0}).addCase(No.rejected,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=void 0,t.items.error=n.error}).addCase(No.fulfilled,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(EZ.fulfilled,(t,n)=>{t.items.content?.push(n.payload)}).addCase(AZ.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(DZ.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(kZ.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(_Z,(t,n)=>{t.items.isInitialized=!0,t.items.isLoading=!1,t.items.content=n.payload,t.items.error=void 0}).addCase(OZ,(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)}})}),p0t={byBridge:{}},m0t=NT(p0t,e=>{e.addCase(Mu.pending,(t,n)=>{t.byBridge[n.meta.arg]=YA(t.byBridge[n.meta.arg],n)}).addCase(Mu.rejected,(t,n)=>{t.byBridge[n.meta.arg]=YA(t.byBridge[n.meta.arg],n)}).addCase(Mu.fulfilled,(t,n)=>{t.byBridge[n.meta.arg]=YA(t.byBridge[n.meta.arg],n)})}),g0t={isInitialized:!1,isLoading:!1,content:void 0,error:void 0},YA=NT(g0t,e=>{e.addCase(Mu.pending,t=>{t.isLoading=!0}).addCase(Mu.rejected,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=void 0,t.error=n.error}).addCase(Mu.fulfilled,(t,n)=>{t.isInitialized=!0,t.isLoading=!1,t.content=n.payload,t.error=void 0})}),y0t=t4e({reducer:{bridges:h0t,devices:m0t}}),Dj=Fve({createStyledComponent:ge("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`maxWidth${ve(String(n.maxWidth))}`],n.fixed&&t.fixed,n.disableGutters&&t.disableGutters]}}),useThemeProps:e=>at({props:e,name:"MuiContainer"})});function b0t(e){return et("MuiToolbar",e)}it("MuiToolbar",["root","gutters","regular","dense"]);const v0t=e=>{const{classes:t,disableGutters:n,variant:r}=e;return tt({root:["root",!n&&"gutters",r]},b0t,t)},x0t=ge("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(Ke(({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}]}))),Iue=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiToolbar"}),{className:i,component:o="div",disableGutters:s=!1,variant:a="regular",...l}=r,c={...r,component:o,disableGutters:s,variant:a},u=v0t(c);return h.jsx(x0t,{as:o,className:Oe(u.root,i),ref:n,ownerState:c,...l})});class S0t extends A.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("ErrorBoundary caught:",t,n.componentStack)}render(){return this.state.hasError?h.jsxs(ae,{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"60vh",gap:2,p:4,children:[h.jsx(ZT,{color:"error",sx:{fontSize:64}}),h.jsx(re,{variant:"h5",fontWeight:600,children:pi.t("errorBoundary.title")}),h.jsx(re,{variant:"body2",color:"text.secondary",textAlign:"center",maxWidth:480,children:this.state.error?.message??pi.t("errorBoundary.fallbackMessage")}),h.jsx(qe,{variant:"contained",onClick:()=>{this.setState({hasError:!1,error:null}),window.location.reload()},children:pi.t("errorBoundary.reload")})]}):this.props.children}}function w0t(e){return et("MuiFab",e)}const aX=it("MuiFab",["root","primary","secondary","extended","circular","focusVisible","disabled","colorInherit","sizeSmall","sizeMedium","sizeLarge","info","error","warning","success"]),C0t=e=>{const{color:t,variant:n,classes:r,size:i}=e,o={root:["root",n,`size${ve(i)}`,t==="inherit"?"colorInherit":t]},s=tt(o,w0t,r);return{...r,...s}},E0t=ge(os,{name:"MuiFab",slot:"Root",shouldForwardProp:e=>Li(e)||e==="classes",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${ve(n.size)}`],n.color==="inherit"&&t.colorInherit,t[ve(n.size)],t[n.color]]}})(Ke(({theme:e})=>({...e.typography.button,minHeight:36,transition:e.transitions.create(["background-color","box-shadow","border-color"],{duration:e.transitions.duration.short}),borderRadius:"50%",padding:0,minWidth:0,width:56,height:56,zIndex:(e.vars||e).zIndex.fab,boxShadow:(e.vars||e).shadows[6],"&:active":{boxShadow:(e.vars||e).shadows[12]},color:e.vars?e.vars.palette.grey[900]:e.palette.getContrastText?.(e.palette.grey[300]),backgroundColor:(e.vars||e).palette.grey[300],"&:hover":{backgroundColor:(e.vars||e).palette.grey.A100,"@media (hover: none)":{backgroundColor:(e.vars||e).palette.grey[300]},textDecoration:"none"},[`&.${aX.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},variants:[{props:{size:"small"},style:{width:40,height:40}},{props:{size:"medium"},style:{width:48,height:48}},{props:{variant:"extended"},style:{borderRadius:48/2,padding:"0 16px",width:"auto",minHeight:"auto",minWidth:48,height:48}},{props:{variant:"extended",size:"small"},style:{width:"auto",padding:"0 8px",borderRadius:34/2,minWidth:34,height:34}},{props:{variant:"extended",size:"medium"},style:{width:"auto",padding:"0 16px",borderRadius:40/2,minWidth:40,height:40}},{props:{color:"inherit"},style:{color:"inherit"}}]})),Ke(({theme:e})=>({variants:[...Object.entries(e.palette).filter(Wn(["dark","contrastText"])).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].contrastText,backgroundColor:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:(e.vars||e).palette[t].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t].main}}}}))]})),Ke(({theme:e})=>({[`&.${aX.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}))),k0t=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiFab"}),{children:i,className:o,color:s="default",component:a="button",disabled:l=!1,disableFocusRipple:c=!1,focusVisibleClassName:u,size:d="large",variant:p="circular",...g}=r,y={...r,color:s,component:a,disabled:l,disableFocusRipple:c,size:d,variant:p},b=C0t(y);return h.jsx(E0t,{className:Oe(b.root,o),component:a,disabled:l,focusRipple:!c,focusVisibleClassName:Oe(b.focusVisible,u),ownerState:y,ref:n,...g,classes:b,children:i})}),A0t=[{code:"en",flag:"🇬🇧",name:"English"},{code:"de",flag:"🇩🇪",name:"Deutsch"},{code:"fr",flag:"🇫🇷",name:"Français"},{code:"es",flag:"🇪🇸",name:"Español"},{code:"it",flag:"🇮🇹",name:"Italiano"},{code:"zh",flag:"🇨🇳",name:"中文"},{code:"th",flag:"🇹🇭",name:"ไทย"},{code:"sv",flag:"🇸🇪",name:"Svenska"},{code:"tr",flag:"🇹🇷",name:"Türkçe"}],D0t="hamh-custom-languages";function _0t(){try{const e=localStorage.getItem(D0t);return e?JSON.parse(e).map(n=>({code:n.code,flag:"🌐",name:n.name})):[]}catch{return[]}}const O0t="https://github.com/RiDDiX/home-assistant-matter-hub/issues/new?labels=translation&title=Translation+improvement";function T0t(){const{t:e,i18n:t}=on(),[n,r]=A.useState(!1),i=A.useRef(null),o=A.useMemo(()=>[...A0t,..._0t()],[]),s=t.language?.split("-")[0]??"en",a=A.useCallback(()=>{r(u=>!u)},[]),l=A.useCallback(u=>{t.changeLanguage(u),r(!1)},[t]),c=A.useCallback(()=>{r(!1)},[]);return h.jsx(tZ,{onClickAway:c,children:h.jsxs(ae,{children:[h.jsx(k0t,{ref:i,size:"small",color:"primary",onClick:a,"aria-label":"Change language",sx:{position:"fixed",bottom:24,right:24,zIndex:1300},children:h.jsx(aDe,{})}),h.jsx(Yb,{open:n,anchorEl:i.current,placement:"top-end",transition:!0,sx:{zIndex:1300},children:({TransitionProps:u})=>h.jsx(TS,{...u,timeout:200,children:h.jsxs(Gr,{elevation:8,sx:{mb:1,py:.5,minWidth:160,borderRadius:2,overflow:"hidden"},children:[o.map(d=>h.jsxs(ae,{onClick:()=>l(d.code),sx:{display:"flex",alignItems:"center",gap:1.5,px:2,py:1,cursor:"pointer",bgcolor:s===d.code?"action.selected":"transparent","&:hover":{bgcolor:"action.hover"},transition:"background-color 0.15s"},children:[h.jsx(re,{sx:{fontSize:"1.4rem",lineHeight:1,userSelect:"none"},children:d.flag}),h.jsx(re,{variant:"body2",fontWeight:s===d.code?600:400,children:d.name})]},d.code)),h.jsx(Dr,{}),h.jsxs(ae,{sx:{display:"flex",alignItems:"flex-start",gap:.75,px:2,py:1},children:[h.jsx(UT,{sx:{fontSize:14,mt:.25,color:"text.secondary"}}),h.jsxs(re,{variant:"caption",color:"text.secondary",sx:{lineHeight:1.4},children:[e("languageSwitcher.disclaimer")," ",h.jsx(Wb,{href:O0t,target:"_blank",rel:"noopener",sx:{fontSize:"inherit"},children:e("languageSwitcher.contribute")})]})]})]})})})]})})}const M0t="home-assistant-matter-hub",R0t={name:M0t};function jue(){const e="2.1.0-alpha.532",[t,n]=A.useState(null);A.useEffect(()=>{fetch("api/health").then(i=>i.ok?i.json():null).then(i=>{i?.version&&n(i.version)}).catch(()=>{})},[]);const r=A.useMemo(()=>!t||e==="0.0.0-dev"?!1:e!==t,[t]);return A.useMemo(()=>({name:R0t.name,version:t??e,frontendVersion:e,backendVersion:t,versionMismatch:r}),[t,r])}const I0t=()=>{const{t:e}=on(),t=[{name:e("footer.github"),url:Tt.githubRepository},{name:e("footer.documentation"),url:Tt.documentation}];return h.jsxs(Dj,{sx:{mt:16,mb:4},children:[h.jsx(Dr,{sx:{mt:4,mb:4}}),h.jsx(dt,{container:!0,spacing:2,justifyContent:"center",children:t.map((n,r)=>h.jsx(dt,{size:{xs:12,sm:"auto"},children:h.jsx(qe,{fullWidth:!0,size:"small",variant:"outlined",component:Wb,href:n.url,target:"_blank",children:n.name})},r.toString()))})]})};function j0t(e){return et("MuiAppBar",e)}it("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const P0t=e=>{const{color:t,position:n,classes:r}=e,i={root:["root",`color${ve(t)}`,`position${ve(n)}`]};return tt(i,j0t,r)},lX=(e,t)=>e?`${e.replace(")","")}, ${t})`:t,$0t=ge(Gr,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${ve(n.position)}`],t[`color${ve(n.color)}`]]}})(Ke(({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(Wn(["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?lX(e.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:e.vars?lX(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"})}}]}))),L0t=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiAppBar"}),{className:i,color:o="primary",enableColorOnDark:s=!1,position:a="fixed",...l}=r,c={...r,color:o,position:a,enableColorOnDark:s},u=P0t(c);return h.jsx($0t,{square:!0,component:"header",ownerState:c,elevation:4,className:Oe(u.root,i,a==="fixed"&&"mui-fixed"),ref:n,...l})});function N0t(e,t,n){const r=t.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=oa(t);let s;if(t.fakeTransform)s=t.fakeTransform;else{const c=o.getComputedStyle(t);s=c.getPropertyValue("-webkit-transform")||c.getPropertyValue("transform")}let a=0,l=0;if(s&&s!=="none"&&typeof s=="string"){const c=s.split("(")[1].split(")")[0].split(",");a=parseInt(c[4],10),l=parseInt(c[5],10)}return e==="left"?i?`translateX(${i.right+a-r.left}px)`:`translateX(${o.innerWidth+a-r.left}px)`:e==="right"?i?`translateX(-${r.right-i.left-a}px)`:`translateX(-${r.left+r.width-a}px)`:e==="up"?i?`translateY(${i.bottom+l-r.top}px)`:`translateY(${o.innerHeight+l-r.top}px)`:i?`translateY(-${r.top-i.top+r.height-l}px)`:`translateY(-${r.top+r.height-l}px)`}function F0t(e){return typeof e=="function"?e():e}function o4(e,t,n){const r=F0t(n),i=N0t(e,t,r);i&&(t.style.webkitTransform=i,t.style.transform=i)}const B0t=A.forwardRef(function(t,n){const r=qi(),i={enter:r.transitions.easing.easeOut,exit:r.transitions.easing.sharp},o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:s,appear:a=!0,children:l,container:c,direction:u="down",easing:d=i,in:p,onEnter:g,onEntered:y,onEntering:b,onExit:v,onExited:S,onExiting:C,style:w,timeout:k=o,TransitionComponent:E=Xa,...O}=t,_=A.useRef(null),T=Br(Mf(l),_,n),I=V=>q=>{V&&(q===void 0?V(_.current):V(_.current,q))},P=I((V,q)=>{o4(u,V,c),IT(V),g&&g(V,q)}),L=I((V,q)=>{const X=mf({timeout:k,style:w,easing:d},{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,q)}),M=I(y),$=I(C),N=I(V=>{const q=mf({timeout:k,style:w,easing:d},{mode:"exit"});V.style.webkitTransition=r.transitions.create("-webkit-transform",q),V.style.transition=r.transitions.create("transform",q),o4(u,V,c),v&&v(V)}),z=I(V=>{V.style.webkitTransition="",V.style.transition="",S&&S(V)}),F=V=>{s&&s(_.current,V)},W=A.useCallback(()=>{_.current&&o4(u,_.current,c)},[u,c]);return A.useEffect(()=>{if(p||u==="down"||u==="right")return;const V=Ub(()=>{_.current&&o4(u,_.current,c)}),q=oa(_.current);return q.addEventListener("resize",V),()=>{V.clear(),q.removeEventListener("resize",V)}},[u,p,c]),A.useEffect(()=>{p||W()},[p,W]),h.jsx(E,{nodeRef:_,onEnter:P,onEntered:M,onEntering:L,onExit:N,onExited:z,onExiting:$,addEndListener:F,appear:a,in:p,timeout:k,...O,children:(V,{ownerState:q,...X})=>A.cloneElement(l,{ref:T,style:{visibility:V==="exited"&&!p?"hidden":void 0,...w,...l.props.style},...X})})});function z0t(e){return et("MuiDrawer",e)}it("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Pue=(e,t)=>{const{ownerState:n}=e;return[t.root,(n.variant==="permanent"||n.variant==="persistent")&&t.docked,n.variant==="temporary"&&t.modal]},H0t=e=>{const{classes:t,anchor:n,variant:r}=e,i={root:["root",`anchor${ve(n)}`],docked:[(r==="permanent"||r==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${ve(n)}`,r!=="temporary"&&`paperAnchorDocked${ve(n)}`]};return tt(i,z0t,t)},U0t=ge(tM,{name:"MuiDrawer",slot:"Root",overridesResolver:Pue})(Ke(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),V0t=ge("div",{shouldForwardProp:Li,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Pue})({flex:"0 0 auto"}),W0t=ge(Gr,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperAnchor${ve(n.anchor)}`],n.variant!=="temporary"&&t[`paperAnchorDocked${ve(n.anchor)}`]]}})(Ke(({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}`}}]}))),$ue={left:"right",right:"left",top:"down",bottom:"up"};function q0t(e){return["left","right"].includes(e)}function G0t({direction:e},t){return e==="rtl"&&q0t(t)?$ue[t]:t}const K0t=A.forwardRef(function(t,n){const r=at({props:t,name:"MuiDrawer"}),i=qi(),o=Pc(),s={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{anchor:a="left",BackdropProps:l,children:c,className:u,elevation:d=16,hideBackdrop:p=!1,ModalProps:{BackdropProps:g,...y}={},onClose:b,open:v=!1,PaperProps:S={},SlideProps:C,TransitionComponent:w,transitionDuration:k=s,variant:E="temporary",slots:O={},slotProps:_={},...T}=r,I=A.useRef(!1);A.useEffect(()=>{I.current=!0},[]);const P=G0t({direction:o?"rtl":"ltr"},a),M={...r,anchor:a,elevation:d,open:v,variant:E,...T},$=H0t(M),N={slots:{transition:w,...O},slotProps:{paper:S,transition:C,..._,backdrop:TT(_.backdrop||{...l,...g},{transitionDuration:k})}},[z,F]=ut("root",{ref:n,elementType:U0t,className:Oe($.root,$.modal,u),shouldForwardComponentProp:!0,ownerState:M,externalForwardedProps:{...N,...T,...y},additionalProps:{open:v,onClose:b,hideBackdrop:p,slots:{backdrop:N.slots.backdrop},slotProps:{backdrop:N.slotProps.backdrop}}}),[W,V]=ut("paper",{elementType:W0t,shouldForwardComponentProp:!0,className:Oe($.paper,S.className),ownerState:M,externalForwardedProps:N,additionalProps:{elevation:E==="temporary"?d:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[q,X]=ut("docked",{elementType:V0t,ref:n,className:Oe($.root,$.docked,u),ownerState:M,externalForwardedProps:N,additionalProps:T}),[B,U]=ut("transition",{elementType:B0t,ownerState:M,externalForwardedProps:N,additionalProps:{in:v,direction:$ue[P],timeout:k,appear:I.current}}),Y=h.jsx(W,{...V,children:c});if(E==="permanent")return h.jsx(q,{...X,children:Y});const H=h.jsx(B,{...U,children:Y});return E==="persistent"?h.jsx(q,{...X,children:H}):h.jsx(z,{...F,children:H})}),Y0t=IJ({themeId:Ra}),X0t={error:jf,warn:ug,info:QT,debug:cC},J0t=({open:e,onClose:t})=>{const{t:n}=on(),r=qi(),i=A.useMemo(()=>({error:r.palette.error.main,warn:r.palette.warning.main,info:r.palette.info.main,debug:r.palette.secondary.main}),[r]),[o,s]=A.useState([]),[a,l]=A.useState(!0),[c,u]=A.useState("error,warn,info".split(",")),[d,p]=A.useState(""),[g,y]=A.useState(!0),b=A.useCallback(async()=>{try{const k=new URLSearchParams({level:c.join(","),limit:"500",...d&&{search:d}}),E=await fetch(`api/logs?${k}`);if(E.ok){const O=await E.json();s(O.entries)}}catch(k){console.error("Failed to fetch logs:",k)}finally{l(!1)}},[c,d]);A.useEffect(()=>{e&&b()},[e,b]),A.useEffect(()=>{if(!g||!e)return;const k=setInterval(b,5e3);return()=>clearInterval(k)},[g,e,b]);const v=k=>{u(Array.isArray(k.target.value)?k.target.value:[k.target.value])},S=k=>{p(k.target.value)},C=async()=>{try{await fetch("api/logs",{method:"DELETE"}),s([])}catch(k){console.error("Failed to clear logs:",k)}},w=k=>{const E=X0t[k]||QT;return h.jsx(E,{sx:{fontSize:16,color:i[k]}})};return h.jsxs(Po,{open:e,onClose:t,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(Lo,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(cC,{}),n("logs.title"),h.jsx(ae,{sx:{flexGrow:1}}),h.jsx(Nt,{title:n("logs.autoRefresh"),children:h.jsx(ft,{label:g?"Auto":"Manual",color:g?"success":"default",size:"small",onClick:()=>y(!g),sx:{cursor:"pointer"}})}),h.jsx(Wt,{onClick:t,children:h.jsx(LS,{})})]}),h.jsxs($o,{children:[h.jsx(Vt,{spacing:2,sx:{mb:2},children:h.jsxs(Vt,{direction:"row",spacing:2,alignItems:"center",children:[h.jsxs(rs,{size:"small",sx:{minWidth:200},children:[h.jsx(ja,{children:n("logs.logLevel")}),h.jsxs(ts,{value:c,label:n("logs.logLevel"),onChange:v,multiple:!0,renderValue:k=>h.jsx(ae,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:(Array.isArray(k)?k:[k]).map(E=>h.jsx(ft,{label:E.toUpperCase(),size:"small",sx:{backgroundColor:i[E],color:"white"}},E))}),children:[h.jsx(Nn,{value:"error",children:n("logs.error")}),h.jsx(Nn,{value:"warn",children:n("logs.warning")}),h.jsx(Nn,{value:"info",children:n("logs.info")}),h.jsx(Nn,{value:"debug",children:n("logs.debug")})]})]}),h.jsx(Zn,{size:"small",placeholder:n("logs.searchPlaceholder"),value:d,onChange:S,sx:{flexGrow:1}}),h.jsx(qe,{variant:"outlined",onClick:b,children:n("common.refresh")}),h.jsx(qe,{variant:"outlined",color:"error",onClick:C,children:n("common.delete")})]})}),h.jsx(ae,{sx:{height:400,overflow:"auto",backgroundColor:"background.paper",border:1,borderColor:"divider",borderRadius:1,p:1},children:a?h.jsx(ae,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsxs(re,{children:[n("common.loading"),"..."]})}):o.length===0?h.jsx(ae,{sx:{display:"flex",justifyContent:"center",p:4},children:h.jsx(re,{color:"text.secondary",children:n("logs.noResults")})}):h.jsx(Vt,{spacing:1,children:o.map((k,E)=>h.jsxs(ae,{sx:{p:1,borderRadius:1,backgroundColor:"action.hover",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all"},children:[h.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[w(k.level),h.jsx(re,{variant:"caption",color:"text.secondary",children:new Date(k.timestamp).toLocaleString()}),h.jsx(ft,{label:k.level.toUpperCase(),size:"small",sx:{backgroundColor:i[k.level],color:r.palette.getContrastText(i[k.level]??r.palette.grey[500]),fontSize:"0.7rem",height:20}})]}),h.jsx(re,{sx:{ml:3},children:k.message}),k.context&&h.jsx(re,{sx:{ml:3,color:"text.secondary",fontSize:"0.8rem"},children:JSON.stringify(k.context,null,2)})]},`${k.timestamp}-${k.level}-${E}`))})})]}),h.jsx(es,{children:h.jsx(qe,{onClick:t,children:n("common.close")})})]})};function cX(){const{t:e}=on(),{isConnected:t}=MZ(),[n,r]=A.useState(null),[i,o]=A.useState(!1);A.useEffect(()=>{const b=async()=>{try{const S=await fetch("api/health");if(S.ok){const C=await S.json();r(C),o(!1)}else o(!0)}catch{o(!0)}};b();const v=setInterval(b,3e4);return()=>clearInterval(v)},[]);const s=b=>{const v=Math.floor(b/3600),S=Math.floor(b%3600/60);return v>0?`${v}h ${S}m`:`${S}m`},a=n?.status==="healthy"&&!i,l=n?.services?.bridges,c=l&&l.total>0&&l.running===l.total,u=l&&l.total===0,d=n?h.jsxs(ae,{sx:{p:.5},children:[h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.version"),":"]})," ",n.version??e("status.unknown")]}),h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.uptime"),":"]})," ",s(n.uptime??0)]}),n.services?.bridges&&h.jsxs("div",{children:[h.jsxs("strong",{children:[e("nav.bridges"),":"]})," ",n.services.bridges.running??0,"/",n.services.bridges.total??0," ",e("common.running").toLowerCase(),(n.services.bridges.stopped??0)>0&&` (${n.services.bridges.stopped} ${e("common.stopped").toLowerCase()})`]}),n.services?.homeAssistant&&h.jsxs("div",{children:[h.jsxs("strong",{children:[e("health.homeAssistant"),":"]})," ",n.services.homeAssistant.connected?e("health.connected"):e("health.disconnected")]}),h.jsxs("div",{children:[h.jsx("strong",{children:"WebSocket:"})," ",e(t?"health.connected":"health.disconnected")]})]}):e("status.loadingHealth"),p=()=>i||!a?h.jsx(jf,{fontSize:"small"}):c?h.jsx(Ja,{fontSize:"small"}):h.jsx(Kw,{fontSize:"small"}),g=()=>i||!a?"error":!c||!t?"warning":"success",y=()=>e(i?"status.error":a?t?u?"status.noBridges":c?"common.online":"common.starting":"common.offline":"status.unhealthy");return h.jsx(Nt,{title:d,arrow:!0,children:h.jsx(ft,{icon:p(),label:y(),color:g(),size:"small",variant:"filled",sx:{borderRadius:1,fontWeight:600,"& .MuiChip-icon":{color:"inherit"}}})})}const Z0t=e=>A.createElement("svg",{viewBox:"0 0 91 89",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("g",{style:{display:"inline"}},A.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"}),A.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"}))),Q0t=e=>{const t=jue();return h.jsxs(ae,{component:Dc,to:Tt.dashboard,sx:{display:"flex",alignItems:"center",justifyContent:e.large?"flex-start":"center",flexGrow:1,textDecoration:"none",color:"inherit"},children:[h.jsx(Z0t,{style:{height:"40px"}}),h.jsx(re,{variant:"inherit",component:"span",sx:{mr:1,ml:1},children:t.name.split("-").map(ve).join("-")}),e.large&&h.jsx(re,{variant:"caption",component:"span",children:t.version})]})},egt=()=>{const e=Y0t("(min-width:600px)"),{mode:t,setMode:n}=Iw(),[r,i]=A.useState(!1),[o,s]=A.useState(!1),a=jc(),l=Gu(),c=y=>y?y==="/"?l.pathname==="/":l.pathname.startsWith(y):!1,u=()=>{n(t==="dark"?"light":"dark")},{t:d}=on(),p=[{label:d("dashboard.title"),icon:h.jsx(CM,{}),to:Tt.dashboard},{label:d("nav.bridges"),icon:h.jsx(Ny,{}),to:Tt.bridges},{label:d("nav.devices"),icon:h.jsx(aa,{}),to:Tt.devices},{label:d("nav.networkMap"),icon:h.jsx(xM,{}),to:Tt.networkMap},{label:d("nav.startupOrder"),icon:h.jsx(cg,{}),to:Tt.startup},{label:d("nav.lockCredentials"),icon:h.jsx(Tu,{}),to:Tt.lockCredentials},{label:d("nav.filterReference"),icon:h.jsx(EM,{}),to:Tt.labels},{label:"Plugins",icon:h.jsx(Ly,{}),to:Tt.plugins},{label:d("nav.settings"),icon:h.jsx(fg,{}),to:Tt.settings},{label:d(t==="dark"?"nav.lightMode":"nav.darkMode"),icon:t==="dark"?h.jsx(cDe,{}):h.jsx(JAe,{}),onClick:u},{label:d("nav.systemLogs"),icon:h.jsx(cC,{}),onClick:()=>i(!0)},{label:d("nav.health"),icon:h.jsx(rM,{}),to:Tt.health}],g=y=>{s(!1),y.onClick?y.onClick():y.to&&a(y.to)};return h.jsxs(ae,{children:[h.jsx(L0t,{sx:{height:"72px"},children:h.jsx(Iue,{sx:{paddingLeft:"0 !important",paddingRight:"0 !important"},children:h.jsxs(Dj,{sx:{padding:2,height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h.jsx(Q0t,{large:e}),e?h.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.map(y=>y.to?h.jsx(Nt,{title:y.label,children:h.jsx(Wt,{component:Dc,to:y.to,sx:{color:"inherit",bgcolor:c(y.to)?"rgba(255,255,255,0.15)":"transparent",borderRadius:1},children:y.icon})},y.label):h.jsx(Nt,{title:y.label,children:h.jsx(Wt,{onClick:y.onClick,sx:{color:"inherit"},children:y.icon})},y.label)),h.jsx(cX,{})]}):h.jsxs(ae,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(cX,{}),h.jsx(Wt,{onClick:()=>s(!0),sx:{color:"inherit"},children:h.jsx(uDe,{})})]})]})})}),h.jsx(K0t,{anchor:"right",open:o,onClose:()=>s(!1),children:h.jsx(Fo,{sx:{width:250},children:p.map(y=>h.jsxs(h6e,{selected:c(y.to),onClick:()=>g(y),children:[h.jsx(jo,{children:y.icon}),h.jsx(so,{primary:y.label})]},y.label))})}),h.jsx(J0t,{open:r,onClose:()=>i(!1)})]})},tgt=()=>{const{versionMismatch:e,frontendVersion:t,backendVersion:n}=jue(),{isConnected:r}=MZ();return h.jsxs(ae,{children:[h.jsx(egt,{}),h.jsx(Iue,{}),e&&h.jsxs(zt,{severity:"warning",variant:"filled",sx:{borderRadius:0},action:h.jsx(qe,{color:"inherit",size:"small",onClick:()=>window.location.reload(),children:"Reload"}),children:["Version mismatch: frontend ",t,", backend ",n,". Please reload to get the latest UI."]}),!r&&h.jsx(zt,{severity:"error",variant:"filled",sx:{borderRadius:0},children:"Connection lost — data may be outdated. Reconnecting…"}),h.jsx(Dj,{sx:{p:2},children:h.jsx(S0t,{children:h.jsx(BX,{})})}),h.jsx(I0t,{}),h.jsx(T0t,{})]})},ngt=Tw({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 sS=document.getElementsByTagName("base")[0]?.href?.replace(/\/$/,"");sS?.startsWith("http")&&(sS=new URL(sS).pathname);const rgt=jme([{path:"/",element:h.jsx(tgt,{}),children:d0t}],{basename:sS});Jfe.createRoot(document.getElementById("root")).render(h.jsx(A.StrictMode,{children:h.jsx(phe,{store:y0t,children:h.jsxs(Xxe,{theme:ngt,children:[h.jsx(Wxe,{}),h.jsx(KJ,{styles:{".rjsf-field-array > .MuiFormControl-root > .MuiPaper-root > .MuiBox-root > .MuiGrid-root > .MuiGrid-root:has(> .MuiBox-root > .MuiPaper-root > .MuiBox-root > .rjsf-field)":{overflow:"initial !important",flexGrow:1}}}),h.jsx(v4e,{children:h.jsx(u5e,{children:h.jsx(Gme,{router:rgt})})})]})})}));