@camstack/addon-admin-ui 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CKfGBI-Z.js → __mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CeLhKMin.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-CykPKLuU.js → __mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-DXPQtD9p.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-xMlwAAY4.js → __mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-OcRSBqRe.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-Clpxla3F.js → __mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs_commonjs-proxy-GvBGLFI2.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-B_akQFxJ.js → __mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-Dl4u0xYE.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs_commonjs-proxy-BZBxNMgx.js → __mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs_commonjs-proxy-CSyOECfO.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CCRqQaXq.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CzO_Esxm.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-B5D3mvYP.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-xw6c6JeS.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-CRHuTm5p.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DNpf5SLz.js} +1 -1
- package/dist/assets/{__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs_commonjs-proxy-XIS4Ck9-.js → __mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs_commonjs-proxy-BEKtiDI3.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D4TBsvIB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CziSE-Do.js} +1 -1
- package/dist/assets/auth-records-BEfan3dC.js +1 -0
- package/dist/assets/capability-router-map-B3jHfbHt.js +1 -0
- package/dist/assets/devices-BfsgGvwu.js +1 -0
- package/dist/assets/{hostInit-DpSCsYyA.js → hostInit-7yPTCcmg.js} +1 -1
- package/dist/assets/index-BlKJSHE9.js +80 -0
- package/dist/assets/index-ByDDdVKJ.css +1 -0
- package/dist/assets/index-C-M4yvxf.js +1 -0
- package/dist/assets/index-DculG9Gi.js +1098 -0
- package/dist/assets/index-DfH297U6.js +1 -0
- package/dist/assets/index-Dvmk3HcY.js +1 -0
- package/dist/assets/index-K1-f6oQr.js +1 -0
- package/dist/assets/index-X-IEwb-L.js +80 -0
- package/dist/assets/index-cfq-Npln.js +1 -0
- package/dist/assets/index-iCcWZGKs.js +1 -0
- package/dist/assets/index-ptcmLXsE.js +1 -0
- package/dist/assets/{remoteEntry-0zDoMSWf.js → remoteEntry-Da_G1gka.js} +1 -1
- package/dist/assets/{schemas-BOzikgNT.js → schemas-XgIEoUz3.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BnGk9xo_.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-kSAHDLPS.js} +2 -2
- package/dist/index.html +7 -8
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/dist/server/addon.js +11 -25
- package/dist/server/addon.js.map +1 -1
- package/dist/sw.js +1 -1
- package/package.json +4 -3
- package/dist/assets/capability-router-map-Bqwnkkax.js +0 -1
- package/dist/assets/devices-CFL4MLSo.js +0 -511
- package/dist/assets/index-BP0PcGIN.js +0 -1
- package/dist/assets/index-BQVATbZy.js +0 -5
- package/dist/assets/index-BZhZ3Jvf.js +0 -1
- package/dist/assets/index-BfdtdylV.js +0 -533
- package/dist/assets/index-BkJ1uzOh.js +0 -8420
- package/dist/assets/index-BuajxCgS.js +0 -1
- package/dist/assets/index-CKMQgnc3.js +0 -1
- package/dist/assets/index-DAq7g5_U.js +0 -1
- package/dist/assets/index-DRebE_bu.js +0 -22
- package/dist/assets/index-DUjRaULz.js +0 -1
- package/dist/assets/index-OcuNiGT5.js +0 -34
- package/dist/assets/index-R6tzT59K.css +0 -1
- package/dist/assets/index-pmj5N6Ix.js +0 -5
- package/dist/server/addon.d.ts +0 -12
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as k,z as B,f as F,g as U,s as z,p as $,m as j,i as W,j as P,k as H,l as R,n as K,o as Z,q,r as V,t as G,u as Y,A as ge,v as Se,w as ye,x as be,y as Ce,B as ve,C as Ae,E as we,F as Ie,G as _e,H as Ee,I as De,J as ke,K as Pe,L as Re,N as Ne,O as Te,P as Oe,Q as xe,R as Me,T as Le,U as Be,V as Fe,X as Ue,Y as ze,Z as $e,_ as je,$ as We,a0 as He,a1 as Ke,a2 as Ze,a3 as qe,a4 as Ve,a5 as Ge,a6 as Ye,a7 as Je,a8 as Qe,a9 as Xe,aa as et,ab as tt,ac as at,ad as st,ae as it,af as nt,ag as rt,ah as ot,ai as ct,aj as dt,ak as lt,al as ut,am as ht,an as mt,ao as pt,ap as ft,aq as gt,ar as St,as as yt,at as bt,au as Ct,av as vt,aw as At,ax as wt,ay as It,az as _t,aA as Et,aB as Dt,aC as kt,aD as Pt,aE as Rt,aF as Nt,aG as Tt,aH as Ot,aI as xt,aJ as Mt,aK as Lt,aL as Bt,aM as Ft,aN as Ut,aO as zt,aP as $t,aQ as jt,aR as Wt,aS as Ht,aT as Kt,D as Zt,aU as qt,aV as Vt,aW as Gt,aX as Yt,a as Jt,aY as Qt,aZ as Xt,a_ as ea,a$ as ta,b0 as aa,b1 as sa,b2 as ia,b3 as na,b4 as ra,b5 as oa,b6 as ca,b7 as da,b8 as la,b9 as ua,ba as ha,bb as ma,bc as pa,bd as fa,be as ga,bf as Sa,bg as ya,bh as ba,bi as Ca,bj as va,bk as Aa,bl as wa,bm as Ia,bn as _a,M as Ea,bo as Da,bp as ka,bq as Pa,br as Ra,bs as Na,bt as Ta,bu as Oa,bv as xa,bw as Ma,bx as La,by as Ba,bz as Fa,bA as Ua,bB as za,bC as $a,bD as ja,bE as Wa,bF as Ha,bG as Ka,bH as Za,bI as qa,bJ as Va,bK as Ga,bL as Ya,bM as Ja,bN as Qa,bO as Xa,bP as es,bQ as ts,bR as as,bS as ss,bT as is,bU as ns,bV as rs,bW as os,bX as cs,bY as ds,bZ as ls,b_ as us,b$ as hs,c0 as ms,c1 as ps,c2 as fs,c3 as gs,c4 as Ss,c5 as ys,c6 as bs,c7 as Cs,c8 as vs,c9 as As,ca as ws,cb as Is,cc as _s,cd as Es,ce as Ds,cf as ks,cg as Ps,ch as Rs,ci as Ns,cj as Ts,ck as Os,cl as xs,cm as Ms,cn as Ls,co as Bs,cp as Fs,cq as Us,cr as zs,cs as $s,ct as js,cu as Ws,cv as Hs,cw as Ks,cx as Zs,cy as qs,d as Vs,cz as Gs,cA as Ys,cB as Js,cC as Qs,cD as Xs,cE as ei,cF as ti,cG as ai,cH as si,cI as ii,cJ as ni,cK as ri,cL as oi,cM as ci,cN as di,cO as li,W as ui,cP as hi,cQ as mi,cR as pi,cS as fi,cT as gi,cU as Si,cV as yi,cW as bi,cX as Ci,cY as vi,cZ as Ai,c_ as wi,c$ as Ii,d0 as _i,d1 as Ei,d2 as Di,d3 as ki,d4 as Pi,d5 as Ri,d6 as Ni,d7 as Ti,d8 as Oi,d9 as xi,da as Mi,db as Li,dc as Bi,dd as Fi,de as Ui,df as zi,dg as $i,dh as ji,c as Wi,di as Hi,dj as Ki,dk as Zi,b as qi,dl as Vi,dm as Gi,dn as Yi,dp as Ji,dq as Qi,dr as Xi,ds as en,dt as tn,du as an,dv as sn,dw as nn,dx as rn,dy as on,dz as cn,dA as dn,dB as ln,dC as un,dD as hn,dE as mn,dF as pn,dG as fn,dH as gn,dI as Sn,dJ as yn,dK as bn,dL as Cn,dM as vn,dN as An,dO as wn,dP as In,dQ as _n,dR as En,dS as Dn,dT as kn,dU as Pn,dV as Rn,dW as Nn,dX as Tn,dY as On,dZ as xn,d_ as Mn,d$ as Ln,e0 as Bn,e1 as Fn,e2 as Un,e3 as zn,e4 as $n,e5 as jn}from"./index-BP0PcGIN.js";import{E as C,A as Wn,C as Hn,a as Kn}from"./capability-router-map-Bqwnkkax.js";import{Z as Zn,j as qn,k as Vn,m as Gn,p as Yn,q as Jn,v as J,w as Qn,x as Xn}from"./schemas-BOzikgNT.js";const Q="main-group",X="hub-only";function b(a){return{placement:a.execution?.placement??X,group:a.execution?.group??Q}}function er(a){const e=b(a).placement;return e==="any-node"||e==="agent-only"}function tr(a){return b(a).placement==="agent-only"}function ar(a){return b(a).group}function sr(a){return b(a).placement}function ir(a,e){return a.category===e}function N(a,e,t){return{id:typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2),timestamp:new Date,source:e,category:a,data:t}}function ee(a,e){const t=e.ts??Date.now();a.emit(N("system.ready-state",{type:"capability",id:e.capName,nodeId:e.sourceNodeId},{capName:e.capName,scope:e.scope,state:e.state,generation:e.generation,sourceNodeId:e.sourceNodeId,ts:t}))}class te{_ctx=null;_config;_readinessGeneration=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,14);_registeredCapNames=[];defaults;constructor(e){this.defaults=e,this._config={...e}}get autoEmitReadiness(){return!0}get ctx(){if(!this._ctx)throw new Error(`${this.constructor.name}: ctx accessed before initialize()`);return this._ctx}get ctxIfReady(){return this._ctx}get config(){return this._config}async initialize(e){this._ctx=e,await this.resolveConfig();const t=await this.onInitialize();this.emitLifecycle(C.AddonStarted);const s=ae(t),i=s&&"providers"in s&&s.providers?s.providers:[];return this._registeredCapNames=i.map(n=>n.capability.name),s}postBrokerStart(){this.autoEmitReadiness&&this._registeredCapNames.length>0&&this.emitReadinessForProviders("ready")}async onHubReachable(){}async shutdown(){this.emitLifecycle(C.AddonStopped),this.autoEmitReadiness&&this.emitReadinessForProviders("down"),await this.onShutdown();for(const e of this._subscriptions)e();this._subscriptions=[],this._ctx=null}async onShutdown(){}async onConfigChanged(){}field(e){return e}schema(e){return e}globalSettingsSchema(){return null}deviceSettingsSchema(){return null}async getGlobalSettings(e){const t=this.globalSettingsSchema();if(!t)return{sections:[]};const s=await this._ctx?.settings?.readAddonStore()??{};return k(t,e?{...s,...e}:s)}async updateGlobalSettings(e){await this._ctx?.settings?.writeAddonStore(e),await this.resolveConfig(),await this.onConfigChanged(),this.emitLifecycle(C.AddonUpdated,{level:"global"}),this.maybeAutoRestart(e,this.globalSettingsSchema())}maybeAutoRestart(e,t){if(!t)return;const s=new Set;for(const o of t.sections)for(const c of o.fields)c.type==="separator"||c.type==="info"||c.requiresRestart&&s.add(c.key);if(s.size===0||!Object.keys(e).some(o=>s.has(o)))return;const n=this._ctx;if(!n)return;const r=n.id;setImmediate(()=>{n.api.addons?.restartAddon?.mutate({addonId:r}).then(()=>{n.logger.info("addon auto-restart triggered by restart-required setting change",{meta:{changedFields:Object.keys(e).filter(c=>s.has(c))}})}).catch(c=>{n.logger.error("addon auto-restart failed",{meta:{error:c instanceof Error?c.message:String(c)}})})})}async getDeviceSettings(e){const t=this.deviceSettingsSchema();if(!t)return{sections:[]};const s=await this._ctx?.settings?.readDeviceStore(e)??{};return k(t,s)}async updateDeviceSettings(e,t){await this._ctx?.settings?.writeDeviceStore(e,t)}_subscriptions=[];watchCapability(e,t){const s=Array.isArray(e)?e:[e],i=new Set(s);this.subscribe({category:"system.ready-state"},n=>{const r=n.data;if(typeof r.capName!="string"||!i.has(r.capName)||r.scope?.type!=="node")return;const o=r.scope.nodeId;if(typeof o!="string"||o.length===0)return;const c=r.capName;r.state==="down"?t.onDown?.(o,c):r.state==="ready"&&t.onReady?.(o,c)})}subscribe(e,t){const s=this.ctx.eventBus.subscribe(e,t);this._subscriptions.push(s)}emitLifecycle(e,t){try{this._ctx?.eventBus.emit({id:`${this._ctx.id}-${Date.now()}`,timestamp:new Date,source:{type:"addon",id:this._ctx.id,nodeId:this._ctx.kernel.localNodeId??"hub"},category:e,data:t??{}})}catch{}}emitReadinessForProviders(e){const t=this._ctx;if(!t||this._registeredCapNames.length===0)return;const s=t.kernel?.localNodeId??"hub",i=s.includes("/")?s.split("/")[0]:s;for(const n of this._registeredCapNames)try{ee(t.eventBus,{capName:n,scope:{type:"node",nodeId:i},state:e,generation:this._readinessGeneration,sourceNodeId:i})}catch{}}async resolveModelsDir(){return this.ctx.api.storage.resolve.query({location:"models",relativePath:""}).catch(()=>"camstack-data/models")}get capabilities(){return this.ctx.capabilities??null}async resolveConfig(){const e=await this._ctx?.settings?.readAddonStore()??{},t={...this.defaults};for(const s of Object.keys(this.defaults)){const i=e[s];if(i!=null){const n=typeof this.defaults[s];typeof i===n&&(t[s]=i)}}this._config=t}}function ae(a){if(a!=null)return Array.isArray(a)?{providers:a}:a}class se extends Error{capName;scope;waitedMs;constructor(e,t,s){super(`Timed out waiting for ${e} (${f(t)}) to become ready after ${s}ms`),this.name="ReadinessTimeoutError",this.capName=e,this.scope=t,this.waitedMs=s}}function v(a,e){return`${a}|${f(e)}`}function f(a){switch(a.type){case"global":return"global";case"node":return`node:${a.nodeId}`;case"device":return`device:${a.deviceId}`}}function E(a,e){return a.type!==e.type?!1:a.type==="global"||e.type==="global"?!0:a.type==="node"&&e.type==="node"?a.nodeId===e.nodeId:a.type==="device"&&e.type==="device"?a.deviceId===e.deviceId:!1}class nr{bus;sourceNodeId;logger;now;generation;snapshot=new Map;subscriptions=new Set;unsubscribeBus;unsubscribeAgentOffline;constructor(e){if(this.bus=e.eventBus,this.sourceNodeId=e.sourceNodeId,this.logger=e.logger,this.now=e.now??(()=>Date.now()),this.generation=e.generation??rr(),this.unsubscribeBus=this.bus.subscribe({category:"system.ready-state"},t=>this.ingest(t.data)),this.unsubscribeAgentOffline=this.bus.subscribe({category:"agent.offline"},t=>this.synthesizeDownForNode(t.data.agentId)),typeof this.bus.getRecent=="function")try{const t=this.bus.getRecent({category:"system.ready-state"});for(const s of t)this.ingest(s.data)}catch{}}close(){this.unsubscribeBus(),this.unsubscribeAgentOffline(),this.subscriptions.clear()}get(e,t){return this.snapshot.get(v(e,t))??null}getSnapshotForTransport(){return Array.from(this.snapshot.values())}hydrate(e){const t=this.now();for(const s of e){const i=v(s.capName,s.scope);if(this.snapshot.has(i))continue;const n={capName:s.capName,scope:s.scope,state:s.state,generation:s.generation,epoch:1,lastChange:t,sourceNodeId:s.sourceNodeId};this.snapshot.set(i,n),this.logger&&this.logger.debug(`readiness: ${s.capName} (${f(s.scope)}) → ${s.state} (hydrated, gen=${s.generation.slice(0,6)})`);const r={capName:s.capName,scope:s.scope,state:s.state,epoch:1,generation:s.generation,sourceNodeId:"hydrated",ts:t,durationInPrevState:0};for(const o of this.subscriptions)if(o.capName===s.capName&&E(o.scope,s.scope))try{o.handler(r)}catch(c){this.logger?.warn(`readiness hydrate handler threw for ${s.capName}: ${c.message??String(c)}`)}}}getAll(){return new Map(this.snapshot)}emitReady(e,t){this.emitTransition(e,t,"ready")}emitStarting(e,t){this.emitTransition(e,t,"starting")}emitDown(e,t){this.emitTransition(e,t,"down")}awaitReady(e,t,s={}){const i=s.timeoutMs??Number.POSITIVE_INFINITY,n=this.now();return this.get(e,t)?.state==="ready"?Promise.resolve():s.signal?.aborted?Promise.reject(s.signal.reason??new Error("aborted")):new Promise((o,c)=>{let l=!1;const d=this.onReadyState(e,t,I=>{I.state==="ready"&&(l||(l=!0,p(),o()))}),u=!Number.isFinite(i)?null:setTimeout(()=>{l||(l=!0,p(),c(new se(e,t,this.now()-n)))},i),S=()=>{l||(l=!0,p(),c(s.signal?.reason??new Error("aborted")))};s.signal?.addEventListener("abort",S,{once:!0});function p(){d(),u!==null&&clearTimeout(u),s.signal?.removeEventListener("abort",S)}})}onReadyState(e,t,s){const i={capName:e,scope:t,handler:s};this.subscriptions.add(i);const n=this.get(e,t);return n!==null&&queueMicrotask(()=>{this.subscriptions.has(i)&&s({capName:e,scope:t,state:n.state,epoch:n.epoch,generation:n.generation,sourceNodeId:this.sourceNodeId,ts:n.lastChange,durationInPrevState:0})}),()=>{this.subscriptions.delete(i)}}emitTransition(e,t,s){const i=this.now();this.bus.emit(N("system.ready-state",{type:"capability",id:e,nodeId:this.sourceNodeId},{capName:e,scope:t,state:s,generation:this.generation,sourceNodeId:this.sourceNodeId,ts:i}))}ingest(e){if(typeof e?.capName!="string"||e.state!=="ready"&&e.state!=="starting"&&e.state!=="down"||typeof e.generation!="string"||e.scope?.type!=="global"&&e.scope?.type!=="node"&&e.scope?.type!=="device")return;const t=v(e.capName,e.scope),s=this.snapshot.get(t)??null,i=this.now();let n;if(s===null?n=e.state==="ready"?1:0:s.generation!==e.generation&&e.state==="ready"?n=s.epoch+1:n=s.epoch,s!==null&&s.generation===e.generation&&s.state===e.state)return;const r=s===null?0:Math.max(0,i-s.lastChange),o={capName:e.capName,scope:e.scope,state:e.state,generation:e.generation,epoch:n,lastChange:i,sourceNodeId:e.sourceNodeId};this.snapshot.set(t,o);const c={capName:e.capName,scope:e.scope,state:e.state,epoch:n,generation:e.generation,sourceNodeId:e.sourceNodeId,ts:e.ts,durationInPrevState:r};this.logger&&this.logger.debug(`readiness: ${e.capName} (${f(e.scope)}) → ${e.state} epoch=${n} gen=${e.generation.slice(0,6)} (prev ${r}ms)`);for(const l of this.subscriptions)if(l.capName===e.capName&&E(l.scope,e.scope))try{l.handler(c)}catch(d){this.logger?.warn(`readiness handler threw for ${e.capName}: ${d.message??String(d)}`)}}synthesizeDownForNode(e){const t=this.now();for(const[s,i]of this.snapshot){if(i.state==="down"||!(i.scope.type==="node"&&i.scope.nodeId===e||i.scope.type==="device"&&i.sourceNodeId===e))continue;const r=Math.max(0,t-i.lastChange),o={...i,state:"down",lastChange:t};this.snapshot.set(s,o);const c={capName:i.capName,scope:i.scope,state:"down",epoch:i.epoch,generation:i.generation,sourceNodeId:this.sourceNodeId,ts:t,durationInPrevState:r};this.logger&&this.logger.debug(`readiness: ${i.capName} (${f(i.scope)}) → down (synthesized from agent.offline ${e})`);for(const l of this.subscriptions)if(l.capName===i.capName&&E(l.scope,i.scope))try{l.handler(c)}catch(d){this.logger?.warn(`readiness handler threw during agent.offline demux for ${i.capName}: ${d.message??String(d)}`)}}}}function rr(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,14)}function or(a,e){for(const{capName:t,scope:s}of e)a.emitDown(t,s)}const ie={high:"High",mid:"Mid",low:"Low"};function cr(a){return ie[a]??a.charAt(0).toUpperCase()+a.slice(1)}function ne(a){return(a.width??0)*(a.height??0)}function re(a){if(a.length===0)return[];const e=a.map((s,i)=>({s,i,px:ne(s.metadata??{})})).sort((s,i)=>i.px-s.px),t=Array.from({length:a.length});for(let s=0;s<e.length;s++){const{s:i,i:n}=e[s];let r;s===0?r="high":s===e.length-1?r="low":r="mid",t[n]={...i,quality:r}}return t}function dr(a){const e=a.height??0,t=a.width??0;return e>=1080||t>=1920?"high":e>=480||t>=640?"mid":"low"}function lr(a){const e=a.protocols.find(i=>i.type==="rtsp"&&i.url)??a.protocols.find(i=>i.url),t=e?.type,s=t==="rtsp"?"rtsp":t==="http"||t==="flv"?"http-mjpeg":"custom";return{id:a.id,label:a.label??a.id,protocol:s,url:e?.url,profileHint:a.quality}}function m(a){return typeof a=="string"}function ur(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function hr(a){return m(a)&&a.trim()?{url:a}:ur(a)&&m(a.url)&&a.url.trim()?{url:a.url,label:m(a.label)?a.label:void 0}:null}function mr(a){const e=m(a.snapshot_url)?a.snapshot_url:void 0;if(Array.isArray(a.streams)){const r=[];for(const o of a.streams){const c=hr(o);c&&r.push(c)}return{streams:r,snapshot_url:e}}const t=[],s=m(a.main_stream_url)?a.main_stream_url:void 0;s&&t.push({url:s,label:m(a.main_stream_name)?a.main_stream_name:void 0});const i=m(a.sub_stream_url)?a.sub_stream_url:void 0;i&&t.push({url:i,label:m(a.sub_stream_name)?a.sub_stream_name:void 0});const n=m(a.third_stream_url)?a.third_stream_url:void 0;return n&&t.push({url:n,label:m(a.third_stream_name)?a.third_stream_name:void 0}),{streams:t,snapshot_url:e}}function pr(a){if(a.length===0)return{};const e=re(a),t={},s=e.find(o=>o.quality==="high"),i=e.find(o=>o.quality==="mid"),n=e.find(o=>o.quality==="low");s&&(t.high=s.id),i&&(t.mid=i.id),n&&(t.low=n.id);const r=s??i??n??e[0];return r&&(t.high||(t.high=r.id),t.mid||(t.mid=r.id),t.low||(t.low=r.id)),t}const fr={streaming:!0,notifications:!0,objectDetection:!1,remoteAccess:!0,agentCluster:!1,smartHome:!0,recordings:!0,backup:!0,repl:!0},gr=["face","plate"],Sr=["face","plate","clip","custom"],yr={cleanupIntervalMs:3600*1e3,detectionEventsDays:30,audioLevelsDays:7,snapshotsDays:14};var oe=(a=>(a.Addon="addon",a.Core="core",a.Device="device",a.Provider="provider",a.System="system",a))(oe||{});const ce="camstack/camstack-models",br=`https://huggingface.co/${ce}/resolve/main`,Cr={"features.streaming":!0,"features.notifications":!0,"features.objectDetection":!1,"features.remoteAccess":!0,"features.agentCluster":!1,"features.smartHome":!0,"features.recordings":!0,"features.backup":!0,"features.repl":!0,"retention.detectionEventsDays":30,"retention.audioLevelsDays":7,"logging.level":"info","logging.retentionDays":30,"eventBus.ringBufferSize":1e4,"storage.provider":"sqlite-storage","storage.locations":{data:"camstack-data/data",media:"camstack-data/media",recordings:"camstack-data/recordings",cache:"/tmp/camstack-cache",logs:"camstack-data/logs",models:"camstack-data/models"},providers:[],"recording.segmentDurationSeconds":4,"recording.defaultRetentionDays":30,"ffmpeg.binaryPath":"ffmpeg","ffmpeg.hwAccel":"auto","ffmpeg.threadCount":0,"auth.tokenExpiry":"24h"};function T(a){return JSON.parse(a)}function de(a){return a===null||typeof a!="object"||Array.isArray(a)?null:{...a}}function vr(a){return Array.isArray(a)?a:[]}function Ar(a,e=""){return typeof a=="string"?a:e}function wr(a,e=0){return typeof a=="number"?a:e}function Ir(a,e=!1){return typeof a=="boolean"?a:e}function _r(a){try{return de(T(a))}catch{return null}}function Er(a){try{const e=T(a);return Array.isArray(e)?e:null}catch{return null}}function Dr(a,e){return`https://huggingface.co/${a}/resolve/main/${e}`}function kr(a,e){if(a.length!==e.length)return 0;let t=0,s=0,i=0;for(let r=0;r<a.length;r++)t+=a[r]*e[r],s+=a[r]*a[r],i+=e[r]*e[r];const n=Math.sqrt(s)*Math.sqrt(i);return n===0?0:t/n}class Pr{constructor(e,t){this.elementId=e,this.getBackend=typeof t=="function"?t:()=>t}cache={};listeners=new Set;loaded=!1;getBackend;async ensureLoaded(){if(this.loaded)return;const e=this.getBackend();if(!e)throw new Error(`ElementConfigStore(${this.elementId}): settings backend not available`);const t=await e.query({collection:"config",filter:{where:{id:this.elementId},limit:1}});t.length>0&&(this.cache=t[0].data??{}),this.loaded=!0}getAll(){return{...this.cache}}get(e){const t=e.split(".");let s=this.cache;for(const i of t){if(s===null||typeof s!="object"||Array.isArray(s))return;s=Reflect.get(s,i)}return s}async set(e,t){await this.ensureLoaded(),Rr(this.cache,e,t),await this.persist(),this.notifyListeners()}async setAll(e){await this.ensureLoaded(),this.cache={...e},await this.persist(),this.notifyListeners()}onChange(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async load(){await this.ensureLoaded()}async loadDefaults(e){await this.ensureLoaded(),Object.keys(this.cache).length===0&&(this.cache={...e},await this.persist())}async persist(){const e=this.getBackend();if(!e)throw new Error(`ElementConfigStore(${this.elementId}): settings backend not available — cannot persist config`);await e.set({collection:"config",key:this.elementId,value:this.cache})}notifyListeners(){const e=this.getAll();for(const t of this.listeners)try{t(e)}catch{}}}function Rr(a,e,t){const s=e.split(".");let i=a;for(let n=0;n<s.length-1;n++){const r=s[n],o=i[r];if(o===null||typeof o!="object"||Array.isArray(o)){const c={};i[r]=c,i=c}else i=o}i[s[s.length-1]]=t}const O={cpu:"onnx",coreml:"onnx",cuda:"onnx",tensorrt:"onnx","onnx-py":"onnx",pytorch:"pt",openvino:"openvino"},le={onnx:"onnx",coreml:"coreml",openvino:"openvino",tflite:"tflite",pytorch:"pt"},ue={coreml:"coreml_inference.py",pytorch:"pytorch_inference.py",openvino:"openvino_inference.py"};function he(a,e){return a==="node"?"onnx":{coreml:"coreml",openvino:"openvino",pytorch:"pytorch","onnx-py":"onnx",cpu:"onnx"}[e]??e}function Nr(a,e){return a==="node"?O[e]??"onnx":{coreml:"coreml",openvino:"openvino",pytorch:"pt","onnx-py":"onnx",cpu:"onnx"}[e]??"onnx"}function Tr(a,e){return!a||a==="auto"?"auto":he(a,e??"cpu")}function Or(a){return O[a]??"onnx"}function xr(a){return le[a]}function Mr(a){return ue[a]}function Lr(a){return a==="coreml"||a==="pytorch"||a==="openvino"}function me(a){return a instanceof Error?a.message:typeof a=="string"?a:String(a)}async function Br(a,e){const t=performance.now();try{return{output:e!==void 0?await Fr(a(),e):await a(),durationMs:M(performance.now()-t),ok:!0}}catch(s){return{output:void 0,durationMs:M(performance.now()-t),ok:!1,error:me(s)}}}function M(a){return Math.round(a*100)/100}function Fr(a,e){return new Promise((t,s)=>{const i=setTimeout(()=>s(new Error(`Inference timeout after ${e}ms`)),e);a.then(n=>{clearTimeout(i),t(n)}).catch(n=>{clearTimeout(i),s(n)})})}const Ur=[{id:"person",name:"Person"},{id:"bicycle",name:"Bicycle"},{id:"car",name:"Car"},{id:"motorcycle",name:"Motorcycle"},{id:"airplane",name:"Airplane"},{id:"bus",name:"Bus"},{id:"train",name:"Train"},{id:"truck",name:"Truck"},{id:"boat",name:"Boat"},{id:"traffic light",name:"Traffic Light"},{id:"fire hydrant",name:"Fire Hydrant"},{id:"stop sign",name:"Stop Sign"},{id:"parking meter",name:"Parking Meter"},{id:"bench",name:"Bench"},{id:"bird",name:"Bird"},{id:"cat",name:"Cat"},{id:"dog",name:"Dog"},{id:"horse",name:"Horse"},{id:"sheep",name:"Sheep"},{id:"cow",name:"Cow"},{id:"elephant",name:"Elephant"},{id:"bear",name:"Bear"},{id:"zebra",name:"Zebra"},{id:"giraffe",name:"Giraffe"},{id:"backpack",name:"Backpack"},{id:"umbrella",name:"Umbrella"},{id:"handbag",name:"Handbag"},{id:"tie",name:"Tie"},{id:"suitcase",name:"Suitcase"},{id:"frisbee",name:"Frisbee"},{id:"skis",name:"Skis"},{id:"snowboard",name:"Snowboard"},{id:"sports ball",name:"Sports Ball"},{id:"kite",name:"Kite"},{id:"baseball bat",name:"Baseball Bat"},{id:"baseball glove",name:"Baseball Glove"},{id:"skateboard",name:"Skateboard"},{id:"surfboard",name:"Surfboard"},{id:"tennis racket",name:"Tennis Racket"},{id:"bottle",name:"Bottle"},{id:"wine glass",name:"Wine Glass"},{id:"cup",name:"Cup"},{id:"fork",name:"Fork"},{id:"knife",name:"Knife"},{id:"spoon",name:"Spoon"},{id:"bowl",name:"Bowl"},{id:"banana",name:"Banana"},{id:"apple",name:"Apple"},{id:"sandwich",name:"Sandwich"},{id:"orange",name:"Orange"},{id:"broccoli",name:"Broccoli"},{id:"carrot",name:"Carrot"},{id:"hot dog",name:"Hot Dog"},{id:"pizza",name:"Pizza"},{id:"donut",name:"Donut"},{id:"cake",name:"Cake"},{id:"chair",name:"Chair"},{id:"couch",name:"Couch"},{id:"potted plant",name:"Potted Plant"},{id:"bed",name:"Bed"},{id:"dining table",name:"Dining Table"},{id:"toilet",name:"Toilet"},{id:"tv",name:"TV"},{id:"laptop",name:"Laptop"},{id:"mouse",name:"Mouse"},{id:"remote",name:"Remote"},{id:"keyboard",name:"Keyboard"},{id:"cell phone",name:"Cell Phone"},{id:"microwave",name:"Microwave"},{id:"oven",name:"Oven"},{id:"toaster",name:"Toaster"},{id:"sink",name:"Sink"},{id:"refrigerator",name:"Refrigerator"},{id:"book",name:"Book"},{id:"clock",name:"Clock"},{id:"vase",name:"Vase"},{id:"scissors",name:"Scissors"},{id:"teddy bear",name:"Teddy Bear"},{id:"hair drier",name:"Hair Drier"},{id:"toothbrush",name:"Toothbrush"}],zr=[{id:"person",name:"Person"},{id:"vehicle",name:"Vehicle"},{id:"animal",name:"Animal"}],$r={mapping:{person:"person",bicycle:"vehicle",car:"vehicle",motorcycle:"vehicle",airplane:"vehicle",bus:"vehicle",train:"vehicle",truck:"vehicle",boat:"vehicle",bird:"animal",cat:"animal",dog:"animal",horse:"animal",sheep:"animal",cow:"animal",elephant:"animal",bear:"animal",zebra:"animal",giraffe:"animal"},preserveOriginal:!1},jr={camera:{type:"camera",label:"Camera",icon:"camera"}};class g{schema;data;persistFn;constructor(e,t,s){this.schema=e,this.data=t,this.persistFn=s}static fromSchema(e,t,s={},i){const n=e.safeParse(s);if(n.success)return new g(e,n.data,t);const r=new Set;for(const d of n.error.issues){const h=d.path[0];typeof h=="string"&&r.add(h)}const o={...s};for(const d of r)delete o[d];const c=e.safeParse(o);if(i?.({droppedKeys:[...r],issues:n.error.issues}),c.success)return t(c.data).catch(()=>{}),new g(e,c.data,t);const l=e.parse({});return new g(e,l,t)}get values(){return this.data}get(e){return this.data[e]}async set(e,t){const s=this.schema.parse({...this.data,[e]:t});this.data=s,await this.persistFn(this.data)}async setAll(e){const t=this.schema.parse({...this.data,...e});this.data=t,await this.persistFn(this.data)}async deleteKey(e){const{[e]:t,...s}=this.data,i=this.schema.parse(s);this.data=i,await this.persistFn(this.data)}entries(){const e=this.schema.shape;return Object.entries(e).map(([t,s])=>({key:t,schema:s,value:this.data[t],description:s.description}))}}class w{writer;pendingWrites=new Set;slices;schemas=new Map;listeners=new Set;capListeners=new Map;constructor(e,t){this.writer=t,this.slices=new Map;for(const[s,i]of Object.entries(e))i&&typeof i=="object"&&!Array.isArray(i)&&this.slices.set(s,{...i})}static fromInitial(e,t){return new w(e,t)}installCapSchema(e,t){const s=this.schemas.get(e);if(s){if(s!==t)throw new Error(`[DeviceRuntimeState] capability "${e}" registered a different runtime-state schema; each cap must declare ONE shape across every provider`);return}this.schemas.set(e,t);const i=this.slices.get(e);if(i){const n=t.safeParse(i);n.success?this.slices.set(e,n.data):this.slices.delete(e)}}getCapState(e){const t=this.slices.get(e);if(t)return Object.freeze({...t})}getCapField(e,t){return this.slices.get(e)?.[t]}setCapState(e,t){this.applyCapWrite(e,t,!1)}patchCapState(e,t){this.applyCapWrite(e,t,!0)}applyCapWrite(e,t,s){const i=this.schemas.get(e);if(!i)throw new Error(`[DeviceRuntimeState] no schema registered for cap "${e}" — did the device register it via ctx.registerNativeCap before writing?`);const n=this.slices.get(e)??{},r=s?{...n,...t}:{...t},o=i.parse(r);if(Wr(n,o))return;this.slices.set(e,o),this.fireListeners([e]);const c=this.writer(e,{...o}).catch(()=>{});this.pendingWrites.add(c),c.finally(()=>{this.pendingWrites.delete(c)})}fireListeners(e){const t=this.snapshot();for(const s of this.listeners)try{s(e,t)}catch{}for(const s of e){const i=this.capListeners.get(s);if(!i)continue;const n=this.getCapState(s);for(const r of i)try{r(n)}catch{}}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}subscribeCap(e,t){let s=this.capListeners.get(e);s||(s=new Set,this.capListeners.set(e,s));const i=n=>{t(n)};return s.add(i),()=>{const n=this.capListeners.get(e);n&&(n.delete(i),n.size===0&&this.capListeners.delete(e))}}snapshot(){const e={};for(const[t,s]of this.slices)e[t]=Object.freeze({...s});return Object.freeze(e)}async flush(){if(this.pendingWrites.size===0)return;const e=[...this.pendingWrites];await Promise.allSettled(e)}}function Wr(a,e){const t=Object.keys(a),s=Object.keys(e);if(t.length!==s.length)return!1;for(const i of t)if(a[i]!==e[i])return!1;return!0}const D="lastFetchedAt";function Hr(a){const{runtimeState:e,cap:t,ownDeviceId:s,refresh:i,staleMs:n,empty:r}=a,o=async()=>{const d=e.getCapState(t.name),h=typeof d?.[D]=="number"?d[D]:0;(!d||Date.now()-h>n)&&await i()},c=()=>{const d=e.getCapState(t.name);if(!d)return r();const{[D]:h,...u}=d;return u};return{ensureFresh:o,getStatus:async({deviceId:d})=>{if(d!==s)throw new Error(`${t.name}: deviceId mismatch, expected ${s}, got ${d}`);return await o(),c()}}}const Kr={audioMetrics:G,battery:V,brightness:q,cameraStreams:Z,deviceDiscovery:K,deviceStatus:R,doorbell:H,featureProbe:P,motion:W,motionTrigger:j,ptzAutotrack:$,switch:z,zoneAnalytics:U,zoneRules:F,zones:B};class Zr{id;stableId;type;name;parentDeviceId;role;get online(){return this.runtimeState.getCapState("device-status")?.online??!1}set online(e){this.markOnline(e)}get state(){if(!this._stateProxyCache){const e={},t={get:(s,i)=>{const n=i;if(n in e)return e[n];const r=Kr[n];if(!r)return;const o=this.sliceProxy(r);return e[n]=o,o}};this._stateProxyCache=new Proxy(e,t)}return this._stateProxyCache}_stateProxyCache;config;runtimeState;ctx;location;disabled;constructor(e,t,s){if(this.ctx=e,this.id=e.id,this.stableId=e.stableId,this.type=s.type,!e.deviceMeta)throw new Error(`BaseDevice constructor: ctx.deviceMeta is required (id=${e.id} stableId=${e.stableId})`);this.name=e.deviceMeta.name,this.location=e.deviceMeta.location,this.disabled=e.deviceMeta.disabled,this.role=s.role,this.parentDeviceId=e.parentDeviceId;const i=e.persistedConfig??{};this.config=g.fromSchema(t,d=>e.persistConfig(d),i,({droppedKeys:d,issues:h})=>{e.logger.warn("Device config recovery: dropping invalid persisted fields",{tags:{deviceId:e.id,stableId:e.stableId},meta:{droppedKeys:[...d],firstIssue:h[0]?.message??null}})});let n=null;const r=async(d,h)=>{n||(n=e.fetchDevice(e.id)),await(await n).deviceState.setCapSlice({capName:d,slice:h})},o=e.initialRuntimeState??{};this.runtimeState=w.fromInitial(o,r),e.bindRuntimeState?.(this.runtimeState),e.registerNativeCap?.(R,{});const c={online:!1,lastChangedAt:Date.now()};this.runtimeState.setCapState("device-status",c),e.registerNativeCap?.(P,{});const l={flags:{},deviceType:null,model:null,channelCount:null,lastProbedAt:0,lastFetchedAt:0};this.runtimeState.setCapState("feature-probe",l)}async removeDevice(){}markOnline(e){if(this.online===e)return;const t={online:e,lastChangedAt:Date.now()};this.runtimeState.setCapState("device-status",t)}async refreshFeatures(){const t=this.ctx.api?.deviceManager?.registerDevice;if(t)try{await t.mutate({addonId:this.ctx.deviceMeta.addonId,stableId:this.stableId,id:this.id,type:this.type,name:this.name,parentDeviceId:this.parentDeviceId,features:[...this.features],config:{}})}catch{}}getCapSlice(e){return this.runtimeState.getCapState(e.name)??null}setCapSlice(e,t){this.runtimeState.setCapState(e.name,t)}sliceProxy(e){const t={},s={get:(i,n)=>this.runtimeState.getCapState(e.name)?.[n],set:(i,n,r)=>(this.runtimeState.patchCapState(e.name,{[n]:r}),!0),has:(i,n)=>{const r=this.runtimeState.getCapState(e.name);return r?n in r:!1},ownKeys:()=>{const i=this.runtimeState.getCapState(e.name);return i?Object.keys(i):[]},getOwnPropertyDescriptor:(i,n)=>{const r=this.runtimeState.getCapState(e.name);if(!(!r||!(n in r)))return{configurable:!0,enumerable:!0,value:r[n]}}};return new Proxy(t,s)}getSettingsUISchema(){return{sections:[]}}async applySettingsPatch(e){await this.config.setAll(e)}async onProbe(){}async onActivate(){}async reprobe(){this._kernelReprobe?await this._kernelReprobe():await this.onProbe()}_kernelReprobe;getAccessoryChildren(){return[]}getProbeFlags(){return this.runtimeState.getCapState("feature-probe")?.flags??{}}hasProbed(){return(this.runtimeState.getCapState("feature-probe")?.lastProbedAt??0)>0}}function pe(a,e){const t={};for(const s of a.config.entries())t[s.key]=s.value;return{id:a.id,stableId:a.stableId,addonId:e,type:String(a.type),name:a.name,parentDeviceId:a.parentDeviceId,online:a.online,features:[...a.features],config:t}}class qr extends te{async onInitialize(){return this.ctx.logger.info(`${this.providerName} Provider initialized`),[{capability:Y,provider:this}]}async onShutdown(){const e=await this.ctx.kernel.devices?.getAll()??[];for(const t of e)try{await this.ctx.kernel.devices?.decommission(t.id)}catch(s){this.ctx.logger.warn(`${this.providerName}: decommission failed`,{tags:{deviceId:t.id,stableId:t.stableId},meta:{error:s instanceof Error?s.message:String(s)}})}this.ctx.logger.info(`${this.providerName} Provider shut down`,{meta:{decommissionedCount:e.length}})}async start(){}async stop(){}async getStatus(){return{connected:!0,deviceCount:(await this.ctx.kernel.devices?.getAll()??[]).length}}async getDevices(){return(await this.ctx.kernel.devices?.getAll()??[]).map(t=>({id:t.stableId,name:t.name,type:String(t.type)}))}async supportsDiscovery(){return!1}async discoverDevices(){return[]}async adoptDiscoveredDevice(e){throw new Error(`${this.providerName} provider does not support discovery-based adoption`)}async supportsManualCreation(){return!0}async getChildCreationSchema(e){return this.onGetCreationSchema(e.type)}async createDevice(e){const t=await this.onCreateDevice(e.type,e.config),s=this.deviceClasses[t.meta.type];if(!s)throw new Error(`${this.providerName} provider: no device class registered for type "${t.meta.type}" — add it to the deviceClasses map`);const i=this.generateStableId(t.meta.type,t.config),n=await this.ctx.kernel.devices.create(i,s,t.config,null,t.meta);if(t.onAfterCreate)try{await t.onAfterCreate(n)}catch(r){this.ctx.logger.warn("createDevice: onAfterCreate hook threw — device is already registered",{tags:{deviceId:n.id,stableId:i},meta:{error:r instanceof Error?r.message:String(r)}})}return this.toSummary(n)}generateStableId(e,t){return`${this.addonId}-${Date.now()}`}async testCreationField(e){return{status:"ok",labels:["probe not implemented"]}}async restoreDevices(e){await this.onRestoreDevices(e),e.length>0&&this.ctx.logger.info(`Restored ${e.length} ${this.providerName} device(s)`)}async onRestoreDevices(e){const t=new Set;for(const i of e){if(i.parentDeviceId!==null)continue;const n=this.deviceClasses[i.type];if(!n){this.ctx.logger.warn("No device class registered for restored type — skipping",{tags:{stableId:i.stableId},meta:{type:i.type}});continue}try{await this.ctx.kernel.devices.create(i.stableId,n,{}),t.add(i.id)}catch(r){this.ctx.logger.warn("Failed to restore device",{tags:{stableId:i.stableId},meta:{type:i.type,error:r instanceof Error?r.message:String(r)}})}}const s=e.filter(i=>i.parentDeviceId!==null);for(const i of s){const n=this.deviceClasses[i.type];if(n&&i.parentDeviceId!==null&&t.has(i.parentDeviceId))try{await this.ctx.kernel.devices.create(i.stableId,n,{},i.parentDeviceId),t.add(i.id)}catch(r){this.ctx.logger.warn("Failed to restore hub-adopted child",{tags:{stableId:i.stableId,parentDeviceId:i.parentDeviceId},meta:{type:i.type,error:r instanceof Error?r.message:String(r)}})}}}toSummary(e){return pe(e,this.addonId)}}function y(a){return a.def}function Vr(a,e="Configuration",t="main"){const s=a.map(i=>Gr(i.key,i.schema,i.description));return{sections:[{id:t,title:e,fields:s}]}}function Gr(a,e,t){const s=A(e),i=eo(e),n=t??fe(a),r={key:a,label:n,description:t,default:i};return s instanceof Zn?Yr(a,r):s instanceof qn?Jr(s,r):s instanceof Vn?{...r,type:"boolean"}:s instanceof Gn?Xr(s,r):s instanceof Yn||s instanceof Jn?{...r,type:"textarea",rows:6,isJson:!0}:{...r,type:"text"}}function Yr(a,e){const t=a.toLowerCase();return t.includes("password")||t.includes("secret")||t.includes("token")||t.includes("apikey")||t.includes("api_key")?{...e,type:"password",showToggle:!0}:{...e,type:"text"}}function Jr(a,e){const t=a,s=t.minValue,i=t.maxValue,n=s!=null&&isFinite(s)?s:void 0,r=i!=null&&isFinite(i)?i:void 0,o=Qr(a);return{...e,type:"number",...n!==void 0?{min:n}:{},...r!==void 0?{max:r}:{},...o!==void 0?{step:o}:{}}}function Qr(a){const t=y(a).checks??[];for(const s of t)if(s._zod?.def?.check==="multiple_of"&&s._zod.def.value!==void 0)return s._zod.def.value}function Xr(a,e){const t=a.options.map(i=>String(i));return{...e,type:"select",options:t.map(i=>({label:fe(i),value:i}))}}function A(a){return a instanceof J||a instanceof Qn||a instanceof Xn?A(y(a).innerType):a}function eo(a){if(a instanceof J)return y(a).defaultValue}function fe(a){return a.replace(/([A-Z])/g," $1").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase()).trim()}function to(a,e,t,s,i){if(t.length===0||e.length===0)return{passed:a,excluded:[]};const n=t.filter(u=>u.enabled!==!1),r=n.filter(u=>u.mode==="include"),o=n.filter(u=>u.mode==="exclude"),c=r.length>0,l=new Map(e.map(u=>[u.id,u])),d=[],h=[];for(const u of a){const S=s(u),p=i?.(u),I=r.some(_=>L(_,S,p,l)),x=o.some(_=>L(_,S,p,l));c?I&&!x?d.push(u):h.push(u):x?h.push(u):d.push(u)}return{passed:d,excluded:h}}function L(a,e,t,s){if(a.classFilter&&a.classFilter.length>0&&t!==void 0&&!a.classFilter.includes(t))return!1;for(const i of a.zoneIds){const n=s.get(i);if(n&&ao(e,n.polygon))return!0}return!1}function ao(a,e){if(e.length<3)return!1;let t=!1;const{x:s,y:i}=a;for(let n=0,r=e.length-1;n<e.length;r=n++){const o=e[n],c=e[r];o.y>i!=c.y>i&&s<(c.x-o.x)*(i-o.y)/(c.y-o.y||Number.EPSILON)+o.x&&(t=!t)}return t}function so(a){return a}function io(a,e,t){return{input:a,output:e,kind:t?.kind??"query",auth:t?.auth??"protected",scope:t?.scope??{kind:"system"}}}const no=["accessories","battery","brightness","camera-credentials","device-discovery","device-status","doorbell","feature-probe","intercom","motion","motion-trigger","native-object-detection","osd","ptz","ptz-autotrack","snapshot","switch"];function ro(a){try{const e=new URL(a);return!e.username&&!e.password?a:(e.username="",e.password="",e.toString())}catch{return a}}class oo{constructor(e){this.capacity=e,this.items=Array.from({length:e})}items;head=0;tail=0;count=0;get size(){return this.count}push(e){this.items[this.tail]=e,this.tail=(this.tail+1)%this.capacity,this.count<this.capacity?this.count++:this.head=(this.head+1)%this.capacity}drain(e){const t=[],s=Math.min(e,this.count);for(let i=0;i<s;i++)t.push(this.items[this.head]),this.items[this.head]=void 0,this.head=(this.head+1)%this.capacity;return this.count-=s,t}}function co(a,e,t){const s={};for(const i of Object.keys(t))s[i]=n=>a.addons.custom.mutate({addonId:e,action:i,input:n});return s}const mo=Object.freeze(Object.defineProperty({__proto__:null,ACCESSORY_LABEL:ge,ALL_CAPABILITY_DEFINITIONS:Wn,APPLE_SA_TO_MACRO:Se,AUDIO_BACKEND_CHOICES:ye,AUDIO_MACRO_LABELS:be,AccessoriesStatusSchema:Ce,AccessoryKind:ve,AddonAutoUpdateSchema:Ae,AddonListItemSchema:we,AddonPageDeclarationSchema:Ie,AddonPageInfoSchema:_e,AgentLoadSummarySchema:Ee,AlertSchema:De,AlertSeveritySchema:ke,AlertSourceSchema:Pe,AlertStatusSchema:Re,ApiKeyRecordSchema:Ne,ApiKeySummarySchema:Te,AudioAnalysisResultSchema:Oe,AudioAnalysisSettingsSchema:xe,AudioChunkInputSchema:Me,AudioClassSummarySchema:Le,AudioClassificationLabelSchema:Be,AudioClassificationResultSchema:Fe,AudioCodecInfoSchema:Ue,AudioDecodeSessionConfigSchema:ze,AudioEncodeSessionConfigSchema:$e,AudioEncodedChunkSchema:je,AudioEventSchema:We,AudioLevelSchema:He,AudioMetricsHistoryPointSchema:Ke,AudioMetricsHistorySchema:Ze,AudioMetricsSnapshotSchema:qe,AudioPcmChunkSchema:Ve,AuthResultSchema:Ge,AutoUpdateSettingsSchema:Ye,AvailableIntegrationTypeSchema:Je,BACKEND_TO_FORMAT:O,BATTERY_DEVICE_PROFILE:Qe,BaseAddon:te,BaseDevice:Zr,BaseDeviceProvider:qr,BatteryStatusSchema:Xe,BoundingBoxSchema:et,BrightnessStatusSchema:tt,BrokerAudioClientSchema:at,BrokerClientsSchema:st,BrokerDecodedClientSchema:it,BrokerRtspClientSchema:nt,BrokerStatsSchema:rt,BrokerStatusSchema:ot,CAM_PROFILE_ORDER:ct,CAPABILITY_NAMES:Hn,CAPABILITY_ROUTER_KEYS:Kn,CAP_NAMES_WITH_STATUS:no,COCO_80_LABELS:Ur,COCO_TO_MACRO:$r,CamProfileSchema:dt,CamStreamKindSchema:lt,CamStreamResolutionSchema:ut,CameraCredentialsSchema:ht,CameraCredentialsStatusSchema:mt,CameraMetricsSchema:pt,CameraMetricsWithDeviceIdSchema:ft,CameraStreamSchema:gt,CapabilityBindingsSchema:St,ChargingStatus:yt,ClientNetworkStatsSchema:bt,ClusterAddonNodeDeploymentSchema:Ct,ClusterAddonStatusEntrySchema:vt,CollectionColumnSchema:At,CollectionIndexSchema:wt,ConfigEntrySchema:It,ConfigSectionWithValuesSchema:_t,ConfigTabDeclarationSchema:Et,CreateApiKeyInputSchema:Dt,CreateApiKeyResultSchema:kt,CreateIntegrationInputSchema:Pt,CreateScopedTokenInputSchema:Rt,CreateScopedTokenResultSchema:Nt,CreateUserInputSchema:Tt,CustomActionInputSchema:Ot,DEFAULT_ADDON_GROUP:Q,DEFAULT_ADDON_PLACEMENT:X,DEFAULT_AUDIO_ANALYZER_CONFIG:xt,DEFAULT_DECODER_HWACCEL_CONFIG:Mt,DEFAULT_FEATURES:fr,DEFAULT_RETENTION:yr,DEVICE_PROFILES:Lt,DEVICE_SETTINGS_CONTRIBUTION_METHODS:Bt,DEVICE_STATUS_METHOD:Ft,DEVICE_TYPE_INFO:jr,DecodedFrameSchema:Ut,DecoderAssignmentSchema:zt,DecoderSessionConfigSchema:$t,DecoderStatsSchema:jt,DeleteIntegrationResultSchema:Wt,DetectorOutputSchema:Ht,DeviceConfig:g,DeviceDiscoveryStatusSchema:Kt,DeviceFeature:Zt,DeviceInfoSchema:qt,DeviceNetworkStatsSchema:Vt,DeviceRole:Gt,DeviceRuntimeState:w,DeviceStatusSchema:Yt,DeviceType:Jt,DiscoveredChildDeviceSchema:Qt,DiscoveredChildStatusSchema:Xt,DiscoveredDeviceSchema:ea,DoorbellPressEventSchema:ta,DoorbellStatusSchema:aa,ElementConfigStore:Pr,EmbeddingInfoSchema:sa,EmbeddingResultSchema:ia,EncodedPacketSchema:na,EnrichedWidgetMetadataSchema:ra,EventCategory:C,EventItemSchema:oa,EventKindSchema:ca,EventSourceType:oe,ExposedResourceSchema:da,FeatureManifestSchema:la,FeatureProbeStatusSchema:ua,FrameInputSchema:ha,GlobalMetricsSchema:ma,HF_BASE_URL:br,HF_REPO:ce,HWACCEL_OPTIONS:pa,HealthStatusSchema:fa,HistoryPointSchema:ga,HistoryResolutionEnum:Sa,InstalledPackageSchema:ya,IntegrationLiteSchema:ba,IntegrationWithStateSchema:Ca,IntercomAbilitySchema:va,IntercomStatusSchema:Aa,LogEntrySchema:wa,LogLevelSchema:Ia,LogStreamEntrySchema:_a,MACRO_LABELS:zr,MODEL_FORMATS:Ea,MediaFileSchema:Da,MotionAnalysisResultSchema:ka,MotionEventSchema:Pa,MotionOnMotionChangedDataSchema:Ra,MotionRegionSchema:Na,MotionSourceEnum:Ta,MotionSourcesSchema:Oa,MotionStatusSchema:xa,MotionTriggerRuntimeStateSchema:Ma,MotionTriggerStatusSchema:La,NativeDetectionSchema:Ba,NativeObjectClassEnum:Fa,NativeObjectDetectionStatusSchema:Ua,NetworkAccessStatusSchema:za,NetworkAddressSchema:$a,NetworkEndpointSchema:ja,NotificationHistoryEntrySchema:Wa,NotificationRuleSchema:Ha,NotificationSchema:Ka,ObjectEventSchema:Za,OrchestratorMetricsSchema:qa,OsdOverlayKindEnum:Va,OsdOverlayPatchSchema:Ga,OsdOverlaySchema:Ya,OsdPositionEnum:Ja,OsdStatusSchema:Qa,PIPELINE_FLOW_CAPABILITY_NAMES:Xa,PIPELINE_OWNER_CAPABILITY_NAMES:es,PYTHON_SCRIPT:ue,PackageUpdateSchema:ts,PackageVersionInfoSchema:as,PcmSampleFormatSchema:ss,PerScopeBreakdownSchema:is,PipelineAssignmentSchema:ns,PipelineDefaultStepSchema:rs,PipelineEngineChoiceSchema:os,PipelineRunResultBridge:cs,PipelineStepInputSchema:ds,PlaceholderReasonSchema:ls,PolygonPointSchema:us,ProfileSlotSchema:hs,ProfileSlotStatusSchema:ms,ProviderStatusSchema:ps,PtzAutotrackRuntimeStateSchema:fs,PtzAutotrackSettingsSchema:gs,PtzAutotrackStatusSchema:Ss,PtzAutotrackTargetOptionSchema:ys,PtzMoveCommandSchema:bs,PtzPositionSchema:Cs,PtzPresetSchema:vs,QueryFilterSchema:As,RECOGNITION_TYPES:Sr,RUNTIME_DEFAULTS:Cr,RUNTIME_TO_FORMAT:le,ReadinessRegistry:nr,ReadinessTimeoutError:se,RegisteredStreamSchema:ws,ReportMotionInputSchema:Is,RingBuffer:oo,RtspRestreamEntrySchema:_s,RunnerCameraConfigSchema:Es,RunnerCameraDeviceUIFields:Ds,RunnerLocalLoadSchema:ks,RunnerLocalMetricsSchema:Ps,STREAM_QUALITY_LABELS:ie,SUB_DETECTION_TYPES:gr,ScopedTokenSchema:Rs,ScopedTokenSummarySchema:Ns,SearchResultSchema:Ts,SegmentSchema:Os,SettingsPatchSchema:xs,SettingsRecordSchema:Ms,SettingsSchemaWithValuesSchema:Ls,SettingsUpdateResultSchema:Bs,SnapshotImageSchema:Fs,SpatialDetectionSchema:Us,StorageLocationTypeSchema:zs,StreamFormatSchema:$s,StreamInfoSchema:js,StreamNetworkStatsSchema:Ws,StreamSourceEntrySchema:Hs,StreamSourceSchema:Ks,SwitchStatusSchema:Zs,SystemMetricsSchema:qs,SystemMirror:Vs,TestConnectionResultSchema:Gs,ToastSchema:Ys,TokenScopeSchema:Js,TopologyNodeSchema:Qs,TopologyProcessSchema:Xs,TopologyServiceSchema:ei,TrackSchema:ti,TrackStateSchema:ai,TrackedDetectionSchema:si,TurnServerSchema:ii,UpdateIntegrationInputSchema:ni,UpdateUserInputSchema:ri,UserRecordSchema:oi,UserRoleSchema:ci,UserSummarySchema:di,WELL_KNOWN_TABS:li,WELL_KNOWN_TAB_MAP:ui,WebrtcStreamChoiceSchema:hi,WebrtcStreamTargetSchema:mi,WidgetHostEnum:pi,WidgetMetadataSchema:fi,WidgetSizeEnum:gi,YAMNET_TO_MACRO:Si,ZoneKindEnum:yi,ZoneRuleModeEnum:bi,ZoneRuleSchema:Ci,ZoneRuleStageEnum:vi,ZoneRulesArraySchema:Ai,ZoneSchema:wi,ZoneScopeBreakdownSchema:Ii,accessoriesCapability:_i,accessoryStableId:Ei,addonPagesCapability:Di,addonPagesSourceCapability:ki,addonRoutesCapability:Pi,addonSettingsCapability:Ri,addonWidgetsCapability:Ni,addonWidgetsSourceCapability:Ti,addonsCapability:Oi,adminUiCapability:xi,advancedNotifierCapability:Mi,alertsCapability:Li,asBoolean:Ir,asJsonArray:vr,asJsonObject:de,asNumber:wr,asString:Ar,audioAnalysisCapability:Bi,audioAnalyzerCapability:Fi,audioCodecCapability:Ui,audioMetricsCapability:G,authProviderCapability:zi,autoAssignProfiles:pr,backupCapability:$i,batteryCapability:V,bindAddonActions:co,brightnessCapability:q,cameraCredentialsCapability:ji,cameraStreamsCapability:Z,classifyStream:dr,classifyStreams:re,cosineSimilarity:kr,createDeviceProxy:Wi,createEvent:N,createLazyTrpcSource:Hi,createMirrorSource:Ki,createRuntimeStateBridge:Hr,createSliceHandle:Zi,createSystemProxy:qi,customAction:io,decoderCapability:Vi,defineCustomActions:so,detectionPipelineCapability:Gi,deviceDiscoveryCapability:K,deviceManagerCapability:Yi,deviceMatchesProfile:Ji,deviceOpsCapability:Qi,deviceProviderCapability:Y,deviceStateCapability:Xi,deviceStatusCapability:R,doorbellCapability:H,embeddingEncoderCapability:en,emitDownForOwnedCaps:or,emitReadiness:ee,errMsg:me,evaluateZoneRules:to,event:tn,eventsCapability:an,expandCapMethods:sn,featureProbeCapability:P,formatForBackend:Or,formatForRuntime:xr,getAudioMacroClassIds:nn,hfModelUrl:Dr,hydrateSchema:k,integrationsCapability:rn,intercomCapability:on,isAgentOnlyPlacement:tr,isDeployableToAgent:er,isEvent:ir,logDestinationCapability:cn,mapAudioLabelToMacro:dn,maskUrlCredentials:ro,method:ln,metricsProviderCapability:un,motionCapability:W,motionDetectionCapability:hn,motionTriggerCapability:j,nativeObjectDetectionCapability:mn,networkAccessCapability:pn,networkQualityCapability:fn,nodesCapability:gn,normalizeAddonInitResult:ae,notificationOutputCapability:Sn,osdCapability:yn,parseCameraStreamConfig:mr,parseJsonArray:Er,parseJsonObject:_r,parseJsonUnknown:T,pipelineAnalyticsCapability:bn,pipelineExecutorCapability:Cn,pipelineOrchestratorCapability:vn,pipelineRunnerCapability:An,platformProbeCapability:wn,ptzAutotrackCapability:$,ptzCapability:In,pythonScriptForBackend:Mr,readinessKey:v,rebootCapability:_n,recordingCapability:En,recordingEngineCapability:Dn,requiresPython:Lr,resolveAddonExecution:b,resolveAddonGroup:ar,resolveAddonPlacement:sr,resolveAddonRuntime:Tr,resolveDetectionRuntime:he,resolveDeviceProfile:kn,resolveModelFormat:Nr,restreamerCapability:Pn,runInferenceStep:Br,scopeKey:f,settingsStoreCapability:Rn,snapshotCapability:Nn,snapshotProviderCapability:Tn,storageCapability:On,streamBrokerCapability:xn,streamPixels:ne,streamQualityLabel:cr,streamingEngineCapability:Mn,switchCapability:z,systemCapability:Ln,toDeviceSummary:pe,toStreamSourceEntry:lr,toastCapability:Bn,turnProviderCapability:Fn,userManagementCapability:Un,webrtcCapability:zn,webrtcClientHintsSchema:$n,webrtcSessionCapability:jn,zodEntriesToConfigUI:Vr,zoneAnalyticsCapability:U,zoneRulesCapability:F,zonesCapability:B},Symbol.toStringTag,{value:"Module"}));export{de as a,mo as s};
|