@placeos/ts-client 4.7.10 → 4.8.1

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.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(o,$e){typeof exports=="object"&&typeof module<"u"?$e(exports):typeof define=="function"&&define.amd?define(["exports"],$e):(o=typeof globalThis<"u"?globalThis:o||self,$e(o.cloud_uploads={}))})(this,function(o){"use strict";var $e=function(t,e){return $e=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])},$e(t,e)};function ne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");$e(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var xe=function(){return xe=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},xe.apply(this,arguments)};function rs(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 is(t,e,n,r){function i(s){return s instanceof n?s:new n(function(u){u(s)})}return new(n||(n=Promise))(function(s,u){function c(m){try{h(r.next(m))}catch(g){u(g)}}function a(m){try{h(r.throw(m))}catch(g){u(g)}}function h(m){m.done?s(m.value):i(m.value).then(c,a)}h((r=r.apply(t,e||[])).next())})}function sr(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(h){return function(m){return a([h,m])}}function a(h){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,h[0]&&(n=0)),n;)try{if(r=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return n.label++,{value:h[1],done:!1};case 5:n.label++,i=h[1],h=[0];continue;case 7:h=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){n.label=h[1];break}if(h[0]===6&&n.label<s[1]){n.label=s[1],s=h;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(h);break}s[2]&&n.ops.pop(),n.trys.pop();continue}h=e.call(t,n)}catch(m){h=[6,m],i=0}finally{r=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Fe(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 It(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],u;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){u={error:c}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(u)throw u.error}}return s}function qt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function je(t){return this instanceof je?(this.v=t,this):new je(t)}function ss(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",u),i[Symbol.asyncIterator]=function(){return this},i;function u(l){return function(d){return Promise.resolve(d).then(l,g)}}function c(l,d){r[l]&&(i[l]=function(f){return new Promise(function(w,$){s.push([l,f,w,$])>1||a(l,f)})},d&&(i[l]=d(i[l])))}function a(l,d){try{h(r[l](d))}catch(f){_(s[0][3],f)}}function h(l){l.value instanceof je?Promise.resolve(l.value.v).then(m,g):_(s[0][2],l)}function m(l){a("next",l)}function g(l){a("throw",l)}function _(l,d){l(d),s.shift(),s.length&&a(s[0][0],s[0][1])}}function os(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 Fe=="function"?Fe(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(u){return new Promise(function(c,a){u=t[s](u),i(c,a,u.done,u.value)})}}function i(s,u,c,a){Promise.resolve(a).then(function(h){s({value:h,done:c})},u)}}typeof SuppressedError=="function"&&SuppressedError;function N(t){return typeof t=="function"}function $n(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 An=$n(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ (function(o,$e){typeof exports=="object"&&typeof module<"u"?$e(exports):typeof define=="function"&&define.amd?define(["exports"],$e):(o=typeof globalThis<"u"?globalThis:o||self,$e(o.cloud_uploads={}))})(this,function(o){"use strict";var $e=function(t,e){return $e=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])},$e(t,e)};function ne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");$e(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Xe=function(){return Xe=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Xe.apply(this,arguments)};function os(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 us(t,e,n,r){function i(s){return s instanceof n?s:new n(function(u){u(s)})}return new(n||(n=Promise))(function(s,u){function c(m){try{h(r.next(m))}catch(g){u(g)}}function a(m){try{h(r.throw(m))}catch(g){u(g)}}function h(m){m.done?s(m.value):i(m.value).then(c,a)}h((r=r.apply(t,e||[])).next())})}function ur(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(h){return function(m){return a([h,m])}}function a(h){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,h[0]&&(n=0)),n;)try{if(r=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return n.label++,{value:h[1],done:!1};case 5:n.label++,i=h[1],h=[0];continue;case 7:h=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){n.label=h[1];break}if(h[0]===6&&n.label<s[1]){n.label=s[1],s=h;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(h);break}s[2]&&n.ops.pop(),n.trys.pop();continue}h=e.call(t,n)}catch(m){h=[6,m],i=0}finally{r=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Fe(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 It(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],u;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){u={error:c}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(u)throw u.error}}return s}function Mt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function Le(t){return this instanceof Le?(this.v=t,this):new Le(t)}function cs(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",u),i[Symbol.asyncIterator]=function(){return this},i;function u(l){return function(d){return Promise.resolve(d).then(l,g)}}function c(l,d){r[l]&&(i[l]=function(f){return new Promise(function(w,$){s.push([l,f,w,$])>1||a(l,f)})},d&&(i[l]=d(i[l])))}function a(l,d){try{h(r[l](d))}catch(f){_(s[0][3],f)}}function h(l){l.value instanceof Le?Promise.resolve(l.value.v).then(m,g):_(s[0][2],l)}function m(l){a("next",l)}function g(l){a("throw",l)}function _(l,d){l(d),s.shift(),s.length&&a(s[0][0],s[0][1])}}function as(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 Fe=="function"?Fe(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(u){return new Promise(function(c,a){u=t[s](u),i(c,a,u.done,u.value)})}}function i(s,u,c,a){Promise.resolve(a).then(function(h){s({value:h,done:c})},u)}}typeof SuppressedError=="function"&&SuppressedError;function N(t){return typeof t=="function"}function wn(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 Pn=wn(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 Mt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Ae=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,s;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var c=Fe(u),a=c.next();!a.done;a=c.next()){var h=a.value;h.remove(this)}}catch(f){e={error:f}}finally{try{a&&!a.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}else u.remove(this);var m=this.initialTeardown;if(N(m))try{m()}catch(f){s=f instanceof An?f.errors:[f]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var _=Fe(g),l=_.next();!l.done;l=_.next()){var d=l.value;try{cr(d)}catch(f){s=s??[],f instanceof An?s=qt(qt([],It(s)),It(f.errors)):s.push(f)}}}catch(f){r={error:f}}finally{try{l&&!l.done&&(i=_.return)&&i.call(_)}finally{if(r)throw r.error}}}if(s)throw new An(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)cr(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)&&Mt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Mt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),or=Ae.EMPTY;function ur(t){return t instanceof Ae||t&&"closed"in t&&N(t.remove)&&N(t.add)&&N(t.unsubscribe)}function cr(t){N(t)?t():t.unsubscribe()}var us={Promise:void 0},cs={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,qt([t,e],It(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function ar(t){cs.setTimeout(function(){throw t})}function lr(){}function Rt(t){t()}var Ut=function(t){ne(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ur(n)&&n.add(r)):r.destination=hs,r}return e.create=function(n,r,i){return new wn(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}(Ae),as=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){Dt(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Dt(r)}else Dt(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Dt(n)}},t}(),wn=function(t){ne(e,t);function e(n,r,i){var s=t.call(this)||this,u;return N(n)||!n?u={next:n??void 0,error:r??void 0,complete:i??void 0}:u=n,s.destination=new as(u),s}return e}(Ut);function Dt(t){ar(t)}function ls(t){throw t}var hs={closed:!0,next:lr,error:ls,complete:lr},Pn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Tn(t){return t}function fs(t){return t.length===0?Tn:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var j=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,s=ps(e)?e:new wn(e,n,r);return Rt(function(){var u=i,c=u.operator,a=u.source;s.add(c?c.call(s,a):a?i._subscribe(s):i._trySubscribe(s))}),s},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=hr(n),new n(function(i,s){var u=new wn({next:function(c){try{e(c)}catch(a){s(a),u.unsubscribe()}},error:s,complete:i});r.subscribe(u)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[Pn]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return fs(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=hr(e),new e(function(r,i){var s;n.subscribe(function(u){return s=u},function(u){return i(u)},function(){return r(s)})})},t.create=function(e){return new t(e)},t}();function hr(t){var e;return(e=t??us.Promise)!==null&&e!==void 0?e:Promise}function ds(t){return t&&N(t.next)&&N(t.error)&&N(t.complete)}function ps(t){return t&&t instanceof Ut||ds(t)&&ur(t)}function _s(t){return N(t?.lift)}function oe(t){return function(e){if(_s(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 ee(t,e,n,r,i){return new ms(t,e,n,r,i)}var ms=function(t){ne(e,t);function e(n,r,i,s,u,c){var a=t.call(this,n)||this;return a.onFinalize=u,a.shouldUnsubscribe=c,a._next=r?function(h){try{r(h)}catch(m){n.error(m)}}:t.prototype._next,a._error=s?function(h){try{s(h)}catch(m){n.error(m)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=i?function(){try{i()}catch(h){n.error(h)}finally{this.unsubscribe()}}:t.prototype._complete,a}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}(Ut),ys=$n(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),we=function(t){ne(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 On(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new ys},e.prototype.next=function(n){var r=this;Rt(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var u=Fe(r.currentObservers),c=u.next();!c.done;c=u.next()){var a=c.value;a.next(n)}}catch(h){i={error:h}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Rt(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;Rt(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,s=i.hasError,u=i.isStopped,c=i.observers;return s||u?or:(this.currentObservers=null,c.push(n),new Ae(function(){r.currentObservers=null,Mt(c,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,s=r.thrownError,u=r.isStopped;i?n.error(s):u&&n.complete()},e.prototype.asObservable=function(){var n=new j;return n.source=this,n},e.create=function(n,r){return new On(n,r)},e}(j),On=function(t){ne(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}(we),pe=function(t){ne(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,s=n._value;if(r)throw i;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(we),En={now:function(){return(En.delegate||Date).now()},delegate:void 0},In=function(t){ne(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=En);var s=t.call(this)||this;return s._bufferSize=n,s._windowTime=r,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,n),s._windowTime=Math.max(1,r),s}return e.prototype.next=function(n){var r=this,i=r.isStopped,s=r._buffer,u=r._infiniteTimeWindow,c=r._timestampProvider,a=r._windowTime;i||(s.push(n),!u&&s.push(c.now()+a)),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,s=i._infiniteTimeWindow,u=i._buffer,c=u.slice(),a=0;a<c.length&&!n.closed;a+=s?1:2)n.next(c[a]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,s=n._buffer,u=n._infiniteTimeWindow,c=(u?1:2)*r;if(r<1/0&&c<s.length&&s.splice(0,s.length-c),!u){for(var a=i.now(),h=0,m=1;m<s.length&&s[m]<=a;m+=2)h=m;h&&s.splice(0,h+1)}},e}(we),gs=function(t){ne(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(Ae),fr={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,qt([t,e],It(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},vs=function(t){ne(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 s=this.id,u=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(u,s,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(u,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),fr.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&&fr.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,s;try{this.work(n)}catch(u){i=!0,s=u||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Mt(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(gs),dr=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=En.now,t}(),bs=function(t){ne(e,t);function e(n,r){r===void 0&&(r=dr.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}(dr),pr=new bs(vs),Ss=pr,ks=new j(function(t){return t.complete()});function $s(t){return t&&N(t.schedule)}var _r=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function mr(t){return N(t?.then)}function yr(t){return N(t[Pn])}function gr(t){return Symbol.asyncIterator&&N(t?.[Symbol.asyncIterator])}function vr(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 As(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var br=As();function Sr(t){return N(t?.[br])}function kr(t){return ss(this,arguments,function(){var n,r,i,s;return sr(this,function(u){switch(u.label){case 0:n=t.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,je(n.read())];case 3:return r=u.sent(),i=r.value,s=r.done,s?[4,je(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,je(i)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function $r(t){return N(t?.getReader)}function ue(t){if(t instanceof j)return t;if(t!=null){if(yr(t))return ws(t);if(_r(t))return Ps(t);if(mr(t))return Ts(t);if(gr(t))return Ar(t);if(Sr(t))return Os(t);if($r(t))return Es(t)}throw vr(t)}function ws(t){return new j(function(e){var n=t[Pn]();if(N(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ps(t){return new j(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function Ts(t){return new j(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,ar)})}function Os(t){return new j(function(e){var n,r;try{for(var i=Fe(t),s=i.next();!s.done;s=i.next()){var u=s.value;if(e.next(u),e.closed)return}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Ar(t){return new j(function(e){Is(t,e).catch(function(n){return e.error(n)})})}function Es(t){return Ar(kr(t))}function Is(t,e){var n,r,i,s;return is(this,void 0,void 0,function(){var u,c;return sr(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=os(t),a.label=1;case 1:return[4,n.next()];case 2:if(r=a.sent(),!!r.done)return[3,4];if(u=r.value,e.next(u),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=a.sent(),i={error:c},[3,11];case 6:return a.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:a.sent(),a.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 Pe(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var s=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!i)return s}function wr(t,e){return e===void 0&&(e=0),oe(function(n,r){n.subscribe(ee(r,function(i){return Pe(r,t,function(){return r.next(i)},e)},function(){return Pe(r,t,function(){return r.complete()},e)},function(i){return Pe(r,t,function(){return r.error(i)},e)}))})}function Pr(t,e){return e===void 0&&(e=0),oe(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function qs(t,e){return ue(t).pipe(Pr(e),wr(e))}function Ms(t,e){return ue(t).pipe(Pr(e),wr(e))}function Rs(t,e){return new j(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function Us(t,e){return new j(function(n){var r;return Pe(n,e,function(){r=t[br](),Pe(n,e,function(){var i,s,u;try{i=r.next(),s=i.value,u=i.done}catch(c){n.error(c);return}u?n.complete():n.next(s)},0,!0)}),function(){return N(r?.return)&&r.return()}})}function Tr(t,e){if(!t)throw new Error("Iterable cannot be null");return new j(function(n){Pe(n,e,function(){var r=t[Symbol.asyncIterator]();Pe(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function Ds(t,e){return Tr(kr(t),e)}function Cs(t,e){if(t!=null){if(yr(t))return qs(t,e);if(_r(t))return Rs(t,e);if(mr(t))return Ms(t,e);if(gr(t))return Tr(t,e);if(Sr(t))return Us(t,e);if($r(t))return Ds(t,e)}throw vr(t)}function Ns(t,e){return e?Cs(t,e):ue(t)}function Or(t,e){var n=N(t)?t:function(){return t},r=function(i){return i.error(n())};return new j(r)}var Fs=$n(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function js(t,e){return new Promise(function(n,r){var i=!1,s;t.subscribe({next:function(u){s=u,i=!0},error:r,complete:function(){i?n(s):r(new Fs)}})})}function Ls(t){return t instanceof Date&&!isNaN(t)}function b(t,e){return oe(function(n,r){var i=0;n.subscribe(ee(r,function(s){r.next(t.call(e,s,i++))}))})}function Hs(t,e,n,r,i,s,u,c){var a=[],h=0,m=0,g=!1,_=function(){g&&!a.length&&!h&&e.complete()},l=function(f){return h<r?d(f):a.push(f)},d=function(f){h++;var w=!1;ue(n(f,m++)).subscribe(ee(e,function($){e.next($)},function(){w=!0},void 0,function(){if(w)try{h--;for(var $=function(){var T=a.shift();u||d(T)};a.length&&h<r;)$();_()}catch(T){e.error(T)}}))};return t.subscribe(ee(e,l,function(){g=!0,_()})),function(){}}function Er(t,e,n){return n===void 0&&(n=1/0),N(e)?Er(function(r,i){return b(function(s,u){return e(r,s,i,u)})(ue(t(r,i)))},n):(typeof e=="number"&&(n=e),oe(function(r,i){return Hs(r,i,t,n)}))}function qn(t,e,n){t===void 0&&(t=0),n===void 0&&(n=Ss);var r=-1;return e!=null&&($s(e)?n=e:r=e),new j(function(i){var s=Ls(t)?+t-n.now():t;s<0&&(s=0);var u=0;return n.schedule(function(){i.closed||(i.next(u++),0<=r?this.schedule(void 0,r):i.complete())},s)})}function zs(t,e){return oe(function(n,r){var i=0;n.subscribe(ee(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function Ir(t){return t<=0?function(){return ks}:oe(function(e,n){var r=0;e.subscribe(ee(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Ws(t){return b(function(){return t})}function Bs(t,e){return Er(function(n,r){return ue(t(n,r)).pipe(Ir(1),Ws(n))})}function Qs(t,e){e===void 0&&(e=pr);var n=qn(t,e);return Bs(function(){return n})}function Vs(t,e){return e===void 0&&(e=Tn),t=t??Zs,oe(function(n,r){var i,s=!0;n.subscribe(ee(r,function(u){var c=e(u);(s||!t(i,c))&&(s=!1,i=c,r.next(u))}))})}function Zs(t,e){return t===e}function Gs(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,s=e.resetOnSuccess,u=s===void 0?!1:s;return r<=0?Tn:oe(function(c,a){var h=0,m,g=function(){var _=!1;m=c.subscribe(ee(a,function(l){u&&(h=0),a.next(l)},void 0,function(l){if(h++<r){var d=function(){m?(m.unsubscribe(),m=null,g()):_=!0};if(i!=null){var f=typeof i=="number"?qn(i):ue(i(l,h)),w=ee(a,function(){w.unsubscribe(),d()},function(){a.complete()});f.subscribe(w)}else d()}else a.error(l)})),_&&(m.unsubscribe(),m=null,g())};g()})}function qr(t,e){return oe(function(n,r){var i=null,s=0,u=!1,c=function(){return u&&!i&&r.complete()};n.subscribe(ee(r,function(a){i?.unsubscribe();var h=0,m=s++;ue(t(a,m)).subscribe(i=ee(r,function(g){return r.next(e?e(a,g,m,h++):g)},function(){i=null,c()}))},function(){u=!0,c()}))})}function Mn(t,e){e===void 0&&(e={});var n=e.selector,r=rs(e,["selector"]);return new j(function(i){var s=new AbortController,u=s.signal,c=!0,a=r.signal;if(a)if(a.aborted)s.abort();else{var h=function(){u.aborted||s.abort()};a.addEventListener("abort",h),i.add(function(){return a.removeEventListener("abort",h)})}var m=xe(xe({},r),{signal:u}),g=function(_){c=!1,i.error(_)};return fetch(t,m).then(function(_){n?ue(n(_)).subscribe(ee(i,void 0,function(){c=!1,i.complete()},g)):(c=!1,i.next(_),i.complete())}).catch(g),function(){c&&s.abort()}})}const ce=["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","+","/"],Mr=[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 Ct(t){if(t>=Mr.length)throw new Error("Unable to parse base64 string.");const e=Mr[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function Rr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=ce[t[n-2]>>2],e+=ce[(t[n-2]&3)<<4|t[n-1]>>4],e+=ce[(t[n-1]&15)<<2|t[n]>>6],e+=ce[t[n]&63];return n===r+1&&(e+=ce[t[n-2]>>2],e+=ce[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=ce[t[n-2]>>2],e+=ce[(t[n-2]&3)<<4|t[n-1]>>4],e+=ce[(t[n-1]&15)<<2],e+="="),e}function Ks(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)),s;for(let u=0,c=0;u<r;u+=4,c+=3)s=Ct(t.charCodeAt(u))<<18|Ct(t.charCodeAt(u+1))<<12|Ct(t.charCodeAt(u+2))<<6|Ct(t.charCodeAt(u+3)),i[c]=s>>16,i[c+1]=s>>8&255,i[c+2]=s&255;return i.subarray(0,i.length-n)}function Ys(t,e=new TextEncoder){return Rr(e.encode(t))}var Nt={exports:{}},Js=Nt.exports,Ur;function xs(){return Ur||(Ur=1,function(t){(function(e,n){var r={};n(r);var i=r.default;for(var s in r)i[s]=r[s];t.exports=i})(Js,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(_,l,d,f,w){for(var $,T,O,Y,z,D,se,W,Q,B,Ot,Et,kn;w>=64;){for($=l[0],T=l[1],O=l[2],Y=l[3],z=l[4],D=l[5],se=l[6],W=l[7],B=0;B<16;B++)Ot=f+B*4,_[B]=(d[Ot]&255)<<24|(d[Ot+1]&255)<<16|(d[Ot+2]&255)<<8|d[Ot+3]&255;for(B=16;B<64;B++)Q=_[B-2],Et=(Q>>>17|Q<<15)^(Q>>>19|Q<<13)^Q>>>10,Q=_[B-15],kn=(Q>>>7|Q<<25)^(Q>>>18|Q<<14)^Q>>>3,_[B]=(Et+_[B-7]|0)+(kn+_[B-16]|0);for(B=0;B<64;B++)Et=(((z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&D^~z&se)|0)+(W+(n[B]+_[B]|0)|0)|0,kn=(($>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10))+($&T^$&O^T&O)|0,W=se,se=D,D=z,z=Y+Et|0,Y=O,O=T,T=$,$=Et+kn|0;l[0]+=$,l[1]+=T,l[2]+=O,l[3]+=Y,l[4]+=z,l[5]+=D,l[6]+=se,l[7]+=W,f+=64,w-=64}return f}var i=function(){function _(){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 _.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},_.prototype.clean=function(){for(var l=0;l<this.buffer.length;l++)this.buffer[l]=0;for(var l=0;l<this.temp.length;l++)this.temp[l]=0;this.reset()},_.prototype.update=function(l,d){if(d===void 0&&(d=l.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=d,this.bufferLength>0){for(;this.bufferLength<64&&d>0;)this.buffer[this.bufferLength++]=l[f++],d--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(d>=64&&(f=r(this.temp,this.state,l,f,d),d%=64);d>0;)this.buffer[this.bufferLength++]=l[f++],d--;return this},_.prototype.finish=function(l){if(!this.finished){var d=this.bytesHashed,f=this.bufferLength,w=d/536870912|0,$=d<<3,T=d%64<56?64:128;this.buffer[f]=128;for(var O=f+1;O<T-8;O++)this.buffer[O]=0;this.buffer[T-8]=w>>>24&255,this.buffer[T-7]=w>>>16&255,this.buffer[T-6]=w>>>8&255,this.buffer[T-5]=w>>>0&255,this.buffer[T-4]=$>>>24&255,this.buffer[T-3]=$>>>16&255,this.buffer[T-2]=$>>>8&255,this.buffer[T-1]=$>>>0&255,r(this.temp,this.state,this.buffer,0,T),this.finished=!0}for(var O=0;O<8;O++)l[O*4+0]=this.state[O]>>>24&255,l[O*4+1]=this.state[O]>>>16&255,l[O*4+2]=this.state[O]>>>8&255,l[O*4+3]=this.state[O]>>>0&255;return this},_.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},_.prototype._saveState=function(l){for(var d=0;d<this.state.length;d++)l[d]=this.state[d]},_.prototype._restoreState=function(l,d){for(var f=0;f<this.state.length;f++)this.state[f]=l[f];this.bytesHashed=d,this.finished=!1,this.bufferLength=0},_}();e.Hash=i;var s=function(){function _(l){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var d=new Uint8Array(this.blockSize);if(l.length>this.blockSize)new i().update(l).finish(d).clean();else for(var f=0;f<l.length;f++)d[f]=l[f];for(var f=0;f<d.length;f++)d[f]^=54;this.inner.update(d);for(var f=0;f<d.length;f++)d[f]^=106;this.outer.update(d),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var f=0;f<d.length;f++)d[f]=0}return _.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},_.prototype.clean=function(){for(var l=0;l<this.istate.length;l++)this.ostate[l]=this.istate[l]=0;this.inner.clean(),this.outer.clean()},_.prototype.update=function(l){return this.inner.update(l),this},_.prototype.finish=function(l){return this.outer.finished?this.outer.finish(l):(this.inner.finish(l),this.outer.update(l,this.digestLength).finish(l)),this},_.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},_}();e.HMAC=s;function u(_){var l=new i().update(_),d=l.digest();return l.clean(),d}e.hash=u,e.default=u;function c(_,l){var d=new s(_).update(l),f=d.digest();return d.clean(),f}e.hmac=c;function a(_,l,d,f){var w=f[0];if(w===0)throw new Error("hkdf: cannot expand more");l.reset(),w>1&&l.update(_),d&&l.update(d),l.update(f),l.finish(_),f[0]++}var h=new Uint8Array(e.digestLength);function m(_,l,d,f){l===void 0&&(l=h),f===void 0&&(f=32);for(var w=new Uint8Array([1]),$=c(l,_),T=new s($),O=new Uint8Array(T.digestLength),Y=O.length,z=new Uint8Array(f),D=0;D<f;D++)Y===O.length&&(a(O,T,d,w),Y=0),z[D]=O[Y++];return T.clean(),O.fill(0),w.fill(0),z}e.hkdf=m;function g(_,l,d,f){for(var w=new s(_),$=w.digestLength,T=new Uint8Array(4),O=new Uint8Array($),Y=new Uint8Array($),z=new Uint8Array(f),D=0;D*$<f;D++){var se=D+1;T[0]=se>>>24&255,T[1]=se>>>16&255,T[2]=se>>>8&255,T[3]=se>>>0&255,w.reset(),w.update(l),w.update(T),w.finish(Y);for(var W=0;W<$;W++)O[W]=Y[W];for(var W=2;W<=d;W++){w.reset(),w.update(Y).finish(Y);for(var Q=0;Q<$;Q++)O[Q]^=Y[Q]}for(var W=0;W<$&&D*$+W<f;W++)z[D*$+W]=O[W]}for(var D=0;D<$;D++)O[D]=Y[D]=0;for(var D=0;D<4;D++)T[D]=0;return w.clean(),z}e.pbkdf2=g})}(Nt)),Nt.exports}var Xs=xs();const eo=new Int32Array(4);class G{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 G;static _hex(e){const n=G.hexChars,r=G.hexOut;let i,s,u,c;for(c=0;c<4;c+=1)for(s=c*8,i=e[c],u=0;u<8;u+=2)r[s+1+u]=n.charAt(i&15),i>>>=4,r[s+0+u]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],s=e[2],u=e[3];r+=(i&s|~i&u)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[1]-389564586|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[2]+606105819|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&u)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[5]+1200080426|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[6]-1473231341|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&u)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[9]-1958414417|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[10]-42063|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&u)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[13]-40341101|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[14]-1502002290|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+s|0,r+=(i&u|s&~u)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[6]-1069501632|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[11]+643717713|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+s|0,r+=(i&u|s&~u)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[10]+38016083|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[15]-660478335|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+s|0,r+=(i&u|s&~u)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[14]-1019803690|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[3]-187363961|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+s|0,r+=(i&u|s&~u)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[2]-51403784|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[7]+1735328473|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+s|0,r+=(i^s^u)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[8]-2022574463|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[11]+1839030562|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^u)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[4]+1272893353|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[7]-155497632|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^u)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[0]-358537222|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[3]-722521979|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^u)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[12]-421815835|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[15]+530742520|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+s|0,r+=(s^(i|~u))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[7]+1126891415|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[14]-1416354905|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~u))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[3]-1894986606|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[10]-1051523|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~u))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[15]-30611744|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[6]-1560198380|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~u))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[11]-1120210379|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[2]+718787259|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=s+e[2]|0,e[3]=u+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(G.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,u;for(u=0;u<e.length;u+=1){if(s=e.charCodeAt(u),s<128)n[i++]=s;else if(s<2048)n[i++]=(s>>>6)+192,n[i++]=s&63|128;else if(s<55296||s>56319)n[i++]=(s>>>12)+224,n[i++]=s>>>6&63|128,n[i++]=s&63|128;else{if(s=(s-55296)*1024+(e.charCodeAt(++u)-56320)+65536,s>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(s>>>18)+240,n[i++]=s>>>12&63|128,n[i++]=s>>>6&63|128,n[i++]=s&63|128}i>=64&&(this._dataLength+=64,G._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,s,u=0;for(;;){for(s=Math.min(e.length-u,64-i);s--;)n[i++]=e.charCodeAt(u++);if(i<64)break;this._dataLength+=64,G._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,u=0;for(;;){for(s=Math.min(e.length-u,64-i);s--;)n[i++]=e[u++];if(i<64)break;this._dataLength+=64,G._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 s;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],s=0;s<n.length;s+=1)this._buffer8[s]=n.charCodeAt(s)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,s=(n>>2)+1;this._dataLength+=n;const u=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(G.buffer32Identity.subarray(s),s),n>55&&(G._md5cycle(this._state,i),i.set(G.buffer32Identity)),u<=4294967295)i[14]=u;else{const c=u.toString(16).match(/(.*?)(.{0,8})$/);if(c===null)return e?eo:"";const a=parseInt(c[2],16),h=parseInt(c[1],16)||0;i[14]=a,i[15]=h}return G._md5cycle(this._state,i),e?this._state:G._hex(this._state)}}if(G.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const to=36e5,Dr=Symbol.for("constructDateFrom");function Ft(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Dr in t?t[Dr](e):t instanceof Date?new t.constructor(e):new Date(e)}function Xe(t,e){return Ft(t,t)}function no(t,e,n){const r=Xe(t);if(isNaN(e))return Ft(t,NaN);const i=r.getDate(),s=Ft(t,r.getTime());s.setMonth(r.getMonth()+e+1,0);const u=s.getDate();return i>=u?s:(r.setFullYear(s.getFullYear(),s.getMonth(),i),r)}function Cr(t,e,n){return Ft(t,+Xe(t)+e)}function ro(t,e,n){return Cr(t,e*to)}function io(t,e,n){return Cr(t,e*1e3)}function so(t,e,n){return no(t,e*12)}function Nr(t){return Math.trunc(+Xe(t)/1e3)}function oo(t,e){return+Xe(t)<+Xe(e)}function p(t,e,n,r="debug",i){if(window.debug){const u=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?Rn()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...u,n):console[r](`[PlaceOS][${t}] ${e}`,n):Rn()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...u):console[r](`[PlaceOS][${t}] ${e}`)}}function Rn(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function Un(){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=Le(i[0]),e||(e=i[1])}else n=Le(t);let r={};return e&&(r=Le(e)),{...n,...r}}function Le(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 Fr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function jr(t=40){let e="";for(let n=0;n<t;n++)e+=Fr.charAt(Math.floor(Math.random()*Fr.length));return e}function _e(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 et(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 Lr(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 s=i[0].replace(/<(.*)>/,"$1").trim(),u=i[1].replace(/rel="(.*)"/,"$1").trim();n[u]=s}return n}function Hr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function zr(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Wr(){return window.location!==window.parent.location}function Br(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class uo{abort(){p("Stub","Aborted")}}function U(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 Te={},tt={},me={};function co(){for(const t in Te)Te.hasOwnProperty(t)&&Oe(t);for(const t in tt)tt.hasOwnProperty(t)&&ao(t);for(const t in me)me.hasOwnProperty(t)&&lo(t)}function ae(t,e,n=300){if(t&&e&&e instanceof Function)Oe(t),Te[t]=setTimeout(()=>{e(),delete Te[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Oe(t){Te[t]&&(clearTimeout(Te[t]),delete Te[t])}function ao(t){tt[t]&&(clearInterval(tt[t]),delete tt[t])}function lo(t){me&&me[t]&&(me[t]instanceof Ae?me[t].unsubscribe():me[t](),delete me[t])}const ho={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={},M=localStorage,L;const S={};let R="",Ee="";const He=new pe(""),jt=new pe("");let Dn="/api/engine/v2";const ye=new pe(!1),fo=ye.asObservable();let Lt=0;function Qr(t){if(!t||t.startsWith("http://")||t.startsWith("https://"))return t;const e=L?.domain;return e?`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${e}${t}`:t}function A(){return`${`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${v.host||window.location?.host}`}${Cn()}`}function Cn(){return v.version==="ACA Engine"?"/control/api":Dn}function po(){return!!v.token_header}function Vr(){return R}function _o(){return v.redirect_uri}function mo(t,e=!0){M.setItem(`${R}_x-api-key`,`${t}`),M.setItem("trusted",`${e}`),Zr("x-api-key",so(new Date,5).valueOf())}function nt(){return Qt("x-api-key",!1)||""}function Zr(t,e=ro(new Date,2).valueOf()){v.ignore_api_key&&t==="x-api-key"||(M.setItem(`${R}_expires_at`,`${e}`),M.setItem(`${R}_access_token`,t))}function J(t=!0){if(v.mock)return"mock-token";if(!M)return"";if(nt()&&!v.ignore_api_key)return"x-api-key";const e=M.getItem(`${R}_expires_at`)||"",n=He.getValue();return oo(+e,new Date)&&(p("Auth","Token expired. Requesting new token..."),Vt(),S.load_authority||(Lt+=1,ae("re-authorise",async()=>{delete S.authorise,await jn().catch(r=>p("Auth",`Failed to get token: ${r}`))},200*Math.min(20,Lt))),!t)?"":n||M.getItem(`${R}_access_token`)||""}function Ht(){return jt.getValue()||M.getItem(`${R}_refresh_token`)||""}function zt(){return v.host||window.location?.host}function Gr(){return!!J()}function Kr(){return He.pipe(b(t=>!!Gr()))}function rt(){return L}function yo(){return ye.getValue()}function Wt(){return!!v.mock}function Yr(){return!!v.secure}function go(){return fo}function Bt(){return Qt("trust")==="true"||Qt("trusted")==="true"}function Nn(){return!!nt()&&!v.ignore_api_key||Qt("fixed_device")==="true"}function Qt(t,e=!0){let r=Un()[t];if(M){const i=`${Vr()}_${t}`;r=r||M.getItem(i)||M.getItem(t)||"",e&&M.setItem(i,`${r}`)}return r}async function vo(t){return v=t||v,v.token_header=v.token_header??Wr(),window.AbortController||(window.AbortController=uo),M=v.storage==="session"?sessionStorage:localStorage,R=G.hashStr(v.redirect_uri,!1),v.delay&&v.delay>0&&await js(qn(v.delay)),Ln()}function bo(t){M=t==="session"?sessionStorage:localStorage}function So(){v={},L=void 0,He.next(""),jt.next(""),ye.next(!1),R="",Ee="",Dn="/api/engine/v2";for(const t in S)t in S&&delete S[t];co()}function Fn(){return p("Auth","Refreshing authorty."),L=void 0,Ln()}function Vt(){p("Auth","Invalidating tokens."),M.removeItem(`${R}_access_token`),M.removeItem(`${R}_expires_at`),He.getValue()&&He.next("")}function jn(t,e=L){return S.authorise||(S.authorise=new Promise((n,r)=>{if(!e)return delete S.authorise,r("Authority is not loaded");p("Auth","Authorising user...");const i=()=>{if(J(!1))p("Auth","Valid token found."),delete S.authorise,n(J());else{const s=[()=>{p("Auth","Successfully generated token."),n(J()),delete S.authorise},()=>{p("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete S.authorise,200)}];v&&v.auth_type==="password"?(p("Auth","Logging in with credentials."),qo(v).then(...s),Lt=0):Ee||Ht()?(p("Auth",`Generating token with ${Ee?"code":"refresh token"}`),ei().then(...s),Lt=0):e.session?(p("Auth","Users has session. Authorising application..."),$o(t).then(...s)):(p("Auth","No user session"),xr(e),r("No user session"),setTimeout(()=>delete S.authorise,200))}};wo().then(i,i)})),S.authorise}function ko(){const t=Qr(L?L.logout_url:"/logout");fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+J()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<M.length;r++){const i=M.key(r);i&&i.indexOf(R)>=0&&M.removeItem(i)}window.location?.assign(n)})}function Ln(t=0){return S.load_authority||(S.load_authority=new Promise(e=>{if(ye.next(!1),v.mock){L=ho,p("Auth","System in mock mode"),ye.next(!0),e();return}p("Auth",`Fixed: ${Nn()} | Trusted: ${Bt()}`),p("Auth","Loading authority...");const n=v.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{p("Auth",`Failed to load authority(${i})`),ye.next(!1),ae("load_authority",()=>{delete S.load_authority,Ln(t).then(s=>e())},300*Math.min(20,++t))};Mn(`${n?"https:":"http:"}//${zt()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(u=>u));L=await i.json(),Dn=/[2-9]\.[0-9]+\.[0-9]+/g.test(L.version||"")?"/api/engine/v2":"/control/api",p("Auth","Loaded authority.",[],"group"),L&&(p("Auth",`Name: ${L.name}`),p("Auth",`Version: ${L.version}`),p("Auth",`Domain: ${L.domain}`),p("Auth",`Session: ${L.session}`),p("Auth",`Production: ${L.production}`),p("Auth",`Config Keys: ${Object.keys(L.config||{}).length}`)),p("Auth","",[],"groupEnd");const s=()=>{ye.next(!0),p("Auth","Application set online."),e()};delete S.load_authority,jn("").then(s,s)},r)})),S.load_authority}async function $o(t){const e=To(t);if(v.use_iframe)return Ao(e);window.location?.assign(e)}function Ao(t){return S.iframe_auth||(S.iframe_auth=new Promise((e,n)=>{p("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=s=>{if(s.origin===window.location?.origin&&s.data.type==="place-os"){const u=s.data;if(p("Auth","Received credentials from iFrame..."),document.body.removeChild(r),Oe("iframe_auth"),window.removeEventListener("message",i),delete S.iframe_auth,u.token)return e(),Hn({access_token:u.token,...u});Ee=u.code||"",ei().then(c=>e(c),c=>n(c))}};ae("iframe_auth",()=>{p("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",i),r.onerror=s=>{p("Auth","iFrame error.",s),delete S.iframe_auth,n()},document.body.appendChild(r)})),S.iframe_auth}let Jr=!1;function xr(t){if(v.handle_login!==!1&&!Jr){p("Auth","Redirecting to login page...");const e=Qr(t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href)));throw setTimeout(()=>window.location?.assign(e),300),Jr=!0,new Error("Redirecting to login page...")}else p("Auth","Login being handled locally.");delete S.authorise}function wo(){return S.check_token||(S.check_token=new Promise(async(t,e)=>{J()?(p("Auth","Valid token found."),t(J())):(p("Auth","No token. Checking URL for auth credentials..."),await Po()?t(!0):e()),delete S.check_token})),S.check_token}function Po(){return S.check_params||(S.check_params=new Promise(t=>{p("Auth","Checking for auth parameters...");let e=Un();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&&(Ee=e.code,_e("code")),e.refresh_token&&(M.setItem(`${R}_refresh_token`,e.refresh_token),_e("refresh_token"));const n=M.getItem(`${R}_nonce`)||"",r=(e.state||"").split(";");_e("state"),_e("token_type");const i=r[0];n===i?(Hn(e),t(!!e.access_token)):t(!1)}else t(!1);ae("check_params_promise",()=>delete S.check_params,50)})),S.check_params}function To(t){const e=Mo();t=t?`${e};${t}`:e;const n=v?(v.auth_uri||"").indexOf("?")>=0:!1,r=(v?v.auth_uri:null)||"/auth/oauth/authorize",i=Bt()||v.auth_type==="auth_code"?"code":"token";let s=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(R)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(v.redirect_uri)}&scope=${encodeURIComponent(v.scope)}`;if(v.auth_type==="auth_code"){const{challenge:u,verify:c}=Oo();sessionStorage.setItem(`${R}_challenge`,u),s+="&code_challenge_method=S256",s+=`&code_challenge=${c}`}return s}const Xr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Oo(t=43){const e=new Array(t).fill(0).map(()=>Xr[Math.floor(Math.random()*Xr.length)]).join(""),n=Ks(Ys(e)),r=Rr(Xs.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function Eo(){let e=(v.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(R)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(v.redirect_uri)}`,Ht()){e+=`&refresh_token=${encodeURIComponent(Ht())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(Ee)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${R}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${R}_challenge`)),Ee=""}return[e,n]}function Io(t){const e=t.token_uri||"/auth/token",n=U({grant_type:"password",client_id:R,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 ei(){return ti(...Eo())}function qo(t){return ti(Io(t))}function ti(t,e=""){return S.generate_tokens||(S.generate_tokens=new Promise((n,r)=>{p("Auth","Generating new token...");const i=s=>{p("Auth","Error generating new tokens.",s),M.removeItem(`${R}_refresh_token`),jt.next(""),r(),delete S.generate_tokens};Mn(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async s=>{if(!s.ok)return i(s);const u=await s.json();Hn(u),n(),delete S.generate_tokens},i)})),S.generate_tokens}function Hn(t){const e=io(new Date,Math.max(60,parseInt(t.expires_in,10)-300));p("Auth","Tokens generated storing..."),Bt()&&(t.access_token&&(M.setItem(`${R}_access_token`,t.access_token),_e("access_token")),t.refresh_token&&(M.setItem(`${R}_refresh_token`,t.refresh_token),_e("refresh_token"))),t.expires_in&&(M.setItem(`${R}_expires_at`,`${e.valueOf()}`),_e("expires_in")),ye.next(!0),He.next(t.access_token||""),jt.next(t.refresh_token||"")}function Mo(){const t=jr();return M.setItem(`${R}_nonce`,t),t}const Zt={};let ni=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,p("HTTP(M)",`404 ${t}:`,e),Or(n)};function Ro(t){ni=t}function Uo(t,e=Zt){ri(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(s=>s[0]===":"?s.replace(":",""):"")};e[n]=i,p("HTTP(M)",`+ ${t.method} ${t.path}`)}function ri(t,e,n=Zt){const r=`${t}|${e}`;n[r]&&(delete n[r],p("HTTP(M)",`- ${t} ${e}`))}function Do(t,e,n,r=Zt){const i=Co(t,e,r);if(i){const s=No(e,i,n);return Fo(i,s)}return ni(t,e)}function Co(t,e,n=Zt){const i=e.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),s=Object.keys(n).reduce((u,c)=>(c.indexOf(`${t}|`)===0&&u.push(n[c]),u),[]);for(const u of s)if(u.path_structure.length===i.length){let c=!0;for(let a=0;a<u.path_structure.length;a++)if(!u.path_structure[a]&&u.path_parts[a]!==i[a]){c=!1;break}if(c)return u}return null}function No(t,e,n){const r=t.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").split("?"),i=r[0].replace(/^\//,""),s=r[1]||"",u=Le(s),c=i.split("/"),a={};for(let m=0;m<e.path_structure.length;m++){const g=e.path_structure[m];g&&(a[g]=c[m])}const h={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:a,query_params:u,body:n};return p("HTTP(M)",`MATCHED ${h.method}:`,h),h}function Fo(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(u){throw p("HTTP(M)",`ERROR ${e.method}:`,[e.url,u]),u}const r=t.delay_variance||100,i=t.delay||300,s=Math.floor(Math.random()*r-r/2)+i;return p("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),Ns([n]).pipe(Qs(Math.max(200,s)))}const ii={};function si(t,e=ii){return e[t]||{}}function F(t,e,n=it){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function K(t,e,n,r=it){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function Ie(t,e,n,r=it){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function ze(t,e,n,r=it){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function ge(t,e,n=it){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function jo(t,e,n=ii){if(t.headers){const r={};t.headers.forEach?t.headers.forEach((i,s)=>r[s.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 oi=()=>(Vt(),Fn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{oi().then(()=>t())},1e3)})));function it(t,e,n,r=Wt,i=Do,s=jo){if(r()){const u=i(t,e,n?.body);if(u)return u}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Kr().pipe(zs(u=>u),Ir(1),qr(u=>{J()==="x-api-key"?n.headers["X-API-Key"]=nt():n.headers.Authorization=`Bearer ${J()}`;const c={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(c.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),Mn(e,c)}),qr(u=>u.ok?s(u,n.response_type):Or(u)),Gs({count:4,delay:(u,c)=>new j(a=>{if(u.status===511){xr(rt()),a.error(u);return}if(u.status!==401){a.error(u||{});return}p("HTTP","Auth error",u);const h=Math.pow(2,c-1)*1e3;oi().then(()=>{a.next(h),a.complete()}).catch(()=>{a.error(u)})})}))}class H{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,Hr(e,[void 0,null,""])}}class ui extends H{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;any_match;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1,this.conditions=e.conditions||{time_dependents:[],comparisons:[]},this.severity=e.severity||"low",this.alert_type=e.alert_type||"threshold",this.debounce_period=e.debounce_period||0,this.alert_dashboard_id=e.alert_dashboard_id||"",this.alert_dashboard_details=e.alert_dashboard_details||void 0,this.any_match=e.any_match||!1}}class ci extends H{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const We="alert_dashboards";function Gt(t){return new ci(t)}function Lo(t={}){return P({query_params:t,fn:Gt,path:We})}function Ho(t){return k({id:t,query_params:{},fn:Gt,path:We})}function zo(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:Gt,path:We})}function Wo(t){return I({form_data:t,query_params:{},fn:Gt,path:We})}function Bo(t){return E({id:t,query_params:{},path:We})}function Qo(t){return P({query_params:{},fn:ot,path:`${We}/${t}/alerts`})}const st="alerts";function ot(t){return new ui(t)}function Vo(t={}){return P({query_params:t,fn:ot,path:st})}function Zo(t,e={}){return k({id:t,query_params:e,fn:ot,path:st})}function Go(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:ot,path:st})}function Ko(t){return I({form_data:t,query_params:{},fn:ot,path:st})}function Yo(t){return E({id:t,query_params:{},path:st})}class ai extends H{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 Jo(t){return li[t]||0}function xo(t){return hi[t]||0}let li={},hi={},fi="";const Kt=t=>t;function P(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,s=U(e),u=`${i||A()}${r?"/"+r:""}${s?"?"+s:""}`;return F(u).pipe(b(c=>{const a=Xo(u,s,r);return{total:a.total||0,next:a.next?()=>P({query_params:a.next,fn:n,endpoint:i,path:r}):null,data:c&&c instanceof Array?c.map(h=>(n||Kt)(h)):c&&!(c instanceof Array)&&c.results?c.results.map(h=>h):[]}}))}function k(t){const{query_params:e,id:n,path:r,fn:i,options:s}=t,u=U(e),c=`${A()}/${r}/${n}${u?"?"+u:""}`;return F(c,s).pipe(b(a=>(i||Kt)(a)))}function I(t){const{query_params:e,form_data:n,path:r,fn:i}=t,s=U(e),u=`${A()}/${r}${s?"?"+s:""}`;return K(u,n).pipe(b(a=>(i||Kt)(a)))}function y(t){const{id:e,task_name:n,form_data:r,method:i,path:s,callback:u}=t,c=U(r),a=`${A()}/${s}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?Ie:K)(a,r):(i==="del"?ge:F)(`${a}${c?"?"+c:""}`,{response_type:"json"})).pipe(b(m=>(u||(g=>g))(m)))}function q(t){const{id:e,query_params:n,form_data:r,method:i,path:s,fn:u}=t,c=U({...n,version:r.version||0}),a=`${A()}/${s}/${e}${c?"?"+c:""}`;return(i==="put"?Ie:ze)(a,r).pipe(b(h=>(u||Kt)(h)))}function E(t){const{id:e,query_params:n,path:r}=t,i=U(n),s=`${A()}/${r}/${e}${i?"?"+i:""}`;return ge(s)}function Xo(t,e,n){const r=si(t[0]==="/"?`${location.origin}${t}`:t),i={total:0,next:null};if(r&&r["x-total-count"]){const s=+(r["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(li[n]=s),hi[n]=s,i.total=s}return r&&r.link&&(fi=Lr(r.link||"").next,i.next=Le(fi.split("?")[1])),i}function Eh(t){return t}const ut="oauth_apps";function Yt(t){return new ai(t)}function eu(t={}){return P({query_params:t,fn:Yt,path:ut})}function tu(t){return k({id:t,query_params:{},fn:Yt,path:ut})}function nu(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:Yt,path:ut})}function ru(t){return I({form_data:t,query_params:{},fn:Yt,path:ut})}function iu(t){return E({id:t,query_params:{},path:ut})}var di=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(di||{});class pi extends H{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 ct="brokers";function Jt(t){return new pi(t)}function su(t={}){return P({query_params:t,fn:Jt,path:ct})}function ou(t,e={}){return k({id:t,query_params:e,fn:Jt,path:ct})}function uu(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:ct})}function cu(t){return I({form_data:t,query_params:{},fn:Jt,path:ct})}function au(t,e={}){return E({id:t,query_params:e,path:ct})}class _i{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=et(this.memory_usage*1024),this.total_memory=et(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 mi{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=et(this.memory_usage*1024),this.total_memory=et(this.memory_total*1024)}}const Be="cluster";function yi(t){return new _i(t)}function lu(t={}){return P({query_params:t,fn:yi,path:Be})}function hu(t,e={}){return k({id:t,query_params:e,fn:yi,path:Be})}function fu(t,e={}){return k({id:t,query_params:e,fn:n=>n.map(r=>new mi(t,r)),path:Be})}function du(t,e){return E({id:t,query_params:e,path:Be})}function pu(){const t=`${A()}${Be}/rebalance`;return K(t,{}).pipe(b(()=>{}))}function _u(){const t=`${A()}${Be}/versions`;return F(t).pipe(b(e=>e))}class gi extends H{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 Qe="domains";function at(t){return new gi(t)}function mu(t={}){return P({query_params:t,fn:at,path:Qe})}function yu(t){return k({id:t,query_params:{},fn:at,path:Qe})}function gu(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:at,path:Qe})}function vu(t){return I({form_data:t,query_params:{},fn:at,path:Qe})}function bu(t){return E({id:t,query_params:{},path:Qe})}function Su(t){const e=`${A()}${Qe}/lookup/${encodeURIComponent(t)}`;return F(e).pipe(b(n=>at(n)))}var qe=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(qe||{});class ve extends H{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||qe.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var lt=(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))(lt||{});class zn extends H{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;alert_level;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??lt.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.alert_level=e.alert_level||"medium",this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in qe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}}const le="drivers";function xt(t){return new zn(t)}function ku(t={}){return P({query_params:t,fn:xt,path:le})}function $u(t,e={}){return k({id:t,query_params:e,fn:xt,path:le})}function Au(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:xt,path:le})}function wu(t){return I({form_data:t,query_params:{},fn:xt,path:le})}function Pu(t){return E({id:t,query_params:{},path:le})}function Tu(t){return y({id:t,task_name:"recompile",path:le})}function Ou(t){return y({id:t,task_name:"reload",path:le})}function Eu(t){return y({id:t,task_name:"compiled",method:"get",path:le})}function Iu(t){return y({id:t,task_name:"readme",method:"get",path:le})}class vi extends H{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 Me="edges";function Xt(t){return new vi(t)}function qu(t={}){return P({query_params:t,fn:Xt,path:Me})}function Mu(t){return k({id:t,query_params:{},fn:Xt,path:Me})}function Ru(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:Xt,path:Me})}function Uu(t){return I({form_data:t,query_params:{},fn:Xt,path:Me})}function Du(t){return E({id:t,query_params:{},path:Me})}function Cu(t){return y({id:t,task_name:"token",form_data:{},method:"get",path:Me})}function Nu(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${Me}/control`}class bi extends H{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 ht="ldap_auths";function en(t){return new bi(t)}function Fu(t={}){return P({query_params:t,fn:en,path:ht})}function ju(t){return k({id:t,query_params:{},fn:en,path:ht})}function Lu(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:en,path:ht})}function Hu(t){return I({form_data:t,query_params:{},fn:en,path:ht})}function zu(t){return E({id:t,query_params:{},path:ht})}class Wn{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 he extends H{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;any_match;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||"",this.any_match=e.any_match||!1}}class tn extends H{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 qe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new he(n)))}}class Si{zone;metadata;keys;constructor(e={}){this.zone=new tn(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Wn(n[r])}}const Re="metadata";function ft(t){return new Wn(t)}function Wu(t,e={}){return k({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>ft(n[r])),path:Re})}function Bu(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 Qu(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Bu(Object.keys(n).map(r=>n[r].map(i=>ft(i)))),path:Re})}function Vu(t,e){return k({id:t,query_params:{name:e},fn:n=>ft(n[e]),path:Re})}function Zu(t,e,n="put"){return q({id:t,form_data:e,query_params:{},method:n,fn:ft,path:Re})}function Gu(t){return I({form_data:t,query_params:{},fn:ft,path:Re})}function Ku(t,e){return E({id:t,query_params:e,path:Re})}function Yu(t,e){return y({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new Si({...r,keys:Object.keys(r.metadata)})),path:Re})}class Bn extends H{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_url;timetable_url;camera_snapshot_urls;camera_url;room_booking_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.camera_snapshot_urls=e.camera_snapshot_urls||[],this.camera_url=e.camera_url||"",this.timetable_url=e.timetable_url||"",this.room_booking_url=e.room_booking_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 qe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Qn(n)))}}class Qn extends H{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;alert_level;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??lt.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 Bn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new zn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],this.alert_level=e.alert_level||"medium",typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in qe)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==lt.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 x="modules";function nn(t){return new Qn(t)}function Ju(t={}){return P({query_params:t,fn:nn,path:x})}function xu(t,e={}){return k({id:t,query_params:e,fn:nn,path:x})}function Xu(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:nn,path:x})}function ec(t){return I({form_data:t,query_params:{},fn:nn,path:x})}function tc(t){return E({id:t,query_params:{},path:x})}function nc(t){return y({id:t,task_name:"start",path:x})}function rc(t){return y({id:t,task_name:"stop",path:x})}function ic(t){return y({id:t,task_name:"state",method:"get",path:x})}function sc(t,e){return y({id:t,task_name:`state/${e}`,method:"get",path:x})}function oc(t){return y({id:t,task_name:"load",method:"post",path:x})}function uc(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:x})}function cc(t){return y({id:t,task_name:"error",method:"get",path:x})}function ac(t,e,n=[]){return y({id:t,task_name:`exec/${encodeURIComponent(e)}`,form_data:n,path:x})}class ki extends H{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 dt="oauth_auths";function rn(t){return new ki(t)}function lc(t={}){return P({query_params:t,fn:rn,path:dt})}function hc(t){return k({id:t,query_params:{},fn:rn,path:dt})}function fc(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:rn,path:dt})}function dc(t){return I({form_data:t,query_params:{},fn:rn,path:dt})}function pc(t){return E({id:t,query_params:{},path:dt})}var Vn=(t=>(t.Driver="driver",t.Interface="interface",t))(Vn||{});class $i extends H{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||Vn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const V="repositories";function sn(t){return new $i(t)}function _c(t={}){return P({query_params:t,fn:sn,path:V})}function mc(t){return k({id:t,query_params:{},fn:sn,path:V})}function yc(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:sn,path:V})}function gc(t){return I({form_data:t,query_params:{},fn:sn,path:V})}function vc(t){return E({id:t,query_params:{},path:V})}function bc(){return k({id:"interfaces",query_params:{},path:V})}function Sc(t){return k({id:"remote_default_branch",query_params:t,path:V})}function kc(t){return k({id:"remote_branches",query_params:t,path:V})}function $c(t){return k({id:"remote_commits",query_params:t,path:V})}function Ac(t,e){return y({id:t,task_name:"drivers",form_data:e,method:"get",path:V})}function wc(t,e){return y({id:t,task_name:"commits",form_data:e,method:"get",path:V})}function Pc(t){return y({id:t,task_name:"branches",method:"get",path:V})}function Tc(t){return y({id:t,task_name:"default_branch",method:"get",path:V})}function Oc(t,e){return y({id:t,task_name:"details",form_data:e,method:"get",path:V})}function Ec(t,e){return y({id:t,task_name:"pull",form_data:e,method:"post",path:V})}function Ic(t,e){return y({id:t,task_name:"folders",form_data:e,method:"get",path:V})}class Ai extends H{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 pt="saml_auths";function on(t){return new Ai(t)}function qc(t={}){return P({query_params:t,fn:on,path:pt})}function Mc(t){return k({id:t,query_params:{},fn:on,path:pt})}function Rc(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:on,path:pt})}function Uc(t){return I({form_data:t,query_params:{},fn:on,path:pt})}function Dc(t){return E({id:t,query_params:{},path:pt})}const Ve="settings";function _t(t){return new ve(t)}function Cc(t={}){return P({query_params:t,fn:_t,path:Ve})}function Nc(t){return k({id:t,query_params:{},fn:_t,path:Ve})}function Fc(t,e,n={},r="patch"){return q({id:t,form_data:e,query_params:n,method:r,fn:_t,path:Ve})}function jc(t,e={}){return I({form_data:t,query_params:e,fn:_t,path:Ve})}function Lc(t){return E({id:t,query_params:{},path:Ve})}function Hc(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>_t(r)),path:Ve})}const C="systems";function Ue(t){return new Bn(t)}function zc(t={}){return P({query_params:t,fn:Ue,path:C})}function Wc(t){return P({query_params:t,fn:Ue,path:`${C}/with_emails`})}function Bc(t,e={}){return k({id:t,query_params:e,fn:Ue,path:C})}function Qc(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:Ue,path:C})}function Vc(t){return I({form_data:t,query_params:{},fn:Ue,path:C})}function Zc(t){return E({id:t,query_params:{},path:C})}function Gc(t,e,n={}){return y({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>Ue(r),path:C})}function Kc(t,e){return y({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Ue(n),path:C})}function Yc(t,e={}){return y({id:t,task_name:"start",form_data:e,path:C})}function Jc(t,e={}){return y({id:t,task_name:"stop",form_data:e,path:C})}function xc(t,e,n,r=1,i=[]){return y({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:C})}function Xc(t,e,n=1){return y({id:t,task_name:`${e}_${n}`,method:"get",path:C})}function ea(t,e,n=1,r){return y({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:C})}function ta(t,e,n=1){return y({id:t,task_name:`functions/${e}_${n}`,method:"get",path:C})}function na(t){return P({query_params:{},fn:e=>new tn(e),path:`${C}/${t}/zones`})}function ra(t,e={}){return P({query_params:e,fn:n=>new he(n),path:`${C}/${t}/triggers`})}function ia(t,e){return y({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new he(n),path:C})}function sa(t,e){return y({id:t,task_name:`triggers/${e}`,method:"del",path:C})}function oa(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:C})}function ua(t={}){const e=A(),n=e.startsWith("https")?"wss:":"ws:",r=e.startsWith("https")?"https:":"http:";let i=e.replace(r,n)+`${C}/control`;return t.fixed_device&&(i+=`?fixed_device=${encodeURIComponent(String(t.fixed_device))}`),i}function ca(t,e={}){return y({id:t,task_name:"metadata",form_data:e,method:"get",path:C})}function aa(t,e,n={}){return y({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:"get",callback:r=>new he(r),path:C})}function la(t,e,n,r="patch"){return y({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:r,callback:i=>new he(i),path:C})}const Ze="triggers";function un(t){return new he(t)}function ha(t={}){return P({query_params:t,fn:un,path:Ze})}function fa(t,e={}){return k({id:t,query_params:e,fn:un,path:Ze})}function da(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:un,path:Ze})}function pa(t){return I({form_data:t,query_params:{},fn:un,path:Ze})}function _a(t){return E({id:t,query_params:{},path:Ze})}function ma(t){return y({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new he(n)),path:Ze})}var wi=(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))(wi||{}),Pi=(t=>(t.AT="at",t.CRON="cron",t))(Pi||{}),Ti=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(Ti||{});class Oi extends H{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 X="users";function Ge(t){return new Oi(t)}function ya(t={}){return P({query_params:t,fn:Ge,path:X})}function ga(t,e={}){return k({id:t,query_params:e,fn:Ge,path:X})}function va(t={}){return k({id:"current",query_params:t,fn:Ge,path:X})}function ba(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:Ge,path:X})}function Sa(t){return I({form_data:t,query_params:{},fn:Ge,path:X})}function ka(t,e={}){return E({id:t,query_params:e,path:X})}function $a(t){const e=U(t),n=`${A()}${X}/groups${e?"?"+e:""}`;return F(n).pipe(b(r=>r))}function Aa(t){const e=U(t),n=`${A()}${X}/metadata/search${e?"?"+e:""}`;return F(n).pipe(b(r=>r))}function wa(){const t=`${A()}${X}/resource_token`;return K(t,{}).pipe(b(e=>e))}function Pa(t,e={}){return y({id:t,task_name:"metadata",form_data:e,method:"get",path:X})}function Ta(t){const e=`${A()}${X}/${encodeURIComponent(t)}/resource_token`;return ge(e,{response_type:"void"})}function Oa(t){const e=`${A()}${X}/${encodeURIComponent(t)}/resource_token`;return K(e,{}).pipe(b(n=>n))}function Ea(t){return y({id:t,task_name:"revive",form_data:{},method:"post",callback:e=>Ge(e),path:X})}const fe="zones";function cn(t){return new tn(t)}function Ia(t={}){return P({query_params:t,fn:cn,path:fe})}function qa(t={}){return k({id:"tags",query_params:t,fn:e=>e,path:fe})}function Ma(t,e={}){return k({id:t,query_params:e,fn:cn,path:fe})}function Ra(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:cn,path:fe})}function Ua(t){return I({form_data:t,query_params:{},fn:cn,path:fe})}function Da(t){return E({id:t,query_params:{},path:fe})}function Ca(t,e={}){return P({query_params:e,fn:n=>new he(n),path:`${fe}/${t}/triggers`})}function Na(t,e,n,r=1,i=[]){return y({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:fe})}function Fa(t,e={}){return y({id:t,task_name:"metadata",form_data:e,method:"get",path:fe})}var Zn=(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))(Zn||{});class Ei{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||Nr(Date.now()),this.updated_at=e.updated_at||Nr(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 an{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 Ii{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||Zn.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 qi="signage";function ja(t,e={},n){return k({id:t,query_params:e,fn:r=>r,path:`${qi}`,options:n})}function La(t){return y({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:qi})}const Ke="signage/media";function ln(t){return new Ei(t)}function Ha(t={}){return P({query_params:t,fn:ln,path:Ke})}function za(t,e={}){return k({id:t,query_params:e,fn:ln,path:Ke})}function Wa(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:ln,path:Ke})}function Ba(t){return I({form_data:t,query_params:{},fn:ln,path:Ke})}function Qa(t,e={}){return E({id:t,query_params:e,path:Ke})}function Va(t){return`${A()}/${Ke}/${t}/thumbnail`}const de="signage/playlists";function hn(t){return new Ii(t)}function Za(t={}){return P({query_params:t,fn:hn,path:de})}function Ga(t,e={}){return k({id:t,query_params:e,fn:hn,path:de})}function Ka(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:hn,path:de})}function Ya(t){return I({form_data:t,query_params:{},fn:hn,path:de})}function Ja(t,e={}){return E({id:t,query_params:e,path:de})}function xa(t,e={}){return y({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new an(n),path:de})}function Xa(t,e={}){return y({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new an(r)),path:de})}function el(t){return y({id:t,task_name:"media/approve",method:"post",path:de})}function tl(t,e){return y({id:t,task_name:"media",form_data:e,method:"post",path:de,callback:n=>new an(n)})}class Gn{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 Mi="/api/staff/v1/surveys/answers";function nl(t={}){const e=U(t);return F(`${Mi}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new Gn(r))))}function rl(t){return K(`${Mi}`,t).pipe(b(e=>e.map(n=>new Gn(n))))}class mt{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 yt="/api/staff/v1/surveys/invitations";function il(t={}){const e=U(t);return F(`${yt}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new mt(r))))}function sl(t,e={}){const n=U(e);return F(`${yt}/${t}${n?"?"+n:""}`).pipe(b(r=>new mt(r)))}function ol(t,e,n="patch"){return(n==="put"?Ie:ze)(`${yt}/${t}`,e).pipe(b(r=>new mt(r)))}function ul(t){return K(`${yt}`,t).pipe(b(e=>new mt(e)))}function cl(t,e={}){const n=U(e);return ge(`${yt}/${t}${n?"?"+n:""}`)}class gt{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 vt="/api/staff/v1/surveys/questions";function al(t={}){const e=U(t);return F(`${vt}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new gt(r))))}function ll(t,e={}){const n=U(e);return F(`${vt}/${t}${n?"?"+n:""}`).pipe(b(r=>new gt(r)))}function hl(t){return K(`${vt}`,t).pipe(b(e=>new gt(e)))}function fl(t,e,n="patch"){return(n==="put"?Ie:ze)(`${vt}/${t}`,e).pipe(b(r=>new gt(r)))}function dl(t,e={}){const n=U(e);return ge(`${vt}/${t}${n?"?"+n:""}`)}class bt{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 St="/api/staff/v1/surveys";function pl(t={}){const e=U(t);return F(`${St}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new bt(r))))}function _l(t,e={}){const n=U(e);return F(`${St}/${t}${n?"?"+n:""}`).pipe(b(r=>new bt(r)))}function ml(t,e,n="patch"){return(n==="put"?Ie:ze)(`${St}/${t}`,e).pipe(b(r=>new bt(r)))}function yl(t){return K(`${St}`,t).pipe(b(e=>new bt(e)))}function gl(t,e={}){const n=U(e);return ge(`${St}/${t}${n?"?"+n:""}`)}class Ri{id;parent_category_id;name;description;hidden;created_at;updated_at;constructor(e){this.id=e.id||"",this.parent_category_id=e.parent_category_id||"",this.name=e.name||"",this.description=e.description||"",this.hidden=e.hidden||!1,this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Ui{id;purchase_order_number;invoice_number;supplier_details;purchase_date;unit_price;expected_service_start_date;expected_service_end_date;created_at;updated_at;constructor(e){this.id=e.id||"",this.purchase_order_number=e.purchase_order_number||"",this.invoice_number=e.invoice_number||"",this.supplier_details=e.supplier_details||{},this.purchase_date=e.purchase_date||0,this.unit_price=e.unit_price||0,this.expected_service_start_date=e.expected_service_start_date||0,this.expected_service_end_date=e.expected_service_end_date||0,this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Di{id;category_id;name;brand;description;model_number;images;created_at;updated_at;constructor(e){this.id=e.id||"",this.category_id=e.category_id||"",this.name=e.name||"",this.brand=e.brand||"",this.description=e.description||"",this.model_number=e.model_number||"",this.images=e.images||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Ci{id;parent_id;asset_type_id;purchase_order_id;zone_id;identifier;serial_number;other_data;barcode;name;client_ids;map_id;bookable;accessible;zones;place_groups;assigned_to;assigned_name;features;images;notes;security_system_groups;created_at;updated_at;constructor(e){this.id=e.id||"",this.parent_id=e.parent_id||"",this.asset_type_id=e.asset_type_id||"",this.purchase_order_id=e.purchase_order_id||"",this.zone_id=e.zone_id||"",this.identifier=e.identifier||"",this.serial_number=e.serial_number||"",this.other_data=e.other_data||{},this.barcode=e.barcode||"",this.name=e.name||"",this.client_ids=e.client_ids||{},this.map_id=e.map_id||"",this.bookable=e.bookable||!1,this.accessible=e.accessible||!1,this.zones=e.zones||[],this.place_groups=e.place_groups||[],this.assigned_to=e.assigned_to||"",this.assigned_name=e.assigned_name||"",this.features=e.features||[],this.images=e.images||[],this.notes=e.notes||"",this.security_system_groups=e.security_system_groups||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const be="assets";function De(t){return new Ci(t)}function vl(t={}){return P({query_params:t,fn:De,path:be})}function bl(t,e={}){return k({id:t,query_params:e,fn:De,path:be})}function Sl(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:De,path:be})}function kl(t){return I({form_data:t,query_params:{},fn:De,path:be})}function $l(t,e={}){return E({id:t,query_params:e,path:be})}function Al(t){return K(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(b(e=>e.map(n=>De(n))))}function wl(t,e="patch"){return(e==="put"?Ie:ze)(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(b(r=>r.map(i=>De(i))))}function Pl(t,e={}){const n=U(e);return ge(`${A()}${be}/bulk${n?"?"+n:""}`,{body:JSON.stringify(t)}).pipe(b(r=>r.map(i=>De(i))))}const kt="asset_types";function fn(t){return new Di(t)}function Tl(t={}){return P({query_params:t,fn,path:kt})}function Ol(t,e={}){return k({id:t,query_params:e,fn,path:kt})}function El(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn,path:kt})}function Il(t){return I({form_data:t,query_params:{},fn,path:kt})}function ql(t,e={}){return E({id:t,query_params:e,path:kt})}const $t="asset_categories";function dn(t){return new Ri(t)}function Ml(t={}){return P({query_params:t,fn:dn,path:$t})}function Rl(t,e={}){return k({id:t,query_params:e,fn:dn,path:$t})}function Ul(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:dn,path:$t})}function Dl(t){return I({form_data:t,query_params:{},fn:dn,path:$t})}function Cl(t,e={}){return E({id:t,query_params:e,path:$t})}const At="asset_purchase_orders";function pn(t){return new Ui(t)}function Nl(t={}){return P({query_params:t,fn:pn,path:At})}function Fl(t,e={}){return k({id:t,query_params:e,fn:pn,path:At})}function jl(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:pn,path:At})}function Ll(t){return I({form_data:t,query_params:{},fn:pn,path:At})}function Hl(t,e={}){return E({id:t,query_params:e,path:At})}class Ni{id;name;uri;description;user_id;user_email;user_name;redirect_count;enabled;valid_from;valid_until;authority_id;created_at;updated_at;constructor(e){this.id=e.id||"",this.name=e.name||"",this.uri=e.uri||"",this.description=e.description||"",this.user_id=e.user_id||"",this.user_email=e.user_email||"",this.user_name=e.user_name||"",this.redirect_count=e.redirect_count||0,this.enabled=e.enabled??!0,this.valid_from=e.valid_from||"",this.valid_until=e.valid_until||"",this.authority_id=e.authority_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const ie="short_url";function _n(t){return new Ni(t)}function zl(t={}){return P({query_params:t,fn:_n,path:ie})}function Wl(t,e={}){return k({id:t,query_params:e,fn:_n,path:ie})}function Bl(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:_n,path:ie})}function Ql(t){return I({form_data:t,query_params:{},fn:_n,path:ie})}function Vl(t,e={}){return E({id:t,query_params:e,path:ie})}function Zl(t){return`${A()}${ie}/${encodeURIComponent(t)}/redirect`}function Gl(t){return F(`${A()}${ie}/${encodeURIComponent(t)}/qr_code.svg`,{response_type:"text"})}function Kl(t,e={}){const n=U(e);return`${A()}${ie}/${encodeURIComponent(t)}/qr_code.png${n?"?"+n:""}`}function Yl(t){const{format:e="svg",...n}=t,r={...n,format:e},i=U(r);return`${A()}${ie}/qr_code${i?"?"+i:""}`}function Jl(t){const e={...t,format:"svg"},n=U(e);return F(`${A()}${ie}/qr_code${n?"?"+n:""}`,{response_type:"text"})}class Fi{id;storage_type;bucket_name;region;access_key;access_secret;authority_id;endpoint;is_default;ext_filter;mime_filter;created_at;updated_at;constructor(e){this.id=e.id||"",this.storage_type=e.storage_type||null,this.bucket_name=e.bucket_name||"",this.region=e.region||"",this.access_key=e.access_key||"",this.access_secret=e.access_secret||"",this.authority_id=e.authority_id||"",this.endpoint=e.endpoint||"",this.is_default=e.is_default??!1,this.ext_filter=e.ext_filter||[],this.mime_filter=e.mime_filter||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const wt="storages";function mn(t){return new Fi(t)}function xl(t={}){return P({query_params:t,fn:mn,path:wt})}function Xl(t,e={}){return k({id:t,query_params:e,fn:mn,path:wt})}function eh(t,e,n="patch"){return q({id:t,form_data:e,query_params:{},method:n,fn:mn,path:wt})}function th(t){return I({form_data:t,query_params:{},fn:mn,path:wt})}function nh(t,e={}){return E({id:t,query_params:e,path:wt})}const Se="webrtc";function rh(t={}){const e=U(t),n=`${A()}${Se}/rooms${e?"?"+e:""}`;return F(n).pipe(b(r=>r))}function ih(t){const e=`${A()}${Se}/room/${encodeURIComponent(t)}`;return F(e).pipe(b(n=>n))}function sh(t){const e=`${A()}${Se}/members/${encodeURIComponent(t)}`;return F(e).pipe(b(n=>n))}function oh(t,e){const n=`${A()}${Se}/guest_entry/${encodeURIComponent(t)}`;return K(n,e).pipe(b(()=>{}))}function uh(){const t=`${A()}${Se}/guest/exit`;return K(t,{}).pipe(b(()=>{}))}function ch(t,e,n){const r=`${A()}${Se}/kick/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return K(r,n).pipe(b(()=>{}))}function ah(t,e,n){const r=`${A()}${Se}/transfer/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return K(r,n||{}).pipe(b(()=>{}))}function lh(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${Se}/signaller`}var hh={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},fh="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",dh=function(t){ne(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof j)i.destination=r,i.source=n;else{var s=i._config=xe({},hh);if(i._output=new we,typeof n=="string")s.url=n;else for(var u in n)n.hasOwnProperty(u)&&(s[u]=n[u]);if(!s.WebSocketCtor&&WebSocket)s.WebSocketCtor=WebSocket;else if(!s.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new In}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 In),this._output=new we},e.prototype.multiplex=function(n,r,i){var s=this;return new j(function(u){try{s.next(n())}catch(a){u.error(a)}var c=s.subscribe({next:function(a){try{i(a)&&u.next(a)}catch(h){u.error(h)}},error:function(a){return u.error(a)},complete:function(){return u.complete()}});return function(){try{s.next(r())}catch(a){u.error(a)}c.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,r=this._config,i=r.WebSocketCtor,s=r.protocol,u=r.url,c=r.binaryType,a=this._output,h=null;try{h=s?new i(u,s):new i(u),this._socket=h,c&&(this._socket.binaryType=c)}catch(g){a.error(g);return}var m=new Ae(function(){n._socket=null,h&&h.readyState===1&&h.close()});h.onopen=function(g){var _=n._socket;if(!_){h.close(),n._resetState();return}var l=n._config.openObserver;l&&l.next(g);var d=n.destination;n.destination=Ut.create(function(f){if(h.readyState===1)try{var w=n._config.serializer;h.send(w(f))}catch($){n.destination.error($)}},function(f){var w=n._config.closingObserver;w&&w.next(void 0),f&&f.code?h.close(f.code,f.reason):a.error(new TypeError(fh)),n._resetState()},function(){var f=n._config.closingObserver;f&&f.next(void 0),h.close(),n._resetState()}),d&&d instanceof In&&m.add(d.subscribe(n.destination))},h.onerror=function(g){n._resetState(),a.error(g)},h.onclose=function(g){h===n._socket&&n._resetState();var _=n._config.closeObserver;_&&_.next(g),g.wasClean?a.complete():a.error(g)},h.onmessage=function(g){try{var _=n._config.deserializer;a.next(_(g))}catch(l){a.error(l)}}},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 s=r._socket;r._output.observers.length===0&&(s&&(s.readyState===1||s.readyState===0)&&s.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}(On);function ph(t){return new dh(t)}var re=(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))(re||{}),Kn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(Kn||{});class ji{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 j)&&!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 pe(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class Li{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 ji(this,n))}}const yn={};function _h(t,e){return yn[t]=new Li(e),yn[t]}function Hi(t){return yn[t]}function mh(t){delete yn[t]}const zi=15;let Pt=0,te,Wi=0;const Z={},Yn={},Ce={},yh={},Ne=new pe(!1);Ce._place_os_status=Ne.asObservable();const Bi=new pe([0,0]);Ce._place_os_sync=Bi.asObservable();let Qi=Date.now(),Ye,gn=0,ke=null,vn,Jn=0;const Tt=10*1e3,xn=new we;Ce._place_os_debug_events=xn.asObservable();function bn(){return A().indexOf("/control/")>=0?"/control/websocket":`${Cn()}/systems/control`}function Xn(){return Ne.getValue()}function Vi(){return Ce._place_os_status}function gh(){return Ce._place_os_sync}function Zi(t,e=Yn,n=Ce){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new pe(void 0),n[r]=e[r].asObservable()),n[r]}function Gi(t,e=Yn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function er(t,e=0,n=Je){const r={id:++Pt,cmd:"bind",...t};return n(r,e)}function Ki(t,e=0,n=Je){const r={id:++Pt,cmd:"unbind",...t};return n(r,e)}function Yi(t,e=Tt,n=Je){const r={id:++Pt,cmd:"exec",...t};return n(r,e)}function vh(t,e=Tt,n=Je){const r={id:++Pt,cmd:"debug",...t};return n(r,e)}function bh(t,e=Tt,n=Je){const r={id:++Pt,cmd:"ignore",...t};return n(r,e)}function Je(t,e=Tt,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Br()}`;if(Z[r])p("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((s,u)=>{const c=()=>{delete Z[r],Z[r]=null,Je(t,e,n).then(a=>s(a),a=>u(a))};if(te&&Xn()){Wt()&&Th(t,te,yh),i.resolve=s,i.reject=u;const a=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${a}`,t.args),te.next(t),e>0&&ae(`${r}`,()=>{u("Request timed out."),delete Z[r],Z[r]=null},e)}else ke?setTimeout(()=>c(),1e3):tr().then(()=>c())}),Z[r]=i}return Z[r].promise}function Ji(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)$h(t.meta,t.value);else if(t.type==="success")Sh(t);else if(t.type==="debug"){p("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};xn.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||Kn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?kh(t):t.cmd||p("WS","Invalid websocket message",t,"error");Oe(`${t.id}`)}else t==="pong"&&(Jn=Date.now(),p("WS","Pong!"))}function Sh(t){const e=Object.keys(Z).map(n=>Z[n]).find(n=>n?.id===t.id);p("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete Z[e.key])}function kh(t){let e="UNEXPECTED FAILURE";switch(t.code){case re.ACCESS_DENIED:e="ACCESS DENIED";break;case re.BAD_REQUEST:e="BAD REQUEST";break;case re.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case re.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case re.PARSE_ERROR:e="PARSE ERROR";break;case re.REQUEST_FAILED:e="REQUEST FAILED";break;case re.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}p("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),Oe(`${n.key}`),delete Z[n.key])}function $h(t,e,n=Yn,r=Ce){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new pe(null),r[i]=n[i].asObservable());const s=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[NOTIFY] ${s} changed`,[n[i].getValue(),"→",e]),n[i].next(e)}function tr(t=0){return ke==null&&(ke=new Promise(e=>{if(t>40)return location.reload();gn++,Qi=Date.now(),te=Wt()?Ph():Ah(),te?(p("WS(Debug)","Authority:",[rt()]),p("WS","Connecting to websocket..."),te.subscribe(n=>{Ne.getValue()||(p("WS","Connection established."),e()),Ne.next(!0),gn=0,nr(),Ji(n)},n=>{te=void 0,ke=null,Xi(),nr(),wh(n)},()=>{te=void 0,ke=null,Xi(),p("WS","Connection closed by browser."),Ne.next(!1),Sn()}),Ye&&clearInterval(Ye),Jn=Date.now(),xi(),Ye=setInterval(()=>xi(),zi*1e3),nr(),Wi+=1,vn=setTimeout(()=>{p("WS","Unhealthy connection. Reconnecting..."),Ne.next(!1),ke=null,Sn()},30*1e3)):(te?p("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!J(),!!rt()],"info"):p("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{ke=null,tr(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),ke}function Ah(){if(!rt()||!J())return null;const t=Yr()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${zt()}${bn()}${Nn()?"?fixed_device=true":""}`;const n=J();let r=n==="x-api-key"?`api-key=${nt()}`:`bearer_token=${n}`;return!po()&&!zr()?(p("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${bn()};`,r+=`${t?"secure;":""}samesite=strict`,document.cookie=r,p("WS","Cookies:",[document.cookie,r])):(p("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${r}`),p("WS",`Creating websocket connection to ws${t?"s":""}://${zt()}${bn()}`),ph({url:e,serializer:i=>typeof i=="object"?JSON.stringify(i):i,deserializer:i=>{let s=i.data;if(s==="pong")return s;try{return JSON.parse(i.data)}catch{return s}}})}function Sn(){Bi.next([Wi,Date.now()-Qi]),te&&Xn()&&(te.complete(),Ye&&(clearInterval(Ye),Ye=void 0)),p("WS",`Reconnecting in ${Math.min(5e3,gn*300||1e3)}ms...`),ae("reconnect",()=>tr(),Math.min(5e3,(gn+1)*300||1e3))}function xi(){if(Date.now()-Jn>4*zi*1e3)return Sn();te?.next("ping")}function wh(t){Ne.next(!1),p("WS","Websocket error:",t,void 0,"error"),t.status===401&&Vt(),Fn(),Sn()}function nr(){vn&&(clearTimeout(vn),vn=void 0)}function Ph(){const t=new we;return t.subscribe(e=>Ji(e)),t}function Th(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=Hi(t.sys),s=i&&i[t.mod]?i[t.mod][t.index-1||0]:null;if(s){switch(t.cmd){case"bind":n[r]=s.listen(t.name).subscribe(u=>{setTimeout(()=>{e.next({type:"notify",value:u,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[r]&&(n[r].unsubscribe(),delete n[r],Oe(`${r}`));break}ae(`${t.id}-response`,()=>{const u={id:t.id,type:"success",value:t.cmd==="exec"?s.call(t.name,t.args):null};e.next(u)},10)}else ae(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?re.SYS_NOT_FOUND:re.MOD_NOT_FOUND}),10)}function Xi(){for(const t in Z)Z[t]&&delete Z[t]}class rr{constructor(e,n){this._module=e,this.name=n,Vi().pipe(Vs()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(p("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Oe(`rebind:${JSON.stringify(this.binding())}`),p("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 Gi(this.binding())}listen(){return Zi(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,er(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Ki(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||ae(`rebind:${JSON.stringify(this.binding())}`,async()=>{await er(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 es{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 rr(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new rr(this,e)),this._bindings[e]}execute(e,n,r=Tt){return Yi({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class ts{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 es(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const ir={};function ns(t){return ir[t]||(ir[t]=new ts(t)),ir[t]}function Oh(t,e,n=1){return ns(t).module(e,n)}o.AuthType=di,o.EncryptionLevel=qe,o.MediaAnimation=Zn,o.MockPlaceWebsocketModule=ji,o.MockPlaceWebsocketSystem=Li,o.PlaceAlert=ui,o.PlaceAlertDashboard=ci,o.PlaceApplication=ai,o.PlaceAsset=Ci,o.PlaceAssetCategory=Ri,o.PlaceAssetPurchaseOrder=Ui,o.PlaceAssetType=Di,o.PlaceCluster=_i,o.PlaceDomain=gi,o.PlaceDriver=zn,o.PlaceDriverRole=lt,o.PlaceEdge=vi,o.PlaceErrorCodes=re,o.PlaceLDAPSource=bi,o.PlaceLogLevel=Kn,o.PlaceMQTTBroker=pi,o.PlaceMetadata=Wn,o.PlaceModule=Qn,o.PlaceModuleBinding=es,o.PlaceOAuthSource=ki,o.PlaceProcess=mi,o.PlaceRepository=$i,o.PlaceRepositoryType=Vn,o.PlaceResource=H,o.PlaceSAMLSource=Ai,o.PlaceSettings=ve,o.PlaceShortUrl=Ni,o.PlaceStorage=Fi,o.PlaceSystem=Bn,o.PlaceSystemBinding=ts,o.PlaceTrigger=he,o.PlaceUser=Oi,o.PlaceVariableBinding=rr,o.PlaceZone=tn,o.PlaceZoneMetadata=Si,o.SignageMedia=Ei,o.SignagePlaylist=Ii,o.SignagePlaylistMedia=an,o.Survey=bt,o.SurveyAnswer=Gn,o.SurveyInvitation=mt,o.SurveyQuestion=gt,o.TriggerConditionOperator=wi,o.TriggerTimeConditionType=Pi,o.TriggerWebhookType=Ti,o.addAlert=Ko,o.addAlertDashboard=Wo,o.addAnswer=rl,o.addApplication=ru,o.addAsset=kl,o.addAssetCategory=Dl,o.addAssetPurchaseOrder=Ll,o.addAssetType=Il,o.addAssets=Al,o.addBroker=cu,o.addDomain=vu,o.addDriver=wu,o.addEdge=Uu,o.addInvitation=ul,o.addLDAPSource=Hu,o.addMetadata=Gu,o.addModule=ec,o.addOAuthSource=dc,o.addQuestion=hl,o.addRepository=gc,o.addSAMLSource=Uc,o.addSettings=jc,o.addShortUrl=Ql,o.addSignageMedia=Ba,o.addSignagePlaylist=Ya,o.addStorage=th,o.addSurvey=yl,o.addSystem=Vc,o.addSystemModule=Gc,o.addSystemTrigger=ia,o.addTrigger=pa,o.addUser=Sa,o.addZone=Ua,o.apiEndpoint=A,o.apiKey=nt,o.approveSignagePlaylist=el,o.authorise=jn,o.authority=rt,o.bind=er,o.cleanObject=Hr,o.cleanupAuth=So,o.clientId=Vr,o.clusterRebalance=pu,o.clusterVersions=_u,o.connectionState=gh,o.consoleHasColours=Rn,o.convertPairStringToMap=Le,o.create=I,o.currentUser=va,o.currentUserResourceToken=wa,o.debug=vh,o.debug_events=xn,o.del=ge,o.deregisterMockEndpoint=ri,o.deregisterSystem=mh,o.driverReadme=Iu,o.edgeControlUrl=Nu,o.execute=Yi,o.executeOnModule=ac,o.executeOnSystem=xc,o.executeOnZone=Na,o.functionList=ta,o.generateNonce=jr,o.generateQrCode=Jl,o.get=F,o.getFragments=Un,o.getModule=Oh,o.getShortUrlQrCodeSvg=Gl,o.getSystem=ns,o.hasToken=Gr,o.host=zt,o.httpRoute=Cn,o.humanReadableByteCount=et,o.ignore=bh,o.invalidateToken=Vt,o.isDriverCompiled=Eu,o.isFixedDevice=Nn,o.isMobileSafari=zr,o.isMock=Wt,o.isNestedFrame=Wr,o.isOnline=yo,o.isSecure=Yr,o.isTrusted=Bt,o.is_connected=Xn,o.lastRequestTotal=xo,o.listChildMetadata=Yu,o.listDashboardAlerts=Qo,o.listInterfaceRepositories=bc,o.listMetadata=Wu,o.listMetadataHistory=Qu,o.listRemoteRepositoryBranches=kc,o.listRemoteRepositoryCommits=$c,o.listRemoteRepositoryDefaultBranch=Sc,o.listRepositoryBranches=Pc,o.listRepositoryCommits=wc,o.listRepositoryDefaultBranch=Tc,o.listRepositoryDriverDetails=Oc,o.listRepositoryDrivers=Ac,o.listRepositoryFolders=Ic,o.listSignagePlaylistMedia=xa,o.listSignagePlaylistMediaRevisions=Xa,o.listSystemTriggers=ra,o.listSystemZones=na,o.listTriggerInstances=ma,o.listZoneTags=qa,o.listZoneTriggers=Ca,o.listen=Zi,o.listenForToken=Kr,o.loadModule=oc,o.log=p,o.logout=ko,o.lookupDomainByEmail=Su,o.lookupModuleState=sc,o.lookupSystemModuleState=ea,o.mediaThumbnail=Va,o.mockSystem=Hi,o.moduleRuntimeError=cc,o.moduleSettings=uc,o.moduleState=ic,o.onlineState=go,o.parseLinkHeader=Lr,o.patch=ze,o.post=K,o.pullRepositoryChanges=Ec,o.put=Ie,o.qrCodeUrl=Yl,o.query=P,o.queryAlertDashboards=Lo,o.queryAlerts=Vo,o.queryAnswers=nl,o.queryApplications=eu,o.queryAssetCategories=Ml,o.queryAssetPurchaseOrders=Nl,o.queryAssetTypes=Tl,o.queryAssets=vl,o.queryBrokers=su,o.queryClusters=lu,o.queryDomains=mu,o.queryDrivers=ku,o.queryEdges=qu,o.queryInvitations=il,o.queryLDAPSources=Fu,o.queryModules=Ju,o.queryOAuthSources=lc,o.queryProcesses=fu,o.queryQuestions=al,o.queryRepositories=_c,o.querySAMLSources=qc,o.querySettings=Cc,o.queryShortUrls=zl,o.querySignageMedia=Ha,o.querySignagePlaylists=Za,o.queryStorages=xl,o.querySurveys=pl,o.querySystems=zc,o.querySystemsWithEmails=Wc,o.queryTriggers=ha,o.queryUserGroups=$a,o.queryUsers=ya,o.queryWebrtcRooms=rh,o.queryZones=Ia,o.recompileDriver=Tu,o.redirectUri=_o,o.refreshAuthority=Fn,o.refreshToken=Ht,o.registerMockEndpoint=Uo,o.registerSystem=_h,o.reloadDriver=Ou,o.remove=E,o.removeAlert=Yo,o.removeAlertDashboard=Bo,o.removeApplication=iu,o.removeAsset=$l,o.removeAssetCategory=Cl,o.removeAssetPurchaseOrder=Hl,o.removeAssetType=ql,o.removeAssets=Pl,o.removeBroker=au,o.removeDomain=bu,o.removeDriver=Pu,o.removeEdge=Du,o.removeFragment=_e,o.removeInvitation=cl,o.removeLDAPSource=zu,o.removeMetadata=Ku,o.removeModule=tc,o.removeOAuthSource=pc,o.removeQuestion=dl,o.removeRepository=vc,o.removeSAMLSource=Dc,o.removeSettings=Lc,o.removeShortUrl=Vl,o.removeSignageMedia=Qa,o.removeSignagePlaylist=Ja,o.removeStorage=nh,o.removeSurvey=gl,o.removeSystem=Zc,o.removeSystemModule=Kc,o.removeSystemTrigger=sa,o.removeTrigger=_a,o.removeUser=ka,o.removeUserResourceToken=Ta,o.removeZone=Da,o.requestTotal=Jo,o.responseHeaders=si,o.retrieveEdgeToken=Cu,o.reviveUser=Ea,o.searchUserMetadata=Aa,o.setAPI_Key=mo,o.setMockNotFoundHandler=Ro,o.setStorage=bo,o.setToken=Zr,o.settingsHistory=Hc,o.setup=vo,o.shortUrlQrCodePngUrl=Kl,o.shortUrlRedirectUrl=Zl,o.show=k,o.showAlert=Zo,o.showAlertDashboard=Ho,o.showApplication=tu,o.showAsset=bl,o.showAssetCategory=Rl,o.showAssetPurchaseOrder=Fl,o.showAssetType=Ol,o.showBroker=ou,o.showCluster=hu,o.showDomain=yu,o.showDriver=$u,o.showEdge=Mu,o.showInvitation=sl,o.showLDAPSource=ju,o.showMetadata=Vu,o.showModule=xu,o.showOAuthSource=hc,o.showQuestion=ll,o.showRepository=mc,o.showSAMLSource=Mc,o.showSettings=Nc,o.showShortUrl=Wl,o.showSignage=ja,o.showSignageMedia=za,o.showSignageMetrics=La,o.showSignagePlaylist=Ga,o.showStorage=Xl,o.showSurvey=_l,o.showSystem=Bc,o.showSystemTrigger=aa,o.showTrigger=fa,o.showUser=ga,o.showWebrtcRoom=ih,o.showZone=Ma,o.simplifiedTime=Br,o.startModule=nc,o.startSystem=Yc,o.status=Vi,o.stopModule=rc,o.stopSystem=Jc,o.systemControlUrl=ua,o.systemMetadata=ca,o.systemModuleState=Xc,o.systemSettings=oa,o.terminateProcess=du,o.token=J,o.unbind=Ki,o.update=q,o.updateAlert=Go,o.updateAlertDashboard=zo,o.updateApplication=nu,o.updateAsset=Sl,o.updateAssetCategory=Ul,o.updateAssetPurchaseOrder=jl,o.updateAssetType=El,o.updateAssets=wl,o.updateBroker=uu,o.updateDomain=gu,o.updateDriver=Au,o.updateEdge=Ru,o.updateInvitation=ol,o.updateLDAPSource=Lu,o.updateMetadata=Zu,o.updateModule=Xu,o.updateOAuthSource=fc,o.updateQuestion=fl,o.updateRepository=yc,o.updateSAMLSource=Rc,o.updateSettings=Fc,o.updateShortUrl=Bl,o.updateSignageMedia=Wa,o.updateSignagePlaylist=Ka,o.updateSignagePlaylistMedia=tl,o.updateStorage=eh,o.updateSurvey=ml,o.updateSystem=Qc,o.updateSystemTrigger=la,o.updateTrigger=da,o.updateUser=ba,o.updateZone=Ra,o.userMetadata=Pa,o.userResourceToken=Oa,o.value=Gi,o.webrtcGuestEntry=oh,o.webrtcGuestExit=uh,o.webrtcKickUser=ch,o.webrtcSessionMembers=sh,o.webrtcSignallerUrl=lh,o.webrtcTransferUser=ah,o.websocketRoute=bn,o.zoneMetadata=Fa,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function Rt(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Ae=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,s;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var c=Fe(u),a=c.next();!a.done;a=c.next()){var h=a.value;h.remove(this)}}catch(f){e={error:f}}finally{try{a&&!a.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}else u.remove(this);var m=this.initialTeardown;if(N(m))try{m()}catch(f){s=f instanceof Pn?f.errors:[f]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var _=Fe(g),l=_.next();!l.done;l=_.next()){var d=l.value;try{lr(d)}catch(f){s=s??[],f instanceof Pn?s=Mt(Mt([],It(s)),It(f.errors)):s.push(f)}}}catch(f){r={error:f}}finally{try{l&&!l.done&&(i=_.return)&&i.call(_)}finally{if(r)throw r.error}}}if(s)throw new Pn(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)lr(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)&&Rt(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Rt(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),cr=Ae.EMPTY;function ar(t){return t instanceof Ae||t&&"closed"in t&&N(t.remove)&&N(t.add)&&N(t.unsubscribe)}function lr(t){N(t)?t():t.unsubscribe()}var ls={Promise:void 0},hs={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Mt([t,e],It(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function hr(t){hs.setTimeout(function(){throw t})}function fr(){}function Ut(t){t()}var Dt=function(t){ne(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,ar(n)&&n.add(r)):r.destination=ps,r}return e.create=function(n,r,i){return new Tn(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}(Ae),fs=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){Ct(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){Ct(r)}else Ct(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){Ct(n)}},t}(),Tn=function(t){ne(e,t);function e(n,r,i){var s=t.call(this)||this,u;return N(n)||!n?u={next:n??void 0,error:r??void 0,complete:i??void 0}:u=n,s.destination=new fs(u),s}return e}(Dt);function Ct(t){hr(t)}function ds(t){throw t}var ps={closed:!0,next:fr,error:ds,complete:fr},On=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function En(t){return t}function _s(t){return t.length===0?En:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var L=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,s=ys(e)?e:new Tn(e,n,r);return Ut(function(){var u=i,c=u.operator,a=u.source;s.add(c?c.call(s,a):a?i._subscribe(s):i._trySubscribe(s))}),s},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=dr(n),new n(function(i,s){var u=new Tn({next:function(c){try{e(c)}catch(a){s(a),u.unsubscribe()}},error:s,complete:i});r.subscribe(u)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[On]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return _s(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=dr(e),new e(function(r,i){var s;n.subscribe(function(u){return s=u},function(u){return i(u)},function(){return r(s)})})},t.create=function(e){return new t(e)},t}();function dr(t){var e;return(e=t??ls.Promise)!==null&&e!==void 0?e:Promise}function ms(t){return t&&N(t.next)&&N(t.error)&&N(t.complete)}function ys(t){return t&&t instanceof Dt||ms(t)&&ar(t)}function gs(t){return N(t?.lift)}function oe(t){return function(e){if(gs(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 ee(t,e,n,r,i){return new vs(t,e,n,r,i)}var vs=function(t){ne(e,t);function e(n,r,i,s,u,c){var a=t.call(this,n)||this;return a.onFinalize=u,a.shouldUnsubscribe=c,a._next=r?function(h){try{r(h)}catch(m){n.error(m)}}:t.prototype._next,a._error=s?function(h){try{s(h)}catch(m){n.error(m)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=i?function(){try{i()}catch(h){n.error(h)}finally{this.unsubscribe()}}:t.prototype._complete,a}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}(Dt),bs=wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),we=function(t){ne(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 qn(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new bs},e.prototype.next=function(n){var r=this;Ut(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var u=Fe(r.currentObservers),c=u.next();!c.done;c=u.next()){var a=c.value;a.next(n)}}catch(h){i={error:h}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;Ut(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;Ut(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,s=i.hasError,u=i.isStopped,c=i.observers;return s||u?cr:(this.currentObservers=null,c.push(n),new Ae(function(){r.currentObservers=null,Rt(c,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,s=r.thrownError,u=r.isStopped;i?n.error(s):u&&n.complete()},e.prototype.asObservable=function(){var n=new L;return n.source=this,n},e.create=function(n,r){return new qn(n,r)},e}(L),qn=function(t){ne(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:cr},e}(we),pe=function(t){ne(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,s=n._value;if(r)throw i;return this._throwIfClosed(),s},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e}(we),In={now:function(){return(In.delegate||Date).now()},delegate:void 0},Mn=function(t){ne(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=In);var s=t.call(this)||this;return s._bufferSize=n,s._windowTime=r,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,n),s._windowTime=Math.max(1,r),s}return e.prototype.next=function(n){var r=this,i=r.isStopped,s=r._buffer,u=r._infiniteTimeWindow,c=r._timestampProvider,a=r._windowTime;i||(s.push(n),!u&&s.push(c.now()+a)),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,s=i._infiniteTimeWindow,u=i._buffer,c=u.slice(),a=0;a<c.length&&!n.closed;a+=s?1:2)n.next(c[a]);return this._checkFinalizedStatuses(n),r},e.prototype._trimBuffer=function(){var n=this,r=n._bufferSize,i=n._timestampProvider,s=n._buffer,u=n._infiniteTimeWindow,c=(u?1:2)*r;if(r<1/0&&c<s.length&&s.splice(0,s.length-c),!u){for(var a=i.now(),h=0,m=1;m<s.length&&s[m]<=a;m+=2)h=m;h&&s.splice(0,h+1)}},e}(we),Ss=function(t){ne(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(Ae),pr={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,Mt([t,e],It(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},ks=function(t){ne(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 s=this.id,u=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(u,s,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(u,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),pr.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&&pr.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,s;try{this.work(n)}catch(u){i=!0,s=u||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Rt(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Ss),_r=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=In.now,t}(),$s=function(t){ne(e,t);function e(n,r){r===void 0&&(r=_r.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}(_r),mr=new $s(ks),As=mr,ws=new L(function(t){return t.complete()});function Ps(t){return t&&N(t.schedule)}var yr=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function gr(t){return N(t?.then)}function vr(t){return N(t[On])}function br(t){return Symbol.asyncIterator&&N(t?.[Symbol.asyncIterator])}function Sr(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 Ts(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var kr=Ts();function $r(t){return N(t?.[kr])}function Ar(t){return cs(this,arguments,function(){var n,r,i,s;return ur(this,function(u){switch(u.label){case 0:n=t.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,Le(n.read())];case 3:return r=u.sent(),i=r.value,s=r.done,s?[4,Le(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,Le(i)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function wr(t){return N(t?.getReader)}function ue(t){if(t instanceof L)return t;if(t!=null){if(vr(t))return Os(t);if(yr(t))return Es(t);if(gr(t))return qs(t);if(br(t))return Pr(t);if($r(t))return Is(t);if(wr(t))return Ms(t)}throw Sr(t)}function Os(t){return new L(function(e){var n=t[On]();if(N(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Es(t){return new L(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function qs(t){return new L(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,hr)})}function Is(t){return new L(function(e){var n,r;try{for(var i=Fe(t),s=i.next();!s.done;s=i.next()){var u=s.value;if(e.next(u),e.closed)return}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function Pr(t){return new L(function(e){Rs(t,e).catch(function(n){return e.error(n)})})}function Ms(t){return Pr(Ar(t))}function Rs(t,e){var n,r,i,s;return us(this,void 0,void 0,function(){var u,c;return ur(this,function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=as(t),a.label=1;case 1:return[4,n.next()];case 2:if(r=a.sent(),!!r.done)return[3,4];if(u=r.value,e.next(u),e.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=a.sent(),i={error:c},[3,11];case 6:return a.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:a.sent(),a.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 Pe(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var s=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!i)return s}function Tr(t,e){return e===void 0&&(e=0),oe(function(n,r){n.subscribe(ee(r,function(i){return Pe(r,t,function(){return r.next(i)},e)},function(){return Pe(r,t,function(){return r.complete()},e)},function(i){return Pe(r,t,function(){return r.error(i)},e)}))})}function Or(t,e){return e===void 0&&(e=0),oe(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function Us(t,e){return ue(t).pipe(Or(e),Tr(e))}function Ds(t,e){return ue(t).pipe(Or(e),Tr(e))}function Cs(t,e){return new L(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function Ns(t,e){return new L(function(n){var r;return Pe(n,e,function(){r=t[kr](),Pe(n,e,function(){var i,s,u;try{i=r.next(),s=i.value,u=i.done}catch(c){n.error(c);return}u?n.complete():n.next(s)},0,!0)}),function(){return N(r?.return)&&r.return()}})}function Er(t,e){if(!t)throw new Error("Iterable cannot be null");return new L(function(n){Pe(n,e,function(){var r=t[Symbol.asyncIterator]();Pe(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function Fs(t,e){return Er(Ar(t),e)}function Ls(t,e){if(t!=null){if(vr(t))return Us(t,e);if(yr(t))return Cs(t,e);if(gr(t))return Ds(t,e);if(br(t))return Er(t,e);if($r(t))return Ns(t,e);if(wr(t))return Fs(t,e)}throw Sr(t)}function js(t,e){return e?Ls(t,e):ue(t)}function qr(t,e){var n=N(t)?t:function(){return t},r=function(i){return i.error(n())};return new L(r)}var Hs=wn(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function zs(t,e){return new Promise(function(n,r){var i=!1,s;t.subscribe({next:function(u){s=u,i=!0},error:r,complete:function(){i?n(s):r(new Hs)}})})}function Ws(t){return t instanceof Date&&!isNaN(t)}function b(t,e){return oe(function(n,r){var i=0;n.subscribe(ee(r,function(s){r.next(t.call(e,s,i++))}))})}function Bs(t,e,n,r,i,s,u,c){var a=[],h=0,m=0,g=!1,_=function(){g&&!a.length&&!h&&e.complete()},l=function(f){return h<r?d(f):a.push(f)},d=function(f){h++;var w=!1;ue(n(f,m++)).subscribe(ee(e,function($){e.next($)},function(){w=!0},void 0,function(){if(w)try{h--;for(var $=function(){var T=a.shift();u||d(T)};a.length&&h<r;)$();_()}catch(T){e.error(T)}}))};return t.subscribe(ee(e,l,function(){g=!0,_()})),function(){}}function Ir(t,e,n){return n===void 0&&(n=1/0),N(e)?Ir(function(r,i){return b(function(s,u){return e(r,s,i,u)})(ue(t(r,i)))},n):(typeof e=="number"&&(n=e),oe(function(r,i){return Bs(r,i,t,n)}))}function Rn(t,e,n){t===void 0&&(t=0),n===void 0&&(n=As);var r=-1;return e!=null&&(Ps(e)?n=e:r=e),new L(function(i){var s=Ws(t)?+t-n.now():t;s<0&&(s=0);var u=0;return n.schedule(function(){i.closed||(i.next(u++),0<=r?this.schedule(void 0,r):i.complete())},s)})}function Qs(t,e){return oe(function(n,r){var i=0;n.subscribe(ee(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function Mr(t){return t<=0?function(){return ws}:oe(function(e,n){var r=0;e.subscribe(ee(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function Vs(t){return b(function(){return t})}function Zs(t,e){return Ir(function(n,r){return ue(t(n,r)).pipe(Mr(1),Vs(n))})}function Gs(t,e){e===void 0&&(e=mr);var n=Rn(t,e);return Zs(function(){return n})}function Ks(t,e){return e===void 0&&(e=En),t=t??Ys,oe(function(n,r){var i,s=!0;n.subscribe(ee(r,function(u){var c=e(u);(s||!t(i,c))&&(s=!1,i=c,r.next(u))}))})}function Ys(t,e){return t===e}function Js(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,s=e.resetOnSuccess,u=s===void 0?!1:s;return r<=0?En:oe(function(c,a){var h=0,m,g=function(){var _=!1;m=c.subscribe(ee(a,function(l){u&&(h=0),a.next(l)},void 0,function(l){if(h++<r){var d=function(){m?(m.unsubscribe(),m=null,g()):_=!0};if(i!=null){var f=typeof i=="number"?Rn(i):ue(i(l,h)),w=ee(a,function(){w.unsubscribe(),d()},function(){a.complete()});f.subscribe(w)}else d()}else a.error(l)})),_&&(m.unsubscribe(),m=null,g())};g()})}function Rr(t,e){return oe(function(n,r){var i=null,s=0,u=!1,c=function(){return u&&!i&&r.complete()};n.subscribe(ee(r,function(a){i?.unsubscribe();var h=0,m=s++;ue(t(a,m)).subscribe(i=ee(r,function(g){return r.next(e?e(a,g,m,h++):g)},function(){i=null,c()}))},function(){u=!0,c()}))})}function Un(t,e){e===void 0&&(e={});var n=e.selector,r=os(e,["selector"]);return new L(function(i){var s=new AbortController,u=s.signal,c=!0,a=r.signal;if(a)if(a.aborted)s.abort();else{var h=function(){u.aborted||s.abort()};a.addEventListener("abort",h),i.add(function(){return a.removeEventListener("abort",h)})}var m=Xe(Xe({},r),{signal:u}),g=function(_){c=!1,i.error(_)};return fetch(t,m).then(function(_){n?ue(n(_)).subscribe(ee(i,void 0,function(){c=!1,i.complete()},g)):(c=!1,i.next(_),i.complete())}).catch(g),function(){c&&s.abort()}})}const ce=["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","+","/"],Ur=[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 Nt(t){if(t>=Ur.length)throw new Error("Unable to parse base64 string.");const e=Ur[t];if(e===255)throw new Error("Unable to parse base64 string.");return e}function Dr(t){let e="",n,r=t.length;for(n=2;n<r;n+=3)e+=ce[t[n-2]>>2],e+=ce[(t[n-2]&3)<<4|t[n-1]>>4],e+=ce[(t[n-1]&15)<<2|t[n]>>6],e+=ce[t[n]&63];return n===r+1&&(e+=ce[t[n-2]>>2],e+=ce[(t[n-2]&3)<<4],e+="=="),n===r&&(e+=ce[t[n-2]>>2],e+=ce[(t[n-2]&3)<<4|t[n-1]>>4],e+=ce[(t[n-1]&15)<<2],e+="="),e}function Xs(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)),s;for(let u=0,c=0;u<r;u+=4,c+=3)s=Nt(t.charCodeAt(u))<<18|Nt(t.charCodeAt(u+1))<<12|Nt(t.charCodeAt(u+2))<<6|Nt(t.charCodeAt(u+3)),i[c]=s>>16,i[c+1]=s>>8&255,i[c+2]=s&255;return i.subarray(0,i.length-n)}function xs(t,e=new TextEncoder){return Dr(e.encode(t))}var Ft={exports:{}},eo=Ft.exports,Cr;function to(){return Cr||(Cr=1,function(t){(function(e,n){var r={};n(r);var i=r.default;for(var s in r)i[s]=r[s];t.exports=i})(eo,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(_,l,d,f,w){for(var $,T,O,Y,z,D,se,W,Q,B,Et,qt,An;w>=64;){for($=l[0],T=l[1],O=l[2],Y=l[3],z=l[4],D=l[5],se=l[6],W=l[7],B=0;B<16;B++)Et=f+B*4,_[B]=(d[Et]&255)<<24|(d[Et+1]&255)<<16|(d[Et+2]&255)<<8|d[Et+3]&255;for(B=16;B<64;B++)Q=_[B-2],qt=(Q>>>17|Q<<15)^(Q>>>19|Q<<13)^Q>>>10,Q=_[B-15],An=(Q>>>7|Q<<25)^(Q>>>18|Q<<14)^Q>>>3,_[B]=(qt+_[B-7]|0)+(An+_[B-16]|0);for(B=0;B<64;B++)qt=(((z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7))+(z&D^~z&se)|0)+(W+(n[B]+_[B]|0)|0)|0,An=(($>>>2|$<<30)^($>>>13|$<<19)^($>>>22|$<<10))+($&T^$&O^T&O)|0,W=se,se=D,D=z,z=Y+qt|0,Y=O,O=T,T=$,$=qt+An|0;l[0]+=$,l[1]+=T,l[2]+=O,l[3]+=Y,l[4]+=z,l[5]+=D,l[6]+=se,l[7]+=W,f+=64,w-=64}return f}var i=function(){function _(){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 _.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},_.prototype.clean=function(){for(var l=0;l<this.buffer.length;l++)this.buffer[l]=0;for(var l=0;l<this.temp.length;l++)this.temp[l]=0;this.reset()},_.prototype.update=function(l,d){if(d===void 0&&(d=l.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var f=0;if(this.bytesHashed+=d,this.bufferLength>0){for(;this.bufferLength<64&&d>0;)this.buffer[this.bufferLength++]=l[f++],d--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(d>=64&&(f=r(this.temp,this.state,l,f,d),d%=64);d>0;)this.buffer[this.bufferLength++]=l[f++],d--;return this},_.prototype.finish=function(l){if(!this.finished){var d=this.bytesHashed,f=this.bufferLength,w=d/536870912|0,$=d<<3,T=d%64<56?64:128;this.buffer[f]=128;for(var O=f+1;O<T-8;O++)this.buffer[O]=0;this.buffer[T-8]=w>>>24&255,this.buffer[T-7]=w>>>16&255,this.buffer[T-6]=w>>>8&255,this.buffer[T-5]=w>>>0&255,this.buffer[T-4]=$>>>24&255,this.buffer[T-3]=$>>>16&255,this.buffer[T-2]=$>>>8&255,this.buffer[T-1]=$>>>0&255,r(this.temp,this.state,this.buffer,0,T),this.finished=!0}for(var O=0;O<8;O++)l[O*4+0]=this.state[O]>>>24&255,l[O*4+1]=this.state[O]>>>16&255,l[O*4+2]=this.state[O]>>>8&255,l[O*4+3]=this.state[O]>>>0&255;return this},_.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},_.prototype._saveState=function(l){for(var d=0;d<this.state.length;d++)l[d]=this.state[d]},_.prototype._restoreState=function(l,d){for(var f=0;f<this.state.length;f++)this.state[f]=l[f];this.bytesHashed=d,this.finished=!1,this.bufferLength=0},_}();e.Hash=i;var s=function(){function _(l){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var d=new Uint8Array(this.blockSize);if(l.length>this.blockSize)new i().update(l).finish(d).clean();else for(var f=0;f<l.length;f++)d[f]=l[f];for(var f=0;f<d.length;f++)d[f]^=54;this.inner.update(d);for(var f=0;f<d.length;f++)d[f]^=106;this.outer.update(d),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var f=0;f<d.length;f++)d[f]=0}return _.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},_.prototype.clean=function(){for(var l=0;l<this.istate.length;l++)this.ostate[l]=this.istate[l]=0;this.inner.clean(),this.outer.clean()},_.prototype.update=function(l){return this.inner.update(l),this},_.prototype.finish=function(l){return this.outer.finished?this.outer.finish(l):(this.inner.finish(l),this.outer.update(l,this.digestLength).finish(l)),this},_.prototype.digest=function(){var l=new Uint8Array(this.digestLength);return this.finish(l),l},_}();e.HMAC=s;function u(_){var l=new i().update(_),d=l.digest();return l.clean(),d}e.hash=u,e.default=u;function c(_,l){var d=new s(_).update(l),f=d.digest();return d.clean(),f}e.hmac=c;function a(_,l,d,f){var w=f[0];if(w===0)throw new Error("hkdf: cannot expand more");l.reset(),w>1&&l.update(_),d&&l.update(d),l.update(f),l.finish(_),f[0]++}var h=new Uint8Array(e.digestLength);function m(_,l,d,f){l===void 0&&(l=h),f===void 0&&(f=32);for(var w=new Uint8Array([1]),$=c(l,_),T=new s($),O=new Uint8Array(T.digestLength),Y=O.length,z=new Uint8Array(f),D=0;D<f;D++)Y===O.length&&(a(O,T,d,w),Y=0),z[D]=O[Y++];return T.clean(),O.fill(0),w.fill(0),z}e.hkdf=m;function g(_,l,d,f){for(var w=new s(_),$=w.digestLength,T=new Uint8Array(4),O=new Uint8Array($),Y=new Uint8Array($),z=new Uint8Array(f),D=0;D*$<f;D++){var se=D+1;T[0]=se>>>24&255,T[1]=se>>>16&255,T[2]=se>>>8&255,T[3]=se>>>0&255,w.reset(),w.update(l),w.update(T),w.finish(Y);for(var W=0;W<$;W++)O[W]=Y[W];for(var W=2;W<=d;W++){w.reset(),w.update(Y).finish(Y);for(var Q=0;Q<$;Q++)O[Q]^=Y[Q]}for(var W=0;W<$&&D*$+W<f;W++)z[D*$+W]=O[W]}for(var D=0;D<$;D++)O[D]=Y[D]=0;for(var D=0;D<4;D++)T[D]=0;return w.clean(),z}e.pbkdf2=g})}(Ft)),Ft.exports}var no=to();const ro=new Int32Array(4);class G{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 G;static _hex(e){const n=G.hexChars,r=G.hexOut;let i,s,u,c;for(c=0;c<4;c+=1)for(s=c*8,i=e[c],u=0;u<8;u+=2)r[s+1+u]=n.charAt(i&15),i>>>=4,r[s+0+u]=n.charAt(i&15),i>>>=4;return r.join("")}static _md5cycle(e,n){let r=e[0],i=e[1],s=e[2],u=e[3];r+=(i&s|~i&u)+n[0]-680876936|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[1]-389564586|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[2]+606105819|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[3]-1044525330|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&u)+n[4]-176418897|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[5]+1200080426|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[6]-1473231341|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[7]-45705983|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&u)+n[8]+1770035416|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[9]-1958414417|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[10]-42063|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[11]-1990404162|0,i=(i<<22|i>>>10)+s|0,r+=(i&s|~i&u)+n[12]+1804603682|0,r=(r<<7|r>>>25)+i|0,u+=(r&i|~r&s)+n[13]-40341101|0,u=(u<<12|u>>>20)+r|0,s+=(u&r|~u&i)+n[14]-1502002290|0,s=(s<<17|s>>>15)+u|0,i+=(s&u|~s&r)+n[15]+1236535329|0,i=(i<<22|i>>>10)+s|0,r+=(i&u|s&~u)+n[1]-165796510|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[6]-1069501632|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[11]+643717713|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[0]-373897302|0,i=(i<<20|i>>>12)+s|0,r+=(i&u|s&~u)+n[5]-701558691|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[10]+38016083|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[15]-660478335|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[4]-405537848|0,i=(i<<20|i>>>12)+s|0,r+=(i&u|s&~u)+n[9]+568446438|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[14]-1019803690|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[3]-187363961|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[8]+1163531501|0,i=(i<<20|i>>>12)+s|0,r+=(i&u|s&~u)+n[13]-1444681467|0,r=(r<<5|r>>>27)+i|0,u+=(r&s|i&~s)+n[2]-51403784|0,u=(u<<9|u>>>23)+r|0,s+=(u&i|r&~i)+n[7]+1735328473|0,s=(s<<14|s>>>18)+u|0,i+=(s&r|u&~r)+n[12]-1926607734|0,i=(i<<20|i>>>12)+s|0,r+=(i^s^u)+n[5]-378558|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[8]-2022574463|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[11]+1839030562|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[14]-35309556|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^u)+n[1]-1530992060|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[4]+1272893353|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[7]-155497632|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[10]-1094730640|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^u)+n[13]+681279174|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[0]-358537222|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[3]-722521979|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[6]+76029189|0,i=(i<<23|i>>>9)+s|0,r+=(i^s^u)+n[9]-640364487|0,r=(r<<4|r>>>28)+i|0,u+=(r^i^s)+n[12]-421815835|0,u=(u<<11|u>>>21)+r|0,s+=(u^r^i)+n[15]+530742520|0,s=(s<<16|s>>>16)+u|0,i+=(s^u^r)+n[2]-995338651|0,i=(i<<23|i>>>9)+s|0,r+=(s^(i|~u))+n[0]-198630844|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[7]+1126891415|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[14]-1416354905|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[5]-57434055|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~u))+n[12]+1700485571|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[3]-1894986606|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[10]-1051523|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[1]-2054922799|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~u))+n[8]+1873313359|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[15]-30611744|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[6]-1560198380|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[13]+1309151649|0,i=(i<<21|i>>>11)+s|0,r+=(s^(i|~u))+n[4]-145523070|0,r=(r<<6|r>>>26)+i|0,u+=(i^(r|~s))+n[11]-1120210379|0,u=(u<<10|u>>>22)+r|0,s+=(r^(u|~i))+n[2]+718787259|0,s=(s<<15|s>>>17)+u|0,i+=(u^(s|~r))+n[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=s+e[2]|0,e[3]=u+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(G.stateIdentity),this}appendStr(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,u;for(u=0;u<e.length;u+=1){if(s=e.charCodeAt(u),s<128)n[i++]=s;else if(s<2048)n[i++]=(s>>>6)+192,n[i++]=s&63|128;else if(s<55296||s>56319)n[i++]=(s>>>12)+224,n[i++]=s>>>6&63|128,n[i++]=s&63|128;else{if(s=(s-55296)*1024+(e.charCodeAt(++u)-56320)+65536,s>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");n[i++]=(s>>>18)+240,n[i++]=s>>>12&63|128,n[i++]=s>>>6&63|128,n[i++]=s&63|128}i>=64&&(this._dataLength+=64,G._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,s,u=0;for(;;){for(s=Math.min(e.length-u,64-i);s--;)n[i++]=e.charCodeAt(u++);if(i<64)break;this._dataLength+=64,G._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(e){const n=this._buffer8,r=this._buffer32;let i=this._bufferLength,s,u=0;for(;;){for(s=Math.min(e.length-u,64-i);s--;)n[i++]=e[u++];if(i<64)break;this._dataLength+=64,G._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 s;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],s=0;s<n.length;s+=1)this._buffer8[s]=n.charCodeAt(s)}end(e=!1){const n=this._bufferLength,r=this._buffer8,i=this._buffer32,s=(n>>2)+1;this._dataLength+=n;const u=this._dataLength*8;if(r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(G.buffer32Identity.subarray(s),s),n>55&&(G._md5cycle(this._state,i),i.set(G.buffer32Identity)),u<=4294967295)i[14]=u;else{const c=u.toString(16).match(/(.*?)(.{0,8})$/);if(c===null)return e?ro:"";const a=parseInt(c[2],16),h=parseInt(c[1],16)||0;i[14]=a,i[15]=h}return G._md5cycle(this._state,i),e?this._state:G._hex(this._state)}}if(G.hashStr("hello")!=="5d41402abc4b2a76b9719d911017c592")throw new Error("Md5 self test failed.");const io=36e5,Nr=Symbol.for("constructDateFrom");function Lt(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&Nr in t?t[Nr](e):t instanceof Date?new t.constructor(e):new Date(e)}function xe(t,e){return Lt(t,t)}function so(t,e,n){const r=xe(t);if(isNaN(e))return Lt(t,NaN);const i=r.getDate(),s=Lt(t,r.getTime());s.setMonth(r.getMonth()+e+1,0);const u=s.getDate();return i>=u?s:(r.setFullYear(s.getFullYear(),s.getMonth(),i),r)}function Fr(t,e,n){return Lt(t,+xe(t)+e)}function oo(t,e,n){return Fr(t,e*io)}function uo(t,e,n){return Fr(t,e*1e3)}function co(t,e,n){return so(t,e*12)}function Lr(t){return Math.trunc(+xe(t)/1e3)}function ao(t,e){return+xe(t)<+xe(e)}function p(t,e,n,r="debug",i){if(window.debug){const u=["color: #0288D1",`color:${i||"#009688"}`,"color: default"];n?Dn()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...u,n):console[r](`[PlaceOS][${t}] ${e}`,n):Dn()?console[r](`%c[PlaceOS]%c[${t}] %c${e}`,...u):console[r](`[PlaceOS][${t}] ${e}`)}}function Dn(){return!(document.documentMode||/Edge/.test(navigator.userAgent))}function Cn(){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=je(i[0]),e||(e=i[1])}else n=je(t);let r={};return e&&(r=je(e)),{...n,...r}}function je(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 jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Hr(t=40){let e="";for(let n=0;n<t;n++)e+=jr.charAt(Math.floor(Math.random()*jr.length));return e}function _e(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 et(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 zr(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 s=i[0].replace(/<(.*)>/,"$1").trim(),u=i[1].replace(/rel="(.*)"/,"$1").trim();n[u]=s}return n}function Wr(t,e){for(const n in t)t.hasOwnProperty(n)&&e.indexOf(t[n])>=0&&delete t[n];return t}function Br(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Qr(){return window.location!==window.parent.location}function Vr(t=Date.now(),e=60*1e3){return Math.floor(t/e)}class lo{abort(){p("Stub","Aborted")}}function U(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 Te={},tt={},me={};function ho(){for(const t in Te)Te.hasOwnProperty(t)&&Oe(t);for(const t in tt)tt.hasOwnProperty(t)&&fo(t);for(const t in me)me.hasOwnProperty(t)&&po(t)}function ae(t,e,n=300){if(t&&e&&e instanceof Function)Oe(t),Te[t]=setTimeout(()=>{e(),delete Te[t]},n);else throw new Error(t?"Cannot create named timeout without a name":"Cannot create a timeout without a callback")}function Oe(t){Te[t]&&(clearTimeout(Te[t]),delete Te[t])}function fo(t){tt[t]&&(clearInterval(tt[t]),delete tt[t])}function po(t){me&&me[t]&&(me[t]instanceof Ae?me[t].unsubscribe():me[t](),delete me[t])}const _o={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={},M=localStorage,j;const k={};let R="",Ee="";const He=new pe(""),jt=new pe("");let Nn="/api/engine/v2";const ye=new pe(!1),mo=ye.asObservable();let Ht=0;function Zr(t){if(!t||t.startsWith("http://")||t.startsWith("https://"))return t;const e=j?.domain;return e?`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${e}${t}`:t}function A(){return`${`${v.secure||window.location?.protocol.indexOf("https")>=0?"https:":"http:"}//${v.host||window.location?.host}`}${Fn()}`}function Fn(){return v.version==="ACA Engine"?"/control/api":Nn}function yo(){return!!v.token_header}function Gr(){return R}function go(){return v.redirect_uri}function vo(t,e=!0){M.setItem(`${R}_x-api-key`,`${t}`),M.setItem("trusted",`${e}`),Kr("x-api-key",co(new Date,5).valueOf())}function nt(){return Vt("x-api-key",!1)||""}function Kr(t,e=oo(new Date,2).valueOf()){v.ignore_api_key&&t==="x-api-key"||(M.setItem(`${R}_expires_at`,`${e}`),M.setItem(`${R}_access_token`,t))}function J(t=!0){if(v.mock)return"mock-token";if(!M)return"";if(nt()&&!v.ignore_api_key)return"x-api-key";const e=M.getItem(`${R}_expires_at`)||"",n=He.getValue();return ao(+e,new Date)&&(p("Auth","Token expired. Requesting new token..."),Zt(),k.load_authority||(Ht+=1,ae("re-authorise",async()=>{delete k.authorise,await Hn().catch(r=>p("Auth",`Failed to get token: ${r}`))},200*Math.min(20,Ht))),!t)?"":n||M.getItem(`${R}_access_token`)||""}function zt(){return jt.getValue()||M.getItem(`${R}_refresh_token`)||""}function Wt(){return v.host||window.location?.host}function Yr(){return!!J()}function Jr(){return He.pipe(b(t=>!!Yr()))}function rt(){return j}function bo(){return ye.getValue()}function Bt(){return!!v.mock}function Xr(){return!!v.secure}function So(){return mo}function Qt(){return Vt("trust")==="true"||Vt("trusted")==="true"}function Ln(){return!!nt()&&!v.ignore_api_key||Vt("fixed_device")==="true"}function Vt(t,e=!0){let r=Cn()[t];if(M){const i=`${Gr()}_${t}`;r=r||M.getItem(i)||M.getItem(t)||"",e&&M.setItem(i,`${r}`)}return r}async function ko(t){return v=t||v,v.token_header=v.token_header??Qr(),window.AbortController||(window.AbortController=lo),M=v.storage==="session"?sessionStorage:localStorage,R=G.hashStr(v.redirect_uri,!1),v.delay&&v.delay>0&&await zs(Rn(v.delay)),zn()}function $o(t){M=t==="session"?sessionStorage:localStorage}function Ao(){v={},j=void 0,He.next(""),jt.next(""),ye.next(!1),R="",Ee="",Nn="/api/engine/v2";for(const t in k)t in k&&delete k[t];ho()}function jn(){return p("Auth","Refreshing authorty."),j=void 0,zn()}function Zt(){p("Auth","Invalidating tokens."),M.removeItem(`${R}_access_token`),M.removeItem(`${R}_expires_at`),He.getValue()&&He.next("")}function Hn(t,e=j){return k.authorise||(k.authorise=new Promise((n,r)=>{if(!e)return delete k.authorise,r("Authority is not loaded");p("Auth","Authorising user...");const i=()=>{if(J(!1))p("Auth","Valid token found."),delete k.authorise,n(J());else{const s=[()=>{p("Auth","Successfully generated token."),n(J()),delete k.authorise},()=>{p("Auth","Failed to generate token."),r("Failed to generate token"),setTimeout(()=>delete k.authorise,200)}];v&&v.auth_type==="password"?(p("Auth","Logging in with credentials."),Uo(v).then(...s),Ht=0):Ee||zt()?(p("Auth",`Generating token with ${Ee?"code":"refresh token"}`),ni().then(...s),Ht=0):e.session?(p("Auth","Users has session. Authorising application..."),Po(t).then(...s)):(p("Auth","No user session"),ei(e),r("No user session"),setTimeout(()=>delete k.authorise,200))}};Oo().then(i,i)})),k.authorise}function wo(){const t=Zr(j?j.logout_url:"/logout");fetch(t,{method:"GET",redirect:"manual",headers:{Authorization:"Bearer "+J()}}).then(e=>{const n=e.headers.get("Location")||t;for(let r=0;r<M.length;r++){const i=M.key(r);i&&i.indexOf(R)>=0&&M.removeItem(i)}window.location?.assign(n)})}function zn(t=0){return k.load_authority||(k.load_authority=new Promise(e=>{if(ye.next(!1),v.mock){j=_o,p("Auth","System in mock mode"),ye.next(!0),e();return}p("Auth",`Fixed: ${Ln()} | Trusted: ${Qt()}`),p("Auth","Loading authority...");const n=v.secure||window.location?.protocol.indexOf("https")>=0,r=i=>{p("Auth",`Failed to load authority(${i})`),ye.next(!1),ae("load_authority",()=>{delete k.load_authority,zn(t).then(s=>e())},300*Math.min(20,++t))};Un(`${n?"https:":"http:"}//${Wt()}/auth/authority`,{credentials:"same-origin"}).subscribe(async i=>{if(!i.ok)return r(await i.text().catch(u=>u));j=await i.json(),Nn=/[2-9]\.[0-9]+\.[0-9]+/g.test(j.version||"")?"/api/engine/v2":"/control/api",p("Auth","Loaded authority.",[],"group"),j&&(p("Auth",`Name: ${j.name}`),p("Auth",`Version: ${j.version}`),p("Auth",`Domain: ${j.domain}`),p("Auth",`Session: ${j.session}`),p("Auth",`Production: ${j.production}`),p("Auth",`Config Keys: ${Object.keys(j.config||{}).length}`)),p("Auth","",[],"groupEnd");const s=()=>{ye.next(!0),p("Auth","Application set online."),e()};delete k.load_authority,Hn("").then(s,s)},r)})),k.load_authority}async function Po(t){const e=qo(t);if(v.use_iframe)return To(e);window.location?.assign(e)}function To(t){return k.iframe_auth||(k.iframe_auth=new Promise((e,n)=>{p("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=s=>{if(s.origin===window.location?.origin&&s.data.type==="place-os"){const u=s.data;if(p("Auth","Received credentials from iFrame..."),document.body.removeChild(r),Oe("iframe_auth"),window.removeEventListener("message",i),delete k.iframe_auth,u.token)return e(),Wn({access_token:u.token,...u});Ee=u.code||"",ni().then(c=>e(c),c=>n(c))}};ae("iframe_auth",()=>{p("Auth","Unable to resolve iFrame after 15 seconds..."),n()},15*1e3),window.addEventListener("message",i),r.onerror=s=>{p("Auth","iFrame error.",s),delete k.iframe_auth,n()},document.body.appendChild(r)})),k.iframe_auth}let xr=!1;function ei(t){if(v.handle_login!==!1&&!xr){p("Auth","Redirecting to login page...");const e=Zr(t.login_url?.replace("{{url}}",encodeURIComponent(window.location?.href)));throw setTimeout(()=>window.location?.assign(e),300),xr=!0,new Error("Redirecting to login page...")}else p("Auth","Login being handled locally.");delete k.authorise}function Oo(){return k.check_token||(k.check_token=new Promise(async(t,e)=>{J()?(p("Auth","Valid token found."),t(J())):(p("Auth","No token. Checking URL for auth credentials..."),await Eo()?t(!0):e()),delete k.check_token})),k.check_token}function Eo(){return k.check_params||(k.check_params=new Promise(t=>{p("Auth","Checking for auth parameters...");let e=Cn();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&&(Ee=e.code,_e("code")),e.refresh_token&&(M.setItem(`${R}_refresh_token`,e.refresh_token),_e("refresh_token"));const n=M.getItem(`${R}_nonce`)||"",r=(e.state||"").split(";");_e("state"),_e("token_type");const i=r[0];n===i?(Wn(e),t(!!e.access_token)):t(!1)}else t(!1);ae("check_params_promise",()=>delete k.check_params,50)})),k.check_params}function qo(t){const e=Do();t=t?`${e};${t}`:e;const n=v?(v.auth_uri||"").indexOf("?")>=0:!1,r=(v?v.auth_uri:null)||"/auth/oauth/authorize",i=Qt()||v.auth_type==="auth_code"?"code":"token";let s=`${r}${n?"&":"?"}response_type=${encodeURIComponent(i)}&client_id=${encodeURIComponent(R)}&state=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(v.redirect_uri)}&scope=${encodeURIComponent(v.scope)}`;if(v.auth_type==="auth_code"){const{challenge:u,verify:c}=Io();sessionStorage.setItem(`${R}_challenge`,u),s+="&code_challenge_method=S256",s+=`&code_challenge=${c}`}return s}const ti="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("");function Io(t=43){const e=new Array(t).fill(0).map(()=>ti[Math.floor(Math.random()*ti.length)]).join(""),n=Xs(xs(e)),r=Dr(no.hash(n)).split("=")[0].replace(/\//g,"_").replace(/\+/g,"-");return{challenge:e,verify:r}}function Mo(){let e=(v.token_uri||"/auth/token")+`?client_id=${encodeURIComponent(R)}`,n="";if(e+=`&redirect_uri=${encodeURIComponent(v.redirect_uri)}`,zt()){e+=`&refresh_token=${encodeURIComponent(zt())}`,e+="&grant_type=refresh_token";const r=e.split("?");e=r[0],n=r[1]}else{e+=`&code=${encodeURIComponent(Ee)}`,e+="&grant_type=authorization_code";const r=sessionStorage.getItem(`${R}_challenge`);r&&(e+=`&code_verifier=${r}`,sessionStorage.removeItem(`${R}_challenge`)),Ee=""}return[e,n]}function Ro(t){const e=t.token_uri||"/auth/token",n=U({grant_type:"password",client_id:R,client_secret:t.client_secret,redirect_uri:t.redirect_uri,authority:j?.id,scope:t.scope,username:t.username,password:t.password});return`${e}?${n}`}function ni(){return ri(...Mo())}function Uo(t){return ri(Ro(t))}function ri(t,e=""){return k.generate_tokens||(k.generate_tokens=new Promise((n,r)=>{p("Auth","Generating new token...");const i=s=>{p("Auth","Error generating new tokens.",s),M.removeItem(`${R}_refresh_token`),jt.next(""),r(),delete k.generate_tokens};Un(t,{method:"POST",body:e,headers:{"Content-Type":"application/x-www-form-urlencoded"}}).subscribe(async s=>{if(!s.ok)return i(s);const u=await s.json();Wn(u),n(),delete k.generate_tokens},i)})),k.generate_tokens}function Wn(t){const e=uo(new Date,Math.max(60,parseInt(t.expires_in,10)-300));p("Auth","Tokens generated storing..."),Qt()&&(t.access_token&&(M.setItem(`${R}_access_token`,t.access_token),_e("access_token")),t.refresh_token&&(M.setItem(`${R}_refresh_token`,t.refresh_token),_e("refresh_token"))),t.expires_in&&(M.setItem(`${R}_expires_at`,`${e.valueOf()}`),_e("expires_in")),ye.next(!0),He.next(t.access_token||""),jt.next(t.refresh_token||"")}function Do(){const t=Hr();return M.setItem(`${R}_nonce`,t),t}const Gt={};let ii=(t,e)=>{const n=new Error(`Mock endpoint not found: ${t} ${e}`);return n.status=404,p("HTTP(M)",`404 ${t}:`,e),qr(n)};function Co(t){ii=t}function No(t,e=Gt){si(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(s=>s[0]===":"?s.replace(":",""):"")};e[n]=i,p("HTTP(M)",`+ ${t.method} ${t.path}`)}function si(t,e,n=Gt){const r=`${t}|${e}`;n[r]&&(delete n[r],p("HTTP(M)",`- ${t} ${e}`))}function Fo(t,e,n,r=Gt){const i=Lo(t,e,r);if(i){const s=jo(e,i,n);return Ho(i,s)}return ii(t,e)}function Lo(t,e,n=Gt){const i=e.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").replace(/^\//,"").split("?")[0].split("/"),s=Object.keys(n).reduce((u,c)=>(c.indexOf(`${t}|`)===0&&u.push(n[c]),u),[]);for(const u of s)if(u.path_structure.length===i.length){let c=!0;for(let a=0;a<u.path_structure.length;a++)if(!u.path_structure[a]&&u.path_parts[a]!==i[a]){c=!1;break}if(c)return u}return null}function jo(t,e,n){const r=t.replace(/(http|https):\/\/[a-zA-Z0-9.-]*:?([0-9]*)?/g,"").split("?"),i=r[0].replace(/^\//,""),s=r[1]||"",u=je(s),c=i.split("/"),a={};for(let m=0;m<e.path_structure.length;m++){const g=e.path_structure[m];g&&(a[g]=c[m])}const h={url:t,path:e.path,method:e.method,metadata:e.metadata,route_params:a,query_params:u,body:n};return p("HTTP(M)",`MATCHED ${h.method}:`,h),h}function Ho(t,e){let n;try{n=t.callback?t.callback(e):t.metadata}catch(u){throw p("HTTP(M)",`ERROR ${e.method}:`,[e.url,u]),u}const r=t.delay_variance||100,i=t.delay||300,s=Math.floor(Math.random()*r-r/2)+i;return p("HTTP(M)",`RESP ${e.method}:`,[e.url,n]),js([n]).pipe(Gs(Math.max(200,s)))}const oi={};function ui(t,e=oi){return e[t]||{}}function F(t,e,n=it){return e||(e={response_type:"json"}),n("GET",t,{response_type:"json",...e})}function K(t,e,n,r=it){return n||(n={response_type:"json"}),r("POST",t,{body:e,response_type:"json",...n})}function qe(t,e,n,r=it){return n||(n={response_type:"json"}),r("PUT",t,{body:e,response_type:"json",...n})}function ze(t,e,n,r=it){return n||(n={response_type:"json"}),r("PATCH",t,{body:e,response_type:"json",...n})}function ge(t,e,n=it){return e||(e={response_type:"void"}),n("DELETE",t,{response_type:"void",...e})}async function zo(t,e,n=oi){if(t.headers){const r={};t.headers.forEach?t.headers.forEach((i,s)=>r[s.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 ci=()=>(Zt(),jn().then(()=>Promise.resolve(),()=>new Promise(t=>{setTimeout(()=>{ci().then(()=>t())},1e3)})));function it(t,e,n,r=Bt,i=Fo,s=zo){if(r()){const u=i(t,e,n?.body);if(u)return u}return n.headers=n.headers||{},!n.headers["Content-Type"]&&!n.headers["content-type"]&&(n.headers["Content-Type"]="application/json"),Jr().pipe(Qs(u=>u),Mr(1),Rr(u=>{J()==="x-api-key"?n.headers["X-API-Key"]=nt():n.headers.Authorization=`Bearer ${J()}`;const c={...n,method:t,credentials:"same-origin"};return["POST","PUT","PATCH"].includes(t)&&n.body!==void 0&&(c.body=typeof n.body=="string"?n.body:JSON.stringify(n.body)),Un(e,c)}),Rr(u=>u.ok?s(u,n.response_type):qr(u)),Js({count:4,delay:(u,c)=>new L(a=>{if(u.status===511){ei(rt()),a.error(u);return}if(u.status!==401){a.error(u||{});return}p("HTTP","Auth error",u);const h=Math.pow(2,c-1)*1e3;ci().then(()=>{a.next(h),a.complete()}).catch(()=>{a.error(u)})})}))}class H{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,Wr(e,[void 0,null,""])}}class ai extends H{alert_dashboard_id;alert_dashboard_details;authority_id;description;enabled;conditions;severity;alert_type;debounce_period;any_match;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1,this.conditions=e.conditions||{time_dependents:[],comparisons:[]},this.severity=e.severity||"low",this.alert_type=e.alert_type||"threshold",this.debounce_period=e.debounce_period||0,this.alert_dashboard_id=e.alert_dashboard_id||"",this.alert_dashboard_details=e.alert_dashboard_details||void 0,this.any_match=e.any_match||!1}}class li extends H{authority_id;description;enabled;constructor(e){super(e),this.authority_id=e.authority_id||"",this.description=e.description||"",this.enabled=e.enabled||!1}}const We="alert_dashboards";function Kt(t){return new li(t)}function Wo(t={}){return P({query_params:t,fn:Kt,path:We})}function Bo(t){return S({id:t,query_params:{},fn:Kt,path:We})}function Qo(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Kt,path:We})}function Vo(t){return q({form_data:t,query_params:{},fn:Kt,path:We})}function Zo(t){return E({id:t,query_params:{},path:We})}function Go(t){return P({query_params:{},fn:ot,path:`${We}/${t}/alerts`})}const st="alerts";function ot(t){return new ai(t)}function Ko(t={}){return P({query_params:t,fn:ot,path:st})}function Yo(t,e={}){return S({id:t,query_params:e,fn:ot,path:st})}function Jo(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:ot,path:st})}function Xo(t){return q({form_data:t,query_params:{},fn:ot,path:st})}function xo(t){return E({id:t,query_params:{},path:st})}class hi extends H{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 eu(t){return fi[t]||0}function tu(t){return di[t]||0}let fi={},di={},pi="";const Yt=t=>t;function P(t){const{query_params:e,fn:n,path:r,endpoint:i}=t,s=U(e),u=`${i||A()}${r?"/"+r:""}${s?"?"+s:""}`;return F(u).pipe(b(c=>{const a=nu(u,s,r);return{total:a.total||0,next:a.next?()=>P({query_params:a.next,fn:n,endpoint:i,path:r}):null,data:c&&c instanceof Array?c.map(h=>(n||Yt)(h)):c&&!(c instanceof Array)&&c.results?c.results.map(h=>h):[]}}))}function S(t){const{query_params:e,id:n,path:r,fn:i,options:s}=t,u=U(e),c=`${A()}/${r}/${n}${u?"?"+u:""}`;return F(c,s).pipe(b(a=>(i||Yt)(a)))}function q(t){const{query_params:e,form_data:n,path:r,fn:i}=t,s=U(e),u=`${A()}/${r}${s?"?"+s:""}`;return K(u,n).pipe(b(a=>(i||Yt)(a)))}function y(t){const{id:e,task_name:n,form_data:r,method:i,path:s,callback:u}=t,c=U(r),a=`${A()}/${s}/${e}/${n}`;return(i==="post"||i==="put"||!i?(i==="put"?qe:K)(a,r):(i==="del"?ge:F)(`${a}${c?"?"+c:""}`,{response_type:"json"})).pipe(b(m=>(u||(g=>g))(m)))}function I(t){const{id:e,query_params:n,form_data:r,method:i,path:s,fn:u}=t,c=U({...n,version:r.version||0}),a=`${A()}/${s}/${e}${c?"?"+c:""}`;return(i==="put"?qe:ze)(a,r).pipe(b(h=>(u||Yt)(h)))}function E(t){const{id:e,query_params:n,path:r}=t,i=U(n),s=`${A()}/${r}/${e}${i?"?"+i:""}`;return ge(s)}function nu(t,e,n){const r=ui(t[0]==="/"?`${location.origin}${t}`:t),i={total:0,next:null};if(r&&r["x-total-count"]){const s=+(r["x-total-count"]||0);(e.length<2||e.length<12&&e.indexOf("offset=")>=0)&&(fi[n]=s),di[n]=s,i.total=s}return r&&r.link&&(pi=zr(r.link||"").next,i.next=je(pi.split("?")[1])),i}function Nh(t){return t}const ut="oauth_apps";function Jt(t){return new hi(t)}function ru(t={}){return P({query_params:t,fn:Jt,path:ut})}function iu(t){return S({id:t,query_params:{},fn:Jt,path:ut})}function su(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Jt,path:ut})}function ou(t){return q({form_data:t,query_params:{},fn:Jt,path:ut})}function uu(t){return E({id:t,query_params:{},path:ut})}var _i=(t=>(t[t.Certificate=0]="Certificate",t[t.NoAuth=1]="NoAuth",t[t.UserPassword=2]="UserPassword",t))(_i||{});class mi extends H{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 ct="brokers";function Xt(t){return new mi(t)}function cu(t={}){return P({query_params:t,fn:Xt,path:ct})}function au(t,e={}){return S({id:t,query_params:e,fn:Xt,path:ct})}function lu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Xt,path:ct})}function hu(t){return q({form_data:t,query_params:{},fn:Xt,path:ct})}function fu(t,e={}){return E({id:t,query_params:e,path:ct})}class yi{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=et(this.memory_usage*1024),this.total_memory=et(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 gi{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=et(this.memory_usage*1024),this.total_memory=et(this.memory_total*1024)}}const Be="cluster";function vi(t){return new yi(t)}function du(t={}){return P({query_params:t,fn:vi,path:Be})}function pu(t,e={}){return S({id:t,query_params:e,fn:vi,path:Be})}function _u(t,e={}){return S({id:t,query_params:e,fn:n=>n.map(r=>new gi(t,r)),path:Be})}function mu(t,e){return E({id:t,query_params:e,path:Be})}function yu(){const t=`${A()}${Be}/rebalance`;return K(t,{}).pipe(b(()=>{}))}function gu(){const t=`${A()}${Be}/versions`;return F(t).pipe(b(e=>e))}class bi extends H{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 Qe="domains";function at(t){return new bi(t)}function vu(t={}){return P({query_params:t,fn:at,path:Qe})}function bu(t){return S({id:t,query_params:{},fn:at,path:Qe})}function Su(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:at,path:Qe})}function ku(t){return q({form_data:t,query_params:{},fn:at,path:Qe})}function $u(t){return E({id:t,query_params:{},path:Qe})}function Au(t){const e=`${A()}${Qe}/lookup/${encodeURIComponent(t)}`;return F(e).pipe(b(n=>at(n)))}var Ie=(t=>(t[t.None=0]="None",t[t.Support=1]="Support",t[t.Admin=2]="Admin",t[t.NeverDisplay=3]="NeverDisplay",t))(Ie||{});class ve extends H{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||Ie.None,this.keys=e.keys||[],this.modified_by_id=e.modified_by_id||""}}var lt=(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))(lt||{});class Bn extends H{class_name;description;module_name;role;default_uri;default_port;repository_id;file_name;commit;ignore_connected;update_available;update_info;alert_level;settings;constructor(e={}){super(e),this.description=e.description||"",this.module_name=e.module_name||"",this.role=e.role??lt.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.alert_level=e.alert_level||"medium",this.settings=e.settings||[null,null,null,null],typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ie)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}}const le="drivers";function xt(t){return new Bn(t)}function wu(t={}){return P({query_params:t,fn:xt,path:le})}function Pu(t,e={}){return S({id:t,query_params:e,fn:xt,path:le})}function Tu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:xt,path:le})}function Ou(t){return q({form_data:t,query_params:{},fn:xt,path:le})}function Eu(t){return E({id:t,query_params:{},path:le})}function qu(t){return y({id:t,task_name:"recompile",path:le})}function Iu(t){return y({id:t,task_name:"reload",path:le})}function Mu(t){return y({id:t,task_name:"compiled",method:"get",path:le})}function Ru(t){return y({id:t,task_name:"readme",method:"get",path:le})}class Si extends H{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 Me="edges";function en(t){return new Si(t)}function Uu(t={}){return P({query_params:t,fn:en,path:Me})}function Du(t){return S({id:t,query_params:{},fn:en,path:Me})}function Cu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:en,path:Me})}function Nu(t){return q({form_data:t,query_params:{},fn:en,path:Me})}function Fu(t){return E({id:t,query_params:{},path:Me})}function Lu(t){return y({id:t,task_name:"token",form_data:{},method:"get",path:Me})}function ju(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${Me}/control`}class ki extends H{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 ht="ldap_auths";function tn(t){return new ki(t)}function Hu(t={}){return P({query_params:t,fn:tn,path:ht})}function zu(t){return S({id:t,query_params:{},fn:tn,path:ht})}function Wu(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:tn,path:ht})}function Bu(t){return q({form_data:t,query_params:{},fn:tn,path:ht})}function Qu(t){return E({id:t,query_params:{},path:ht})}class Qn{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 he extends H{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;any_match;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||"",this.any_match=e.any_match||!1}}class nn extends H{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 Ie)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.trigger_data&&e.trigger_data instanceof Array&&(this.trigger_list=e.trigger_data.map(n=>new he(n)))}}class $i{zone;metadata;keys;constructor(e={}){this.zone=new nn(e.zone),this.keys=e.keys||[],this.metadata={};const n=e.metadata||{};for(const r of this.keys)this.metadata[r]=new Qn(n[r])}}const Re="metadata";function ft(t){return new Qn(t)}function Vu(t,e={}){return S({id:t,query_params:e,fn:n=>Object.keys(n).map(r=>ft(n[r])),path:Re})}function Zu(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 Gu(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>Zu(Object.keys(n).map(r=>n[r].map(i=>ft(i)))),path:Re})}function Ku(t,e){return S({id:t,query_params:{name:e},fn:n=>ft(n[e]),path:Re})}function Yu(t,e,n="put"){return I({id:t,form_data:e,query_params:{},method:n,fn:ft,path:Re})}function Ju(t){return q({form_data:t,query_params:{},fn:ft,path:Re})}function Xu(t,e){return E({id:t,query_params:e,path:Re})}function xu(t,e){return y({id:t,task_name:"children",form_data:e,method:"get",callback:n=>n.map(r=>new $i({...r,keys:Object.keys(r.metadata)})),path:Re})}class Vn extends H{settings=[null,null,null,null];display_name;description;email;code;capacity;features;bookable;public;installed_ui_devices;support_url;timetable_url;camera_snapshot_url;camera_snapshot_urls;camera_url;room_booking_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.camera_snapshot_url=e.camera_snapshot_url||"",this.camera_snapshot_urls=e.camera_snapshot_urls||[],this.camera_url=e.camera_url||"",this.timetable_url=e.timetable_url||"",this.room_booking_url=e.room_booking_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 Ie)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}));e.module_data&&e.module_data instanceof Array&&(this.module_list=e.module_data.map(n=>new Zn(n)))}}class Zn extends H{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;alert_level;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??lt.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 Vn(e.control_system||e.system),this.has_runtime_error=e.has_runtime_error||!1,this.error_timestamp=e.error_timestamp||0,this.driver=new Bn(e.dependency||e.driver),this.settings=e.settings||[null,null,null,null],this.alert_level=e.alert_level||"medium",typeof this.settings!="object"&&(this.settings=[null,null,null,null]);for(const n in Ie)!isNaN(Number(n))&&!this.settings[n]&&(this.settings[n]=new ve({parent_id:this.id,encryption_level:+n}))}toJSON(e=!1){const n=super.toJSON();return(n.role!==lt.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 X="modules";function rn(t){return new Zn(t)}function ec(t={}){return P({query_params:t,fn:rn,path:X})}function tc(t,e={}){return S({id:t,query_params:e,fn:rn,path:X})}function nc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:rn,path:X})}function rc(t){return q({form_data:t,query_params:{},fn:rn,path:X})}function ic(t){return E({id:t,query_params:{},path:X})}function sc(t){return y({id:t,task_name:"start",path:X})}function oc(t){return y({id:t,task_name:"stop",path:X})}function uc(t){return y({id:t,task_name:"state",method:"get",path:X})}function cc(t,e){return y({id:t,task_name:`state/${e}`,method:"get",path:X})}function ac(t){return y({id:t,task_name:"load",method:"post",path:X})}function lc(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:X})}function hc(t){return y({id:t,task_name:"error",method:"get",path:X})}function fc(t,e,n=[]){return y({id:t,task_name:`exec/${encodeURIComponent(e)}`,form_data:n,path:X})}class Ai extends H{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 dt="oauth_auths";function sn(t){return new Ai(t)}function dc(t={}){return P({query_params:t,fn:sn,path:dt})}function pc(t){return S({id:t,query_params:{},fn:sn,path:dt})}function _c(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:sn,path:dt})}function mc(t){return q({form_data:t,query_params:{},fn:sn,path:dt})}function yc(t){return E({id:t,query_params:{},path:dt})}var Gn=(t=>(t.Driver="driver",t.Interface="interface",t))(Gn||{});class wi extends H{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||Gn.Driver,this.username=e.username||"",this.password=e.password||"",this.root_path=e.root_path||""}}const V="repositories";function on(t){return new wi(t)}function gc(t={}){return P({query_params:t,fn:on,path:V})}function vc(t){return S({id:t,query_params:{},fn:on,path:V})}function bc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:on,path:V})}function Sc(t){return q({form_data:t,query_params:{},fn:on,path:V})}function kc(t){return E({id:t,query_params:{},path:V})}function $c(){return S({id:"interfaces",query_params:{},path:V})}function Ac(t){return S({id:"remote_default_branch",query_params:t,path:V})}function wc(t){return S({id:"remote_branches",query_params:t,path:V})}function Pc(t){return S({id:"remote_commits",query_params:t,path:V})}function Tc(t,e){return y({id:t,task_name:"drivers",form_data:e,method:"get",path:V})}function Oc(t,e){return y({id:t,task_name:"commits",form_data:e,method:"get",path:V})}function Ec(t){return y({id:t,task_name:"branches",method:"get",path:V})}function qc(t){return y({id:t,task_name:"default_branch",method:"get",path:V})}function Ic(t,e){return y({id:t,task_name:"details",form_data:e,method:"get",path:V})}function Mc(t,e){return y({id:t,task_name:"pull",form_data:e,method:"post",path:V})}function Rc(t,e){return y({id:t,task_name:"folders",form_data:e,method:"get",path:V})}class Pi extends H{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 pt="saml_auths";function un(t){return new Pi(t)}function Uc(t={}){return P({query_params:t,fn:un,path:pt})}function Dc(t){return S({id:t,query_params:{},fn:un,path:pt})}function Cc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:un,path:pt})}function Nc(t){return q({form_data:t,query_params:{},fn:un,path:pt})}function Fc(t){return E({id:t,query_params:{},path:pt})}const Ve="settings";function _t(t){return new ve(t)}function Lc(t={}){return P({query_params:t,fn:_t,path:Ve})}function jc(t){return S({id:t,query_params:{},fn:_t,path:Ve})}function Hc(t,e,n={},r="patch"){return I({id:t,form_data:e,query_params:n,method:r,fn:_t,path:Ve})}function zc(t,e={}){return q({form_data:t,query_params:e,fn:_t,path:Ve})}function Wc(t){return E({id:t,query_params:{},path:Ve})}function Bc(t,e={}){return y({id:t,task_name:"history",form_data:e,method:"get",callback:n=>n.map(r=>_t(r)),path:Ve})}const C="systems";function Ue(t){return new Vn(t)}function Qc(t={}){return P({query_params:t,fn:Ue,path:C})}function Vc(t){return P({query_params:t,fn:Ue,path:`${C}/with_emails`})}function Zc(t,e={}){return S({id:t,query_params:e,fn:Ue,path:C})}function Gc(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Ue,path:C})}function Kc(t){return q({form_data:t,query_params:{},fn:Ue,path:C})}function Yc(t){return E({id:t,query_params:{},path:C})}function Jc(t,e,n={}){return y({id:t,task_name:`module/${e}`,form_data:n,method:"put",callback:r=>Ue(r),path:C})}function Xc(t,e){return y({id:t,task_name:`module/${e}`,form_data:{},method:"del",callback:n=>Ue(n),path:C})}function xc(t,e={}){return y({id:t,task_name:"start",form_data:e,path:C})}function ea(t,e={}){return y({id:t,task_name:"stop",form_data:e,path:C})}function ta(t,e,n,r=1,i=[]){return y({id:t,task_name:`${n}_${r}/${encodeURIComponent(e)}`,form_data:i,path:C})}function na(t,e,n=1){return y({id:t,task_name:`${e}_${n}`,method:"get",path:C})}function ra(t,e,n=1,r){return y({id:t,task_name:`${e}_${n}/${r}`,method:"get",path:C})}function ia(t,e,n=1){return y({id:t,task_name:`functions/${e}_${n}`,method:"get",path:C})}function sa(t){return P({query_params:{},fn:e=>new nn(e),path:`${C}/${t}/zones`})}function oa(t,e={}){return P({query_params:e,fn:n=>new he(n),path:`${C}/${t}/triggers`})}function ua(t,e){return y({id:t,task_name:"triggers",form_data:e,method:"post",callback:n=>new he(n),path:C})}function ca(t,e){return y({id:t,task_name:`triggers/${e}`,method:"del",path:C})}function aa(t){return y({id:t,task_name:"settings",method:"get",callback:e=>e.map(n=>new ve(n)),path:C})}function la(t={}){const e=A(),n=e.startsWith("https")?"wss:":"ws:",r=e.startsWith("https")?"https:":"http:";let i=e.replace(r,n)+`${C}/control`;return t.fixed_device&&(i+=`?fixed_device=${encodeURIComponent(String(t.fixed_device))}`),i}function ha(t,e={}){return y({id:t,task_name:"metadata",form_data:e,method:"get",path:C})}function fa(t,e,n={}){return y({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:"get",callback:r=>new he(r),path:C})}function da(t,e,n,r="patch"){return y({id:t,task_name:`triggers/${encodeURIComponent(e)}`,form_data:n,method:r,callback:i=>new he(i),path:C})}const Ze="triggers";function cn(t){return new he(t)}function pa(t={}){return P({query_params:t,fn:cn,path:Ze})}function _a(t,e={}){return S({id:t,query_params:e,fn:cn,path:Ze})}function ma(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:cn,path:Ze})}function ya(t){return q({form_data:t,query_params:{},fn:cn,path:Ze})}function ga(t){return E({id:t,query_params:{},path:Ze})}function va(t){return y({id:t,task_name:"instances",form_data:{},method:"get",callback:e=>e.map(n=>new he(n)),path:Ze})}var Ti=(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))(Ti||{}),Oi=(t=>(t.AT="at",t.CRON="cron",t))(Oi||{}),Ei=(t=>(t[t.ExecuteBefore=0]="ExecuteBefore",t[t.ExecuteAfter=1]="ExecuteAfter",t[t.PayloadOnly=2]="PayloadOnly",t[t.IgnorePayload=3]="IgnorePayload",t))(Ei||{});class qi extends H{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 x="users";function Ge(t){return new qi(t)}function ba(t={}){return P({query_params:t,fn:Ge,path:x})}function Sa(t,e={}){return S({id:t,query_params:e,fn:Ge,path:x})}function ka(t={}){return S({id:"current",query_params:t,fn:Ge,path:x})}function $a(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:Ge,path:x})}function Aa(t){return q({form_data:t,query_params:{},fn:Ge,path:x})}function wa(t,e={}){return E({id:t,query_params:e,path:x})}function Pa(t){const e=U(t),n=`${A()}${x}/groups${e?"?"+e:""}`;return F(n).pipe(b(r=>r))}function Ta(t){const e=U(t),n=`${A()}${x}/metadata/search${e?"?"+e:""}`;return F(n).pipe(b(r=>r))}function Oa(){const t=`${A()}${x}/resource_token`;return K(t,{}).pipe(b(e=>e))}function Ea(t,e={}){return y({id:t,task_name:"metadata",form_data:e,method:"get",path:x})}function qa(t){const e=`${A()}${x}/${encodeURIComponent(t)}/resource_token`;return ge(e,{response_type:"void"})}function Ia(t){const e=`${A()}${x}/${encodeURIComponent(t)}/resource_token`;return K(e,{}).pipe(b(n=>n))}function Ma(t){return y({id:t,task_name:"revive",form_data:{},method:"post",callback:e=>Ge(e),path:x})}const fe="zones";function an(t){return new nn(t)}function Ra(t={}){return P({query_params:t,fn:an,path:fe})}function Ua(t={}){return S({id:"tags",query_params:t,fn:e=>e,path:fe})}function Da(t,e={}){return S({id:t,query_params:e,fn:an,path:fe})}function Ca(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:an,path:fe})}function Na(t){return q({form_data:t,query_params:{},fn:an,path:fe})}function Fa(t){return E({id:t,query_params:{},path:fe})}function La(t,e={}){return P({query_params:e,fn:n=>new he(n),path:`${fe}/${t}/triggers`})}function ja(t,e,n,r=1,i=[]){return y({id:t,task_name:`exec/${encodeURIComponent(n+"_"+r)}/${encodeURIComponent(e)}`,form_data:i,path:fe})}function Ha(t,e={}){return y({id:t,task_name:"metadata",form_data:e,method:"get",path:fe})}var Kn=(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))(Kn||{});class Ii{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;plugin_id;plugin_params;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||Lr(Date.now()),this.updated_at=e.updated_at||Lr(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.plugin_id=e.plugin_id||"",this.plugin_params=e.plugin_params||{},this.play_count=e.play_count||0,this.valid_from=e.valid_from,this.valid_until=e.valid_until}}class ln{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 Mi{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||Kn.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||""}}class Ri{id;created_at;updated_at;name;description;uri;playback_type;authority_id;enabled;params;defaults;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.uri=e.uri||"",this.playback_type=e.playback_type||"static",this.authority_id=e.authority_id||"",this.enabled=e.enabled??!0,this.params=e.params||{},this.defaults=e.defaults||{}}}const Ui="signage";function za(t,e={},n){return S({id:t,query_params:e,fn:r=>r,path:`${Ui}`,options:n})}function Wa(t){return y({id:t,task_name:"metrics",form_data:{},method:"post",callback:e=>e,path:Ui})}const Ke="signage/media";function hn(t){return new Ii(t)}function Ba(t={}){return P({query_params:t,fn:hn,path:Ke})}function Qa(t,e={}){return S({id:t,query_params:e,fn:hn,path:Ke})}function Va(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:hn,path:Ke})}function Za(t){return q({form_data:t,query_params:{},fn:hn,path:Ke})}function Ga(t,e={}){return E({id:t,query_params:e,path:Ke})}function Ka(t){return`${A()}/${Ke}/${t}/thumbnail`}const de="signage/playlists";function fn(t){return new Mi(t)}function Ya(t={}){return P({query_params:t,fn,path:de})}function Ja(t,e={}){return S({id:t,query_params:e,fn,path:de})}function Xa(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn,path:de})}function xa(t){return q({form_data:t,query_params:{},fn,path:de})}function el(t,e={}){return E({id:t,query_params:e,path:de})}function tl(t,e={}){return y({id:t,task_name:"media",form_data:e,method:"get",callback:n=>new ln(n),path:de})}function nl(t,e={}){return y({id:t,task_name:"media/revisions",form_data:e,method:"get",callback:n=>n.map(r=>new ln(r)),path:de})}function rl(t){return y({id:t,task_name:"media/approve",method:"post",path:de})}function il(t,e){return y({id:t,task_name:"media",form_data:e,method:"post",path:de,callback:n=>new ln(n)})}const mt="signage/plugins";function dn(t){return new Ri(t)}function sl(t={}){return P({query_params:t,fn:dn,path:mt})}function ol(t,e={}){return S({id:t,query_params:e,fn:dn,path:mt})}function ul(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:dn,path:mt})}function cl(t){return q({form_data:t,query_params:{},fn:dn,path:mt})}function al(t,e={}){return E({id:t,query_params:e,path:mt})}class Yn{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 ll(t={}){const e=U(t);return F(`${Di}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new Yn(r))))}function hl(t){return K(`${Di}`,t).pipe(b(e=>e.map(n=>new Yn(n))))}class yt{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 gt="/api/staff/v1/surveys/invitations";function fl(t={}){const e=U(t);return F(`${gt}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new yt(r))))}function dl(t,e={}){const n=U(e);return F(`${gt}/${t}${n?"?"+n:""}`).pipe(b(r=>new yt(r)))}function pl(t,e,n="patch"){return(n==="put"?qe:ze)(`${gt}/${t}`,e).pipe(b(r=>new yt(r)))}function _l(t){return K(`${gt}`,t).pipe(b(e=>new yt(e)))}function ml(t,e={}){const n=U(e);return ge(`${gt}/${t}${n?"?"+n:""}`)}class vt{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 bt="/api/staff/v1/surveys/questions";function yl(t={}){const e=U(t);return F(`${bt}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new vt(r))))}function gl(t,e={}){const n=U(e);return F(`${bt}/${t}${n?"?"+n:""}`).pipe(b(r=>new vt(r)))}function vl(t){return K(`${bt}`,t).pipe(b(e=>new vt(e)))}function bl(t,e,n="patch"){return(n==="put"?qe:ze)(`${bt}/${t}`,e).pipe(b(r=>new vt(r)))}function Sl(t,e={}){const n=U(e);return ge(`${bt}/${t}${n?"?"+n:""}`)}class St{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 kt="/api/staff/v1/surveys";function kl(t={}){const e=U(t);return F(`${kt}${e?"?"+e:""}`).pipe(b(n=>n.map(r=>new St(r))))}function $l(t,e={}){const n=U(e);return F(`${kt}/${t}${n?"?"+n:""}`).pipe(b(r=>new St(r)))}function Al(t,e,n="patch"){return(n==="put"?qe:ze)(`${kt}/${t}`,e).pipe(b(r=>new St(r)))}function wl(t){return K(`${kt}`,t).pipe(b(e=>new St(e)))}function Pl(t,e={}){const n=U(e);return ge(`${kt}/${t}${n?"?"+n:""}`)}class Ci{id;parent_category_id;name;description;hidden;created_at;updated_at;constructor(e){this.id=e.id||"",this.parent_category_id=e.parent_category_id||"",this.name=e.name||"",this.description=e.description||"",this.hidden=e.hidden||!1,this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Ni{id;purchase_order_number;invoice_number;supplier_details;purchase_date;unit_price;expected_service_start_date;expected_service_end_date;created_at;updated_at;constructor(e){this.id=e.id||"",this.purchase_order_number=e.purchase_order_number||"",this.invoice_number=e.invoice_number||"",this.supplier_details=e.supplier_details||{},this.purchase_date=e.purchase_date||0,this.unit_price=e.unit_price||0,this.expected_service_start_date=e.expected_service_start_date||0,this.expected_service_end_date=e.expected_service_end_date||0,this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Fi{id;category_id;name;brand;description;model_number;images;created_at;updated_at;constructor(e){this.id=e.id||"",this.category_id=e.category_id||"",this.name=e.name||"",this.brand=e.brand||"",this.description=e.description||"",this.model_number=e.model_number||"",this.images=e.images||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}class Li{id;parent_id;asset_type_id;purchase_order_id;zone_id;identifier;serial_number;other_data;barcode;name;client_ids;map_id;bookable;accessible;zones;place_groups;assigned_to;assigned_name;features;images;notes;security_system_groups;created_at;updated_at;constructor(e){this.id=e.id||"",this.parent_id=e.parent_id||"",this.asset_type_id=e.asset_type_id||"",this.purchase_order_id=e.purchase_order_id||"",this.zone_id=e.zone_id||"",this.identifier=e.identifier||"",this.serial_number=e.serial_number||"",this.other_data=e.other_data||{},this.barcode=e.barcode||"",this.name=e.name||"",this.client_ids=e.client_ids||{},this.map_id=e.map_id||"",this.bookable=e.bookable||!1,this.accessible=e.accessible||!1,this.zones=e.zones||[],this.place_groups=e.place_groups||[],this.assigned_to=e.assigned_to||"",this.assigned_name=e.assigned_name||"",this.features=e.features||[],this.images=e.images||[],this.notes=e.notes||"",this.security_system_groups=e.security_system_groups||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const be="assets";function De(t){return new Li(t)}function Tl(t={}){return P({query_params:t,fn:De,path:be})}function Ol(t,e={}){return S({id:t,query_params:e,fn:De,path:be})}function El(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:De,path:be})}function ql(t){return q({form_data:t,query_params:{},fn:De,path:be})}function Il(t,e={}){return E({id:t,query_params:e,path:be})}function Ml(t){return K(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(b(e=>e.map(n=>De(n))))}function Rl(t,e="patch"){return(e==="put"?qe:ze)(`${A()}${be}/bulk`,JSON.stringify(t),{}).pipe(b(r=>r.map(i=>De(i))))}function Ul(t,e={}){const n=U(e);return ge(`${A()}${be}/bulk${n?"?"+n:""}`,{body:JSON.stringify(t)}).pipe(b(r=>r.map(i=>De(i))))}const $t="asset_types";function pn(t){return new Fi(t)}function Dl(t={}){return P({query_params:t,fn:pn,path:$t})}function Cl(t,e={}){return S({id:t,query_params:e,fn:pn,path:$t})}function Nl(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:pn,path:$t})}function Fl(t){return q({form_data:t,query_params:{},fn:pn,path:$t})}function Ll(t,e={}){return E({id:t,query_params:e,path:$t})}const At="asset_categories";function _n(t){return new Ci(t)}function jl(t={}){return P({query_params:t,fn:_n,path:At})}function Hl(t,e={}){return S({id:t,query_params:e,fn:_n,path:At})}function zl(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:_n,path:At})}function Wl(t){return q({form_data:t,query_params:{},fn:_n,path:At})}function Bl(t,e={}){return E({id:t,query_params:e,path:At})}const wt="asset_purchase_orders";function mn(t){return new Ni(t)}function Ql(t={}){return P({query_params:t,fn:mn,path:wt})}function Vl(t,e={}){return S({id:t,query_params:e,fn:mn,path:wt})}function Zl(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:mn,path:wt})}function Gl(t){return q({form_data:t,query_params:{},fn:mn,path:wt})}function Kl(t,e={}){return E({id:t,query_params:e,path:wt})}class ji{id;name;uri;description;user_id;user_email;user_name;redirect_count;enabled;valid_from;valid_until;authority_id;created_at;updated_at;constructor(e){this.id=e.id||"",this.name=e.name||"",this.uri=e.uri||"",this.description=e.description||"",this.user_id=e.user_id||"",this.user_email=e.user_email||"",this.user_name=e.user_name||"",this.redirect_count=e.redirect_count||0,this.enabled=e.enabled??!0,this.valid_from=e.valid_from||"",this.valid_until=e.valid_until||"",this.authority_id=e.authority_id||"",this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const ie="short_url";function yn(t){return new ji(t)}function Yl(t={}){return P({query_params:t,fn:yn,path:ie})}function Jl(t,e={}){return S({id:t,query_params:e,fn:yn,path:ie})}function Xl(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:yn,path:ie})}function xl(t){return q({form_data:t,query_params:{},fn:yn,path:ie})}function eh(t,e={}){return E({id:t,query_params:e,path:ie})}function th(t){return`${A()}${ie}/${encodeURIComponent(t)}/redirect`}function nh(t){return F(`${A()}${ie}/${encodeURIComponent(t)}/qr_code.svg`,{response_type:"text"})}function rh(t,e={}){const n=U(e);return`${A()}${ie}/${encodeURIComponent(t)}/qr_code.png${n?"?"+n:""}`}function ih(t){const{format:e="svg",...n}=t,r={...n,format:e},i=U(r);return`${A()}${ie}/qr_code${i?"?"+i:""}`}function sh(t){const e={...t,format:"svg"},n=U(e);return F(`${A()}${ie}/qr_code${n?"?"+n:""}`,{response_type:"text"})}class Hi{id;storage_type;bucket_name;region;access_key;access_secret;authority_id;endpoint;is_default;ext_filter;mime_filter;created_at;updated_at;constructor(e){this.id=e.id||"",this.storage_type=e.storage_type||null,this.bucket_name=e.bucket_name||"",this.region=e.region||"",this.access_key=e.access_key||"",this.access_secret=e.access_secret||"",this.authority_id=e.authority_id||"",this.endpoint=e.endpoint||"",this.is_default=e.is_default??!1,this.ext_filter=e.ext_filter||[],this.mime_filter=e.mime_filter||[],this.created_at=e.created_at||0,this.updated_at=e.updated_at||0}}const Pt="storages";function gn(t){return new Hi(t)}function oh(t={}){return P({query_params:t,fn:gn,path:Pt})}function uh(t,e={}){return S({id:t,query_params:e,fn:gn,path:Pt})}function ch(t,e,n="patch"){return I({id:t,form_data:e,query_params:{},method:n,fn:gn,path:Pt})}function ah(t){return q({form_data:t,query_params:{},fn:gn,path:Pt})}function lh(t,e={}){return E({id:t,query_params:e,path:Pt})}const Se="webrtc";function hh(t={}){const e=U(t),n=`${A()}${Se}/rooms${e?"?"+e:""}`;return F(n).pipe(b(r=>r))}function fh(t){const e=`${A()}${Se}/room/${encodeURIComponent(t)}`;return F(e).pipe(b(n=>n))}function dh(t){const e=`${A()}${Se}/members/${encodeURIComponent(t)}`;return F(e).pipe(b(n=>n))}function ph(t,e){const n=`${A()}${Se}/guest_entry/${encodeURIComponent(t)}`;return K(n,e).pipe(b(()=>{}))}function _h(){const t=`${A()}${Se}/guest/exit`;return K(t,{}).pipe(b(()=>{}))}function mh(t,e,n){const r=`${A()}${Se}/kick/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return K(r,n).pipe(b(()=>{}))}function yh(t,e,n){const r=`${A()}${Se}/transfer/${encodeURIComponent(t)}/${encodeURIComponent(e)}`;return K(r,n||{}).pipe(b(()=>{}))}function gh(){const t=A(),e=t.startsWith("https")?"wss:":"ws:",n=t.startsWith("https")?"https:":"http:";return t.replace(n,e)+`${Se}/signaller`}var vh={url:"",deserializer:function(t){return JSON.parse(t.data)},serializer:function(t){return JSON.stringify(t)}},bh="WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }",Sh=function(t){ne(e,t);function e(n,r){var i=t.call(this)||this;if(i._socket=null,n instanceof L)i.destination=r,i.source=n;else{var s=i._config=Xe({},vh);if(i._output=new we,typeof n=="string")s.url=n;else for(var u in n)n.hasOwnProperty(u)&&(s[u]=n[u]);if(!s.WebSocketCtor&&WebSocket)s.WebSocketCtor=WebSocket;else if(!s.WebSocketCtor)throw new Error("no WebSocket constructor can be found");i.destination=new Mn}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 Mn),this._output=new we},e.prototype.multiplex=function(n,r,i){var s=this;return new L(function(u){try{s.next(n())}catch(a){u.error(a)}var c=s.subscribe({next:function(a){try{i(a)&&u.next(a)}catch(h){u.error(h)}},error:function(a){return u.error(a)},complete:function(){return u.complete()}});return function(){try{s.next(r())}catch(a){u.error(a)}c.unsubscribe()}})},e.prototype._connectSocket=function(){var n=this,r=this._config,i=r.WebSocketCtor,s=r.protocol,u=r.url,c=r.binaryType,a=this._output,h=null;try{h=s?new i(u,s):new i(u),this._socket=h,c&&(this._socket.binaryType=c)}catch(g){a.error(g);return}var m=new Ae(function(){n._socket=null,h&&h.readyState===1&&h.close()});h.onopen=function(g){var _=n._socket;if(!_){h.close(),n._resetState();return}var l=n._config.openObserver;l&&l.next(g);var d=n.destination;n.destination=Dt.create(function(f){if(h.readyState===1)try{var w=n._config.serializer;h.send(w(f))}catch($){n.destination.error($)}},function(f){var w=n._config.closingObserver;w&&w.next(void 0),f&&f.code?h.close(f.code,f.reason):a.error(new TypeError(bh)),n._resetState()},function(){var f=n._config.closingObserver;f&&f.next(void 0),h.close(),n._resetState()}),d&&d instanceof Mn&&m.add(d.subscribe(n.destination))},h.onerror=function(g){n._resetState(),a.error(g)},h.onclose=function(g){h===n._socket&&n._resetState();var _=n._config.closeObserver;_&&_.next(g),g.wasClean?a.complete():a.error(g)},h.onmessage=function(g){try{var _=n._config.deserializer;a.next(_(g))}catch(l){a.error(l)}}},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 s=r._socket;r._output.observers.length===0&&(s&&(s.readyState===1||s.readyState===0)&&s.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}(qn);function kh(t){return new Sh(t)}var re=(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))(re||{}),Jn=(t=>(t.Info="info",t.Debug="debug",t.Warning="warn",t.Error="error",t.Fatal="fatal",t.Trace="trace",t))(Jn||{});class zi{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 L)&&!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 pe(n),this[`_${e}_obs`]=this[`_${e}`].asObservable(),Object.defineProperty(this,e,{get:()=>this[`_${e}`].getValue(),set:r=>this[`_${e}`].next(r)})}}class Wi{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 zi(this,n))}}const vn={};function $h(t,e){return vn[t]=new Wi(e),vn[t]}function Bi(t){return vn[t]}function Ah(t){delete vn[t]}const Qi=15;let Tt=0,te,Vi=0;const Z={},Xn={},Ce={},wh={},Ne=new pe(!1);Ce._place_os_status=Ne.asObservable();const Zi=new pe([0,0]);Ce._place_os_sync=Zi.asObservable();let Gi=Date.now(),Ye,bn=0,ke=null,Sn,xn=0;const Ot=10*1e3,er=new we;Ce._place_os_debug_events=er.asObservable();function kn(){return A().indexOf("/control/")>=0?"/control/websocket":`${Fn()}/systems/control`}function tr(){return Ne.getValue()}function Ki(){return Ce._place_os_status}function Ph(){return Ce._place_os_sync}function Yi(t,e=Xn,n=Ce){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`;return e[r]||(e[r]=new pe(void 0),n[r]=e[r].asObservable()),n[r]}function Ji(t,e=Xn){const n=`${t.sys}|${t.mod}_${t.index}|${t.name}`;if(e[n])return e[n].getValue()}function nr(t,e=0,n=Je){const r={id:++Tt,cmd:"bind",...t};return n(r,e)}function Xi(t,e=0,n=Je){const r={id:++Tt,cmd:"unbind",...t};return n(r,e)}function xi(t,e=Ot,n=Je){const r={id:++Tt,cmd:"exec",...t};return n(r,e)}function Th(t,e=Ot,n=Je){const r={id:++Tt,cmd:"debug",...t};return n(r,e)}function Oh(t,e=Ot,n=Je){const r={id:++Tt,cmd:"ignore",...t};return n(r,e)}function Je(t,e=Ot,n=0){const r=`${t.cmd}|${t.sys}|${t.mod}${t.index}|${t.name}|${t.args}|${Vr()}`;if(Z[r])p("WS","Request already in progress. Waiting...",t);else{const i={...t,key:r};i.promise=new Promise((s,u)=>{const c=()=>{delete Z[r],Z[r]=null,Je(t,e,n).then(a=>s(a),a=>u(a))};if(te&&tr()){Bt()&&Dh(t,te,wh),i.resolve=s,i.reject=u;const a=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[${t.cmd.toUpperCase()}](${t.id}) ${a}`,t.args),te.next(t),e>0&&ae(`${r}`,()=>{u("Request timed out."),delete Z[r],Z[r]=null},e)}else ke?setTimeout(()=>c(),1e3):rr().then(()=>c())}),Z[r]=i}return Z[r].promise}function es(t){if(t!=="pong"&&t instanceof Object){if(t.type==="notify"&&t.meta)Ih(t.meta,t.value);else if(t.type==="success")Eh(t);else if(t.type==="debug"){p("WS",`[DEBUG] ${t.mod}${t.klass||""} →`,t.msg);const e=t.meta||{mod:"",index:""};er.next({mod_id:t.mod||"<empty>",module:`${e.mod}_${e.index}`,class_name:t.klass||"<empty>",message:t.msg||"<empty>",level:t.level||Jn.Debug,time:Math.floor(new Date().getTime()/1e3)})}else t.type==="error"?qh(t):t.cmd||p("WS","Invalid websocket message",t,"error");Oe(`${t.id}`)}else t==="pong"&&(xn=Date.now(),p("WS","Pong!"))}function Eh(t){const e=Object.keys(Z).map(n=>Z[n]).find(n=>n?.id===t.id);p("WS",`[SUCCESS](${t.id})`),e&&e.resolve&&(e.resolve(t.value),delete Z[e.key])}function qh(t){let e="UNEXPECTED FAILURE";switch(t.code){case re.ACCESS_DENIED:e="ACCESS DENIED";break;case re.BAD_REQUEST:e="BAD REQUEST";break;case re.MOD_NOT_FOUND:e="MODULE NOT FOUND";break;case re.SYS_NOT_FOUND:e="SYSTEM NOT FOUND";break;case re.PARSE_ERROR:e="PARSE ERROR";break;case re.REQUEST_FAILED:e="REQUEST FAILED";break;case re.UNKNOWN_CMD:e="UNKNOWN COMMAND";break}p("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),Oe(`${n.key}`),delete Z[n.key])}function Ih(t,e,n=Xn,r=Ce){const i=`${t.sys}|${t.mod}_${t.index}|${t.name}`;n[i]||(n[i]=new pe(null),r[i]=n[i].asObservable());const s=`${t.sys}, ${t.mod}_${t.index}, ${t.name}`;p("WS",`[NOTIFY] ${s} changed`,[n[i].getValue(),"→",e]),n[i].next(e)}function rr(t=0){return ke==null&&(ke=new Promise(e=>{if(t>40)return location.reload();bn++,Gi=Date.now(),te=Bt()?Uh():Mh(),te?(p("WS(Debug)","Authority:",[rt()]),p("WS","Connecting to websocket..."),te.subscribe(n=>{Ne.getValue()||(p("WS","Connection established."),e()),Ne.next(!0),bn=0,ir(),es(n)},n=>{te=void 0,ke=null,ns(),ir(),Rh(n)},()=>{te=void 0,ke=null,ns(),p("WS","Connection closed by browser."),Ne.next(!1),$n()}),Ye&&clearInterval(Ye),xn=Date.now(),ts(),Ye=setInterval(()=>ts(),Qi*1e3),ir(),Vi+=1,Sn=setTimeout(()=>{p("WS","Unhealthy connection. Reconnecting..."),Ne.next(!1),ke=null,$n()},30*1e3)):(te?p("WS",`Waiting on auth(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,[!!J(),!!rt()],"info"):p("WS",`Failed to create websocket(${t}). Retrying in ${1e3*Math.min(10,t+1)}ms...`,void 0,"error"),setTimeout(()=>{ke=null,rr(t).then(n=>e(n))},1e3*Math.min(10,++t)))})),ke}function Mh(){if(!rt()||!J())return null;const t=Xr()||location.protocol.indexOf("https")>=0;let e=`ws${t?"s":""}://${Wt()}${kn()}${Ln()?"?fixed_device=true":""}`;const n=J();let r=n==="x-api-key"?`api-key=${nt()}`:`bearer_token=${n}`;return!yo()&&!Br()?(p("WS","Authenticating through cookie..."),r+=`;max-age=120;path=${kn()};`,r+=`${t?"secure;":""}samesite=strict`,document.cookie=r,p("WS","Cookies:",[document.cookie,r])):(p("WS","Authenticating through URL query parameter..."),e+=`${e.indexOf("?")>=0?"&":"?"}${r}`),p("WS",`Creating websocket connection to ws${t?"s":""}://${Wt()}${kn()}`),kh({url:e,serializer:i=>typeof i=="object"?JSON.stringify(i):i,deserializer:i=>{let s=i.data;if(s==="pong")return s;try{return JSON.parse(i.data)}catch{return s}}})}function $n(){Zi.next([Vi,Date.now()-Gi]),te&&tr()&&(te.complete(),Ye&&(clearInterval(Ye),Ye=void 0)),p("WS",`Reconnecting in ${Math.min(5e3,bn*300||1e3)}ms...`),ae("reconnect",()=>rr(),Math.min(5e3,(bn+1)*300||1e3))}function ts(){if(Date.now()-xn>4*Qi*1e3)return $n();te?.next("ping")}function Rh(t){Ne.next(!1),p("WS","Websocket error:",t,void 0,"error"),t.status===401&&Zt(),jn(),$n()}function ir(){Sn&&(clearTimeout(Sn),Sn=void 0)}function Uh(){const t=new we;return t.subscribe(e=>es(e)),t}function Dh(t,e,n){const r=`${t.sys}|${t.mod}_${t.index}|${t.name}`,i=Bi(t.sys),s=i&&i[t.mod]?i[t.mod][t.index-1||0]:null;if(s){switch(t.cmd){case"bind":n[r]=s.listen(t.name).subscribe(u=>{setTimeout(()=>{e.next({type:"notify",value:u,meta:t})},Math.floor(Math.random()*100+50))});break;case"unbind":n[r]&&(n[r].unsubscribe(),delete n[r],Oe(`${r}`));break}ae(`${t.id}-response`,()=>{const u={id:t.id,type:"success",value:t.cmd==="exec"?s.call(t.name,t.args):null};e.next(u)},10)}else ae(`${t.id}-error`,()=>e.next({id:t.id,type:"error",code:i?re.SYS_NOT_FOUND:re.MOD_NOT_FOUND}),10)}function ns(){for(const t in Z)Z[t]&&delete Z[t]}class sr{constructor(e,n){this._module=e,this.name=n,Ki().pipe(Ks()).subscribe(r=>{r&&(this._stale_bindings||this._pending===1)?(p("VAR","Re-binding to status variable",this.binding()),this.rebind()):r||(Oe(`rebind:${JSON.stringify(this.binding())}`),p("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 Ji(this.binding())}listen(){return Yi(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,nr(this.binding()).then(()=>{this._binding_count++,this._pending=0}).catch(()=>null)),()=>this.unbind()}unbind(){this._binding_count===1&&this._pending===0?(this._pending=2,Xi(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||ae(`rebind:${JSON.stringify(this.binding())}`,async()=>{await nr(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 rs{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 sr(this,e)),this._bindings[e]}variable(e){return this._bindings[e]||(this._bindings[e]=new sr(this,e)),this._bindings[e]}execute(e,n,r=Ot){return xi({sys:this._system.id,mod:this.name,index:this.index,name:e,args:n},r)}}class is{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 rs(this,`${i}_${this._module_list[i].length+1}`));return this._module_list[i][n-1]}}const or={};function ss(t){return or[t]||(or[t]=new is(t)),or[t]}function Ch(t,e,n=1){return ss(t).module(e,n)}o.AuthType=_i,o.EncryptionLevel=Ie,o.MediaAnimation=Kn,o.MockPlaceWebsocketModule=zi,o.MockPlaceWebsocketSystem=Wi,o.PlaceAlert=ai,o.PlaceAlertDashboard=li,o.PlaceApplication=hi,o.PlaceAsset=Li,o.PlaceAssetCategory=Ci,o.PlaceAssetPurchaseOrder=Ni,o.PlaceAssetType=Fi,o.PlaceCluster=yi,o.PlaceDomain=bi,o.PlaceDriver=Bn,o.PlaceDriverRole=lt,o.PlaceEdge=Si,o.PlaceErrorCodes=re,o.PlaceLDAPSource=ki,o.PlaceLogLevel=Jn,o.PlaceMQTTBroker=mi,o.PlaceMetadata=Qn,o.PlaceModule=Zn,o.PlaceModuleBinding=rs,o.PlaceOAuthSource=Ai,o.PlaceProcess=gi,o.PlaceRepository=wi,o.PlaceRepositoryType=Gn,o.PlaceResource=H,o.PlaceSAMLSource=Pi,o.PlaceSettings=ve,o.PlaceShortUrl=ji,o.PlaceStorage=Hi,o.PlaceSystem=Vn,o.PlaceSystemBinding=is,o.PlaceTrigger=he,o.PlaceUser=qi,o.PlaceVariableBinding=sr,o.PlaceZone=nn,o.PlaceZoneMetadata=$i,o.SignageMedia=Ii,o.SignagePlaylist=Mi,o.SignagePlaylistMedia=ln,o.SignagePlugin=Ri,o.Survey=St,o.SurveyAnswer=Yn,o.SurveyInvitation=yt,o.SurveyQuestion=vt,o.TriggerConditionOperator=Ti,o.TriggerTimeConditionType=Oi,o.TriggerWebhookType=Ei,o.addAlert=Xo,o.addAlertDashboard=Vo,o.addAnswer=hl,o.addApplication=ou,o.addAsset=ql,o.addAssetCategory=Wl,o.addAssetPurchaseOrder=Gl,o.addAssetType=Fl,o.addAssets=Ml,o.addBroker=hu,o.addDomain=ku,o.addDriver=Ou,o.addEdge=Nu,o.addInvitation=_l,o.addLDAPSource=Bu,o.addMetadata=Ju,o.addModule=rc,o.addOAuthSource=mc,o.addQuestion=vl,o.addRepository=Sc,o.addSAMLSource=Nc,o.addSettings=zc,o.addShortUrl=xl,o.addSignageMedia=Za,o.addSignagePlaylist=xa,o.addSignagePlugin=cl,o.addStorage=ah,o.addSurvey=wl,o.addSystem=Kc,o.addSystemModule=Jc,o.addSystemTrigger=ua,o.addTrigger=ya,o.addUser=Aa,o.addZone=Na,o.apiEndpoint=A,o.apiKey=nt,o.approveSignagePlaylist=rl,o.authorise=Hn,o.authority=rt,o.bind=nr,o.cleanObject=Wr,o.cleanupAuth=Ao,o.clientId=Gr,o.clusterRebalance=yu,o.clusterVersions=gu,o.connectionState=Ph,o.consoleHasColours=Dn,o.convertPairStringToMap=je,o.create=q,o.currentUser=ka,o.currentUserResourceToken=Oa,o.debug=Th,o.debug_events=er,o.del=ge,o.deregisterMockEndpoint=si,o.deregisterSystem=Ah,o.driverReadme=Ru,o.edgeControlUrl=ju,o.execute=xi,o.executeOnModule=fc,o.executeOnSystem=ta,o.executeOnZone=ja,o.functionList=ia,o.generateNonce=Hr,o.generateQrCode=sh,o.get=F,o.getFragments=Cn,o.getModule=Ch,o.getShortUrlQrCodeSvg=nh,o.getSystem=ss,o.hasToken=Yr,o.host=Wt,o.httpRoute=Fn,o.humanReadableByteCount=et,o.ignore=Oh,o.invalidateToken=Zt,o.isDriverCompiled=Mu,o.isFixedDevice=Ln,o.isMobileSafari=Br,o.isMock=Bt,o.isNestedFrame=Qr,o.isOnline=bo,o.isSecure=Xr,o.isTrusted=Qt,o.is_connected=tr,o.lastRequestTotal=tu,o.listChildMetadata=xu,o.listDashboardAlerts=Go,o.listInterfaceRepositories=$c,o.listMetadata=Vu,o.listMetadataHistory=Gu,o.listRemoteRepositoryBranches=wc,o.listRemoteRepositoryCommits=Pc,o.listRemoteRepositoryDefaultBranch=Ac,o.listRepositoryBranches=Ec,o.listRepositoryCommits=Oc,o.listRepositoryDefaultBranch=qc,o.listRepositoryDriverDetails=Ic,o.listRepositoryDrivers=Tc,o.listRepositoryFolders=Rc,o.listSignagePlaylistMedia=tl,o.listSignagePlaylistMediaRevisions=nl,o.listSystemTriggers=oa,o.listSystemZones=sa,o.listTriggerInstances=va,o.listZoneTags=Ua,o.listZoneTriggers=La,o.listen=Yi,o.listenForToken=Jr,o.loadModule=ac,o.log=p,o.logout=wo,o.lookupDomainByEmail=Au,o.lookupModuleState=cc,o.lookupSystemModuleState=ra,o.mediaThumbnail=Ka,o.mockSystem=Bi,o.moduleRuntimeError=hc,o.moduleSettings=lc,o.moduleState=uc,o.onlineState=So,o.parseLinkHeader=zr,o.patch=ze,o.post=K,o.pullRepositoryChanges=Mc,o.put=qe,o.qrCodeUrl=ih,o.query=P,o.queryAlertDashboards=Wo,o.queryAlerts=Ko,o.queryAnswers=ll,o.queryApplications=ru,o.queryAssetCategories=jl,o.queryAssetPurchaseOrders=Ql,o.queryAssetTypes=Dl,o.queryAssets=Tl,o.queryBrokers=cu,o.queryClusters=du,o.queryDomains=vu,o.queryDrivers=wu,o.queryEdges=Uu,o.queryInvitations=fl,o.queryLDAPSources=Hu,o.queryModules=ec,o.queryOAuthSources=dc,o.queryProcesses=_u,o.queryQuestions=yl,o.queryRepositories=gc,o.querySAMLSources=Uc,o.querySettings=Lc,o.queryShortUrls=Yl,o.querySignageMedia=Ba,o.querySignagePlaylists=Ya,o.querySignagePlugins=sl,o.queryStorages=oh,o.querySurveys=kl,o.querySystems=Qc,o.querySystemsWithEmails=Vc,o.queryTriggers=pa,o.queryUserGroups=Pa,o.queryUsers=ba,o.queryWebrtcRooms=hh,o.queryZones=Ra,o.recompileDriver=qu,o.redirectUri=go,o.refreshAuthority=jn,o.refreshToken=zt,o.registerMockEndpoint=No,o.registerSystem=$h,o.reloadDriver=Iu,o.remove=E,o.removeAlert=xo,o.removeAlertDashboard=Zo,o.removeApplication=uu,o.removeAsset=Il,o.removeAssetCategory=Bl,o.removeAssetPurchaseOrder=Kl,o.removeAssetType=Ll,o.removeAssets=Ul,o.removeBroker=fu,o.removeDomain=$u,o.removeDriver=Eu,o.removeEdge=Fu,o.removeFragment=_e,o.removeInvitation=ml,o.removeLDAPSource=Qu,o.removeMetadata=Xu,o.removeModule=ic,o.removeOAuthSource=yc,o.removeQuestion=Sl,o.removeRepository=kc,o.removeSAMLSource=Fc,o.removeSettings=Wc,o.removeShortUrl=eh,o.removeSignageMedia=Ga,o.removeSignagePlaylist=el,o.removeSignagePlugin=al,o.removeStorage=lh,o.removeSurvey=Pl,o.removeSystem=Yc,o.removeSystemModule=Xc,o.removeSystemTrigger=ca,o.removeTrigger=ga,o.removeUser=wa,o.removeUserResourceToken=qa,o.removeZone=Fa,o.requestTotal=eu,o.responseHeaders=ui,o.retrieveEdgeToken=Lu,o.reviveUser=Ma,o.searchUserMetadata=Ta,o.setAPI_Key=vo,o.setMockNotFoundHandler=Co,o.setStorage=$o,o.setToken=Kr,o.settingsHistory=Bc,o.setup=ko,o.shortUrlQrCodePngUrl=rh,o.shortUrlRedirectUrl=th,o.show=S,o.showAlert=Yo,o.showAlertDashboard=Bo,o.showApplication=iu,o.showAsset=Ol,o.showAssetCategory=Hl,o.showAssetPurchaseOrder=Vl,o.showAssetType=Cl,o.showBroker=au,o.showCluster=pu,o.showDomain=bu,o.showDriver=Pu,o.showEdge=Du,o.showInvitation=dl,o.showLDAPSource=zu,o.showMetadata=Ku,o.showModule=tc,o.showOAuthSource=pc,o.showQuestion=gl,o.showRepository=vc,o.showSAMLSource=Dc,o.showSettings=jc,o.showShortUrl=Jl,o.showSignage=za,o.showSignageMedia=Qa,o.showSignageMetrics=Wa,o.showSignagePlaylist=Ja,o.showSignagePlugin=ol,o.showStorage=uh,o.showSurvey=$l,o.showSystem=Zc,o.showSystemTrigger=fa,o.showTrigger=_a,o.showUser=Sa,o.showWebrtcRoom=fh,o.showZone=Da,o.simplifiedTime=Vr,o.startModule=sc,o.startSystem=xc,o.status=Ki,o.stopModule=oc,o.stopSystem=ea,o.systemControlUrl=la,o.systemMetadata=ha,o.systemModuleState=na,o.systemSettings=aa,o.terminateProcess=mu,o.token=J,o.unbind=Xi,o.update=I,o.updateAlert=Jo,o.updateAlertDashboard=Qo,o.updateApplication=su,o.updateAsset=El,o.updateAssetCategory=zl,o.updateAssetPurchaseOrder=Zl,o.updateAssetType=Nl,o.updateAssets=Rl,o.updateBroker=lu,o.updateDomain=Su,o.updateDriver=Tu,o.updateEdge=Cu,o.updateInvitation=pl,o.updateLDAPSource=Wu,o.updateMetadata=Yu,o.updateModule=nc,o.updateOAuthSource=_c,o.updateQuestion=bl,o.updateRepository=bc,o.updateSAMLSource=Cc,o.updateSettings=Hc,o.updateShortUrl=Xl,o.updateSignageMedia=Va,o.updateSignagePlaylist=Xa,o.updateSignagePlaylistMedia=il,o.updateSignagePlugin=ul,o.updateStorage=ch,o.updateSurvey=Al,o.updateSystem=Gc,o.updateSystemTrigger=da,o.updateTrigger=ma,o.updateUser=$a,o.updateZone=Ca,o.userMetadata=Ea,o.userResourceToken=Ia,o.value=Ji,o.webrtcGuestEntry=ph,o.webrtcGuestExit=_h,o.webrtcKickUser=mh,o.webrtcSessionMembers=dh,o.webrtcSignallerUrl=gh,o.webrtcTransferUser=yh,o.websocketRoute=kn,o.zoneMetadata=Ha,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
4
4
  //# sourceMappingURL=index.umd.js.map