@camstack/addon-admin-ui 0.1.18 → 0.1.19
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-CziSE-Do.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DP-TohD5.js} +1 -1
- package/dist/assets/{auth-records-BEfan3dC.js → auth-records-pPU2T5YK.js} +1 -1
- package/dist/assets/{capability-router-map-B3jHfbHt.js → capability-router-map-CnswfTnw.js} +1 -1
- package/dist/assets/{devices-BfsgGvwu.js → devices-DmhCpmLN.js} +1 -1
- package/dist/assets/{hostInit-7yPTCcmg.js → hostInit-Burx4GuM.js} +1 -1
- package/dist/assets/{index-cfq-Npln.js → index-CQLrpnMs.js} +1 -1
- package/dist/assets/{index-K1-f6oQr.js → index-CXbDmdLy.js} +1 -1
- package/dist/assets/{index-Bzz7AnXl.js → index-CZAjr0Nt.js} +2 -2
- package/dist/assets/{index-iCcWZGKs.js → index-DJUPuA7C.js} +1 -1
- package/dist/assets/{index-DfH297U6.js → index-DlYD2xgP.js} +1 -1
- package/dist/assets/{index-ptcmLXsE.js → index-Dq4t4mCo.js} +1 -1
- package/dist/assets/index-Dv_f5EEQ.js +1 -0
- package/dist/assets/{index-BlKJSHE9.js → index-gpRVuU7E.js} +1 -1
- package/dist/assets/{index-X-IEwb-L.js → index-hps9vVhf.js} +1 -1
- package/dist/assets/{index-Dvmk3HcY.js → index-xPcbbtKN.js} +1 -1
- package/dist/assets/{remoteEntry-Da_G1gka.js → remoteEntry-BJyQcDUE.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-kSAHDLPS.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-24aug5i6.js} +2 -2
- package/dist/index.html +5 -5
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/index-C-M4yvxf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as r}from"./index-
|
|
1
|
+
import{s as r}from"./index-DlYD2xgP.js";import{b as e}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-C_6K4VBY.js";const o=e(r);export{o as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as k,z as B,e as F,f as U,s as z,p as $,m as W,g as j,i as P,j as H,k as R,l as K,n as Z,o as q,q as V,r as G,t as Y,A as ge,u as Se,v as ye,w as be,x as Ce,y as ve,B as Ie,C as Ae,E as we,F as Ee,G as _e,H as De,I as ke,J as Pe,K as Re,L as Te,N as Ne,O as Oe,P as xe,Q as Me,R as Le,T as Be,U as Fe,V as Ue,X as ze,Y as $e,Z as We,_ as je,$ as He,a0 as Ke,a1 as Ze,a2 as qe,a3 as Ve,a4 as Ge,a5 as Ye,a6 as Je,a7 as Qe,a8 as Xe,a9 as et,aa as tt,ab as at,ac as st,ad as it,ae as nt,af as rt,ag as ot,ah as ct,ai as dt,aj as lt,ak as ut,al as ht,am as mt,an as pt,ao as ft,ap as gt,aq as St,ar as yt,as as bt,at as Ct,au as vt,av as It,aw as At,ax as wt,ay as Et,az as _t,aA as Dt,aB as kt,aC as Pt,aD as Rt,aE as Tt,aF as Nt,aG as Ot,aH as xt,aI as Mt,aJ as Lt,aK as Bt,aL as Ft,aM as Ut,aN as zt,aO as $t,aP as Wt,aQ as jt,aR as Ht,aS as Kt,aT as Zt,aU as qt,aV as Vt,aW as Gt,aX as Yt,D as Jt,aY as Qt,aZ as Xt,a_ as ea,a$ as ta,a as aa,b0 as sa,b1 as ia,b2 as na,b3 as ra,b4 as oa,b5 as ca,b6 as da,b7 as la,b8 as ua,b9 as ha,ba as ma,bb as pa,bc as fa,bd as ga,be as Sa,bf as ya,bg as ba,bh as Ca,bi as va,bj as Ia,bk as Aa,bl as wa,bm as Ea,bn as _a,bo as Da,bp as ka,bq as Pa,br as Ra,bs as Ta,M as Na,bt as Oa,bu as xa,bv as Ma,bw as La,bx as Ba,by as Fa,bz as Ua,bA as za,bB as $a,bC as Wa,bD as ja,bE as Ha,bF as Ka,bG as Za,bH as qa,bI as Va,bJ as Ga,bK as Ya,bL as Ja,bM as Qa,bN as Xa,bO as es,bP as ts,bQ as as,bR as ss,bS as is,bT as ns,bU as rs,bV as os,bW as cs,bX as ds,bY as ls,bZ as us,b_ as hs,b$ as ms,c0 as ps,c1 as fs,c2 as gs,c3 as Ss,c4 as ys,c5 as bs,c6 as Cs,c7 as vs,c8 as Is,c9 as As,ca as ws,cb as Es,cc as _s,cd as Ds,ce as ks,cf as Ps,cg as Rs,ch as Ts,ci as Ns,cj as Os,ck as xs,cl as Ms,cm as Ls,cn as Bs,S as Fs,co as Us,cp as zs,cq as $s,cr as Ws,cs as js,ct as Hs,cu as Ks,cv as Zs,cw as qs,cx as Vs,cy as Gs,cz as Ys,cA as Js,cB as Qs,cC as Xs,cD as ei,cE as ti,cF as ai,cG as si,cH as ii,cI as ni,cJ as ri,cK as oi,cL as ci,cM as di,cN as li,cO as ui,cP as hi,cQ as mi,cR as pi,cS as fi,d as gi,cT as Si,cU as yi,cV as bi,cW as Ci,cX as vi,cY as Ii,cZ as Ai,c_ as wi,c$ as Ei,d0 as _i,d1 as Di,d2 as ki,d3 as Pi,d4 as Ri,d5 as Ti,d6 as Ni,d7 as Oi,W as xi,d8 as Mi,d9 as Li,da as Bi,db as Fi,dc as Ui,dd as zi,de as $i,df as Wi,dg as ji,dh as Hi,di as Ki,dj as Zi,dk 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,c as pn,dF as fn,dG as gn,dH as Sn,b as yn,dI as bn,dJ as Cn,dK as vn,dL as In,dM as An,dN as wn,dO as En,dP as _n,dQ as Dn,dR as kn,dS as Pn,dT as Rn,dU as Tn,dV as Nn,dW as On,dX as xn,dY as Mn,dZ as Ln,d_ as Bn,d$ as Fn,e0 as Un,e1 as zn,e2 as $n,e3 as Wn,e4 as jn,e5 as Hn,e6 as Kn,e7 as Zn,e8 as qn,e9 as Vn,ea as Gn,eb as Yn,ec as Jn,ed as Qn,ee as Xn,ef as er,eg as tr,eh as ar,ei as sr,ej as ir,ek as nr,el as rr,em as or,en as cr,eo as dr,ep as lr,eq as ur,er as hr,es as mr,et as pr,eu as fr,ev as gr,ew as Sr,ex as yr}from"./auth-records-BEfan3dC.js";import{E as C,A as br,C as Cr,a as vr}from"./capability-router-map-B3jHfbHt.js";import{Z as Ir,m as Ar,p as wr,q as Er,v as _r,w as Dr,x as J,y as kr,z as Pr}from"./schemas-XgIEoUz3.js";class Rr{disposers=[];disposed=!1;onError;constructor(e={}){this.onError=e.onError??((t,s)=>{console.error(`[DisposerChain] disposer #${s} threw`,t)})}add(e){if(this.disposed){try{const t=e();t&&typeof t.then=="function"&&t.catch(s=>this.onError(s,-1))}catch(t){this.onError(t,-1)}return()=>{}}return this.disposers.push(e),()=>{const t=this.disposers.indexOf(e);t>=0&&this.disposers.splice(t,1)}}get isDisposed(){return this.disposed}get size(){return this.disposers.length}async dispose(){if(this.disposed)return;this.disposed=!0;const e=this.disposers.slice().reverse();this.disposers=[];for(let t=0;t<e.length;t++){const s=e[t];try{const i=s();i&&typeof i.then=="function"&&await i}catch(i){this.onError(i,e.length-1-t)}}}}const Q="main-group",X="hub-only";function b(a){return{placement:a.execution?.placement??X,group:a.execution?.group??Q}}function Tr(a){const e=b(a).placement;return e==="any-node"||e==="agent-only"}function Nr(a){return b(a).placement==="agent-only"}function Or(a){return b(a).group}function xr(a){return b(a).placement}function Mr(a,e){return a.category===e}function T(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(T("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.readAddonStoreWithRetry(),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}async readAddonStoreWithRetry(){const e=this._ctx?.settings;if(!e)return{};const t=[150,350,600,900];let s;for(let i=0;i<=t.length;i++)try{return await e.readAddonStore()??{}}catch(n){s=n;const r=n instanceof Error?n.message:String(n);if(!(r.includes("SqliteSettingsBackend not initialized")||r.includes("provider not available")))throw n;if(i===t.length)break;await new Promise(c=>setTimeout(c,t[i]))}return this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults",{meta:{error:s instanceof Error?s.message:String(s)}}),{}}}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 _(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 Lr{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??Br(),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&&_(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,w=>{w.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(T("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&&_(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&&_(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 Br(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,14)}function Fr(a,e){for(const{capName:t,scope:s}of e)a.emitDown(t,s)}const Ur=["data","media","recordings","recordings-high","recordings-low","recordings-clips","event-images","models","addons-data","cache","logs","backups"],zr={data:"db",media:"media",recordings:"recordings","recordings-high":"recordings-high","recordings-low":"recordings-low","recordings-clips":"recordings-clips","event-images":"event-images",models:"models","addons-data":"addons-data",cache:"/tmp/camstack-cache",logs:"logs",backups:"backups"},ie={high:"High",mid:"Mid",low:"Low"};function $r(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 Wr(a){const e=a.height??0,t=a.width??0;return e>=1080||t>=1920?"high":e>=480||t>=640?"mid":"low"}function jr(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 Hr(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Kr(a){return m(a)&&a.trim()?{url:a}:Hr(a)&&m(a.url)&&a.url.trim()?{url:a.url,label:m(a.label)?a.label:void 0}:null}function Zr(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=Kr(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 qr(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 Vr={streaming:!0,notifications:!0,objectDetection:!1,remoteAccess:!0,agentCluster:!1,smartHome:!0,recordings:!0,backup:!0,repl:!0},Gr=["face","plate"],Yr=["face","plate","clip","custom"],Jr={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",Qr=`https://huggingface.co/${ce}/resolve/main`,Xr={"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 N(a){return JSON.parse(a)}function de(a){return a===null||typeof a!="object"||Array.isArray(a)?null:{...a}}function eo(a){return Array.isArray(a)?a:[]}function to(a,e=""){return typeof a=="string"?a:e}function ao(a,e=0){return typeof a=="number"?a:e}function so(a,e=!1){return typeof a=="boolean"?a:e}function io(a){try{return de(N(a))}catch{return null}}function no(a){try{const e=N(a);return Array.isArray(e)?e:null}catch{return null}}function ro(a,e){return`https://huggingface.co/${a}/resolve/main/${e}`}function oo(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 co{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(),lo(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 lo(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 uo(a,e){return a==="node"?O[e]??"onnx":{coreml:"coreml",openvino:"openvino",pytorch:"pt","onnx-py":"onnx",cpu:"onnx"}[e]??"onnx"}function ho(a,e){return!a||a==="auto"?"auto":he(a,e??"cpu")}function mo(a){return O[a]??"onnx"}function po(a){return le[a]}function fo(a){return ue[a]}function go(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 So(a,e){const t=performance.now();try{return{output:e!==void 0?await yo(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 yo(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 bo=[{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"}],Co=[{id:"person",name:"Person"},{id:"vehicle",name:"Vehicle"},{id:"animal",name:"Animal"}],vo={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},Io={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 A{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 A(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(Ao(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 Ao(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 wo(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 Eo={audioMetrics:G,battery:V,brightness:q,cameraStreams:Z,deviceDiscovery:K,deviceStatus:R,doorbell:H,featureProbe:P,motion:j,motionTrigger:W,ptzAutotrack:$,switch:z,zoneAnalytics:U,zoneRules:F,zones:B};class _o{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=Eo[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=A.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 Do 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 ko(a,e="Configuration",t="main"){const s=a.map(i=>Po(i.key,i.schema,i.description));return{sections:[{id:t,title:e,fields:s}]}}function Po(a,e,t){const s=I(e),i=xo(e),n=t??fe(a),r={key:a,label:n,description:t,default:i};return s instanceof Ir?Ro(a,r):s instanceof Ar?To(s,r):s instanceof wr?{...r,type:"boolean"}:s instanceof Er?Oo(s,r):s instanceof _r||s instanceof Dr?{...r,type:"textarea",rows:6,isJson:!0}:{...r,type:"text"}}function Ro(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 To(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=No(a);return{...e,type:"number",...n!==void 0?{min:n}:{},...r!==void 0?{max:r}:{},...o!==void 0?{step:o}:{}}}function No(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 Oo(a,e){const t=a.options.map(i=>String(i));return{...e,type:"select",options:t.map(i=>({label:fe(i),value:i}))}}function I(a){return a instanceof J||a instanceof kr||a instanceof Pr?I(y(a).innerType):a}function xo(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 Mo(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),w=r.some(E=>L(E,S,p,l)),x=o.some(E=>L(E,S,p,l));c?w&&!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&&Lo(e,n.polygon))return!0}return!1}function Lo(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 Bo(a){return a}function Fo(a,e,t){return{input:a,output:e,kind:t?.kind??"query",auth:t?.auth??"protected",scope:t?.scope??{kind:"system"}}}const Uo=["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 zo(a){try{const e=new URL(a);return!e.username&&!e.password?a:(e.username="",e.password="",e.toString())}catch{return a}}class $o{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 Wo(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 Zo=Object.freeze(Object.defineProperty({__proto__:null,ACCESSORY_LABEL:ge,ALL_CAPABILITY_DEFINITIONS:br,APPLE_SA_TO_MACRO:Se,AUDIO_BACKEND_CHOICES:ye,AUDIO_MACRO_LABELS:be,AccessoriesStatusSchema:Ce,AccessoryKind:ve,AddonAutoUpdateSchema:Ie,AddonListItemSchema:Ae,AddonPageDeclarationSchema:we,AddonPageInfoSchema:Ee,AgentLoadSummarySchema:_e,AlertSchema:De,AlertSeveritySchema:ke,AlertSourceSchema:Pe,AlertStatusSchema:Re,ApiKeyRecordSchema:Te,ApiKeySummarySchema:Ne,ArchiveEntrySchema:Oe,ArchiveManifestSchema:xe,AudioAnalysisResultSchema:Me,AudioAnalysisSettingsSchema:Le,AudioChunkInputSchema:Be,AudioClassSummarySchema:Fe,AudioClassificationLabelSchema:Ue,AudioClassificationResultSchema:ze,AudioCodecInfoSchema:$e,AudioDecodeSessionConfigSchema:We,AudioEncodeSessionConfigSchema:je,AudioEncodedChunkSchema:He,AudioEventSchema:Ke,AudioLevelSchema:Ze,AudioMetricsHistoryPointSchema:qe,AudioMetricsHistorySchema:Ve,AudioMetricsSnapshotSchema:Ge,AudioPcmChunkSchema:Ye,AuthProviderInfoSchema:Je,AuthResultSchema:Qe,AutoUpdateSettingsSchema:Xe,AvailableIntegrationTypeSchema:et,BACKEND_TO_FORMAT:O,BATTERY_DEVICE_PROFILE:tt,BackupDestinationInfoSchema:at,BackupEntrySchema:st,BaseAddon:te,BaseDevice:_o,BaseDeviceProvider:Do,BatteryStatusSchema:it,BoundingBoxSchema:nt,BrightnessStatusSchema:rt,BrokerAudioClientSchema:ot,BrokerClientsSchema:ct,BrokerDecodedClientSchema:dt,BrokerRtspClientSchema:lt,BrokerStatsSchema:ut,BrokerStatusSchema:ht,CAM_PROFILE_ORDER:mt,CAPABILITY_NAMES:Cr,CAPABILITY_ROUTER_KEYS:vr,CAP_NAMES_WITH_STATUS:Uo,COCO_80_LABELS:bo,COCO_TO_MACRO:vo,CamProfileSchema:pt,CamStreamKindSchema:ft,CamStreamResolutionSchema:gt,CameraCredentialsSchema:St,CameraCredentialsStatusSchema:yt,CameraMetricsSchema:bt,CameraMetricsWithDeviceIdSchema:Ct,CameraStreamSchema:vt,CapabilityBindingsSchema:It,ChargingStatus:At,ClientNetworkStatsSchema:wt,ClusterAddonNodeDeploymentSchema:Et,ClusterAddonStatusEntrySchema:_t,CollectionColumnSchema:Dt,CollectionIndexSchema:kt,ConfigEntrySchema:Pt,ConfigSectionWithValuesSchema:Rt,ConfigTabDeclarationSchema:Tt,CreateApiKeyInputSchema:Nt,CreateApiKeyResultSchema:Ot,CreateIntegrationInputSchema:xt,CreateScopedTokenInputSchema:Mt,CreateScopedTokenResultSchema:Lt,CreateUserInputSchema:Bt,CustomActionInputSchema:Ft,DEFAULT_ADDON_GROUP:Q,DEFAULT_ADDON_PLACEMENT:X,DEFAULT_AUDIO_ANALYZER_CONFIG:Ut,DEFAULT_DECODER_HWACCEL_CONFIG:zt,DEFAULT_FEATURES:Vr,DEFAULT_LOCATION_SUBDIRS:zr,DEFAULT_RETENTION:Jr,DEVICE_PROFILES:$t,DEVICE_SETTINGS_CONTRIBUTION_METHODS:Wt,DEVICE_STATUS_METHOD:jt,DEVICE_TYPE_INFO:Io,DecodedFrameSchema:Ht,DecoderAssignmentSchema:Kt,DecoderSessionConfigSchema:Zt,DecoderStatsSchema:qt,DeleteIntegrationResultSchema:Vt,DetectorOutputSchema:Gt,DeviceConfig:g,DeviceDiscoveryStatusSchema:Yt,DeviceFeature:Jt,DeviceInfoSchema:Qt,DeviceNetworkStatsSchema:Xt,DeviceRole:ea,DeviceRuntimeState:A,DeviceStatusSchema:ta,DeviceType:aa,DiscoveredChildDeviceSchema:sa,DiscoveredChildStatusSchema:ia,DiscoveredDeviceSchema:na,DisposerChain:Rr,DoorbellPressEventSchema:ra,DoorbellStatusSchema:oa,ElementConfigStore:co,EmbeddingInfoSchema:ca,EmbeddingResultSchema:da,EncodedPacketSchema:la,EnrichedWidgetMetadataSchema:ua,EventCategory:C,EventItemSchema:ha,EventKindSchema:ma,EventSourceType:oe,ExposedResourceSchema:pa,FeatureManifestSchema:fa,FeatureProbeStatusSchema:ga,FrameInputSchema:Sa,GlobalMetricsSchema:ya,HF_BASE_URL:Qr,HF_REPO:ce,HWACCEL_OPTIONS:ba,HealthStatusSchema:Ca,HistoryPointSchema:va,HistoryResolutionEnum:Ia,InstalledPackageSchema:Aa,IntegrationLiteSchema:wa,IntegrationWithStateSchema:Ea,IntercomAbilitySchema:_a,IntercomStatusSchema:Da,LocationStatSchema:ka,LogEntrySchema:Pa,LogLevelSchema:Ra,LogStreamEntrySchema:Ta,MACRO_LABELS:Co,MODEL_FORMATS:Na,MediaFileSchema:Oa,MotionAnalysisResultSchema:xa,MotionEventSchema:Ma,MotionOnMotionChangedDataSchema:La,MotionRegionSchema:Ba,MotionSourceEnum:Fa,MotionSourcesSchema:Ua,MotionStatusSchema:za,MotionTriggerRuntimeStateSchema:$a,MotionTriggerStatusSchema:Wa,NativeDetectionSchema:ja,NativeObjectClassEnum:Ha,NativeObjectDetectionStatusSchema:Ka,NetworkAccessStatusSchema:Za,NetworkAddressSchema:qa,NetworkEndpointSchema:Va,NotificationHistoryEntrySchema:Ga,NotificationRuleSchema:Ya,NotificationSchema:Ja,ObjectEventSchema:Qa,OrchestratorMetricsSchema:Xa,OsdOverlayKindEnum:es,OsdOverlayPatchSchema:ts,OsdOverlaySchema:as,OsdPositionEnum:ss,OsdStatusSchema:is,PIPELINE_FLOW_CAPABILITY_NAMES:ns,PIPELINE_OWNER_CAPABILITY_NAMES:rs,PYTHON_SCRIPT:ue,PackageUpdateSchema:os,PackageVersionInfoSchema:cs,PcmSampleFormatSchema:ds,PerScopeBreakdownSchema:ls,PipelineAssignmentSchema:us,PipelineDefaultStepSchema:hs,PipelineEngineChoiceSchema:ms,PipelineRunResultBridge:ps,PipelineStepInputSchema:fs,PlaceholderReasonSchema:gs,PolygonPointSchema:Ss,ProfileSlotSchema:ys,ProfileSlotStatusSchema:bs,ProviderStatusSchema:Cs,PtzAutotrackRuntimeStateSchema:vs,PtzAutotrackSettingsSchema:Is,PtzAutotrackStatusSchema:As,PtzAutotrackTargetOptionSchema:ws,PtzMoveCommandSchema:Es,PtzPositionSchema:_s,PtzPresetSchema:Ds,QueryFilterSchema:ks,RECOGNITION_TYPES:Yr,RUNTIME_DEFAULTS:Xr,RUNTIME_TO_FORMAT:le,ReadinessRegistry:Lr,ReadinessTimeoutError:se,RegisteredStreamSchema:Ps,RemoteAccessEndpointSchema:Rs,RemoteAccessProviderInfoSchema:Ts,ReportMotionInputSchema:Ns,RingBuffer:$o,RtspRestreamEntrySchema:Os,RunnerCameraConfigSchema:xs,RunnerCameraDeviceUIFields:Ms,RunnerLocalLoadSchema:Ls,RunnerLocalMetricsSchema:Bs,STORAGE_LOCATION_CARDINALITY:Fs,STORAGE_LOCATION_TYPES:Ur,STREAM_QUALITY_LABELS:ie,SUB_DETECTION_TYPES:Gr,ScopedTokenSchema:Us,ScopedTokenSummarySchema:zs,SearchResultSchema:$s,SegmentSchema:Ws,SettingsPatchSchema:js,SettingsRecordSchema:Hs,SettingsSchemaWithValuesSchema:Ks,SettingsUpdateResultSchema:Zs,SnapshotImageSchema:qs,SpatialDetectionSchema:Vs,StorageAbortUploadInputSchema:Gs,StorageBeginDownloadInputSchema:Ys,StorageBeginDownloadResultSchema:Js,StorageBeginUploadInputSchema:Qs,StorageBeginUploadResultSchema:Xs,StorageEndDownloadInputSchema:ei,StorageFinalizeUploadInputSchema:ti,StorageLocationRefSchema:ai,StorageLocationSchema:si,StorageLocationTypeSchema:ii,StorageProviderInfoSchema:ni,StorageReadChunkInputSchema:ri,StorageTestLocationResultSchema:oi,StorageWriteChunkInputSchema:ci,StreamFormatSchema:di,StreamInfoSchema:li,StreamNetworkStatsSchema:ui,StreamSourceEntrySchema:hi,StreamSourceSchema:mi,SwitchStatusSchema:pi,SystemMetricsSchema:fi,SystemMirror:gi,TestConnectionResultSchema:Si,ToastSchema:yi,TokenScopeSchema:bi,TopologyNodeSchema:Ci,TopologyProcessSchema:vi,TopologyServiceSchema:Ii,TrackSchema:Ai,TrackStateSchema:wi,TrackedDetectionSchema:Ei,TurnProviderInfoSchema:_i,TurnServerSchema:Di,UpdateIntegrationInputSchema:ki,UpdateUserInputSchema:Pi,UserRecordSchema:Ri,UserRoleSchema:Ti,UserSummarySchema:Ni,WELL_KNOWN_TABS:Oi,WELL_KNOWN_TAB_MAP:xi,WebrtcStreamChoiceSchema:Mi,WebrtcStreamTargetSchema:Li,WidgetHostEnum:Bi,WidgetMetadataSchema:Fi,WidgetSizeEnum:Ui,YAMNET_TO_MACRO:zi,ZoneKindEnum:$i,ZoneRuleModeEnum:Wi,ZoneRuleSchema:ji,ZoneRuleStageEnum:Hi,ZoneRulesArraySchema:Ki,ZoneSchema:Zi,ZoneScopeBreakdownSchema:qi,accessoriesCapability:Vi,accessoryStableId:Gi,addonPagesCapability:Yi,addonPagesSourceCapability:Ji,addonRoutesCapability:Qi,addonSettingsCapability:Xi,addonWidgetsCapability:en,addonWidgetsSourceCapability:tn,addonsCapability:an,adminUiCapability:sn,advancedNotifierCapability:nn,alertsCapability:rn,asBoolean:so,asJsonArray:eo,asJsonObject:de,asNumber:ao,asString:to,audioAnalysisCapability:on,audioAnalyzerCapability:cn,audioCodecCapability:dn,audioMetricsCapability:G,authProviderCapability:ln,authenticationCapability:un,autoAssignProfiles:qr,backupCapability:hn,batteryCapability:V,bindAddonActions:Wo,brightnessCapability:q,cameraCredentialsCapability:mn,cameraStreamsCapability:Z,classifyStream:Wr,classifyStreams:re,cosineSimilarity:oo,createDeviceProxy:pn,createEvent:T,createLazyTrpcSource:fn,createMirrorSource:gn,createRuntimeStateBridge:wo,createSliceHandle:Sn,createSystemProxy:yn,customAction:Fo,decoderCapability:bn,defineCustomActions:Bo,detectionPipelineCapability:Cn,deviceDiscoveryCapability:K,deviceManagerCapability:vn,deviceMatchesProfile:In,deviceOpsCapability:An,deviceProviderCapability:Y,deviceStateCapability:wn,deviceStatusCapability:R,doorbellCapability:H,embeddingEncoderCapability:En,emitDownForOwnedCaps:Fr,emitReadiness:ee,errMsg:me,evaluateZoneRules:Mo,event:_n,eventsCapability:Dn,expandCapMethods:kn,featureProbeCapability:P,formatForBackend:mo,formatForRuntime:po,getAudioMacroClassIds:Pn,hfModelUrl:ro,hydrateSchema:k,integrationsCapability:Rn,intercomCapability:Tn,isAgentOnlyPlacement:Nr,isDeployableToAgent:Tr,isEvent:Mr,localNetworkCapability:Nn,logDestinationCapability:On,mapAudioLabelToMacro:xn,maskUrlCredentials:zo,meshNetworkCapability:Mn,meshOrchestratorCapability:Ln,method:Bn,metricsProviderCapability:Fn,motionCapability:j,motionDetectionCapability:Un,motionTriggerCapability:W,nativeObjectDetectionCapability:zn,networkAccessCapability:$n,networkQualityCapability:Wn,nodesCapability:jn,normalizeAddonInitResult:ae,notificationOutputCapability:Hn,osdCapability:Kn,parseCameraStreamConfig:Zr,parseJsonArray:no,parseJsonObject:io,parseJsonUnknown:N,pipelineAnalyticsCapability:Zn,pipelineExecutorCapability:qn,pipelineOrchestratorCapability:Vn,pipelineRunnerCapability:Gn,platformProbeCapability:Yn,ptzAutotrackCapability:$,ptzCapability:Jn,pythonScriptForBackend:fo,readinessKey:v,rebootCapability:Qn,recordingCapability:Xn,recordingEngineCapability:er,remoteAccessCapability:tr,requiresPython:go,resolveAddonExecution:b,resolveAddonGroup:Or,resolveAddonPlacement:xr,resolveAddonRuntime:ho,resolveDetectionRuntime:he,resolveDeviceProfile:ar,resolveModelFormat:uo,restreamerCapability:sr,runInferenceStep:So,scopeKey:f,settingsStoreCapability:ir,snapshotCapability:nr,snapshotProviderCapability:rr,storageCapability:or,storageProviderCapability:cr,streamBrokerCapability:dr,streamPixels:ne,streamQualityLabel:$r,streamingEngineCapability:lr,switchCapability:z,systemCapability:ur,toDeviceSummary:pe,toStreamSourceEntry:jr,toastCapability:hr,turnOrchestratorCapability:mr,turnProviderCapability:pr,userManagementCapability:fr,webrtcCapability:gr,webrtcClientHintsSchema:Sr,webrtcSessionCapability:yr,zodEntriesToConfigUI:ko,zoneAnalyticsCapability:U,zoneRulesCapability:F,zonesCapability:B},Symbol.toStringTag,{value:"Module"}));export{Ur as S,de as a,Zo as s};
|
|
1
|
+
import{h as k,z as B,e as F,f as U,s as z,p as $,m as W,g as j,i as P,j as H,k as R,l as K,n as Z,o as q,q as V,r as G,t as Y,A as ge,u as Se,v as ye,w as be,x as Ce,y as ve,B as Ie,C as Ae,E as we,F as Ee,G as _e,H as De,I as ke,J as Pe,K as Re,L as Te,N as Ne,O as Oe,P as xe,Q as Me,R as Le,T as Be,U as Fe,V as Ue,X as ze,Y as $e,Z as We,_ as je,$ as He,a0 as Ke,a1 as Ze,a2 as qe,a3 as Ve,a4 as Ge,a5 as Ye,a6 as Je,a7 as Qe,a8 as Xe,a9 as et,aa as tt,ab as at,ac as st,ad as it,ae as nt,af as rt,ag as ot,ah as ct,ai as dt,aj as lt,ak as ut,al as ht,am as mt,an as pt,ao as ft,ap as gt,aq as St,ar as yt,as as bt,at as Ct,au as vt,av as It,aw as At,ax as wt,ay as Et,az as _t,aA as Dt,aB as kt,aC as Pt,aD as Rt,aE as Tt,aF as Nt,aG as Ot,aH as xt,aI as Mt,aJ as Lt,aK as Bt,aL as Ft,aM as Ut,aN as zt,aO as $t,aP as Wt,aQ as jt,aR as Ht,aS as Kt,aT as Zt,aU as qt,aV as Vt,aW as Gt,aX as Yt,D as Jt,aY as Qt,aZ as Xt,a_ as ea,a$ as ta,a as aa,b0 as sa,b1 as ia,b2 as na,b3 as ra,b4 as oa,b5 as ca,b6 as da,b7 as la,b8 as ua,b9 as ha,ba as ma,bb as pa,bc as fa,bd as ga,be as Sa,bf as ya,bg as ba,bh as Ca,bi as va,bj as Ia,bk as Aa,bl as wa,bm as Ea,bn as _a,bo as Da,bp as ka,bq as Pa,br as Ra,bs as Ta,M as Na,bt as Oa,bu as xa,bv as Ma,bw as La,bx as Ba,by as Fa,bz as Ua,bA as za,bB as $a,bC as Wa,bD as ja,bE as Ha,bF as Ka,bG as Za,bH as qa,bI as Va,bJ as Ga,bK as Ya,bL as Ja,bM as Qa,bN as Xa,bO as es,bP as ts,bQ as as,bR as ss,bS as is,bT as ns,bU as rs,bV as os,bW as cs,bX as ds,bY as ls,bZ as us,b_ as hs,b$ as ms,c0 as ps,c1 as fs,c2 as gs,c3 as Ss,c4 as ys,c5 as bs,c6 as Cs,c7 as vs,c8 as Is,c9 as As,ca as ws,cb as Es,cc as _s,cd as Ds,ce as ks,cf as Ps,cg as Rs,ch as Ts,ci as Ns,cj as Os,ck as xs,cl as Ms,cm as Ls,cn as Bs,S as Fs,co as Us,cp as zs,cq as $s,cr as Ws,cs as js,ct as Hs,cu as Ks,cv as Zs,cw as qs,cx as Vs,cy as Gs,cz as Ys,cA as Js,cB as Qs,cC as Xs,cD as ei,cE as ti,cF as ai,cG as si,cH as ii,cI as ni,cJ as ri,cK as oi,cL as ci,cM as di,cN as li,cO as ui,cP as hi,cQ as mi,cR as pi,cS as fi,d as gi,cT as Si,cU as yi,cV as bi,cW as Ci,cX as vi,cY as Ii,cZ as Ai,c_ as wi,c$ as Ei,d0 as _i,d1 as Di,d2 as ki,d3 as Pi,d4 as Ri,d5 as Ti,d6 as Ni,d7 as Oi,W as xi,d8 as Mi,d9 as Li,da as Bi,db as Fi,dc as Ui,dd as zi,de as $i,df as Wi,dg as ji,dh as Hi,di as Ki,dj as Zi,dk 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,c as pn,dF as fn,dG as gn,dH as Sn,b as yn,dI as bn,dJ as Cn,dK as vn,dL as In,dM as An,dN as wn,dO as En,dP as _n,dQ as Dn,dR as kn,dS as Pn,dT as Rn,dU as Tn,dV as Nn,dW as On,dX as xn,dY as Mn,dZ as Ln,d_ as Bn,d$ as Fn,e0 as Un,e1 as zn,e2 as $n,e3 as Wn,e4 as jn,e5 as Hn,e6 as Kn,e7 as Zn,e8 as qn,e9 as Vn,ea as Gn,eb as Yn,ec as Jn,ed as Qn,ee as Xn,ef as er,eg as tr,eh as ar,ei as sr,ej as ir,ek as nr,el as rr,em as or,en as cr,eo as dr,ep as lr,eq as ur,er as hr,es as mr,et as pr,eu as fr,ev as gr,ew as Sr,ex as yr}from"./auth-records-pPU2T5YK.js";import{E as C,A as br,C as Cr,a as vr}from"./capability-router-map-CnswfTnw.js";import{Z as Ir,m as Ar,p as wr,q as Er,v as _r,w as Dr,x as J,y as kr,z as Pr}from"./schemas-XgIEoUz3.js";class Rr{disposers=[];disposed=!1;onError;constructor(e={}){this.onError=e.onError??((t,s)=>{console.error(`[DisposerChain] disposer #${s} threw`,t)})}add(e){if(this.disposed){try{const t=e();t&&typeof t.then=="function"&&t.catch(s=>this.onError(s,-1))}catch(t){this.onError(t,-1)}return()=>{}}return this.disposers.push(e),()=>{const t=this.disposers.indexOf(e);t>=0&&this.disposers.splice(t,1)}}get isDisposed(){return this.disposed}get size(){return this.disposers.length}async dispose(){if(this.disposed)return;this.disposed=!0;const e=this.disposers.slice().reverse();this.disposers=[];for(let t=0;t<e.length;t++){const s=e[t];try{const i=s();i&&typeof i.then=="function"&&await i}catch(i){this.onError(i,e.length-1-t)}}}}const Q="main-group",X="hub-only";function b(a){return{placement:a.execution?.placement??X,group:a.execution?.group??Q}}function Tr(a){const e=b(a).placement;return e==="any-node"||e==="agent-only"}function Nr(a){return b(a).placement==="agent-only"}function Or(a){return b(a).group}function xr(a){return b(a).placement}function Mr(a,e){return a.category===e}function T(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(T("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.readAddonStoreWithRetry(),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}async readAddonStoreWithRetry(){const e=this._ctx?.settings;if(!e)return{};const t=[150,350,600,900];let s;for(let i=0;i<=t.length;i++)try{return await e.readAddonStore()??{}}catch(n){s=n;const r=n instanceof Error?n.message:String(n);if(!(r.includes("SqliteSettingsBackend not initialized")||r.includes("provider not available")))throw n;if(i===t.length)break;await new Promise(c=>setTimeout(c,t[i]))}return this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults",{meta:{error:s instanceof Error?s.message:String(s)}}),{}}}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 _(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 Lr{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??Br(),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&&_(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,w=>{w.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(T("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&&_(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&&_(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 Br(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,14)}function Fr(a,e){for(const{capName:t,scope:s}of e)a.emitDown(t,s)}const Ur=["data","media","recordings","recordings-high","recordings-low","recordings-clips","event-images","models","addons-data","cache","logs","backups"],zr={data:"db",media:"media",recordings:"recordings","recordings-high":"recordings-high","recordings-low":"recordings-low","recordings-clips":"recordings-clips","event-images":"event-images",models:"models","addons-data":"addons-data",cache:"/tmp/camstack-cache",logs:"logs",backups:"backups"},ie={high:"High",mid:"Mid",low:"Low"};function $r(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 Wr(a){const e=a.height??0,t=a.width??0;return e>=1080||t>=1920?"high":e>=480||t>=640?"mid":"low"}function jr(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 Hr(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}function Kr(a){return m(a)&&a.trim()?{url:a}:Hr(a)&&m(a.url)&&a.url.trim()?{url:a.url,label:m(a.label)?a.label:void 0}:null}function Zr(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=Kr(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 qr(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 Vr={streaming:!0,notifications:!0,objectDetection:!1,remoteAccess:!0,agentCluster:!1,smartHome:!0,recordings:!0,backup:!0,repl:!0},Gr=["face","plate"],Yr=["face","plate","clip","custom"],Jr={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",Qr=`https://huggingface.co/${ce}/resolve/main`,Xr={"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 N(a){return JSON.parse(a)}function de(a){return a===null||typeof a!="object"||Array.isArray(a)?null:{...a}}function eo(a){return Array.isArray(a)?a:[]}function to(a,e=""){return typeof a=="string"?a:e}function ao(a,e=0){return typeof a=="number"?a:e}function so(a,e=!1){return typeof a=="boolean"?a:e}function io(a){try{return de(N(a))}catch{return null}}function no(a){try{const e=N(a);return Array.isArray(e)?e:null}catch{return null}}function ro(a,e){return`https://huggingface.co/${a}/resolve/main/${e}`}function oo(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 co{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(),lo(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 lo(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 uo(a,e){return a==="node"?O[e]??"onnx":{coreml:"coreml",openvino:"openvino",pytorch:"pt","onnx-py":"onnx",cpu:"onnx"}[e]??"onnx"}function ho(a,e){return!a||a==="auto"?"auto":he(a,e??"cpu")}function mo(a){return O[a]??"onnx"}function po(a){return le[a]}function fo(a){return ue[a]}function go(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 So(a,e){const t=performance.now();try{return{output:e!==void 0?await yo(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 yo(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 bo=[{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"}],Co=[{id:"person",name:"Person"},{id:"vehicle",name:"Vehicle"},{id:"animal",name:"Animal"}],vo={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},Io={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 A{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 A(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(Ao(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 Ao(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 wo(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 Eo={audioMetrics:G,battery:V,brightness:q,cameraStreams:Z,deviceDiscovery:K,deviceStatus:R,doorbell:H,featureProbe:P,motion:j,motionTrigger:W,ptzAutotrack:$,switch:z,zoneAnalytics:U,zoneRules:F,zones:B};class _o{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=Eo[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=A.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 Do 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 ko(a,e="Configuration",t="main"){const s=a.map(i=>Po(i.key,i.schema,i.description));return{sections:[{id:t,title:e,fields:s}]}}function Po(a,e,t){const s=I(e),i=xo(e),n=t??fe(a),r={key:a,label:n,description:t,default:i};return s instanceof Ir?Ro(a,r):s instanceof Ar?To(s,r):s instanceof wr?{...r,type:"boolean"}:s instanceof Er?Oo(s,r):s instanceof _r||s instanceof Dr?{...r,type:"textarea",rows:6,isJson:!0}:{...r,type:"text"}}function Ro(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 To(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=No(a);return{...e,type:"number",...n!==void 0?{min:n}:{},...r!==void 0?{max:r}:{},...o!==void 0?{step:o}:{}}}function No(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 Oo(a,e){const t=a.options.map(i=>String(i));return{...e,type:"select",options:t.map(i=>({label:fe(i),value:i}))}}function I(a){return a instanceof J||a instanceof kr||a instanceof Pr?I(y(a).innerType):a}function xo(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 Mo(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),w=r.some(E=>L(E,S,p,l)),x=o.some(E=>L(E,S,p,l));c?w&&!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&&Lo(e,n.polygon))return!0}return!1}function Lo(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 Bo(a){return a}function Fo(a,e,t){return{input:a,output:e,kind:t?.kind??"query",auth:t?.auth??"protected",scope:t?.scope??{kind:"system"}}}const Uo=["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 zo(a){try{const e=new URL(a);return!e.username&&!e.password?a:(e.username="",e.password="",e.toString())}catch{return a}}class $o{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 Wo(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 Zo=Object.freeze(Object.defineProperty({__proto__:null,ACCESSORY_LABEL:ge,ALL_CAPABILITY_DEFINITIONS:br,APPLE_SA_TO_MACRO:Se,AUDIO_BACKEND_CHOICES:ye,AUDIO_MACRO_LABELS:be,AccessoriesStatusSchema:Ce,AccessoryKind:ve,AddonAutoUpdateSchema:Ie,AddonListItemSchema:Ae,AddonPageDeclarationSchema:we,AddonPageInfoSchema:Ee,AgentLoadSummarySchema:_e,AlertSchema:De,AlertSeveritySchema:ke,AlertSourceSchema:Pe,AlertStatusSchema:Re,ApiKeyRecordSchema:Te,ApiKeySummarySchema:Ne,ArchiveEntrySchema:Oe,ArchiveManifestSchema:xe,AudioAnalysisResultSchema:Me,AudioAnalysisSettingsSchema:Le,AudioChunkInputSchema:Be,AudioClassSummarySchema:Fe,AudioClassificationLabelSchema:Ue,AudioClassificationResultSchema:ze,AudioCodecInfoSchema:$e,AudioDecodeSessionConfigSchema:We,AudioEncodeSessionConfigSchema:je,AudioEncodedChunkSchema:He,AudioEventSchema:Ke,AudioLevelSchema:Ze,AudioMetricsHistoryPointSchema:qe,AudioMetricsHistorySchema:Ve,AudioMetricsSnapshotSchema:Ge,AudioPcmChunkSchema:Ye,AuthProviderInfoSchema:Je,AuthResultSchema:Qe,AutoUpdateSettingsSchema:Xe,AvailableIntegrationTypeSchema:et,BACKEND_TO_FORMAT:O,BATTERY_DEVICE_PROFILE:tt,BackupDestinationInfoSchema:at,BackupEntrySchema:st,BaseAddon:te,BaseDevice:_o,BaseDeviceProvider:Do,BatteryStatusSchema:it,BoundingBoxSchema:nt,BrightnessStatusSchema:rt,BrokerAudioClientSchema:ot,BrokerClientsSchema:ct,BrokerDecodedClientSchema:dt,BrokerRtspClientSchema:lt,BrokerStatsSchema:ut,BrokerStatusSchema:ht,CAM_PROFILE_ORDER:mt,CAPABILITY_NAMES:Cr,CAPABILITY_ROUTER_KEYS:vr,CAP_NAMES_WITH_STATUS:Uo,COCO_80_LABELS:bo,COCO_TO_MACRO:vo,CamProfileSchema:pt,CamStreamKindSchema:ft,CamStreamResolutionSchema:gt,CameraCredentialsSchema:St,CameraCredentialsStatusSchema:yt,CameraMetricsSchema:bt,CameraMetricsWithDeviceIdSchema:Ct,CameraStreamSchema:vt,CapabilityBindingsSchema:It,ChargingStatus:At,ClientNetworkStatsSchema:wt,ClusterAddonNodeDeploymentSchema:Et,ClusterAddonStatusEntrySchema:_t,CollectionColumnSchema:Dt,CollectionIndexSchema:kt,ConfigEntrySchema:Pt,ConfigSectionWithValuesSchema:Rt,ConfigTabDeclarationSchema:Tt,CreateApiKeyInputSchema:Nt,CreateApiKeyResultSchema:Ot,CreateIntegrationInputSchema:xt,CreateScopedTokenInputSchema:Mt,CreateScopedTokenResultSchema:Lt,CreateUserInputSchema:Bt,CustomActionInputSchema:Ft,DEFAULT_ADDON_GROUP:Q,DEFAULT_ADDON_PLACEMENT:X,DEFAULT_AUDIO_ANALYZER_CONFIG:Ut,DEFAULT_DECODER_HWACCEL_CONFIG:zt,DEFAULT_FEATURES:Vr,DEFAULT_LOCATION_SUBDIRS:zr,DEFAULT_RETENTION:Jr,DEVICE_PROFILES:$t,DEVICE_SETTINGS_CONTRIBUTION_METHODS:Wt,DEVICE_STATUS_METHOD:jt,DEVICE_TYPE_INFO:Io,DecodedFrameSchema:Ht,DecoderAssignmentSchema:Kt,DecoderSessionConfigSchema:Zt,DecoderStatsSchema:qt,DeleteIntegrationResultSchema:Vt,DetectorOutputSchema:Gt,DeviceConfig:g,DeviceDiscoveryStatusSchema:Yt,DeviceFeature:Jt,DeviceInfoSchema:Qt,DeviceNetworkStatsSchema:Xt,DeviceRole:ea,DeviceRuntimeState:A,DeviceStatusSchema:ta,DeviceType:aa,DiscoveredChildDeviceSchema:sa,DiscoveredChildStatusSchema:ia,DiscoveredDeviceSchema:na,DisposerChain:Rr,DoorbellPressEventSchema:ra,DoorbellStatusSchema:oa,ElementConfigStore:co,EmbeddingInfoSchema:ca,EmbeddingResultSchema:da,EncodedPacketSchema:la,EnrichedWidgetMetadataSchema:ua,EventCategory:C,EventItemSchema:ha,EventKindSchema:ma,EventSourceType:oe,ExposedResourceSchema:pa,FeatureManifestSchema:fa,FeatureProbeStatusSchema:ga,FrameInputSchema:Sa,GlobalMetricsSchema:ya,HF_BASE_URL:Qr,HF_REPO:ce,HWACCEL_OPTIONS:ba,HealthStatusSchema:Ca,HistoryPointSchema:va,HistoryResolutionEnum:Ia,InstalledPackageSchema:Aa,IntegrationLiteSchema:wa,IntegrationWithStateSchema:Ea,IntercomAbilitySchema:_a,IntercomStatusSchema:Da,LocationStatSchema:ka,LogEntrySchema:Pa,LogLevelSchema:Ra,LogStreamEntrySchema:Ta,MACRO_LABELS:Co,MODEL_FORMATS:Na,MediaFileSchema:Oa,MotionAnalysisResultSchema:xa,MotionEventSchema:Ma,MotionOnMotionChangedDataSchema:La,MotionRegionSchema:Ba,MotionSourceEnum:Fa,MotionSourcesSchema:Ua,MotionStatusSchema:za,MotionTriggerRuntimeStateSchema:$a,MotionTriggerStatusSchema:Wa,NativeDetectionSchema:ja,NativeObjectClassEnum:Ha,NativeObjectDetectionStatusSchema:Ka,NetworkAccessStatusSchema:Za,NetworkAddressSchema:qa,NetworkEndpointSchema:Va,NotificationHistoryEntrySchema:Ga,NotificationRuleSchema:Ya,NotificationSchema:Ja,ObjectEventSchema:Qa,OrchestratorMetricsSchema:Xa,OsdOverlayKindEnum:es,OsdOverlayPatchSchema:ts,OsdOverlaySchema:as,OsdPositionEnum:ss,OsdStatusSchema:is,PIPELINE_FLOW_CAPABILITY_NAMES:ns,PIPELINE_OWNER_CAPABILITY_NAMES:rs,PYTHON_SCRIPT:ue,PackageUpdateSchema:os,PackageVersionInfoSchema:cs,PcmSampleFormatSchema:ds,PerScopeBreakdownSchema:ls,PipelineAssignmentSchema:us,PipelineDefaultStepSchema:hs,PipelineEngineChoiceSchema:ms,PipelineRunResultBridge:ps,PipelineStepInputSchema:fs,PlaceholderReasonSchema:gs,PolygonPointSchema:Ss,ProfileSlotSchema:ys,ProfileSlotStatusSchema:bs,ProviderStatusSchema:Cs,PtzAutotrackRuntimeStateSchema:vs,PtzAutotrackSettingsSchema:Is,PtzAutotrackStatusSchema:As,PtzAutotrackTargetOptionSchema:ws,PtzMoveCommandSchema:Es,PtzPositionSchema:_s,PtzPresetSchema:Ds,QueryFilterSchema:ks,RECOGNITION_TYPES:Yr,RUNTIME_DEFAULTS:Xr,RUNTIME_TO_FORMAT:le,ReadinessRegistry:Lr,ReadinessTimeoutError:se,RegisteredStreamSchema:Ps,RemoteAccessEndpointSchema:Rs,RemoteAccessProviderInfoSchema:Ts,ReportMotionInputSchema:Ns,RingBuffer:$o,RtspRestreamEntrySchema:Os,RunnerCameraConfigSchema:xs,RunnerCameraDeviceUIFields:Ms,RunnerLocalLoadSchema:Ls,RunnerLocalMetricsSchema:Bs,STORAGE_LOCATION_CARDINALITY:Fs,STORAGE_LOCATION_TYPES:Ur,STREAM_QUALITY_LABELS:ie,SUB_DETECTION_TYPES:Gr,ScopedTokenSchema:Us,ScopedTokenSummarySchema:zs,SearchResultSchema:$s,SegmentSchema:Ws,SettingsPatchSchema:js,SettingsRecordSchema:Hs,SettingsSchemaWithValuesSchema:Ks,SettingsUpdateResultSchema:Zs,SnapshotImageSchema:qs,SpatialDetectionSchema:Vs,StorageAbortUploadInputSchema:Gs,StorageBeginDownloadInputSchema:Ys,StorageBeginDownloadResultSchema:Js,StorageBeginUploadInputSchema:Qs,StorageBeginUploadResultSchema:Xs,StorageEndDownloadInputSchema:ei,StorageFinalizeUploadInputSchema:ti,StorageLocationRefSchema:ai,StorageLocationSchema:si,StorageLocationTypeSchema:ii,StorageProviderInfoSchema:ni,StorageReadChunkInputSchema:ri,StorageTestLocationResultSchema:oi,StorageWriteChunkInputSchema:ci,StreamFormatSchema:di,StreamInfoSchema:li,StreamNetworkStatsSchema:ui,StreamSourceEntrySchema:hi,StreamSourceSchema:mi,SwitchStatusSchema:pi,SystemMetricsSchema:fi,SystemMirror:gi,TestConnectionResultSchema:Si,ToastSchema:yi,TokenScopeSchema:bi,TopologyNodeSchema:Ci,TopologyProcessSchema:vi,TopologyServiceSchema:Ii,TrackSchema:Ai,TrackStateSchema:wi,TrackedDetectionSchema:Ei,TurnProviderInfoSchema:_i,TurnServerSchema:Di,UpdateIntegrationInputSchema:ki,UpdateUserInputSchema:Pi,UserRecordSchema:Ri,UserRoleSchema:Ti,UserSummarySchema:Ni,WELL_KNOWN_TABS:Oi,WELL_KNOWN_TAB_MAP:xi,WebrtcStreamChoiceSchema:Mi,WebrtcStreamTargetSchema:Li,WidgetHostEnum:Bi,WidgetMetadataSchema:Fi,WidgetSizeEnum:Ui,YAMNET_TO_MACRO:zi,ZoneKindEnum:$i,ZoneRuleModeEnum:Wi,ZoneRuleSchema:ji,ZoneRuleStageEnum:Hi,ZoneRulesArraySchema:Ki,ZoneSchema:Zi,ZoneScopeBreakdownSchema:qi,accessoriesCapability:Vi,accessoryStableId:Gi,addonPagesCapability:Yi,addonPagesSourceCapability:Ji,addonRoutesCapability:Qi,addonSettingsCapability:Xi,addonWidgetsCapability:en,addonWidgetsSourceCapability:tn,addonsCapability:an,adminUiCapability:sn,advancedNotifierCapability:nn,alertsCapability:rn,asBoolean:so,asJsonArray:eo,asJsonObject:de,asNumber:ao,asString:to,audioAnalysisCapability:on,audioAnalyzerCapability:cn,audioCodecCapability:dn,audioMetricsCapability:G,authProviderCapability:ln,authenticationCapability:un,autoAssignProfiles:qr,backupCapability:hn,batteryCapability:V,bindAddonActions:Wo,brightnessCapability:q,cameraCredentialsCapability:mn,cameraStreamsCapability:Z,classifyStream:Wr,classifyStreams:re,cosineSimilarity:oo,createDeviceProxy:pn,createEvent:T,createLazyTrpcSource:fn,createMirrorSource:gn,createRuntimeStateBridge:wo,createSliceHandle:Sn,createSystemProxy:yn,customAction:Fo,decoderCapability:bn,defineCustomActions:Bo,detectionPipelineCapability:Cn,deviceDiscoveryCapability:K,deviceManagerCapability:vn,deviceMatchesProfile:In,deviceOpsCapability:An,deviceProviderCapability:Y,deviceStateCapability:wn,deviceStatusCapability:R,doorbellCapability:H,embeddingEncoderCapability:En,emitDownForOwnedCaps:Fr,emitReadiness:ee,errMsg:me,evaluateZoneRules:Mo,event:_n,eventsCapability:Dn,expandCapMethods:kn,featureProbeCapability:P,formatForBackend:mo,formatForRuntime:po,getAudioMacroClassIds:Pn,hfModelUrl:ro,hydrateSchema:k,integrationsCapability:Rn,intercomCapability:Tn,isAgentOnlyPlacement:Nr,isDeployableToAgent:Tr,isEvent:Mr,localNetworkCapability:Nn,logDestinationCapability:On,mapAudioLabelToMacro:xn,maskUrlCredentials:zo,meshNetworkCapability:Mn,meshOrchestratorCapability:Ln,method:Bn,metricsProviderCapability:Fn,motionCapability:j,motionDetectionCapability:Un,motionTriggerCapability:W,nativeObjectDetectionCapability:zn,networkAccessCapability:$n,networkQualityCapability:Wn,nodesCapability:jn,normalizeAddonInitResult:ae,notificationOutputCapability:Hn,osdCapability:Kn,parseCameraStreamConfig:Zr,parseJsonArray:no,parseJsonObject:io,parseJsonUnknown:N,pipelineAnalyticsCapability:Zn,pipelineExecutorCapability:qn,pipelineOrchestratorCapability:Vn,pipelineRunnerCapability:Gn,platformProbeCapability:Yn,ptzAutotrackCapability:$,ptzCapability:Jn,pythonScriptForBackend:fo,readinessKey:v,rebootCapability:Qn,recordingCapability:Xn,recordingEngineCapability:er,remoteAccessCapability:tr,requiresPython:go,resolveAddonExecution:b,resolveAddonGroup:Or,resolveAddonPlacement:xr,resolveAddonRuntime:ho,resolveDetectionRuntime:he,resolveDeviceProfile:ar,resolveModelFormat:uo,restreamerCapability:sr,runInferenceStep:So,scopeKey:f,settingsStoreCapability:ir,snapshotCapability:nr,snapshotProviderCapability:rr,storageCapability:or,storageProviderCapability:cr,streamBrokerCapability:dr,streamPixels:ne,streamQualityLabel:$r,streamingEngineCapability:lr,switchCapability:z,systemCapability:ur,toDeviceSummary:pe,toStreamSourceEntry:jr,toastCapability:hr,turnOrchestratorCapability:mr,turnProviderCapability:pr,userManagementCapability:fr,webrtcCapability:gr,webrtcClientHintsSchema:Sr,webrtcSessionCapability:yr,zodEntriesToConfigUI:ko,zoneAnalyticsCapability:U,zoneRulesCapability:F,zonesCapability:B},Symbol.toStringTag,{value:"Module"}));export{Ur as S,de as a,Zo as s};
|