@camstack/addon-admin-ui 0.1.36 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CeLhKMin.js → __mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-Cv6qLu_-.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-DXPQtD9p.js → __mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-CChEG9e0.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-OcRSBqRe.js → __mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-C1BmHlGM.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-GvBGLFI2.js → __mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-Bxv_3KWz.js} +1 -1
- package/dist/assets/__mfe_internal__admin_ui_host__loadShare__konva__loadShare__.mjs-g85Oidc0.js +15 -0
- package/dist/assets/__mfe_internal__admin_ui_host__loadShare__konva__loadShare__.mjs_commonjs-proxy-Bqeq2Zwj.js +1 -0
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-Dl4u0xYE.js → __mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-DC63qZbr.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs_commonjs-proxy-CSyOECfO.js → __mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs_commonjs-proxy-D2C49VyZ.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CzO_Esxm.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-D3WbXy3O.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-xw6c6JeS.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-Csg6EbPB.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DNpf5SLz.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-CUc0oFNo.js} +2 -2
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs_commonjs-proxy-BEKtiDI3.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs_commonjs-proxy-vh0hhA5d.js} +1 -1
- package/dist/assets/__mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.mjs-CpGtTxci.js +35 -0
- package/dist/assets/__mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.mjs_commonjs-proxy-RUDPE9aM.js +1 -0
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-W-FrsYv6.js +1 -0
- package/dist/assets/{devices-D4k34mru.js → devices-GLp7me2a.js} +1 -1
- package/dist/assets/hostInit-c5F5KLjV.js +1 -0
- package/dist/assets/index-2B5djHSh.js +1150 -0
- package/dist/assets/index-ByRJWRUP.js +1 -0
- package/dist/assets/index-COoei6lw.css +1 -0
- package/dist/assets/index-CtHpLu0L.js +1 -0
- package/dist/assets/{index-D92THlot.js → index-CwF7Dxf8.js} +1 -1
- package/dist/assets/{index-BI3Z7SSi.js → index-D6khiudP.js} +1 -1
- package/dist/assets/index-DNY_otk4.js +151 -0
- package/dist/assets/index-DQFO9ZU6.js +1 -0
- package/dist/assets/{index-BGZqVJZt.js → index-JJ5NLHxC.js} +1 -1
- package/dist/assets/{index-Bwcmc2hW.js → index-TiJwCuZx.js} +1 -1
- package/dist/assets/index-WrAHDGEr.js +87 -0
- package/dist/assets/index-b0D9qthW.js +1 -0
- package/dist/assets/method-access-map-DLEhlu0x.js +1 -0
- package/dist/assets/{remoteEntry-BRybuw2S.js → remoteEntry-BJZZ6pth.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DUkp33c_.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DWHckfBG.js} +6 -6
- package/dist/index.html +6 -6
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/dist/server/addon.js +528 -96
- package/dist/server/addon.js.map +1 -1
- package/dist/sw.js +1 -1
- package/package.json +10 -2
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DYU-qDnu.js +0 -1
- package/dist/assets/hostInit-CBKchP1G.js +0 -1
- package/dist/assets/index-BEewR-UX.js +0 -1
- package/dist/assets/index-BRSAFSOw.css +0 -1
- package/dist/assets/index-BqMPfvQx.js +0 -1
- package/dist/assets/index-CP1R6E2R.js +0 -88
- package/dist/assets/index-CwjnPcOV.js +0 -152
- package/dist/assets/index-Dmon2mdO.js +0 -1
- package/dist/assets/index-KlKJOjpC.js +0 -1
- package/dist/assets/index-SyrojlmO.js +0 -1156
- package/dist/assets/method-access-map-BFPyQ2-G.js +0 -1
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import{e as C,h as _,c as U,f as K,d as Ie,b as et,i as W,j as Oe,R as Ae,l as gt,m as Cl,k as Vt,g as zn,a as Ms}from"./__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-Dl4u0xYE.js";import{c as o,d as m,e as Se,a as Es}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-C_6K4VBY.js";import{b as _r,a as As}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CzO_Esxm.js";import{b as Ml,a as Ps}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DNpf5SLz.js";import{n as Tr,m as Rs,h as El,o as Al,p as Pl,_ as Is}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CeLhKMin.js";import{c as _s,s as Ts,B as Rl,F as Il,n as _l,_ as Ds}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DIkg6-MH.js";import{a as Tl,_ as Ls}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-OcRSBqRe.js";import{K as Dl,E as q,A as Ll}from"./method-access-map-BFPyQ2-G.js";import{D as Ol,c as $l,E as Bl}from"./index-BqMPfvQx.js";import{c as zl}from"./devices-D4k34mru.js";import{a as Fl}from"./schemas-BEt-CulV.js";import"./__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs_commonjs-proxy-CSyOECfO.js";import"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-xw6c6JeS.js";var Os={frigate:"#3b82f6",scrypted:"#a855f7",reolink:"#06b6d4",homeAssistant:"#22d3ee",rtsp:"#78716c"},Gl={primary:"#f59e42",primaryForeground:"#0c0a09",background:"#0c0a09",backgroundElevated:"#1c1917",surface:"#1c1917",surfaceHover:"#292524",border:"#292524",borderSubtle:"#1c1917",foreground:"#fafaf9",foregroundMuted:"#a8a29e",foregroundSubtle:"#78716c",foregroundDisabled:"#57534e",success:"#4ade80",warning:"#fbbf24",danger:"#f87171",info:"#60a5fa",provider:Os},Ql={primary:"#e67e22",primaryForeground:"#ffffff",background:"#fafaf9",backgroundElevated:"#ffffff",surface:"#f5f5f4",surfaceHover:"#e7e5e4",border:"#d6d3d1",borderSubtle:"#e7e5e4",foreground:"#1c1917",foregroundMuted:"#57534e",foregroundSubtle:"#78716c",foregroundDisabled:"#a8a29e",success:"#16a34a",warning:"#d97706",danger:"#dc2626",info:"#2563eb",provider:Os},uo={colors:{dark:Gl,light:Ql},spacing:{xs:2,sm:4,md:8,lg:12,xl:16,"2xl":24,"3xl":32},radius:{sm:4,md:6,lg:8,xl:12},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',sizes:{xs:{fontSize:10,lineHeight:14},sm:{fontSize:11,lineHeight:16},base:{fontSize:12,lineHeight:18},lg:{fontSize:13,lineHeight:18},xl:{fontSize:14,lineHeight:20},"2xl":{fontSize:16,lineHeight:22},"3xl":{fontSize:20,lineHeight:28}},weights:{regular:400,medium:500,semibold:600,bold:700}},table:{rowHeight:28,headerHeight:24,cellPaddingX:8,cellPaddingY:6},sidebar:{width:176,itemHeight:28,iconSize:14}};function $s(e,t){const r={...e};for(const n in t){const s=t[n],a=e[n];s!==void 0&&typeof s=="object"&&s!==null&&!Array.isArray(s)&&typeof a=="object"&&a!==null?r[n]=$s(a,s):s!==void 0&&(r[n]=s)}return r}function Fb(e){return e?$s(structuredClone(uo),e):structuredClone(uo)}function Bs(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function jl(e){return`--color-${Bs(e)}`}function po(e){const t=[];for(const[r,n]of Object.entries(e))r!=="provider"&&t.push(` ${jl(r)}: ${n};`);return t.join(`
|
|
2
|
-
`)}function Ul(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --color-provider-${Bs(r)}: ${n};`);return t.join(`
|
|
3
|
-
`)}function Hl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --spacing-${r}: ${n}px;`);return t.join(`
|
|
4
|
-
`)}function Vl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --radius-${r}: ${n}px;`);return t.join(`
|
|
5
|
-
`)}function Gb(e){const t=po(e.colors.dark),r=po(e.colors.light);return`@theme {
|
|
6
|
-
${Ul(e.colors.dark.provider)}
|
|
7
|
-
${Hl(e.spacing)}
|
|
8
|
-
${Vl(e.radius)}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dark {
|
|
12
|
-
${t}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.light {
|
|
16
|
-
${r}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@media (prefers-color-scheme: dark) {
|
|
20
|
-
:root {
|
|
21
|
-
${t.replace(/^ {2}/gm," ")}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@media (prefers-color-scheme: light) {
|
|
26
|
-
:root {
|
|
27
|
-
${r.replace(/^ {2}/gm," ")}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`}var zs=et(null),jr=["dark","light","system"];function Fs(){return typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ql(e,t){if(typeof window>"u")return t;const r=localStorage.getItem(e);return r==="dark"||r==="light"||r==="system"?r:t}function fo(e){return e==="system"?Fs():e}function mo({children:e,defaultMode:t="system",storageKey:r="camstack-theme-mode"}){const[n,s]=C(()=>ql(r,t)),[a,i]=C(()=>fo(n)),d=_(u=>{s(u),i(fo(u)),typeof window<"u"&&localStorage.setItem(r,u)},[r]),l=_(()=>{d(jr[(jr.indexOf(n)+1)%jr.length]??"dark")},[n,d]);U(()=>{if(typeof document>"u")return;const u=document.documentElement;u.classList.remove("dark","light"),u.classList.add(a)},[n,a]),U(()=>{if(typeof window>"u"||n!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),p=()=>{i(Fs())};return u.addEventListener("change",p),()=>u.removeEventListener("change",p)},[n]);const c=K(()=>({mode:n,resolvedMode:a,setMode:d,toggleMode:l}),[n,a,d,l]);return o(zs.Provider,{value:c,children:e})}function Wl(){const e=Ie(zs);if(!e)throw new Error("useThemeMode must be used within a ThemeProvider");return e}var Ur={};function Gs(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Gs(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Qs(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Gs(e))&&(n&&(n+=" "),n+=t);return n}var Kl=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Yl=(e,t)=>({classGroupId:e,validator:t}),js=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Cr="-",ho=[],Zl="arbitrary..",Xl=e=>{const t=ec(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Jl(i);const d=i.split(Cr);return Us(d,d[0]===""&&d.length>1?1:0,t)},getConflictingClassGroupIds:(i,d)=>{if(d){const l=n[i],c=r[i];return l?c?Kl(c,l):l:c||ho}return r[i]||ho}}},Us=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],s=r.nextPart.get(n);if(s){const l=Us(e,t+1,s);if(l)return l}const a=r.validators;if(a===null)return;const i=t===0?e.join(Cr):e.slice(t).join(Cr),d=a.length;for(let l=0;l<d;l++){const c=a[l];if(c.validator(i))return c.classGroupId}},Jl=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Zl+n:void 0})(),ec=e=>{const{theme:t,classGroups:r}=e;return tc(r,t)},tc=(e,t)=>{const r=js();for(const n in e){const s=e[n];Fn(s,r,n,t)}return r},Fn=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];rc(i,t,r,n)}},rc=(e,t,r,n)=>{if(typeof e=="string"){nc(e,t,r);return}if(typeof e=="function"){oc(e,t,r,n);return}sc(e,t,r,n)},nc=(e,t,r)=>{const n=e===""?t:Hs(t,e);n.classGroupId=r},oc=(e,t,r,n)=>{if(ac(e)){Fn(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Yl(r,e))},sc=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[d,l]=s[i];Fn(l,Hs(t,d),r,n)}},Hs=(e,t)=>{let r=e;const n=t.split(Cr),s=n.length;for(let a=0;a<s;a++){const i=n[a];let d=r.nextPart.get(i);d||(d=js(),r.nextPart.set(i,d)),r=d}return r},ac=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ic=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},mn="!",go=":",lc=[],bo=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),cc=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,d=0,l=0,c;const u=s.length;for(let v=0;v<u;v++){const y=s[v];if(i===0&&d===0){if(y===go){a.push(s.slice(l,v)),l=v+1;continue}if(y==="/"){c=v;continue}}y==="["?i++:y==="]"?i--:y==="("?d++:y===")"&&d--}const p=a.length===0?s:s.slice(l);let h=p,g=!1;p.endsWith(mn)?(h=p.slice(0,-1),g=!0):p.startsWith(mn)&&(h=p.slice(1),g=!0);const b=c&&c>l?c-l:void 0;return bo(a,g,h,b)};if(t){const s=t+go,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):bo(lc,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},dc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],d=i[0]==="[",l=t.has(i);d||l?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},uc=e=>({cache:ic(e.cacheSize),parseClassName:cc(e),sortModifiers:dc(e),...Xl(e)}),pc=/\s+/,fc=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],d=e.trim().split(pc);let l="";for(let c=d.length-1;c>=0;c-=1){const u=d[c],{isExternal:p,modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=r(u);if(p){l=u+(l.length>0?" "+l:l);continue}let y=!!v,x=n(y?b.substring(0,v):b);if(!x){if(!y){l=u+(l.length>0?" "+l:l);continue}if(x=n(b),!x){l=u+(l.length>0?" "+l:l);continue}y=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),k=g?w+mn:w,M=k+x;if(i.indexOf(M)>-1)continue;i.push(M);const S=s(x,y);for(let E=0;E<S.length;++E){const I=S[E];i.push(k+I)}l=u+(l.length>0?" "+l:l)}return l},mc=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Vs(r))&&(s&&(s+=" "),s+=n);return s},Vs=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Vs(e[n]))&&(r&&(r+=" "),r+=t);return r},hc=(e,...t)=>{let r,n,s,a;const i=l=>(r=uc(t.reduce((c,u)=>u(c),e())),n=r.cache.get,s=r.cache.set,a=d,d(l)),d=l=>{const c=n(l);if(c)return c;const u=fc(l,r);return s(l,u),u};return a=i,(...l)=>a(mc(...l))},gc=[],Re=e=>{const t=r=>r[e]||gc;return t.isThemeGetter=!0,t},qs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,bc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,vc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rt=e=>bc.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),nt=e=>!!e&&Number.isInteger(Number(e)),Hr=e=>e.endsWith("%")&&ue(e.slice(0,-1)),Je=e=>vc.test(e),Ks=()=>!0,Nc=e=>yc.test(e)&&!xc.test(e),Gn=()=>!1,Sc=e=>wc.test(e),Cc=e=>kc.test(e),Mc=e=>!G(e)&&!Q(e),Ec=e=>lt(e,Xs,Gn),G=e=>qs.test(e),pt=e=>lt(e,Js,Nc),vo=e=>lt(e,Lc,ue),Ac=e=>lt(e,ta,Ks),Pc=e=>lt(e,ea,Gn),yo=e=>lt(e,Ys,Gn),Rc=e=>lt(e,Zs,Cc),sr=e=>lt(e,ra,Sc),Q=e=>Ws.test(e),Gt=e=>vt(e,Js),Ic=e=>vt(e,ea),xo=e=>vt(e,Ys),_c=e=>vt(e,Xs),Tc=e=>vt(e,Zs),ar=e=>vt(e,ra,!0),Dc=e=>vt(e,ta,!0),lt=(e,t,r)=>{const n=qs.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},vt=(e,t,r=!1)=>{const n=Ws.exec(e);return n?n[1]?t(n[1]):r:!1},Ys=e=>e==="position"||e==="percentage",Zs=e=>e==="image"||e==="url",Xs=e=>e==="length"||e==="size"||e==="bg-size",Js=e=>e==="length",Lc=e=>e==="number",ea=e=>e==="family-name",ta=e=>e==="number"||e==="weight",ra=e=>e==="shadow",Oc=()=>{const e=Re("color"),t=Re("font"),r=Re("text"),n=Re("font-weight"),s=Re("tracking"),a=Re("leading"),i=Re("breakpoint"),d=Re("container"),l=Re("spacing"),c=Re("radius"),u=Re("shadow"),p=Re("inset-shadow"),h=Re("text-shadow"),g=Re("drop-shadow"),b=Re("blur"),v=Re("perspective"),y=Re("aspect"),x=Re("ease"),w=Re("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...M(),Q,G],E=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],A=()=>[Q,G,l],F=()=>[rt,"full","auto",...A()],Y=()=>[nt,"none","subgrid",Q,G],ce=()=>["auto",{span:["full",nt,Q,G]},nt,Q,G],ge=()=>[nt,"auto",Q,G],se=()=>["auto","min","max","fr",Q,G],ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],le=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...A()],H=()=>[rt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],ve=()=>[rt,"screen","full","dvw","lvw","svw","min","max","fit",...A()],me=()=>[rt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],T=()=>[e,Q,G],z=()=>[...M(),xo,yo,{position:[Q,G]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",_c,Ec,{size:[Q,G]}],V=()=>[Hr,Gt,pt],Z=()=>["","none","full",c,Q,G],X=()=>["",ue,Gt,pt],j=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[ue,Hr,xo,yo],Te=()=>["","none",b,Q,G],De=()=>["none",ue,Q,G],ee=()=>["none",ue,Q,G],he=()=>[ue,Q,G],we=()=>[rt,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Je],breakpoint:[Je],color:[Ks],container:[Je],"drop-shadow":[Je],ease:["in","out","in-out"],font:[Mc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Je],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Je],shadow:[Je],spacing:["px",ue],text:[Je],"text-shadow":[Je],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rt,G,Q,y]}],container:["container"],columns:[{columns:[ue,G,Q,d]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:F()}],"inset-x":[{"inset-x":F()}],"inset-y":[{"inset-y":F()}],start:[{"inset-s":F(),start:F()}],end:[{"inset-e":F(),end:F()}],"inset-bs":[{"inset-bs":F()}],"inset-be":[{"inset-be":F()}],top:[{top:F()}],right:[{right:F()}],bottom:[{bottom:F()}],left:[{left:F()}],visibility:["visible","invisible","collapse"],z:[{z:[nt,"auto",Q,G]}],basis:[{basis:[rt,"full","auto",d,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,rt,"auto","initial","none",G]}],grow:[{grow:["",ue,Q,G]}],shrink:[{shrink:["",ue,Q,G]}],order:[{order:[nt,"first","last","none",Q,G]}],"grid-cols":[{"grid-cols":Y()}],"col-start-end":[{col:ce()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":Y()}],"row-start-end":[{row:ce()}],"row-start":[{"row-start":ge()}],"row-end":[{"row-end":ge()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":se()}],"auto-rows":[{"auto-rows":se()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...ae(),"normal"]}],"justify-items":[{"justify-items":[...le(),"normal"]}],"justify-self":[{"justify-self":["auto",...le()]}],"align-content":[{content:["normal",...ae()]}],"align-items":[{items:[...le(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...le(),{baseline:["","last"]}]}],"place-content":[{"place-content":ae()}],"place-items":[{"place-items":[...le(),"baseline"]}],"place-self":[{"place-self":["auto",...le()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mbs:[{mbs:te()}],mbe:[{mbe:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...ve()]}],"min-inline-size":[{"min-inline":["auto",...ve()]}],"max-inline-size":[{"max-inline":["none",...ve()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[d,"screen",...H()]}],"min-w":[{"min-w":[d,"screen","none",...H()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,Gt,pt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Dc,Ac]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hr,G]}],"font-family":[{font:[Ic,Pc,t]}],"font-features":[{"font-features":[G]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Q,G]}],"line-clamp":[{"line-clamp":[ue,"none",Q,vo]}],leading:[{leading:[a,...A()]}],"list-image":[{"list-image":["none",Q,G]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,G]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...j(),"wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",Q,pt]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[ue,"auto",Q,G]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,G]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,G]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},nt,Q,G],radial:["",Q,G],conic:[nt,Q,G]},Tc,Rc]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:X()}],"border-w-x":[{"border-x":X()}],"border-w-y":[{"border-y":X()}],"border-w-s":[{"border-s":X()}],"border-w-e":[{"border-e":X()}],"border-w-bs":[{"border-bs":X()}],"border-w-be":[{"border-be":X()}],"border-w-t":[{"border-t":X()}],"border-w-r":[{"border-r":X()}],"border-w-b":[{"border-b":X()}],"border-w-l":[{"border-l":X()}],"divide-x":[{"divide-x":X()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":X()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...j(),"hidden","none"]}],"divide-style":[{divide:[...j(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...j(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ue,Q,G]}],"outline-w":[{outline:["",ue,Gt,pt]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",u,ar,sr]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",p,ar,sr]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[ue,pt]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":X()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,ar,sr]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[ue,Q,G]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[Q,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,G]}],filter:[{filter:["","none",Q,G]}],blur:[{blur:Te()}],brightness:[{brightness:[ue,Q,G]}],contrast:[{contrast:[ue,Q,G]}],"drop-shadow":[{"drop-shadow":["","none",g,ar,sr]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",ue,Q,G]}],"hue-rotate":[{"hue-rotate":[ue,Q,G]}],invert:[{invert:["",ue,Q,G]}],saturate:[{saturate:[ue,Q,G]}],sepia:[{sepia:["",ue,Q,G]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,G]}],"backdrop-blur":[{"backdrop-blur":Te()}],"backdrop-brightness":[{"backdrop-brightness":[ue,Q,G]}],"backdrop-contrast":[{"backdrop-contrast":[ue,Q,G]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,Q,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,Q,G]}],"backdrop-invert":[{"backdrop-invert":["",ue,Q,G]}],"backdrop-opacity":[{"backdrop-opacity":[ue,Q,G]}],"backdrop-saturate":[{"backdrop-saturate":[ue,Q,G]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,Q,G]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,G]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",Q,G]}],ease:[{ease:["linear","initial",x,Q,G]}],delay:[{delay:[ue,Q,G]}],animate:[{animate:["none",w,Q,G]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,G]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:De()}],"rotate-x":[{"rotate-x":De()}],"rotate-y":[{"rotate-y":De()}],"rotate-z":[{"rotate-z":De()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[Q,G,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,G]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,G]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[ue,Gt,pt,vo]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$c=hc(Oc);function N(...e){return $c(Qs(e))}var Qb="rounded-lg border border-border bg-surface overflow-hidden",jb="border-b border-border px-3 sm:px-4 py-1.5 sm:py-2",Ub="p-2 sm:p-3 lg:p-4",Hb="space-y-3 sm:space-y-4",Vb="gap-2 sm:gap-3",qb="px-3 sm:px-4 py-1.5 sm:py-2",Wb="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4",Kb="grid grid-cols-1 lg:grid-cols-2",Yb="flex flex-col-reverse md:flex-row",Zb="w-full md:w-44 lg:w-52 md:flex-shrink-0 border-b md:border-b-0 md:border-l border-border",Xb="text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider",Jb="text-[11px] sm:text-xs text-foreground",ev="text-[10px] text-foreground-subtle",tv="text-[11px] sm:text-xs font-medium text-foreground",rv="text-base sm:text-lg font-semibold leading-tight text-foreground",nv="inline-flex items-center justify-center gap-1 rounded border border-border bg-surface px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40",ov="inline-flex items-center justify-center gap-1 rounded border border-primary/40 bg-primary/15 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-primary hover:bg-primary/25 transition-colors disabled:opacity-40",sv="inline-flex items-center justify-center gap-1 rounded border border-danger/40 bg-danger/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-danger hover:bg-danger/20 transition-colors disabled:opacity-40",av="inline-flex items-center justify-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-warning hover:bg-warning/20 transition-colors disabled:opacity-40",iv="w-full rounded border border-border bg-background px-1.5 py-0.5 sm:px-2 sm:py-1 text-[11px] sm:text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none",lv="inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors",cv="border-primary/50 bg-primary/15 text-primary",dv="border-border bg-surface text-foreground-subtle hover:bg-surface-hover";function Bc(e,t){for(const r of e.slots)for(const n of r.addons)if(n.id===t)return n;return null}function zc(e,t){return e.models.find(r=>r.id===t)??null}function Fc(e,t){return e.models.find(r=>!!r.formats[t])??null}function Gc(e,t){const r=new Set((t.configSchema??[]).map(s=>s.key)),n={};for(const[s,a]of Object.entries(e))r.has(s)&&(n[s]=a);return n}function uv(e){const{source:t,target:r,catalog:n,addonIds:s}=e,a=[];for(const i of s){const d=t.defaults[i];if(!d){a.push({addonId:i,outcome:"skip",modelId:null,reason:"no source entry",patch:null});continue}const l=Bc(n,i);if(!l){a.push({addonId:i,outcome:"skip",modelId:null,reason:"addon not in target catalog",patch:null});continue}const c=zc(l,d.modelId),u=c!==null&&!!c.formats[r.engine.format];let p,h;if(u)p=d.modelId,h="exact";else{const b=Fc(l,r.engine.format);if(!b){a.push({addonId:i,outcome:"skip",modelId:null,reason:"no compatible model for target format",patch:null});continue}p=b.id,h="mapped"}const g={enabled:d.enabled,modelId:p,settings:Gc(d.settings,l)};a.push({addonId:i,outcome:h,modelId:p,patch:g})}return a}var wo={idle:{label:"Idle",textColor:"text-foreground-subtle",badgeClass:"border-border bg-surface-hover text-foreground-subtle",dotClass:"bg-gray-400",icon:"PowerOff"},active:{label:"Active",textColor:"text-success",badgeClass:"border-success/40 bg-success/10 text-success",dotClass:"bg-red-500 animate-pulse",icon:"Activity"},watching:{label:"Watching",textColor:"text-foreground-subtle",badgeClass:"border-border bg-surface-hover text-foreground-subtle",dotClass:"bg-emerald-500",icon:"Eye"},"load-shed":{label:"Load-Shed",textColor:"text-amber-500",badgeClass:"border-amber-500/40 bg-amber-500/10 text-amber-500",dotClass:"bg-amber-500",icon:"AlertTriangle"},paused:{label:"Paused",textColor:"text-gray-400",badgeClass:"border-gray-500/40 bg-gray-500/10 text-gray-400",dotClass:"bg-gray-400",icon:"PauseCircle"}};function na(e){return wo[e]??wo.watching}function ct(e,t){if(typeof globalThis>"u")return et(t);const r=globalThis.__camstackSharedContexts,n=r??new Map;r||(globalThis.__camstackSharedContexts=n);const s=n.get(e);if(s)return s;const a=et(t);return n.set(e,a),a}var Qc="FEDERATION_DEBUG",hn=(function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e})({}),oa=!0;function jc(){return oa}function Uc(){try{if(jc()&&window.localStorage)return!!localStorage.getItem(Qc)}catch{return!1}return!1}function gn(){return typeof process<"u"&&Ur&&Ur.FEDERATION_DEBUG?!!Ur.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:Uc()}var Hc="[ Federation Runtime ]",sa=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}:${r}`:r:t,""):""},bn=(e,t)=>{if("getPublicPath"in e){let r;return e.getPublicPath.startsWith("function")?r=new Function("return "+e.getPublicPath)()():r=new Function(e.getPublicPath)(),`${r}${t}`}else return"publicPath"in e?`${e.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},aa=e=>{console.warn(`${Hc}: ${e}`)};function ia(e){try{return JSON.stringify(e,null,2)}catch{return""}}var Vr=(e,t)=>{if(!e)return t;const n=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const a=s.slice(1);return a.endsWith("/")?a.slice(0,-1):a}return s})(e);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function Vc(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function qc(e,t={}){const{remotes:r={},overrides:n={},version:s}=t;let a;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&s?Vc(s):e.metaData.publicPath:e.metaData.getPublicPath,d=Object.keys(n);let l={};Object.keys(r).length||(l=e.remotes?.reduce((w,k)=>{let M;const S=k.federationContainerName;return d.includes(S)?M=n[S]:"version"in k?M=k.version:M=k.entry,w[S]={matchedVersion:M},w},{})||{}),Object.keys(r).forEach(w=>l[w]={matchedVersion:d.includes(w)?n[w]:r[w]});const{remoteEntry:{path:c,name:u,type:p},types:h={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:g},globalName:b,ssrRemoteEntry:v}=e.metaData,{exposes:y}=e;let x={version:s||"",buildVersion:g,globalName:b,remoteEntry:Vr(c,u),remoteEntryType:p,remoteTypes:Vr(h.path,h.name),remoteTypesZip:h.zip||"",remoteTypesAPI:h.api||"",remotesInfo:l,shared:e?.shared.map(w=>({assets:w.assets,sharedName:w.name,version:w.version,usedExports:w.referenceExports||[]})),modules:y?.map(w=>({moduleName:w.name,modulePath:w.path,assets:w.assets}))};if("publicPath"in e.metaData?(a={...x,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(a.ssrPublicPath=e.metaData.ssrPublicPath)):a={...x,getPublicPath:i()},v){const w=Vr(v.path,v.name);a.ssrRemoteEntry=w,a.ssrRemoteEntryType=v.type||"commonjs-module"}return a}function la(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(".json"))}var Wc="[ Module Federation ]",Qt=console,Kc=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function Yc(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
|
|
31
|
-
`),r=t.filter(n=>!Kc.some(s=>n.includes(s)));return r.length?`Stack trace:
|
|
32
|
-
${r.slice(0,5).join(`
|
|
33
|
-
`)}`:void 0}catch{return}}var ca=class{constructor(e,t=Qt){this.prefix=e,this.delegate=t??Qt}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??Qt}emit(e,t){const r=this.delegate,n=gn()?Yc():void 0,s=n?[...t,n]:t,a=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(const i of a){const d=r[i];if(typeof d=="function"){d.call(r,this.prefix,...s);return}}for(const i of a){const d=Qt[i];if(typeof d=="function"){d.call(Qt,this.prefix,...s);return}}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){gn()&&this.emit("debug",e)}};function Zc(e){return new ca(e)}function Xc(e){const t=new ca(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Xc(Wc);async function da(e,t){try{return await e()}catch(r){aa(r);return}}function vn(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function ua(e){let t=null,r=!0,n=2e4,s;const a=document.getElementsByTagName("script");for(let c=0;c<a.length;c++){const u=a[c],p=u.getAttribute("src");if(p&&vn(p,e.url)){t=u,r=!1;break}}if(!t){const c=e.attrs;t=document.createElement("script"),t.type=c?.type==="module"?"module":"text/javascript";let u;e.createScriptHook&&(u=e.createScriptHook(e.url,e.attrs),u instanceof HTMLScriptElement?t=u:typeof u=="object"&&("script"in u&&u.script&&(t=u.script),"timeout"in u&&u.timeout&&(n=u.timeout))),t.src||(t.src=e.url),c&&!u&&Object.keys(c).forEach(p=>{t&&(p==="async"||p==="defer"?t[p]=c[p]:t.getAttribute(p)||t.setAttribute(p,c[p]))})}let i=null;const d=typeof window<"u"?c=>{if(c.filename&&vn(c.filename,e.url)){const u=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${c.message} (${c.filename}:${c.lineno}:${c.colno})`);u.name="ScriptExecutionError",i=u}}:null;d&&window.addEventListener("error",d);const l=async(c,u)=>{clearTimeout(s),d&&window.removeEventListener("error",d);const p=()=>{if(u?.type==="error"){const h=new Error(u?.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);h.name="ScriptNetworkError",e?.onErrorCallback&&e?.onErrorCallback(h)}else i?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,da(()=>{const{needDeleteScript:h=!0}=e;h&&t?.parentNode&&t.parentNode.removeChild(t)}),c&&typeof c=="function")){const h=c(u);if(h instanceof Promise){const g=await h;return p(),g}return p(),h}p()};return t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),s=setTimeout(()=>{l(null,{type:"error",isTimeout:!0})},n),{script:t,needAttach:r}}function qr(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let a=0;a<n.length;a++){const i=n[a],d=i.getAttribute("href"),l=i.getAttribute("rel");if(d&&vn(d,e.url)&&l===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let a;const i=e.attrs;e.createLinkHook&&(a=e.createLinkHook(e.url,i),a instanceof HTMLLinkElement&&(t=a)),i&&!a&&Object.keys(i).forEach(d=>{t&&!t.getAttribute(d)&&t.setAttribute(d,i[d])})}const s=(a,i)=>{const d=()=>{i?.type==="error"?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,da(()=>{const{needDeleteLink:l=!0}=e;l&&t?.parentNode&&t.parentNode.removeChild(t)}),a)){const l=a(i);return d(),l}d()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:r}}function Jc(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((s,a)=>{const{script:i,needAttach:d}=ua({url:e,cb:s,onErrorCallback:a,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});d&&document.head.appendChild(i)})}var ed=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,pa=(e,t,r,n)=>{const s=[`${[t[e]]} #${e}`];return r&&s.push(`args: ${JSON.stringify(r)}`),s.push(ed(e)),n&&s.push(`Original Error Message:
|
|
34
|
-
${n}`),s.join(`
|
|
35
|
-
`)};function td(e,t,r,n,s,a){return n(pa(e,t,r,s))}var ft="[ Federation Runtime ]",yn=Zc(ft);function Be(e,t,r,n,s){e||(r!==void 0?Me(t,r,n,void 0):Me(t))}function Me(e,t,r,n,s){if(t!==void 0)return td(e,t,r??{},i=>{throw new Error(`${ft}: ${i}`)},n);const a=e;throw a instanceof Error?(a.message.startsWith(ft)||(a.message=`${ft}: ${a.message}`),a):new Error(`${ft}: ${a}`)}function Qn(e){e instanceof Error&&(e.message.startsWith(ft)||(e.message=`${ft}: ${e.message}`)),yn.warn(e)}function rd(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function qt(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function jn(e){return typeof e.entry<"u"}function fa(e){return!e.entry.includes(".json")}function Un(e){return e&&typeof e=="object"}var nd=Object.prototype.toString;function od(e){return nd.call(e)==="[object Object]"}function ma(e){return Array.isArray(e)?e:[e]}function ha(e){const t={url:"",type:"global",globalName:""};return"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t}var sd=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},Pe=typeof globalThis=="object"?globalThis:window,He=(()=>{try{return document.defaultView}catch{return Pe}})(),Wt=He;function br(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function vr(e,t){return Object.hasOwnProperty.call(e,t)}vr(Pe,"__GLOBAL_LOADING_REMOTE_ENTRY__")||br(Pe,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});var Mt=Pe.__GLOBAL_LOADING_REMOTE_ENTRY__;function ga(e){vr(e,"__VMOK__")&&!vr(e,"__FEDERATION__")&&br(e,"__FEDERATION__",e.__VMOK__),vr(e,"__FEDERATION__")||(br(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),br(e,"__VMOK__",e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map}ga(Pe);ga(He);function ad(e){Pe.__FEDERATION__.__INSTANCES__.push(e)}function id(){return Pe.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function ld(e,t=gn()){t&&(Pe.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,Pe.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.4.0")}function Tt(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[s,a]=n.split(":"),i=`${s}:${t}`,d=e[i];if(d)return{value:d,key:i}}return{value:void 0,key:t}}}else Me(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var ko=()=>He.__FEDERATION__.moduleInfo,cd=(e,t)=>{const r=Tt(t,qt(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:n,...s}=e,a=qt(s),i=Tt(He.__FEDERATION__.moduleInfo,a).value;if(i?.version===n)return i}},yr=e=>cd(e,He.__FEDERATION__.moduleInfo),No=(e,t)=>{const r=qt(e);return He.__FEDERATION__.moduleInfo[r]=t,He.__FEDERATION__.moduleInfo},dd=e=>(He.__FEDERATION__.moduleInfo={...He.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete He.__FEDERATION__.moduleInfo[r]}),ba=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:Pe[r]}},ud=()=>He.__FEDERATION__.__GLOBAL_PLUGIN__,pd=e=>Pe.__FEDERATION__.__PRELOADED_MAP__.get(e),fd=e=>Pe.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),So="[0-9A-Za-z-]+",Hn=`(?:\\+(${So}(?:\\.${So})*))`,Ut="0|[1-9]\\d*",xr="[0-9]+",va="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Co=`(?:${xr}|${va})`,md=`(?:-?(${Co}(?:\\.${Co})*))`,Mo=`(?:${Ut}|${va})`,ya=`(?:-(${Mo}(?:\\.${Mo})*))`,Wr=`${Ut}|x|X|\\*`,Dt=`[v=\\s]*(${Wr})(?:\\.(${Wr})(?:\\.(${Wr})(?:${ya})?${Hn}?)?)?`,hd=`^\\s*(${Dt})\\s+-\\s+(${Dt})\\s*$`,gd=`[v=\\s]*${`(${xr})\\.(${xr})\\.(${xr})`}${md}?${Hn}?`,Vn="((?:<|>)?=?)",bd=`(\\s*)${Vn}\\s*(${gd}|${Dt})`,xa="(?:~>?)",vd=`(\\s*)${xa}\\s+`,wa="(?:\\^)",yd=`(\\s*)${wa}\\s+`,xd="(<|>)?=?\\s*\\*",wd=`^${wa}${Dt}$`,kd=`v?${`(${Ut})\\.(${Ut})\\.(${Ut})`}${ya}?${Hn}?`,Nd=`^${xa}${Dt}$`,Sd=`^${Vn}\\s*${Dt}$`,Cd=`^${Vn}\\s*(${kd})$|^$`,Md="^\\s*>=\\s*0.0.0\\s*$";function Ze(e){return new RegExp(e)}function Le(e){return!e||e.toLowerCase()==="x"||e==="*"}function ka(...e){return t=>e.reduce((r,n)=>n(r),t)}function Eo(e){return e.match(Ze(Cd))}function Ao(e,t,r,n){const s=`${e}.${t}.${r}`;return n?`${s}-${n}`:s}function Ed(e){return e.replace(Ze(hd),(t,r,n,s,a,i,d,l,c,u,p,h)=>(Le(n)?r="":Le(s)?r=`>=${n}.0.0`:Le(a)?r=`>=${n}.${s}.0`:r=`>=${r}`,Le(c)?l="":Le(u)?l=`<${Number(c)+1}.0.0-0`:Le(p)?l=`<${c}.${Number(u)+1}.0-0`:h?l=`<=${c}.${u}.${p}-${h}`:l=`<=${l}`,`${r} ${l}`.trim()))}function Ad(e){return e.replace(Ze(bd),"$1$2$3")}function Pd(e){return e.replace(Ze(vd),"$1~")}function Rd(e){return e.replace(Ze(yd),"$1^")}function Id(e){return e.trim().split(/\s+/).map(t=>t.replace(Ze(wd),(r,n,s,a,i)=>Le(n)?"":Le(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:Le(a)?n==="0"?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?s==="0"?`>=${n}.${s}.${a}-${i} <${n}.${s}.${Number(a)+1}-0`:`>=${n}.${s}.${a}-${i} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${a}-${i} <${Number(n)+1}.0.0-0`:n==="0"?s==="0"?`>=${n}.${s}.${a} <${n}.${s}.${Number(a)+1}-0`:`>=${n}.${s}.${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${a} <${Number(n)+1}.0.0-0`)).join(" ")}function _d(e){return e.trim().split(/\s+/).map(t=>t.replace(Ze(Nd),(r,n,s,a,i)=>Le(n)?"":Le(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:Le(a)?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:i?`>=${n}.${s}.${a}-${i} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${a} <${n}.${Number(s)+1}.0-0`)).join(" ")}function Td(e){return e.split(/\s+/).map(t=>t.trim().replace(Ze(Sd),(r,n,s,a,i,d)=>{const l=Le(s),c=l||Le(a),u=c||Le(i);return n==="="&&u&&(n=""),d="",l?n===">"||n==="<"?"<0.0.0-0":"*":n&&u?(c&&(a=0),i=0,n===">"?(n=">=",c?(s=Number(s)+1,a=0,i=0):(a=Number(a)+1,i=0)):n==="<="&&(n="<",c?s=Number(s)+1:a=Number(a)+1),n==="<"&&(d="-0"),`${n+s}.${a}.${i}${d}`):c?`>=${s}.0.0${d} <${Number(s)+1}.0.0-0`:u?`>=${s}.${a}.0${d} <${s}.${Number(a)+1}.0-0`:r})).join(" ")}function Dd(e){return e.trim().replace(Ze(xd),"")}function Ld(e){return e.trim().replace(Ze(Md),"")}function wr(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function Od(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let s=0,a=r.length;s<=a;s++){const i=r[s],d=n[s];if(i!==d)return i===void 0&&d===void 0?0:i?d?wr(i,d):-1:1}return 0}function ir(e,t){return wr(e.major,t.major)||wr(e.minor,t.minor)||wr(e.patch,t.patch)||Od(e,t)}function Kr(e,t){return e.version===t.version}function $d(e,t){switch(e.operator){case"":case"=":return Kr(e,t);case">":return ir(e,t)<0;case">=":return Kr(e,t)||ir(e,t)<0;case"<":return ir(e,t)>0;case"<=":return Kr(e,t)||ir(e,t)>0;case void 0:return!0;default:return!1}}function Bd(e){return ka(Id,_d,Td,Dd)(e)}function zd(e){return ka(Ed,Ad,Pd,Rd)(e.trim()).split(/\s+/).join(" ")}function jt(e,t){if(!e)return!1;const r=Eo(e);if(!r)return!1;const[,n,,s,a,i,d]=r,l={operator:n,version:Ao(s,a,i,d),major:s,minor:a,patch:i,preRelease:d?.split(".")},c=t.split("||");for(const u of c){const p=u.trim();if(!p||p==="*"||p==="x")return!0;try{const h=zd(p);if(!h.trim())return!0;const g=h.split(" ").map(y=>Bd(y)).join(" ");if(!g.trim())return!0;const b=g.split(/\s+/).map(y=>Ld(y)).filter(Boolean);if(b.length===0)continue;let v=!0;for(const y of b){const x=Eo(y);if(!x){v=!1;break}const[,w,,k,M,S,E]=x;if(!$d({operator:w,version:Ao(k,M,S,E),major:k,minor:M,patch:S,preRelease:E?.split(".")},l)){v=!1;break}}if(v)return!0}catch(h){console.error(`[semver] Error processing range part "${p}":`,h);continue}}return!1}var Dr="default",Fd="global";function Gd(e,t,r,n){let s;return"get"in e?s=e.get:"lib"in e?s=()=>Promise.resolve(e.lib):s=()=>Promise.resolve(()=>{Me(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),e.shareConfig?.eager&&e.treeShaking?.mode&&Me(`Invalid shared config for "${r}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:s,loaded:e?.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??hn.UNKNOWN,useIn:[]}:void 0}}function Na(e,t){const r=t.shared||{},n=t.name,s=Object.keys(r).reduce((i,d)=>{const l=ma(r[d]);return i[d]=i[d]||[],l.forEach(c=>{i[d].push(Gd(c,n,d,t.shareStrategy))}),i},{}),a={...e.shared};return Object.keys(s).forEach(i=>{a[i]?s[i].forEach(d=>{a[i].find(l=>l.version===d.version)||a[i].push(d)}):a[i]=s[i]}),{allShareInfos:a,newShareInfos:s}}function Kt(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===hn.NO_USE?!1:r===hn.CALCULATED?!0:n==="runtime-infer"?t?jd(e,t):!0:!1}function mt(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const s=n.split(".");let a=n;for(let i=0;i<3-s.length;i++)a+=".0";return a}return n};return!!jt(r(e),`<=${r(t)}`)}var Yt=(e,t)=>{const r=t||function(n,s){return mt(n,s)};return Object.keys(e).reduce((n,s)=>!n||r(n,s)||n==="0"?s:n,0)},Mr=e=>!!e.loaded||typeof e.lib=="function",Qd=e=>!!e.loading,jd=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function Ud(e,t,r,n){const s=e[t][r];let a="",i=Kt(n);const d=function(l,c){return i?s[l].treeShaking?s[c].treeShaking?!Mr(s[l].treeShaking)&&mt(l,c):!1:!0:!Mr(s[l])&&mt(l,c)};if(i){if(a=Yt(e[t][r],d),a)return{version:a,useTreesShaking:i};i=!1}return{version:Yt(e[t][r],d),useTreesShaking:i}}var Nt=e=>Mr(e)||Qd(e);function Hd(e,t,r,n){const s=e[t][r];let a="",i=Kt(n);const d=function(l,c){if(i){if(!s[l].treeShaking)return!0;if(!s[c].treeShaking)return!1;if(Nt(s[c].treeShaking))return Nt(s[l].treeShaking)?!!mt(l,c):!0;if(Nt(s[l].treeShaking))return!1}return Nt(s[c])?Nt(s[l])?!!mt(l,c):!0:Nt(s[l])?!1:mt(l,c)};if(i){if(a=Yt(e[t][r],d),a)return{version:a,useTreesShaking:i};i=!1}return{version:Yt(e[t][r],d),useTreesShaking:i}}function Vd(e){return e==="loaded-first"?Hd:Ud}function kr(e,t,r,n){if(!e)return;const{shareConfig:s,scope:a=Dr,strategy:i,treeShaking:d}=r,l=Array.isArray(a)?a:[a];for(const c of l)if(s&&e[c]&&e[c][t]){const{requiredVersion:u}=s,{version:p,useTreesShaking:h}=Vd(i)(e,c,t,d),g=()=>{const v=e[c][t][p];if(s.singleton){if(typeof u=="string"&&!jt(p,u)){const y=`Version ${p} from ${p&&v.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;s.strictVersion?Me(y):Qn(y)}return{shared:v,useTreesShaking:h}}else{if(u===!1||u==="*")return{shared:v,useTreesShaking:h};if(jt(p,u))return{shared:v,useTreesShaking:h};const y=Kt(d);if(y){for(const[x,w]of Object.entries(e[c][t]))if(Kt(w.treeShaking,d?.usedExports)&&jt(x,u))return{shared:w,useTreesShaking:y}}for(const[x,w]of Object.entries(e[c][t]))if(jt(x,u))return{shared:w,useTreesShaking:!1}}},b={shareScopeMap:e,scope:c,pkgName:t,version:p,GlobalFederation:Wt.__FEDERATION__,shareInfo:r,resolver:g};return(n.emit(b)||b).resolver()}}function Sa(){return Wt.__FEDERATION__.__SHARE__}function Po(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,s=l=>{if(!l)return;const c={};return l.forEach(p=>{c[p.version]=p}),c[Yt(c,function(p,h){return!Mr(c[p])&&mt(p,h)})]},a=r?.resolver??s,i=l=>l!==null&&typeof l=="object"&&!Array.isArray(l),d=(...l)=>{const c={};for(const u of l)if(u)for(const[p,h]of Object.entries(u)){const g=c[p];i(g)&&i(h)?c[p]=d(g,h):h!==void 0&&(c[p]=h)}return c};return d(a(n[t]),r?.customShareInfo)}var St=(e,t)=>{e.useIn||(e.useIn=[]),rd(e.useIn,t)};function lr(e,t){return t&&e.treeShaking?e.treeShaking:e}function qd(e,t){for(const r of e){const n=t.startsWith(r.name);let s=t.replace(r.name,"");if(n){if(s.startsWith("/")){const d=r.name;return s=`.${s}`,{pkgNameOrAlias:d,expose:s,remote:r}}else if(s==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const a=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&a){if(i&&i.startsWith("/")){const d=r.alias;return i=`.${i}`,{pkgNameOrAlias:d,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function Wd(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}var Ca="RUNTIME-001",Ma="RUNTIME-002",Ea="RUNTIME-003",Aa="RUNTIME-004",Pa="RUNTIME-005",xn="RUNTIME-006",Ra="RUNTIME-007",Ia="RUNTIME-008",qn="RUNTIME-009",_a="RUNTIME-010",Ta="RUNTIME-011",Kd="RUNTIME-012",ze={[Ca]:"Failed to get remoteEntry exports.",[Ma]:'The remote entry interface does not contain "init"',[Ea]:"Failed to get manifest.",[Aa]:"Failed to locate remote.",[Pa]:"Invalid loadShareSync function call from bundler runtime",[xn]:"Invalid loadShareSync function call from runtime",[Ra]:"Failed to get remote snapshot.",[Ia]:"Failed to load script resources.",[qn]:"Please call createInstance first.",[_a]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[Ta]:"The remoteEntry URL is missing from the remote snapshot.",[Kd]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'};({...ze});var Da=".then(callbacks[0]).catch(callbacks[1])";async function Yd({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${Da}`)([r,n]):import(e).then(r).catch(n)}catch(s){Me(`Failed to load ESM entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}async function Zd({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${Da}`)([r,n])}catch(s){Me(`Failed to load SystemJS entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}function Xd(e,t,r){const{remoteEntryKey:n,entryExports:s}=ba(e,t);return s||Me(Ca,ze,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),s}async function Jd({name:e,globalName:t,entry:r,remoteInfo:n,loaderHook:s,getEntryUrl:a}){const{entryExports:i}=ba(e,t);if(i)return i;const d=a?a(r):r;return Jc(d,{attrs:{},createScriptHook:(l,c)=>{const u=s.lifecycle.createScript.emit({url:l,attrs:c,remoteInfo:n});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>Xd(e,t,r),l=>{const c=l instanceof Error?l.message:String(l);Me(Ia,ze,{remoteName:e,resourceUrl:d},c)})}async function eu({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:s,entryGlobalName:a,name:i,type:d}=e;switch(d){case"esm":case"module":return Yd({entry:s,remoteEntryExports:t});case"system":return Zd({entry:s,remoteEntryExports:t});default:return Jd({entry:s,globalName:a,name:i,remoteInfo:e,loaderHook:r,getEntryUrl:n})}}function wn(e){const{entry:t,name:r}=e;return sa(r,t)}async function Er(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:s,_inErrorHandling:a=!1}=e,i=wn(n);if(r)return r;if(!Mt[i]){const d=t.remoteHandler.hooks.lifecycle.loadEntry,l=t.loaderHook;Mt[i]=d.emit({loaderHook:l,remoteInfo:n,remoteEntryExports:r}).then(c=>c||eu({remoteInfo:n,remoteEntryExports:r,loaderHook:l,getEntryUrl:s})).catch(async c=>{const u=wn(n),p=c instanceof Error&&c.message.includes("ScriptExecutionError");if(c instanceof Error&&c.message.includes("RUNTIME-008")&&!p&&!a){const h=b=>Er({...b,_inErrorHandling:!0}),g=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:Mt,uniqueKey:u});if(g)return g}throw c})}return Mt[i]}function Ar(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||"global",entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||"default"}}function tu(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function ru(e,t){const r=ud(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(s=>{e?.find(a=>a.name!==s.name)&&e.push(s)}),e&&e.length>0&&e.forEach(s=>{n.forEach(a=>{a.applyPlugin(s,t)})}),e}function nu(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function Lt(e){const t={};for(const[r,n]of Object.entries(e.shared)){const s=n[0];s&&(t[r]={version:s.version,singleton:s.shareConfig?.singleton,requiredVersion:s.shareConfig?.requiredVersion===!1?!1:s.shareConfig?.requiredVersion,eager:s.eager,strictVersion:s.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?"host":"unknown"},mfConfig:{name:e.name,remotes:e.remotes?.map(nu)??[],shared:t}}}function La(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function ou(e,t){return t.map(r=>{const n=Wd(e,r.nameOrAlias);return Be(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&ia({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:La(r)}})}function su(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function Oa(e,t,r,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:a,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(d=>{const{moduleInfo:l}=d,c=t.moduleCache.get(e.name);Er(c?{origin:t,remoteInfo:l,remoteEntryExports:c.remoteEntryExports}:{origin:t,remoteInfo:l,remoteEntryExports:void 0})}),n){const d={rel:"preload",as:"style"};s.forEach(l=>{const{link:c,needAttach:u}=qr({url:l,cb:()=>{},attrs:d,createLinkHook:(p,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:p,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g}});u&&document.head.appendChild(c)})}else{const d={rel:"stylesheet",type:"text/css"};s.forEach(l=>{const{link:c,needAttach:u}=qr({url:l,cb:()=>{},attrs:d,createLinkHook:(p,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:p,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g},needDeleteLink:!1});u&&document.head.appendChild(c)})}if(n){const d={rel:"preload",as:"script"};a.forEach(l=>{const{link:c,needAttach:u}=qr({url:l,cb:()=>{},attrs:d,createLinkHook:(p,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:p,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g}});u&&document.head.appendChild(c)})}else{const d={fetchpriority:"high",type:e?.type==="module"?"module":"text/javascript"};a.forEach(l=>{const{script:c,needAttach:u}=ua({url:l,cb:()=>{},attrs:d,createScriptHook:(p,h)=>{const g=t.loaderHook.lifecycle.createScript.emit({url:p,attrs:h,remoteInfo:e});if(g instanceof HTMLScriptElement)return g},needDeleteScript:!0});u&&document.head.appendChild(c)})}}}function au(e,t,r){const n=t,s=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];s.length||s.push("default"),s.forEach(i=>{n[i]||(n[i]={})});const a={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?s:e.shareScope||"default"};return Object.defineProperty(a,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:a,shareScope:n[s[0]],initScope:r??[]}}var $a=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await Er({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return Be(e,`remoteEntryExports is undefined
|
|
36
|
-
${ia(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:s,shareScope:a,initScope:i}=au(this.remoteInfo,this.host.shareScopeMap,r),d=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:a,remoteEntryInitOptions:s,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof n?.init>"u"&&Me(Ma,ze,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,Lt(this.host.options)),await n.init(d.shareScope,d.initScope,d.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...d,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:s=!0}=r||{loadFactory:!0},a=await this.init(e,n);this.lib=a;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:t,moduleInfo:this.remoteInfo}),i||(i=await a.get(t)),Be(i,`${qt(this.remoteInfo)} remote don't export ${t}.`);const d=sd(this.remoteInfo.name,t),l=this.wraperFactory(i,d);return s?await l():l}wraperFactory(e,t){function r(n,s){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:s,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},Fe=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},je=class extends Fe{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const s=a=>a===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(s):a;t=s()}return Promise.resolve(t)}};function Ba(e,t){if(!Un(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var Pt=class extends Fe{constructor(e){super(),this.onerror=Me,this.type=e}emit(e){Un(e)||Me(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(Ba(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Qn(r),this.onerror(r)}return e}},st=class extends Fe{constructor(e){super(),this.onerror=Me,this.type=e}emit(e){Un(e)||Me(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const n=a=>(Qn(a),this.onerror(a),e),s=a=>{if(Ba(e,a)){if(e=a,r<t.length)try{return Promise.resolve(t[r++](e)).then(s,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(s(e))}return Promise.resolve(e)}},Rt=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){Be(od(e),"Plugin configuration is invalid.");const r=e.name;Be(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,e.apply?.(t),Object.keys(this.lifecycle).forEach(n=>{const s=e[n];s&&this.lifecycle[n].on(s)}))}removePlugin(e){Be(e,"A name is required.");const t=this.registerPlugins[e];Be(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function za(e,t){const r=ha(t);r.url||Me(Ta,ze,{remoteName:e.name});let n=bn(t,r.url);e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function iu(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:s,remoteInfo:a,id:i}=e;if(!jn(t)||!fa(t)){const{remoteSnapshot:d,globalSnapshot:l}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});za(a,d);const c={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:c,remoteInfo:a,remote:t,remoteSnapshot:d,globalSnapshot:l});return u&&Oa(a,s,u,!1),{...e,remoteSnapshot:d}}return e}}}function lu(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function Fa(e,t,r,n,s={},a){const{value:i}=Tt(e,qt(t)),d=a||i;if(d&&!la(d)&&(r(d,t,n),d.remotesInfo)){const l=Object.keys(d.remotesInfo);for(const c of l){if(s[c])continue;s[c]=!0;const u=lu(c),p=d.remotesInfo[c];Fa(e,{name:u.name,version:p.matchedVersion},r,!1,s,void 0)}}}var Yr=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function cu(e,t,r,n,s){const a=[],i=[],d=[],l=new Set,c=new Set,{options:u}=e,{preloadConfig:p}=t,{depsRemote:h}=p;if(Fa(n,r,(b,v,y)=>{let x;if(y)x=p;else if(Array.isArray(h)){const E=h.find(I=>I.nameOrAlias===v.name||I.nameOrAlias===v.alias);if(!E)return;x=La(E)}else if(h===!0)x=p;else return;const w=bn(b,ha(b).url);w&&d.push({name:v.name,moduleInfo:{name:v.name,entry:w,type:"remoteEntryType"in b?b.remoteEntryType:"global",entryGlobalName:"globalName"in b?b.globalName:v.name,shareScope:"",version:"version"in b?b.version:void 0},url:w});let k="modules"in b?b.modules:[];const M=su(x.exposes);M.length&&"modules"in b&&(k=b?.modules?.reduce((E,I)=>(M?.indexOf(I.moduleName)!==-1&&E.push(I),E),[]));function S(E){const I=E.map(A=>bn(b,A));return x.filter?I.filter(x.filter):I}if(k){const E=k.length;for(let I=0;I<E;I++){const A=k[I],F=`${v.name}/${A.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:A.moduleName==="."?v.name:F,name:v.name,remoteSnapshot:b,preloadConfig:x,remote:v,origin:e}),!pd(F)&&(x.resourceCategory==="all"?(a.push(...S(A.assets.css.async)),a.push(...S(A.assets.css.sync)),i.push(...S(A.assets.js.async)),i.push(...S(A.assets.js.sync))):x.resourceCategory==="sync"&&(a.push(...S(A.assets.css.sync)),i.push(...S(A.assets.js.sync))),fd(F))}}},!0,{},s),s.shared&&s.shared.length>0){const b=(v,y)=>{const{shared:x}=kr(e.shareScopeMap,y.sharedName,v,e.sharedHandler.hooks.lifecycle.resolveShare)||{};x&&typeof x.lib=="function"&&(y.assets.js.sync.forEach(w=>{l.add(w)}),y.assets.css.sync.forEach(w=>{c.add(w)}))};s.shared.forEach(v=>{const y=u.shared?.[v.sharedName];if(!y)return;const x=v.version?y.find(w=>w.version===v.version):y;x&&ma(x).forEach(w=>{b(w,v)})})}const g=i.filter(b=>!l.has(b)&&!Yr("script",b));return{cssAssets:a.filter(b=>!c.has(b)&&!Yr("link",b)),jsAssetsWithoutEntry:g,entryAssets:d.filter(b=>!Yr("script",b.url))}}var du=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:s,globalSnapshot:a,remoteSnapshot:i}=e;return jn(s)&&fa(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(za(n,i),cu(t,r,n,a,i))}}};function Ga(e,t){const r=yr({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&Tt(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:ko(),remoteSnapshot:yr({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:ko(),remoteSnapshot:yr({name:e.name,version:"version"in e?e.version:void 0})}}var uu=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new Rt({beforeLoadRemoteSnapshot:new je("beforeLoadRemoteSnapshot"),loadSnapshot:new st("loadGlobalSnapshot"),loadRemoteSnapshot:new st("loadRemoteSnapshot"),afterLoadSnapshot:new st("afterLoadSnapshot")}),this.manifestLoading=Wt.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let s=yr({name:this.HostInstance.options.name,version:this.HostInstance.options.version});s||(s={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},dd({[this.HostInstance.options.name]:s})),s&&"remotesInfo"in s&&!Tt(s.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(s.remotesInfo={...s?.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:a,remoteSnapshot:i,globalSnapshot:d}=this.getGlobalRemoteInfo(e),{remoteSnapshot:l,globalSnapshot:c}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:a,remoteSnapshot:i,globalSnapshot:d});let u,p;if(l)if(la(l)){const h=l.remoteEntry,g=await this.getManifestJson(h,e,{}),b=No({...e,entry:h},g);u=g,p=b}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:l,from:"global"});u=h,p=c}else if(jn(e)){const h=await this.getManifestJson(e.entry,e,{}),g=No(e,h),{remoteSnapshot:b}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:h,from:"global"});u=b,p=g}else Me(Ra,ze,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(c)},void 0,Lt(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:p}}getGlobalRemoteInfo(e){return Ga(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let a=this.manifestCache.get(e);if(a)return a;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{},Ar(t));(!i||!(i instanceof Response))&&(i=await fetch(e,{})),a=await i.json()}catch(i){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),a||(delete this.manifestLoading[e],Me(Ea,ze,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,Lt(this.HostInstance.options)))}return Be(a.metaData&&a.exposes&&a.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!a.metaData&&"metaData",!a.exposes&&"exposes",!a.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,a),a},s=async()=>{const a=await n(),i=qc(a,{version:e}),{remoteSnapshot:d}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:a,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return d};return this.manifestLoading[e]||(this.manifestLoading[e]=s().then(a=>a)),this.manifestLoading[e]}},pu=class{constructor(e){this.hooks=new Rt({beforeRegisterShare:new Pt("beforeRegisterShare"),afterResolve:new st("afterResolve"),beforeLoadShare:new st("beforeLoadShare"),loadShare:new je,resolveShare:new Pt("resolveShare"),initContainerShareScopeMap:new Pt("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=Na(e,t);return Object.keys(r).forEach(s=>{r[s].forEach(a=>{a.scope.forEach(i=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:s,shared:a}),this.shareScopeMap[i]?.[s]||this.setShared({pkgName:s,lib:a.lib,get:a.get,loaded:a.loaded||!!a.lib,shared:a,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=Po({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n?.scope&&await Promise.all(n.scope.map(async d=>{await Promise.all(this.initializeSharing(d,{strategy:n.strategy}))}));const{shareInfo:s}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});Be(s,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);const{shared:a,useTreesShaking:i}=kr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(a){const d=lr(a,i);if(d.lib)return St(d,r.options.name),d.lib;if(d.loading&&!d.loaded){const l=await d.loading;return d.loaded=!0,d.lib||(d.lib=l),St(d,r.options.name),l}else{const c=(async()=>{const u=await d.get();return St(d,r.options.name),d.loaded=!0,d.lib=u,u})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:c,treeShaking:i?d:void 0}),c}}else{if(t?.customShareInfo)return!1;const d=Kt(s.treeShaking),l=lr(s,d),u=(async()=>{const p=await l.get();l.lib=p,l.loaded=!0,St(l,r.options.name);const{shared:h,useTreesShaking:g}=kr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(h){const b=lr(h,g);b.lib=p,b.loaded=!0,h.from=s.from}return p})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:u,treeShaking:d?l:void 0}),u}}initializeSharing(e=Dr,t){const{host:r}=this,n=t?.from,s=t?.strategy;let a=t?.initScope;const i=[];if(n!=="build"){const{initTokens:h}=this;a||(a=[]);let g=h[e];if(g||(g=h[e]={from:this.host.name}),a.indexOf(g)>=0)return i;a.push(g)}const d=this.shareScopeMap,l=r.options.name;d[e]||(d[e]={});const c=d[e],u=(h,g)=>{const{version:b,eager:v}=g;c[h]=c[h]||{};const y=c[h],x=y[b]&&lr(y[b]),w=!!(x&&("eager"in x&&x.eager||"shareConfig"in x&&x.shareConfig?.eager));(!x||x.strategy!=="loaded-first"&&!x.loaded&&(!v!=!w?v:l>y[b].from))&&(y[b]=g)},p=async h=>{const{module:g}=await r.remoteHandler.getRemoteModuleAndOptions({id:h});let b;try{b=await g.getEntry()}catch(v){if(b=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:h,error:v,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!b)return}finally{b?.init&&!g.initing&&(g.remoteEntryExports=b,await g.init(void 0,void 0,a))}};return Object.keys(r.options.shared).forEach(h=>{r.options.shared[h].forEach(g=>{g.scope.includes(e)&&u(h,g)})}),(r.options.shareStrategy==="version-first"||s==="version-first")&&r.options.remotes.forEach(h=>{h.shareScope===e&&i.push(p(h.name))}),i}loadShareSync(e,t){const{host:r}=this,n=Po({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n?.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:s,useTreesShaking:a}=kr(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(s){if(typeof s.lib=="function")return St(s,r.options.name),s.loaded||(s.loaded=!0,s.from===r.options.name&&(n.loaded=!0)),s.lib;if(typeof s.get=="function"){const i=s.get();if(!(i instanceof Promise))return St(s,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:s}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();return i instanceof Promise&&Me(t?.from==="build"?Pa:xn,ze,{hostName:r.options.name,sharedPkgName:e},void 0,Lt(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}Me(xn,ze,{hostName:r.options.name,sharedPkgName:e},void 0,Lt(r.options))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:s,loaded:a,get:i,treeShaking:d}){const{version:l,scope:c="default",...u}=t,p=Array.isArray(c)?c:[c],h=g=>{const b=(y,x,w)=>{w&&!y[x]&&(y[x]=w)},v=d?g.treeShaking:g;b(v,"loaded",a),b(v,"loading",s),b(v,"get",i)};p.forEach(g=>{this.shareScopeMap[g]||(this.shareScopeMap[g]={}),this.shareScopeMap[g][e]||(this.shareScopeMap[g][e]={}),this.shareScopeMap[g][e][l]||(this.shareScopeMap[g][e][l]={version:l,scope:[g],...u,lib:n});const b=this.shareScopeMap[g][e][l];h(b),r&&b.from!==r&&(b.from=r)})}_setGlobalShareScopeMap(e){const t=Sa(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},fu=class{constructor(e){this.hooks=new Rt({beforeRegisterRemote:new Pt("beforeRegisterRemote"),registerRemote:new Pt("registerRemote"),beforeRequest:new st("beforeRequest"),onLoad:new je("onLoad"),handlePreloadModule:new Fe("handlePreloadModule"),errorLoadRemote:new je("errorLoadRemote"),beforePreloadRemote:new je("beforePreloadRemote"),generatePreloadAssets:new je("generatePreloadAssets"),afterPreloadRemote:new je,loadEntry:new je}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:s,alias:a}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},a&&e.startsWith(s)){const i=e.replace(s,a);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(a&&e.startsWith(a)){const i=e.replace(a,s);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:s,moduleOptions:a,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:d,remote:l,expose:c,id:u,remoteSnapshot:p}=i,h=await s.get(u,c,t,p),g=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:d,expose:c,exposeModule:n?h:void 0,exposeModuleFactory:n?void 0:h,remote:l,options:a,moduleInstance:s,origin:r});return this.setIdToRemoteMap(e,i),typeof g=="function"?g:h}catch(n){const{from:s="runtime"}=t||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:s,lifecycle:"onLoad",origin:r});if(!a)throw n;return a}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=ou(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:s}=n,a=Ar(s),{globalSnapshot:i,remoteSnapshot:d}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:s}),l=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:s,remoteInfo:a,globalSnapshot:i,remoteSnapshot:d});l&&Oa(a,t,l)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t?.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(g){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:g,lifecycle:"beforeRequest"}),!n)throw g}const{id:s}=n,a=qd(t.options.remotes,s);a||Me(Aa,ze,{hostName:t.options.name,requestId:s},void 0,Lt(t.options));const{remote:i}=a,d=Ar(i),l=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:s,...a,options:t.options,origin:t,remoteInfo:d}),{remote:c,expose:u}=l;Be(c&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${s}.`);let p=t.moduleCache.get(c.name);const h={host:t,remoteInfo:d};return p||(p=new $a(h),t.moduleCache.set(c.name,p)),{module:p,moduleOptions:h,remoteMatchInfo:l}}registerRemote(e,t,r){const{host:n}=this,s=()=>{if(e.alias){const i=t.find(d=>e.alias&&(d.name.startsWith(e.alias)||d.alias?.startsWith(e.alias)));Be(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=Dr),e.type||(e.type=Fd)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const a=t.find(i=>i.name===e.name);if(!a)s(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r?.force&&(this.removeRemote(a),s(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),aa(i.join(" ")))}}removeRemote(e){try{const{host:t}=this,{name:r}=e,n=t.options.remotes.findIndex(a=>a.name===r);n!==-1&&t.options.remotes.splice(n,1);const s=t.moduleCache.get(e.name);if(s){const a=s.remoteInfo,i=a.entryGlobalName;Pe[i]&&(Object.getOwnPropertyDescriptor(Pe,i)?.configurable?delete Pe[i]:Pe[i]=void 0);const d=wn(s.remoteInfo);Mt[d]&&delete Mt[d],t.snapshotHandler.manifestCache.delete(a.entry);let l=a.buildVersion?sa(a.name,a.buildVersion):a.name;const c=Pe.__FEDERATION__.__INSTANCES__.findIndex(p=>a.buildVersion?p.options.id===l:p.name===l);if(c!==-1){const p=Pe.__FEDERATION__.__INSTANCES__[c];l=p.options.id||l;const h=Sa();let g=!0;const b=[];Object.keys(h).forEach(v=>{const y=h[v];y&&Object.keys(y).forEach(x=>{const w=y[x];w&&Object.keys(w).forEach(k=>{const M=w[k];M&&Object.keys(M).forEach(S=>{const E=M[S];E&&typeof E=="object"&&E.from===a.name&&(E.loaded||E.loading?(E.useIn=E.useIn.filter(I=>I!==a.name),E.useIn.length?g=!1:b.push([v,x,k,S])):b.push([v,x,k,S]))})})})}),g&&(p.shareScopeMap={},delete h[l]),b.forEach(([v,y,x,w])=>{delete h[v]?.[y]?.[x]?.[w]}),Pe.__FEDERATION__.__INSTANCES__.splice(c,1)}const{hostGlobalSnapshot:u}=Ga(e,t);if(u){const p=u&&"remotesInfo"in u&&u.remotesInfo&&Tt(u.remotesInfo,e.name).key;p&&(delete u.remotesInfo[p],Wt.__FEDERATION__.__MANIFEST_LOADING__[p]&&delete Wt.__FEDERATION__.__MANIFEST_LOADING__[p])}t.moduleCache.delete(e.name)}}catch(t){yn.error(`removeRemote failed: ${t instanceof Error?t.message:String(t)}`)}}},mu=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0,Qa=class{constructor(e){this.hooks=new Rt({beforeInit:new Pt("beforeInit"),init:new Fe,beforeInitContainer:new st("beforeInitContainer"),initContainer:new st("initContainer")}),this.version="2.4.0",this.moduleCache=new Map,this.loaderHook=new Rt({getModuleInfo:new Fe,createScript:new Fe,createLink:new Fe,fetch:new je,loadEntryError:new je,getModuleFactory:new je}),this.bridgeHook=new Rt({beforeBridgeRender:new Fe,afterBridgeRender:new Fe,beforeBridgeDestroy:new Fe,afterBridgeDestroy:new Fe});const t=mu?[iu(),du()]:[],r={id:tu(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:oa};this.name=e.name,this.options=r,this.snapshotHandler=new uu(this),this.sharedHandler=new pu(this),this.remoteHandler=new fu(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&Me(pa(_a,ze)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=Dr,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=Ar({name:e,entry:t}),s=new $a({host:this,remoteInfo:n});return s.remoteEntryExports=r,this.moduleCache.set(e,s),s}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const{allShareInfos:r}=Na(e,t),{userOptions:n,options:s}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),a=this.remoteHandler.formatAndRegisterRemote(s,n),{allShareInfos:i}=this.sharedHandler.registerShared(s,n),d=[...s.plugins];n.plugins&&n.plugins.forEach(c=>{d.includes(c)||d.push(c)});const l={...e,...t,plugins:d,remotes:a,shared:i,id:n.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:l}),l}registerPlugins(e){const t=ru(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(s=>s.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};function hu(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function gu(e,t){const r=hu();return Pe.__FEDERATION__.__INSTANCES__.find(n=>!!(r&&n.options.id===r||n.options.name===e&&!n.options.version&&!t||n.options.name===e&&t&&n.options.version===t))}function bu(e){const t=new(id()||Qa)({id:`${e.name}@${e.version||Date.now()}`,...e});return ad(t),t}var Ue=null;function vu(e){const t=gu(e.name,e.version),r={...e,id:e.id||""};return t?(t.initOptions(r),Ue||(Ue=t),t):(Ue=bu(r),Ue)}function yu(...e){return Be(Ue,qn,ze),Ue.loadRemote.apply(Ue,e)}function xu(...e){return Be(Ue,qn,ze),Ue.registerRemotes.apply(Ue,e)}function wu(){return Ue}ld(Qa);function It(e){const t=(typeof globalThis<"u"?globalThis:void 0)?.[e];return t&&typeof t=="object"?t:{}}var ku={singleton:!0,requiredVersion:!1,eager:!0},qe=e=>({version:"0.0.0",scope:"default",lib:e,shareConfig:ku}),Ro="__mf_module_cache__";function Nu(){const e=globalThis,t=e[Ro];if(t&&typeof t=="object"){const n=t;return n.share??={},n.remote??={},n}const r={share:{},remote:{}};return e[Ro]=r,r}function Su(){const e=Nu();e.share.react??=Ms,e.share["react-dom"]??=As,e.share["react-dom/client"]??=Ps,e.share["react/jsx-runtime"]??=Es,e.share["@tanstack/react-query"]??=Is,e.share["@trpc/client"]??=Ds,e.share["@trpc/react-query"]??=Ls,e.share["@camstack/ui-library"]??=It("__camstackUiLibrary"),e.share["@camstack/sdk"]??=It("__camstackSdk"),e.share["@camstack/types"]??=It("__camstackTypes")}function Cu(){Su(),wu()===null&&vu({name:"admin_ui_host",remotes:[],shared:{react:qe(()=>Ms),"react-dom":qe(()=>As),"react-dom/client":qe(()=>Ps),"react/jsx-runtime":qe(()=>Es),"@tanstack/react-query":qe(()=>Is),"@trpc/client":qe(()=>Ds),"@trpc/react-query":qe(()=>Ls),"@camstack/ui-library":qe(()=>It("__camstackUiLibrary")),"@camstack/sdk":qe(()=>It("__camstackSdk")),"@camstack/types":qe(()=>It("__camstackTypes"))}})}/**
|
|
37
|
-
* @license lucide-react v0.576.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var ja=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
|
|
42
|
-
* @license lucide-react v0.576.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/var Mu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
47
|
-
* @license lucide-react v0.576.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/var Eu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
|
|
52
|
-
* @license lucide-react v0.576.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/var Io=e=>{const t=Eu(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
57
|
-
* @license lucide-react v0.576.0 - ISC
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the ISC license.
|
|
60
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/var Au={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
62
|
-
* @license lucide-react v0.576.0 - ISC
|
|
63
|
-
*
|
|
64
|
-
* This source code is licensed under the ISC license.
|
|
65
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/var Pu=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
67
|
-
* @license lucide-react v0.576.0 - ISC
|
|
68
|
-
*
|
|
69
|
-
* This source code is licensed under the ISC license.
|
|
70
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/var Ru=Oe(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:i,...d},l)=>Vt("svg",{ref:l,...Au,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:ja("lucide",s),...!a&&!Pu(d)&&{"aria-hidden":"true"},...d},[...i.map(([c,u])=>Vt(c,u)),...Array.isArray(a)?a:[a]]));/**
|
|
72
|
-
* @license lucide-react v0.576.0 - ISC
|
|
73
|
-
*
|
|
74
|
-
* This source code is licensed under the ISC license.
|
|
75
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/var R=(e,t)=>{const r=Oe(({className:n,...s},a)=>Vt(Ru,{ref:a,iconNode:t,className:ja(`lucide-${Mu(Io(e))}`,`lucide-${e}`,n),...s}));return r.displayName=Io(e),r},ot=R("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),Iu=R("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),_u=R("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),Tu=R("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),Wn=R("arrow-up-to-line",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]),Du=R("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),Lu=R("battery-full",[["path",{d:"M10 10v4",key:"1mb2ec"}],["path",{d:"M14 10v4",key:"1nt88p"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 10v4",key:"1n77qd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),Ou=R("battery-low",[["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 14v-4",key:"14a6bd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),$u=R("battery-warning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2",key:"1m83kb"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"h8lgfh"}]]),Ua=R("battery",[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),Bu=R("bell-ring",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]),Lr=R("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),zu=R("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]),Kn=R("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),Fu=R("cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]),$t=R("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),yt=R("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Gu=R("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),dt=R("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),tr=R("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),Qu=R("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),ju=R("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Uu=R("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),Hu=R("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),Vu=R("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Ha=R("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),qu=R("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),Wu=R("copy-plus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),tt=R("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),Ku=R("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),Va=R("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]),Yu=R("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),qa=R("door-open",[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]]),kn=R("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),Wa=R("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Yn=R("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),Zn=R("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Bt=R("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Ka=R("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),Zu=R("grip-horizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Ya=R("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]),Xu=R("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),Ju=R("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]),ep=R("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),tp=R("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),Za=R("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),Qe=R("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),rp=R("locate-fixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),_o=R("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),np=R("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),Xa=R("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),To=R("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),Ja=R("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Xn=R("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),op=R("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]),Nn=R("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),sp=R("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),Sn=R("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),rr=R("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ap=R("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]),ip=R("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),lp=R("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]),ei=R("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),cp=R("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Or=R("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ti=R("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),ri=R("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),dp=R("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),up=R("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),pp=R("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Zt=R("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),fp=R("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),Do=R("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),mp=R("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),hp=R("ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]),gp=R("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]),Lo=R("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),bp=R("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),ni=R("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),vp=R("table-2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),Oo=R("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),yp=R("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),xp=R("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),Ye=R("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),wp=R("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),kp=R("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),zt=R("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Np=R("unlink-2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]),oi=R("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),Sp=R("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),si=R("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),Jn=R("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),_e=R("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$o=R("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Cp=R("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Mp=R("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),pv={frigate:hp,scrypted:mp,reolink:cp,homeAssistant:Ya,rtsp:Fu},fv={online:ju,offline:qu,degraded:tr,unknown:Ha},Bo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,zo=Qs,xt=(e,t)=>r=>{var n;if(t?.variants==null)return zo(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(l=>{const c=r?.[l],u=a?.[l];if(c===null)return null;const p=Bo(c)||Bo(u);return s[l][p]}),d=r&&Object.entries(r).reduce((l,c)=>{let[u,p]=c;return p===void 0||(l[u]=p),l},{});return zo(e,i,t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((l,c)=>{let{class:u,className:p,...h}=c;return Object.entries(h).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...a,...d}[b]):{...a,...d}[b]===v})?[...l,u,p]:l},[]),r?.class,r?.className)},Ep=xt("inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer disabled:opacity-50 disabled:pointer-events-none",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-surface text-foreground hover:bg-surface-hover",ghost:"hover:bg-surface-hover text-foreground-muted",danger:"bg-danger text-white hover:bg-danger/90",outline:"border border-border bg-transparent hover:bg-surface-hover"},size:{sm:"h-7 px-2.5 text-xs gap-1.5",md:"h-8 px-3 text-sm gap-2",lg:"h-9 px-4 text-sm gap-2"}},defaultVariants:{variant:"primary",size:"sm"}}),at=Oe(({className:e,variant:t,size:r,...n},s)=>o("button",{ref:s,className:N(Ep({variant:t,size:r}),e),...n}));at.displayName="Button";var Ap=xt("inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer disabled:opacity-50 disabled:pointer-events-none",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-surface text-foreground hover:bg-surface-hover",ghost:"hover:bg-surface-hover text-foreground-muted",danger:"bg-danger text-white hover:bg-danger/90",outline:"border border-border bg-transparent hover:bg-surface-hover"},size:{sm:"h-7 w-7",md:"h-8 w-8",lg:"h-9 w-9"}},defaultVariants:{variant:"primary",size:"sm"}}),ai=Oe(({className:e,variant:t,size:r,icon:n,...s},a)=>o("button",{ref:a,className:N(Ap({variant:t,size:r}),e),...s,children:o(n,{className:"h-4 w-4"})}));ai.displayName="IconButton";var Pp=xt("inline-flex items-center rounded-full text-xs font-medium px-2 py-0.5",{variants:{variant:{default:"bg-surface-hover text-foreground",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",info:"bg-info/15 text-info"},styleVariant:{solid:"",outline:"border bg-transparent"}},defaultVariants:{variant:"default",styleVariant:"solid"}}),ht=Oe(({className:e,variant:t,style:r,...n},s)=>o("span",{ref:s,className:N(Pp({variant:t,styleVariant:r}),e),...n}));ht.displayName="Badge";var Rp=xt("rounded-lg p-3",{variants:{variant:{flat:"bg-surface",bordered:"bg-surface border border-border"}},defaultVariants:{variant:"bordered"}}),ii=Oe(({className:e,variant:t,...r},n)=>o("div",{ref:n,className:N(Rp({variant:t}),e),...r}));ii.displayName="Card";function Ip({expanded:e,onExpandedChange:t,header:r,children:n,dimmed:s=!1,hideChevron:a=!1,className:i}){return m("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden",s&&"opacity-[0.45]",i),children:[m("div",{role:"button",tabIndex:0,className:"flex items-center gap-2.5 px-3 py-2.5 cursor-pointer select-none",onClick:()=>t(!e),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t(!e))},children:[!a&&o("span",{className:"text-foreground-subtle shrink-0",children:e?o(yt,{className:"h-4 w-4"}):o(dt,{className:"h-4 w-4"})}),r]}),e&&n&&o("div",{className:"border-t border-border px-3 py-3",children:n})]})}var li=Oe(({className:e,...t},r)=>o("label",{ref:r,className:N("text-[10px] uppercase tracking-wider text-foreground-muted font-medium",e),...t}));li.displayName="Label";var _p=xt("",{variants:{orientation:{horizontal:"h-px w-full bg-border-subtle",vertical:"w-px h-full bg-border-subtle"}},defaultVariants:{orientation:"horizontal"}}),ci=Oe(({className:e,orientation:t,...r},n)=>o("div",{ref:n,role:"separator",className:N(_p({orientation:t}),e),...r}));ci.displayName="Separator";var Tp=Oe(({className:e,...t},r)=>o("div",{ref:r,className:N("animate-pulse bg-surface-hover rounded-md h-4 w-full",e),...t}));Tp.displayName="Skeleton";var Fo=xt("h-7 w-full px-2.5 text-xs bg-surface border rounded-md text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary transition-colors",{variants:{state:{default:"border-border",error:"border-danger"}},defaultVariants:{state:"default"}}),Cn=Oe(({className:e,state:t,leftSlot:r,rightSlot:n,...s},a)=>r||n?m("div",{className:"relative flex items-center w-full",children:[r&&o("div",{className:"absolute left-2.5 flex items-center pointer-events-none",children:r}),o("input",{ref:a,className:N(Fo({state:t}),r?"pl-7":"",n?"pr-7":"",e),...s}),n&&o("div",{className:"absolute right-2.5 flex items-center pointer-events-none",children:n})]}):o("input",{ref:a,className:N(Fo({state:t}),e),...s}));Cn.displayName="Input";var Pr=Oe(({className:e,options:t,...r},n)=>m("div",{className:"relative w-full",children:[o("select",{ref:n,className:N("h-7 w-full px-2.5 text-xs bg-surface border border-border rounded-md text-foreground appearance-none pr-7 focus:outline-none focus:ring-1 focus:ring-primary",e),...r,children:t.map(s=>o("option",{value:s.value,children:s.label},s.value))}),o("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-foreground-muted",children:o(yt,{className:"h-3.5 w-3.5"})})]}));Pr.displayName="Select";var Dp=Oe(({className:e,...t},r)=>o("input",{ref:r,type:"checkbox",className:N("w-3.5 h-3.5 rounded-sm border border-border accent-primary",e),...t}));Dp.displayName="Checkbox";var Lp=Oe(({className:e,checked:t,onCheckedChange:r,label:n,...s},a)=>m("button",{ref:a,role:"switch","aria-checked":t,type:"button",onClick:()=>r(!t),className:N("inline-flex items-center gap-2",e),...s,children:[o("span",{className:N("w-8 h-4 rounded-full transition-colors",t?"bg-primary":"bg-surface-hover"),children:o("span",{className:N("block w-3.5 h-3.5 rounded-full bg-white transition-transform",t?"translate-x-4":"translate-x-0.5")})}),n&&o("span",{className:"text-xs text-foreground",children:n})]}));Lp.displayName="Switch";var di=et(null);function ui(){const e=Ie(di);if(!e)throw new Error("Dialog compound components must be used within <Dialog>");return e}function Op({children:e,open:t,onOpenChange:r}){const[n,s]=C(!1),a=t??n,i=gt(),d=_(l=>{r?.(l),t===void 0&&s(l)},[t,r]);return o(di.Provider,{value:{open:a,setOpen:d,contentId:i},children:e})}function mv({children:e,...t}){const{setOpen:r}=ui();return o("button",{type:"button",onClick:()=>r(!0),...t,children:e})}var $p=xt("bg-background-elevated border border-border rounded-lg p-4 backdrop:bg-black/50 backdrop:backdrop-blur-sm max-w-[calc(100vw-2rem)] max-h-[calc(100dvh-2rem)] overflow-y-auto",{variants:{width:{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"}},defaultVariants:{width:"md"}}),pi=Oe(({className:e,width:t,children:r,...n},s)=>{const{open:a,setOpen:i,contentId:d}=ui(),l=W(null),c=s??l;U(()=>{const p=c.current;p&&(a&&!p.open&&p.showModal(),!a&&p.open&&p.close())},[a,c]);const u=p=>{p.target===p.currentTarget&&i(!1)};return o("dialog",{ref:c,id:d,className:N($p({width:t}),"w-full",e),onClick:u,onClose:()=>i(!1),...n,children:r})});pi.displayName="DialogContent";function Bp({className:e,...t}){return o("div",{className:N("flex flex-col gap-1 mb-3",e),...t})}function zp({className:e,...t}){return o("div",{className:N("flex justify-end gap-2 mt-4",e),...t})}function Fp({className:e,...t}){return o("h2",{className:N("text-sm font-semibold text-foreground",e),...t})}function Gp({className:e,...t}){return o("p",{className:N("text-xs text-foreground-muted",e),...t})}var fi=et(null);function eo(){const e=Ie(fi);if(!e)throw new Error("Dropdown compound components must be used within <Dropdown>");return e}function hv({children:e}){const[t,r]=C(!1),n=gt(),s=gt(),a=W(null);return o(fi.Provider,{value:{open:t,setOpen:r,triggerId:n,contentId:s,triggerRef:a},children:o("div",{className:"relative inline-block",children:e})})}function gv({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a,triggerRef:i}=eo();return o("button",{type:"button",ref:i,id:s,"aria-haspopup":"menu","aria-expanded":r,"aria-controls":r?a:void 0,onClick:()=>n(!r),...t,children:e})}function bv({className:e,children:t,align:r="start",offset:n=4,...s}){const{open:a,setOpen:i,contentId:d,triggerId:l,triggerRef:c}=eo(),u=W(null),[p,h]=C(null);return Cl(()=>{if(!a){h(null);return}const g=()=>{const b=c.current;if(!b)return;const v=b.getBoundingClientRect(),y=r==="end"?v.right:v.left;h({top:v.bottom+n,left:y,minWidth:v.width})};return g(),window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0)}},[a,r,n,c]),U(()=>{if(!a)return;const g=v=>{const y=u.current,x=c.current;y&&!y.contains(v.target)&&!x?.contains(v.target)&&i(!1)},b=v=>{v.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b)}},[a,i,c]),!a||!p||typeof document>"u"?null:_r(o("div",{ref:u,id:d,role:"menu","aria-labelledby":l,style:{position:"fixed",top:p.top,...r==="end"?{right:window.innerWidth-p.left}:{left:p.left},minWidth:p.minWidth},className:N("z-50 bg-background-elevated border border-border rounded-md shadow-lg py-1 min-w-[160px]",e),...s,children:t}),document.body)}function vv({className:e,icon:t,variant:r="default",children:n,onClick:s,...a}){const{setOpen:i}=eo(),d=_(l=>{s?.(l),i(!1)},[s,i]);return m("button",{type:"button",role:"menuitem",className:N("h-7 text-xs px-2 w-full text-left flex items-center gap-2",r==="danger"?"text-danger hover:bg-danger/10":"text-foreground hover:bg-surface-hover",e),onClick:d,...a,children:[t&&o(t,{size:14}),n]})}var mi=et(null);function hi(){const e=Ie(mi);if(!e)throw new Error("Tooltip compound components must be used within <Tooltip>");return e}function yv({children:e}){const[t,r]=C(!1),n=W(null),s=gt(),a=()=>{n.current=setTimeout(()=>r(!0),300)},i=()=>{n.current&&clearTimeout(n.current),r(!1)};return o(mi.Provider,{value:{open:t,show:a,hide:i,tooltipId:s},children:o("div",{className:"relative inline-block",children:e})})}function xv({children:e,...t}){const{show:r,hide:n,tooltipId:s,open:a}=hi();return o("div",{onMouseEnter:r,onMouseLeave:n,onFocus:r,onBlur:n,"aria-describedby":a?s:void 0,...t,children:e})}function wv({className:e,children:t,...r}){const{open:n,tooltipId:s}=hi();return o("div",{id:s,role:"tooltip",className:N("absolute bottom-full left-1/2 -translate-x-1/2 mb-2 bg-foreground text-background text-xs px-2 py-1 rounded-md shadow-md whitespace-nowrap pointer-events-none transition-opacity duration-150",n?"opacity-100":"opacity-0",e),...r,children:t})}var Go="(max-width: 767px)",Qo="(min-width: 768px) and (max-width: 1023px)";function gi(e){return t=>{const r=window.matchMedia(e);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)}}function bi(e){return()=>window.matchMedia(e).matches}function vi(){return!1}function $r(){return zn(gi(Go),bi(Go),vi)}function kv(){return zn(gi(Qo),bi(Qo),vi)}function yi({open:e,onClose:t,title:r,children:n,className:s}){return U(()=>{if(!e)return;const a=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",a),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[e,t]),m(Se,{children:[o("div",{className:N("fixed inset-0 z-40 bg-black/50 transition-opacity duration-200",e?"opacity-100":"pointer-events-none opacity-0"),onClick:t,"aria-hidden":"true"}),m("div",{role:"dialog","aria-modal":"true",className:N("fixed inset-x-0 bottom-0 z-50 flex flex-col bg-background-elevated border-t border-border rounded-t-xl shadow-2xl transition-transform duration-200 ease-out","max-h-[80dvh]",e?"translate-y-0":"translate-y-full",s),children:[o("div",{className:"flex justify-center pt-2 pb-1",children:o("div",{className:"h-1 w-8 rounded-full bg-foreground-subtle/30"})}),r&&m("div",{className:"flex items-center justify-between px-4 pb-2",children:[o("span",{className:"text-sm font-medium text-foreground",children:r}),o("button",{onClick:t,className:"p-1 rounded-md hover:bg-surface-hover text-foreground-muted transition-colors",children:o(_e,{className:"h-4 w-4"})})]}),o("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:n})]})]})}var xi=et(null);function wi(){const e=Ie(xi);if(!e)throw new Error("Popover compound components must be used within <Popover>");return e}function Qp({children:e,open:t,onOpenChange:r}){const[n,s]=C(!1),a=t??n,i=gt(),d=gt(),l=_(c=>{r?.(c),t===void 0&&s(c)},[t,r]);return o(xi.Provider,{value:{open:a,setOpen:l,triggerId:i,contentId:d},children:o("div",{className:"relative inline-block",children:e})})}function jp({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a}=wi();return o("button",{type:"button",id:s,"aria-haspopup":"dialog","aria-expanded":r,"aria-controls":r?a:void 0,onClick:()=>n(!r),...t,children:e})}function Up({className:e,children:t,...r}){const{open:n,setOpen:s,contentId:a,triggerId:i}=wi(),d=$r(),l=W(null);return U(()=>{if(!n||d)return;const c=p=>{const h=l.current,g=document.getElementById(i);h&&!h.contains(p.target)&&!g?.contains(p.target)&&s(!1)},u=p=>{p.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u)}},[n,s,i,d]),n?d?o(yi,{open:n,onClose:()=>s(!1),children:t}):o("div",{ref:l,id:a,role:"dialog","aria-labelledby":i,className:N("absolute left-0 top-full z-50 mt-1 bg-background-elevated border border-border rounded-lg shadow-lg p-3",e),...r,children:t}):null}var ki=et(null);function Ni(){const e=Ie(ki);if(!e)throw new Error("Tabs compound components must be used within <Tabs>");return e}function Nv({value:e,onValueChange:t,defaultValue:r="",className:n,...s}){const[a,i]=C(r),d=e??a,l=_(c=>{t?.(c),e===void 0&&i(c)},[e,t]);return o(ki.Provider,{value:{value:d,setValue:l},children:o("div",{className:n,...s})})}function Sv({className:e,...t}){return o("div",{role:"tablist",className:N("flex flex-row border-b border-border-subtle",e),...t})}function Cv({value:e,className:t,...r}){const{value:n,setValue:s}=Ni(),a=e===n;return o("button",{type:"button",role:"tab","aria-selected":a,"aria-controls":`tabpanel-${e}`,tabIndex:a?0:-1,className:N("h-7 text-xs px-3 transition-colors",a?"border-b-2 border-primary text-foreground font-medium":"text-foreground-muted hover:text-foreground",t),onClick:()=>s(e),...r})}function Mv({value:e,className:t,...r}){const{value:n}=Ni();return e!==n?null:o("div",{role:"tabpanel",id:`tabpanel-${e}`,className:N("pt-3",t),...r})}var Si=Oe(({className:e,...t},r)=>o("div",{ref:r,className:N("overflow-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-surface-hover [&::-webkit-scrollbar-thumb]:rounded-full",e),...t}));Si.displayName="ScrollArea";function Ev({title:e,onClose:t,children:r,defaultWidth:n=360,defaultHeight:s=280,minWidth:a=280,minHeight:i=160,offsetIndex:d=0,className:l}){const[c,u]=C({x:80+d*30,y:80+d*30}),[p,h]=C({w:n,h:s}),[g,b]=C(!1),v=W(!1),y=W(!1),x=W({x:0,y:0}),w=$r(),k=_(S=>{S.preventDefault(),v.current=!0,x.current={x:S.clientX-c.x,y:S.clientY-c.y}},[c]),M=_(S=>{S.preventDefault(),S.stopPropagation(),y.current=!0,x.current={x:S.clientX,y:S.clientY}},[]);return U(()=>{const S=I=>{if(v.current&&u({x:I.clientX-x.current.x,y:I.clientY-x.current.y}),y.current){const A=I.clientX-x.current.x,F=I.clientY-x.current.y;x.current={x:I.clientX,y:I.clientY},h(Y=>({w:Math.max(a,Y.w+A),h:Math.max(i,Y.h+F)}))}},E=()=>{v.current=!1,y.current=!1};return window.addEventListener("mousemove",S),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",E)}},[a,i]),w?m("div",{className:N("fixed inset-x-0 bottom-0 z-50 rounded-t-xl border-t border-border bg-background-elevated shadow-2xl flex flex-col overflow-hidden",l),style:{maxHeight:"60dvh"},children:[m("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border shrink-0 bg-surface",children:[o("span",{className:"text-[11px] font-medium truncate",children:e}),m("div",{className:"flex items-center gap-1 shrink-0",children:[o("button",{onClick:()=>b(!g),className:"p-0.5 rounded hover:bg-surface-hover text-foreground-muted transition-colors",children:g?o(_o,{size:12}):o(To,{size:12})}),o("button",{onClick:t,className:"p-0.5 rounded hover:bg-danger/20 text-foreground-muted hover:text-danger transition-colors",children:o(_e,{size:12})})]})]}),!g&&o("div",{className:"flex-1 min-h-0 overflow-y-auto",children:r})]}):m("div",{className:N("fixed z-50 rounded-lg border border-border bg-background-elevated shadow-2xl flex flex-col overflow-hidden",l),style:{left:c.x,top:c.y,width:g?280:p.w,height:g?"auto":p.h},children:[m("div",{onMouseDown:k,className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border cursor-move select-none shrink-0 bg-surface",children:[m("div",{className:"flex items-center gap-2 min-w-0",children:[o(Zu,{size:12,className:"text-foreground-subtle shrink-0"}),o("span",{className:"text-[11px] font-medium truncate",children:e})]}),m("div",{className:"flex items-center gap-1 shrink-0",children:[o("button",{onClick:()=>b(!g),className:"p-0.5 rounded hover:bg-surface-hover text-foreground-muted transition-colors",title:g?"Restore":"Minimize",children:g?o(_o,{size:12}):o(To,{size:12})}),o("button",{onClick:t,className:"p-0.5 rounded hover:bg-danger/20 text-foreground-muted hover:text-danger transition-colors",title:"Close",children:o(_e,{size:12})})]})]}),!g&&m("div",{className:"flex-1 min-h-0 overflow-y-auto relative",children:[r,o("div",{onMouseDown:M,className:"absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize",style:{background:"linear-gradient(135deg, transparent 50%, var(--color-foreground-subtle) 50%)",opacity:.4}})]})]})}function Hp({open:e,onClose:t,children:r,className:n,width:s="w-64"}){const a=W(null);return U(()=>{if(!e)return;const i=d=>{d.key==="Escape"&&t()};return document.addEventListener("keydown",i),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}},[e,t]),m(Se,{children:[o("div",{className:N("fixed inset-0 z-40 bg-black/50 backdrop-blur-sm transition-opacity duration-200",e?"opacity-100":"pointer-events-none opacity-0"),onClick:t,"aria-hidden":"true"}),o("div",{ref:a,role:"dialog","aria-modal":"true",className:N("fixed inset-y-0 left-0 z-50 flex flex-col bg-surface border-r border-border shadow-2xl transition-transform duration-200 ease-out",s,e?"translate-x-0":"-translate-x-full",n),children:r})]})}function Av({items:e,className:t}){return o("nav",{className:`flex items-center gap-1 text-[11px] text-foreground-subtle ${t??""}`,children:e.map((r,n)=>{const s=n===e.length-1,a=!s&&(r.onClick||r.href);return m(Ae.Fragment,{children:[n>0&&o(dt,{className:"h-3 w-3 flex-shrink-0"}),a?r.onClick?o("button",{type:"button",onClick:r.onClick,className:"hover:text-foreground transition-colors",children:r.label}):o("a",{href:r.href,className:"hover:text-foreground transition-colors",children:r.label}):o("span",{className:s?"text-foreground font-medium":"",children:r.label})]},n)})})}var jo={left:"text-left",right:"text-right",center:"text-center"};function Vp({columns:e,rows:t,rowKey:r,onRowClick:n,minWidthPx:s=480,emptyMessage:a,className:i,bordered:d=!0,rowClassName:l}){return t.length===0&&a?o("div",{className:`rounded-lg ${d?"border border-border":""} bg-surface px-3 py-4 text-xs text-foreground-subtle text-center ${i??""}`,children:a}):t.length===0?null:o("div",{className:`rounded-lg ${d?"border border-border":""} bg-surface overflow-x-auto ${i??""}`,children:m("table",{className:"w-full text-xs",style:{minWidth:`${s}px`},children:[o("thead",{className:"bg-surface",children:o("tr",{children:e.map(c=>{const u=c.align??"left",p=c.nowrap??!0;return o("th",{className:["px-3 py-2 text-foreground-subtle font-medium bg-surface border-b border-border",jo[u],p?"whitespace-nowrap":"",c.width??""].filter(Boolean).join(" "),children:c.headerRender?c.headerRender():c.header},c.key)})})}),o("tbody",{children:t.map((c,u)=>{const p=r?r(c,u):u,h=l?.(c,u)??"",g=n!==void 0;return o("tr",{onClick:g?()=>n(c,u):void 0,className:[g?"cursor-pointer hover:bg-primary/5":"hover:bg-primary/5",h].filter(Boolean).join(" "),children:e.map(b=>{const v=b.align??"left",y=b.nowrap??!1;return o("td",{className:["px-3 py-2 text-foreground border-b border-border",jo[v],y?"whitespace-nowrap":""].filter(Boolean).join(" "),children:b.render(c,u)},b.key)})},p)})})]})})}function Pv({open:e,onClose:t,title:r,subtitle:n,footer:s,children:a,widthClass:i="w-[360px]"}){return U(()=>{if(!e)return;const d=l=>{l.key==="Escape"&&t()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,t]),e?m("aside",{className:N("absolute top-0 right-0 bottom-0 z-20 flex flex-col","bg-surface border-l border-border shadow-xl",i),role:"dialog","aria-modal":"false",children:[m("header",{className:"flex items-start justify-between gap-2 px-4 py-3 border-b border-border",children:[m("div",{className:"min-w-0",children:[o("div",{className:"text-sm font-semibold text-foreground truncate",children:r}),n!==void 0&&o("div",{className:"text-[11px] text-foreground-subtle mt-0.5 truncate",children:n})]}),o("button",{type:"button",onClick:t,className:"p-1 rounded hover:bg-muted text-foreground-subtle hover:text-foreground","aria-label":"Close panel",children:o(_e,{className:"w-4 h-4"})})]}),o("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-3",children:a}),s!==void 0&&o("footer",{className:"flex items-center gap-2 justify-end px-4 py-3 border-t border-border",children:s})]}):null}var qp={inherit:"bg-muted",on:"bg-emerald-500",off:"bg-orange-500",na:"bg-gray-300 opacity-50"};function Ci({node:e,depth:t,selectedAddonId:r,onSelect:n,agentDots:s}){const a=e.addonId===r,i=s?.[e.addonId]??[];return m("div",{children:[m("button",{type:"button",onClick:()=>n(e.addonId),className:N("w-full flex items-center justify-between gap-2 text-left px-3 py-1.5 text-xs","border-l-2",a?"bg-accent border-primary text-foreground font-medium":"border-transparent hover:bg-muted/40 text-foreground"),style:{paddingLeft:`${12+t*14}px`},children:[o("span",{className:"truncate",children:e.addonName}),i.length>0&&o("span",{className:"flex items-center gap-1 shrink-0",children:i.map(d=>o("span",{title:`${d.agentNodeId}: ${d.state}`,className:N("w-2 h-2 rounded-full",qp[d.state])},d.agentNodeId))})]}),e.children.map(d=>o(Ci,{node:d,depth:t+1,selectedAddonId:r,onSelect:n,agentDots:s},d.addonId))]})}function Rv({tree:e,selectedAddonId:t,onSelect:r,agentDots:n,className:s}){return o("div",{className:N("flex flex-col py-2",s),children:e.map(a=>o(Ci,{node:a,depth:0,selectedAddonId:t,onSelect:r,agentDots:n},a.addonId))})}function Iv(e){const t=[],r=[],n=new Map;for(const a of e.slots)for(const i of a.addons){const d={addonId:i.id,addonName:i.name,slot:i.slot,inputClasses:i.inputClasses,outputClasses:i.outputClasses,children:[]};i.slot==="audio-classifier"?t.push(d):(r.push(d),n.set(i.id,d))}const s=[];for(const a of r){if(a.inputClasses.length===0){s.push(a);continue}const i=r.find(d=>d.addonId!==a.addonId&&d.outputClasses.some(l=>a.inputClasses.includes(l)));i&&i.children.push(a)}return[...s,...t]}function Wp(e){return e?e.models.map(t=>({id:t.id,name:t.name})):[]}function Zr({step:e,schema:t,allSchemas:r,depth:n=0,onChange:s,onDelete:a,readOnly:i=!1,toggleMode:d="simple",overrideState:l=null,onOverrideChange:c,inheritedEnabled:u,hideModelAndSettings:p=!1}){const[h,g]=C(!1),b=Wp(t);if(b.length>0&&!b.some(y=>y.id===e.modelId)&&!i){const y=(t?.defaultModelId?b.find(x=>x.id===t.defaultModelId):null)??b[0];y&&y.id!==e.modelId&&queueMicrotask(()=>s({...e,modelId:y.id}))}const v=m(Se,{children:[m("div",{className:"flex-1 min-w-0",children:[o("span",{className:"text-[10px] uppercase tracking-wider font-medium text-foreground-subtle/60 block leading-none",children:e.slot}),o("span",{className:"text-sm font-semibold text-foreground truncate block leading-tight",children:e.addonName}),m("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.inputClasses.map(y=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-blue-500/12 text-blue-400",children:y},y)),e.inputClasses.length>0&&e.outputClasses.length>0&&o("span",{className:"text-foreground-subtle/40 text-[10px]",children:"→"}),e.outputClasses.map(y=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-green-500/12 text-green-400",children:y},y))]})]}),!i&&d==="simple"&&o("button",{onClick:y=>{y.stopPropagation(),s({...e,enabled:!e.enabled})},className:N("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors",e.enabled?"bg-success":"bg-foreground-subtle/30"),children:o("span",{className:N("inline-block h-4 w-4 rounded-full bg-white shadow transition-transform",e.enabled?"translate-x-6":"translate-x-1")})}),!i&&d==="threeState"&&c&&m("div",{className:"flex items-center gap-0.5 rounded-md border border-border p-0.5",onClick:y=>y.stopPropagation(),children:[o(Xr,{label:"Inherit",active:l===null,variant:"inherit",subtext:u===void 0?void 0:u?"on":"off",onClick:()=>c(null)}),o(Xr,{label:"On",active:l===!0,variant:"on",onClick:()=>c(!0)}),o(Xr,{label:"Off",active:l===!1,variant:"off",onClick:()=>c(!1)})]})]});return o(Ip,{expanded:h,onExpandedChange:g,dimmed:!e.enabled,header:v,children:p?o("p",{className:"text-[11px] text-foreground-subtle",children:"Model and detection settings are managed per agent — open the Pipeline page for this camera's agent to edit them."}):m("div",{className:"space-y-3",children:[o(Mn,{label:"Model",value:e.modelId,disabled:i,options:b.map(y=>({value:y.id,label:y.name})),onChange:y=>s({...e,modelId:y})}),e.slot==="audio-classifier"&&e.engine&&o(Mn,{label:"Runtime",value:`${e.engine.runtime}/${e.engine.backend}`,disabled:i,options:[{value:"node/cpu",label:"Node.js — ONNX CPU"},{value:"node/coreml",label:"Node.js — Apple SoundAnalysis (macOS)"},{value:"python/cpu",label:"Python — ONNX CPU"}],onChange:y=>{const[x,w]=y.split("/");s({...e,engine:{runtime:x,backend:w,format:w==="coreml"?"coreml":"onnx"}})}}),t?.configSchema?.map(y=>o(to,{field:y,allFields:t.configSchema??[],step:e,disabled:i,onChange:s},y.key))]})})}function Mn({label:e,value:t,options:r,disabled:n,onChange:s}){return m("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1.5",children:e}),m("select",{value:t,onChange:a=>s(a.target.value),disabled:n,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground focus:outline-none focus:border-primary/50",children:[r.length===0&&o("option",{value:t,children:t||"default"}),r.map(a=>o("option",{value:a.value,disabled:a.disabled,children:a.label},a.value))]})]})}function Kp({label:e,description:t,value:r,options:n,disabled:s,onChange:a}){function i(d){s||a(r.includes(d)?r.filter(l=>l!==d):[...r,d])}return m("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1",children:e}),t&&o("p",{className:"text-[10px] text-foreground-subtle/60 mb-1.5",children:t}),o("div",{className:"flex flex-wrap gap-1.5",children:n.map(d=>o("button",{type:"button",disabled:s,onClick:()=>i(d.value),className:N("text-[10px] font-medium px-2 py-1 rounded-md border transition-colors",r.includes(d.value)?"bg-primary/20 text-primary border-primary/40":"bg-surface text-foreground-subtle border-border hover:border-primary/30",s&&"opacity-50 cursor-not-allowed"),children:d.label},d.value))})]})}function Yp(e,t,r){const n=t.settings?.[e];if(n!==void 0)return n;const s=r.find(a=>"key"in a&&a.key===e);return s&&"default"in s?s.default:void 0}function to({field:e,allFields:t,step:r,disabled:n,onChange:s}){const a=e.type!=="separator"&&e.type!=="info"?e.showWhen:void 0;if(a){const{field:d,equals:l,notEquals:c,in:u,notIn:p}=a,h=Yp(d,r,t);if(l!==void 0&&h!==l||c!==void 0&&h===c||u!==void 0&&!u.includes(h)||p!==void 0&&p.includes(h))return null}function i(d){s({...r,settings:{...r.settings,[e.key]:d}})}if(e.type==="select"){const d=r.settings?.[e.key],l=typeof d=="string"?d:e.default??"";return o(Mn,{label:e.label,value:l,disabled:n||e.disabled,options:e.options,onChange:i})}if(e.type==="multiselect"){const d=r.settings?.[e.key],l=Array.isArray(d)?d:Array.isArray(e.default)?e.default:[];return o(Kp,{label:e.label,description:e.description,value:l,options:e.options,disabled:n||e.disabled,onChange:i})}if(e.type==="slider"||e.type==="number"){const d=r.settings?.[e.key],l=typeof e.default=="number"?e.default:e.min??0,c=typeof d=="number"?d:l,u=e.min??0,p=e.max??1,h=e.step??.01,g=e.type==="slider"?e.showValue:!0,b="unit"in e?e.unit:void 0,v=e.type==="slider"?e.displayScale:void 0,y=v?c/v:c;return m("div",{children:[m("div",{className:"flex items-center justify-between mb-1",children:[o("span",{className:"text-[10px] font-medium text-foreground-subtle uppercase tracking-wide",children:e.label}),g&&m("span",{className:"text-xs font-medium text-foreground tabular-nums",children:[typeof y=="number"?y.toFixed(2).replace(/\.?0+$/,""):y,b?` ${b}`:""]})]}),e.description&&o("p",{className:"text-[10px] text-foreground-subtle/60 mb-1.5",children:e.description}),o("input",{type:"range",min:u,max:p,step:h,value:c,disabled:n||e.disabled,onChange:x=>i(Number(x.target.value)),className:"w-full accent-primary h-1.5"})]})}if(e.type==="boolean"){const d=r.settings?.[e.key];return m("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:typeof d=="boolean"?d:e.default===!0,disabled:n||e.disabled,onChange:l=>i(l.target.checked),className:"h-3.5 w-3.5 accent-primary"}),o("span",{className:"text-[10px] font-medium text-foreground-subtle uppercase tracking-wide",children:e.label})]})}if(e.type==="text"||e.type==="password"||e.type==="textarea"){const d=r.settings?.[e.key],l=typeof d=="string"?d:e.default??"",c=e.type==="password"?"password":"text";return m("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1.5",children:e.label}),e.type==="textarea"?o("textarea",{value:l,disabled:n||e.disabled,placeholder:e.placeholder,onChange:u=>i(u.target.value),rows:3,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground focus:outline-none focus:border-primary/50 resize-y"}):o("input",{type:c,value:l,disabled:n||e.disabled,placeholder:e.placeholder,onChange:u=>i(u.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground focus:outline-none focus:border-primary/50"})]})}return e.type==="separator"?o("div",{className:"border-t border-border my-2"}):e.type==="info"?o("div",{className:"rounded-md border border-border bg-surface px-2 py-1.5 text-[10px] text-foreground-subtle",children:e.content}):null}function Xr({label:e,active:t,variant:r,subtext:n,onClick:s}){return m("button",{type:"button",onClick:s,className:N("px-2 py-1 text-[10px] font-medium rounded transition-colors",t?r==="on"?"bg-green-500/20 text-green-400":r==="off"?"bg-red-500/20 text-red-400":"bg-primary/20 text-primary":"text-foreground-subtle hover:bg-surface-hover"),children:[e,n&&t&&m("span",{className:"ml-1 opacity-60",children:["(",n,")"]})]})}function Mi(e,t){return{addonId:e.id,addonName:e.name,slot:e.slot,inputClasses:[...e.inputClasses],outputClasses:[...e.outputClasses],enabled:t.enabled,modelId:t.modelId,children:[],settings:{...t.settings}}}function Zp(e,t,r){return r?{enabled:r.enabled??t.enabled,modelId:r.modelId??t.modelId,settings:r.settings??t.settings}:t}function Xp({addon:e,agentDefault:t,modelsForFormat:r,onChangeAgentConfig:n}){const s=a=>{n?.({...t,...a})};return m("div",{className:"space-y-4 text-xs",children:[m("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:t.enabled,onChange:a=>s({enabled:a.target.checked})}),m("span",{children:["Enabled on this agent (",e.name,")"]})]}),m("div",{children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle mb-1",children:"Model"}),o("select",{className:"w-full bg-surface border border-border rounded px-2 py-1 text-xs",value:t.modelId,onChange:a=>s({modelId:a.target.value}),children:r.map(a=>o("option",{value:a.id,children:a.name},a.id))})]}),(e.configSchema?.length??0)>0&&m("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle",children:"Settings"}),e.configSchema?.map(a=>o(to,{field:a,allFields:e.configSchema??[],step:Mi(e,t),disabled:!1,onChange:i=>s({settings:{...i.settings}})},a.key))]})]})}function Jp({addon:e,agentDefault:t,agentNodeId:r,currentPatch:n,modelsForFormat:s,onChangePatch:a}){const i=Zp("device",t,n),d=g=>{const b=g.enabled!==void 0||g.modelId!==void 0||g.settings!==void 0;a?.(b?g:null)},l=g=>{const{enabled:b,...v}=n??{};d(g==="inherit"?v:{...v,enabled:g==="on"})},c=g=>{const{modelId:b,...v}=n??{};d(g===void 0?v:{...v,modelId:g})},u=g=>{const{settings:b,...v}=n??{};d(g===void 0?v:{...v,settings:g})},p=n?.enabled===void 0?"inherit":n.enabled?"on":"off",h=n?.modelId!==void 0;return m("div",{className:"space-y-4 text-xs",children:[m("div",{className:"flex items-center gap-1",children:[["inherit","on","off"].map(g=>o("button",{type:"button",onClick:()=>l(g),className:N("px-3 py-1 border border-border rounded text-xs capitalize",p===g?"bg-primary text-primary-foreground border-primary":"bg-surface text-foreground hover:bg-muted"),children:g},g)),m("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["agent default: ",o("span",{className:"font-semibold",children:t.enabled?"on":"off"})]})]}),m("div",{children:[m("div",{className:"flex items-center justify-between mb-1",children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle",children:"Model"}),h?o("button",{type:"button",className:"text-[10px] text-foreground-subtle hover:text-foreground",onClick:()=>c(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>c(t.modelId),children:"Override"})]}),o("select",{disabled:!h,className:"w-full bg-surface border border-border rounded px-2 py-1 text-xs disabled:opacity-50",value:h?n?.modelId??t.modelId:t.modelId,onChange:g=>c(g.target.value),children:s.map(g=>o("option",{value:g.id,children:g.name},g.id))}),!h&&m("div",{className:"text-[10px] text-foreground-subtle mt-1",children:["inherits from ",r]})]}),(e.configSchema?.length??0)>0&&(()=>{const g=n?.settings!==void 0;return m("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[m("div",{className:"flex items-center justify-between",children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle",children:"Settings"}),g?o("button",{type:"button",className:"text-[10px] text-foreground-subtle hover:text-foreground",onClick:()=>u(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>u({...t.settings}),children:"Override"})]}),e.configSchema?.map(b=>o(to,{field:b,allFields:e.configSchema??[],step:Mi(e,i),disabled:!g,onChange:v=>u({...v.settings})},b.key)),!g&&m("div",{className:"text-[10px] text-foreground-subtle",children:["inherits from ",r]})]})})(),m("div",{className:"rounded bg-muted/40 px-3 py-2 text-[11px] text-foreground-subtle",children:[o("div",{className:"font-semibold text-foreground mb-0.5",children:"Effective config preview"}),m("div",{className:"font-mono truncate",children:[e.id," · model: ",i.modelId," · ",i.enabled?"on":"off"]})]})]})}function _v(e){const{mode:t,addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,onChangeAgentConfig:i,onChangePatch:d,engineFormat:l}=e,c=K(()=>r.models.filter(u=>!!u.formats[l]),[r.models,l]);return t==="agent"?o(Xp,{addon:r,agentDefault:n,modelsForFormat:c,onChangeAgentConfig:i}):o(Jp,{addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,modelsForFormat:c,onChangePatch:d})}function ef(e){const t=[],r=(n,s)=>{for(const a of n)t.push({node:a,depth:s}),r(a.children,s+1)};return r(e,0),t}var Uo={detector:{label:"detector",className:"text-emerald-500"},cropper:{label:"cropper",className:"text-blue-500"},classifier:{label:"classifier",className:"text-violet-500"},refiner:{label:"refiner",className:"text-amber-500"},"audio-classifier":{label:"audio classifier",className:"text-pink-500"}};function tf({slot:e}){const t=Uo[e]??Uo.classifier;return o("span",{className:N("text-[9px] font-semibold uppercase tracking-widest leading-none",t.className),children:t.label})}var Ho="inline-flex items-center rounded bg-muted px-1.5 py-px text-[9px] font-medium text-foreground-subtle";function rf({inputs:e,outputs:t}){return e.length===0&&t.length===0?null:m("span",{className:"inline-flex items-center gap-1 flex-wrap",children:[e.map(r=>o("span",{className:N(Ho,"bg-blue-500/10 text-blue-500"),children:r},`in-${r}`)),e.length>0&&t.length>0&&o("span",{className:"text-foreground-subtle/60 text-[9px]",children:"→"}),t.map(r=>o("span",{className:N(Ho,"bg-emerald-500/10 text-emerald-500"),children:r},`out-${r}`))]})}function nf({enabled:e,onChange:t,disabled:r}){return o("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:n=>{n.stopPropagation(),t(!e)},className:N("relative inline-flex h-3.5 w-7 shrink-0 items-center rounded-full transition-colors",e?"bg-emerald-500":"bg-foreground-subtle/30",r?"opacity-50 cursor-not-allowed":"cursor-pointer"),title:e?"Click to disable":"Click to enable",children:o("span",{className:N("inline-block h-3 w-3 rounded-full bg-white shadow transition-transform",e?"translate-x-3.5":"translate-x-0.5")})})}function of(e){return e.kind==="enabled"?m("span",{className:"inline-flex items-center gap-1",children:[o("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shrink-0"}),o("span",{className:"font-mono text-foreground",children:e.modelId})]}):e.kind==="disabled"?m("span",{className:"inline-flex items-center gap-1 text-foreground-subtle",children:[o("span",{className:"h-1.5 w-1.5 rounded-full border border-foreground-subtle/60 shrink-0"}),"off"]}):m("span",{className:"inline-flex items-center gap-1 text-foreground-subtle/70",children:[o("span",{className:"h-1.5 w-1.5 rounded-full bg-muted shrink-0"}),"n/a"]})}function sf({node:e,depth:t,agents:r,getCellState:n,onCellClick:s,selectedCell:a,toggleProps:i}){return m(Se,{children:[m("div",{className:"sticky left-0 z-10 bg-surface px-3 py-2 border-b border-border text-xs flex items-start gap-2",style:{paddingLeft:`${12+t*14}px`},children:[m("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[o(tf,{slot:e.slot}),m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"font-semibold truncate",children:e.addonName}),o(rf,{inputs:e.inputClasses,outputs:e.outputClasses})]})]}),i&&o("span",{className:"pl-2 pt-0.5 shrink-0",children:o(nf,{enabled:i.enabled,onChange:i.onChange,disabled:i.disabled})})]}),r.map(d=>{const l=n(e.addonId,d.agentNodeId),c=a?.addonId===e.addonId&&a.agentNodeId===d.agentNodeId;return o("button",{type:"button",onClick:()=>s(e.addonId,d.agentNodeId),className:N("text-left px-3 py-1.5 border-b border-l border-border text-xs hover:bg-muted/40",l.kind==="enabled"&&"bg-emerald-500/5",l.kind==="na"&&"bg-muted/30",c&&"ring-2 ring-primary ring-inset"),children:of(l)},d.agentNodeId)})]})}function Tv({tree:e,agents:t,getCellState:r,onCellClick:n,selectedCell:s,onToggleEnabled:a}){const i=K(()=>ef(e),[e]),d=`minmax(320px, 1fr) repeat(${t.length}, minmax(160px, 220px))`,l=a!==void 0&&t.length===1,c=t[0]?.agentNodeId;return o("div",{className:"overflow-auto border border-border rounded",children:m("div",{className:"grid",style:{gridTemplateColumns:d},children:[o("div",{className:"sticky top-0 left-0 z-20 bg-muted/60 px-3 py-2 text-[10px] uppercase tracking-widest text-foreground-subtle border-b border-border",children:"Step"}),t.map(u=>m("div",{className:"sticky top-0 z-10 bg-muted/60 px-3 py-2 border-b border-l border-border",children:[o("div",{className:"text-xs font-semibold text-foreground",children:u.agentNodeId}),o("div",{className:"text-[10px] text-foreground-subtle truncate",children:u.engineLabel})]},u.agentNodeId)),i.map(({node:u,depth:p})=>{const h=l&&c!==void 0?r(u.addonId,c):null;return o(sf,{node:u,depth:p,agents:t,getCellState:r,onCellClick:n,selectedCell:s,toggleProps:l&&h!==null?{enabled:h.kind==="enabled",onChange:g=>a?.(u.addonId,g),disabled:h.kind==="na"}:void 0},u.addonId)})]})})}var Ei=typeof globalThis<"u"?globalThis.__camstackTrpcReact:void 0,f=Ei??Tl();typeof globalThis<"u"&&!Ei&&(globalThis.__camstackTrpcReact=f);var ro=ct("camstack:system",null);function af({system:e,children:t}){return o(ro.Provider,{value:e,children:t})}function Ft(){const e=Ie(ro);if(!e)throw new Error("useSystem(): no <SystemProvider> in tree");return e}function Dv(){return Ie(ro)}function Br(e,t){const r=Ft(),n=W(t);n.current=t;const[s,a]=C(r.connectionVersion);U(()=>r.subscribeConnectionEvents((i,d)=>{i==="connected"&&a(d)}),[r]),U(()=>r.subscribeEvent(e,i=>{n.current(i)}),[r,e,s])}function En(e){const t=W(e);return t.current=e,t}function Ai(e,t){const[r,n]=C(null),s=En(t);return Br(e,a=>{const i=a.data,d=s.current;d&&!d(i)||n(i)}),r}function Lv(e,t,r){const[n,s]=C(()=>new Map),a=En(t),i=En(r);return Br(e,d=>{const l=d.data,c=i.current;if(c&&!c(l))return;const u=a.current(l);s(p=>{const h=new Map(p);return h.set(u,l),h})}),{map:n,values:K(()=>Array.from(n.values()),[n])}}function no(){const{data:e,isLoading:t}=f.nodes.topology.useQuery(void 0,{staleTime:6e4}),r=Ai("cluster.topology-snapshot")?.nodes??e;return{nodes:K(()=>{const n=[];for(const s of r??[])n.push({id:String(s.id??""),name:String(s.name??s.id??""),shortName:s.isHub?"HUB":String(s.name??s.id??""),isHub:!!s.isHub,isOnline:!!s.isOnline,localIps:s.localIps??[],addons:(s.addons??[]).map(a=>({addonId:a.id,capabilities:a.capabilities}))});return n.sort((s,a)=>s.isHub!==a.isHub?s.isHub?-1:1:s.name.localeCompare(a.name)),n},[r]),isLoading:t}}function Ov({selectedNodeId:e,onSelect:t,label:r="Node",hideIcon:n=!1,alwaysShow:s=!1}){const{nodes:a}=no();return!s&&a.length<=1?null:m("div",{className:"flex items-center gap-1.5",children:[!n&&o(fp,{className:"h-3.5 w-3.5 text-foreground-subtle"}),r&&o("span",{className:"text-[10px] uppercase tracking-wider text-foreground-subtle",children:r}),o("div",{className:"flex rounded-md border border-border overflow-hidden text-[11px] font-medium",children:a.map((i,d)=>{const l=e===i.id;return o("button",{type:"button",onClick:()=>t(i.id),disabled:!i.isOnline,title:i.isOnline?i.name:`${i.name} (offline)`,className:N("px-2.5 py-1 transition-colors",l?"bg-primary/15 text-primary":"bg-transparent text-foreground-subtle hover:bg-surface-hover hover:text-foreground",d>0&&"border-l border-border",!i.isOnline&&"opacity-50 cursor-not-allowed"),children:i.shortName},i.id)})})]})}var lf={online:{colorClass:"bg-success",label:"Online"},offline:{colorClass:"bg-danger",label:"Offline"},degraded:{colorClass:"bg-warning",label:"Degraded"},unknown:{colorClass:"bg-foreground-subtle",label:"Unknown"}};function $v({status:e,showDot:t=!0,showLabel:r=!0,size:n="sm",className:s}){const a=lf[e];return m("span",{className:N("inline-flex items-center gap-1.5",n==="sm"?"text-xs":"text-sm",s),children:[t&&o("span",{className:N("h-1.5 w-1.5 shrink-0 rounded-full",a.colorClass),"aria-hidden":"true"}),r&&o("span",{className:"text-foreground",children:a.label})]})}var cf={frigate:{colorClass:"bg-provider-frigate",label:"Frigate"},scrypted:{colorClass:"bg-provider-scrypted",label:"Scrypted"},reolink:{colorClass:"bg-provider-reolink",label:"Reolink"},homeAssistant:{colorClass:"bg-provider-homeAssistant",label:"Home Assistant"},rtsp:{colorClass:"bg-provider-rtsp",label:"RTSP"}};function Bv({provider:e,showLabel:t=!0,className:r}){const n=cf[e];return m("span",{className:N("inline-flex items-center gap-1.5 text-xs",r),children:[o("span",{className:N("h-1.5 w-1.5 shrink-0 rounded-sm",n.colorClass),"aria-hidden":"true"}),t&&o("span",{className:"text-foreground",children:n.label})]})}var df={success:"bg-emerald-400 text-emerald-950",warning:"bg-amber-400 text-amber-950",danger:"bg-red-400 text-red-950",info:"bg-blue-400 text-blue-950",neutral:"bg-foreground-subtle/20 text-foreground"};function uf({children:e,variant:t="neutral",mono:r,className:n}){return o("span",{className:N("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-bold leading-tight",r&&"font-mono",df[t],n),children:e})}function zv({version:e,preRelease:t,className:r}){return o(uf,{variant:t??/-(alpha|beta|rc|dev|canary|next)/i.test(e)?"warning":"success",mono:!0,className:r,children:e})}function Fv({label:e,description:t,error:r,required:n,children:s,orientation:a="vertical",className:i}){const d=a==="horizontal";return m("div",{className:N("flex gap-2",d?"flex-row items-center justify-between":"flex-col",i),children:[m("div",{className:N(d?"flex-1":""),children:[m(li,{children:[e,n&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),t&&o("p",{className:"text-foreground-subtle text-xs mt-0.5",children:t})]}),o("div",{className:N(d?"shrink-0":""),children:s}),r&&o("p",{className:"text-danger text-xs",children:r})]})}function Gv({title:e,subtitle:t,actions:r,className:n}){return m("div",{className:N("flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between",n),children:[m("div",{children:[o("h1",{className:"text-sm font-semibold text-foreground",children:e}),t&&o("p",{className:"text-foreground-subtle text-xs",children:t})]}),r&&o("div",{className:"flex items-center gap-2 flex-wrap",children:r})]})}function pf({icon:e,title:t,description:r,action:n,className:s}){return m("div",{className:N("flex flex-col items-center justify-center gap-3 py-12",s),children:[e&&o(e,{className:"h-12 w-12 text-foreground-subtle","aria-hidden":"true"}),m("div",{className:"flex flex-col items-center gap-1 text-center",children:[o("p",{className:"text-foreground-muted text-sm font-medium",children:t}),r&&o("p",{className:"text-foreground-subtle text-xs max-w-xs",children:r})]}),n&&o("div",{className:"mt-1",children:n})]})}var ff={danger:{box:"border-danger/40 bg-danger/10",icon:"text-danger",title:"text-danger",message:"text-danger"},warning:{box:"border-amber-500/40 bg-amber-500/10",icon:"text-amber-600 dark:text-amber-400",title:"text-amber-700 dark:text-amber-300",message:"text-amber-700 dark:text-amber-300"}};function mf({message:e,title:t,onRetry:r,action:n,variant:s="danger",className:a}){const i=ff[s],d=s==="warning"?zt:tr;return m("div",{role:"alert",className:N("flex items-start gap-2.5 rounded border px-3 py-2.5",i.box,a),children:[o(d,{className:N("h-4 w-4 mt-0.5 shrink-0",i.icon),"aria-hidden":"true"}),m("div",{className:"flex-1 min-w-0",children:[t&&o("p",{className:N("text-xs font-semibold",i.title),children:t}),o("div",{className:N("text-xs break-words",i.message,t?"mt-0.5":""),children:e})]}),n??(r&&m("button",{type:"button",onClick:r,className:N("shrink-0 inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium","border border-current/30 hover:bg-current/10 transition-colors",i.message),children:[o(Or,{className:"h-3 w-3","aria-hidden":"true"}),"Retry"]}))]})}var Pi=ct("camstack:confirm-dialog",null);function oo(){const e=Ie(Pi);if(!e)throw new Error("useConfirm must be used within ConfirmDialogProvider");return e.confirm}function Qv({children:e}){const[t,r]=C(null),n=_(l=>new Promise(c=>{r({...l,resolve:c})}),[]),s=()=>{t?.resolve(!0),r(null)},a=()=>{t?.resolve(!1),r(null)},i={danger:{icon:"text-red-400",button:"bg-red-500 hover:bg-red-600 text-white"},warning:{icon:"text-orange-400",button:"bg-orange-500 hover:bg-orange-600 text-white"},default:{icon:"text-primary",button:"bg-primary hover:bg-primary/90 text-white"}},d=t?i[t.variant??"default"]:i.default;return m(Pi.Provider,{value:{confirm:n},children:[e,t&&m("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:a}),m("div",{className:"relative z-10 w-full max-w-sm mx-4 rounded-xl border border-border bg-surface shadow-2xl overflow-hidden animate-in fade-in zoom-in-95 duration-150",onClick:l=>l.stopPropagation(),children:[m("div",{className:"px-5 pt-5 pb-4",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:t.title}),o("p",{className:"mt-2 text-xs text-foreground-subtle leading-relaxed",children:t.message})]}),m("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border bg-surface-hover/30",children:[o("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-xs font-medium rounded-md border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",children:t.cancelLabel??"Cancel"}),o("button",{type:"button",onClick:s,className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${d.button}`,children:t.confirmLabel??"Confirm"})]})]})]})]})}function jv({value:e,label:t,trend:r,className:n}){return m(ii,{className:N("flex flex-col gap-1",n),children:[m("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"text-2xl font-semibold text-foreground",children:e}),r&&m("span",{className:N("inline-flex items-center gap-0.5 text-xs font-medium",r.direction==="up"?"text-success":"text-danger"),children:[r.direction==="up"?o(wp,{className:"h-3 w-3"}):o(kp,{className:"h-3 w-3"}),r.value,"%"]})]}),o("span",{className:"text-xs text-foreground-muted",children:t})]})}function Uv({items:e,className:t}){return o("dl",{className:N("flex flex-col",t),children:e.map(r=>m("div",{className:"flex items-center h-7",children:[o("dt",{className:"text-foreground-subtle text-xs w-1/3 shrink-0",children:r.key}),o("dd",{className:"text-foreground text-xs",children:r.value})]},r.key))})}function Hv({children:e,maxHeight:t=300,className:r}){const[n,s]=C(!1),a=_(()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})},[e]);return m("div",{className:N("relative group",r),children:[o(Si,{style:{maxHeight:t},children:o("pre",{className:"font-mono text-xs bg-surface p-3 rounded-md border border-border-subtle",children:o("code",{children:e})})}),o("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:o(ai,{icon:n?$t:tt,"aria-label":"Copy code",variant:"ghost",size:"sm",onClick:a})})]})}function Vv({filters:e,values:t,onChange:r,className:n}){const s=$r(),[a,i]=C(!1),d=(c,u)=>{r({...t,[c]:u})},l=Object.values(t).filter(c=>c!==void 0&&c!=="").length;if(s){const c=e.find(p=>p.type==="search"),u=e.some(p=>p.type!=="search");return m("div",{className:N("flex items-center gap-2",n),children:[c&&o(Cn,{placeholder:c.placeholder??"Search...",value:t[c.key]??"",onChange:p=>d(c.key,p.target.value),leftSlot:o(Zt,{className:"h-3 w-3 text-foreground-subtle"}),className:"flex-1"}),u&&m(Se,{children:[m("button",{onClick:()=>i(!0),className:"flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-foreground-muted hover:bg-surface-hover transition-colors shrink-0",children:[o(gp,{className:"h-3.5 w-3.5"}),"Filters",l>0&&o(ht,{variant:"info",className:"ml-1 text-[10px] px-1 py-0",children:l})]}),o(yi,{open:a,onClose:()=>i(!1),title:"Filters",children:o("div",{className:"flex flex-col gap-3",children:e.filter(p=>p.type!=="search").map(p=>{switch(p.type){case"select":return m("div",{children:[o("label",{className:"text-xs text-foreground-muted mb-1 block",children:p.label}),o(Pr,{options:p.options,value:t[p.key]??"",onChange:h=>d(p.key,h.target.value),className:"w-full"})]},p.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1 flex-wrap",children:p.options.map(h=>{const g=t[p.key]===h.value;return o("button",{type:"button",onClick:()=>d(p.key,g?void 0:h.value),children:o(ht,{variant:g?"info":"default",className:"cursor-pointer",children:h.label})},h.value)})},p.key);default:return null}})})})]})]})}return o("div",{className:N("flex items-center gap-2 flex-wrap",n),children:e.map(c=>{switch(c.type){case"search":return o(Cn,{placeholder:c.placeholder??"Search...",value:t[c.key]??"",onChange:u=>d(c.key,u.target.value),leftSlot:o(Zt,{className:"h-3 w-3 text-foreground-subtle"}),className:"w-48"},c.key);case"select":return o(Pr,{options:c.options,value:t[c.key]??"",onChange:u=>d(c.key,u.target.value),className:"w-36"},c.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1",children:c.options.map(u=>{const p=t[c.key]===u.value;return o("button",{type:"button",onClick:()=>d(c.key,p?void 0:u.value),children:o(ht,{variant:p?"info":"default",className:"cursor-pointer",children:u.label})},u.value)})},c.key);default:return null}})})}function Vo({label:e,icon:t,href:r,badge:n,active:s=!1,className:a}){return m("a",{href:r,className:N("flex items-center gap-2 h-7 px-2 text-[11px] transition-colors",s?"border-l-2 border-primary bg-primary/[0.08] text-foreground rounded-r-md":"text-foreground-subtle hover:bg-surface-hover rounded-md",a),children:[o(t,{className:"h-3.5 w-3.5 shrink-0"}),o("span",{className:"truncate flex-1",children:e}),n!==void 0&&o(ht,{className:"ml-auto text-[10px] px-1.5 py-0",children:n})]})}function qo({logo:e,sections:t,footer:r,onNavigate:n,className:s}){return m("nav",{className:N("bg-surface border-r border-border h-full flex flex-col",s),children:[e&&o("div",{className:"px-3 py-2 shrink-0",children:e}),o("div",{className:"flex-1 overflow-auto px-1 py-1",children:t.map((a,i)=>m("div",{className:N(i>0?"mt-3":""),children:[a.label&&o("span",{className:"text-[10px] text-foreground-disabled uppercase tracking-wider px-2 mb-1 block",children:a.label}),o("div",{className:"flex flex-col gap-0.5",onClick:n,children:a.items.map(d=>o(Vo,{...d},d.href))})]},i))}),r&&r.length>0&&m("div",{className:"shrink-0 px-1 pb-1",children:[o(ci,{className:"mb-1"}),o("div",{className:"flex flex-col gap-0.5",onClick:n,children:r.map(a=>o(Vo,{...a},a.href))})]})]})}function qv({sidebar:e,header:t,mobileLogo:r,mobileActions:n,children:s,className:a}){const i=$r(),[d,l]=C(!1);return m("div",{className:N("flex h-screen",a),children:[!i&&o(qo,{...e,className:N("w-44",e.className)}),i&&o(Hp,{open:d,onClose:()=>l(!1),width:"w-64",children:o(qo,{...e,onNavigate:()=>l(!1),className:"w-full border-r-0"})}),m("div",{className:"flex flex-1 flex-col min-w-0",children:[i&&m("header",{className:"flex items-center h-12 border-b border-border px-3 shrink-0 bg-surface/80 backdrop-blur-sm",children:[o("button",{onClick:()=>l(!0),className:"p-1.5 -ml-1.5 rounded-md hover:bg-surface-hover text-foreground-muted transition-colors","aria-label":"Open menu",children:o(np,{className:"h-5 w-5"})}),r&&o("div",{className:"flex-1 flex justify-center",children:r}),n&&o("div",{className:"shrink-0",children:n})]}),!i&&t&&m("header",{className:"flex items-center h-10 border-b border-border px-4 shrink-0",children:[t.breadcrumbs&&t.breadcrumbs.length>0&&o("nav",{className:"flex items-center gap-1 text-xs flex-1 min-w-0",children:t.breadcrumbs.map((c,u)=>{const p=u===t.breadcrumbs.length-1;return m("span",{className:"flex items-center gap-1",children:[u>0&&o(dt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),c.href&&!p?o("a",{href:c.href,className:"text-foreground-subtle hover:text-foreground transition-colors truncate",children:c.label}):o("span",{className:"text-foreground truncate",children:c.label})]},u)})}),t.actions&&o("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:t.actions})]}),o("main",{className:"flex-1 overflow-auto p-4",children:s})]})]})}var hf={online:"bg-success",offline:"bg-danger",warning:"bg-warning",unknown:"bg-foreground-subtle"};function Wv({title:e,subtitle:t,status:r,selected:n,onClick:s,badges:a,actions:i,offlineAction:d,className:l}){const c=r==="offline";return m("div",{onClick:s,className:N("w-full rounded-lg border p-3 text-left transition-colors",s&&"cursor-pointer",n?"border-primary bg-primary/10":"border-border bg-surface hover:bg-surface-hover",c&&!n&&"opacity-50",l),children:[m("div",{className:"flex items-center justify-between mb-2",children:[o("span",{className:"text-sm font-medium truncate",children:e}),r&&o("span",{className:N("h-2 w-2 rounded-full shrink-0",hf[r])})]}),t&&o("div",{className:"text-[11px] text-foreground-muted",children:t}),a&&a.length>0&&o("div",{className:"flex flex-wrap gap-1 mt-2",children:a.map((u,p)=>{const h=N("rounded px-1.5 py-0.5 text-[10px] flex items-center gap-0.5",n?"bg-primary/20":"bg-surface-hover",u.onClick&&"hover:opacity-80 transition-opacity cursor-pointer");return u.onClick?m("button",{onClick:g=>{g.stopPropagation(),u.onClick()},className:h,children:[u.icon,u.label]},p):m("span",{className:h,children:[u.icon,u.label]},p)})}),!c&&i&&i.length>0&&o("div",{className:"flex items-center gap-0.5 mt-2 -mb-1",children:i.map((u,p)=>o("button",{onClick:h=>{h.stopPropagation(),u.onClick()},className:"p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground transition-colors",title:u.label,"aria-label":u.label,children:u.icon},p))}),c&&d&&o("div",{className:"mt-2",onClick:u=>u.stopPropagation(),children:d})]})}function Kv({children:e,minCardWidth:t=220,gap:r=3,className:n}){return o("div",{className:N("p-4 overflow-y-auto flex-1 content-start",n),style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:`${r*4}px`},children:e})}var gf="capability.binding-changed";function zr(e,t){const[r,n]=C(null);return U(()=>{if(t===null){n(null);return}let s=!1;const a=async()=>{try{const d=await e.deviceManager.getBindings.query({deviceId:t});s||n(d)}catch{s||n(d=>d)}};a();const i=e.live?.onEvent.subscribe({category:gf},{onData:d=>{const l=d.data?.source;if(!l){a();return}l.type==="device"&&l.id===t&&a()}});return()=>{s=!0,i?.unsubscribe()}},[e,t]),K(()=>r?$l(e,r):null,[e,r])}function Ri(e){const t=_(n=>e?e.subscribe(()=>n()):()=>{},[e]),r=_(()=>e?.value,[e]);return zn(t,r,r)}function bf(e,t,r){const n=zr(e,t);return Ri(n?r(n.state):void 0)}function nr(e){const t=zr(e.trpc,e.deviceId),r=Ri(t!==null?e.slice(t):void 0),n=t!==null?e.cap(t):void 0;return{dev:t,cap:n,slice:r,available:(e.requireFeature===void 0||(e.deviceFeatures??[]).includes(e.requireFeature))&&n!==void 0&&r!==void 0}}function Yv(e){return e.parentDeviceId===null?"top-level":e.role?"accessory":"adopted"}var vf={minimal:{showIntegrationIcon:!1,showParentBadge:!1,showSnapshot:!1,showBattery:!1,showStableId:!1,showId:!1,showSwitchToggle:!0,showChildrenAccordion:!1},compact:{showIntegrationIcon:!0,showParentBadge:!0,showSnapshot:!0,showBattery:!0,showStableId:!1,showId:!1,showSwitchToggle:!0,showChildrenAccordion:!0},expanded:{showIntegrationIcon:!1,showParentBadge:!0,showSnapshot:!0,showBattery:!0,showStableId:!0,showId:!0,showSwitchToggle:!0,showChildrenAccordion:!0}};function yf(e){const t=vf[e.variant??"compact"];return{showIntegrationIcon:e.showIntegrationIcon??t.showIntegrationIcon,showParentBadge:e.showParentBadge??t.showParentBadge,showSnapshot:e.showSnapshot??t.showSnapshot,showBattery:e.showBattery??t.showBattery,showStableId:e.showStableId??t.showStableId,showId:e.showId??t.showId,showSwitchToggle:e.showSwitchToggle??t.showSwitchToggle,showChildrenAccordion:e.showChildrenAccordion??t.showChildrenAccordion}}var xf={siren:Lr,floodlight:Za,spotlight:ni,"pir-sensor":ei,chime:op,autotrack:Va,nightvision:Xn,"privacy-mask":Zn,doorbell:qa},wf={camera:Kn,hub:Nn,nvr:Nn,light:Za,siren:Lr,switch:xp,sensor:ei,thermostat:yp,button:Uu,generic:Jn};function Ii(e){return e.role?xf[e.role]??Jn:wf[e.type.toLowerCase()]??Kn}var _i={"native-snapshot":Xu,"two-way-audio":Xa,"pan-tilt-zoom":Va,"ptz-autotrack":rp,"doorbell-button":qa,"motion-trigger":ot,"battery-operated":Ua,rebootable:ri},Ti={"native-snapshot":"Native snapshot","two-way-audio":"Two-way audio","pan-tilt-zoom":"Pan-Tilt-Zoom","ptz-autotrack":"PTZ autotrack","doorbell-button":"Doorbell button","motion-trigger":"Motion trigger","battery-operated":"Battery operated",rebootable:"Rebootable"},kf={"native-snapshot":"snapshot",rebootable:"reboot","pan-tilt-zoom":"ptz","ptz-autotrack":"ptz-autotrack","two-way-audio":"intercom","motion-trigger":"motion-trigger"},Di=new Set(["camera","hub","nvr"]);function Li(e){return!Di.has(e.type.toLowerCase())}function Wo(e){return e.role?!0:!Di.has(e.type.toLowerCase())}function Oi(e){return(e.features??[]).includes("motion-trigger")}function Nf(e){if(e.length<=24)return e;const t=e.lastIndexOf(":");if(t>=0&&t<e.length-4)return e.slice(t+1);const r=e.split("-");if(r.length>2){const n=r.slice(-2).join("-");if(n.length>=6)return n}return`…${e.slice(-18)}`}function Sf({trpc:e,accessoryChildren:t,adoptedChildren:r,onNavigate:n}){return m("div",{className:"border-t border-border-subtle/50",children:[r.length>0&&o(Ko,{trpc:e,label:"Adopted devices",rows:r,onNavigate:n}),t.length>0&&o(Ko,{trpc:e,label:"Accessories",rows:t,onNavigate:n})]})}function Ko({trpc:e,label:t,rows:r,onNavigate:n}){return m("div",{children:[o("div",{className:"px-3 pt-1.5 pb-1 text-[9px] font-semibold uppercase tracking-wide text-foreground-subtle",children:t}),o("ul",{children:r.map(s=>o(Cf,{trpc:e,child:s,onNavigate:n},s.id))})]})}function Cf({trpc:e,child:t,onNavigate:r}){const n=!t.disabled,s=n&&Li(t),a=n&&Oi(t);return o("li",{children:m("div",{onClick:i=>{i.stopPropagation(),r(t.id)},className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-hover transition-colors cursor-pointer",children:[o(Ii(t),{className:"h-3 w-3 text-foreground-subtle flex-shrink-0"}),o("span",{className:"text-[10.5px] text-foreground flex-1 truncate",children:t.name}),a&&o(Ef,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Mf,{trpc:e,deviceId:t.id}),o("span",{className:N("h-1.5 w-1.5 rounded-full flex-shrink-0",t.online?"bg-success":"bg-foreground-subtle/40"),title:t.online?"Online":"Offline"})]})})}function Mf({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=nr({trpc:e,deviceId:t,cap:p=>p.switch,slice:p=>p.state.switch}),[i,d]=C(!1);if(r!==null&&!n)return null;const l=s?.on===!0,c={transform:l?"translateX(14px)":"translateX(2px)"},u=async p=>{if(p.stopPropagation(),!(i||!a||!n)){d(!0);try{await n.setState({on:!l})}finally{d(!1)}}};return o("button",{type:"button",onClick:p=>{u(p)},disabled:i||!a,className:N("relative inline-flex h-4 w-7 items-center rounded-full border transition-colors flex-shrink-0",l?"bg-success/30 border-success/50":"bg-surface-hover border-border",i&&"opacity-60",!a&&"opacity-40 cursor-not-allowed"),title:a?l?"Turn off":"Turn on":"Awaiting state…","aria-pressed":l,children:o("span",{className:N("absolute h-3 w-3 rounded-full transition-all",l?"bg-success":"bg-foreground-subtle"),style:c})})}function Ef({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=nr({trpc:e,deviceId:t,cap:p=>p.motionTrigger,slice:p=>p.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[d,l]=C(!1);if(n!==null&&!s)return null;const c=a?.enabled===!0,u=async p=>{if(p.stopPropagation(),!(d||!i||!s)){l(!0);try{await s.setMotionTrigger({enabled:!c})}finally{l(!1)}}};return o("button",{type:"button",onClick:p=>{u(p)},disabled:d||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",c?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(d||!i)&&"opacity-50"),title:i?c?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":c,children:o(ot,{className:"h-2.5 w-2.5"})})}function $i({trpc:e,device:t,flags:r}){if(t.disabled)return null;const n=t.type.toLowerCase(),s=r.showSwitchToggle&&Li(t),a=Oi(t),i=n==="hub"||n==="nvr",d=(t.features??[]).includes("rebootable"),l=i&&d;return m(Se,{children:[a&&o(Pf,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Af,{trpc:e,deviceId:t.id}),l&&o(If,{trpc:e,deviceId:t.id})]})}function Af({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=nr({trpc:e,deviceId:t,cap:p=>p.switch,slice:p=>p.state.switch}),[i,d]=C(!1);if(r!==null&&!n)return null;const l=s?.on===!0,c={transform:l?"translateX(14px)":"translateX(2px)"},u=async p=>{if(p.stopPropagation(),!(i||!a||!n)){d(!0);try{await n.setState({on:!l})}finally{d(!1)}}};return o("button",{type:"button",onClick:p=>{u(p)},disabled:i||!a,className:N("relative inline-flex h-4 w-7 items-center rounded-full border transition-colors flex-shrink-0",l?"bg-success/30 border-success/50":"bg-surface-hover border-border",i&&"opacity-60",!a&&"opacity-40 cursor-not-allowed"),title:a?l?"Turn off":"Turn on":"Awaiting state…","aria-pressed":l,children:o("span",{className:N("absolute h-3 w-3 rounded-full transition-all",l?"bg-success":"bg-foreground-subtle"),style:c})})}function Pf({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=nr({trpc:e,deviceId:t,cap:p=>p.motionTrigger,slice:p=>p.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[d,l]=C(!1);if(n!==null&&!s)return null;const c=a?.enabled===!0,u=async p=>{if(p.stopPropagation(),!(d||!i||!s)){l(!0);try{await s.setMotionTrigger({enabled:!c})}finally{l(!1)}}};return o("button",{type:"button",onClick:p=>{u(p)},disabled:d||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",c?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(d||!i)&&"opacity-50"),title:i?c?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":c,children:o(ot,{className:"h-2.5 w-2.5"})})}var Jr=168,Rf=4;function If({trpc:e,deviceId:t}){const{dev:r,cap:n}=nr({trpc:e,deviceId:t,cap:y=>y.reboot,slice:()=>{}}),s=W(null),a=W(null),[i,d]=C(null),[l,c]=C(!1),u=r!==null&&n!==void 0&&n!==null,p=i!==null,h=()=>d(null),g=()=>{const y=s.current;if(!y)return;const x=y.getBoundingClientRect(),w=x.right-Jr,k=Math.max(8,Math.min(w,window.innerWidth-Jr-8));d({top:x.bottom+Rf,left:k})};if(U(()=>{if(!p)return;const y=w=>{const k=s.current,M=a.current,S=w.target;S!==null&&(k&&k.contains(S)||M&&M.contains(S)||h())},x=w=>{w.key==="Escape"&&(w.stopPropagation(),h())};return document.addEventListener("mousedown",y),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",x)}},[p]),r!==null&&!n)return null;const b=y=>{y.stopPropagation(),p?h():g()},v=async()=>{if(!(l||!u||!n)){c(!0),h();try{await n.reboot({})}finally{c(!1)}}};return m(Se,{children:[o("button",{ref:s,type:"button",onClick:b,disabled:l||!u,className:N("inline-flex h-5 w-5 items-center justify-center rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors flex-shrink-0",(l||!u)&&"opacity-50",p&&"bg-surface-hover text-foreground"),title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":p,children:o(Wa,{className:"h-3 w-3"})}),i&&_r(o("div",{ref:a,role:"menu",style:{position:"fixed",top:i.top,left:i.left,width:Jr},className:"z-[9999] rounded-md border border-border bg-surface shadow-lg shadow-black/30 p-1",onClick:y=>y.stopPropagation(),children:m("button",{type:"button",role:"menuitem",onClick:()=>{v()},disabled:l||!u,className:N("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[11px] text-foreground","hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed"),children:[o(ri,{className:"h-3 w-3 shrink-0 text-foreground-subtle"}),o("span",{children:"Reboot device"})]})}),document.body)]})}var _f=Object.freeze([]);function Tf(e){return e==="native"?"native":"enhanced"}function Df(e){return e.map(t=>({kind:"marker",feature:t}))}function Lf(e,t){const r=new Map,n=t.entries??[];for(const a of n)r.set(a.capName,a);const s=[];for(const a of e){const i=kf[a];if(i===void 0){s.push({kind:"marker",feature:a});continue}const d=r.get(i);d&&s.push({kind:Tf(d.kind),feature:a,capName:i})}return s}function Of(e,t,r){const[n,s]=C(null),[a,i]=C(!1),[d,l]=C(!0);return U(()=>{if(t===null){s(null),i(!1),l(!1);return}let c=!1;l(!0),i(!1);const u=async()=>{try{const h=await e.deviceManager.getBindings.query({deviceId:t});if(c)return;s(h),l(!1)}catch{if(c)return;i(!0),l(!1)}};u();const p=e.live?.onEvent.subscribe({category:"capability.binding-changed"},{onData:h=>{const g=h.data?.source;if(!g){u();return}g.type==="device"&&g.id===t&&u()}});return()=>{c=!0,p?.unsubscribe()}},[e,t]),r.length===0?{loading:d,resolved:_f}:d||a||!n?{loading:d,resolved:Df(r)}:{loading:!1,resolved:Lf(r,n)}}var $f=[];function Bi({trpc:e,device:t,flags:r,accessoryCount:n,adoptedCount:s,showFeatureRow:a=!1}){const i=n+s,d=r.showChildrenAccordion&&i>0,l=t.features??$f,c=a&&l.length>0,{resolved:u}=Of(e,c?t.id:null,l),p=c&&u.length>0;return!d&&!p?null:m("div",{className:"flex items-center gap-1.5 flex-nowrap whitespace-nowrap min-w-0",children:[d&&o(Bf,{accessoryCount:n,adoptedCount:s}),p&&o(zf,{resolved:u})]})}function Bf({accessoryCount:e,adoptedCount:t}){const r=e+t;return r===0?null:m("span",{className:"text-[9px] font-medium text-foreground-subtle bg-surface-elevated/60 rounded px-1.5 py-0.5 flex-shrink-0",title:t>0&&e>0?`${String(t)} adopted · ${String(e)} accessor${e===1?"y":"ies"}`:t>0?`${String(t)} adopted`:`${String(e)} accessor${e===1?"y":"ies"}`,children:["+",r]})}var zi=240,Yo=200;function zf({resolved:e}){const t=W(null),[r,n]=C(null);return m("span",{ref:t,className:"relative inline-flex items-center gap-1 cursor-help",onMouseEnter:()=>{const i=t.current;if(!i)return;const d=i.getBoundingClientRect();n({top:window.innerHeight-d.bottom>=Yo?d.bottom+4:d.top-Yo-4,left:Math.max(8,Math.min(d.left,window.innerWidth-zi-8))})},onMouseLeave:()=>n(null),children:[e.map(i=>{const d=_i[i.feature];return d?o("span",{className:"inline-flex items-center justify-center h-4 w-4 rounded bg-surface-elevated/60 text-foreground-subtle",title:Ti[i.feature]??i.feature,children:o(d,{className:"h-2.5 w-2.5"})},i.feature):null}),r&&_r(o(Ff,{resolved:e,position:r}),document.body)]})}function Ff({resolved:e,position:t}){return m("div",{style:{position:"fixed",top:t.top,left:t.left,width:zi,pointerEvents:"none"},className:"z-[9999] rounded-md border border-border bg-surface shadow-lg shadow-black/30 p-2",children:[o("h5",{className:"text-[9px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1.5",children:"Features"}),o("ul",{className:"space-y-0.5",children:e.map(r=>o(Gf,{entry:r},r.feature))})]})}function Gf({entry:e}){const t=_i[e.feature],r=Ti[e.feature]??e.feature;return m("li",{className:"flex items-center justify-between gap-2 text-[10px]",children:[m("span",{className:"flex items-center gap-1.5 text-foreground",children:[t&&o(t,{className:"h-3 w-3 text-foreground-subtle"}),o("span",{children:r})]}),o(Qf,{kind:e.kind})]})}function Qf({kind:e}){return e==="marker"?o("span",{className:"text-[8.5px] px-1 rounded text-foreground-subtle",title:"Informational marker (no cap registered)",children:"marker"}):o("span",{className:N("text-[8.5px] px-1 rounded",e==="native"?"bg-success/15 text-success":"bg-primary/15 text-primary"),children:e})}function Fi({device:e,variant:t,flags:r,parent:n,integrationIcon:s,hasChildren:a,expanded:i,onToggleExpand:d,onNavigateToParent:l}){const c=Ii(e);return m("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.showChildrenAccordion&&a?o("button",{type:"button",onClick:u=>{u.stopPropagation(),d()},className:"flex h-3.5 w-3.5 items-center justify-center text-foreground-subtle hover:text-foreground transition-colors flex-shrink-0","aria-label":i?"Collapse children":"Expand children","aria-expanded":i,children:i?o(yt,{className:"h-3 w-3"}):o(dt,{className:"h-3 w-3"})}):r.showChildrenAccordion?o("span",{className:"h-3.5 w-3.5 flex-shrink-0"}):null,o(c,{className:N("text-foreground-subtle flex-shrink-0",t==="minimal"?"h-3 w-3":"h-3.5 w-3.5")}),m("div",{className:"flex-1 min-w-0",children:[m("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.showIntegrationIcon&&s&&o("span",{className:"flex-shrink-0",children:s}),o("span",{className:N("font-semibold text-foreground truncate",t==="minimal"?"text-[10.5px]":"text-[11px]"),title:e.name,children:e.name})]}),(r.showId||r.showStableId)&&m("div",{className:"mt-0.5 flex items-center gap-1 text-[9px] text-foreground-subtle font-mono truncate",title:r.showStableId?`stableId: ${e.stableId}`:void 0,children:[r.showId&&m("span",{className:"flex-shrink-0 tabular-nums",children:["#",String(e.id)]}),r.showId&&r.showStableId&&o("span",{className:"flex-shrink-0 opacity-50",children:"·"}),r.showStableId&&o("span",{className:"truncate",children:Nf(e.stableId)})]}),r.showParentBadge&&n&&m("button",{type:"button",onClick:u=>{u.stopPropagation(),l(n.id)},className:"mt-0.5 inline-flex max-w-full items-center gap-1 text-[9px] text-foreground-subtle hover:text-primary transition-colors",title:`Open parent: ${n.name} (#${String(n.id)})`,children:[o(Nn,{className:"h-2.5 w-2.5 shrink-0"}),m("span",{className:"truncate",children:["Under: ",n.name]})]})]})]})}function jf(e,t){return bf(e,t,r=>r.battery)??null}function Uf(e,t){const r=zr(e,t),n=W(!1),{data:s,isLoading:a,isFetching:i,refetch:d}=Rs({queryKey:["device",t,"snapshot"],queryFn:()=>{if(!r)throw new Error("useDeviceSnapshotImage: device proxy not ready");const u=n.current;return n.current=!1,r.snapshot?.getSnapshot({force:u})??null},enabled:r!==null&&t!==null,staleTime:1e4,gcTime:1440*60*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),l=s?`data:${s.contentType};base64,${s.base64}`:null;function c(){n.current=!0,d()}return{src:l,loading:a||i,refresh:c}}function Hf(e){return e<=10?$u:e<=30?Ou:e>=95?Lu:Ua}function Vf(e,t){return t!=="none"?"text-emerald-400":e<=10?"text-rose-400":e<=30?"text-amber-400":"text-foreground-subtle"}function qf({status:e,variant:t="compact",className:r}){if(!e)return null;const n=Hf(e.percentage),s=Vf(e.percentage,e.charging),a=e.charging==="solar"?ni:e.charging==="dc"?ap:null,i=e.sleeping;return m("span",{className:N("inline-flex items-center gap-1 text-[10px] font-medium",s,r),title:`Battery: ${Math.round(e.percentage)}%`+(e.charging!=="none"?` · charging (${e.charging})`:"")+(e.sleeping?" · sleeping":""),children:[o(n,{className:"h-3.5 w-3.5"}),m("span",{children:[Math.round(e.percentage),"%"]}),a&&o(a,{className:"h-3 w-3"}),i&&o(Xn,{className:"h-3 w-3 text-blue-300"}),t==="full"&&e.charging!=="none"&&o("span",{className:"text-foreground-subtle",children:e.charging})]})}function Gi({trpc:e,device:t,status:r,enabled:n,showStatusPills:s=!1}){const a=Uf(e,n&&t.online?t.id:null),i=(t.features??[]).includes("battery-operated"),d=s&&i&&!t.disabled,l=jf(e,d?t.id:null);return!n&&!d?null:m("span",{className:"inline-flex items-center gap-1.5 flex-nowrap whitespace-nowrap",children:[d&&l&&o(qf,{status:l}),n&&o(Wf,{deviceName:t.name,snapshotUrl:a.src,status:r})]})}var en=288,Zo=196,tn=8;function Wf({deviceName:e,snapshotUrl:t,status:r}){const n=W(null),[s,a]=C(null),i=r==="offline"||r==="disabled",d=()=>{const c=n.current;if(!c)return;const u=c.getBoundingClientRect(),p=u.top,h=window.innerHeight-u.bottom,g=p<Zo+tn&&h>p,b=g?u.bottom+tn:u.top-Zo-tn,v=u.right-en;a({top:b,left:Math.max(8,Math.min(v,window.innerWidth-en-8)),placeBelow:g})},l=()=>a(null);return m(Se,{children:[o("button",{ref:n,type:"button",onClick:c=>c.stopPropagation(),onMouseEnter:d,onMouseLeave:l,onFocus:d,onBlur:l,className:"flex h-6 w-6 items-center justify-center rounded text-foreground-subtle hover:bg-surface-hover hover:text-foreground transition-colors flex-shrink-0",title:"Preview","aria-label":"Preview snapshot",children:o(Bt,{className:"h-3.5 w-3.5"})}),s&&_r(m("div",{style:{position:"fixed",top:s.top,left:s.left,width:en,pointerEvents:"none"},className:"rounded-lg border border-border bg-surface shadow-lg shadow-black/30 z-[9999] overflow-hidden",children:[o("div",{className:"h-40 bg-background flex items-center justify-center",children:t&&!i?o("img",{src:t,alt:e,className:"h-full w-full object-cover"}):o("span",{className:"text-xs text-foreground-subtle",children:r==="offline"?"Offline — no snapshot":r==="disabled"?"Disabled":"No snapshot yet"})}),o("div",{className:"px-3 py-2",children:o("p",{className:"text-xs font-semibold text-foreground truncate",children:e})})]}),document.body)]})}function Qi({status:e}){const t=e==="disabled"?"bg-warning":e==="online"?"bg-success":"bg-danger",r=e==="disabled"?"Disabled":e==="online"?"Online":"Offline";return o("span",{className:N("h-1.5 w-1.5 rounded-full flex-shrink-0",t),title:r})}function An(e){const{trpc:t,device:r,parent:n,integrationIcon:s,onNavigate:a,className:i}=e,d=yf(e),l=e.variant??"compact",c=e.view??"card",u=!r.disabled,p=r.isCamera??r.type.toLowerCase()==="camera",h=e.children??[],g=h.filter(Wo),b=h.filter(I=>!Wo(I)),v=h.length>0,[y,x]=C(!1),w=e.expanded??y,k=e.onToggleExpand??(()=>x(I=>!I)),M=I=>{a?.(I)},S=e.indentLevel??(e.isAccessoryRow?2:0),E=u?r.online?"online":"offline":"disabled";return c==="table"?o(Yf,{trpc:t,device:r,variant:l,flags:d,parent:n??null,integrationIcon:s??null,accessoryCount:g.length,adoptedCount:b.length,hasChildren:v,expanded:w,onToggleExpand:k,onNavigate:M,displayStatus:E,isCamera:p,showSnapshot:d.showSnapshot&&p,isAccessoryRow:e.isAccessoryRow??!1,indentLevel:S,className:i}):m("div",{className:N("rounded-lg border border-border bg-surface transition-colors",!u&&"opacity-60",i),children:[m("div",{onClick:()=>M(r.id),className:N("flex items-center gap-2 cursor-pointer hover:border-foreground-subtle/30 w-full",l==="minimal"?"px-2.5 py-1.5":"px-3 py-2.5"),children:[o(Fi,{device:r,variant:l,flags:d,parent:n??null,integrationIcon:s??null,hasChildren:v,expanded:w,onToggleExpand:k,onNavigateToParent:M}),o(Bi,{trpc:t,device:r,flags:d,accessoryCount:g.length,adoptedCount:b.length,showFeatureRow:!1}),o(Gi,{trpc:t,device:r,status:E,enabled:d.showSnapshot&&p,showStatusPills:!0}),o($i,{trpc:t,device:r,flags:d}),o(Qi,{status:E})]}),w&&v&&o(Sf,{trpc:t,accessoryChildren:g,adoptedChildren:b,onNavigate:M})]})}var Kf={0:"pl-2",1:"pl-6",2:"pl-8"};function Yf(e){const{trpc:t,device:r,variant:n,flags:s,parent:a,integrationIcon:i,accessoryCount:d,adoptedCount:l,hasChildren:c,expanded:u,onToggleExpand:p,onNavigate:h,displayStatus:g,isCamera:b,showSnapshot:v,isAccessoryRow:y,indentLevel:x,className:w}=e;return m("tr",{onClick:()=>h(r.id),className:N("cursor-pointer hover:bg-surface-hover transition-colors",!s.showChildrenAccordion&&"border-b border-border-subtle/40",y&&"bg-foreground-subtle/[0.03]",w),children:[o("td",{className:N("py-2 align-middle pr-2",Kf[x]),children:o(Fi,{device:r,variant:n,flags:s,parent:a,integrationIcon:i,hasChildren:c,expanded:u,onToggleExpand:p,onNavigateToParent:h})}),o("td",{className:"px-2 py-2 align-middle text-[10px] text-foreground-subtle whitespace-nowrap",children:r.type}),o("td",{className:"px-2 py-2 align-middle",children:o(Bi,{trpc:t,device:r,flags:s,accessoryCount:d,adoptedCount:l,showFeatureRow:!0})}),o("td",{className:"px-2 py-2 align-middle",children:o(Gi,{trpc:t,device:r,status:g,enabled:v&&b,showStatusPills:!0})}),o("td",{className:"px-2 py-2 align-middle text-right whitespace-nowrap",children:m("span",{className:"inline-flex items-center gap-1.5",children:[o($i,{trpc:t,device:r,flags:s}),o(Qi,{status:g})]})})]})}function Zf(e,t){const[r,n]=C(e);return U(()=>{const s=setTimeout(()=>n(e),t);return()=>clearTimeout(s)},[e,t]),r}var Xf=new Set(["hub","nvr"]);function Jf(e){const t=new Map;for(const s of e)t.set(s.id,s);const r=[],n=new Map;for(const s of e){const a=s.parentDeviceId;if(a==null){r.push(s);continue}const i=t.get(a);if(!i){r.push(s);continue}const d=s.role!==null&&s.role!==void 0;if(Xf.has(i.type)&&!d){r.push(s);continue}const l=n.get(a);l?l.push(s):n.set(a,[s])}return{topLevel:r,accessoriesByParent:n}}var Xo=2;function em(e,t){if(t<=1)return[{kind:"page",n:1}];if(t<=7){const a=[];for(let i=1;i<=t;i++)a.push({kind:"page",n:i});return a}const r=[],n=Math.max(2,e-Xo),s=Math.min(t-1,e+Xo);r.push({kind:"page",n:1}),n>2&&r.push({kind:"ellipsis",side:"left"});for(let a=n;a<=s;a++)r.push({kind:"page",n:a});return s<t-1&&r.push({kind:"ellipsis",side:"right"}),r.push({kind:"page",n:t}),r}function tm({currentPage:e,totalItems:t,pageSize:r,onPageChange:n,itemNoun:s="devices"}){if(t<=r)return null;const a=Math.ceil(t/r),i=(e-1)*r+1,d=Math.min(e*r,t),l=em(e,a);return m("div",{className:"flex items-center justify-between gap-4 flex-wrap pt-2 text-[11px] text-foreground-subtle",children:[m("span",{children:["Showing ",i,"–",d," of ",t," ",s]}),m("span",{className:"inline-flex items-center gap-1",children:[o("button",{type:"button","aria-label":"Previous page",disabled:e===1,onClick:()=>n(e-1),className:N("inline-flex items-center justify-center h-7 w-7 rounded border border-border bg-surface text-foreground-subtle","hover:text-foreground hover:bg-surface-hover transition-colors","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-surface"),children:o(Gu,{className:"h-3 w-3"})}),l.map((c,u)=>c.kind==="ellipsis"?o("span",{className:"px-1 text-foreground-subtle/60 select-none",children:"…"},`e-${u}`):o("button",{type:"button",onClick:()=>n(c.n),className:N("inline-flex items-center justify-center h-7 min-w-7 px-1.5 rounded border text-[10.5px] font-medium transition-colors",c.n===e?"border-primary/40 bg-primary/10 text-primary":"border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),children:c.n},`p-${c.n}`)),o("button",{type:"button","aria-label":"Next page",disabled:e===a,onClick:()=>n(e+1),className:N("inline-flex items-center justify-center h-7 w-7 rounded border border-border bg-surface text-foreground-subtle","hover:text-foreground hover:bg-surface-hover transition-colors","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-surface"),children:o(dt,{className:"h-3 w-3"})})]})]})}function rm({view:e,onViewChange:t,types:r,currentType:n,onTypeChange:s,addons:a,currentAddon:i,onAddonChange:d,hideAddons:l=!1}){return m("div",{className:"flex items-center gap-2 flex-wrap",children:[m("span",{className:"inline-flex border border-border rounded-md overflow-hidden",children:[o("button",{type:"button",onClick:()=>t("cards"),className:N("inline-flex items-center justify-center h-7 w-8 transition-colors",e==="cards"?"bg-primary/10 text-primary":"bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),"aria-label":"Cards view",children:o(tp,{className:"h-3.5 w-3.5"})}),o("button",{type:"button",onClick:()=>t("table"),className:N("inline-flex items-center justify-center h-7 w-8 border-l border-border transition-colors",e==="table"?"bg-primary/10 text-primary":"bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),"aria-label":"Table view",children:o(vp,{className:"h-3.5 w-3.5"})})]}),r&&r.length>0&&m(Se,{children:[o(Jo,{children:"Type"}),o(rn,{active:n===null,onClick:()=>s(null),children:"All"}),r.map(c=>o(rn,{active:n===c,onClick:()=>s(n===c?null:c),children:nm(c)},c))]}),!l&&a&&a.length>0&&m(Se,{children:[o(Jo,{children:"Integration"}),a.map(c=>o(rn,{active:i===c.id,icon:c.icon,onClick:()=>d(i===c.id?null:c.id),showClearIcon:i===c.id,children:c.name},c.id))]})]})}function Jo({children:e}){return o("span",{className:"text-[10px] font-medium uppercase tracking-wider text-foreground-subtle ml-1",children:e})}function rn({active:e,icon:t,onClick:r,showClearIcon:n,children:s}){return m("button",{type:"button",onClick:r,className:N("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-full border text-[10.5px] font-medium transition-colors",e?"border-primary/40 bg-primary/15 text-primary":"border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),children:[t&&o("span",{className:"inline-flex items-center",children:t}),o("span",{children:s}),e&&n&&o(_e,{className:"h-2.5 w-2.5 opacity-70"})]})}function nm(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function om({variant:e,onClearFilters:t}){return m("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o(Ju,{className:"h-8 w-8 text-foreground-subtle/40 mb-3"}),o("p",{className:"text-sm font-medium text-foreground-subtle",children:e==="filtered"?"No devices match the current filters":"No devices yet"}),e==="filtered"&&t&&o("button",{type:"button",onClick:t,className:"mt-2 text-[11px] text-primary hover:underline",children:"Clear filters"})]})}function Ke(e,t){if(e==="root")return t;switch(t){case"view":return"deviceView";case"page":return"devicePage";case"type":return"deviceType";case"q":return"deviceQ";case"addon":return"deviceAddon"}}function es(e){try{const t=localStorage.getItem(`camstack:${e}:lastFilters`);if(!t)return{};const r=JSON.parse(t);return typeof r!="object"||r===null?{}:r}catch{return{}}}function sm(e,t){try{localStorage.setItem(`camstack:${e}:lastFilters`,JSON.stringify(t))}catch{}}function ts(e,t,r){const n=new URLSearchParams(window.location.search),s=n.get(Ke(e,"view")),a=s==="cards"||s==="table"?s:r.view??t,i=n.get(Ke(e,"page")),d=i?parseInt(i,10):1;return{view:a,page:Number.isFinite(d)&&d>=1?d:1,addon:n.get(Ke(e,"addon"))??r.addon??null,type:n.get(Ke(e,"type"))??r.type??null,q:n.get(Ke(e,"q"))??r.q??""}}function am(e,t,r){const n=new URLSearchParams(window.location.search),s=(d,l)=>{l===null||l===""?n.delete(d):n.set(d,l)};s(Ke(e,"view"),t.view===r?null:t.view),s(Ke(e,"page"),t.page===1?null:String(t.page)),s(Ke(e,"addon"),t.addon),s(Ke(e,"type"),t.type),s(Ke(e,"q"),t.q||null);const a=n.toString(),i=a?`${window.location.pathname}?${a}`:window.location.pathname;window.history.replaceState(null,"",i)}function im(e){const{scope:t,defaultView:r,lsKey:n}=e,[s,a]=C(()=>ts(t,r,es(n))),i=W(s);i.current=s,U(()=>{const l=()=>{const c=ts(t,r,es(n));i.current=c,a(c)};return window.addEventListener("popstate",l),()=>window.removeEventListener("popstate",l)},[t,r,n]);const d=_(l=>{const c=l(i.current);i.current=c,a(c),am(t,c,r),sm(n,{view:c.view,addon:c.addon,type:c.type,q:c.q})},[t,r,n]);return{state:s,setView:_(l=>d(c=>({...c,view:l})),[d]),setPage:_(l=>d(c=>({...c,page:l})),[d]),setAddon:_(l=>d(c=>({...c,addon:l,page:1})),[d]),setType:_(l=>d(c=>({...c,type:l,page:1})),[d]),setQ:_(l=>d(c=>({...c,q:l,page:1})),[d]),clearFilters:_(()=>d(l=>({...l,addon:null,type:null,q:"",page:1})),[d])}}var lm={cards:24,table:50};function Zv(e){const{devices:t,trpc:r,defaultView:n="table",filters:s,forceAddon:a,resolveIntegrationIcon:i,resolveParent:d,onNavigate:l,pageSize:c=lm,urlScope:u="root",lsKey:p=u==="root"?"devices":"integrations:nested"}=e,h=im({scope:u,defaultView:n,lsKey:p}),g=h.state.view,b=g==="cards"?c.cards:c.table,[v,y]=C(h.state.q),x=Zf(v,300);U(()=>{x!==h.state.q&&h.setQ(x)},[x]);const w=a??h.state.addon,k=K(()=>{const se=h.state.q.toLowerCase().trim();return t.filter(ae=>!(w&&ae.addonId!==w||h.state.type&&ae.type!==h.state.type||se&&!ae.name.toLowerCase().includes(se)&&!ae.stableId.toLowerCase().includes(se)))},[t,w,h.state.type,h.state.q]),M=K(()=>Jf(k),[k]),S=K(()=>{if(h.state.q.trim()==="")return new Set;const se=h.state.q.toLowerCase().trim(),ae=new Set;for(const[le,te]of M.accessoriesByParent.entries())te.some(H=>H.name.toLowerCase().includes(se)||H.stableId.toLowerCase().includes(se))&&ae.add(le);return ae},[M.accessoriesByParent,h.state.q]),E=M.topLevel.length,I=Math.max(1,Math.ceil(E/b)),A=Math.min(h.state.page,I),F=(A-1)*b,Y=M.topLevel.slice(F,F+b);U(()=>{A!==h.state.page&&h.setPage(A)},[A]),mm();const ce=w!=null||h.state.type!==null||h.state.q!=="",ge=E===0;return m("div",{className:"flex flex-col gap-3",children:[m("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[o(rm,{view:g,onViewChange:h.setView,types:s?.types,currentType:h.state.type,onTypeChange:h.setType,addons:s?.addons,currentAddon:h.state.addon,onAddonChange:h.setAddon,hideAddons:a!==void 0}),m("div",{className:"relative",children:[o(Zt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle pointer-events-none"}),o("input",{type:"text",value:v,onChange:se=>y(se.target.value),placeholder:"Search by name or stableId","aria-label":"Search devices by name or stableId",className:"h-7 pl-7 pr-2.5 rounded-md border border-border bg-surface text-[11px] text-foreground placeholder:text-foreground-subtle/60 focus:outline-none focus:ring-1 focus:ring-primary/40 w-56"})]})]}),ge?o(om,{variant:ce?"filtered":"nofilter",onClearFilters:ce?h.clearFilters:void 0}):g==="cards"?o(cm,{rows:Y,accessoriesByParent:M.accessoriesByParent,trpc:r,resolveIntegrationIcon:i??null,resolveParent:d??null,onNavigate:l??null}):o(pm,{rows:Y,accessoriesByParent:M.accessoriesByParent,autoExpandedParents:S,devices:k,trpc:r,resolveIntegrationIcon:i??null,resolveParent:d??null,onNavigate:l??null}),o(tm,{currentPage:A,totalItems:E,pageSize:b,onPageChange:h.setPage}),a===void 0&&ce&&E>0&&m("p",{className:"text-[11px] text-foreground-subtle",children:["Showing ",E," of ",t.length," devices",w&&m(Se,{children:[" ","· filtered by"," ",o("strong",{className:"text-primary",children:s?.addons?.find(se=>se.id===w)?.name??w})]})]})]})}function cm({rows:e,accessoriesByParent:t,trpc:r,resolveIntegrationIcon:n,resolveParent:s,onNavigate:a}){return o("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(i=>{const d=t.get(i.id)??[];return o(An,{trpc:r,device:i,view:"card",integrationIcon:n?.(i.addonId)??null,parent:i.parentDeviceId!==null?s?.(i.parentDeviceId)??null:null,children:d,onNavigate:a??void 0},i.id)})})}var dm=new Set(["hub","nvr"]);function um(e,t){return e.parentDeviceId===null||t===null?0:dm.has(t.toLowerCase())?1:0}function pm({rows:e,accessoriesByParent:t,autoExpandedParents:r,devices:n,trpc:s,resolveIntegrationIcon:a,resolveParent:i,onNavigate:d}){const l=K(()=>{const c=new Map;for(const u of n)c.set(u.id,u.type);return c},[n]);return o("div",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:m("table",{className:"w-full border-collapse",children:[o("thead",{children:m("tr",{className:"border-b border-border",children:[o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle",children:"Name"}),o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-24",children:"Type"}),o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-32",children:"Features"}),o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-20",children:"Preview"}),o("th",{className:"text-right px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-32",children:"Actions"})]})}),o("tbody",{children:e.map(c=>{const u=t.get(c.id)??[],p=u.length>0,h=r.has(c.id),g=c.parentDeviceId!==null?i?.(c.parentDeviceId)??null:null,b=c.parentDeviceId!==null?l.get(c.parentDeviceId)??null:null;return o(fm,{parent:c,accessories:u,hasAccessories:p,forceExpanded:h,trpc:s,integrationIcon:a?.(c.addonId)??null,parentRowParent:g,indentLevel:um(c,b),onNavigate:d??null},c.id)})})]})})}function fm({parent:e,accessories:t,hasAccessories:r,forceExpanded:n,trpc:s,integrationIcon:a,parentRowParent:i,indentLevel:d,onNavigate:l}){const[c,u]=C(n),p=W(n);return U(()=>{p.current!==n&&(u(n),p.current=n)},[n]),m(Se,{children:[o(An,{trpc:s,device:e,view:"table",integrationIcon:a,parent:i,children:t,onNavigate:l??void 0,showChildrenAccordion:r,expanded:c,onToggleExpand:()=>u(g=>!g),indentLevel:d}),r&&c&&t.map(g=>o(An,{trpc:s,device:g,view:"table",integrationIcon:null,parent:null,isAccessoryRow:!0,showChildrenAccordion:!1,onNavigate:l??void 0},g.id))]})}function mm(){Tr()}function Xv({options:e,value:t,onChange:r}){return o("div",{className:"flex flex-wrap gap-2",children:e.map(n=>{const s=n.id===t;return m("button",{onClick:()=>n.available&&r(n.id),disabled:!n.available,className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-xs font-medium transition-all ${s?"border-primary/40 bg-primary/10 text-primary":n.available?"border-border bg-surface text-foreground-subtle hover:bg-surface-hover hover:text-foreground":"border-border/40 bg-surface/40 text-foreground-subtle/40 cursor-not-allowed"}`,children:[o(Ku,{className:"h-3.5 w-3.5 shrink-0"}),n.label,n.isBest&&m("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-amber-400",children:[o(bp,{className:"h-2.5 w-2.5"}),"Best"]}),n.platformScore!=null&&m("span",{className:"text-[10px] text-foreground-subtle/60",children:["(",n.platformScore,")"]}),o("span",{className:`h-1.5 w-1.5 rounded-full ${n.available?"bg-success":"bg-danger"}`})]},n.id)})})}function hm(e,t){const r=new Set(t.slots.flatMap(i=>i.addons.map(d=>d.id))),n=[];function s(i){if(!r.has(i.addonId))return n.push(`Addon "${i.addonId}" is no longer available — step removed`),null;const d=t.slots.flatMap(u=>u.addons).find(u=>u.id===i.addonId);let l=i.modelId;if(d&&!d.models.some(u=>u.id===l)){const u=d.defaultModelId;n.push(`Model "${l}" not available for ${i.addonId} — using "${u}"`),l=u}const c=i.children.map(u=>s(u)).filter(u=>u!==null);return{...i,modelId:l,children:c}}const a=e.map(i=>s(i)).filter(i=>i!==null);return{valid:n.length===0,steps:a,warnings:n}}function gm(e){const t=new Map;for(const r of e.slots)for(const n of r.addons)t.set(n.id,n);return t}function nn(e){return{addonId:e.id,addonName:e.name,slot:e.slot,inputClasses:[...e.inputClasses],outputClasses:[...e.outputClasses],enabled:!0,modelId:e.defaultModelId,children:[]}}function on({addon:e,onClick:t}){return o("button",{type:"button",onClick:t,className:"w-full rounded-lg border border-dashed border-border/60 px-3 py-2.5 text-left transition-all hover:border-primary/30 hover:bg-surface/60 group",children:m("div",{className:"flex items-center gap-3",children:[o(Vu,{className:"h-[18px] w-[18px] text-foreground-subtle/30 group-hover:text-primary/60 shrink-0"}),m("div",{className:"flex-1 min-w-0",children:[o("span",{className:"text-[13px] font-medium text-foreground-subtle/50 group-hover:text-foreground-subtle block truncate",children:e.name}),m("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.inputClasses.map(r=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-blue-500/8 text-blue-400/50",children:r},r)),e.inputClasses.length>0&&e.outputClasses.length>0&&o("span",{className:"text-foreground-subtle/25 text-[10px]",children:"→"}),e.outputClasses.map(r=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-green-500/8 text-green-400/50",children:r},r))]})]})]})})}function Jv({schema:e,steps:t,onChange:r,templates:n,selectedTemplateId:s,onSelectTemplate:a,onSaveTemplate:i,onUpdateTemplate:d,onDeleteTemplate:l,readOnly:c=!1,excludeAddons:u=[],hideTemplates:p=!1,showOnlyEnabled:h=!1,showSlotLabels:g=!1,toggleMode:b="simple",overrides:v={},onOverrideChange:y,inheritedEnabledByAddon:x={},hideModelAndSettings:w=!1}){const k=z=>({toggleMode:b,hideModelAndSettings:w,...b==="threeState"?{overrideState:v[z]!==void 0?v[z]:null,onOverrideChange:y?$=>y(z,$):void 0,inheritedEnabled:x[z]}:{}}),M=K(()=>new Set(u),[u]),S=K(()=>gm(e),[e]),[E,I]=C([]),A=s?JSON.stringify(t)!==JSON.stringify(n.find(z=>z.id===s)?.steps):!1;function F(z){const $=z.target.value||null;if($){const ie=n.find(V=>V.id===$);ie&&I([...hm(ie.steps,e).warnings])}else I([]);a($)}function Y(){s&&d(s,t)}function ce(){const z=window.prompt("Template name:");z?.trim()&&i(z.trim(),t)}function ge(){if(!s)return;const z=n.find($=>$.id===s);z&&window.confirm(`Delete template "${z.name}"?`)&&l(s)}function se(z){r(t.map($=>$.addonId!==z.addonId?$:ae(z)))}function ae(z){const $=z.children.some(ie=>ie.enabled||ie.children.some(V=>V.enabled));return{...z,enabled:z.enabled||$,children:z.children.map(ie=>{const V=ie.children.some(Z=>Z.enabled);return{...ie,enabled:ie.enabled||V}})}}function le(z,$){const ie=nn($);r(t.map(V=>V.addonId!==z?V:{...V,children:[...V.children,ie]}))}function te(z){const $=new Set;for(const ie of z){$.add(ie.addonId);for(const Z of ie.children)$.add(Z.addonId);const V=te(ie.children);for(const Z of V)$.add(Z)}return $}const H=te(t);function ve(z){const $=S.get(z.addonId);if(!$)return[];const ie=e.slots.find(j=>j.id===$.slot)?.parentSlot==null,V=$.childSlots,Z=new Set(z.children.map(j=>j.addonId)),X=[];for(const j of e.slots)if(V.includes(j.id))for(const oe of j.addons){if(Z.has(oe.id)||M.has(oe.id))continue;const J=oe.inputClasses.length===0;J&&!ie||(J||oe.inputClasses.some(Te=>z.outputClasses.includes(Te)))&&X.push(oe)}return X}function me(z){const $=h?{...z,children:z.children.filter(V=>V.enabled).map(V=>({...V,children:V.children.filter(Z=>Z.enabled)}))}:z,ie=h?[]:ve($);return m("div",{className:"space-y-1.5",children:[o(Zr,{step:$,schema:S.get($.addonId)??null,allSchemas:S,onChange:se,onDelete:c?void 0:V=>r(t.filter(Z=>Z.addonId!==V)),readOnly:c,...k($.addonId)}),($.children.length>0||ie.length>0)&&m("div",{className:"ml-4 pl-3 border-l border-border/60 space-y-1.5",children:[g&&o("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/40",children:"Slot: Cropper / Classifier"}),$.children.map(V=>{const Z=ve(V);return m("div",{className:"space-y-1.5",children:[o(Zr,{step:V,schema:S.get(V.addonId)??null,allSchemas:S,depth:1,onChange:X=>{se({...$,children:$.children.map(j=>j.addonId===X.addonId?X:j)})},onDelete:c?void 0:X=>{se({...$,children:$.children.filter(j=>j.addonId!==X)})},readOnly:c,...k(V.addonId)}),(V.children.length>0||Z.length>0)&&m("div",{className:"ml-4 pl-3 border-l border-border/40 space-y-1.5",children:[g&&o("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/30",children:"Slot: Recognizer"}),V.children.map(X=>o(Zr,{step:X,schema:S.get(X.addonId)??null,allSchemas:S,depth:2,onChange:j=>{se({...$,children:$.children.map(oe=>oe.addonId===V.addonId?{...oe,children:oe.children.map(J=>J.addonId===j.addonId?j:J)}:oe)})},onDelete:c?void 0:j=>{se({...$,children:$.children.map(oe=>oe.addonId===V.addonId?{...oe,children:oe.children.filter(J=>J.addonId!==j)}:oe)})},readOnly:c,...k(X.addonId)},X.addonId)),!c&&Z.map(X=>o(on,{addon:X,onClick:()=>{const j=nn(X);se({...$,children:$.children.map(oe=>oe.addonId===V.addonId?{...oe,children:[...oe.children,j]}:oe)})}},X.id))]})]},V.addonId)}),!c&&ie.map(V=>o(on,{addon:V,onClick:()=>le($.addonId,V)},V.id))]})]},$.addonId)}const T=e.slots.filter(z=>z.parentSlot===null).sort((z,$)=>z.priority-$.priority);return m("div",{className:"space-y-4",children:[!p&&o("div",{className:"rounded-lg border border-border bg-surface p-3",children:m("div",{className:"flex items-center gap-2",children:[o("div",{className:"relative flex-1 min-w-0",children:m("select",{value:s??"",onChange:F,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none focus:border-primary/50",children:[o("option",{value:"",children:"No template"}),n.map(z=>o("option",{value:z.id,children:z.name},z.id))]})}),A&&o("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500 shrink-0"}),o("button",{onClick:Y,disabled:!s||c,title:"Save",className:N("p-2 rounded-lg border border-border transition-colors",s&&!c?"text-foreground-subtle hover:bg-surface-hover":"text-foreground-subtle/30 cursor-not-allowed"),children:o(dp,{className:"h-4 w-4"})}),o("button",{onClick:ce,disabled:c,title:"Save As",className:N("p-2 rounded-lg border border-border transition-colors",c?"text-foreground-subtle/30 cursor-not-allowed":"text-foreground-subtle hover:bg-surface-hover"),children:o(Wu,{className:"h-4 w-4"})}),o("button",{onClick:ge,disabled:!s||c,title:"Delete",className:N("p-2 rounded-lg border border-border transition-colors",s&&!c?"text-foreground-subtle hover:text-danger":"text-foreground-subtle/30 cursor-not-allowed"),children:o(Ye,{className:"h-4 w-4"})})]})}),E.length>0&&m("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 text-xs text-amber-400 space-y-1",children:[m("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-medium",children:"Template loaded with warnings:"}),o("button",{onClick:()=>I([]),className:"text-amber-400/60 hover:text-amber-400",children:o(_e,{className:"h-3.5 w-3.5"})})]}),E.map((z,$)=>m("div",{children:["• ",z]},$))]}),T.map(z=>{const $=t.filter(j=>j.slot===z.id&&!M.has(j.addonId)),ie=h?$.filter(j=>j.enabled):$,V=h?[]:z.addons.filter(j=>!H.has(j.id)&&!M.has(j.id)),Z=new Map,X=[];for(const j of ie)j.group?(Z.has(j.group)||Z.set(j.group,[]),Z.get(j.group).push(j)):X.push(j);return m("div",{className:"space-y-2",children:[g&&m("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/50",children:["Slot: ",z.label]}),X.map(j=>me(j)),[...Z.entries()].map(([j,oe])=>m("div",{className:"space-y-2 rounded-lg border border-border/40 p-2",children:[o("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/50 px-1",children:j}),oe.map(J=>me(J))]},j)),!c&&V.map(j=>o(on,{addon:j,onClick:()=>{r([...t,nn(j)])}},j.id))]},z.id)})]})}var cr={person:"#3b82f6",vehicle:"#f59e0b",animal:"#22c55e",face:"#a855f7",plate:"#ec4899",bird:"#14b8a6",dog:"#84cc16",cat:"#f97316",car:"#f59e0b",truck:"#d97706",bus:"#b45309",motorcycle:"#eab308",bicycle:"#ca8a04",motion:"#facc15"},rs=["#ef4444","#8b5cf6","#06b6d4","#f97316","#10b981","#6366f1","#e11d48","#0891b2","#7c3aed","#059669"],ey="#f59e42";function Ge(e,t){if(t?.[e])return t[e];if(t?.[e.toLowerCase()])return t[e.toLowerCase()];if(cr[e])return cr[e];if(cr[e.toLowerCase()])return cr[e.toLowerCase()];let r=0;for(let n=0;n<e.length;n++)r=r*31+(e.codePointAt(n)??0)>>>0;return rs[r%rs.length]??"#f59e42"}function ty({src:e,imageWidth:t,imageHeight:r,detections:n=[],classColors:s,aspectRatio:a,className:i,placeholder:d,showConfidence:l=!0,minConfidence:c=0,borderWidth:u=2}){function p(x){return Ge(x,s)}const h=a??(t&&r?`${t}/${r}`:"16/9"),g=n.filter(x=>x.score>=c),b=g.filter(x=>x.kind==="first-level"),v=g.filter(x=>x.kind==="detail"),y=ym(v,x=>x.parentId??"");return o("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden relative",i),style:{aspectRatio:h},children:e?m(Se,{children:[o("img",{src:e,className:"absolute inset-0 w-full h-full object-fill",alt:""}),g.map((x,w)=>x.debug?.mask&&x.debug.maskWidth&&x.debug.maskHeight?o(bm,{mask:x.debug.mask,maskWidth:x.debug.maskWidth,maskHeight:x.debug.maskHeight,bbox:x.bbox,imageWidth:t,imageHeight:r,color:p(x.macroClass)},`mask-${w}`):null),b.map(x=>{const w=y.get(x.id)??[];return o(ns,{detection:x,imageWidth:t,imageHeight:r,color:p(x.macroClass),showConfidence:l,borderWidth:x.debug?.mask?1:u,children:w.map(k=>o(vm,{child:k,parentBbox:x.bbox,color:p(k.macroClass),showConfidence:l},`child-${k.id}`))},`det-${x.id}`)}),v.filter(x=>!x.parentId||!b.some(w=>w.id===x.parentId)).map(x=>o(ns,{detection:x,imageWidth:t,imageHeight:r,color:p(x.macroClass),showConfidence:l,borderWidth:u},`orphan-${x.id}`))]}):o("div",{className:"w-full h-full flex items-center justify-center text-foreground-subtle text-sm",children:d??"No image loaded"})})}function ns({detection:e,imageWidth:t,imageHeight:r,color:n,showConfidence:s,borderWidth:a,children:i}){const{x:d,y:l,width:c,height:u}=e.bbox,p=m("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"2px"},children:[m("span",{className:"text-[10px] px-1 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:n},children:[e.macroClass,s&&` ${(e.score*100).toFixed(0)}%`]}),e.labels.map((h,g)=>m("span",{className:"text-[9px] font-semibold px-1 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:Ge(h.label)},children:[h.label," ",(h.score*100).toFixed(0),"%"]},`${e.id}-lbl-${g}`))]});return m("div",{className:"absolute rounded-sm",style:{left:`${d/t*100}%`,top:`${l/r*100}%`,width:`${c/t*100}%`,height:`${u/r*100}%`,borderWidth:`${a}px`,borderStyle:"solid",borderColor:n},children:[p,i]})}function bm({mask:e,maskWidth:t,maskHeight:r,bbox:n,imageWidth:s,imageHeight:a,color:i}){const d=W(null);return U(()=>{const l=d.current;if(!l)return;const c=l.getContext("2d");if(!c)return;const u=atob(e),p=new Uint8Array(u.length);for(let x=0;x<u.length;x++)p[x]=u.charCodeAt(x);const h=parseInt(i.slice(1,3),16),g=parseInt(i.slice(3,5),16),b=parseInt(i.slice(5,7),16);l.width=t,l.height=r;const v=c.createImageData(t,r),y=t*r;for(let x=0;x<y;x++){const w=x<p.length?p[x]:0,k=x*4;w>0&&(v.data[k]=h,v.data[k+1]=g,v.data[k+2]=b,v.data[k+3]=120)}c.putImageData(v,0,0)},[e,t,r,i]),o("canvas",{ref:d,className:"absolute pointer-events-none",style:{left:`${n.x/s*100}%`,top:`${n.y/a*100}%`,width:`${n.width/s*100}%`,height:`${n.height/a*100}%`,imageRendering:"pixelated"}})}function vm({child:e,parentBbox:t,color:r,showConfidence:n}){if(t.width<=0||t.height<=0)return null;const s=(e.bbox.x-t.x)/t.width*100,a=(e.bbox.y-t.y)/t.height*100,i=e.bbox.width/t.width*100,d=e.bbox.height/t.height*100;return o("div",{className:"absolute rounded-sm",style:{left:`${Math.max(0,s)}%`,top:`${Math.max(0,a)}%`,width:`${Math.min(100,i)}%`,height:`${Math.min(100,d)}%`,borderWidth:"1px",borderStyle:"solid",borderColor:r},children:m("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"1px"},children:[m("span",{className:"text-[9px] px-0.5 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:r},children:[e.macroClass,n&&` ${(e.score*100).toFixed(0)}%`]}),e.labels.map((l,c)=>m("span",{className:"text-[8px] font-semibold px-0.5 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:Ge(l.label)},children:[l.label," ",(l.score*100).toFixed(0),"%"]},`${e.id}-lbl-${c}`))]})})}function ym(e,t){const r=new Map;for(const n of e){const s=t(n),a=r.get(s)??[];a.push(n),r.set(s,a)}return r}function ry({detections:e,classColors:t,className:r,hiddenKeys:n,onToggleVisibility:s}){const a=t;if(e.length===0)return o("div",{className:"text-sm text-foreground-subtle italic text-center py-4",children:"No detections"});const i=e.filter(u=>u.kind==="first-level"),d=e.filter(u=>u.kind==="detail"),l=new Map;for(const u of d){if(!u.parentId)continue;const p=l.get(u.parentId)??[];p.push(u),l.set(u.parentId,p)}const c=d.filter(u=>!u.parentId||!i.some(p=>p.id===u.parentId));return m("div",{className:r,children:[m("div",{className:"text-xs font-medium text-foreground-subtle uppercase tracking-wide mb-2",children:["Detections (",e.length,")"]}),m("div",{className:"space-y-2",children:[i.map(u=>o(os,{detection:u,children_:l.get(u.id)??[],colors:a,hiddenKeys:n,onToggleVisibility:s},u.id)),c.map(u=>o(os,{detection:u,children_:[],colors:a,hiddenKeys:n,onToggleVisibility:s},u.id))]})]})}function os({detection:e,children_:t,colors:r,hiddenKeys:n,onToggleVisibility:s}){const a=Ge(e.macroClass,r),i=!n?.has(e.id),d=e.debug?.mask,l=e.debug?.maskWidth,c=e.debug?.maskHeight,u=e.debug?.alternateLabels;return m("div",{className:`rounded-md border border-border bg-surface p-3 space-y-1 ${i?"":"opacity-40"}`,children:[m("div",{className:"flex justify-between items-center",children:[m("div",{className:"flex items-center gap-2",children:[s&&o("input",{type:"checkbox",checked:i,onChange:()=>s(e.id,!i),className:"h-3.5 w-3.5 rounded border-border accent-primary cursor-pointer shrink-0"}),o("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:a}}),o("span",{className:"text-sm font-medium text-foreground",children:e.macroClass}),e.kind==="detail"&&o("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:"detail"}),d&&l&&c&&m("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",l,"x",c]})]}),o(km,{confidence:e.score})]}),m("div",{className:"text-[10px] text-foreground-subtle font-mono",children:["bbox: [",Math.round(e.bbox.x),", ",Math.round(e.bbox.y),","," ",Math.round(e.bbox.x+e.bbox.width),","," ",Math.round(e.bbox.y+e.bbox.height),"]"]}),e.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 mt-1",children:e.labels.map((p,h)=>m("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{backgroundColor:Ge(p.label,r)+"20",color:Ge(p.label,r)},children:[p.label,m("span",{className:"opacity-60",children:[(p.score*100).toFixed(0),"%"]}),p.detectionId&&m("span",{className:"opacity-40 text-[8px]",children:["→ ",p.detectionId]})]},h))}),u&&Object.keys(u).length>0&&o(wm,{alternateLabels:u,colors:r}),t.length>0&&o(xm,{items:t,colors:r,hiddenKeys:n,onToggleVisibility:s})]})}function xm({items:e,colors:t,hiddenKeys:r,onToggleVisibility:n}){return o("div",{className:"ml-4 mt-1.5 space-y-1.5 border-l-2 border-border pl-3",children:e.map(s=>{const a=Ge(s.macroClass,t),i=!r?.has(s.id),d=s.debug?.mask,l=s.debug?.maskWidth,c=s.debug?.maskHeight;return m("div",{className:`text-xs space-y-0.5 ${i?"":"opacity-40"}`,children:[m("div",{className:"flex items-center gap-1.5",children:[n&&o("input",{type:"checkbox",checked:i,onChange:()=>n(s.id,!i),className:"h-3 w-3 rounded border-border accent-primary cursor-pointer shrink-0"}),o("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:a}}),o("span",{className:"font-medium",style:{color:a},children:s.macroClass}),m("span",{className:"text-foreground-subtle",children:[(s.score*100).toFixed(0),"%"]}),d&&l&&c&&m("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",l,"x",c]})]}),s.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 ml-5 mt-0.5",children:s.labels.map((u,p)=>m("span",{className:"inline-flex items-center gap-0.5 text-[9px] font-medium px-1 py-0.5 rounded-full",style:{backgroundColor:Ge(u.label,t)+"20",color:Ge(u.label,t)},children:[u.label," ",m("span",{className:"opacity-60",children:[(u.score*100).toFixed(0),"%"]})]},p))})]},s.id)})})}function wm({alternateLabels:e,colors:t}){const[r,n]=C(!1),s=Object.keys(e);return m("div",{className:"mt-1",children:[m("button",{onClick:()=>n(a=>!a),className:"text-[9px] text-foreground-subtle hover:text-foreground transition-colors flex items-center gap-1",children:[o("span",{className:`transition-transform ${r?"rotate-90":""}`,children:"▶"}),"Alternates (",s.length," source",s.length!==1?"s":"",")"]}),r&&o("div",{className:"mt-1 ml-3 space-y-1.5",children:s.map(a=>{const i=e[a];return!i||i.length===0?null:m("div",{children:[o("div",{className:"text-[9px] font-medium text-foreground-subtle mb-0.5",children:a}),o("div",{className:"flex flex-wrap gap-1",children:i.map((d,l)=>m("span",{className:"inline-flex items-center gap-0.5 text-[9px] px-1 py-0.5 rounded-full",style:{backgroundColor:Ge(a,t)+"10",color:Ge(a,t),opacity:Math.max(.4,d.score)},children:[d.label,m("span",{className:"opacity-60",children:[(d.score*100).toFixed(1),"%"]})]},l))})]},a)})})]})}function km({confidence:e}){return m("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${e>=.8?"bg-success/10 text-success":e>=.5?"bg-warning/10 text-warning":"bg-danger/10 text-danger"}`,children:[(e*100).toFixed(1),"%"]})}function ny({timings:e,totalMs:t,className:r}){const n=Object.entries(e);return n.length===0&&t===void 0?null:m("div",{className:`rounded-lg border border-border bg-surface p-3 space-y-2 ${r??""}`,children:[o("div",{className:"text-xs font-medium text-foreground-subtle uppercase tracking-wide",children:"Timings"}),m("div",{className:"space-y-1 text-xs",children:[n.map(([s,a])=>m("div",{className:"flex justify-between",children:[o("span",{className:"text-foreground-subtle",children:s}),m("span",{className:"font-mono text-foreground",children:[a.toFixed(1),"ms"]})]},s)),t!==void 0&&m("div",{className:"flex justify-between pt-1 border-t border-border font-medium text-foreground",children:[o("span",{children:"Total"}),m("span",{className:"font-mono",children:[t.toFixed(1),"ms"]})]})]})]})}function oy({images:e,selectedFilename:t,uploadedName:r,onSelect:n,onUpload:s,className:a,accept:i="image/*",uploadLabel:d="Upload..."}){const l=()=>{const c=document.createElement("input");c.type="file",c.accept=i,c.onchange=()=>{const u=c.files?.[0];if(!u)return;const p=new FileReader;p.onload=()=>{const h=p.result,g=h.split(",")[1];g&&s(g,u.name,h)},p.readAsDataURL(u)},c.click()};return m("div",{className:`flex flex-wrap items-center gap-2 ${a??""}`,children:[e.map(c=>o("button",{onClick:()=>n(c.filename),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${t===c.filename?"bg-primary text-primary-foreground border-primary":"bg-surface border-border text-foreground hover:border-primary/50"}`,children:c.id??c.filename.replace(/\.[^.]+$/,"")},c.filename)),o("button",{onClick:l,className:"px-3 py-1.5 text-xs rounded-md border border-border bg-surface text-foreground hover:bg-surface-hover transition-colors",children:d}),r&&o("span",{className:"text-xs text-foreground-subtle",children:r})]})}var dr="w-full px-3 py-2 text-sm rounded-md border border-border bg-surface text-foreground focus:outline-none focus:ring-2 focus:ring-primary/50";function sy({runtime:e,backend:t,modelId:r,agentId:n="hub",runtimes:s,backends:a,models:i,agents:d=[],onRuntimeChange:l,onBackendChange:c,onModelChange:u,onAgentChange:p,layout:h="grid",className:g,showAgent:b=!1}){return m("div",{className:`${h==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4":h==="horizontal"?"flex flex-wrap items-end gap-4":"space-y-3"} ${g??""}`,children:[b&&d.length>0&&m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Agent"}),o("select",{value:n,onChange:v=>p?.(v.target.value),className:dr,children:d.map(v=>m("option",{value:v.id,children:[v.name," (",v.status,")"]},v.id))})]}),m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Runtime"}),o("select",{value:e,onChange:v=>l(v.target.value),className:dr,children:s.map(v=>m("option",{value:v.value,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.value))})]}),m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Backend"}),o("select",{value:t,onChange:v=>c(v.target.value),className:dr,children:a.map(v=>m("option",{value:v.id,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.id))})]}),m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Model"}),o("select",{value:r,onChange:v=>u(v.target.value),className:dr,children:i.length===0?o("option",{value:"",children:"No compatible models"}):i.map(v=>m("option",{value:v.id,children:[v.name,v.downloaded?" ✓":""]},v.id))})]})]})}var Nm=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},ji=class{constructor(e){this.generateIdentifier=e,this.kv=new Nm}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Sm=class extends ji{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function Cm(e){if("values"in Object)return Object.values(e);const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}function Mm(e,t){const r=Cm(e);if("find"in r)return r.find(t);const n=r;for(let s=0;s<n.length;s++){const a=n[s];if(t(a))return a}}function Ot(e,t){Object.entries(e).forEach(([r,n])=>t(n,r))}function Nr(e,t){return e.indexOf(t)!==-1}function ss(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(t(n))return n}}var Em=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Mm(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Am=e=>Object.prototype.toString.call(e).slice(8,-1),Ui=e=>typeof e>"u",Pm=e=>e===null,Xt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,Pn=e=>Xt(e)&&Object.keys(e).length===0,it=e=>Array.isArray(e),Rm=e=>typeof e=="string",Im=e=>typeof e=="number"&&!isNaN(e),_m=e=>typeof e=="boolean",Tm=e=>e instanceof RegExp,Jt=e=>e instanceof Map,er=e=>e instanceof Set,Hi=e=>Am(e)==="Symbol",Dm=e=>e instanceof Date&&!isNaN(e.valueOf()),Vi=e=>e instanceof Error,as=e=>typeof e=="number"&&isNaN(e),Lm=e=>_m(e)||Pm(e)||Ui(e)||Im(e)||Rm(e)||Hi(e),Om=e=>typeof e=="bigint",$m=e=>e===1/0||e===-1/0,Bm=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),zm=e=>e instanceof URL,Rn=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),sn=e=>e.map(String).map(Rn).join("."),Ht=(e,t)=>{const r=[];let n="";for(let a=0;a<e.length;a++){let i=e.charAt(a);if(!t&&i==="\\"){const d=e.charAt(a+1);if(d==="\\"){n+="\\",a++;continue}else if(d!==".")throw Error("invalid path")}if(i==="\\"&&e.charAt(a+1)==="."){n+=".",a++;continue}if(i==="."){r.push(n),n="";continue}n+=i}const s=n;return r.push(s),r};function We(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var qi=[We(Ui,"undefined",()=>null,()=>{}),We(Om,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),We(Dm,"Date",e=>e.toISOString(),e=>new Date(e)),We(Vi,"Error",(e,t)=>{const r={name:e.name,message:e.message};return"cause"in e&&(r.cause=e.cause),t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r},(e,t)=>{const r=new Error(e.message,{cause:e.cause});return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r}),We(Tm,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),r=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,r)}),We(er,"set",e=>[...e.values()],e=>new Set(e)),We(Jt,"map",e=>[...e.entries()],e=>new Map(e)),We(e=>as(e)||$m(e),"number",e=>as(e)?"NaN":e>0?"Infinity":"-Infinity",Number),We(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),We(zm,"URL",e=>e.toString(),e=>new URL(e))];function Fr(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var Wi=Fr((e,t)=>Hi(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{const n=r.symbolRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),Fm=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Ki=Fr(Bm,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=Fm[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function Yi(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Zi=Fr(Yi,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};const n={};return r.forEach(s=>{n[s]=e[s]}),n},(e,t,r)=>{const n=r.classRegistry.getValue(t[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),e)}),Xi=Fr((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{const n=r.customTransformerRegistry.findByName(t[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),Gm=[Zi,Wi,Xi,Ki],is=(e,t)=>{const r=ss(Gm,s=>s.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const n=ss(qi,s=>s.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},Ji={};qi.forEach(e=>{Ji[e.annotation]=e});var Qm=(e,t,r)=>{if(it(t))switch(t[0]){case"symbol":return Wi.untransform(e,t,r);case"class":return Zi.untransform(e,t,r);case"custom":return Xi.untransform(e,t,r);case"typed-array":return Ki.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const n=Ji[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,r)}},Et=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function el(e){if(Nr(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Nr(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Nr(e,"constructor"))throw new Error("constructor is not allowed as a property")}var jm=(e,t)=>{el(t);for(let r=0;r<t.length;r++){const n=t[r];if(er(e))e=Et(e,+n);else if(Jt(e)){const s=+n,a=+t[++r]==0?"key":"value",i=Et(e,s);switch(a){case"key":e=i;break;case"value":e=e.get(i);break}}else e=e[n]}return e},In=(e,t,r)=>{if(el(t),t.length===0)return r(e);let n=e;for(let a=0;a<t.length-1;a++){const i=t[a];if(it(n)){const d=+i;n=n[d]}else if(Xt(n))n=n[i];else if(er(n)){const d=+i;n=Et(n,d)}else if(Jt(n)){if(a===t.length-2)break;const d=+i,l=+t[++a]==0?"key":"value",c=Et(n,d);switch(l){case"key":n=c;break;case"value":n=n.get(c);break}}}const s=t[t.length-1];if(it(n)?n[+s]=r(n[+s]):Xt(n)&&(n[s]=r(n[s])),er(n)){const a=Et(n,+s),i=r(a);a!==i&&(n.delete(a),n.add(i))}if(Jt(n)){const a=+t[t.length-2],i=Et(n,a);switch(+s==0?"key":"value"){case"key":{const d=r(i);n.set(d,n.get(i)),d!==i&&n.delete(i);break}case"value":n.set(i,r(n.get(i)));break}}return e},tl=e=>e<1;function _n(e,t,r,n=[]){if(!e)return;const s=tl(r);if(!it(e)){Ot(e,(d,l)=>_n(d,t,r,[...n,...Ht(l,s)]));return}const[a,i]=e;i&&Ot(i,(d,l)=>{_n(d,t,r,[...n,...Ht(l,s)])}),t(a,n)}function Um(e,t,r,n){return _n(t,(s,a)=>{e=In(e,a,i=>Qm(i,s,n))},r),e}function Hm(e,t,r){const n=tl(r);function s(a,i){const d=jm(e,Ht(i,n));a.map(l=>Ht(l,n)).forEach(l=>{e=In(e,l,()=>d)})}if(it(t)){const[a,i]=t;a.forEach(d=>{e=In(e,Ht(d,n),()=>e)}),i&&Ot(i,s)}else Ot(t,s);return e}var Vm=(e,t)=>Xt(e)||it(e)||Jt(e)||er(e)||Vi(e)||Yi(e,t);function qm(e,t,r){const n=r.get(e);n?n.push(t):r.set(e,[t])}function Wm(e,t){const r={};let n;return e.forEach(s=>{if(s.length<=1)return;t||(s=s.map(d=>d.map(String)).sort((d,l)=>d.length-l.length));const[a,...i]=s;a.length===0?n=i.map(sn):r[sn(a)]=i.map(sn)}),n?Pn(r)?[n]:[n,r]:Pn(r)?void 0:r}var rl=(e,t,r,n,s=[],a=[],i=new Map)=>{const d=Lm(e);if(!d){qm(e,s,t);const g=i.get(e);if(g)return n?{transformedValue:null}:g}if(!Vm(e,r)){const g=is(e,r),b=g?{transformedValue:g.value,annotations:[g.type]}:{transformedValue:e};return d||i.set(e,b),b}if(Nr(a,e))return{transformedValue:null};const l=is(e,r),c=l?.value??e,u=it(c)?[]:{},p={};Ot(c,(g,b)=>{if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Detected property ${b}. This is a prototype pollution risk, please remove it from your object.`);const v=rl(g,t,r,n,[...s,b],[...a,e],i);u[b]=v.transformedValue,it(v.annotations)?p[Rn(b)]=v.annotations:Xt(v.annotations)&&Ot(v.annotations,(y,x)=>{p[Rn(b)+"."+x]=y})});const h=Pn(p)?{transformedValue:u,annotations:l?[l.type]:void 0}:{transformedValue:u,annotations:l?[l.type,p]:p};return d||i.set(e,h),h};function nl(e){return Object.prototype.toString.call(e).slice(8,-1)}function ls(e){return nl(e)==="Array"}function Km(e){if(nl(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Ym(e,t,r,n,s){const a={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=r),s&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0})}function Tn(e,t={}){if(ls(e))return e.map(s=>Tn(s,t));if(!Km(e))return e;const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...r,...n].reduce((s,a)=>{if(a==="__proto__"||ls(t.props)&&!t.props.includes(a))return s;const i=e[a];return Ym(s,a,Tn(i,t),e,t.nonenumerable),s},{})}var fe=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Sm,this.symbolRegistry=new ji(t=>t.description??""),this.customTransformerRegistry=new Em,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,r=rl(e,t,this,this.dedupe),n={json:r.transformedValue};r.annotations&&(n.meta={...n.meta,values:r.annotations});const s=Wm(t,this.dedupe);return s&&(n.meta={...n.meta,referentialEqualities:s}),n.meta&&(n.meta.v=1),n}deserialize(e,t){const{json:r,meta:n}=e;let s=t?.inPlace?r:Tn(r);return n?.values&&(s=Um(s,n.values,n.v??0,this)),n?.referentialEqualities&&(s=Hm(s,n.referentialEqualities,n.v??0)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};fe.defaultInstance=new fe;fe.serialize=fe.defaultInstance.serialize.bind(fe.defaultInstance);fe.deserialize=fe.defaultInstance.deserialize.bind(fe.defaultInstance);fe.stringify=fe.defaultInstance.stringify.bind(fe.defaultInstance);fe.parse=fe.defaultInstance.parse.bind(fe.defaultInstance);fe.registerClass=fe.defaultInstance.registerClass.bind(fe.defaultInstance);fe.registerSymbol=fe.defaultInstance.registerSymbol.bind(fe.defaultInstance);fe.registerCustom=fe.defaultInstance.registerCustom.bind(fe.defaultInstance);fe.allowErrorProps=fe.defaultInstance.allowErrorProps.bind(fe.defaultInstance);fe.serialize;fe.deserialize;fe.stringify;fe.parse;fe.registerClass;fe.registerCustom;fe.registerSymbol;fe.allowErrorProps;function Zm({className:e}){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[o("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),o("circle",{cx:"12",cy:"12",r:"3"})]})}function Xm({className:e}){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[o("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),o("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),o("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),o("path",{d:"m2 2 20 20"})]})}function Jm({className:e}){return o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:o("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function eh({onLogin:e,serverUrl:t,logoSrc:r,error:n,className:s}){const[a,i]=C(""),[d,l]=C(""),[c,u]=C(!1),[p,h]=C(!1),[g,b]=C(null),v=n??g,y=async x=>{if(x.preventDefault(),!p){b(null),h(!0);try{await e(a,d)}catch(w){b(w instanceof Error?w.message:"Login failed. Please try again.")}finally{h(!1)}}};return o("div",{className:N("flex min-h-screen items-center justify-center bg-background p-4",s),children:m("div",{className:"w-full max-w-sm",children:[r&&o("div",{className:"flex justify-center mb-8",children:o("img",{src:r,alt:"Logo",className:"h-12"})}),t&&o("p",{className:"mb-4 text-center text-xs text-foreground-subtle truncate",children:t}),m("form",{onSubmit:y,className:"space-y-4 rounded-xl border border-border bg-surface p-6 shadow-xl shadow-black/10",children:[v&&o("div",{className:"rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger",children:v}),m("div",{className:"space-y-1.5",children:[o("label",{className:"text-xs font-medium text-foreground-subtle",children:"Username"}),o("input",{type:"text",value:a,onChange:x=>i(x.target.value),autoComplete:"username",required:!0,className:"w-full rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary"})]}),m("div",{className:"space-y-1.5",children:[o("label",{className:"text-xs font-medium text-foreground-subtle",children:"Password"}),m("div",{className:"relative",children:[o("input",{type:c?"text":"password",value:d,onChange:x=>l(x.target.value),autoComplete:"current-password",required:!0,className:"w-full rounded-lg border border-border bg-background px-3 py-2.5 pr-10 text-sm text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary"}),o("button",{type:"button",onClick:()=>u(x=>!x),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",tabIndex:-1,children:c?o(Xm,{className:"h-4 w-4"}):o(Zm,{className:"h-4 w-4"})})]})]}),m("button",{type:"submit",disabled:p,className:"w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:[p&&o(Jm,{className:"h-4 w-4 animate-spin"}),p?"Logging in...":"Log in"]})]})]})})}var Dn="camstack_dev_token",ol=et(null);function ay(){const e=Ie(ol);if(!e)throw new Error("useDevShell must be used within a DevShell");return e}function th(){return typeof window>"u"?null:localStorage.getItem(Dn)}function rh({className:e}){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[o("circle",{cx:"12",cy:"12",r:"4"}),o("path",{d:"M12 2v2"}),o("path",{d:"M12 20v2"}),o("path",{d:"m4.93 4.93 1.41 1.41"}),o("path",{d:"m17.66 17.66 1.41 1.41"}),o("path",{d:"M2 12h2"}),o("path",{d:"M20 12h2"}),o("path",{d:"m6.34 17.66-1.41 1.41"}),o("path",{d:"m19.07 4.93-1.41 1.41"})]})}function nh({className:e}){return o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:o("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function oh({children:e,serverUrl:t,title:r,token:n,onLogout:s}){const a=Wl(),i=K(()=>[Rl({condition:h=>h.type==="subscription",true:Il({client:_l({url:t.replace(/^http/,"ws")+"/trpc",connectionParams:()=>({token:n})}),transformer:fe}),false:Ts({url:`${t}/trpc`,transformer:fe,headers:()=>({authorization:`Bearer ${n}`})})})],[t,n]),d=K(()=>_s({links:i}),[i]),l=K(()=>f.createClient({links:i}),[i]),c=K(()=>zl({serverUrl:t,token:n}),[t,n]);U(()=>(c.init().catch(()=>{}),()=>{c.close()}),[c]);const u=K(()=>new Al,[]),p=K(()=>({trpc:d,token:n,logout:s}),[d,n,s]);return o(af,{system:c,children:o(f.Provider,{client:l,queryClient:u,children:o(Pl,{client:u,children:o(ol.Provider,{value:p,children:m("div",{className:"min-h-screen bg-background text-foreground",children:[m("div",{className:"flex items-center justify-between border-b border-border bg-surface px-4 py-2",children:[m("div",{className:"flex items-center gap-2",children:[o("span",{className:"rounded bg-warning/20 px-2 py-0.5 text-xs font-bold text-warning",children:"DEV MODE"}),r&&o("span",{className:"text-sm font-medium text-foreground",children:r}),o("span",{className:"text-xs text-foreground-subtle",children:t})]}),m("div",{className:"flex items-center gap-2",children:[m("button",{type:"button",onClick:a.toggleMode,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",title:`Theme: ${a.mode}`,children:[a.resolvedMode==="dark"?o(rh,{className:"h-3.5 w-3.5"}):o(nh,{className:"h-3.5 w-3.5"}),a.mode==="dark"?"Dark":a.mode==="light"?"Light":"System"]}),o("button",{type:"button",onClick:s,className:"rounded-md px-2.5 py-1 text-xs font-medium text-danger hover:bg-danger/10 transition-colors",children:"Logout"})]})]}),o("div",{className:"p-4",children:e({trpc:d,theme:a})})]})})})})})}function sh({children:e,serverUrl:t="https://localhost:4443",title:r}){const[n,s]=C(th),a=_(async(d,l)=>{const c=await _s({links:[Ts({url:`${t}/trpc`,transformer:fe})]}).auth.login.mutate({username:d,password:l});if(!c.token)throw new Error("No token returned");localStorage.setItem(Dn,c.token),s(c.token)},[t]),i=_(()=>{localStorage.removeItem(Dn),s(null)},[]);return n?o(mo,{children:o(oh,{serverUrl:t,title:r,token:n,onLogout:i,children:e})}):o(mo,{children:o(eh,{onLogin:a,serverUrl:t})})}function iy(e,t={}){const{serverUrl:r="https://localhost:4443",title:n,rootId:s="root"}=t,a=document.getElementById(s);if(!a){console.error(`[mountAddonPage] Element #${s} not found`);return}Ml(a).render(Vt(sh,{serverUrl:r,title:n,children:({trpc:i,theme:d})=>Vt(e,{trpc:i,theme:{isDark:d.resolvedMode==="dark"},navigate:l=>{console.log("[dev] navigate:",l)}})}))}var sl=ct("camstack:custom-field-renderers",{});function ly({renderers:e,children:t}){return o(sl.Provider,{value:e,children:t})}function ah(e){return Ie(sl)[e]??null}var so=ct("camstack:device-context",null);function cy({deviceId:e,device:t,children:r}){const n={deviceId:e,device:t??null};return o(so.Provider,{value:n,children:r})}function ih(){return Ie(so)?.deviceId??null}function dy(){return Ie(so)?.device??null}var uy=f.accessories.getStatus.useQuery,py=f.addonPages.listPages.useQuery,lh=f.addons.list.useQuery,fy=f.addons.getLogs.useQuery,my=f.addons.listPackages.useQuery,hy=f.addons.installPackage.useMutation,gy=f.addons.installFromWorkspace.useMutation,by=f.addons.isWorkspaceAvailable.useQuery,vy=f.addons.listWorkspacePackages.useQuery,yy=f.addons.uninstallPackage.useMutation,xy=f.addons.reloadPackages.useMutation,wy=f.addons.searchAvailable.useQuery,ky=f.addons.listUpdates.useQuery,Ny=f.addons.updatePackage.useMutation,Sy=f.addons.rollbackPackage.useMutation,Cy=f.addons.forceRefresh.useMutation,My=f.addons.restartServer.useMutation,Ey=f.addons.getLastRestart.useQuery,Ay=f.addons.listFrameworkPackages.useQuery,Py=f.addons.listCapabilityProviders.useQuery,Ry=f.addons.setCapabilityProviderEnabled.useMutation,Iy=f.addons.updateFrameworkPackage.useMutation,_y=f.addons.getVersions.useQuery,Ty=f.addons.restartAddon.useMutation,Dy=f.addons.retryLoad.useMutation,Ly=f.addons.getAutoUpdateSettings.useQuery,Oy=f.addons.setAutoUpdateSettings.useMutation,$y=f.addons.getAddonAutoUpdate.useQuery,By=f.addons.setAddonAutoUpdate.useMutation,zy=f.addons.applyAutoUpdateToAll.useMutation,Fy=f.addons.custom.useMutation,Gy=f.addons.onAddonLogs.useSubscription,Qy=f.addonSettings.getGlobalSettings.useQuery,jy=f.addonSettings.updateGlobalSettings.useMutation,Uy=f.addonSettings.getDeviceSettings.useQuery,Hy=f.addonSettings.updateDeviceSettings.useMutation,ch=f.addonWidgets.listWidgets.useQuery,Vy=f.alerts.emit.useMutation,qy=f.alerts.update.useMutation,Wy=f.alerts.list.useQuery,Ky=f.alerts.getUnreadCount.useQuery,Yy=f.alerts.markRead.useMutation,Zy=f.alerts.markAllRead.useMutation,Xy=f.alerts.dismiss.useMutation,Jy=f.audioAnalysis.resolveDeviceSettings.useQuery,e0=f.audioAnalysis.getDeviceSettingsContribution.useQuery,t0=f.audioAnalysis.getDeviceLiveContribution.useQuery,r0=f.audioAnalysis.applyDeviceSettingsPatch.useMutation,n0=f.audioAnalyzer.analyseChunk.useMutation,o0=f.audioAnalyzer.classify.useQuery,s0=f.audioAnalyzer.isReady.useQuery,a0=f.audioAnalyzer.dispose.useMutation,i0=f.audioAnalyzer.reprobeAudioEngine.useMutation,l0=f.audioCodec.listSupportedCodecs.useQuery,c0=f.audioCodec.canHandle.useQuery,d0=f.audioCodec.createDecodeSession.useMutation,u0=f.audioCodec.createEncodeSession.useMutation,p0=f.audioCodec.closeSession.useMutation,f0=f.audioCodec.pushEncodedFrame.useMutation,m0=f.audioCodec.pullPcm.useQuery,h0=f.audioCodec.pushPcm.useMutation,g0=f.audioCodec.pullEncoded.useQuery,b0=f.audioCodec.flushEncode.useMutation,v0=f.audioCodec.listActiveSessions.useQuery,y0=f.audioMetrics.getCurrentSnapshot.useQuery,x0=f.audioMetrics.getHistory.useQuery,w0=f.backup.listDestinations.useQuery,k0=f.backup.trigger.useMutation,N0=f.backup.list.useQuery,S0=f.backup.listLocations.useQuery,C0=f.backup.getEntries.useQuery,M0=f.backup.restore.useMutation,E0=f.backup.delete.useMutation,A0=f.backup.listArchives.useQuery,P0=f.backup.upsertDestinationPolicy.useMutation,R0=f.backup.previewSchedule.useQuery,I0=f.battery.getStatus.useQuery,_0=f.brightness.setBrightness.useMutation,T0=f.brightness.getStatus.useQuery,D0=f.cameraCredentials.getCredentials.useQuery,L0=f.cameraCredentials.getStatus.useQuery,O0=f.cameraStreams.getCameraStreams.useQuery,$0=f.cameraStreams.getBrokerStreams.useQuery,dh=f.cameraStreams.getRtspEntries.useQuery,B0=f.decoder.supportsCodec.useQuery,z0=f.decoder.getInfo.useQuery,F0=f.decoder.createSession.useQuery,G0=f.decoder.destroySession.useQuery,Q0=f.decoder.pushPacket.useQuery,j0=f.decoder.openStream.useQuery,U0=f.decoder.pullFrames.useQuery,H0=f.decoder.updateConfig.useQuery,V0=f.decoder.getStats.useQuery,q0=f.decoder.listActiveSessions.useQuery,W0=f.decoder.reprobeHwaccel.useMutation,K0=f.detectionPipeline.getDeviceSettingsContribution.useQuery,Y0=f.detectionPipeline.getDeviceLiveContribution.useQuery,Z0=f.detectionPipeline.applyDeviceSettingsPatch.useMutation,X0=f.deviceDiscovery.listDiscovered.useQuery,J0=f.deviceDiscovery.refreshDiscovery.useMutation,ex=f.deviceDiscovery.adoptDevice.useMutation,tx=f.deviceDiscovery.releaseDevice.useMutation,rx=f.deviceDiscovery.getStatus.useQuery,uh=f.deviceExport.getStatus.useQuery,nx=f.deviceExport.listSupportedDeviceKinds.useQuery,ph=f.deviceExport.listExposedDevices.useQuery,ox=f.deviceExport.exposeDevice.useMutation,fh=f.deviceExport.unexposeDevice.useMutation,sx=f.deviceExport.getDeviceSettingsContribution.useQuery,ax=f.deviceExport.getDeviceLiveContribution.useQuery,ix=f.deviceExport.applyDeviceSettingsPatch.useMutation,lx=f.deviceManager.allocateDeviceId.useMutation,cx=f.deviceManager.registerDevice.useMutation,dx=f.deviceManager.removeDevice.useMutation,ux=f.deviceManager.persistConfig.useMutation,px=f.deviceManager.loadConfig.useQuery,fx=f.deviceManager.loadRuntimeState.useQuery,mx=f.deviceManager.loadMeta.useQuery,hx=f.deviceManager.setName.useMutation,gx=f.deviceManager.setLocation.useMutation,bx=f.deviceManager.setMetadata.useMutation,vx=f.deviceManager.listLocations.useQuery,yx=f.deviceManager.addLocation.useMutation,xx=f.deviceManager.removeLocation.useMutation,wx=f.deviceManager.setDisabled.useMutation,kx=f.deviceManager.listPersistedByAddon.useQuery,mh=f.deviceManager.listAll.useQuery,Nx=f.deviceManager.getDevice.useQuery,Sx=f.deviceManager.getChildren.useQuery,Cx=f.deviceManager.getStreamSources.useQuery,Mx=f.deviceManager.getConfigSchema.useQuery,Ex=f.deviceManager.getSettingsSchema.useQuery,Ax=f.deviceManager.updateConfig.useMutation,Px=f.deviceManager.enable.useMutation,Rx=f.deviceManager.disable.useMutation,Ix=f.deviceManager.remove.useMutation,_x=f.deviceManager.getStreamProfileMap.useQuery,Tx=f.deviceManager.setStreamProfileMap.useMutation,Dx=f.deviceManager.probeStreams.useMutation,Lx=f.deviceManager.getBindings.useQuery,Ox=f.deviceManager.getAllBindings.useQuery,$x=f.deviceManager.setWrapperActive.useMutation,Bx=f.deviceManager.listWrappersForCap.useQuery,zx=f.deviceManager.listBindableCapsForDeviceType.useQuery,Fx=f.deviceManager.getDeviceSettingsAggregate.useQuery,Gx=f.deviceManager.getDeviceLiveInfoAggregate.useQuery,Qx=f.deviceManager.getDeviceAggregate.useQuery,jx=f.deviceManager.updateDeviceField.useMutation,Ux=f.deviceManager.updateDeviceFieldsBatch.useMutation,Hx=f.deviceManager.discoverDevices.useMutation,Vx=f.deviceManager.adoptDevice.useMutation,qx=f.deviceManager.getCreationSchema.useQuery,Wx=f.deviceManager.createDevice.useMutation,Kx=f.deviceManager.testCreationField.useMutation,Yx=f.deviceManager.testField.useMutation,Zx=f.deviceManager.getDeviceStatusAggregate.useQuery,Xx=f.deviceOps.getStreamSources.useQuery,Jx=f.deviceOps.getConfigEntries.useQuery,e1=f.deviceOps.setConfig.useMutation,t1=f.deviceOps.removeDevice.useMutation,r1=f.deviceOps.getSettingsSchema.useQuery,n1=f.deviceProvider.start.useMutation,o1=f.deviceProvider.stop.useMutation,s1=f.deviceProvider.getStatus.useQuery,a1=f.deviceProvider.getDevices.useQuery,i1=f.deviceProvider.supportsDiscovery.useQuery,l1=f.deviceProvider.discoverDevices.useMutation,c1=f.deviceProvider.adoptDiscoveredDevice.useMutation,d1=f.deviceProvider.supportsManualCreation.useQuery,u1=f.deviceProvider.getChildCreationSchema.useQuery,p1=f.deviceProvider.createDevice.useMutation,f1=f.deviceProvider.testCreationField.useMutation,m1=f.deviceState.getSnapshot.useQuery,h1=f.deviceState.getCapSlice.useQuery,g1=f.deviceState.getAllSnapshots.useQuery,b1=f.deviceState.setCapSlice.useMutation,v1=f.deviceStatus.getStatus.useQuery,y1=f.doorbell.getStatus.useQuery,x1=f.events.getEvents.useQuery,w1=f.events.getEventThumbnail.useQuery,k1=f.events.getEventClipUrl.useQuery,N1=f.featureProbe.getStatus.useQuery,S1=f.integrations.list.useQuery,C1=f.integrations.get.useQuery,M1=f.integrations.getByAddonId.useQuery,E1=f.integrations.create.useMutation,A1=f.integrations.update.useMutation,P1=f.integrations.delete.useMutation,R1=f.integrations.getSettings.useQuery,I1=f.integrations.setSettings.useMutation,_1=f.integrations.getAvailableTypes.useQuery,T1=f.integrations.testConnection.useMutation,D1=f.intercom.startSession.useMutation,L1=f.intercom.handleAnswer.useMutation,O1=f.intercom.stopSession.useMutation,$1=f.intercom.startTalkSession.useMutation,B1=f.intercom.pushTalkPcm.useMutation,z1=f.intercom.endTalkSession.useMutation,F1=f.intercom.getStatus.useQuery,G1=f.localNetwork.list.useQuery,Q1=f.localNetwork.getPreferred.useQuery,j1=f.localNetwork.getConnectionEndpoints.useQuery,U1=f.localNetwork.getAllowedAddresses.useQuery,H1=f.localNetwork.setAllowedAddresses.useMutation,V1=f.localNetwork.resetAllowlistToBestMatch.useMutation,q1=f.meshNetwork.getStatus.useQuery,W1=f.meshNetwork.join.useMutation,K1=f.meshNetwork.startLogin.useMutation,Y1=f.meshNetwork.leave.useMutation,Z1=f.meshNetwork.logout.useMutation,X1=f.meshNetwork.listPeers.useQuery,J1=f.meshNetwork.testConnection.useMutation,ew=f.metricsProvider.collectSnapshot.useQuery,tw=f.metricsProvider.getCached.useQuery,rw=f.metricsProvider.getCurrent.useQuery,nw=f.metricsProvider.getDiskSpace.useQuery,ow=f.metricsProvider.getGpuInfo.useQuery,sw=f.metricsProvider.getCpuTemperature.useQuery,aw=f.metricsProvider.getProcessStats.useQuery,iw=f.metricsProvider.listAddonInstances.useQuery,lw=f.metricsProvider.getAddonStats.useQuery,cw=f.metricsProvider.listNodeProcesses.useQuery,dw=f.metricsProvider.killProcess.useMutation,uw=f.motion.isDetected.useQuery,pw=f.motion.getStatus.useQuery,fw=f.motionDetection.analyze.useMutation,mw=f.motionDetection.removeCamera.useMutation,hw=f.motionDetection.reset.useMutation,gw=f.motionDetection.getDeviceSettingsContribution.useQuery,bw=f.motionDetection.getDeviceLiveContribution.useQuery,vw=f.motionDetection.applyDeviceSettingsPatch.useMutation,yw=f.motionTrigger.setMotionTrigger.useMutation,xw=f.motionTrigger.getStatus.useQuery,ww=f.mqttBroker.listBrokers.useQuery,kw=f.mqttBroker.getBrokerConfig.useQuery,Nw=f.mqttBroker.addBroker.useMutation,Sw=f.mqttBroker.removeBroker.useMutation,Cw=f.mqttBroker.testConnection.useMutation,Mw=f.mqttBroker.startEmbeddedBroker.useMutation,Ew=f.mqttBroker.stopEmbeddedBroker.useMutation,Aw=f.mqttBroker.getStatus.useQuery,Pw=f.nativeObjectDetection.getStatus.useQuery,Rw=f.networkAccess.start.useMutation,Iw=f.networkAccess.stop.useMutation,_w=f.networkAccess.getEndpoint.useQuery,Tw=f.networkAccess.getStatus.useQuery,Dw=f.networkAccess.listEndpoints.useQuery,Lw=f.networkQuality.getDeviceStats.useQuery,Ow=f.networkQuality.getAllStats.useQuery,$w=f.networkQuality.reportClientStats.useMutation,Bw=f.nodes.topology.useQuery,zw=f.nodes.deployAddon.useMutation,Fw=f.nodes.undeployAddon.useMutation,Gw=f.nodes.restartAddon.useMutation,Qw=f.nodes.restartProcess.useMutation,jw=f.nodes.restartNode.useMutation,Uw=f.nodes.shutdownNode.useMutation,Hw=f.nodes.renameNode.useMutation,Vw=f.nodes.clusterAddonStatus.useQuery,qw=f.nodes.getNodeAddons.useQuery,Ww=f.nodes.setProcessLogLevel.useMutation,Kw=f.nodes.executeQuery.useMutation,Yw=f.notificationOutput.send.useMutation,Zw=f.notificationOutput.sendTest.useMutation,Xw=f.osd.setOverlay.useMutation,Jw=f.osd.getStatus.useQuery,e2=f.pipelineAnalytics.getActiveTracks.useQuery,t2=f.pipelineAnalytics.getTrack.useQuery,r2=f.pipelineAnalytics.listTracks.useQuery,n2=f.pipelineAnalytics.clearTracks.useMutation,o2=f.pipelineAnalytics.getMotionEvents.useQuery,s2=f.pipelineAnalytics.getObjectEvents.useQuery,a2=f.pipelineAnalytics.getAudioEvents.useQuery,i2=f.pipelineAnalytics.getEventMedia.useQuery,l2=f.pipelineAnalytics.getTrackMedia.useQuery,c2=f.pipelineAnalytics.getDeviceSettingsContribution.useQuery,d2=f.pipelineAnalytics.getDeviceLiveContribution.useQuery,u2=f.pipelineAnalytics.applyDeviceSettingsPatch.useMutation,p2=f.pipelineExecutor.getAvailableEngines.useQuery,f2=f.pipelineExecutor.getSelectedEngine.useQuery,m2=f.pipelineExecutor.getDefaultSteps.useQuery,h2=f.pipelineExecutor.reprobeEngine.useMutation,g2=f.pipelineExecutor.getVideoPipelineSteps.useQuery,b2=f.pipelineExecutor.setVideoPipelineSteps.useMutation,v2=f.pipelineExecutor.getSchema.useQuery,y2=f.pipelineExecutor.getGlobalSteps.useQuery,x2=f.pipelineExecutor.getGlobalPipelineConfig.useQuery,w2=f.pipelineExecutor.getOrchestratorConfigSchema.useQuery,k2=f.pipelineExecutor.listTemplates.useQuery,N2=f.pipelineExecutor.saveTemplate.useMutation,S2=f.pipelineExecutor.updateTemplate.useMutation,C2=f.pipelineExecutor.deleteTemplate.useMutation,M2=f.pipelineExecutor.getCapabilities.useQuery,E2=f.pipelineExecutor.getAddonModels.useQuery,A2=f.pipelineExecutor.downloadModel.useMutation,P2=f.pipelineExecutor.deleteModel.useMutation,R2=f.pipelineExecutor.detect.useQuery,I2=f.pipelineExecutor.runPipeline.useMutation,_2=f.pipelineExecutor.runPipelineBatch.useMutation,T2=f.pipelineExecutor.cacheFrameInPool.useMutation,D2=f.pipelineExecutor.inferCached.useMutation,L2=f.pipelineExecutor.uncacheFrame.useMutation,O2=f.pipelineExecutor.getEffectiveTuning.useQuery,$2=f.pipelineExecutor.listLoadedEngines.useQuery,B2=f.pipelineExecutor.spinEngine.useMutation,z2=f.pipelineExecutor.killEngine.useMutation,F2=f.pipelineExecutor.listReferenceImages.useQuery,G2=f.pipelineExecutor.getReferenceImage.useQuery,Q2=f.pipelineExecutor.getReferenceAudioFiles.useQuery,j2=f.pipelineExecutor.getReferenceAudio.useQuery,U2=f.pipelineExecutor.getAudioCapabilities.useQuery,H2=f.pipelineExecutor.runAudioTest.useMutation,V2=f.pipelineExecutor.getDetectionConfigSchema.useQuery,q2=f.pipelineOrchestrator.assignPipeline.useMutation,W2=f.pipelineOrchestrator.unassignPipeline.useMutation,K2=f.pipelineOrchestrator.rebalance.useMutation,Y2=f.pipelineOrchestrator.getPipelineAssignments.useQuery,Z2=f.pipelineOrchestrator.getPipelineAssignment.useQuery,X2=f.pipelineOrchestrator.getAgentLoad.useQuery,J2=f.pipelineOrchestrator.getGlobalMetrics.useQuery,ek=f.pipelineOrchestrator.getCameraMetrics.useQuery,tk=f.pipelineOrchestrator.getCapabilityBindings.useQuery,rk=f.pipelineOrchestrator.setCapabilityBinding.useMutation,nk=f.pipelineOrchestrator.assignDecoder.useMutation,ok=f.pipelineOrchestrator.unassignDecoder.useMutation,sk=f.pipelineOrchestrator.getDecoderAssignments.useQuery,ak=f.pipelineOrchestrator.assignAudio.useMutation,ik=f.pipelineOrchestrator.unassignAudio.useMutation,lk=f.pipelineOrchestrator.getAudioAssignment.useQuery,ck=f.pipelineOrchestrator.getAudioNodeLoad.useQuery,dk=f.pipelineOrchestrator.getAudioAssignments.useQuery,uk=f.pipelineOrchestrator.getDecoderAssignment.useQuery,pk=f.pipelineOrchestrator.getAgentSettings.useQuery,fk=f.pipelineOrchestrator.listAgentSettings.useQuery,mk=f.pipelineOrchestrator.setAgentAddonDefaults.useMutation,hk=f.pipelineOrchestrator.removeAgentSettings.useMutation,gk=f.pipelineOrchestrator.getCameraSettings.useQuery,bk=f.pipelineOrchestrator.setCameraStepToggle.useMutation,vk=f.pipelineOrchestrator.getCameraStepOverrides.useQuery,yk=f.pipelineOrchestrator.setCameraStepOverride.useMutation,xk=f.pipelineOrchestrator.setCameraPipelineForAgent.useMutation,wk=f.pipelineOrchestrator.resolvePipeline.useQuery,kk=f.pipelineOrchestrator.listTemplates.useQuery,Nk=f.pipelineOrchestrator.saveTemplate.useMutation,Sk=f.pipelineOrchestrator.updateTemplate.useMutation,Ck=f.pipelineOrchestrator.deleteTemplate.useMutation,Mk=f.pipelineOrchestrator.getDeviceSettingsContribution.useQuery,Ek=f.pipelineOrchestrator.getDeviceLiveContribution.useQuery,Ak=f.pipelineOrchestrator.applyDeviceSettingsPatch.useMutation,Pk=f.pipelineRunner.attachCamera.useMutation,Rk=f.pipelineRunner.detachCamera.useMutation,Ik=f.pipelineRunner.reportMotion.useMutation,_k=f.pipelineRunner.getLocalLoad.useQuery,Tk=f.pipelineRunner.getLocalMetrics.useQuery,Dk=f.pipelineRunner.getCameraMetrics.useQuery,Lk=f.pipelineRunner.getAllCameraMetrics.useQuery,Ok=f.pipelineRunner.getLocalCameras.useQuery,$k=f.platformProbe.getCapabilities.useQuery,Bk=f.platformProbe.getHardware.useQuery,zk=f.platformProbe.resolveInferenceConfig.useQuery,Fk=f.platformProbe.resolveHwAccel.useQuery,Gk=f.platformProbe.getHardwareEncoders.useQuery,Qk=f.platformProbe.refreshHardwareEncoders.useMutation,jk=f.ptz.move.useMutation,Uk=f.ptz.continuousMove.useMutation,Hk=f.ptz.stop.useMutation,Vk=f.ptz.getPresets.useQuery,qk=f.ptz.goToPreset.useMutation,Wk=f.ptz.goHome.useMutation,Kk=f.ptz.getPosition.useQuery,Yk=f.ptz.getStatus.useQuery,Zk=f.ptzAutotrack.getStatus.useQuery,Xk=f.ptzAutotrack.setEnabled.useMutation,Jk=f.ptzAutotrack.getSettings.useQuery,eN=f.ptzAutotrack.setSettings.useMutation,tN=f.reboot.reboot.useMutation,rN=f.recording.getSegments.useQuery,nN=f.recording.getPlaybackUrl.useQuery,oN=f.recording.getThumbnailAt.useQuery,sN=f.recordingEngine.getStatus.useQuery,aN=f.recordingEngine.enable.useMutation,iN=f.recordingEngine.disable.useMutation,lN=f.recordingEngine.getConfig.useQuery,cN=f.recordingEngine.updateConfig.useMutation,dN=f.recordingEngine.getPlaylist.useQuery,uN=f.recordingEngine.getThumbnail.useQuery,pN=f.recordingEngine.getSegments.useQuery,fN=f.recordingEngine.getAvailability.useQuery,mN=f.recordingEngine.estimateStorage.useQuery,hN=f.recordingEngine.estimateGlobalStorage.useQuery,gN=f.recordingEngine.getStorageUsage.useQuery,bN=f.recordingEngine.setPolicy.useMutation,vN=f.recordingEngine.getPolicy.useQuery,yN=f.recordingEngine.getPolicyStatus.useQuery,xN=f.recordingEngine.getRetentionConfig.useQuery,wN=f.recordingEngine.updateRetentionConfig.useMutation,kN=f.recordingEngine.getMotionStats.useQuery,NN=f.settingsStore.get.useQuery,SN=f.settingsStore.set.useMutation,CN=f.settingsStore.query.useQuery,MN=f.settingsStore.insert.useMutation,EN=f.settingsStore.update.useMutation,AN=f.settingsStore.delete.useMutation,PN=f.settingsStore.count.useQuery,RN=f.settingsStore.isEmpty.useQuery,IN=f.settingsStore.declareCollection.useMutation,_N=f.snapshot.getSnapshot.useQuery,TN=f.snapshot.invalidateCache.useMutation,DN=f.snapshot.getStatus.useQuery,LN=f.snapshot.getDeviceSettingsContribution.useQuery,ON=f.snapshot.getDeviceLiveContribution.useQuery,$N=f.snapshot.applyDeviceSettingsPatch.useMutation,BN=f.snapshotProvider.supportsDevice.useQuery,zN=f.snapshotProvider.getSnapshot.useQuery,FN=f.storage.resolve.useQuery,GN=f.storage.write.useMutation,QN=f.storage.read.useQuery,jN=f.storage.exists.useQuery,UN=f.storage.list.useQuery,HN=f.storage.delete.useMutation,VN=f.storage.getAvailableSpace.useQuery,qN=f.storage.beginUpload.useMutation,WN=f.storage.writeChunk.useMutation,KN=f.storage.finalizeUpload.useMutation,YN=f.storage.abortUpload.useMutation,ZN=f.storage.beginDownload.useMutation,XN=f.storage.readChunk.useQuery,JN=f.storage.endDownload.useMutation,eS=f.storage.listLocations.useQuery,tS=f.storage.getDefaultLocation.useQuery,rS=f.storage.upsertLocation.useMutation,nS=f.storage.deleteLocation.useMutation,oS=f.storage.testLocation.useQuery,sS=f.storage.listProviders.useQuery,aS=f.storage.testConfig.useQuery,iS=f.streamBroker.publishCameraStream.useMutation,lS=f.streamBroker.retractCameraStream.useMutation,cS=f.streamBroker.assignProfile.useMutation,dS=f.streamBroker.unassignProfile.useMutation,uS=f.streamBroker.listAllCameraStreams.useQuery,pS=f.streamBroker.listAllProfileSlots.useQuery,fS=f.streamBroker.getBrokerStats.useQuery,mS=f.streamBroker.listClients.useQuery,hS=f.streamBroker.killClient.useMutation,gS=f.streamBroker.restartProfile.useMutation,bS=f.streamBroker.getStreamUrl.useQuery,vS=f.streamBroker.getStreamWithCodec.useMutation,yS=f.streamBroker.releaseStreamWithCodec.useMutation,xS=f.streamBroker.getBroker.useQuery,wS=f.streamBroker.setPreBufferDuration.useMutation,kS=f.streamBroker.getPreBufferInfo.useQuery,NS=f.streamBroker.getRtspPort.useQuery,SS=f.streamBroker.getAllRtspEntries.useQuery,CS=f.streamBroker.getRtspEntry.useQuery,MS=f.streamBroker.regenerateRtspToken.useMutation,ES=f.streamBroker.setRtspEnabled.useMutation,AS=f.streamBroker.isRtspEnabled.useQuery,PS=f.streamBroker.getDeviceSettingsContribution.useQuery,RS=f.streamBroker.getDeviceLiveContribution.useQuery,IS=f.streamBroker.applyDeviceSettingsPatch.useMutation,_S=f.switch.setState.useMutation,TS=f.switch.getStatus.useQuery,DS=f.system.info.useQuery,LS=f.system.health.useQuery,OS=f.system.featureFlags.useQuery,$S=f.system.networkAddresses.useQuery,BS=f.system.getRetentionConfig.useQuery,zS=f.system.setRetentionConfig.useMutation,FS=f.system.forceRetentionCleanup.useMutation,GS=f.toast.onToast.useSubscription,QS=f.turnProvider.getTurnServers.useQuery,jS=f.userManagement.listUsers.useQuery,US=f.userManagement.createUser.useMutation,HS=f.userManagement.updateUser.useMutation,VS=f.userManagement.deleteUser.useMutation,qS=f.userManagement.resetPassword.useMutation,WS=f.userManagement.setUserScopes.useMutation,KS=f.userManagement.validateCredentials.useMutation,YS=f.userManagement.listApiKeys.useQuery,ZS=f.userManagement.createApiKey.useMutation,XS=f.userManagement.revokeApiKey.useMutation,JS=f.userManagement.validateApiKey.useMutation,eC=f.userManagement.createScopedToken.useMutation,tC=f.userManagement.revokeScopedToken.useMutation,rC=f.userManagement.validateScopedToken.useQuery,nC=f.userManagement.listScopedTokens.useQuery,oC=f.userManagement.setupTotp.useMutation,sC=f.userManagement.confirmTotp.useMutation,aC=f.userManagement.disableTotp.useMutation,iC=f.userManagement.getTotpStatus.useQuery,lC=f.userManagement.verifyTotp.useMutation,cC=f.webrtcSession.listStreams.useQuery,dC=f.webrtcSession.createSession.useMutation,uC=f.webrtcSession.handleOffer.useMutation,pC=f.webrtcSession.handleAnswer.useMutation,fC=f.webrtcSession.closeSession.useMutation,mC=f.webrtcSession.hasAdaptiveBitrate.useQuery,hC=f.zoneAnalytics.getCurrentSnapshot.useQuery,gC=f.zoneAnalytics.getZoneHistory.useQuery,bC=f.zoneAnalytics.getCameraHistory.useQuery,vC=f.zoneAnalytics.getUnzonedHistory.useQuery,yC=f.zoneRules.listRules.useQuery,xC=f.zoneRules.setRules.useMutation,wC=f.zones.listZones.useQuery,kC=f.zones.addZone.useMutation,NC=f.zones.removeZone.useMutation,SC=f.zones.updateZone.useMutation,al=ct("camstack:widget-registry",null),Rr=new Map,ur=new Map,cs=new Set;function hh(e){if(!e||typeof e!="object")return!1;const t=e.default;return t!==null&&typeof t=="object"}function gh(e){if(!e||typeof e!="object")return typeof e;const t=e,r=Object.getPrototypeOf(t),n=r&&typeof r=="object"?r.constructor?.name:void 0;return{ownKeys:Object.keys(t),allKeys:Object.getOwnPropertyNames(t),proto:typeof n=="string"?n:void 0}}async function bh(e,t){const r=Rr.get(e);if(r)return r;const n=ur.get(e);if(n)return n;cs.has(e)||(Cu(),xu([{name:e,entry:t,type:"module"}],{force:!1}),cs.add(e));const s=yu(`${e}/widgets`).then(a=>{if(!hh(a)){const d=gh(a);throw new Error(`Widget remote ${e} (${t}) does not expose a default record on './widgets'. Got: ${JSON.stringify(d)}`)}const i=a.default;return Rr.set(e,i),ur.delete(e),i}).catch(a=>{throw ur.delete(e),a});return ur.set(e,s),s}var vh=3e4,yh=2e3;function CC({children:e}){const t=Tr(),r=W(Date.now()),{data:n}=ch(void 0,{staleTime:0,refetchOnMount:"always",refetchInterval:d=>{const l=d.state.data;return l&&l.length>0||Date.now()-r.current>=vh?!1:yh}});Br("addon.widget-ready",()=>{t.invalidateQueries({queryKey:[["addonWidgets","listWidgets"]]})});const[s,a]=C(0);U(()=>{if(!n)return;let d=!1;const l=new Set;for(const c of n){if(l.has(c.remoteName)||(l.add(c.remoteName),Rr.has(c.remoteName)))continue;const u=c.bundleUrl;bh(c.remoteName,u).then(()=>{d||a(p=>p+1)}).catch(p=>{const h=p instanceof Error?p.message:String(p);(typeof globalThis<"u"?globalThis.console:void 0)?.error?.("[WidgetRegistry] Failed to load widget remote",{remoteName:c.remoteName,entryUrl:u,reason:h})})}return()=>{d=!0}},[n]);const i=K(()=>{const d=n??[],l=new Map;for(const u of d)l.set(`${u.addonId}/${u.stableId}`,u);const c=(u,p)=>({widgetId:u,addonId:p.addonId,stableId:p.stableId,label:p.label,description:p.description,icon:p.icon,remoteName:p.remoteName,bundleUrl:p.bundleUrl,hosts:p.hosts,requires:p.requires,defaultSize:p.defaultSize,allowedSizes:p.allowedSizes,defaultColumns:p.defaultColumns,defaultRows:p.defaultRows});return{resolve:u=>{const p=l.get(u);if(!p)return;const h=Rr.get(p.remoteName);if(!h)return null;const g=h[p.stableId];if(g)return g},metadata:u=>{const p=l.get(u);if(p)return c(u,p)},listAll:()=>{const u=[];for(const[p,h]of l)u.push(c(p,h));return u}}},[n,s]);return o(al.Provider,{value:i,children:e})}function xh(e){return ao().resolve(e)}function wh(e){return ao().metadata(e)}function MC(){return ao().listAll()}function ao(){const e=kh();if(!e)throw new Error("useWidgetRegistry(): no <WidgetRegistryProvider> in tree");return e}function kh(){return Nh(al)}function Nh(e){return Ie(e)}function Sh(e){const{widgetId:t,host:r="device-tab",config:n,deviceId:s,integrationId:a,instanceId:i,size:d,columns:l,rows:c}=e,u=xh(t),p=wh(t),h=K(()=>i??t,[i,t]);if(u===void 0&&p===void 0)return o(pr,{widgetId:t,reason:"unknown"});if(u===void 0)return o(pr,{widgetId:t,reason:"missing-export"});if(u===null)return o(Ch,{});if(p){if(p.requires.deviceContext&&s===void 0)return o(pr,{widgetId:t,reason:"missing-device-context"});if(p.requires.integrationContext&&a===void 0)return o(pr,{widgetId:t,reason:"missing-integration-context"})}return o(u,{instanceId:h,host:r,config:n,deviceId:s,integrationId:a,size:d,columns:l,rows:c})}function Ch(){return m("div",{className:"rounded-lg border border-border bg-surface/40 p-4 animate-pulse",children:[o("div",{className:"h-3 w-24 bg-foreground-subtle/20 rounded mb-2"}),o("div",{className:"h-2 w-full bg-foreground-subtle/10 rounded mb-1"}),o("div",{className:"h-2 w-3/4 bg-foreground-subtle/10 rounded"})]})}function pr({widgetId:e,reason:t}){return o("div",{className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",children:t==="unknown"?`Widget "${e}" not registered`:t==="missing-export"?`Widget "${e}" bundle does not export this stableId`:t==="missing-device-context"?`Widget "${e}" requires a deviceId`:`Widget "${e}" requires an integrationId`})}var wt="w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none disabled:opacity-50 disabled:cursor-not-allowed",Gr="block text-[11px] font-medium text-foreground mb-1",Mh="text-[10px] text-foreground-subtle mt-0.5";function Ee({label:e,description:t,required:r,span:n,children:s,translationFn:a}){const i=n===2?"col-span-2":n===3?"col-span-3":n===4?"col-span-4":"col-span-1",d=Ve(e,a),l=Ve(t,a);return m("div",{className:i,children:[d!==void 0&&d!==""&&m("label",{className:Gr,children:[d,r&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),s,l&&o("p",{className:Mh,children:l})]})}function Eh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("input",{type:e.inputType??"text",className:wt,value:t==null?"":String(t),placeholder:e.placeholder,maxLength:e.maxLength,pattern:e.pattern,disabled:n||e.disabled,onChange:a=>r(a.target.value)})})}function Ah({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=C(t==null?"":String(t)),d=W(!1);U(()=>{d.current||i(t==null?"":String(t))},[t]);const l=c=>{if(i(c),c===""||c==="-"){r(void 0);return}const u=Number(c);Number.isNaN(u)||r(u)};return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"flex items-center gap-1",children:[o("input",{type:"number",className:wt,value:a,placeholder:e.placeholder,min:e.min,max:e.max,step:e.step,disabled:n||e.disabled,onFocus:()=>{d.current=!0},onBlur:()=>{d.current=!1},onChange:c=>l(c.target.value)}),e.unit&&o("span",{className:"text-xs text-foreground-subtle whitespace-nowrap",children:e.unit})]})})}function Ph({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=!!t,i=n||e.disabled;return e.style==="checkbox"?o(Ee,{label:void 0,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[o("input",{type:"checkbox",className:"h-3.5 w-3.5 rounded border-border accent-primary",checked:a,disabled:i,onChange:d=>r(d.target.checked)}),o("span",{className:"text-xs font-medium text-foreground",children:Ve(e.label,s)}),e.required&&o("span",{className:"text-danger",children:"*"})]})}):o(Ee,{label:void 0,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"flex items-center justify-between",children:[m("span",{className:Gr+" mb-0",children:[Ve(e.label,s),e.required&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),o("button",{type:"button",role:"switch","aria-checked":a,disabled:i,onClick:()=>!i&&r(!a),className:["relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150",a?"bg-primary":"bg-foreground-subtle/30",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),children:o("span",{className:["inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150",a?"translate-x-4":"translate-x-0.5"].join(" ")})})]})})}function Rh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=e.options.some(i=>i.value==="");return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("select",{className:wt,value:t==null?"":String(t),disabled:n||e.disabled,onChange:i=>r(i.target.value),children:[!e.required&&!a&&o("option",{value:"",children:"— Select —"}),e.options.map(i=>o("option",{value:i.value,children:i.label},i.value))]})})}function Ih({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],i=d=>{if(a.includes(d))r(a.filter(l=>l!==d));else{if(e.maxItems!==void 0&&a.length>=e.maxItems)return;r([...a,d])}};return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("div",{className:"flex flex-wrap gap-2",children:e.options.map(d=>{const l=a.includes(d.value);return m("label",{className:["flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs cursor-pointer select-none transition-colors",l?"border-primary bg-primary/10 text-primary":"border-border bg-background text-foreground hover:bg-surface",n||e.disabled?"opacity-50 cursor-not-allowed":""].join(" "),children:[o("input",{type:"checkbox",className:"sr-only",checked:l,disabled:n||e.disabled,onChange:()=>i(d.value)}),d.label]},d.value)})})})}function _h({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=C(!1),d=e.showToggle!==!1;return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"relative",children:[o("input",{type:a?"text":"password",className:wt+(d?" pr-9":""),value:t==null?"":String(t),placeholder:e.placeholder,disabled:n||e.disabled,onChange:l=>r(l.target.value)}),d&&o("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",tabIndex:-1,onClick:()=>i(l=>!l),children:a?o(Zn,{className:"h-3.5 w-3.5"}):o(Bt,{className:"h-3.5 w-3.5"})})]})})}function Th({field:e,value:t,onChange:r,disabled:n,translationFn:s}){return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("textarea",{className:wt+" resize-y min-h-[60px]",value:t==null?"":String(t),placeholder:e.placeholder,rows:e.rows??3,maxLength:e.maxLength,disabled:n||e.disabled,onChange:a=>r(a.target.value)})})}function Dh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null,i=e.nullable===!0,d=a?e.default??e.min:Number(t),l=e.showValue!==!1,c=e.nullLabel??"Auto",u=n||e.disabled,p=e.displayScale??1,h=e.min/p,g=e.max/p,b=d/p,v=(e.step??1)/p;if(i&&a)return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("button",{className:"w-full rounded-lg border border-dashed border-border px-3 py-2 text-xs text-foreground-subtle hover:border-primary/40 hover:text-primary transition-colors text-left",disabled:u,onClick:()=>r(e.default??e.min),children:[c," — click to set manually"]})});const y=e.showStepper===!0&&l,x=k=>{const M=d+k*(e.step??1),S=Math.min(e.max,Math.max(e.min,M));S!==d&&r(S)},w="flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:cursor-not-allowed disabled:opacity-40";return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[m("div",{className:"flex min-w-0 flex-1 basis-[160px] items-center gap-2",children:[o("span",{className:"text-[10px] text-foreground-subtle tabular-nums shrink-0",children:h}),o("input",{type:"range",className:"min-w-0 flex-1 h-1 accent-primary cursor-pointer disabled:opacity-50",min:h,max:g,step:v,value:b,disabled:u,onChange:k=>r(Number(k.target.value)*p)}),o("span",{className:"text-[10px] text-foreground-subtle tabular-nums shrink-0",children:g})]}),(l||i||e.unit)&&m("div",{className:"flex shrink-0 items-center gap-2",children:[y&&o("button",{type:"button",className:w,disabled:u||d<=e.min,onClick:()=>x(-1),title:`Decrease by ${e.step??1}`,"aria-label":"Decrement",children:o(Ja,{className:"h-3 w-3"})}),l&&o("input",{type:"number",className:"w-16 rounded border border-border bg-surface px-1.5 py-0.5 text-xs text-center text-foreground tabular-nums focus:outline-none focus:ring-1 focus:ring-primary",min:h,max:g,step:v,value:b,disabled:u,onChange:k=>{if(k.target.value===""){r(i?null:e.min);return}const M=Number(k.target.value)*p,S=e.step??1,E=M-e.min,I=e.min+Math.round(E/S)*S;r(Math.min(e.max,Math.max(e.min,I)))}}),y&&o("button",{type:"button",className:w,disabled:u||d>=e.max,onClick:()=>x(1),title:`Increase by ${e.step??1}`,"aria-label":"Increment",children:o(rr,{className:"h-3 w-3"})}),e.unit&&o("span",{className:"text-[10px] text-foreground-subtle",children:e.unit}),i&&o("button",{className:"text-[10px] text-foreground-subtle hover:text-primary transition-colors",title:`Reset to ${c}`,disabled:u,onClick:()=>r(null),children:c})]})]})})}function Lh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],[i,d]=C(""),l=W(null),c=_(g=>{const b=g.trim();!b||a.includes(b)||e.maxTags!==void 0&&a.length>=e.maxTags||(r([...a,b]),d(""))},[a,e.maxTags,r]),u=g=>r(a.filter(b=>b!==g)),p=g=>{g.key==="Enter"||g.key===","?(g.preventDefault(),c(i)):g.key==="Backspace"&&i===""&&a.length>0&&u(a[a.length-1])},h=n||e.disabled;return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:["flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px] cursor-text","focus-within:border-primary focus-within:ring-1 focus-within:ring-primary/30",h?"opacity-50 cursor-not-allowed":""].join(" "),onClick:()=>!h&&l.current?.focus(),children:[a.map(g=>m("span",{className:"inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[g,!h&&o("button",{type:"button",onClick:()=>u(g),className:"hover:text-danger",children:o(_e,{className:"h-2.5 w-2.5"})})]},g)),o("input",{ref:l,type:"text",className:"flex-1 min-w-[80px] bg-transparent text-sm text-foreground outline-none placeholder:text-foreground-disabled",value:i,placeholder:a.length===0?e.placeholder??"Add tags…":"",disabled:h,list:`tags-suggestions-${e.key}`,onChange:g=>d(g.target.value),onKeyDown:p,onBlur:()=>{i.trim()&&c(i)}}),e.suggestions&&o("datalist",{id:`tags-suggestions-${e.key}`,children:e.suggestions.map(g=>o("option",{value:g},g))})]})})}function Oh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const{nodes:a}=no(),i=typeof t=="string"?t:"",d=e.showOffline?a:a.filter(l=>l.isOnline);return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("select",{className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground focus:outline-none focus:border-primary/50 disabled:opacity-50",value:i,onChange:l=>r(l.target.value),disabled:n,children:[o("option",{value:"",children:"Select node…"}),d.map(l=>m("option",{value:l.id,disabled:!l.isOnline,children:[l.shortName,l.isOnline?"":" (offline)"]},l.id))]})})}function $h({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const{nodes:a}=no(),i=new Set(Array.isArray(t)?t.map(String):[]),d=e.showOffline?a:a.filter(c=>c.isOnline),l=c=>{const u=new Set(i);u.has(c)?u.delete(c):u.add(c),r([...u])};return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("div",{className:"flex flex-wrap gap-1.5",children:d.map(c=>{const u=i.has(c.id);return o("button",{type:"button",onClick:()=>l(c.id),disabled:n||!c.isOnline,className:`px-2.5 py-1 text-xs font-medium rounded-md border transition-colors ${u?"border-primary bg-primary/10 text-primary":"border-border bg-surface text-foreground-subtle hover:bg-surface-hover"} ${c.isOnline?"":"opacity-50 cursor-not-allowed"}`,children:c.shortName},c.id)})})})}function Bh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null?"#000000":String(t);return m(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[m("div",{className:"flex items-center gap-2",children:[o("input",{type:"color",className:"h-9 w-9 rounded-md border border-border bg-background cursor-pointer p-0.5 disabled:opacity-50",value:a,disabled:n||e.disabled,onChange:i=>r(i.target.value)}),o("input",{type:"text",className:wt+" flex-1 font-mono",value:a,placeholder:"#000000",disabled:n||e.disabled,onChange:i=>r(i.target.value)})]}),e.presets&&e.presets.length>0&&o("div",{className:"flex gap-1.5 mt-1.5",children:e.presets.map(i=>o("button",{type:"button",className:"h-5 w-5 rounded-md border border-border hover:scale-110 transition-transform disabled:opacity-50",style:{backgroundColor:i},disabled:n||e.disabled,title:i,onClick:()=>r(i)},i))})]})}function zh({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i,externalProbe:d}){const[l,c]=C("idle"),[u,p]=C(null),h=d?.status??l,g=d?.result??u,b=!!a||!!i,v=_(async()=>{if(b){c("probing"),p(null);try{const w=a?await a(e.key,t):await i("test-probe",e.key,t),k=w&&typeof w=="object"?w:{status:"error",error:"Probe handler returned no result"};p(k),c(k.status==="ok"?"ok":"error")}catch(w){p({status:"error",error:w instanceof Error?w.message:String(w)}),c("error")}}},[a,i,e.key,t,b]),y=h==="probing"?"border-primary/40 bg-primary/10 text-primary":h==="ok"?"border-success/40 bg-success/10 text-success hover:bg-success/15":h==="error"?"border-danger/40 bg-danger/10 text-danger hover:bg-danger/15":"border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover",x=h==="probing"?o(Qe,{className:"h-3 w-3 animate-spin"}):h==="ok"?o(Qu,{className:"h-3 w-3"}):h==="error"?o(tr,{className:"h-3 w-3"}):o(si,{className:"h-3 w-3"});return m(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[m("div",{className:"@container flex items-center gap-2",style:{containerType:"inline-size"},children:[m("button",{type:"button",onClick:v,title:"Test",disabled:e.disabled||h==="probing"||!b||!t,className:`flex-shrink-0 inline-flex items-center gap-1.5 rounded-md border px-2 py-2 text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed @[280px]:px-3 ${y}`,children:[x,o("span",{className:"hidden @[280px]:inline",children:"Test"})]}),o("input",{type:e.inputType??"url",className:wt+" flex-1 min-w-0",value:t==null?"":String(t),placeholder:e.placeholder,disabled:n||e.disabled,onChange:w=>{r(w.target.value),l!=="idle"&&(c("idle"),p(null))}})]}),h==="ok"&&g?.labels&&g.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 mt-1.5",children:g.labels.map((w,k)=>o("span",{className:"text-xs bg-success/10 text-success rounded px-2 py-0.5 font-mono",children:w},k))}),h==="error"&&g?.error&&o("p",{className:"text-xs text-danger mt-1 truncate",title:g.error,children:g.error})]})}function Fh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a}){const[i,d]=C(e.defaultCollapsed??!1),l=e.style==="accordion";return o("div",{className:e.span===2?"col-span-2":e.span===3?"col-span-3":e.span===4?"col-span-4":"col-span-1",children:m("div",{className:"rounded-lg border border-border bg-surface/50 overflow-hidden",children:[m("div",{className:["px-3 py-2 flex items-center justify-between",l?"cursor-pointer hover:bg-surface":""].join(" "),onClick:l?()=>d(c=>!c):void 0,children:[o("span",{className:"text-xs font-semibold text-foreground",children:Ve(e.label,s)}),l&&o("span",{className:"text-foreground-subtle text-xs",children:i?"▸":"▾"})]}),!i&&o("div",{className:"px-3 pb-3 grid grid-cols-2 gap-x-4 gap-y-3",children:e.fields.map(c=>o(or,{field:c,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a},c.key))})]})})}function Gh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const[d,l]=C(e.tabs[0]?.id??""),c=e.span===2?"col-span-2":e.span===3?"col-span-3":e.span===4?"col-span-4":"col-span-1";return e.tabs.length===0?null:m("div",{className:c,children:[e.label&&o("div",{className:Gr,children:Ve(e.label,s)}),m("div",{className:"rounded-lg border border-border-subtle bg-surface-hover/40 overflow-hidden",children:[o("div",{className:"flex flex-wrap gap-1 p-1.5 border-b border-border-subtle bg-surface/40",role:"tablist",children:e.tabs.map(u=>{const p=u.id===d;return m("button",{type:"button",role:"tab","aria-selected":p,onClick:()=>l(u.id),className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 py-1 text-[11px] transition-colors ${p?"bg-primary text-primary-foreground font-medium shadow-sm":"bg-transparent text-foreground-subtle hover:bg-surface hover:text-foreground"}`,children:[o("span",{children:Ve(u.label,s)}),u.badge&&o("span",{className:`text-[9px] px-1 py-0.5 rounded-full font-medium ${p?"bg-primary-foreground/20 text-primary-foreground":"bg-primary/10 text-primary"}`,children:u.badge})]},u.id)})}),e.tabs.map(u=>u.id!==d?null:o("div",{role:"tabpanel",className:"px-3 pb-3 pt-2 grid grid-cols-2 gap-x-4 gap-y-3",children:u.fields.map((p,h)=>{const g="key"in p&&typeof p.key=="string"?p.key:`__${u.id}__${h}`;return o(or,{field:p,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i},g)})},u.id))]})]})}function Qh({span:e}){return o("div",{className:e===2?"col-span-2":e===3?"col-span-3":e===4?"col-span-4":"col-span-full",children:o("hr",{className:"border-border"})})}var ds={info:{border:"border-info",bg:"bg-info/5",text:"text-info"},warning:{border:"border-warning",bg:"bg-warning/5",text:"text-warning"},success:{border:"border-success",bg:"bg-success/5",text:"text-success"},danger:{border:"border-danger",bg:"bg-danger/5",text:"text-danger"}};function jh(e){if(typeof window>"u"||typeof DOMParser>"u")return"";const t=new Set(["A","UL","OL","LI","STRONG","EM","CODE","BR","P","SPAN"]),r=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),n=r.body.firstElementChild;if(!n)return"";const s=a=>{const i=Array.from(a.children);for(const d of i){if(!t.has(d.tagName)){const c=r.createTextNode(d.textContent??"");d.replaceWith(c);continue}const l=d.tagName==="A"?new Set(["href"]):new Set;for(const c of Array.from(d.attributes))l.has(c.name)||d.removeAttribute(c.name);if(d.tagName==="A"){const c=d.getAttribute("href")??"";!/^https?:\/\//i.test(c)&&!c.startsWith("mailto:")?d.removeAttribute("href"):(d.setAttribute("target","_blank"),d.setAttribute("rel","noopener noreferrer"))}s(d)}};return s(n),n.innerHTML}function Uh({field:e}){const t=ds[e.variant??"info"]??ds.info,r=e.format==="html";return o("div",{className:"col-span-full",children:m("div",{className:`rounded-md border-l-4 px-3 py-2.5 ${t.border} ${t.bg}`,children:[e.label&&o("p",{className:`text-xs font-semibold mb-0.5 ${t.text}`,children:e.label}),r?o("div",{className:"text-xs text-foreground-subtle leading-relaxed info-html-content",dangerouslySetInnerHTML:{__html:jh(e.content)}}):o("p",{className:"text-xs text-foreground-subtle leading-relaxed whitespace-pre-line",children:e.content})]})})}var us={ok:"bg-success",warn:"bg-amber-500",danger:"bg-danger",idle:"bg-foreground-subtle/40",unknown:"bg-foreground-subtle/40"};function Hh(e){if(!Number.isFinite(e)||e<0)return"—";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const r=Math.floor(t/60),n=t%60;return n===0?`${r}m`:`${r}m ${n}s`}function Vh(e){return!Number.isFinite(e)||e<=0?"—":new Date(e).toLocaleTimeString()}function qh({kind:e,value:t}){return t==null||t===""?o("span",{className:"text-foreground-subtle/60",children:"—"}):e==="monospace"?o("span",{className:"font-mono text-[11px]",children:String(t)}):e==="status"?m("span",{className:"inline-flex items-center gap-1.5",children:[o("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${us[String(t).toLowerCase()]??us.unknown}`}),o("span",{children:String(t)})]}):e==="duration"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:Hh(t)}):e==="timestamp"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:Vh(t)}):o("span",{children:String(t)})}function Wh({field:e}){const t=e.value??[],r=e.description;return m("div",{className:"col-span-full",children:[e.label&&o("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1",children:e.label}),r&&o("p",{className:"text-xs text-foreground-subtle mb-2",children:r}),t.length===0?o("div",{className:"rounded-md border border-border bg-surface-subtle px-3 py-2 text-xs text-foreground-subtle",children:e.emptyMessage??"No entries"}):o("div",{className:"rounded-md border border-border overflow-hidden",children:m("table",{className:"w-full text-xs",children:[o("thead",{className:"bg-surface-subtle border-b border-border",children:o("tr",{children:e.columns.map(n=>o("th",{className:"px-3 py-1.5 text-left font-medium text-foreground-subtle",style:n.width?{width:n.width}:void 0,children:n.label},n.key))})}),o("tbody",{className:"divide-y divide-border",children:t.map((n,s)=>o("tr",{className:"hover:bg-surface-hover/40",children:e.columns.map(a=>o("td",{className:"px-3 py-1.5 align-top text-foreground",children:o(qh,{kind:a.kind,value:n[a.key]})},a.key))},s))})]})})]})}function Kh({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const d=Array.isArray(t)?t:[],l=e.minRows??0,c=e.maxRows??Number.POSITIVE_INFINITY,u=(y,x,w)=>{const k=d.slice();k[y]={...k[y]??{},[x]:w},r(k)},p=y=>{d.length<=l||r(d.filter((x,w)=>w!==y))},h=()=>{if(d.length>=c)return;const y=e.defaultItem??{};r([...d,{...y}])},g=(y,x)=>e.rowTitleTemplate?e.rowTitleTemplate.replace(/\{(\w+)\}/g,(w,k)=>{const M=y[k];return M==null||M===""?"—":String(M)}):`Row ${x+1}`,b=d.length>l,v=d.length<c;return m("div",{className:"col-span-full space-y-2",children:[m("div",{className:"space-y-0.5",children:[e.label&&o("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle",children:Ve(e.label,s)}),e.description&&o("p",{className:"text-[11px] text-foreground-subtle",children:Ve(e.description,s)})]}),d.length===0?o("div",{className:"rounded-md border border-dashed border-border bg-background px-3 py-3 text-center text-[11px] text-foreground-subtle",children:e.emptyMessage??"No entries"}):o("div",{className:"space-y-2",children:d.map((y,x)=>m("div",{className:"rounded-md border border-border bg-background",children:[m("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[o("span",{className:"text-xs font-medium text-foreground",children:g(y,x)}),m("button",{type:"button",onClick:()=>p(x),disabled:n||!b,className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-30 disabled:cursor-not-allowed",title:b?"Remove this row":`At least ${l} row(s) required`,children:[o(Ja,{className:"h-3 w-3"}),"Remove"]})]}),o("div",{className:"grid grid-cols-1 @[420px]:grid-cols-2 gap-x-3 gap-y-2 p-3",children:e.itemFields.map(w=>o(or,{field:w,values:y,onChange:(k,M)=>u(x,k,M),disabled:n,translationFn:s,onTestField:a,allFields:e.itemFields,onAction:i},w.key))})]},x))}),m("div",{children:[m("button",{type:"button",onClick:h,disabled:n||!v,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-3 py-1 text-[11px] font-medium text-foreground hover:border-primary/40 hover:bg-primary/5 disabled:opacity-30 disabled:cursor-not-allowed",children:[o(rr,{className:"h-3 w-3"}),e.addLabel??"Add"]}),!v&&Number.isFinite(c)&&m("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["(limit: ",c,")"]})]})]})}function Yh({field:e,disabled:t,onAction:r}){const[n,s]=C(!1),a=oo(),i=async()=>{if(!(e.confirmMessage&&!await a({title:e.label,message:e.confirmMessage,confirmLabel:e.buttonLabel,variant:e.variant==="danger"?"danger":"default"}))&&r){s(!0);try{await r(e.action,e.key)}finally{s(!1)}}},d={default:"border border-border text-foreground hover:bg-surface-hover",primary:"bg-primary text-primary-foreground hover:bg-primary/90",danger:"bg-danger text-white hover:bg-danger/90"};return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,children:o("button",{onClick:i,disabled:t||n,className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 ${d[e.variant??"default"]??d.default}`,children:n?"Processing...":e.buttonLabel})})}function il(e,t){const r={...e.paramsStatic??{}};if(e.paramsFromForm)for(const[n,s]of Object.entries(e.paramsFromForm)){const a=t[s];a!=null&&a!==""&&(r[n]=a)}return r}function Zh({field:e,value:t,values:r,onChange:n,disabled:s,onAction:a}){const[i,d]=C(!1),[l,c]=C(null),[u,p]=C(null),h=il(e,r),g=Object.keys(e.paramsFromForm??{}).some(x=>h[x]===void 0);U(()=>{if(!a||g){p(null),c(null);return}let x=!1;return d(!0),c(null),a(e.action,e.key,h).then(w=>{if(x)return;const k=w;let M=[];if(Array.isArray(k))M=k;else if(k&&typeof k=="object")for(const S of Object.keys(k)){const E=k[S];if(Array.isArray(E)){M=E;break}}p(M)}).catch(w=>{x||(c(w instanceof Error?w.message:String(w)),p([]))}).finally(()=>{x||d(!1)}),()=>{x=!0}},[(e.refreshOn??Object.values(e.paramsFromForm??{})).map(x=>`${x}=${JSON.stringify(r[x])}`).join("|"),a,e.action,e.key]);const b=e.mapOption.value,v=e.mapOption.label,y=e.mapOption.description;return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,children:g?o("div",{className:"text-[11px] text-foreground-subtle italic",children:e.emptyParamsMessage??"Fill the prerequisite fields above first."}):i?m("div",{className:"flex items-center gap-2 text-[11px] text-foreground-subtle",children:[o(Qe,{className:"h-3 w-3 animate-spin"})," Loading options…"]}):l?o("div",{className:"text-[11px] text-danger",children:l}):u&&u.length===0?o("div",{className:"text-[11px] text-foreground-subtle italic",children:e.emptyResultsMessage??"No options returned."}):(()=>{const x=(u??[]).some(w=>{const k=w[b];return k===""||k===void 0});return m("select",{className:"w-full rounded-md border border-border bg-surface px-2 py-1.5 text-xs text-foreground",value:typeof t=="string"?t:"",disabled:s,onChange:w=>n(w.target.value),children:[!x&&o("option",{value:"",children:"— Select —"}),(u??[]).map((w,k)=>{const M=w[b],S=w[v],E=y?w[y]:void 0,I=typeof M=="string"&&M!==""?M:`row-${k}`;return m("option",{value:typeof M=="string"?M:String(M??""),children:[typeof S=="string"?S:String(S??I),E!==void 0?` (${String(E)})`:""]},I)})]})})()})}function Xh({field:e,values:t,disabled:r,onAction:n}){const[s,a]=C(!1),[i,d]=C(null),l=oo(),c=async()=>{if(e.confirmMessage&&!await l({title:e.label,message:e.confirmMessage,confirmLabel:e.buttonLabel,variant:e.variant==="danger"?"danger":"default"})||!n)return;const p=il(e,t);a(!0),d(null);try{const h=await n(e.action,e.key,p),g=typeof h=="object"&&h!==null?h:null;d({kind:"ok",text:e.successMessage?e.successMessage.replace(/\{(\w+)\}/g,(b,v)=>{const y=g?.[v];return y===void 0?"":String(y)}):"Done."})}catch(h){d({kind:"error",text:h instanceof Error?h.message:String(h)})}finally{a(!1)}},u={default:"border border-border text-foreground hover:bg-surface-hover",primary:"bg-primary text-primary-foreground hover:bg-primary/90",danger:"bg-danger text-white hover:bg-danger/90"};return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,children:m("div",{className:"flex flex-col gap-1.5",children:[o("button",{onClick:c,disabled:r||s,className:`inline-flex w-fit items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 ${u[e.variant??"default"]??u.default}`,children:s?"Working…":e.buttonLabel}),i&&o("div",{className:`text-[11px] ${i.kind==="ok"?"text-emerald-700 dark:text-emerald-300":"text-danger"}`,children:i.text})]})})}function Jh({field:e}){const t=ih();return o(Ee,{label:e.label,description:e.description,required:e.required,span:e.span,children:o(Sh,{widgetId:e.widgetId,host:"device-tab",config:e.widgetConfig,deviceId:t??void 0,instanceId:e.key})})}function eg(e,t){if(e==null)return"—";if(typeof e=="boolean")return e?"yes":"no";if(typeof e=="number"){const r=Number.isInteger(e)?String(e):e.toFixed(2);return t?`${r} ${t}`:r}return typeof e=="string"?e:JSON.stringify(e)}function tg({field:e,values:t,onAction:r,translationFn:n}){const s="key"in e?e.key:void 0;if(!s)return null;const a=t[s],i=a!==void 0?a:"default"in e?e.default:void 0,d=eg(i,"unit"in e?e.unit:void 0),l="label"in e?e.label:void 0,c="description"in e?e.description:void 0,u="span"in e?e.span:void 0,p="actions"in e?e.actions??[]:[];return o(Ee,{label:l,description:c,span:u,translationFn:n,children:m("div",{className:"flex items-stretch gap-1",children:[o("div",{className:"flex-1 rounded-md border border-border bg-surface-alt px-2.5 py-1.5 text-xs text-foreground font-mono break-all",children:d}),p.length>0&&o("div",{className:"flex items-center gap-1",children:p.map(h=>o(ng,{action:h,fieldKey:s,value:i,onAction:r},h.action))})]})})}function rg({name:e}){const t="h-3.5 w-3.5";switch(e){case"copy":return o(tt,{className:t});case"refresh-cw":return o(Or,{className:t});case"external-link":return o(Yn,{className:t});case"trash-2":return o(Ye,{className:t});case"download":return o(kn,{className:t});case"upload":return o(oi,{className:t});default:return o(Jn,{className:t})}}function ng({action:e,fieldKey:t,value:r,onAction:n}){const s=oo(),[a,i]=C(!1),d=e.variant==="danger"?"text-danger hover:bg-danger/10 border-danger/30":e.variant==="primary"?"text-primary hover:bg-primary/10 border-primary/30":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover border-border";return o("button",{type:"button",onClick:async()=>{if(!(e.confirmMessage&&!await s({title:e.tooltip,message:e.confirmMessage,variant:e.variant==="danger"?"danger":"default"}))){if(e.action==="copy-value"){try{await navigator.clipboard.writeText(typeof r=="string"?r:String(r))}catch{}return}if(n){i(!0);try{await n(e.action,t)}finally{i(!1)}}}},disabled:a,title:e.tooltip,className:`inline-flex items-center justify-center rounded-md border px-2 py-1.5 transition-colors disabled:opacity-50 ${d}`,children:o(rg,{name:e.icon})})}function og(e){return"multiple"in e&&e.multiple!=null}function sg({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:d,onAction:l}){const c=e.multiple,u=c.min,p=c.max,h=t[e.key],g=[...Array.isArray(h)?h:h!=null?[h]:[]],b=c.itemDefault!==void 0?c.itemDefault:"default"in e&&e.default!==void 0?e.default:"";for(;g.length<u;)g.push(b);const v=M=>r(e.key,[...M]),y=(M,S)=>{const E=[...g];E[M]=S,v(E)},x=()=>{g.length>=p||v([...g,b])},w=M=>{g.length<=u||v(g.filter((S,E)=>E!==M))},k=()=>{const{multiple:M,...S}=e;return{...S,...{label:void 0,description:void 0,required:!1}}};return o(Ee,{label:e.label,description:e.description,required:u>0?e.required:!1,span:e.span,translationFn:s,children:m("div",{className:"space-y-2",children:[g.map((M,S)=>{const E=c.itemLabel?.replace("${n}",String(S+1));return m("div",{className:"space-y-1",children:[E&&o("div",{className:Gr,children:E}),m("div",{className:"flex items-center gap-2",children:[o("div",{className:"flex-1 min-w-0",children:o(or,{field:k(),values:{...t,[e.key]:M},onChange:(I,A)=>y(S,A),disabled:n,translationFn:s,onTestField:a,onAction:l,allFields:d})}),g.length>u&&o("button",{type:"button",onClick:()=>w(S),disabled:n,title:"Remove",className:"flex-shrink-0 inline-flex items-center justify-center rounded-md border border-border p-1.5 text-foreground-subtle hover:text-danger hover:border-danger/50 transition-colors disabled:opacity-40",children:o(Ye,{className:"h-3.5 w-3.5"})})]})]},S)}),m("div",{className:"flex items-center justify-between pt-1",children:[g.length<p?m("button",{type:"button",onClick:x,disabled:n,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40",children:[o(rr,{className:"h-3 w-3"}),c.addLabel??"Add"]}):o("span",{}),m("span",{className:"text-[10px] text-foreground-subtle tabular-nums",children:[g.length,"/",p]})]})]})})}function ag(e,t,r){if(!("showWhen"in e)||!e.showWhen)return!0;const n=e.showWhen,s=t[n.field],a=r?.find(l=>"key"in l&&l.key===n.field),i=a&&"default"in a?a.default:void 0,d=s!==void 0?s:i;return n.equals!==void 0?d===n.equals:n.notEquals!==void 0?d!==n.notEquals:n.in!==void 0?n.in.includes(d):n.notIn!==void 0?!n.notIn.includes(d):n.includes!==void 0?Array.isArray(d)&&d.includes(n.includes):n.notIncludes!==void 0?!Array.isArray(d)||!d.includes(n.notIncludes):!0}function or({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:d,onAction:l}){if(og(e))return o(sg,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:d,onAction:l});if("readonlyField"in e&&e.readonlyField===!0)return o(tg,{field:e,values:t,onAction:l,translationFn:s});if(!ag(e,t,d))return null;const c=t[e.key],u=c!==void 0?c:"default"in e?e.default:void 0,p=g=>r(e.key,g),h=ah(e.type);switch(e.type){case"text":return o(Eh,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"number":return o(Ah,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"boolean":return o(Ph,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"select":return o(Rh,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"multiselect":return o(Ih,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"password":return o(_h,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"textarea":return o(Th,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"slider":return o(Dh,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"tags":return o(Lh,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"color":return o(Bh,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"node-select":return o(Oh,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"node-multiselect":return o($h,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"probe":return o(zh,{field:e,value:u,onChange:p,disabled:n,translationFn:s,onTestField:a,onAction:l,externalProbe:i});case"group":return o(Fh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a});case"sub-tabs":return o(Gh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:l});case"separator":return o(Qh,{});case"info":return o(Uh,{field:e});case"object-array":return o(Wh,{field:e});case"editable-array":return o(Kh,{field:e,value:u,onChange:p,disabled:n,translationFn:s,onTestField:a,onAction:l});case"button":return o(Yh,{field:e,disabled:n,onAction:l});case"addon-action-select":return o(Zh,{field:e,value:u,values:t,onChange:p,disabled:n,onAction:l});case"addon-action-button":return o(Xh,{field:e,values:t,disabled:n,onAction:l});case"widget":return o(Jh,{field:e});default:return h?o(h,{field:e,value:u,onChange:p,disabled:n}):null}}function ig(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function Ve(e,t){if(e!==void 0)return t&&ig(e)?t(e):e}function lg({section:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i}){const[d,l]=C(e.defaultCollapsed??!1),c=e.style==="accordion",u=e.columns??2,p=u===1?"grid-cols-1":u===3?"grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3":u===4?"grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4":"grid-cols-1 @[640px]:grid-cols-2";return m("div",{className:"@container rounded-lg border border-border bg-surface p-3",style:{containerType:"inline-size"},children:[m("div",{className:["flex items-center justify-between mb-2",c?"cursor-pointer":""].join(" "),onClick:c?()=>l(h=>!h):void 0,children:[m("div",{children:[o("h3",{className:"text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider",children:Ve(e.title,s)}),e.description&&o("p",{className:"text-[10px] text-foreground-subtle mt-0.5",children:Ve(e.description,s)})]}),c&&o("span",{className:"text-foreground-subtle text-xs ml-2",children:d?"▸":"▾"})]}),!d&&o("div",{className:`grid ${p} gap-x-3 gap-y-2.5`,children:e.fields.map(h=>o(or,{field:h,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i?.[h.key]},h.key))})]})}function cg({schema:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i,onClearProbe:d}){const l=(c,u)=>{r({...t,[c]:u}),d?.(c)};return o("div",{className:"space-y-4",children:e.sections.map(c=>o(lg,{section:c,values:t,onChange:l,disabled:n,translationFn:s,onTestField:a,probeResults:i},c.id))})}var dg=({open:e})=>o("svg",{className:`h-3 w-3 transition-transform ${e?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o("polyline",{points:"9 18 15 12 9 6"})});function ps(e){const t={};if(!e)return t;for(const r of e.sections)for(const n of r.fields){if(n.type==="separator"||n.type==="info"||n.type==="button"||n.type==="group")continue;const s=n.key;t[s]=n.value}return t}function ug(e){return{...e,sections:e.sections.map(t=>({...t,fields:t.fields.map(r=>{if(r.type==="separator"||r.type==="info"||r.type==="button"||r.type==="group")return r;const{value:n,...s}=r;return s})}))}}function EC({trpc:e,addonId:t,nodeId:r,title:n,disabled:s,onAfterChange:a,refreshToken:i,collapsible:d,defaultOpen:l,mode:c,onOverrideChange:u}){const p=c??"persist",[h,g]=C(null),[b,v]=C(!0),[y,x]=C(null),[w,k]=C(!1),[M,S]=C(l??!1),[E,I]=C({}),[A,F]=C(null);U(()=>{F(null),I({})},[e,t,r,i,p]),U(()=>{let le=!1;v(!0),x(null);const te=p==="override"&&Object.keys(E).length>0?E:void 0;return e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r,...te?{overlay:te}:{}}).then(H=>{le||(g(H),te||F(ps(H)),v(!1))}).catch(H=>{le||(x(H instanceof Error?H.message:String(H)),v(!1))}),()=>{le=!0}},[e,t,r,i,p,JSON.stringify(E)]);const Y=K(()=>ps(h),[h]),ce=K(()=>h?ug(h):null,[h]),ge=async le=>{if(p==="override"){const H=A??Y,ve={};for(const T of Object.keys(le))le[T]!==H[T]&&(ve[T]=le[T]);const me={...H,...ve};I(ve),u?.(ve,me);return}const te={};for(const H of Object.keys(le))le[H]!==Y[H]&&(te[H]=le[H]);if(Object.keys(te).length!==0){k(!0);try{await e.addonSettings.updateGlobalSettings.mutate({addonId:t,nodeId:r,patch:te}),g(await e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r})),a?.()}catch(H){x(H instanceof Error?H.message:String(H))}finally{k(!1)}}};if(b)return m("div",{className:"text-xs text-foreground-subtle animate-pulse",children:["Loading ",n??t,"…"]});if(y)return m("div",{className:"text-xs text-red-400",children:[n??t,": ",y]});if(!h||!ce)return m("div",{className:"text-xs text-foreground-subtle",children:[n??t," not available on ",r,"."]});const se=p==="override"?{...Y,...E}:Y,ae=m(Se,{children:[p==="override"?o("div",{className:"mb-2 text-[11px] text-foreground-subtle",children:"Benchmark override — applies to this run only. The addon's saved settings are not changed."}):null,o(cg,{schema:ce,values:se,onChange:ge,disabled:s===!0||w})]});return d===!0?m("section",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[m("button",{type:"button",onClick:()=>S(le=>!le),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-surface-hover text-left","aria-expanded":M,children:[o(dg,{open:M}),o("h3",{className:"text-xs font-semibold text-foreground uppercase tracking-wide flex-1",children:n??t}),o("span",{className:"text-[10px] text-foreground-subtle",children:M?"hide":"edit"})]}),M?o("div",{className:"border-t border-border px-4 py-3",children:ae}):null]}):n?m("section",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[o("div",{className:"border-b border-border px-4 py-2",children:o("h3",{className:"text-xs font-semibold text-foreground uppercase tracking-wide",children:n})}),o("div",{className:"px-4 py-3",children:ae})]}):o("div",{children:ae})}function pg({detections:{motion:e,motionRaw:t,detection:r,phase:n},showMotionZones:s=!0,showMotionRaw:a=!0,showDetections:i=!0,showPhaseIndicator:d=!0}){const l=s&&e&&e.zones.length>0,c=a&&t&&t.boxes.length>0,u=i&&r&&r.detections.length>0;return!l&&!c&&!u&&!d?null:m("div",{className:"absolute inset-0 pointer-events-none z-10",children:[d&&o(fg,{phase:n}),c&&o(mg,{raw:t}),l&&o(hg,{motion:e}),u&&o(gg,{detections:r.detections,frameWidth:r.frameWidth,frameHeight:r.frameHeight})]})}function fg({phase:e}){const t=na(e);return m("div",{className:"absolute top-2 left-2 flex items-center gap-1.5 px-2 py-1 rounded-md bg-black/60 backdrop-blur-sm",children:[o("span",{className:`w-2 h-2 rounded-full ${t.dotClass}`}),o("span",{className:"text-[10px] font-semibold text-white uppercase tracking-wider",children:t.label})]})}function mg({raw:e}){return e.frameWidth===0||e.frameHeight===0?null:o(Se,{children:e.boxes.map((t,r)=>{const[n,s,a,i]=t.bbox,d=n/e.frameWidth*100,l=s/e.frameHeight*100,c=(a-n)/e.frameWidth*100,u=(i-s)/e.frameHeight*100,p=Math.max(.05,Math.min(.25,t.changeScore*.3));return o("div",{className:"absolute rounded-sm",style:{left:`${d}%`,top:`${l}%`,width:`${c}%`,height:`${u}%`,backgroundColor:`rgba(239, 68, 68, ${p})`}},`mr-${r}`)})})}function hg({motion:e}){return e.frameWidth===0||e.frameHeight===0?null:o(Se,{children:e.zones.filter(t=>t.w*t.h/(e.frameWidth*e.frameHeight)<.9).map((t,r)=>{const n=Math.max(.15,Math.min(.5,t.intensity/255));return o("div",{className:"absolute rounded-sm",style:{left:`${t.x/e.frameWidth*100}%`,top:`${t.y/e.frameHeight*100}%`,width:`${t.w/e.frameWidth*100}%`,height:`${t.h/e.frameHeight*100}%`,border:`1px solid rgba(250, 204, 21, ${n})`,backgroundColor:`rgba(250, 204, 21, ${n*.15})`}},`mz-${r}`)})})}function gg({detections:e,frameWidth:t,frameHeight:r}){return t===0||r===0?null:o(Se,{children:e.map(n=>{const{x:s,y:a,width:i,height:d}=n.bbox,l=s/t*100,c=a/r*100,u=i/t*100,p=d/r*100,h=Ge(n.macroClass),g=[`${n.macroClass} ${(n.score*100).toFixed(0)}%`];for(const b of n.labels)g.push(b.label);return o("div",{className:"absolute border-2 rounded-sm",style:{left:`${l}%`,top:`${c}%`,width:`${u}%`,height:`${p}%`,borderColor:h},children:o("div",{className:"absolute -top-4 left-0 px-1 py-0.5 text-[9px] font-bold text-white rounded-sm whitespace-nowrap",style:{backgroundColor:h},children:g.join(" | ")})},`det-${n.id}`)})})}function bg(e){const t={};if(typeof window<"u"){if(e){const n=e.getBoundingClientRect();n.width>0&&n.height>0&&(t.viewportWidth=Math.round(n.width),t.viewportHeight=Math.round(n.height))}t.viewportWidth===void 0&&(t.viewportWidth=window.innerWidth,t.viewportHeight=window.innerHeight),t.devicePixelRatio=window.devicePixelRatio||1;const r=navigator.connection;r?.downlink&&r.downlink>0&&(t.downlinkMbps=r.downlink)}return t}var vg=3e3,yg=5;function xg({serverUrl:e,streamKey:t,label:r,autoPlay:n=!0,muted:s=!0,showControls:a=!0,className:i="",onStateChange:d,onError:l,overlay:c,createSession:u,sendAnswer:p,closeSession:h,hintsOverride:g}){const b=W(null),v=W(null),y=W(null),x=W(new Set),w=W(null),k=W(null),M=W(0),S=W(!0),[E,I]=C("idle"),[A,F]=C(""),[Y,ce]=C(s),[ge,se]=C(!1),[ae,le]=C(!1),te=W(null),H=W(!1);(p||u)&&(H.current=!0);const ve=H.current,me=_(ee=>{I(ee),d?.(ee)},[d]),T=_(()=>{if(w.current?.abort(),w.current=null,k.current&&(clearTimeout(k.current),k.current=null),y.current&&(y.current.close(),y.current=null),h&&x.current.size>0){for(const ee of x.current)h(ee).catch(()=>{});x.current.clear()}b.current&&(b.current.srcObject=null)},[h]),z=_(async()=>{if(!S.current||!u||!p)return;T(),me("connecting");const ee=new AbortController;w.current=ee;try{const{sessionId:he,sdpOffer:we}=await u({...bg(v.current),...g});if(x.current.add(he),!S.current||ee.signal.aborted){h?.(he).catch(()=>{}),x.current.delete(he);return}const ke=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});y.current=ke;const O=new MediaStream;ke.ontrack=L=>{console.debug("[WebRTC] ontrack",L.track.kind,L.track.readyState),O.addTrack(L.track),b.current&&(b.current.srcObject=O,b.current.play().catch(()=>{}))},ke.oniceconnectionstatechange=()=>{if(!S.current)return;const L=ke.iceConnectionState;console.debug("[WebRTC] ICE state:",L),L==="connected"||L==="completed"?(M.current=0,me("playing"),b.current?.paused&&(console.debug("[WebRTC] video was paused at ICE connected — calling play()"),b.current.play().catch(()=>{}))):(L==="failed"||L==="disconnected"||L==="closed")&&(me("disconnected"),Z())},ke.onicecandidateerror=L=>{console.debug("[WebRTC] ICE candidate error:",L)},console.debug("[WebRTC] Setting remote description (server offer)..."),await ke.setRemoteDescription({type:"offer",sdp:we});const P=await ke.createAnswer();if(await ke.setLocalDescription(P),console.debug("[WebRTC] Local description set, waiting for ICE gathering..."),await fs(ke),!S.current)return;const D=(ke.localDescription?.sdp??"").split(`
|
|
77
|
-
`).filter(L=>L.startsWith("a=candidate:")).length;console.debug("[WebRTC] Sending answer to server",{localCandidates:D,sessionId:he.slice(0,8)}),await p(he,ke.localDescription?.sdp??""),console.debug("[WebRTC] Answer sent successfully");const re=ke,de=()=>{const L=re.connectionState;if(L==="closed"||L==="failed")return;const ne=b.current;ne&&ne.readyState===0&&console.log(`[WebRTC] no video data yet (ice=${re.iceConnectionState})`)};setTimeout(de,3e3),setTimeout(de,8e3)}catch(he){if(!S.current)return;const we=he instanceof Error?he.message:String(he);F(we),me("error"),l?.(we),Z()}},[e,t,u,p,T,me,l,g]),$=_(async()=>{if(S.current){T(),me("connecting");try{const ee=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});y.current=ee,ee.addTransceiver("video",{direction:"recvonly"}),ee.addTransceiver("audio",{direction:"recvonly"});const he=new MediaStream;ee.ontrack=D=>{he.addTrack(D.track),b.current&&(b.current.srcObject=he,b.current.play().catch(()=>{}))},ee.oniceconnectionstatechange=()=>{if(!S.current)return;const D=ee.iceConnectionState;D==="connected"||D==="completed"?(M.current=0,me("playing"),b.current?.paused&&b.current.play().catch(()=>{})):(D==="failed"||D==="disconnected"||D==="closed")&&(me("disconnected"),Z())};const we=await ee.createOffer();if(await ee.setLocalDescription(we),await fs(ee),!S.current)return;const ke=`${e}/api/webrtc?src=${encodeURIComponent(t)}`,O=await fetch(ke,{method:"POST",headers:{"Content-Type":"application/sdp"},body:ee.localDescription?.sdp??""});if(!O.ok)throw new Error(`WHEP ${O.status}: ${O.statusText}`);const P=await O.text();await ee.setRemoteDescription({type:"answer",sdp:P})}catch(ee){if(!S.current)return;const he=ee instanceof Error?ee.message:String(ee);F(he),me("error"),l?.(he),Z()}}},[e,t,T,me,l]),ie=ve?z:$,V=W(()=>{});V.current=ie;const Z=_(()=>{S.current&&(M.current>=yg||(M.current+=1,k.current=setTimeout(()=>{S.current&&V.current()},vg)))},[]);U(()=>(S.current=!0,M.current=0,n&&ie(),()=>{S.current=!1,T()}),[e,t]);const X=W(!1);U(()=>{!n||!ve||!u||!p||X.current||y.current||(X.current=!0,ie())},[n,ve,u,p,ie]);const j=()=>{M.current=0,ie()},oe=()=>{b.current&&(b.current.muted=!b.current.muted,ce(b.current.muted))},J=async()=>{if(v.current)try{document.fullscreenElement?await document.exitFullscreen():await v.current.requestFullscreen()}catch(ee){console.warn(`Fullscreen toggle failed: ${ee instanceof Error?ee.message:ee}`)}},Te=()=>{if(!b.current)return;const ee=document.createElement("canvas");ee.width=b.current.videoWidth||1280,ee.height=b.current.videoHeight||720;const he=ee.getContext("2d");if(!he)return;he.drawImage(b.current,0,0);const we=document.createElement("a");we.download=`${t.replace(/[/:]/g,"-")}-${Date.now()}.jpg`,we.href=ee.toDataURL("image/jpeg",.92),we.click()};U(()=>{const ee=()=>se(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",ee),()=>document.removeEventListener("fullscreenchange",ee)},[]);const De=()=>{le(!0),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>le(!1),3e3)};return m("div",{ref:v,className:`relative bg-black overflow-hidden group ${i}`,onMouseMove:De,onMouseEnter:De,children:[o("video",{ref:b,autoPlay:n,muted:Y,playsInline:!0,className:"w-full h-full object-contain"}),r&&E==="playing"&&o("div",{className:"absolute top-2 left-2 px-2 py-0.5 rounded bg-black/60 text-[10px] text-white font-medium",children:r}),c,E==="connecting"&&m("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/70 gap-2",children:[o("svg",{className:"h-6 w-6 text-white/60 animate-spin",viewBox:"0 0 24 24",fill:"none",children:o("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"32",className:"animate-[dash_1.5s_ease-in-out_infinite]"})}),o("span",{className:"text-xs text-white/60",children:"Connecting…"})]}),(E==="error"||E==="disconnected")&&m("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/70 gap-2",children:[o("svg",{className:"h-6 w-6 text-red-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o("path",{d:"M1 1l5.5 5.5M23 23l-5.5-5.5M8.11 15.89a8 8 0 0110.78-10.78M3.64 3.64A12 12 0 0020.36 20.36",strokeLinecap:"round"})}),o("span",{className:"text-xs text-red-400 text-center px-4",children:E==="error"?A||"Connection failed":"Disconnected"}),o("button",{onClick:j,className:"mt-1 inline-flex items-center gap-1.5 rounded px-3 py-1 text-xs bg-white/10 text-white hover:bg-white/20 transition-colors",children:"Reconnect"})]}),a&&E==="playing"&&m("div",{className:`absolute bottom-0 inset-x-0 flex items-center justify-between px-3 py-1.5 bg-gradient-to-t from-black/80 to-transparent transition-opacity duration-200 ${ae?"opacity-100":"opacity-0"}`,children:[o("div",{className:"flex items-center gap-1",children:o(an,{onClick:oe,title:Y?"Unmute":"Mute",children:Y?m("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),o("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),o("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}):m("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),o("path",{d:"M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07"})]})})}),m("div",{className:"flex items-center gap-1",children:[o(an,{onClick:Te,title:"Take snapshot",children:m("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o("path",{d:"M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"}),o("circle",{cx:"12",cy:"13",r:"4"})]})}),o(an,{onClick:J,title:ge?"Exit fullscreen":"Fullscreen",children:ge?o("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:o("path",{d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):o("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:o("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"})})})]})]})]})}function an({onClick:e,title:t,children:r}){return o("button",{onClick:e,title:t,className:"rounded-full p-1.5 text-white/80 hover:text-white hover:bg-white/20 transition-colors",children:r})}async function fs(e){if(e.iceGatheringState!=="complete")return new Promise(t=>{const r=()=>{e.iceGatheringState==="complete"&&(e.removeEventListener("icegatheringstatechange",r),t())};e.addEventListener("icegatheringstatechange",r),setTimeout(t,5e3)})}var io=ct("camstack:player-overlays-state",null),lo=ct("camstack:player-overlays-actions",null);function AC({children:e}){const[t,r]=C(()=>new Map),[n,s]=C(()=>new Map),a=_(p=>{r(h=>{const g=new Map(h);return g.set(p.id,p),g})},[]),i=_(p=>{r(h=>{if(!h.has(p))return h;const g=new Map(h);return g.delete(p),g})},[]),d=_(p=>{s(h=>{const g=new Map(h);return g.set(p.id,p),g})},[]),l=_(p=>{s(h=>{if(!h.has(p))return h;const g=new Map(h);return g.delete(p),g})},[]),c=K(()=>({layers:t,buttons:n}),[t,n]),u=K(()=>({setLayer:a,removeLayer:i,setButton:d,removeButton:l}),[a,i,d,l]);return o(io.Provider,{value:c,children:o(lo.Provider,{value:u,children:e})})}function PC(){const e=Ie(io);return K(()=>e?[...e.layers.values()].sort((t,r)=>t.order-r.order):[],[e])}function wg(){const e=Ie(io);return K(()=>e?[...e.buttons.values()].sort((t,r)=>t.order-r.order):[],[e])}function RC(e){const t=Ie(lo);U(()=>{if(!(!t||!e))return t.setLayer(e),()=>t.removeLayer(e.id)},[t,e])}function IC(e){const t=Ie(lo);U(()=>{if(!(!t||!e))return t.setButton(e),()=>t.removeButton(e.id)},[t,e])}function kg(e){return e==="streaming"?"bg-emerald-500":e==="connecting"?"bg-amber-500":e==="error"?"bg-rose-500":"bg-zinc-500"}function Ng(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h${Math.floor(t%3600/60)}m`}function Ln({className:e}){return o("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("polygon",{points:"5 3 19 12 5 21 5 3"})})}function Sg({className:e}){return o("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Cg({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"}),o("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),o("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),o("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}function Mg({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[o("circle",{cx:"5",cy:"12",r:"2"}),o("circle",{cx:"12",cy:"12",r:"2"}),o("circle",{cx:"19",cy:"12",r:"2"})]})}function ln({label:e,active:t,onClick:r}){return m("button",{type:"button",onClick:r,className:"w-full flex items-center justify-between gap-3 px-3 py-1.5 text-[11px] text-foreground hover:bg-surface-hover transition-colors",children:[o("span",{children:e}),o("span",{className:`inline-block h-3 w-5 rounded-full transition-colors ${t?"bg-primary":"bg-foreground-subtle/30"} relative`,children:o("span",{className:`absolute top-0.5 h-2 w-2 rounded-full bg-white transition-all ${t?"left-2.5":"left-0.5"}`})})]})}function ll({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o("polyline",{points:"23 4 23 10 17 10"}),o("polyline",{points:"1 20 1 14 7 14"}),o("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]})}function Eg({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o("line",{x1:"2",y1:"2",x2:"22",y2:"22"}),o("path",{d:"M10.41 10.41a2 2 0 11-2.83-2.83"}),o("line",{x1:"13.5",y1:"13.5",x2:"6",y2:"21"}),o("path",{d:"M18 12l-1.5-1.5"}),o("path",{d:"M21 15V5a2 2 0 00-2-2H5"}),o("path",{d:"M21 21H5a2 2 0 01-2-2V11"})]})}function _C({serverUrl:e,createSession:t,sendAnswer:r,closeSession:n,streams:s,activeStreamId:a,onStreamChange:i,deviceName:d,phase:l,pipelineMetrics:c,detections:u,defaultShowDetections:p=!0,defaultShowMotion:h=!1,streamStats:g,autoPlay:b=!1,showPlayStop:v=!1,snapshotSrc:y,snapshotLoading:x=!1,onRefreshSnapshot:w,showStreamStats:k=!1,children:M,extraOverlay:S,ptzAvailable:E=!1,ptzShown:I=!1,ptzOverlay:A,onPtzToggle:F,intercomAvailable:Y=!1,intercomShown:ce=!1,onIntercomToggle:ge,chromeless:se=!1,className:ae}){const le=wg(),[te,H]=C(b),[ve,me]=C(p),[T,z]=C(h),[$,ie]=C(null),[V,Z]=C(!1),X=W(null);U(()=>{if(!V)return;function L(ne){X.current&&!X.current.contains(ne.target)&&Z(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[V]);const j=a??$??s?.[0]?.id??"",oe=s?.find(L=>L.id===j)??s?.[0],J=oe?.inputFps!=null?{status:oe.status??"unknown",inputFps:oe.inputFps,bitrateKbps:oe.bitrateKbps??0}:null,Te=L=>{ie(L),i?.(L),te&&v&&(H(!1),setTimeout(()=>H(!0),50))},De=K(()=>{const L=oe?.target;if(L)return ne=>t(L,ne)},[t,oe]),ee=s,he=()=>H(!0),we=()=>H(!1),ke=c?.phase??l,O=ke==="active",P=!!u,D=P&&(ve||T),re=E&&I&&!!A,de=v?te:!0;return m("div",{className:`overflow-hidden ${se?"":"rounded-xl border border-border bg-surface"} ${ae??""}`,children:[m("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[m("div",{className:"flex items-center gap-2",children:[(g??J)&&o("span",{className:`w-2 h-2 rounded-full ${kg((g??J).status)}`}),d&&o("span",{className:"text-xs font-medium text-foreground",children:d}),ee&&ee.length>1&&m("div",{className:"relative",children:[o("select",{"data-testid":"stream-profile-select",value:j,onChange:L=>Te(L.target.value),className:"appearance-none cursor-pointer rounded-md border border-border bg-surface-hover hover:bg-surface text-foreground text-[11px] font-medium pl-2 pr-6 py-1 focus:outline-none focus:ring-1 focus:ring-primary transition-colors",children:ee.map(L=>o("option",{value:L.id,children:L.label},L.id))}),o("span",{className:"pointer-events-none absolute right-1.5 top-1/2 -translate-y-1/2 text-foreground-subtle",children:o("svg",{className:"h-2.5 w-2.5",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("polyline",{points:"3 4.5 6 7.5 9 4.5"})})})]})]}),m("div",{className:"flex items-center gap-1.5",children:[Y&&m("button",{"data-testid":"stream-intercom-toggle","data-intercom-shown":ce?"true":"false",onClick:ge,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors ${ce?"bg-primary/15 text-primary":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover"}`,title:ce?"Close intercom":"Open intercom",children:[o(Cg,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:"Intercom"})]}),le.map(L=>{const ne=L.tone==="primary"?"bg-primary text-primary-foreground":"bg-primary/15 text-primary";return m("button",{type:"button","data-toolbar-button-id":L.id,"data-toolbar-button-active":L.active?"true":"false",onClick:L.onClick,disabled:L.disabled,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors disabled:opacity-50 ${L.active?ne:"text-foreground-subtle hover:text-foreground hover:bg-surface-hover"}`,title:L.title??L.label,children:[L.icon,o("span",{className:"hidden xl:inline",children:L.label})]},L.id)}),v&&m("button",{"data-testid":"stream-play-toggle","data-stream-playing":de?"true":"false",onClick:de?we:he,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors ${de?"bg-danger/10 text-danger hover:bg-danger/20":"bg-primary/10 text-primary hover:bg-primary/20"}`,title:de?"Stop stream":"Start stream",children:[de?o(Sg,{className:"h-3 w-3"}):o(Ln,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:de?"Stop":"Play"})]}),w&&m("button",{"data-testid":"stream-snapshot-refresh",onClick:w,disabled:x,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50",title:"Force snapshot refresh",children:[o(ll,{className:`h-3 w-3 ${x?"animate-spin":""}`}),o("span",{className:"hidden xl:inline",children:"Snapshot"})]}),(P||E||c||ke||g||J&&J.inputFps>0)&&m("div",{ref:X,className:"relative",children:[o("button",{onClick:()=>Z(L=>!L),title:"More controls",className:"inline-flex items-center justify-center rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",children:o(Mg,{className:"h-3.5 w-3.5"})}),V&&m("div",{className:"absolute right-0 top-full mt-1 z-30 min-w-[200px] rounded-lg border border-border bg-surface shadow-xl py-1.5",children:[k&&g&&m("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),m("span",{className:"tabular-nums text-foreground",children:[g.inputFps.toFixed(1)," fps"]})]}),m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Decode"}),m("span",{className:"tabular-nums text-foreground",children:[g.decodeFps.toFixed(1)," fps"]})]}),m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Uptime"}),o("span",{className:"tabular-nums text-foreground",children:Ng(g.uptimeMs)})]})]}),!k&&J&&J.inputFps>0&&m("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),m("span",{className:"tabular-nums text-foreground",children:[J.inputFps.toFixed(1)," fps"]})]}),J.bitrateKbps>0&&m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Bitrate"}),m("span",{className:"tabular-nums text-foreground",children:[J.bitrateKbps," kbps"]})]})]}),(c||P&&ke)&&m("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[m("div",{className:"flex justify-between gap-3 items-center",children:[o("span",{children:"Phase"}),m("span",{className:`flex items-center gap-1 font-semibold uppercase tracking-wider ${O?"text-red-400":"text-emerald-400"}`,children:[o("span",{className:`w-1.5 h-1.5 rounded-full ${O?"bg-red-500 animate-pulse":"bg-emerald-500"}`}),O?"Active":"Watching"]})]}),c&&c.detectionFps>0&&m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Detection"}),m("span",{className:"tabular-nums text-foreground",children:[c.detectionFps.toFixed(1)," det/s"]})]}),c&&c.avgInferenceMs>0&&m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Inference"}),m("span",{className:"tabular-nums text-foreground",children:[c.avgInferenceMs.toFixed(0)," ms"]})]})]}),P&&m(Se,{children:[o(ln,{label:"Show detections",active:ve,onClick:()=>me(L=>!L)}),o(ln,{label:"Show motion",active:T,onClick:()=>z(L=>!L)})]}),E&&o(ln,{label:"PTZ controls",active:I,onClick:()=>{F?.(),Z(!1)}})]})]})]})]}),de?o("div",{className:"aspect-video relative",children:o(xg,{serverUrl:e,streamKey:j,autoPlay:!0,className:"w-full h-full",createSession:De,sendAnswer:r,closeSession:n,overlay:D||S||re?m(Se,{children:[D&&o(pg,{detections:u,showPhaseIndicator:!1,showMotionZones:T,showMotionRaw:T,showDetections:ve}),S,re&&A]}):void 0},j)}):o(Ag,{src:y??null,isLoading:x,onPlay:he,onRetry:w,extraOverlay:S||re?m(Se,{children:[S,re&&A]}):null,suppressPlayHover:!!S||re}),M]})}function Ag({src:e,isLoading:t,onPlay:r,onRetry:n,extraOverlay:s,suppressPlayHover:a=!1}){return e?m("div",{className:"relative w-full aspect-video bg-black/90 flex items-center justify-center",children:[o("img",{src:e,alt:"Camera snapshot",className:"w-full h-full object-contain"}),!a&&o("button",{onClick:r,className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 hover:opacity-100 transition-opacity cursor-pointer",children:o("div",{className:"h-14 w-14 rounded-full bg-white/20 backdrop-blur-sm flex items-center justify-center",children:o(Ln,{className:"h-7 w-7 text-white ml-0.5"})})}),s]}):t?o("div",{className:"relative w-full aspect-video bg-black/90 flex items-center justify-center",children:o("div",{className:"h-8 w-8 border-2 border-white/20 border-t-white/60 rounded-full animate-spin"})}):o("div",{className:"relative w-full aspect-video bg-black/90 flex items-center justify-center",children:m("div",{className:"flex flex-col items-center gap-2 text-white/40",children:[o(Eg,{className:"h-8 w-8"}),o("span",{className:"text-xs",children:"No snapshot available"}),m("div",{className:"flex items-center gap-2 mt-1",children:[n&&m("button",{onClick:n,className:"inline-flex items-center gap-1.5 rounded-md border border-white/20 px-3 py-1.5 text-xs font-medium text-white/60 hover:text-white hover:border-white/40 transition-colors",children:[o(ll,{className:"h-3 w-3"}),"Retry"]}),m("button",{onClick:r,className:"inline-flex items-center gap-1.5 rounded-md bg-primary/80 px-3 py-1.5 text-xs font-medium text-white hover:bg-primary transition-colors",children:[o(Ln,{className:"h-3 w-3"}),"Play Live"]})]})]})})}var ms={value:"auto",label:"Auto (best available)"};function Pg(e){return e.charAt(0).toUpperCase()+e.slice(1)}function TC({deviceId:e,value:t,onChange:r,disabled:n,label:s,className:a}){const i=gt(),d=dh({deviceId:e},{refetchOnWindowFocus:!1}),[l,c]=C([ms]);U(()=>{if(!d.data)return;const h=`${e}/`,g=[ms];for(const b of d.data){if(!b.enabled)continue;const v=b.brokerId.startsWith(h)?b.brokerId.slice(h.length):b.brokerId;g.push({value:v,label:Pg(v)})}c(g)},[d.data,e]);const u=s??"Preferred stream",p=d.isLoading?"Loading available streams…":d.isError?"Could not load streams — only Auto available.":l.length===1?"No enabled streams found — only Auto available.":null;return m("div",{className:a,children:[o("label",{id:i,className:"text-xs font-medium text-foreground-muted block mb-1",children:u}),o(Pr,{"aria-labelledby":i,options:l,value:t,disabled:n,onChange:h=>r(h.target.value)}),p!==null&&o("p",{className:"text-foreground-subtle text-[10px] mt-1",children:p})]})}var Rg=Object.defineProperty,Ir=Object.getOwnPropertySymbols,cl=Object.prototype.hasOwnProperty,dl=Object.prototype.propertyIsEnumerable,hs=(e,t,r)=>t in e?Rg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,On=(e,t)=>{for(var r in t||(t={}))cl.call(t,r)&&hs(e,r,t[r]);if(Ir)for(var r of Ir(t))dl.call(t,r)&&hs(e,r,t[r]);return e},$n=(e,t)=>{var r={};for(var n in e)cl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ir)for(var n of Ir(e))t.indexOf(n)<0&&dl.call(e,n)&&(r[n]=e[n]);return r};/**
|
|
78
|
-
* @license QR Code generator library (TypeScript)
|
|
79
|
-
* Copyright (c) Project Nayuki.
|
|
80
|
-
* SPDX-License-Identifier: MIT
|
|
81
|
-
*/var bt;(e=>{const t=class pe{constructor(l,c,u,p){if(this.version=l,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],l<pe.MIN_VERSION||l>pe.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=l*4+17;let h=[];for(let b=0;b<this.size;b++)h.push(!1);for(let b=0;b<this.size;b++)this.modules.push(h.slice()),this.isFunction.push(h.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(u);if(this.drawCodewords(g),p==-1){let b=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const y=this.getPenaltyScore();y<b&&(p=v,b=y),this.applyMask(v)}}s(0<=p&&p<=7),this.mask=p,this.applyMask(p),this.drawFormatBits(p),this.isFunction=[]}static encodeText(l,c){const u=e.QrSegment.makeSegments(l);return pe.encodeSegments(u,c)}static encodeBinary(l,c){const u=e.QrSegment.makeBytes(l);return pe.encodeSegments([u],c)}static encodeSegments(l,c,u=1,p=40,h=-1,g=!0){if(!(pe.MIN_VERSION<=u&&u<=p&&p<=pe.MAX_VERSION)||h<-1||h>7)throw new RangeError("Invalid value");let b,v;for(b=u;;b++){const k=pe.getNumDataCodewords(b,c)*8,M=i.getTotalBits(l,b);if(M<=k){v=M;break}if(b>=p)throw new RangeError("Data too long")}for(const k of[pe.Ecc.MEDIUM,pe.Ecc.QUARTILE,pe.Ecc.HIGH])g&&v<=pe.getNumDataCodewords(b,k)*8&&(c=k);let y=[];for(const k of l){r(k.mode.modeBits,4,y),r(k.numChars,k.mode.numCharCountBits(b),y);for(const M of k.getData())y.push(M)}s(y.length==v);const x=pe.getNumDataCodewords(b,c)*8;s(y.length<=x),r(0,Math.min(4,x-y.length),y),r(0,(8-y.length%8)%8,y),s(y.length%8==0);for(let k=236;y.length<x;k^=253)r(k,8,y);let w=[];for(;w.length*8<y.length;)w.push(0);return y.forEach((k,M)=>w[M>>>3]|=k<<7-(M&7)),new pe(b,c,w,h)}getModule(l,c){return 0<=l&&l<this.size&&0<=c&&c<this.size&&this.modules[c][l]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const l=this.getAlignmentPatternPositions(),c=l.length;for(let u=0;u<c;u++)for(let p=0;p<c;p++)u==0&&p==0||u==0&&p==c-1||u==c-1&&p==0||this.drawAlignmentPattern(l[u],l[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(l){const c=this.errorCorrectionLevel.formatBits<<3|l;let u=c;for(let h=0;h<10;h++)u=u<<1^(u>>>9)*1335;const p=(c<<10|u)^21522;s(p>>>15==0);for(let h=0;h<=5;h++)this.setFunctionModule(8,h,n(p,h));this.setFunctionModule(8,7,n(p,6)),this.setFunctionModule(8,8,n(p,7)),this.setFunctionModule(7,8,n(p,8));for(let h=9;h<15;h++)this.setFunctionModule(14-h,8,n(p,h));for(let h=0;h<8;h++)this.setFunctionModule(this.size-1-h,8,n(p,h));for(let h=8;h<15;h++)this.setFunctionModule(8,this.size-15+h,n(p,h));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let l=this.version;for(let u=0;u<12;u++)l=l<<1^(l>>>11)*7973;const c=this.version<<12|l;s(c>>>18==0);for(let u=0;u<18;u++){const p=n(c,u),h=this.size-11+u%3,g=Math.floor(u/3);this.setFunctionModule(h,g,p),this.setFunctionModule(g,h,p)}}drawFinderPattern(l,c){for(let u=-4;u<=4;u++)for(let p=-4;p<=4;p++){const h=Math.max(Math.abs(p),Math.abs(u)),g=l+p,b=c+u;0<=g&&g<this.size&&0<=b&&b<this.size&&this.setFunctionModule(g,b,h!=2&&h!=4)}}drawAlignmentPattern(l,c){for(let u=-2;u<=2;u++)for(let p=-2;p<=2;p++)this.setFunctionModule(l+p,c+u,Math.max(Math.abs(p),Math.abs(u))!=1)}setFunctionModule(l,c,u){this.modules[c][l]=u,this.isFunction[c][l]=!0}addEccAndInterleave(l){const c=this.version,u=this.errorCorrectionLevel;if(l.length!=pe.getNumDataCodewords(c,u))throw new RangeError("Invalid argument");const p=pe.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][c],h=pe.ECC_CODEWORDS_PER_BLOCK[u.ordinal][c],g=Math.floor(pe.getNumRawDataModules(c)/8),b=p-g%p,v=Math.floor(g/p);let y=[];const x=pe.reedSolomonComputeDivisor(h);for(let k=0,M=0;k<p;k++){let S=l.slice(M,M+v-h+(k<b?0:1));M+=S.length;const E=pe.reedSolomonComputeRemainder(S,x);k<b&&S.push(0),y.push(S.concat(E))}let w=[];for(let k=0;k<y[0].length;k++)y.forEach((M,S)=>{(k!=v-h||S>=b)&&w.push(M[k])});return s(w.length==g),w}drawCodewords(l){if(l.length!=Math.floor(pe.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let p=0;p<this.size;p++)for(let h=0;h<2;h++){const g=u-h,b=(u+1&2)==0?this.size-1-p:p;!this.isFunction[b][g]&&c<l.length*8&&(this.modules[b][g]=n(l[c>>>3],7-(c&7)),c++)}}s(c==l.length*8)}applyMask(l){if(l<0||l>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let u=0;u<this.size;u++){let p;switch(l){case 0:p=(u+c)%2==0;break;case 1:p=c%2==0;break;case 2:p=u%3==0;break;case 3:p=(u+c)%3==0;break;case 4:p=(Math.floor(u/3)+Math.floor(c/2))%2==0;break;case 5:p=u*c%2+u*c%3==0;break;case 6:p=(u*c%2+u*c%3)%2==0;break;case 7:p=((u+c)%2+u*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][u]&&p&&(this.modules[c][u]=!this.modules[c][u])}}getPenaltyScore(){let l=0;for(let h=0;h<this.size;h++){let g=!1,b=0,v=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[h][y]==g?(b++,b==5?l+=pe.PENALTY_N1:b>5&&l++):(this.finderPenaltyAddHistory(b,v),g||(l+=this.finderPenaltyCountPatterns(v)*pe.PENALTY_N3),g=this.modules[h][y],b=1);l+=this.finderPenaltyTerminateAndCount(g,b,v)*pe.PENALTY_N3}for(let h=0;h<this.size;h++){let g=!1,b=0,v=[0,0,0,0,0,0,0];for(let y=0;y<this.size;y++)this.modules[y][h]==g?(b++,b==5?l+=pe.PENALTY_N1:b>5&&l++):(this.finderPenaltyAddHistory(b,v),g||(l+=this.finderPenaltyCountPatterns(v)*pe.PENALTY_N3),g=this.modules[y][h],b=1);l+=this.finderPenaltyTerminateAndCount(g,b,v)*pe.PENALTY_N3}for(let h=0;h<this.size-1;h++)for(let g=0;g<this.size-1;g++){const b=this.modules[h][g];b==this.modules[h][g+1]&&b==this.modules[h+1][g]&&b==this.modules[h+1][g+1]&&(l+=pe.PENALTY_N2)}let c=0;for(const h of this.modules)c=h.reduce((g,b)=>g+(b?1:0),c);const u=this.size*this.size,p=Math.ceil(Math.abs(c*20-u*10)/u)-1;return s(0<=p&&p<=9),l+=p*pe.PENALTY_N4,s(0<=l&&l<=2568888),l}getAlignmentPatternPositions(){if(this.version==1)return[];{const l=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(l*2-2))*2;let u=[6];for(let p=this.size-7;u.length<l;p-=c)u.splice(1,0,p);return u}}static getNumRawDataModules(l){if(l<pe.MIN_VERSION||l>pe.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*l+128)*l+64;if(l>=2){const u=Math.floor(l/7)+2;c-=(25*u-10)*u-55,l>=7&&(c-=36)}return s(208<=c&&c<=29648),c}static getNumDataCodewords(l,c){return Math.floor(pe.getNumRawDataModules(l)/8)-pe.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l]*pe.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l]}static reedSolomonComputeDivisor(l){if(l<1||l>255)throw new RangeError("Degree out of range");let c=[];for(let p=0;p<l-1;p++)c.push(0);c.push(1);let u=1;for(let p=0;p<l;p++){for(let h=0;h<c.length;h++)c[h]=pe.reedSolomonMultiply(c[h],u),h+1<c.length&&(c[h]^=c[h+1]);u=pe.reedSolomonMultiply(u,2)}return c}static reedSolomonComputeRemainder(l,c){let u=c.map(p=>0);for(const p of l){const h=p^u.shift();u.push(0),c.forEach((g,b)=>u[b]^=pe.reedSolomonMultiply(g,h))}return u}static reedSolomonMultiply(l,c){if(l>>>8||c>>>8)throw new RangeError("Byte out of range");let u=0;for(let p=7;p>=0;p--)u=u<<1^(u>>>7)*285,u^=(c>>>p&1)*l;return s(u>>>8==0),u}finderPenaltyCountPatterns(l){const c=l[1];s(c<=this.size*3);const u=c>0&&l[2]==c&&l[3]==c*3&&l[4]==c&&l[5]==c;return(u&&l[0]>=c*4&&l[6]>=c?1:0)+(u&&l[6]>=c*4&&l[0]>=c?1:0)}finderPenaltyTerminateAndCount(l,c,u){return l&&(this.finderPenaltyAddHistory(c,u),c=0),c+=this.size,this.finderPenaltyAddHistory(c,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(l,c){c[0]==0&&(l+=this.size),c.pop(),c.unshift(l)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function r(d,l,c){if(l<0||l>31||d>>>l)throw new RangeError("Value out of range");for(let u=l-1;u>=0;u--)c.push(d>>>u&1)}function n(d,l){return(d>>>l&1)!=0}function s(d){if(!d)throw new Error("Assertion error")}const a=class Ce{constructor(l,c,u){if(this.mode=l,this.numChars=c,this.bitData=u,c<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(l){let c=[];for(const u of l)r(u,8,c);return new Ce(Ce.Mode.BYTE,l.length,c)}static makeNumeric(l){if(!Ce.isNumeric(l))throw new RangeError("String contains non-numeric characters");let c=[];for(let u=0;u<l.length;){const p=Math.min(l.length-u,3);r(parseInt(l.substring(u,u+p),10),p*3+1,c),u+=p}return new Ce(Ce.Mode.NUMERIC,l.length,c)}static makeAlphanumeric(l){if(!Ce.isAlphanumeric(l))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],u;for(u=0;u+2<=l.length;u+=2){let p=Ce.ALPHANUMERIC_CHARSET.indexOf(l.charAt(u))*45;p+=Ce.ALPHANUMERIC_CHARSET.indexOf(l.charAt(u+1)),r(p,11,c)}return u<l.length&&r(Ce.ALPHANUMERIC_CHARSET.indexOf(l.charAt(u)),6,c),new Ce(Ce.Mode.ALPHANUMERIC,l.length,c)}static makeSegments(l){return l==""?[]:Ce.isNumeric(l)?[Ce.makeNumeric(l)]:Ce.isAlphanumeric(l)?[Ce.makeAlphanumeric(l)]:[Ce.makeBytes(Ce.toUtf8ByteArray(l))]}static makeEci(l){let c=[];if(l<0)throw new RangeError("ECI assignment value out of range");if(l<128)r(l,8,c);else if(l<16384)r(2,2,c),r(l,14,c);else if(l<1e6)r(6,3,c),r(l,21,c);else throw new RangeError("ECI assignment value out of range");return new Ce(Ce.Mode.ECI,0,c)}static isNumeric(l){return Ce.NUMERIC_REGEX.test(l)}static isAlphanumeric(l){return Ce.ALPHANUMERIC_REGEX.test(l)}getData(){return this.bitData.slice()}static getTotalBits(l,c){let u=0;for(const p of l){const h=p.mode.numCharCountBits(c);if(p.numChars>=1<<h)return 1/0;u+=4+h+p.bitData.length}return u}static toUtf8ByteArray(l){l=encodeURI(l);let c=[];for(let u=0;u<l.length;u++)l.charAt(u)!="%"?c.push(l.charCodeAt(u)):(c.push(parseInt(l.substring(u+1,u+3),16)),u+=2);return c}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=a;e.QrSegment=a})(bt||(bt={}));(e=>{(t=>{const r=class{constructor(s,a){this.ordinal=s,this.formatBits=a}};r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),t.Ecc=r})(e.QrCode||(e.QrCode={}))})(bt||(bt={}));(e=>{(t=>{const r=class{constructor(s,a){this.modeBits=s,this.numBitsCharCount=a}numCharCountBits(s){return this.numBitsCharCount[Math.floor((s+7)/17)]}};r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),t.Mode=r})(e.QrSegment||(e.QrSegment={}))})(bt||(bt={}));var At=bt;/**
|
|
82
|
-
* @license qrcode.react
|
|
83
|
-
* Copyright (c) Paul O'Shannessy
|
|
84
|
-
* SPDX-License-Identifier: ISC
|
|
85
|
-
*/var Ig={L:At.QrCode.Ecc.LOW,M:At.QrCode.Ecc.MEDIUM,Q:At.QrCode.Ecc.QUARTILE,H:At.QrCode.Ecc.HIGH},ul=128,pl="L",fl="#FFFFFF",ml="#000000",hl=!1,gl=1,_g=4,Tg=0,Dg=.1;function bl(e,t=0){const r=[];return e.forEach(function(n,s){let a=null;n.forEach(function(i,d){if(!i&&a!==null){r.push(`M${a+t} ${s+t}h${d-a}v1H${a+t}z`),a=null;return}if(d===n.length-1){if(!i)return;a===null?r.push(`M${d+t},${s+t} h1v1H${d+t}z`):r.push(`M${a+t},${s+t} h${d+1-a}v1H${a+t}z`);return}i&&a===null&&(a=d)})}),r.join("")}function vl(e,t){return e.slice().map((r,n)=>n<t.y||n>=t.y+t.h?r:r.map((s,a)=>a<t.x||a>=t.x+t.w?s:!1))}function Lg(e,t,r,n){if(n==null)return null;const s=e.length+r*2,a=Math.floor(t*Dg),i=s/t,d=(n.width||a)*i,l=(n.height||a)*i,c=n.x==null?e.length/2-d/2:n.x*i,u=n.y==null?e.length/2-l/2:n.y*i,p=n.opacity==null?1:n.opacity;let h=null;if(n.excavate){let b=Math.floor(c),v=Math.floor(u);h={x:b,y:v,w:Math.ceil(d+c-b),h:Math.ceil(l+u-v)}}const g=n.crossOrigin;return{x:c,y:u,h:l,w:d,excavation:h,opacity:p,crossOrigin:g}}function Og(e,t){return t!=null?Math.max(Math.floor(t),0):e?_g:Tg}function yl({value:e,level:t,minVersion:r,includeMargin:n,marginSize:s,imageSettings:a,size:i,boostLevel:d}){let l=Ae.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((b,v)=>(b.push(...At.QrSegment.makeSegments(v)),b),[]);return At.QrCode.encodeSegments(g,Ig[t],r,void 0,void 0,d)},[e,t,r,d]);const{cells:c,margin:u,numCells:p,calculatedImageSettings:h}=Ae.useMemo(()=>{let g=l.getModules();const b=Og(n,s);return{cells:g,margin:b,numCells:g.length+b*2,calculatedImageSettings:Lg(g,i,b,a)}},[l,i,a,n,s]);return{qrcode:l,margin:u,cells:c,numCells:p,calculatedImageSettings:h}}var $g=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Bg=Ae.forwardRef(function(t,r){const n=t,{value:s,size:a=ul,level:i=pl,bgColor:d=fl,fgColor:l=ml,includeMargin:c=hl,minVersion:u=gl,boostLevel:p,marginSize:h,imageSettings:g}=n,b=$n(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:v}=b,y=$n(b,["style"]),x=g?.src,w=Ae.useRef(null),k=Ae.useRef(null),M=Ae.useCallback(se=>{w.current=se,typeof r=="function"?r(se):r&&(r.current=se)},[r]),[S,E]=Ae.useState(!1),{margin:I,cells:A,numCells:F,calculatedImageSettings:Y}=yl({value:s,level:i,minVersion:u,boostLevel:p,includeMargin:c,marginSize:h,imageSettings:g,size:a});Ae.useEffect(()=>{if(w.current!=null){const se=w.current,ae=se.getContext("2d");if(!ae)return;let le=A;const te=k.current,H=Y!=null&&te!==null&&te.complete&&te.naturalHeight!==0&&te.naturalWidth!==0;H&&Y.excavation!=null&&(le=vl(A,Y.excavation));const ve=window.devicePixelRatio||1;se.height=se.width=a*ve;const me=a/F*ve;ae.scale(me,me),ae.fillStyle=d,ae.fillRect(0,0,F,F),ae.fillStyle=l,$g?ae.fill(new Path2D(bl(le,I))):A.forEach(function(T,z){T.forEach(function($,ie){$&&ae.fillRect(ie+I,z+I,1,1)})}),Y&&(ae.globalAlpha=Y.opacity),H&&ae.drawImage(te,Y.x+I,Y.y+I,Y.w,Y.h)}}),Ae.useEffect(()=>{E(!1)},[x]);const ce=On({height:a,width:a},v);let ge=null;return x!=null&&(ge=Ae.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{E(!0)},ref:k,crossOrigin:Y?.crossOrigin})),Ae.createElement(Ae.Fragment,null,Ae.createElement("canvas",On({style:ce,height:a,width:a,ref:M,role:"img"},y)),ge)});Bg.displayName="QRCodeCanvas";var xl=Ae.forwardRef(function(t,r){const n=t,{value:s,size:a=ul,level:i=pl,bgColor:d=fl,fgColor:l=ml,includeMargin:c=hl,minVersion:u=gl,boostLevel:p,title:h,marginSize:g,imageSettings:b}=n,v=$n(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:y,cells:x,numCells:w,calculatedImageSettings:k}=yl({value:s,level:i,minVersion:u,boostLevel:p,includeMargin:c,marginSize:g,imageSettings:b,size:a});let M=x,S=null;b!=null&&k!=null&&(k.excavation!=null&&(M=vl(x,k.excavation)),S=Ae.createElement("image",{href:b.src,height:k.h,width:k.w,x:k.x+y,y:k.y+y,preserveAspectRatio:"none",opacity:k.opacity,crossOrigin:k.crossOrigin}));const E=bl(M,y);return Ae.createElement("svg",On({height:a,width:a,viewBox:`0 0 ${w} ${w}`,ref:r,role:"img"},v),!!h&&Ae.createElement("title",null,h),Ae.createElement("path",{fill:d,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),Ae.createElement("path",{fill:l,d:E,shapeRendering:"crispEdges"}),S)});xl.displayName="QRCodeSVG";var zg=192;function Fg({value:e,size:t=zg,className:r,alt:n}){const s=e.trim();return s.length===0?null:o("div",{className:N("inline-flex rounded-md bg-white p-2",r),children:o(xl,{value:s,size:t,marginSize:1,title:n??"QR code"})})}var Gg=2e3;function Qg({value:e,label:t,className:r,disabled:n}){const[s,a]=C(!1),i=_(()=>{e&&navigator.clipboard.writeText(e).then(()=>{a(!0),setTimeout(()=>a(!1),Gg)})},[e]);return m(at,{size:"sm",variant:"ghost",type:"button",disabled:n||e.length===0,onClick:i,className:N(r),"aria-label":s?"Copied":`Copy ${t??"value"}`,children:[s?o($t,{className:"h-3.5 w-3.5 text-success"}):o(tt,{className:"h-3.5 w-3.5"}),t?o("span",{className:"ml-1",children:s?"Copied":t}):null]})}var jg=Fl(Bl),gs=1e4;function bs(e){return e==="linked"?"success":e==="error"?"danger":"warning"}function vs(e){return e==="linked"?"Linked":e==="unlinked"?"Unlinked":e==="error"?"Error":e}function Ug({field:e}){const[t,r]=C(!1),n=e.secret===!0,s=n&&!t?"•".repeat(Math.min(e.value.length,24)):e.value;return m("div",{className:"flex items-center gap-2 py-1.5",children:[o("span",{className:"text-[11px] text-foreground-subtle w-32 shrink-0",children:e.label}),o("span",{className:"flex-1 min-w-0 truncate font-mono text-xs text-foreground",children:s||"—"}),n&&o(at,{size:"sm",variant:"ghost",type:"button","aria-label":t?"Hide value":"Reveal value",onClick:()=>r(a=>!a),children:t?o(Zn,{className:"h-3.5 w-3.5"}):o(Bt,{className:"h-3.5 w-3.5"})}),o(Qg,{value:e.value,label:e.label})]})}function Hg({setup:e}){const t=e.fields??[];return m("div",{className:"border-b border-border bg-surface-hover/10",children:[m("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border",children:[o(lp,{className:"h-3.5 w-3.5 text-foreground-subtle shrink-0"}),o("span",{className:"text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide",children:"Setup"})]}),m("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-start",children:[e.qr&&o("div",{className:"shrink-0",children:o(Fg,{value:e.qr,alt:"Pairing QR code"})}),m("div",{className:"flex-1 min-w-0",children:[e.note&&o("p",{className:"text-xs text-foreground-muted whitespace-pre-line mb-2",children:e.note}),t.length>0&&o("div",{className:"divide-y divide-border-subtle",children:t.map(r=>o(Ug,{field:r},r.label))})]})]})]})}function OC({addonId:e,onOpenDevice:t}){const r=Tr(),n=uh({nodeId:"hub",addonId:e},{refetchInterval:gs,retry:!1}),s=ph({nodeId:"hub",addonId:e},{refetchInterval:gs,retry:!1}),a=fh({onSuccess:()=>{r.invalidateQueries({queryKey:[["deviceExport"]]})}}),i=K(()=>{const g=Ol.safeParse(n.data);return g.success?g.data:null},[n.data]),d=K(()=>{const g=jg.safeParse(s.data);return g.success?g.data:[]},[s.data]),l=i?.linkState??"unlinked",c=K(()=>d.map(g=>({deviceId:g.deviceId,displayName:g.exposedAs??`Device ${g.deviceId}`,streamPreference:"auto",linkState:l})),[d,l]),u=n.isLoading||s.isLoading,p=i?.exposedDeviceCount??c.length,h=K(()=>[{key:"device",header:"Device",render:g=>m("div",{className:"flex flex-col",children:[o("span",{className:"text-foreground font-medium",children:g.displayName}),m("span",{className:"text-foreground-subtle text-xs font-mono",children:["#",g.deviceId]})]})},{key:"status",header:"Status",render:g=>o(ht,{variant:bs(g.linkState),children:vs(g.linkState)})},{key:"stream",header:"Stream",render:g=>o("span",{className:"text-xs text-foreground-subtle font-mono",children:g.streamPreference==="auto"?"Auto":g.streamPreference})},{key:"actions",header:"",align:"right",render:g=>m("div",{className:"flex items-center justify-end gap-2",children:[t&&m(at,{size:"sm",variant:"ghost",onClick:()=>t(g.deviceId),children:[o(Yn,{className:"h-3.5 w-3.5 mr-1"}),"Open"]}),m(at,{size:"sm",variant:"ghost",disabled:a.isPending,onClick:()=>a.mutate({deviceId:g.deviceId,nodeId:"hub",addonId:e}),children:[o(Np,{className:"h-3.5 w-3.5 mr-1"}),"Unexpose"]})]})}],[t,a,e]);return m("div",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[m("div",{className:"flex items-center justify-between gap-3 px-4 py-2.5 border-b border-border bg-surface-hover/20",children:[m("div",{className:"flex items-center gap-2 min-w-0",children:[o(Do,{className:"h-3.5 w-3.5 text-foreground-subtle shrink-0"}),o("span",{className:"text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide",children:"Exported devices"}),o(ht,{variant:bs(l),children:vs(l)}),m("span",{className:"text-[11px] text-foreground-subtle",children:[p," exposed"]})]}),u&&o(Qe,{className:"h-3.5 w-3.5 animate-spin text-foreground-subtle"})]}),i?.error&&o("div",{className:"px-4 py-3 border-b border-border",children:o(mf,{message:i.error})}),i?.setup&&o(Hg,{setup:i.setup}),c.length===0?o(pf,{icon:Do,title:"No devices exposed",description:`Expose a camera to "${e}" from its device-details page to surface it in the connected ecosystem.`}):o("div",{className:"p-3",children:o(Vp,{columns:h,rows:c,rowKey:g=>g.deviceId})})]})}function $C({samples:e,sampleRate:t=16e3,height:r=96,className:n="",color:s="#3b82f6",bgColor:a="transparent"}){const i=W(null),d=W(null),l=_(()=>{const u=i.current,p=d.current;if(!u||!p||!e||e.length===0)return;const h=p.clientWidth;if(h===0)return;const g=window.devicePixelRatio||1;u.width=h*g,u.height=r*g,u.style.width=`${h}px`,u.style.height=`${r}px`;const b=u.getContext("2d");if(!b)return;b.scale(g,g),a!=="transparent"?(b.fillStyle=a,b.fillRect(0,0,h,r)):b.clearRect(0,0,h,r);const v=e.length/h,y=r/2;b.fillStyle=s,b.globalAlpha=.7;for(let x=0;x<h;x++){const w=Math.floor(x*v),k=Math.min(Math.floor((x+1)*v),e.length);let M=0,S=0;for(let F=w;F<k;F++){const Y=e[F];Y<M&&(M=Y),Y>S&&(S=Y)}const E=y-S*y,I=y-M*y,A=Math.max(1,I-E);b.fillRect(x,E,1,A)}b.globalAlpha=1,b.strokeStyle=s,b.globalAlpha=.2,b.lineWidth=1,b.beginPath(),b.moveTo(0,y),b.lineTo(h,y),b.stroke(),b.globalAlpha=1},[e,r,s,a]);U(()=>{l()},[l]),U(()=>{const u=new ResizeObserver(()=>l()),p=d.current;return p&&u.observe(p),()=>u.disconnect()},[l]);const c=((e&&t?Math.round(e.length/t*1e3):0)/1e3).toFixed(1);return m("div",{ref:d,className:`relative ${n}`,children:[o("canvas",{ref:i,className:"w-full rounded-md"}),e&&e.length>0&&m("div",{className:"absolute bottom-1 right-2 text-[10px] text-foreground-subtle/60 font-mono",children:[c,"s · ",t/1e3,"kHz · ",e.length.toLocaleString()," samples"]})]})}function BC({currentDbfs:e,durationSec:t=30,maxSamples:r=120,height:n=64,className:s="",color:a="#10b981",clipColor:i="#ef4444",clipThreshold:d=-6,minDbfs:l=-96}){const c=W(null),u=W(null),[p,h]=C([]);U(()=>{e!==null&&h(v=>{const y=[...v,{dbfs:e,timestamp:Date.now()}];return y.length>r?y.slice(-r):y})},[e,r]);const g=_(()=>{const v=c.current,y=u.current;if(!v||!y)return;const x=y.clientWidth;if(x===0)return;const w=window.devicePixelRatio||1;v.width=x*w,v.height=n*w,v.style.width=`${x}px`,v.style.height=`${n}px`;const k=v.getContext("2d");if(!k||(k.scale(w,w),k.clearRect(0,0,x,n),p.length===0))return;const M=p[p.length-1].timestamp,S=t*1e3,E=M-S,I=p.filter(ce=>ce.timestamp>=E);if(I.length===0)return;const A=Math.max(1,Math.floor(x/(t*2))),F=Math.abs(l);for(const ce of I){const ge=ce.timestamp-E,se=Math.floor(ge/S*x),ae=(Math.max(l,Math.min(0,ce.dbfs))-l)/F,le=Math.max(1,ae*n);k.fillStyle=ce.dbfs>=d?i:a,k.globalAlpha=.8,k.fillRect(se,n-le,A,le)}k.globalAlpha=1;const Y=n-(d-l)/F*n;k.strokeStyle=i,k.globalAlpha=.25,k.lineWidth=1,k.setLineDash([4,4]),k.beginPath(),k.moveTo(0,Y),k.lineTo(x,Y),k.stroke(),k.setLineDash([]),k.globalAlpha=1},[p,t,n,a,i,d,l]);U(()=>{g()},[g]),U(()=>{const v=new ResizeObserver(()=>g()),y=u.current;return y&&v.observe(y),()=>v.disconnect()},[g]);const b=p.length>0?p[p.length-1].dbfs:null;return m("div",{ref:u,className:`relative ${s}`,children:[o("canvas",{ref:c,className:"w-full rounded-md"}),m("div",{className:"absolute top-1 left-2 text-[9px] text-foreground-subtle/50 font-mono",children:[t,"s"]}),b!==null&&m("div",{className:"absolute bottom-1 right-2 text-[9px] text-foreground-subtle/50 font-mono",children:[b.toFixed(1)," dBFS · ",p.length," samples"]})]})}function Vg(e){return e>=.8?"bg-emerald-500":e>=.5?"bg-amber-500":e>=.3?"bg-orange-500":"bg-zinc-500"}function qg(e){return e>=.8?"text-emerald-400":e>=.5?"text-amber-400":e>=.3?"text-orange-400":"text-zinc-400"}function zC({classifications:e,processing:t=!1,inferenceMs:r,maxItems:n=10,className:s=""}){const a=e.slice(0,n),i=a.length>0?a[0].score:1;return t?o("div",{className:`rounded-xl border border-border bg-surface p-4 text-center ${s}`,children:o("div",{className:"text-sm text-foreground-subtle animate-pulse",children:"Classifying audio..."})}):a.length===0?o("div",{className:`rounded-xl border border-border bg-surface p-4 text-center ${s}`,children:o("div",{className:"text-xs text-foreground-subtle",children:"No classifications yet"})}):m("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${s}`,children:[m("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[o("h3",{className:"text-xs font-medium text-foreground",children:"Audio Classifications"}),m("div",{className:"flex items-center gap-3 text-[10px] text-foreground-subtle",children:[a.length<e.length&&m("span",{children:["showing ",a.length," of ",e.length]}),r!==void 0&&m("span",{className:"font-mono",children:[r.toFixed(1),"ms"]})]})]}),o("div",{className:"divide-y divide-border/50",children:a.map((d,l)=>{const c=i>0?d.score/i*100:0;return m("div",{className:"px-3 py-1.5 flex items-center gap-3 hover:bg-surface-hover/30",children:[o("span",{className:"text-[10px] text-foreground-subtle w-5 text-right font-mono",children:l+1}),o("span",{className:"text-xs font-medium text-foreground min-w-[120px]",children:d.className}),o("div",{className:"flex-1 h-2 rounded-full bg-zinc-800 overflow-hidden",children:o("div",{className:`h-full rounded-full transition-all duration-300 ${Vg(d.score)}`,style:{width:`${c}%`}})}),m("span",{className:`text-xs font-mono font-semibold w-14 text-right ${qg(d.score)}`,children:[(d.score*100).toFixed(1),"%"]})]},`${d.className}-${l}`)})})]})}function FC({data:e,label:t="Response",className:r=""}){const[n,s]=C(!1);if(!e)return null;const a=JSON.stringify(e,null,2);return m("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${r}`,children:[m("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between cursor-pointer select-none hover:bg-surface-hover/30",onClick:()=>s(i=>!i),children:[m("div",{className:"flex items-center gap-2",children:[o("span",{className:"text-[10px] text-foreground-subtle",children:n?"▼":"▶"}),o("h3",{className:"text-xs font-medium text-foreground",children:t})]}),o("span",{className:"text-[10px] text-foreground-subtle font-mono",children:a.length>1e3?`${(a.length/1024).toFixed(1)} KB`:`${a.length} bytes`})]}),n&&o("div",{className:"max-h-80 overflow-y-auto overflow-x-auto",children:o("pre",{className:"p-3 text-[10px] leading-4 font-mono text-foreground-subtle whitespace-pre",children:a})})]})}var Wg={Activity:ot,Eye:Bt,AlertTriangle:zt,PauseCircle:Hu,PowerOff:ip};function GC({phase:e,...t}){const r=Wg[na(e).icon];return o(r,{...t})}function _t(e){const[t,r]=C([]),n=_(a=>{r(i=>{const d=[...i,a];return d.length>e?d.slice(-e):d})},[e]),s=_(()=>{r([])},[]);return K(()=>({entries:t,append:n,reset:s}),[t,n,s])}function ys(e){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var xs={error:{icon:tr,color:"text-red-400"},warn:{icon:zt,color:"text-amber-400"},info:{icon:ep,color:"text-blue-400"},debug:{icon:zu,color:"text-gray-500"}},ws={debug:0,info:1,warn:2,error:3},Kg=["all","debug","info","warn","error"],Yg=500;function Zg(e,t){return t?(ws[e]??0)>=(ws[t]??0):!0}function wl({agentId:e,addonId:t,deviceId:r,integrationId:n,requestId:s,level:a,maxHeight:i="max-h-96",showScope:d=!1,showFilters:l=!0,limit:c=100,liveBuffer:u,onClose:p,className:h}){const[g,b]=C(""),[v,y]=C(""),[x,w]=C(a),k=e,M=t??(g||void 0),S=r??(v?Number(v):void 0),E=n,I=s,A=K(()=>{const P={};return k&&(P.agentId=k),M&&(P.addonId=M),S!==void 0&&Number.isFinite(S)&&(P.deviceId=S),E&&(P.integrationId=E),I&&(P.requestId=I),Object.keys(P).length>0?P:void 0},[k,M,S,E,I]),F=_t(Yg),Y=u??F,ce=Y.entries,[ge,se]=C(0),[ae,le]=C(!1),[te,H]=C(!1),[ve,me]=C(new Set),[T,z]=C(""),$=W(null),ie=`${k??""}:${M??""}:${String(S??"")}:${E??""}:${I??""}`,V=W(ie);U(()=>{V.current!==ie&&(V.current=ie,Y.reset(),se(0),me(new Set))},[ie,Y]);const{data:Z,isLoading:X}=f.logs.query.useQuery({...A?{tags:A}:{},limit:c},{staleTime:3e4});f.logs.subscribe.useSubscription({...A?{tags:A}:{}},{onData:P=>{Y.append(P)}});const j=W(ce.length);U(()=>{const P=$.current;if(!P){j.current=ce.length;return}const D=j.current;if(j.current=ce.length,!(ce.length<=D)){if(ae&&P.scrollTop<=8)P.scrollTo({top:0});else if(!ae&&P.scrollTop>0){const re=P.querySelector("tbody tr"),de=re instanceof HTMLElement?re.offsetHeight:24;P.scrollTop+=de*(ce.length-D)}}},[ce.length,ae]);const oe=K(()=>{const P=(Z??[]).map(ne=>({timestamp:ne.timestamp,level:ne.level,message:ne.message,scope:ne.scope,tags:ne.tags,meta:ne.meta})),D=new Set,re=[];for(const ne of[...ce].reverse()){const Ne=`${ne.timestamp}|${ne.level}|${ne.scope??""}|${ne.message}`;D.has(Ne)||(D.add(Ne),re.push(ne))}for(const ne of P){const Ne=`${ne.timestamp}|${ne.level}|${ne.scope??""}|${ne.message}`;D.has(Ne)||(D.add(Ne),re.push(ne))}const de=(ge>0?re.filter(ne=>new Date(ne.timestamp).getTime()>ge):re).filter(ne=>Zg(ne.level,x)),L=T.trim().toLowerCase();return L?de.filter(ne=>{if(ne.message.toLowerCase().includes(L)||ne.scope&&ne.scope.toLowerCase().includes(L))return!0;if(ne.tags){for(const Ne of Object.values(ne.tags))if(Ne!==void 0&&String(Ne).toLowerCase().includes(L))return!0}if(ne.meta){for(const Ne of Object.values(ne.meta))if(Ne!=null&&ys(Ne).toLowerCase().includes(L))return!0}return!1}):de},[Z,ce,x,ge,T]),J=_(()=>{const P=oe.map(D=>{const re=new Date(D.timestamp).toLocaleTimeString(),de=D.tags?" "+Object.entries(D.tags).filter(([,L])=>L).map(([L,ne])=>`${L}=${ne}`).join(" "):"";return`${re} [${D.level.toUpperCase()}]${D.scope?` [${D.scope}]`:""}${de} ${D.message}`});navigator.clipboard.writeText(P.join(`
|
|
86
|
-
`)).then(()=>{H(!0),setTimeout(()=>H(!1),1500)})},[oe]),Te=f.logs.clear.useMutation(),De=_(()=>{se(Date.now()),Y.reset(),Te.mutate({...A?{tags:A}:{}})},[Y,Te,A]),ee=_(P=>{me(D=>{const re=new Set(D);return re.has(P)?re.delete(P):re.add(P),re})},[]),[he,we]=C(null),ke=_((P,D)=>{const re=new Date(P.timestamp).toISOString(),de=P.tags?" "+Object.entries(P.tags).filter(([,Ne])=>Ne).map(([Ne,Xe])=>`${Ne}=${Xe}`).join(" "):"",L=P.meta&&Object.keys(P.meta).length>0?` meta=${JSON.stringify(P.meta)}`:"",ne=`${re} [${P.level.toUpperCase()}]${P.scope?` [${P.scope}]`:""}${de} ${P.message}${L}`;navigator.clipboard.writeText(ne).then(()=>{we(D),setTimeout(()=>we(Ne=>Ne===D?null:Ne),1200)})},[]),O=_(P=>`${P.timestamp}|${P.level}|${P.scope??""}|${P.message}`,[]);return m("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:P=>P.stopPropagation(),children:[m("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"text-[10px] uppercase tracking-wide text-foreground-subtle font-medium",children:"Logs"}),k&&o(cn,{label:"agent",value:k}),M&&o(cn,{label:"addon",value:M}),S!==void 0&&o(cn,{label:"device",value:`#${S}`}),o("div",{className:"flex rounded border border-border overflow-hidden text-[9px]",children:Kg.map(P=>m("button",{type:"button",onClick:()=>w(P==="all"?void 0:P),className:N("px-1.5 py-0.5 capitalize transition-colors",P==="all"&&!x||x===P?"bg-primary/10 text-primary":"text-foreground-subtle hover:bg-surface-hover",P!=="all"&&"border-l border-border"),children:[P,P!=="all"?"+":""]},P))}),o(dn,{icon:Wn,label:ae?"Auto":"Paused",active:!ae,onClick:()=>{le(P=>!P),!ae&&$.current&&$.current.scrollTo({top:0,behavior:"smooth"})}}),o(dn,{icon:tt,label:te?"Copied!":"Copy",onClick:J,disabled:oe.length===0}),o(dn,{icon:Ye,label:"Clear",onClick:De}),m("div",{className:"relative",children:[o("input",{type:"text",value:T,onChange:P=>z(P.target.value),placeholder:"Search…",className:"w-32 pl-1.5 pr-5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"}),T&&o("button",{type:"button",onClick:()=>z(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(_e,{className:"h-2.5 w-2.5"})})]}),ce.length>0&&m("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",ce.length," live"]})]}),p&&o("button",{type:"button",onClick:p,className:"text-foreground-subtle hover:text-foreground",children:o(_e,{className:"h-3.5 w-3.5"})})]}),l&&(!t||!r)&&m("div",{className:"flex items-center gap-2 px-3 py-1 border-b border-border/50 bg-surface/50 text-[10px]",children:[!t&&m("label",{className:"flex items-center gap-1",children:[o("span",{className:"text-foreground-subtle",children:"Addon:"}),o("input",{type:"text",value:g,onChange:P=>b(P.target.value),placeholder:"all",className:"w-28 px-1.5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"})]}),!r&&m("label",{className:"flex items-center gap-1",children:[o("span",{className:"text-foreground-subtle",children:"Device:"}),o("input",{type:"text",inputMode:"numeric",value:v,onChange:P=>y(P.target.value),placeholder:"all",className:"w-16 px-1.5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"})]})]}),m("div",{ref:$,className:N("flex-1 min-h-0 overflow-auto font-mono text-[10px]",i),children:[X&&m("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Qe,{className:"h-3.5 w-3.5 animate-spin"}),"Loading logs..."]}),!X&&oe.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No logs found"}),oe.length>0&&o("table",{className:"w-full",children:o("tbody",{children:oe.map(P=>{const D=xs[P.level]??xs.info,re=D.icon,de=O(P),L=ve.has(de),ne=P.tags&&Object.keys(P.tags).length>0,Ne=P.meta&&Object.keys(P.meta).length>0,Xe=ne||Ne;return m("tr",{className:N("hover:bg-surface-hover/30 border-b border-border/30",Xe&&"cursor-pointer"),onClick:Xe?()=>ee(de):void 0,children:[o("td",{className:"px-2 py-1 text-foreground-subtle whitespace-nowrap align-top w-[70px]",children:new Date(P.timestamp).toLocaleTimeString()}),o("td",{className:N("px-1 py-1 align-top w-5",D.color),children:o(re,{className:"h-3 w-3"})}),d&&o("td",{className:"px-2 py-1 text-foreground-subtle align-top truncate max-w-[120px]",title:P.scope,children:P.scope?.replace(/^addon:/,"")??""}),o("td",{className:"px-2 py-1 text-foreground break-all",children:m("div",{className:"flex items-start gap-1",children:[Xe&&(L?o(yt,{className:"h-3 w-3 text-foreground-subtle shrink-0 mt-0.5"}):o(dt,{className:"h-3 w-3 text-foreground-subtle shrink-0 mt-0.5"})),m("div",{className:"flex-1 min-w-0",children:[P.message,L&&Xe&&m("div",{className:"mt-1 text-[9px] text-foreground-subtle bg-surface rounded px-2 py-1 space-y-0.5",children:[Ne&&Object.entries(P.meta).filter(([,$e])=>$e!==void 0&&$e!=="").map(([$e,kt])=>m("div",{children:[o("span",{className:"text-amber-400/80 font-medium",children:$e}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:ys(kt)})]},`m-${$e}`)),ne&&Object.entries(P.tags).filter(([,$e])=>$e!==void 0).map(([$e,kt])=>m("div",{children:[o("span",{className:"text-primary/70 font-medium",children:$e}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:kt})]},`t-${$e}`))]})]})]})}),o("td",{className:"px-1 py-1 align-top w-5",children:o(Xg,{copied:he===de,onCopy:()=>ke(P,de)})})]},de)})})})]})]})}function QC({position:e="bottom",className:t,...r}){return o("div",{className:N(e==="bottom"?"absolute bottom-0 left-0 right-0 z-10 border-t border-border bg-surface/95 backdrop-blur-sm":"absolute inset-x-2 bottom-2 z-10 rounded-lg border border-border bg-surface/95 backdrop-blur-sm shadow-xl",t),children:o(wl,{maxHeight:"max-h-48",...r})})}function cn({label:e,value:t}){return m("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function Xg({copied:e,onCopy:t}){return o("button",{type:"button",title:"Copy this row",onClick:r=>{r.stopPropagation(),t()},className:N("rounded p-0.5 transition-colors",e?"text-emerald-400":"text-foreground-subtle/60 hover:text-foreground hover:bg-surface-hover"),children:e?o($t,{className:"h-3 w-3"}):o(tt,{className:"h-3 w-3"})})}function dn({icon:e,label:t,onClick:r,disabled:n,active:s}){return m("button",{type:"button",onClick:r,disabled:n,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",s?"border-amber-500/30 bg-amber-500/10 text-amber-400":"border-border text-foreground-subtle hover:text-foreground",n&&"opacity-40 cursor-not-allowed"),children:[o(e,{className:"h-2.5 w-2.5"}),t]})}function Jg(e,t,r,n){if(n!==void 0&&(e.source.deviceId??(e.source.type==="device"&&typeof e.source.id=="number"?e.source.id:void 0))!==n||r!==void 0&&(e.source.addonId??(e.source.type==="addon"&&typeof e.source.id=="string"?e.source.id:void 0))!==r)return!1;if(t!==void 0){const s=e.source.nodeId;if(!s||s!==t&&!s.startsWith(`${t}/`))return!1}return!0}var eb={[q.AddonStarted]:{icon:Sn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Started"},[q.AddonInstalled]:{icon:kn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Installed"},[q.AddonRestarted]:{icon:Or,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Restarted"},[q.AddonUpdated]:{icon:oi,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Updated"},[q.AddonStopped]:{icon:Lo,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Stopped"},[q.AddonUninstalled]:{icon:Ye,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Uninstalled"},[q.AddonCrashed]:{icon:tr,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Crashed"},[q.AddonError]:{icon:zt,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Error"},[q.DetectionPhaseTransition]:{icon:ot,color:"bg-violet-500/15 text-violet-400 border-violet-500/30",label:"Phase"},[q.DetectionResult]:{icon:up,color:"bg-purple-500/15 text-purple-400 border-purple-500/30",label:"Detection"},[q.DetectionEvent]:{icon:Bt,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Event"},[q.DetectionCameraNative]:{icon:Oo,color:"bg-cyan-500/15 text-cyan-400 border-cyan-500/30",label:"Camera AI"},[q.ProviderMotion]:{icon:$o,color:"bg-orange-500/15 text-orange-400 border-orange-500/30",label:"Motion"},[q.MotionOnMotionChanged]:{icon:$o,color:"bg-orange-500/15 text-orange-400 border-orange-500/30",label:"Motion"},[q.MotionAnalysis]:{icon:ot,color:"bg-orange-500/10 text-orange-300 border-orange-500/20",label:"Motion analysis"},[q.MotionZonesRaw]:{icon:ot,color:"bg-orange-500/10 text-orange-300 border-orange-500/20",label:"Motion zones"},[q.ProviderDetection]:{icon:Oo,color:"bg-cyan-500/15 text-cyan-400 border-cyan-500/30",label:"Provider Det"},[q.PipelineAudioInferenceResult]:{icon:Xa,color:"bg-pink-500/15 text-pink-400 border-pink-500/30",label:"Audio"},[q.AgentOnline]:{icon:Sn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Agent Online"},[q.AgentOffline]:{icon:Lo,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Agent Offline"},[q.DeviceRegistered]:{icon:kn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Registered"},[q.DeviceUnregistered]:{icon:Ye,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Unregistered"},[q.DeviceStateChanged]:{icon:ot,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"State"}};function Bn(e,t){const r=eb[e]??{icon:Sn,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:e.split(".").pop()??e};if(e===q.DeviceStateChanged&&t&&typeof t.capName=="string"){const n=t.capName;return{...r,label:n}}return r}var Ct=Object.freeze([...new Set(Object.values(q))].sort()),tb=Object.freeze([q.PipelineCameraMetricsSnapshot,q.PipelineRunnerLoadSnapshot,q.PipelineEngineMetricsSnapshot,q.PipelineInferenceResult,q.PipelineTrace,q.PipelineProgress,q.StreamBrokerMetricsSnapshot,q.MetricsNodeResourcesSnapshot,q.MetricsNodeProcessesSnapshot,q.ClusterTopologySnapshot,q.MotionAnalysis,q.MotionZonesRaw,q.DetectionResult,q.PipelineAudioInferenceResult,q.PlatformProbePhase,q.BenchmarkProgress,q.ModelDownloadProgress]),rb=new Set(tb),nb=Object.freeze(Ct.filter(e=>!rb.has(e)));function Sr(e,t){if(e===q.DetectionPhaseTransition){const s=t.to,a=t.from,i=typeof t.source=="string"?t.source:null,d=typeof t.cooldownMs=="number"?t.cooldownMs:null,l=i?` (${i}${d?`, ${Math.round(d/1e3)}s cooldown`:""})`:"";return s==="active"?`Motion detected — phase active${l}`:s==="watching"?`Cooldown expired — phase watching${l}`:`Phase: ${String(a)} → ${String(s)}${l}`}if(e===q.DetectionResult){const s=t.frame?.detections??[];if(s.length===0)return null;const a=new Map;for(const i of s){const d=i,l=d.class??d.macroClass,c=typeof l=="string"?l:"";c&&a.set(c,(a.get(c)??0)+1)}return[...a.entries()].map(([i,d])=>d>1?`${i} ×${d}`:i).join(", ")}if(e===q.PipelineAudioInferenceResult){const s=t.frame?.detections??[];return s.length===0?null:s.map(a=>{const i=a,d=i.macroClass??i.class??i.label,l=typeof d=="string"?d:"",c=i.score;return c?`${l} (${Math.round(c*100)}%)`:l}).filter(Boolean).join(", ")}if(e===q.DetectionEvent){const s=t.label??t.class,a=t.score??t.confidence,i=[];return typeof s=="string"&&i.push(s),typeof a=="number"&&i.push(`${Math.round(a*100)}%`),i.length>0?i.join(" — "):null}if(e===q.ProviderMotion)return t.active===!0?"motion start":"motion stop";if(e===q.DeviceStateChanged){const s=t.slice;if(s&&typeof s=="object"){const a=Object.keys(s).filter(i=>i!=="lastFetchedAt"&&i!=="ts");if(a.length>0)return a.slice(0,4).join(", ")+(a.length>4?"…":"")}return null}if(e===q.MotionOnMotionChanged){const s=t.detected,a=typeof t.source=="string"?t.source:null,i=s===!0?"motion start":s===!1?"motion stop":"motion";return a?`${i} (${a})`:i}if(e===q.ProviderDetection||e===q.DetectionCameraNative){const s=t.detections??[];if(!Array.isArray(s)||s.length===0)return(typeof t.class=="string"?t.class:null)??null;const a=new Map;for(const i of s){const d=i,l=d.class??d.macroClass,c=typeof l=="string"?l:"";c&&a.set(c,(a.get(c)??0)+1)}return[...a.entries()].map(([i,d])=>d>1?`${i} ×${d}`:i).join(", ")}const r=t.addonId,n=t.error;return n||(r?`addon: ${r}`:null)}function ob(e){const t=e.category;return t===q.DetectionResult||t===q.PipelineAudioInferenceResult?Sr(t,e.data)!==null:!0}var sb=300;function kl({agentId:e,addonId:t,deviceId:r,defaultCategories:n,categories:s,category:a,maxHeight:i="max-h-96",limit:d=50,showCategoryFilter:l=!0,showFilters:c=!1,liveBuffer:u,onClose:p,className:h}){const g=K(()=>n??s??nb,[n,s]),b=K(()=>[...g].sort().join(","),[g]),[v,y]=C(()=>new Set(g)),x=W(b);U(()=>{x.current!==b&&(x.current=b,y(new Set(g)))},[b,g]);const w=_t(sb),k=u??w,M=k.entries,[S,E]=C(!0),[I,A]=C(new Set),[F,Y]=C(""),[ce,ge]=C(!1),[se,ae]=C(""),[le,te]=C(0),H=W(null),ve=W(null),me=`${e??""}:${t??""}:${String(r??"")}:${a??""}`,T=W(me);U(()=>{T.current!==me&&(T.current=me,k.reset(),A(new Set),te(0))},[me,k]),U(()=>{if(!ce)return;const B=be=>{const ye=ve.current;ye&&be.target instanceof Node&&!ye.contains(be.target)&&ge(!1)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[ce]);const z=K(()=>{const B={};return e&&(B.agentId=e),t&&(B.addonId=t),r!==void 0&&(B.deviceId=r),a&&(B.category=a),B},[e,t,r,a]),$=K(()=>[...v].sort(),[v]),ie=K(()=>{const B={...z,limit:d};return $.length>0&&$.length<Ct.length&&(B.category=$),B},[z,d,K(()=>$.join(","),[$]),$]),{data:V,isLoading:Z}=f.systemEvents.getRecent.useQuery(ie,{staleTime:3e4}),X=W(v);U(()=>{X.current=v},[v]);const j=z;f.systemEvents.subscribe.useSubscription(j,{onData:B=>{const be=B;be?.id&&Jg(be,e,t,r)&&X.current.has(be.category)&&k.append(be)}});const oe=W(M.length);U(()=>{const B=H.current;if(!B){oe.current=M.length;return}const be=oe.current;if(oe.current=M.length,!(M.length<=be)){if(S&&B.scrollTop<=8)B.scrollTo({top:0});else if(!S&&B.scrollTop>0){const ye=B.firstElementChild?.firstElementChild,xe=ye instanceof HTMLElement?ye.offsetHeight:28;B.scrollTop+=xe*(M.length-be)}}},[M.length,S]);const J=K(()=>{const B=new Map;for(const xe of V??[])B.set(xe.id,xe);for(const xe of M)B.set(xe.id,xe);let be=[...B.values()].filter(xe=>v.has(xe.category)).filter(ob);le>0&&(be=be.filter(xe=>new Date(xe.timestamp).getTime()>le));const ye=F.trim().toLowerCase();return ye&&(be=be.filter(xe=>{if(xe.category.toLowerCase().includes(ye)||Bn(xe.category,xe.data).label.toLowerCase().includes(ye))return!0;const ut=Sr(xe.category,xe.data);if(ut&&ut.toLowerCase().includes(ye))return!0;try{if(new Date(xe.timestamp).toLocaleTimeString().toLowerCase().includes(ye))return!0}catch{}try{if(JSON.stringify(xe.data).toLowerCase().includes(ye)||JSON.stringify(xe.source).toLowerCase().includes(ye))return!0}catch{}return!1})),be.sort((xe,ut)=>new Date(ut.timestamp).getTime()-new Date(xe.timestamp).getTime())},[V,M,v,F,le]),Te=_(B=>{A(be=>{const ye=new Set(be);return ye.has(B)?ye.delete(B):ye.add(B),ye})},[]),De=_(B=>{y(be=>{const ye=new Set(be);return ye.has(B)?ye.delete(B):ye.add(B),ye})},[]),ee=_(()=>{y(new Set(g)),Y(""),te(0)},[g]),he=_(()=>{te(Date.now()),k.reset()},[k]),[we,ke]=C(!1),[O,P]=C(null),D=_(B=>{const be=new Date(B.timestamp).toISOString(),ye=Sr(B.category,B.data)??"",xe=ye?` ${ye}`:"";return`${be} [${B.category}]${xe} data=${JSON.stringify(B.data)}`},[]),re=_(()=>{const B=J.map(D);navigator.clipboard.writeText(B.join(`
|
|
87
|
-
`)).then(()=>{ke(!0),setTimeout(()=>ke(!1),1500)})},[J,D]),de=_(B=>{navigator.clipboard.writeText(D(B)).then(()=>{P(B.id),setTimeout(()=>P(be=>be===B.id?null:be),1200)})},[D]),L=_(()=>{y(new Set(Ct))},[]),ne=_(()=>{y(new Set)},[]),Ne=K(()=>{const B=se.trim().toLowerCase();return B?Ct.filter(be=>be.toLowerCase().includes(B)):Ct},[se]),Xe=Ct.length,$e=v.size,kt=$e===Xe,Sl=kt?"All":`${$e}/${Xe}`;return m("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:B=>B.stopPropagation(),children:[m("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"text-[10px] uppercase tracking-wide text-foreground-subtle font-medium",children:"Events"}),e&&o(fr,{label:"agent",value:e}),t&&o(fr,{label:"addon",value:t}),r!==void 0&&o(fr,{label:"device",value:`#${r}`}),a&&o(fr,{label:"category",value:a}),m("button",{type:"button",onClick:()=>{E(B=>!B),!S&&H.current&&H.current.scrollTo({top:0,behavior:"smooth"})},className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",S?"border-border text-foreground-subtle hover:text-foreground":"border-amber-500/30 bg-amber-500/10 text-amber-400"),children:[o(Wn,{className:"h-2.5 w-2.5"}),S?"Auto":"Paused"]}),l&&m("div",{className:"relative",ref:ve,children:[m("button",{type:"button",onClick:()=>ge(B=>!B),className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",kt?"border-border text-foreground-subtle hover:text-foreground":"border-violet-500/30 bg-violet-500/10 text-violet-400"),title:"Pick events to track",children:[o(Ka,{className:"h-2.5 w-2.5"}),"Filter (",Sl,")"]}),ce&&o(ab,{search:se,onSearchChange:ae,categories:Ne,active:v,onToggle:De,onSelectAll:L,onSelectNone:ne,onResetDefaults:ee})]}),m("button",{type:"button",onClick:ee,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Reset filters to defaults",children:[o(ti,{className:"h-2.5 w-2.5"}),"Reset"]}),m("button",{type:"button",onClick:he,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Clear visible entries",children:[o(Ye,{className:"h-2.5 w-2.5"}),"Clear"]}),m("button",{type:"button",onClick:re,disabled:J.length===0,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",we?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-border text-foreground-subtle hover:text-foreground",J.length===0&&"opacity-40 cursor-not-allowed"),title:"Copy all visible events",children:[o(tt,{className:"h-2.5 w-2.5"}),we?"Copied!":"Copy"]}),m("div",{className:"relative",children:[o("input",{type:"text",value:F,onChange:B=>Y(B.target.value),placeholder:"Search…",className:"w-32 pl-1.5 pr-5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"}),F&&o("button",{type:"button",onClick:()=>Y(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(_e,{className:"h-2.5 w-2.5"})})]}),M.length>0&&m("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",M.length," live"]})]}),p&&o("button",{type:"button",onClick:p,className:"text-foreground-subtle hover:text-foreground",children:o(_e,{className:"h-3.5 w-3.5"})})]}),m("div",{ref:H,className:N("flex-1 min-h-0 overflow-auto text-[10px]",i),children:[Z&&m("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Qe,{className:"h-3.5 w-3.5 animate-spin"}),"Loading events..."]}),!Z&&J.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No events found"}),J.length>0&&o("div",{className:"divide-y divide-border/30",children:J.map(B=>{const be=Bn(B.category,B.data),ye=be.icon,xe=Sr(B.category,B.data),ut=I.has(B.id);return m("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>Te(B.id),children:[o("span",{className:"text-foreground-subtle whitespace-nowrap w-[70px] shrink-0 pt-0.5",children:new Date(B.timestamp).toLocaleTimeString()}),o(ib,{copied:O===B.id,onCopy:()=>de(B)}),m("div",{className:"flex-1 min-w-0",children:[m("div",{className:"flex items-center gap-1.5",children:[ut?o(yt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(dt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),m("span",{className:N("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[9px] font-medium",be.color),children:[o(ye,{className:"h-2.5 w-2.5"}),be.label]}),B.source.nodeId&&B.source.nodeId!=="hub"&&o("span",{className:"text-[9px] px-1 py-0.5 rounded bg-foreground-subtle/10 text-foreground-subtle font-mono",children:B.source.nodeId})]}),xe&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5",children:xe}),ut&&m("div",{className:"mt-1 ml-5 text-[9px] bg-surface rounded px-2 py-1.5 space-y-0.5 font-mono overflow-x-auto",children:[m("div",{children:[o("span",{className:"text-primary/70",children:"source"}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:JSON.stringify(B.source)})]}),m("div",{children:[o("span",{className:"text-primary/70",children:"category"}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:B.category})]}),Object.entries(B.data).map(([co,Qr])=>m("div",{children:[o("span",{className:"text-primary/70",children:co}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:typeof Qr=="object"?JSON.stringify(Qr):String(Qr)})]},co))]})]})]},B.id)})})]})]})}function ab({search:e,onSearchChange:t,categories:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:d}){return m("div",{className:"absolute z-20 top-full mt-1 left-0 w-72 max-h-80 rounded-md border border-border bg-surface shadow-lg flex flex-col",onClick:l=>l.stopPropagation(),children:[m("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(Zt,{className:"h-3 w-3 text-foreground-subtle"}),o("input",{type:"text",value:e,onChange:l=>t(l.target.value),placeholder:"Filter categories…",className:"flex-1 bg-transparent text-[10px] focus:outline-none text-foreground placeholder:text-foreground-subtle",autoFocus:!0}),e&&o("button",{type:"button",onClick:()=>t(""),className:"text-foreground-subtle hover:text-foreground",children:o(_e,{className:"h-2.5 w-2.5"})})]}),m("div",{className:"flex items-center gap-1 px-2 py-1 border-b border-border/50 text-[9px]",children:[o("button",{type:"button",onClick:a,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"All"}),o("button",{type:"button",onClick:i,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"None"}),o("button",{type:"button",onClick:d,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"Defaults"})]}),m("div",{className:"overflow-y-auto flex-1",children:[r.length===0&&o("div",{className:"text-[10px] text-foreground-subtle italic px-2 py-3 text-center",children:"No matches"}),r.map(l=>{const c=n.has(l),u=Bn(l),p=u.icon;return m("button",{type:"button",onClick:()=>s(l),className:"w-full flex items-center gap-2 px-2 py-1 text-left hover:bg-surface-hover/40 text-[10px]",children:[o("input",{type:"checkbox",readOnly:!0,checked:c,className:"accent-violet-500"}),m("span",{className:N("inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[9px] font-medium shrink-0",u.color),children:[o(p,{className:"h-2.5 w-2.5"}),u.label]}),o("span",{className:"text-foreground-subtle font-mono truncate",children:l})]},l)})]})]})}function jC({position:e="bottom",className:t,...r}){return o("div",{className:N(e==="bottom"?"absolute bottom-0 left-0 right-0 z-10 border-t border-border bg-surface/95 backdrop-blur-sm":"absolute inset-x-2 bottom-2 z-10 rounded-lg border border-border bg-surface/95 backdrop-blur-sm shadow-xl",t),children:o(kl,{maxHeight:"max-h-48",...r})})}function fr({label:e,value:t}){return m("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function ib({copied:e,onCopy:t}){return o("button",{type:"button",title:"Copy this event",onClick:r=>{r.stopPropagation(),t()},className:N("rounded p-0.5 transition-colors mt-0.5",e?"text-emerald-400":"text-foreground-subtle/60 hover:text-foreground hover:bg-surface-hover"),children:e?o($t,{className:"h-3 w-3"}):o(tt,{className:"h-3 w-3"})})}function UC({deviceId:e,className:t="",onOpenChild:r}){const n=f.useUtils(),s=f.deviceDiscovery.listDiscovered.useQuery({deviceId:e},{refetchInterval:1e4,retry:!1}),a=f.deviceDiscovery.getStatus.useQuery({deviceId:e},{refetchInterval:1e4,retry:!1}),i=f.deviceDiscovery.refreshDiscovery.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e}),n.deviceDiscovery.getStatus.invalidate({deviceId:e})}}),d=f.deviceDiscovery.adoptDevice.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e})}}),l=f.deviceDiscovery.releaseDevice.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e})}}),[c,u]=C(null),{available:p,adopted:h}=K(()=>{const k=s.data??[],M=E=>typeof E.metadata.rtspChannel=="number"?E.metadata.rtspChannel:Number.POSITIVE_INFINITY,S=(E,I)=>{const A=M(E),F=M(I);return A!==F?A-F:E.name.localeCompare(I.name)};return{available:k.filter(E=>!E.alreadyAdopted).sort(S),adopted:k.filter(E=>E.alreadyAdopted).sort(S)}},[s.data]),g=a.data,b=g?.lastError??null,v=g?.lastDiscoveryAt??null;async function y(){await i.mutateAsync({deviceId:e}).catch(()=>{})}async function x(k){u(k.childNativeId);try{await d.mutateAsync({deviceId:e,childNativeId:k.childNativeId})}finally{u(null)}}async function w(k){if(k.adoptedDeviceId!=null){u(k.childNativeId);try{await l.mutateAsync({deviceId:e,childDeviceId:k.adoptedDeviceId})}finally{u(null)}}}return m("div",{className:`rounded-xl border border-border bg-surface ${t}`,children:[m("div",{className:"flex items-start justify-between gap-2 border-b border-border px-3 py-2 sm:px-5 sm:py-3",children:[m("div",{className:"min-w-0",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:"Discovered devices"}),m("p",{className:"text-[11px] text-foreground-subtle",children:["Channels behind this hub. Click ",o("span",{className:"font-medium",children:"Add"})," to promote a channel to a managed device, or ",o("span",{className:"font-medium",children:"Remove"})," to detach."]})]}),m("button",{type:"button",onClick:y,disabled:i.isPending,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-2 py-1.5 sm:px-3 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 shrink-0",children:[i.isPending?o(Qe,{className:"h-3.5 w-3.5 animate-spin"}):o(Or,{className:"h-3.5 w-3.5"}),o("span",{className:"hidden sm:inline",children:"Refresh"})]})]}),b?m("div",{className:"flex items-start gap-2 border-b border-border bg-destructive/10 px-5 py-2 text-[11px] text-destructive",children:[o(zt,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),m("span",{children:["Last refresh failed: ",b]})]}):null,s.isLoading?o("div",{className:"flex items-center justify-center py-8 text-foreground-subtle",children:o(Qe,{className:"h-5 w-5 animate-spin"})}):p.length===0&&h.length===0?o("div",{className:"px-5 py-8 text-center text-xs text-foreground-subtle",children:"No channels reported by the hub yet. Click Refresh to enumerate."}):m(Se,{children:[p.length>0?o(ks,{title:"Available to add",count:p.length,tone:"primary",children:p.map(k=>o(Ns,{child:k,busy:c===k.childNativeId,onAdopt:x,onRelease:w,onOpenChild:r},k.childNativeId))}):null,h.length>0?o(ks,{title:"Already adopted",count:h.length,tone:"muted",children:h.map(k=>o(Ns,{child:k,busy:c===k.childNativeId,onAdopt:x,onRelease:w,onOpenChild:r},k.childNativeId))}):null]}),v!=null?m("div",{className:"border-t border-border px-5 py-2 text-[10px] text-foreground-subtle",children:["Last refreshed ",new Date(v).toLocaleString()]}):null]})}function ks({title:e,count:t,tone:r,children:n}){return m("div",{className:"border-t border-border",children:[m("div",{className:`flex items-center justify-between border-b px-3 sm:px-5 py-1.5 text-[10px] uppercase tracking-wider ${r==="primary"?"bg-primary/5 text-primary border-primary/30":"bg-surface text-foreground-subtle border-border"}`,children:[o("span",{className:"font-semibold",children:e}),o("span",{className:"font-mono",children:t})]}),o("div",{className:"divide-y divide-border",children:n})]})}function Ns({child:e,busy:t,onAdopt:r,onRelease:n,onOpenChild:s}){return m("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 sm:px-5 sm:py-3 sm:flex-nowrap sm:gap-3",children:[m("div",{className:"min-w-0 flex-1",children:[m("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[o(lb,{status:e.status}),o("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),e.metadata.isDoorbell?o("span",{className:"rounded bg-surface-hover px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-foreground-subtle",children:"Doorbell"}):null,e.metadata.isBattery?o("span",{className:"rounded bg-surface-hover px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-foreground-subtle",children:"Battery"}):null,e.metadata.isMultifocal?o("span",{className:"rounded bg-surface-hover px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-foreground-subtle",children:"Multifocal"}):null]}),m("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-foreground-subtle",children:[typeof e.metadata.rtspChannel=="number"?m("span",{children:["ch ",o("span",{className:"font-mono",children:e.metadata.rtspChannel})]}):null,e.metadata.model?o("span",{className:"truncate max-w-[160px]",children:e.metadata.model}):null,e.metadata.uid?m("span",{className:"font-mono truncate max-w-[140px]",children:[e.metadata.uid.slice(0,12),"…"]}):null]})]}),e.alreadyAdopted?m("div",{className:"flex items-center gap-2",children:[s&&e.adoptedDeviceId!==null?m("button",{type:"button",onClick:()=>s(e.adoptedDeviceId),className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",title:"Open device detail",children:[o(Yn,{className:"h-3.5 w-3.5"}),"Open"]}):null,m("button",{type:"button",onClick:()=>{n(e)},disabled:t,className:"inline-flex items-center gap-1.5 rounded-lg border border-destructive/30 px-3 py-1.5 text-xs text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",children:[t?o(Qe,{className:"h-3.5 w-3.5 animate-spin"}):o(Ye,{className:"h-3.5 w-3.5"}),"Remove"]})]}):m("button",{type:"button",onClick:()=>{r(e)},disabled:t,className:"inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50",children:[t?o(Qe,{className:"h-3.5 w-3.5 animate-spin"}):o(rr,{className:"h-3.5 w-3.5"}),"Add"]})]})}function lb({status:e}){switch(e){case"online":return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-emerald-500/40 bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-500",children:[o(si,{className:"h-2.5 w-2.5"})," online"]});case"sleeping":return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-500",children:[o(Xn,{className:"h-2.5 w-2.5"})," sleeping"]});case"offline":return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-destructive/40 bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[o(Sp,{className:"h-2.5 w-2.5"})," offline"]});default:return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-border bg-surface px-2 py-0.5 text-[10px] font-medium text-foreground-subtle",children:[o(Ha,{className:"h-2.5 w-2.5"})," unknown"]})}}function cb(e,t){if(!e||typeof e!="object")return!1;const r=e;if(r.category!==q.DeviceStateChanged)return!1;const n=r.data;return!(!n||typeof n!="object"||n.deviceId!==t||typeof n.capName!="string"||!n.slice||typeof n.slice!="object")}function un(e){if(!e||typeof e!="object")return null;const t=e,r=typeof t.id=="string"?t.id:null,n=typeof t.timestamp=="string"?t.timestamp:null,s=t.data;return!r||!n||!s||typeof s!="object"||typeof s.capName!="string"||!s.slice||typeof s.slice!="object"?null:{id:r,timestamp:n,capName:s.capName,slice:s.slice}}var db=300,ub=Object.freeze([...new Set(Ll.filter(e=>e.scope==="device").map(e=>e.name))].sort());function pb({deviceId:e,defaultCaps:t,maxHeight:r="max-h-96",limit:n=50,liveBuffer:s,onClose:a,className:i}){const[d,l]=C(K(()=>new Set(t??[]),[t])),[c,u]=C(""),[p,h]=C(!0),[g,b]=C(new Set),[v,y]=C(0),[x,w]=C(!1),[k,M]=C(""),S=W(null),E=_t(db),I=s??E,A=I.entries,F=W(null),Y=W(e);U(()=>{Y.current!==e&&(Y.current=e,I.reset(),b(new Set),y(0))},[e,I]);const ce=K(()=>({deviceId:e,category:q.DeviceStateChanged,limit:n}),[e,n]),{data:ge,isLoading:se}=f.systemEvents.getRecent.useQuery(ce,{staleTime:3e4}),ae=W(d);U(()=>{ae.current=d},[d]),f.systemEvents.subscribe.useSubscription({deviceId:e,category:q.DeviceStateChanged},{onData:O=>{if(!cb(O,e))return;const P=un(O);if(!P)return;const D=ae.current;D.size>0&&!D.has(P.capName)||I.append(P)}});const le=W(A.length);U(()=>{const O=F.current;if(!O){le.current=A.length;return}const P=le.current;if(le.current=A.length,!(A.length<=P)){if(p&&O.scrollTop<=8)O.scrollTo({top:0});else if(!p&&O.scrollTop>0){const D=O.firstElementChild?.firstElementChild,re=D instanceof HTMLElement?D.offsetHeight:28,de=A.length-P;O.scrollTop+=re*de}}},[A.length,p]);const te=K(()=>{const O=new Map;for(const re of ge??[]){const de=un(re);de&&O.set(de.id,de)}for(const re of A)O.set(re.id,re);let P=[...O.values()];v>0&&(P=P.filter(re=>new Date(re.timestamp).getTime()>v)),d.size>0&&(P=P.filter(re=>d.has(re.capName)));const D=c.trim().toLowerCase();return D&&(P=P.filter(re=>{if(re.capName.toLowerCase().includes(D))return!0;try{if(new Date(re.timestamp).toLocaleTimeString().toLowerCase().includes(D))return!0}catch{}try{if(Object.entries(re.slice).map(([de,L])=>`${de}=${pn(L)}`).join(" · ").toLowerCase().includes(D))return!0}catch{}try{if(JSON.stringify(re.slice).toLowerCase().includes(D))return!0}catch{}return!1})),P.sort((re,de)=>new Date(de.timestamp).getTime()-new Date(re.timestamp).getTime())},[ge,A,d,c,v]),H=K(()=>{const O=new Set(ub);for(const P of ge??[]){const D=un(P);D&&O.add(D.capName)}for(const P of A)O.add(P.capName);return[...O].sort()},[ge,A]),ve=_(O=>{b(P=>{const D=new Set(P);return D.has(O)?D.delete(O):D.add(O),D})},[]),me=_(O=>{l(P=>{const D=new Set(P);return D.has(O)?D.delete(O):D.add(O),D})},[]),T=_(()=>{l(new Set(t??[])),u("")},[t]),z=_(()=>{y(Date.now()),I.reset()},[I]),[$,ie]=C(!1),[V,Z]=C(null),X=_(O=>`${new Date(O.timestamp).toISOString()} [${O.capName}] slice=${JSON.stringify(O.slice)}`,[]),j=_(()=>{const O=te.map(X);navigator.clipboard.writeText(O.join(`
|
|
88
|
-
`)).then(()=>{ie(!0),setTimeout(()=>ie(!1),1500)})},[te,X]),oe=_(O=>{navigator.clipboard.writeText(X(O)).then(()=>{Z(O.id),setTimeout(()=>Z(P=>P===O.id?null:P),1200)})},[X]),J=_(()=>{l(new Set(H))},[H]),Te=_(()=>{l(new Set)},[]),De=K(()=>{const O=k.trim().toLowerCase();return O?H.filter(P=>P.toLowerCase().includes(O)):H},[k,H]),ee=H.length,he=d.size,we=he===0||he===ee,ke=we?"All":`${he}/${ee}`;return U(()=>{if(!x)return;const O=P=>{const D=S.current;D&&!D.contains(P.target)&&w(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[x]),m("div",{className:N("h-full min-h-0 flex flex-col",i),onClick:O=>O.stopPropagation(),children:[m("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"text-[10px] uppercase tracking-wide text-foreground-subtle font-medium",children:"State"}),o(fb,{label:"device",value:`#${e}`}),m("button",{type:"button",onClick:()=>{h(O=>!O),!p&&F.current&&F.current.scrollTo({top:0,behavior:"smooth"})},className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",p?"border-border text-foreground-subtle hover:text-foreground":"border-amber-500/30 bg-amber-500/10 text-amber-400"),children:[o(Wn,{className:"h-2.5 w-2.5"}),p?"Auto":"Paused"]}),m("div",{className:"relative",ref:S,children:[m("button",{type:"button",onClick:()=>w(O=>!O),className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",we?"border-border text-foreground-subtle hover:text-foreground":"border-violet-500/30 bg-violet-500/10 text-violet-400"),title:"Pick caps to track",children:[o(Ka,{className:"h-2.5 w-2.5"}),"Filter (",ke,")"]}),x&&o(mb,{search:k,onSearchChange:M,caps:De,active:d,onToggle:me,onSelectAll:J,onSelectNone:Te,onResetDefaults:T})]}),m("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Reset filters",children:[o(ti,{className:"h-2.5 w-2.5"}),"Reset"]}),m("button",{type:"button",onClick:z,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Clear visible entries",children:[o(Ye,{className:"h-2.5 w-2.5"}),"Clear"]}),m("button",{type:"button",onClick:j,disabled:te.length===0,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",$?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-border text-foreground-subtle hover:text-foreground",te.length===0&&"opacity-40 cursor-not-allowed"),title:"Copy all visible state changes",children:[o(tt,{className:"h-2.5 w-2.5"}),$?"Copied!":"Copy"]}),m("div",{className:"relative",children:[o("input",{type:"text",value:c,onChange:O=>u(O.target.value),placeholder:"Search…",className:"w-32 pl-1.5 pr-5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"}),c&&o("button",{type:"button",onClick:()=>u(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(_e,{className:"h-2.5 w-2.5"})})]}),A.length>0&&m("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",A.length," live"]})]}),a&&o("button",{type:"button",onClick:a,className:"text-foreground-subtle hover:text-foreground",children:o(_e,{className:"h-3.5 w-3.5"})})]}),m("div",{ref:F,className:N("flex-1 min-h-0 overflow-auto text-[10px]",r),children:[se&&m("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Qe,{className:"h-3.5 w-3.5 animate-spin"}),"Loading state changes..."]}),!se&&te.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No state changes"}),te.length>0&&o("div",{className:"divide-y divide-border/30",children:te.map(O=>{const P=g.has(O.id),D=Object.entries(O.slice),re=D.slice(0,3).map(([de,L])=>`${de}=${pn(L)}`).join(" · ");return m("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>ve(O.id),children:[o("span",{className:"text-foreground-subtle whitespace-nowrap w-[70px] shrink-0 pt-0.5",children:new Date(O.timestamp).toLocaleTimeString()}),o(hb,{copied:V===O.id,onCopy:()=>oe(O)}),m("div",{className:"flex-1 min-w-0",children:[m("div",{className:"flex items-center gap-1.5",children:[P?o(yt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(dt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),o("span",{className:"inline-flex items-center gap-1 rounded-full border border-violet-500/30 bg-violet-500/15 text-violet-400 px-2 py-0.5 text-[9px] font-medium",children:O.capName}),D.length>3&&m("span",{className:"text-[9px] text-foreground-subtle",children:["+",D.length-3," more"]})]}),re&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5 truncate",children:re}),P&&o("div",{className:"mt-1 ml-5 text-[9px] bg-surface rounded px-2 py-1.5 space-y-0.5 font-mono overflow-x-auto",children:D.length===0?o("div",{className:"text-foreground-subtle italic",children:"empty slice"}):D.map(([de,L])=>m("div",{children:[o("span",{className:"text-primary/70",children:de}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:pn(L)})]},de))})]})]},O.id)})})]})]})}function pn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function fb({label:e,value:t}){return m("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function mb({search:e,onSearchChange:t,caps:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:d}){return m("div",{className:"absolute z-20 top-full mt-1 left-0 w-72 max-h-80 rounded-md border border-border bg-surface shadow-lg flex flex-col",onClick:l=>l.stopPropagation(),children:[m("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(Zt,{className:"h-3 w-3 text-foreground-subtle"}),o("input",{type:"text",value:e,onChange:l=>t(l.target.value),placeholder:"Filter caps…",className:"flex-1 bg-transparent text-[10px] focus:outline-none text-foreground placeholder:text-foreground-subtle",autoFocus:!0}),e&&o("button",{type:"button",onClick:()=>t(""),className:"text-foreground-subtle hover:text-foreground",children:o(_e,{className:"h-2.5 w-2.5"})})]}),m("div",{className:"flex items-center gap-1 px-2 py-1 border-b border-border/50 text-[9px]",children:[o("button",{type:"button",onClick:a,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"All"}),o("button",{type:"button",onClick:i,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"None"}),o("button",{type:"button",onClick:d,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"Defaults"})]}),m("div",{className:"overflow-y-auto flex-1",children:[r.length===0&&o("div",{className:"text-[10px] text-foreground-subtle italic px-2 py-3 text-center",children:"No matches"}),r.map(l=>m("button",{type:"button",onClick:()=>s(l),className:"w-full flex items-center gap-2 px-2 py-1 text-left hover:bg-surface-hover/40 text-[10px]",children:[o("input",{type:"checkbox",readOnly:!0,checked:n.has(l),className:"accent-violet-500"}),o("span",{className:"inline-flex items-center gap-1 rounded-full border border-violet-500/30 bg-violet-500/15 text-violet-400 px-1.5 py-0.5 text-[9px] font-medium shrink-0",children:l})]},l))]})]})}function hb({copied:e,onCopy:t}){return o("button",{type:"button",title:"Copy this state change",onClick:r=>{r.stopPropagation(),t()},className:N("rounded p-0.5 transition-colors mt-0.5",e?"text-emerald-400":"text-foreground-subtle/60 hover:text-foreground hover:bg-surface-hover"),children:e?o($t,{className:"h-3 w-3"}):o(tt,{className:"h-3 w-3"})})}var fn=500,gb=[{id:"logs",label:"Logs",icon:pp},{id:"events",label:"Events",icon:Lr},{id:"state",label:"State",icon:Yu}];function HC({deviceId:e,defaultEventCategories:t,defaultStateCaps:r,initialTab:n="events",className:s,maxHeight:a="max-h-96"}){const[i,d]=C(n),l=_t(fn),c=_t(fn),u=_t(fn),p=l.reset,h=c.reset,g=u.reset;return U(()=>{p(),h(),g()},[e,p,h,g]),m("div",{className:N("flex flex-col h-full min-h-0",s),children:[o("div",{className:"flex items-center gap-1 mb-2 shrink-0",children:gb.map(({id:b,label:v,icon:y})=>m("button",{type:"button",onClick:()=>d(b),className:N("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[11px] font-medium transition-colors",i===b?"bg-primary/15 text-primary border border-primary/30":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover border border-transparent"),children:[o(y,{className:"h-3.5 w-3.5"}),v]},b))}),m("div",{className:"flex-1 min-h-0 overflow-hidden",children:[i==="logs"&&o(wl,{deviceId:e,maxHeight:a,showFilters:!1,liveBuffer:l}),i==="events"&&o(kl,{deviceId:e,defaultCategories:t,maxHeight:a,showCategoryFilter:!0,liveBuffer:c}),i==="state"&&o(pb,{deviceId:e,defaultCaps:r,maxHeight:a,liveBuffer:u})]})]})}function VC({label:e,icon:t,title:r="Confirm action",description:n,confirmLabel:s,triggerVariant:a="outline",confirmVariant:i="danger",size:d="sm",disabled:l,className:c,action:u,onSuccess:p}){const[h,g]=C(!1),[b,v]=C(!1),[y,x]=C(null),w=async()=>{x(null),v(!0);try{const k=await u();p?.(k),g(!1)}catch(k){x(k instanceof Error?k.message:String(k))}finally{v(!1)}};return m(Se,{children:[m(at,{type:"button",variant:a,size:d,disabled:l,onClick:()=>{x(null),g(!0)},className:c,children:[t&&o(t,{className:"h-3.5 w-3.5"}),e]}),o(Op,{open:h,onOpenChange:k=>!b&&g(k),children:m(pi,{children:[m(Bp,{children:[m(Fp,{className:"flex items-center gap-2",children:[o(zt,{className:"h-4 w-4 text-amber-400"}),r]}),typeof n=="string"?o(Gp,{children:n}):n]}),y&&o("div",{className:N("mt-2 px-3 py-2 rounded border border-danger/40 bg-danger/10","text-xs text-danger"),children:y}),m(zp,{children:[o(at,{type:"button",variant:"ghost",size:d,disabled:b,onClick:()=>g(!1),children:"Cancel"}),m(at,{type:"button",variant:i,size:d,disabled:b,onClick:()=>{w()},children:[b&&o(Qe,{className:"h-3.5 w-3.5 animate-spin"}),s??e]})]})]})})]})}function mr({direction:e,icon:t,disabled:r,className:n,variant:s,onMove:a,onStart:i,onStop:d}){const[l,c]=C(null),[u,p]=C(!1),h=_(x=>{if(r)return;x.currentTarget.setPointerCapture(x.pointerId),c(Date.now()),p(!1);const w=setTimeout(()=>{p(!0),i(e)},250);x.currentTarget.dataset.timer=String(w)},[e,r,i]),g=_(x=>{const w=Number(x.currentTarget.dataset.timer);w&&clearTimeout(w),x.currentTarget.dataset.timer="",u?d():l!==null&&a(e),c(null),p(!1)},[u,e,a,d,l]),b=_(x=>{const w=Number(x.currentTarget.dataset.timer);w&&clearTimeout(w),x.currentTarget.dataset.timer="",u&&d(),c(null),p(!1)},[u,d]),v=s==="panel"?"h-9 w-9":"h-7 w-7",y=s==="panel"?"h-4 w-4":"h-3.5 w-3.5";return o("button",{type:"button",disabled:r,onPointerDown:h,onPointerUp:g,onPointerCancel:b,className:N("flex items-center justify-center rounded transition-colors disabled:opacity-40",s==="panel"?"text-foreground hover:bg-surface-hover active:bg-surface-hover/80":"text-white hover:bg-white/15 active:bg-white/25",v,n),title:e,children:o(t,{className:y})})}function qC({controls:e,mode:t="overlay",showPresets:r,showZoom:n=!0,showHome:s=!0,className:a}){const{move:i,startContinuous:d,stopContinuous:l,zoom:c,goHome:u,goToPreset:p,presets:h,busy:g,error:b}=e,[v,y]=C(!1),x=(r??h.length>0)&&h.length>0,w=t==="panel",k=w?"flex flex-col items-stretch gap-2 w-full h-full p-3":"pointer-events-auto absolute top-3 right-3 z-10 flex flex-col items-end gap-2",M=N(w?"flex items-center gap-3 rounded-lg p-2":"flex items-center gap-2 rounded-lg border border-white/30 bg-zinc-900/90 backdrop-blur-md p-2 shadow-lg shadow-black/40",g&&"ring-1 ring-primary/40"),S=w?"h-9 w-9":"h-7 w-7",E=w?"h-4 w-4":"h-3.5 w-3.5",I=w?"text-foreground hover:bg-surface-hover":"text-white hover:bg-white/15",A=w?"h-12 w-px bg-border mx-1":"h-12 w-px bg-white/15 mx-1";return m("div",{className:N(k,a),children:[b&&m("div",{className:"rounded bg-danger/90 px-2 py-1 text-[10px] font-medium text-white shadow-lg max-w-[200px] self-center",children:["PTZ: ",b]}),m("div",{className:N(M,w&&"justify-center"),children:[m("div",{className:"grid grid-cols-3 gap-0.5",children:[o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(mr,{direction:"up",icon:Du,variant:t,onMove:i,onStart:d,onStop:l}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(mr,{direction:"left",icon:_u,variant:t,onMove:i,onStart:d,onStop:l}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(mr,{direction:"right",icon:Tu,variant:t,onMove:i,onStart:d,onStop:l}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(mr,{direction:"down",icon:Iu,variant:t,onMove:i,onStart:d,onStop:l}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"})]}),(n||s)&&o("div",{className:A}),m("div",{className:"flex flex-col gap-0.5",children:[n&&m(Se,{children:[o("button",{type:"button",onClick:()=>c("in"),disabled:g,title:"Zoom in",className:N("flex items-center justify-center rounded disabled:opacity-40",S,I),children:o(Cp,{className:E})}),o("button",{type:"button",onClick:()=>c("out"),disabled:g,title:"Zoom out",className:N("flex items-center justify-center rounded disabled:opacity-40",S,I),children:o(Mp,{className:E})})]}),s&&o("button",{type:"button",onClick:()=>u(),disabled:g,title:"Go home",className:N("flex items-center justify-center rounded disabled:opacity-40",S,I),children:o(Ya,{className:E})})]}),x&&m("div",{className:"relative",children:[m("button",{type:"button",onClick:()=>y(F=>!F),disabled:g,className:N("flex items-center gap-1 rounded px-2 text-[10px] disabled:opacity-40",w?"h-9 text-foreground hover:bg-surface-hover":"h-7 text-white hover:bg-white/15"),title:"Presets",children:["Presets",o(yt,{className:N("h-3 w-3 transition-transform",v&&"rotate-180")})]}),v&&o("div",{className:N("absolute right-0 min-w-[140px] rounded-lg shadow-xl py-1 z-20",w?"bottom-full mb-1 bg-surface border border-border":"top-full mt-1 border border-white/30 bg-zinc-900/95 backdrop-blur-md"),children:h.map(F=>o("button",{type:"button",onClick:()=>{p(F.id),y(!1)},disabled:g,className:N("block w-full px-3 py-1.5 text-left text-[10px] disabled:opacity-40",w?"text-foreground hover:bg-surface-hover":"text-white hover:bg-white/15"),children:F.name||F.id},F.id))})]})]})]})}function bb(e,t){const r=document.createElement("a");r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function WC({trpc:e,deviceId:t,deviceName:r,size:n="sm",className:s}){const[a,i]=C(!1),[d,l]=C(!1),[c,u]=C(null),p=r.replace(/[^a-zA-Z0-9_.-]+/g,"_"),h=_(async S=>{i(!0),u(null),l(!1);try{const E=await e.snapshot.getSnapshot.query({deviceId:t,force:!0});if(!E)throw new Error("No snapshot available");const I=`data:${E.contentType};base64,${E.base64}`;if(S==="copy")try{await navigator.clipboard.writeText(I)}catch{throw new Error("Clipboard unavailable")}else{const A=E.contentType.includes("png")?"png":"jpg";bb(`${p}-${new Date().toISOString().replace(/[:.]/g,"-")}.${A}`,I)}l(!0),setTimeout(()=>l(!1),1500)}catch(E){u(E instanceof Error?E.message:String(E))}finally{i(!1)}},[e,t,p]),g=n==="md"?"h-9 px-3 text-sm gap-2":"h-7 px-2.5 text-[11px] gap-1.5",[b,v]=C(null),[y,x]=C(!1),w=()=>{x(!1),v(setTimeout(()=>{x(!0),h("copy")},600))},k=()=>{b&&(clearTimeout(b),v(null)),y||h("download")},M=()=>{b&&(clearTimeout(b),v(null))};return m("button",{type:"button",title:"Click to download · long-press to copy",disabled:a,onPointerDown:w,onPointerUp:k,onPointerLeave:M,onPointerCancel:M,className:N("inline-flex items-center justify-center rounded-lg font-medium border border-border","text-foreground-subtle hover:text-foreground hover:bg-surface-hover","disabled:opacity-50 transition-colors",g,c&&"border-danger/40 text-danger",s),children:[a?o(Qe,{className:"h-3.5 w-3.5 animate-spin"}):d?o($t,{className:"h-3.5 w-3.5 text-success"}):o(Kn,{className:"h-3.5 w-3.5"}),"Snapshot"]})}function vb(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function KC({history:e,limit:t=5,latestIsFresh:r,className:n}){if(e.length===0)return null;const s=r?Bu:Lr,a=e.slice(0,t);return m("div",{className:N("rounded-lg border border-border bg-surface px-3 py-2",n),children:[m("div",{className:"flex items-center gap-2 mb-2",children:[o(s,{className:N("h-4 w-4 text-amber-400",r&&"animate-pulse")}),o("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle",children:"Recent presses"}),o("span",{className:"ml-auto rounded-full bg-foreground-subtle/10 px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle border border-border",children:e.length})]}),o("ul",{className:"space-y-1",children:a.map(i=>m("li",{className:"flex items-center justify-between text-[11px]",title:new Date(i.timestamp).toLocaleString(),children:[o("span",{className:"text-foreground",children:vb(i.timestamp)}),o("span",{className:"text-foreground-subtle font-mono text-[10px]",children:new Date(i.timestamp).toLocaleTimeString()})]},`${i.deviceId}-${i.timestamp}`))})]})}function YC({items:e,header:t,triggerClassName:r,title:n="More actions"}){const[s,a]=C(!1),i=e.filter(d=>!d.hidden);return i.length===0?null:m(Qp,{open:s,onOpenChange:a,children:[o(jp,{title:n,className:N("inline-flex items-center justify-center rounded-lg p-2","text-foreground-subtle hover:text-foreground hover:bg-surface-hover","border border-transparent transition-colors",r),children:o(Wa,{className:"h-4 w-4"})}),m(Up,{className:"left-auto right-0 mt-1 min-w-[200px] p-1",children:[t&&o("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wider text-foreground-subtle",children:t}),o("ul",{className:"space-y-0.5",children:i.map((d,l)=>m("li",{children:[d.separatorBefore&&l>0&&o("div",{className:"my-1 h-px bg-border"}),m("button",{type:"button",disabled:d.disabled,onClick:()=>{d.disabled||(d.onClick(),a(!1))},className:N("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-[12px]","transition-colors disabled:opacity-40 disabled:cursor-not-allowed",d.danger?"text-foreground hover:bg-danger/10 hover:text-danger":"text-foreground hover:bg-surface-hover"),children:[d.icon&&o(d.icon,{className:N("h-3.5 w-3.5 shrink-0 mt-0.5",d.danger&&"text-danger/80")}),m("span",{className:"flex-1 min-w-0",children:[o("span",{className:"block leading-tight",children:d.label}),d.description&&o("span",{className:"block mt-0.5 text-[10px] text-foreground-subtle leading-tight",children:d.description})]})]})]},d.id))})]})]})}var yb=[{value:"view",label:"View",icon:Bt,hint:"Read-only — queries + subscriptions"},{value:"create",label:"Create",icon:sp,hint:"Mutations that create or update"},{value:"delete",label:"Delete",icon:Ye,hint:"Destructive ops (delete/revoke/reset/…)"}],xb=["device","system"];function wb(){return{type:"capability",target:"",access:["view"]}}function kb(e){if(e==null)return[];const t=new Set;for(const r of e)if(r.type==="device")for(const n of r.targets)t.add(n);return[...t]}function Nb(e,t,r,n){let s;switch(e){case"addon":s=r;break;case"capability":s=n;break;case"category":s=xb.map(i=>({value:i,label:i}));break}if(t==null)return s;const a=new Set(t.filter(i=>i.type!=="device"&&i.type===e).map(i=>i.target));return s.filter(i=>a.has(i.value))}function Sb(e,t){if(t==null)return["view","create","delete"];const r=t.filter(s=>s.type!==e.type?!1:s.type==="device"&&e.type==="device"?s.targets.some(a=>e.targets.includes(a)):s.type!=="device"&&e.type!=="device"?s.target===e.target:!1);if(r.length===0)return[];const n=new Set;for(const s of r)for(const a of s.access)n.add(a);return[...n]}function ZC({value:e,onChange:t,clampToParent:r,emptyHint:n}){const{data:s}=lh(),{data:a}=mh({}),i=K(()=>(s??[]).map(b=>({value:b.manifest.id,label:b.manifest.id})).sort((b,v)=>b.label.localeCompare(v.label)),[s]),d=K(()=>[...Dl].sort().map(b=>({value:b,label:b})),[]),l=K(()=>(a??[]).map(b=>({value:String(b.id),label:`${b.name} (#${b.id} · ${b.addonId})`})).sort((b,v)=>b.label.localeCompare(v.label)),[a]),c=K(()=>r==null?null:kb(r),[r]),u=(b,v)=>{const y=[...v];switch(b){case"category":return{type:"category",target:"device",access:y};case"capability":return{type:"capability",target:"",access:y};case"addon":return{type:"addon",target:"",access:y};case"device":return{type:"device",targets:[],access:y}}},p=(b,v)=>{t(e.map((y,x)=>{if(x!==b)return y;if(v.type!==void 0&&v.type!==y.type)return u(v.type,v.access??y.access);const w=[...v.access??y.access];return y.type==="device"?{type:"device",targets:[...v.targets??y.targets],access:w}:y.type==="category"?{type:"category",target:v.target??y.target,access:w}:y.type==="capability"?{type:"capability",target:v.target??y.target,access:w}:{type:"addon",target:v.target??y.target,access:w}}))},h=b=>{t(e.filter((v,y)=>y!==b))},g=()=>{t([...e,wb()])};return m("div",{className:"space-y-2",children:[e.length===0&&n&&o("div",{className:"text-[10px] text-foreground-subtle italic px-2 py-2",children:n}),e.map((b,v)=>{const y=Sb(b,r);return m("div",{className:"flex flex-wrap items-start gap-1.5 rounded border border-border bg-surface px-2 py-1.5",children:[m("select",{value:b.type,onChange:x=>p(v,{type:x.target.value}),className:"rounded border border-border bg-background px-2 py-1 text-[11px] focus:outline-none focus:ring-1 focus:ring-primary",children:[o("option",{value:"category",children:"category"}),o("option",{value:"capability",children:"capability"}),o("option",{value:"addon",children:"addon"}),o("option",{value:"device",children:"device"})]}),b.type==="device"?o(Cb,{value:b.targets,choices:l,clampToParent:c,onChange:x=>p(v,{targets:x})}):m("select",{value:b.target,onChange:x=>p(v,{target:x.target.value}),className:"flex-1 min-w-[160px] rounded border border-border bg-background px-2 py-1 text-[11px] font-mono focus:outline-none focus:ring-1 focus:ring-primary",children:[m("option",{value:"",children:["— pick ",b.type," —"]}),Nb(b.type,r,i,d).map(x=>o("option",{value:x.value,children:x.label},x.value))]}),o("div",{className:"flex items-center gap-1",children:yb.map(({value:x,label:w,icon:k,hint:M})=>{const S=b.access.includes(x),E=r!=null&&!y.includes(x)&&!S;return m("label",{title:E?`${M} — not granted by your scope`:M,className:`inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] cursor-pointer transition-colors ${S?"bg-primary/15 text-primary font-medium":"text-foreground-subtle hover:bg-foreground-subtle/10"} ${E?"opacity-40 cursor-not-allowed":""}`,children:[o("input",{type:"checkbox",checked:S,disabled:E,onChange:I=>{const A=new Set(b.access);I.target.checked?A.add(x):A.delete(x),p(v,{access:[...A]})},className:"sr-only"}),o(k,{className:"h-3 w-3"}),w]},x)})}),o("button",{type:"button",onClick:()=>h(v),className:"rounded p-1 text-foreground-subtle hover:bg-danger/10 hover:text-danger transition-colors",title:"Remove scope",children:o(_e,{className:"h-3 w-3"})})]},v)}),m("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-foreground-subtle hover:text-foreground hover:bg-foreground-subtle/10 transition-colors",children:[o(rr,{className:"h-3 w-3"}),"Add scope"]})]})}function Cb({value:e,choices:t,clampToParent:r,onChange:n}){const[s,a]=C(""),i=K(()=>{const u=r==null?t:t.filter(h=>r.includes(h.value)),p=new Set(e);return u.filter(h=>!p.has(h.value))},[t,r,e]),d=u=>t.find(p=>p.value===u)?.label??`#${u}`,l=u=>{u&&(n([...e,u]),a(""))},c=u=>{n(e.filter(p=>p!==u))};return m("div",{className:"flex-1 min-w-[160px] flex flex-wrap items-center gap-1",children:[e.length===0&&o("span",{className:"text-[10px] text-foreground-subtle italic px-1",children:"no devices selected"}),e.map(u=>m("span",{className:"inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-mono text-primary",children:[d(u),o("button",{type:"button",onClick:()=>c(u),className:"hover:text-danger transition-colors",title:"Remove device",children:o(_e,{className:"h-2.5 w-2.5"})})]},u)),i.length>0&&m("select",{value:s,onChange:u=>l(u.target.value),className:"rounded border border-border bg-background px-1.5 py-0.5 text-[10px] focus:outline-none focus:ring-1 focus:ring-primary",children:[o("option",{value:"",children:"+ add device…"}),i.map(u=>o("option",{value:u.value,children:u.label},u.value))]})]})}function XC(e){for(const t of e){if(t.type==="device"){if(t.targets.length===0)return"Scope device: pick at least one device"}else if(t.target.trim().length===0)return`Scope ${t.type}: pick a target`;if(t.access.length===0){const r=t.type==="device"?`[${t.targets.join(",")}]`:t.target;return`Scope ${t.type}:${r}: pick at least one access`}}return null}var Nl=ct("camstack:zone-editing",null);function JC({children:e}){const[t,r]=C(!1),[n,s]=C(null),[a,i]=C(null),[d,l]=C(null),c=_(w=>{r(w),w||(s(null),i(null),l(null))},[]),u=_(w=>{s(w)},[]),p=_(w=>{i(w)},[]),h=_(w=>{r(!0),i(null),s(w),l(null)},[]),g=_(()=>{r(!1),s(null),i(null),l(null)},[]),b=_(w=>{i(w.id),l(w)},[]),v=_(w=>{l(k=>k===null?k:{...k,...w})},[]),y=_(()=>{l(null)},[]),x=K(()=>({editing:t,drawingKind:n,selectedZoneId:a,editingDraft:d,setEditing:c,setDrawingKind:u,setSelectedZoneId:p,startDrawing:h,exitEditing:g,enterDraft:b,updateDraft:v,discardDraft:y}),[t,n,a,d,c,u,p,h,g,b,v,y]);return o(Nl.Provider,{value:x,children:e})}function e5(){return Ie(Nl)}var Ss=500,Mb=800;function hr(e,t,r){try{const n=e.live;if(!n)return null;const s=n.onEvent;return!s||typeof s.subscribe!="function"?null:s.subscribe({category:t},{onData:r})}catch{return null}}function gr(e,t){return e?.id===t}function t5(e,t){const[r,n]=C(null),[s,a]=C(null),[i,d]=C(null),[l,c]=C("watching"),u=W(void 0),p=W(void 0),h=W(void 0);return U(()=>{if(t===null)return;const g=hr(e,"detection.motion-analysis",b=>{const v=b;if(!gr(v?.source,t))return;const y=v.data;!y?.regions||y.regions.length===0||(n({zones:y.regions.map(x=>({...x.bbox,intensity:x.intensity})),frameWidth:y.frameWidth,frameHeight:y.frameHeight}),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>n(null),Ss))});return()=>{g?.unsubscribe(),u.current&&clearTimeout(u.current)}},[e,t]),U(()=>{if(t===null)return;const g=hr(e,"detection.motion-zones-raw",b=>{const v=b;if(!gr(v?.source,t))return;const y=v.data;y?.zones&&(a({boxes:y.zones.map(x=>({bbox:x.bbox,changeScore:x.changeScore})),frameWidth:y.frameSize?.width??0,frameHeight:y.frameSize?.height??0,motionScore:y.zones.length>0?y.zones.reduce((x,w)=>x+w.changeScore,0)/y.zones.length:0}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>a(null),Ss))});return()=>{g?.unsubscribe(),p.current&&clearTimeout(p.current)}},[e,t]),U(()=>{if(t===null)return;const g=hr(e,"detection.result",b=>{const v=b;if(!gr(v?.source,t))return;const y=v.data?.frame;y?.detections?.length&&(d({detections:y.detections,frameWidth:y.width,frameHeight:y.height}),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>d(null),Mb))});return()=>{g?.unsubscribe(),h.current&&clearTimeout(h.current)}},[e,t]),U(()=>{if(t===null)return;const g=hr(e,"detection.phase-transition",b=>{const v=b;gr(v?.source,t)&&v.data?.to&&c(v.data.to)});return()=>{g?.unsubscribe()}},[e,t]),{motion:r,motionRaw:s,detection:i,phase:l}}function r5(e,t,r=5e3){const[n,s]=C([]);U(()=>{if(t===null)return;let c=!1;const u=()=>{e.webrtcSession.listStreams.query({deviceId:t}).then(h=>{c||s(h)}).catch(()=>{})};u();const p=setInterval(u,r);return()=>{c=!0,clearInterval(p)}},[e,t,r]);const[a,i]=C(null);U(()=>{if(t===null)return;let c=!1;return e.pipelineOrchestrator&&e.pipelineOrchestrator.getCameraMetrics.query({deviceId:t}).then(u=>{c||!u||i({phase:u.phase,detectionFps:u.actualFps,avgInferenceMs:u.avgInferenceTimeMs,droppedFrames:u.droppedFrames})}).catch(()=>{}),()=>{c=!0}},[e,t]),Br("pipeline.camera-metrics-snapshot",c=>{if(t===null)return;const u=c.data;u.deviceId!==t||!u.metrics||i({phase:u.metrics.phase,detectionFps:u.metrics.actualFps,avgInferenceMs:u.metrics.avgInferenceTimeMs,droppedFrames:u.metrics.droppedFrames})});const{streams:d,hasWebrtc:l}=K(()=>t===null||n.length===0?{streams:[],hasWebrtc:!1}:{streams:n.map(c=>({id:c.id,label:c.label,target:c.target,status:c.status,inputFps:c.inputFps,decodeFps:c.decodeFps,bitrateKbps:c.bitrateKbps})),hasWebrtc:!0},[t,n]);return{streams:d,hasWebrtc:l,pipelineMetrics:a,createSession:_(async(c,u)=>{if(t===null)throw new Error("No device selected");const p=await e.webrtcSession.createSession.mutate({deviceId:t,target:c,hints:u});return{sessionId:p.sessionId,sdpOffer:p.sdpOffer}},[e,t]),sendAnswer:_(async(c,u)=>{if(t===null)throw new Error("No device selected");await e.webrtcSession.handleAnswer.mutate({deviceId:t,sessionId:c,sdpAnswer:u})},[e,t]),closeSession:_(async c=>{t!==null&&await e.webrtcSession.closeSession.mutate({deviceId:t,sessionId:c}).catch(()=>{})},[e,t])}}var Cs={up:{pan:0,tilt:1},down:{pan:0,tilt:-1},left:{pan:-1,tilt:0},right:{pan:1,tilt:0},"up-left":{pan:-1,tilt:1},"up-right":{pan:1,tilt:1},"down-left":{pan:-1,tilt:-1},"down-right":{pan:1,tilt:-1}};function n5(e,t,r){const n=r?.defaultSpeed??.5,s=r?.pulseMs??250,a=r?.enabled??!0,i=zr(e,a?t:null)?.ptz,[d,l]=C([]),[c,u]=C(!1),[p,h]=C(null),g=_(async()=>{if(!(!a||!i))try{l(await i.getPresets({}))}catch(v){const y=v instanceof Error?v.message:String(v);if(y.includes("provider not available")||y.includes("no 'ptz' binding"))return;h(y)}},[i,a]);U(()=>{g()},[g]);const b=_(async v=>{if(!(!a||!i)){h(null),u(!0);try{return await v()}catch(y){h(y instanceof Error?y.message:String(y));return}finally{u(!1)}}},[a,i]);return{move:_(async(v,y)=>{if(!i)return;const x=Cs[v],w=y??n;await b(async()=>{await i.move({pan:x.pan,tilt:x.tilt,speed:w}),await new Promise(k=>setTimeout(k,s)),await i.stop({})})},[i,n,s,b]),startContinuous:_(async(v,y)=>{if(!i)return;const x=Cs[v],w=y??n;await b(()=>i.continuousMove({pan:x.pan,tilt:x.tilt,speed:w}))},[i,n,b]),stopContinuous:_(async()=>{i&&await b(()=>i.stop({}))},[i,b]),zoom:_(async(v,y)=>{if(!i)return;const x=v==="in"?1:-1,w=y??n;await b(async()=>{await i.move({zoom:x,speed:w}),await new Promise(k=>setTimeout(k,s)),await i.stop({})})},[i,n,s,b]),goHome:_(async()=>{i&&await b(()=>i.goHome({}))},[i,b]),goToPreset:_(async v=>{i&&await b(()=>i.goToPreset({presetId:v}))},[i,b]),presets:d,refreshPresets:g,busy:c,error:p}}function o5(e){const t=e?.deviceId??null,r=e?.historyLimit??20,n=Ai("doorbell.onPressed",t!==null?i=>i.deviceId===t:void 0),[s,a]=C([]);return U(()=>{n&&a(i=>{if(i.length>0&&i[0].deviceId===n.deviceId&&i[0].timestamp===n.timestamp)return i;const d=[n,...i];return d.length>r?d.slice(0,r):d})},[n,r]),{latest:n??null,history:s}}function s5(e){const t=Ft(),r=K(()=>e?JSON.stringify(e):"",[e]),[n,s]=C(()=>t.listDevices(e));return U(()=>{const a=()=>{s(t.listDevices(e))};a();let i=null,d=null;try{i=t.onDeviceAdded(a),d=t.onDeviceRemoved(a)}catch{}const l=t.subscribeConnectionEvents(c=>{c==="connected"&&a()});return()=>{i?.(),d?.(),l()}},[t,e,r]),n}function a5(e){const t=Ft(),[r,n]=C(()=>e===null?null:t.getDevice(e));return U(()=>{if(e===null){n(null);return}const s=()=>{n(t.getDevice(e))};s();let a=null,i=null;try{a=t.onDeviceAdded(s),i=t.onDeviceRemoved(s)}catch{}const d=t.subscribeConnectionEvents(l=>{l==="connected"&&s()});return()=>{a?.(),i?.(),d()}},[t,e]),r}function i5(e,t,r){const n=Ft();return Rs({queryKey:e,queryFn:()=>t(n)(),...r})}function l5(e,t){const r=Ft();return El({mutationFn:n=>e(r)(n),...t})}function c5(e,t){const r=Ft(),n=Tr(),[s,a]=C(r.connectionVersion);U(()=>r.subscribeConnectionEvents((l,c)=>{l==="connected"&&a(c)}),[r]);const i=t.join("|"),d=JSON.stringify(e);U(()=>{const l=[],c=()=>{const u=JSON.parse(d),p=u.length===1&&Array.isArray(u[0])?u:[u];n.invalidateQueries({queryKey:p})};c();for(const u of i.split("|"))if(u)try{l.push(r.subscribeEvent(u,c))}catch{}return()=>{for(const u of l)u()}},[r,n,i,d,s])}export{EC as AddonGlobalSettingsForm,_v as AgentStepEditor,qv as AppShell,zC as AudioClassificationList,BC as AudioLevelWaveform,$C as AudioWaveform,nv as BTN_COMPACT,sv as BTN_COMPACT_DANGER,ov as BTN_COMPACT_PRIMARY,av as BTN_COMPACT_WARNING,ht as Badge,qf as BatteryBadge,yi as BottomSheet,Av as Breadcrumb,at as Button,cv as CHIP_ACTIVE,lv as CHIP_BASE,dv as CHIP_INACTIVE,cr as CLASS_COLORS,xg as CameraStreamPlayer,ii as Card,Dp as Checkbox,Hv as CodeBlock,Ip as CollapsibleCard,cg as ConfigFormBuilder,or as ConfigFormField,to as ConfigSchemaField,VC as ConfirmActionButton,Qv as ConfirmDialogProvider,Qg as CopyButton,ly as CustomFieldRenderersProvider,ey as DEFAULT_COLOR,Vp as DataTable,ty as DetectionCanvas,pg as DetectionOverlay,ry as DetectionResultTree,sh as DevShell,HC as DeviceActivityPanel,Wv as DeviceCard,cy as DeviceContextProvider,OC as DeviceExportPanel,Kv as DeviceGrid,An as DeviceItem,Zv as DeviceList,Op as Dialog,pi as DialogContent,Gp as DialogDescription,zp as DialogFooter,Bp as DialogHeader,Fp as DialogTitle,mv as DialogTrigger,UC as DiscoveryPanel,KC as DoorbellRecentPanel,hv as Dropdown,bv as DropdownContent,vv as DropdownItem,gv as DropdownTrigger,pf as EmptyState,mf as ErrorBox,kl as EventStream,Vv as FilterBar,jC as FloatingEventStream,QC as FloatingLogStream,Ev as FloatingPanel,Fv as FormField,Vb as GRID_GAP,Kb as GRID_PAIRED,Wb as GRID_QUICK_STATS,iv as INPUT_COMPACT,ai as IconButton,oy as ImageSelector,sy as InferenceConfigSelector,Cn as Input,YC as KebabMenu,Uv as KeyValueList,qb as LIST_ROW,li as Label,wl as LogStream,eh as LoginForm,Hp as MobileDrawer,$h as NodeMultiSelectField,Ov as NodePicker,Oh as NodeSelectField,wo as PHASE_CONFIG,qC as PTZOverlay,Gv as PageHeader,GC as PhaseIcon,Jv as PipelineBuilder,Xv as PipelineRuntimeSelector,Zr as PipelineStep,Tv as PipelineTreeMatrix,AC as PlayerOverlaysProvider,Qp as Popover,Up as PopoverContent,jp as PopoverTrigger,Bv as ProviderBadge,Fg as QrCode,FC as ResponseLog,Ub as SECTION_BODY,Qb as SECTION_CARD,jb as SECTION_HEADER,Yb as SPLIT_PANEL_OUTER,Zb as SPLIT_PANEL_SIDE,Hb as STACK_GAP,ZC as ScopePicker,Si as ScrollArea,Pr as Select,uf as SemanticBadge,ci as Separator,qo as Sidebar,Vo as SidebarItem,Tp as Skeleton,Pv as SlideOverPanel,WC as SnapshotButton,jv as StatCard,pb as StateValuesStream,$v as StatusBadge,ny as StepTimings,Rv as StepTreeMaster,TC as StreamBrokerSelector,_C as StreamPanel,Lp as Switch,af as SystemProvider,Jb as TEXT_FIELD_LABEL,ev as TEXT_HINT,rv as TEXT_METRIC,Xb as TEXT_SECTION_LABEL,tv as TEXT_VALUE,Nv as Tabs,Mv as TabsContent,Sv as TabsList,Cv as TabsTrigger,mo as ThemeProvider,yv as Tooltip,wv as TooltipContent,xv as TooltipTrigger,zv as VersionBadge,CC as WidgetRegistryProvider,Sh as WidgetSlot,JC as ZoneEditingProvider,Iv as buildStepTreeFromSchema,N as cn,ct as createSharedContext,Fb as createTheme,Gl as darkColors,uo as defaultTheme,Yv as deriveDeviceKind,Cu as ensureMfHostInit,Ge as getClassColor,na as getPhaseVisual,ag as isFieldVisible,Ql as lightColors,uv as mirror,iy as mountAddonPage,pv as providerIcons,fv as statusIcons,Gb as themeToCss,f as trpc,uy as useAccessoriesGetStatus,py as useAddonPagesListPages,Uy as useAddonSettingsGetDeviceSettings,Qy as useAddonSettingsGetGlobalSettings,Hy as useAddonSettingsUpdateDeviceSettings,jy as useAddonSettingsUpdateGlobalSettings,ch as useAddonWidgetsListWidgets,zy as useAddonsApplyAutoUpdateToAll,Fy as useAddonsCustom,Cy as useAddonsForceRefresh,$y as useAddonsGetAddonAutoUpdate,Ly as useAddonsGetAutoUpdateSettings,Ey as useAddonsGetLastRestart,fy as useAddonsGetLogs,_y as useAddonsGetVersions,gy as useAddonsInstallFromWorkspace,hy as useAddonsInstallPackage,by as useAddonsIsWorkspaceAvailable,lh as useAddonsList,Py as useAddonsListCapabilityProviders,Ay as useAddonsListFrameworkPackages,my as useAddonsListPackages,ky as useAddonsListUpdates,vy as useAddonsListWorkspacePackages,Gy as useAddonsOnAddonLogs,xy as useAddonsReloadPackages,Ty as useAddonsRestartAddon,My as useAddonsRestartServer,Dy as useAddonsRetryLoad,Sy as useAddonsRollbackPackage,wy as useAddonsSearchAvailable,By as useAddonsSetAddonAutoUpdate,Oy as useAddonsSetAutoUpdateSettings,Ry as useAddonsSetCapabilityProviderEnabled,yy as useAddonsUninstallPackage,Iy as useAddonsUpdateFrameworkPackage,Ny as useAddonsUpdatePackage,Xy as useAlertsDismiss,Vy as useAlertsEmit,Ky as useAlertsGetUnreadCount,Wy as useAlertsList,Zy as useAlertsMarkAllRead,Yy as useAlertsMarkRead,qy as useAlertsUpdate,MC as useAllWidgets,r0 as useAudioAnalysisApplyDeviceSettingsPatch,t0 as useAudioAnalysisGetDeviceLiveContribution,e0 as useAudioAnalysisGetDeviceSettingsContribution,Jy as useAudioAnalysisResolveDeviceSettings,n0 as useAudioAnalyzerAnalyseChunk,o0 as useAudioAnalyzerClassify,a0 as useAudioAnalyzerDispose,s0 as useAudioAnalyzerIsReady,i0 as useAudioAnalyzerReprobeAudioEngine,c0 as useAudioCodecCanHandle,p0 as useAudioCodecCloseSession,d0 as useAudioCodecCreateDecodeSession,u0 as useAudioCodecCreateEncodeSession,b0 as useAudioCodecFlushEncode,v0 as useAudioCodecListActiveSessions,l0 as useAudioCodecListSupportedCodecs,g0 as useAudioCodecPullEncoded,m0 as useAudioCodecPullPcm,f0 as useAudioCodecPushEncodedFrame,h0 as useAudioCodecPushPcm,y0 as useAudioMetricsGetCurrentSnapshot,x0 as useAudioMetricsGetHistory,E0 as useBackupDelete,C0 as useBackupGetEntries,N0 as useBackupList,A0 as useBackupListArchives,w0 as useBackupListDestinations,S0 as useBackupListLocations,R0 as useBackupPreviewSchedule,M0 as useBackupRestore,k0 as useBackupTrigger,P0 as useBackupUpsertDestinationPolicy,I0 as useBatteryGetStatus,T0 as useBrightnessGetStatus,_0 as useBrightnessSetBrightness,D0 as useCameraCredentialsGetCredentials,L0 as useCameraCredentialsGetStatus,$0 as useCameraStreamsGetBrokerStreams,O0 as useCameraStreamsGetCameraStreams,dh as useCameraStreamsGetRtspEntries,no as useClusterNodes,oo as useConfirm,ah as useCustomFieldRenderer,Zf as useDebouncedString,F0 as useDecoderCreateSession,G0 as useDecoderDestroySession,z0 as useDecoderGetInfo,V0 as useDecoderGetStats,q0 as useDecoderListActiveSessions,j0 as useDecoderOpenStream,U0 as useDecoderPullFrames,Q0 as useDecoderPushPacket,W0 as useDecoderReprobeHwaccel,B0 as useDecoderSupportsCodec,H0 as useDecoderUpdateConfig,Z0 as useDetectionPipelineApplyDeviceSettingsPatch,Y0 as useDetectionPipelineGetDeviceLiveContribution,K0 as useDetectionPipelineGetDeviceSettingsContribution,ay as useDevShell,a5 as useDevice,jf as useDeviceBattery,nr as useDeviceCapability,t5 as useDeviceDetections,ex as useDeviceDiscoveryAdoptDevice,rx as useDeviceDiscoveryGetStatus,X0 as useDeviceDiscoveryListDiscovered,J0 as useDeviceDiscoveryRefreshDiscovery,tx as useDeviceDiscoveryReleaseDevice,ix as useDeviceExportApplyDeviceSettingsPatch,ox as useDeviceExportExposeDevice,ax as useDeviceExportGetDeviceLiveContribution,sx as useDeviceExportGetDeviceSettingsContribution,uh as useDeviceExportGetStatus,ph as useDeviceExportListExposedDevices,nx as useDeviceExportListSupportedDeviceKinds,fh as useDeviceExportUnexposeDevice,ih as useDeviceId,yx as useDeviceManagerAddLocation,Vx as useDeviceManagerAdoptDevice,lx as useDeviceManagerAllocateDeviceId,Wx as useDeviceManagerCreateDevice,Rx as useDeviceManagerDisable,Hx as useDeviceManagerDiscoverDevices,Px as useDeviceManagerEnable,Ox as useDeviceManagerGetAllBindings,Lx as useDeviceManagerGetBindings,Sx as useDeviceManagerGetChildren,Mx as useDeviceManagerGetConfigSchema,qx as useDeviceManagerGetCreationSchema,Nx as useDeviceManagerGetDevice,Qx as useDeviceManagerGetDeviceAggregate,Gx as useDeviceManagerGetDeviceLiveInfoAggregate,Fx as useDeviceManagerGetDeviceSettingsAggregate,Zx as useDeviceManagerGetDeviceStatusAggregate,Ex as useDeviceManagerGetSettingsSchema,_x as useDeviceManagerGetStreamProfileMap,Cx as useDeviceManagerGetStreamSources,mh as useDeviceManagerListAll,zx as useDeviceManagerListBindableCapsForDeviceType,vx as useDeviceManagerListLocations,kx as useDeviceManagerListPersistedByAddon,Bx as useDeviceManagerListWrappersForCap,px as useDeviceManagerLoadConfig,mx as useDeviceManagerLoadMeta,fx as useDeviceManagerLoadRuntimeState,ux as useDeviceManagerPersistConfig,Dx as useDeviceManagerProbeStreams,cx as useDeviceManagerRegisterDevice,Ix as useDeviceManagerRemove,dx as useDeviceManagerRemoveDevice,xx as useDeviceManagerRemoveLocation,wx as useDeviceManagerSetDisabled,gx as useDeviceManagerSetLocation,bx as useDeviceManagerSetMetadata,hx as useDeviceManagerSetName,Tx as useDeviceManagerSetStreamProfileMap,$x as useDeviceManagerSetWrapperActive,Kx as useDeviceManagerTestCreationField,Yx as useDeviceManagerTestField,Ax as useDeviceManagerUpdateConfig,jx as useDeviceManagerUpdateDeviceField,Ux as useDeviceManagerUpdateDeviceFieldsBatch,Jx as useDeviceOpsGetConfigEntries,r1 as useDeviceOpsGetSettingsSchema,Xx as useDeviceOpsGetStreamSources,t1 as useDeviceOpsRemoveDevice,e1 as useDeviceOpsSetConfig,c1 as useDeviceProviderAdoptDiscoveredDevice,p1 as useDeviceProviderCreateDevice,l1 as useDeviceProviderDiscoverDevices,u1 as useDeviceProviderGetChildCreationSchema,a1 as useDeviceProviderGetDevices,s1 as useDeviceProviderGetStatus,n1 as useDeviceProviderStart,o1 as useDeviceProviderStop,i1 as useDeviceProviderSupportsDiscovery,d1 as useDeviceProviderSupportsManualCreation,f1 as useDeviceProviderTestCreationField,zr as useDeviceProxy,dy as useDeviceSnapshot,Uf as useDeviceSnapshotImage,bf as useDeviceState,g1 as useDeviceStateGetAllSnapshots,h1 as useDeviceStateGetCapSlice,m1 as useDeviceStateGetSnapshot,b1 as useDeviceStateSetCapSlice,Ri as useDeviceStateSlice,v1 as useDeviceStatusGetStatus,r5 as useDeviceWebrtc,s5 as useDevices,o5 as useDoorbellEvents,y1 as useDoorbellGetStatus,c5 as useEventInvalidation,Ai as useEventStreamLatest,Lv as useEventStreamMap,k1 as useEventsGetEventClipUrl,w1 as useEventsGetEventThumbnail,x1 as useEventsGetEvents,N1 as useFeatureProbeGetStatus,E1 as useIntegrationsCreate,P1 as useIntegrationsDelete,C1 as useIntegrationsGet,_1 as useIntegrationsGetAvailableTypes,M1 as useIntegrationsGetByAddonId,R1 as useIntegrationsGetSettings,S1 as useIntegrationsList,I1 as useIntegrationsSetSettings,T1 as useIntegrationsTestConnection,A1 as useIntegrationsUpdate,z1 as useIntercomEndTalkSession,F1 as useIntercomGetStatus,L1 as useIntercomHandleAnswer,B1 as useIntercomPushTalkPcm,D1 as useIntercomStartSession,$1 as useIntercomStartTalkSession,O1 as useIntercomStopSession,kv as useIsMidWidth,$r as useIsMobile,_t as useLiveBuffer,Br as useLiveEvent,U1 as useLocalNetworkGetAllowedAddresses,j1 as useLocalNetworkGetConnectionEndpoints,Q1 as useLocalNetworkGetPreferred,G1 as useLocalNetworkList,V1 as useLocalNetworkResetAllowlistToBestMatch,H1 as useLocalNetworkSetAllowedAddresses,q1 as useMeshNetworkGetStatus,W1 as useMeshNetworkJoin,Y1 as useMeshNetworkLeave,X1 as useMeshNetworkListPeers,Z1 as useMeshNetworkLogout,K1 as useMeshNetworkStartLogin,J1 as useMeshNetworkTestConnection,ew as useMetricsProviderCollectSnapshot,lw as useMetricsProviderGetAddonStats,tw as useMetricsProviderGetCached,sw as useMetricsProviderGetCpuTemperature,rw as useMetricsProviderGetCurrent,nw as useMetricsProviderGetDiskSpace,ow as useMetricsProviderGetGpuInfo,aw as useMetricsProviderGetProcessStats,dw as useMetricsProviderKillProcess,iw as useMetricsProviderListAddonInstances,cw as useMetricsProviderListNodeProcesses,fw as useMotionDetectionAnalyze,vw as useMotionDetectionApplyDeviceSettingsPatch,bw as useMotionDetectionGetDeviceLiveContribution,gw as useMotionDetectionGetDeviceSettingsContribution,mw as useMotionDetectionRemoveCamera,hw as useMotionDetectionReset,pw as useMotionGetStatus,uw as useMotionIsDetected,xw as useMotionTriggerGetStatus,yw as useMotionTriggerSetMotionTrigger,Nw as useMqttBrokerAddBroker,kw as useMqttBrokerGetBrokerConfig,Aw as useMqttBrokerGetStatus,ww as useMqttBrokerListBrokers,Sw as useMqttBrokerRemoveBroker,Mw as useMqttBrokerStartEmbeddedBroker,Ew as useMqttBrokerStopEmbeddedBroker,Cw as useMqttBrokerTestConnection,Pw as useNativeObjectDetectionGetStatus,_w as useNetworkAccessGetEndpoint,Tw as useNetworkAccessGetStatus,Dw as useNetworkAccessListEndpoints,Rw as useNetworkAccessStart,Iw as useNetworkAccessStop,Ow as useNetworkQualityGetAllStats,Lw as useNetworkQualityGetDeviceStats,$w as useNetworkQualityReportClientStats,Vw as useNodesClusterAddonStatus,zw as useNodesDeployAddon,Kw as useNodesExecuteQuery,qw as useNodesGetNodeAddons,Hw as useNodesRenameNode,Gw as useNodesRestartAddon,jw as useNodesRestartNode,Qw as useNodesRestartProcess,Ww as useNodesSetProcessLogLevel,Uw as useNodesShutdownNode,Bw as useNodesTopology,Fw as useNodesUndeployAddon,Yw as useNotificationOutputSend,Zw as useNotificationOutputSendTest,Dv as useOptionalSystem,kh as useOptionalWidgetRegistry,Jw as useOsdGetStatus,Xw as useOsdSetOverlay,n5 as usePTZ,u2 as usePipelineAnalyticsApplyDeviceSettingsPatch,n2 as usePipelineAnalyticsClearTracks,e2 as usePipelineAnalyticsGetActiveTracks,a2 as usePipelineAnalyticsGetAudioEvents,d2 as usePipelineAnalyticsGetDeviceLiveContribution,c2 as usePipelineAnalyticsGetDeviceSettingsContribution,i2 as usePipelineAnalyticsGetEventMedia,o2 as usePipelineAnalyticsGetMotionEvents,s2 as usePipelineAnalyticsGetObjectEvents,t2 as usePipelineAnalyticsGetTrack,l2 as usePipelineAnalyticsGetTrackMedia,r2 as usePipelineAnalyticsListTracks,T2 as usePipelineExecutorCacheFrameInPool,P2 as usePipelineExecutorDeleteModel,C2 as usePipelineExecutorDeleteTemplate,R2 as usePipelineExecutorDetect,A2 as usePipelineExecutorDownloadModel,E2 as usePipelineExecutorGetAddonModels,U2 as usePipelineExecutorGetAudioCapabilities,p2 as usePipelineExecutorGetAvailableEngines,M2 as usePipelineExecutorGetCapabilities,m2 as usePipelineExecutorGetDefaultSteps,V2 as usePipelineExecutorGetDetectionConfigSchema,O2 as usePipelineExecutorGetEffectiveTuning,x2 as usePipelineExecutorGetGlobalPipelineConfig,y2 as usePipelineExecutorGetGlobalSteps,w2 as usePipelineExecutorGetOrchestratorConfigSchema,j2 as usePipelineExecutorGetReferenceAudio,Q2 as usePipelineExecutorGetReferenceAudioFiles,G2 as usePipelineExecutorGetReferenceImage,v2 as usePipelineExecutorGetSchema,f2 as usePipelineExecutorGetSelectedEngine,g2 as usePipelineExecutorGetVideoPipelineSteps,D2 as usePipelineExecutorInferCached,z2 as usePipelineExecutorKillEngine,$2 as usePipelineExecutorListLoadedEngines,F2 as usePipelineExecutorListReferenceImages,k2 as usePipelineExecutorListTemplates,h2 as usePipelineExecutorReprobeEngine,H2 as usePipelineExecutorRunAudioTest,I2 as usePipelineExecutorRunPipeline,_2 as usePipelineExecutorRunPipelineBatch,N2 as usePipelineExecutorSaveTemplate,b2 as usePipelineExecutorSetVideoPipelineSteps,B2 as usePipelineExecutorSpinEngine,L2 as usePipelineExecutorUncacheFrame,S2 as usePipelineExecutorUpdateTemplate,Ak as usePipelineOrchestratorApplyDeviceSettingsPatch,ak as usePipelineOrchestratorAssignAudio,nk as usePipelineOrchestratorAssignDecoder,q2 as usePipelineOrchestratorAssignPipeline,Ck as usePipelineOrchestratorDeleteTemplate,X2 as usePipelineOrchestratorGetAgentLoad,pk as usePipelineOrchestratorGetAgentSettings,lk as usePipelineOrchestratorGetAudioAssignment,dk as usePipelineOrchestratorGetAudioAssignments,ck as usePipelineOrchestratorGetAudioNodeLoad,ek as usePipelineOrchestratorGetCameraMetrics,gk as usePipelineOrchestratorGetCameraSettings,vk as usePipelineOrchestratorGetCameraStepOverrides,tk as usePipelineOrchestratorGetCapabilityBindings,uk as usePipelineOrchestratorGetDecoderAssignment,sk as usePipelineOrchestratorGetDecoderAssignments,Ek as usePipelineOrchestratorGetDeviceLiveContribution,Mk as usePipelineOrchestratorGetDeviceSettingsContribution,J2 as usePipelineOrchestratorGetGlobalMetrics,Z2 as usePipelineOrchestratorGetPipelineAssignment,Y2 as usePipelineOrchestratorGetPipelineAssignments,fk as usePipelineOrchestratorListAgentSettings,kk as usePipelineOrchestratorListTemplates,K2 as usePipelineOrchestratorRebalance,hk as usePipelineOrchestratorRemoveAgentSettings,wk as usePipelineOrchestratorResolvePipeline,Nk as usePipelineOrchestratorSaveTemplate,mk as usePipelineOrchestratorSetAgentAddonDefaults,xk as usePipelineOrchestratorSetCameraPipelineForAgent,yk as usePipelineOrchestratorSetCameraStepOverride,bk as usePipelineOrchestratorSetCameraStepToggle,rk as usePipelineOrchestratorSetCapabilityBinding,ik as usePipelineOrchestratorUnassignAudio,ok as usePipelineOrchestratorUnassignDecoder,W2 as usePipelineOrchestratorUnassignPipeline,Sk as usePipelineOrchestratorUpdateTemplate,Pk as usePipelineRunnerAttachCamera,Rk as usePipelineRunnerDetachCamera,Lk as usePipelineRunnerGetAllCameraMetrics,Dk as usePipelineRunnerGetCameraMetrics,Ok as usePipelineRunnerGetLocalCameras,_k as usePipelineRunnerGetLocalLoad,Tk as usePipelineRunnerGetLocalMetrics,Ik as usePipelineRunnerReportMotion,$k as usePlatformProbeGetCapabilities,Bk as usePlatformProbeGetHardware,Gk as usePlatformProbeGetHardwareEncoders,Qk as usePlatformProbeRefreshHardwareEncoders,Fk as usePlatformProbeResolveHwAccel,zk as usePlatformProbeResolveInferenceConfig,RC as usePlayerOverlayLayer,PC as usePlayerOverlayLayers,IC as usePlayerToolbarButton,wg as usePlayerToolbarButtons,Jk as usePtzAutotrackGetSettings,Zk as usePtzAutotrackGetStatus,Xk as usePtzAutotrackSetEnabled,eN as usePtzAutotrackSetSettings,Uk as usePtzContinuousMove,Kk as usePtzGetPosition,Vk as usePtzGetPresets,Yk as usePtzGetStatus,Wk as usePtzGoHome,qk as usePtzGoToPreset,jk as usePtzMove,Hk as usePtzStop,tN as useRebootReboot,iN as useRecordingEngineDisable,aN as useRecordingEngineEnable,hN as useRecordingEngineEstimateGlobalStorage,mN as useRecordingEngineEstimateStorage,fN as useRecordingEngineGetAvailability,lN as useRecordingEngineGetConfig,kN as useRecordingEngineGetMotionStats,dN as useRecordingEngineGetPlaylist,vN as useRecordingEngineGetPolicy,yN as useRecordingEngineGetPolicyStatus,xN as useRecordingEngineGetRetentionConfig,pN as useRecordingEngineGetSegments,sN as useRecordingEngineGetStatus,gN as useRecordingEngineGetStorageUsage,uN as useRecordingEngineGetThumbnail,bN as useRecordingEngineSetPolicy,cN as useRecordingEngineUpdateConfig,wN as useRecordingEngineUpdateRetentionConfig,nN as useRecordingGetPlaybackUrl,rN as useRecordingGetSegments,oN as useRecordingGetThumbnailAt,PN as useSettingsStoreCount,IN as useSettingsStoreDeclareCollection,AN as useSettingsStoreDelete,NN as useSettingsStoreGet,MN as useSettingsStoreInsert,RN as useSettingsStoreIsEmpty,CN as useSettingsStoreQuery,SN as useSettingsStoreSet,EN as useSettingsStoreUpdate,$N as useSnapshotApplyDeviceSettingsPatch,ON as useSnapshotGetDeviceLiveContribution,LN as useSnapshotGetDeviceSettingsContribution,_N as useSnapshotGetSnapshot,DN as useSnapshotGetStatus,TN as useSnapshotInvalidateCache,zN as useSnapshotProviderGetSnapshot,BN as useSnapshotProviderSupportsDevice,YN as useStorageAbortUpload,ZN as useStorageBeginDownload,qN as useStorageBeginUpload,HN as useStorageDelete,nS as useStorageDeleteLocation,JN as useStorageEndDownload,jN as useStorageExists,KN as useStorageFinalizeUpload,VN as useStorageGetAvailableSpace,tS as useStorageGetDefaultLocation,UN as useStorageList,eS as useStorageListLocations,sS as useStorageListProviders,QN as useStorageRead,XN as useStorageReadChunk,FN as useStorageResolve,aS as useStorageTestConfig,oS as useStorageTestLocation,rS as useStorageUpsertLocation,GN as useStorageWrite,WN as useStorageWriteChunk,IS as useStreamBrokerApplyDeviceSettingsPatch,cS as useStreamBrokerAssignProfile,SS as useStreamBrokerGetAllRtspEntries,xS as useStreamBrokerGetBroker,fS as useStreamBrokerGetBrokerStats,RS as useStreamBrokerGetDeviceLiveContribution,PS as useStreamBrokerGetDeviceSettingsContribution,kS as useStreamBrokerGetPreBufferInfo,CS as useStreamBrokerGetRtspEntry,NS as useStreamBrokerGetRtspPort,bS as useStreamBrokerGetStreamUrl,vS as useStreamBrokerGetStreamWithCodec,AS as useStreamBrokerIsRtspEnabled,hS as useStreamBrokerKillClient,uS as useStreamBrokerListAllCameraStreams,pS as useStreamBrokerListAllProfileSlots,mS as useStreamBrokerListClients,iS as useStreamBrokerPublishCameraStream,MS as useStreamBrokerRegenerateRtspToken,yS as useStreamBrokerReleaseStreamWithCodec,gS as useStreamBrokerRestartProfile,lS as useStreamBrokerRetractCameraStream,wS as useStreamBrokerSetPreBufferDuration,ES as useStreamBrokerSetRtspEnabled,dS as useStreamBrokerUnassignProfile,TS as useSwitchGetStatus,_S as useSwitchSetState,Ft as useSystem,OS as useSystemFeatureFlags,FS as useSystemForceRetentionCleanup,BS as useSystemGetRetentionConfig,LS as useSystemHealth,DS as useSystemInfo,l5 as useSystemMutation,$S as useSystemNetworkAddresses,i5 as useSystemQuery,zS as useSystemSetRetentionConfig,Wl as useThemeMode,GS as useToastOnToast,QS as useTurnProviderGetTurnServers,sC as useUserManagementConfirmTotp,ZS as useUserManagementCreateApiKey,eC as useUserManagementCreateScopedToken,US as useUserManagementCreateUser,VS as useUserManagementDeleteUser,aC as useUserManagementDisableTotp,iC as useUserManagementGetTotpStatus,YS as useUserManagementListApiKeys,nC as useUserManagementListScopedTokens,jS as useUserManagementListUsers,qS as useUserManagementResetPassword,XS as useUserManagementRevokeApiKey,tC as useUserManagementRevokeScopedToken,WS as useUserManagementSetUserScopes,oC as useUserManagementSetupTotp,HS as useUserManagementUpdateUser,JS as useUserManagementValidateApiKey,KS as useUserManagementValidateCredentials,rC as useUserManagementValidateScopedToken,lC as useUserManagementVerifyTotp,fC as useWebrtcSessionCloseSession,dC as useWebrtcSessionCreateSession,pC as useWebrtcSessionHandleAnswer,uC as useWebrtcSessionHandleOffer,mC as useWebrtcSessionHasAdaptiveBitrate,cC as useWebrtcSessionListStreams,xh as useWidget,wh as useWidgetMetadata,ao as useWidgetRegistry,bC as useZoneAnalyticsGetCameraHistory,hC as useZoneAnalyticsGetCurrentSnapshot,vC as useZoneAnalyticsGetUnzonedHistory,gC as useZoneAnalyticsGetZoneHistory,e5 as useZoneEditing,yC as useZoneRulesListRules,xC as useZoneRulesSetRules,kC as useZonesAddZone,wC as useZonesListZones,NC as useZonesRemoveZone,SC as useZonesUpdateZone,XC as validateScopes};
|