@placeos/ts-client 4.2.2 → 4.2.4

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/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var un=function(t,e){return un=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},un(t,e)};function G(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");un(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Be=function(){return Be=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Be.apply(this,arguments)};function Ti(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Ii(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(m){try{l(r.next(m))}catch(b){s(b)}}function c(m){try{l(r.throw(m))}catch(b){s(b)}}function l(m){m.done?o(m.value):i(m.value).then(u,c)}l((r=r.apply(t,e||[])).next())})}function rr(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(l){return function(m){return c([l,m])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){n.label=l[1];break}if(l[0]===6&&n.label<o[1]){n.label=o[1],o=l;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(l);break}o[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(m){l=[6,m],i=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function kt(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function xt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Oe(t){return this instanceof Oe?(this.v=t,this):new Oe(t)}function Mi(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(a){return function(f){return Promise.resolve(f).then(a,b)}}function u(a,f){r[a]&&(i[a]=function(h){return new Promise(function(S,y){o.push([a,h,S,y])>1||c(a,h)})},f&&(i[a]=f(i[a])))}function c(a,f){try{l(r[a](f))}catch(h){p(o[0][3],h)}}function l(a){a.value instanceof Oe?Promise.resolve(a.value.v).then(m,b):p(o[0][2],a)}function m(a){c("next",a)}function b(a){c("throw",a)}function p(a,f){a(f),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Ri(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Ie=="function"?Ie(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(u,c){s=t[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(l){o({value:l,done:u})},s)}}function T(t){return typeof t=="function"}function ir(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var nn=ir(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var un=function(t,e){return un=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},un(t,e)};function G(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");un(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Be=function(){return Be=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Be.apply(this,arguments)};function Pi(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Oi(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(m){try{l(r.next(m))}catch(_){s(_)}}function c(m){try{l(r.throw(m))}catch(_){s(_)}}function l(m){m.done?o(m.value):i(m.value).then(u,c)}l((r=r.apply(t,e||[])).next())})}function tr(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(l){return function(m){return c([l,m])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){n.label=l[1];break}if(l[0]===6&&n.label<o[1]){n.label=o[1],o=l;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(l);break}o[2]&&n.ops.pop(),n.trys.pop();continue}l=e.call(t,n)}catch(m){l=[6,m],i=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function kt(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function xt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}function Oe(t){return this instanceof Oe?(this.v=t,this):new Oe(t)}function Ti(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(a){return function(f){return Promise.resolve(f).then(a,_)}}function u(a,f){r[a]&&(i[a]=function(h){return new Promise(function(S,g){o.push([a,h,S,g])>1||c(a,h)})},f&&(i[a]=f(i[a])))}function c(a,f){try{l(r[a](f))}catch(h){p(o[0][3],h)}}function l(a){a.value instanceof Oe?Promise.resolve(a.value.v).then(m,_):p(o[0][2],a)}function m(a){c("next",a)}function _(a){c("throw",a)}function p(a,f){a(f),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Ei(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Ie=="function"?Ie(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(u,c){s=t[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(l){o({value:l,done:u})},s)}}function E(t){return typeof t=="function"}function nr(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var nn=nr(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
2
2
  `+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function $t(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var be=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=Ie(s),c=u.next();!c.done;c=u.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var m=this.initialTeardown;if(T(m))try{m()}catch(h){o=h instanceof nn?h.errors:[h]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var p=Ie(b),a=p.next();!a.done;a=p.next()){var f=a.value;try{Fn(f)}catch(h){o=o??[],h instanceof nn?o=xt(xt([],kt(o)),kt(h.errors)):o.push(h)}}}catch(h){r={error:h}}finally{try{a&&!a.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(o)throw new nn(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Fn(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&$t(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&$t(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),or=be.EMPTY;function sr(t){return t instanceof be||t&&"closed"in t&&T(t.remove)&&T(t.add)&&T(t.unsubscribe)}function Fn(t){T(t)?t():t.unsubscribe()}var Di={Promise:void 0},qi={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,xt([t,e],kt(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function ur(t){qi.setTimeout(function(){throw t})}function Ln(){}function gt(t){t()}var Rt=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,sr(n)&&n.add(r)):r.destination=Ni,r}return e.create=function(n,r,i){return new cn(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(be),Ui=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){_t(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){_t(r)}else _t(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){_t(n)}},t}(),cn=function(t){G(e,t);function e(n,r,i){var o=t.call(this)||this,s;return T(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Ui(s),o}return e}(Rt);function _t(t){ur(t)}function Ci(t){throw t}var Ni={closed:!0,next:Ln,error:Ci,complete:Ln},dn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function cr(t){return t}function Fi(t){return t.length===0?cr:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var N=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=ji(e)?e:new cn(e,n,r);return gt(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=jn(n),new n(function(i,o){var s=new cn({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[dn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Fi(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=jn(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function jn(t){var e;return(e=t??Di.Promise)!==null&&e!==void 0?e:Promise}function Li(t){return t&&T(t.next)&&T(t.error)&&T(t.complete)}function ji(t){return t&&t instanceof Rt||Li(t)&&sr(t)}function zi(t){return T(t?.lift)}function re(t){return function(e){if(zi(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(t,e,n,r,i){return new Bi(t,e,n,r,i)}var Bi=function(t){G(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(l){try{r(l)}catch(m){n.error(m)}}:t.prototype._next,c._error=o?function(l){try{o(l)}catch(m){n.error(m)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Rt),Hi=ir(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),le=function(t){G(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new an(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Hi},e.prototype.next=function(n){var r=this;gt(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Ie(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(l){i={error:l}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;gt(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;gt(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?or:(this.currentObservers=null,u.push(n),new be(function(){r.currentObservers=null,$t(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new N;return n.source=this,n},e.create=function(n,r){return new an(n,r)},e}(N),an=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:or},e}(le),he=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,o=n._value;if(r)throw i;return this._throwIfClosed(),o},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(le),pn={now:function(){return(pn.delegate||Date).now()},delegate:void 0},rn=function(t){G(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=pn);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return e.prototype.next=function(n){var r=this,i=r.isStopped,o=r._buffer,s=r._infiniteTimeWindow,u=r._timestampProvider,c=r._windowTime;i||(o.push(n),!s&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,o=i._infiniteTimeWindow,s=i._buffer,u=s.slice(),c=0;c<u.length&&!n.closed;c+=o?1:2)n.next(u[c]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,o=n._buffer,s=n._infiniteTimeWindow,u=(s?1:2)*r;if(r<1/0&&u<o.length&&o.splice(0,o.length-u),!s){for(var c=i.now(),l=0,m=1;m<o.length&&o[m]<=c;m+=2)l=m;l&&o.splice(0,l+1)}},e}(le),Wi=function(t){G(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(be),zn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,xt([t,e],kt(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Qi=function(t){G(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var o=this.id,s=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(s,o,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(s,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),zn.setInterval(n.flush.bind(n,this),i)},e.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&zn.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var i=!1,o;try{this.work(n)}catch(s){i=!0,o=s||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,$t(o,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Wi),Bn=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=pn.now,t}(),Zi=function(t){G(e,t);function e(n,r){r===void 0&&(r=Bn.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e}(Bn),ar=new Zi(Qi),Vi=ar,Ki=new N(function(t){return t.complete()});function lr(t){return t&&T(t.schedule)}function Yi(t){return t[t.length-1]}function Ji(t){return lr(Yi(t))?t.pop():void 0}var hr=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function fr(t){return T(t?.then)}function dr(t){return T(t[dn])}function pr(t){return Symbol.asyncIterator&&T(t?.[Symbol.asyncIterator])}function mr(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Gi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var _r=Gi();function yr(t){return T(t?.[_r])}function gr(t){return Mi(this,arguments,function(){var n,r,i,o;return rr(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Oe(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Oe(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Oe(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function vr(t){return T(t?.getReader)}function ie(t){if(t instanceof N)return t;if(t!=null){if(dr(t))return Xi(t);if(hr(t))return eo(t);if(fr(t))return to(t);if(pr(t))return br(t);if(yr(t))return no(t);if(vr(t))return ro(t)}throw mr(t)}function Xi(t){return new N(function(e){var n=t[dn]();if(T(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function eo(t){return new N(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function to(t){return new N(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,ur)})}function no(t){return new N(function(e){var n,r;try{for(var i=Ie(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function br(t){return new N(function(e){io(t,e).catch(function(n){return e.error(n)})})}function ro(t){return br(gr(t))}function io(t,e){var n,r,i,o;return Ii(this,void 0,void 0,function(){var s,u;return rr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Ri(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ye(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function Sr(t,e){return e===void 0&&(e=0),re(function(n,r){n.subscribe(K(r,function(i){return ye(r,t,function(){return r.next(i)},e)},function(){return ye(r,t,function(){return r.complete()},e)},function(i){return ye(r,t,function(){return r.error(i)},e)}))})}function kr(t,e){return e===void 0&&(e=0),re(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function oo(t,e){return ie(t).pipe(kr(e),Sr(e))}function so(t,e){return ie(t).pipe(kr(e),Sr(e))}function uo(t,e){return new N(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function co(t,e){return new N(function(n){var r;return ye(n,e,function(){r=t[_r](),ye(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return T(r?.return)&&r.return()}})}function xr(t,e){if(!t)throw new Error("Iterable cannot be null");return new N(function(n){ye(n,e,function(){var r=t[Symbol.asyncIterator]();ye(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function ao(t,e){return xr(gr(t),e)}function lo(t,e){if(t!=null){if(dr(t))return oo(t,e);if(hr(t))return uo(t,e);if(fr(t))return so(t,e);if(pr(t))return xr(t,e);if(yr(t))return co(t,e);if(vr(t))return ao(t,e)}throw mr(t)}function $r(t,e){return e?lo(t,e):ie(t)}function Hn(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ji(t);return $r(t,n)}function Wn(t,e){var n=T(t)?t:function(){return t},r=function(i){return i.error(n())};return new N(r)}function ho(t){return t instanceof Date&&!isNaN(t)}function E(t,e){return re(function(n,r){var i=0;n.subscribe(K(r,function(o){r.next(t.call(e,o,i++))}))})}function fo(t,e,n,r,i,o,s,u){var c=[],l=0,m=0,b=!1,p=function(){b&&!c.length&&!l&&e.complete()},a=function(h){return l<r?f(h):c.push(h)},f=function(h){l++;var S=!1;ie(n(h,m++)).subscribe(K(e,function(y){e.next(y)},function(){S=!0},void 0,function(){if(S)try{l--;for(var y=function(){var k=c.shift();s||f(k)};c.length&&l<r;)y();p()}catch(k){e.error(k)}}))};return t.subscribe(K(e,a,function(){b=!0,p()})),function(){}}function mn(t,e,n){return n===void 0&&(n=1/0),T(e)?mn(function(r,i){return E(function(o,s){return e(r,o,i,s)})(ie(t(r,i)))},n):(typeof e=="number"&&(n=e),re(function(r,i){return fo(r,i,t,n)}))}function po(t,e,n){t===void 0&&(t=0),n===void 0&&(n=Vi);var r=-1;return e!=null&&(lr(e)?n=e:r=e),new N(function(i){var o=ho(t)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=r?this.schedule(void 0,r):i.complete())},o)})}function mo(t,e){return re(function(n,r){var i=0;n.subscribe(K(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function Ar(t){return t<=0?function(){return Ki}:re(function(e,n){var r=0;e.subscribe(K(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function _o(t){return E(function(){return t})}function yo(t,e){return mn(function(n,r){return ie(t(n,r)).pipe(Ar(1),_o(n))})}function go(t,e){e===void 0&&(e=ar);var n=po(t,e);return yo(function(){return n})}function vo(t,e){return e===void 0&&(e=cr),t=t??bo,re(function(n,r){var i,o=!0;n.subscribe(K(r,function(s){var u=e(s);(o||!t(i,u))&&(o=!1,i=u,r.next(s))}))})}function bo(t,e){return t===e}function So(t){return re(function(e,n){var r,i=!1,o,s=function(){r=e.subscribe(K(n,void 0,void 0,function(u){o||(o=new le,ie(t(o)).subscribe(K(n,function(){return r?s():i=!0}))),o&&o.next(u)})),i&&(r.unsubscribe(),r=null,i=!1,s())};s()})}function Qn(t,e){return re(function(n,r){var i=null,o=0,s=!1,u=function(){return s&&!i&&r.complete()};n.subscribe(K(r,function(c){i?.unsubscribe();var l=0,m=o++;ie(t(c,m)).subscribe(i=K(r,function(b){return r.next(e?e(c,b,m,l++):b)},function(){i=null,u()}))},function(){s=!0,u()}))})}function _n(t,e){e===void 0&&(e={});var n=e.selector,r=Ti(e,["selector"]);return new N(function(i){var o=new AbortController,s=o.signal,u=!0,c=r.signal;if(c)if(c.aborted)o.abort();else{var l=function(){s.aborted||o.abort()};c.addEventListener("abort",l),i.add(function(){return c.removeEventListener("abort",l)})}var m=Be(Be({},r),{signal:s}),b=function(p){u=!1,i.error(p)};return fetch(t,m).then(function(p){n?ie(n(p)).subscribe(K(i,void 0,function(){u=!1,i.complete()},b)):(u=!1,i.next(p),i.complete())}).catch(b),function(){u&&o.abort()}})}const te=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],Zn=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function yt(t){if(t>=Zn.length)throw new Error("Unable to parse base64 string.");const e=Zn[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function wr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4|t[n-1]>>4],e+=te[(t[n-1]&15)<<2|t[n]>>6],e+=te[t[n]&63];return n===r+1&&(e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4|t[n-1]>>4],e+=te[(t[n-1]&15)<<2],e+="="),e}function ko(t){if(t.length%4!==0)throw new Error("Unable to parse base64 string.");const e=t.indexOf("=");if(e!==-1&&e<t.length-2)throw new Error("Unable to parse base64 string.");let n=t.endsWith("==")?2:t.endsWith("=")?1:0,r=t.length,i=new Uint8Array(3*(r/4)),o;for(let s=0,u=0;s<r;s+=4,u+=3)o=yt(t.charCodeAt(s))<<18|yt(t.charCodeAt(s+1))<<12|yt(t.charCodeAt(s+2))<<6|yt(t.charCodeAt(s+3)),i[u]=o>>16,i[u+1]=o>>8&255,i[u+2]=o&255;return i.subarray(0,i.length-n)}function xo(t,e=new TextEncoder){return wr(e.encode(t))}var vt={exports:{}},$o=vt.exports,Vn;function Ao(){return Vn||(Vn=1,function(t){(function(e,n){var r={};n(r);var i=r.default;for(var o in r)i[o]=r[o];t.exports=i})($o,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(p,a,f,h,S){for(var y,k,x,H,q,P,ee,U,F,C,Le,je,mt;S>=64;){for(y=a[0],k=a[1],x=a[2],H=a[3],q=a[4],P=a[5],ee=a[6],U=a[7],C=0;C<16;C++)Le=h+C*4,p[C]=(f[Le]&255)<<24|(f[Le+1]&255)<<16|(f[Le+2]&255)<<8|f[Le+3]&255;for(C=16;C<64;C++)F=p[C-2],je=(F>>>17|F<<15)^(F>>>19|F<<13)^F>>>10,F=p[C-15],mt=(F>>>7|F<<25)^(F>>>18|F<<14)^F>>>3,p[C]=(je+p[C-7]|0)+(mt+p[C-16]|0);for(C=0;C<64;C++)je=(((q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7))+(q&P^~q&ee)|0)+(U+(n[C]+p[C]|0)|0)|0,mt=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&k^y&x^k&x)|0,U=ee,ee=P,P=q,q=H+je|0,H=x,x=k,k=y,y=je+mt|0;a[0]+=y,a[1]+=k,a[2]+=x,a[3]+=H,a[4]+=q,a[5]+=P,a[6]+=ee,a[7]+=U,h+=64,S-=64}return h}var i=function(){function p(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return p.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},p.prototype.clean=function(){for(var a=0;a<this.buffer.length;a++)this.buffer[a]=0;for(var a=0;a<this.temp.length;a++)this.temp[a]=0;this.reset()},p.prototype.update=function(a,f){if(f===void 0&&(f=a.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=f,this.bufferLength>0){for(;this.bufferLength<64&&f>0;)this.buffer[this.bufferLength++]=a[h++],f--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(f>=64&&(h=r(this.temp,this.state,a,h,f),f%=64);f>0;)this.buffer[this.bufferLength++]=a[h++],f--;return this},p.prototype.finish=function(a){if(!this.finished){var f=this.bytesHashed,h=this.bufferLength,S=f/536870912|0,y=f<<3,k=f%64<56?64:128;this.buffer[h]=128;for(var x=h+1;x<k-8;x++)this.buffer[x]=0;this.buffer[k-8]=S>>>24&255,this.buffer[k-7]=S>>>16&255,this.buffer[k-6]=S>>>8&255,this.buffer[k-5]=S>>>0&255,this.buffer[k-4]=y>>>24&255,this.buffer[k-3]=y>>>16&255,this.buffer[k-2]=y>>>8&255,this.buffer[k-1]=y>>>0&255,r(this.temp,this.state,this.buffer,0,k),this.finished=!0}for(var x=0;x<8;x++)a[x*4+0]=this.state[x]>>>24&255,a[x*4+1]=this.state[x]>>>16&255,a[x*4+2]=this.state[x]>>>8&255,a[x*4+3]=this.state[x]>>>0&255;return this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p.prototype._saveState=function(a){for(var f=0;f<this.state.length;f++)a[f]=this.state[f]},p.prototype._restoreState=function(a,f){for(var h=0;h<this.state.length;h++)this.state[h]=a[h];this.bytesHashed=f,this.finished=!1,this.bufferLength=0},p}();e.Hash=i;var o=function(){function p(a){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var f=new Uint8Array(this.blockSize);if(a.length>this.blockSize)new i().update(a).finish(f).clean();else for(var h=0;h<a.length;h++)f[h]=a[h];for(var h=0;h<f.length;h++)f[h]^=54;this.inner.update(f);for(var h=0;h<f.length;h++)f[h]^=106;this.outer.update(f),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<f.length;h++)f[h]=0}return p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var a=0;a<this.istate.length;a++)this.ostate[a]=this.istate[a]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(a){return this.inner.update(a),this},p.prototype.finish=function(a){return this.outer.finished?this.outer.finish(a):(this.inner.finish(a),this.outer.update(a,this.digestLength).finish(a)),this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p}();e.HMAC=o;function s(p){var a=new i().update(p),f=a.digest();return a.clean(),f}e.hash=s,e.default=s;function u(p,a){var f=new o(p).update(a),h=f.digest();return f.clean(),h}e.hmac=u;function c(p,a,f,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");a.reset(),S>1&&a.update(p),f&&a.update(f),a.update(h),a.finish(p),h[0]++}var l=new Uint8Array(e.digestLength);function m(p,a,f,h){a===void 0&&(a=l),h===void 0&&(h=32);for(var S=new Uint8Array([1]),y=u(a,p),k=new o(y),x=new Uint8Array(k.digestLength),H=x.length,q=new Uint8Array(h),P=0;P<h;P++)H===x.length&&(c(x,k,f,S),H=0),q[P]=x[H++];return k.clean(),x.fill(0),S.fill(0),q}e.hkdf=m;function b(p,a,f,h){for(var S=new o(p),y=S.digestLength,k=new Uint8Array(4),x=new Uint8Array(y),H=new Uint8Array(y),q=new Uint8Array(h),P=0;P*y<h;P++){var ee=P+1;k[0]=ee>>>24&255,k[1]=ee>>>16&255,k[2]=ee>>>8&255,k[3]=ee>>>0&255,S.reset(),S.update(a),S.update(k),S.finish(H);for(var U=0;U<y;U++)x[U]=H[U];for(var U=2;U<=f;U++){S.reset(),S.update(H).finish(H);for(var F=0;F<y;F++)x[F]^=H[F]}for(var U=0;U<y&&P*y+U<h;U++)q[P*y+U]=x[U]}for(var P=0;P<y;P++)x[P]=H[P]=0;for(var P=0;P<4;P++)k[P]=0;return S.clean(),q}e.pbkdf2=b})}(vt)),vt.exports}var wo=Ao();const Po=new Int32Array(4);class W{static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new W;static _hex(e){const n=W.hexChars,r=W.hexOut;let i,o,s,u;for(u=0;u<4;u+=1)for(o=u*8,i=e[u],s=0;s<8;s+=2)r[o+1+s]=n.charAt(i&15),i>>>=4,r[o+0+s]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],s=e[3];r+=(i&o|~i&s)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&s|o&~s)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^s)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~s))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(W.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[i++]=o;else if(o<2048)n[i++]=(o>>>6)+192,n[i++]=o&63|128;else if(o<55296||o>56319)n[i++]=(o>>>12)+224,n[i++]=o>>>6&63|128,n[i++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(o>>>18)+240,n[i++]=o>>>12&63|128,n[i++]=o>>>6&63|128,n[i++]=o&63|128}i>=64&&(this._dataLength+=64,W._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e[s++];if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){const n=e.buffer,r=e.state,i=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=(n>>2)+1;this._dataLength+=n;const s=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(W.buffer32Identity.subarray(o),o),n>55&&(W._md5cycle(this._state,i),i.set(W.buffer32Identity)),s<=4294967295)i[14]=s;else{const u=s.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return e?Po:"";const c=parseInt(u[2],16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return W._md5cycle(this._state,i),e?this._state:W._hex(this._state)}}if(W.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const Oo=36e5,Kn=Symbol.for("constructDateFrom");function At(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Kn in t?t[Kn](e):t instanceof Date?new t.constructor(e):new Date(e)}function He(t,e){return At(t,t)}function Eo(t,e,n){const r=He(t);if(isNaN(e))return At(t,NaN);const i=r.getDate(),o=At(t,r.getTime());o.setMonth(r.getMonth()+e+1,0);const s=o.getDate();return i>=s?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function Pr(t,e,n){return At(t,+He(t)+e)}function To(t,e,n){return Pr(t,e*Oo)}function Io(t,e,n){return Pr(t,e*1e3)}function Mo(t,e,n){return Eo(t,e*12)}function Yn(t){return Math.trunc(+He(t)/1e3)}function Ro(t,e){return+He(t)<+He(e)}function d(t,e,n,r="debug",i){if(window.debug){const s=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?ln()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...s,n):console[r](`[PlaceOS][${t}] ${e}`,n):ln()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...s):console[r](`[PlaceOS][${t}] ${e}`)}}function ln(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function yn(){const t=window.location?.hash?window.location?.hash.slice(1):window.location?.href.split("#")[1]||"";let e=window.location?.search?window.location?.search.slice(1):window.location?.href.split("?")[1]||"",n={};if(t)if(t.indexOf("?")>=0){const i=t.split("?");n=Ee(i[0]),e||(e=i[1])}else n=Ee(t);let r={};return e&&(r=Ee(e)),{...n,...r}}function Ee(t){const e={},n=t.split("&");for(const r of n){const i=r.split("=");i[1]&&(e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]))}return e}const Jn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Or(t=40){let e="";for(let n=0;n<t;n++)e+=Jn.charAt(Math.floor(Math.random()*Jn.length));return e}function ce(t){const e=(window.location?.hash||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/#&/g,"#").replace(/&$/g,"#"),n=(window.location?.search||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/\?&/g,"#").replace(/&$/g,"#");window.history?.replaceState&&window.history?.replaceState(null,"",`${window.location?.pathname}${e}${n}`)}function We(t,e=!1){const n=e?1e3:1024;if(t<n)return t+(e?" iB":" B");const r=Math.floor(Math.log(t)/Math.log(n)),i=(e?"kMGTPE":"KMGTPE").charAt(r-1)+(e?"iB":"B");return(t/Math.pow(n,r)).toFixed(2)+" "+i}function Er(t){if(t.length===0)throw new Error("Input must not be of zero length");const e=t.split(","),n={};for(const r of e){const i=r.split(";");if(i.length!==2)throw new Error("Section could not be split on ';'");const o=i[0].replace(/<(.*)>/,"$1").trim(),s=i[1].replace(/rel="(.*)"/,"$1").trim();n[s]=o}return n}function Tr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Ir(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Mr(){return window.location!==window.parent.location}function Rr(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class Do{abort(){d("Stub","Aborted")}}function j(t){let e="";if(t)for(const n in t)t.hasOwnProperty(n)&&t[n]!==void 0&&t[n]!==null&&(e+=`${e?"&":""}${n}=${encodeURIComponent(t[n])}`);return e}const ge={},ze={},ue={};function qo(){for(const t in ge)ge.hasOwnProperty(t)&&Se(t);for(const t in ze)ze.hasOwnProperty(t)&&Uo(t);for(const t in ue)ue.hasOwnProperty(t)&&Co(t)}function ne(t,e,n=300){if(t&&e&&e instanceof Function)Se(t),ge[t]=setTimeout(()=>{e(),delete ge[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Se(t){ge[t]&&(clearTimeout(ge[t]),delete ge[t])}function Uo(t){ze[t]&&(clearInterval(ze[t]),delete ze[t])}function Co(t){ue&&ue[t]&&(ue[t]instanceof be?ue[t].unsubscribe():ue[t](),delete ue[t])}const No={id:"mock-authority",name:"localhost:4200",description:"",domain:"localhost:4200",login_url:"/login?continue={{url}}",logout_url:"/logout",session:!0,production:!1,config:{},version:"2.0.0"};let g={},A,L;const v={};let w="",ve="";const Me=new he(""),Dt=new he("");let gn="/api/engine/v2";const ae=new he(!1),Fo=ae.asObservable();let wt=0;function fe(){return`${`${g.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${g.host||window.location?.host}`}${vn()}`}function vn(){return g.version==="ACA Engine"?"/control/api":gn}function Lo(){return!!g.token_header}function Dr(){return w}function jo(){return g.redirect_uri}function zo(t,e=!0){A.setItem(`${w}_x-api-key`,`${t}`),A.setItem("trusted",`${e}`),qr("x-api-key",Mo(new Date,5).valueOf())}function Ve(){return Et("x-api-key",!1)||""}function qr(t,e=To(new Date,2).valueOf()){g.ignore_api_key&&t==="x-api-key"||(A.setItem(`${w}_expires_at`,`${e}`),A.setItem(`${w}_access_token`,t))}function Z(t=!0){if(g.mock)return"mock-token";if(!A)return"";if(Ve()&&!g.ignore_api_key)return"x-api-key";const e=A.getItem(`${w}_expires_at`)||"",n=Me.getValue();return Ro(+e,new Date)&&(d("Auth","Token expired. Requesting new token..."),Ct(),v.load_authority||(wt+=1,ne("re-authorise",()=>kn().catch(r=>d("Auth",`Failed to get token: ${r}`)),200*Math.min(20,wt))),!t)?"":n||A.getItem(`${w}_access_token`)||""}function Pt(){return Dt.getValue()||A.getItem(`${w}_refresh_token`)||""}function Ot(){return g.host||window.location?.host}function Ur(){return!!Z()}function Cr(){return Me.pipe(E(t=>!!Ur()))}function Qe(){return L}function Bo(){return ae.getValue()}function qt(){return!!g.mock}function Nr(){return!!g.secure}function Ho(){return Fo}function Ut(){return Et("trust")==="true"||Et("trusted")==="true"}function bn(){return!!Ve()&&!g.ignore_api_key||Et("fixed_device")==="true"}function Et(t,e=!0){let r=yn()[t];if(A){const i=`${Dr()}_${t}`;r=r||A.getItem(i)||A.getItem(t)||"",e&&A.setItem(i,`${r}`)}return r}function Wo(t){return g=t||g,g.token_header=g.token_header??Mr(),window.AbortController||(window.AbortController=Do),A=g.storage==="session"?sessionStorage:localStorage,w=W.hashStr(g.redirect_uri,!1),xn()}function Qo(){g={},L=void 0,Me.next(""),Dt.next(""),ae.next(!1),w="",ve="",gn="/api/engine/v2";for(const t in v)t in v&&delete v[t];qo()}function Sn(){return d("Auth","Refreshing authorty."),L=void 0,xn()}function Ct(){d("Auth","Invalidating tokens."),A.removeItem(`${w}_access_token`),A.removeItem(`${w}_expires_at`),Me.getValue()&&Me.next("")}function kn(t,e=L){return v.authorise||(v.authorise=new Promise((n,r)=>{if(!e)return delete v.authorise,r("Authority is not loaded");d("Auth","Authorising user...");const i=()=>{if(Z(!1))d("Auth","Valid token found."),delete v.authorise,n(Z());else{const o=[()=>{d("Auth","Successfully generated token."),n(Z()),delete v.authorise},()=>{d("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete v.authorise,200)}];g&&g.auth_type==="password"?(d("Auth","Logging in with credentials."),ns(g).then(...o),wt=0):ve||Pt()?(d("Auth",`Generating token with ${ve?"code":"refresh token"}`),Lr().then(...o),wt=0):e.session?(d("Auth","Users has session. Authorising application..."),Vo(t).then(...o)):(d("Auth","No user session"),Fr(e),r("No user session"),setTimeout(()=>delete v.authorise,200))}};Yo().then(i,i)})),v.authorise}function Zo(){const t=L?L.logout_url:"/logout";fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+Z()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<A.length;r++){const i=A.key(r);i&&i.indexOf(w)>=0&&A.removeItem(i)}window.location?.assign(n)})}function xn(t=0){return v.load_authority||(v.load_authority=new Promise(e=>{if(ae.next(!1),g.mock){L=No,d("Auth","System in mock mode"),ae.next(!0),e();return}d("Auth",`Fixed: ${bn()} | Trusted: ${Ut()}`),d("Auth","Loading authority...");const n=g.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{d("Auth",`Failed to load authority(${i})`),ae.next(!1),ne("load_authority",()=>{delete v.load_authority,xn(t).then(o=>e())},300*Math.min(20,++t))};_n(`${n?"https:":"http:"}//${Ot()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(s=>s));L=await i.json(),gn=/[2-9]\.[0-9]+\.[0-9]+/g.test(L.version||"")?"/api/engine/v2":"/control/api",d("Auth","Loaded authority.",[],"group"),L&&(d("Auth",`Name: ${L.name}`),d("Auth",`Version: ${L.version}`),d("Auth",`Domain: ${L.domain}`),d("Auth",`Session: ${L.session}`),d("Auth",`Production: ${L.production}`),d("Auth",`Config Keys: ${Object.keys(L.config||{}).length}`)),d("Auth","",[],"groupEnd");const o=()=>{ae.next(!0),d("Auth","Application set online."),e()};delete v.load_authority,kn("").then(o,o)},r)})),v.load_authority}async function Vo(t){const e=Go(t);if(g.use_iframe)return Ko(e);window.location?.assign(e)}function Ko(t){return v.iframe_auth||(v.iframe_auth=new Promise((e,n)=>{d("Auth","Authorizing in an iFrame...");const r=document.createElement("iframe");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.height="1px",r.style.width="1px",r.style.zIndex="-1",r.id="place-authorize",r.src=`${t}`;const i=o=>{if(o.origin===window.location?.origin&&o.data.type==="place-os"){const s=o.data;if(d("Auth","Received credentials from iFrame..."),document.body.removeChild(r),Se("iframe_auth"),window.removeEventListener("message",i),delete v.iframe_auth,s.token)return e(),$n({access_token:s.token,...s});ve=s.code||"",Lr().then(u=>e(u),u=>n(u))}};ne("iframe_auth",()=>{d("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",i),r.onerror=o=>{d("Auth","iFrame error.",o),delete v.iframe_auth,n()},document.body.appendChild(r)})),v.iframe_auth}let Gn=!1;function Fr(t){if(g.handle_login!==!1&&!Gn){d("Auth","Redirecting to login page...");const e=t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href));throw setTimeout(()=>window.location?.assign(e),300),Gn=!0,new Error("Redirecting to login page...")}else d("Auth","Login being handled locally.");delete v.authorise}function Yo(){return v.check_token||(v.check_token=new Promise(async(t,e)=>{Z()?(d("Auth","Valid token found."),t(Z())):(d("Auth","No token. Checking URL for auth credentials..."),await Jo()?t(!0):e()),delete v.check_token})),v.check_token}function Jo(){return v.check_params||(v.check_params=new Promise(t=>{d("Auth","Checking for auth parameters...");let e=yn();if((!e||Object.keys(e).length<=0)&&sessionStorage&&(e=JSON.parse(sessionStorage.getItem("ENGINE.auth.params")||"{}")),e&&(e.code||e.access_token||e.refresh_token)){e.code&&(ve=e.code,ce("code")),e.refresh_token&&(A.setItem(`${w}_refresh_token`,e.refresh_token),ce("refresh_token"));const n=A.getItem(`${w}_nonce`)||"",r=(e.state||"").split(";");ce("state"),ce("token_type");const i=r[0];n===i?($n(e),t(!!e.access_token)):t(!1)}else t(!1);ne("check_params_promise",()=>delete v.check_params,50)})),v.check_params}function Go(t){const e=rs();t=t?`${e};${t}`:e;const n=g?(g.auth_uri||"").indexOf("?")>=0:!1,r=(g?g.auth_uri:null)||"/auth/oauth/authorize",i=Ut()||g.auth_type==="auth_code"?"code":"token";let o=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(w)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(g.redirect_uri)}&scope=${encodeURIComponent(g.scope)}`;if(g.auth_type==="auth_code"){const{challenge:s,verify:u}=Xo();sessionStorage.setItem(`${w}_challenge`,s),o+="&code_challenge_method=S256",o+=`&code_challenge=${u}`}return o}const Xn="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Xo(t=43){const e=new Array(t).fill(0).map(()=>Xn[Math.floor(Math.random()*Xn.length)]).join(""),n=ko(xo(e)),r=wr(wo.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function es(){let e=(g.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(w)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(g.redirect_uri)}`,Pt()){e+=`&refresh_token=${encodeURIComponent(Pt())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(ve)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${w}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${w}_challenge`)),ve=""}return[e,n]}function ts(t){const e=t.token_uri||"/auth/token",n=j({grant_type:"password",client_id:w,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:L?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function Lr(){return jr(...es())}function ns(t){return jr(ts(t))}function jr(t,e=""){return v.generate_tokens||(v.generate_tokens=new Promise((n,r)=>{d("Auth","Generating new token...");const i=o=>{d("Auth","Error generating new tokens.",o),A.removeItem(`${w}_refresh_token`),Dt.next(""),r(),delete v.generate_tokens};_n(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async o=>{if(!o.ok)return i(o);const s=await o.json();$n(s),n(),delete v.generate_tokens},i)})),v.generate_tokens}function $n(t){const e=Io(new Date,Math.max(60,parseInt(t.expires_in,10)-300));d("Auth","Tokens generated storing..."),Ut()&&(t.access_token&&(A.setItem(`${w}_access_token`,t.access_token),ce("access_token")),t.refresh_token&&(A.setItem(`${w}_refresh_token`,t.refresh_token),ce("refresh_token"))),t.expires_in&&(A.setItem(`${w}_expires_at`,`${e.valueOf()}`),ce("expires_in")),ae.next(!0),Me.next(t.access_token||""),Dt.next(t.refresh_token||"")}function rs(){const t=Or();return A.setItem(`${w}_nonce`,t),t}const Nt={};function is(t,e=Nt){zr(t.method,t.path,e);const n=`${t.method}|${t.path}`,r=t.path.replace(/(http|https):\/\/[a-zA-Z0-9.]*:?([0-9]*)?/g,"").replace(/^\//,"").split("/"),i={...t,path_parts:r,path_structure:r.map(o=>o[0]===":"?o.replace(":",""):"")};e[n]=i,d("HTTP(M)",`+ ${t.method} ${t.path}`)}function zr(t,e,n=Nt){const r=`${t}|${e}`;n[r]&&(delete n[r],d("HTTP(M)",`- ${t} ${e}`))}function os(t,e,n,r=Nt){const i=ss(t,e,r);if(i){const o=us(e,i,n);return cs(i,o)}return null}function ss(t,e,n=Nt){const i=e.replace(/(http|https)?:\/\/[a-zA-Z0-9.]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),o=Object.keys(n).reduce((s,u)=>(u.indexOf(`${t}|`)===0&&s.push(n[u]),s),[]);for(const s of o)if(s.path_structure.length===i.length){let u=!0;for(let c=0;c<s.path_structure.length;c++)if(!s.path_structure[c]&&s.path_parts[c]!==i[c]){u=!1;break}if(u)return s}return null}function us(t,e,n){const r=t.replace(/(http|https):\/\/[a-zA-Z0-9.]*:?([0-9]*)?/g,"").split("?"),i=r[0].replace(/^\//g,""),o=r[1]||"",s=Ee(o),u=i.split("/"),c={};for(const m of e.path_structure)m&&(c[m]=u[e.path_structure.indexOf(m)]);const l={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:c,query_params:s,body:n};return d("HTTP(M)",`MATCHED ${l.method}:`,l),l}function cs(t,e){const n=t.callback?t.callback(e):t.metadata,r=t.delay_variance||100,i=t.delay||300,o=Math.floor(Math.random()*r-r/2)+i;return d("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),$r([n]).pipe(go(Math.max(200,o)))}const Br={};function Hr(t,e=Br){return e[t]||{}}function X(t,e,n=Ye){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function ke(t,e,n,r=Ye){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function Re(t,e,n,r=Ye){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function Ke(t,e,n,r=Ye){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function De(t,e,n=Ye){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function as(t,e,n=Br){if(t.headers){const r={};t.headers.forEach?t.headers.forEach((i,o)=>r[o.toLowerCase()]=i):Object.keys(t.headers).forEach(i=>r[i.toLowerCase()]=t.headers[i]),n[t.url||""]=r}switch(e){case"json":return await t.json().catch(()=>({}));case"text":return await t.text()}}const Wr=()=>{Ct(),Sn().then(()=>null,()=>setTimeout(()=>Wr(),1e3))};function Ye(t,e,n,r=qt,i=os,o=as){if(r()){const s=i(t,e,n?.body);if(s)return s}return n.headers=n.headers||{},n.headers["Content-Type"]="application/json",Cr().pipe(mo(s=>s),Ar(1),Qn(s=>(Z()==="x-api-key"?n.headers["X-API-Key"]=Ve():n.headers.Authorization=`Bearer ${Z()}`,_n(e,{...n,body:JSON.stringify(n.body),method:t,credentials:"same-origin"}))),Qn(s=>s.ok?o(s,n.response_type):Wn(s)),So(s=>s.pipe(mn((u,c)=>u.status===511?(Fr(Qe()),Hn(u)):c+1>4||u.status!==401?Wn(u||{}):(d("HTTP","Auth error",u),Wr(),Hn(u))))))}class B{id;name;created_at;updated_at;version;constructor(e={}){this.id=e.id||"",this.name=e.name||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.version=e.version||0}toJSON(){const e={...this};return e.version=this.version,delete e.created_at,Tr(e,[void 0,null,""])}}class Qr extends B{uid;secret;owner_id;scopes;redirect_uri;skip_authorization;preserve_client_id;constructor(e={}){super(e),this.uid=e.uid||"",this.secret=e.secret||"",this.owner_id=e.owner_id||"",this.scopes=e.scopes||"",this.redirect_uri=e.redirect_uri||"",this.skip_authorization=e.skip_authorization||!1,this.preserve_client_id=e.preserve_client_id||!1}}function ls(t){return Zr[t]||0}function hs(t){return Vr[t]||0}let Zr={},Vr={},er="";const Ft=t=>t;function O(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,o=j(e),s=`${i||fe()}${r?"/"+r:""}${o?"?"+o:""}`;return X(s).pipe(E(u=>{const c=fs(s,o,r);return{total:c.total||0,next:c.next?()=>O({query_params:c.next,fn:n,endpoint:i,path:r}):null,data:u&&u instanceof Array?u.map(l=>(n||Ft)(l)):u&&!(u instanceof Array)&&u.results?u.results.map(l=>l):[]}}))}function $(t){const{query_params:e,id:n,path:r,fn:i,options:o}=t,s=j(e),u=`${fe()}/${r}/${n}${s?"?"+s:""}`;return X(u,o).pipe(E(c=>(i||Ft)(c)))}function M(t){const{query_params:e,form_data:n,path:r,fn:i}=t,o=j(e),s=`${fe()}/${r}${o?"?"+o:""}`;return ke(s,n).pipe(E(c=>(i||Ft)(c)))}function _(t){const{id:e,task_name:n,form_data:r,method:i,path:o,callback:s}=t,u=j(r),c=`${fe()}/${o}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?Re:ke)(c,r):(i==="del"?De:X)(`${c}${u?"?"+u:""}`,{response_type:"json"})).pipe(E(m=>(s||(b=>b))(m)))}function R(t){const{id:e,query_params:n,form_data:r,method:i,path:o,fn:s}=t,u=j({...n,version:r.version||0}),c=`${fe()}/${o}/${e}${u?"?"+u:""}`;return(i==="put"?Re:Ke)(c,r).pipe(E(l=>(s||Ft)(l)))}function I(t){const{id:e,query_params:n,path:r}=t,i=j(n),o=`${fe()}/${r}/${e}${i?"?"+i:""}`;return De(o)}function fs(t,e,n){const r=Hr(t[0]==="/"?`${location.origin}${t}`:t),i={total:0,next:null};if(r&&r["x-total-count"]){const o=+(r["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(Zr[n]=o),Vr[n]=o,i.total=o}return r&&r.link&&(er=Er(r.link||"").next,i.next=Ee(er.split("?")[1])),i}const Je="oauth_apps";function Lt(t){return new Qr(t)}function ds(t={}){return O({query_params:t,fn:Lt,path:Je})}function ps(t,e={}){return $({id:t,query_params:e,fn:Lt,path:Je})}function ms(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Lt,path:Je})}function _s(t){return M({form_data:t,query_params:{},fn:Lt,path:Je})}function ys(t,e={}){return I({id:t,query_params:e,path:Je})}var Kr=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(Kr||{});class Yr extends B{id;name;auth_type;description;host;port;tls;username;password;certificate;secret;filters;constructor(e={}){super(),this.id=e.id||"",this.name=e.name||"",this.auth_type=e.auth_type||2,this.description=e.description||"",this.host=e.host||"",this.port=e.port||1883,this.tls=e.tls||!1,this.username=e.username||"",this.password=e.password||"",this.certificate=e.certificate||"",this.secret=e.secret||"",this.filters=e.filters||[]}}const Ge="brokers";function jt(t){return new Yr(t)}function gs(t={}){return O({query_params:t,fn:jt,path:Ge})}function vs(t,e={}){return $({id:t,query_params:e,fn:jt,path:Ge})}function bs(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:jt,path:Ge})}function Ss(t){return M({form_data:t,query_params:{},fn:jt,path:Ge})}function ks(t,e={}){return I({id:t,query_params:e,path:Ge})}class Jr{id;compiled_drivers;available_repositories;running_drivers;module_instances;unavailable_repositories;unavailable_drivers;hostname;cpu_count;core_cpu;total_cpu;memory_total;memory_usage;core_memory;memory_percentage;used_memory;total_memory;edge_nodes;run_counts;constructor(e={}){this.id=e.id||e.core_id||"",this.compiled_drivers=e.compiled_drivers||[],this.available_repositories=e.available_repositories||e.status?.available_repositories||[],this.running_drivers=e.running_drivers||e.status?.running_drivers||0,this.module_instances=e.module_instances||e.status?.module_instances||0,this.unavailable_repositories=e.unavailable_repositories||e.status?.unavailable_repositories||[],this.unavailable_drivers=e.unavailable_drivers||e.status?.unavailable_drivers||[],this.hostname=e.hostname||e.load?.local.hostname||"",this.cpu_count=e.cpu_count||e.load?.local.cpu_count||0,this.core_cpu=e.core_cpu||e.load?.local.core_cpu||0,this.total_cpu=e.total_cpu||e.load?.local.total_cpu||0,this.memory_total=e.memory_total||e.load?.local.memory_total||0,this.memory_usage=e.memory_usage||e.load?.local.memory_usage||0,this.core_memory=e.core_memory||e.load?.local.core_memory||0,this.run_counts=e.run_counts||e.status?.run_counts?.local||{modules:0,drivers:0},this.memory_percentage=+(this.memory_usage/this.memory_total*100).toFixed(4),this.used_memory=We(this.memory_usage*1024),this.total_memory=We(this.memory_total*1024);const n=e.load?.edge||{};this.edge_nodes=e.edge_nodes||Object.keys(n).map(r=>({id:r,...n[r],run_count:e.status?.run_count?.edge[r]||{}}))||[]}}class Gr{cluster_id;id;modules;running;module_instances;last_exit_code;launch_count;launch_time;cpu_usage;memory_total;memory_usage;used_memory;total_memory;constructor(e,n={}){this.cluster_id=e,this.id=n.id||n.driver||"",this.modules=n.modules||[],this.running=n.running||!1,this.module_instances=n.module_instances||n.edge?.status?.module_instances||n.local?.status?.module_instances||0,this.last_exit_code=n.last_exit_code||n.edge?.status?.last_exit_code||n.local?.status?.last_exit_code||0,this.launch_count=n.launch_count||n.edge?.status?.launch_count||n.local?.status?.launch_count||0,this.launch_time=n.launch_time||n.edge?.status?.launch_time||n.local?.status?.launch_time||0,this.cpu_usage=n.cpu_usage||n.percentage_cpu||n.edge?.status?.percentage_cpu||n.local?.status?.percentage_cpu||0,this.memory_total=n.memory_total||n.edge?.status?.memory_total||n.local?.status?.memory_total||0,this.memory_usage=n.memory_usage||n.edge?.status?.memory_usage||n.local?.status?.memory_usage||0,this.used_memory=We(this.memory_usage*1024),this.total_memory=We(this.memory_total*1024)}}const An="cluster";function xs(t){return new Jr(t)}function $s(t={}){return O({query_params:t,fn:xs,path:An})}function As(t,e={}){return $({id:t,query_params:e,fn:n=>n.map(r=>new Gr(t,r)),path:An})}function ws(t,e){return I({id:t,query_params:{driver:e},path:An})}class Xr extends B{domain;login_url;logout_url;description;config;internals;email_domains;constructor(e={}){super(e),this.description=e.description||"",this.domain=e.domain||"",this.login_url=e.login_url||"",this.logout_url=e.logout_url||"",this.config=e.config||{},this.internals=e.internals||{},this.email_domains=e.email_domains||[]}}const Xe="domains";function zt(t){return new Xr(t)}function Ps(t={}){return O({query_params:t,fn:zt,path:Xe})}function Os(t,e={}){return $({id:t,query_params:e,fn:zt,path:Xe})}function Es(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:zt,path:Xe})}function Ts(t){return M({form_data:t,query_params:{},fn:zt,path:Xe})}function Is(t,e={}){return I({id:t,query_params:e,path:Xe})}var xe=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(xe||{});class de extends B{parent_id;updated_at;encryption_level;settings_string;keys;modified_by_id;get value(){return this.settings_string}constructor(e={}){super(e),this.parent_id=e.parent_id||"",this.updated_at=e.updated_at||Math.floor(new Date().getTime()/1e3),this.settings_string=e.settings_string||"",this.encryption_level=e.encryption_level||xe.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var Ze=(t=>(t[t.SSH=0]="SSH",t[t.Device=1]="Device",t[t.Service=2]="Service",t[t.Websocket=3]="Websocket",t[t.Logic=99]="Logic",t))(Ze||{});class wn extends B{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??Ze.Logic,this.default_uri=e.default_uri||"",this.default_port=e.default_port||1,this.ignore_connected=e.ignore_connected||!1,this.class_name=e.class_name||"",this.repository_id=e.repository_id||"",this.file_name=e.file_name||"",this.commit=e.commit||"",this.update_available=e.update_available||!1,this.update_info=e.update_info,this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}))}}const pe="drivers";function Bt(t){return new wn(t)}function Ms(t={}){return O({query_params:t,fn:Bt,path:pe})}function Rs(t,e={}){return $({id:t,query_params:e,fn:Bt,path:pe})}function Ds(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Bt,path:pe})}function qs(t){return M({form_data:t,query_params:{},fn:Bt,path:pe})}function Us(t,e={}){return I({id:t,query_params:e,path:pe})}function Cs(t){return _({id:t,task_name:"recompile",path:pe})}function Ns(t){return _({id:t,task_name:"reload",path:pe})}function Fs(t){return _({id:t,task_name:"compiled",method:"get",path:pe})}class ei extends B{description;secret;x_api_key;online;last_seen;constructor(e={}){super(e),this.description=e.description||"",this.secret=e.secret||"",this.x_api_key=e.x_api_key||"",this.last_seen=(e.last_seen||0)*1e3||Date.now(),this.online=e.online||!1}toJSON(){const e=super.toJSON();return delete e.last_seen,e}}const qe="edges";function Ht(t){return new ei(t)}function Ls(t={}){return O({query_params:t,fn:Ht,path:qe})}function js(t,e={}){return $({id:t,query_params:e,fn:Ht,path:qe})}function zs(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Ht,path:qe})}function Bs(t){return M({form_data:t,query_params:{},fn:Ht,path:qe})}function Hs(t,e={}){return I({id:t,query_params:e,path:qe})}function Ws(t,e={}){return _({id:t,task_name:"token",form_data:e,method:"get",path:qe})}class ti extends B{type="ldap";authority_id;host;port;auth_method;uid;base;bind_dn;password;filter;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.host=e.host||"",this.port=e.port||636,this.auth_method=e.auth_method||"ssl",this.uid=e.uid||"",this.base=e.base||"",this.bind_dn=e.bind_dn||"",this.password=e.password||"",this.filter=e.filter||""}}const et="ldap_auths";function Wt(t){return new ti(t)}function Qs(t={}){return O({query_params:t,fn:Wt,path:et})}function Zs(t,e={}){return $({id:t,query_params:e,fn:Wt,path:et})}function Vs(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Wt,path:et})}function Ks(t){return M({form_data:t,query_params:{},fn:Wt,path:et})}function Ys(t,e={}){return I({id:t,query_params:e,path:et})}class Pn{id;name;description;details;editors;schema;updated_at;modified_by_id;version;constructor(e={}){this.id=e.id||e.parent_id||"",this.name=e.name||"",this.description=e.description||"";try{this.details=(typeof e.details=="string"?JSON.parse(e.details):e.details)||{}}catch{this.details=e.details||{}}this.editors=e.editors||[],this.schema=e.schema||"",this.updated_at=(e.updated_at||0)*1e3||Date.now(),this.modified_by_id=e.modified_by_id||"",this.version=e.version||0}}class $e extends B{system_name;activated_count;description;debounce_period;important;enabled;enable_webhook;exec_enabled;webhook_secret;supported_methods;control_system_id;zone_id;trigger_id;playlists;get system_id(){return this.control_system_id}get actions(){const e=this._actions,n=(e.functions||[]).map(i=>({...i,args:{...i.args}})),r=(e.mailers||[]).map(i=>({...i,emails:[...i.emails]}));return{functions:n,mailers:r}}get conditions(){const e=this._conditions,n=(e.comparisons||[]).map(i=>({...i,left:typeof i.left=="object"?{...i.left}:i.left,right:typeof i.right=="object"?{...i.right}:i.right})),r=(e.time_dependents||[]).map(i=>({...i}));return{comparisons:n,time_dependents:r}}_actions;_conditions;constructor(e={}){super(e),this.description=e.description||"",this._actions=e.actions||{functions:[],mailers:[]},this._conditions=e.conditions||{comparisons:[],time_dependents:[]},this.debounce_period=e.debounce_period||0,this.important=e.important||!1,this.enabled=e.enabled||!1,this.webhook_secret=e.webhook_secret||"",this.control_system_id=e.system_id||e.control_system_id||"",this.zone_id=e.zone_id||"",this.system_name=e.system_name||(e.control_system?e.control_system.name:""),this.enable_webhook=e.enable_webhook||!1,this.exec_enabled=e.exec_enabled||!1,this.supported_methods=e.supported_methods||["POST"],this.activated_count=e.activated_count||e.trigger_count||0,this.playlists=e.playlists||[],this.trigger_id=e.trigger_id||""}}class Qt extends B{settings=[null,null,null,null];description;parent_id;triggers;tags;location;display_name;code;type;count;capacity;map_id;images;timezone;playlists;trigger_list=[];constructor(e={}){super(e),this.description=e.description||"",this.tags=e.tags||[],this.triggers=e.triggers||[],this.settings=e.settings||[null,null,null,null],this.parent_id=e.parent_id||"",this.location=e.location||"",this.display_name=e.display_name||"",this.code=e.code||"",this.type=e.type||"",this.count=e.count||0,this.capacity=e.capacity||0,this.map_id=e.map_id||"",this.timezone=e.timezone||"",this.images=e.images||[],this.playlists=e.playlists||[],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new $e(n)))}}class ni{zone;metadata;keys;constructor(e={}){this.zone=new Qt(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Pn(n[r])}}const Ae="metadata";function tt(t){return new Pn(t)}function Js(t,e={}){return $({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>tt(n[r])),path:Ae})}function Gs(t){const e=[...t],n=[];for(;e.length;){const r=e.pop();Array.isArray(r)?e.push(...r):n.push(r)}return n.reverse()}function Xs(t,e={}){return _({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Gs(Object.keys(n).map(r=>n[r].map(i=>tt(i)))),path:Ae})}function eu(t,e,n={}){return $({id:t,query_params:{...n,name:e},fn:r=>tt(r[e]),path:Ae})}function tu(t,e,n="put"){return R({id:t,form_data:e,query_params:{},method:n,fn:tt,path:Ae})}function nu(t){return M({form_data:t,query_params:{},fn:tt,path:Ae})}function ru(t,e={}){return I({id:t,query_params:e,path:Ae})}function iu(t,e){return _({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new ni({...r,keys:Object.keys(r.metadata)})),path:Ae})}class On extends B{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_url;map_id;modules;images;zones;timezone;module_list=[];signage;playlists;approval;orientation;constructor(e={}){super(e),this.display_name=e.display_name||"",this.description=e.description||"",this.email=e.email||"",this.code=e.code||"",this.capacity=e.capacity||0,this.features=e.features||[],this.bookable=e.bookable||!1,this.public=e.public??!1,this.installed_ui_devices=e.installed_ui_devices||0,this.support_url=e.support_url||"",this.map_id=e.map_id||"",this.modules=e.modules||[],this.images=e.images||[],this.zones=e.zones||[],this.settings=e.settings||[null,null,null,null],this.timezone=e.timezone||"",this.signage=e.signage||!1,this.playlists=e.playlists||[],this.orientation=e.orientation||"unspecified",this.approval=e.approval||!1,typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new En(n)))}}class En extends B{connected;running;updated_at;edge_id;driver_id;driver;control_system_id;system;ip;tls;udp;port;makebreak;uri;custom_name;role;notes;ignore_connected;settings=[null,null,null,null];has_runtime_error;error_timestamp;get system_id(){return this.control_system_id}constructor(e={}){super(e),this.driver_id=e.driver_id||e.dependency_id||"",this.control_system_id=e.control_system_id||"",this.edge_id=e.edge_id||"",this.ip=e.ip||"",this.tls=e.tls||!1,this.udp=e.udp||!1,this.port=e.port||1,this.makebreak=e.makebreak||!1,this.uri=e.uri||"",this.custom_name=e.custom_name||"",this.role=e.role??Ze.Logic,this.notes=e.notes||"",this.ignore_connected=e.ignore_connected||!1,this.connected=e.connected,this.running=e.running||!1,this.updated_at=e.updated_at||0,this.system=new On(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new wn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new de({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==Ze.Logic&&!e||!n.control_system_id)&&delete n.control_system_id,delete n.driver,delete n.system,delete n.error_timestamp,delete n.has_runtime_error,n}}const Y="modules";function Zt(t){return new En(t)}function ou(t={}){return O({query_params:t,fn:Zt,path:Y})}function su(t,e={}){return $({id:t,query_params:e,fn:Zt,path:Y})}function uu(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Zt,path:Y})}function cu(t){return M({form_data:t,query_params:{},fn:Zt,path:Y})}function au(t,e={}){return I({id:t,query_params:e,path:Y})}function lu(t){return _({id:t,task_name:"start",path:Y})}function hu(t){return _({id:t,task_name:"stop",path:Y})}function fu(t){return _({id:t,task_name:"state",method:"get",path:Y})}function du(t,e){return _({id:t,task_name:`state${e}`,method:"get",path:Y})}function pu(t){return _({id:t,task_name:"load",method:"post",path:Y})}function mu(t){return _({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new de(n)),path:Y})}function _u(t){return _({id:t,task_name:"error",method:"get",path:Y})}class ri extends B{type="oauth";authority_id;client_id;client_secret;info_mappings;site;authorize_url;token_method;token_url;auth_scheme;scope;raw_info_url;authorize_params;ensure_matching;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.client_id=e.client_id||"",this.client_secret=e.client_secret||"",this.info_mappings=e.info_mappings||{},this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{},this.site=e.site||"",this.authorize_url=e.authorize_url||"oauth/authorize",this.token_method=e.token_method||"post",this.token_url=e.token_url||"oauth/token",this.auth_scheme=e.auth_scheme||"request_body",this.scope=e.scope||"",this.raw_info_url=e.raw_info_url||"",this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{}}}const nt="oauth_auths";function Vt(t){return new ri(t)}function yu(t={}){return O({query_params:t,fn:Vt,path:nt})}function gu(t,e={}){return $({id:t,query_params:e,fn:Vt,path:nt})}function vu(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Vt,path:nt})}function bu(t){return M({form_data:t,query_params:{},fn:Vt,path:nt})}function Su(t,e={}){return I({id:t,query_params:e,path:nt})}var Tn=(t=>(t.Driver="driver",t.Interface="interface",t))(Tn||{});class ii extends B{folder_name;description;uri;branch;commit_hash;repo_type;username;password;get type(){return this.repo_type}constructor(e={}){super(e),this.folder_name=e.folder_name||"",this.description=e.description||"",this.uri=e.uri||"",this.branch=e.branch||"",this.commit_hash=e.commit_hash||"",this.repo_type=e.repo_type||Tn.Driver,this.username=e.username||"",this.password=e.password||""}}const Q="repositories";function Kt(t){return new ii(t)}function ku(t={}){return O({query_params:t,fn:Kt,path:Q})}function xu(t,e={}){return $({id:t,query_params:e,fn:Kt,path:Q})}function $u(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Kt,path:Q})}function Au(t){return M({form_data:t,query_params:{},fn:Kt,path:Q})}function wu(t,e={}){return I({id:t,query_params:e,path:Q})}function Pu(t={}){return $({id:"interfaces",query_params:t,path:Q})}function Ou(t){return $({id:"remote_default_branch",query_params:t,path:Q})}function Eu(t){return $({id:"remote_branches",query_params:t,path:Q})}function Tu(t){return $({id:"remote_commits",query_params:t,path:Q})}function Iu(t,e){return _({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Mu(t,e){return _({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Ru(t){return _({id:t,task_name:"branches",method:"get",path:Q})}function Du(t){return _({id:t,task_name:"default_branch",method:"get",path:Q})}function qu(t,e){return _({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function Uu(t,e){return _({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}class oi extends B{type="saml";authority_id;issuer;idp_sso_target_url_runtime_params;name_identifier_format;uid_attribute;assertion_consumer_service_url;idp_sso_target_url;idp_cert;idp_cert_fingerprint;attribute_service_name;attribute_statements;request_attributes;idp_slo_target_url;slo_default_relay_state;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.issuer=e.issuer||"",this.idp_sso_target_url_runtime_params=e.idp_sso_target_url_runtime_params||{},this.name_identifier_format=e.name_identifier_format||"",this.uid_attribute=e.uid_attribute||"",this.assertion_consumer_service_url=e.assertion_consumer_service_url||"",this.idp_sso_target_url=e.idp_sso_target_url||"",this.idp_cert=e.idp_cert||"",this.idp_cert_fingerprint=e.idp_cert_fingerprint||"",this.attribute_service_name=e.attribute_service_name||"",this.attribute_statements=e.attribute_statements||{},this.request_attributes=e.request_attributes||[],this.idp_slo_target_url=e.idp_slo_target_url||"",this.slo_default_relay_state=e.slo_default_relay_state||""}}const rt="saml_auths";function Yt(t){return new oi(t)}function Cu(t={}){return O({query_params:t,fn:Yt,path:rt})}function Nu(t,e={}){return $({id:t,query_params:e,fn:Yt,path:rt})}function Fu(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:rt})}function Lu(t){return M({form_data:t,query_params:{},fn:Yt,path:rt})}function ju(t,e={}){return I({id:t,query_params:e,path:rt})}const Ue="settings";function it(t){return new de(t)}function zu(t={}){return O({query_params:t,fn:it,path:Ue})}function Bu(t,e={}){return $({id:t,query_params:e,fn:it,path:Ue})}function Hu(t,e,n={},r="patch"){return R({id:t,form_data:e,query_params:n,method:r,fn:it,path:Ue})}function Wu(t,e={}){return M({form_data:t,query_params:e,fn:it,path:Ue})}function Qu(t,e={}){return I({id:t,query_params:e,path:Ue})}function Zu(t,e={}){return _({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>it(r)),path:Ue})}const D="systems";function we(t){return new On(t)}function Vu(t={}){return O({query_params:t,fn:we,path:D})}function Ku(t={}){return O({query_params:t,fn:we,path:`${D}/with_emails`})}function Yu(t,e={}){return $({id:t,query_params:e,fn:we,path:D})}function Ju(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:we,path:D})}function Gu(t){return M({form_data:t,query_params:{},fn:we,path:D})}function Xu(t,e={}){return I({id:t,query_params:e,path:D})}function ec(t,e,n={}){return _({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>we(r),path:D})}function tc(t,e){return _({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>we(n),path:D})}function nc(t){return _({id:t,task_name:"start",form_data:{},path:D})}function rc(t){return _({id:t,task_name:"stop",path:D})}function ic(t,e,n,r=1,i=[]){return _({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:D})}function oc(t,e,n=1){return _({id:t,task_name:`${e}_${n}`,method:"get",path:D})}function sc(t,e,n=1,r){return _({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:D})}function uc(t,e,n=1){return _({id:t,task_name:`functions/${e}_${n}`,method:"get",path:D})}function cc(t){return O({query_params:{},fn:e=>new Qt(e),path:`${D}/${t}/zones`})}function ac(t){return O({query_params:{},fn:e=>new $e(e),path:`${D}/${t}/triggers`})}function lc(t,e){return _({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new $e(n),path:D})}function hc(t,e){return _({id:t,task_name:`triggers/${e}`,method:"del",path:D})}function fc(t){return _({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new de(n)),path:D})}const Ce="triggers";function Jt(t){return new $e(t)}function dc(t={}){return O({query_params:t,fn:Jt,path:Ce})}function pc(t,e={}){return $({id:t,query_params:e,fn:Jt,path:Ce})}function mc(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:Ce})}function _c(t){return M({form_data:t,query_params:{},fn:Jt,path:Ce})}function yc(t,e={}){return I({id:t,query_params:e,path:Ce})}function gc(t){return _({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new $e(n)),path:Ce})}var si=(t=>(t.EQ="equal",t.NEQ="not_equal",t.GT="greater_than",t.GTE="greater_than_or_equal",t.LT="less_than",t.LTE="less_than_or_equal",t.AND="and",t.OR="or",t.XOR="exclusive_or",t))(si||{}),ui=(t=>(t.AT="at",t.CRON="cron",t))(ui||{}),ci=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(ci||{});class ai extends B{email_digest;authority_id;email;phone;country;building;groups;image;metadata;login_name;staff_id;first_name;last_name;support;sys_admin;ui_theme;card_number;department;work_preferences;work_overrides;photo_upload_id;locatable;password="";confirm_password="";constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.email=e.email||"",this.email_digest=e.email_digest||"",this.phone=e.phone||"",this.country=e.country||"",this.building=e.building||"",this.image=e.image||"",this.metadata=e.metadata||"",this.login_name=e.login_name||"",this.staff_id=e.staff_id||"",this.first_name=e.first_name||"",this.last_name=e.last_name||"",this.support=!!e.support,this.sys_admin=!!e.sys_admin,this.ui_theme=e.ui_theme||"",this.card_number=e.card_number||"",this.groups=e.groups||[],this.department=e.department||"",this.photo_upload_id=e.photo_upload_id||"",this.work_preferences=e.work_preferences||[],this.work_overrides=e.work_overrides||{},this.locatable=e.locatable??!0}}const Ne="users";function ot(t){return new ai(t)}function vc(t={}){return O({query_params:t,fn:ot,path:Ne})}function bc(t,e={}){return $({id:t,query_params:e,fn:ot,path:Ne})}function Sc(t={}){return $({id:"current",query_params:t,fn:ot,path:Ne})}function kc(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:ot,path:Ne})}function xc(t){return M({form_data:t,query_params:{},fn:ot,path:Ne})}function $c(t,e={}){return I({id:t,query_params:e,path:Ne})}const me="zones";function Gt(t){return new Qt(t)}function Ac(t={}){return O({query_params:t,fn:Gt,path:me})}function wc(t={}){return $({id:"tags",query_params:t,fn:e=>e,path:me})}function Pc(t,e={}){return $({id:t,query_params:e,fn:Gt,path:me})}function Oc(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:Gt,path:me})}function Ec(t){return M({form_data:t,query_params:{},fn:Gt,path:me})}function Tc(t,e={}){return I({id:t,query_params:e,path:me})}function Ic(t,e={}){return O({query_params:e,fn:n=>new $e(n),path:`${me}/${t}/triggers`})}function Mc(t,e,n,r=1,i=[]){return _({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:me})}var In=(t=>(t[t.Default=0]="Default",t[t.Cut=1]="Cut",t[t.CrossFade=2]="CrossFade",t[t.SlideTop=3]="SlideTop",t[t.SlideLeft=4]="SlideLeft",t[t.SlideRight=5]="SlideRight",t[t.SlideBottom=6]="SlideBottom",t))(In||{});class li{id;created_at;updated_at;name;description;authority_id;start_time;play_time;video_length;animation;media_type;orientation;media_uri;media_id;thumbnail_id;play_count;valid_from;valid_until;get media_url(){return this.media_id?`/api/engine/v2/uploads/${this.media_id}/url`:this.media_uri}get thumbnail_url(){return`/api/engine/v2/uploads/${this.thumbnail_id}/url`}constructor(e){this.id=e.id||"",this.created_at=e.created_at||Yn(Date.now()),this.updated_at=e.updated_at||Yn(Date.now()),this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.start_time=e.start_time||0,this.play_time=e.play_time||0,this.video_length=e.video_length||0,this.animation=e.animation,this.media_type=e.media_type||"unknown",this.orientation=e.orientation||"unspecified",this.media_uri=e.media_uri||"",this.media_id=e.media_id||"",this.thumbnail_id=e.thumbnail_id||"",this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class Xt{id;playlist_id;items;created_at;updated_at;user_id;user_name;user_email;approved;approved_by_id;approved_by_email;approved_by_name;constructor(e={}){this.id=e.id||"",this.playlist_id=e.playlist_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.items=e.items||[],this.approved=!!e.approved,this.approved_by_id=e.approved_by_id||"",this.approved_by_email=e.approved_by_email||"",this.approved_by_name=e.approved_by_name||"",this.user_id=e.user_id||"",this.user_name=e.user_name||"",this.user_email=e.user_email||""}}class hi{id;created_at;updated_at;name;description;authority_id;orientation;play_count;play_through_count;default_animation;random;enabled;default_duration;play_hours;play_at;play_cron;valid_from;valid_until;constructor(e){this.id=e.id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.orientation=e.orientation||"",this.play_count=e.play_count||0,this.play_through_count=e.play_through_count||0,this.default_animation=e.default_animation||In.Cut,this.random=e.random||!1,this.enabled=e.enabled??!0,this.default_duration=e.default_duration??15*1e3,this.valid_from=e.valid_from,this.valid_until=e.valid_until,this.play_hours=e.play_hours||"",this.play_at=e.play_at||"",this.play_cron=e.play_cron||""}}const fi="signage";function Rc(t,e={},n){return $({id:t,query_params:e,fn:r=>r,path:`${fi}`,options:n})}function Dc(t){return _({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:fi})}const st="signage/media";function en(t){return new li(t)}function qc(t={}){return O({query_params:t,fn:en,path:st})}function Uc(t,e={}){return $({id:t,query_params:e,fn:en,path:st})}function Cc(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:en,path:st})}function Nc(t){return M({form_data:t,query_params:{},fn:en,path:st})}function Fc(t,e={}){return I({id:t,query_params:e,path:st})}const oe="signage/playlists";function tn(t){return new hi(t)}function Lc(t={}){return O({query_params:t,fn:tn,path:oe})}function jc(t,e={}){return $({id:t,query_params:e,fn:tn,path:oe})}function zc(t,e,n="patch"){return R({id:t,form_data:e,query_params:{},method:n,fn:tn,path:oe})}function Bc(t){return M({form_data:t,query_params:{},fn:tn,path:oe})}function Hc(t,e={}){return I({id:t,query_params:e,path:oe})}function Wc(t,e={}){return _({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new Xt(n),path:oe})}function Qc(t,e={}){return _({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new Xt(r)),path:oe})}function Zc(t){return _({id:t,task_name:"media/approve",method:"post",path:oe})}function Vc(t,e){return _({id:t,task_name:"media",form_data:e,method:"post",path:oe,callback:n=>new Xt(n)})}class Mn{id;question_id;survey_id;type;answer_json;constructor(e){this.id=e.id||0,this.question_id=e.question_id||0,this.survey_id=e.survey_id||0,this.type=e.type||"",this.answer_json=e.answer_json||{}}}const di="/api/staff/v1/surveys/answers";function Kc(t={}){const e=j(t);return X(`${di}${e?"?"+e:""}`).pipe(E(n=>n.map(r=>new Mn(r))))}function Yc(t){return ke(`${di}`,t).pipe(E(e=>e.map(n=>new Mn(n))))}class ut{id;survey_id;token;email;sent;constructor(e){this.id=e.id||0,this.survey_id=e.survey_id||0,this.token=e.token||"",this.email=e.email||"",this.sent=e.sent??!1}}const ct="/api/staff/v1/surveys/invitations";function Jc(t={}){const e=j(t);return X(`${ct}${e?"?"+e:""}`).pipe(E(n=>n.map(r=>new ut(r))))}function Gc(t,e={}){const n=j(e);return X(`${ct}/${t}${n?"?"+n:""}`).pipe(E(r=>new ut(r)))}function Xc(t,e,n="patch"){return(n==="put"?Re:Ke)(`${ct}/${t}`,e).pipe(E(r=>new ut(r)))}function ea(t){return ke(`${ct}`,t).pipe(E(e=>new ut(e)))}function ta(t,e={}){const n=j(e);return De(`${ct}/${t}${n?"?"+n:""}`)}class at{id;title;description;type;options;required;max_rating;choices;tags;deleted;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.type=e.type||"",this.options=e.options||{},this.required=e.required||!1,this.max_rating=e.max_rating||0,this.choices=e.choices||[],this.tags=e.tags||[],this.deleted=e.deleted||!1}}const lt="/api/staff/v1/surveys/questions";function na(t={}){const e=j(t);return X(`${lt}${e?"?"+e:""}`).pipe(E(n=>n.map(r=>new at(r))))}function ra(t,e={}){const n=j(e);return X(`${lt}/${t}${n?"?"+n:""}`).pipe(E(r=>new at(r)))}function ia(t){return ke(`${lt}`,t).pipe(E(e=>new at(e)))}function oa(t,e,n="patch"){return(n==="put"?Re:Ke)(`${lt}/${t}`,e).pipe(E(r=>new at(r)))}function sa(t,e={}){const n=j(e);return De(`${lt}/${t}${n?"?"+n:""}`)}class ht{id;title;description;trigger;building_id;zone_id;pages;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.building_id=e.building_id||"",this.zone_id=e.zone_id||"",this.pages=e.pages||[],this.trigger=e.trigger||"NONE"}}const ft="/api/staff/v1/surveys";function ua(t={}){const e=j(t);return X(`${ft}${e?"?"+e:""}`).pipe(E(n=>n.map(r=>new ht(r))))}function ca(t,e={}){const n=j(e);return X(`${ft}/${t}${n?"?"+n:""}`).pipe(E(r=>new ht(r)))}function aa(t,e,n="patch"){return(n==="put"?Re:Ke)(`${ft}/${t}`,e).pipe(E(r=>new ht(r)))}function la(t){return ke(`${ft}`,t).pipe(E(e=>new ht(e)))}function ha(t,e={}){const n=j(e);return De(`${ft}/${t}${n?"?"+n:""}`)}var fa={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},da="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",pa=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof N)i.destination=r,i.source=n;else{var o=i._config=Be({},fa);if(i._output=new le,typeof n=="string")o.url=n;else for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new rn}return i}return e.prototype.lift=function(n){var r=new e(this._config,this.destination);return r.operator=n,r.source=this,r},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new rn),this._output=new le},e.prototype.multiplex=function(n,r,i){var o=this;return new N(function(s){try{o.next(n())}catch(c){s.error(c)}var u=o.subscribe({next:function(c){try{i(c)&&s.next(c)}catch(l){s.error(l)}},error:function(c){return s.error(c)},complete:function(){return s.complete()}});return function(){try{o.next(r())}catch(c){s.error(c)}u.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,r=this._config,i=r.WebSocketCtor,o=r.protocol,s=r.url,u=r.binaryType,c=this._output,l=null;try{l=o?new i(s,o):new i(s),this._socket=l,u&&(this._socket.binaryType=u)}catch(b){c.error(b);return}var m=new be(function(){n._socket=null,l&&l.readyState===1&&l.close()});l.onopen=function(b){var p=n._socket;if(!p){l.close(),n._resetState();return}var a=n._config.openObserver;a&&a.next(b);var f=n.destination;n.destination=Rt.create(function(h){if(l.readyState===1)try{var S=n._config.serializer;l.send(S(h))}catch(y){n.destination.error(y)}},function(h){var S=n._config.closingObserver;S&&S.next(void 0),h&&h.code?l.close(h.code,h.reason):c.error(new TypeError(da)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),l.close(),n._resetState()}),f&&f instanceof rn&&m.add(f.subscribe(n.destination))},l.onerror=function(b){n._resetState(),c.error(b)},l.onclose=function(b){l===n._socket&&n._resetState();var p=n._config.closeObserver;p&&p.next(b),b.wasClean?c.complete():c.error(b)},l.onmessage=function(b){try{var p=n._config.deserializer;c.next(p(b))}catch(a){c.error(a)}}},e.prototype._subscribe=function(n){var r=this,i=this.source;return i?i.subscribe(n):(this._socket||this._connectSocket(),this._output.subscribe(n),n.add(function(){var o=r._socket;r._output.observers.length===0&&(o&&(o.readyState===1||o.readyState===0)&&o.close(),r._resetState())}),n)},e.prototype.unsubscribe=function(){var n=this._socket;n&&(n.readyState===1||n.readyState===0)&&n.close(),this._resetState(),t.prototype.unsubscribe.call(this)},e}(an);function ma(t){return new pa(t)}var J=(t=>(t[t.PARSE_ERROR=0]="PARSE_ERROR",t[t.BAD_REQUEST=1]="BAD_REQUEST",t[t.ACCESS_DENIED=2]="ACCESS_DENIED",t[t.REQUEST_FAILED=3]="REQUEST_FAILED",t[t.UNKNOWN_CMD=4]="UNKNOWN_CMD",t[t.SYS_NOT_FOUND=5]="SYS_NOT_FOUND",t[t.MOD_NOT_FOUND=6]="MOD_NOT_FOUND",t[t.UNEXPECTED_FAILURE=7]="UNEXPECTED_FAILURE",t))(J||{}),Rn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(Rn||{});class pi{constructor(e,n){this._system=e;const r=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(i=>i.startsWith("$"));for(const i in n)n.hasOwnProperty(i)&&n[i]!==void 0&&(n[i]instanceof Function?this.addMethod(i,n[i]):this.addProperty(i,n[i]));for(const i of r)n[i]instanceof Function&&this.addMethod(i,n[i])}call(e,n=[]){return this[`$${e}`]instanceof Function?this[`$${e}`](...n):null}listen(e){return!this[`_${e}`]&&!(this[`_${e}_obs`]instanceof N)&&!this[e]&&this.addProperty(e,null),this[`_${e}_obs`]}addMethod(e,n){e[0]!=="$"&&(e=`$${e}`),this[e]=n}addProperty(e,n){e[0]==="$"&&(e=e.replace("$","")),this[`_${e}`]=new he(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class mi{constructor(e){for(const n in e)e.hasOwnProperty(n)&&e[n]&&e[n]instanceof Array&&e[n].forEach(r=>{this.addModule(n,r)})}addModule(e,n){this[e]||(this[e]=[]),this[e].push(new pi(this,n))}}const Tt={};function _a(t,e){return Tt[t]=new mi(e),Tt[t]}function _i(t){return Tt[t]}function ya(t){delete Tt[t]}const yi=15;let dt=0,V,gi=0;const z={},Dn={},Pe={},ga={},_e=new he(!1);Pe._place_os_status=_e.asObservable();const vi=new he([0,0]);Pe._place_os_sync=vi.asObservable();let bi=Date.now(),Te,It=0,se=null,bt,qn=0;const pt=10*1e3,Un=new le;Pe._place_os_debug_events=Un.asObservable();function St(){return fe().indexOf("/control/")>=0?"/control/websocket":`${vn()}/systems/control`}function Cn(){return _e.getValue()}function Si(){return Pe._place_os_status}function va(){return Pe._place_os_status}function ki(t,e=Dn,n=Pe){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new he(void 0),n[r]=e[r].asObservable()),n[r]}function xi(t,e=Dn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function hn(t,e=0,n=Fe){const r={id:++dt,cmd:"bind",...t};return n(r,e)}function $i(t,e=0,n=Fe){const r={id:++dt,cmd:"unbind",...t};return n(r,e)}function Ai(t,e=pt,n=Fe){const r={id:++dt,cmd:"exec",...t};return n(r,e)}function ba(t,e=pt,n=Fe){const r={id:++dt,cmd:"debug",...t};return n(r,e)}function Sa(t,e=pt,n=Fe){const r={id:++dt,cmd:"ignore",...t};return n(r,e)}function Fe(t,e=pt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Rr()}`;if(z[r])d("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((o,s)=>{const u=()=>{delete z[r],z[r]=null,Fe(t,e,n).then(c=>o(c),c=>s(c))};if(V&&Cn()){qt()&&Oa(t,V,ga),i.resolve=o,i.reject=s;const c=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${c}`,t.args),V.next(t),e>0&&ne(`${r}`,()=>{s("Request timed out."),delete z[r],z[r]=null},e)}else se?setTimeout(()=>u(),1e3):Nn().then(()=>u())}),z[r]=i}return z[r].promise}function wi(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)$a(t.meta,t.value);else if(t.type==="success")ka(t);else if(t.type==="debug"){d("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};Un.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||Rn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?xa(t):t.cmd||d("WS","Invalid websocket message",t,"error");Se(`${t.id}`)}else t==="pong"&&(qn=Date.now(),d("WS","Pong!"))}function ka(t){const e=Object.keys(z).map(n=>z[n]).find(n=>n?.id===t.id);d("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete z[e.key])}function xa(t){let e="UNEXPECTED FAILURE";switch(t.code){case J.ACCESS_DENIED:e="ACCESS DENIED";break;case J.BAD_REQUEST:e="BAD REQUEST";break;case J.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case J.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case J.PARSE_ERROR:e="PARSE ERROR";break;case J.REQUEST_FAILED:e="REQUEST FAILED";break;case J.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}d("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(z).map(r=>z[r]).filter(r=>r).find(r=>r.id===t.id);n&&n.reject&&(n.reject(t),Se(`${n.key}`),delete z[n.key])}function $a(t,e,n=Dn,r=Pe){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new he(null),r[i]=n[i].asObservable());const o=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[NOTIFY] ${o} changed`,[n[i].getValue(),"→",e]),n[i].next(e)}function Nn(t=0){return se==null&&(se=new Promise(e=>{if(t>40)return location.reload();It++,bi=Date.now(),V=qt()?Pa():Aa(),V?(d("WS(Debug)","Authority:",[Qe()]),d("WS","Connecting to websocket..."),V.subscribe(n=>{_e.getValue()||(d("WS","Connection established."),e()),_e.next(!0),It=0,on(),wi(n)},n=>{V=void 0,se=null,nr(),on(),wa(n)},()=>{V=void 0,se=null,nr(),d("WS","Connection closed by browser."),_e.next(!1),Mt()}),Te&&clearInterval(Te),qn=Date.now(),tr(),Te=setInterval(()=>tr(),yi*1e3),on(),gi+=1,bt=setTimeout(()=>{d("WS","Unhealthy connection. Reconnecting..."),_e.next(!1),se=null,Mt()},30*1e3)):(V?d("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!Z(),!!Qe()],"info"):d("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{se=null,Nn(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),se}function Aa(){if(!Qe()||!Z())return null;const t=Nr()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Ot()}${St()}${bn()?"?fixed_device=true":""}`;const n=Z();let r=n==="x-api-key"?`api-key=${Ve()}`:`bearer_token=${n}`;return!Lo()&&!Ir()?(d("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${St()};`,r+=`${t?"secure;":""}samesite=strict`,document.cookie=r,d("WS","Cookies:",[document.cookie,r])):(d("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${r}`),d("WS",`Creating websocket connection to ws${t?"s":""}://${Ot()}${St()}`),ma({url:e,serializer:i=>typeof i=="object"?JSON.stringify(i):i,deserializer:i=>{let o=i.data;if(o==="pong")return o;try{return JSON.parse(i.data)}catch{return o}}})}function Mt(){vi.next([gi,Date.now()-bi]),V&&Cn()&&(V.complete(),Te&&(clearInterval(Te),Te=void 0)),d("WS",`Reconnecting in ${Math.min(5e3,It*300||1e3)}ms...`),ne("reconnect",()=>Nn(),Math.min(5e3,(It+1)*300||1e3))}function tr(){if(Date.now()-qn>4*yi*1e3)return Mt();V?.next("ping")}function wa(t){_e.next(!1),d("WS","Websocket error:",t,void 0,"error"),t.status===401&&Ct(),Sn(),Mt()}function on(){bt&&(clearTimeout(bt),bt=void 0)}function Pa(){const t=new le;return t.subscribe(e=>wi(e)),t}function Oa(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=_i(t.sys),o=i&&i[t.mod]?i[t.mod][t.index-1||0]:null;if(o){switch(t.cmd){case"bind":n[r]=o.listen(t.name).subscribe(s=>{setTimeout(()=>{e.next({type:"notify",value:s,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[r]&&(n[r].unsubscribe(),delete n[r],Se(`${r}`));break}ne(`${t.id}-response`,()=>{const s={id:t.id,type:"success",value:t.cmd==="exec"?o.call(t.name,t.args):null};e.next(s)},10)}else ne(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?J.SYS_NOT_FOUND:J.MOD_NOT_FOUND}),10)}function nr(){for(const t in z)z[t]&&delete z[t]}class fn{constructor(e,n){this._module=e,this.name=n,Si().pipe(vo()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(d("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Se(`rebind:${JSON.stringify(this.binding())}`),d("VAR","Binding dropped due to disconnection, re-binding when possible.",this.binding()),this._stale_bindings=this._binding_count||this._stale_bindings,this._binding_count=0)})}name;_pending=0;_binding_count=0;_stale_bindings=0;get count(){return this._binding_count}get value(){return xi(this.binding())}listen(){return ki(this.binding())}subscribe(e){return this.listen().subscribe(e)}bindThenSubscribe(e){const n=this.bind();return this.listen().subscribe({next:e,complete:()=>n(),error:()=>n()})}bind(){return(this._binding_count<=0&&this._stale_bindings<=0||this._pending===2)&&(this._pending=1,hn(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,$i(this.binding()).then(()=>{this._pending===2&&(this._pending=0),this._binding_count--})):this._binding_count=Math.max(this._binding_count-1,0)}async rebind(){!this._stale_bindings&&this._pending!==1||ne(`rebind:${JSON.stringify(this.binding())}`,async()=>{await hn(this.binding()),this._binding_count=this._stale_bindings||1,this._stale_bindings=0},100)}binding(){return{sys:this._module.system.id,mod:this._module.name,index:this._module.index,name:this.name}}}class Pi{constructor(e,n){this._system=e,this._id=n}_bindings={};get id(){return`${this.name}_${this.index}`}get system(){return this._system}get index(){const n=this._id.split("_").pop();return parseInt(n||"",10)||1}get name(){const e=this._id.split("_");return e.pop(),e.join("_")}binding(e){return this._bindings[e]||(this._bindings[e]=new fn(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new fn(this,e)),this._bindings[e]}execute(e,n,r=pt){return Ai({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class Oi{id;_module_list={};constructor(e){this.id=e}module(e,n=1){if(!e)throw new Error("Invalid module ID");const r=e.split("_");r.length>1&&Number.isInteger(+r[r.length-1])&&(n=+r[r.length-1],r.pop()),n<1&&(n=1);const i=r.join("_");for(this._module_list[i]||(this._module_list[i]=[]);this._module_list[i].length<n;)this._module_list[i].push(new Pi(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const sn={};function Ei(t){return sn[t]||(sn[t]=new Oi(t)),sn[t]}function Ea(t,e,n=1){return Ei(t).module(e,n)}exports.AuthType=Kr;exports.EncryptionLevel=xe;exports.MediaAnimation=In;exports.MockPlaceWebsocketModule=pi;exports.MockPlaceWebsocketSystem=mi;exports.PlaceApplication=Qr;exports.PlaceCluster=Jr;exports.PlaceDomain=Xr;exports.PlaceDriver=wn;exports.PlaceDriverRole=Ze;exports.PlaceEdge=ei;exports.PlaceErrorCodes=J;exports.PlaceLDAPSource=ti;exports.PlaceLogLevel=Rn;exports.PlaceMQTTBroker=Yr;exports.PlaceMetadata=Pn;exports.PlaceModule=En;exports.PlaceModuleBinding=Pi;exports.PlaceOAuthSource=ri;exports.PlaceProcess=Gr;exports.PlaceRepository=ii;exports.PlaceRepositoryType=Tn;exports.PlaceResource=B;exports.PlaceSAMLSource=oi;exports.PlaceSettings=de;exports.PlaceSystem=On;exports.PlaceSystemBinding=Oi;exports.PlaceTrigger=$e;exports.PlaceUser=ai;exports.PlaceVariableBinding=fn;exports.PlaceZone=Qt;exports.PlaceZoneMetadata=ni;exports.SignageMedia=li;exports.SignagePlaylist=hi;exports.SignagePlaylistMedia=Xt;exports.Survey=ht;exports.SurveyAnswer=Mn;exports.SurveyInvitation=ut;exports.SurveyQuestion=at;exports.TriggerConditionOperator=si;exports.TriggerTimeConditionType=ui;exports.TriggerWebhookType=ci;exports.addAnswer=Yc;exports.addApplication=_s;exports.addBroker=Ss;exports.addDomain=Ts;exports.addDriver=qs;exports.addEdge=Bs;exports.addInvitation=ea;exports.addLDAPSource=Ks;exports.addMetadata=nu;exports.addModule=cu;exports.addOAuthSource=bu;exports.addQuestion=ia;exports.addRepository=Au;exports.addSAMLSource=Lu;exports.addSettings=Wu;exports.addSignageMedia=Nc;exports.addSignagePlaylist=Bc;exports.addSurvey=la;exports.addSystem=Gu;exports.addSystemModule=ec;exports.addSystemTrigger=lc;exports.addTrigger=_c;exports.addUser=xc;exports.addZone=Ec;exports.apiEndpoint=fe;exports.apiKey=Ve;exports.approveSignagePlaylist=Zc;exports.authorise=kn;exports.authority=Qe;exports.bind=hn;exports.cleanObject=Tr;exports.cleanupAuth=Qo;exports.clientId=Dr;exports.connectionState=va;exports.consoleHasColours=ln;exports.convertPairStringToMap=Ee;exports.create=M;exports.currentUser=Sc;exports.debug=ba;exports.debug_events=Un;exports.del=De;exports.deregisterMockEndpoint=zr;exports.deregisterSystem=ya;exports.execute=Ai;exports.executeOnSystem=ic;exports.executeOnZone=Mc;exports.functionList=uc;exports.generateNonce=Or;exports.get=X;exports.getFragments=yn;exports.getModule=Ea;exports.getSystem=Ei;exports.hasToken=Ur;exports.host=Ot;exports.httpRoute=vn;exports.humanReadableByteCount=We;exports.ignore=Sa;exports.invalidateToken=Ct;exports.isDriverCompiled=Fs;exports.isFixedDevice=bn;exports.isMobileSafari=Ir;exports.isMock=qt;exports.isNestedFrame=Mr;exports.isOnline=Bo;exports.isSecure=Nr;exports.isTrusted=Ut;exports.is_connected=Cn;exports.lastRequestTotal=hs;exports.listChildMetadata=iu;exports.listInterfaceRepositories=Pu;exports.listMetadata=Js;exports.listMetadataHistory=Xs;exports.listRemoteRepositoryBranches=Eu;exports.listRemoteRepositoryCommits=Tu;exports.listRemoteRepositoryDefaultBranch=Ou;exports.listRepositoryBranches=Ru;exports.listRepositoryCommits=Mu;exports.listRepositoryDefaultBranch=Du;exports.listRepositoryDriverDetails=qu;exports.listRepositoryDrivers=Iu;exports.listSignagePlaylistMedia=Wc;exports.listSignagePlaylistMediaRevisions=Qc;exports.listSystemTriggers=ac;exports.listSystemZones=cc;exports.listTriggerInstances=gc;exports.listZoneTags=wc;exports.listZoneTriggers=Ic;exports.listen=ki;exports.listenForToken=Cr;exports.loadModule=pu;exports.log=d;exports.logout=Zo;exports.lookupModuleState=du;exports.lookupSystemModuleState=sc;exports.mockSystem=_i;exports.moduleRuntimeError=_u;exports.moduleSettings=mu;exports.moduleState=fu;exports.onlineState=Ho;exports.parseLinkHeader=Er;exports.patch=Ke;exports.post=ke;exports.pullRepositoryChanges=Uu;exports.put=Re;exports.query=O;exports.queryAnswers=Kc;exports.queryApplications=ds;exports.queryBrokers=gs;exports.queryClusters=$s;exports.queryDomains=Ps;exports.queryDrivers=Ms;exports.queryEdges=Ls;exports.queryInvitations=Jc;exports.queryLDAPSources=Qs;exports.queryModules=ou;exports.queryOAuthSources=yu;exports.queryProcesses=As;exports.queryQuestions=na;exports.queryRepositories=ku;exports.querySAMLSources=Cu;exports.querySettings=zu;exports.querySignageMedia=qc;exports.querySignagePlaylists=Lc;exports.querySurveys=ua;exports.querySystems=Vu;exports.querySystemsWithEmails=Ku;exports.queryTriggers=dc;exports.queryUsers=vc;exports.queryZones=Ac;exports.recompileDriver=Cs;exports.redirectUri=jo;exports.refreshAuthority=Sn;exports.refreshToken=Pt;exports.registerMockEndpoint=is;exports.registerSystem=_a;exports.reloadDriver=Ns;exports.remove=I;exports.removeApplication=ys;exports.removeBroker=ks;exports.removeDomain=Is;exports.removeDriver=Us;exports.removeEdge=Hs;exports.removeFragment=ce;exports.removeInvitation=ta;exports.removeLDAPSource=Ys;exports.removeMetadata=ru;exports.removeModule=au;exports.removeOAuthSource=Su;exports.removeQuestion=sa;exports.removeRepository=wu;exports.removeSAMLSource=ju;exports.removeSettings=Qu;exports.removeSignageMedia=Fc;exports.removeSignagePlaylist=Hc;exports.removeSurvey=ha;exports.removeSystem=Xu;exports.removeSystemModule=tc;exports.removeSystemTrigger=hc;exports.removeTrigger=yc;exports.removeUser=$c;exports.removeZone=Tc;exports.requestTotal=ls;exports.responseHeaders=Hr;exports.retrieveEdgeToken=Ws;exports.setAPI_Key=zo;exports.setToken=qr;exports.settingsHistory=Zu;exports.setup=Wo;exports.show=$;exports.showApplication=ps;exports.showBroker=vs;exports.showDomain=Os;exports.showDriver=Rs;exports.showEdge=js;exports.showInvitation=Gc;exports.showLDAPSource=Zs;exports.showMetadata=eu;exports.showModule=su;exports.showOAuthSource=gu;exports.showQuestion=ra;exports.showRepository=xu;exports.showSAMLSource=Nu;exports.showSettings=Bu;exports.showSignage=Rc;exports.showSignageMedia=Uc;exports.showSignageMetrics=Dc;exports.showSignagePlaylist=jc;exports.showSurvey=ca;exports.showSystem=Yu;exports.showTrigger=pc;exports.showUser=bc;exports.showZone=Pc;exports.simplifiedTime=Rr;exports.startModule=lu;exports.startSystem=nc;exports.status=Si;exports.stopModule=hu;exports.stopSystem=rc;exports.systemModuleState=oc;exports.systemSettings=fc;exports.terminateProcess=ws;exports.token=Z;exports.unbind=$i;exports.update=R;exports.updateApplication=ms;exports.updateBroker=bs;exports.updateDomain=Es;exports.updateDriver=Ds;exports.updateEdge=zs;exports.updateInvitation=Xc;exports.updateLDAPSource=Vs;exports.updateMetadata=tu;exports.updateModule=uu;exports.updateOAuthSource=vu;exports.updateQuestion=oa;exports.updateRepository=$u;exports.updateSAMLSource=Fu;exports.updateSettings=Hu;exports.updateSignageMedia=Cc;exports.updateSignagePlaylist=zc;exports.updateSignagePlaylistMedia=Vc;exports.updateSurvey=aa;exports.updateSystem=Ju;exports.updateTrigger=mc;exports.updateUser=kc;exports.updateZone=Oc;exports.value=xi;exports.websocketRoute=St;
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function $t(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var be=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=Ie(s),c=u.next();!c.done;c=u.next()){var l=c.value;l.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}else s.remove(this);var m=this.initialTeardown;if(E(m))try{m()}catch(h){o=h instanceof nn?h.errors:[h]}var _=this._finalizers;if(_){this._finalizers=null;try{for(var p=Ie(_),a=p.next();!a.done;a=p.next()){var f=a.value;try{jn(f)}catch(h){o=o??[],h instanceof nn?o=xt(xt([],kt(o)),kt(h.errors)):o.push(h)}}}catch(h){r={error:h}}finally{try{a&&!a.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(o)throw new nn(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)jn(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&$t(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&$t(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),rr=be.EMPTY;function ir(t){return t instanceof be||t&&"closed"in t&&E(t.remove)&&E(t.add)&&E(t.unsubscribe)}function jn(t){E(t)?t():t.unsubscribe()}var Ii={Promise:void 0},Mi={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,xt([t,e],kt(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function or(t){Mi.setTimeout(function(){throw t})}function Fn(){}function gt(t){t()}var Rt=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ir(n)&&n.add(r)):r.destination=qi,r}return e.create=function(n,r,i){return new cn(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(be),Ri=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){_t(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){_t(r)}else _t(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){_t(n)}},t}(),cn=function(t){G(e,t);function e(n,r,i){var o=t.call(this)||this,s;return E(n)||!n?s={next:n??void 0,error:r??void 0,complete:i??void 0}:s=n,o.destination=new Ri(s),o}return e}(Rt);function _t(t){or(t)}function Di(t){throw t}var qi={closed:!0,next:Fn,error:Di,complete:Fn},dn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function pn(t){return t}function Ui(t){return t.length===0?pn:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var M=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,o=Ni(e)?e:new cn(e,n,r);return gt(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Ln(n),new n(function(i,o){var s=new cn({next:function(u){try{e(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});r.subscribe(s)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[dn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Ui(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Ln(e),new e(function(r,i){var o;n.subscribe(function(s){return o=s},function(s){return i(s)},function(){return r(o)})})},t.create=function(e){return new t(e)},t}();function Ln(t){var e;return(e=t??Ii.Promise)!==null&&e!==void 0?e:Promise}function Ci(t){return t&&E(t.next)&&E(t.error)&&E(t.complete)}function Ni(t){return t&&t instanceof Rt||Ci(t)&&ir(t)}function ji(t){return E(t?.lift)}function re(t){return function(e){if(ji(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function K(t,e,n,r,i){return new Fi(t,e,n,r,i)}var Fi=function(t){G(e,t);function e(n,r,i,o,s,u){var c=t.call(this,n)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=r?function(l){try{r(l)}catch(m){n.error(m)}}:t.prototype._next,c._error=o?function(l){try{o(l)}catch(m){n.error(m)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(l){n.error(l)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(Rt),Li=nr(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ge=function(t){G(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new an(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new Li},e.prototype.next=function(n){var r=this;gt(function(){var i,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var s=Ie(r.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(n)}}catch(l){i={error:l}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;gt(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;gt(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?rr:(this.currentObservers=null,u.push(n),new be(function(){r.currentObservers=null,$t(u,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new M;return n.source=this,n},e.create=function(n,r){return new an(n,r)},e}(M),an=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:rr},e}(ge),le=function(t){G(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,o=n._value;if(r)throw i;return this._throwIfClosed(),o},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(ge),mn={now:function(){return(mn.delegate||Date).now()},delegate:void 0},rn=function(t){G(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=mn);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return e.prototype.next=function(n){var r=this,i=r.isStopped,o=r._buffer,s=r._infiniteTimeWindow,u=r._timestampProvider,c=r._windowTime;i||(o.push(n),!s&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,o=i._infiniteTimeWindow,s=i._buffer,u=s.slice(),c=0;c<u.length&&!n.closed;c+=o?1:2)n.next(u[c]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,o=n._buffer,s=n._infiniteTimeWindow,u=(s?1:2)*r;if(r<1/0&&u<o.length&&o.splice(0,o.length-u),!s){for(var c=i.now(),l=0,m=1;m<o.length&&o[m]<=c;m+=2)l=m;l&&o.splice(0,l+1)}},e}(ge),zi=function(t){G(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(be),zn={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,xt([t,e],kt(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Bi=function(t){G(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var o=this.id,s=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(s,o,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(s,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),zn.setInterval(n.flush.bind(n,this),i)},e.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&zn.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var i=!1,o;try{this.work(n)}catch(s){i=!0,o=s||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,$t(o,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(zi),Bn=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=mn.now,t}(),Hi=function(t){G(e,t);function e(n,r){r===void 0&&(r=Bn.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e}(Bn),sr=new Hi(Bi),Wi=sr,Qi=new M(function(t){return t.complete()});function Zi(t){return t&&E(t.schedule)}var ur=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function cr(t){return E(t?.then)}function ar(t){return E(t[dn])}function lr(t){return Symbol.asyncIterator&&E(t?.[Symbol.asyncIterator])}function hr(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Vi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var fr=Vi();function dr(t){return E(t?.[fr])}function pr(t){return Ti(this,arguments,function(){var n,r,i,o;return tr(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Oe(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,Oe(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Oe(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function mr(t){return E(t?.getReader)}function ie(t){if(t instanceof M)return t;if(t!=null){if(ar(t))return Ki(t);if(ur(t))return Yi(t);if(cr(t))return Ji(t);if(lr(t))return _r(t);if(dr(t))return Gi(t);if(mr(t))return Xi(t)}throw hr(t)}function Ki(t){return new M(function(e){var n=t[dn]();if(E(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Yi(t){return new M(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Ji(t){return new M(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,or)})}function Gi(t){return new M(function(e){var n,r;try{for(var i=Ie(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function _r(t){return new M(function(e){eo(t,e).catch(function(n){return e.error(n)})})}function Xi(t){return _r(pr(t))}function eo(t,e){var n,r,i,o;return Oi(this,void 0,void 0,function(){var s,u;return tr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Ei(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function _e(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var o=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(o),!i)return o}function yr(t,e){return e===void 0&&(e=0),re(function(n,r){n.subscribe(K(r,function(i){return _e(r,t,function(){return r.next(i)},e)},function(){return _e(r,t,function(){return r.complete()},e)},function(i){return _e(r,t,function(){return r.error(i)},e)}))})}function gr(t,e){return e===void 0&&(e=0),re(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function to(t,e){return ie(t).pipe(gr(e),yr(e))}function no(t,e){return ie(t).pipe(gr(e),yr(e))}function ro(t,e){return new M(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function io(t,e){return new M(function(n){var r;return _e(n,e,function(){r=t[fr](),_e(n,e,function(){var i,o,s;try{i=r.next(),o=i.value,s=i.done}catch(u){n.error(u);return}s?n.complete():n.next(o)},0,!0)}),function(){return E(r?.return)&&r.return()}})}function vr(t,e){if(!t)throw new Error("Iterable cannot be null");return new M(function(n){_e(n,e,function(){var r=t[Symbol.asyncIterator]();_e(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function oo(t,e){return vr(pr(t),e)}function so(t,e){if(t!=null){if(ar(t))return to(t,e);if(ur(t))return ro(t,e);if(cr(t))return no(t,e);if(lr(t))return vr(t,e);if(dr(t))return io(t,e);if(mr(t))return oo(t,e)}throw hr(t)}function uo(t,e){return e?so(t,e):ie(t)}function co(t,e){var n=E(t)?t:function(){return t},r=function(i){return i.error(n())};return new M(r)}function ao(t){return t instanceof Date&&!isNaN(t)}function T(t,e){return re(function(n,r){var i=0;n.subscribe(K(r,function(o){r.next(t.call(e,o,i++))}))})}function lo(t,e,n,r,i,o,s,u){var c=[],l=0,m=0,_=!1,p=function(){_&&!c.length&&!l&&e.complete()},a=function(h){return l<r?f(h):c.push(h)},f=function(h){l++;var S=!1;ie(n(h,m++)).subscribe(K(e,function(g){e.next(g)},function(){S=!0},void 0,function(){if(S)try{l--;for(var g=function(){var k=c.shift();s||f(k)};c.length&&l<r;)g();p()}catch(k){e.error(k)}}))};return t.subscribe(K(e,a,function(){_=!0,p()})),function(){}}function br(t,e,n){return n===void 0&&(n=1/0),E(e)?br(function(r,i){return T(function(o,s){return e(r,o,i,s)})(ie(t(r,i)))},n):(typeof e=="number"&&(n=e),re(function(r,i){return lo(r,i,t,n)}))}function Sr(t,e,n){t===void 0&&(t=0),n===void 0&&(n=Wi);var r=-1;return e!=null&&(Zi(e)?n=e:r=e),new M(function(i){var o=ao(t)?+t-n.now():t;o<0&&(o=0);var s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=r?this.schedule(void 0,r):i.complete())},o)})}function ho(t,e){return re(function(n,r){var i=0;n.subscribe(K(r,function(o){return t.call(e,o,i++)&&r.next(o)}))})}function kr(t){return t<=0?function(){return Qi}:re(function(e,n){var r=0;e.subscribe(K(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function fo(t){return T(function(){return t})}function po(t,e){return br(function(n,r){return ie(t(n,r)).pipe(kr(1),fo(n))})}function mo(t,e){e===void 0&&(e=sr);var n=Sr(t,e);return po(function(){return n})}function _o(t,e){return e===void 0&&(e=pn),t=t??yo,re(function(n,r){var i,o=!0;n.subscribe(K(r,function(s){var u=e(s);(o||!t(i,u))&&(o=!1,i=u,r.next(s))}))})}function yo(t,e){return t===e}function go(t){t===void 0&&(t=1/0);var e;t&&typeof t=="object"?e=t:e={count:t};var n=e.count,r=n===void 0?1/0:n,i=e.delay,o=e.resetOnSuccess,s=o===void 0?!1:o;return r<=0?pn:re(function(u,c){var l=0,m,_=function(){var p=!1;m=u.subscribe(K(c,function(a){s&&(l=0),c.next(a)},void 0,function(a){if(l++<r){var f=function(){m?(m.unsubscribe(),m=null,_()):p=!0};if(i!=null){var h=typeof i=="number"?Sr(i):ie(i(a,l)),S=K(c,function(){S.unsubscribe(),f()},function(){c.complete()});h.subscribe(S)}else f()}else c.error(a)})),p&&(m.unsubscribe(),m=null,_())};_()})}function Hn(t,e){return re(function(n,r){var i=null,o=0,s=!1,u=function(){return s&&!i&&r.complete()};n.subscribe(K(r,function(c){i?.unsubscribe();var l=0,m=o++;ie(t(c,m)).subscribe(i=K(r,function(_){return r.next(e?e(c,_,m,l++):_)},function(){i=null,u()}))},function(){s=!0,u()}))})}function _n(t,e){e===void 0&&(e={});var n=e.selector,r=Pi(e,["selector"]);return new M(function(i){var o=new AbortController,s=o.signal,u=!0,c=r.signal;if(c)if(c.aborted)o.abort();else{var l=function(){s.aborted||o.abort()};c.addEventListener("abort",l),i.add(function(){return c.removeEventListener("abort",l)})}var m=Be(Be({},r),{signal:s}),_=function(p){u=!1,i.error(p)};return fetch(t,m).then(function(p){n?ie(n(p)).subscribe(K(i,void 0,function(){u=!1,i.complete()},_)):(u=!1,i.next(p),i.complete())}).catch(_),function(){u&&o.abort()}})}const te=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],Wn=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function yt(t){if(t>=Wn.length)throw new Error("Unable to parse base64 string.");const e=Wn[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function xr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4|t[n-1]>>4],e+=te[(t[n-1]&15)<<2|t[n]>>6],e+=te[t[n]&63];return n===r+1&&(e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=te[t[n-2]>>2],e+=te[(t[n-2]&3)<<4|t[n-1]>>4],e+=te[(t[n-1]&15)<<2],e+="="),e}function vo(t){if(t.length%4!==0)throw new Error("Unable to parse base64 string.");const e=t.indexOf("=");if(e!==-1&&e<t.length-2)throw new Error("Unable to parse base64 string.");let n=t.endsWith("==")?2:t.endsWith("=")?1:0,r=t.length,i=new Uint8Array(3*(r/4)),o;for(let s=0,u=0;s<r;s+=4,u+=3)o=yt(t.charCodeAt(s))<<18|yt(t.charCodeAt(s+1))<<12|yt(t.charCodeAt(s+2))<<6|yt(t.charCodeAt(s+3)),i[u]=o>>16,i[u+1]=o>>8&255,i[u+2]=o&255;return i.subarray(0,i.length-n)}function bo(t,e=new TextEncoder){return xr(e.encode(t))}var vt={exports:{}},So=vt.exports,Qn;function ko(){return Qn||(Qn=1,function(t){(function(e,n){var r={};n(r);var i=r.default;for(var o in r)i[o]=r[o];t.exports=i})(So,function(e){e.__esModule=!0,e.digestLength=32,e.blockSize=64;var n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(p,a,f,h,S){for(var g,k,x,H,U,P,ee,C,j,N,Fe,Le,mt;S>=64;){for(g=a[0],k=a[1],x=a[2],H=a[3],U=a[4],P=a[5],ee=a[6],C=a[7],N=0;N<16;N++)Fe=h+N*4,p[N]=(f[Fe]&255)<<24|(f[Fe+1]&255)<<16|(f[Fe+2]&255)<<8|f[Fe+3]&255;for(N=16;N<64;N++)j=p[N-2],Le=(j>>>17|j<<15)^(j>>>19|j<<13)^j>>>10,j=p[N-15],mt=(j>>>7|j<<25)^(j>>>18|j<<14)^j>>>3,p[N]=(Le+p[N-7]|0)+(mt+p[N-16]|0);for(N=0;N<64;N++)Le=(((U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&P^~U&ee)|0)+(C+(n[N]+p[N]|0)|0)|0,mt=((g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10))+(g&k^g&x^k&x)|0,C=ee,ee=P,P=U,U=H+Le|0,H=x,x=k,k=g,g=Le+mt|0;a[0]+=g,a[1]+=k,a[2]+=x,a[3]+=H,a[4]+=U,a[5]+=P,a[6]+=ee,a[7]+=C,h+=64,S-=64}return h}var i=function(){function p(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return p.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},p.prototype.clean=function(){for(var a=0;a<this.buffer.length;a++)this.buffer[a]=0;for(var a=0;a<this.temp.length;a++)this.temp[a]=0;this.reset()},p.prototype.update=function(a,f){if(f===void 0&&(f=a.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var h=0;if(this.bytesHashed+=f,this.bufferLength>0){for(;this.bufferLength<64&&f>0;)this.buffer[this.bufferLength++]=a[h++],f--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(f>=64&&(h=r(this.temp,this.state,a,h,f),f%=64);f>0;)this.buffer[this.bufferLength++]=a[h++],f--;return this},p.prototype.finish=function(a){if(!this.finished){var f=this.bytesHashed,h=this.bufferLength,S=f/536870912|0,g=f<<3,k=f%64<56?64:128;this.buffer[h]=128;for(var x=h+1;x<k-8;x++)this.buffer[x]=0;this.buffer[k-8]=S>>>24&255,this.buffer[k-7]=S>>>16&255,this.buffer[k-6]=S>>>8&255,this.buffer[k-5]=S>>>0&255,this.buffer[k-4]=g>>>24&255,this.buffer[k-3]=g>>>16&255,this.buffer[k-2]=g>>>8&255,this.buffer[k-1]=g>>>0&255,r(this.temp,this.state,this.buffer,0,k),this.finished=!0}for(var x=0;x<8;x++)a[x*4+0]=this.state[x]>>>24&255,a[x*4+1]=this.state[x]>>>16&255,a[x*4+2]=this.state[x]>>>8&255,a[x*4+3]=this.state[x]>>>0&255;return this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p.prototype._saveState=function(a){for(var f=0;f<this.state.length;f++)a[f]=this.state[f]},p.prototype._restoreState=function(a,f){for(var h=0;h<this.state.length;h++)this.state[h]=a[h];this.bytesHashed=f,this.finished=!1,this.bufferLength=0},p}();e.Hash=i;var o=function(){function p(a){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var f=new Uint8Array(this.blockSize);if(a.length>this.blockSize)new i().update(a).finish(f).clean();else for(var h=0;h<a.length;h++)f[h]=a[h];for(var h=0;h<f.length;h++)f[h]^=54;this.inner.update(f);for(var h=0;h<f.length;h++)f[h]^=106;this.outer.update(f),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var h=0;h<f.length;h++)f[h]=0}return p.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},p.prototype.clean=function(){for(var a=0;a<this.istate.length;a++)this.ostate[a]=this.istate[a]=0;this.inner.clean(),this.outer.clean()},p.prototype.update=function(a){return this.inner.update(a),this},p.prototype.finish=function(a){return this.outer.finished?this.outer.finish(a):(this.inner.finish(a),this.outer.update(a,this.digestLength).finish(a)),this},p.prototype.digest=function(){var a=new Uint8Array(this.digestLength);return this.finish(a),a},p}();e.HMAC=o;function s(p){var a=new i().update(p),f=a.digest();return a.clean(),f}e.hash=s,e.default=s;function u(p,a){var f=new o(p).update(a),h=f.digest();return f.clean(),h}e.hmac=u;function c(p,a,f,h){var S=h[0];if(S===0)throw new Error("hkdf: cannot expand more");a.reset(),S>1&&a.update(p),f&&a.update(f),a.update(h),a.finish(p),h[0]++}var l=new Uint8Array(e.digestLength);function m(p,a,f,h){a===void 0&&(a=l),h===void 0&&(h=32);for(var S=new Uint8Array([1]),g=u(a,p),k=new o(g),x=new Uint8Array(k.digestLength),H=x.length,U=new Uint8Array(h),P=0;P<h;P++)H===x.length&&(c(x,k,f,S),H=0),U[P]=x[H++];return k.clean(),x.fill(0),S.fill(0),U}e.hkdf=m;function _(p,a,f,h){for(var S=new o(p),g=S.digestLength,k=new Uint8Array(4),x=new Uint8Array(g),H=new Uint8Array(g),U=new Uint8Array(h),P=0;P*g<h;P++){var ee=P+1;k[0]=ee>>>24&255,k[1]=ee>>>16&255,k[2]=ee>>>8&255,k[3]=ee>>>0&255,S.reset(),S.update(a),S.update(k),S.finish(H);for(var C=0;C<g;C++)x[C]=H[C];for(var C=2;C<=f;C++){S.reset(),S.update(H).finish(H);for(var j=0;j<g;j++)x[j]^=H[j]}for(var C=0;C<g&&P*g+C<h;C++)U[P*g+C]=x[C]}for(var P=0;P<g;P++)x[P]=H[P]=0;for(var P=0;P<4;P++)k[P]=0;return S.clean(),U}e.pbkdf2=_})}(vt)),vt.exports}var xo=ko();const $o=new Int32Array(4);class W{static hashStr(e,n=!1){return this.onePassHasher.start().appendStr(e).end(n)}static hashAsciiStr(e,n=!1){return this.onePassHasher.start().appendAsciiStr(e).end(n)}static stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new W;static _hex(e){const n=W.hexChars,r=W.hexOut;let i,o,s,u;for(u=0;u<4;u+=1)for(o=u*8,i=e[u],s=0;s<8;s+=2)r[o+1+s]=n.charAt(i&15),i>>>=4,r[o+0+s]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],o=e[2],s=e[3];r+=(i&o|~i&s)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[1]-389564586|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[2]+606105819|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[5]+1200080426|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[9]-1958414417|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[10]-42063|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+o|0,r+=(i&o|~i&s)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,s+=(r&i|~r&o)+n[13]-40341101|0,s=(s<<12|s>>>20)+r|0,o+=(s&r|~s&i)+n[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,i+=(o&s|~o&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+o|0,r+=(i&s|o&~s)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[6]-1069501632|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[11]+643717713|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[10]+38016083|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[15]-660478335|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[14]-1019803690|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[3]-187363961|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+o|0,r+=(i&s|o&~s)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,s+=(r&o|i&~o)+n[2]-51403784|0,s=(s<<9|s>>>23)+r|0,o+=(s&i|r&~i)+n[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,i+=(o&r|s&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+o|0,r+=(i^o^s)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[8]-2022574463|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[4]+1272893353|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[7]-155497632|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[0]-358537222|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[3]-722521979|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+o|0,r+=(i^o^s)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,s+=(r^i^o)+n[12]-421815835|0,s=(s<<11|s>>>21)+r|0,o+=(s^r^i)+n[15]+530742520|0,o=(o<<16|o>>>16)+s|0,i+=(o^s^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+o|0,r+=(o^(i|~s))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[7]+1126891415|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[3]-1894986606|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[10]-1051523|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[15]-30611744|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+o|0,r+=(o^(i|~s))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,s+=(i^(r|~o))+n[11]-1120210379|0,s=(s<<10|s>>>22)+r|0,o+=(r^(s|~i))+n[2]+718787259|0,o=(o<<15|o>>>17)+s|0,i+=(s^(o|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+o|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=s+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array(4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(W.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s;for(s=0;s<e.length;s+=1){if(o=e.charCodeAt(s),o<128)n[i++]=o;else if(o<2048)n[i++]=(o>>>6)+192,n[i++]=o&63|128;else if(o<55296||o>56319)n[i++]=(o>>>12)+224,n[i++]=o>>>6&63|128,n[i++]=o&63|128;else{if(o=(o-55296)*1024+(e.charCodeAt(++s)-56320)+65536,o>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(o>>>18)+240,n[i++]=o>>>12&63|128,n[i++]=o>>>6&63|128,n[i++]=o&63|128}i>=64&&(this._dataLength+=64,W._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e.charCodeAt(s++);if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,o,s=0;for(;;){for(o=Math.min(e.length-s,64-i);o--;)n[i++]=e[s++];if(i<64)break;this._dataLength+=64,W._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){const e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){const n=e.buffer,r=e.state,i=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],o=0;o<n.length;o+=1)this._buffer8[o]=n.charCodeAt(o)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,o=(n>>2)+1;this._dataLength+=n;const s=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(W.buffer32Identity.subarray(o),o),n>55&&(W._md5cycle(this._state,i),i.set(W.buffer32Identity)),s<=4294967295)i[14]=s;else{const u=s.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return e?$o:"";const c=parseInt(u[2],16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return W._md5cycle(this._state,i),e?this._state:W._hex(this._state)}}if(W.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const Ao=36e5,Zn=Symbol.for("constructDateFrom");function At(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Zn in t?t[Zn](e):t instanceof Date?new t.constructor(e):new Date(e)}function He(t,e){return At(t,t)}function wo(t,e,n){const r=He(t);if(isNaN(e))return At(t,NaN);const i=r.getDate(),o=At(t,r.getTime());o.setMonth(r.getMonth()+e+1,0);const s=o.getDate();return i>=s?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function $r(t,e,n){return At(t,+He(t)+e)}function Po(t,e,n){return $r(t,e*Ao)}function Oo(t,e,n){return $r(t,e*1e3)}function To(t,e,n){return wo(t,e*12)}function Vn(t){return Math.trunc(+He(t)/1e3)}function Eo(t,e){return+He(t)<+He(e)}function d(t,e,n,r="debug",i){if(window.debug){const s=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?ln()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...s,n):console[r](`[PlaceOS][${t}] ${e}`,n):ln()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...s):console[r](`[PlaceOS][${t}] ${e}`)}}function ln(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function yn(){const t=window.location?.hash?window.location?.hash.slice(1):window.location?.href.split("#")[1]||"";let e=window.location?.search?window.location?.search.slice(1):window.location?.href.split("?")[1]||"",n={};if(t)if(t.indexOf("?")>=0){const i=t.split("?");n=Te(i[0]),e||(e=i[1])}else n=Te(t);let r={};return e&&(r=Te(e)),{...n,...r}}function Te(t){const e={},n=t.split("&");for(const r of n){const i=r.split("=");i[1]&&(e[decodeURIComponent(i[0])]=decodeURIComponent(i[1]))}return e}const Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Ar(t=40){let e="";for(let n=0;n<t;n++)e+=Kn.charAt(Math.floor(Math.random()*Kn.length));return e}function ce(t){const e=(window.location?.hash||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/#&/g,"#").replace(/&$/g,"#"),n=(window.location?.search||"").replace(new RegExp(`${t}[a-zA-Z0-9_+-.%=]*&?`,"g"),"").replace(/&&/g,"&").replace(/\?&/g,"#").replace(/&$/g,"#");window.history?.replaceState&&window.history?.replaceState(null,"",`${window.location?.pathname}${e}${n}`)}function We(t,e=!1){const n=e?1e3:1024;if(t<n)return t+(e?" iB":" B");const r=Math.floor(Math.log(t)/Math.log(n)),i=(e?"kMGTPE":"KMGTPE").charAt(r-1)+(e?"iB":"B");return(t/Math.pow(n,r)).toFixed(2)+" "+i}function wr(t){if(t.length===0)throw new Error("Input must not be of zero length");const e=t.split(","),n={};for(const r of e){const i=r.split(";");if(i.length!==2)throw new Error("Section could not be split on ';'");const o=i[0].replace(/<(.*)>/,"$1").trim(),s=i[1].replace(/rel="(.*)"/,"$1").trim();n[s]=o}return n}function Pr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Or(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Tr(){return window.location!==window.parent.location}function Er(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class Io{abort(){d("Stub","Aborted")}}function L(t){let e="";if(t)for(const n in t)t.hasOwnProperty(n)&&t[n]!==void 0&&t[n]!==null&&(e+=`${e?"&":""}${n}=${encodeURIComponent(t[n])}`);return e}const ye={},ze={},ue={};function Mo(){for(const t in ye)ye.hasOwnProperty(t)&&Se(t);for(const t in ze)ze.hasOwnProperty(t)&&Ro(t);for(const t in ue)ue.hasOwnProperty(t)&&Do(t)}function ne(t,e,n=300){if(t&&e&&e instanceof Function)Se(t),ye[t]=setTimeout(()=>{e(),delete ye[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Se(t){ye[t]&&(clearTimeout(ye[t]),delete ye[t])}function Ro(t){ze[t]&&(clearInterval(ze[t]),delete ze[t])}function Do(t){ue&&ue[t]&&(ue[t]instanceof be?ue[t].unsubscribe():ue[t](),delete ue[t])}const qo={id:"mock-authority",name:"localhost:4200",description:"",domain:"localhost:4200",login_url:"/login?continue={{url}}",logout_url:"/logout",session:!0,production:!1,config:{},version:"2.0.0"};let v={},A,F;const b={};let w="",ve="";const Me=new le(""),Dt=new le("");let gn="/api/engine/v2";const ae=new le(!1),Uo=ae.asObservable();let wt=0;function he(){return`${`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${v.host||window.location?.host}`}${vn()}`}function vn(){return v.version==="ACA Engine"?"/control/api":gn}function Co(){return!!v.token_header}function Ir(){return w}function No(){return v.redirect_uri}function jo(t,e=!0){A.setItem(`${w}_x-api-key`,`${t}`),A.setItem("trusted",`${e}`),Mr("x-api-key",To(new Date,5).valueOf())}function Ve(){return Tt("x-api-key",!1)||""}function Mr(t,e=Po(new Date,2).valueOf()){v.ignore_api_key&&t==="x-api-key"||(A.setItem(`${w}_expires_at`,`${e}`),A.setItem(`${w}_access_token`,t))}function Z(t=!0){if(v.mock)return"mock-token";if(!A)return"";if(Ve()&&!v.ignore_api_key)return"x-api-key";const e=A.getItem(`${w}_expires_at`)||"",n=Me.getValue();return Eo(+e,new Date)&&(d("Auth","Token expired. Requesting new token..."),Ct(),b.load_authority||(wt+=1,ne("re-authorise",()=>kn().catch(r=>d("Auth",`Failed to get token: ${r}`)),200*Math.min(20,wt))),!t)?"":n||A.getItem(`${w}_access_token`)||""}function Pt(){return Dt.getValue()||A.getItem(`${w}_refresh_token`)||""}function Ot(){return v.host||window.location?.host}function Rr(){return!!Z()}function Dr(){return Me.pipe(T(t=>!!Rr()))}function Qe(){return F}function Fo(){return ae.getValue()}function qt(){return!!v.mock}function qr(){return!!v.secure}function Lo(){return Uo}function Ut(){return Tt("trust")==="true"||Tt("trusted")==="true"}function bn(){return!!Ve()&&!v.ignore_api_key||Tt("fixed_device")==="true"}function Tt(t,e=!0){let r=yn()[t];if(A){const i=`${Ir()}_${t}`;r=r||A.getItem(i)||A.getItem(t)||"",e&&A.setItem(i,`${r}`)}return r}function zo(t){return v=t||v,v.token_header=v.token_header??Tr(),window.AbortController||(window.AbortController=Io),A=v.storage==="session"?sessionStorage:localStorage,w=W.hashStr(v.redirect_uri,!1),xn()}function Bo(){v={},F=void 0,Me.next(""),Dt.next(""),ae.next(!1),w="",ve="",gn="/api/engine/v2";for(const t in b)t in b&&delete b[t];Mo()}function Sn(){return d("Auth","Refreshing authorty."),F=void 0,xn()}function Ct(){d("Auth","Invalidating tokens."),A.removeItem(`${w}_access_token`),A.removeItem(`${w}_expires_at`),Me.getValue()&&Me.next("")}function kn(t,e=F){return b.authorise||(b.authorise=new Promise((n,r)=>{if(!e)return delete b.authorise,r("Authority is not loaded");d("Auth","Authorising user...");const i=()=>{if(Z(!1))d("Auth","Valid token found."),delete b.authorise,n(Z());else{const o=[()=>{d("Auth","Successfully generated token."),n(Z()),delete b.authorise},()=>{d("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete b.authorise,200)}];v&&v.auth_type==="password"?(d("Auth","Logging in with credentials."),Xo(v).then(...o),wt=0):ve||Pt()?(d("Auth",`Generating token with ${ve?"code":"refresh token"}`),Cr().then(...o),wt=0):e.session?(d("Auth","Users has session. Authorising application..."),Wo(t).then(...o)):(d("Auth","No user session"),Ur(e),r("No user session"),setTimeout(()=>delete b.authorise,200))}};Zo().then(i,i)})),b.authorise}function Ho(){const t=F?F.logout_url:"/logout";fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+Z()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<A.length;r++){const i=A.key(r);i&&i.indexOf(w)>=0&&A.removeItem(i)}window.location?.assign(n)})}function xn(t=0){return b.load_authority||(b.load_authority=new Promise(e=>{if(ae.next(!1),v.mock){F=qo,d("Auth","System in mock mode"),ae.next(!0),e();return}d("Auth",`Fixed: ${bn()} | Trusted: ${Ut()}`),d("Auth","Loading authority...");const n=v.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{d("Auth",`Failed to load authority(${i})`),ae.next(!1),ne("load_authority",()=>{delete b.load_authority,xn(t).then(o=>e())},300*Math.min(20,++t))};_n(`${n?"https:":"http:"}//${Ot()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(s=>s));F=await i.json(),gn=/[2-9]\.[0-9]+\.[0-9]+/g.test(F.version||"")?"/api/engine/v2":"/control/api",d("Auth","Loaded authority.",[],"group"),F&&(d("Auth",`Name: ${F.name}`),d("Auth",`Version: ${F.version}`),d("Auth",`Domain: ${F.domain}`),d("Auth",`Session: ${F.session}`),d("Auth",`Production: ${F.production}`),d("Auth",`Config Keys: ${Object.keys(F.config||{}).length}`)),d("Auth","",[],"groupEnd");const o=()=>{ae.next(!0),d("Auth","Application set online."),e()};delete b.load_authority,kn("").then(o,o)},r)})),b.load_authority}async function Wo(t){const e=Ko(t);if(v.use_iframe)return Qo(e);window.location?.assign(e)}function Qo(t){return b.iframe_auth||(b.iframe_auth=new Promise((e,n)=>{d("Auth","Authorizing in an iFrame...");const r=document.createElement("iframe");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.height="1px",r.style.width="1px",r.style.zIndex="-1",r.id="place-authorize",r.src=`${t}`;const i=o=>{if(o.origin===window.location?.origin&&o.data.type==="place-os"){const s=o.data;if(d("Auth","Received credentials from iFrame..."),document.body.removeChild(r),Se("iframe_auth"),window.removeEventListener("message",i),delete b.iframe_auth,s.token)return e(),$n({access_token:s.token,...s});ve=s.code||"",Cr().then(u=>e(u),u=>n(u))}};ne("iframe_auth",()=>{d("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",i),r.onerror=o=>{d("Auth","iFrame error.",o),delete b.iframe_auth,n()},document.body.appendChild(r)})),b.iframe_auth}let Yn=!1;function Ur(t){if(v.handle_login!==!1&&!Yn){d("Auth","Redirecting to login page...");const e=t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href));throw setTimeout(()=>window.location?.assign(e),300),Yn=!0,new Error("Redirecting to login page...")}else d("Auth","Login being handled locally.");delete b.authorise}function Zo(){return b.check_token||(b.check_token=new Promise(async(t,e)=>{Z()?(d("Auth","Valid token found."),t(Z())):(d("Auth","No token. Checking URL for auth credentials..."),await Vo()?t(!0):e()),delete b.check_token})),b.check_token}function Vo(){return b.check_params||(b.check_params=new Promise(t=>{d("Auth","Checking for auth parameters...");let e=yn();if((!e||Object.keys(e).length<=0)&&sessionStorage&&(e=JSON.parse(sessionStorage.getItem("ENGINE.auth.params")||"{}")),e&&(e.code||e.access_token||e.refresh_token)){e.code&&(ve=e.code,ce("code")),e.refresh_token&&(A.setItem(`${w}_refresh_token`,e.refresh_token),ce("refresh_token"));const n=A.getItem(`${w}_nonce`)||"",r=(e.state||"").split(";");ce("state"),ce("token_type");const i=r[0];n===i?($n(e),t(!!e.access_token)):t(!1)}else t(!1);ne("check_params_promise",()=>delete b.check_params,50)})),b.check_params}function Ko(t){const e=es();t=t?`${e};${t}`:e;const n=v?(v.auth_uri||"").indexOf("?")>=0:!1,r=(v?v.auth_uri:null)||"/auth/oauth/authorize",i=Ut()||v.auth_type==="auth_code"?"code":"token";let o=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(w)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(v.redirect_uri)}&scope=${encodeURIComponent(v.scope)}`;if(v.auth_type==="auth_code"){const{challenge:s,verify:u}=Yo();sessionStorage.setItem(`${w}_challenge`,s),o+="&code_challenge_method=S256",o+=`&code_challenge=${u}`}return o}const Jn="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Yo(t=43){const e=new Array(t).fill(0).map(()=>Jn[Math.floor(Math.random()*Jn.length)]).join(""),n=vo(bo(e)),r=xr(xo.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function Jo(){let e=(v.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(w)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(v.redirect_uri)}`,Pt()){e+=`&refresh_token=${encodeURIComponent(Pt())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(ve)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${w}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${w}_challenge`)),ve=""}return[e,n]}function Go(t){const e=t.token_uri||"/auth/token",n=L({grant_type:"password",client_id:w,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:F?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function Cr(){return Nr(...Jo())}function Xo(t){return Nr(Go(t))}function Nr(t,e=""){return b.generate_tokens||(b.generate_tokens=new Promise((n,r)=>{d("Auth","Generating new token...");const i=o=>{d("Auth","Error generating new tokens.",o),A.removeItem(`${w}_refresh_token`),Dt.next(""),r(),delete b.generate_tokens};_n(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async o=>{if(!o.ok)return i(o);const s=await o.json();$n(s),n(),delete b.generate_tokens},i)})),b.generate_tokens}function $n(t){const e=Oo(new Date,Math.max(60,parseInt(t.expires_in,10)-300));d("Auth","Tokens generated storing..."),Ut()&&(t.access_token&&(A.setItem(`${w}_access_token`,t.access_token),ce("access_token")),t.refresh_token&&(A.setItem(`${w}_refresh_token`,t.refresh_token),ce("refresh_token"))),t.expires_in&&(A.setItem(`${w}_expires_at`,`${e.valueOf()}`),ce("expires_in")),ae.next(!0),Me.next(t.access_token||""),Dt.next(t.refresh_token||"")}function es(){const t=Ar();return A.setItem(`${w}_nonce`,t),t}const Nt={};function ts(t,e=Nt){jr(t.method,t.path,e);const n=`${t.method}|${t.path}`,r=t.path.replace(/(http|https):\/\/[a-zA-Z0-9.]*:?([0-9]*)?/g,"").replace(/^\//,"").split("/"),i={...t,path_parts:r,path_structure:r.map(o=>o[0]===":"?o.replace(":",""):"")};e[n]=i,d("HTTP(M)",`+ ${t.method} ${t.path}`)}function jr(t,e,n=Nt){const r=`${t}|${e}`;n[r]&&(delete n[r],d("HTTP(M)",`- ${t} ${e}`))}function ns(t,e,n,r=Nt){const i=rs(t,e,r);if(i){const o=is(e,i,n);return os(i,o)}return null}function rs(t,e,n=Nt){const i=e.replace(/(http|https):\/\/[a-zA-Z0-9.]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),o=Object.keys(n).reduce((s,u)=>(u.indexOf(`${t}|`)===0&&s.push(n[u]),s),[]);for(const s of o)if(s.path_structure.length===i.length){let u=!0;for(let c=0;c<s.path_structure.length;c++)if(!s.path_structure[c]&&s.path_parts[c]!==i[c]){u=!1;break}if(u)return s}return null}function is(t,e,n){const r=t.replace(/(http|https):\/\/[a-zA-Z0-9.]*:?([0-9]*)?/g,"").split("?"),i=r[0].replace(/^\//,""),o=r[1]||"",s=Te(o),u=i.split("/"),c={};for(let m=0;m<e.path_structure.length;m++){const _=e.path_structure[m];_&&(c[_]=u[m])}const l={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:c,query_params:s,body:n};return d("HTTP(M)",`MATCHED ${l.method}:`,l),l}function os(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(s){throw d("HTTP(M)",`ERROR ${e.method}:`,[e.url,s]),s}const r=t.delay_variance||100,i=t.delay||300,o=Math.floor(Math.random()*r-r/2)+i;return d("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),uo([n]).pipe(mo(Math.max(200,o)))}const Fr={};function Lr(t,e=Fr){return e[t]||{}}function X(t,e,n=Ye){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function ke(t,e,n,r=Ye){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function Re(t,e,n,r=Ye){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function Ke(t,e,n,r=Ye){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function De(t,e,n=Ye){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function ss(t,e,n=Fr){if(t.headers){const r={};t.headers.forEach?t.headers.forEach((i,o)=>r[o.toLowerCase()]=i):Object.keys(t.headers).forEach(i=>r[i.toLowerCase()]=t.headers[i]),n[t.url||""]=r}switch(e){case"json":return await t.json().catch(()=>({}));case"text":return await t.text();case"void":return;default:return await t.json().catch(()=>({}))}}const zr=()=>(Ct(),Sn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{zr().then(()=>t())},1e3)})));function Ye(t,e,n,r=qt,i=ns,o=ss){if(r()){const s=i(t,e,n?.body);if(s)return s}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Dr().pipe(ho(s=>s),kr(1),Hn(s=>{Z()==="x-api-key"?n.headers["X-API-Key"]=Ve():n.headers.Authorization=`Bearer ${Z()}`;const u={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(u.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),_n(e,u)}),Hn(s=>s.ok?o(s,n.response_type):co(s)),go({count:4,delay:(s,u)=>new M(c=>{if(s.status===511){Ur(Qe()),c.error(s);return}if(s.status!==401){c.error(s||{});return}d("HTTP","Auth error",s);const l=Math.pow(2,u-1)*1e3;zr().then(()=>{c.next(l),c.complete()}).catch(()=>{c.error(s)})})}))}class B{id;name;created_at;updated_at;version;constructor(e={}){this.id=e.id||"",this.name=e.name||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.version=e.version||0}toJSON(){const e={...this};return e.version=this.version,delete e.created_at,Pr(e,[void 0,null,""])}}class Br extends B{uid;secret;owner_id;scopes;redirect_uri;skip_authorization;preserve_client_id;constructor(e={}){super(e),this.uid=e.uid||"",this.secret=e.secret||"",this.owner_id=e.owner_id||"",this.scopes=e.scopes||"",this.redirect_uri=e.redirect_uri||"",this.skip_authorization=e.skip_authorization||!1,this.preserve_client_id=e.preserve_client_id||!1}}function us(t){return Hr[t]||0}function cs(t){return Wr[t]||0}let Hr={},Wr={},Gn="";const jt=t=>t;function O(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,o=L(e),s=`${i||he()}${r?"/"+r:""}${o?"?"+o:""}`;return X(s).pipe(T(u=>{const c=as(s,o,r);return{total:c.total||0,next:c.next?()=>O({query_params:c.next,fn:n,endpoint:i,path:r}):null,data:u&&u instanceof Array?u.map(l=>(n||jt)(l)):u&&!(u instanceof Array)&&u.results?u.results.map(l=>l):[]}}))}function $(t){const{query_params:e,id:n,path:r,fn:i,options:o}=t,s=L(e),u=`${he()}/${r}/${n}${s?"?"+s:""}`;return X(u,o).pipe(T(c=>(i||jt)(c)))}function R(t){const{query_params:e,form_data:n,path:r,fn:i}=t,o=L(e),s=`${he()}/${r}${o?"?"+o:""}`;return ke(s,n).pipe(T(c=>(i||jt)(c)))}function y(t){const{id:e,task_name:n,form_data:r,method:i,path:o,callback:s}=t,u=L(r),c=`${he()}/${o}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?Re:ke)(c,r):(i==="del"?De:X)(`${c}${u?"?"+u:""}`,{response_type:"json"})).pipe(T(m=>(s||(_=>_))(m)))}function D(t){const{id:e,query_params:n,form_data:r,method:i,path:o,fn:s}=t,u=L({...n,version:r.version||0}),c=`${he()}/${o}/${e}${u?"?"+u:""}`;return(i==="put"?Re:Ke)(c,r).pipe(T(l=>(s||jt)(l)))}function I(t){const{id:e,query_params:n,path:r}=t,i=L(n),o=`${he()}/${r}/${e}${i?"?"+i:""}`;return De(o)}function as(t,e,n){const r=Lr(t[0]==="/"?`${location.origin}${t}`:t),i={total:0,next:null};if(r&&r["x-total-count"]){const o=+(r["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(Hr[n]=o),Wr[n]=o,i.total=o}return r&&r.link&&(Gn=wr(r.link||"").next,i.next=Te(Gn.split("?")[1])),i}const Je="oauth_apps";function Ft(t){return new Br(t)}function ls(t={}){return O({query_params:t,fn:Ft,path:Je})}function hs(t,e={}){return $({id:t,query_params:e,fn:Ft,path:Je})}function fs(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Ft,path:Je})}function ds(t){return R({form_data:t,query_params:{},fn:Ft,path:Je})}function ps(t,e={}){return I({id:t,query_params:e,path:Je})}var Qr=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(Qr||{});class Zr extends B{id;name;auth_type;description;host;port;tls;username;password;certificate;secret;filters;constructor(e={}){super(),this.id=e.id||"",this.name=e.name||"",this.auth_type=e.auth_type||2,this.description=e.description||"",this.host=e.host||"",this.port=e.port||1883,this.tls=e.tls||!1,this.username=e.username||"",this.password=e.password||"",this.certificate=e.certificate||"",this.secret=e.secret||"",this.filters=e.filters||[]}}const Ge="brokers";function Lt(t){return new Zr(t)}function ms(t={}){return O({query_params:t,fn:Lt,path:Ge})}function _s(t,e={}){return $({id:t,query_params:e,fn:Lt,path:Ge})}function ys(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Lt,path:Ge})}function gs(t){return R({form_data:t,query_params:{},fn:Lt,path:Ge})}function vs(t,e={}){return I({id:t,query_params:e,path:Ge})}class Vr{id;compiled_drivers;available_repositories;running_drivers;module_instances;unavailable_repositories;unavailable_drivers;hostname;cpu_count;core_cpu;total_cpu;memory_total;memory_usage;core_memory;memory_percentage;used_memory;total_memory;edge_nodes;run_counts;constructor(e={}){this.id=e.id||e.core_id||"",this.compiled_drivers=e.compiled_drivers||[],this.available_repositories=e.available_repositories||e.status?.available_repositories||[],this.running_drivers=e.running_drivers||e.status?.running_drivers||0,this.module_instances=e.module_instances||e.status?.module_instances||0,this.unavailable_repositories=e.unavailable_repositories||e.status?.unavailable_repositories||[],this.unavailable_drivers=e.unavailable_drivers||e.status?.unavailable_drivers||[],this.hostname=e.hostname||e.load?.local.hostname||"",this.cpu_count=e.cpu_count||e.load?.local.cpu_count||0,this.core_cpu=e.core_cpu||e.load?.local.core_cpu||0,this.total_cpu=e.total_cpu||e.load?.local.total_cpu||0,this.memory_total=e.memory_total||e.load?.local.memory_total||0,this.memory_usage=e.memory_usage||e.load?.local.memory_usage||0,this.core_memory=e.core_memory||e.load?.local.core_memory||0,this.run_counts=e.run_counts||e.status?.run_counts?.local||{modules:0,drivers:0},this.memory_percentage=+(this.memory_usage/this.memory_total*100).toFixed(4),this.used_memory=We(this.memory_usage*1024),this.total_memory=We(this.memory_total*1024);const n=e.load?.edge||{};this.edge_nodes=e.edge_nodes||Object.keys(n).map(r=>({id:r,...n[r],run_count:e.status?.run_count?.edge[r]||{}}))||[]}}class Kr{cluster_id;id;modules;running;module_instances;last_exit_code;launch_count;launch_time;cpu_usage;memory_total;memory_usage;used_memory;total_memory;constructor(e,n={}){this.cluster_id=e,this.id=n.id||n.driver||"",this.modules=n.modules||[],this.running=n.running||!1,this.module_instances=n.module_instances||n.edge?.status?.module_instances||n.local?.status?.module_instances||0,this.last_exit_code=n.last_exit_code||n.edge?.status?.last_exit_code||n.local?.status?.last_exit_code||0,this.launch_count=n.launch_count||n.edge?.status?.launch_count||n.local?.status?.launch_count||0,this.launch_time=n.launch_time||n.edge?.status?.launch_time||n.local?.status?.launch_time||0,this.cpu_usage=n.cpu_usage||n.percentage_cpu||n.edge?.status?.percentage_cpu||n.local?.status?.percentage_cpu||0,this.memory_total=n.memory_total||n.edge?.status?.memory_total||n.local?.status?.memory_total||0,this.memory_usage=n.memory_usage||n.edge?.status?.memory_usage||n.local?.status?.memory_usage||0,this.used_memory=We(this.memory_usage*1024),this.total_memory=We(this.memory_total*1024)}}const An="cluster";function bs(t){return new Vr(t)}function Ss(t={}){return O({query_params:t,fn:bs,path:An})}function ks(t,e={}){return $({id:t,query_params:e,fn:n=>n.map(r=>new Kr(t,r)),path:An})}function xs(t,e){return I({id:t,query_params:{driver:e},path:An})}class Yr extends B{domain;login_url;logout_url;description;config;internals;email_domains;constructor(e={}){super(e),this.description=e.description||"",this.domain=e.domain||"",this.login_url=e.login_url||"",this.logout_url=e.logout_url||"",this.config=e.config||{},this.internals=e.internals||{},this.email_domains=e.email_domains||[]}}const Xe="domains";function zt(t){return new Yr(t)}function $s(t={}){return O({query_params:t,fn:zt,path:Xe})}function As(t,e={}){return $({id:t,query_params:e,fn:zt,path:Xe})}function ws(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:zt,path:Xe})}function Ps(t){return R({form_data:t,query_params:{},fn:zt,path:Xe})}function Os(t,e={}){return I({id:t,query_params:e,path:Xe})}var xe=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(xe||{});class fe extends B{parent_id;updated_at;encryption_level;settings_string;keys;modified_by_id;get value(){return this.settings_string}constructor(e={}){super(e),this.parent_id=e.parent_id||"",this.updated_at=e.updated_at||Math.floor(new Date().getTime()/1e3),this.settings_string=e.settings_string||"",this.encryption_level=e.encryption_level||xe.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var Ze=(t=>(t[t.SSH=0]="SSH",t[t.Device=1]="Device",t[t.Service=2]="Service",t[t.Websocket=3]="Websocket",t[t.Logic=99]="Logic",t))(Ze||{});class wn extends B{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??Ze.Logic,this.default_uri=e.default_uri||"",this.default_port=e.default_port||1,this.ignore_connected=e.ignore_connected||!1,this.class_name=e.class_name||"",this.repository_id=e.repository_id||"",this.file_name=e.file_name||"",this.commit=e.commit||"",this.update_available=e.update_available||!1,this.update_info=e.update_info,this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new fe({parent_id:this.id,encryption_level:+n}))}}const de="drivers";function Bt(t){return new wn(t)}function Ts(t={}){return O({query_params:t,fn:Bt,path:de})}function Es(t,e={}){return $({id:t,query_params:e,fn:Bt,path:de})}function Is(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Bt,path:de})}function Ms(t){return R({form_data:t,query_params:{},fn:Bt,path:de})}function Rs(t,e={}){return I({id:t,query_params:e,path:de})}function Ds(t){return y({id:t,task_name:"recompile",path:de})}function qs(t){return y({id:t,task_name:"reload",path:de})}function Us(t){return y({id:t,task_name:"compiled",method:"get",path:de})}class Jr extends B{description;secret;x_api_key;online;last_seen;constructor(e={}){super(e),this.description=e.description||"",this.secret=e.secret||"",this.x_api_key=e.x_api_key||"",this.last_seen=(e.last_seen||0)*1e3||Date.now(),this.online=e.online||!1}toJSON(){const e=super.toJSON();return delete e.last_seen,e}}const qe="edges";function Ht(t){return new Jr(t)}function Cs(t={}){return O({query_params:t,fn:Ht,path:qe})}function Ns(t,e={}){return $({id:t,query_params:e,fn:Ht,path:qe})}function js(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Ht,path:qe})}function Fs(t){return R({form_data:t,query_params:{},fn:Ht,path:qe})}function Ls(t,e={}){return I({id:t,query_params:e,path:qe})}function zs(t,e={}){return y({id:t,task_name:"token",form_data:e,method:"get",path:qe})}class Gr extends B{type="ldap";authority_id;host;port;auth_method;uid;base;bind_dn;password;filter;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.host=e.host||"",this.port=e.port||636,this.auth_method=e.auth_method||"ssl",this.uid=e.uid||"",this.base=e.base||"",this.bind_dn=e.bind_dn||"",this.password=e.password||"",this.filter=e.filter||""}}const et="ldap_auths";function Wt(t){return new Gr(t)}function Bs(t={}){return O({query_params:t,fn:Wt,path:et})}function Hs(t,e={}){return $({id:t,query_params:e,fn:Wt,path:et})}function Ws(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Wt,path:et})}function Qs(t){return R({form_data:t,query_params:{},fn:Wt,path:et})}function Zs(t,e={}){return I({id:t,query_params:e,path:et})}class Pn{id;name;description;details;editors;schema;updated_at;modified_by_id;version;constructor(e={}){this.id=e.id||e.parent_id||"",this.name=e.name||"",this.description=e.description||"";try{this.details=(typeof e.details=="string"?JSON.parse(e.details):e.details)||{}}catch{this.details=e.details||{}}this.editors=e.editors||[],this.schema=e.schema||"",this.updated_at=(e.updated_at||0)*1e3||Date.now(),this.modified_by_id=e.modified_by_id||"",this.version=e.version||0}}class $e extends B{system_name;activated_count;description;debounce_period;important;enabled;enable_webhook;exec_enabled;webhook_secret;supported_methods;control_system_id;zone_id;trigger_id;playlists;get system_id(){return this.control_system_id}get actions(){const e=this._actions,n=(e.functions||[]).map(i=>({...i,args:{...i.args}})),r=(e.mailers||[]).map(i=>({...i,emails:[...i.emails]}));return{functions:n,mailers:r}}get conditions(){const e=this._conditions,n=(e.comparisons||[]).map(i=>({...i,left:typeof i.left=="object"?{...i.left}:i.left,right:typeof i.right=="object"?{...i.right}:i.right})),r=(e.time_dependents||[]).map(i=>({...i}));return{comparisons:n,time_dependents:r}}_actions;_conditions;constructor(e={}){super(e),this.description=e.description||"",this._actions=e.actions||{functions:[],mailers:[]},this._conditions=e.conditions||{comparisons:[],time_dependents:[]},this.debounce_period=e.debounce_period||0,this.important=e.important||!1,this.enabled=e.enabled||!1,this.webhook_secret=e.webhook_secret||"",this.control_system_id=e.system_id||e.control_system_id||"",this.zone_id=e.zone_id||"",this.system_name=e.system_name||(e.control_system?e.control_system.name:""),this.enable_webhook=e.enable_webhook||!1,this.exec_enabled=e.exec_enabled||!1,this.supported_methods=e.supported_methods||["POST"],this.activated_count=e.activated_count||e.trigger_count||0,this.playlists=e.playlists||[],this.trigger_id=e.trigger_id||""}}class Qt extends B{settings=[null,null,null,null];description;parent_id;triggers;tags;location;display_name;code;type;count;capacity;map_id;images;timezone;playlists;trigger_list=[];constructor(e={}){super(e),this.description=e.description||"",this.tags=e.tags||[],this.triggers=e.triggers||[],this.settings=e.settings||[null,null,null,null],this.parent_id=e.parent_id||"",this.location=e.location||"",this.display_name=e.display_name||"",this.code=e.code||"",this.type=e.type||"",this.count=e.count||0,this.capacity=e.capacity||0,this.map_id=e.map_id||"",this.timezone=e.timezone||"",this.images=e.images||[],this.playlists=e.playlists||[],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new fe({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new $e(n)))}}class Xr{zone;metadata;keys;constructor(e={}){this.zone=new Qt(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Pn(n[r])}}const Ae="metadata";function tt(t){return new Pn(t)}function Vs(t,e={}){return $({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>tt(n[r])),path:Ae})}function Ks(t){const e=[...t],n=[];for(;e.length;){const r=e.pop();Array.isArray(r)?e.push(...r):n.push(r)}return n.reverse()}function Ys(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Ks(Object.keys(n).map(r=>n[r].map(i=>tt(i)))),path:Ae})}function Js(t,e,n={}){return $({id:t,query_params:{...n,name:e},fn:r=>tt(r[e]),path:Ae})}function Gs(t,e,n="put"){return D({id:t,form_data:e,query_params:{},method:n,fn:tt,path:Ae})}function Xs(t){return R({form_data:t,query_params:{},fn:tt,path:Ae})}function eu(t,e={}){return I({id:t,query_params:e,path:Ae})}function tu(t,e){return y({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new Xr({...r,keys:Object.keys(r.metadata)})),path:Ae})}class On extends B{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_url;map_id;modules;images;zones;timezone;module_list=[];signage;playlists;approval;orientation;constructor(e={}){super(e),this.display_name=e.display_name||"",this.description=e.description||"",this.email=e.email||"",this.code=e.code||"",this.capacity=e.capacity||0,this.features=e.features||[],this.bookable=e.bookable||!1,this.public=e.public??!1,this.installed_ui_devices=e.installed_ui_devices||0,this.support_url=e.support_url||"",this.map_id=e.map_id||"",this.modules=e.modules||[],this.images=e.images||[],this.zones=e.zones||[],this.settings=e.settings||[null,null,null,null],this.timezone=e.timezone||"",this.signage=e.signage||!1,this.playlists=e.playlists||[],this.orientation=e.orientation||"unspecified",this.approval=e.approval||!1,typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new fe({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Tn(n)))}}class Tn extends B{connected;running;updated_at;edge_id;driver_id;driver;control_system_id;system;ip;tls;udp;port;makebreak;uri;custom_name;role;notes;ignore_connected;settings=[null,null,null,null];has_runtime_error;error_timestamp;get system_id(){return this.control_system_id}constructor(e={}){super(e),this.driver_id=e.driver_id||e.dependency_id||"",this.control_system_id=e.control_system_id||"",this.edge_id=e.edge_id||"",this.ip=e.ip||"",this.tls=e.tls||!1,this.udp=e.udp||!1,this.port=e.port||1,this.makebreak=e.makebreak||!1,this.uri=e.uri||"",this.custom_name=e.custom_name||"",this.role=e.role??Ze.Logic,this.notes=e.notes||"",this.ignore_connected=e.ignore_connected||!1,this.connected=e.connected,this.running=e.running||!1,this.updated_at=e.updated_at||0,this.system=new On(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new wn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in xe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new fe({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==Ze.Logic&&!e||!n.control_system_id)&&delete n.control_system_id,delete n.driver,delete n.system,delete n.error_timestamp,delete n.has_runtime_error,n}}const Y="modules";function Zt(t){return new Tn(t)}function nu(t={}){return O({query_params:t,fn:Zt,path:Y})}function ru(t,e={}){return $({id:t,query_params:e,fn:Zt,path:Y})}function iu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Zt,path:Y})}function ou(t){return R({form_data:t,query_params:{},fn:Zt,path:Y})}function su(t,e={}){return I({id:t,query_params:e,path:Y})}function uu(t){return y({id:t,task_name:"start",path:Y})}function cu(t){return y({id:t,task_name:"stop",path:Y})}function au(t){return y({id:t,task_name:"state",method:"get",path:Y})}function lu(t,e){return y({id:t,task_name:`state${e}`,method:"get",path:Y})}function hu(t){return y({id:t,task_name:"load",method:"post",path:Y})}function fu(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new fe(n)),path:Y})}function du(t){return y({id:t,task_name:"error",method:"get",path:Y})}class ei extends B{type="oauth";authority_id;client_id;client_secret;info_mappings;site;authorize_url;token_method;token_url;auth_scheme;scope;raw_info_url;authorize_params;ensure_matching;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.client_id=e.client_id||"",this.client_secret=e.client_secret||"",this.info_mappings=e.info_mappings||{},this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{},this.site=e.site||"",this.authorize_url=e.authorize_url||"oauth/authorize",this.token_method=e.token_method||"post",this.token_url=e.token_url||"oauth/token",this.auth_scheme=e.auth_scheme||"request_body",this.scope=e.scope||"",this.raw_info_url=e.raw_info_url||"",this.authorize_params=e.authorize_params||{},this.ensure_matching=e.ensure_matching||{}}}const nt="oauth_auths";function Vt(t){return new ei(t)}function pu(t={}){return O({query_params:t,fn:Vt,path:nt})}function mu(t,e={}){return $({id:t,query_params:e,fn:Vt,path:nt})}function _u(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Vt,path:nt})}function yu(t){return R({form_data:t,query_params:{},fn:Vt,path:nt})}function gu(t,e={}){return I({id:t,query_params:e,path:nt})}var En=(t=>(t.Driver="driver",t.Interface="interface",t))(En||{});class ti extends B{folder_name;description;uri;branch;commit_hash;repo_type;username;password;root_path;get type(){return this.repo_type}constructor(e={}){super(e),this.folder_name=e.folder_name||"",this.description=e.description||"",this.uri=e.uri||"",this.branch=e.branch||"",this.commit_hash=e.commit_hash||"",this.repo_type=e.repo_type||En.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const Q="repositories";function Kt(t){return new ti(t)}function vu(t={}){return O({query_params:t,fn:Kt,path:Q})}function bu(t,e={}){return $({id:t,query_params:e,fn:Kt,path:Q})}function Su(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Kt,path:Q})}function ku(t){return R({form_data:t,query_params:{},fn:Kt,path:Q})}function xu(t,e={}){return I({id:t,query_params:e,path:Q})}function $u(t={}){return $({id:"interfaces",query_params:t,path:Q})}function Au(t){return $({id:"remote_default_branch",query_params:t,path:Q})}function wu(t){return $({id:"remote_branches",query_params:t,path:Q})}function Pu(t){return $({id:"remote_commits",query_params:t,path:Q})}function Ou(t,e){return y({id:t,task_name:"drivers",form_data:e,method:"get",path:Q})}function Tu(t,e){return y({id:t,task_name:"commits",form_data:e,method:"get",path:Q})}function Eu(t){return y({id:t,task_name:"branches",method:"get",path:Q})}function Iu(t){return y({id:t,task_name:"default_branch",method:"get",path:Q})}function Mu(t,e){return y({id:t,task_name:"details",form_data:e,method:"get",path:Q})}function Ru(t,e){return y({id:t,task_name:"pull",form_data:e,method:"post",path:Q})}class ni extends B{type="saml";authority_id;issuer;idp_sso_target_url_runtime_params;name_identifier_format;uid_attribute;assertion_consumer_service_url;idp_sso_target_url;idp_cert;idp_cert_fingerprint;attribute_service_name;attribute_statements;request_attributes;idp_slo_target_url;slo_default_relay_state;constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.issuer=e.issuer||"",this.idp_sso_target_url_runtime_params=e.idp_sso_target_url_runtime_params||{},this.name_identifier_format=e.name_identifier_format||"",this.uid_attribute=e.uid_attribute||"",this.assertion_consumer_service_url=e.assertion_consumer_service_url||"",this.idp_sso_target_url=e.idp_sso_target_url||"",this.idp_cert=e.idp_cert||"",this.idp_cert_fingerprint=e.idp_cert_fingerprint||"",this.attribute_service_name=e.attribute_service_name||"",this.attribute_statements=e.attribute_statements||{},this.request_attributes=e.request_attributes||[],this.idp_slo_target_url=e.idp_slo_target_url||"",this.slo_default_relay_state=e.slo_default_relay_state||""}}const rt="saml_auths";function Yt(t){return new ni(t)}function Du(t={}){return O({query_params:t,fn:Yt,path:rt})}function qu(t,e={}){return $({id:t,query_params:e,fn:Yt,path:rt})}function Uu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:rt})}function Cu(t){return R({form_data:t,query_params:{},fn:Yt,path:rt})}function Nu(t,e={}){return I({id:t,query_params:e,path:rt})}const Ue="settings";function it(t){return new fe(t)}function ju(t={}){return O({query_params:t,fn:it,path:Ue})}function Fu(t,e={}){return $({id:t,query_params:e,fn:it,path:Ue})}function Lu(t,e,n={},r="patch"){return D({id:t,form_data:e,query_params:n,method:r,fn:it,path:Ue})}function zu(t,e={}){return R({form_data:t,query_params:e,fn:it,path:Ue})}function Bu(t,e={}){return I({id:t,query_params:e,path:Ue})}function Hu(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>it(r)),path:Ue})}const q="systems";function we(t){return new On(t)}function Wu(t={}){return O({query_params:t,fn:we,path:q})}function Qu(t={}){return O({query_params:t,fn:we,path:`${q}/with_emails`})}function Zu(t,e={}){return $({id:t,query_params:e,fn:we,path:q})}function Vu(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:we,path:q})}function Ku(t){return R({form_data:t,query_params:{},fn:we,path:q})}function Yu(t,e={}){return I({id:t,query_params:e,path:q})}function Ju(t,e,n={}){return y({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>we(r),path:q})}function Gu(t,e){return y({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>we(n),path:q})}function Xu(t){return y({id:t,task_name:"start",form_data:{},path:q})}function ec(t){return y({id:t,task_name:"stop",path:q})}function tc(t,e,n,r=1,i=[]){return y({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:q})}function nc(t,e,n=1){return y({id:t,task_name:`${e}_${n}`,method:"get",path:q})}function rc(t,e,n=1,r){return y({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:q})}function ic(t,e,n=1){return y({id:t,task_name:`functions/${e}_${n}`,method:"get",path:q})}function oc(t){return O({query_params:{},fn:e=>new Qt(e),path:`${q}/${t}/zones`})}function sc(t){return O({query_params:{},fn:e=>new $e(e),path:`${q}/${t}/triggers`})}function uc(t,e){return y({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new $e(n),path:q})}function cc(t,e){return y({id:t,task_name:`triggers/${e}`,method:"del",path:q})}function ac(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new fe(n)),path:q})}const Ce="triggers";function Jt(t){return new $e(t)}function lc(t={}){return O({query_params:t,fn:Jt,path:Ce})}function hc(t,e={}){return $({id:t,query_params:e,fn:Jt,path:Ce})}function fc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:Ce})}function dc(t){return R({form_data:t,query_params:{},fn:Jt,path:Ce})}function pc(t,e={}){return I({id:t,query_params:e,path:Ce})}function mc(t){return y({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new $e(n)),path:Ce})}var ri=(t=>(t.EQ="equal",t.NEQ="not_equal",t.GT="greater_than",t.GTE="greater_than_or_equal",t.LT="less_than",t.LTE="less_than_or_equal",t.AND="and",t.OR="or",t.XOR="exclusive_or",t))(ri||{}),ii=(t=>(t.AT="at",t.CRON="cron",t))(ii||{}),oi=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(oi||{});class si extends B{email_digest;authority_id;email;phone;country;building;groups;image;metadata;login_name;staff_id;first_name;last_name;support;sys_admin;ui_theme;card_number;department;work_preferences;work_overrides;photo_upload_id;locatable;password="";confirm_password="";constructor(e={}){super(e),this.authority_id=e.authority_id||"",this.email=e.email||"",this.email_digest=e.email_digest||"",this.phone=e.phone||"",this.country=e.country||"",this.building=e.building||"",this.image=e.image||"",this.metadata=e.metadata||"",this.login_name=e.login_name||"",this.staff_id=e.staff_id||"",this.first_name=e.first_name||"",this.last_name=e.last_name||"",this.support=!!e.support,this.sys_admin=!!e.sys_admin,this.ui_theme=e.ui_theme||"",this.card_number=e.card_number||"",this.groups=e.groups||[],this.department=e.department||"",this.photo_upload_id=e.photo_upload_id||"",this.work_preferences=e.work_preferences||[],this.work_overrides=e.work_overrides||{},this.locatable=e.locatable??!0}}const Ne="users";function ot(t){return new si(t)}function _c(t={}){return O({query_params:t,fn:ot,path:Ne})}function yc(t,e={}){return $({id:t,query_params:e,fn:ot,path:Ne})}function gc(t={}){return $({id:"current",query_params:t,fn:ot,path:Ne})}function vc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:ot,path:Ne})}function bc(t){return R({form_data:t,query_params:{},fn:ot,path:Ne})}function Sc(t,e={}){return I({id:t,query_params:e,path:Ne})}const pe="zones";function Gt(t){return new Qt(t)}function kc(t={}){return O({query_params:t,fn:Gt,path:pe})}function xc(t={}){return $({id:"tags",query_params:t,fn:e=>e,path:pe})}function $c(t,e={}){return $({id:t,query_params:e,fn:Gt,path:pe})}function Ac(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:Gt,path:pe})}function wc(t){return R({form_data:t,query_params:{},fn:Gt,path:pe})}function Pc(t,e={}){return I({id:t,query_params:e,path:pe})}function Oc(t,e={}){return O({query_params:e,fn:n=>new $e(n),path:`${pe}/${t}/triggers`})}function Tc(t,e,n,r=1,i=[]){return y({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:pe})}var In=(t=>(t[t.Default=0]="Default",t[t.Cut=1]="Cut",t[t.CrossFade=2]="CrossFade",t[t.SlideTop=3]="SlideTop",t[t.SlideLeft=4]="SlideLeft",t[t.SlideRight=5]="SlideRight",t[t.SlideBottom=6]="SlideBottom",t))(In||{});class ui{id;created_at;updated_at;name;description;authority_id;start_time;play_time;video_length;animation;media_type;orientation;media_uri;media_id;thumbnail_id;play_count;valid_from;valid_until;get media_url(){return this.media_id?`/api/engine/v2/uploads/${this.media_id}/url`:this.media_uri}get thumbnail_url(){return`/api/engine/v2/uploads/${this.thumbnail_id}/url`}constructor(e){this.id=e.id||"",this.created_at=e.created_at||Vn(Date.now()),this.updated_at=e.updated_at||Vn(Date.now()),this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.start_time=e.start_time||0,this.play_time=e.play_time||0,this.video_length=e.video_length||0,this.animation=e.animation,this.media_type=e.media_type||"unknown",this.orientation=e.orientation||"unspecified",this.media_uri=e.media_uri||"",this.media_id=e.media_id||"",this.thumbnail_id=e.thumbnail_id||"",this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class Xt{id;playlist_id;items;created_at;updated_at;user_id;user_name;user_email;approved;approved_by_id;approved_by_email;approved_by_name;constructor(e={}){this.id=e.id||"",this.playlist_id=e.playlist_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.items=e.items||[],this.approved=!!e.approved,this.approved_by_id=e.approved_by_id||"",this.approved_by_email=e.approved_by_email||"",this.approved_by_name=e.approved_by_name||"",this.user_id=e.user_id||"",this.user_name=e.user_name||"",this.user_email=e.user_email||""}}class ci{id;created_at;updated_at;name;description;authority_id;orientation;play_count;play_through_count;default_animation;random;enabled;default_duration;play_hours;play_at;play_cron;valid_from;valid_until;constructor(e){this.id=e.id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0,this.name=e.name||"",this.description=e.description||"",this.authority_id=e.authority_id||"",this.orientation=e.orientation||"",this.play_count=e.play_count||0,this.play_through_count=e.play_through_count||0,this.default_animation=e.default_animation||In.Cut,this.random=e.random||!1,this.enabled=e.enabled??!0,this.default_duration=e.default_duration??15*1e3,this.valid_from=e.valid_from,this.valid_until=e.valid_until,this.play_hours=e.play_hours||"",this.play_at=e.play_at||"",this.play_cron=e.play_cron||""}}const ai="signage";function Ec(t,e={},n){return $({id:t,query_params:e,fn:r=>r,path:`${ai}`,options:n})}function Ic(t){return y({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:ai})}const st="signage/media";function en(t){return new ui(t)}function Mc(t={}){return O({query_params:t,fn:en,path:st})}function Rc(t,e={}){return $({id:t,query_params:e,fn:en,path:st})}function Dc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:en,path:st})}function qc(t){return R({form_data:t,query_params:{},fn:en,path:st})}function Uc(t,e={}){return I({id:t,query_params:e,path:st})}const oe="signage/playlists";function tn(t){return new ci(t)}function Cc(t={}){return O({query_params:t,fn:tn,path:oe})}function Nc(t,e={}){return $({id:t,query_params:e,fn:tn,path:oe})}function jc(t,e,n="patch"){return D({id:t,form_data:e,query_params:{},method:n,fn:tn,path:oe})}function Fc(t){return R({form_data:t,query_params:{},fn:tn,path:oe})}function Lc(t,e={}){return I({id:t,query_params:e,path:oe})}function zc(t,e={}){return y({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new Xt(n),path:oe})}function Bc(t,e={}){return y({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new Xt(r)),path:oe})}function Hc(t){return y({id:t,task_name:"media/approve",method:"post",path:oe})}function Wc(t,e){return y({id:t,task_name:"media",form_data:e,method:"post",path:oe,callback:n=>new Xt(n)})}class Mn{id;question_id;survey_id;type;answer_json;constructor(e){this.id=e.id||0,this.question_id=e.question_id||0,this.survey_id=e.survey_id||0,this.type=e.type||"",this.answer_json=e.answer_json||{}}}const li="/api/staff/v1/surveys/answers";function Qc(t={}){const e=L(t);return X(`${li}${e?"?"+e:""}`).pipe(T(n=>n.map(r=>new Mn(r))))}function Zc(t){return ke(`${li}`,t).pipe(T(e=>e.map(n=>new Mn(n))))}class ut{id;survey_id;token;email;sent;constructor(e){this.id=e.id||0,this.survey_id=e.survey_id||0,this.token=e.token||"",this.email=e.email||"",this.sent=e.sent??!1}}const ct="/api/staff/v1/surveys/invitations";function Vc(t={}){const e=L(t);return X(`${ct}${e?"?"+e:""}`).pipe(T(n=>n.map(r=>new ut(r))))}function Kc(t,e={}){const n=L(e);return X(`${ct}/${t}${n?"?"+n:""}`).pipe(T(r=>new ut(r)))}function Yc(t,e,n="patch"){return(n==="put"?Re:Ke)(`${ct}/${t}`,e).pipe(T(r=>new ut(r)))}function Jc(t){return ke(`${ct}`,t).pipe(T(e=>new ut(e)))}function Gc(t,e={}){const n=L(e);return De(`${ct}/${t}${n?"?"+n:""}`)}class at{id;title;description;type;options;required;max_rating;choices;tags;deleted;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.type=e.type||"",this.options=e.options||{},this.required=e.required||!1,this.max_rating=e.max_rating||0,this.choices=e.choices||[],this.tags=e.tags||[],this.deleted=e.deleted||!1}}const lt="/api/staff/v1/surveys/questions";function Xc(t={}){const e=L(t);return X(`${lt}${e?"?"+e:""}`).pipe(T(n=>n.map(r=>new at(r))))}function ea(t,e={}){const n=L(e);return X(`${lt}/${t}${n?"?"+n:""}`).pipe(T(r=>new at(r)))}function ta(t){return ke(`${lt}`,t).pipe(T(e=>new at(e)))}function na(t,e,n="patch"){return(n==="put"?Re:Ke)(`${lt}/${t}`,e).pipe(T(r=>new at(r)))}function ra(t,e={}){const n=L(e);return De(`${lt}/${t}${n?"?"+n:""}`)}class ht{id;title;description;trigger;building_id;zone_id;pages;constructor(e){this.id=e.id||0,this.title=e.title||"",this.description=e.description||"",this.building_id=e.building_id||"",this.zone_id=e.zone_id||"",this.pages=e.pages||[],this.trigger=e.trigger||"NONE"}}const ft="/api/staff/v1/surveys";function ia(t={}){const e=L(t);return X(`${ft}${e?"?"+e:""}`).pipe(T(n=>n.map(r=>new ht(r))))}function oa(t,e={}){const n=L(e);return X(`${ft}/${t}${n?"?"+n:""}`).pipe(T(r=>new ht(r)))}function sa(t,e,n="patch"){return(n==="put"?Re:Ke)(`${ft}/${t}`,e).pipe(T(r=>new ht(r)))}function ua(t){return ke(`${ft}`,t).pipe(T(e=>new ht(e)))}function ca(t,e={}){const n=L(e);return De(`${ft}/${t}${n?"?"+n:""}`)}var aa={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},la="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",ha=function(t){G(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof M)i.destination=r,i.source=n;else{var o=i._config=Be({},aa);if(i._output=new ge,typeof n=="string")o.url=n;else for(var s in n)n.hasOwnProperty(s)&&(o[s]=n[s]);if(!o.WebSocketCtor&&WebSocket)o.WebSocketCtor=WebSocket;else if(!o.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new rn}return i}return e.prototype.lift=function(n){var r=new e(this._config,this.destination);return r.operator=n,r.source=this,r},e.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new rn),this._output=new ge},e.prototype.multiplex=function(n,r,i){var o=this;return new M(function(s){try{o.next(n())}catch(c){s.error(c)}var u=o.subscribe({next:function(c){try{i(c)&&s.next(c)}catch(l){s.error(l)}},error:function(c){return s.error(c)},complete:function(){return s.complete()}});return function(){try{o.next(r())}catch(c){s.error(c)}u.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,r=this._config,i=r.WebSocketCtor,o=r.protocol,s=r.url,u=r.binaryType,c=this._output,l=null;try{l=o?new i(s,o):new i(s),this._socket=l,u&&(this._socket.binaryType=u)}catch(_){c.error(_);return}var m=new be(function(){n._socket=null,l&&l.readyState===1&&l.close()});l.onopen=function(_){var p=n._socket;if(!p){l.close(),n._resetState();return}var a=n._config.openObserver;a&&a.next(_);var f=n.destination;n.destination=Rt.create(function(h){if(l.readyState===1)try{var S=n._config.serializer;l.send(S(h))}catch(g){n.destination.error(g)}},function(h){var S=n._config.closingObserver;S&&S.next(void 0),h&&h.code?l.close(h.code,h.reason):c.error(new TypeError(la)),n._resetState()},function(){var h=n._config.closingObserver;h&&h.next(void 0),l.close(),n._resetState()}),f&&f instanceof rn&&m.add(f.subscribe(n.destination))},l.onerror=function(_){n._resetState(),c.error(_)},l.onclose=function(_){l===n._socket&&n._resetState();var p=n._config.closeObserver;p&&p.next(_),_.wasClean?c.complete():c.error(_)},l.onmessage=function(_){try{var p=n._config.deserializer;c.next(p(_))}catch(a){c.error(a)}}},e.prototype._subscribe=function(n){var r=this,i=this.source;return i?i.subscribe(n):(this._socket||this._connectSocket(),this._output.subscribe(n),n.add(function(){var o=r._socket;r._output.observers.length===0&&(o&&(o.readyState===1||o.readyState===0)&&o.close(),r._resetState())}),n)},e.prototype.unsubscribe=function(){var n=this._socket;n&&(n.readyState===1||n.readyState===0)&&n.close(),this._resetState(),t.prototype.unsubscribe.call(this)},e}(an);function fa(t){return new ha(t)}var J=(t=>(t[t.PARSE_ERROR=0]="PARSE_ERROR",t[t.BAD_REQUEST=1]="BAD_REQUEST",t[t.ACCESS_DENIED=2]="ACCESS_DENIED",t[t.REQUEST_FAILED=3]="REQUEST_FAILED",t[t.UNKNOWN_CMD=4]="UNKNOWN_CMD",t[t.SYS_NOT_FOUND=5]="SYS_NOT_FOUND",t[t.MOD_NOT_FOUND=6]="MOD_NOT_FOUND",t[t.UNEXPECTED_FAILURE=7]="UNEXPECTED_FAILURE",t))(J||{}),Rn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(Rn||{});class hi{constructor(e,n){this._system=e;const r=Object.getOwnPropertyNames(Object.getPrototypeOf(n)).filter(i=>i.startsWith("$"));for(const i in n)n.hasOwnProperty(i)&&n[i]!==void 0&&(n[i]instanceof Function?this.addMethod(i,n[i]):this.addProperty(i,n[i]));for(const i of r)n[i]instanceof Function&&this.addMethod(i,n[i])}call(e,n=[]){return this[`$${e}`]instanceof Function?this[`$${e}`](...n):null}listen(e){return!this[`_${e}`]&&!(this[`_${e}_obs`]instanceof M)&&!this[e]&&this.addProperty(e,null),this[`_${e}_obs`]}addMethod(e,n){e[0]!=="$"&&(e=`$${e}`),this[e]=n}addProperty(e,n){e[0]==="$"&&(e=e.replace("$","")),this[`_${e}`]=new le(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class fi{constructor(e){for(const n in e)e.hasOwnProperty(n)&&e[n]&&e[n]instanceof Array&&e[n].forEach(r=>{this.addModule(n,r)})}addModule(e,n){this[e]||(this[e]=[]),this[e].push(new hi(this,n))}}const Et={};function da(t,e){return Et[t]=new fi(e),Et[t]}function di(t){return Et[t]}function pa(t){delete Et[t]}const pi=15;let dt=0,V,mi=0;const z={},Dn={},Pe={},ma={},me=new le(!1);Pe._place_os_status=me.asObservable();const _i=new le([0,0]);Pe._place_os_sync=_i.asObservable();let yi=Date.now(),Ee,It=0,se=null,bt,qn=0;const pt=10*1e3,Un=new ge;Pe._place_os_debug_events=Un.asObservable();function St(){return he().indexOf("/control/")>=0?"/control/websocket":`${vn()}/systems/control`}function Cn(){return me.getValue()}function gi(){return Pe._place_os_status}function _a(){return Pe._place_os_status}function vi(t,e=Dn,n=Pe){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new le(void 0),n[r]=e[r].asObservable()),n[r]}function bi(t,e=Dn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function hn(t,e=0,n=je){const r={id:++dt,cmd:"bind",...t};return n(r,e)}function Si(t,e=0,n=je){const r={id:++dt,cmd:"unbind",...t};return n(r,e)}function ki(t,e=pt,n=je){const r={id:++dt,cmd:"exec",...t};return n(r,e)}function ya(t,e=pt,n=je){const r={id:++dt,cmd:"debug",...t};return n(r,e)}function ga(t,e=pt,n=je){const r={id:++dt,cmd:"ignore",...t};return n(r,e)}function je(t,e=pt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Er()}`;if(z[r])d("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((o,s)=>{const u=()=>{delete z[r],z[r]=null,je(t,e,n).then(c=>o(c),c=>s(c))};if(V&&Cn()){qt()&&Aa(t,V,ma),i.resolve=o,i.reject=s;const c=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${c}`,t.args),V.next(t),e>0&&ne(`${r}`,()=>{s("Request timed out."),delete z[r],z[r]=null},e)}else se?setTimeout(()=>u(),1e3):Nn().then(()=>u())}),z[r]=i}return z[r].promise}function xi(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Sa(t.meta,t.value);else if(t.type==="success")va(t);else if(t.type==="debug"){d("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};Un.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||Rn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?ba(t):t.cmd||d("WS","Invalid websocket message",t,"error");Se(`${t.id}`)}else t==="pong"&&(qn=Date.now(),d("WS","Pong!"))}function va(t){const e=Object.keys(z).map(n=>z[n]).find(n=>n?.id===t.id);d("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete z[e.key])}function ba(t){let e="UNEXPECTED FAILURE";switch(t.code){case J.ACCESS_DENIED:e="ACCESS DENIED";break;case J.BAD_REQUEST:e="BAD REQUEST";break;case J.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case J.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case J.PARSE_ERROR:e="PARSE ERROR";break;case J.REQUEST_FAILED:e="REQUEST FAILED";break;case J.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}d("WS",`[ERROR] ${e}(${t.id}): ${t.msg}`,void 0,"error");const n=Object.keys(z).map(r=>z[r]).filter(r=>r).find(r=>r.id===t.id);n&&n.reject&&(n.reject(t),Se(`${n.key}`),delete z[n.key])}function Sa(t,e,n=Dn,r=Pe){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new le(null),r[i]=n[i].asObservable());const o=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;d("WS",`[NOTIFY] ${o} changed`,[n[i].getValue(),"→",e]),n[i].next(e)}function Nn(t=0){return se==null&&(se=new Promise(e=>{if(t>40)return location.reload();It++,yi=Date.now(),V=qt()?$a():ka(),V?(d("WS(Debug)","Authority:",[Qe()]),d("WS","Connecting to websocket..."),V.subscribe(n=>{me.getValue()||(d("WS","Connection established."),e()),me.next(!0),It=0,on(),xi(n)},n=>{V=void 0,se=null,er(),on(),xa(n)},()=>{V=void 0,se=null,er(),d("WS","Connection closed by browser."),me.next(!1),Mt()}),Ee&&clearInterval(Ee),qn=Date.now(),Xn(),Ee=setInterval(()=>Xn(),pi*1e3),on(),mi+=1,bt=setTimeout(()=>{d("WS","Unhealthy connection. Reconnecting..."),me.next(!1),se=null,Mt()},30*1e3)):(V?d("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!Z(),!!Qe()],"info"):d("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{se=null,Nn(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),se}function ka(){if(!Qe()||!Z())return null;const t=qr()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Ot()}${St()}${bn()?"?fixed_device=true":""}`;const n=Z();let r=n==="x-api-key"?`api-key=${Ve()}`:`bearer_token=${n}`;return!Co()&&!Or()?(d("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${St()};`,r+=`${t?"secure;":""}samesite=strict`,document.cookie=r,d("WS","Cookies:",[document.cookie,r])):(d("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${r}`),d("WS",`Creating websocket connection to ws${t?"s":""}://${Ot()}${St()}`),fa({url:e,serializer:i=>typeof i=="object"?JSON.stringify(i):i,deserializer:i=>{let o=i.data;if(o==="pong")return o;try{return JSON.parse(i.data)}catch{return o}}})}function Mt(){_i.next([mi,Date.now()-yi]),V&&Cn()&&(V.complete(),Ee&&(clearInterval(Ee),Ee=void 0)),d("WS",`Reconnecting in ${Math.min(5e3,It*300||1e3)}ms...`),ne("reconnect",()=>Nn(),Math.min(5e3,(It+1)*300||1e3))}function Xn(){if(Date.now()-qn>4*pi*1e3)return Mt();V?.next("ping")}function xa(t){me.next(!1),d("WS","Websocket error:",t,void 0,"error"),t.status===401&&Ct(),Sn(),Mt()}function on(){bt&&(clearTimeout(bt),bt=void 0)}function $a(){const t=new ge;return t.subscribe(e=>xi(e)),t}function Aa(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=di(t.sys),o=i&&i[t.mod]?i[t.mod][t.index-1||0]:null;if(o){switch(t.cmd){case"bind":n[r]=o.listen(t.name).subscribe(s=>{setTimeout(()=>{e.next({type:"notify",value:s,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[r]&&(n[r].unsubscribe(),delete n[r],Se(`${r}`));break}ne(`${t.id}-response`,()=>{const s={id:t.id,type:"success",value:t.cmd==="exec"?o.call(t.name,t.args):null};e.next(s)},10)}else ne(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?J.SYS_NOT_FOUND:J.MOD_NOT_FOUND}),10)}function er(){for(const t in z)z[t]&&delete z[t]}class fn{constructor(e,n){this._module=e,this.name=n,gi().pipe(_o()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(d("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Se(`rebind:${JSON.stringify(this.binding())}`),d("VAR","Binding dropped due to disconnection, re-binding when possible.",this.binding()),this._stale_bindings=this._binding_count||this._stale_bindings,this._binding_count=0)})}name;_pending=0;_binding_count=0;_stale_bindings=0;get count(){return this._binding_count}get value(){return bi(this.binding())}listen(){return vi(this.binding())}subscribe(e){return this.listen().subscribe(e)}bindThenSubscribe(e){const n=this.bind();return this.listen().subscribe({next:e,complete:()=>n(),error:()=>n()})}bind(){return(this._binding_count<=0&&this._stale_bindings<=0||this._pending===2)&&(this._pending=1,hn(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Si(this.binding()).then(()=>{this._pending===2&&(this._pending=0),this._binding_count--})):this._binding_count=Math.max(this._binding_count-1,0)}async rebind(){!this._stale_bindings&&this._pending!==1||ne(`rebind:${JSON.stringify(this.binding())}`,async()=>{await hn(this.binding()),this._binding_count=this._stale_bindings||1,this._stale_bindings=0},100)}binding(){return{sys:this._module.system.id,mod:this._module.name,index:this._module.index,name:this.name}}}class $i{constructor(e,n){this._system=e,this._id=n}_bindings={};get id(){return`${this.name}_${this.index}`}get system(){return this._system}get index(){const n=this._id.split("_").pop();return parseInt(n||"",10)||1}get name(){const e=this._id.split("_");return e.pop(),e.join("_")}binding(e){return this._bindings[e]||(this._bindings[e]=new fn(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new fn(this,e)),this._bindings[e]}execute(e,n,r=pt){return ki({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class Ai{id;_module_list={};constructor(e){this.id=e}module(e,n=1){if(!e)throw new Error("Invalid module ID");const r=e.split("_");r.length>1&&Number.isInteger(+r[r.length-1])&&(n=+r[r.length-1],r.pop()),n<1&&(n=1);const i=r.join("_");for(this._module_list[i]||(this._module_list[i]=[]);this._module_list[i].length<n;)this._module_list[i].push(new $i(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const sn={};function wi(t){return sn[t]||(sn[t]=new Ai(t)),sn[t]}function wa(t,e,n=1){return wi(t).module(e,n)}exports.AuthType=Qr;exports.EncryptionLevel=xe;exports.MediaAnimation=In;exports.MockPlaceWebsocketModule=hi;exports.MockPlaceWebsocketSystem=fi;exports.PlaceApplication=Br;exports.PlaceCluster=Vr;exports.PlaceDomain=Yr;exports.PlaceDriver=wn;exports.PlaceDriverRole=Ze;exports.PlaceEdge=Jr;exports.PlaceErrorCodes=J;exports.PlaceLDAPSource=Gr;exports.PlaceLogLevel=Rn;exports.PlaceMQTTBroker=Zr;exports.PlaceMetadata=Pn;exports.PlaceModule=Tn;exports.PlaceModuleBinding=$i;exports.PlaceOAuthSource=ei;exports.PlaceProcess=Kr;exports.PlaceRepository=ti;exports.PlaceRepositoryType=En;exports.PlaceResource=B;exports.PlaceSAMLSource=ni;exports.PlaceSettings=fe;exports.PlaceSystem=On;exports.PlaceSystemBinding=Ai;exports.PlaceTrigger=$e;exports.PlaceUser=si;exports.PlaceVariableBinding=fn;exports.PlaceZone=Qt;exports.PlaceZoneMetadata=Xr;exports.SignageMedia=ui;exports.SignagePlaylist=ci;exports.SignagePlaylistMedia=Xt;exports.Survey=ht;exports.SurveyAnswer=Mn;exports.SurveyInvitation=ut;exports.SurveyQuestion=at;exports.TriggerConditionOperator=ri;exports.TriggerTimeConditionType=ii;exports.TriggerWebhookType=oi;exports.addAnswer=Zc;exports.addApplication=ds;exports.addBroker=gs;exports.addDomain=Ps;exports.addDriver=Ms;exports.addEdge=Fs;exports.addInvitation=Jc;exports.addLDAPSource=Qs;exports.addMetadata=Xs;exports.addModule=ou;exports.addOAuthSource=yu;exports.addQuestion=ta;exports.addRepository=ku;exports.addSAMLSource=Cu;exports.addSettings=zu;exports.addSignageMedia=qc;exports.addSignagePlaylist=Fc;exports.addSurvey=ua;exports.addSystem=Ku;exports.addSystemModule=Ju;exports.addSystemTrigger=uc;exports.addTrigger=dc;exports.addUser=bc;exports.addZone=wc;exports.apiEndpoint=he;exports.apiKey=Ve;exports.approveSignagePlaylist=Hc;exports.authorise=kn;exports.authority=Qe;exports.bind=hn;exports.cleanObject=Pr;exports.cleanupAuth=Bo;exports.clientId=Ir;exports.connectionState=_a;exports.consoleHasColours=ln;exports.convertPairStringToMap=Te;exports.create=R;exports.currentUser=gc;exports.debug=ya;exports.debug_events=Un;exports.del=De;exports.deregisterMockEndpoint=jr;exports.deregisterSystem=pa;exports.execute=ki;exports.executeOnSystem=tc;exports.executeOnZone=Tc;exports.functionList=ic;exports.generateNonce=Ar;exports.get=X;exports.getFragments=yn;exports.getModule=wa;exports.getSystem=wi;exports.hasToken=Rr;exports.host=Ot;exports.httpRoute=vn;exports.humanReadableByteCount=We;exports.ignore=ga;exports.invalidateToken=Ct;exports.isDriverCompiled=Us;exports.isFixedDevice=bn;exports.isMobileSafari=Or;exports.isMock=qt;exports.isNestedFrame=Tr;exports.isOnline=Fo;exports.isSecure=qr;exports.isTrusted=Ut;exports.is_connected=Cn;exports.lastRequestTotal=cs;exports.listChildMetadata=tu;exports.listInterfaceRepositories=$u;exports.listMetadata=Vs;exports.listMetadataHistory=Ys;exports.listRemoteRepositoryBranches=wu;exports.listRemoteRepositoryCommits=Pu;exports.listRemoteRepositoryDefaultBranch=Au;exports.listRepositoryBranches=Eu;exports.listRepositoryCommits=Tu;exports.listRepositoryDefaultBranch=Iu;exports.listRepositoryDriverDetails=Mu;exports.listRepositoryDrivers=Ou;exports.listSignagePlaylistMedia=zc;exports.listSignagePlaylistMediaRevisions=Bc;exports.listSystemTriggers=sc;exports.listSystemZones=oc;exports.listTriggerInstances=mc;exports.listZoneTags=xc;exports.listZoneTriggers=Oc;exports.listen=vi;exports.listenForToken=Dr;exports.loadModule=hu;exports.log=d;exports.logout=Ho;exports.lookupModuleState=lu;exports.lookupSystemModuleState=rc;exports.mockSystem=di;exports.moduleRuntimeError=du;exports.moduleSettings=fu;exports.moduleState=au;exports.onlineState=Lo;exports.parseLinkHeader=wr;exports.patch=Ke;exports.post=ke;exports.pullRepositoryChanges=Ru;exports.put=Re;exports.query=O;exports.queryAnswers=Qc;exports.queryApplications=ls;exports.queryBrokers=ms;exports.queryClusters=Ss;exports.queryDomains=$s;exports.queryDrivers=Ts;exports.queryEdges=Cs;exports.queryInvitations=Vc;exports.queryLDAPSources=Bs;exports.queryModules=nu;exports.queryOAuthSources=pu;exports.queryProcesses=ks;exports.queryQuestions=Xc;exports.queryRepositories=vu;exports.querySAMLSources=Du;exports.querySettings=ju;exports.querySignageMedia=Mc;exports.querySignagePlaylists=Cc;exports.querySurveys=ia;exports.querySystems=Wu;exports.querySystemsWithEmails=Qu;exports.queryTriggers=lc;exports.queryUsers=_c;exports.queryZones=kc;exports.recompileDriver=Ds;exports.redirectUri=No;exports.refreshAuthority=Sn;exports.refreshToken=Pt;exports.registerMockEndpoint=ts;exports.registerSystem=da;exports.reloadDriver=qs;exports.remove=I;exports.removeApplication=ps;exports.removeBroker=vs;exports.removeDomain=Os;exports.removeDriver=Rs;exports.removeEdge=Ls;exports.removeFragment=ce;exports.removeInvitation=Gc;exports.removeLDAPSource=Zs;exports.removeMetadata=eu;exports.removeModule=su;exports.removeOAuthSource=gu;exports.removeQuestion=ra;exports.removeRepository=xu;exports.removeSAMLSource=Nu;exports.removeSettings=Bu;exports.removeSignageMedia=Uc;exports.removeSignagePlaylist=Lc;exports.removeSurvey=ca;exports.removeSystem=Yu;exports.removeSystemModule=Gu;exports.removeSystemTrigger=cc;exports.removeTrigger=pc;exports.removeUser=Sc;exports.removeZone=Pc;exports.requestTotal=us;exports.responseHeaders=Lr;exports.retrieveEdgeToken=zs;exports.setAPI_Key=jo;exports.setToken=Mr;exports.settingsHistory=Hu;exports.setup=zo;exports.show=$;exports.showApplication=hs;exports.showBroker=_s;exports.showDomain=As;exports.showDriver=Es;exports.showEdge=Ns;exports.showInvitation=Kc;exports.showLDAPSource=Hs;exports.showMetadata=Js;exports.showModule=ru;exports.showOAuthSource=mu;exports.showQuestion=ea;exports.showRepository=bu;exports.showSAMLSource=qu;exports.showSettings=Fu;exports.showSignage=Ec;exports.showSignageMedia=Rc;exports.showSignageMetrics=Ic;exports.showSignagePlaylist=Nc;exports.showSurvey=oa;exports.showSystem=Zu;exports.showTrigger=hc;exports.showUser=yc;exports.showZone=$c;exports.simplifiedTime=Er;exports.startModule=uu;exports.startSystem=Xu;exports.status=gi;exports.stopModule=cu;exports.stopSystem=ec;exports.systemModuleState=nc;exports.systemSettings=ac;exports.terminateProcess=xs;exports.token=Z;exports.unbind=Si;exports.update=D;exports.updateApplication=fs;exports.updateBroker=ys;exports.updateDomain=ws;exports.updateDriver=Is;exports.updateEdge=js;exports.updateInvitation=Yc;exports.updateLDAPSource=Ws;exports.updateMetadata=Gs;exports.updateModule=iu;exports.updateOAuthSource=_u;exports.updateQuestion=na;exports.updateRepository=Su;exports.updateSAMLSource=Uu;exports.updateSettings=Lu;exports.updateSignageMedia=Dc;exports.updateSignagePlaylist=jc;exports.updateSignagePlaylistMedia=Wc;exports.updateSurvey=sa;exports.updateSystem=Vu;exports.updateTrigger=fc;exports.updateUser=vc;exports.updateZone=Ac;exports.value=bi;exports.websocketRoute=St;
4
4
  //# sourceMappingURL=index.cjs.js.map