@camstack/addon-admin-ui 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DlquBRmD.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CziSE-Do.js} +1 -1
- package/dist/assets/{devices-CVfa8e_5.js → devices-BfsgGvwu.js} +1 -1
- package/dist/assets/{hostInit-Bq0J4U4L.js → hostInit-7yPTCcmg.js} +1 -1
- package/dist/assets/{index-C5--Sp9A.js → index-BlKJSHE9.js} +2 -2
- package/dist/assets/index-C-M4yvxf.js +1 -0
- package/dist/assets/{index-BqEwAQt-.js → index-DculG9Gi.js} +2 -2
- package/dist/assets/index-DfH297U6.js +1 -0
- package/dist/assets/{index-CJH_U_aT.js → index-Dvmk3HcY.js} +1 -1
- package/dist/assets/index-K1-f6oQr.js +1 -0
- package/dist/assets/{index-Bftw8yZ0.js → index-X-IEwb-L.js} +2 -2
- package/dist/assets/index-cfq-Npln.js +1 -0
- package/dist/assets/{index-CLnkxPD7.js → index-iCcWZGKs.js} +1 -1
- package/dist/assets/index-ptcmLXsE.js +1 -0
- package/dist/assets/{remoteEntry-qFyESaJr.js → remoteEntry-Da_G1gka.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-cGbq1Btt.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-kSAHDLPS.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/index-B3BmQjhl.js +0 -1
- package/dist/assets/index-BYRl5bfb.js +0 -1
- package/dist/assets/index-gZlh9vZc.js +0 -1
- package/dist/assets/index-o6URf7uT.js +0 -1
- package/dist/assets/index-otlbS_ZJ.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as _e,c as x,F as be,s as ve}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DIkg6-MH.js";import{b as V,d as Ee}from"./auth-records-BEfan3dC.js";import"./schemas-XgIEoUz3.js";class Pe{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(t,r){this.keyToValue.set(t,r),this.valueToKey.set(r,t)}getByKey(t){return this.keyToValue.get(t)}getByValue(t){return this.valueToKey.get(t)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class q{constructor(t){this.generateIdentifier=t,this.kv=new Pe}register(t,r){this.kv.getByValue(t)||(r||(r=this.generateIdentifier(t)),this.kv.set(r,t))}clear(){this.kv.clear()}getIdentifier(t){return this.kv.getByValue(t)}getValue(t){return this.kv.getByKey(t)}}class Ce extends q{constructor(){super(t=>t.name),this.classToAllowedProps=new Map}register(t,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(t,r.allowProps),super.register(t,r.identifier)):super.register(t,r)}getAllowedProps(t){return this.classToAllowedProps.get(t)}}function Se(e){if("values"in Object)return Object.values(e);const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}function ke(e,t){const r=Se(e);if("find"in r)return r.find(t);const s=r;for(let n=0;n<s.length;n++){const i=s[n];if(t(i))return i}}function v(e,t){Object.entries(e).forEach(([r,s])=>t(s,r))}function k(e,t){return e.indexOf(t)!==-1}function B(e,t){for(let r=0;r<e.length;r++){const s=e[r];if(t(s))return s}}class Re{constructor(){this.transfomers={}}register(t){this.transfomers[t.name]=t}findApplicable(t){return ke(this.transfomers,r=>r.isApplicable(t))}findByName(t){return this.transfomers[t]}}const Ie=e=>Object.prototype.toString.call(e).slice(8,-1),W=e=>typeof e>"u",Te=e=>e===null,P=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,T=e=>P(e)&&Object.keys(e).length===0,g=e=>Array.isArray(e),Ae=e=>typeof e=="string",Me=e=>typeof e=="number"&&!isNaN(e),Oe=e=>typeof e=="boolean",De=e=>e instanceof RegExp,C=e=>e instanceof Map,S=e=>e instanceof Set,K=e=>Ie(e)==="Symbol",Le=e=>e instanceof Date&&!isNaN(e.valueOf()),Y=e=>e instanceof Error,U=e=>typeof e=="number"&&isNaN(e),Ne=e=>Oe(e)||Te(e)||W(e)||Me(e)||Ae(e)||K(e),xe=e=>typeof e=="bigint",Ve=e=>e===1/0||e===-1/0,Be=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Ue=e=>e instanceof URL,A=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),I=e=>e.map(String).map(A).join("."),E=(e,t)=>{const r=[];let s="";for(let i=0;i<e.length;i++){let o=e.charAt(i);if(!t&&o==="\\"){const f=e.charAt(i+1);if(f==="\\"){s+="\\",i++;continue}else if(f!==".")throw Error("invalid path")}if(o==="\\"&&e.charAt(i+1)==="."){s+=".",i++;continue}if(o==="."){r.push(s),s="";continue}s+=o}const n=s;return r.push(n),r};function y(e,t,r,s){return{isApplicable:e,annotation:t,transform:r,untransform:s}}const G=[y(W,"undefined",()=>null,()=>{}),y(xe,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),y(Le,"Date",e=>e.toISOString(),e=>new Date(e)),y(Y,"Error",(e,t)=>{const r={name:e.name,message:e.message};return"cause"in e&&(r.cause=e.cause),t.allowedErrorProps.forEach(s=>{r[s]=e[s]}),r},(e,t)=>{const r=new Error(e.message,{cause:e.cause});return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(s=>{r[s]=e[s]}),r}),y(De,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),r=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,r)}),y(S,"set",e=>[...e.values()],e=>new Set(e)),y(C,"map",e=>[...e.entries()],e=>new Map(e)),y(e=>U(e)||Ve(e),"number",e=>U(e)?"NaN":e>0?"Infinity":"-Infinity",Number),y(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),y(Ue,"URL",e=>e.toString(),e=>new URL(e))];function R(e,t,r,s){return{isApplicable:e,annotation:t,transform:r,untransform:s}}const H=R((e,t)=>K(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{const s=r.symbolRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown symbol");return s}),ze=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),X=R(Be,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=ze[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function Z(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}const Q=R(Z,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};const s={};return r.forEach(n=>{s[n]=e[n]}),s},(e,t,r)=>{const s=r.classRegistry.getValue(t[1]);if(!s)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(s.prototype),e)}),j=R((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{const s=r.customTransformerRegistry.findByName(t[1]);if(!s)throw new Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),Fe=[Q,H,j,X],z=(e,t)=>{const r=B(Fe,n=>n.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const s=B(G,n=>n.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},J={};G.forEach(e=>{J[e.annotation]=e});const $e=(e,t,r)=>{if(g(t))switch(t[0]){case"symbol":return H.untransform(e,t,r);case"class":return Q.untransform(e,t,r);case"custom":return j.untransform(e,t,r);case"typed-array":return X.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const s=J[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,r)}},b=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function ee(e){if(k(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(k(e,"prototype"))throw new Error("prototype is not allowed as a property");if(k(e,"constructor"))throw new Error("constructor is not allowed as a property")}const qe=(e,t)=>{ee(t);for(let r=0;r<t.length;r++){const s=t[r];if(S(e))e=b(e,+s);else if(C(e)){const n=+s,i=+t[++r]==0?"key":"value",o=b(e,n);switch(i){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},M=(e,t,r)=>{if(ee(t),t.length===0)return r(e);let s=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(g(s)){const a=+o;s=s[a]}else if(P(s))s=s[o];else if(S(s)){const a=+o;s=b(s,a)}else if(C(s)){if(i===t.length-2)break;const c=+o,f=+t[++i]==0?"key":"value",h=b(s,c);switch(f){case"key":s=h;break;case"value":s=s.get(h);break}}}const n=t[t.length-1];if(g(s)?s[+n]=r(s[+n]):P(s)&&(s[n]=r(s[n])),S(s)){const i=b(s,+n),o=r(i);i!==o&&(s.delete(i),s.add(o))}if(C(s)){const i=+t[t.length-2],o=b(s,i);switch(+n==0?"key":"value"){case"key":{const c=r(o);s.set(c,s.get(o)),c!==o&&s.delete(o);break}case"value":{s.set(o,r(s.get(o)));break}}}return e},te=e=>e<1;function O(e,t,r,s=[]){if(!e)return;const n=te(r);if(!g(e)){v(e,(a,c)=>O(a,t,r,[...s,...E(c,n)]));return}const[i,o]=e;o&&v(o,(a,c)=>{O(a,t,r,[...s,...E(c,n)])}),t(i,s)}function We(e,t,r,s){return O(t,(n,i)=>{e=M(e,i,o=>$e(o,n,s))},r),e}function Ke(e,t,r){const s=te(r);function n(i,o){const a=qe(e,E(o,s));i.map(c=>E(c,s)).forEach(c=>{e=M(e,c,()=>a)})}if(g(t)){const[i,o]=t;i.forEach(a=>{e=M(e,E(a,s),()=>e)}),o&&v(o,n)}else v(t,n);return e}const Ye=(e,t)=>P(e)||g(e)||C(e)||S(e)||Y(e)||Z(e,t);function Ge(e,t,r){const s=r.get(e);s?s.push(t):r.set(e,[t])}function He(e,t){const r={};let s;return e.forEach(n=>{if(n.length<=1)return;t||(n=n.map(a=>a.map(String)).sort((a,c)=>a.length-c.length));const[i,...o]=n;i.length===0?s=o.map(I):r[I(i)]=o.map(I)}),s?T(r)?[s]:[s,r]:T(r)?void 0:r}const re=(e,t,r,s,n=[],i=[],o=new Map)=>{const a=Ne(e);if(!a){Ge(e,n,t);const u=o.get(e);if(u)return s?{transformedValue:null}:u}if(!Ye(e,r)){const u=z(e,r),m=u?{transformedValue:u.value,annotations:[u.type]}:{transformedValue:e};return a||o.set(e,m),m}if(k(i,e))return{transformedValue:null};const c=z(e,r),f=c?.value??e,h=g(f)?[]:{},p={};v(f,(u,m)=>{if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Detected property ${m}. This is a prototype pollution risk, please remove it from your object.`);const _=re(u,t,r,s,[...n,m],[...i,e],o);h[m]=_.transformedValue,g(_.annotations)?p[A(m)]=_.annotations:P(_.annotations)&&v(_.annotations,(w,we)=>{p[A(m)+"."+we]=w})});const d=T(p)?{transformedValue:h,annotations:c?[c.type]:void 0}:{transformedValue:h,annotations:c?[c.type,p]:p};return a||o.set(e,d),d};function se(e){return Object.prototype.toString.call(e).slice(8,-1)}function F(e){return se(e)==="Array"}function Xe(e){if(se(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Ze(e,t,r,s,n){const i={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";i==="enumerable"&&(e[t]=r),n&&i==="nonenumerable"&&Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0})}function D(e,t={}){if(F(e))return e.map(n=>D(n,t));if(!Xe(e))return e;const r=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...r,...s].reduce((n,i)=>{if(i==="__proto__"||F(t.props)&&!t.props.includes(i))return n;const o=e[i],a=D(o,t);return Ze(n,i,a,e,t.nonenumerable),n},{})}class l{constructor({dedupe:t=!1}={}){this.classRegistry=new Ce,this.symbolRegistry=new q(r=>r.description??""),this.customTransformerRegistry=new Re,this.allowedErrorProps=[],this.dedupe=t}serialize(t){const r=new Map,s=re(t,r,this,this.dedupe),n={json:s.transformedValue};s.annotations&&(n.meta={...n.meta,values:s.annotations});const i=He(r,this.dedupe);return i&&(n.meta={...n.meta,referentialEqualities:i}),n.meta&&(n.meta.v=1),n}deserialize(t,r){const{json:s,meta:n}=t;let i=r?.inPlace?s:D(s);return n?.values&&(i=We(i,n.values,n.v??0,this)),n?.referentialEqualities&&(i=Ke(i,n.referentialEqualities,n.v??0)),i}stringify(t){return JSON.stringify(this.serialize(t))}parse(t){return this.deserialize(JSON.parse(t),{inPlace:!0})}registerClass(t,r){this.classRegistry.register(t,r)}registerSymbol(t,r){this.symbolRegistry.register(t,r)}registerCustom(t,r){this.customTransformerRegistry.register({name:r,...t})}allowErrorProps(...t){this.allowedErrorProps.push(...t)}}l.defaultInstance=new l;l.serialize=l.defaultInstance.serialize.bind(l.defaultInstance);l.deserialize=l.defaultInstance.deserialize.bind(l.defaultInstance);l.stringify=l.defaultInstance.stringify.bind(l.defaultInstance);l.parse=l.defaultInstance.parse.bind(l.defaultInstance);l.registerClass=l.defaultInstance.registerClass.bind(l.defaultInstance);l.registerSymbol=l.defaultInstance.registerSymbol.bind(l.defaultInstance);l.registerCustom=l.defaultInstance.registerCustom.bind(l.defaultInstance);l.allowErrorProps=l.defaultInstance.allowErrorProps.bind(l.defaultInstance);l.serialize;l.deserialize;l.stringify;l.parse;l.registerClass;l.registerCustom;l.registerSymbol;l.allowErrorProps;const Qe=1e4,je=3e3,Je=2e3,et=3e4;class tt{_serverUrl;useWs;baseRetryMs;maxRetryMs;onConnectionChange;token;_trpcClient;_wsClient=null;mirror=null;mirrorInit=null;connected=!1;connectedPromise=null;_systemProxy;_connectionVersion=0;connectionListeners=new Set;constructor(t){this._serverUrl=t.serverUrl.replace(/\/+$/,""),this.token=t.token;const r=typeof window<"u";this.useWs=t.useWebSocket??r,this.onConnectionChange=t.onConnectionChange,this.baseRetryMs=t.retryDelayMs??Je,this.maxRetryMs=t.maxRetryDelayMs??et,this._trpcClient=this.buildTrpcClient(),this._systemProxy=V(this._trpcClient)}get serverUrl(){return this._serverUrl}get connectionVersion(){return this._connectionVersion}subscribeConnectionEvents(t){return this.connectionListeners.add(t),()=>{this.connectionListeners.delete(t)}}emitConnectionEvent(t){try{this.onConnectionChange?.(t)}catch{}for(const r of this.connectionListeners)try{r(t,this._connectionVersion)}catch{}}async awaitConnected(t){if(this.connected)return;if(this.connectedPromise)return this.connectedPromise;const r=t??15e3;this.connectedPromise=(async()=>{const s=this._trpcClient.auth.me.query();Number.isFinite(r)?await new Promise((n,i)=>{const o=setTimeout(()=>i(new Error(`System.awaitConnected: probe timed out after ${r}ms`)),r);s.then(()=>{clearTimeout(o),n()},a=>{clearTimeout(o),i(a instanceof Error?a:new Error(String(a)))})}):await s,this.connected=!0})();try{await this.connectedPromise}finally{this.connectedPromise=null}}async init(t){if(this.mirror?.isReady())return;if(this.mirrorInit)return this.mirrorInit;const r=new Ee(this._trpcClient);return this.mirror=r,this.mirrorInit=(async()=>{await this.awaitConnected(t),await r.init(t)})().finally(()=>{this.mirrorInit=null}),this.mirrorInit}async awaitReady(){if(!this.mirror?.isReady())return this.mirrorInit?this.mirrorInit:this.init()}isReady(){return this.mirror?.isReady()??!1}isConnected(){return this.connected}reconnect(){this.useWs&&(this.emitConnectionEvent("connecting"),this._wsClient?.close(),this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._trpcClient=this.buildTrpcClient(),this._systemProxy=V(this._trpcClient))}switchServerUrl(t){const r=t.replace(/\/+$/,"");r!==this._serverUrl&&(this._serverUrl=r,this.reconnect())}async raceConnectionEndpoints(t){const r=t?.perCandidateTimeoutMs??1500,s=(()=>{try{return new URL(this._serverUrl)}catch{return null}})(),n=s?.port?Number(s.port):s?.protocol==="https:"?443:80,i=s?.protocol==="https:"?"https":"http",a=this._trpcClient.localNetwork?.getConnectionEndpoints;if(!a)return{winner:this._serverUrl,switched:!1};let c=[];try{c=(await a.query({port:n,ipv4Only:t?.ipv4Only,scheme:i})).endpoints}catch{return{winner:this._serverUrl,switched:!1}}if(c.length===0)return{winner:this._serverUrl,switched:!1};const f=await rt(c.map(h=>h.baseUrl),r);return!f||f===this._serverUrl?{winner:f??this._serverUrl,switched:!1}:(this.switchServerUrl(f),{winner:f,switched:!0})}close(){this.disposeMirror(),this.connected=!1,this.connectedPromise=null,this._wsClient?.close()}disposeMirror(){this.mirror?.dispose(),this.mirror=null,this.mirrorInit=null}async login(t,r){const s=await this._trpcClient.auth.login.mutate({username:t,password:r});if(typeof s=="object"&&s!==null&&"token"in s){const n=s.token;typeof n=="string"&&this.setToken(n)}return s}async logout(){await this._trpcClient.auth.logout.mutate()}async getMe(){return await this._trpcClient.auth.me.query()}setToken(t){this.token=t}listDevices(t){return this.mirror?(t?this.mirror.query(t):this.mirror.getAllDevices()).map(s=>this.attachBinding(s)):[]}getDevice(t){const r=this.mirror?.getDeviceById(t)??null;return r?this.attachBinding(r):null}getDeviceByName(t){const r=this.mirror?.getDeviceByName(t)??null;return r?this.attachBinding(r):null}getDeviceByStableId(t){const r=this.mirror?.getDeviceByStableId(t)??null;return r?this.attachBinding(r):null}async waitForDevice(t,r){this.mirror||await this.init();const s=await this.mirror.waitForDevice(t,r??3e4);return this.attachBinding(s)}onDeviceAdded(t){if(!this.mirror)throw new Error("System.onDeviceAdded: call init() before subscribing");return this.mirror.onDeviceAdded(t)}onDeviceRemoved(t){if(!this.mirror)throw new Error("System.onDeviceRemoved: call init() before subscribing");return this.mirror.onDeviceRemoved(t)}attachBinding(t){const r=this.lookupBinding(t.deviceId);if(r===t.binding)return t;const s=t;return s.binding=r,t}lookupBinding(t){return this.mirror?this.mirror.getDeviceById(t)?.binding??null:null}get addonPages(){return this._systemProxy.addonPages}get addonSettings(){return this._systemProxy.addonSettings}get alerts(){return this._systemProxy.alerts}get audioAnalyzer(){return this._systemProxy.audioAnalyzer}get audioCodec(){return this._systemProxy.audioCodec}get backup(){return this._systemProxy.backup}get decoder(){return this._systemProxy.decoder}get deviceManager(){return this._systemProxy.deviceManager}get deviceProvider(){return this._systemProxy.deviceProvider}get deviceState(){return this._systemProxy.deviceState}get metricsProvider(){return this._systemProxy.metricsProvider}get notificationOutput(){return this._systemProxy.notificationOutput}get pipelineExecutor(){return this._systemProxy.pipelineExecutor}get pipelineOrchestrator(){return this._systemProxy.pipelineOrchestrator}get pipelineRunner(){return this._systemProxy.pipelineRunner}get platformProbe(){return this._systemProxy.platformProbe}get recordingEngine(){return this._systemProxy.recordingEngine}get settingsStore(){return this._systemProxy.settingsStore}get storage(){return this._systemProxy.storage}get streamBroker(){return this._systemProxy.streamBroker}get turnProvider(){return this._systemProxy.turnProvider}get userManagement(){return this._systemProxy.userManagement}subscribeEvent(t,r){const s=this._trpcClient.live.onEvent.subscribe({category:t},{onData:n=>{try{r(n)}catch{}}});return()=>{try{s.unsubscribe()}catch{}}}get trpcClient(){return this._trpcClient}get wsClient(){return this._wsClient}buildTrpcClient(){const t=()=>{const r={};return this.token&&(r.Authorization=`Bearer ${this.token}`),r};if(this.useWs){const r=this._serverUrl.replace(/^http/,"ws")+"/trpc",s=this.baseRetryMs,n=this.maxRetryMs;return this._wsClient=_e({url:r,connectionParams:()=>({token:this.token}),retryDelayMs:i=>Math.min(s*Math.pow(2,i),n),keepAlive:{enabled:!0,intervalMs:Qe,pongTimeoutMs:je},onOpen:()=>{this._connectionVersion+=1,this.emitConnectionEvent("connected")},onClose:()=>{this.emitConnectionEvent("disconnected")}}),x({links:[be({client:this._wsClient,transformer:l})]})}return this._wsClient=null,x({links:[ve({url:`${this._serverUrl}/trpc`,headers:t,transformer:l})]})}}function mt(e){return new tt(e)}async function rt(e,t){if(e.length===0)return null;if(typeof fetch!="function")return e[0]??null;const s=typeof window<"u"&&typeof window.location<"u"&&window.location.protocol==="https:"?e.filter(o=>o.toLowerCase().startsWith("https://")):e;if(s.length===0)return null;const n=s.map(()=>new AbortController),i=s.map(async(o,a)=>{const c=n[a],f=setTimeout(()=>c.abort(),t);try{const h=await fetch(`${o.replace(/\/+$/,"")}/trpc/health`,{method:"GET",signal:c.signal,credentials:"omit"});if(!h.ok)throw new Error(`${h.status}`);return o}finally{clearTimeout(f)}});try{const o=await Promise.any(i);for(const a of n)try{a.abort()}catch{}return o}catch{return null}}var ne=(e=>(e.Motion="motion",e.Person="person",e.Vehicle="vehicle",e.Animal="animal",e.Audio="audio",e.Face="face",e.Plate="plate",e.Package="package",e.Doorbell="doorbell",e.Sensor="sensor",e))(ne||{});const ie=["animal","dog_cat","dog","cat","horse","sheep","cow","elephant","bear","zebra","giraffe","mouse","rabbit","deer","lion","tiger","bird","eagle","owl","pigeon","fish","whale","dolphin","snake","turtle","lizard"],oe=["person","people","pedestrian","rider","driver","cyclist","skier","skateboarder","face","hand","head","body"],ae=["vehicle","car","truck","bus","motorcycle","bicycle","van","ambulance","police_car","fire_truck","train","subway","tram","airplane","boat","ship","helicopter"],le=["face","eyes","nose","mouth","ears","eyebrows","left_eye","right_eye","pupil","iris","eyelid","eye_corner","upper_lip","lower_lip","teeth","chin","cheek","forehead","jaw","glasses","sunglasses","facial_hair","beard","mustache","facial_landmark","facial_keypoint"],ce=["plate","license_plate","front_plate","rear_plate","motorcycle_plate","temporary_plate","dealer_plate","licensePlate","plate_number","plate_character","plate_digit","plate_letter","plate_symbol","plate_region","plate_country_identifier","plate_frame","plate_bolt","plate_sticker","plate_validation_tag","damaged_plate","obscured_plate","dirty_plate"],ue=["motion","movement","other"],de=["package","packet"],fe=["audio"],me=["speech","scream","babbling","yell","bellow","whoop","whispering","laughter","snicker","crying","cry","sigh","singing","choir","chant","mantra","child_singing","rapping","humming","groan","grunt","whistling","breathing","wheeze","snoring","gasp","pant","snort","cough","throat_clearing","sneeze","sniff","cheering","applause","chatter","crowd","children_playing","bark","yip","howl","bow-wow","growling","whimper_dog","purr","meow","hiss","caterwaul","pets","livestock","doorbell","ding-dong","door","slam","knock","alarm","telephone","music","dog","dogs"],he=["doorbell","ring"],pe=["lock","binary","flood","entry","door","leak","door_open","flooded","entry_open"],ye={...ie.reduce((e,t)=>({...e,[t]:"animal"}),{}),...oe.reduce((e,t)=>({...e,[t]:"person"}),{}),...ae.reduce((e,t)=>({...e,[t]:"vehicle"}),{}),...ue.reduce((e,t)=>({...e,[t]:"motion"}),{}),...de.reduce((e,t)=>({...e,[t]:"package"}),{}),...le.reduce((e,t)=>({...e,[t]:"face"}),{}),...ce.reduce((e,t)=>({...e,[t]:"plate"}),{}),...fe.reduce((e,t)=>({...e,[t]:"audio"}),{}),...me.reduce((e,t)=>({...e,[t]:"audio"}),{}),...he.reduce((e,t)=>({...e,[t]:"doorbell"}),{}),...pe.reduce((e,t)=>({...e,[t]:"sensor"}),{})},st=e=>le.includes(e),nt=e=>ce.includes(e),ht=e=>ie.includes(e),pt=e=>oe.includes(e),yt=e=>ae.includes(e),gt=e=>ue.includes(e),wt=e=>he.includes(e),_t=e=>de.includes(e),bt=e=>fe.includes(e)||me.includes(e),vt=e=>pe.includes(e),Et=e=>st(e)||nt(e),Pt=e=>ye[e],Ct=e=>{const{className:t}=e,r={face:"person",plate:"vehicle"},s=ye[t];return s&&s!==t?s:r[t]},it=Object.values(ne),L=it.filter(e=>e!=="motion"),ge=["person","doorbell","package"],ot=[...ge,"vehicle","animal","audio","face","plate"],at=[...L];function St(e,t){switch(e){case"critical":return ge;case"important":return ot;case"all":return at;case"custom":return t?.length?t:L;default:return L}}const $={Light:"light",Switch:"switch",WindowCovering:"cover",Lock:"lock",SecuritySystem:"alarm",Buttons:"button",Select:"select",Siren:"siren",Sensor:"sensor",Entry:"entry",Program:"script",MediaPlayer:"media_player",Outlet:"switch",light:"light",switch:"switch",input_boolean:"switch",cover:"cover",lock:"lock",alarm_control_panel:"alarm",input_button:"button",button:"button",input_select:"select",select:"select",siren:"siren",sensor:"sensor",media_player:"media_player",script:"script"},kt={light:"light",switch:"switch",input_boolean:"switch",cover:"cover",lock:"lock",alarm_control_panel:"alarm",input_button:"button",button:"button",input_select:"select",select:"select",siren:"siren",sensor:"sensor",binary_sensor:"sensor",media_player:"media_player",script:"script",climate:"climate",camera:"camera",fan:"fan",vacuum:"vacuum",automation:"automation",scene:"scene",input_number:"sensor",person:"person",device_tracker:"tracker",weather:"weather",water_heater:"climate"},Rt={Light:"light",Switch:"switch",WindowCovering:"cover",Lock:"lock",SecuritySystem:"alarm",Buttons:"button",Select:"select",Siren:"siren",Sensor:"sensor",Entry:"entry",Program:"script",MediaPlayer:"media_player",Camera:"camera",Doorbell:"doorbell",Fan:"fan",Outlet:"switch"};function It(e){const t=$[e];if(t)return t;const r=e.toLowerCase();return $[r]??null}const lt=["Entry","Light","Switch","Lock","SecuritySystem","Buttons","WindowCovering","Siren","Sensor","Select","Program"],Tt=new Set(lt),ct=["light","switch","input_boolean","cover","lock","alarm_control_panel","input_button","button","input_select","select","siren","media_player","script"],At=new Set(ct),N=[{id:"liveStream",label:"Live Stream",sources:{frigate:!0,scrypted:!0,rtsp:!0},adapterMethod:"getLiveStream"},{id:"multiResolution",label:"Multi-Resolution",sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:"getResolutions"},{id:"motion",label:"Motion Detection",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getMotion"},{id:"objectDetection",label:"Object Detection",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getObjectDetections"},{id:"audioVolume",label:"Audio Level",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getAudioVolume"},{id:"audioVolumes",label:"Audio Volumes (dBFS)",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getAudioVolumes"},{id:"ptz",label:"PTZ Control",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getPTZ"},{id:"intercom",label:"Intercom (Mic)",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getIntercomSupport"},{id:"deviceStatus",label:"Device Status",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"getStatus"},{id:"timeline",label:"Detection Timeline",sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:"getCameraDayData"},{id:"clusteredTimeline",label:"Clustered Timeline",sources:{frigate:!0,scrypted:!0,rtsp:!1},requiresBackend:!0,adapterMethod:"getClusteredDayData"},{id:"detectionClasses",label:"Detection Classes",sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:"getDetectionClasses"},{id:"videoClips",label:"Video Clips",sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:"getVideoClips"},{id:"nvrPlayback",label:"NVR Playback",sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:"getNvrPlaybackSupported"},{id:"nvrScrub",label:"NVR Scrub/Seek",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"seekRecordingStream"},{id:"recordingThumbnail",label:"Recording Thumbnails",sources:{frigate:!0,scrypted:!0,rtsp:!1},adapterMethod:"getRecordingStreamThumbnail"},{id:"nvrSeekToLive",label:"Seek to Live",sources:{frigate:!1,scrypted:!0,rtsp:!1},adapterMethod:"seekNvrToLive"}];function Mt(e,t,r){const s=N.find(n=>n.id===e);return!(!s||!s.sources[t]||s.platforms&&s.platforms[r]===!1)}function Ot(e){return N.filter(t=>t.sources[e])}function Dt(){return N.filter(e=>e.requiresBackend)}function Lt(e,t,r){if(e.length===0)return null;const s=t.viewportWidth*t.viewportHeight*(t.pixelRatio??1),n=t.bandwidthMbps??100,i=t.packetLoss??0,o=t.rttMs??50;let a="high";t.maxResolution==="low"||t.isCellular||n<1||i>.05?a="low":t.maxResolution==="medium"||n<5||s<5e5||o>200?a="medium":(t.maxResolution==="high"||s>2e6)&&(a="high");const c={main:"high",sub:"medium",ext:"low"},f=r??"native",h=e.map(d=>{let u=0;const m=c[d.profile]??"medium";if(m===a?u+=100:(a==="high"&&m==="medium"||a==="medium"&&m==="high"||a==="medium"&&m==="low"||a==="low"&&m==="medium")&&(u+=50),d.transport===f?u+=30:d.transport==="native"?u+=20:d.transport==="rtsp"?u+=15:d.transport==="rtmp"&&(u+=10),d.metadata?.width&&d.metadata?.height){const w=d.metadata.width*d.metadata.height/Math.max(s,1);w>=.8&&w<=2?u+=25:w>=.5&&w<=3&&(u+=15),w>4&&n<10&&(u-=20)}return d.metadata?.codec&&(n<5&&d.metadata.codec.includes("265")&&(u+=10),n>=10&&d.metadata.codec.includes("264")&&(u+=5)),{...d,score:u,targetTier:a}});h.sort((d,u)=>u.score-d.score);const p=h[0];return{streamName:p.streamName,profile:p.profile,transport:p.transport,label:p.label,metadata:p.metadata,reason:`${p.targetTier} quality → ${p.profile}/${p.transport} (score: ${p.score})`}}function Nt(e,t){return t?10:e.isCellular||(e.packetLoss??0)>.02?15:30}export{L as DEFAULT_ENABLED_CLASSES,ne as DetectionClass,ct as ELIGIBLE_HA_DOMAINS,At as ELIGIBLE_HA_DOMAINS_SET,lt as ELIGIBLE_SCRYPTED_DEVICE_TYPES,Tt as ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET,N as FEATURE_MATRIX,kt as HA_DOMAIN_TYPE_MAP,$ as RAW_TO_CANONICAL,Rt as SCRYPTED_TYPE_TO_CANONICAL,tt as System,at as TIMELINE_PRESET_ALL,ge as TIMELINE_PRESET_CRITICAL,ot as TIMELINE_PRESET_IMPORTANT,ie as animalClasses,fe as audioClasses,me as audioLabelClasses,mt as createSystem,it as defaultDetectionClasses,ye as detectionClassesDefaultMap,he as doorbellClasses,le as faceClasses,Dt as getBackendRequiredFeatures,It as getCanonicalDeviceType,St as getClassesForTimelinePreset,Nt as getNextEvalInterval,Pt as getParentClass,Ct as getParentDetectionClass,Ot as getSourceFeatures,ht as isAnimalClassname,bt as isAudioClassname,wt as isDoorbellClassname,st as isFaceClassname,Mt as isFeatureAvailable,Et as isLabelDetection,gt as isMotionClassname,_t as isPackageClassname,pt as isPersonClassname,nt as isPlateClassname,vt as isSensorLabelClassname,yt as isVehicleClassname,ce as licensePlateClasses,ue as motionClasses,de as packageClasses,oe as personClasses,rt as raceFastestEndpoint,Lt as selectOptimalStream,pe as sensorLabelClasses,ae as vehicleClasses};
|