@camstack/addon-admin-ui 0.1.25 → 0.1.26
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/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Bo47Kbxo.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DlcNv4jc.js} +1 -1
- package/dist/assets/{hostInit-Dv-mRJY_.js → hostInit-BpDp2mzG.js} +1 -1
- package/dist/assets/index-CAlT1MNc.css +1 -0
- package/dist/assets/{index-0gxFObCa.js → index-CO8Odo2q.js} +228 -223
- package/dist/assets/index-CaiMG86U.js +80 -0
- package/dist/assets/index-DDPTeM3J.js +80 -0
- package/dist/assets/{index-DyOyiTHa.js → index-DOXiszQ-.js} +1 -1
- package/dist/assets/{index-Dl7YZL2P.js → index-DV9irWJe.js} +1 -1
- package/dist/assets/index-zk-hwOKE.js +1 -0
- package/dist/assets/method-access-map-DAzkqn3U.js +1 -0
- package/dist/assets/{remoteEntry-eloL7nFC.js → remoteEntry-DcLH2pUv.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-FwiS5mbU.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CJWQPV3f.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/capability-router-map-B_3PX_qC.js +0 -1
- package/dist/assets/index-By7PGB6H.js +0 -80
- package/dist/assets/index-CtBSaA5o.js +0 -80
- package/dist/assets/index-DJpRWTJm.js +0 -1
- package/dist/assets/index-uOUrSD7R.css +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import{e as S,h as I,c as H,f as ee,d as Ae,b as Ye,i as q,j as Te,R as Ji,l as Ct,m as el,k as $t,g as Pn,a as ds}from"./__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-Dl4u0xYE.js";import{c as o,d as f,e as Ne,a as us}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-C_6K4VBY.js";import{b as Sr,a as ps}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CzO_Esxm.js";import{b as tl,a as fs}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DNpf5SLz.js";import{n as Rn,m as ms,h as rl,o as nl,p as ol,_ as hs}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CeLhKMin.js";import{c as gs,s as bs,B as sl,F as al,n as il,_ as vs}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DIkg6-MH.js";import{a as ll,_ as ys}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-OcRSBqRe.js";import{K as cl,E as V,A as dl}from"./method-access-map-DAzkqn3U.js";import{c as ul}from"./index-DMrjJViX.js";import{c as pl}from"./devices-Ccad-MYH.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";import"./schemas-XgIEoUz3.js";var xs={frigate:"#3b82f6",scrypted:"#a855f7",reolink:"#06b6d4",homeAssistant:"#22d3ee",rtsp:"#78716c"},fl={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:xs},ml={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:xs},eo={colors:{dark:fl,light:ml},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 ws(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]=ws(a,s):s!==void 0&&(r[n]=s)}return r}function Lg(e){return e?ws(structuredClone(eo),e):structuredClone(eo)}function ks(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function hl(e){return`--color-${ks(e)}`}function to(e){const t=[];for(const[r,n]of Object.entries(e))r!=="provider"&&t.push(` ${hl(r)}: ${n};`);return t.join(`
|
|
2
|
+
`)}function gl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --color-provider-${ks(r)}: ${n};`);return t.join(`
|
|
3
|
+
`)}function bl(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 Og(e){const t=to(e.colors.dark),r=to(e.colors.light);return`@theme {
|
|
6
|
+
${gl(e.colors.dark.provider)}
|
|
7
|
+
${bl(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 Ns=Ye(null),Dr=["dark","light","system"];function Ss(){return typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function yl(e,t){if(typeof window>"u")return t;const r=localStorage.getItem(e);return r==="dark"||r==="light"||r==="system"?r:t}function ro(e){return e==="system"?Ss():e}function no({children:e,defaultMode:t="system",storageKey:r="camstack-theme-mode"}){const[n,s]=S(()=>yl(r,t)),[a,i]=S(()=>ro(n)),l=I(u=>{s(u),i(ro(u)),typeof window<"u"&&localStorage.setItem(r,u)},[r]),c=I(()=>{l(Dr[(Dr.indexOf(n)+1)%Dr.length]??"dark")},[n,l]);H(()=>{if(typeof document>"u")return;const u=document.documentElement;u.classList.remove("dark","light"),u.classList.add(a)},[n,a]),H(()=>{if(typeof window>"u"||n!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),p=()=>{i(Ss())};return u.addEventListener("change",p),()=>u.removeEventListener("change",p)},[n]);const d=ee(()=>({mode:n,resolvedMode:a,setMode:l,toggleMode:c}),[n,a,l,c]);return o(Ns.Provider,{value:d,children:e})}function xl(){const e=Ae(Ns);if(!e)throw new Error("useThemeMode must be used within a ThemeProvider");return e}var Lr={};function Cs(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=Cs(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ms(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Cs(e))&&(n&&(n+=" "),n+=t);return n}var wl=(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},kl=(e,t)=>({classGroupId:e,validator:t}),Es=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),yr="-",oo=[],Nl="arbitrary..",Sl=e=>{const t=Ml(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Cl(i);const l=i.split(yr);return As(l,l[0]===""&&l.length>1?1:0,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],d=r[i];return c?d?wl(d,c):c:d||oo}return r[i]||oo}}},As=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],s=r.nextPart.get(n);if(s){const c=As(e,t+1,s);if(c)return c}const a=r.validators;if(a===null)return;const i=t===0?e.join(yr):e.slice(t).join(yr),l=a.length;for(let c=0;c<l;c++){const d=a[c];if(d.validator(i))return d.classGroupId}},Cl=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?Nl+n:void 0})(),Ml=e=>{const{theme:t,classGroups:r}=e;return El(r,t)},El=(e,t)=>{const r=Es();for(const n in e){const s=e[n];_n(s,r,n,t)}return r},_n=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];Al(i,t,r,n)}},Al=(e,t,r,n)=>{if(typeof e=="string"){Pl(e,t,r);return}if(typeof e=="function"){Rl(e,t,r,n);return}_l(e,t,r,n)},Pl=(e,t,r)=>{const n=e===""?t:Ps(t,e);n.classGroupId=r},Rl=(e,t,r,n)=>{if(Il(e)){_n(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(kl(r,e))},_l=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];_n(c,Ps(t,l),r,n)}},Ps=(e,t)=>{let r=e;const n=t.split(yr),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=Es(),r.nextPart.set(i,l)),r=l}return r},Il=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Tl=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)}}},on="!",so=":",Dl=[],ao=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),Ll=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,d;const u=s.length;for(let v=0;v<u;v++){const x=s[v];if(i===0&&l===0){if(x===so){a.push(s.slice(c,v)),c=v+1;continue}if(x==="/"){d=v;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const p=a.length===0?s:s.slice(c);let h=p,g=!1;p.endsWith(on)?(h=p.slice(0,-1),g=!0):p.startsWith(on)&&(h=p.slice(1),g=!0);const b=d&&d>c?d-c:void 0;return ao(a,g,h,b)};if(t){const s=t+so,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):ao(Dl,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},Ol=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],l=i[0]==="[",c=t.has(i);l||c?(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}},$l=e=>({cache:Tl(e.cacheSize),parseClassName:Ll(e),sortModifiers:Ol(e),...Sl(e)}),Bl=/\s+/,zl=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(Bl);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!v,y=n(x?b.substring(0,v):b);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),k=g?w+on:w,M=k+y;if(i.indexOf(M)>-1)continue;i.push(M);const C=s(y,x);for(let A=0;A<C.length;++A){const _=C[A];i.push(k+_)}c=u+(c.length>0?" "+c:c)}return c},Fl=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Rs(r))&&(s&&(s+=" "),s+=n);return s},Rs=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Rs(e[n]))&&(r&&(r+=" "),r+=t);return r},jl=(e,...t)=>{let r,n,s,a;const i=c=>(r=$l(t.reduce((d,u)=>u(d),e())),n=r.cache.get,s=r.cache.set,a=l,l(c)),l=c=>{const d=n(c);if(d)return d;const u=zl(c,r);return s(c,u),u};return a=i,(...c)=>a(Fl(...c))},Gl=[],Ee=e=>{const t=r=>r[e]||Gl;return t.isThemeGetter=!0,t},_s=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Is=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ql=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Hl=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ul=/\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$/,Vl=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ql=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xe=e=>Ql.test(e),ce=e=>!!e&&!Number.isNaN(Number(e)),Je=e=>!!e&&Number.isInteger(Number(e)),Or=e=>e.endsWith("%")&&ce(e.slice(0,-1)),Ze=e=>Hl.test(e),Ts=()=>!0,Kl=e=>Ul.test(e)&&!Vl.test(e),In=()=>!1,Zl=e=>ql.test(e),Yl=e=>Wl.test(e),Xl=e=>!F(e)&&!j(e),Jl=e=>nt(e,Os,In),F=e=>_s.test(e),lt=e=>nt(e,$s,Kl),io=e=>nt(e,ic,ce),ec=e=>nt(e,zs,Ts),tc=e=>nt(e,Bs,In),lo=e=>nt(e,Ds,In),rc=e=>nt(e,Ls,Yl),Xt=e=>nt(e,Fs,Zl),j=e=>Is.test(e),_t=e=>ut(e,$s),nc=e=>ut(e,Bs),co=e=>ut(e,Ds),oc=e=>ut(e,Os),sc=e=>ut(e,Ls),Jt=e=>ut(e,Fs,!0),ac=e=>ut(e,zs,!0),nt=(e,t,r)=>{const n=_s.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ut=(e,t,r=!1)=>{const n=Is.exec(e);return n?n[1]?t(n[1]):r:!1},Ds=e=>e==="position"||e==="percentage",Ls=e=>e==="image"||e==="url",Os=e=>e==="length"||e==="size"||e==="bg-size",$s=e=>e==="length",ic=e=>e==="number",Bs=e=>e==="family-name",zs=e=>e==="number"||e==="weight",Fs=e=>e==="shadow",lc=()=>{const e=Ee("color"),t=Ee("font"),r=Ee("text"),n=Ee("font-weight"),s=Ee("tracking"),a=Ee("leading"),i=Ee("breakpoint"),l=Ee("container"),c=Ee("spacing"),d=Ee("radius"),u=Ee("shadow"),p=Ee("inset-shadow"),h=Ee("text-shadow"),g=Ee("drop-shadow"),b=Ee("blur"),v=Ee("perspective"),x=Ee("aspect"),y=Ee("ease"),w=Ee("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"],C=()=>[...M(),j,F],A=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],P=()=>[j,F,c],Q=()=>[Xe,"full","auto",...P()],oe=()=>[Je,"none","subgrid",j,F],le=()=>["auto",{span:["full",Je,j,F]},Je,j,F],ge=()=>[Je,"auto",j,F],de=()=>["auto","min","max","fr",j,F],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],ne=()=>["auto",...P()],W=()=>[Xe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],ye=()=>[Xe,"screen","full","dvw","lvw","svw","min","max","fit",...P()],me=()=>[Xe,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],T=()=>[e,j,F],z=()=>[...M(),co,lo,{position:[j,F]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",oc,Jl,{size:[j,F]}],U=()=>[Or,_t,lt],K=()=>["","none","full",d,j,F],Z=()=>["",ce,_t,lt],G=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[ce,Or,co,lo],Re=()=>["","none",b,j,F],_e=()=>["none",ce,j,F],X=()=>["none",ce,j,F],fe=()=>[ce,j,F],xe=()=>[Xe,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ze],breakpoint:[Ze],color:[Ts],container:[Ze],"drop-shadow":[Ze],ease:["in","out","in-out"],font:[Xl],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ze],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ze],shadow:[Ze],spacing:["px",ce],text:[Ze],"text-shadow":[Ze],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xe,F,j,x]}],container:["container"],columns:[{columns:[ce,F,j,l]}],"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:C()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Q()}],"inset-x":[{"inset-x":Q()}],"inset-y":[{"inset-y":Q()}],start:[{"inset-s":Q(),start:Q()}],end:[{"inset-e":Q(),end:Q()}],"inset-bs":[{"inset-bs":Q()}],"inset-be":[{"inset-be":Q()}],top:[{top:Q()}],right:[{right:Q()}],bottom:[{bottom:Q()}],left:[{left:Q()}],visibility:["visible","invisible","collapse"],z:[{z:[Je,"auto",j,F]}],basis:[{basis:[Xe,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ce,Xe,"auto","initial","none",F]}],grow:[{grow:["",ce,j,F]}],shrink:[{shrink:["",ce,j,F]}],order:[{order:[Je,"first","last","none",j,F]}],"grid-cols":[{"grid-cols":oe()}],"col-start-end":[{col:le()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":oe()}],"row-start-end":[{row:le()}],"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":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:ne()}],mx:[{mx:ne()}],my:[{my:ne()}],ms:[{ms:ne()}],me:[{me:ne()}],mbs:[{mbs:ne()}],mbe:[{mbe:ne()}],mt:[{mt:ne()}],mr:[{mr:ne()}],mb:[{mb:ne()}],ml:[{ml:ne()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...ye()]}],"min-inline-size":[{"min-inline":["auto",...ye()]}],"max-inline-size":[{"max-inline":["none",...ye()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,_t,lt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ac,ec]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Or,F]}],"font-family":[{font:[nc,tc,t]}],"font-features":[{"font-features":[F]}],"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,j,F]}],"line-clamp":[{"line-clamp":[ce,"none",j,io]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",j,F]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",j,F]}],"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:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ce,"from-font","auto",j,lt]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[ce,"auto",j,F]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",j,F]}],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",j,F]}],"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:B()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Je,j,F],radial:["",j,F],conic:[Je,j,F]},sc,rc]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"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:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ce,j,F]}],"outline-w":[{outline:["",ce,_t,lt]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",u,Jt,Xt]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",p,Jt,Xt]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[ce,lt]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,Jt,Xt]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[ce,j,F]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"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":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"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":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"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":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"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":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"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":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"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":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[j,F]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"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":[ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"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:B()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",j,F]}],filter:[{filter:["","none",j,F]}],blur:[{blur:Re()}],brightness:[{brightness:[ce,j,F]}],contrast:[{contrast:[ce,j,F]}],"drop-shadow":[{"drop-shadow":["","none",g,Jt,Xt]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",ce,j,F]}],"hue-rotate":[{"hue-rotate":[ce,j,F]}],invert:[{invert:["",ce,j,F]}],saturate:[{saturate:[ce,j,F]}],sepia:[{sepia:["",ce,j,F]}],"backdrop-filter":[{"backdrop-filter":["","none",j,F]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[ce,j,F]}],"backdrop-contrast":[{"backdrop-contrast":[ce,j,F]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ce,j,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ce,j,F]}],"backdrop-invert":[{"backdrop-invert":["",ce,j,F]}],"backdrop-opacity":[{"backdrop-opacity":[ce,j,F]}],"backdrop-saturate":[{"backdrop-saturate":[ce,j,F]}],"backdrop-sepia":[{"backdrop-sepia":["",ce,j,F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",j,F]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ce,"initial",j,F]}],ease:[{ease:["linear","initial",y,j,F]}],delay:[{delay:[ce,j,F]}],animate:[{animate:["none",w,j,F]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,j,F]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[j,F,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"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",j,F]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",j,F]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[ce,_t,lt,io]}],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"]}},cc=jl(lc);function N(...e){return cc(Ms(e))}var $g="rounded-lg border border-border bg-surface overflow-hidden",Bg="border-b border-border px-3 sm:px-4 py-1.5 sm:py-2",zg="p-2 sm:p-3 lg:p-4",Fg="space-y-3 sm:space-y-4",jg="gap-2 sm:gap-3",Gg="px-3 sm:px-4 py-1.5 sm:py-2",Qg="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4",Hg="grid grid-cols-1 lg:grid-cols-2",Ug="flex flex-col-reverse md:flex-row",Vg="w-full md:w-44 lg:w-52 md:flex-shrink-0 border-b md:border-b-0 md:border-l border-border",qg="text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider",Wg="text-[11px] sm:text-xs text-foreground",Kg="text-[10px] text-foreground-subtle",Zg="text-[11px] sm:text-xs font-medium text-foreground",Yg="text-base sm:text-lg font-semibold leading-tight text-foreground",Xg="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",Jg="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",eb="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",tb="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",rb="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",nb="inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors",ob="border-primary/50 bg-primary/15 text-primary",sb="border-border bg-surface text-foreground-subtle hover:bg-surface-hover";function dc(e,t){for(const r of e.slots)for(const n of r.addons)if(n.id===t)return n;return null}function uc(e,t){return e.models.find(r=>r.id===t)??null}function pc(e,t){return e.models.find(r=>!!r.formats[t])??null}function fc(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 ab(e){const{source:t,target:r,catalog:n,addonIds:s}=e,a=[];for(const i of s){const l=t.defaults[i];if(!l){a.push({addonId:i,outcome:"skip",modelId:null,reason:"no source entry",patch:null});continue}const c=dc(n,i);if(!c){a.push({addonId:i,outcome:"skip",modelId:null,reason:"addon not in target catalog",patch:null});continue}const d=uc(c,l.modelId),u=d!==null&&!!d.formats[r.engine.format];let p,h;if(u)p=l.modelId,h="exact";else{const b=pc(c,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:l.enabled,modelId:p,settings:fc(l.settings,c)};a.push({addonId:i,outcome:h,modelId:p,patch:g})}return a}var uo={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 js(e){return uo[e]??uo.watching}function ot(e,t){if(typeof globalThis>"u")return Ye(t);const r=globalThis.__camstackSharedContexts,n=r??new Map;r||(globalThis.__camstackSharedContexts=n);const s=n.get(e);if(s)return s;const a=Ye(t);return n.set(e,a),a}var mc="FEDERATION_DEBUG",sn=(function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e})({}),Gs=!0;function hc(){return Gs}function gc(){try{if(hc()&&window.localStorage)return!!localStorage.getItem(mc)}catch{return!1}return!1}function an(){return typeof process<"u"&&Lr&&Lr.FEDERATION_DEBUG?!!Lr.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:gc()}var bc="[ Federation Runtime ]",Qs=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}:${r}`:r:t,""):""},ln=(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),"")},Hs=e=>{console.warn(`${bc}: ${e}`)};function Us(e){try{return JSON.stringify(e,null,2)}catch{return""}}var $r=(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 yc(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,l=Object.keys(n);let c={};Object.keys(r).length||(c=e.remotes?.reduce((w,k)=>{let M;const C=k.federationContainerName;return l.includes(C)?M=n[C]:"version"in k?M=k.version:M=k.entry,w[C]={matchedVersion:M},w},{})||{}),Object.keys(r).forEach(w=>c[w]={matchedVersion:l.includes(w)?n[w]:r[w]});const{remoteEntry:{path:d,name:u,type:p},types:h={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:g},globalName:b,ssrRemoteEntry:v}=e.metaData,{exposes:x}=e;let y={version:s||"",buildVersion:g,globalName:b,remoteEntry:$r(d,u),remoteEntryType:p,remoteTypes:$r(h.path,h.name),remoteTypesZip:h.zip||"",remoteTypesAPI:h.api||"",remotesInfo:c,shared:e?.shared.map(w=>({assets:w.assets,sharedName:w.name,version:w.version,usedExports:w.referenceExports||[]})),modules:x?.map(w=>({moduleName:w.name,modulePath:w.path,assets:w.assets}))};if("publicPath"in e.metaData?(a={...y,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(a.ssrPublicPath=e.metaData.ssrPublicPath)):a={...y,getPublicPath:i()},v){const w=$r(v.path,v.name);a.ssrRemoteEntry=w,a.ssrRemoteEntryType=v.type||"commonjs-module"}return a}function Vs(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(".json"))}var xc="[ Module Federation ]",It=console,wc=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function kc(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
|
|
31
|
+
`),r=t.filter(n=>!wc.some(s=>n.includes(s)));return r.length?`Stack trace:
|
|
32
|
+
${r.slice(0,5).join(`
|
|
33
|
+
`)}`:void 0}catch{return}}var qs=class{constructor(e,t=It){this.prefix=e,this.delegate=t??It}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??It}emit(e,t){const r=this.delegate,n=an()?kc():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 l=r[i];if(typeof l=="function"){l.call(r,this.prefix,...s);return}}for(const i of a){const l=It[i];if(typeof l=="function"){l.call(It,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){an()&&this.emit("debug",e)}};function Nc(e){return new qs(e)}function Sc(e){const t=new qs(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Sc(xc);async function Ws(e,t){try{return await e()}catch(r){Hs(r);return}}function cn(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function Ks(e){let t=null,r=!0,n=2e4,s;const a=document.getElementsByTagName("script");for(let d=0;d<a.length;d++){const u=a[d],p=u.getAttribute("src");if(p&&cn(p,e.url)){t=u,r=!1;break}}if(!t){const d=e.attrs;t=document.createElement("script"),t.type=d?.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),d&&!u&&Object.keys(d).forEach(p=>{t&&(p==="async"||p==="defer"?t[p]=d[p]:t.getAttribute(p)||t.setAttribute(p,d[p]))})}let i=null;const l=typeof window<"u"?d=>{if(d.filename&&cn(d.filename,e.url)){const u=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${d.message} (${d.filename}:${d.lineno}:${d.colno})`);u.name="ScriptExecutionError",i=u}}:null;l&&window.addEventListener("error",l);const c=async(d,u)=>{clearTimeout(s),l&&window.removeEventListener("error",l);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,Ws(()=>{const{needDeleteScript:h=!0}=e;h&&t?.parentNode&&t.parentNode.removeChild(t)}),d&&typeof d=="function")){const h=d(u);if(h instanceof Promise){const g=await h;return p(),g}return p(),h}p()};return t.onerror=c.bind(null,t.onerror),t.onload=c.bind(null,t.onload),s=setTimeout(()=>{c(null,{type:"error",isTimeout:!0})},n),{script:t,needAttach:r}}function Br(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let a=0;a<n.length;a++){const i=n[a],l=i.getAttribute("href"),c=i.getAttribute("rel");if(l&&cn(l,e.url)&&c===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(l=>{t&&!t.getAttribute(l)&&t.setAttribute(l,i[l])})}const s=(a,i)=>{const l=()=>{i?.type==="error"?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,Ws(()=>{const{needDeleteLink:c=!0}=e;c&&t?.parentNode&&t.parentNode.removeChild(t)}),a)){const c=a(i);return l(),c}l()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:r}}function Cc(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((s,a)=>{const{script:i,needAttach:l}=Ks({url:e,cb:s,onErrorCallback:a,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});l&&document.head.appendChild(i)})}var Mc=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,Zs=(e,t,r,n)=>{const s=[`${[t[e]]} #${e}`];return r&&s.push(`args: ${JSON.stringify(r)}`),s.push(Mc(e)),n&&s.push(`Original Error Message:
|
|
34
|
+
${n}`),s.join(`
|
|
35
|
+
`)};function Ec(e,t,r,n,s,a){return n(Zs(e,t,r,s))}var ct="[ Federation Runtime ]",dn=Nc(ct);function Le(e,t,r,n,s){e||(r!==void 0?Se(t,r,n,void 0):Se(t))}function Se(e,t,r,n,s){if(t!==void 0)return Ec(e,t,r??{},i=>{throw new Error(`${ct}: ${i}`)},n);const a=e;throw a instanceof Error?(a.message.startsWith(ct)||(a.message=`${ct}: ${a.message}`),a):new Error(`${ct}: ${a}`)}function Tn(e){e instanceof Error&&(e.message.startsWith(ct)||(e.message=`${ct}: ${e.message}`)),dn.warn(e)}function Ac(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Bt(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Dn(e){return typeof e.entry<"u"}function Ys(e){return!e.entry.includes(".json")}function Ln(e){return e&&typeof e=="object"}var Pc=Object.prototype.toString;function Rc(e){return Pc.call(e)==="[object Object]"}function Xs(e){return Array.isArray(e)?e:[e]}function Js(e){const t={url:"",type:"global",globalName:""};return"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t}var _c=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},Me=typeof globalThis=="object"?globalThis:window,je=(()=>{try{return document.defaultView}catch{return Me}})(),zt=je;function dr(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function ur(e,t){return Object.hasOwnProperty.call(e,t)}ur(Me,"__GLOBAL_LOADING_REMOTE_ENTRY__")||dr(Me,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});var yt=Me.__GLOBAL_LOADING_REMOTE_ENTRY__;function ea(e){ur(e,"__VMOK__")&&!ur(e,"__FEDERATION__")&&dr(e,"__FEDERATION__",e.__VMOK__),ur(e,"__FEDERATION__")||(dr(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),dr(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}ea(Me);ea(je);function Ic(e){Me.__FEDERATION__.__INSTANCES__.push(e)}function Tc(){return Me.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function Dc(e,t=an()){t&&(Me.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,Me.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.4.0")}function Mt(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}`,l=e[i];if(l)return{value:l,key:i}}return{value:void 0,key:t}}}else Se(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var po=()=>je.__FEDERATION__.moduleInfo,Lc=(e,t)=>{const r=Mt(t,Bt(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=Bt(s),i=Mt(je.__FEDERATION__.moduleInfo,a).value;if(i?.version===n)return i}},pr=e=>Lc(e,je.__FEDERATION__.moduleInfo),fo=(e,t)=>{const r=Bt(e);return je.__FEDERATION__.moduleInfo[r]=t,je.__FEDERATION__.moduleInfo},Oc=e=>(je.__FEDERATION__.moduleInfo={...je.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete je.__FEDERATION__.moduleInfo[r]}),ta=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:Me[r]}},$c=()=>je.__FEDERATION__.__GLOBAL_PLUGIN__,Bc=e=>Me.__FEDERATION__.__PRELOADED_MAP__.get(e),zc=e=>Me.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),mo="[0-9A-Za-z-]+",On=`(?:\\+(${mo}(?:\\.${mo})*))`,Dt="0|[1-9]\\d*",fr="[0-9]+",ra="\\d*[a-zA-Z-][a-zA-Z0-9-]*",ho=`(?:${fr}|${ra})`,Fc=`(?:-?(${ho}(?:\\.${ho})*))`,go=`(?:${Dt}|${ra})`,na=`(?:-(${go}(?:\\.${go})*))`,zr=`${Dt}|x|X|\\*`,Et=`[v=\\s]*(${zr})(?:\\.(${zr})(?:\\.(${zr})(?:${na})?${On}?)?)?`,jc=`^\\s*(${Et})\\s+-\\s+(${Et})\\s*$`,Gc=`[v=\\s]*${`(${fr})\\.(${fr})\\.(${fr})`}${Fc}?${On}?`,$n="((?:<|>)?=?)",Qc=`(\\s*)${$n}\\s*(${Gc}|${Et})`,oa="(?:~>?)",Hc=`(\\s*)${oa}\\s+`,sa="(?:\\^)",Uc=`(\\s*)${sa}\\s+`,Vc="(<|>)?=?\\s*\\*",qc=`^${sa}${Et}$`,Wc=`v?${`(${Dt})\\.(${Dt})\\.(${Dt})`}${na}?${On}?`,Kc=`^${oa}${Et}$`,Zc=`^${$n}\\s*${Et}$`,Yc=`^${$n}\\s*(${Wc})$|^$`,Xc="^\\s*>=\\s*0.0.0\\s*$";function We(e){return new RegExp(e)}function Ie(e){return!e||e.toLowerCase()==="x"||e==="*"}function aa(...e){return t=>e.reduce((r,n)=>n(r),t)}function bo(e){return e.match(We(Yc))}function vo(e,t,r,n){const s=`${e}.${t}.${r}`;return n?`${s}-${n}`:s}function Jc(e){return e.replace(We(jc),(t,r,n,s,a,i,l,c,d,u,p,h)=>(Ie(n)?r="":Ie(s)?r=`>=${n}.0.0`:Ie(a)?r=`>=${n}.${s}.0`:r=`>=${r}`,Ie(d)?c="":Ie(u)?c=`<${Number(d)+1}.0.0-0`:Ie(p)?c=`<${d}.${Number(u)+1}.0-0`:h?c=`<=${d}.${u}.${p}-${h}`:c=`<=${c}`,`${r} ${c}`.trim()))}function ed(e){return e.replace(We(Qc),"$1$2$3")}function td(e){return e.replace(We(Hc),"$1~")}function rd(e){return e.replace(We(Uc),"$1^")}function nd(e){return e.trim().split(/\s+/).map(t=>t.replace(We(qc),(r,n,s,a,i)=>Ie(n)?"":Ie(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:Ie(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 od(e){return e.trim().split(/\s+/).map(t=>t.replace(We(Kc),(r,n,s,a,i)=>Ie(n)?"":Ie(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:Ie(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 sd(e){return e.split(/\s+/).map(t=>t.trim().replace(We(Zc),(r,n,s,a,i,l)=>{const c=Ie(s),d=c||Ie(a),u=d||Ie(i);return n==="="&&u&&(n=""),l="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&u?(d&&(a=0),i=0,n===">"?(n=">=",d?(s=Number(s)+1,a=0,i=0):(a=Number(a)+1,i=0)):n==="<="&&(n="<",d?s=Number(s)+1:a=Number(a)+1),n==="<"&&(l="-0"),`${n+s}.${a}.${i}${l}`):d?`>=${s}.0.0${l} <${Number(s)+1}.0.0-0`:u?`>=${s}.${a}.0${l} <${s}.${Number(a)+1}.0-0`:r})).join(" ")}function ad(e){return e.trim().replace(We(Vc),"")}function id(e){return e.trim().replace(We(Xc),"")}function mr(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function ld(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],l=n[s];if(i!==l)return i===void 0&&l===void 0?0:i?l?mr(i,l):-1:1}return 0}function er(e,t){return mr(e.major,t.major)||mr(e.minor,t.minor)||mr(e.patch,t.patch)||ld(e,t)}function Fr(e,t){return e.version===t.version}function cd(e,t){switch(e.operator){case"":case"=":return Fr(e,t);case">":return er(e,t)<0;case">=":return Fr(e,t)||er(e,t)<0;case"<":return er(e,t)>0;case"<=":return Fr(e,t)||er(e,t)>0;case void 0:return!0;default:return!1}}function dd(e){return aa(nd,od,sd,ad)(e)}function ud(e){return aa(Jc,ed,td,rd)(e.trim()).split(/\s+/).join(" ")}function Tt(e,t){if(!e)return!1;const r=bo(e);if(!r)return!1;const[,n,,s,a,i,l]=r,c={operator:n,version:vo(s,a,i,l),major:s,minor:a,patch:i,preRelease:l?.split(".")},d=t.split("||");for(const u of d){const p=u.trim();if(!p||p==="*"||p==="x")return!0;try{const h=ud(p);if(!h.trim())return!0;const g=h.split(" ").map(x=>dd(x)).join(" ");if(!g.trim())return!0;const b=g.split(/\s+/).map(x=>id(x)).filter(Boolean);if(b.length===0)continue;let v=!0;for(const x of b){const y=bo(x);if(!y){v=!1;break}const[,w,,k,M,C,A]=y;if(!cd({operator:w,version:vo(k,M,C,A),major:k,minor:M,patch:C,preRelease:A?.split(".")},c)){v=!1;break}}if(v)return!0}catch(h){console.error(`[semver] Error processing range part "${p}":`,h);continue}}return!1}var Cr="default",pd="global";function fd(e,t,r,n){let s;return"get"in e?s=e.get:"lib"in e?s=()=>Promise.resolve(e.lib):s=()=>Promise.resolve(()=>{Se(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),e.shareConfig?.eager&&e.treeShaking?.mode&&Se(`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??sn.UNKNOWN,useIn:[]}:void 0}}function ia(e,t){const r=t.shared||{},n=t.name,s=Object.keys(r).reduce((i,l)=>{const c=Xs(r[l]);return i[l]=i[l]||[],c.forEach(d=>{i[l].push(fd(d,n,l,t.shareStrategy))}),i},{}),a={...e.shared};return Object.keys(s).forEach(i=>{a[i]?s[i].forEach(l=>{a[i].find(c=>c.version===l.version)||a[i].push(l)}):a[i]=s[i]}),{allShareInfos:a,newShareInfos:s}}function Ft(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===sn.NO_USE?!1:r===sn.CALCULATED?!0:n==="runtime-infer"?t?hd(e,t):!0:!1}function dt(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!!Tt(r(e),`<=${r(t)}`)}var jt=(e,t)=>{const r=t||function(n,s){return dt(n,s)};return Object.keys(e).reduce((n,s)=>!n||r(n,s)||n==="0"?s:n,0)},xr=e=>!!e.loaded||typeof e.lib=="function",md=e=>!!e.loading,hd=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function gd(e,t,r,n){const s=e[t][r];let a="",i=Ft(n);const l=function(c,d){return i?s[c].treeShaking?s[d].treeShaking?!xr(s[c].treeShaking)&&dt(c,d):!1:!0:!xr(s[c])&&dt(c,d)};if(i){if(a=jt(e[t][r],l),a)return{version:a,useTreesShaking:i};i=!1}return{version:jt(e[t][r],l),useTreesShaking:i}}var gt=e=>xr(e)||md(e);function bd(e,t,r,n){const s=e[t][r];let a="",i=Ft(n);const l=function(c,d){if(i){if(!s[c].treeShaking)return!0;if(!s[d].treeShaking)return!1;if(gt(s[d].treeShaking))return gt(s[c].treeShaking)?!!dt(c,d):!0;if(gt(s[c].treeShaking))return!1}return gt(s[d])?gt(s[c])?!!dt(c,d):!0:gt(s[c])?!1:dt(c,d)};if(i){if(a=jt(e[t][r],l),a)return{version:a,useTreesShaking:i};i=!1}return{version:jt(e[t][r],l),useTreesShaking:i}}function vd(e){return e==="loaded-first"?bd:gd}function hr(e,t,r,n){if(!e)return;const{shareConfig:s,scope:a=Cr,strategy:i,treeShaking:l}=r,c=Array.isArray(a)?a:[a];for(const d of c)if(s&&e[d]&&e[d][t]){const{requiredVersion:u}=s,{version:p,useTreesShaking:h}=vd(i)(e,d,t,l),g=()=>{const v=e[d][t][p];if(s.singleton){if(typeof u=="string"&&!Tt(p,u)){const x=`Version ${p} from ${p&&v.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;s.strictVersion?Se(x):Tn(x)}return{shared:v,useTreesShaking:h}}else{if(u===!1||u==="*")return{shared:v,useTreesShaking:h};if(Tt(p,u))return{shared:v,useTreesShaking:h};const x=Ft(l);if(x){for(const[y,w]of Object.entries(e[d][t]))if(Ft(w.treeShaking,l?.usedExports)&&Tt(y,u))return{shared:w,useTreesShaking:x}}for(const[y,w]of Object.entries(e[d][t]))if(Tt(y,u))return{shared:w,useTreesShaking:!1}}},b={shareScopeMap:e,scope:d,pkgName:t,version:p,GlobalFederation:zt.__FEDERATION__,shareInfo:r,resolver:g};return(n.emit(b)||b).resolver()}}function la(){return zt.__FEDERATION__.__SHARE__}function yo(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,s=c=>{if(!c)return;const d={};return c.forEach(p=>{d[p.version]=p}),d[jt(d,function(p,h){return!xr(d[p])&&dt(p,h)})]},a=r?.resolver??s,i=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),l=(...c)=>{const d={};for(const u of c)if(u)for(const[p,h]of Object.entries(u)){const g=d[p];i(g)&&i(h)?d[p]=l(g,h):h!==void 0&&(d[p]=h)}return d};return l(a(n[t]),r?.customShareInfo)}var bt=(e,t)=>{e.useIn||(e.useIn=[]),Ac(e.useIn,t)};function tr(e,t){return t&&e.treeShaking?e.treeShaking:e}function yd(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 l=r.name;return s=`.${s}`,{pkgNameOrAlias:l,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 l=r.alias;return i=`.${i}`,{pkgNameOrAlias:l,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function xd(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}var ca="RUNTIME-001",da="RUNTIME-002",ua="RUNTIME-003",pa="RUNTIME-004",fa="RUNTIME-005",un="RUNTIME-006",ma="RUNTIME-007",ha="RUNTIME-008",Bn="RUNTIME-009",ga="RUNTIME-010",ba="RUNTIME-011",wd="RUNTIME-012",Oe={[ca]:"Failed to get remoteEntry exports.",[da]:'The remote entry interface does not contain "init"',[ua]:"Failed to get manifest.",[pa]:"Failed to locate remote.",[fa]:"Invalid loadShareSync function call from bundler runtime",[un]:"Invalid loadShareSync function call from runtime",[ma]:"Failed to get remote snapshot.",[ha]:"Failed to load script resources.",[Bn]:"Please call createInstance first.",[ga]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[ba]:"The remoteEntry URL is missing from the remote snapshot.",[wd]:'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.'};({...Oe});var va=".then(callbacks[0]).catch(callbacks[1])";async function kd({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${va}`)([r,n]):import(e).then(r).catch(n)}catch(s){Se(`Failed to load ESM entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}async function Nd({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}")${va}`)([r,n])}catch(s){Se(`Failed to load SystemJS entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}function Sd(e,t,r){const{remoteEntryKey:n,entryExports:s}=ta(e,t);return s||Se(ca,Oe,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),s}async function Cd({name:e,globalName:t,entry:r,remoteInfo:n,loaderHook:s,getEntryUrl:a}){const{entryExports:i}=ta(e,t);if(i)return i;const l=a?a(r):r;return Cc(l,{attrs:{},createScriptHook:(c,d)=>{const u=s.lifecycle.createScript.emit({url:c,attrs:d,remoteInfo:n});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>Sd(e,t,r),c=>{const d=c instanceof Error?c.message:String(c);Se(ha,Oe,{remoteName:e,resourceUrl:l},d)})}async function Md({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:s,entryGlobalName:a,name:i,type:l}=e;switch(l){case"esm":case"module":return kd({entry:s,remoteEntryExports:t});case"system":return Nd({entry:s,remoteEntryExports:t});default:return Cd({entry:s,globalName:a,name:i,remoteInfo:e,loaderHook:r,getEntryUrl:n})}}function pn(e){const{entry:t,name:r}=e;return Qs(r,t)}async function wr(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:s,_inErrorHandling:a=!1}=e,i=pn(n);if(r)return r;if(!yt[i]){const l=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;yt[i]=l.emit({loaderHook:c,remoteInfo:n,remoteEntryExports:r}).then(d=>d||Md({remoteInfo:n,remoteEntryExports:r,loaderHook:c,getEntryUrl:s})).catch(async d=>{const u=pn(n),p=d instanceof Error&&d.message.includes("ScriptExecutionError");if(d instanceof Error&&d.message.includes("RUNTIME-008")&&!p&&!a){const h=b=>wr({...b,_inErrorHandling:!0}),g=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:yt,uniqueKey:u});if(g)return g}throw d})}return yt[i]}function kr(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||"global",entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||"default"}}function Ed(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Ad(e,t){const r=$c(),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 Pd(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 At(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(Pd)??[],shared:t}}}function ya(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function Rd(e,t){return t.map(r=>{const n=xd(e,r.nameOrAlias);return Le(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Us({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:ya(r)}})}function _d(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function xa(e,t,r,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:a,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(l=>{const{moduleInfo:c}=l,d=t.moduleCache.get(e.name);wr(d?{origin:t,remoteInfo:c,remoteEntryExports:d.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),n){const l={rel:"preload",as:"style"};s.forEach(c=>{const{link:d,needAttach:u}=Br({url:c,cb:()=>{},attrs:l,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(d)})}else{const l={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:d,needAttach:u}=Br({url:c,cb:()=>{},attrs:l,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(d)})}if(n){const l={rel:"preload",as:"script"};a.forEach(c=>{const{link:d,needAttach:u}=Br({url:c,cb:()=>{},attrs:l,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(d)})}else{const l={fetchpriority:"high",type:e?.type==="module"?"module":"text/javascript"};a.forEach(c=>{const{script:d,needAttach:u}=Ks({url:c,cb:()=>{},attrs:l,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(d)})}}}function Id(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 wa=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 wr({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return Le(e,`remoteEntryExports is undefined
|
|
36
|
+
${Us(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}=Id(this.remoteInfo,this.host.shareScopeMap,r),l=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:a,remoteEntryInitOptions:s,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof n?.init>"u"&&Se(da,Oe,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,At(this.host.options)),await n.init(l.shareScope,l.initScope,l.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...l,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)),Le(i,`${Bt(this.remoteInfo)} remote don't export ${t}.`);const l=_c(this.remoteInfo.name,t),c=this.wraperFactory(i,l);return s?await c():c}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}}},$e=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()}},ze=class extends $e{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 ka(e,t){if(!Ln(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var wt=class extends $e{constructor(e){super(),this.onerror=Se,this.type=e}emit(e){Ln(e)||Se(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(ka(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Tn(r),this.onerror(r)}return e}},tt=class extends $e{constructor(e){super(),this.onerror=Se,this.type=e}emit(e){Ln(e)||Se(`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=>(Tn(a),this.onerror(a),e),s=a=>{if(ka(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)}},kt=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){Le(Rc(e),"Plugin configuration is invalid.");const r=e.name;Le(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){Le(e,"A name is required.");const t=this.registerPlugins[e];Le(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Na(e,t){const r=Js(t);r.url||Se(ba,Oe,{remoteName:e.name});let n=ln(t,r.url);e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function Td(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:s,remoteInfo:a,id:i}=e;if(!Dn(t)||!Ys(t)){const{remoteSnapshot:l,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Na(a,l);const d={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:d,remoteInfo:a,remote:t,remoteSnapshot:l,globalSnapshot:c});return u&&xa(a,s,u,!1),{...e,remoteSnapshot:l}}return e}}}function Dd(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 Sa(e,t,r,n,s={},a){const{value:i}=Mt(e,Bt(t)),l=a||i;if(l&&!Vs(l)&&(r(l,t,n),l.remotesInfo)){const c=Object.keys(l.remotesInfo);for(const d of c){if(s[d])continue;s[d]=!0;const u=Dd(d),p=l.remotesInfo[d];Sa(e,{name:u.name,version:p.matchedVersion},r,!1,s,void 0)}}}var jr=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function Ld(e,t,r,n,s){const a=[],i=[],l=[],c=new Set,d=new Set,{options:u}=e,{preloadConfig:p}=t,{depsRemote:h}=p;if(Sa(n,r,(b,v,x)=>{let y;if(x)y=p;else if(Array.isArray(h)){const A=h.find(_=>_.nameOrAlias===v.name||_.nameOrAlias===v.alias);if(!A)return;y=ya(A)}else if(h===!0)y=p;else return;const w=ln(b,Js(b).url);w&&l.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=_d(y.exposes);M.length&&"modules"in b&&(k=b?.modules?.reduce((A,_)=>(M?.indexOf(_.moduleName)!==-1&&A.push(_),A),[]));function C(A){const _=A.map(P=>ln(b,P));return y.filter?_.filter(y.filter):_}if(k){const A=k.length;for(let _=0;_<A;_++){const P=k[_],Q=`${v.name}/${P.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:P.moduleName==="."?v.name:Q,name:v.name,remoteSnapshot:b,preloadConfig:y,remote:v,origin:e}),!Bc(Q)&&(y.resourceCategory==="all"?(a.push(...C(P.assets.css.async)),a.push(...C(P.assets.css.sync)),i.push(...C(P.assets.js.async)),i.push(...C(P.assets.js.sync))):y.resourceCategory==="sync"&&(a.push(...C(P.assets.css.sync)),i.push(...C(P.assets.js.sync))),zc(Q))}}},!0,{},s),s.shared&&s.shared.length>0){const b=(v,x)=>{const{shared:y}=hr(e.shareScopeMap,x.sharedName,v,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(x.assets.js.sync.forEach(w=>{c.add(w)}),x.assets.css.sync.forEach(w=>{d.add(w)}))};s.shared.forEach(v=>{const x=u.shared?.[v.sharedName];if(!x)return;const y=v.version?x.find(w=>w.version===v.version):x;y&&Xs(y).forEach(w=>{b(w,v)})})}const g=i.filter(b=>!c.has(b)&&!jr("script",b));return{cssAssets:a.filter(b=>!d.has(b)&&!jr("link",b)),jsAssetsWithoutEntry:g,entryAssets:l.filter(b=>!jr("script",b.url))}}var Od=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 Dn(s)&&Ys(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Na(n,i),Ld(t,r,n,a,i))}}};function Ca(e,t){const r=pr({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&Mt(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:po(),remoteSnapshot:pr({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:po(),remoteSnapshot:pr({name:e.name,version:"version"in e?e.version:void 0})}}var $d=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new kt({beforeLoadRemoteSnapshot:new ze("beforeLoadRemoteSnapshot"),loadSnapshot:new tt("loadGlobalSnapshot"),loadRemoteSnapshot:new tt("loadRemoteSnapshot"),afterLoadSnapshot:new tt("afterLoadSnapshot")}),this.manifestLoading=zt.__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=pr({name:this.HostInstance.options.name,version:this.HostInstance.options.version});s||(s={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},Oc({[this.HostInstance.options.name]:s})),s&&"remotesInfo"in s&&!Mt(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:l}=this.getGlobalRemoteInfo(e),{remoteSnapshot:c,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:a,remoteSnapshot:i,globalSnapshot:l});let u,p;if(c)if(Vs(c)){const h=c.remoteEntry,g=await this.getManifestJson(h,e,{}),b=fo({...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:c,from:"global"});u=h,p=d}else if(Dn(e)){const h=await this.getManifestJson(e.entry,e,{}),g=fo(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 Se(ma,Oe,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(d)},void 0,At(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 Ca(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,{},kr(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],Se(ua,Oe,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,At(this.HostInstance.options)))}return Le(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=yc(a,{version:e}),{remoteSnapshot:l}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:a,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return l};return this.manifestLoading[e]||(this.manifestLoading[e]=s().then(a=>a)),this.manifestLoading[e]}},Bd=class{constructor(e){this.hooks=new kt({beforeRegisterShare:new wt("beforeRegisterShare"),afterResolve:new tt("afterResolve"),beforeLoadShare:new tt("beforeLoadShare"),loadShare:new ze,resolveShare:new wt("resolveShare"),initContainerShareScopeMap:new wt("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=ia(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=yo({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n?.scope&&await Promise.all(n.scope.map(async l=>{await Promise.all(this.initializeSharing(l,{strategy:n.strategy}))}));const{shareInfo:s}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});Le(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}=hr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(a){const l=tr(a,i);if(l.lib)return bt(l,r.options.name),l.lib;if(l.loading&&!l.loaded){const c=await l.loading;return l.loaded=!0,l.lib||(l.lib=c),bt(l,r.options.name),c}else{const d=(async()=>{const u=await l.get();return bt(l,r.options.name),l.loaded=!0,l.lib=u,u})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:d,treeShaking:i?l:void 0}),d}}else{if(t?.customShareInfo)return!1;const l=Ft(s.treeShaking),c=tr(s,l),u=(async()=>{const p=await c.get();c.lib=p,c.loaded=!0,bt(c,r.options.name);const{shared:h,useTreesShaking:g}=hr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(h){const b=tr(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:l?c:void 0}),u}}initializeSharing(e=Cr,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 l=this.shareScopeMap,c=r.options.name;l[e]||(l[e]={});const d=l[e],u=(h,g)=>{const{version:b,eager:v}=g;d[h]=d[h]||{};const x=d[h],y=x[b]&&tr(x[b]),w=!!(y&&("eager"in y&&y.eager||"shareConfig"in y&&y.shareConfig?.eager));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!v!=!w?v:c>x[b].from))&&(x[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=yo({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}=hr(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(s){if(typeof s.lib=="function")return bt(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 bt(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&&Se(t?.from==="build"?fa:un,Oe,{hostName:r.options.name,sharedPkgName:e},void 0,At(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}Se(un,Oe,{hostName:r.options.name,sharedPkgName:e},void 0,At(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:l}){const{version:c,scope:d="default",...u}=t,p=Array.isArray(d)?d:[d],h=g=>{const b=(x,y,w)=>{w&&!x[y]&&(x[y]=w)},v=l?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][c]||(this.shareScopeMap[g][e][c]={version:c,scope:[g],...u,lib:n});const b=this.shareScopeMap[g][e][c];h(b),r&&b.from!==r&&(b.from=r)})}_setGlobalShareScopeMap(e){const t=la(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},zd=class{constructor(e){this.hooks=new kt({beforeRegisterRemote:new wt("beforeRegisterRemote"),registerRemote:new wt("registerRemote"),beforeRequest:new tt("beforeRequest"),onLoad:new ze("onLoad"),handlePreloadModule:new $e("handlePreloadModule"),errorLoadRemote:new ze("errorLoadRemote"),beforePreloadRemote:new ze("beforePreloadRemote"),generatePreloadAssets:new ze("generatePreloadAssets"),afterPreloadRemote:new ze,loadEntry:new ze}),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:l,remote:c,expose:d,id:u,remoteSnapshot:p}=i,h=await s.get(u,d,t,p),g=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:l,expose:d,exposeModule:n?h:void 0,exposeModuleFactory:n?void 0:h,remote:c,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=Rd(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:s}=n,a=kr(s),{globalSnapshot:i,remoteSnapshot:l}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:s}),c=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:s,remoteInfo:a,globalSnapshot:i,remoteSnapshot:l});c&&xa(a,t,c)}))}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=yd(t.options.remotes,s);a||Se(pa,Oe,{hostName:t.options.name,requestId:s},void 0,At(t.options));const{remote:i}=a,l=kr(i),c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:s,...a,options:t.options,origin:t,remoteInfo:l}),{remote:d,expose:u}=c;Le(d&&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(d.name);const h={host:t,remoteInfo:l};return p||(p=new wa(h),t.moduleCache.set(d.name,p)),{module:p,moduleOptions:h,remoteMatchInfo:c}}registerRemote(e,t,r){const{host:n}=this,s=()=>{if(e.alias){const i=t.find(l=>e.alias&&(l.name.startsWith(e.alias)||l.alias?.startsWith(e.alias)));Le(!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=Cr),e.type||(e.type=pd)};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}),Hs(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;Me[i]&&(Object.getOwnPropertyDescriptor(Me,i)?.configurable?delete Me[i]:Me[i]=void 0);const l=pn(s.remoteInfo);yt[l]&&delete yt[l],t.snapshotHandler.manifestCache.delete(a.entry);let c=a.buildVersion?Qs(a.name,a.buildVersion):a.name;const d=Me.__FEDERATION__.__INSTANCES__.findIndex(p=>a.buildVersion?p.options.id===c:p.name===c);if(d!==-1){const p=Me.__FEDERATION__.__INSTANCES__[d];c=p.options.id||c;const h=la();let g=!0;const b=[];Object.keys(h).forEach(v=>{const x=h[v];x&&Object.keys(x).forEach(y=>{const w=x[y];w&&Object.keys(w).forEach(k=>{const M=w[k];M&&Object.keys(M).forEach(C=>{const A=M[C];A&&typeof A=="object"&&A.from===a.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter(_=>_!==a.name),A.useIn.length?g=!1:b.push([v,y,k,C])):b.push([v,y,k,C]))})})})}),g&&(p.shareScopeMap={},delete h[c]),b.forEach(([v,x,y,w])=>{delete h[v]?.[x]?.[y]?.[w]}),Me.__FEDERATION__.__INSTANCES__.splice(d,1)}const{hostGlobalSnapshot:u}=Ca(e,t);if(u){const p=u&&"remotesInfo"in u&&u.remotesInfo&&Mt(u.remotesInfo,e.name).key;p&&(delete u.remotesInfo[p],zt.__FEDERATION__.__MANIFEST_LOADING__[p]&&delete zt.__FEDERATION__.__MANIFEST_LOADING__[p])}t.moduleCache.delete(e.name)}}catch(t){dn.error(`removeRemote failed: ${t instanceof Error?t.message:String(t)}`)}}},Fd=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0,Ma=class{constructor(e){this.hooks=new kt({beforeInit:new wt("beforeInit"),init:new $e,beforeInitContainer:new tt("beforeInitContainer"),initContainer:new tt("initContainer")}),this.version="2.4.0",this.moduleCache=new Map,this.loaderHook=new kt({getModuleInfo:new $e,createScript:new $e,createLink:new $e,fetch:new ze,loadEntryError:new ze,getModuleFactory:new ze}),this.bridgeHook=new kt({beforeBridgeRender:new $e,afterBridgeRender:new $e,beforeBridgeDestroy:new $e,afterBridgeDestroy:new $e});const t=Fd?[Td(),Od()]:[],r={id:Ed(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:Gs};this.name=e.name,this.options=r,this.snapshotHandler=new $d(this),this.sharedHandler=new Bd(this),this.remoteHandler=new zd(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&&Se(Zs(ga,Oe)),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=Cr,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=kr({name:e,entry:t}),s=new wa({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}=ia(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),l=[...s.plugins];n.plugins&&n.plugins.forEach(d=>{l.includes(d)||l.push(d)});const c={...e,...t,plugins:l,remotes:a,shared:i,id:n.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){const t=Ad(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 jd(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Gd(e,t){const r=jd();return Me.__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 Qd(e){const t=new(Tc()||Ma)({id:`${e.name}@${e.version||Date.now()}`,...e});return Ic(t),t}var Fe=null;function Hd(e){const t=Gd(e.name,e.version),r={...e,id:e.id||""};return t?(t.initOptions(r),Fe||(Fe=t),t):(Fe=Qd(r),Fe)}function Ud(...e){return Le(Fe,Bn,Oe),Fe.loadRemote.apply(Fe,e)}function Vd(...e){return Le(Fe,Bn,Oe),Fe.registerRemotes.apply(Fe,e)}function qd(){return Fe}Dc(Ma);function Nt(e){const t=(typeof globalThis<"u"?globalThis:void 0)?.[e];return t&&typeof t=="object"?t:{}}var Wd={singleton:!0,requiredVersion:!1,eager:!0},He=e=>({version:"0.0.0",scope:"default",lib:e,shareConfig:Wd}),xo="__mf_module_cache__";function Kd(){const e=globalThis,t=e[xo];if(t&&typeof t=="object"){const n=t;return n.share??={},n.remote??={},n}const r={share:{},remote:{}};return e[xo]=r,r}function Zd(){const e=Kd();e.share.react??=ds,e.share["react-dom"]??=ps,e.share["react-dom/client"]??=fs,e.share["react/jsx-runtime"]??=us,e.share["@tanstack/react-query"]??=hs,e.share["@trpc/client"]??=vs,e.share["@trpc/react-query"]??=ys,e.share["@camstack/ui-library"]??=Nt("__camstackUiLibrary"),e.share["@camstack/sdk"]??=Nt("__camstackSdk"),e.share["@camstack/types"]??=Nt("__camstackTypes")}function Yd(){Zd(),qd()===null&&Hd({name:"admin_ui_host",remotes:[],shared:{react:He(()=>ds),"react-dom":He(()=>ps),"react-dom/client":He(()=>fs),"react/jsx-runtime":He(()=>us),"@tanstack/react-query":He(()=>hs),"@trpc/client":He(()=>vs),"@trpc/react-query":He(()=>ys),"@camstack/ui-library":He(()=>Nt("__camstackUiLibrary")),"@camstack/sdk":He(()=>Nt("__camstackSdk")),"@camstack/types":He(()=>Nt("__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 Ea=(...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 Xd=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 Jd=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 wo=e=>{const t=Jd(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 eu={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 tu=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=Te(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:i,...l},c)=>$t("svg",{ref:c,...eu,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ea("lucide",s),...!a&&!tu(l)&&{"aria-hidden":"true"},...l},[...i.map(([d,u])=>$t(d,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=Te(({className:n,...s},a)=>$t(ru,{ref:a,iconNode:t,className:Ea(`lucide-${Xd(wo(e))}`,`lucide-${e}`,n),...s}));return r.displayName=wo(e),r},et=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"}]]),nu=R("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),ou=R("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),su=R("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),zn=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"}]]),au=R("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),iu=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"}]]),lu=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"}]]),cu=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"}]]),Aa=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"}]]),du=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"}]]),Mr=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"}]]),uu=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"}]]),Fn=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"}]]),pu=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"}]]),Vt=R("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),pt=R("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),fu=R("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),st=R("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Er=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"}]]),mu=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"}]]),hu=R("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),gu=R("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),bu=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"}]]),Pa=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"}]]),yu=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"}]]),xu=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"}]]),at=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"}]]),wu=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"}]]),Ra=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"}]]),ku=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"}]]),_a=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"}]]),fn=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"}]]),Ia=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"}]]),Ta=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"}]]),Da=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"}]]),qt=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"}]]),La=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"}]]),Nu=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"}]]),Oa=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"}]]),Su=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"}]]),Cu=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"}]]),Mu=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"}]]),Eu=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"}]]),$a=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"}]]),Ge=R("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Au=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"}]]),ko=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"}]]),Pu=R("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),Ba=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"}]]),No=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"}]]),za=R("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),jn=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"}]]),Ru=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"}]]),mn=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"}]]),_u=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"}]]),hn=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"}]]),Wt=R("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Iu=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"}]]),Tu=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"}]]),Fa=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"}]]),Du=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"}]]),Gn=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"}]]),ja=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"}]]),Ga=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"}]]),Lu=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"}]]),Ou=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"}]]),$u=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"}]]),Gt=R("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Bu=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"}]]),zu=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"}]]),Fu=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"}]]),ju=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"}]]),So=R("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Gu=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"}]]),Qa=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"}]]),Qu=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"}]]),Co=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"}]]),Hu=R("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),Uu=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"}]]),qe=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"}]]),Vu=R("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),qu=R("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),Kt=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"}]]),Ha=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"}]]),Wu=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"}]]),Ua=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"}]]),Qn=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"}]]),Pe=R("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Mo=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"}]]),Ku=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"}]]),Zu=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"}]]),ib={frigate:Fu,scrypted:zu,reolink:Du,homeAssistant:Oa,rtsp:pu},lb={online:hu,offline:yu,degraded:Er,unknown:Pa},Eo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ao=Ms,ft=(e,t)=>r=>{var n;if(t?.variants==null)return Ao(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(c=>{const d=r?.[c],u=a?.[c];if(d===null)return null;const p=Eo(d)||Eo(u);return s[c][p]}),l=r&&Object.entries(r).reduce((c,d)=>{let[u,p]=d;return p===void 0||(c[u]=p),c},{});return Ao(e,i,t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,d)=>{let{class:u,className:p,...h}=d;return Object.entries(h).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...a,...l}[b]):{...a,...l}[b]===v})?[...c,u,p]:c},[]),r?.class,r?.className)},Yu=ft("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"}}),gr=Te(({className:e,variant:t,size:r,...n},s)=>o("button",{ref:s,className:N(Yu({variant:t,size:r}),e),...n}));gr.displayName="Button";var Xu=ft("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"}}),Va=Te(({className:e,variant:t,size:r,icon:n,...s},a)=>o("button",{ref:a,className:N(Xu({variant:t,size:r}),e),...s,children:o(n,{className:"h-4 w-4"})}));Va.displayName="IconButton";var Ju=ft("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"}}),Lt=Te(({className:e,variant:t,style:r,...n},s)=>o("span",{ref:s,className:N(Ju({variant:t,styleVariant:r}),e),...n}));Lt.displayName="Badge";var ep=ft("rounded-lg p-3",{variants:{variant:{flat:"bg-surface",bordered:"bg-surface border border-border"}},defaultVariants:{variant:"bordered"}}),qa=Te(({className:e,variant:t,...r},n)=>o("div",{ref:n,className:N(ep({variant:t}),e),...r}));qa.displayName="Card";function tp({expanded:e,onExpandedChange:t,header:r,children:n,dimmed:s=!1,hideChevron:a=!1,className:i}){return f("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden",s&&"opacity-[0.45]",i),children:[f("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:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(!e))},children:[!a&&o("span",{className:"text-foreground-subtle shrink-0",children:e?o(pt,{className:"h-4 w-4"}):o(st,{className:"h-4 w-4"})}),r]}),e&&n&&o("div",{className:"border-t border-border px-3 py-3",children:n})]})}var Wa=Te(({className:e,...t},r)=>o("label",{ref:r,className:N("text-[10px] uppercase tracking-wider text-foreground-muted font-medium",e),...t}));Wa.displayName="Label";var rp=ft("",{variants:{orientation:{horizontal:"h-px w-full bg-border-subtle",vertical:"w-px h-full bg-border-subtle"}},defaultVariants:{orientation:"horizontal"}}),Ka=Te(({className:e,orientation:t,...r},n)=>o("div",{ref:n,role:"separator",className:N(rp({orientation:t}),e),...r}));Ka.displayName="Separator";var np=Te(({className:e,...t},r)=>o("div",{ref:r,className:N("animate-pulse bg-surface-hover rounded-md h-4 w-full",e),...t}));np.displayName="Skeleton";var Po=ft("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"}}),gn=Te(({className:e,state:t,leftSlot:r,rightSlot:n,...s},a)=>r||n?f("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(Po({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(Po({state:t}),e),...s}));gn.displayName="Input";var bn=Te(({className:e,options:t,...r},n)=>f("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(pt,{className:"h-3.5 w-3.5"})})]}));bn.displayName="Select";var op=Te(({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}));op.displayName="Checkbox";var sp=Te(({className:e,checked:t,onCheckedChange:r,label:n,...s},a)=>f("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})]}));sp.displayName="Switch";var Za=Ye(null);function Ya(){const e=Ae(Za);if(!e)throw new Error("Dialog compound components must be used within <Dialog>");return e}function ap({children:e,open:t,onOpenChange:r}){const[n,s]=S(!1),a=t??n,i=Ct(),l=I(c=>{r?.(c),t===void 0&&s(c)},[t,r]);return o(Za.Provider,{value:{open:a,setOpen:l,contentId:i},children:e})}function cb({children:e,...t}){const{setOpen:r}=Ya();return o("button",{type:"button",onClick:()=>r(!0),...t,children:e})}var ip=ft("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"}}),Xa=Te(({className:e,width:t,children:r,...n},s)=>{const{open:a,setOpen:i,contentId:l}=Ya(),c=q(null),d=s??c;H(()=>{const p=d.current;p&&(a&&!p.open&&p.showModal(),!a&&p.open&&p.close())},[a,d]);const u=p=>{p.target===p.currentTarget&&i(!1)};return o("dialog",{ref:d,id:l,className:N(ip({width:t}),"w-full",e),onClick:u,onClose:()=>i(!1),...n,children:r})});Xa.displayName="DialogContent";function lp({className:e,...t}){return o("div",{className:N("flex flex-col gap-1 mb-3",e),...t})}function cp({className:e,...t}){return o("div",{className:N("flex justify-end gap-2 mt-4",e),...t})}function dp({className:e,...t}){return o("h2",{className:N("text-sm font-semibold text-foreground",e),...t})}function up({className:e,...t}){return o("p",{className:N("text-xs text-foreground-muted",e),...t})}var Ja=Ye(null);function Hn(){const e=Ae(Ja);if(!e)throw new Error("Dropdown compound components must be used within <Dropdown>");return e}function db({children:e}){const[t,r]=S(!1),n=Ct(),s=Ct(),a=q(null);return o(Ja.Provider,{value:{open:t,setOpen:r,triggerId:n,contentId:s,triggerRef:a},children:o("div",{className:"relative inline-block",children:e})})}function ub({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a,triggerRef:i}=Hn();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 pb({className:e,children:t,align:r="start",offset:n=4,...s}){const{open:a,setOpen:i,contentId:l,triggerId:c,triggerRef:d}=Hn(),u=q(null),[p,h]=S(null);return el(()=>{if(!a){h(null);return}const g=()=>{const b=d.current;if(!b)return;const v=b.getBoundingClientRect(),x=r==="end"?v.right:v.left;h({top:v.bottom+n,left:x,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,d]),H(()=>{if(!a)return;const g=v=>{const x=u.current,y=d.current;x&&!x.contains(v.target)&&!y?.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,d]),!a||!p||typeof document>"u"?null:Sr(o("div",{ref:u,id:l,role:"menu","aria-labelledby":c,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 fb({className:e,icon:t,variant:r="default",children:n,onClick:s,...a}){const{setOpen:i}=Hn(),l=I(c=>{s?.(c),i(!1)},[s,i]);return f("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:l,...a,children:[t&&o(t,{size:14}),n]})}var ei=Ye(null);function ti(){const e=Ae(ei);if(!e)throw new Error("Tooltip compound components must be used within <Tooltip>");return e}function mb({children:e}){const[t,r]=S(!1),n=q(null),s=Ct(),a=()=>{n.current=setTimeout(()=>r(!0),300)},i=()=>{n.current&&clearTimeout(n.current),r(!1)};return o(ei.Provider,{value:{open:t,show:a,hide:i,tooltipId:s},children:o("div",{className:"relative inline-block",children:e})})}function hb({children:e,...t}){const{show:r,hide:n,tooltipId:s,open:a}=ti();return o("div",{onMouseEnter:r,onMouseLeave:n,onFocus:r,onBlur:n,"aria-describedby":a?s:void 0,...t,children:e})}function gb({className:e,children:t,...r}){const{open:n,tooltipId:s}=ti();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 Ro="(max-width: 767px)",_o="(min-width: 768px) and (max-width: 1023px)";function ri(e){return t=>{const r=window.matchMedia(e);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)}}function ni(e){return()=>window.matchMedia(e).matches}function oi(){return!1}function Ar(){return Pn(ri(Ro),ni(Ro),oi)}function bb(){return Pn(ri(_o),ni(_o),oi)}function si({open:e,onClose:t,title:r,children:n,className:s}){return H(()=>{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]),f(Ne,{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"}),f("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&&f("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(Pe,{className:"h-4 w-4"})})]}),o("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:n})]})]})}var ai=Ye(null);function ii(){const e=Ae(ai);if(!e)throw new Error("Popover compound components must be used within <Popover>");return e}function pp({children:e,open:t,onOpenChange:r}){const[n,s]=S(!1),a=t??n,i=Ct(),l=Ct(),c=I(d=>{r?.(d),t===void 0&&s(d)},[t,r]);return o(ai.Provider,{value:{open:a,setOpen:c,triggerId:i,contentId:l},children:o("div",{className:"relative inline-block",children:e})})}function fp({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a}=ii();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 mp({className:e,children:t,...r}){const{open:n,setOpen:s,contentId:a,triggerId:i}=ii(),l=Ar(),c=q(null);return H(()=>{if(!n||l)return;const d=p=>{const h=c.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",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u)}},[n,s,i,l]),n?l?o(si,{open:n,onClose:()=>s(!1),children:t}):o("div",{ref:c,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 li=Ye(null);function ci(){const e=Ae(li);if(!e)throw new Error("Tabs compound components must be used within <Tabs>");return e}function vb({value:e,onValueChange:t,defaultValue:r="",className:n,...s}){const[a,i]=S(r),l=e??a,c=I(d=>{t?.(d),e===void 0&&i(d)},[e,t]);return o(li.Provider,{value:{value:l,setValue:c},children:o("div",{className:n,...s})})}function yb({className:e,...t}){return o("div",{role:"tablist",className:N("flex flex-row border-b border-border-subtle",e),...t})}function xb({value:e,className:t,...r}){const{value:n,setValue:s}=ci(),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 wb({value:e,className:t,...r}){const{value:n}=ci();return e!==n?null:o("div",{role:"tabpanel",id:`tabpanel-${e}`,className:N("pt-3",t),...r})}var di=Te(({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}));di.displayName="ScrollArea";function kb({title:e,onClose:t,children:r,defaultWidth:n=360,defaultHeight:s=280,minWidth:a=280,minHeight:i=160,offsetIndex:l=0,className:c}){const[d,u]=S({x:80+l*30,y:80+l*30}),[p,h]=S({w:n,h:s}),[g,b]=S(!1),v=q(!1),x=q(!1),y=q({x:0,y:0}),w=Ar(),k=I(C=>{C.preventDefault(),v.current=!0,y.current={x:C.clientX-d.x,y:C.clientY-d.y}},[d]),M=I(C=>{C.preventDefault(),C.stopPropagation(),x.current=!0,y.current={x:C.clientX,y:C.clientY}},[]);return H(()=>{const C=_=>{if(v.current&&u({x:_.clientX-y.current.x,y:_.clientY-y.current.y}),x.current){const P=_.clientX-y.current.x,Q=_.clientY-y.current.y;y.current={x:_.clientX,y:_.clientY},h(oe=>({w:Math.max(a,oe.w+P),h:Math.max(i,oe.h+Q)}))}},A=()=>{v.current=!1,x.current=!1};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",A)}},[a,i]),w?f("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",c),style:{maxHeight:"60dvh"},children:[f("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}),f("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(ko,{size:12}):o(No,{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(Pe,{size:12})})]})]}),!g&&o("div",{className:"flex-1 min-h-0 overflow-y-auto",children:r})]}):f("div",{className:N("fixed z-50 rounded-lg border border-border bg-background-elevated shadow-2xl flex flex-col overflow-hidden",c),style:{left:d.x,top:d.y,width:g?280:p.w,height:g?"auto":p.h},children:[f("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:[f("div",{className:"flex items-center gap-2 min-w-0",children:[o(Nu,{size:12,className:"text-foreground-subtle shrink-0"}),o("span",{className:"text-[11px] font-medium truncate",children:e})]}),f("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(ko,{size:12}):o(No,{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(Pe,{size:12})})]})]}),!g&&f("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=q(null);return H(()=>{if(!e)return;const i=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",i),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}},[e,t]),f(Ne,{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 Nb({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 f(Ji.Fragment,{children:[n>0&&o(st,{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 Io={left:"text-left",right:"text-right",center:"text-center"};function Sb({columns:e,rows:t,rowKey:r,onRowClick:n,minWidthPx:s=480,emptyMessage:a,className:i,bordered:l=!0,rowClassName:c}){return t.length===0&&a?o("div",{className:`rounded-lg ${l?"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 ${l?"border border-border":""} bg-surface overflow-x-auto ${i??""}`,children:f("table",{className:"w-full text-xs",style:{minWidth:`${s}px`},children:[o("thead",{className:"bg-surface",children:o("tr",{children:e.map(d=>{const u=d.align??"left",p=d.nowrap??!0;return o("th",{className:["px-3 py-2 text-foreground-subtle font-medium bg-surface border-b border-border",Io[u],p?"whitespace-nowrap":"",d.width??""].filter(Boolean).join(" "),children:d.headerRender?d.headerRender():d.header},d.key)})})}),o("tbody",{children:t.map((d,u)=>{const p=r?r(d,u):u,h=c?.(d,u)??"",g=n!==void 0;return o("tr",{onClick:g?()=>n(d,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",x=b.nowrap??!1;return o("td",{className:["px-3 py-2 text-foreground border-b border-border",Io[v],x?"whitespace-nowrap":""].filter(Boolean).join(" "),children:b.render(d,u)},b.key)})},p)})})]})})}function Cb({open:e,onClose:t,title:r,subtitle:n,footer:s,children:a,widthClass:i="w-[360px]"}){return H(()=>{if(!e)return;const l=c=>{c.key==="Escape"&&t()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,t]),e?f("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:[f("header",{className:"flex items-start justify-between gap-2 px-4 py-3 border-b border-border",children:[f("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(Pe,{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 gp={inherit:"bg-muted",on:"bg-emerald-500",off:"bg-orange-500",na:"bg-gray-300 opacity-50"};function ui({node:e,depth:t,selectedAddonId:r,onSelect:n,agentDots:s}){const a=e.addonId===r,i=s?.[e.addonId]??[];return f("div",{children:[f("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(l=>o("span",{title:`${l.agentNodeId}: ${l.state}`,className:N("w-2 h-2 rounded-full",gp[l.state])},l.agentNodeId))})]}),e.children.map(l=>o(ui,{node:l,depth:t+1,selectedAddonId:r,onSelect:n,agentDots:s},l.addonId))]})}function Mb({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(ui,{node:a,depth:0,selectedAddonId:t,onSelect:r,agentDots:n},a.addonId))})}function Eb(e){const t=[],r=[],n=new Map;for(const a of e.slots)for(const i of a.addons){const l={addonId:i.id,addonName:i.name,slot:i.slot,inputClasses:i.inputClasses,outputClasses:i.outputClasses,children:[]};i.slot==="audio-classifier"?t.push(l):(r.push(l),n.set(i.id,l))}const s=[];for(const a of r){if(a.inputClasses.length===0){s.push(a);continue}const i=r.find(l=>l.addonId!==a.addonId&&l.outputClasses.some(c=>a.inputClasses.includes(c)));i&&i.children.push(a)}return[...s,...t]}function bp(e){return e?e.models.map(t=>({id:t.id,name:t.name})):[]}function Gr({step:e,schema:t,allSchemas:r,depth:n=0,onChange:s,onDelete:a,readOnly:i=!1,toggleMode:l="simple",overrideState:c=null,onOverrideChange:d,inheritedEnabled:u,hideModelAndSettings:p=!1}){const[h,g]=S(!1),b=bp(t);if(b.length>0&&!b.some(x=>x.id===e.modelId)&&!i){const x=(t?.defaultModelId?b.find(y=>y.id===t.defaultModelId):null)??b[0];x&&x.id!==e.modelId&&queueMicrotask(()=>s({...e,modelId:x.id}))}const v=f(Ne,{children:[f("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}),f("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.inputClasses.map(x=>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:x},x)),e.inputClasses.length>0&&e.outputClasses.length>0&&o("span",{className:"text-foreground-subtle/40 text-[10px]",children:"→"}),e.outputClasses.map(x=>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:x},x))]})]}),!i&&l==="simple"&&o("button",{onClick:x=>{x.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&&l==="threeState"&&d&&f("div",{className:"flex items-center gap-0.5 rounded-md border border-border p-0.5",onClick:x=>x.stopPropagation(),children:[o(Qr,{label:"Inherit",active:c===null,variant:"inherit",subtext:u===void 0?void 0:u?"on":"off",onClick:()=>d(null)}),o(Qr,{label:"On",active:c===!0,variant:"on",onClick:()=>d(!0)}),o(Qr,{label:"Off",active:c===!1,variant:"off",onClick:()=>d(!1)})]})]});return o(tp,{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."}):f("div",{className:"space-y-3",children:[o(vn,{label:"Model",value:e.modelId,disabled:i,options:b.map(x=>({value:x.id,label:x.name})),onChange:x=>s({...e,modelId:x})}),e.slot==="audio-classifier"&&e.engine&&o(vn,{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:x=>{const[y,w]=x.split("/");s({...e,engine:{runtime:y,backend:w,format:w==="coreml"?"coreml":"onnx"}})}}),t?.configSchema?.map(x=>o(Un,{field:x,allFields:t.configSchema??[],step:e,disabled:i,onChange:s},x.key))]})})}function vn({label:e,value:t,options:r,disabled:n,onChange:s}){return f("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1.5",children:e}),f("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 vp({label:e,description:t,value:r,options:n,disabled:s,onChange:a}){function i(l){s||a(r.includes(l)?r.filter(c=>c!==l):[...r,l])}return f("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(l=>o("button",{type:"button",disabled:s,onClick:()=>i(l.value),className:N("text-[10px] font-medium px-2 py-1 rounded-md border transition-colors",r.includes(l.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:l.label},l.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 Un({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:l,equals:c,notEquals:d,in:u,notIn:p}=a,h=yp(l,r,t);if(c!==void 0&&h!==c||d!==void 0&&h===d||u!==void 0&&!u.includes(h)||p!==void 0&&p.includes(h))return null}function i(l){s({...r,settings:{...r.settings,[e.key]:l}})}if(e.type==="select"){const l=r.settings?.[e.key],c=typeof l=="string"?l:e.default??"";return o(vn,{label:e.label,value:c,disabled:n||e.disabled,options:e.options,onChange:i})}if(e.type==="multiselect"){const l=r.settings?.[e.key],c=Array.isArray(l)?l:Array.isArray(e.default)?e.default:[];return o(vp,{label:e.label,description:e.description,value:c,options:e.options,disabled:n||e.disabled,onChange:i})}if(e.type==="slider"||e.type==="number"){const l=r.settings?.[e.key],c=typeof e.default=="number"?e.default:e.min??0,d=typeof l=="number"?l:c,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,x=v?d/v:d;return f("div",{children:[f("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&&f("span",{className:"text-xs font-medium text-foreground tabular-nums",children:[typeof x=="number"?x.toFixed(2).replace(/\.?0+$/,""):x,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:d,disabled:n||e.disabled,onChange:y=>i(Number(y.target.value)),className:"w-full accent-primary h-1.5"})]})}if(e.type==="boolean"){const l=r.settings?.[e.key];return f("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:typeof l=="boolean"?l:e.default===!0,disabled:n||e.disabled,onChange:c=>i(c.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 l=r.settings?.[e.key],c=typeof l=="string"?l:e.default??"",d=e.type==="password"?"password":"text";return f("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:c,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:d,value:c,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 Qr({label:e,active:t,variant:r,subtext:n,onClick:s}){return f("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&&f("span",{className:"ml-1 opacity-60",children:["(",n,")"]})]})}function pi(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 xp(e,t,r){return r?{enabled:r.enabled??t.enabled,modelId:r.modelId??t.modelId,settings:r.settings??t.settings}:t}function wp({addon:e,agentDefault:t,modelsForFormat:r,onChangeAgentConfig:n}){const s=a=>{n?.({...t,...a})};return f("div",{className:"space-y-4 text-xs",children:[f("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:t.enabled,onChange:a=>s({enabled:a.target.checked})}),f("span",{children:["Enabled on this agent (",e.name,")"]})]}),f("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&&f("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(Un,{field:a,allFields:e.configSchema??[],step:pi(e,t),disabled:!1,onChange:i=>s({settings:{...i.settings}})},a.key))]})]})}function kp({addon:e,agentDefault:t,agentNodeId:r,currentPatch:n,modelsForFormat:s,onChangePatch:a}){const i=xp("device",t,n),l=g=>{const b=g.enabled!==void 0||g.modelId!==void 0||g.settings!==void 0;a?.(b?g:null)},c=g=>{const{enabled:b,...v}=n??{};l(g==="inherit"?v:{...v,enabled:g==="on"})},d=g=>{const{modelId:b,...v}=n??{};l(g===void 0?v:{...v,modelId:g})},u=g=>{const{settings:b,...v}=n??{};l(g===void 0?v:{...v,settings:g})},p=n?.enabled===void 0?"inherit":n.enabled?"on":"off",h=n?.modelId!==void 0;return f("div",{className:"space-y-4 text-xs",children:[f("div",{className:"flex items-center gap-1",children:[["inherit","on","off"].map(g=>o("button",{type:"button",onClick:()=>c(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)),f("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["agent default: ",o("span",{className:"font-semibold",children:t.enabled?"on":"off"})]})]}),f("div",{children:[f("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:()=>d(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>d(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=>d(g.target.value),children:s.map(g=>o("option",{value:g.id,children:g.name},g.id))}),!h&&f("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 f("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[f("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(Un,{field:b,allFields:e.configSchema??[],step:pi(e,i),disabled:!g,onChange:v=>u({...v.settings})},b.key)),!g&&f("div",{className:"text-[10px] text-foreground-subtle",children:["inherits from ",r]})]})})(),f("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"}),f("div",{className:"font-mono truncate",children:[e.id," · model: ",i.modelId," · ",i.enabled?"on":"off"]})]})]})}function Ab(e){const{mode:t,addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,onChangeAgentConfig:i,onChangePatch:l,engineFormat:c}=e,d=ee(()=>r.models.filter(u=>!!u.formats[c]),[r.models,c]);return t==="agent"?o(wp,{addon:r,agentDefault:n,modelsForFormat:d,onChangeAgentConfig:i}):o(kp,{addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,modelsForFormat:d,onChangePatch:l})}function Np(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 To={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 Sp({slot:e}){const t=To[e]??To.classifier;return o("span",{className:N("text-[9px] font-semibold uppercase tracking-widest leading-none",t.className),children:t.label})}var Do="inline-flex items-center rounded bg-muted px-1.5 py-px text-[9px] font-medium text-foreground-subtle";function Cp({inputs:e,outputs:t}){return e.length===0&&t.length===0?null:f("span",{className:"inline-flex items-center gap-1 flex-wrap",children:[e.map(r=>o("span",{className:N(Do,"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(Do,"bg-emerald-500/10 text-emerald-500"),children:r},`out-${r}`))]})}function Mp({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 Ep(e){return e.kind==="enabled"?f("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"?f("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"]}):f("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 Ap({node:e,depth:t,agents:r,getCellState:n,onCellClick:s,selectedCell:a,toggleProps:i}){return f(Ne,{children:[f("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:[f("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[o(Sp,{slot:e.slot}),f("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"font-semibold truncate",children:e.addonName}),o(Cp,{inputs:e.inputClasses,outputs:e.outputClasses})]})]}),i&&o("span",{className:"pl-2 pt-0.5 shrink-0",children:o(Mp,{enabled:i.enabled,onChange:i.onChange,disabled:i.disabled})})]}),r.map(l=>{const c=n(e.addonId,l.agentNodeId),d=a?.addonId===e.addonId&&a.agentNodeId===l.agentNodeId;return o("button",{type:"button",onClick:()=>s(e.addonId,l.agentNodeId),className:N("text-left px-3 py-1.5 border-b border-l border-border text-xs hover:bg-muted/40",c.kind==="enabled"&&"bg-emerald-500/5",c.kind==="na"&&"bg-muted/30",d&&"ring-2 ring-primary ring-inset"),children:Ep(c)},l.agentNodeId)})]})}function Pb({tree:e,agents:t,getCellState:r,onCellClick:n,selectedCell:s,onToggleEnabled:a}){const i=ee(()=>Np(e),[e]),l=`minmax(320px, 1fr) repeat(${t.length}, minmax(160px, 220px))`,c=a!==void 0&&t.length===1,d=t[0]?.agentNodeId;return o("div",{className:"overflow-auto border border-border rounded",children:f("div",{className:"grid",style:{gridTemplateColumns:l},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=>f("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=c&&d!==void 0?r(u.addonId,d):null;return o(Ap,{node:u,depth:p,agents:t,getCellState:r,onCellClick:n,selectedCell:s,toggleProps:c&&h!==null?{enabled:h.kind==="enabled",onChange:g=>a?.(u.addonId,g),disabled:h.kind==="na"}:void 0},u.addonId)})]})})}var fi=typeof globalThis<"u"?globalThis.__camstackTrpcReact:void 0,m=fi??ll();typeof globalThis<"u"&&!fi&&(globalThis.__camstackTrpcReact=m);var Vn=ot("camstack:system",null);function Pp({system:e,children:t}){return o(Vn.Provider,{value:e,children:t})}function Rt(){const e=Ae(Vn);if(!e)throw new Error("useSystem(): no <SystemProvider> in tree");return e}function Rb(){return Ae(Vn)}function Pr(e,t){const r=Rt(),n=q(t);n.current=t;const[s,a]=S(r.connectionVersion);H(()=>r.subscribeConnectionEvents((i,l)=>{i==="connected"&&a(l)}),[r]),H(()=>r.subscribeEvent(e,i=>{n.current(i)}),[r,e,s])}function yn(e){const t=q(e);return t.current=e,t}function mi(e,t){const[r,n]=S(null),s=yn(t);return Pr(e,a=>{const i=a.data,l=s.current;l&&!l(i)||n(i)}),r}function _b(e,t,r){const[n,s]=S(()=>new Map),a=yn(t),i=yn(r);return Pr(e,l=>{const c=l.data,d=i.current;if(d&&!d(c))return;const u=a.current(c);s(p=>{const h=new Map(p);return h.set(u,c),h})}),{map:n,values:ee(()=>Array.from(n.values()),[n])}}function qn(){const{data:e,isLoading:t}=m.nodes.topology.useQuery(void 0,{staleTime:6e4}),r=mi("cluster.topology-snapshot")?.nodes??e;return{nodes:ee(()=>{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 Ib({selectedNodeId:e,onSelect:t,label:r="Node",hideIcon:n=!1,alwaysShow:s=!1}){const{nodes:a}=qn();return!s&&a.length<=1?null:f("div",{className:"flex items-center gap-1.5",children:[!n&&o(Bu,{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,l)=>{const c=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",c?"bg-primary/15 text-primary":"bg-transparent text-foreground-subtle hover:bg-surface-hover hover:text-foreground",l>0&&"border-l border-border",!i.isOnline&&"opacity-50 cursor-not-allowed"),children:i.shortName},i.id)})})]})}var Rp={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 Tb({status:e,showDot:t=!0,showLabel:r=!0,size:n="sm",className:s}){const a=Rp[e];return f("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 _p={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 Db({provider:e,showLabel:t=!0,className:r}){const n=_p[e];return f("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 Ip={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 Tp({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",Ip[t],n),children:e})}function Lb({version:e,preRelease:t,className:r}){return o(Tp,{variant:t??/-(alpha|beta|rc|dev|canary|next)/i.test(e)?"warning":"success",mono:!0,className:r,children:e})}function Ob({label:e,description:t,error:r,required:n,children:s,orientation:a="vertical",className:i}){const l=a==="horizontal";return f("div",{className:N("flex gap-2",l?"flex-row items-center justify-between":"flex-col",i),children:[f("div",{className:N(l?"flex-1":""),children:[f(Wa,{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(l?"shrink-0":""),children:s}),r&&o("p",{className:"text-danger text-xs",children:r})]})}function $b({title:e,subtitle:t,actions:r,className:n}){return f("div",{className:N("flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between",n),children:[f("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 Bb({icon:e,title:t,description:r,action:n,className:s}){return f("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"}),f("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 hi=ot("camstack:confirm-dialog",null);function Wn(){const e=Ae(hi);if(!e)throw new Error("useConfirm must be used within ConfirmDialogProvider");return e.confirm}function zb({children:e}){const[t,r]=S(null),n=I(c=>new Promise(d=>{r({...c,resolve:d})}),[]),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"}},l=t?i[t.variant??"default"]:i.default;return f(hi.Provider,{value:{confirm:n},children:[e,t&&f("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}),f("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:c=>c.stopPropagation(),children:[f("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})]}),f("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 ${l.button}`,children:t.confirmLabel??"Confirm"})]})]})]})]})}function Fb({value:e,label:t,trend:r,className:n}){return f(qa,{className:N("flex flex-col gap-1",n),children:[f("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"text-2xl font-semibold text-foreground",children:e}),r&&f("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(Vu,{className:"h-3 w-3"}):o(qu,{className:"h-3 w-3"}),r.value,"%"]})]}),o("span",{className:"text-xs text-foreground-muted",children:t})]})}function jb({items:e,className:t}){return o("dl",{className:N("flex flex-col",t),children:e.map(r=>f("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 Gb({children:e,maxHeight:t=300,className:r}){const[n,s]=S(!1),a=I(()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})},[e]);return f("div",{className:N("relative group",r),children:[o(di,{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(Va,{icon:n?Vt:at,"aria-label":"Copy code",variant:"ghost",size:"sm",onClick:a})})]})}function Qb({filters:e,values:t,onChange:r,className:n}){const s=Ar(),[a,i]=S(!1),l=(d,u)=>{r({...t,[d]:u})},c=Object.values(t).filter(d=>d!==void 0&&d!=="").length;if(s){const d=e.find(p=>p.type==="search"),u=e.some(p=>p.type!=="search");return f("div",{className:N("flex items-center gap-2",n),children:[d&&o(gn,{placeholder:d.placeholder??"Search...",value:t[d.key]??"",onChange:p=>l(d.key,p.target.value),leftSlot:o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),className:"flex-1"}),u&&f(Ne,{children:[f("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(ju,{className:"h-3.5 w-3.5"}),"Filters",c>0&&o(Lt,{variant:"info",className:"ml-1 text-[10px] px-1 py-0",children:c})]}),o(si,{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 f("div",{children:[o("label",{className:"text-xs text-foreground-muted mb-1 block",children:p.label}),o(bn,{options:p.options,value:t[p.key]??"",onChange:h=>l(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:()=>l(p.key,g?void 0:h.value),children:o(Lt,{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(d=>{switch(d.type){case"search":return o(gn,{placeholder:d.placeholder??"Search...",value:t[d.key]??"",onChange:u=>l(d.key,u.target.value),leftSlot:o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),className:"w-48"},d.key);case"select":return o(bn,{options:d.options,value:t[d.key]??"",onChange:u=>l(d.key,u.target.value),className:"w-36"},d.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1",children:d.options.map(u=>{const p=t[d.key]===u.value;return o("button",{type:"button",onClick:()=>l(d.key,p?void 0:u.value),children:o(Lt,{variant:p?"info":"default",className:"cursor-pointer",children:u.label})},u.value)})},d.key);default:return null}})})}function Lo({label:e,icon:t,href:r,badge:n,active:s=!1,className:a}){return f("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(Lt,{className:"ml-auto text-[10px] px-1.5 py-0",children:n})]})}function Oo({logo:e,sections:t,footer:r,onNavigate:n,className:s}){return f("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)=>f("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(l=>o(Lo,{...l},l.href))})]},i))}),r&&r.length>0&&f("div",{className:"shrink-0 px-1 pb-1",children:[o(Ka,{className:"mb-1"}),o("div",{className:"flex flex-col gap-0.5",onClick:n,children:r.map(a=>o(Lo,{...a},a.href))})]})]})}function Hb({sidebar:e,header:t,mobileLogo:r,mobileActions:n,children:s,className:a}){const i=Ar(),[l,c]=S(!1);return f("div",{className:N("flex h-screen",a),children:[!i&&o(Oo,{...e,className:N("w-44",e.className)}),i&&o(hp,{open:l,onClose:()=>c(!1),width:"w-64",children:o(Oo,{...e,onNavigate:()=>c(!1),className:"w-full border-r-0"})}),f("div",{className:"flex flex-1 flex-col min-w-0",children:[i&&f("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:()=>c(!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(Pu,{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&&f("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((d,u)=>{const p=u===t.breadcrumbs.length-1;return f("span",{className:"flex items-center gap-1",children:[u>0&&o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),d.href&&!p?o("a",{href:d.href,className:"text-foreground-subtle hover:text-foreground transition-colors truncate",children:d.label}):o("span",{className:"text-foreground truncate",children:d.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 Dp={online:"bg-success",offline:"bg-danger",warning:"bg-warning",unknown:"bg-foreground-subtle"};function Ub({title:e,subtitle:t,status:r,selected:n,onClick:s,badges:a,actions:i,offlineAction:l,className:c}){const d=r==="offline";return f("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",d&&!n&&"opacity-50",c),children:[f("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",Dp[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?f("button",{onClick:g=>{g.stopPropagation(),u.onClick()},className:h,children:[u.icon,u.label]},p):f("span",{className:h,children:[u.icon,u.label]},p)})}),!d&&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))}),d&&l&&o("div",{className:"mt-2",onClick:u=>u.stopPropagation(),children:l})]})}function Vb({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 Lp="capability.binding-changed";function Rr(e,t){const[r,n]=S(null);return H(()=>{if(t===null){n(null);return}let s=!1;const a=async()=>{try{const l=await e.deviceManager.getBindings.query({deviceId:t});s||n(l)}catch{s||n(l=>l)}};a();const i=e.live?.onEvent.subscribe({category:Lp},{onData:l=>{const c=l.data?.source;if(!c){a();return}c.type==="device"&&c.id===t&&a()}});return()=>{s=!0,i?.unsubscribe()}},[e,t]),ee(()=>r?ul(e,r):null,[e,r])}function gi(e){const t=I(n=>e?e.subscribe(()=>n()):()=>{},[e]),r=I(()=>e?.value,[e]);return Pn(t,r,r)}function Op(e,t,r){const n=Rr(e,t);return gi(n?r(n.state):void 0)}function Zt(e){const t=Rr(e.trpc,e.deviceId),r=gi(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 qb(e){return e.parentDeviceId===null?"top-level":e.role?"accessory":"adopted"}var $p={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 Bp(e){const t=$p[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 zp={siren:Mr,floodlight:$a,spotlight:Qa,"pir-sensor":Fa,chime:Ru,autotrack:Ra,nightvision:jn,"privacy-mask":Da,doorbell:_a},Fp={camera:Fn,hub:mn,nvr:mn,light:$a,siren:Mr,switch:Uu,sensor:Fa,thermostat:Hu,button:gu,generic:Qn};function bi(e){return e.role?zp[e.role]??Qn:Fp[e.type.toLowerCase()]??Fn}var vi={"native-snapshot":Su,"two-way-audio":Ba,"pan-tilt-zoom":Ra,"ptz-autotrack":Au,"doorbell-button":_a,"motion-trigger":et,"battery-operated":Aa,rebootable:Ga},yi={"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"},jp={"native-snapshot":"snapshot",rebootable:"reboot","pan-tilt-zoom":"ptz","ptz-autotrack":"ptz-autotrack","two-way-audio":"intercom","motion-trigger":"motion-trigger"},xi=new Set(["camera","hub","nvr"]);function wi(e){return!xi.has(e.type.toLowerCase())}function $o(e){return e.role?!0:!xi.has(e.type.toLowerCase())}function ki(e){return(e.features??[]).includes("motion-trigger")}function Gp(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 Qp({trpc:e,accessoryChildren:t,adoptedChildren:r,onNavigate:n}){return f("div",{className:"border-t border-border-subtle/50",children:[r.length>0&&o(Bo,{trpc:e,label:"Adopted devices",rows:r,onNavigate:n}),t.length>0&&o(Bo,{trpc:e,label:"Accessories",rows:t,onNavigate:n})]})}function Bo({trpc:e,label:t,rows:r,onNavigate:n}){return f("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(Hp,{trpc:e,child:s,onNavigate:n},s.id))})]})}function Hp({trpc:e,child:t,onNavigate:r}){const n=!t.disabled,s=n&&wi(t),a=n&&ki(t);return o("li",{children:f("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(bi(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(Vp,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Up,{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 Up({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=Zt({trpc:e,deviceId:t,cap:p=>p.switch,slice:p=>p.state.switch}),[i,l]=S(!1);if(r!==null&&!n)return null;const c=s?.on===!0,d={transform:c?"translateX(14px)":"translateX(2px)"},u=async p=>{if(p.stopPropagation(),!(i||!a||!n)){l(!0);try{await n.setState({on:!c})}finally{l(!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",c?"bg-success/30 border-success/50":"bg-surface-hover border-border",i&&"opacity-60",!a&&"opacity-40 cursor-not-allowed"),title:a?c?"Turn off":"Turn on":"Awaiting state…","aria-pressed":c,children:o("span",{className:N("absolute h-3 w-3 rounded-full transition-all",c?"bg-success":"bg-foreground-subtle"),style:d})})}function Vp({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=Zt({trpc:e,deviceId:t,cap:p=>p.motionTrigger,slice:p=>p.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[l,c]=S(!1);if(n!==null&&!s)return null;const d=a?.enabled===!0,u=async p=>{if(p.stopPropagation(),!(l||!i||!s)){c(!0);try{await s.setMotionTrigger({enabled:!d})}finally{c(!1)}}};return o("button",{type:"button",onClick:p=>{u(p)},disabled:l||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",d?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(l||!i)&&"opacity-50"),title:i?d?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":d,children:o(et,{className:"h-2.5 w-2.5"})})}function Ni({trpc:e,device:t,flags:r}){if(t.disabled)return null;const n=t.type.toLowerCase(),s=r.showSwitchToggle&&wi(t),a=ki(t),i=n==="hub"||n==="nvr",l=(t.features??[]).includes("rebootable"),c=i&&l;return f(Ne,{children:[a&&o(Wp,{trpc:e,deviceId:t.id,features:t.features}),s&&o(qp,{trpc:e,deviceId:t.id}),c&&o(Zp,{trpc:e,deviceId:t.id})]})}function qp({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=Zt({trpc:e,deviceId:t,cap:p=>p.switch,slice:p=>p.state.switch}),[i,l]=S(!1);if(r!==null&&!n)return null;const c=s?.on===!0,d={transform:c?"translateX(14px)":"translateX(2px)"},u=async p=>{if(p.stopPropagation(),!(i||!a||!n)){l(!0);try{await n.setState({on:!c})}finally{l(!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",c?"bg-success/30 border-success/50":"bg-surface-hover border-border",i&&"opacity-60",!a&&"opacity-40 cursor-not-allowed"),title:a?c?"Turn off":"Turn on":"Awaiting state…","aria-pressed":c,children:o("span",{className:N("absolute h-3 w-3 rounded-full transition-all",c?"bg-success":"bg-foreground-subtle"),style:d})})}function Wp({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=Zt({trpc:e,deviceId:t,cap:p=>p.motionTrigger,slice:p=>p.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[l,c]=S(!1);if(n!==null&&!s)return null;const d=a?.enabled===!0,u=async p=>{if(p.stopPropagation(),!(l||!i||!s)){c(!0);try{await s.setMotionTrigger({enabled:!d})}finally{c(!1)}}};return o("button",{type:"button",onClick:p=>{u(p)},disabled:l||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",d?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(l||!i)&&"opacity-50"),title:i?d?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":d,children:o(et,{className:"h-2.5 w-2.5"})})}var Hr=168,Kp=4;function Zp({trpc:e,deviceId:t}){const{dev:r,cap:n}=Zt({trpc:e,deviceId:t,cap:x=>x.reboot,slice:()=>{}}),s=q(null),a=q(null),[i,l]=S(null),[c,d]=S(!1),u=r!==null&&n!==void 0&&n!==null,p=i!==null,h=()=>l(null),g=()=>{const x=s.current;if(!x)return;const y=x.getBoundingClientRect(),w=y.right-Hr,k=Math.max(8,Math.min(w,window.innerWidth-Hr-8));l({top:y.bottom+Kp,left:k})};if(H(()=>{if(!p)return;const x=w=>{const k=s.current,M=a.current,C=w.target;C!==null&&(k&&k.contains(C)||M&&M.contains(C)||h())},y=w=>{w.key==="Escape"&&(w.stopPropagation(),h())};return document.addEventListener("mousedown",x),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y)}},[p]),r!==null&&!n)return null;const b=x=>{x.stopPropagation(),p?h():g()},v=async()=>{if(!(c||!u||!n)){d(!0),h();try{await n.reboot({})}finally{d(!1)}}};return f(Ne,{children:[o("button",{ref:s,type:"button",onClick:b,disabled:c||!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",(c||!u)&&"opacity-50",p&&"bg-surface-hover text-foreground"),title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":p,children:o(Ia,{className:"h-3 w-3"})}),i&&Sr(o("div",{ref:a,role:"menu",style:{position:"fixed",top:i.top,left:i.left,width:Hr},className:"z-[9999] rounded-md border border-border bg-surface shadow-lg shadow-black/30 p-1",onClick:x=>x.stopPropagation(),children:f("button",{type:"button",role:"menuitem",onClick:()=>{v()},disabled:c||!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(Ga,{className:"h-3 w-3 shrink-0 text-foreground-subtle"}),o("span",{children:"Reboot device"})]})}),document.body)]})}var Yp=Object.freeze([]);function Xp(e){return e==="native"?"native":"enhanced"}function Jp(e){return e.map(t=>({kind:"marker",feature:t}))}function ef(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=jp[a];if(i===void 0){s.push({kind:"marker",feature:a});continue}const l=r.get(i);l&&s.push({kind:Xp(l.kind),feature:a,capName:i})}return s}function tf(e,t,r){const[n,s]=S(null),[a,i]=S(!1),[l,c]=S(!0);return H(()=>{if(t===null){s(null),i(!1),c(!1);return}let d=!1;c(!0),i(!1);const u=async()=>{try{const h=await e.deviceManager.getBindings.query({deviceId:t});if(d)return;s(h),c(!1)}catch{if(d)return;i(!0),c(!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()=>{d=!0,p?.unsubscribe()}},[e,t]),r.length===0?{loading:l,resolved:Yp}:l||a||!n?{loading:l,resolved:Jp(r)}:{loading:!1,resolved:ef(r,n)}}var rf=[];function Si({trpc:e,device:t,flags:r,accessoryCount:n,adoptedCount:s,showFeatureRow:a=!1}){const i=n+s,l=r.showChildrenAccordion&&i>0,c=t.features??rf,d=a&&c.length>0,{resolved:u}=tf(e,d?t.id:null,c),p=d&&u.length>0;return!l&&!p?null:f("div",{className:"flex items-center gap-1.5 flex-nowrap whitespace-nowrap min-w-0",children:[l&&o(nf,{accessoryCount:n,adoptedCount:s}),p&&o(of,{resolved:u})]})}function nf({accessoryCount:e,adoptedCount:t}){const r=e+t;return r===0?null:f("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 Ci=240,zo=200;function of({resolved:e}){const t=q(null),[r,n]=S(null);return f("span",{ref:t,className:"relative inline-flex items-center gap-1 cursor-help",onMouseEnter:()=>{const i=t.current;if(!i)return;const l=i.getBoundingClientRect();n({top:window.innerHeight-l.bottom>=zo?l.bottom+4:l.top-zo-4,left:Math.max(8,Math.min(l.left,window.innerWidth-Ci-8))})},onMouseLeave:()=>n(null),children:[e.map(i=>{const l=vi[i.feature];return l?o("span",{className:"inline-flex items-center justify-center h-4 w-4 rounded bg-surface-elevated/60 text-foreground-subtle",title:yi[i.feature]??i.feature,children:o(l,{className:"h-2.5 w-2.5"})},i.feature):null}),r&&Sr(o(sf,{resolved:e,position:r}),document.body)]})}function sf({resolved:e,position:t}){return f("div",{style:{position:"fixed",top:t.top,left:t.left,width:Ci,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(af,{entry:r},r.feature))})]})}function af({entry:e}){const t=vi[e.feature],r=yi[e.feature]??e.feature;return f("li",{className:"flex items-center justify-between gap-2 text-[10px]",children:[f("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(lf,{kind:e.kind})]})}function lf({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 Mi({device:e,variant:t,flags:r,parent:n,integrationIcon:s,hasChildren:a,expanded:i,onToggleExpand:l,onNavigateToParent:c}){const d=bi(e);return f("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.showChildrenAccordion&&a?o("button",{type:"button",onClick:u=>{u.stopPropagation(),l()},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(pt,{className:"h-3 w-3"}):o(st,{className:"h-3 w-3"})}):r.showChildrenAccordion?o("span",{className:"h-3.5 w-3.5 flex-shrink-0"}):null,o(d,{className:N("text-foreground-subtle flex-shrink-0",t==="minimal"?"h-3 w-3":"h-3.5 w-3.5")}),f("div",{className:"flex-1 min-w-0",children:[f("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)&&f("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&&f("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:Gp(e.stableId)})]}),r.showParentBadge&&n&&f("button",{type:"button",onClick:u=>{u.stopPropagation(),c(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(mn,{className:"h-2.5 w-2.5 shrink-0"}),f("span",{className:"truncate",children:["Under: ",n.name]})]})]})]})}function cf(e,t){return Op(e,t,r=>r.battery)??null}function df(e,t){const r=Rr(e,t),n=q(!1),{data:s,isLoading:a,isFetching:i,refetch:l}=ms({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}),c=s?`data:${s.contentType};base64,${s.base64}`:null;function d(){n.current=!0,l()}return{src:c,loading:a||i,refresh:d}}function uf(e){return e<=10?cu:e<=30?lu:e>=95?iu:Aa}function pf(e,t){return t!=="none"?"text-emerald-400":e<=10?"text-rose-400":e<=30?"text-amber-400":"text-foreground-subtle"}function ff({status:e,variant:t="compact",className:r}){if(!e)return null;const n=uf(e.percentage),s=pf(e.percentage,e.charging),a=e.charging==="solar"?Qa:e.charging==="dc"?Iu:null,i=e.sleeping;return f("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"}),f("span",{children:[Math.round(e.percentage),"%"]}),a&&o(a,{className:"h-3 w-3"}),i&&o(jn,{className:"h-3 w-3 text-blue-300"}),t==="full"&&e.charging!=="none"&&o("span",{className:"text-foreground-subtle",children:e.charging})]})}function Ei({trpc:e,device:t,status:r,enabled:n,showStatusPills:s=!1}){const a=df(e,n&&t.online?t.id:null),i=(t.features??[]).includes("battery-operated"),l=s&&i&&!t.disabled,c=cf(e,l?t.id:null);return!n&&!l?null:f("span",{className:"inline-flex items-center gap-1.5 flex-nowrap whitespace-nowrap",children:[l&&c&&o(ff,{status:c}),n&&o(mf,{deviceName:t.name,snapshotUrl:a.src,status:r})]})}var Ur=288,Fo=196,Vr=8;function mf({deviceName:e,snapshotUrl:t,status:r}){const n=q(null),[s,a]=S(null),i=r==="offline"||r==="disabled",l=()=>{const d=n.current;if(!d)return;const u=d.getBoundingClientRect(),p=u.top,h=window.innerHeight-u.bottom,g=p<Fo+Vr&&h>p,b=g?u.bottom+Vr:u.top-Fo-Vr,v=u.right-Ur;a({top:b,left:Math.max(8,Math.min(v,window.innerWidth-Ur-8)),placeBelow:g})},c=()=>a(null);return f(Ne,{children:[o("button",{ref:n,type:"button",onClick:d=>d.stopPropagation(),onMouseEnter:l,onMouseLeave:c,onFocus:l,onBlur:c,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(qt,{className:"h-3.5 w-3.5"})}),s&&Sr(f("div",{style:{position:"fixed",top:s.top,left:s.left,width:Ur,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 Ai({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 xn(e){const{trpc:t,device:r,parent:n,integrationIcon:s,onNavigate:a,className:i}=e,l=Bp(e),c=e.variant??"compact",d=e.view??"card",u=!r.disabled,p=r.isCamera??r.type.toLowerCase()==="camera",h=e.children??[],g=h.filter($o),b=h.filter(_=>!$o(_)),v=h.length>0,[x,y]=S(!1),w=e.expanded??x,k=e.onToggleExpand??(()=>y(_=>!_)),M=_=>{a?.(_)},C=e.indentLevel??(e.isAccessoryRow?2:0),A=u?r.online?"online":"offline":"disabled";return d==="table"?o(gf,{trpc:t,device:r,variant:c,flags:l,parent:n??null,integrationIcon:s??null,accessoryCount:g.length,adoptedCount:b.length,hasChildren:v,expanded:w,onToggleExpand:k,onNavigate:M,displayStatus:A,isCamera:p,showSnapshot:l.showSnapshot&&p,isAccessoryRow:e.isAccessoryRow??!1,indentLevel:C,className:i}):f("div",{className:N("rounded-lg border border-border bg-surface transition-colors",!u&&"opacity-60",i),children:[f("div",{onClick:()=>M(r.id),className:N("flex items-center gap-2 cursor-pointer hover:border-foreground-subtle/30 w-full",c==="minimal"?"px-2.5 py-1.5":"px-3 py-2.5"),children:[o(Mi,{device:r,variant:c,flags:l,parent:n??null,integrationIcon:s??null,hasChildren:v,expanded:w,onToggleExpand:k,onNavigateToParent:M}),o(Si,{trpc:t,device:r,flags:l,accessoryCount:g.length,adoptedCount:b.length,showFeatureRow:!1}),o(Ei,{trpc:t,device:r,status:A,enabled:l.showSnapshot&&p,showStatusPills:!0}),o(Ni,{trpc:t,device:r,flags:l}),o(Ai,{status:A})]}),w&&v&&o(Qp,{trpc:t,accessoryChildren:g,adoptedChildren:b,onNavigate:M})]})}var hf={0:"pl-2",1:"pl-6",2:"pl-8"};function gf(e){const{trpc:t,device:r,variant:n,flags:s,parent:a,integrationIcon:i,accessoryCount:l,adoptedCount:c,hasChildren:d,expanded:u,onToggleExpand:p,onNavigate:h,displayStatus:g,isCamera:b,showSnapshot:v,isAccessoryRow:x,indentLevel:y,className:w}=e;return f("tr",{onClick:()=>h(r.id),className:N("cursor-pointer hover:bg-surface-hover transition-colors",!s.showChildrenAccordion&&"border-b border-border-subtle/40",x&&"bg-foreground-subtle/[0.03]",w),children:[o("td",{className:N("py-2 align-middle pr-2",hf[y]),children:o(Mi,{device:r,variant:n,flags:s,parent:a,integrationIcon:i,hasChildren:d,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(Si,{trpc:t,device:r,flags:s,accessoryCount:l,adoptedCount:c,showFeatureRow:!0})}),o("td",{className:"px-2 py-2 align-middle",children:o(Ei,{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:f("span",{className:"inline-flex items-center gap-1.5",children:[o(Ni,{trpc:t,device:r,flags:s}),o(Ai,{status:g})]})})]})}function bf(e,t){const[r,n]=S(e);return H(()=>{const s=setTimeout(()=>n(e),t);return()=>clearTimeout(s)},[e,t]),r}var vf=new Set(["hub","nvr"]);function yf(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 l=s.role!==null&&s.role!==void 0;if(vf.has(i.type)&&!l){r.push(s);continue}const c=n.get(a);c?c.push(s):n.set(a,[s])}return{topLevel:r,accessoriesByParent:n}}var jo=2;function xf(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-jo),s=Math.min(t-1,e+jo);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 wf({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,l=Math.min(e*r,t),c=xf(e,a);return f("div",{className:"flex items-center justify-between gap-4 flex-wrap pt-2 text-[11px] text-foreground-subtle",children:[f("span",{children:["Showing ",i,"–",l," of ",t," ",s]}),f("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(fu,{className:"h-3 w-3"})}),c.map((d,u)=>d.kind==="ellipsis"?o("span",{className:"px-1 text-foreground-subtle/60 select-none",children:"…"},`e-${u}`):o("button",{type:"button",onClick:()=>n(d.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",d.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:d.n},`p-${d.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(st,{className:"h-3 w-3"})})]})]})}function kf({view:e,onViewChange:t,types:r,currentType:n,onTypeChange:s,addons:a,currentAddon:i,onAddonChange:l,hideAddons:c=!1}){return f("div",{className:"flex items-center gap-2 flex-wrap",children:[f("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(Eu,{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(Qu,{className:"h-3.5 w-3.5"})})]}),r&&r.length>0&&f(Ne,{children:[o(Go,{children:"Type"}),o(qr,{active:n===null,onClick:()=>s(null),children:"All"}),r.map(d=>o(qr,{active:n===d,onClick:()=>s(n===d?null:d),children:Nf(d)},d))]}),!c&&a&&a.length>0&&f(Ne,{children:[o(Go,{children:"Integration"}),a.map(d=>o(qr,{active:i===d.id,icon:d.icon,onClick:()=>l(i===d.id?null:d.id),showClearIcon:i===d.id,children:d.name},d.id))]})]})}function Go({children:e}){return o("span",{className:"text-[10px] font-medium uppercase tracking-wider text-foreground-subtle ml-1",children:e})}function qr({active:e,icon:t,onClick:r,showClearIcon:n,children:s}){return f("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(Pe,{className:"h-2.5 w-2.5 opacity-70"})]})}function Nf(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Sf({variant:e,onClearFilters:t}){return f("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o(Cu,{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 Ve(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 Qo(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 Cf(e,t){try{localStorage.setItem(`camstack:${e}:lastFilters`,JSON.stringify(t))}catch{}}function Ho(e,t,r){const n=new URLSearchParams(window.location.search),s=n.get(Ve(e,"view")),a=s==="cards"||s==="table"?s:r.view??t,i=n.get(Ve(e,"page")),l=i?parseInt(i,10):1;return{view:a,page:Number.isFinite(l)&&l>=1?l:1,addon:n.get(Ve(e,"addon"))??r.addon??null,type:n.get(Ve(e,"type"))??r.type??null,q:n.get(Ve(e,"q"))??r.q??""}}function Mf(e,t,r){const n=new URLSearchParams(window.location.search),s=(l,c)=>{c===null||c===""?n.delete(l):n.set(l,c)};s(Ve(e,"view"),t.view===r?null:t.view),s(Ve(e,"page"),t.page===1?null:String(t.page)),s(Ve(e,"addon"),t.addon),s(Ve(e,"type"),t.type),s(Ve(e,"q"),t.q||null);const a=n.toString(),i=a?`${window.location.pathname}?${a}`:window.location.pathname;window.history.replaceState(null,"",i)}function Ef(e){const{scope:t,defaultView:r,lsKey:n}=e,[s,a]=S(()=>Ho(t,r,Qo(n))),i=q(s);i.current=s,H(()=>{const c=()=>{const d=Ho(t,r,Qo(n));i.current=d,a(d)};return window.addEventListener("popstate",c),()=>window.removeEventListener("popstate",c)},[t,r,n]);const l=I(c=>{const d=c(i.current);i.current=d,a(d),Mf(t,d,r),Cf(n,{view:d.view,addon:d.addon,type:d.type,q:d.q})},[t,r,n]);return{state:s,setView:I(c=>l(d=>({...d,view:c})),[l]),setPage:I(c=>l(d=>({...d,page:c})),[l]),setAddon:I(c=>l(d=>({...d,addon:c,page:1})),[l]),setType:I(c=>l(d=>({...d,type:c,page:1})),[l]),setQ:I(c=>l(d=>({...d,q:c,page:1})),[l]),clearFilters:I(()=>l(c=>({...c,addon:null,type:null,q:"",page:1})),[l])}}var Af={cards:24,table:50};function Wb(e){const{devices:t,trpc:r,defaultView:n="table",filters:s,forceAddon:a,resolveIntegrationIcon:i,resolveParent:l,onNavigate:c,pageSize:d=Af,urlScope:u="root",lsKey:p=u==="root"?"devices":"integrations:nested"}=e,h=Ef({scope:u,defaultView:n,lsKey:p}),g=h.state.view,b=g==="cards"?d.cards:d.table,[v,x]=S(h.state.q),y=bf(v,300);H(()=>{y!==h.state.q&&h.setQ(y)},[y]);const w=a??h.state.addon,k=ee(()=>{const de=h.state.q.toLowerCase().trim();return t.filter(pe=>!(w&&pe.addonId!==w||h.state.type&&pe.type!==h.state.type||de&&!pe.name.toLowerCase().includes(de)&&!pe.stableId.toLowerCase().includes(de)))},[t,w,h.state.type,h.state.q]),M=ee(()=>yf(k),[k]),C=ee(()=>{if(h.state.q.trim()==="")return new Set;const de=h.state.q.toLowerCase().trim(),pe=new Set;for(const[ie,ne]of M.accessoriesByParent.entries())ne.some(W=>W.name.toLowerCase().includes(de)||W.stableId.toLowerCase().includes(de))&&pe.add(ie);return pe},[M.accessoriesByParent,h.state.q]),A=M.topLevel.length,_=Math.max(1,Math.ceil(A/b)),P=Math.min(h.state.page,_),Q=(P-1)*b,oe=M.topLevel.slice(Q,Q+b);H(()=>{P!==h.state.page&&h.setPage(P)},[P]),Df();const le=w!=null||h.state.type!==null||h.state.q!=="",ge=A===0;return f("div",{className:"flex flex-col gap-3",children:[f("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[o(kf,{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}),f("div",{className:"relative",children:[o(Gt,{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:de=>x(de.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(Sf,{variant:le?"filtered":"nofilter",onClearFilters:le?h.clearFilters:void 0}):g==="cards"?o(Pf,{rows:oe,accessoriesByParent:M.accessoriesByParent,trpc:r,resolveIntegrationIcon:i??null,resolveParent:l??null,onNavigate:c??null}):o(If,{rows:oe,accessoriesByParent:M.accessoriesByParent,autoExpandedParents:C,devices:k,trpc:r,resolveIntegrationIcon:i??null,resolveParent:l??null,onNavigate:c??null}),o(wf,{currentPage:P,totalItems:A,pageSize:b,onPageChange:h.setPage}),a===void 0&&le&&A>0&&f("p",{className:"text-[11px] text-foreground-subtle",children:["Showing ",A," of ",t.length," devices",w&&f(Ne,{children:[" ","· filtered by"," ",o("strong",{className:"text-primary",children:s?.addons?.find(de=>de.id===w)?.name??w})]})]})]})}function Pf({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 l=t.get(i.id)??[];return o(xn,{trpc:r,device:i,view:"card",integrationIcon:n?.(i.addonId)??null,parent:i.parentDeviceId!==null?s?.(i.parentDeviceId)??null:null,children:l,onNavigate:a??void 0},i.id)})})}var Rf=new Set(["hub","nvr"]);function _f(e,t){return e.parentDeviceId===null||t===null?0:Rf.has(t.toLowerCase())?1:0}function If({rows:e,accessoriesByParent:t,autoExpandedParents:r,devices:n,trpc:s,resolveIntegrationIcon:a,resolveParent:i,onNavigate:l}){const c=ee(()=>{const d=new Map;for(const u of n)d.set(u.id,u.type);return d},[n]);return o("div",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:f("table",{className:"w-full border-collapse",children:[o("thead",{children:f("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(d=>{const u=t.get(d.id)??[],p=u.length>0,h=r.has(d.id),g=d.parentDeviceId!==null?i?.(d.parentDeviceId)??null:null,b=d.parentDeviceId!==null?c.get(d.parentDeviceId)??null:null;return o(Tf,{parent:d,accessories:u,hasAccessories:p,forceExpanded:h,trpc:s,integrationIcon:a?.(d.addonId)??null,parentRowParent:g,indentLevel:_f(d,b),onNavigate:l??null},d.id)})})]})})}function Tf({parent:e,accessories:t,hasAccessories:r,forceExpanded:n,trpc:s,integrationIcon:a,parentRowParent:i,indentLevel:l,onNavigate:c}){const[d,u]=S(n),p=q(n);return H(()=>{p.current!==n&&(u(n),p.current=n)},[n]),f(Ne,{children:[o(xn,{trpc:s,device:e,view:"table",integrationIcon:a,parent:i,children:t,onNavigate:c??void 0,showChildrenAccordion:r,expanded:d,onToggleExpand:()=>u(g=>!g),indentLevel:l}),r&&d&&t.map(g=>o(xn,{trpc:s,device:g,view:"table",integrationIcon:null,parent:null,isAccessoryRow:!0,showChildrenAccordion:!1,onNavigate:c??void 0},g.id))]})}function Df(){Rn()}function Kb({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 f("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(wu,{className:"h-3.5 w-3.5 shrink-0"}),n.label,n.isBest&&f("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(Gu,{className:"h-2.5 w-2.5"}),"Best"]}),n.platformScore!=null&&f("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 Lf(e,t){const r=new Set(t.slots.flatMap(i=>i.addons.map(l=>l.id))),n=[];function s(i){if(!r.has(i.addonId))return n.push(`Addon "${i.addonId}" is no longer available — step removed`),null;const l=t.slots.flatMap(u=>u.addons).find(u=>u.id===i.addonId);let c=i.modelId;if(l&&!l.models.some(u=>u.id===c)){const u=l.defaultModelId;n.push(`Model "${c}" not available for ${i.addonId} — using "${u}"`),c=u}const d=i.children.map(u=>s(u)).filter(u=>u!==null);return{...i,modelId:c,children:d}}const a=e.map(i=>s(i)).filter(i=>i!==null);return{valid:n.length===0,steps:a,warnings:n}}function Of(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 Wr(e){return{addonId:e.id,addonName:e.name,slot:e.slot,inputClasses:[...e.inputClasses],outputClasses:[...e.outputClasses],enabled:!0,modelId:e.defaultModelId,children:[]}}function Kr({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:f("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"}),f("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}),f("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 Zb({schema:e,steps:t,onChange:r,templates:n,selectedTemplateId:s,onSelectTemplate:a,onSaveTemplate:i,onUpdateTemplate:l,onDeleteTemplate:c,readOnly:d=!1,excludeAddons:u=[],hideTemplates:p=!1,showOnlyEnabled:h=!1,showSlotLabels:g=!1,toggleMode:b="simple",overrides:v={},onOverrideChange:x,inheritedEnabledByAddon:y={},hideModelAndSettings:w=!1}){const k=z=>({toggleMode:b,hideModelAndSettings:w,...b==="threeState"?{overrideState:v[z]!==void 0?v[z]:null,onOverrideChange:x?B=>x(z,B):void 0,inheritedEnabled:y[z]}:{}}),M=ee(()=>new Set(u),[u]),C=ee(()=>Of(e),[e]),[A,_]=S([]),P=s?JSON.stringify(t)!==JSON.stringify(n.find(z=>z.id===s)?.steps):!1;function Q(z){const B=z.target.value||null;if(B){const se=n.find(U=>U.id===B);se&&_([...Lf(se.steps,e).warnings])}else _([]);a(B)}function oe(){s&&l(s,t)}function le(){const z=window.prompt("Template name:");z?.trim()&&i(z.trim(),t)}function ge(){if(!s)return;const z=n.find(B=>B.id===s);z&&window.confirm(`Delete template "${z.name}"?`)&&c(s)}function de(z){r(t.map(B=>B.addonId!==z.addonId?B:pe(z)))}function pe(z){const B=z.children.some(se=>se.enabled||se.children.some(U=>U.enabled));return{...z,enabled:z.enabled||B,children:z.children.map(se=>{const U=se.children.some(K=>K.enabled);return{...se,enabled:se.enabled||U}})}}function ie(z,B){const se=Wr(B);r(t.map(U=>U.addonId!==z?U:{...U,children:[...U.children,se]}))}function ne(z){const B=new Set;for(const se of z){B.add(se.addonId);for(const K of se.children)B.add(K.addonId);const U=ne(se.children);for(const K of U)B.add(K)}return B}const W=ne(t);function ye(z){const B=C.get(z.addonId);if(!B)return[];const se=e.slots.find(G=>G.id===B.slot)?.parentSlot==null,U=B.childSlots,K=new Set(z.children.map(G=>G.addonId)),Z=[];for(const G of e.slots)if(U.includes(G.id))for(const re of G.addons){if(K.has(re.id)||M.has(re.id))continue;const Y=re.inputClasses.length===0;Y&&!se||(Y||re.inputClasses.some(Re=>z.outputClasses.includes(Re)))&&Z.push(re)}return Z}function me(z){const B=h?{...z,children:z.children.filter(U=>U.enabled).map(U=>({...U,children:U.children.filter(K=>K.enabled)}))}:z,se=h?[]:ye(B);return f("div",{className:"space-y-1.5",children:[o(Gr,{step:B,schema:C.get(B.addonId)??null,allSchemas:C,onChange:de,onDelete:d?void 0:U=>r(t.filter(K=>K.addonId!==U)),readOnly:d,...k(B.addonId)}),(B.children.length>0||se.length>0)&&f("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"}),B.children.map(U=>{const K=ye(U);return f("div",{className:"space-y-1.5",children:[o(Gr,{step:U,schema:C.get(U.addonId)??null,allSchemas:C,depth:1,onChange:Z=>{de({...B,children:B.children.map(G=>G.addonId===Z.addonId?Z:G)})},onDelete:d?void 0:Z=>{de({...B,children:B.children.filter(G=>G.addonId!==Z)})},readOnly:d,...k(U.addonId)}),(U.children.length>0||K.length>0)&&f("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"}),U.children.map(Z=>o(Gr,{step:Z,schema:C.get(Z.addonId)??null,allSchemas:C,depth:2,onChange:G=>{de({...B,children:B.children.map(re=>re.addonId===U.addonId?{...re,children:re.children.map(Y=>Y.addonId===G.addonId?G:Y)}:re)})},onDelete:d?void 0:G=>{de({...B,children:B.children.map(re=>re.addonId===U.addonId?{...re,children:re.children.filter(Y=>Y.addonId!==G)}:re)})},readOnly:d,...k(Z.addonId)},Z.addonId)),!d&&K.map(Z=>o(Kr,{addon:Z,onClick:()=>{const G=Wr(Z);de({...B,children:B.children.map(re=>re.addonId===U.addonId?{...re,children:[...re.children,G]}:re)})}},Z.id))]})]},U.addonId)}),!d&&se.map(U=>o(Kr,{addon:U,onClick:()=>ie(B.addonId,U)},U.id))]})]},B.addonId)}const T=e.slots.filter(z=>z.parentSlot===null).sort((z,B)=>z.priority-B.priority);return f("div",{className:"space-y-4",children:[!p&&o("div",{className:"rounded-lg border border-border bg-surface p-3",children:f("div",{className:"flex items-center gap-2",children:[o("div",{className:"relative flex-1 min-w-0",children:f("select",{value:s??"",onChange:Q,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))]})}),P&&o("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500 shrink-0"}),o("button",{onClick:oe,disabled:!s||d,title:"Save",className:N("p-2 rounded-lg border border-border transition-colors",s&&!d?"text-foreground-subtle hover:bg-surface-hover":"text-foreground-subtle/30 cursor-not-allowed"),children:o(Lu,{className:"h-4 w-4"})}),o("button",{onClick:le,disabled:d,title:"Save As",className:N("p-2 rounded-lg border border-border transition-colors",d?"text-foreground-subtle/30 cursor-not-allowed":"text-foreground-subtle hover:bg-surface-hover"),children:o(xu,{className:"h-4 w-4"})}),o("button",{onClick:ge,disabled:!s||d,title:"Delete",className:N("p-2 rounded-lg border border-border transition-colors",s&&!d?"text-foreground-subtle hover:text-danger":"text-foreground-subtle/30 cursor-not-allowed"),children:o(qe,{className:"h-4 w-4"})})]})}),A.length>0&&f("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 text-xs text-amber-400 space-y-1",children:[f("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-medium",children:"Template loaded with warnings:"}),o("button",{onClick:()=>_([]),className:"text-amber-400/60 hover:text-amber-400",children:o(Pe,{className:"h-3.5 w-3.5"})})]}),A.map((z,B)=>f("div",{children:["• ",z]},B))]}),T.map(z=>{const B=t.filter(G=>G.slot===z.id&&!M.has(G.addonId)),se=h?B.filter(G=>G.enabled):B,U=h?[]:z.addons.filter(G=>!W.has(G.id)&&!M.has(G.id)),K=new Map,Z=[];for(const G of se)G.group?(K.has(G.group)||K.set(G.group,[]),K.get(G.group).push(G)):Z.push(G);return f("div",{className:"space-y-2",children:[g&&f("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/50",children:["Slot: ",z.label]}),Z.map(G=>me(G)),[...K.entries()].map(([G,re])=>f("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:G}),re.map(Y=>me(Y))]},G)),!d&&U.map(G=>o(Kr,{addon:G,onClick:()=>{r([...t,Wr(G)])}},G.id))]},z.id)})]})}var rr={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"},Uo=["#ef4444","#8b5cf6","#06b6d4","#f97316","#10b981","#6366f1","#e11d48","#0891b2","#7c3aed","#059669"],Yb="#f59e42";function Be(e,t){if(t?.[e])return t[e];if(t?.[e.toLowerCase()])return t[e.toLowerCase()];if(rr[e])return rr[e];if(rr[e.toLowerCase()])return rr[e.toLowerCase()];let r=0;for(let n=0;n<e.length;n++)r=r*31+(e.codePointAt(n)??0)>>>0;return Uo[r%Uo.length]??"#f59e42"}function Xb({src:e,imageWidth:t,imageHeight:r,detections:n=[],classColors:s,aspectRatio:a,className:i,placeholder:l,showConfidence:c=!0,minConfidence:d=0,borderWidth:u=2}){function p(y){return Be(y,s)}const h=a??(t&&r?`${t}/${r}`:"16/9"),g=n.filter(y=>y.score>=d),b=g.filter(y=>y.kind==="first-level"),v=g.filter(y=>y.kind==="detail"),x=zf(v,y=>y.parentId??"");return o("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden relative",i),style:{aspectRatio:h},children:e?f(Ne,{children:[o("img",{src:e,className:"absolute inset-0 w-full h-full object-fill",alt:""}),g.map((y,w)=>y.debug?.mask&&y.debug.maskWidth&&y.debug.maskHeight?o($f,{mask:y.debug.mask,maskWidth:y.debug.maskWidth,maskHeight:y.debug.maskHeight,bbox:y.bbox,imageWidth:t,imageHeight:r,color:p(y.macroClass)},`mask-${w}`):null),b.map(y=>{const w=x.get(y.id)??[];return o(Vo,{detection:y,imageWidth:t,imageHeight:r,color:p(y.macroClass),showConfidence:c,borderWidth:y.debug?.mask?1:u,children:w.map(k=>o(Bf,{child:k,parentBbox:y.bbox,color:p(k.macroClass),showConfidence:c},`child-${k.id}`))},`det-${y.id}`)}),v.filter(y=>!y.parentId||!b.some(w=>w.id===y.parentId)).map(y=>o(Vo,{detection:y,imageWidth:t,imageHeight:r,color:p(y.macroClass),showConfidence:c,borderWidth:u},`orphan-${y.id}`))]}):o("div",{className:"w-full h-full flex items-center justify-center text-foreground-subtle text-sm",children:l??"No image loaded"})})}function Vo({detection:e,imageWidth:t,imageHeight:r,color:n,showConfidence:s,borderWidth:a,children:i}){const{x:l,y:c,width:d,height:u}=e.bbox,p=f("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"2px"},children:[f("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)=>f("span",{className:"text-[9px] font-semibold px-1 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:Be(h.label)},children:[h.label," ",(h.score*100).toFixed(0),"%"]},`${e.id}-lbl-${g}`))]});return f("div",{className:"absolute rounded-sm",style:{left:`${l/t*100}%`,top:`${c/r*100}%`,width:`${d/t*100}%`,height:`${u/r*100}%`,borderWidth:`${a}px`,borderStyle:"solid",borderColor:n},children:[p,i]})}function $f({mask:e,maskWidth:t,maskHeight:r,bbox:n,imageWidth:s,imageHeight:a,color:i}){const l=q(null);return H(()=>{const c=l.current;if(!c)return;const d=c.getContext("2d");if(!d)return;const u=atob(e),p=new Uint8Array(u.length);for(let y=0;y<u.length;y++)p[y]=u.charCodeAt(y);const h=parseInt(i.slice(1,3),16),g=parseInt(i.slice(3,5),16),b=parseInt(i.slice(5,7),16);c.width=t,c.height=r;const v=d.createImageData(t,r),x=t*r;for(let y=0;y<x;y++){const w=y<p.length?p[y]:0,k=y*4;w>0&&(v.data[k]=h,v.data[k+1]=g,v.data[k+2]=b,v.data[k+3]=120)}d.putImageData(v,0,0)},[e,t,r,i]),o("canvas",{ref:l,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 Bf({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,l=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,l)}%`,borderWidth:"1px",borderStyle:"solid",borderColor:r},children:f("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"1px"},children:[f("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((c,d)=>f("span",{className:"text-[8px] font-semibold px-0.5 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:Be(c.label)},children:[c.label," ",(c.score*100).toFixed(0),"%"]},`${e.id}-lbl-${d}`))]})})}function zf(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 Jb({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"),l=e.filter(u=>u.kind==="detail"),c=new Map;for(const u of l){if(!u.parentId)continue;const p=c.get(u.parentId)??[];p.push(u),c.set(u.parentId,p)}const d=l.filter(u=>!u.parentId||!i.some(p=>p.id===u.parentId));return f("div",{className:r,children:[f("div",{className:"text-xs font-medium text-foreground-subtle uppercase tracking-wide mb-2",children:["Detections (",e.length,")"]}),f("div",{className:"space-y-2",children:[i.map(u=>o(qo,{detection:u,children_:c.get(u.id)??[],colors:a,hiddenKeys:n,onToggleVisibility:s},u.id)),d.map(u=>o(qo,{detection:u,children_:[],colors:a,hiddenKeys:n,onToggleVisibility:s},u.id))]})]})}function qo({detection:e,children_:t,colors:r,hiddenKeys:n,onToggleVisibility:s}){const a=Be(e.macroClass,r),i=!n?.has(e.id),l=e.debug?.mask,c=e.debug?.maskWidth,d=e.debug?.maskHeight,u=e.debug?.alternateLabels;return f("div",{className:`rounded-md border border-border bg-surface p-3 space-y-1 ${i?"":"opacity-40"}`,children:[f("div",{className:"flex justify-between items-center",children:[f("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"}),l&&c&&d&&f("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",c,"x",d]})]}),o(Gf,{confidence:e.score})]}),f("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)=>f("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{backgroundColor:Be(p.label,r)+"20",color:Be(p.label,r)},children:[p.label,f("span",{className:"opacity-60",children:[(p.score*100).toFixed(0),"%"]}),p.detectionId&&f("span",{className:"opacity-40 text-[8px]",children:["→ ",p.detectionId]})]},h))}),u&&Object.keys(u).length>0&&o(jf,{alternateLabels:u,colors:r}),t.length>0&&o(Ff,{items:t,colors:r,hiddenKeys:n,onToggleVisibility:s})]})}function Ff({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=Be(s.macroClass,t),i=!r?.has(s.id),l=s.debug?.mask,c=s.debug?.maskWidth,d=s.debug?.maskHeight;return f("div",{className:`text-xs space-y-0.5 ${i?"":"opacity-40"}`,children:[f("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}),f("span",{className:"text-foreground-subtle",children:[(s.score*100).toFixed(0),"%"]}),l&&c&&d&&f("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",c,"x",d]})]}),s.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 ml-5 mt-0.5",children:s.labels.map((u,p)=>f("span",{className:"inline-flex items-center gap-0.5 text-[9px] font-medium px-1 py-0.5 rounded-full",style:{backgroundColor:Be(u.label,t)+"20",color:Be(u.label,t)},children:[u.label," ",f("span",{className:"opacity-60",children:[(u.score*100).toFixed(0),"%"]})]},p))})]},s.id)})})}function jf({alternateLabels:e,colors:t}){const[r,n]=S(!1),s=Object.keys(e);return f("div",{className:"mt-1",children:[f("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:f("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((l,c)=>f("span",{className:"inline-flex items-center gap-0.5 text-[9px] px-1 py-0.5 rounded-full",style:{backgroundColor:Be(a,t)+"10",color:Be(a,t),opacity:Math.max(.4,l.score)},children:[l.label,f("span",{className:"opacity-60",children:[(l.score*100).toFixed(1),"%"]})]},c))})]},a)})})]})}function Gf({confidence:e}){return f("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 ev({timings:e,totalMs:t,className:r}){const n=Object.entries(e);return n.length===0&&t===void 0?null:f("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"}),f("div",{className:"space-y-1 text-xs",children:[n.map(([s,a])=>f("div",{className:"flex justify-between",children:[o("span",{className:"text-foreground-subtle",children:s}),f("span",{className:"font-mono text-foreground",children:[a.toFixed(1),"ms"]})]},s)),t!==void 0&&f("div",{className:"flex justify-between pt-1 border-t border-border font-medium text-foreground",children:[o("span",{children:"Total"}),f("span",{className:"font-mono",children:[t.toFixed(1),"ms"]})]})]})]})}function tv({images:e,selectedFilename:t,uploadedName:r,onSelect:n,onUpload:s,className:a,accept:i="image/*",uploadLabel:l="Upload..."}){const c=()=>{const d=document.createElement("input");d.type="file",d.accept=i,d.onchange=()=>{const u=d.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)},d.click()};return f("div",{className:`flex flex-wrap items-center gap-2 ${a??""}`,children:[e.map(d=>o("button",{onClick:()=>n(d.filename),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${t===d.filename?"bg-primary text-primary-foreground border-primary":"bg-surface border-border text-foreground hover:border-primary/50"}`,children:d.id??d.filename.replace(/\.[^.]+$/,"")},d.filename)),o("button",{onClick:c,className:"px-3 py-1.5 text-xs rounded-md border border-border bg-surface text-foreground hover:bg-surface-hover transition-colors",children:l}),r&&o("span",{className:"text-xs text-foreground-subtle",children:r})]})}var nr="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 rv({runtime:e,backend:t,modelId:r,agentId:n="hub",runtimes:s,backends:a,models:i,agents:l=[],onRuntimeChange:c,onBackendChange:d,onModelChange:u,onAgentChange:p,layout:h="grid",className:g,showAgent:b=!1}){return f("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&&l.length>0&&f("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:nr,children:l.map(v=>f("option",{value:v.id,children:[v.name," (",v.status,")"]},v.id))})]}),f("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Runtime"}),o("select",{value:e,onChange:v=>c(v.target.value),className:nr,children:s.map(v=>f("option",{value:v.value,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.value))})]}),f("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Backend"}),o("select",{value:t,onChange:v=>d(v.target.value),className:nr,children:a.map(v=>f("option",{value:v.id,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.id))})]}),f("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:nr,children:i.length===0?o("option",{value:"",children:"No compatible models"}):i.map(v=>f("option",{value:v.id,children:[v.name,v.downloaded?" ✓":""]},v.id))})]})]})}var Qf=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()}},Pi=class{constructor(e){this.generateIdentifier=e,this.kv=new Qf}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)}},Hf=class extends Pi{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 Uf(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 Vf(e,t){const r=Uf(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 Pt(e,t){Object.entries(e).forEach(([r,n])=>t(n,r))}function br(e,t){return e.indexOf(t)!==-1}function Wo(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(t(n))return n}}var qf=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Vf(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Wf=e=>Object.prototype.toString.call(e).slice(8,-1),Ri=e=>typeof e>"u",Kf=e=>e===null,Qt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,wn=e=>Qt(e)&&Object.keys(e).length===0,rt=e=>Array.isArray(e),Zf=e=>typeof e=="string",Yf=e=>typeof e=="number"&&!isNaN(e),Xf=e=>typeof e=="boolean",Jf=e=>e instanceof RegExp,Ht=e=>e instanceof Map,Ut=e=>e instanceof Set,_i=e=>Wf(e)==="Symbol",em=e=>e instanceof Date&&!isNaN(e.valueOf()),Ii=e=>e instanceof Error,Ko=e=>typeof e=="number"&&isNaN(e),tm=e=>Xf(e)||Kf(e)||Ri(e)||Yf(e)||Zf(e)||_i(e),rm=e=>typeof e=="bigint",nm=e=>e===1/0||e===-1/0,om=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),sm=e=>e instanceof URL,kn=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),Zr=e=>e.map(String).map(kn).join("."),Ot=(e,t)=>{const r=[];let n="";for(let a=0;a<e.length;a++){let i=e.charAt(a);if(!t&&i==="\\"){const l=e.charAt(a+1);if(l==="\\"){n+="\\",a++;continue}else if(l!==".")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 Ue(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var Ti=[Ue(Ri,"undefined",()=>null,()=>{}),Ue(rm,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),Ue(em,"Date",e=>e.toISOString(),e=>new Date(e)),Ue(Ii,"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}),Ue(Jf,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),r=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,r)}),Ue(Ut,"set",e=>[...e.values()],e=>new Set(e)),Ue(Ht,"map",e=>[...e.entries()],e=>new Map(e)),Ue(e=>Ko(e)||nm(e),"number",e=>Ko(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Ue(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Ue(sm,"URL",e=>e.toString(),e=>new URL(e))];function _r(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var Di=_r((e,t)=>_i(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}),am=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Li=_r(om,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=am[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function Oi(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var $i=_r(Oi,(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)}),Bi=_r((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)}),im=[$i,Di,Bi,Li],Zo=(e,t)=>{const r=Wo(im,s=>s.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const n=Wo(Ti,s=>s.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},zi={};Ti.forEach(e=>{zi[e.annotation]=e});var lm=(e,t,r)=>{if(rt(t))switch(t[0]){case"symbol":return Di.untransform(e,t,r);case"class":return $i.untransform(e,t,r);case"custom":return Bi.untransform(e,t,r);case"typed-array":return Li.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const n=zi[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,r)}},xt=(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 Fi(e){if(br(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(br(e,"prototype"))throw new Error("prototype is not allowed as a property");if(br(e,"constructor"))throw new Error("constructor is not allowed as a property")}var cm=(e,t)=>{Fi(t);for(let r=0;r<t.length;r++){const n=t[r];if(Ut(e))e=xt(e,+n);else if(Ht(e)){const s=+n,a=+t[++r]==0?"key":"value",i=xt(e,s);switch(a){case"key":e=i;break;case"value":e=e.get(i);break}}else e=e[n]}return e},Nn=(e,t,r)=>{if(Fi(t),t.length===0)return r(e);let n=e;for(let a=0;a<t.length-1;a++){const i=t[a];if(rt(n)){const l=+i;n=n[l]}else if(Qt(n))n=n[i];else if(Ut(n)){const l=+i;n=xt(n,l)}else if(Ht(n)){if(a===t.length-2)break;const l=+i,c=+t[++a]==0?"key":"value",d=xt(n,l);switch(c){case"key":n=d;break;case"value":n=n.get(d);break}}}const s=t[t.length-1];if(rt(n)?n[+s]=r(n[+s]):Qt(n)&&(n[s]=r(n[s])),Ut(n)){const a=xt(n,+s),i=r(a);a!==i&&(n.delete(a),n.add(i))}if(Ht(n)){const a=+t[t.length-2],i=xt(n,a);switch(+s==0?"key":"value"){case"key":{const l=r(i);n.set(l,n.get(i)),l!==i&&n.delete(i);break}case"value":n.set(i,r(n.get(i)));break}}return e},ji=e=>e<1;function Sn(e,t,r,n=[]){if(!e)return;const s=ji(r);if(!rt(e)){Pt(e,(l,c)=>Sn(l,t,r,[...n,...Ot(c,s)]));return}const[a,i]=e;i&&Pt(i,(l,c)=>{Sn(l,t,r,[...n,...Ot(c,s)])}),t(a,n)}function dm(e,t,r,n){return Sn(t,(s,a)=>{e=Nn(e,a,i=>lm(i,s,n))},r),e}function um(e,t,r){const n=ji(r);function s(a,i){const l=cm(e,Ot(i,n));a.map(c=>Ot(c,n)).forEach(c=>{e=Nn(e,c,()=>l)})}if(rt(t)){const[a,i]=t;a.forEach(l=>{e=Nn(e,Ot(l,n),()=>e)}),i&&Pt(i,s)}else Pt(t,s);return e}var pm=(e,t)=>Qt(e)||rt(e)||Ht(e)||Ut(e)||Ii(e)||Oi(e,t);function fm(e,t,r){const n=r.get(e);n?n.push(t):r.set(e,[t])}function mm(e,t){const r={};let n;return e.forEach(s=>{if(s.length<=1)return;t||(s=s.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[a,...i]=s;a.length===0?n=i.map(Zr):r[Zr(a)]=i.map(Zr)}),n?wn(r)?[n]:[n,r]:wn(r)?void 0:r}var Gi=(e,t,r,n,s=[],a=[],i=new Map)=>{const l=tm(e);if(!l){fm(e,s,t);const g=i.get(e);if(g)return n?{transformedValue:null}:g}if(!pm(e,r)){const g=Zo(e,r),b=g?{transformedValue:g.value,annotations:[g.type]}:{transformedValue:e};return l||i.set(e,b),b}if(br(a,e))return{transformedValue:null};const c=Zo(e,r),d=c?.value??e,u=rt(d)?[]:{},p={};Pt(d,(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=Gi(g,t,r,n,[...s,b],[...a,e],i);u[b]=v.transformedValue,rt(v.annotations)?p[kn(b)]=v.annotations:Qt(v.annotations)&&Pt(v.annotations,(x,y)=>{p[kn(b)+"."+y]=x})});const h=wn(p)?{transformedValue:u,annotations:c?[c.type]:void 0}:{transformedValue:u,annotations:c?[c.type,p]:p};return l||i.set(e,h),h};function Qi(e){return Object.prototype.toString.call(e).slice(8,-1)}function Yo(e){return Qi(e)==="Array"}function hm(e){if(Qi(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function gm(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 Cn(e,t={}){if(Yo(e))return e.map(s=>Cn(s,t));if(!hm(e))return e;const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...r,...n].reduce((s,a)=>{if(a==="__proto__"||Yo(t.props)&&!t.props.includes(a))return s;const i=e[a];return gm(s,a,Cn(i,t),e,t.nonenumerable),s},{})}var ue=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Hf,this.symbolRegistry=new Pi(t=>t.description??""),this.customTransformerRegistry=new qf,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,r=Gi(e,t,this,this.dedupe),n={json:r.transformedValue};r.annotations&&(n.meta={...n.meta,values:r.annotations});const s=mm(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:Cn(r);return n?.values&&(s=dm(s,n.values,n.v??0,this)),n?.referentialEqualities&&(s=um(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)}};ue.defaultInstance=new ue;ue.serialize=ue.defaultInstance.serialize.bind(ue.defaultInstance);ue.deserialize=ue.defaultInstance.deserialize.bind(ue.defaultInstance);ue.stringify=ue.defaultInstance.stringify.bind(ue.defaultInstance);ue.parse=ue.defaultInstance.parse.bind(ue.defaultInstance);ue.registerClass=ue.defaultInstance.registerClass.bind(ue.defaultInstance);ue.registerSymbol=ue.defaultInstance.registerSymbol.bind(ue.defaultInstance);ue.registerCustom=ue.defaultInstance.registerCustom.bind(ue.defaultInstance);ue.allowErrorProps=ue.defaultInstance.allowErrorProps.bind(ue.defaultInstance);ue.serialize;ue.deserialize;ue.stringify;ue.parse;ue.registerClass;ue.registerCustom;ue.registerSymbol;ue.allowErrorProps;function bm({className:e}){return f("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 vm({className:e}){return f("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 ym({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 xm({onLogin:e,serverUrl:t,logoSrc:r,error:n,className:s}){const[a,i]=S(""),[l,c]=S(""),[d,u]=S(!1),[p,h]=S(!1),[g,b]=S(null),v=n??g,x=async y=>{if(y.preventDefault(),!p){b(null),h(!0);try{await e(a,l)}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:f("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}),f("form",{onSubmit:x,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}),f("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:y=>i(y.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"})]}),f("div",{className:"space-y-1.5",children:[o("label",{className:"text-xs font-medium text-foreground-subtle",children:"Password"}),f("div",{className:"relative",children:[o("input",{type:d?"text":"password",value:l,onChange:y=>c(y.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(y=>!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",tabIndex:-1,children:d?o(vm,{className:"h-4 w-4"}):o(bm,{className:"h-4 w-4"})})]})]}),f("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(ym,{className:"h-4 w-4 animate-spin"}),p?"Logging in...":"Log in"]})]})]})})}var Mn="camstack_dev_token",Hi=Ye(null);function nv(){const e=Ae(Hi);if(!e)throw new Error("useDevShell must be used within a DevShell");return e}function wm(){return typeof window>"u"?null:localStorage.getItem(Mn)}function km({className:e}){return f("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 Nm({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 Sm({children:e,serverUrl:t,title:r,token:n,onLogout:s}){const a=xl(),i=ee(()=>[sl({condition:h=>h.type==="subscription",true:al({client:il({url:t.replace(/^http/,"ws")+"/trpc",connectionParams:()=>({token:n})}),transformer:ue}),false:bs({url:`${t}/trpc`,transformer:ue,headers:()=>({authorization:`Bearer ${n}`})})})],[t,n]),l=ee(()=>gs({links:i}),[i]),c=ee(()=>m.createClient({links:i}),[i]),d=ee(()=>pl({serverUrl:t,token:n}),[t,n]);H(()=>(d.init().catch(()=>{}),()=>{d.close()}),[d]);const u=ee(()=>new nl,[]),p=ee(()=>({trpc:l,token:n,logout:s}),[l,n,s]);return o(Pp,{system:d,children:o(m.Provider,{client:c,queryClient:u,children:o(ol,{client:u,children:o(Hi.Provider,{value:p,children:f("div",{className:"min-h-screen bg-background text-foreground",children:[f("div",{className:"flex items-center justify-between border-b border-border bg-surface px-4 py-2",children:[f("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})]}),f("div",{className:"flex items-center gap-2",children:[f("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(km,{className:"h-3.5 w-3.5"}):o(Nm,{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:l,theme:a})})]})})})})})}function Cm({children:e,serverUrl:t="https://localhost:4443",title:r}){const[n,s]=S(wm),a=I(async(l,c)=>{const d=await gs({links:[bs({url:`${t}/trpc`,transformer:ue})]}).auth.login.mutate({username:l,password:c});if(!d.token)throw new Error("No token returned");localStorage.setItem(Mn,d.token),s(d.token)},[t]),i=I(()=>{localStorage.removeItem(Mn),s(null)},[]);return n?o(no,{children:o(Sm,{serverUrl:t,title:r,token:n,onLogout:i,children:e})}):o(no,{children:o(xm,{onLogin:a,serverUrl:t})})}function ov(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}tl(a).render($t(Cm,{serverUrl:r,title:n,children:({trpc:i,theme:l})=>$t(e,{trpc:i,theme:{isDark:l.resolvedMode==="dark"},navigate:c=>{console.log("[dev] navigate:",c)}})}))}var Ui=ot("camstack:custom-field-renderers",{});function sv({renderers:e,children:t}){return o(Ui.Provider,{value:e,children:t})}function Mm(e){return Ae(Ui)[e]??null}var Kn=ot("camstack:device-context",null);function av({deviceId:e,device:t,children:r}){const n={deviceId:e,device:t??null};return o(Kn.Provider,{value:n,children:r})}function Em(){return Ae(Kn)?.deviceId??null}function iv(){return Ae(Kn)?.device??null}var lv=m.accessories.getStatus.useQuery,cv=m.addonPages.listPages.useQuery,Am=m.addons.list.useQuery,dv=m.addons.getLogs.useQuery,uv=m.addons.listPackages.useQuery,pv=m.addons.installPackage.useMutation,fv=m.addons.installFromWorkspace.useMutation,mv=m.addons.isWorkspaceAvailable.useQuery,hv=m.addons.listWorkspacePackages.useQuery,gv=m.addons.uninstallPackage.useMutation,bv=m.addons.reloadPackages.useMutation,vv=m.addons.searchAvailable.useQuery,yv=m.addons.listUpdates.useQuery,xv=m.addons.updatePackage.useMutation,wv=m.addons.rollbackPackage.useMutation,kv=m.addons.forceRefresh.useMutation,Nv=m.addons.restartServer.useMutation,Sv=m.addons.getVersions.useQuery,Cv=m.addons.restartAddon.useMutation,Mv=m.addons.retryLoad.useMutation,Ev=m.addons.getAutoUpdateSettings.useQuery,Av=m.addons.setAutoUpdateSettings.useMutation,Pv=m.addons.getAddonAutoUpdate.useQuery,Rv=m.addons.setAddonAutoUpdate.useMutation,_v=m.addons.applyAutoUpdateToAll.useMutation,Iv=m.addons.custom.useMutation,Tv=m.addons.onAddonLogs.useSubscription,Dv=m.addonSettings.getGlobalSettings.useQuery,Lv=m.addonSettings.updateGlobalSettings.useMutation,Ov=m.addonSettings.getDeviceSettings.useQuery,$v=m.addonSettings.updateDeviceSettings.useMutation,Pm=m.addonWidgets.listWidgets.useQuery,Bv=m.alerts.emit.useMutation,zv=m.alerts.update.useMutation,Fv=m.alerts.list.useQuery,jv=m.alerts.getUnreadCount.useQuery,Gv=m.alerts.markRead.useMutation,Qv=m.alerts.markAllRead.useMutation,Hv=m.alerts.dismiss.useMutation,Uv=m.audioAnalysis.resolveDeviceSettings.useQuery,Vv=m.audioAnalysis.getDeviceSettingsContribution.useQuery,qv=m.audioAnalysis.getDeviceLiveContribution.useQuery,Wv=m.audioAnalysis.applyDeviceSettingsPatch.useMutation,Kv=m.audioAnalyzer.analyseChunk.useMutation,Zv=m.audioAnalyzer.classify.useQuery,Yv=m.audioAnalyzer.isReady.useQuery,Xv=m.audioAnalyzer.dispose.useMutation,Jv=m.audioAnalyzer.reprobeAudioEngine.useMutation,ey=m.audioCodec.listSupportedCodecs.useQuery,ty=m.audioCodec.canHandle.useQuery,ry=m.audioCodec.createDecodeSession.useMutation,ny=m.audioCodec.createEncodeSession.useMutation,oy=m.audioCodec.closeSession.useMutation,sy=m.audioCodec.pushEncodedFrame.useMutation,ay=m.audioCodec.pullPcm.useQuery,iy=m.audioCodec.pushPcm.useMutation,ly=m.audioCodec.pullEncoded.useQuery,cy=m.audioCodec.flushEncode.useMutation,dy=m.audioCodec.listActiveSessions.useQuery,uy=m.audioMetrics.getCurrentSnapshot.useQuery,py=m.audioMetrics.getHistory.useQuery,fy=m.authentication.listProviders.useQuery,my=m.authentication.setProviderEnabled.useMutation,hy=m.backup.listDestinations.useQuery,gy=m.backup.trigger.useMutation,by=m.backup.list.useQuery,vy=m.backup.listLocations.useQuery,yy=m.backup.getEntries.useQuery,xy=m.backup.restore.useMutation,wy=m.backup.delete.useMutation,ky=m.backup.listArchives.useQuery,Ny=m.backup.upsertDestinationPolicy.useMutation,Sy=m.backup.previewSchedule.useQuery,Cy=m.battery.getStatus.useQuery,My=m.brightness.setBrightness.useMutation,Ey=m.brightness.getStatus.useQuery,Ay=m.cameraStreams.getCameraStreams.useQuery,Py=m.cameraStreams.getBrokerStreams.useQuery,Ry=m.cameraStreams.getRtspEntries.useQuery,_y=m.decoder.supportsCodec.useQuery,Iy=m.decoder.getInfo.useQuery,Ty=m.decoder.createSession.useQuery,Dy=m.decoder.destroySession.useQuery,Ly=m.decoder.pushPacket.useQuery,Oy=m.decoder.openStream.useQuery,$y=m.decoder.pullFrames.useQuery,By=m.decoder.updateConfig.useQuery,zy=m.decoder.getStats.useQuery,Fy=m.decoder.listActiveSessions.useQuery,jy=m.decoder.reprobeHwaccel.useMutation,Gy=m.detectionPipeline.getDeviceSettingsContribution.useQuery,Qy=m.detectionPipeline.getDeviceLiveContribution.useQuery,Hy=m.detectionPipeline.applyDeviceSettingsPatch.useMutation,Uy=m.deviceDiscovery.listDiscovered.useQuery,Vy=m.deviceDiscovery.refreshDiscovery.useMutation,qy=m.deviceDiscovery.adoptDevice.useMutation,Wy=m.deviceDiscovery.releaseDevice.useMutation,Ky=m.deviceDiscovery.getStatus.useQuery,Zy=m.deviceManager.allocateDeviceId.useMutation,Yy=m.deviceManager.registerDevice.useMutation,Xy=m.deviceManager.removeDevice.useMutation,Jy=m.deviceManager.persistConfig.useMutation,ex=m.deviceManager.loadConfig.useQuery,tx=m.deviceManager.loadRuntimeState.useQuery,rx=m.deviceManager.loadMeta.useQuery,nx=m.deviceManager.setName.useMutation,ox=m.deviceManager.setLocation.useMutation,sx=m.deviceManager.setMetadata.useMutation,ax=m.deviceManager.listLocations.useQuery,ix=m.deviceManager.addLocation.useMutation,lx=m.deviceManager.removeLocation.useMutation,cx=m.deviceManager.setDisabled.useMutation,dx=m.deviceManager.listPersistedByAddon.useQuery,ux=m.deviceManager.listAll.useQuery,px=m.deviceManager.getDevice.useQuery,fx=m.deviceManager.getChildren.useQuery,mx=m.deviceManager.getStreamSources.useQuery,hx=m.deviceManager.getConfigSchema.useQuery,gx=m.deviceManager.getSettingsSchema.useQuery,bx=m.deviceManager.updateConfig.useMutation,vx=m.deviceManager.enable.useMutation,yx=m.deviceManager.disable.useMutation,xx=m.deviceManager.remove.useMutation,wx=m.deviceManager.getStreamProfileMap.useQuery,kx=m.deviceManager.setStreamProfileMap.useMutation,Nx=m.deviceManager.probeStreams.useMutation,Sx=m.deviceManager.getBindings.useQuery,Cx=m.deviceManager.getAllBindings.useQuery,Mx=m.deviceManager.setWrapperActive.useMutation,Ex=m.deviceManager.listWrappersForCap.useQuery,Ax=m.deviceManager.listBindableCapsForDeviceType.useQuery,Px=m.deviceManager.getDeviceSettingsAggregate.useQuery,Rx=m.deviceManager.getDeviceLiveInfoAggregate.useQuery,_x=m.deviceManager.getDeviceAggregate.useQuery,Ix=m.deviceManager.updateDeviceField.useMutation,Tx=m.deviceManager.updateDeviceFieldsBatch.useMutation,Dx=m.deviceManager.discoverDevices.useMutation,Lx=m.deviceManager.adoptDevice.useMutation,Ox=m.deviceManager.getCreationSchema.useQuery,$x=m.deviceManager.createDevice.useMutation,Bx=m.deviceManager.testCreationField.useMutation,zx=m.deviceManager.testField.useMutation,Fx=m.deviceManager.getDeviceStatusAggregate.useQuery,jx=m.deviceOps.getStreamSources.useQuery,Gx=m.deviceOps.getConfigEntries.useQuery,Qx=m.deviceOps.setConfig.useMutation,Hx=m.deviceOps.removeDevice.useMutation,Ux=m.deviceOps.getSettingsSchema.useQuery,Vx=m.deviceProvider.start.useMutation,qx=m.deviceProvider.stop.useMutation,Wx=m.deviceProvider.getStatus.useQuery,Kx=m.deviceProvider.getDevices.useQuery,Zx=m.deviceProvider.supportsDiscovery.useQuery,Yx=m.deviceProvider.discoverDevices.useMutation,Xx=m.deviceProvider.adoptDiscoveredDevice.useMutation,Jx=m.deviceProvider.supportsManualCreation.useQuery,e0=m.deviceProvider.getChildCreationSchema.useQuery,t0=m.deviceProvider.createDevice.useMutation,r0=m.deviceProvider.testCreationField.useMutation,n0=m.deviceState.getSnapshot.useQuery,o0=m.deviceState.getCapSlice.useQuery,s0=m.deviceState.getAllSnapshots.useQuery,a0=m.deviceState.setCapSlice.useMutation,i0=m.doorbell.getStatus.useQuery,l0=m.events.getEvents.useQuery,c0=m.events.getEventThumbnail.useQuery,d0=m.events.getEventClipUrl.useQuery,u0=m.integrations.list.useQuery,p0=m.integrations.get.useQuery,f0=m.integrations.getByAddonId.useQuery,m0=m.integrations.create.useMutation,h0=m.integrations.update.useMutation,g0=m.integrations.delete.useMutation,b0=m.integrations.getSettings.useQuery,v0=m.integrations.setSettings.useMutation,y0=m.integrations.getAvailableTypes.useQuery,x0=m.integrations.testConnection.useMutation,w0=m.intercom.startSession.useMutation,k0=m.intercom.handleAnswer.useMutation,N0=m.intercom.stopSession.useMutation,S0=m.intercom.getStatus.useQuery,C0=m.localNetwork.list.useQuery,M0=m.localNetwork.getPreferred.useQuery,E0=m.localNetwork.getConnectionEndpoints.useQuery,A0=m.localNetwork.getAllowedAddresses.useQuery,P0=m.localNetwork.setAllowedAddresses.useMutation,R0=m.localNetwork.resetAllowlistToBestMatch.useMutation,_0=m.meshOrchestrator.listProviders.useQuery,I0=m.meshOrchestrator.joinProvider.useMutation,T0=m.meshOrchestrator.leaveProvider.useMutation,D0=m.metricsProvider.collectSnapshot.useQuery,L0=m.metricsProvider.getCached.useQuery,O0=m.metricsProvider.getCurrent.useQuery,$0=m.metricsProvider.getDiskSpace.useQuery,B0=m.metricsProvider.getGpuInfo.useQuery,z0=m.metricsProvider.getCpuTemperature.useQuery,F0=m.metricsProvider.getProcessStats.useQuery,j0=m.metricsProvider.listAddonInstances.useQuery,G0=m.metricsProvider.getAddonStats.useQuery,Q0=m.metricsProvider.listNodeProcesses.useQuery,H0=m.metricsProvider.killProcess.useMutation,U0=m.motion.isDetected.useQuery,V0=m.motion.getStatus.useQuery,q0=m.motionDetection.analyze.useMutation,W0=m.motionDetection.removeCamera.useMutation,K0=m.motionDetection.reset.useMutation,Z0=m.motionDetection.getDeviceSettingsContribution.useQuery,Y0=m.motionDetection.getDeviceLiveContribution.useQuery,X0=m.motionDetection.applyDeviceSettingsPatch.useMutation,J0=m.motionTrigger.setMotionTrigger.useMutation,e1=m.motionTrigger.getStatus.useQuery,t1=m.nativeObjectDetection.getStatus.useQuery,r1=m.networkQuality.getDeviceStats.useQuery,n1=m.networkQuality.getAllStats.useQuery,o1=m.networkQuality.reportClientStats.useMutation,s1=m.nodes.topology.useQuery,a1=m.nodes.deployAddon.useMutation,i1=m.nodes.undeployAddon.useMutation,l1=m.nodes.restartAddon.useMutation,c1=m.nodes.restartProcess.useMutation,d1=m.nodes.restartNode.useMutation,u1=m.nodes.shutdownNode.useMutation,p1=m.nodes.renameNode.useMutation,f1=m.nodes.clusterAddonStatus.useQuery,m1=m.nodes.setProcessLogLevel.useMutation,h1=m.nodes.executeQuery.useMutation,g1=m.notificationOutput.send.useMutation,b1=m.notificationOutput.sendTest.useMutation,v1=m.osd.setOverlay.useMutation,y1=m.osd.getStatus.useQuery,x1=m.pipelineAnalytics.getActiveTracks.useQuery,w1=m.pipelineAnalytics.getTrack.useQuery,k1=m.pipelineAnalytics.listTracks.useQuery,N1=m.pipelineAnalytics.clearTracks.useMutation,S1=m.pipelineAnalytics.getMotionEvents.useQuery,C1=m.pipelineAnalytics.getObjectEvents.useQuery,M1=m.pipelineAnalytics.getAudioEvents.useQuery,E1=m.pipelineAnalytics.getEventMedia.useQuery,A1=m.pipelineAnalytics.getTrackMedia.useQuery,P1=m.pipelineAnalytics.getDeviceSettingsContribution.useQuery,R1=m.pipelineAnalytics.getDeviceLiveContribution.useQuery,_1=m.pipelineAnalytics.applyDeviceSettingsPatch.useMutation,I1=m.pipelineExecutor.getAvailableEngines.useQuery,T1=m.pipelineExecutor.getSelectedEngine.useQuery,D1=m.pipelineExecutor.getDefaultSteps.useQuery,L1=m.pipelineExecutor.reprobeEngine.useMutation,O1=m.pipelineExecutor.getVideoPipelineSteps.useQuery,$1=m.pipelineExecutor.setVideoPipelineSteps.useMutation,B1=m.pipelineExecutor.getSchema.useQuery,z1=m.pipelineExecutor.getGlobalSteps.useQuery,F1=m.pipelineExecutor.getGlobalPipelineConfig.useQuery,j1=m.pipelineExecutor.getOrchestratorConfigSchema.useQuery,G1=m.pipelineExecutor.listTemplates.useQuery,Q1=m.pipelineExecutor.saveTemplate.useMutation,H1=m.pipelineExecutor.updateTemplate.useMutation,U1=m.pipelineExecutor.deleteTemplate.useMutation,V1=m.pipelineExecutor.getCapabilities.useQuery,q1=m.pipelineExecutor.getAddonModels.useQuery,W1=m.pipelineExecutor.downloadModel.useMutation,K1=m.pipelineExecutor.deleteModel.useMutation,Z1=m.pipelineExecutor.detect.useQuery,Y1=m.pipelineExecutor.runPipeline.useMutation,X1=m.pipelineExecutor.runPipelineBatch.useMutation,J1=m.pipelineExecutor.cacheFrameInPool.useMutation,ew=m.pipelineExecutor.inferCached.useMutation,tw=m.pipelineExecutor.uncacheFrame.useMutation,rw=m.pipelineExecutor.getEffectiveTuning.useQuery,nw=m.pipelineExecutor.listLoadedEngines.useQuery,ow=m.pipelineExecutor.spinEngine.useMutation,sw=m.pipelineExecutor.killEngine.useMutation,aw=m.pipelineExecutor.listReferenceImages.useQuery,iw=m.pipelineExecutor.getReferenceImage.useQuery,lw=m.pipelineExecutor.getReferenceAudioFiles.useQuery,cw=m.pipelineExecutor.getReferenceAudio.useQuery,dw=m.pipelineExecutor.getAudioCapabilities.useQuery,uw=m.pipelineExecutor.runAudioTest.useMutation,pw=m.pipelineExecutor.getDetectionConfigSchema.useQuery,fw=m.pipelineOrchestrator.assignPipeline.useMutation,mw=m.pipelineOrchestrator.unassignPipeline.useMutation,hw=m.pipelineOrchestrator.rebalance.useMutation,gw=m.pipelineOrchestrator.getPipelineAssignments.useQuery,bw=m.pipelineOrchestrator.getPipelineAssignment.useQuery,vw=m.pipelineOrchestrator.getAgentLoad.useQuery,yw=m.pipelineOrchestrator.getGlobalMetrics.useQuery,xw=m.pipelineOrchestrator.getCameraMetrics.useQuery,ww=m.pipelineOrchestrator.getCapabilityBindings.useQuery,kw=m.pipelineOrchestrator.setCapabilityBinding.useMutation,Nw=m.pipelineOrchestrator.assignDecoder.useMutation,Sw=m.pipelineOrchestrator.unassignDecoder.useMutation,Cw=m.pipelineOrchestrator.getDecoderAssignments.useQuery,Mw=m.pipelineOrchestrator.assignAudio.useMutation,Ew=m.pipelineOrchestrator.unassignAudio.useMutation,Aw=m.pipelineOrchestrator.getAudioAssignment.useQuery,Pw=m.pipelineOrchestrator.getAudioNodeLoad.useQuery,Rw=m.pipelineOrchestrator.getAudioAssignments.useQuery,_w=m.pipelineOrchestrator.getDecoderAssignment.useQuery,Iw=m.pipelineOrchestrator.getAgentSettings.useQuery,Tw=m.pipelineOrchestrator.listAgentSettings.useQuery,Dw=m.pipelineOrchestrator.setAgentAddonDefaults.useMutation,Lw=m.pipelineOrchestrator.removeAgentSettings.useMutation,Ow=m.pipelineOrchestrator.getCameraSettings.useQuery,$w=m.pipelineOrchestrator.setCameraStepToggle.useMutation,Bw=m.pipelineOrchestrator.getCameraStepOverrides.useQuery,zw=m.pipelineOrchestrator.setCameraStepOverride.useMutation,Fw=m.pipelineOrchestrator.setCameraPipelineForAgent.useMutation,jw=m.pipelineOrchestrator.resolvePipeline.useQuery,Gw=m.pipelineOrchestrator.listTemplates.useQuery,Qw=m.pipelineOrchestrator.saveTemplate.useMutation,Hw=m.pipelineOrchestrator.updateTemplate.useMutation,Uw=m.pipelineOrchestrator.deleteTemplate.useMutation,Vw=m.pipelineOrchestrator.getDeviceSettingsContribution.useQuery,qw=m.pipelineOrchestrator.getDeviceLiveContribution.useQuery,Ww=m.pipelineOrchestrator.applyDeviceSettingsPatch.useMutation,Kw=m.pipelineRunner.attachCamera.useMutation,Zw=m.pipelineRunner.detachCamera.useMutation,Yw=m.pipelineRunner.reportMotion.useMutation,Xw=m.pipelineRunner.getLocalLoad.useQuery,Jw=m.pipelineRunner.getLocalMetrics.useQuery,ek=m.pipelineRunner.getCameraMetrics.useQuery,tk=m.pipelineRunner.getAllCameraMetrics.useQuery,rk=m.pipelineRunner.getLocalCameras.useQuery,nk=m.platformProbe.getCapabilities.useQuery,ok=m.platformProbe.getHardware.useQuery,sk=m.platformProbe.resolveInferenceConfig.useQuery,ak=m.platformProbe.resolveHwAccel.useQuery,ik=m.ptz.move.useMutation,lk=m.ptz.continuousMove.useMutation,ck=m.ptz.stop.useMutation,dk=m.ptz.getPresets.useQuery,uk=m.ptz.goToPreset.useMutation,pk=m.ptz.goHome.useMutation,fk=m.ptz.getPosition.useQuery,mk=m.ptz.getStatus.useQuery,hk=m.ptzAutotrack.getStatus.useQuery,gk=m.ptzAutotrack.setEnabled.useMutation,bk=m.ptzAutotrack.getSettings.useQuery,vk=m.ptzAutotrack.setSettings.useMutation,yk=m.reboot.reboot.useMutation,xk=m.recording.getSegments.useQuery,wk=m.recording.getPlaybackUrl.useQuery,kk=m.recording.getThumbnailAt.useQuery,Nk=m.recordingEngine.getStatus.useQuery,Sk=m.recordingEngine.enable.useMutation,Ck=m.recordingEngine.disable.useMutation,Mk=m.recordingEngine.getConfig.useQuery,Ek=m.recordingEngine.updateConfig.useMutation,Ak=m.recordingEngine.getPlaylist.useQuery,Pk=m.recordingEngine.getThumbnail.useQuery,Rk=m.recordingEngine.getSegments.useQuery,_k=m.recordingEngine.getAvailability.useQuery,Ik=m.recordingEngine.estimateStorage.useQuery,Tk=m.recordingEngine.estimateGlobalStorage.useQuery,Dk=m.recordingEngine.getStorageUsage.useQuery,Lk=m.recordingEngine.setPolicy.useMutation,Ok=m.recordingEngine.getPolicy.useQuery,$k=m.recordingEngine.getPolicyStatus.useQuery,Bk=m.recordingEngine.getRetentionConfig.useQuery,zk=m.recordingEngine.updateRetentionConfig.useMutation,Fk=m.recordingEngine.getMotionStats.useQuery,jk=m.remoteAccess.listProviders.useQuery,Gk=m.remoteAccess.startProvider.useMutation,Qk=m.remoteAccess.stopProvider.useMutation,Hk=m.settingsStore.get.useQuery,Uk=m.settingsStore.set.useMutation,Vk=m.settingsStore.query.useQuery,qk=m.settingsStore.insert.useMutation,Wk=m.settingsStore.update.useMutation,Kk=m.settingsStore.delete.useMutation,Zk=m.settingsStore.count.useQuery,Yk=m.settingsStore.isEmpty.useQuery,Xk=m.settingsStore.declareCollection.useMutation,Jk=m.snapshot.getSnapshot.useQuery,e2=m.snapshot.invalidateCache.useMutation,t2=m.snapshot.getStatus.useQuery,r2=m.snapshot.getDeviceSettingsContribution.useQuery,n2=m.snapshot.getDeviceLiveContribution.useQuery,o2=m.snapshot.applyDeviceSettingsPatch.useMutation,s2=m.snapshotProvider.supportsDevice.useQuery,a2=m.snapshotProvider.getSnapshot.useQuery,i2=m.storage.resolve.useQuery,l2=m.storage.write.useMutation,c2=m.storage.read.useQuery,d2=m.storage.exists.useQuery,u2=m.storage.list.useQuery,p2=m.storage.delete.useMutation,f2=m.storage.getAvailableSpace.useQuery,m2=m.storage.beginUpload.useMutation,h2=m.storage.writeChunk.useMutation,g2=m.storage.finalizeUpload.useMutation,b2=m.storage.abortUpload.useMutation,v2=m.storage.beginDownload.useMutation,y2=m.storage.readChunk.useQuery,x2=m.storage.endDownload.useMutation,w2=m.storage.listLocations.useQuery,k2=m.storage.getDefaultLocation.useQuery,N2=m.storage.upsertLocation.useMutation,S2=m.storage.deleteLocation.useMutation,C2=m.storage.testLocation.useQuery,M2=m.storage.listProviders.useQuery,E2=m.storage.testConfig.useQuery,A2=m.streamBroker.publishCameraStream.useMutation,P2=m.streamBroker.retractCameraStream.useMutation,R2=m.streamBroker.assignProfile.useMutation,_2=m.streamBroker.unassignProfile.useMutation,I2=m.streamBroker.listAllCameraStreams.useQuery,T2=m.streamBroker.listAllProfileSlots.useQuery,D2=m.streamBroker.getBrokerStats.useQuery,L2=m.streamBroker.listClients.useQuery,O2=m.streamBroker.killClient.useMutation,$2=m.streamBroker.restartProfile.useMutation,B2=m.streamBroker.getStreamUrl.useQuery,z2=m.streamBroker.getBroker.useQuery,F2=m.streamBroker.setPreBufferDuration.useMutation,j2=m.streamBroker.getPreBufferInfo.useQuery,G2=m.streamBroker.getRtspPort.useQuery,Q2=m.streamBroker.getAllRtspEntries.useQuery,H2=m.streamBroker.getRtspEntry.useQuery,U2=m.streamBroker.regenerateRtspToken.useMutation,V2=m.streamBroker.setRtspEnabled.useMutation,q2=m.streamBroker.isRtspEnabled.useQuery,W2=m.streamBroker.getDeviceSettingsContribution.useQuery,K2=m.streamBroker.getDeviceLiveContribution.useQuery,Z2=m.streamBroker.applyDeviceSettingsPatch.useMutation,Y2=m.switch.setState.useMutation,X2=m.switch.getStatus.useQuery,J2=m.system.info.useQuery,eN=m.system.health.useQuery,tN=m.system.featureFlags.useQuery,rN=m.system.networkAddresses.useQuery,nN=m.system.getRetentionConfig.useQuery,oN=m.system.setRetentionConfig.useMutation,sN=m.system.forceRetentionCleanup.useMutation,aN=m.toast.onToast.useSubscription,iN=m.turnOrchestrator.listProviders.useQuery,lN=m.turnOrchestrator.getAllServers.useQuery,cN=m.turnOrchestrator.setProviderEnabled.useMutation,dN=m.turnProvider.getTurnServers.useQuery,uN=m.userManagement.listUsers.useQuery,pN=m.userManagement.createUser.useMutation,fN=m.userManagement.updateUser.useMutation,mN=m.userManagement.deleteUser.useMutation,hN=m.userManagement.resetPassword.useMutation,gN=m.userManagement.setUserScopes.useMutation,bN=m.userManagement.validateCredentials.useMutation,vN=m.userManagement.listApiKeys.useQuery,yN=m.userManagement.createApiKey.useMutation,xN=m.userManagement.revokeApiKey.useMutation,wN=m.userManagement.validateApiKey.useMutation,kN=m.userManagement.createScopedToken.useMutation,NN=m.userManagement.revokeScopedToken.useMutation,SN=m.userManagement.validateScopedToken.useQuery,CN=m.userManagement.listScopedTokens.useQuery,MN=m.webrtcSession.listStreams.useQuery,EN=m.webrtcSession.createSession.useMutation,AN=m.webrtcSession.handleAnswer.useMutation,PN=m.webrtcSession.closeSession.useMutation,RN=m.webrtcSession.hasAdaptiveBitrate.useQuery,_N=m.zoneAnalytics.getCurrentSnapshot.useQuery,IN=m.zoneAnalytics.getZoneHistory.useQuery,TN=m.zoneAnalytics.getCameraHistory.useQuery,DN=m.zoneAnalytics.getUnzonedHistory.useQuery,LN=m.zoneRules.listRules.useQuery,ON=m.zoneRules.setRules.useMutation,$N=m.zones.listZones.useQuery,BN=m.zones.addZone.useMutation,zN=m.zones.removeZone.useMutation,FN=m.zones.updateZone.useMutation,Vi=ot("camstack:widget-registry",null),Nr=new Map,or=new Map,Xo=new Set;function Rm(e){if(!e||typeof e!="object")return!1;const t=e.default;return t!==null&&typeof t=="object"}function _m(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 Im(e,t){const r=Nr.get(e);if(r)return r;const n=or.get(e);if(n)return n;Xo.has(e)||(Yd(),Vd([{name:e,entry:t,type:"module"}],{force:!1}),Xo.add(e));const s=Ud(`${e}/widgets`).then(a=>{if(!Rm(a)){const l=_m(a);throw new Error(`Widget remote ${e} (${t}) does not expose a default record on './widgets'. Got: ${JSON.stringify(l)}`)}const i=a.default;return Nr.set(e,i),or.delete(e),i}).catch(a=>{throw or.delete(e),a});return or.set(e,s),s}var Tm=3e4,Dm=2e3;function jN({children:e}){const t=Rn(),r=q(Date.now()),{data:n}=Pm(void 0,{staleTime:0,refetchOnMount:"always",refetchInterval:l=>{const c=l.state.data;return c&&c.length>0||Date.now()-r.current>=Tm?!1:Dm}});Pr("addon.widget-ready",()=>{t.invalidateQueries({queryKey:[["addonWidgets","listWidgets"]]})});const[s,a]=S(0);H(()=>{if(!n)return;let l=!1;const c=new Set;for(const d of n){if(c.has(d.remoteName)||(c.add(d.remoteName),Nr.has(d.remoteName)))continue;const u=d.bundleUrl;Im(d.remoteName,u).then(()=>{l||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:d.remoteName,entryUrl:u,reason:h})})}return()=>{l=!0}},[n]);const i=ee(()=>{const l=n??[],c=new Map;for(const u of l)c.set(`${u.addonId}/${u.stableId}`,u);const d=(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=c.get(u);if(!p)return;const h=Nr.get(p.remoteName);if(!h)return null;const g=h[p.stableId];if(g)return g},metadata:u=>{const p=c.get(u);if(p)return d(u,p)},listAll:()=>{const u=[];for(const[p,h]of c)u.push(d(p,h));return u}}},[n,s]);return o(Vi.Provider,{value:i,children:e})}function Lm(e){return Zn().resolve(e)}function Om(e){return Zn().metadata(e)}function GN(){return Zn().listAll()}function Zn(){const e=$m();if(!e)throw new Error("useWidgetRegistry(): no <WidgetRegistryProvider> in tree");return e}function $m(){return Bm(Vi)}function Bm(e){return Ae(e)}function zm(e){const{widgetId:t,host:r="device-tab",config:n,deviceId:s,integrationId:a,instanceId:i,size:l,columns:c,rows:d}=e,u=Lm(t),p=Om(t),h=ee(()=>i??t,[i,t]);if(u===void 0&&p===void 0)return o(sr,{widgetId:t,reason:"unknown"});if(u===void 0)return o(sr,{widgetId:t,reason:"missing-export"});if(u===null)return o(Fm,{});if(p){if(p.requires.deviceContext&&s===void 0)return o(sr,{widgetId:t,reason:"missing-device-context"});if(p.requires.integrationContext&&a===void 0)return o(sr,{widgetId:t,reason:"missing-integration-context"})}return o(u,{instanceId:h,host:r,config:n,deviceId:s,integrationId:a,size:l,columns:c,rows:d})}function Fm(){return f("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 sr({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 mt="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",Ir="block text-[11px] font-medium text-foreground mb-1",jm="text-[10px] text-foreground-subtle mt-0.5";function Ce({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",l=Qe(e,a),c=Qe(t,a);return f("div",{className:i,children:[l!==void 0&&l!==""&&f("label",{className:Ir,children:[l,r&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),s,c&&o("p",{className:jm,children:c})]})}function Gm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("input",{type:e.inputType??"text",className:mt,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 Qm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=S(t==null?"":String(t)),l=q(!1);H(()=>{l.current||i(t==null?"":String(t))},[t]);const c=d=>{if(i(d),d===""||d==="-"){r(void 0);return}const u=Number(d);Number.isNaN(u)||r(u)};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("div",{className:"flex items-center gap-1",children:[o("input",{type:"number",className:mt,value:a,placeholder:e.placeholder,min:e.min,max:e.max,step:e.step,disabled:n||e.disabled,onFocus:()=>{l.current=!0},onBlur:()=>{l.current=!1},onChange:d=>c(d.target.value)}),e.unit&&o("span",{className:"text-xs text-foreground-subtle whitespace-nowrap",children:e.unit})]})})}function Hm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=!!t,i=n||e.disabled;return e.style==="checkbox"?o(Ce,{label:void 0,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("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:l=>r(l.target.checked)}),o("span",{className:"text-xs font-medium text-foreground",children:Qe(e.label,s)}),e.required&&o("span",{className:"text-danger",children:"*"})]})}):o(Ce,{label:void 0,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("div",{className:"flex items-center justify-between",children:[f("span",{className:Ir+" mb-0",children:[Qe(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 Um({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=e.options.some(i=>i.value==="");return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("select",{className:mt,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 Vm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],i=l=>{if(a.includes(l))r(a.filter(c=>c!==l));else{if(e.maxItems!==void 0&&a.length>=e.maxItems)return;r([...a,l])}};return o(Ce,{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(l=>{const c=a.includes(l.value);return f("label",{className:["flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs cursor-pointer select-none transition-colors",c?"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:c,disabled:n||e.disabled,onChange:()=>i(l.value)}),l.label]},l.value)})})})}function qm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=S(!1),l=e.showToggle!==!1;return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("div",{className:"relative",children:[o("input",{type:a?"text":"password",className:mt+(l?" pr-9":""),value:t==null?"":String(t),placeholder:e.placeholder,disabled:n||e.disabled,onChange:c=>r(c.target.value)}),l&&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(c=>!c),children:a?o(Da,{className:"h-3.5 w-3.5"}):o(qt,{className:"h-3.5 w-3.5"})})]})})}function Wm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("textarea",{className:mt+" 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 Km({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null,i=e.nullable===!0,l=a?e.default??e.min:Number(t),c=e.showValue!==!1,d=e.nullLabel??"Auto",u=n||e.disabled,p=e.displayScale??1,h=e.min/p,g=e.max/p,b=l/p,v=(e.step??1)/p;if(i&&a)return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("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:[d," — click to set manually"]})});const x=e.showStepper===!0&&c,y=k=>{const M=l+k*(e.step??1),C=Math.min(e.max,Math.max(e.min,M));C!==l&&r(C)},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(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[f("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})]}),(c||i||e.unit)&&f("div",{className:"flex shrink-0 items-center gap-2",children:[x&&o("button",{type:"button",className:w,disabled:u||l<=e.min,onClick:()=>y(-1),title:`Decrease by ${e.step??1}`,"aria-label":"Decrement",children:o(za,{className:"h-3 w-3"})}),c&&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,C=e.step??1,A=M-e.min,_=e.min+Math.round(A/C)*C;r(Math.min(e.max,Math.max(e.min,_)))}}),x&&o("button",{type:"button",className:w,disabled:u||l>=e.max,onClick:()=>y(1),title:`Increase by ${e.step??1}`,"aria-label":"Increment",children:o(Wt,{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 ${d}`,disabled:u,onClick:()=>r(null),children:d})]})]})})}function Zm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],[i,l]=S(""),c=q(null),d=I(g=>{const b=g.trim();!b||a.includes(b)||e.maxTags!==void 0&&a.length>=e.maxTags||(r([...a,b]),l(""))},[a,e.maxTags,r]),u=g=>r(a.filter(b=>b!==g)),p=g=>{g.key==="Enter"||g.key===","?(g.preventDefault(),d(i)):g.key==="Backspace"&&i===""&&a.length>0&&u(a[a.length-1])},h=n||e.disabled;return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("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&&c.current?.focus(),children:[a.map(g=>f("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(Pe,{className:"h-2.5 w-2.5"})})]},g)),o("input",{ref:c,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=>l(g.target.value),onKeyDown:p,onBlur:()=>{i.trim()&&d(i)}}),e.suggestions&&o("datalist",{id:`tags-suggestions-${e.key}`,children:e.suggestions.map(g=>o("option",{value:g},g))})]})})}function Ym({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const{nodes:a}=qn(),i=typeof t=="string"?t:"",l=e.showOffline?a:a.filter(c=>c.isOnline);return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("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:c=>r(c.target.value),disabled:n,children:[o("option",{value:"",children:"Select node…"}),l.map(c=>f("option",{value:c.id,disabled:!c.isOnline,children:[c.shortName,c.isOnline?"":" (offline)"]},c.id))]})})}function Xm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const{nodes:a}=qn(),i=new Set(Array.isArray(t)?t.map(String):[]),l=e.showOffline?a:a.filter(d=>d.isOnline),c=d=>{const u=new Set(i);u.has(d)?u.delete(d):u.add(d),r([...u])};return o(Ce,{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:l.map(d=>{const u=i.has(d.id);return o("button",{type:"button",onClick:()=>c(d.id),disabled:n||!d.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"} ${d.isOnline?"":"opacity-50 cursor-not-allowed"}`,children:d.shortName},d.id)})})})}function Jm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null?"#000000":String(t);return f(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[f("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:mt+" 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 eh({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i,externalProbe:l}){const[c,d]=S("idle"),[u,p]=S(null),h=l?.status??c,g=l?.result??u,b=!!a||!!i,v=I(async()=>{if(b){d("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),d(k.status==="ok"?"ok":"error")}catch(w){p({status:"error",error:w instanceof Error?w.message:String(w)}),d("error")}}},[a,i,e.key,t,b]),x=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",y=h==="probing"?o(Ge,{className:"h-3 w-3 animate-spin"}):h==="ok"?o(mu,{className:"h-3 w-3"}):h==="error"?o(Er,{className:"h-3 w-3"}):o(Ua,{className:"h-3 w-3"});return f(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[f("div",{className:"@container flex items-center gap-2",style:{containerType:"inline-size"},children:[f("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 ${x}`,children:[y,o("span",{className:"hidden @[280px]:inline",children:"Test"})]}),o("input",{type:e.inputType??"url",className:mt+" flex-1 min-w-0",value:t==null?"":String(t),placeholder:e.placeholder,disabled:n||e.disabled,onChange:w=>{r(w.target.value),c!=="idle"&&(d("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 th({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a}){const[i,l]=S(e.defaultCollapsed??!1),c=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:f("div",{className:"rounded-lg border border-border bg-surface/50 overflow-hidden",children:[f("div",{className:["px-3 py-2 flex items-center justify-between",c?"cursor-pointer hover:bg-surface":""].join(" "),onClick:c?()=>l(d=>!d):void 0,children:[o("span",{className:"text-xs font-semibold text-foreground",children:Qe(e.label,s)}),c&&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(d=>o(Yt,{field:d,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a},d.key))})]})})}function rh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const[l,c]=S(e.tabs[0]?.id??""),d=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:f("div",{className:d,children:[e.label&&o("div",{className:Ir,children:Qe(e.label,s)}),f("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===l;return f("button",{type:"button",role:"tab","aria-selected":p,onClick:()=>c(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:Qe(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!==l?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(Yt,{field:p,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i},g)})},u.id))]})]})}function nh({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 Jo={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 oh(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 l of i){if(!t.has(l.tagName)){const d=r.createTextNode(l.textContent??"");l.replaceWith(d);continue}const c=l.tagName==="A"?new Set(["href"]):new Set;for(const d of Array.from(l.attributes))c.has(d.name)||l.removeAttribute(d.name);if(l.tagName==="A"){const d=l.getAttribute("href")??"";!/^https?:\/\//i.test(d)&&!d.startsWith("mailto:")?l.removeAttribute("href"):(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))}s(l)}};return s(n),n.innerHTML}function sh({field:e}){const t=Jo[e.variant??"info"]??Jo.info,r=e.format==="html";return o("div",{className:"col-span-full",children:f("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:oh(e.content)}}):o("p",{className:"text-xs text-foreground-subtle leading-relaxed whitespace-pre-line",children:e.content})]})})}var es={ok:"bg-success",warn:"bg-amber-500",danger:"bg-danger",idle:"bg-foreground-subtle/40",unknown:"bg-foreground-subtle/40"};function ah(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 ih(e){return!Number.isFinite(e)||e<=0?"—":new Date(e).toLocaleTimeString()}function lh({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"?f("span",{className:"inline-flex items-center gap-1.5",children:[o("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${es[String(t).toLowerCase()]??es.unknown}`}),o("span",{children:String(t)})]}):e==="duration"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:ah(t)}):e==="timestamp"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:ih(t)}):o("span",{children:String(t)})}function ch({field:e}){const t=e.value??[],r=e.description;return f("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:f("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(lh,{kind:a.kind,value:n[a.key]})},a.key))},s))})]})})]})}function dh({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const l=Array.isArray(t)?t:[],c=e.minRows??0,d=e.maxRows??Number.POSITIVE_INFINITY,u=(x,y,w)=>{const k=l.slice();k[x]={...k[x]??{},[y]:w},r(k)},p=x=>{l.length<=c||r(l.filter((y,w)=>w!==x))},h=()=>{if(l.length>=d)return;const x=e.defaultItem??{};r([...l,{...x}])},g=(x,y)=>e.rowTitleTemplate?e.rowTitleTemplate.replace(/\{(\w+)\}/g,(w,k)=>{const M=x[k];return M==null||M===""?"—":String(M)}):`Row ${y+1}`,b=l.length>c,v=l.length<d;return f("div",{className:"col-span-full space-y-2",children:[f("div",{className:"space-y-0.5",children:[e.label&&o("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle",children:Qe(e.label,s)}),e.description&&o("p",{className:"text-[11px] text-foreground-subtle",children:Qe(e.description,s)})]}),l.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:l.map((x,y)=>f("div",{className:"rounded-md border border-border bg-background",children:[f("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(x,y)}),f("button",{type:"button",onClick:()=>p(y),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 ${c} row(s) required`,children:[o(za,{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(Yt,{field:w,values:x,onChange:(k,M)=>u(y,k,M),disabled:n,translationFn:s,onTestField:a,allFields:e.itemFields,onAction:i},w.key))})]},y))}),f("div",{children:[f("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(Wt,{className:"h-3 w-3"}),e.addLabel??"Add"]}),!v&&Number.isFinite(d)&&f("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["(limit: ",d,")"]})]})]})}function uh({field:e,disabled:t,onAction:r}){const[n,s]=S(!1),a=Wn(),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)}}},l={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(Ce,{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 ${l[e.variant??"default"]??l.default}`,children:n?"Processing...":e.buttonLabel})})}function qi(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 ph({field:e,value:t,values:r,onChange:n,disabled:s,onAction:a}){const[i,l]=S(!1),[c,d]=S(null),[u,p]=S(null),h=qi(e,r),g=Object.keys(e.paramsFromForm??{}).some(y=>h[y]===void 0);H(()=>{if(!a||g){p(null),d(null);return}let y=!1;return l(!0),d(null),a(e.action,e.key,h).then(w=>{if(y)return;const k=w;let M=[];if(Array.isArray(k))M=k;else if(k&&typeof k=="object")for(const C of Object.keys(k)){const A=k[C];if(Array.isArray(A)){M=A;break}}p(M)}).catch(w=>{y||(d(w instanceof Error?w.message:String(w)),p([]))}).finally(()=>{y||l(!1)}),()=>{y=!0}},[(e.refreshOn??Object.values(e.paramsFromForm??{})).map(y=>`${y}=${JSON.stringify(r[y])}`).join("|"),a,e.action,e.key]);const b=e.mapOption.value,v=e.mapOption.label,x=e.mapOption.description;return o(Ce,{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?f("div",{className:"flex items-center gap-2 text-[11px] text-foreground-subtle",children:[o(Ge,{className:"h-3 w-3 animate-spin"})," Loading options…"]}):c?o("div",{className:"text-[11px] text-danger",children:c}):u&&u.length===0?o("div",{className:"text-[11px] text-foreground-subtle italic",children:e.emptyResultsMessage??"No options returned."}):(()=>{const y=(u??[]).some(w=>{const k=w[b];return k===""||k===void 0});return f("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:[!y&&o("option",{value:"",children:"— Select —"}),(u??[]).map((w,k)=>{const M=w[b],C=w[v],A=x?w[x]:void 0,_=typeof M=="string"&&M!==""?M:`row-${k}`;return f("option",{value:typeof M=="string"?M:String(M??""),children:[typeof C=="string"?C:String(C??_),A!==void 0?` (${String(A)})`:""]},_)})]})})()})}function fh({field:e,values:t,disabled:r,onAction:n}){const[s,a]=S(!1),[i,l]=S(null),c=Wn(),d=async()=>{if(e.confirmMessage&&!await c({title:e.label,message:e.confirmMessage,confirmLabel:e.buttonLabel,variant:e.variant==="danger"?"danger":"default"})||!n)return;const p=qi(e,t);a(!0),l(null);try{const h=await n(e.action,e.key,p),g=typeof h=="object"&&h!==null?h:null;l({kind:"ok",text:e.successMessage?e.successMessage.replace(/\{(\w+)\}/g,(b,v)=>{const x=g?.[v];return x===void 0?"":String(x)}):"Done."})}catch(h){l({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(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:f("div",{className:"flex flex-col gap-1.5",children:[o("button",{onClick:d,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 mh({field:e}){const t=Em();return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:o(zm,{widgetId:e.widgetId,host:"device-tab",config:e.widgetConfig,deviceId:t??void 0,instanceId:e.key})})}function hh(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 gh({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,l=hh(i,"unit"in e?e.unit:void 0),c="label"in e?e.label:void 0,d="description"in e?e.description:void 0,u="span"in e?e.span:void 0,p="actions"in e?e.actions??[]:[];return o(Ce,{label:c,description:d,span:u,translationFn:n,children:f("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:l}),p.length>0&&o("div",{className:"flex items-center gap-1",children:p.map(h=>o(vh,{action:h,fieldKey:s,value:i,onAction:r},h.action))})]})})}function bh({name:e}){const t="h-3.5 w-3.5";switch(e){case"copy":return o(at,{className:t});case"refresh-cw":return o(Gn,{className:t});case"external-link":return o(Ta,{className:t});case"trash-2":return o(qe,{className:t});case"download":return o(fn,{className:t});case"upload":return o(Ha,{className:t});default:return o(Qn,{className:t})}}function vh({action:e,fieldKey:t,value:r,onAction:n}){const s=Wn(),[a,i]=S(!1),l=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 ${l}`,children:o(bh,{name:e.icon})})}function yh(e){return"multiple"in e&&e.multiple!=null}function xh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c}){const d=e.multiple,u=d.min,p=d.max,h=t[e.key],g=[...Array.isArray(h)?h:h!=null?[h]:[]],b=d.itemDefault!==void 0?d.itemDefault:"default"in e&&e.default!==void 0?e.default:"";for(;g.length<u;)g.push(b);const v=M=>r(e.key,[...M]),x=(M,C)=>{const A=[...g];A[M]=C,v(A)},y=()=>{g.length>=p||v([...g,b])},w=M=>{g.length<=u||v(g.filter((C,A)=>A!==M))},k=()=>{const{multiple:M,...C}=e;return{...C,...{label:void 0,description:void 0,required:!1}}};return o(Ce,{label:e.label,description:e.description,required:u>0?e.required:!1,span:e.span,translationFn:s,children:f("div",{className:"space-y-2",children:[g.map((M,C)=>{const A=d.itemLabel?.replace("${n}",String(C+1));return f("div",{className:"space-y-1",children:[A&&o("div",{className:Ir,children:A}),f("div",{className:"flex items-center gap-2",children:[o("div",{className:"flex-1 min-w-0",children:o(Yt,{field:k(),values:{...t,[e.key]:M},onChange:(_,P)=>x(C,P),disabled:n,translationFn:s,onTestField:a,onAction:c,allFields:l})}),g.length>u&&o("button",{type:"button",onClick:()=>w(C),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(qe,{className:"h-3.5 w-3.5"})})]})]},C)}),f("div",{className:"flex items-center justify-between pt-1",children:[g.length<p?f("button",{type:"button",onClick:y,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(Wt,{className:"h-3 w-3"}),d.addLabel??"Add"]}):o("span",{}),f("span",{className:"text-[10px] text-foreground-subtle tabular-nums",children:[g.length,"/",p]})]})]})})}function wh(e,t,r){if(!("showWhen"in e)||!e.showWhen)return!0;const n=e.showWhen,s=t[n.field],a=r?.find(c=>"key"in c&&c.key===n.field),i=a&&"default"in a?a.default:void 0,l=s!==void 0?s:i;return n.equals!==void 0?l===n.equals:n.notEquals!==void 0?l!==n.notEquals:n.in!==void 0?n.in.includes(l):n.notIn!==void 0?!n.notIn.includes(l):n.includes!==void 0?Array.isArray(l)&&l.includes(n.includes):n.notIncludes!==void 0?!Array.isArray(l)||!l.includes(n.notIncludes):!0}function Yt({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c}){if(yh(e))return o(xh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c});if("readonlyField"in e&&e.readonlyField===!0)return o(gh,{field:e,values:t,onAction:c,translationFn:s});if(!wh(e,t,l))return null;const d=t[e.key],u=d!==void 0?d:"default"in e?e.default:void 0,p=g=>r(e.key,g),h=Mm(e.type);switch(e.type){case"text":return o(Gm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"number":return o(Qm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"boolean":return o(Hm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"select":return o(Um,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"multiselect":return o(Vm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"password":return o(qm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"textarea":return o(Wm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"slider":return o(Km,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"tags":return o(Zm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"color":return o(Jm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"node-select":return o(Ym,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"node-multiselect":return o(Xm,{field:e,value:u,onChange:p,disabled:n,translationFn:s});case"probe":return o(eh,{field:e,value:u,onChange:p,disabled:n,translationFn:s,onTestField:a,onAction:c,externalProbe:i});case"group":return o(th,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a});case"sub-tabs":return o(rh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:c});case"separator":return o(nh,{});case"info":return o(sh,{field:e});case"object-array":return o(ch,{field:e});case"editable-array":return o(dh,{field:e,value:u,onChange:p,disabled:n,translationFn:s,onTestField:a,onAction:c});case"button":return o(uh,{field:e,disabled:n,onAction:c});case"addon-action-select":return o(ph,{field:e,value:u,values:t,onChange:p,disabled:n,onAction:c});case"addon-action-button":return o(fh,{field:e,values:t,disabled:n,onAction:c});case"widget":return o(mh,{field:e});default:return h?o(h,{field:e,value:u,onChange:p,disabled:n}):null}}function kh(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function Qe(e,t){if(e!==void 0)return t&&kh(e)?t(e):e}function Nh({section:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i}){const[l,c]=S(e.defaultCollapsed??!1),d=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 f("div",{className:"@container rounded-lg border border-border bg-surface p-3",style:{containerType:"inline-size"},children:[f("div",{className:["flex items-center justify-between mb-2",d?"cursor-pointer":""].join(" "),onClick:d?()=>c(h=>!h):void 0,children:[f("div",{children:[o("h3",{className:"text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider",children:Qe(e.title,s)}),e.description&&o("p",{className:"text-[10px] text-foreground-subtle mt-0.5",children:Qe(e.description,s)})]}),d&&o("span",{className:"text-foreground-subtle text-xs ml-2",children:l?"▸":"▾"})]}),!l&&o("div",{className:`grid ${p} gap-x-3 gap-y-2.5`,children:e.fields.map(h=>o(Yt,{field:h,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i?.[h.key]},h.key))})]})}function Sh({schema:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i,onClearProbe:l}){const c=(d,u)=>{r({...t,[d]:u}),l?.(d)};return o("div",{className:"space-y-4",children:e.sections.map(d=>o(Nh,{section:d,values:t,onChange:c,disabled:n,translationFn:s,onTestField:a,probeResults:i},d.id))})}var Ch=({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 ts(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 Mh(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 QN({trpc:e,addonId:t,nodeId:r,title:n,disabled:s,onAfterChange:a,refreshToken:i,collapsible:l,defaultOpen:c,mode:d,onOverrideChange:u}){const p=d??"persist",[h,g]=S(null),[b,v]=S(!0),[x,y]=S(null),[w,k]=S(!1),[M,C]=S(c??!1),[A,_]=S({}),[P,Q]=S(null);H(()=>{Q(null),_({})},[e,t,r,i,p]),H(()=>{let ie=!1;v(!0),y(null);const ne=p==="override"&&Object.keys(A).length>0?A:void 0;return e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r,...ne?{overlay:ne}:{}}).then(W=>{ie||(g(W),ne||Q(ts(W)),v(!1))}).catch(W=>{ie||(y(W instanceof Error?W.message:String(W)),v(!1))}),()=>{ie=!0}},[e,t,r,i,p,JSON.stringify(A)]);const oe=ee(()=>ts(h),[h]),le=ee(()=>h?Mh(h):null,[h]),ge=async ie=>{if(p==="override"){const W=P??oe,ye={};for(const T of Object.keys(ie))ie[T]!==W[T]&&(ye[T]=ie[T]);const me={...W,...ye};_(ye),u?.(ye,me);return}const ne={};for(const W of Object.keys(ie))ie[W]!==oe[W]&&(ne[W]=ie[W]);if(Object.keys(ne).length!==0){k(!0);try{await e.addonSettings.updateGlobalSettings.mutate({addonId:t,nodeId:r,patch:ne}),g(await e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r})),a?.()}catch(W){y(W instanceof Error?W.message:String(W))}finally{k(!1)}}};if(b)return f("div",{className:"text-xs text-foreground-subtle animate-pulse",children:["Loading ",n??t,"…"]});if(x)return f("div",{className:"text-xs text-red-400",children:[n??t,": ",x]});if(!h||!le)return f("div",{className:"text-xs text-foreground-subtle",children:[n??t," not available on ",r,"."]});const de=p==="override"?{...oe,...A}:oe,pe=f(Ne,{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(Sh,{schema:le,values:de,onChange:ge,disabled:s===!0||w})]});return l===!0?f("section",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[f("button",{type:"button",onClick:()=>C(ie=>!ie),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-surface-hover text-left","aria-expanded":M,children:[o(Ch,{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:pe}):null]}):n?f("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:pe})]}):o("div",{children:pe})}function Eh({detections:{motion:e,motionRaw:t,detection:r,phase:n},showMotionZones:s=!0,showMotionRaw:a=!0,showDetections:i=!0,showPhaseIndicator:l=!0}){const c=s&&e&&e.zones.length>0,d=a&&t&&t.boxes.length>0,u=i&&r&&r.detections.length>0;return!c&&!d&&!u&&!l?null:f("div",{className:"absolute inset-0 pointer-events-none z-10",children:[l&&o(Ah,{phase:n}),d&&o(Ph,{raw:t}),c&&o(Rh,{motion:e}),u&&o(_h,{detections:r.detections,frameWidth:r.frameWidth,frameHeight:r.frameHeight})]})}function Ah({phase:e}){const t=js(e);return f("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 Ph({raw:e}){return e.frameWidth===0||e.frameHeight===0?null:o(Ne,{children:e.boxes.map((t,r)=>{const[n,s,a,i]=t.bbox,l=n/e.frameWidth*100,c=s/e.frameHeight*100,d=(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:`${l}%`,top:`${c}%`,width:`${d}%`,height:`${u}%`,backgroundColor:`rgba(239, 68, 68, ${p})`}},`mr-${r}`)})})}function Rh({motion:e}){return e.frameWidth===0||e.frameHeight===0?null:o(Ne,{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 _h({detections:e,frameWidth:t,frameHeight:r}){return t===0||r===0?null:o(Ne,{children:e.map(n=>{const{x:s,y:a,width:i,height:l}=n.bbox,c=s/t*100,d=a/r*100,u=i/t*100,p=l/r*100,h=Be(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:`${c}%`,top:`${d}%`,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 Ih(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 Th=3e3,Dh=5;function Lh({serverUrl:e,streamKey:t,label:r,autoPlay:n=!0,muted:s=!0,showControls:a=!0,className:i="",onStateChange:l,onError:c,overlay:d,createSession:u,sendAnswer:p,closeSession:h,hintsOverride:g}){const b=q(null),v=q(null),x=q(null),y=q(new Set),w=q(null),k=q(null),M=q(0),C=q(!0),[A,_]=S("idle"),[P,Q]=S(""),[oe,le]=S(s),[ge,de]=S(!1),[pe,ie]=S(!1),ne=q(null),W=q(!1);(p||u)&&(W.current=!0);const ye=W.current,me=I(X=>{_(X),l?.(X)},[l]),T=I(()=>{if(w.current?.abort(),w.current=null,k.current&&(clearTimeout(k.current),k.current=null),x.current&&(x.current.close(),x.current=null),h&&y.current.size>0){for(const X of y.current)h(X).catch(()=>{});y.current.clear()}b.current&&(b.current.srcObject=null)},[h]),z=I(async()=>{if(!C.current||!u||!p)return;T(),me("connecting");const X=new AbortController;w.current=X;try{const{sessionId:fe,sdpOffer:xe}=await u({...Ih(v.current),...g});if(y.current.add(fe),!C.current||X.signal.aborted){h?.(fe).catch(()=>{}),y.current.delete(fe);return}const we=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});x.current=we;const O=new MediaStream;we.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(()=>{}))},we.oniceconnectionstatechange=()=>{if(!C.current)return;const L=we.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"),K())},we.onicecandidateerror=L=>{console.debug("[WebRTC] ICE candidate error:",L)},console.debug("[WebRTC] Setting remote description (server offer)..."),await we.setRemoteDescription({type:"offer",sdp:xe});const E=await we.createAnswer();if(await we.setLocalDescription(E),console.debug("[WebRTC] Local description set, waiting for ICE gathering..."),await rs(we),!C.current)return;const D=(we.localDescription?.sdp??"").split(`
|
|
77
|
+
`).filter(L=>L.startsWith("a=candidate:")).length;console.debug("[WebRTC] Sending answer to server",{localCandidates:D,sessionId:fe.slice(0,8)}),await p(fe,we.localDescription?.sdp??""),console.debug("[WebRTC] Answer sent successfully");const J=we,ae=()=>{const L=J.connectionState;if(L==="closed"||L==="failed")return;const te=b.current;te&&te.readyState===0&&console.log(`[WebRTC] no video data yet (ice=${J.iceConnectionState})`)};setTimeout(ae,3e3),setTimeout(ae,8e3)}catch(fe){if(!C.current)return;const xe=fe instanceof Error?fe.message:String(fe);Q(xe),me("error"),c?.(xe),K()}},[e,t,u,p,T,me,c,g]),B=I(async()=>{if(C.current){T(),me("connecting");try{const X=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});x.current=X,X.addTransceiver("video",{direction:"recvonly"}),X.addTransceiver("audio",{direction:"recvonly"});const fe=new MediaStream;X.ontrack=D=>{fe.addTrack(D.track),b.current&&(b.current.srcObject=fe,b.current.play().catch(()=>{}))},X.oniceconnectionstatechange=()=>{if(!C.current)return;const D=X.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"),K())};const xe=await X.createOffer();if(await X.setLocalDescription(xe),await rs(X),!C.current)return;const we=`${e}/api/webrtc?src=${encodeURIComponent(t)}`,O=await fetch(we,{method:"POST",headers:{"Content-Type":"application/sdp"},body:X.localDescription?.sdp??""});if(!O.ok)throw new Error(`WHEP ${O.status}: ${O.statusText}`);const E=await O.text();await X.setRemoteDescription({type:"answer",sdp:E})}catch(X){if(!C.current)return;const fe=X instanceof Error?X.message:String(X);Q(fe),me("error"),c?.(fe),K()}}},[e,t,T,me,c]),se=ye?z:B,U=q(()=>{});U.current=se;const K=I(()=>{C.current&&(M.current>=Dh||(M.current+=1,k.current=setTimeout(()=>{C.current&&U.current()},Th)))},[]);H(()=>(C.current=!0,M.current=0,n&&se(),()=>{C.current=!1,T()}),[e,t]);const Z=q(!1);H(()=>{!n||!ye||!u||!p||Z.current||x.current||(Z.current=!0,se())},[n,ye,u,p,se]);const G=()=>{M.current=0,se()},re=()=>{b.current&&(b.current.muted=!b.current.muted,le(b.current.muted))},Y=async()=>{if(v.current)try{document.fullscreenElement?await document.exitFullscreen():await v.current.requestFullscreen()}catch(X){console.warn(`Fullscreen toggle failed: ${X instanceof Error?X.message:X}`)}},Re=()=>{if(!b.current)return;const X=document.createElement("canvas");X.width=b.current.videoWidth||1280,X.height=b.current.videoHeight||720;const fe=X.getContext("2d");if(!fe)return;fe.drawImage(b.current,0,0);const xe=document.createElement("a");xe.download=`${t.replace(/[/:]/g,"-")}-${Date.now()}.jpg`,xe.href=X.toDataURL("image/jpeg",.92),xe.click()};H(()=>{const X=()=>de(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",X),()=>document.removeEventListener("fullscreenchange",X)},[]);const _e=()=>{ie(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>ie(!1),3e3)};return f("div",{ref:v,className:`relative bg-black overflow-hidden group ${i}`,onMouseMove:_e,onMouseEnter:_e,children:[o("video",{ref:b,autoPlay:n,muted:oe,playsInline:!0,className:"w-full h-full object-contain"}),r&&A==="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}),d,A==="connecting"&&f("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…"})]}),(A==="error"||A==="disconnected")&&f("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:A==="error"?P||"Connection failed":"Disconnected"}),o("button",{onClick:G,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&&A==="playing"&&f("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 ${pe?"opacity-100":"opacity-0"}`,children:[o("div",{className:"flex items-center gap-1",children:o(Yr,{onClick:re,title:oe?"Unmute":"Mute",children:oe?f("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"})]}):f("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"})]})})}),f("div",{className:"flex items-center gap-1",children:[o(Yr,{onClick:Re,title:"Take snapshot",children:f("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(Yr,{onClick:Y,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 Yr({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 rs(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 Yn=ot("camstack:player-overlays-state",null),Xn=ot("camstack:player-overlays-actions",null);function HN({children:e}){const[t,r]=S(()=>new Map),[n,s]=S(()=>new Map),a=I(p=>{r(h=>{const g=new Map(h);return g.set(p.id,p),g})},[]),i=I(p=>{r(h=>{if(!h.has(p))return h;const g=new Map(h);return g.delete(p),g})},[]),l=I(p=>{s(h=>{const g=new Map(h);return g.set(p.id,p),g})},[]),c=I(p=>{s(h=>{if(!h.has(p))return h;const g=new Map(h);return g.delete(p),g})},[]),d=ee(()=>({layers:t,buttons:n}),[t,n]),u=ee(()=>({setLayer:a,removeLayer:i,setButton:l,removeButton:c}),[a,i,l,c]);return o(Yn.Provider,{value:d,children:o(Xn.Provider,{value:u,children:e})})}function UN(){const e=Ae(Yn);return ee(()=>e?[...e.layers.values()].sort((t,r)=>t.order-r.order):[],[e])}function Oh(){const e=Ae(Yn);return ee(()=>e?[...e.buttons.values()].sort((t,r)=>t.order-r.order):[],[e])}function VN(e){const t=Ae(Xn);H(()=>{if(!(!t||!e))return t.setLayer(e),()=>t.removeLayer(e.id)},[t,e])}function qN(e){const t=Ae(Xn);H(()=>{if(!(!t||!e))return t.setButton(e),()=>t.removeButton(e.id)},[t,e])}function $h(e){return e==="streaming"?"bg-emerald-500":e==="connecting"?"bg-amber-500":e==="error"?"bg-rose-500":"bg-zinc-500"}function Bh(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 En({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 zh({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 Fh({className:e}){return f("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 jh({className:e}){return f("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 Xr({label:e,active:t,onClick:r}){return f("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 Wi({className:e}){return f("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 Gh({className:e}){return f("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 WN({serverUrl:e,createSession:t,sendAnswer:r,closeSession:n,streams:s,activeStreamId:a,onStreamChange:i,deviceName:l,phase:c,pipelineMetrics:d,detections:u,defaultShowDetections:p=!0,defaultShowMotion:h=!1,streamStats:g,autoPlay:b=!1,showPlayStop:v=!1,snapshotSrc:x,snapshotLoading:y=!1,onRefreshSnapshot:w,showStreamStats:k=!1,children:M,extraOverlay:C,ptzAvailable:A=!1,ptzShown:_=!1,ptzOverlay:P,onPtzToggle:Q,intercomAvailable:oe=!1,intercomShown:le=!1,onIntercomToggle:ge,chromeless:de=!1,className:pe}){const ie=Oh(),[ne,W]=S(b),[ye,me]=S(p),[T,z]=S(h),[B,se]=S(null),[U,K]=S(!1),Z=q(null);H(()=>{if(!U)return;function L(te){Z.current&&!Z.current.contains(te.target)&&K(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[U]);const G=a??B??s?.[0]?.id??"",re=s?.find(L=>L.id===G)??s?.[0],Y=re?.inputFps!=null?{status:re.status??"unknown",inputFps:re.inputFps,bitrateKbps:re.bitrateKbps??0}:null,Re=L=>{se(L),i?.(L),ne&&v&&(W(!1),setTimeout(()=>W(!0),50))},_e=ee(()=>{const L=re?.target;if(L)return te=>t(L,te)},[t,re]),X=s,fe=()=>W(!0),xe=()=>W(!1),we=d?.phase??c,O=we==="active",E=!!u,D=E&&(ye||T),J=A&&_&&!!P,ae=v?ne:!0;return f("div",{className:`overflow-hidden ${de?"":"rounded-xl border border-border bg-surface"} ${pe??""}`,children:[f("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[f("div",{className:"flex items-center gap-2",children:[(g??Y)&&o("span",{className:`w-2 h-2 rounded-full ${$h((g??Y).status)}`}),l&&o("span",{className:"text-xs font-medium text-foreground",children:l}),X&&X.length>1&&f("div",{className:"relative",children:[o("select",{"data-testid":"stream-profile-select",value:G,onChange:L=>Re(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:X.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"})})})]})]}),f("div",{className:"flex items-center gap-1.5",children:[oe&&f("button",{"data-testid":"stream-intercom-toggle","data-intercom-shown":le?"true":"false",onClick:ge,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors ${le?"bg-primary/15 text-primary":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover"}`,title:le?"Close intercom":"Open intercom",children:[o(Fh,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:"Intercom"})]}),ie.map(L=>{const te=L.tone==="primary"?"bg-primary text-primary-foreground":"bg-primary/15 text-primary";return f("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?te:"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&&f("button",{"data-testid":"stream-play-toggle","data-stream-playing":ae?"true":"false",onClick:ae?xe:fe,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors ${ae?"bg-danger/10 text-danger hover:bg-danger/20":"bg-primary/10 text-primary hover:bg-primary/20"}`,title:ae?"Stop stream":"Start stream",children:[ae?o(zh,{className:"h-3 w-3"}):o(En,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:ae?"Stop":"Play"})]}),w&&f("button",{"data-testid":"stream-snapshot-refresh",onClick:w,disabled:y,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(Wi,{className:`h-3 w-3 ${y?"animate-spin":""}`}),o("span",{className:"hidden xl:inline",children:"Snapshot"})]}),(E||A||d||we||g||Y&&Y.inputFps>0)&&f("div",{ref:Z,className:"relative",children:[o("button",{onClick:()=>K(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(jh,{className:"h-3.5 w-3.5"})}),U&&f("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&&f("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),f("span",{className:"tabular-nums text-foreground",children:[g.inputFps.toFixed(1)," fps"]})]}),f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Decode"}),f("span",{className:"tabular-nums text-foreground",children:[g.decodeFps.toFixed(1)," fps"]})]}),f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Uptime"}),o("span",{className:"tabular-nums text-foreground",children:Bh(g.uptimeMs)})]})]}),!k&&Y&&Y.inputFps>0&&f("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),f("span",{className:"tabular-nums text-foreground",children:[Y.inputFps.toFixed(1)," fps"]})]}),Y.bitrateKbps>0&&f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Bitrate"}),f("span",{className:"tabular-nums text-foreground",children:[Y.bitrateKbps," kbps"]})]})]}),(d||E&&we)&&f("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[f("div",{className:"flex justify-between gap-3 items-center",children:[o("span",{children:"Phase"}),f("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"]})]}),d&&d.detectionFps>0&&f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Detection"}),f("span",{className:"tabular-nums text-foreground",children:[d.detectionFps.toFixed(1)," det/s"]})]}),d&&d.avgInferenceMs>0&&f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Inference"}),f("span",{className:"tabular-nums text-foreground",children:[d.avgInferenceMs.toFixed(0)," ms"]})]})]}),E&&f(Ne,{children:[o(Xr,{label:"Show detections",active:ye,onClick:()=>me(L=>!L)}),o(Xr,{label:"Show motion",active:T,onClick:()=>z(L=>!L)})]}),A&&o(Xr,{label:"PTZ controls",active:_,onClick:()=>{Q?.(),K(!1)}})]})]})]})]}),ae?o("div",{className:"aspect-video relative",children:o(Lh,{serverUrl:e,streamKey:G,autoPlay:!0,className:"w-full h-full",createSession:_e,sendAnswer:r,closeSession:n,overlay:D||C||J?f(Ne,{children:[D&&o(Eh,{detections:u,showPhaseIndicator:!1,showMotionZones:T,showMotionRaw:T,showDetections:ye}),C,J&&P]}):void 0},G)}):o(Qh,{src:x??null,isLoading:y,onPlay:fe,onRetry:w,extraOverlay:C||J?f(Ne,{children:[C,J&&P]}):null,suppressPlayHover:!!C||J}),M]})}function Qh({src:e,isLoading:t,onPlay:r,onRetry:n,extraOverlay:s,suppressPlayHover:a=!1}){return e?f("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(En,{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:f("div",{className:"flex flex-col items-center gap-2 text-white/40",children:[o(Gh,{className:"h-8 w-8"}),o("span",{className:"text-xs",children:"No snapshot available"}),f("div",{className:"flex items-center gap-2 mt-1",children:[n&&f("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(Wi,{className:"h-3 w-3"}),"Retry"]}),f("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(En,{className:"h-3 w-3"}),"Play Live"]})]})]})})}function KN({samples:e,sampleRate:t=16e3,height:r=96,className:n="",color:s="#3b82f6",bgColor:a="transparent"}){const i=q(null),l=q(null),c=I(()=>{const u=i.current,p=l.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,x=r/2;b.fillStyle=s,b.globalAlpha=.7;for(let y=0;y<h;y++){const w=Math.floor(y*v),k=Math.min(Math.floor((y+1)*v),e.length);let M=0,C=0;for(let Q=w;Q<k;Q++){const oe=e[Q];oe<M&&(M=oe),oe>C&&(C=oe)}const A=x-C*x,_=x-M*x,P=Math.max(1,_-A);b.fillRect(y,A,1,P)}b.globalAlpha=1,b.strokeStyle=s,b.globalAlpha=.2,b.lineWidth=1,b.beginPath(),b.moveTo(0,x),b.lineTo(h,x),b.stroke(),b.globalAlpha=1},[e,r,s,a]);H(()=>{c()},[c]),H(()=>{const u=new ResizeObserver(()=>c()),p=l.current;return p&&u.observe(p),()=>u.disconnect()},[c]);const d=((e&&t?Math.round(e.length/t*1e3):0)/1e3).toFixed(1);return f("div",{ref:l,className:`relative ${n}`,children:[o("canvas",{ref:i,className:"w-full rounded-md"}),e&&e.length>0&&f("div",{className:"absolute bottom-1 right-2 text-[10px] text-foreground-subtle/60 font-mono",children:[d,"s · ",t/1e3,"kHz · ",e.length.toLocaleString()," samples"]})]})}function ZN({currentDbfs:e,durationSec:t=30,maxSamples:r=120,height:n=64,className:s="",color:a="#10b981",clipColor:i="#ef4444",clipThreshold:l=-6,minDbfs:c=-96}){const d=q(null),u=q(null),[p,h]=S([]);H(()=>{e!==null&&h(v=>{const x=[...v,{dbfs:e,timestamp:Date.now()}];return x.length>r?x.slice(-r):x})},[e,r]);const g=I(()=>{const v=d.current,x=u.current;if(!v||!x)return;const y=x.clientWidth;if(y===0)return;const w=window.devicePixelRatio||1;v.width=y*w,v.height=n*w,v.style.width=`${y}px`,v.style.height=`${n}px`;const k=v.getContext("2d");if(!k||(k.scale(w,w),k.clearRect(0,0,y,n),p.length===0))return;const M=p[p.length-1].timestamp,C=t*1e3,A=M-C,_=p.filter(le=>le.timestamp>=A);if(_.length===0)return;const P=Math.max(1,Math.floor(y/(t*2))),Q=Math.abs(c);for(const le of _){const ge=le.timestamp-A,de=Math.floor(ge/C*y),pe=(Math.max(c,Math.min(0,le.dbfs))-c)/Q,ie=Math.max(1,pe*n);k.fillStyle=le.dbfs>=l?i:a,k.globalAlpha=.8,k.fillRect(de,n-ie,P,ie)}k.globalAlpha=1;const oe=n-(l-c)/Q*n;k.strokeStyle=i,k.globalAlpha=.25,k.lineWidth=1,k.setLineDash([4,4]),k.beginPath(),k.moveTo(0,oe),k.lineTo(y,oe),k.stroke(),k.setLineDash([]),k.globalAlpha=1},[p,t,n,a,i,l,c]);H(()=>{g()},[g]),H(()=>{const v=new ResizeObserver(()=>g()),x=u.current;return x&&v.observe(x),()=>v.disconnect()},[g]);const b=p.length>0?p[p.length-1].dbfs:null;return f("div",{ref:u,className:`relative ${s}`,children:[o("canvas",{ref:d,className:"w-full rounded-md"}),f("div",{className:"absolute top-1 left-2 text-[9px] text-foreground-subtle/50 font-mono",children:[t,"s"]}),b!==null&&f("div",{className:"absolute bottom-1 right-2 text-[9px] text-foreground-subtle/50 font-mono",children:[b.toFixed(1)," dBFS · ",p.length," samples"]})]})}function Hh(e){return e>=.8?"bg-emerald-500":e>=.5?"bg-amber-500":e>=.3?"bg-orange-500":"bg-zinc-500"}function Uh(e){return e>=.8?"text-emerald-400":e>=.5?"text-amber-400":e>=.3?"text-orange-400":"text-zinc-400"}function YN({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"})}):f("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${s}`,children:[f("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"}),f("div",{className:"flex items-center gap-3 text-[10px] text-foreground-subtle",children:[a.length<e.length&&f("span",{children:["showing ",a.length," of ",e.length]}),r!==void 0&&f("span",{className:"font-mono",children:[r.toFixed(1),"ms"]})]})]}),o("div",{className:"divide-y divide-border/50",children:a.map((l,c)=>{const d=i>0?l.score/i*100:0;return f("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:c+1}),o("span",{className:"text-xs font-medium text-foreground min-w-[120px]",children:l.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 ${Hh(l.score)}`,style:{width:`${d}%`}})}),f("span",{className:`text-xs font-mono font-semibold w-14 text-right ${Uh(l.score)}`,children:[(l.score*100).toFixed(1),"%"]})]},`${l.className}-${c}`)})})]})}function XN({data:e,label:t="Response",className:r=""}){const[n,s]=S(!1);if(!e)return null;const a=JSON.stringify(e,null,2);return f("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${r}`,children:[f("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:[f("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 Vh={Activity:et,Eye:qt,AlertTriangle:Kt,PauseCircle:bu,PowerOff:Tu};function JN({phase:e,...t}){const r=Vh[js(e).icon];return o(r,{...t})}function St(e){const[t,r]=S([]),n=I(a=>{r(i=>{const l=[...i,a];return l.length>e?l.slice(-e):l})},[e]),s=I(()=>{r([])},[]);return ee(()=>({entries:t,append:n,reset:s}),[t,n,s])}function ns(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 os={error:{icon:Er,color:"text-red-400"},warn:{icon:Kt,color:"text-amber-400"},info:{icon:Mu,color:"text-blue-400"},debug:{icon:uu,color:"text-gray-500"}},ss={debug:0,info:1,warn:2,error:3},qh=["all","debug","info","warn","error"],Wh=500;function Kh(e,t){return t?(ss[e]??0)>=(ss[t]??0):!0}function Ki({agentId:e,addonId:t,deviceId:r,integrationId:n,requestId:s,level:a,maxHeight:i="max-h-96",showScope:l=!1,showFilters:c=!0,limit:d=100,liveBuffer:u,onClose:p,className:h}){const[g,b]=S(""),[v,x]=S(""),[y,w]=S(a),k=e,M=t??(g||void 0),C=r??(v?Number(v):void 0),A=n,_=s,P=ee(()=>{const E={};return k&&(E.agentId=k),M&&(E.addonId=M),C!==void 0&&Number.isFinite(C)&&(E.deviceId=C),A&&(E.integrationId=A),_&&(E.requestId=_),Object.keys(E).length>0?E:void 0},[k,M,C,A,_]),Q=St(Wh),oe=u??Q,le=oe.entries,[ge,de]=S(0),[pe,ie]=S(!1),[ne,W]=S(!1),[ye,me]=S(new Set),[T,z]=S(""),B=q(null),se=`${k??""}:${M??""}:${String(C??"")}:${A??""}:${_??""}`,U=q(se);H(()=>{U.current!==se&&(U.current=se,oe.reset(),de(0),me(new Set))},[se,oe]);const{data:K,isLoading:Z}=m.logs.query.useQuery({...P?{tags:P}:{},limit:d},{staleTime:3e4});m.logs.subscribe.useSubscription({...P?{tags:P}:{}},{onData:E=>{oe.append(E)}});const G=q(le.length);H(()=>{const E=B.current;if(!E){G.current=le.length;return}const D=G.current;if(G.current=le.length,!(le.length<=D)){if(pe&&E.scrollTop<=8)E.scrollTo({top:0});else if(!pe&&E.scrollTop>0){const J=E.querySelector("tbody tr"),ae=J instanceof HTMLElement?J.offsetHeight:24;E.scrollTop+=ae*(le.length-D)}}},[le.length,pe]);const re=ee(()=>{const E=(K??[]).map(te=>({timestamp:te.timestamp,level:te.level,message:te.message,scope:te.scope,tags:te.tags,meta:te.meta})),D=new Set,J=[];for(const te of[...le].reverse()){const ke=`${te.timestamp}|${te.level}|${te.scope??""}|${te.message}`;D.has(ke)||(D.add(ke),J.push(te))}for(const te of E){const ke=`${te.timestamp}|${te.level}|${te.scope??""}|${te.message}`;D.has(ke)||(D.add(ke),J.push(te))}const ae=(ge>0?J.filter(te=>new Date(te.timestamp).getTime()>ge):J).filter(te=>Kh(te.level,y)),L=T.trim().toLowerCase();return L?ae.filter(te=>{if(te.message.toLowerCase().includes(L)||te.scope&&te.scope.toLowerCase().includes(L))return!0;if(te.tags){for(const ke of Object.values(te.tags))if(ke!==void 0&&String(ke).toLowerCase().includes(L))return!0}if(te.meta){for(const ke of Object.values(te.meta))if(ke!=null&&ns(ke).toLowerCase().includes(L))return!0}return!1}):ae},[K,le,y,ge,T]),Y=I(()=>{const E=re.map(D=>{const J=new Date(D.timestamp).toLocaleTimeString(),ae=D.tags?" "+Object.entries(D.tags).filter(([,L])=>L).map(([L,te])=>`${L}=${te}`).join(" "):"";return`${J} [${D.level.toUpperCase()}]${D.scope?` [${D.scope}]`:""}${ae} ${D.message}`});navigator.clipboard.writeText(E.join(`
|
|
78
|
+
`)).then(()=>{W(!0),setTimeout(()=>W(!1),1500)})},[re]),Re=m.logs.clear.useMutation(),_e=I(()=>{de(Date.now()),oe.reset(),Re.mutate({...P?{tags:P}:{}})},[oe,Re,P]),X=I(E=>{me(D=>{const J=new Set(D);return J.has(E)?J.delete(E):J.add(E),J})},[]),[fe,xe]=S(null),we=I((E,D)=>{const J=new Date(E.timestamp).toISOString(),ae=E.tags?" "+Object.entries(E.tags).filter(([,ke])=>ke).map(([ke,Ke])=>`${ke}=${Ke}`).join(" "):"",L=E.meta&&Object.keys(E.meta).length>0?` meta=${JSON.stringify(E.meta)}`:"",te=`${J} [${E.level.toUpperCase()}]${E.scope?` [${E.scope}]`:""}${ae} ${E.message}${L}`;navigator.clipboard.writeText(te).then(()=>{xe(D),setTimeout(()=>xe(ke=>ke===D?null:ke),1200)})},[]),O=I(E=>`${E.timestamp}|${E.level}|${E.scope??""}|${E.message}`,[]);return f("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:E=>E.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[f("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(Jr,{label:"agent",value:k}),M&&o(Jr,{label:"addon",value:M}),C!==void 0&&o(Jr,{label:"device",value:`#${C}`}),o("div",{className:"flex rounded border border-border overflow-hidden text-[9px]",children:qh.map(E=>f("button",{type:"button",onClick:()=>w(E==="all"?void 0:E),className:N("px-1.5 py-0.5 capitalize transition-colors",E==="all"&&!y||y===E?"bg-primary/10 text-primary":"text-foreground-subtle hover:bg-surface-hover",E!=="all"&&"border-l border-border"),children:[E,E!=="all"?"+":""]},E))}),o(en,{icon:zn,label:pe?"Auto":"Paused",active:!pe,onClick:()=>{ie(E=>!E),!pe&&B.current&&B.current.scrollTo({top:0,behavior:"smooth"})}}),o(en,{icon:at,label:ne?"Copied!":"Copy",onClick:Y,disabled:re.length===0}),o(en,{icon:qe,label:"Clear",onClick:_e}),f("div",{className:"relative",children:[o("input",{type:"text",value:T,onChange:E=>z(E.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(Pe,{className:"h-2.5 w-2.5"})})]}),le.length>0&&f("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",le.length," live"]})]}),p&&o("button",{type:"button",onClick:p,className:"text-foreground-subtle hover:text-foreground",children:o(Pe,{className:"h-3.5 w-3.5"})})]}),c&&(!t||!r)&&f("div",{className:"flex items-center gap-2 px-3 py-1 border-b border-border/50 bg-surface/50 text-[10px]",children:[!t&&f("label",{className:"flex items-center gap-1",children:[o("span",{className:"text-foreground-subtle",children:"Addon:"}),o("input",{type:"text",value:g,onChange:E=>b(E.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&&f("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:E=>x(E.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"})]})]}),f("div",{ref:B,className:N("flex-1 min-h-0 overflow-auto font-mono text-[10px]",i),children:[Z&&f("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),"Loading logs..."]}),!Z&&re.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No logs found"}),re.length>0&&o("table",{className:"w-full",children:o("tbody",{children:re.map(E=>{const D=os[E.level]??os.info,J=D.icon,ae=O(E),L=ye.has(ae),te=E.tags&&Object.keys(E.tags).length>0,ke=E.meta&&Object.keys(E.meta).length>0,Ke=te||ke;return f("tr",{className:N("hover:bg-surface-hover/30 border-b border-border/30",Ke&&"cursor-pointer"),onClick:Ke?()=>X(ae):void 0,children:[o("td",{className:"px-2 py-1 text-foreground-subtle whitespace-nowrap align-top w-[70px]",children:new Date(E.timestamp).toLocaleTimeString()}),o("td",{className:N("px-1 py-1 align-top w-5",D.color),children:o(J,{className:"h-3 w-3"})}),l&&o("td",{className:"px-2 py-1 text-foreground-subtle align-top truncate max-w-[120px]",title:E.scope,children:E.scope?.replace(/^addon:/,"")??""}),o("td",{className:"px-2 py-1 text-foreground break-all",children:f("div",{className:"flex items-start gap-1",children:[Ke&&(L?o(pt,{className:"h-3 w-3 text-foreground-subtle shrink-0 mt-0.5"}):o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0 mt-0.5"})),f("div",{className:"flex-1 min-w-0",children:[E.message,L&&Ke&&f("div",{className:"mt-1 text-[9px] text-foreground-subtle bg-surface rounded px-2 py-1 space-y-0.5",children:[ke&&Object.entries(E.meta).filter(([,De])=>De!==void 0&&De!=="").map(([De,ht])=>f("div",{children:[o("span",{className:"text-amber-400/80 font-medium",children:De}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:ns(ht)})]},`m-${De}`)),te&&Object.entries(E.tags).filter(([,De])=>De!==void 0).map(([De,ht])=>f("div",{children:[o("span",{className:"text-primary/70 font-medium",children:De}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:ht})]},`t-${De}`))]})]})]})}),o("td",{className:"px-1 py-1 align-top w-5",children:o(Zh,{copied:fe===ae,onCopy:()=>we(E,ae)})})]},ae)})})})]})]})}function eS({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(Ki,{maxHeight:"max-h-48",...r})})}function Jr({label:e,value:t}){return f("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function Zh({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(Vt,{className:"h-3 w-3"}):o(at,{className:"h-3 w-3"})})}function en({icon:e,label:t,onClick:r,disabled:n,active:s}){return f("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 Yh(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 Xh={[V.AddonStarted]:{icon:hn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Started"},[V.AddonInstalled]:{icon:fn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Installed"},[V.AddonRestarted]:{icon:Gn,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Restarted"},[V.AddonUpdated]:{icon:Ha,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Updated"},[V.AddonStopped]:{icon:So,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Stopped"},[V.AddonUninstalled]:{icon:qe,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Uninstalled"},[V.AddonCrashed]:{icon:Er,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Crashed"},[V.AddonError]:{icon:Kt,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Error"},[V.DetectionPhaseTransition]:{icon:et,color:"bg-violet-500/15 text-violet-400 border-violet-500/30",label:"Phase"},[V.DetectionResult]:{icon:Ou,color:"bg-purple-500/15 text-purple-400 border-purple-500/30",label:"Detection"},[V.DetectionEvent]:{icon:qt,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Event"},[V.DetectionCameraNative]:{icon:Co,color:"bg-cyan-500/15 text-cyan-400 border-cyan-500/30",label:"Camera AI"},[V.ProviderMotion]:{icon:Mo,color:"bg-orange-500/15 text-orange-400 border-orange-500/30",label:"Motion"},[V.MotionOnMotionChanged]:{icon:Mo,color:"bg-orange-500/15 text-orange-400 border-orange-500/30",label:"Motion"},[V.MotionAnalysis]:{icon:et,color:"bg-orange-500/10 text-orange-300 border-orange-500/20",label:"Motion analysis"},[V.MotionZonesRaw]:{icon:et,color:"bg-orange-500/10 text-orange-300 border-orange-500/20",label:"Motion zones"},[V.ProviderDetection]:{icon:Co,color:"bg-cyan-500/15 text-cyan-400 border-cyan-500/30",label:"Provider Det"},[V.PipelineAudioInferenceResult]:{icon:Ba,color:"bg-pink-500/15 text-pink-400 border-pink-500/30",label:"Audio"},[V.AgentOnline]:{icon:hn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Agent Online"},[V.AgentOffline]:{icon:So,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Agent Offline"},[V.DeviceRegistered]:{icon:fn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Registered"},[V.DeviceUnregistered]:{icon:qe,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Unregistered"},[V.DeviceStateChanged]:{icon:et,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"State"}};function An(e,t){const r=Xh[e]??{icon:hn,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:e.split(".").pop()??e};if(e===V.DeviceStateChanged&&t&&typeof t.capName=="string"){const n=t.capName;return{...r,label:n}}return r}var vt=Object.freeze([...new Set(Object.values(V))].sort()),Jh=Object.freeze([V.PipelineCameraMetricsSnapshot,V.PipelineRunnerLoadSnapshot,V.PipelineEngineMetricsSnapshot,V.PipelineInferenceResult,V.PipelineTrace,V.PipelineProgress,V.StreamBrokerMetricsSnapshot,V.MetricsNodeResourcesSnapshot,V.MetricsNodeProcessesSnapshot,V.ClusterTopologySnapshot,V.MotionAnalysis,V.MotionZonesRaw,V.DetectionResult,V.PipelineAudioInferenceResult,V.PlatformProbePhase,V.BenchmarkProgress,V.ModelDownloadProgress]),eg=new Set(Jh),tg=Object.freeze(vt.filter(e=>!eg.has(e)));function vr(e,t){if(e===V.DetectionPhaseTransition){const s=t.to,a=t.from,i=typeof t.source=="string"?t.source:null,l=typeof t.cooldownMs=="number"?t.cooldownMs:null,c=i?` (${i}${l?`, ${Math.round(l/1e3)}s cooldown`:""})`:"";return s==="active"?`Motion detected — phase active${c}`:s==="watching"?`Cooldown expired — phase watching${c}`:`Phase: ${String(a)} → ${String(s)}${c}`}if(e===V.DetectionResult){const s=t.frame?.detections??[];if(s.length===0)return null;const a=new Map;for(const i of s){const l=i,c=l.class??l.macroClass,d=typeof c=="string"?c:"";d&&a.set(d,(a.get(d)??0)+1)}return[...a.entries()].map(([i,l])=>l>1?`${i} ×${l}`:i).join(", ")}if(e===V.PipelineAudioInferenceResult){const s=t.frame?.detections??[];return s.length===0?null:s.map(a=>{const i=a,l=i.macroClass??i.class??i.label,c=typeof l=="string"?l:"",d=i.score;return d?`${c} (${Math.round(d*100)}%)`:c}).filter(Boolean).join(", ")}if(e===V.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===V.ProviderMotion)return t.active===!0?"motion start":"motion stop";if(e===V.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===V.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===V.ProviderDetection||e===V.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 l=i,c=l.class??l.macroClass,d=typeof c=="string"?c:"";d&&a.set(d,(a.get(d)??0)+1)}return[...a.entries()].map(([i,l])=>l>1?`${i} ×${l}`:i).join(", ")}const r=t.addonId,n=t.error;return n||(r?`addon: ${r}`:null)}function rg(e){const t=e.category;return t===V.DetectionResult||t===V.PipelineAudioInferenceResult?vr(t,e.data)!==null:!0}var ng=300;function Zi({agentId:e,addonId:t,deviceId:r,defaultCategories:n,categories:s,category:a,maxHeight:i="max-h-96",limit:l=50,showCategoryFilter:c=!0,showFilters:d=!1,liveBuffer:u,onClose:p,className:h}){const g=ee(()=>n??s??tg,[n,s]),b=ee(()=>[...g].sort().join(","),[g]),[v,x]=S(()=>new Set(g)),y=q(b);H(()=>{y.current!==b&&(y.current=b,x(new Set(g)))},[b,g]);const w=St(ng),k=u??w,M=k.entries,[C,A]=S(!0),[_,P]=S(new Set),[Q,oe]=S(""),[le,ge]=S(!1),[de,pe]=S(""),[ie,ne]=S(0),W=q(null),ye=q(null),me=`${e??""}:${t??""}:${String(r??"")}:${a??""}`,T=q(me);H(()=>{T.current!==me&&(T.current=me,k.reset(),P(new Set),ne(0))},[me,k]),H(()=>{if(!le)return;const $=he=>{const be=ye.current;be&&he.target instanceof Node&&!be.contains(he.target)&&ge(!1)};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[le]);const z=ee(()=>{const $={};return e&&($.agentId=e),t&&($.addonId=t),r!==void 0&&($.deviceId=r),a&&($.category=a),$},[e,t,r,a]),B=ee(()=>[...v].sort(),[v]),se=ee(()=>{const $={...z,limit:l};return B.length>0&&B.length<vt.length&&($.category=B),$},[z,l,ee(()=>B.join(","),[B]),B]),{data:U,isLoading:K}=m.systemEvents.getRecent.useQuery(se,{staleTime:3e4}),Z=q(v);H(()=>{Z.current=v},[v]);const G=z;m.systemEvents.subscribe.useSubscription(G,{onData:$=>{const he=$;he?.id&&Yh(he,e,t,r)&&Z.current.has(he.category)&&k.append(he)}});const re=q(M.length);H(()=>{const $=W.current;if(!$){re.current=M.length;return}const he=re.current;if(re.current=M.length,!(M.length<=he)){if(C&&$.scrollTop<=8)$.scrollTo({top:0});else if(!C&&$.scrollTop>0){const be=$.firstElementChild?.firstElementChild,ve=be instanceof HTMLElement?be.offsetHeight:28;$.scrollTop+=ve*(M.length-he)}}},[M.length,C]);const Y=ee(()=>{const $=new Map;for(const ve of U??[])$.set(ve.id,ve);for(const ve of M)$.set(ve.id,ve);let he=[...$.values()].filter(ve=>v.has(ve.category)).filter(rg);ie>0&&(he=he.filter(ve=>new Date(ve.timestamp).getTime()>ie));const be=Q.trim().toLowerCase();return be&&(he=he.filter(ve=>{if(ve.category.toLowerCase().includes(be)||An(ve.category,ve.data).label.toLowerCase().includes(be))return!0;const it=vr(ve.category,ve.data);if(it&&it.toLowerCase().includes(be))return!0;try{if(new Date(ve.timestamp).toLocaleTimeString().toLowerCase().includes(be))return!0}catch{}try{if(JSON.stringify(ve.data).toLowerCase().includes(be)||JSON.stringify(ve.source).toLowerCase().includes(be))return!0}catch{}return!1})),he.sort((ve,it)=>new Date(it.timestamp).getTime()-new Date(ve.timestamp).getTime())},[U,M,v,Q,ie]),Re=I($=>{P(he=>{const be=new Set(he);return be.has($)?be.delete($):be.add($),be})},[]),_e=I($=>{x(he=>{const be=new Set(he);return be.has($)?be.delete($):be.add($),be})},[]),X=I(()=>{x(new Set(g)),oe(""),ne(0)},[g]),fe=I(()=>{ne(Date.now()),k.reset()},[k]),[xe,we]=S(!1),[O,E]=S(null),D=I($=>{const he=new Date($.timestamp).toISOString(),be=vr($.category,$.data)??"",ve=be?` ${be}`:"";return`${he} [${$.category}]${ve} data=${JSON.stringify($.data)}`},[]),J=I(()=>{const $=Y.map(D);navigator.clipboard.writeText($.join(`
|
|
79
|
+
`)).then(()=>{we(!0),setTimeout(()=>we(!1),1500)})},[Y,D]),ae=I($=>{navigator.clipboard.writeText(D($)).then(()=>{E($.id),setTimeout(()=>E(he=>he===$.id?null:he),1200)})},[D]),L=I(()=>{x(new Set(vt))},[]),te=I(()=>{x(new Set)},[]),ke=ee(()=>{const $=de.trim().toLowerCase();return $?vt.filter(he=>he.toLowerCase().includes($)):vt},[de]),Ke=vt.length,De=v.size,ht=De===Ke,Xi=ht?"All":`${De}/${Ke}`;return f("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:$=>$.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[f("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(ar,{label:"agent",value:e}),t&&o(ar,{label:"addon",value:t}),r!==void 0&&o(ar,{label:"device",value:`#${r}`}),a&&o(ar,{label:"category",value:a}),f("button",{type:"button",onClick:()=>{A($=>!$),!C&&W.current&&W.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",C?"border-border text-foreground-subtle hover:text-foreground":"border-amber-500/30 bg-amber-500/10 text-amber-400"),children:[o(zn,{className:"h-2.5 w-2.5"}),C?"Auto":"Paused"]}),c&&f("div",{className:"relative",ref:ye,children:[f("button",{type:"button",onClick:()=>ge($=>!$),className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",ht?"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(La,{className:"h-2.5 w-2.5"}),"Filter (",Xi,")"]}),le&&o(og,{search:de,onSearchChange:pe,categories:ke,active:v,onToggle:_e,onSelectAll:L,onSelectNone:te,onResetDefaults:X})]}),f("button",{type:"button",onClick:X,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(ja,{className:"h-2.5 w-2.5"}),"Reset"]}),f("button",{type:"button",onClick:fe,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(qe,{className:"h-2.5 w-2.5"}),"Clear"]}),f("button",{type:"button",onClick:J,disabled:Y.length===0,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",xe?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-border text-foreground-subtle hover:text-foreground",Y.length===0&&"opacity-40 cursor-not-allowed"),title:"Copy all visible events",children:[o(at,{className:"h-2.5 w-2.5"}),xe?"Copied!":"Copy"]}),f("div",{className:"relative",children:[o("input",{type:"text",value:Q,onChange:$=>oe($.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"}),Q&&o("button",{type:"button",onClick:()=>oe(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(Pe,{className:"h-2.5 w-2.5"})})]}),M.length>0&&f("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(Pe,{className:"h-3.5 w-3.5"})})]}),f("div",{ref:W,className:N("flex-1 min-h-0 overflow-auto text-[10px]",i),children:[K&&f("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),"Loading events..."]}),!K&&Y.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No events found"}),Y.length>0&&o("div",{className:"divide-y divide-border/30",children:Y.map($=>{const he=An($.category,$.data),be=he.icon,ve=vr($.category,$.data),it=_.has($.id);return f("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>Re($.id),children:[o("span",{className:"text-foreground-subtle whitespace-nowrap w-[70px] shrink-0 pt-0.5",children:new Date($.timestamp).toLocaleTimeString()}),o(sg,{copied:O===$.id,onCopy:()=>ae($)}),f("div",{className:"flex-1 min-w-0",children:[f("div",{className:"flex items-center gap-1.5",children:[it?o(pt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),f("span",{className:N("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[9px] font-medium",he.color),children:[o(be,{className:"h-2.5 w-2.5"}),he.label]}),$.source.nodeId&&$.source.nodeId!=="hub"&&o("span",{className:"text-[9px] px-1 py-0.5 rounded bg-foreground-subtle/10 text-foreground-subtle font-mono",children:$.source.nodeId})]}),ve&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5",children:ve}),it&&f("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:[f("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($.source)})]}),f("div",{children:[o("span",{className:"text-primary/70",children:"category"}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:$.category})]}),Object.entries($.data).map(([Jn,Tr])=>f("div",{children:[o("span",{className:"text-primary/70",children:Jn}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:typeof Tr=="object"?JSON.stringify(Tr):String(Tr)})]},Jn))]})]})]},$.id)})})]})]})}function og({search:e,onSearchChange:t,categories:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:l}){return f("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:c=>c.stopPropagation(),children:[f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),o("input",{type:"text",value:e,onChange:c=>t(c.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(Pe,{className:"h-2.5 w-2.5"})})]}),f("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:l,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"Defaults"})]}),f("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(c=>{const d=n.has(c),u=An(c),p=u.icon;return f("button",{type:"button",onClick:()=>s(c),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:d,className:"accent-violet-500"}),f("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:c})]},c)})]})]})}function tS({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(Zi,{maxHeight:"max-h-48",...r})})}function ar({label:e,value:t}){return f("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function sg({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(Vt,{className:"h-3 w-3"}):o(at,{className:"h-3 w-3"})})}function rS({deviceId:e,className:t="",onOpenChild:r}){const n=m.useUtils(),s=m.deviceDiscovery.listDiscovered.useQuery({deviceId:e},{refetchInterval:1e4,retry:!1}),a=m.deviceDiscovery.getStatus.useQuery({deviceId:e},{refetchInterval:1e4,retry:!1}),i=m.deviceDiscovery.refreshDiscovery.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e}),n.deviceDiscovery.getStatus.invalidate({deviceId:e})}}),l=m.deviceDiscovery.adoptDevice.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e})}}),c=m.deviceDiscovery.releaseDevice.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e})}}),[d,u]=S(null),{available:p,adopted:h}=ee(()=>{const k=s.data??[],M=A=>typeof A.metadata.rtspChannel=="number"?A.metadata.rtspChannel:Number.POSITIVE_INFINITY,C=(A,_)=>{const P=M(A),Q=M(_);return P!==Q?P-Q:A.name.localeCompare(_.name)};return{available:k.filter(A=>!A.alreadyAdopted).sort(C),adopted:k.filter(A=>A.alreadyAdopted).sort(C)}},[s.data]),g=a.data,b=g?.lastError??null,v=g?.lastDiscoveryAt??null;async function x(){await i.mutateAsync({deviceId:e}).catch(()=>{})}async function y(k){u(k.childNativeId);try{await l.mutateAsync({deviceId:e,childNativeId:k.childNativeId})}finally{u(null)}}async function w(k){if(k.adoptedDeviceId!=null){u(k.childNativeId);try{await c.mutateAsync({deviceId:e,childDeviceId:k.adoptedDeviceId})}finally{u(null)}}}return f("div",{className:`rounded-xl border border-border bg-surface ${t}`,children:[f("div",{className:"flex items-start justify-between gap-2 border-b border-border px-3 py-2 sm:px-5 sm:py-3",children:[f("div",{className:"min-w-0",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:"Discovered devices"}),f("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."]})]}),f("button",{type:"button",onClick:x,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(Ge,{className:"h-3.5 w-3.5 animate-spin"}):o(Gn,{className:"h-3.5 w-3.5"}),o("span",{className:"hidden sm:inline",children:"Refresh"})]})]}),b?f("div",{className:"flex items-start gap-2 border-b border-border bg-destructive/10 px-5 py-2 text-[11px] text-destructive",children:[o(Kt,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),f("span",{children:["Last refresh failed: ",b]})]}):null,s.isLoading?o("div",{className:"flex items-center justify-center py-8 text-foreground-subtle",children:o(Ge,{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."}):f(Ne,{children:[p.length>0?o(as,{title:"Available to add",count:p.length,tone:"primary",children:p.map(k=>o(is,{child:k,busy:d===k.childNativeId,onAdopt:y,onRelease:w,onOpenChild:r},k.childNativeId))}):null,h.length>0?o(as,{title:"Already adopted",count:h.length,tone:"muted",children:h.map(k=>o(is,{child:k,busy:d===k.childNativeId,onAdopt:y,onRelease:w,onOpenChild:r},k.childNativeId))}):null]}),v!=null?f("div",{className:"border-t border-border px-5 py-2 text-[10px] text-foreground-subtle",children:["Last refreshed ",new Date(v).toLocaleString()]}):null]})}function as({title:e,count:t,tone:r,children:n}){return f("div",{className:"border-t border-border",children:[f("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 is({child:e,busy:t,onAdopt:r,onRelease:n,onOpenChild:s}){return f("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:[f("div",{className:"min-w-0 flex-1",children:[f("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[o(ag,{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]}),f("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"?f("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?f("span",{className:"font-mono truncate max-w-[140px]",children:[e.metadata.uid.slice(0,12),"…"]}):null]})]}),e.alreadyAdopted?f("div",{className:"flex items-center gap-2",children:[s&&e.adoptedDeviceId!==null?f("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(Ta,{className:"h-3.5 w-3.5"}),"Open"]}):null,f("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(Ge,{className:"h-3.5 w-3.5 animate-spin"}):o(qe,{className:"h-3.5 w-3.5"}),"Remove"]})]}):f("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(Ge,{className:"h-3.5 w-3.5 animate-spin"}):o(Wt,{className:"h-3.5 w-3.5"}),"Add"]})]})}function ag({status:e}){switch(e){case"online":return f("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(Ua,{className:"h-2.5 w-2.5"})," online"]});case"sleeping":return f("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(jn,{className:"h-2.5 w-2.5"})," sleeping"]});case"offline":return f("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(Wu,{className:"h-2.5 w-2.5"})," offline"]});default:return f("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(Pa,{className:"h-2.5 w-2.5"})," unknown"]})}}function ig(e,t){if(!e||typeof e!="object")return!1;const r=e;if(r.category!==V.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 tn(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 lg=300,cg=Object.freeze([...new Set(dl.filter(e=>e.scope==="device").map(e=>e.name))].sort());function dg({deviceId:e,defaultCaps:t,maxHeight:r="max-h-96",limit:n=50,liveBuffer:s,onClose:a,className:i}){const[l,c]=S(ee(()=>new Set(t??[]),[t])),[d,u]=S(""),[p,h]=S(!0),[g,b]=S(new Set),[v,x]=S(0),[y,w]=S(!1),[k,M]=S(""),C=q(null),A=St(lg),_=s??A,P=_.entries,Q=q(null),oe=q(e);H(()=>{oe.current!==e&&(oe.current=e,_.reset(),b(new Set),x(0))},[e,_]);const le=ee(()=>({deviceId:e,category:V.DeviceStateChanged,limit:n}),[e,n]),{data:ge,isLoading:de}=m.systemEvents.getRecent.useQuery(le,{staleTime:3e4}),pe=q(l);H(()=>{pe.current=l},[l]),m.systemEvents.subscribe.useSubscription({deviceId:e,category:V.DeviceStateChanged},{onData:O=>{if(!ig(O,e))return;const E=tn(O);if(!E)return;const D=pe.current;D.size>0&&!D.has(E.capName)||_.append(E)}});const ie=q(P.length);H(()=>{const O=Q.current;if(!O){ie.current=P.length;return}const E=ie.current;if(ie.current=P.length,!(P.length<=E)){if(p&&O.scrollTop<=8)O.scrollTo({top:0});else if(!p&&O.scrollTop>0){const D=O.firstElementChild?.firstElementChild,J=D instanceof HTMLElement?D.offsetHeight:28,ae=P.length-E;O.scrollTop+=J*ae}}},[P.length,p]);const ne=ee(()=>{const O=new Map;for(const J of ge??[]){const ae=tn(J);ae&&O.set(ae.id,ae)}for(const J of P)O.set(J.id,J);let E=[...O.values()];v>0&&(E=E.filter(J=>new Date(J.timestamp).getTime()>v)),l.size>0&&(E=E.filter(J=>l.has(J.capName)));const D=d.trim().toLowerCase();return D&&(E=E.filter(J=>{if(J.capName.toLowerCase().includes(D))return!0;try{if(new Date(J.timestamp).toLocaleTimeString().toLowerCase().includes(D))return!0}catch{}try{if(Object.entries(J.slice).map(([ae,L])=>`${ae}=${rn(L)}`).join(" · ").toLowerCase().includes(D))return!0}catch{}try{if(JSON.stringify(J.slice).toLowerCase().includes(D))return!0}catch{}return!1})),E.sort((J,ae)=>new Date(ae.timestamp).getTime()-new Date(J.timestamp).getTime())},[ge,P,l,d,v]),W=ee(()=>{const O=new Set(cg);for(const E of ge??[]){const D=tn(E);D&&O.add(D.capName)}for(const E of P)O.add(E.capName);return[...O].sort()},[ge,P]),ye=I(O=>{b(E=>{const D=new Set(E);return D.has(O)?D.delete(O):D.add(O),D})},[]),me=I(O=>{c(E=>{const D=new Set(E);return D.has(O)?D.delete(O):D.add(O),D})},[]),T=I(()=>{c(new Set(t??[])),u("")},[t]),z=I(()=>{x(Date.now()),_.reset()},[_]),[B,se]=S(!1),[U,K]=S(null),Z=I(O=>`${new Date(O.timestamp).toISOString()} [${O.capName}] slice=${JSON.stringify(O.slice)}`,[]),G=I(()=>{const O=ne.map(Z);navigator.clipboard.writeText(O.join(`
|
|
80
|
+
`)).then(()=>{se(!0),setTimeout(()=>se(!1),1500)})},[ne,Z]),re=I(O=>{navigator.clipboard.writeText(Z(O)).then(()=>{K(O.id),setTimeout(()=>K(E=>E===O.id?null:E),1200)})},[Z]),Y=I(()=>{c(new Set(W))},[W]),Re=I(()=>{c(new Set)},[]),_e=ee(()=>{const O=k.trim().toLowerCase();return O?W.filter(E=>E.toLowerCase().includes(O)):W},[k,W]),X=W.length,fe=l.size,xe=fe===0||fe===X,we=xe?"All":`${fe}/${X}`;return H(()=>{if(!y)return;const O=E=>{const D=C.current;D&&!D.contains(E.target)&&w(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[y]),f("div",{className:N("h-full min-h-0 flex flex-col",i),onClick:O=>O.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[f("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(ug,{label:"device",value:`#${e}`}),f("button",{type:"button",onClick:()=>{h(O=>!O),!p&&Q.current&&Q.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(zn,{className:"h-2.5 w-2.5"}),p?"Auto":"Paused"]}),f("div",{className:"relative",ref:C,children:[f("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",xe?"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(La,{className:"h-2.5 w-2.5"}),"Filter (",we,")"]}),y&&o(pg,{search:k,onSearchChange:M,caps:_e,active:l,onToggle:me,onSelectAll:Y,onSelectNone:Re,onResetDefaults:T})]}),f("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(ja,{className:"h-2.5 w-2.5"}),"Reset"]}),f("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(qe,{className:"h-2.5 w-2.5"}),"Clear"]}),f("button",{type:"button",onClick:G,disabled:ne.length===0,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",B?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-border text-foreground-subtle hover:text-foreground",ne.length===0&&"opacity-40 cursor-not-allowed"),title:"Copy all visible state changes",children:[o(at,{className:"h-2.5 w-2.5"}),B?"Copied!":"Copy"]}),f("div",{className:"relative",children:[o("input",{type:"text",value:d,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"}),d&&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(Pe,{className:"h-2.5 w-2.5"})})]}),P.length>0&&f("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",P.length," live"]})]}),a&&o("button",{type:"button",onClick:a,className:"text-foreground-subtle hover:text-foreground",children:o(Pe,{className:"h-3.5 w-3.5"})})]}),f("div",{ref:Q,className:N("flex-1 min-h-0 overflow-auto text-[10px]",r),children:[de&&f("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),"Loading state changes..."]}),!de&&ne.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No state changes"}),ne.length>0&&o("div",{className:"divide-y divide-border/30",children:ne.map(O=>{const E=g.has(O.id),D=Object.entries(O.slice),J=D.slice(0,3).map(([ae,L])=>`${ae}=${rn(L)}`).join(" · ");return f("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>ye(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(fg,{copied:U===O.id,onCopy:()=>re(O)}),f("div",{className:"flex-1 min-w-0",children:[f("div",{className:"flex items-center gap-1.5",children:[E?o(pt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(st,{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&&f("span",{className:"text-[9px] text-foreground-subtle",children:["+",D.length-3," more"]})]}),J&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5 truncate",children:J}),E&&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(([ae,L])=>f("div",{children:[o("span",{className:"text-primary/70",children:ae}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:rn(L)})]},ae))})]})]},O.id)})})]})]})}function rn(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 ug({label:e,value:t}){return f("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function pg({search:e,onSearchChange:t,caps:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:l}){return f("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:c=>c.stopPropagation(),children:[f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),o("input",{type:"text",value:e,onChange:c=>t(c.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(Pe,{className:"h-2.5 w-2.5"})})]}),f("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:l,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"Defaults"})]}),f("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(c=>f("button",{type:"button",onClick:()=>s(c),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(c),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:c})]},c))]})]})}function fg({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(Vt,{className:"h-3 w-3"}):o(at,{className:"h-3 w-3"})})}var nn=500,mg=[{id:"logs",label:"Logs",icon:$u},{id:"events",label:"Events",icon:Mr},{id:"state",label:"State",icon:ku}];function nS({deviceId:e,defaultEventCategories:t,defaultStateCaps:r,initialTab:n="events",className:s,maxHeight:a="max-h-96"}){const[i,l]=S(n),c=St(nn),d=St(nn),u=St(nn),p=c.reset,h=d.reset,g=u.reset;return H(()=>{p(),h(),g()},[e,p,h,g]),f("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:mg.map(({id:b,label:v,icon:x})=>f("button",{type:"button",onClick:()=>l(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(x,{className:"h-3.5 w-3.5"}),v]},b))}),f("div",{className:"flex-1 min-h-0 overflow-hidden",children:[i==="logs"&&o(Ki,{deviceId:e,maxHeight:a,showFilters:!1,liveBuffer:c}),i==="events"&&o(Zi,{deviceId:e,defaultCategories:t,maxHeight:a,showCategoryFilter:!0,liveBuffer:d}),i==="state"&&o(dg,{deviceId:e,defaultCaps:r,maxHeight:a,liveBuffer:u})]})]})}function oS({label:e,icon:t,title:r="Confirm action",description:n,confirmLabel:s,triggerVariant:a="outline",confirmVariant:i="danger",size:l="sm",disabled:c,className:d,action:u,onSuccess:p}){const[h,g]=S(!1),[b,v]=S(!1),[x,y]=S(null),w=async()=>{y(null),v(!0);try{const k=await u();p?.(k),g(!1)}catch(k){y(k instanceof Error?k.message:String(k))}finally{v(!1)}};return f(Ne,{children:[f(gr,{type:"button",variant:a,size:l,disabled:c,onClick:()=>{y(null),g(!0)},className:d,children:[t&&o(t,{className:"h-3.5 w-3.5"}),e]}),o(ap,{open:h,onOpenChange:k=>!b&&g(k),children:f(Xa,{children:[f(lp,{children:[f(dp,{className:"flex items-center gap-2",children:[o(Kt,{className:"h-4 w-4 text-amber-400"}),r]}),typeof n=="string"?o(up,{children:n}):n]}),x&&o("div",{className:N("mt-2 px-3 py-2 rounded border border-danger/40 bg-danger/10","text-xs text-danger"),children:x}),f(cp,{children:[o(gr,{type:"button",variant:"ghost",size:l,disabled:b,onClick:()=>g(!1),children:"Cancel"}),f(gr,{type:"button",variant:i,size:l,disabled:b,onClick:()=>{w()},children:[b&&o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),s??e]})]})]})})]})}function ir({direction:e,icon:t,disabled:r,className:n,variant:s,onMove:a,onStart:i,onStop:l}){const[c,d]=S(null),[u,p]=S(!1),h=I(y=>{if(r)return;y.currentTarget.setPointerCapture(y.pointerId),d(Date.now()),p(!1);const w=setTimeout(()=>{p(!0),i(e)},250);y.currentTarget.dataset.timer=String(w)},[e,r,i]),g=I(y=>{const w=Number(y.currentTarget.dataset.timer);w&&clearTimeout(w),y.currentTarget.dataset.timer="",u?l():c!==null&&a(e),d(null),p(!1)},[u,e,a,l,c]),b=I(y=>{const w=Number(y.currentTarget.dataset.timer);w&&clearTimeout(w),y.currentTarget.dataset.timer="",u&&l(),d(null),p(!1)},[u,l]),v=s==="panel"?"h-9 w-9":"h-7 w-7",x=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:x})})}function sS({controls:e,mode:t="overlay",showPresets:r,showZoom:n=!0,showHome:s=!0,className:a}){const{move:i,startContinuous:l,stopContinuous:c,zoom:d,goHome:u,goToPreset:p,presets:h,busy:g,error:b}=e,[v,x]=S(!1),y=(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"),C=w?"h-9 w-9":"h-7 w-7",A=w?"h-4 w-4":"h-3.5 w-3.5",_=w?"text-foreground hover:bg-surface-hover":"text-white hover:bg-white/15",P=w?"h-12 w-px bg-border mx-1":"h-12 w-px bg-white/15 mx-1";return f("div",{className:N(k,a),children:[b&&f("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]}),f("div",{className:N(M,w&&"justify-center"),children:[f("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(ir,{direction:"up",icon:au,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(ir,{direction:"left",icon:ou,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(ir,{direction:"right",icon:su,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(ir,{direction:"down",icon:nu,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"})]}),(n||s)&&o("div",{className:P}),f("div",{className:"flex flex-col gap-0.5",children:[n&&f(Ne,{children:[o("button",{type:"button",onClick:()=>d("in"),disabled:g,title:"Zoom in",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Ku,{className:A})}),o("button",{type:"button",onClick:()=>d("out"),disabled:g,title:"Zoom out",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Zu,{className:A})})]}),s&&o("button",{type:"button",onClick:()=>u(),disabled:g,title:"Go home",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Oa,{className:A})})]}),y&&f("div",{className:"relative",children:[f("button",{type:"button",onClick:()=>x(Q=>!Q),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(pt,{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(Q=>o("button",{type:"button",onClick:()=>{p(Q.id),x(!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:Q.name||Q.id},Q.id))})]})]})]})}function hg(e,t){const r=document.createElement("a");r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function aS({trpc:e,deviceId:t,deviceName:r,size:n="sm",className:s}){const[a,i]=S(!1),[l,c]=S(!1),[d,u]=S(null),p=r.replace(/[^a-zA-Z0-9_.-]+/g,"_"),h=I(async C=>{i(!0),u(null),c(!1);try{const A=await e.snapshot.getSnapshot.query({deviceId:t,force:!0});if(!A)throw new Error("No snapshot available");const _=`data:${A.contentType};base64,${A.base64}`;if(C==="copy")try{await navigator.clipboard.writeText(_)}catch{throw new Error("Clipboard unavailable")}else{const P=A.contentType.includes("png")?"png":"jpg";hg(`${p}-${new Date().toISOString().replace(/[:.]/g,"-")}.${P}`,_)}c(!0),setTimeout(()=>c(!1),1500)}catch(A){u(A instanceof Error?A.message:String(A))}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]=S(null),[x,y]=S(!1),w=()=>{y(!1),v(setTimeout(()=>{y(!0),h("copy")},600))},k=()=>{b&&(clearTimeout(b),v(null)),x||h("download")},M=()=>{b&&(clearTimeout(b),v(null))};return f("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,d&&"border-danger/40 text-danger",s),children:[a?o(Ge,{className:"h-3.5 w-3.5 animate-spin"}):l?o(Vt,{className:"h-3.5 w-3.5 text-success"}):o(Fn,{className:"h-3.5 w-3.5"}),"Snapshot"]})}function gg(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 iS({history:e,limit:t=5,latestIsFresh:r,className:n}){if(e.length===0)return null;const s=r?du:Mr,a=e.slice(0,t);return f("div",{className:N("rounded-lg border border-border bg-surface px-3 py-2",n),children:[f("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=>f("li",{className:"flex items-center justify-between text-[11px]",title:new Date(i.timestamp).toLocaleString(),children:[o("span",{className:"text-foreground",children:gg(i.timestamp)}),o("span",{className:"text-foreground-subtle font-mono text-[10px]",children:new Date(i.timestamp).toLocaleTimeString()})]},`${i.deviceId}-${i.timestamp}`))})]})}function lS({items:e,header:t,triggerClassName:r,title:n="More actions"}){const[s,a]=S(!1),i=e.filter(l=>!l.hidden);return i.length===0?null:f(pp,{open:s,onOpenChange:a,children:[o(fp,{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(Ia,{className:"h-4 w-4"})}),f(mp,{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((l,c)=>f("li",{children:[l.separatorBefore&&c>0&&o("div",{className:"my-1 h-px bg-border"}),f("button",{type:"button",disabled:l.disabled,onClick:()=>{l.disabled||(l.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",l.danger?"text-foreground hover:bg-danger/10 hover:text-danger":"text-foreground hover:bg-surface-hover"),children:[l.icon&&o(l.icon,{className:N("h-3.5 w-3.5 shrink-0 mt-0.5",l.danger&&"text-danger/80")}),f("span",{className:"flex-1 min-w-0",children:[o("span",{className:"block leading-tight",children:l.label}),l.description&&o("span",{className:"block mt-0.5 text-[10px] text-foreground-subtle leading-tight",children:l.description})]})]})]},l.id))})]})]})}var bg=[{value:"view",label:"View",icon:qt,hint:"Read-only — queries + subscriptions"},{value:"create",label:"Create",icon:_u,hint:"Mutations that create or update"},{value:"delete",label:"Delete",icon:qe,hint:"Destructive ops (delete/revoke/reset/…)"}];function vg(){return{type:"capability",target:"",access:["view"]}}function yg(e,t,r,n){const s=e==="addon"?r:n;if(t==null)return s;const a=new Set(t.filter(i=>i.type===e).map(i=>i.target));return s.filter(i=>a.has(i))}function xg(e,t){if(t==null)return["view","create","delete"];const r=t.filter(s=>s.type===e.type&&s.target===e.target);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 cS({value:e,onChange:t,clampToParent:r,emptyHint:n}){const{data:s}=Am(),a=ee(()=>(s??[]).map(u=>u.manifest.id).sort(),[s]),i=ee(()=>[...cl].sort(),[]),l=(u,p)=>{t(e.map((h,g)=>{if(g!==u)return h;const b={...h,...p};return p.type!==void 0&&p.type!==h.type&&(b.target=""),b}))},c=u=>{t(e.filter((p,h)=>h!==u))},d=()=>{t([...e,vg()])};return f("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((u,p)=>{const h=yg(u.type,r,a,i),g=xg(u,r);return f("div",{className:"flex flex-wrap items-center gap-1.5 rounded border border-border bg-surface px-2 py-1.5",children:[f("select",{value:u.type,onChange:b=>l(p,{type:b.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:"capability",children:"capability"}),o("option",{value:"addon",children:"addon"})]}),f("select",{value:u.target,onChange:b=>l(p,{target:b.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:[f("option",{value:"",children:["— pick ",u.type," —"]}),h.map(b=>o("option",{value:b,children:b},b))]}),o("div",{className:"flex items-center gap-1",children:bg.map(({value:b,label:v,icon:x,hint:y})=>{const w=u.access.includes(b),k=r!=null&&!g.includes(b)&&!w;return f("label",{title:k?`${y} — not granted by your scope`:y,className:`inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] cursor-pointer transition-colors ${w?"bg-primary/15 text-primary font-medium":"text-foreground-subtle hover:bg-foreground-subtle/10"} ${k?"opacity-40 cursor-not-allowed":""}`,children:[o("input",{type:"checkbox",checked:w,disabled:k,onChange:M=>{const C=new Set(u.access);M.target.checked?C.add(b):C.delete(b),l(p,{access:[...C]})},className:"sr-only"}),o(x,{className:"h-3 w-3"}),v]},b)})}),o("button",{type:"button",onClick:()=>c(p),className:"rounded p-1 text-foreground-subtle hover:bg-danger/10 hover:text-danger transition-colors",title:"Remove scope",children:o(Pe,{className:"h-3 w-3"})})]},p)}),f("button",{type:"button",onClick:d,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(Wt,{className:"h-3 w-3"}),"Add scope"]})]})}function dS(e){for(const t of e){if(t.target.trim().length===0)return`Scope ${t.type}: pick a target`;if(t.access.length===0)return`Scope ${t.type}:${t.target}: pick at least one access`}return null}var Yi=ot("camstack:zone-editing",null);function uS({children:e}){const[t,r]=S(!1),[n,s]=S(null),[a,i]=S(null),[l,c]=S(null),d=I(w=>{r(w),w||(s(null),i(null),c(null))},[]),u=I(w=>{s(w)},[]),p=I(w=>{i(w)},[]),h=I(w=>{r(!0),i(null),s(w),c(null)},[]),g=I(()=>{r(!1),s(null),i(null),c(null)},[]),b=I(w=>{i(w.id),c(w)},[]),v=I(w=>{c(k=>k===null?k:{...k,...w})},[]),x=I(()=>{c(null)},[]),y=ee(()=>({editing:t,drawingKind:n,selectedZoneId:a,editingDraft:l,setEditing:d,setDrawingKind:u,setSelectedZoneId:p,startDrawing:h,exitEditing:g,enterDraft:b,updateDraft:v,discardDraft:x}),[t,n,a,l,d,u,p,h,g,b,v,x]);return o(Yi.Provider,{value:y,children:e})}function pS(){return Ae(Yi)}var ls=500,wg=800;function lr(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 cr(e,t){return e?.id===t}function fS(e,t){const[r,n]=S(null),[s,a]=S(null),[i,l]=S(null),[c,d]=S("watching"),u=q(void 0),p=q(void 0),h=q(void 0);return H(()=>{if(t===null)return;const g=lr(e,"detection.motion-analysis",b=>{const v=b;if(!cr(v?.source,t))return;const x=v.data;!x?.regions||x.regions.length===0||(n({zones:x.regions.map(y=>({...y.bbox,intensity:y.intensity})),frameWidth:x.frameWidth,frameHeight:x.frameHeight}),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>n(null),ls))});return()=>{g?.unsubscribe(),u.current&&clearTimeout(u.current)}},[e,t]),H(()=>{if(t===null)return;const g=lr(e,"detection.motion-zones-raw",b=>{const v=b;if(!cr(v?.source,t))return;const x=v.data;x?.zones&&(a({boxes:x.zones.map(y=>({bbox:y.bbox,changeScore:y.changeScore})),frameWidth:x.frameSize?.width??0,frameHeight:x.frameSize?.height??0,motionScore:x.zones.length>0?x.zones.reduce((y,w)=>y+w.changeScore,0)/x.zones.length:0}),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>a(null),ls))});return()=>{g?.unsubscribe(),p.current&&clearTimeout(p.current)}},[e,t]),H(()=>{if(t===null)return;const g=lr(e,"detection.result",b=>{const v=b;if(!cr(v?.source,t))return;const x=v.data?.frame;x?.detections?.length&&(l({detections:x.detections,frameWidth:x.width,frameHeight:x.height}),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>l(null),wg))});return()=>{g?.unsubscribe(),h.current&&clearTimeout(h.current)}},[e,t]),H(()=>{if(t===null)return;const g=lr(e,"detection.phase-transition",b=>{const v=b;cr(v?.source,t)&&v.data?.to&&d(v.data.to)});return()=>{g?.unsubscribe()}},[e,t]),{motion:r,motionRaw:s,detection:i,phase:c}}function mS(e,t,r=5e3){const[n,s]=S([]);H(()=>{if(t===null)return;let d=!1;const u=()=>{e.webrtcSession.listStreams.query({deviceId:t}).then(h=>{d||s(h)}).catch(()=>{})};u();const p=setInterval(u,r);return()=>{d=!0,clearInterval(p)}},[e,t,r]);const[a,i]=S(null);H(()=>{if(t===null)return;let d=!1;return e.pipelineOrchestrator&&e.pipelineOrchestrator.getCameraMetrics.query({deviceId:t}).then(u=>{d||!u||i({phase:u.phase,detectionFps:u.actualFps,avgInferenceMs:u.avgInferenceTimeMs,droppedFrames:u.droppedFrames})}).catch(()=>{}),()=>{d=!0}},[e,t]),Pr("pipeline.camera-metrics-snapshot",d=>{if(t===null)return;const u=d.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:l,hasWebrtc:c}=ee(()=>t===null||n.length===0?{streams:[],hasWebrtc:!1}:{streams:n.map(d=>({id:d.id,label:d.label,target:d.target,status:d.status,inputFps:d.inputFps,decodeFps:d.decodeFps,bitrateKbps:d.bitrateKbps})),hasWebrtc:!0},[t,n]);return{streams:l,hasWebrtc:c,pipelineMetrics:a,createSession:I(async(d,u)=>{if(t===null)throw new Error("No device selected");const p=await e.webrtcSession.createSession.mutate({deviceId:t,target:d,hints:u});return{sessionId:p.sessionId,sdpOffer:p.sdpOffer}},[e,t]),sendAnswer:I(async(d,u)=>{if(t===null)throw new Error("No device selected");await e.webrtcSession.handleAnswer.mutate({deviceId:t,sessionId:d,sdpAnswer:u})},[e,t]),closeSession:I(async d=>{t!==null&&await e.webrtcSession.closeSession.mutate({deviceId:t,sessionId:d}).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 hS(e,t,r){const n=r?.defaultSpeed??.5,s=r?.pulseMs??250,a=r?.enabled??!0,i=Rr(e,a?t:null)?.ptz,[l,c]=S([]),[d,u]=S(!1),[p,h]=S(null),g=I(async()=>{if(!(!a||!i))try{c(await i.getPresets({}))}catch(v){const x=v instanceof Error?v.message:String(v);if(x.includes("provider not available")||x.includes("no 'ptz' binding"))return;h(x)}},[i,a]);H(()=>{g()},[g]);const b=I(async v=>{if(!(!a||!i)){h(null),u(!0);try{return await v()}catch(x){h(x instanceof Error?x.message:String(x));return}finally{u(!1)}}},[a,i]);return{move:I(async(v,x)=>{if(!i)return;const y=cs[v],w=x??n;await b(async()=>{await i.move({pan:y.pan,tilt:y.tilt,speed:w}),await new Promise(k=>setTimeout(k,s)),await i.stop({})})},[i,n,s,b]),startContinuous:I(async(v,x)=>{if(!i)return;const y=cs[v],w=x??n;await b(()=>i.continuousMove({pan:y.pan,tilt:y.tilt,speed:w}))},[i,n,b]),stopContinuous:I(async()=>{i&&await b(()=>i.stop({}))},[i,b]),zoom:I(async(v,x)=>{if(!i)return;const y=v==="in"?1:-1,w=x??n;await b(async()=>{await i.move({zoom:y,speed:w}),await new Promise(k=>setTimeout(k,s)),await i.stop({})})},[i,n,s,b]),goHome:I(async()=>{i&&await b(()=>i.goHome({}))},[i,b]),goToPreset:I(async v=>{i&&await b(()=>i.goToPreset({presetId:v}))},[i,b]),presets:l,refreshPresets:g,busy:d,error:p}}function gS(e){const t=e?.deviceId??null,r=e?.historyLimit??20,n=mi("doorbell.onPressed",t!==null?i=>i.deviceId===t:void 0),[s,a]=S([]);return H(()=>{n&&a(i=>{if(i.length>0&&i[0].deviceId===n.deviceId&&i[0].timestamp===n.timestamp)return i;const l=[n,...i];return l.length>r?l.slice(0,r):l})},[n,r]),{latest:n??null,history:s}}function bS(e){const t=Rt(),r=ee(()=>e?JSON.stringify(e):"",[e]),[n,s]=S(()=>t.listDevices(e));return H(()=>{const a=()=>{s(t.listDevices(e))};a();let i=null,l=null;try{i=t.onDeviceAdded(a),l=t.onDeviceRemoved(a)}catch{}const c=t.subscribeConnectionEvents(d=>{d==="connected"&&a()});return()=>{i?.(),l?.(),c()}},[t,e,r]),n}function vS(e){const t=Rt(),[r,n]=S(()=>e===null?null:t.getDevice(e));return H(()=>{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 l=t.subscribeConnectionEvents(c=>{c==="connected"&&s()});return()=>{a?.(),i?.(),l()}},[t,e]),r}function yS(e,t,r){const n=Rt();return ms({queryKey:e,queryFn:()=>t(n)(),...r})}function xS(e,t){const r=Rt();return rl({mutationFn:n=>e(r)(n),...t})}function wS(e,t){const r=Rt(),n=Rn(),[s,a]=S(r.connectionVersion);H(()=>r.subscribeConnectionEvents((c,d)=>{c==="connected"&&a(d)}),[r]);const i=t.join("|"),l=JSON.stringify(e);H(()=>{const c=[],d=()=>{const u=JSON.parse(l),p=u.length===1&&Array.isArray(u[0])?u:[u];n.invalidateQueries({queryKey:p})};d();for(const u of i.split("|"))if(u)try{c.push(r.subscribeEvent(u,d))}catch{}return()=>{for(const u of c)u()}},[r,n,i,l,s])}export{QN as AddonGlobalSettingsForm,Ab as AgentStepEditor,Hb as AppShell,YN as AudioClassificationList,ZN as AudioLevelWaveform,KN as AudioWaveform,Xg as BTN_COMPACT,eb as BTN_COMPACT_DANGER,Jg as BTN_COMPACT_PRIMARY,tb as BTN_COMPACT_WARNING,Lt as Badge,ff as BatteryBadge,si as BottomSheet,Nb as Breadcrumb,gr as Button,ob as CHIP_ACTIVE,nb as CHIP_BASE,sb as CHIP_INACTIVE,rr as CLASS_COLORS,Lh as CameraStreamPlayer,qa as Card,op as Checkbox,Gb as CodeBlock,tp as CollapsibleCard,Sh as ConfigFormBuilder,Yt as ConfigFormField,Un as ConfigSchemaField,oS as ConfirmActionButton,zb as ConfirmDialogProvider,sv as CustomFieldRenderersProvider,Yb as DEFAULT_COLOR,Sb as DataTable,Xb as DetectionCanvas,Eh as DetectionOverlay,Jb as DetectionResultTree,Cm as DevShell,nS as DeviceActivityPanel,Ub as DeviceCard,av as DeviceContextProvider,Vb as DeviceGrid,xn as DeviceItem,Wb as DeviceList,ap as Dialog,Xa as DialogContent,up as DialogDescription,cp as DialogFooter,lp as DialogHeader,dp as DialogTitle,cb as DialogTrigger,rS as DiscoveryPanel,iS as DoorbellRecentPanel,db as Dropdown,pb as DropdownContent,fb as DropdownItem,ub as DropdownTrigger,Bb as EmptyState,Zi as EventStream,Qb as FilterBar,tS as FloatingEventStream,eS as FloatingLogStream,kb as FloatingPanel,Ob as FormField,jg as GRID_GAP,Hg as GRID_PAIRED,Qg as GRID_QUICK_STATS,rb as INPUT_COMPACT,Va as IconButton,tv as ImageSelector,rv as InferenceConfigSelector,gn as Input,lS as KebabMenu,jb as KeyValueList,Gg as LIST_ROW,Wa as Label,Ki as LogStream,xm as LoginForm,hp as MobileDrawer,Xm as NodeMultiSelectField,Ib as NodePicker,Ym as NodeSelectField,uo as PHASE_CONFIG,sS as PTZOverlay,$b as PageHeader,JN as PhaseIcon,Zb as PipelineBuilder,Kb as PipelineRuntimeSelector,Gr as PipelineStep,Pb as PipelineTreeMatrix,HN as PlayerOverlaysProvider,pp as Popover,mp as PopoverContent,fp as PopoverTrigger,Db as ProviderBadge,XN as ResponseLog,zg as SECTION_BODY,$g as SECTION_CARD,Bg as SECTION_HEADER,Ug as SPLIT_PANEL_OUTER,Vg as SPLIT_PANEL_SIDE,Fg as STACK_GAP,cS as ScopePicker,di as ScrollArea,bn as Select,Tp as SemanticBadge,Ka as Separator,Oo as Sidebar,Lo as SidebarItem,np as Skeleton,Cb as SlideOverPanel,aS as SnapshotButton,Fb as StatCard,dg as StateValuesStream,Tb as StatusBadge,ev as StepTimings,Mb as StepTreeMaster,WN as StreamPanel,sp as Switch,Pp as SystemProvider,Wg as TEXT_FIELD_LABEL,Kg as TEXT_HINT,Yg as TEXT_METRIC,qg as TEXT_SECTION_LABEL,Zg as TEXT_VALUE,vb as Tabs,wb as TabsContent,yb as TabsList,xb as TabsTrigger,no as ThemeProvider,mb as Tooltip,gb as TooltipContent,hb as TooltipTrigger,Lb as VersionBadge,jN as WidgetRegistryProvider,zm as WidgetSlot,uS as ZoneEditingProvider,Eb as buildStepTreeFromSchema,N as cn,ot as createSharedContext,Lg as createTheme,fl as darkColors,eo as defaultTheme,qb as deriveDeviceKind,Yd as ensureMfHostInit,Be as getClassColor,js as getPhaseVisual,wh as isFieldVisible,ml as lightColors,ab as mirror,ov as mountAddonPage,ib as providerIcons,lb as statusIcons,Og as themeToCss,m as trpc,lv as useAccessoriesGetStatus,cv as useAddonPagesListPages,Ov as useAddonSettingsGetDeviceSettings,Dv as useAddonSettingsGetGlobalSettings,$v as useAddonSettingsUpdateDeviceSettings,Lv as useAddonSettingsUpdateGlobalSettings,Pm as useAddonWidgetsListWidgets,_v as useAddonsApplyAutoUpdateToAll,Iv as useAddonsCustom,kv as useAddonsForceRefresh,Pv as useAddonsGetAddonAutoUpdate,Ev as useAddonsGetAutoUpdateSettings,dv as useAddonsGetLogs,Sv as useAddonsGetVersions,fv as useAddonsInstallFromWorkspace,pv as useAddonsInstallPackage,mv as useAddonsIsWorkspaceAvailable,Am as useAddonsList,uv as useAddonsListPackages,yv as useAddonsListUpdates,hv as useAddonsListWorkspacePackages,Tv as useAddonsOnAddonLogs,bv as useAddonsReloadPackages,Cv as useAddonsRestartAddon,Nv as useAddonsRestartServer,Mv as useAddonsRetryLoad,wv as useAddonsRollbackPackage,vv as useAddonsSearchAvailable,Rv as useAddonsSetAddonAutoUpdate,Av as useAddonsSetAutoUpdateSettings,gv as useAddonsUninstallPackage,xv as useAddonsUpdatePackage,Hv as useAlertsDismiss,Bv as useAlertsEmit,jv as useAlertsGetUnreadCount,Fv as useAlertsList,Qv as useAlertsMarkAllRead,Gv as useAlertsMarkRead,zv as useAlertsUpdate,GN as useAllWidgets,Wv as useAudioAnalysisApplyDeviceSettingsPatch,qv as useAudioAnalysisGetDeviceLiveContribution,Vv as useAudioAnalysisGetDeviceSettingsContribution,Uv as useAudioAnalysisResolveDeviceSettings,Kv as useAudioAnalyzerAnalyseChunk,Zv as useAudioAnalyzerClassify,Xv as useAudioAnalyzerDispose,Yv as useAudioAnalyzerIsReady,Jv as useAudioAnalyzerReprobeAudioEngine,ty as useAudioCodecCanHandle,oy as useAudioCodecCloseSession,ry as useAudioCodecCreateDecodeSession,ny as useAudioCodecCreateEncodeSession,cy as useAudioCodecFlushEncode,dy as useAudioCodecListActiveSessions,ey as useAudioCodecListSupportedCodecs,ly as useAudioCodecPullEncoded,ay as useAudioCodecPullPcm,sy as useAudioCodecPushEncodedFrame,iy as useAudioCodecPushPcm,uy as useAudioMetricsGetCurrentSnapshot,py as useAudioMetricsGetHistory,fy as useAuthenticationListProviders,my as useAuthenticationSetProviderEnabled,wy as useBackupDelete,yy as useBackupGetEntries,by as useBackupList,ky as useBackupListArchives,hy as useBackupListDestinations,vy as useBackupListLocations,Sy as useBackupPreviewSchedule,xy as useBackupRestore,gy as useBackupTrigger,Ny as useBackupUpsertDestinationPolicy,Cy as useBatteryGetStatus,Ey as useBrightnessGetStatus,My as useBrightnessSetBrightness,Py as useCameraStreamsGetBrokerStreams,Ay as useCameraStreamsGetCameraStreams,Ry as useCameraStreamsGetRtspEntries,qn as useClusterNodes,Wn as useConfirm,Mm as useCustomFieldRenderer,bf as useDebouncedString,Ty as useDecoderCreateSession,Dy as useDecoderDestroySession,Iy as useDecoderGetInfo,zy as useDecoderGetStats,Fy as useDecoderListActiveSessions,Oy as useDecoderOpenStream,$y as useDecoderPullFrames,Ly as useDecoderPushPacket,jy as useDecoderReprobeHwaccel,_y as useDecoderSupportsCodec,By as useDecoderUpdateConfig,Hy as useDetectionPipelineApplyDeviceSettingsPatch,Qy as useDetectionPipelineGetDeviceLiveContribution,Gy as useDetectionPipelineGetDeviceSettingsContribution,nv as useDevShell,vS as useDevice,cf as useDeviceBattery,Zt as useDeviceCapability,fS as useDeviceDetections,qy as useDeviceDiscoveryAdoptDevice,Ky as useDeviceDiscoveryGetStatus,Uy as useDeviceDiscoveryListDiscovered,Vy as useDeviceDiscoveryRefreshDiscovery,Wy as useDeviceDiscoveryReleaseDevice,Em as useDeviceId,ix as useDeviceManagerAddLocation,Lx as useDeviceManagerAdoptDevice,Zy as useDeviceManagerAllocateDeviceId,$x as useDeviceManagerCreateDevice,yx as useDeviceManagerDisable,Dx as useDeviceManagerDiscoverDevices,vx as useDeviceManagerEnable,Cx as useDeviceManagerGetAllBindings,Sx as useDeviceManagerGetBindings,fx as useDeviceManagerGetChildren,hx as useDeviceManagerGetConfigSchema,Ox as useDeviceManagerGetCreationSchema,px as useDeviceManagerGetDevice,_x as useDeviceManagerGetDeviceAggregate,Rx as useDeviceManagerGetDeviceLiveInfoAggregate,Px as useDeviceManagerGetDeviceSettingsAggregate,Fx as useDeviceManagerGetDeviceStatusAggregate,gx as useDeviceManagerGetSettingsSchema,wx as useDeviceManagerGetStreamProfileMap,mx as useDeviceManagerGetStreamSources,ux as useDeviceManagerListAll,Ax as useDeviceManagerListBindableCapsForDeviceType,ax as useDeviceManagerListLocations,dx as useDeviceManagerListPersistedByAddon,Ex as useDeviceManagerListWrappersForCap,ex as useDeviceManagerLoadConfig,rx as useDeviceManagerLoadMeta,tx as useDeviceManagerLoadRuntimeState,Jy as useDeviceManagerPersistConfig,Nx as useDeviceManagerProbeStreams,Yy as useDeviceManagerRegisterDevice,xx as useDeviceManagerRemove,Xy as useDeviceManagerRemoveDevice,lx as useDeviceManagerRemoveLocation,cx as useDeviceManagerSetDisabled,ox as useDeviceManagerSetLocation,sx as useDeviceManagerSetMetadata,nx as useDeviceManagerSetName,kx as useDeviceManagerSetStreamProfileMap,Mx as useDeviceManagerSetWrapperActive,Bx as useDeviceManagerTestCreationField,zx as useDeviceManagerTestField,bx as useDeviceManagerUpdateConfig,Ix as useDeviceManagerUpdateDeviceField,Tx as useDeviceManagerUpdateDeviceFieldsBatch,Gx as useDeviceOpsGetConfigEntries,Ux as useDeviceOpsGetSettingsSchema,jx as useDeviceOpsGetStreamSources,Hx as useDeviceOpsRemoveDevice,Qx as useDeviceOpsSetConfig,Xx as useDeviceProviderAdoptDiscoveredDevice,t0 as useDeviceProviderCreateDevice,Yx as useDeviceProviderDiscoverDevices,e0 as useDeviceProviderGetChildCreationSchema,Kx as useDeviceProviderGetDevices,Wx as useDeviceProviderGetStatus,Vx as useDeviceProviderStart,qx as useDeviceProviderStop,Zx as useDeviceProviderSupportsDiscovery,Jx as useDeviceProviderSupportsManualCreation,r0 as useDeviceProviderTestCreationField,Rr as useDeviceProxy,iv as useDeviceSnapshot,df as useDeviceSnapshotImage,Op as useDeviceState,s0 as useDeviceStateGetAllSnapshots,o0 as useDeviceStateGetCapSlice,n0 as useDeviceStateGetSnapshot,a0 as useDeviceStateSetCapSlice,gi as useDeviceStateSlice,mS as useDeviceWebrtc,bS as useDevices,gS as useDoorbellEvents,i0 as useDoorbellGetStatus,wS as useEventInvalidation,mi as useEventStreamLatest,_b as useEventStreamMap,d0 as useEventsGetEventClipUrl,c0 as useEventsGetEventThumbnail,l0 as useEventsGetEvents,m0 as useIntegrationsCreate,g0 as useIntegrationsDelete,p0 as useIntegrationsGet,y0 as useIntegrationsGetAvailableTypes,f0 as useIntegrationsGetByAddonId,b0 as useIntegrationsGetSettings,u0 as useIntegrationsList,v0 as useIntegrationsSetSettings,x0 as useIntegrationsTestConnection,h0 as useIntegrationsUpdate,S0 as useIntercomGetStatus,k0 as useIntercomHandleAnswer,w0 as useIntercomStartSession,N0 as useIntercomStopSession,bb as useIsMidWidth,Ar as useIsMobile,St as useLiveBuffer,Pr as useLiveEvent,A0 as useLocalNetworkGetAllowedAddresses,E0 as useLocalNetworkGetConnectionEndpoints,M0 as useLocalNetworkGetPreferred,C0 as useLocalNetworkList,R0 as useLocalNetworkResetAllowlistToBestMatch,P0 as useLocalNetworkSetAllowedAddresses,I0 as useMeshOrchestratorJoinProvider,T0 as useMeshOrchestratorLeaveProvider,_0 as useMeshOrchestratorListProviders,D0 as useMetricsProviderCollectSnapshot,G0 as useMetricsProviderGetAddonStats,L0 as useMetricsProviderGetCached,z0 as useMetricsProviderGetCpuTemperature,O0 as useMetricsProviderGetCurrent,$0 as useMetricsProviderGetDiskSpace,B0 as useMetricsProviderGetGpuInfo,F0 as useMetricsProviderGetProcessStats,H0 as useMetricsProviderKillProcess,j0 as useMetricsProviderListAddonInstances,Q0 as useMetricsProviderListNodeProcesses,q0 as useMotionDetectionAnalyze,X0 as useMotionDetectionApplyDeviceSettingsPatch,Y0 as useMotionDetectionGetDeviceLiveContribution,Z0 as useMotionDetectionGetDeviceSettingsContribution,W0 as useMotionDetectionRemoveCamera,K0 as useMotionDetectionReset,V0 as useMotionGetStatus,U0 as useMotionIsDetected,e1 as useMotionTriggerGetStatus,J0 as useMotionTriggerSetMotionTrigger,t1 as useNativeObjectDetectionGetStatus,n1 as useNetworkQualityGetAllStats,r1 as useNetworkQualityGetDeviceStats,o1 as useNetworkQualityReportClientStats,f1 as useNodesClusterAddonStatus,a1 as useNodesDeployAddon,h1 as useNodesExecuteQuery,p1 as useNodesRenameNode,l1 as useNodesRestartAddon,d1 as useNodesRestartNode,c1 as useNodesRestartProcess,m1 as useNodesSetProcessLogLevel,u1 as useNodesShutdownNode,s1 as useNodesTopology,i1 as useNodesUndeployAddon,g1 as useNotificationOutputSend,b1 as useNotificationOutputSendTest,Rb as useOptionalSystem,$m as useOptionalWidgetRegistry,y1 as useOsdGetStatus,v1 as useOsdSetOverlay,hS as usePTZ,_1 as usePipelineAnalyticsApplyDeviceSettingsPatch,N1 as usePipelineAnalyticsClearTracks,x1 as usePipelineAnalyticsGetActiveTracks,M1 as usePipelineAnalyticsGetAudioEvents,R1 as usePipelineAnalyticsGetDeviceLiveContribution,P1 as usePipelineAnalyticsGetDeviceSettingsContribution,E1 as usePipelineAnalyticsGetEventMedia,S1 as usePipelineAnalyticsGetMotionEvents,C1 as usePipelineAnalyticsGetObjectEvents,w1 as usePipelineAnalyticsGetTrack,A1 as usePipelineAnalyticsGetTrackMedia,k1 as usePipelineAnalyticsListTracks,J1 as usePipelineExecutorCacheFrameInPool,K1 as usePipelineExecutorDeleteModel,U1 as usePipelineExecutorDeleteTemplate,Z1 as usePipelineExecutorDetect,W1 as usePipelineExecutorDownloadModel,q1 as usePipelineExecutorGetAddonModels,dw as usePipelineExecutorGetAudioCapabilities,I1 as usePipelineExecutorGetAvailableEngines,V1 as usePipelineExecutorGetCapabilities,D1 as usePipelineExecutorGetDefaultSteps,pw as usePipelineExecutorGetDetectionConfigSchema,rw as usePipelineExecutorGetEffectiveTuning,F1 as usePipelineExecutorGetGlobalPipelineConfig,z1 as usePipelineExecutorGetGlobalSteps,j1 as usePipelineExecutorGetOrchestratorConfigSchema,cw as usePipelineExecutorGetReferenceAudio,lw as usePipelineExecutorGetReferenceAudioFiles,iw as usePipelineExecutorGetReferenceImage,B1 as usePipelineExecutorGetSchema,T1 as usePipelineExecutorGetSelectedEngine,O1 as usePipelineExecutorGetVideoPipelineSteps,ew as usePipelineExecutorInferCached,sw as usePipelineExecutorKillEngine,nw as usePipelineExecutorListLoadedEngines,aw as usePipelineExecutorListReferenceImages,G1 as usePipelineExecutorListTemplates,L1 as usePipelineExecutorReprobeEngine,uw as usePipelineExecutorRunAudioTest,Y1 as usePipelineExecutorRunPipeline,X1 as usePipelineExecutorRunPipelineBatch,Q1 as usePipelineExecutorSaveTemplate,$1 as usePipelineExecutorSetVideoPipelineSteps,ow as usePipelineExecutorSpinEngine,tw as usePipelineExecutorUncacheFrame,H1 as usePipelineExecutorUpdateTemplate,Ww as usePipelineOrchestratorApplyDeviceSettingsPatch,Mw as usePipelineOrchestratorAssignAudio,Nw as usePipelineOrchestratorAssignDecoder,fw as usePipelineOrchestratorAssignPipeline,Uw as usePipelineOrchestratorDeleteTemplate,vw as usePipelineOrchestratorGetAgentLoad,Iw as usePipelineOrchestratorGetAgentSettings,Aw as usePipelineOrchestratorGetAudioAssignment,Rw as usePipelineOrchestratorGetAudioAssignments,Pw as usePipelineOrchestratorGetAudioNodeLoad,xw as usePipelineOrchestratorGetCameraMetrics,Ow as usePipelineOrchestratorGetCameraSettings,Bw as usePipelineOrchestratorGetCameraStepOverrides,ww as usePipelineOrchestratorGetCapabilityBindings,_w as usePipelineOrchestratorGetDecoderAssignment,Cw as usePipelineOrchestratorGetDecoderAssignments,qw as usePipelineOrchestratorGetDeviceLiveContribution,Vw as usePipelineOrchestratorGetDeviceSettingsContribution,yw as usePipelineOrchestratorGetGlobalMetrics,bw as usePipelineOrchestratorGetPipelineAssignment,gw as usePipelineOrchestratorGetPipelineAssignments,Tw as usePipelineOrchestratorListAgentSettings,Gw as usePipelineOrchestratorListTemplates,hw as usePipelineOrchestratorRebalance,Lw as usePipelineOrchestratorRemoveAgentSettings,jw as usePipelineOrchestratorResolvePipeline,Qw as usePipelineOrchestratorSaveTemplate,Dw as usePipelineOrchestratorSetAgentAddonDefaults,Fw as usePipelineOrchestratorSetCameraPipelineForAgent,zw as usePipelineOrchestratorSetCameraStepOverride,$w as usePipelineOrchestratorSetCameraStepToggle,kw as usePipelineOrchestratorSetCapabilityBinding,Ew as usePipelineOrchestratorUnassignAudio,Sw as usePipelineOrchestratorUnassignDecoder,mw as usePipelineOrchestratorUnassignPipeline,Hw as usePipelineOrchestratorUpdateTemplate,Kw as usePipelineRunnerAttachCamera,Zw as usePipelineRunnerDetachCamera,tk as usePipelineRunnerGetAllCameraMetrics,ek as usePipelineRunnerGetCameraMetrics,rk as usePipelineRunnerGetLocalCameras,Xw as usePipelineRunnerGetLocalLoad,Jw as usePipelineRunnerGetLocalMetrics,Yw as usePipelineRunnerReportMotion,nk as usePlatformProbeGetCapabilities,ok as usePlatformProbeGetHardware,ak as usePlatformProbeResolveHwAccel,sk as usePlatformProbeResolveInferenceConfig,VN as usePlayerOverlayLayer,UN as usePlayerOverlayLayers,qN as usePlayerToolbarButton,Oh as usePlayerToolbarButtons,bk as usePtzAutotrackGetSettings,hk as usePtzAutotrackGetStatus,gk as usePtzAutotrackSetEnabled,vk as usePtzAutotrackSetSettings,lk as usePtzContinuousMove,fk as usePtzGetPosition,dk as usePtzGetPresets,mk as usePtzGetStatus,pk as usePtzGoHome,uk as usePtzGoToPreset,ik as usePtzMove,ck as usePtzStop,yk as useRebootReboot,Ck as useRecordingEngineDisable,Sk as useRecordingEngineEnable,Tk as useRecordingEngineEstimateGlobalStorage,Ik as useRecordingEngineEstimateStorage,_k as useRecordingEngineGetAvailability,Mk as useRecordingEngineGetConfig,Fk as useRecordingEngineGetMotionStats,Ak as useRecordingEngineGetPlaylist,Ok as useRecordingEngineGetPolicy,$k as useRecordingEngineGetPolicyStatus,Bk as useRecordingEngineGetRetentionConfig,Rk as useRecordingEngineGetSegments,Nk as useRecordingEngineGetStatus,Dk as useRecordingEngineGetStorageUsage,Pk as useRecordingEngineGetThumbnail,Lk as useRecordingEngineSetPolicy,Ek as useRecordingEngineUpdateConfig,zk as useRecordingEngineUpdateRetentionConfig,wk as useRecordingGetPlaybackUrl,xk as useRecordingGetSegments,kk as useRecordingGetThumbnailAt,jk as useRemoteAccessListProviders,Gk as useRemoteAccessStartProvider,Qk as useRemoteAccessStopProvider,Zk as useSettingsStoreCount,Xk as useSettingsStoreDeclareCollection,Kk as useSettingsStoreDelete,Hk as useSettingsStoreGet,qk as useSettingsStoreInsert,Yk as useSettingsStoreIsEmpty,Vk as useSettingsStoreQuery,Uk as useSettingsStoreSet,Wk as useSettingsStoreUpdate,o2 as useSnapshotApplyDeviceSettingsPatch,n2 as useSnapshotGetDeviceLiveContribution,r2 as useSnapshotGetDeviceSettingsContribution,Jk as useSnapshotGetSnapshot,t2 as useSnapshotGetStatus,e2 as useSnapshotInvalidateCache,a2 as useSnapshotProviderGetSnapshot,s2 as useSnapshotProviderSupportsDevice,b2 as useStorageAbortUpload,v2 as useStorageBeginDownload,m2 as useStorageBeginUpload,p2 as useStorageDelete,S2 as useStorageDeleteLocation,x2 as useStorageEndDownload,d2 as useStorageExists,g2 as useStorageFinalizeUpload,f2 as useStorageGetAvailableSpace,k2 as useStorageGetDefaultLocation,u2 as useStorageList,w2 as useStorageListLocations,M2 as useStorageListProviders,c2 as useStorageRead,y2 as useStorageReadChunk,i2 as useStorageResolve,E2 as useStorageTestConfig,C2 as useStorageTestLocation,N2 as useStorageUpsertLocation,l2 as useStorageWrite,h2 as useStorageWriteChunk,Z2 as useStreamBrokerApplyDeviceSettingsPatch,R2 as useStreamBrokerAssignProfile,Q2 as useStreamBrokerGetAllRtspEntries,z2 as useStreamBrokerGetBroker,D2 as useStreamBrokerGetBrokerStats,K2 as useStreamBrokerGetDeviceLiveContribution,W2 as useStreamBrokerGetDeviceSettingsContribution,j2 as useStreamBrokerGetPreBufferInfo,H2 as useStreamBrokerGetRtspEntry,G2 as useStreamBrokerGetRtspPort,B2 as useStreamBrokerGetStreamUrl,q2 as useStreamBrokerIsRtspEnabled,O2 as useStreamBrokerKillClient,I2 as useStreamBrokerListAllCameraStreams,T2 as useStreamBrokerListAllProfileSlots,L2 as useStreamBrokerListClients,A2 as useStreamBrokerPublishCameraStream,U2 as useStreamBrokerRegenerateRtspToken,$2 as useStreamBrokerRestartProfile,P2 as useStreamBrokerRetractCameraStream,F2 as useStreamBrokerSetPreBufferDuration,V2 as useStreamBrokerSetRtspEnabled,_2 as useStreamBrokerUnassignProfile,X2 as useSwitchGetStatus,Y2 as useSwitchSetState,Rt as useSystem,tN as useSystemFeatureFlags,sN as useSystemForceRetentionCleanup,nN as useSystemGetRetentionConfig,eN as useSystemHealth,J2 as useSystemInfo,xS as useSystemMutation,rN as useSystemNetworkAddresses,yS as useSystemQuery,oN as useSystemSetRetentionConfig,xl as useThemeMode,aN as useToastOnToast,lN as useTurnOrchestratorGetAllServers,iN as useTurnOrchestratorListProviders,cN as useTurnOrchestratorSetProviderEnabled,dN as useTurnProviderGetTurnServers,yN as useUserManagementCreateApiKey,kN as useUserManagementCreateScopedToken,pN as useUserManagementCreateUser,mN as useUserManagementDeleteUser,vN as useUserManagementListApiKeys,CN as useUserManagementListScopedTokens,uN as useUserManagementListUsers,hN as useUserManagementResetPassword,xN as useUserManagementRevokeApiKey,NN as useUserManagementRevokeScopedToken,gN as useUserManagementSetUserScopes,fN as useUserManagementUpdateUser,wN as useUserManagementValidateApiKey,bN as useUserManagementValidateCredentials,SN as useUserManagementValidateScopedToken,PN as useWebrtcSessionCloseSession,EN as useWebrtcSessionCreateSession,AN as useWebrtcSessionHandleAnswer,RN as useWebrtcSessionHasAdaptiveBitrate,MN as useWebrtcSessionListStreams,Lm as useWidget,Om as useWidgetMetadata,Zn as useWidgetRegistry,TN as useZoneAnalyticsGetCameraHistory,_N as useZoneAnalyticsGetCurrentSnapshot,DN as useZoneAnalyticsGetUnzonedHistory,IN as useZoneAnalyticsGetZoneHistory,pS as useZoneEditing,LN as useZoneRulesListRules,ON as useZoneRulesSetRules,BN as useZonesAddZone,$N as useZonesListZones,zN as useZonesRemoveZone,FN as useZonesUpdateZone,dS as validateScopes};
|