epicenter-libs 3.34.0 → 3.34.2
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/CHANGELOG.md +23 -0
- package/dist/browser/epicenter.js +11 -6
- package/dist/browser/epicenter.js.map +1 -1
- package/dist/cjs/epicenter.js +11 -6
- package/dist/cjs/epicenter.js.map +1 -1
- package/dist/cjs/package.json +1 -0
- package/dist/epicenter.js +11 -6
- package/dist/epicenter.js.map +1 -1
- package/dist/epicenter.min.js +1 -1
- package/dist/epicenter.min.js.map +1 -1
- package/dist/module/epicenter.js +11 -6
- package/dist/module/epicenter.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/config.ts +5 -4
- package/src/utils/identification.ts +4 -0
package/dist/epicenter.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).epicenter={})}(this,function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var s,i={exports:{}};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function r(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var s=n.call(t,e);if("object"!=o(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}function a(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}s||(s=1,function(t){var e=function(t){var e,n=Object.prototype,s=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function h(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,n){return t[e]=n}}function u(t,e,n,s){var o=e&&e.prototype instanceof g?e:g,r=Object.create(o.prototype),a=new R(s||[]);return i(r,"_invoke",{value:_(t,n,a)}),r}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",f="executing",y="completed",m={};function g(){}function w(){}function b(){}var v={};h(v,r,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S(P([])));T&&T!==n&&s.call(T,r)&&(v=T);var E=b.prototype=g.prototype=Object.create(v);function x(t){["next","throw","return"].forEach(function(e){h(t,e,function(t){return this._invoke(e,t)})})}function k(t,e){function n(i,o,r,a){var c=l(t[i],t,o);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==typeof u&&s.call(u,"__await")?e.resolve(u.__await).then(function(t){n("next",t,r,a)},function(t){n("throw",t,r,a)}):e.resolve(u).then(function(t){h.value=t,r(h)},function(t){return n("throw",t,r,a)})}a(c.arg)}var o;i(this,"_invoke",{value:function(t,s){function i(){return new e(function(e,i){n(t,s,e,i)})}return o=o?o.then(i,i):i()}})}function _(t,n,s){var i=d;return function(o,r){if(i===f)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw r;return{value:e,done:!0}}for(s.method=o,s.arg=r;;){var a=s.delegate;if(a){var c=A(a,s);if(c){if(c===m)continue;return c}}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if(i===d)throw i=y,s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);i=f;var h=l(t,n,s);if("normal"===h.type){if(i=s.done?y:p,h.arg===m)continue;return{value:h.arg,done:s.done}}"throw"===h.type&&(i=y,s.method="throw",s.arg=h.arg)}}}function A(t,n){var s=n.method,i=t.iterator[s];if(i===e)return n.delegate=null,"throw"===s&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==s&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+s+"' method")),m;var o=l(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var r=o.arg;return r?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function $(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function P(t){if(null!=t){var n=t[r];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(s.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return w.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=h(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},t.awrap=function(t){return{__await:t}},x(k.prototype),h(k.prototype,a,function(){return this}),t.AsyncIterator=k,t.async=function(e,n,s,i,o){void 0===o&&(o=Promise);var r=new k(u(e,n,s,i),o);return t.isGeneratorFunction(n)?r:r.next().then(function(t){return t.done?t.value:r.next()})},x(E),h(E,c,"Generator"),h(E,r,function(){return this}),h(E,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),n=[];for(var s in e)n.push(s);return n.reverse(),function t(){for(;n.length;){var s=n.pop();if(s in e)return t.value=s,t.done=!1,t}return t.done=!0,t}},t.values=P,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach($),!t)for(var n in this)"t"===n.charAt(0)&&s.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(s,i){return a.type="throw",a.arg=t,n.next=s,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],a=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var c=s.call(r,"catchLoc"),h=s.call(r,"finallyLoc");if(c&&h){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=t,r.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),$(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var s=n.completion;if("throw"===s.type){var i=s.arg;$(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,s){return this.delegate={iterator:P(t),resultName:n,nextLoc:s},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(i));var c,h={exports:{}};var u=(c||(c=1,function(t,n){var s="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==e&&e,i=function(){function t(){this.fetch=!1,this.DOMException=s.DOMException}return t.prototype=s,new t}();!function(t){!function(n){var s=void 0!==t&&t||"undefined"!=typeof self&&self||void 0!==e&&e||{},i="URLSearchParams"in s,o="Symbol"in s&&"iterator"in Symbol,r="FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in s,c="ArrayBuffer"in s;if(c)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&h.indexOf(Object.prototype.toString.call(t))>-1};function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function y(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function m(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function g(t){var e=new FileReader,n=m(e);return e.readAsArrayBuffer(t),n}function w(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():c&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=w(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=w(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=y(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=y(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(r)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,n,s,i,o=y(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=m(e),s=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=s?s[1]:"utf-8",e.readAsText(t,i),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),s=0;s<e.length;s++)n[s]=String.fromCharCode(e[s]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=l(t),e=d(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},f.prototype.delete=function(t){delete this.map[l(t)]},f.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},f.prototype.set=function(t,e){this.map[l(t)]=d(e)},f.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),p(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),p(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),p(t)},o&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function S(t,e){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,i,o=(e=e||{}).body;if(t instanceof S){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(n=e.method||this.method||"GET",i=n.toUpperCase(),v.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in s)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function T(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),s=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(s),decodeURIComponent(i))}}),e}function E(t,e){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},b.call(S.prototype),b.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var x=[301,302,303,307,308];E.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},n.DOMException=s.DOMException;try{new n.DOMException}catch(t){n.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},n.DOMException.prototype=Object.create(Error.prototype),n.DOMException.prototype.constructor=n.DOMException}function k(t,e){return new Promise(function(i,o){var a=new S(t,e);if(a.signal&&a.signal.aborted)return o(new n.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function u(){h.abort()}if(h.onload=function(){var t,e,n={statusText:h.statusText,headers:(t=h.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var n=t.split(":"),s=n.shift().trim();if(s){var i=n.join(":").trim();try{e.append(s,i)}catch(t){console.warn("Response "+t.message)}}}),e)};0===a.url.indexOf("file://")&&(h.status<200||h.status>599)?n.status=200:n.status=h.status,n.url="responseURL"in h?h.responseURL:n.headers.get("X-Request-URL");var s="response"in h?h.response:h.responseText;setTimeout(function(){i(new E(s,n))},0)},h.onerror=function(){setTimeout(function(){o(new TypeError("Network request failed"))},0)},h.ontimeout=function(){setTimeout(function(){o(new TypeError("Network request timed out"))},0)},h.onabort=function(){setTimeout(function(){o(new n.DOMException("Aborted","AbortError"))},0)},h.open(a.method,function(t){try{return""===t&&s.location.href?s.location.href:t}catch(e){return t}}(a.url),!0),"include"===a.credentials?h.withCredentials=!0:"omit"===a.credentials&&(h.withCredentials=!1),"responseType"in h&&(r?h.responseType="blob":c&&(h.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof f||s.Headers&&e.headers instanceof s.Headers)){var p=[];Object.getOwnPropertyNames(e.headers).forEach(function(t){p.push(l(t)),h.setRequestHeader(t,d(e.headers[t]))}),a.headers.forEach(function(t,e){-1===p.indexOf(e)&&h.setRequestHeader(e,t)})}else a.headers.forEach(function(t,e){h.setRequestHeader(e,t)});a.signal&&(a.signal.addEventListener("abort",u),h.onreadystatechange=function(){4===h.readyState&&a.signal.removeEventListener("abort",u)}),h.send(void 0===a._bodyInit?null:a._bodyInit)})}k.polyfill=!0,s.fetch||(s.fetch=k,s.Headers=f,s.Request=S,s.Response=E),n.Headers=f,n.Request=S,n.Response=E,n.fetch=k,Object.defineProperty(n,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=s.fetch?s:i;(n=o.fetch).default=o.fetch,n.fetch=o.fetch,n.Headers=o.Headers,n.Request=o.Request,n.Response=o.Response,t.exports=n}(h,h.exports)),h.exports),l=n(u);class d extends Error{constructor(t,e){super(t),a(this,"code",void 0),this.code=e}}class p extends d{constructor(t,e){var n;super(t.message,null===(n=t.information)||void 0===n?void 0:n.code),a(this,"status",void 0),a(this,"information",void 0),a(this,"cause",void 0);const{information:s,message:i,cause:o,status:r}=t;if(this.status=null!=r?r:null==e?void 0:e.status,this.message=i,s){const{code:t,...e}=s;this.code=t,this.information=e}o&&(this.cause=o)}}class f{constructor(t,e){a(this,"status",void 0),a(this,"headers",void 0),a(this,"body",void 0);const{status:n,headers:s}=e;this.status=n,this.headers=s,this.body=t}}const y=new Function("try {return this===window;}catch(e){ return false;}"),m=new Function('try {return (typeof process !== "undefined") && (typeof process.versions.node !== "undefined")}catch(e){return false;}'),g=(t,e)=>e.startsWith(t)?e:`${t}${e}`,w=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var b={getItem:t=>t&&decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${w(encodeURIComponent(t))}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1"))||null,setItem(t,e,n={}){if(!t||/^(?:expires|max-age|path|domain|secure)$/i.test(t))return!1;const{path:s,domain:i,end:o,secure:r,samesite:a}=n,c=(t=>{if(!t)return"";switch(t.constructor){case Number:return t===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":`; max-age=${t}`;case String:return`; expires=${t}`;case Date:return`; expires=${new Date(t).toUTCString()}`;default:return""}})(o),h=i?`; domain=${i}`:"",u=s?`; path=${s}`:"",l=r?"; secure":"",d=a?`; samesite=${a}`:"";return document.cookie=`${encodeURIComponent(t)}=${encodeURIComponent(e)}${c}${h}${u}${l}${d}`,!0},removeItem(t,e={}){if(!this.hasItem(t))return!1;const{path:n,domain:s}=e,i=s?`; domain=${s}`:"",o=n?`; path=${n}`:"";return document.cookie=`${encodeURIComponent(t)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${i}${o}`,!0},hasItem:t=>!(!t||/^(?:expires|max-age|path|domain|secure)$/i.test(t))&&new RegExp(`(?:^|;\\s*)${w(encodeURIComponent(t))}\\s*\\=`).test(document.cookie),clear(){const t=document.cookie.replace(/((?:^|\s*;)[^=]+)(?=;|$)|^\s*|\s*(?:=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:=[^;]*)?;\s*/);for(let e=t.length,n=0;n<e;n++)t[n]=decodeURIComponent(t[n]),this.removeItem(t[n]);return t}};class v{constructor(t){a(this,"_store",void 0),this._store=t}clear(){this._store.clear()}get store(){return this._store}set store(t){this._store=t}}const S=new Map;class T extends v{constructor(){super(S)}getItem(t){return super.store.get(t)}setItem(t,e){return super.store.set(t,e)}removeItem(t){return super.store.delete(t)}}class E extends v{constructor(){super(window.sessionStorage)}getItem(t){const e=super.store.getItem(t);return e?JSON.parse(e):null}setItem(t,e){return super.store.setItem(t,JSON.stringify(e))}removeItem(t){return super.store.removeItem(t)}}class x{constructor(t={}){a(this,"options",{});this.options={path:"/",...t}}getItem(t){const e=b.getItem(t);return e?JSON.parse(e):null}setItem(t,e){return b.setItem(t,JSON.stringify(e),this.options)}removeItem(t){return b.removeItem(t,this.options)}clear(){return b.clear()}}let k=function(t){return t.COOKIE="COOKIE",t.SESSION="SESSION",t}({}),_=function(t){return t.PROJECT="PROJECT",t.GROUP="GROUP",t.EPISODE="EPISODE",t.WORLD="WORLD",t}({}),A=function(t){return t.NONE="NONE",t.INTER="INTER",t.REANIMATE="REANIMATE",t.REVIVE="REVIVE",t.EXORCISE="EXORCISE",t.RESURRECT="RESURRECT",t}({}),N=function(t){return t.CHAT="CHAT",t.CONSENSUS="CONSENSUS",t.CONTROL="CONTROL",t.PRESENCE="PRESENCE",t.LOBBY="LOBBY",t.STREAM="STREAM",t.RUN="RUN",t.VAULT="VAULT",t.VIDEO="VIDEO",t.WORLD="WORLD",t.LEADERBOARD="LEADERBOARD",t.GROUP="GROUP",t.SYSTEM="SYSTEM",t}({}),$=function(t){return t.SYSTEM="SYSTEM",t.MONITOR="MONITOR",t.OWNER="OWNER",t.AUTHOR="AUTHOR",t.SUPPORT="SUPPORT",t.ASSOCIATE="ASSOCIATE",t.FACILITATOR="FACILITATOR",t.REVIEWER="REVIEWER",t.USER="USER",t.LEADER="LEADER",t.PARTICIPANT="PARTICIPANT",t.ANONYMOUS="ANONYMOUS",t}({});const R=new class{constructor(){if(a(this,"_apiVersion",3),a(this,"_apiProtocol",""),a(this,"_apiHost",""),a(this,"_useProjectProxy",!1),a(this,"_accountShortName",""),a(this,"_projectShortName",""),a(this,"authOverride",void 0),y())this.loadBrowser();else{if(!m())throw new d("Could not identify environment; no configuration was setup");this.loadNode()}}get apiProtocol(){return this._apiProtocol}set apiProtocol(t){t.startsWith("http")&&(t.endsWith(":")&&(t=t.slice(0,-1)),this._apiProtocol=t)}get apiHost(){return this._apiHost}set apiHost(t){this._apiHost=t}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(t){this._useProjectProxy=t}get apiVersion(){return this._apiVersion}set apiVersion(t){}get accountShortName(){return this._accountShortName}set accountShortName(t){this._accountShortName=t}get projectShortName(){return this._projectShortName}set projectShortName(t){this._projectShortName=t}isLocal(){if(!y())return!1;const t=window.location.host;return"127.0.0.1"===t||0===t.indexOf("local.")||-1!==t.indexOf("ngrok")||0===t.indexOf("localhost")}loadNode(){this.apiProtocol="https",this.apiHost="forio.com"}loadBrowser(){const t=this.isLocal(),{protocol:e,pathname:n,host:s}=window.location;this.apiProtocol=t?"https":e,this.apiHost=t?"forio.com":s;const i=n.match(/\/app\/([\w-]+)\/([\w-]+)/);if(i){const[t,e]=i.slice(1);this.accountShortName=t,this.projectShortName=e}}setContext(t){t.apiProtocol&&(this.apiProtocol=t.apiProtocol),t.apiHost&&(this.apiHost=t.apiHost),"boolean"==typeof t.useProjectProxy&&(this.useProjectProxy=t.useProjectProxy),t.accountShortName&&(this.accountShortName=t.accountShortName),t.projectShortName&&(this.projectShortName=t.projectShortName)}},{COOKIE:P,SESSION:O}=k,C="com.forio.epicenter.session",I="epicenter.v3.sso";const j=new class{constructor(t){if(a(this,"type",void 0),t!==P&&t!==O)throw new d(`Invalid Storage Type: "${String(t)}", please use "${String(P)}" or "${String(O)}".`);this.type=t,this.consumeSSO()}get session(){return(new(this.getStore())).getItem(C)}set session(t){const e=this.getStore(),n=this.getStoreOptions(t);t?new e(n).setItem(C,t):this.session&&new e(n).removeItem(C)}setSessionWithOptions(t,e){const n=this.getStore(),s=this.getStoreOptions(t,e);t?new n(s).setItem(C,t):this.session&&new n(s).removeItem(C)}getStore(){return m()?T:this.type===O?E:x}getStoreOptions(t,e){const n=t||this.session;if(!n||m())return"";const{objectType:s}=n,i=R.isLocal(),o={samesite:i?"lax":"none",secure:!i},r=!i&&"app"!==window.location.pathname.split("/")[1],a=!i&&!r;if(!1===e)return{...o,path:"/"};if(!0===e||a&&("user"===s||"admin"===s)){const{accountShortName:t,projectShortName:e}=R,n=t?`/${t}`:"",s=n&&e?`/${e}`:"";return{...o,path:`/app${n}${s}`}}return{...o,path:"/"}}consumeSSO(){if(m())return;let t=b.getItem(I);"string"==typeof t&&'"'!==t.charAt(0)&&'"'!==t.charAt(t.length-1)&&(t=`"${t}"`);const e=JSON.parse(JSON.parse(null!=t?t:'"null"'));if(e){const{accountShortName:t,projectShortName:n}=e,s=t?`/${t}`:"",i=s&&n?`/${n}`:"";this.session=e,b.removeItem(I,{path:`/app${s}${i}`})}}}(P);const L=new class{constructor(){a(this,"_handlers",[])}get handlers(){return this._handlers}clearHandlers(){this._handlers=[]}registerHandler(t,e){const n={identifier:t,handle:e,unregister:()=>this.unregisterHandler(t)};return this.handlers.unshift(n),n}unregisterHandler(t){const e=this.handlers.findIndex(e=>e.identifier===t);e>-1&&this.handlers.splice(e,1)}async handle(t,e,n){const s=(n=n||this.handlers).findIndex(({identifier:e})=>e(t)),i=n[s];if(!i)throw t;let o;try{o=await i.handle(t,e).catch(t=>{throw t})}catch(i){console.error("Handler failed due to error",i);const r=s>-1?[...n.slice(0,s),...n.slice(s+1)]:[],a=i instanceof p?i:t;o=await this.handle(a,e,r)}return o}};const M=t=>t.constructor===URLSearchParams?t:("object"==typeof t&&t.constructor===Object&&(t=Object.entries(t).reduce((t,[e,n])=>Array.isArray(n)?[...t,...n.map(t=>[e,t])]:(null==n||t.push([e,n.toString()]),t),[])),new URLSearchParams(t)),U=(t,e,n,s)=>{const i=Object.assign({},t);let o=null;if(y()&&e instanceof FormData?o=e:e&&(i["Content-type"]="application/json; charset=UTF-8",o=JSON.stringify(e)),!n)return delete i.Authorization,{headers:i,body:o};const{session:r}=j;return i.Authorization||(r&&(i.Authorization=`Bearer ${r.token}`),s&&(i.Authorization=s),R.authOverride&&(i.Authorization=R.authOverride)),{headers:i,body:o}},D=204,B=400,K=200;async function W(t,e){if(t.href.length>2048)throw new d(`URL length exceeds maximum of 2048 characters: ${t.href.length} characters.`);const{method:n,headers:s,body:i,includeAuthorization:o,inert:r,paginated:a,authorization:c}=e,h=U(s,i,o,c),u=await l(t.toString(),{method:n,cache:"no-cache",redirect:"follow",headers:h.headers,body:h.body});if(u.status===D)return new f(void 0,u);const y=u.headers.get("content-type");if(!y||!y.includes("application/json"))throw new d(`Response content-type '${y}' does not include 'application/json' and my url is ${t.toString()}, ${n}`);const m=await u.json();if(u.status>=K&&u.status<B){const n=new f(a?function(t,e,n){var s;const i=null!==(s=n.parsePage)&&void 0!==s?s:t=>t,o={...t,values:i(t.values)},r=t.totalResults,a=async function(t=0,s=[]){if(t>=r)return s;const o=new URLSearchParams(e.search);o.set("first",t.toString()),o.delete("max"),e.search=o.toString();const c=await W(e,{...n,paginated:!1}).then(({body:t})=>t);return s.push(...i(c.values)),a(t+c.maxResults,s)};return o.prev=async function(){const t=new URLSearchParams(e.search);if(0===o.firstResult)return console.warn('Pagination: cannot call "prev" on first page'),[];const s=o.firstResult-o.maxResults,r=o.maxResults+(s<0?s:0);t.set("first",Math.max(s,0).toString()),t.set("max",r.toString()),e.search=t.toString();const a=await W(e,{...n,paginated:!1}).then(({body:t})=>t);return a.values=i(a.values),Object.assign(o,a),o.values},o.next=async function(){const t=new URLSearchParams(e.search),s=o.firstResult+o.maxResults;if(s>=o.totalResults)return console.warn('Pagination: cannot call "next" on final page'),[];t.set("first",s.toString()),e.search=t.toString();const r=await W(e,{...n,paginated:!1}).then(({body:t})=>t);return r.values=i(r.values),Object.assign(o,r),o.values},o.all=a,o}(m,t,e):m,u);return n}const g=new p(m,u);if(!0===r)throw g;if("function"==typeof r&&r(g))throw g;const w={...e,inert:!0},b=()=>W(t,w);return b.requestArguments={url:t,...w},L.handle(g,b)}class z{constructor(){a(this,"_version",void 0),a(this,"_server",void 0),a(this,"_useProjectProxy",void 0),a(this,"_accountShortName",void 0),a(this,"_projectShortName",void 0),a(this,"_authorization",void 0),a(this,"_searchParams",new URLSearchParams)}get version(){return this._version}set version(t){this._version=t}get server(){return this._server}set server(t){this._server=t}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(t){this._useProjectProxy=t}get accountShortName(){return this._accountShortName}set accountShortName(t){this._accountShortName=t}get projectShortName(){return this._projectShortName}set projectShortName(t){this._projectShortName=t}get authorization(){return this._authorization}set authorization(t){this._authorization=t}get searchParams(){return this._searchParams}set searchParams(t){this._searchParams=M(t)}withVersion(t){return void 0!==t&&(this.version=t),this}withServer(t){return void 0!==t&&(this.server=t),this}withProjectProxy(t){return void 0!==t&&(this.useProjectProxy=t),this}withAccountShortName(t){return void 0!==t&&(this.accountShortName=t),this}withProjectShortName(t){return void 0!==t&&(this.projectShortName=t),this}withAuthorization(t){return void 0!==t&&(this.authorization=t),this}withSearchParams(t){return void 0!==t&&(this.searchParams=t),this}getURL(t,e={}){var n,s,i,o,r,a,c,h,u,l,d;const p=null!==(n=null!==(s=e.server)&&void 0!==s?s:this.server)&&void 0!==n?n:`${R.apiProtocol}://${R.apiHost}`,f=null!==(i=null!==(o=e.useProjectProxy)&&void 0!==o?o:this.useProjectProxy)&&void 0!==i?i:R.useProjectProxy,y=null!==(r=null!==(a=e.accountShortName)&&void 0!==a?a:this.accountShortName)&&void 0!==r?r:R.accountShortName,m=null!==(c=null!==(h=e.projectShortName)&&void 0!==h?h:this.projectShortName)&&void 0!==c?c:R.projectShortName,w=null!==(u=null!==(l=null==e?void 0:e.version)&&void 0!==l?l:this.version)&&void 0!==u?u:R.apiVersion,b=new URL(`${p}`),v=f?`proxy/${y}/${m}/`:"",S=`api/v${w}/${y}/${m}`,T=g("/",t);return b.pathname=`${v}${S}${T}`,b.search=void 0!==e.query?M(e.query).toString():(null!==(d=this.searchParams)&&void 0!==d?d:new URLSearchParams).toString(),b}async get(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,includeAuthorization:h,inert:u,paginated:l,parsePage:d}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"GET",headers:c,includeAuthorization:null==h||h,authorization:null!=i?i:this.authorization,inert:u,paginated:l,parsePage:d})}async delete(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,includeAuthorization:h,inert:u}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"DELETE",headers:c,includeAuthorization:null==h||h,authorization:null!=i?i:this.authorization,inert:u})}async patch(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,body:h,includeAuthorization:u,inert:l}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"PATCH",headers:c,body:h,includeAuthorization:null==u||u,authorization:null!=i?i:this.authorization,inert:l})}async post(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,body:h,includeAuthorization:u,inert:l}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"POST",headers:c,body:h,includeAuthorization:null==u||u,authorization:null!=i?i:this.authorization,inert:l})}async put(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,body:h,includeAuthorization:u,inert:l}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"PUT",headers:c,body:h,includeAuthorization:null==u||u,authorization:null!=i?i:this.authorization,inert:l})}}var F=Object.freeze({__proto__:null,createAccount:async function(t){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").post("/account",{body:t}).then(({body:t})=>t)},getAccount:async function(t){return await(new z).withAccountShortName(t).get("/account").then(({body:t})=>t)},removeAccount:async function(t){return await(new z).withAccountShortName(t).delete("/account").then(({body:t})=>t)},teamForAdmin:async function(t,e={}){const{includeAllMembers:n,filter:s,first:i,max:o,...r}=e,a={includeAllMembers:n,filter:s,first:i,max:o};return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").withSearchParams(a).get(`/account/team/for/${t}`,r).then(({body:t})=>t)},updateAccount:async function(t,e={}){return await(new z).patch("/account",{body:t,...e}).then(({body:t})=>t)}});var H=Object.freeze({__proto__:null,createAdmin:async function(t){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").post("/admin",{body:t}).then(({body:t})=>t)},getWithHandle:async function(t,e={}){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").get(`/admin/with/${t}`,e).then(({body:t})=>t)}});function q(t){if(!t.filters||0===t.filters.length)return"";const e=t.filters.map(t=>"string"==typeof t?t:q(t)).filter(t=>t.length>0);if(0===e.length)return"";if(!t.type||!["and","or","taxonomy"].includes(t.type))throw new Error(`Invalid or missing filter group type: ${t.type||"undefined"}`);const n=e.join(";");if(1===e.length)return n;switch(t.type){case"and":return`(${n})`;case"or":return`[${n}]`;case"taxonomy":return`{${n}}`;default:throw new Error(`Unexpected filter group type: ${t.type}`)}}function G(t){if(t)return Array.isArray(t)?t.length>0?t.join(";"):void 0:"string"==typeof t?t||void 0:q(t)||void 0}async function V(t={}){return await(new z).get("/project",t).then(({body:t})=>t)}var J=Object.freeze({__proto__:null,ACCESS_TYPE:{PUBLIC:"PUBLIC",PRIVATE:"PRIVATE",AUTHENTICATED:"AUTHENTICATED"},CHANNEL_PROTOCOL:{OUMUAMUA:"OUMUAMUA",COMETD:"COMETD"},PHYLOGENY:{ORIGINAL:"ORIGINAL",HISTORICAL:"HISTORICAL",REFERENTIAL:"REFERENTIAL",ORDERED:"ORDERED",EVENTUAL:"EVENTUAL",TRANSMOGRIFIED:"TRANSMOGRIFIED",REANIMATED:"REANIMATED",SILENT:"SILENT"},WORKER_PARTITION:{NONE:"NONE",ALL:"ALL",FREE:"FREE",LICENSED:"LICENSED",ACCOUNT:"ACCOUNT"},channelsEnabled:async function(t={}){return await(new z).get("/project/channel/isEnabled",t).then(({body:t})=>t)},get:V,list:async function(t,e={}){return await(new z).withAccountShortName(t).withProjectShortName("manager").get("/project/in",e).then(({body:t})=>t)}});const Y="com.forio.epicenter.token",X="idle",Z="failed",Q="connected",tt="succeeded",et="handshaking",nt="disconnected",st=["402","session_unknown","invalid client id","missing client id","session has been disconnected","invalid session type","handshake_denied","handshake_failed"];function it(t){const e=t.toLowerCase();return st.some(t=>e.includes(t))}function ot(t){return t instanceof Error&&t.message.toLowerCase().includes("illegal state")}function rt(t){var e,n;if("handshake"===(null===(e=t.advice)||void 0===e?void 0:e.reconnect))return!0;return it(null!==(n=t.error)&&void 0!==n?n:"")}let at;const ct=new class{constructor(){a(this,"url",""),a(this,"initialization",void 0),a(this,"handshakePromise",void 0),a(this,"subscriptions",new Map),a(this,"isConnected",!1),a(this,"handshakeState",X),a(this,"pendingOperations",[]),a(this,"processingQueue",!1)}get cometd(){if(!at)throw new d("Tried to get non-existent cometd");return at}set cometd(t){at=t}async startup(t={logLevel:"warn"}){var e;const n=await V();if(!n.channelEnabled)throw new d("Push Channels are not enabled on this project");const s=(null===(e=n.channelProtocol)||void 0===e?void 0:e.toLowerCase())||"cometd",{CometD:i}=await Promise.resolve().then(function(){return eo}),{AckExtension:o}=await Promise.resolve().then(function(){return eo}),{ReloadExtension:r}=await Promise.resolve().then(function(){return eo});this.cometd=new i;const{apiProtocol:a,apiHost:c,apiVersion:h,accountShortName:u,projectShortName:l}=R,p=u&&l?`/${u}/${l}`:"/epicenter/manager";return this.url=`${a}://${c}/push/v${h}${p}/${s}`,this.cometd.registerExtension("ack",new o),y()&&(this.cometd.registerExtension("reload",new r),window.onunload=()=>{if(this.cometd.getStatus()===Q){this.cometd.reload&&this.cometd.reload();const t=this.cometd.getTransport();t&&t.abort()}}),this.cometd.configure({url:this.url,logLevel:t.logLevel}),!0}listenToMetaChannels(){this.cometd.addListener("/meta/handshake",t=>{t.successful?(this.handshakeState=tt,this.processPendingOperations()):(this.handshakeState=Z,this.handleHandshakeFailure(t))});const t=new Promise((t,e)=>{this.cometd.addListener("/meta/connect",n=>{if(this.cometd.isDisconnected())return;const s=this.isConnected;if(this.isConnected=n.successful||!1,!s&&this.isConnected){const n=new p({status:void 0,message:"Reconnected to CometD",information:{code:"COMETD_RECONNECTED"}}),s=()=>Promise.resolve();try{const e=L.handle(n,s);t(e)}catch(t){e(t)}this.processPendingOperations()}else s&&!this.isConnected&&(this.handshakeState=X)})}),e=new Promise(t=>{this.cometd.addListener("/meta/disconnect",e=>{e.successful&&(this.isConnected=!1,this.handshakeState=X),t(e)})});return Promise.all([t,e])}handleHandshakeFailure(t){rt(t)&&(this.handshakeState=X,this.handshakePromise=void 0)}async processPendingOperations(){if(this.processingQueue||0===this.pendingOperations.length)return;this.processingQueue=!0;const t=[...this.pendingOperations];this.pendingOperations=[];try{await Promise.all(t.map(t=>t().catch(console.error)))}finally{this.processingQueue=!1}}async init(t){return this.initialization||(this.initialization=this.startup(t)),this.initialization}async handshake(t={}){if(await this.init(),this.handshakePromise&&this.handshakeState===et)return this.handshakePromise;const e=this.cometd.getStatus();if(e===Q&&this.handshakeState===tt)return Promise.resolve();if("connecting"===e||e===et)return this.handshakePromise?this.handshakePromise:Promise.reject(new Error("CometD is already connecting, please wait"));if(e!==nt)return Promise.resolve();this.handshakeState=et;const{session:n}=j;let s={};return n&&(s={ext:{[Y]:n.token,ack:!0}}),this.cometd.websocketEnabled=!0,this.handshakePromise=new Promise((e,n)=>{this.cometd.handshake(s,s=>{var i;if(s.successful)return this.handshakeState=tt,this.listenToMetaChannels(),void e(void 0);this.handshakeState=Z,rt(s)&&(this.handshakeState=X,this.handshakePromise=void 0);const o=null!==(i=s.error)&&void 0!==i?i:"",r=new p({status:o.includes("403")?403:void 0,message:o,information:{code:"COMETD_ERROR",...s}});if(t.inert)return void n(r);const a=()=>this.handshake({inert:!0});try{const t=L.handle(r,a);e(t)}catch(t){n(t)}})}),this.handshakePromise}async disconnect(){return this.initialization?(await this.init(),await this.empty(),this.cometd.getStatus()!==Q?Promise.resolve():new Promise((t,e)=>this.cometd.disconnect(n=>{var s;if(n.successful)return void t(void 0);it(null!==(s=n.error)&&void 0!==s?s:"")?t(void 0):e(new d("Unable to disconnect from CometD server"))}))):Promise.resolve()}async add(t,e,n={}){var s;await this.init();if((null===(s=this.cometd)||void 0===s?void 0:s.getStatus())!==Q)try{await this.handshake()}catch(t){var i;const e=t;if(null!=e&&null!==(i=e.message)&&void 0!==i&&i.includes("already connecting")){var o;const t=500;await new Promise(e=>setTimeout(e,t)),null===(o=this.cometd)||void 0===o||o.getStatus()}throw t}const{session:r}=j,a=r?{ext:{[Y]:r.token}}:{},c=t=>{let n=t.data;if("string"==typeof n)try{n=JSON.parse(n)}catch(t){}return e(n)};return new Promise((s,i)=>{let o;try{o=this.cometd.subscribe(t.path,c,a,r=>{var a;if(r.successful)return this.subscriptions.set(t.path,o),void s(o);rt(r)&&(this.handshakeState=X,this.handshakePromise=void 0);const c=null!==(a=r.error)&&void 0!==a?a:"",h=new p({status:c.includes("403")?403:void 0,message:c,information:{code:"COMETD_ERROR",...r}});if(n.inert)return void i(h);const u=async()=>(rt(r)&&await this.handshake({inert:!0}),this.add(t,e,{inert:!0}));try{const t=L.handle(h,u);s(t)}catch(t){i(t)}})}catch(o){var r;const a=null!==(r=n._retryCount)&&void 0!==r?r:0;if(ot(o)&&a<3)return this.handshakeState=X,this.handshakePromise=void 0,void this.handshake().then(()=>this.add(t,e,{...n,_retryCount:a+1})).then(s).catch(i);i(o)}})}async publish(t,e,n={}){await this.init(),this.cometd.getStatus()!==Q&&await this.handshake();const{session:s}=j,i={ext:s?{[Y]:s.token}:void 0};return new Promise((s,o)=>{try{this.cometd.publish(t.path,e,i,i=>{var r;if(i.successful)return void s(i);rt(i)&&(this.handshakeState=X,this.handshakePromise=void 0);const a=null!==(r=i.error)&&void 0!==r?r:"",c=new p({status:a.includes("403")?403:void 0,message:a,information:{code:"COMETD_ERROR",...i}});if(n.inert)return void o(c);const h=async()=>(rt(i)&&await this.handshake({inert:!0}),this.publish(t,e,{inert:!0}));try{const t=L.handle(c,h);s(t)}catch(t){o(t)}})}catch(i){var r;const a=null!==(r=n._retryCount)&&void 0!==r?r:0;if(ot(i)&&a<3)return this.handshakeState=X,this.handshakePromise=void 0,void this.handshake().then(()=>this.publish(t,e,{...n,_retryCount:a+1})).then(s).catch(o);o(i)}})}async remove(t){let e;await this.init();for(const[n,s]of this.subscriptions.entries())if(s===t){e=n;break}return e&&(this.subscriptions.delete(e),this.cometd.getStatus()===nt)?Promise.resolve():new Promise((e,n)=>{try{this.cometd.unsubscribe(t,t=>{var s;if(t.successful)return void e(t);const i=null!==(s=t.error)&&void 0!==s?s:"";if(it(i))return void e(t);const o=new p({status:void 0,message:i,information:{code:"COMETD_ERROR",...t}});n(o)})}catch(t){if(ot(t))return void e(void 0);n(t)}})}async empty(){await this.init(),this.cometd.clearSubscriptions(),this.subscriptions.clear()}};async function ht(){j.session=void 0,await ct.disconnect()}async function ut(t,e={}){const{objectType:n="user",accountShortName:s,forcePathInclusion:i,...o}=e,r=await(new z).patch("/authentication",{accountShortName:"admin"===n?t:s,body:{objectType:n,groupKey:"user"===n?t:void 0},...o}).then(({body:t})=>t);return await ht(),j.setSessionWithOptions(r,i),r}var lt=Object.freeze({__proto__:null,generateSAMLLINK:function(t={}){return(new z).getURL("/registration/sso/user/saml",t).toString()},getLocalSession:function(){return j.session},getSAMLLink:async function(t={}){return await(new z).get("/registration/sso/user/saml",t).then(({body:t})=>t)},getSession:async function(t={}){const{body:e}=await(new z).get("/verification",t);return j.session=e,e},login:async function(t,e={}){const{objectType:n,forcePathInclusion:s,...i}=e;let o;if(Object.prototype.hasOwnProperty.call(t,"handle")){const{handle:e,password:s,groupKey:i}=t;o={objectType:null!=n?n:"user",handle:e,password:s,groupKey:i||void 0}}if(Object.prototype.hasOwnProperty.call(t,"secretKey")){const{secretKey:e}=t;o={objectType:null!=n?n:"account",secretKey:e}}const r=await(new z).post("/authentication",{inert:!0,includeAuthorization:!1,body:o,...i}).then(({body:t})=>t);return await ht(),j.setSessionWithOptions(r,s),r},logout:async function(t={},e=t){var n;const s=[ct.disconnect()],i=null==j||null===(n=j.session)||void 0===n?void 0:n.groupKey;i&&s.push((new z).delete(`/presence/group/${i}`,e)),await Promise.allSettled(s),await(new z).delete("/verification",t).finally(()=>j.session=void 0)},regenerate:ut,removeLocalSession:ht,resetPassword:async function(t,e={}){const{redirectURL:n,subject:s,...i}=e;return await(new z).post(`/verification/password/user/${t}`,{...i,body:{redirectUrl:n,subject:s}}).then(({body:t})=>t)},setLocalSession:function(t){return j.session=t},sso:async function(t={}){const e=await(new z).get("/registration/sso/user",t).then(({body:t})=>t);return j.session=e,e},ssoOutcome:async function(t,e,n={}){const{...s}=n;return await(new z).post(`/lti/${t}/outcome`,{body:e,...s}).then(({body:t})=>t)},verify:async function(t,e={}){return await(new z).get("/verification",{authorization:`Bearer ${t}`,...e}).then(({body:t})=>t)}});async function dt(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,ttlSeconds:c,tokenAccessSeconds:h,...u}=n;return await(new z).withSearchParams({tokenAccessSeconds:h}).post("/asset",{body:{file:t,scope:{scopeBoundary:s,scopeKey:i,userKey:o},permit:{readLock:null!=r?r:$.USER,writeLock:null!=a?a:$.USER},ttlSeconds:c},...u}).then(({body:t})=>t)}async function pt(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,ttlSeconds:c,tokenAccessSeconds:h,...u}=n;return await(new z).withSearchParams({tokenAccessSeconds:h}).patch("/asset",{body:{file:t,scope:{scopeBoundary:s,scopeKey:i,userKey:o},permit:{readLock:null!=r?r:$.USER,writeLock:null!=a?a:$.USER},ttlSeconds:c},...u}).then(({body:t})=>t)}var ft=Object.freeze({__proto__:null,create:dt,download:async function(t,e={}){const{tokenAccessSeconds:n,...s}=e;return await(new z).withSearchParams({tokenAccessSeconds:n}).get(`/asset/download/${t}`,s).then(({body:t})=>t)},downloadWithScope:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{tokenAccessSeconds:r,...a}=n,c=o?`/${o}`:"";return await(new z).withSearchParams({tokenAccessSeconds:r}).get(`/asset/download/with/${s}/${i}${c}/${t}`,a).then(({body:t})=>t)},get:async function(t,e={}){const{server:n,accountShortName:s,projectShortName:i}=e;return await(new z).withServer(n).withAccountShortName(s).withProjectShortName(i).get(`/asset/${t}`).then(({body:t})=>t)},getURL:async function(t,e={}){const{tokenAccessSeconds:n,...s}=e;return await(new z).withSearchParams({tokenAccessSeconds:n}).get(`/asset/url/${t}`,s).then(({body:t})=>t)},getURLWithScope:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{tokenAccessSeconds:r,...a}=n,c=o?`/${o}`:"";return await(new z).withSearchParams({tokenAccessSeconds:r}).get(`/asset/url/with/${s}/${i}${c}/${t}`,a).then(({body:t})=>t)},list:async function(t,e={}){const{scopeBoundary:n,scopeKey:s,userKey:i}=t,{filter:o,...r}=e,a=i?`/${i}`:"";return await(new z).get(`/asset/in/${n}/${s}${a}/${null!=o?o:"*"}`,r).then(({body:t})=>t)},remove:async function(t,e={}){return await(new z).delete(`/asset/${t}`,e).then(({body:t})=>t)},removeFromScope:async function(t,e={}){const{scopeBoundary:n,scopeKey:s,userKey:i}=t,o=i?`/${i}`:"";return await(new z).delete(`/asset/in/${n}/${s}${o}`,e).then(({body:t})=>t)},store:async function(t,e,n={}){const{overwrite:s,fileName:i,...o}=n,r=null!=i?i:t.name;let a="";try{a=(await dt(r,e,{inert:!0,...o})).url}catch(t){if(!(t instanceof p))throw t;if(!(409===t.status&&s))throw t;a=(await pt(r,e,o)).url}await l(a,{method:"PUT",body:t})},update:pt});var yt=Object.freeze({__proto__:null,sendEmail:async function(t,e,n,s,i={}){const{accountShortName:o,projectShortName:r,server:a,familyNameFirst:c,html:h,from:u,replyTo:l,fromUserKey:d,attachments:p,...f}=i;let y="";return d?y+=`/as/${d}`:u&&(y+=`/from/${u}`,l&&(y+=`/${l}`)),await(new z).withServer(a).withAccountShortName(o).withProjectShortName(r).post(`/email/user/${t}/${e}${y}`,{body:{subject:n,body:s,familyNameFirst:c,html:h,attachments:p},...f}).then(({body:t})=>t)},sendEmailToAdmin:async function(t,e,n,s={}){const{accountShortName:i,projectShortName:o,server:r,familyNameFirst:a,html:c,attachments:h,...u}=s;return await(new z).withServer(r).withAccountShortName(i).withProjectShortName(o).post(`/email/admin/${t}`,{body:{subject:e,body:n,familyNameFirst:a,html:c,attachments:h},...u}).then(({body:t})=>t)},sendEmailToSupport:async function(t,e,n={}){const{accountShortName:s,projectShortName:i,server:o,supportType:r,familyNameFirst:a,html:c,attachments:h,...u}=n;return await(new z).withServer(o).withAccountShortName(s).withProjectShortName(i).withSearchParams({supportType:r}).post("/email/to/support",{body:{subject:t,body:e,familyNameFirst:a,html:c,attachments:h},...u}).then(({body:t})=>t)}});var mt=Object.freeze({__proto__:null,create:async function(t,e,n={}){const{draft:s,runLimit:i,category:o,...r}=n;return await(new z).post(`/episode/${e}`,{body:{name:t,draft:s,runLimit:i,category:o},...r}).then(({body:t})=>t)},forGroup:async function(t,e={}){return await(new z).get(`/episode/in/${t}`,e).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/episode/${t}`,e).then(({body:t})=>t)},query:async function(t,e={}){const{filter:n,sort:s=[],first:i=0,max:o}=t;return await(new z).withSearchParams({filter:G(n),sort:s.join(";")||void 0,first:i,max:o}).get("/episode/search",{paginated:!0,...e}).then(({body:t})=>t)},remove:async function(t,e={}){return await(new z).delete(`/episode/${t}`,e).then(({body:t})=>t)},withName:async function(t,e={}){const{groupName:n,...s}=e,i=j.session;return await(new z).get(`/episode/with/${null!=n?n:null==i?void 0:i.groupName}/${t}`,s).then(({body:t})=>t)}});async function gt(t,e={}){const{filter:n,sort:s=[],first:i,max:o,quantized:r}=t,a={filter:G(n),sort:s.join(";")||void 0,first:i,max:o};return await(new z).withSearchParams(a).get(`/group${r?"/quantized":""}/search`,{paginated:!0,...e}).then(({body:t})=>t)}var wt=Object.freeze({__proto__:null,addUser:async function(t,e={}){const{groupKey:n,...s}=e,i=Array.isArray(t)?t:[t],o=j.session;return await(new z).post(`/group/member/${null!=n?n:null==o?void 0:o.groupKey}`,{body:i.map(t=>{const e="string"==typeof t?t:t.userKey,n="string"==typeof t?$.PARTICIPANT:t.role,s="string"==typeof t||t.available;return{role:n,userKey:e,objectType:"group",available:null==s||s}}),...s}).then(({body:t})=>t)},create:async function(t,e={}){const{name:n,runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:p,allowChannel:f}=t;if(!n)throw new d("Cannot create a group with no name");return await(new z).post("/group",{body:{name:n,runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:p,allowChannel:f},...e}).then(({body:t})=>t)},destroy:async function(t,e={}){return await(new z).delete(`/group/${t}`,e).then(({body:t})=>t)},forUser:async function(t,e={}){const{includeExpired:n,includeAllMembers:s,role:i,...o}=e,r=Array.isArray(i)&&i.length>0,a={includeExpired:n,includeAllMembers:s,role:i?r?i:[i]:void 0};return await(new z).withSearchParams(a).get(`/group/member/for/${t}`,o).then(({body:t})=>t)},gather:async function(t={}){const{includeExpired:e,...n}=t;return await(new z).withSearchParams({includeExpired:e}).get("/group",n).then(({body:t})=>t)},get:async function(t={}){const{groupKey:e,augment:n,...s}=t;let i="";"MEMBERS"===n&&(i="/member"),"QUANTIZED"===n&&(i="/quantized");const o=j.session;return await(new z).get(`/group${i}/${null!=e?e:null==o?void 0:o.groupKey}`,s).then(({body:t})=>t)},getSessionGroups:async function(t={}){const{includeExpired:e,role:n,...s}=t,i=Array.isArray(n)&&n.length>0,o={includeExpired:e,role:n?i?n:[n]:void 0};return await(new z).withSearchParams(o).get("/group/member",s).then(({body:t})=>t)},getWhitelistedUsers:async function(t,e={}){return await(new z).get(`/group/self/${t}`,e).then(({body:t})=>t)},query:gt,removeUser:async function(t,e={}){const{groupKey:n,...s}=e,i=Array.isArray(t)&&t.length>1,o=i?"":`/${1===t.length?t[0]:t}`,r=i?{userKey:t}:void 0,a=j.session;return await(new z).withSearchParams(r).delete(`/group/member/${null!=n?n:null==a?void 0:a.groupKey}${o}`,s).then(({body:t})=>t)},search:async function(t={}){console.warn("DEPRECATION WARNING: groupAdapter.search is deprecated and will be removed with the next release. Use groupAdapter.query instead.");const{filter:e=[],sort:n=[],first:s,max:i,quantized:o,...r}=t,a={filter:e,sort:n,first:s,max:i,quantized:o};return await gt(a,r)},selfRegister:async function(t,e,n={}){const{displayName:s,givenName:i,familyName:o,handle:r,...a}=n;return await(new z).patch(`/registration/self/${t}`,{body:{password:e,displayName:s,givenName:i,familyName:o,handle:r},...a}).then(({body:t})=>t)},sendRegistrationEmail:async function(t,e,n={}){const{redirectURL:s,linkURL:i,subject:o,...r}=n;return await(new z).post(`/registration/self/${t}`,{body:{email:e,linkUrl:i,redirectUrl:s,subject:o},...r}).then(({body:t})=>t)},statusUpdate:async function(t,e,n={}){const{groupKey:s,...i}=n,o=j.session;return await(new z).patch(`/group/status/${null!=s?s:null==o?void 0:o.groupKey}`,{body:{code:t,message:e},...i}).then(({body:t})=>t)},update:async function(t,e,n={}){const{runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:d,allowChannel:p}=e;return await(new z).patch(`/group/${t}`,{body:{runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:d,allowChannel:p},...n}).then(({body:t})=>t)},updateUser:async function(t,e,n={}){const{role:s,available:i}=e,{groupKey:o,...r}=n,a=j.session;return await(new z).patch(`/group/member/${null!=o?o:null==a?void 0:a.groupKey}/${t}`,{body:{objectType:"group",role:s,available:i},...r}).then(({body:t})=>t)},whitelistUsers:async function(t,e={}){const{allow:n=!0,emails:s=["*"],...i}=e;return await(new z).post(`/group/self/${t}`,{body:{allow:n,emails:s},...i}).then(({body:t})=>t)},withGroupName:async function(t,e={}){return await(new z).get(`/group/with/${t}`,e).then(({body:t})=>t)}});async function bt(t,e,n,s={}){const{scopeBoundary:i,scopeKey:o}=e,{filter:r,sort:a=[],first:c,max:h}=n,u={filter:G(r),sort:a.join(";")||void 0,first:c,max:h};return await(new z).withSearchParams(u).get(`/leaderboard/${i}/${o}/${t}`,s).then(({body:t})=>t)}var vt=Object.freeze({__proto__:null,get:async function(t,e,n,s={}){return console.warn("DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead."),await bt(t,e,n,s)},getCount:async function(t,e,n,s={}){const{scopeBoundary:i,scopeKey:o}=e,{filter:r}=n,a={filter:G(r)};return await(new z).withSearchParams(a).get(`/leaderboard/count/${i}/${o}/${t}`,s).then(({body:t})=>t)},list:bt,update:async function(t,e,n,s={}){const{tags:i,allowChannel:o,...r}=s,{scopeBoundary:a,scopeKey:c,userKey:h}=e,u=j.session;return await(new z).post("/leaderboard",{body:{scope:{scopeBoundary:a,scopeKey:c,userKey:null!=h?h:null==u?void 0:u.userKey},collection:t,scores:n,tags:i,allowChannel:o},...r}).then(({body:t})=>t)}});var St=Object.freeze({__proto__:null,connect:async function(){await ct.handshake()},disconnect:async function(t){var e;const n=[ct.disconnect()],s=null==j||null===(e=j.session)||void 0===e?void 0:e.groupKey;s&&n.push((new z).delete(`/presence/group/${s}`,t)),await Promise.allSettled(n)},forGroup:async function(t,e={}){return await(new z).get(`/presence/group/${t}`,e).then(({body:t})=>t)},forWorld:async function(t,e={}){return await(new z).get(`/presence/world/${t}`,e).then(({body:t})=>t)}});var Tt=Object.freeze({__proto__:null,google:async function(t){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").post("/recaptcha/google",{body:{humanKey:t}}).then(({body:t})=>t)}});let Et=function(t){return t.MANY="MANY",t.PROXY="PROXY",t.SINGULAR="SINGULAR",t}({});async function xt(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,ephemeral:c,trackingKey:h,modelContext:u,executionContext:l,allowChannel:d,...p}=n,{WORLD:f}=_,y=j.session,m=r||a,g=Object.assign({},p.headers,m?{"X-Forio-Confirmation":!0}:{}),w=m?{readLock:r,writeLock:a}:void 0;return await(new z).post("/run",{body:{scope:{scopeBoundary:s,scopeKey:i,userKey:s===f?void 0:null!=o?o:null==y?void 0:y.userKey},permit:w,morphology:"MANY",trackingKey:h,modelFile:t,modelContext:u||{},executionContext:l||{},ephemeral:c,allowChannel:d},...p,headers:g}).then(({body:t})=>t)}async function kt(t,e,n={}){const{filter:s,sort:i=[],first:o,max:r,timeout:a,variables:c=[],metadata:h=[],scope:u,groupName:l,episodeName:d,includeEpisodes:p}=e,f=j.session,y=u?`${u.scopeBoundary}/${u.scopeKey}`:`in/${null!=l?l:null==f?void 0:f.groupName}${d?`/${d}`:""}`;let m=s;if(null!=u&&u.userKey){const t=`run.userKey=${u.userKey}`;m=Array.isArray(s)?[...s,t]:"string"==typeof s?s?`${s};${t}`:t:s&&"object"==typeof s?{type:"and",filters:[s,t]}:[t]}const g={filter:G(m),sort:i.join(";")||void 0,var:c.join(";")||void 0,meta:h.join(";")||void 0,first:o,max:r,timeout:a,includeEpisodes:p};return await(new z).withSearchParams(g).get(`/run/${y}/${t}`,{paginated:!0,parsePage:t=>t.map(t=>(t.variables=c.reduce((e,n,s)=>{var i;return e[n]=null===(i=t.variables)||void 0===i?void 0:i[s],e},{}),t)),...n}).then(({body:t})=>t)}async function _t(t,e,n={}){const{timeout:s,ritual:i,ignorable:o,...r}=n,a=Array.isArray(t)&&t.length>1;i!==A.EXORCISE&&a&&console.warn(`Detected ritual: ${i} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`);const c=t=>e.reduce((e,n,s)=>(e[n]=t[s],e),{}),h=a?"":`/${1===t.length?t[0]:t}`,u=e.join(";"),l=a?{runKey:t,include:u,timeout:s}:{ritual:i,include:u,timeout:s},d=o?{ignorable:o}:{};return await(new z).post(`/run/variable${h}`,{body:{...l,...d},...r}).then(({body:t})=>a?Object.keys(t).map(e=>({runKey:e,variables:c(t[e])})):c(t))}var At=Object.freeze({__proto__:null,MORPHOLOGY:Et,action:async function(t,e,n={}){const{timeout:s,ritual:i,...o}=n,r=Array.isArray(t)&&t.length>1,a=r?"":`/${1===t.length?t[0]:t}`,c=r?{runKey:t,timeout:s}:{ritual:i,timeout:s};return i!==A.EXORCISE&&r&&console.warn(`Detected ritual: ${i} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`),await(new z).withSearchParams(c).post(`/run/action${a}`,{body:e,...o}).then(({body:t})=>t)},clone:async function(t,e={}){const{ephemeral:n,trackingKey:s,modelContext:i={},executionContext:o={},...r}=e;return await(new z).post(`/run/clone/${t}`,{body:{trackingKey:s,modelContext:i,executionContext:o,ephemeral:n},...r}).then(({body:t})=>t)},create:xt,createSingular:async function(t,e={}){const{readLock:n,writeLock:s,ephemeral:i,modelContext:o,executionContext:r,...a}=e,c=n||s,h=Object.assign({},a.headers,c?{"X-Forio-Confirmation":!0}:{}),u=c?{readLock:n,writeLock:s}:void 0;return await(new z).post("/run/singular",{body:{modelFile:t,permit:u,modelContext:o||{},executionContext:r||{},ephemeral:i},...a,headers:h}).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/run/${t}`,e).then(({body:t})=>t)},getMetadata:async function(t,e,n={}){const{...s}=n,i=e.join(";"),o=Array.isArray(t)&&t.length>1,r=Array.isArray(t)?t:[t];return await(new z).post("/run/meta",{body:{include:i,runKey:r},...s}).then(({body:t})=>{var e;const n=Object.keys(t).map(e=>({runKey:e,data:t[e]}));return o?n:null==n||null===(e=n[0])||void 0===e?void 0:e.data})},getSingularRunKey:async function(t={}){return await(new z).get("/run/singular/key",t).then(({body:t})=>t)},getVariable:async function(t,e,n={}){const{timeout:s,ritual:i,...o}=n;if(Array.isArray(t)||Array.isArray(e)){return _t(t,Array.isArray(e)?e:[e],n)}return await(new z).withSearchParams({timeout:s,ritual:i}).get(`/run/variable/${t}/${String(e)}`,o).then(({body:t})=>t)},getVariables:_t,getWithStrategy:async function(t,e,n,s={}){if("reuse-across-sessions"===t){const t={scope:n,sort:["-run.created"],max:1},{values:[i]}=await kt(e,t);if(!i){return await xt(e,n,s)}return i}if("reuse-never"===t){return await xt(e,n,s)}throw new d("Invalid run strategy.")},introspect:async function(t,e={}){return await(new z).get(`/run/introspect/model/${t}`,e).then(({body:t})=>t)},introspectWithRunKey:async function(t,e={}){return await(new z).get(`/run/introspect/${t}`,e).then(({body:t})=>t)},migrate:async function(t,e,n={}){const{ephemeral:s,trackingKey:i,modelContext:o={},executionContext:r={},...a}=n;return await(new z).post(`/run/migrate/to/${e}/${t}`,{body:{trackingKey:i,modelContext:o,executionContext:r,ephemeral:s},...a}).then(({body:t})=>t)},operation:async function(t,e,n=[],s={}){const{timeout:i,ritual:o,...r}=s,a=Array.isArray(t)&&t.length>1,c=a?"":`/${1===t.length?t[0]:t}`,h=a?{runKey:t,timeout:i}:{ritual:o,timeout:i};return o!==A.EXORCISE&&a&&console.warn(`Detected ritual: ${o} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`),await(new z).withSearchParams(h).post(`/run/operation${c}`,{body:{name:e,arguments:n,objectType:"execute"},...r}).then(({body:t})=>t)},query:kt,remove:async function(t,e={}){return await(new z).delete(`/run/${t}`,e).then(({body:t})=>t)},removeFromWorld:async function(t,e={}){return await(new z).delete(`/run/world/${t}`,e).then(({body:t})=>t)},restore:async function(t,e={}){const{ephemeral:n,modelContext:s={},executionContext:i={},...o}=e;return await(new z).post(`/run/restore/${t}`,{body:{modelContext:s,executionContext:i,ephemeral:n},...o}).then(({body:t})=>t)},retrieveFromWorld:async function(t,e,n={}){const{readLock:s,writeLock:i,ephemeral:o,trackingKey:r,modelContext:a,executionContext:c,allowChannel:h,...u}=n,l=s||i,d=Object.assign({},u.headers,l?{"X-Forio-Confirmation":!0}:{}),p=l?{readLock:s,writeLock:i}:void 0;return await(new z).post(`/run/world/${t}`,{body:{permit:p,morphology:"MANY",trackingKey:r,modelFile:e,modelContext:a||{},executionContext:c||{},ephemeral:o,allowChannel:h},...u,headers:d}).then(({body:t})=>t)},rewind:async function(t,e,n={}){const{ephemeral:s,modelContext:i={},...o}=n;return await(new z).post(`/run/rewind/${t}`,{body:{rewindCount:e,modelContext:i,ephemeral:s},...o}).then(({body:t})=>t)},update:async function(t,e,n={}){const{readLock:s,writeLock:i,trackingKey:o,marked:r,hidden:a,closed:c,allowChannel:h}=e,u=Array.isArray(t)&&t.length>1,l=u?"":`/${1===t.length?t[0]:t}`,d=s||i?{readLock:s,writeLock:i}:void 0;return await(new z).withSearchParams(u?{runKey:t}:"").patch(`/run${l}`,{body:{permit:d,trackingKey:o,marked:r,hidden:a,closed:c,allowChannel:h},...n}).then(({body:t})=>t)},updateMetadata:async function(t,e,n={}){const{timeout:s,...i}=n,o=Array.isArray(t)&&t.length>1,r=o?"":`/${1===t.length?t[0]:t}`,a=o?{runKey:t,timeout:s}:{timeout:s};return await(new z).withSearchParams(a).patch(`/run/meta${r}`,{body:e,...i}).then(({body:t})=>t)},updateVariables:async function(t,e,n={}){const{timeout:s,ritual:i,...o}=n,r=Array.isArray(t)&&t.length>1,a=r?"":`/${1===t.length?t[0]:t}`,c=r?{runKey:t,timeout:s}:{ritual:i,timeout:s};return i!==A.EXORCISE&&r&&console.warn(`Detected ritual: ${i} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`),await(new z).withSearchParams(c).patch(`/run/variable${a}`,{body:e,...o}).then(({body:t})=>t)}});var Nt=Object.freeze({__proto__:null,createUser:async function(t,e={}){return await(new z).post("/user",{body:t,...e}).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/user/${t}`,e).then(({body:t})=>t)},getWithHandle:async function(t,e={}){const{modality:n,...s}=e,i=n?`/${n}`:"";return await(new z).get(`/user/with/${t}${i}`,s).then(({body:t})=>t)},uploadCSV:async function(t,e={}){const{overwrite:n,...s}=e,i=new FormData;return i.append("file",t),await(new z).withSearchParams({overwrite:n}).post("/user/upload",{body:i,...s}).then(({body:t})=>t)}});async function $t(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,items:c,ttlSeconds:h,mutationStrategy:u="ERROR",allowChannel:l,...d}=n,{WORLD:p}=_,{PARTICIPANT:f,USER:y}=$,m=s===p?f:y,g={mutationStrategy:u};return await(new z).withSearchParams(g).post(`/vault/${t}`,{body:{scope:{scopeBoundary:s,scopeKey:i,userKey:o},permit:{readLock:r||m,writeLock:a||m},ttlSeconds:h,items:c,allowChannel:l},...d}).then(({body:t})=>t)}var Rt=Object.freeze({__proto__:null,byName:async function(t,e={}){const{groupName:n,episodeName:s,userKey:i,includeEpisodes:o,...r}=e,a=j.session,c={userKey:i,includeEpisodes:o};return await(new z).withSearchParams(c).get(`/vault/in/${null!=n?n:null==a?void 0:a.groupName}${s?`/${s}`:""}/${t}`,{...r}).then(({body:t})=>t)},count:async function(t,e={}){const{first:n,filter:s,max:i}=t,o={filter:G(s),first:n,max:i},{groupName:r,...a}=e;return(new z).withSearchParams(o).get("/vault/count"+(r?`/${r}`:""),a).then(({body:t})=>t)},create:async function(t,e,n,s={}){return console.warn("DEPRECATION WARNING: vaultAdapter.create is deprecated and will be removed with the next release. Use vaultAdapter.define instead."),await $t(t,e,{items:n,...s})},define:$t,get:async function(t,e={}){return await(new z).get(`/vault/${t}`,e).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},list:async function(t,e={}){const{first:n,filter:s,max:i}=t,o={filter:G(s),first:n,max:i},{groupName:r,...a}=e;return(new z).withSearchParams(o).get("/vault/search"+(r?`/${r}`:""),a).then(({body:t})=>t)},remove:async function(t,e={}){const{mutationKey:n,...s}=e;return await(new z).withSearchParams({mutationKey:n}).delete(`/vault/${t}`,s).then(({body:t})=>t)},update:async function(t,e,n={}){var s,i,o;const{mutationKey:r,...a}=n;return await(new z).withSearchParams({mutationKey:r}).put(`/vault/${t}`,{body:{set:null!==(s=e.set)&&void 0!==s?s:{},push:null!==(i=e.push)&&void 0!==i?i:{},pop:null!==(o=e.pop)&&void 0!==o?o:{}},...a}).then(({body:t})=>t)},updateProperties:async function(t,e,n={}){return await(new z).patch(`/vault/${t}`,{body:{...e},...n}).then(({body:t})=>t)},withScope:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,r=o?`/${o}`:"";return await(new z).get(`/vault/with/${s}/${i}${r}/${t}`,n).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});async function Pt(t,e,n={}){return await(new z).get(`/video/url/${e}/${t}`,n).then(({body:t})=>t)}async function Ot(t,e,n,s,i={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=s,c=a?`/${a}`:"";return await(new z).get(`/video/url/with/${o}/${r}${c}/${n}/${e}/${t}`,i).then(({body:t})=>t)}async function Ct(t,e={}){return await(new z).get(`/video/dir/${t}`,e).then(({body:t})=>t)}async function It(t,e,n,s={}){const{scopeBoundary:i,scopeKey:o,userKey:r}=n,a=r?`/${r}`:"";return await(new z).get(`/video/dir/with/${i}/${o}${a}/${e}/${t}`,s).then(({body:t})=>t)}async function jt(t={}){return await(new z).get("/video/search",t).then(({body:t})=>t)}async function Lt(t,e={}){return await(new z).delete(`/video/${t}`,e).then(({body:t})=>t)}async function Mt(t,e,n={}){return await(new z).post(`/video/execute/${t}`,{body:e,...n}).then(({body:t})=>t)}async function Ut(t,e,n={}){return await(new z).get(`/video/download/${e}/${t}`,n).then(({body:t})=>t)}async function Dt(t,e,n,s,i={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=s,c=a?`/${a}`:"";return await(new z).get(`/video/download/with/${o}/${r}${c}/${n}/${e}/${t}`,i).then(({body:t})=>t)}var Bt=Object.freeze({__proto__:null,AFFILIATE:{VONAGE:"VONAGE",DAILY:"DAILY",DOMESTIC:"DOMESTIC"},LANGUAGE_CODE:{"af-ZA":"af-ZA","ar-AE":"ar-AE","ar-SA":"ar-SA","cy-GB":"cy-GB","da-DK":"da-DK","de-CH":"de-CH","de-DE":"de-DE","en-AB":"en-AB","en-AU":"en-AU","en-GB":"en-GB","en-IE":"en-IE","en-IN":"en-IN","en-US":"en-US","en-WL":"en-WL","es-ES":"es-ES","es-US":"es-US","fa-IR":"fa-IR","fr-CA":"fr-CA","fr-FR":"fr-FR","ga-IE":"ga-IE","gd-GB":"gd-GB","he-IL":"he-IL","hi-IN":"hi-IN","id-ID":"id-ID","it-IT":"it-IT","ja-JP":"ja-JP","ko-KR":"ko-KR","nl-NL":"nl-NL","pt-BR":"pt-BR","pt-PT":"pt-PT","ru-RU":"ru-RU","ta-IN":"ta-IN","te-IN":"te-IN","tr-TR":"tr-TR","zh-CN":"zh-CN","zh-TW":"zh-TW","th-TH":"th-TH","en-ZA":"en-ZA","en-NZ":"en-NZ"},MEDIA_FORMAT:{mp3:"mp3",mp4:"mp4",wav:"wav",flac:"flac",ogg:"ogg",amr:"amr",webm:"webm"},deleteVideoByKey:Lt,downloadVideoByKey:Ut,downloadVideoWith:Dt,getVideoDirectoryByKey:Ct,getVideoDirectoryWith:It,getVideoSearch:jt,getVideoURLByKey:Pt,getVideoURLWith:Ot,postVideoProcessor:Mt});async function Kt(t,e={}){const{scope:n,affiliate:s,family:i,videoKey:o,...r}=e;if(n&&i&&s)return Ot(t,i,s,n,r);if(o)return Pt(t,o,r);throw new d("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}async function Wt(t={}){const{scope:e,affiliate:n,family:s,videoKey:i,...o}=t;if(e&&s&&n)return It(s,n,e,o);if(i)return Ct(i,o);throw new d("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}var zt=Object.freeze({__proto__:null,download:async function(t,e={}){const{scope:n,affiliate:s,family:i,videoKey:o,...r}=e;if(n&&i&&s)return Dt(t,i,s,n,r);if(o)return Ut(t,o,r);throw new d("Cannot download video -- either a video key or scope/affiliate/family specification is required.")},getDirectoryURL:Wt,getURL:Kt,processVideo:async function(t,e,n={}){const{log:s,...i}=n;return Mt(t,{processors:e,log:s},i)},query:async function(t,e={}){const{filter:n,sort:s=[],first:i,max:o}=t;return jt({query:{filter:G(n),sort:s.join(";")||void 0,first:i,max:o},paginated:!0,...e})},remove:async function(t,e={}){return Lt(t,e)}});async function Ft(t={}){return await(new z).get("/vonage/session",t).then(({body:t})=>t)}async function Ht(t,e={}){return await(new z).post("/vonage/token",{body:{...t,initialLayoutClassList:["placeholder"]},...e}).then(({body:t})=>t)}async function qt(t,e={}){return await(new z).post("/vonage/archive",{body:t,...e}).then(({body:t})=>t)}async function Gt(t={}){return await(new z).get("/vonage/info",t).then(({body:t})=>t)}async function Vt(t,e={}){return await(new z).delete(`/vonage/archive/${t}`,e).then(({body:t})=>t)}var Jt=Object.freeze({__proto__:null,deleteArchiveByID:Vt,getInfo:Gt,getSession:Ft,postArchive:qt,postToken:Ht});var Yt=Object.freeze({__proto__:null,createSession:async function(t={}){return Ft(t)},generateToken:async function(t,e={}){return(await Ht({sessionId:t},e)).token},getProjectID:async function(t={}){return(await Gt(t)).apiKey},startArchive:async function(t,e,n,s={}){const{readLock:i,writeLock:o,ttlSeconds:r,resolution:a,...c}=s,{PARTICIPANT:h,USER:u}=$,l=n.userKey?u:h;return qt({name:t,sessionId:e,scope:n,permit:{readLock:null!=i?i:l,writeLock:null!=o?o:l},ttlSeconds:r,resolution:a},c)},stopArchive:async function(t,e={}){return Vt(t,e)}});const Xt={MINIMUM:"MINIMUM",MAXIMUM:"MAXIMUM",MARGINAL:"MARGINAL",OPTIMAL:"OPTIMAL"};var Zt=Object.freeze({__proto__:null,OBJECTIVE:Xt,WORLD_NAME_GENERATOR_TYPE:{colorAnimal:"colorAnimal",sequential:"sequential"},assignRun:async function(t,e,n={}){return await(new z).patch(`/world/run/${t}`,{body:{runKey:e},...n}).then(({body:t})=>t)},autoAssignUsers:async function(t,e={}){const{groupName:n,episodeName:s,objective:i=Xt.MINIMUM,requireAllAssignments:o,worldNameGenerator:r,keepEmptyWorlds:a,populace:c,allowChannel:h,...u}=e,l=j.session;return await(new z).post(`/world/assignment/${null!=n?n:null==l?void 0:l.groupName}${s?`/${s}`:""}`,{body:{assignments:t,objective:i,requireAllAssignments:o,worldNameGenerator:r,keepEmptyWorlds:a,populace:c,allowChannel:h},...u}).then(({body:t})=>t)},create:async function(t={}){const{name:e,displayName:n,groupName:s,episodeName:i,worldNameGenerator:o,allowChannel:r,...a}=t,c=j.session;return await(new z).post(`/world/${null!=s?s:null==c?void 0:c.groupName}${i?`/${i}`:""}`,{body:{name:e,worldNameGenerator:o,displayName:n,allowChannel:r},...a}).then(({body:t})=>t)},destroy:async function(t,e={}){return await(new z).delete(`/world/${t}`,e).then(({body:t})=>t)},editAssignments:async function(t,e={}){const{groupName:n,episodeName:s,objective:i=Xt.MINIMUM,requireAllAssignments:o,keepEmptyWorlds:r,...a}=e,c=j.session;return await(new z).put(`/world/assignment/${null!=n?n:null==c?void 0:c.groupName}${s?`/${s}`:""}`,{body:{assignments:t,objective:i,requireAllAssignments:o,keepEmptyWorlds:r},...a}).then(({body:t})=>t)},get:async function(t={}){const{groupName:e,episodeName:n,mine:s,...i}=t,o=j.session;return await(new z).withSearchParams({mine:s}).get(`/world/${null!=e?e:null==o?void 0:o.groupName}${n?`/${n}`:""}`,i).then(({body:t})=>t)},getAssignments:async function(t={}){const{groupName:e,episodeName:n,mine:s,...i}=t,o=j.session;return await(new z).withSearchParams({mine:s}).get(`/world/assignment/for/${null!=e?e:null==o?void 0:o.groupName}${n?`/${n}`:""}`,i).then(({body:t})=>t)},getAssignmentsByKey:async function(t,e={}){return await(new z).get(`/world/assignment/${t}`,e).then(({body:t})=>t)},getPersonas:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t,i=n||_.PROJECT,o=`${i===_.WORLD?"":`/${i.toLowerCase()}`}${i===_.PROJECT?"":`/${s}`}`;return await(new z).get(`/world/persona${o}`,{...e}).then(({body:t})=>t)},getSessionWorlds:async function(t={}){return await(new z).get("/world/assignment",t).then(({body:t})=>t)},removeUsers:async function(t,e={}){const{groupName:n,episodeName:s,keepEmptyWorlds:i,...o}=e,r=j.session;return await(new z).withSearchParams({userKey:t,keepEmptyWorlds:Boolean(i)}).delete(`/world/assignment/${null!=n?n:null==r?void 0:r.groupName}${s?`/${s}`:""}`,o).then(({body:t})=>t)},selfAssign:async function(t={}){const{role:e,groupName:n,episodeName:s,objective:i=Xt.MINIMUM,worldNameGenerator:o,populace:r,allowChannel:a,...c}=t,h=j.session;return await(new z).post(`/world/selfassign/${null!=n?n:null==h?void 0:h.groupName}${s?`/${s}`:""}`,{body:{role:e,objective:i,worldNameGenerator:o,populace:r,allowChannel:a},...c}).then(({body:t})=>t)},setPersonas:async function(t,e,n={}){const s=(null==e?void 0:e.scopeBoundary)||_.PROJECT,i=`${s===_.WORLD?"":`/${s.toLowerCase()}`}${s===_.PROJECT?"":`/${null==e?void 0:e.scopeKey}`}`;return await(new z).put(`/world/persona${i}`,{body:t,...n}).then(({body:t})=>t)},update:async function(t,e,n={}){const{displayName:s,runKey:i,allowChannel:o}=e;return await(new z).patch(`/world/${t}`,{body:{displayName:s,runKey:i,allowChannel:o},...n}).then(({body:t})=>t)}});var Qt=Object.freeze({__proto__:null,get:async function(t={}){return await(new z).get("/time",t).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});let te=function(t){return t.DO_NOTHING="DO_NOTHING",t.RESCHEDULE="RESCHEDULE",t.FIRE_ON_FAIL_SAFE="FIRE_ON_FAIL_SAFE",t}({});var ee=Object.freeze({__proto__:null,RETRY_POLICY:te,create:async function(t,e,n,s,i={}){const{retryPolicy:o,failSafeTermination:r,ttlSeconds:a,...c}=i;return await(new z).post("/task",{body:{payload:{objectType:"http",...n},trigger:s,retryPolicy:o,failSafeTermination:r,ttlSeconds:a,scope:t,name:e},...c}).then(({body:t})=>t)},destroy:async function(t,e={}){return await(new z).delete(`/task/${t}`,e).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/task/${t}`,e).then(({body:t})=>t)},getHistory:async function(t,e={}){return await(new z).get(`/task/history/${t}`,e).then(({body:t})=>t)},getTaskIn:async function(t,e={}){const{scopeBoundary:n,scopeKey:s,userKey:i}=t;return await(new z).get(`/task/in/${n}/${s}${i?`/${i}`:""}`,e).then(({body:t})=>t)}});var ne=Object.freeze({__proto__:null,create:async function(t,e,n,s={}){return(new z).post("/chat",{body:{scope:{scopeBoundary:e.scopeBoundary,scopeKey:e.scopeKey},permit:n,room:t},...s}).then(({body:t})=>t)},get:async function(t,e={}){return(new z).get(`/chat/${t}`,e).then(({body:t})=>t)},getMessages:async function(t,e={}){const{maxRecords:n,horizon:s,...i}=e;return(new z).withSearchParams({maxRecords:n,horizon:s}).get(`/chat/message/${t}`,i).then(({body:t})=>t)},getMessagesAdmin:async function(t,e={}){const{maxRecords:n,horizon:s,...i}=e;return(new z).withSearchParams({maxRecords:n,horizon:s}).get(`/chat/message/all/${t}`,i).then(({body:t})=>t)},getMessagesForUser:async function(t,e,n={}){const{maxRecords:s,horizon:i,...o}=n;return(new z).withSearchParams({maxRecords:s,horizon:i}).get(`/chat/message/${t}/${e}`,o).then(({body:t})=>t)},query:async function(t,e={}){const{filter:n,sort:s=[],first:i=0,max:o}=t,r={filter:G(n),sort:s.join(";")||void 0,first:i,max:o};return await(new z).withSearchParams(r).get("/chat/search",{paginated:!0,...e}).then(({body:t})=>t)},sendMessage:async function(t,e,n={}){const{userKey:s,...i}=n,o=s?`/${s}`:"";return(new z).put(`/chat/message/${t}${o}`,{body:{message:e},...i}).then(({body:t})=>t)},sendMessageAdmin:async function(t,e,n={}){const{userKey:s,...i}=n,o=s?`/${s}`:"";return(new z).put(`/chat/message/system/${t}${o}`,{body:{message:e},...i}).then(({body:t})=>t)},updatePermit:async function(t,e,n={}){return(new z).patch(`/chat/${t}`,{...n,body:{permit:e}}).then(({body:t})=>t)}});var se=Object.freeze({__proto__:null,collectInGroup:async function(t,e,n={}){const{episodeName:s,...i}=n;return await(new z).post(`/consensus/in/${e}${s?`/${s}`:""}`,{body:t,...i}).then(({body:t})=>t)},create:async function(t,e,n,s,i,o={}){const{ttlSeconds:r,transparent:a=!1,allowChannel:c,...h}=o;return await(new z).post(`/consensus/${t}/${e}/${n}`,{body:{expectedRoles:s,ttlSeconds:r,transparent:a,actions:i,allowChannel:c},...h}).then(({body:t})=>t)},deleteAll:async function(t,e,n={}){const{...s}=n;return await(new z).delete(`/consensus/${t}/${e}`,{...s}).then(({body:t})=>t)},deleteBarrier:async function(t,e,n,s={}){const{...i}=s;return await(new z).delete(`/consensus/${t}/${e}/${n}`,{...i}).then(({body:t})=>t)},forceClose:async function(t,e,n,s={}){const{ritual:i,...o}=s;return await(new z).post(`/consensus/close/${t}/${e}/${n}`,{body:{ritual:i},...o}).then(({body:t})=>t)},list:async function(t,e,n={}){return await(new z).get(`/consensus/${t}/${e}`,n).then(({body:t})=>t)},load:async function(t,e,n,s={}){return await(new z).get(`/consensus/${t}/${e}/${n}`,s).then(({body:t})=>t)},pause:async function(t,e,n,s={}){return await(new z).patch(`/consensus/pause/${t}/${e}/${n}`,{body:{resume:!1},...s}).then(({body:t})=>t)},removeRoleExpectationFor:async function(t,e,n,s,i={}){return await(new z).delete(`/consensus/expectation/${t}/${e}/${n}/${s}`,i).then(({body:t})=>t)},resume:async function(t,e,n,s={}){return await(new z).patch(`/consensus/pause/${t}/${e}/${n}`,{body:{resume:!0},...s}).then(({body:t})=>t)},submitActions:async function(t,e,n,s,i={}){const{message:o,ritual:r,...a}=i;return await(new z).post(`/consensus/publish/${t}/${e}/${n}`,{body:{ritual:r,actions:s,message:o},...a}).then(({body:t})=>t)},triggerFor:async function(t,e,n,s,i,o={}){const{ritual:r,message:a,...c}=o;return await(new z).post(`/consensus/trigger/${t}/${e}/${n}`,{body:{ritual:r,userKey:s,message:a,actions:i},...c}).then(({body:t})=>t)},undoSubmit:async function(t,e,n,s={}){const{...i}=s;return await(new z).delete(`/consensus/arrival/${t}/${e}/${n}`,{...i}).then(({body:t})=>t)},undoSubmitFor:async function(t,e,n,s,i={}){const{...o}=i;return await(new z).delete(`/consensus/untrigger/${t}/${e}/${n}/${s}`,{...o}).then(({body:t})=>t)},updateDefaults:async function(t,e,n,s,i={}){const{...o}=i;return await(new z).patch(`/consensus/actions/${t}/${e}/${n}`,{body:{actions:s},...o}).then(({body:t})=>t)}});var ie=Object.freeze({__proto__:null,byEmail:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i}=e;return await(new z).get(`/somebody/with/${s}/${i}/${t}`,n).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},create:async function(t,e,n={}){const{givenName:s,familyName:i,...o}=n;return await(new z).post("/somebody",{body:{email:t,givenName:s,familyName:i,scope:e},...o}).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/somebody/${t}`,e).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},inScope:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t,{first:i,max:o,...r}=e,a={first:i,max:o};return await(new z).withSearchParams(a).get(`/somebody/in/${n}/${s}`,{paginated:!0,...r}).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});var oe=Object.freeze({__proto__:null,addUser:async function(t,e={}){const{accountShortName:n,projectShortName:s,server:i}=e;return await(new z).withServer(i).withAccountShortName(n).withProjectShortName(s).patch("/matchmaker/udome",{body:{udomeKey:t}}).then(({body:t})=>t)},byName:async function(t,e,n={}){const{accountShortName:s,projectShortName:i,server:o}=n,{scopeBoundary:r,scopeKey:a}=e;return await(new z).withServer(o).withAccountShortName(s).withProjectShortName(i).get(`/matchmaker/udome/${r}/${a}/${t}`).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},create:async function(t,e,n,s={}){const{accountShortName:i,projectShortName:o,server:r}=s;return await(new z).withServer(r).withAccountShortName(i).withProjectShortName(o).post(`/matchmaker/udome/${t}`,{body:{scope:n,partners:e}}).then(({body:t})=>t)},edit:async function(t,e,n={}){const{accountShortName:s,projectShortName:i,server:o}=n;return await(new z).withServer(o).withAccountShortName(s).withProjectShortName(i).put(`/matchmaker/udome/${t}`,{body:{closed:e}}).then(({body:t})=>t)},get:async function(t,e={}){const{accountShortName:n,projectShortName:s,server:i}=e;return await(new z).withServer(i).withAccountShortName(n).withProjectShortName(s).get(`/matchmaker/udome/${t}`).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});const re=[[6e3,1e4],[11e3,2e4],[3e4,45e3]];async function ae(t,e=0){let n;try{n=await t()}catch(i){if(!(i instanceof p&&429===i.status&&e<=re.length))throw i;{const[i,o]=re[e];await(s=((t,e)=>t+Math.random()*(e-t))(i,o),new Promise(t=>setTimeout(t,s))),n=await ae(t,e+1)}}var s;return n}var ce=Object.freeze({__proto__:null,createRoom:async function(t,e={}){const{readLock:n,writeLock:s,ttlSeconds:i,privacy:o,exp:r,enable_recording:a,streaming_endpoints:c,disableRateLimitHandling:h,...u}=e,{PARTICIPANT:l}=$;return ae(async()=>await(new z).post("/daily/v1/room",{body:{epicenter:{ttlSeconds:i,scope:t,permit:{readLock:n||l,writeLock:s||l}},properties:{exp:r,enable_recording:a,streaming_endpoints:c},privacy:o},...u}).then(({body:t})=>t),h?re.length+1:0)},createToken:async function(t,e={}){const{start_video_off:n,is_owner:s,user_name:i,close_tab_on_exit:o,exp:r,enable_recording:a,disableRateLimitHandling:c,selfSign:h=!0,...u}=e;return ae(async()=>await(new z).withSearchParams({selfSign:h}).post("/daily/v1/meetingToken",{body:{properties:{room_name:t,start_video_off:n,is_owner:s,user_name:i,close_tab_on_exit:o,exp:r,enable_recording:a}},...u}).then(({body:t})=>t),c?re.length+1:0)},getConfig:async function(t={}){return await(new z).get("/daily/v1",t).then(({body:t})=>t)},getVideoByRecordingId:async function(t,e,n,s={}){const i=(await Wt({scope:n,affiliate:"DAILY",family:t,...s})).contents;if(null==i||!i.length)return null;i.sort((t,e)=>Number(e.split(".")[0])-Number(t.split(".")[0]));const o=i.find(t=>t.includes(e)&&t.includes(".mp4"));return o?await Kt(o,{scope:n,affiliate:"DAILY",family:t,...s}):null},updateRecordingStatus:async function(t,e={}){return await(new z).delete(`/daily/v1/meetingToken/${t}`,e).then(({body:t})=>t)}});var he=Object.freeze({__proto__:null,get:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t;let{userKey:i}=t;const o=j.session;return null!=i||(i=null==o?void 0:o.userKey),await(new z).get(`/wallet/${n}/${s}/${i}`,e).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},update:async function(t,e,n={}){var s;const i=j.session;return null!==(s=t.userKey)&&void 0!==s||(t.userKey=null==i?void 0:i.userKey),await(new z).post("/wallet",{body:{items:e,scope:t},...n}).then(({body:t})=>t)},withScope:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t,{first:i=0,max:o,...r}=e;return await(new z).withSearchParams({first:i,max:o}).get(`/wallet/with/${n}/${s}`,{paginated:!0,...r}).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});var ue=Object.freeze({__proto__:null,parseFilterInput:G,proxy:async(t,e)=>{const{accountShortName:n,projectShortName:s,isLocal:i}=R;let o=g("/",t);return i()||(o=`/proxy/${n}/${s}${o}`),l(o,e)}});const le={};function de(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function pe(t,e,n){return t.set(ye(t,e),n),n}function fe(t,e){return t.get(ye(t,e))}function ye(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}le.cometdReconnected=L.registerHandler(t=>"COMETD_RECONNECTED"===t.code,async t=>{y()&&console.warn('Cometd Reconnected. If you wish to react to this reconnection, register an error handler with identifier: error.code === "COMETD_RECONNECTED".',t)}),le.cometdError=L.registerHandler(t=>403===t.status&&"COMETD_ERROR"===t.code,async(t,e)=>(console.warn("Cometd error. Attempting to reconnect.",t),await ct.disconnect(),await e())),le.authExpired=L.registerHandler(t=>401===t.status&&"AUTHENTICATION_EXPIRED"===t.code,async t=>{throw await ht(),y()&&alert("Session token has expired, try logging in again."),t}),le.authGroupExpired=L.registerHandler(t=>401===t.status&&"AUTHENTICATION_GROUP_EXPIRED"===t.code,async t=>{throw y()&&alert("This group has expired. Try logging into a different group"),t}),le.authInvalidated=L.registerHandler(t=>401===t.status&&"AUTHENTICATION_INVALIDATED"===t.code,async(t,e)=>{try{var n;const t=j.session;if("admin"===(null==t?void 0:t.objectType))throw new d("Unhandled error: admin session was somehow invalidated");const s=null!==(n=null==t?void 0:t.groupKey)&&void 0!==n?n:"";return await ut(s,{objectType:"user",inert:!0}),await e()}catch(e){throw await ht(),t}}),Object.freeze(le);var me=new WeakMap,ge=new WeakMap;class we{constructor(){de(this,me,[]),de(this,ge,{})}getTransportTypes(){return fe(me,this).slice(0)}add(t,e,n){let s=!1;for(let e=0;e<fe(me,this).length;++e)if(fe(me,this)[e]===t){s=!0;break}return s||("number"!=typeof n?fe(me,this).push(t):fe(me,this).splice(n,0,t),fe(ge,this)[t]=e),!s}find(t){for(let e=0;e<fe(me,this).length;++e)if(fe(me,this)[e]===t)return fe(ge,this)[t];return null}negotiateTransport(t,e,n,s){for(let i=0;i<fe(me,this).length;++i){const o=fe(me,this)[i];for(let i=0;i<t.length;++i)if(o===t[i]){const t=fe(ge,this)[o];if(!0===t.accept(e,n,s))return t}}return null}clear(){pe(me,this,[]),pe(ge,this,{})}reset(t){for(let e=0;e<fe(me,this).length;++e)fe(ge,this)[fe(me,this)[e]].reset(t)}findTransportTypes(t,e,n){const s=[];for(let i=0;i<fe(me,this).length;++i){const o=fe(me,this)[i];!0===fe(ge,this)[o].accept(t,e,n)&&s.push(o)}return s}remove(t){for(let e=0;e<fe(me,this).length;++e)if(fe(me,this)[e]===t){fe(me,this).splice(e,1);const n=fe(ge,this)[t];return delete fe(ge,this)[t],n}return null}}function be(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function ve(t,e){return t.get(Te(t,e))}function Se(t,e,n){return t.set(Te(t,e),n),n}function Te(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ee=new WeakMap,xe=new WeakMap,ke=new WeakMap;class _e{constructor(){be(this,Ee,void 0),be(this,xe,void 0),be(this,ke,void 0)}registered(t,e){Se(Ee,this,t),Se(xe,this,e)}unregistered(){Se(Ee,this,null),Se(xe,this,null)}get cometd(){return ve(xe,this)}notifyTransportTimeout(t){const e=this.cometd._getTransportListeners("timeout");if(e)for(let n=0;n<e.length;++n){const s=e[n];try{const e=s.call(this,t);if("number"==typeof e&&e>0)return e}catch(t){this.cometd._info("Exception during execution of transport listener",s,t)}}return 0}debug(){this.cometd._debug.apply(this.cometd,arguments)}get configuration(){return this.cometd.getConfiguration()}get advice(){return this.cometd.getAdvice()}setTimeout(t,e){return this.cometd.setTimeout(t,e)}clearTimeout(t){this.cometd.clearTimeout(t)}convertToJSON(t){const e=this.configuration.maxSendBayeuxMessageSize;let n="[";for(let s=0;s<t.length;++s){s>0&&(n+=",");const i=t[s],o=JSON.stringify(i);if(o.length>e)throw new Error("maxSendBayeuxMessageSize "+e+" exceeded");n+=o}return n+="]",n}convertToMessages(t){if(null==t)return[];if("string"==typeof t||t instanceof String)try{return JSON.parse(t)}catch(e){throw this.debug("Could not convert to JSON the following string:",t),e}if(Array.isArray(t))return t;if(t instanceof Object)return[t];throw new Error("Conversion Error "+t+", typeof "+typeof t)}accept(t,e,n){throw new Error("Abstract")}get type(){return ve(Ee,this)}get url(){return ve(ke,this)}set url(t){Se(ke,this,t)}send(t,e){throw new Error("Abstract")}reset(t){this.debug("Transport",this.type,"reset",t?"initial":"retry")}abort(){this.debug("Transport",this.type,"aborted")}toString(){return this.type}}function Ae(t,e,n){Ne(t,e),e.set(t,n)}function Ne(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $e(t,e,n){return t.set(Pe(t,e),n),n}function Re(t,e){return t.get(Pe(t,e))}function Pe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Oe=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,je=new WeakMap,Le=new WeakSet;class Me extends _e{constructor(...t){var e,n;super(...t),Ne(e=this,n=Le),n.add(e),Ae(this,Oe,0),Ae(this,Ce,null),Ae(this,Ie,[]),Ae(this,je,[])}complete(t,e,n){n?Pe(Le,this,We).call(this,t):Pe(Le,this,ze).call(this,t,e)}transportSend(t,e){throw new Error("Abstract")}transportSuccess(t,e,n){e.expired||(this.clearTimeout(e.timeout),this.debug("Transport",this.type,"cancelled waiting for message replies"),this.complete(e,!0,e.metaConnect),n&&n.length>0?t.onSuccess(n):t.onFailure(e.xhr,t.messages,{httpCode:204}))}transportFailure(t,e,n){e.expired||(this.clearTimeout(e.timeout),this.debug("Transport",this.type,"cancelled waiting for failed message replies"),this.complete(e,!1,e.metaConnect),t.onFailure(e.xhr,t.messages,n))}send(t,e){e?Pe(Le,this,Fe).call(this,t):Pe(Le,this,Ke).call(this,t)}abort(){super.abort();for(let t=0;t<Re(Ie,this).length;++t){const e=Re(Ie,this)[t];e&&(this.debug("Aborting request",e),this.abortXHR(e.xhr)||this.transportFailure(e.envelope,e,{reason:"abort"}))}const t=Re(Ce,this);t&&(this.debug("Aborting /meta/connect request",t),this.abortXHR(t.xhr)||this.transportFailure(t.envelope,t,{reason:"abort"})),this.reset(!0)}reset(t){super.reset(t),$e(Ce,this,null),$e(Ie,this,[]),$e(je,this,[])}abortXHR(t){if(t)try{const e=t.readyState;return t.abort(),e!==window.XMLHttpRequest.UNSENT}catch(t){this.debug(t)}return!1}xhrStatus(t){if(t)try{return t.status}catch(t){this.debug(t)}return-1}}function Ue(t){for(;Re(je,this).length>0;){const e=Re(je,this)[0],n=e[0],s=e[1];if(n.url!==t.url||n.sync!==t.sync)break;Re(je,this).shift(),t.messages=t.messages.concat(n.messages),this.debug("Coalesced",n.messages.length,"messages from request",s.id)}}function De(t,e,n){const s=this.notifyTransportTimeout(t.messages);if(s>0)this.debug("Transport",this.type,"extended waiting for message replies of request",e.id,":",s,"ms"),e.timeout=this.setTimeout(()=>{Pe(Le,this,De).call(this,t,e,n+s)},s);else{e.expired=!0;const s="Transport "+this+" expired waiting for message replies of request "+e.id+": "+n+" ms",i={reason:s},o=e.xhr;i.httpCode=this.xhrStatus(o),this.abortXHR(o),this.debug(s),this.complete(e,!1,e.metaConnect),t.onFailure(o,t.messages,i)}}function Be(t,e){if(this.transportSend(t,e)&&(e.expired=!1,!t.sync)){let n=this.configuration.maxNetworkDelay;!0===e.metaConnect&&(n+=this.advice.timeout),this.debug("Transport",this.type,"started waiting for message replies of request",e.id,":",n,"ms"),e.timeout=this.setTimeout(()=>{Pe(Le,this,De).call(this,t,e,n)},n)}}function Ke(t){var e;const n=$e(Oe,this,(e=Re(Oe,this),++e)),s={id:n,metaConnect:!1,envelope:t};Re(Ie,this).length<this.configuration.maxConnections-1?(Re(Ie,this).push(s),Pe(Le,this,Be).call(this,t,s)):(this.debug("Transport",this.type,"queueing request",n,"envelope",t),Re(je,this).push([t,s]))}function We(t){const e=t.id;if(this.debug("Transport",this.type,"/meta/connect complete, request",e),null!==Re(Ce,this)&&Re(Ce,this).id!==e)throw new Error("/meta/connect request mismatch, completing request "+e);$e(Ce,this,null)}function ze(t,e){const n=Re(Ie,this).indexOf(t);if(n>=0&&Re(Ie,this).splice(n,1),Re(je,this).length>0){const n=Re(je,this).shift(),s=n[0],i=n[1];this.debug("Transport dequeued request",i.id),e?(this.configuration.autoBatch&&Pe(Le,this,Ue).call(this,s),Pe(Le,this,Ke).call(this,s),this.debug("Transport",this.type,"completed request",t.id,s)):this.setTimeout(()=>{this.complete(i,!1,i.metaConnect);const t={reason:"Previous request failed"},e=i.xhr;t.httpCode=this.xhrStatus(e),s.onFailure(e,s.messages,t)},0)}}function Fe(t){var e;if(null!==Re(Ce,this))throw new Error("Concurrent /meta/connect requests not allowed, request id="+Re(Ce,this).id+" not yet completed");const n=$e(Oe,this,(e=Re(Oe,this),++e));this.debug("Transport",this.type,"/meta/connect send, request",n,"envelope",t);const s={id:n,metaConnect:!0,envelope:t};Pe(Le,this,Be).call(this,t,s),$e(Ce,this,s)}function He(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function qe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ge=new WeakMap;class Ve extends Me{constructor(...t){super(...t),He(this,Ge,0)}accept(t,e,n){return!0}jsonpSend(t){var e,n;const s=window.document.getElementsByTagName("head")[0],i=window.document.createElement("script"),o="_cometd_jsonp_"+(function(t,e,n){t.set(qe(t,e),n)}(Ge,this,(a=this,e=(r=Ge).get(qe(r,a)),n=e++,e)),n);var r,a;window[o]=e=>{s.removeChild(i),delete window[o],t.onSuccess(e)};let c=t.url;c+=c.indexOf("?")<0?"?":"&",c+="jsonp="+o,c+="&message="+encodeURIComponent(t.body),i.src=c,i.async=!0!==t.sync,i.type="text/javascript",i.onerror=e=>{t.onError("jsonp "+e.type)},s.appendChild(i)}transportSend(t,e){let n=0,s=t.messages.length;const i=[];for(;s>0;){const o=JSON.stringify(t.messages.slice(n,n+s)),r=t.url.length+encodeURI(o).length,a=this.configuration.maxURILength;if(r>a){if(1===s){const n="Bayeux message too big ("+r+" bytes, max is "+a+") for transport "+this;return this.setTimeout(()=>this.transportFailure(t,e,{exception:n}),0),!1}--s}else i.push(s),n+=s,s=t.messages.length-n}let o=t;if(i.length>1){let n=0,s=i[0];this.debug("Transport",this.type,"split",t.messages.length,"messages into",i.join(" + ")),o=this.cometd._mixin(!1,{},t),o.messages=t.messages.slice(n,s),o.onSuccess=t.onSuccess,o.onFailure=t.onFailure;for(let o=1;o<i.length;++o){const r=this.cometd._mixin(!1,{},t);n=s,s+=i[o],r.messages=t.messages.slice(n,s),r.onSuccess=t.onSuccess,r.onFailure=t.onFailure,this.send(r,e.metaConnect)}}this.debug("Transport",this.type,"sending request",e.id,"envelope",o);try{let t=!0;return this.jsonpSend({transport:this,url:o.url,sync:o.sync,headers:this.configuration.requestHeaders,body:JSON.stringify(o.messages),onSuccess:t=>{let n=!1;try{const s=this.convertToMessages(t);0===s.length?this.transportFailure(o,e,{httpCode:204}):(n=!0,this.transportSuccess(o,e,s))}catch(t){this.debug(t),n||this.transportFailure(o,e,{exception:t})}},onError:(n,s)=>{const i={reason:n,exception:s};t?this.setTimeout(()=>{this.transportFailure(o,e,i)},0):this.transportFailure(o,e,i)}}),t=!1,!0}catch(t){return this.setTimeout(()=>{this.transportFailure(o,e,{exception:t})},0),!1}}}function Je(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ye(t,e,n){return t.set(Xe(t,e),n),n}function Xe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ze=new WeakMap,Qe=new WeakSet;class tn extends Me{constructor(...t){var e,n;super(...t),Je(e=this,n=Qe),n.add(e),function(t,e,n){Je(t,e),e.set(t,n)}(this,Ze,!0)}accept(t,e,n){return i=this,(s=Ze).get(Xe(s,i))||!e;var s,i}xhrSend(t){const e=Xe(Qe,this,en).call(this);Xe(Qe,this,nn).call(this,e),e.withCredentials=!0,e.open("POST",t.url,!0!==t.sync);const n=t.headers;if(n)for(let t in n)n.hasOwnProperty(t)&&e.setRequestHeader(t,n[t]);return e.setRequestHeader("Content-Type","application/json"),e.onload=()=>{200===e.status?t.onSuccess(e.responseText):t.onError(e.statusText)},e.onabort=e.onerror=()=>{t.onError(e.statusText)},e.send(t.body),e}transportSend(t,e){this.debug("Transport",this.type,"sending request",e.id,"envelope",t);try{let n=!0;return e.xhr=this.xhrSend({transport:this,url:t.url,sync:t.sync,headers:this.configuration.requestHeaders,body:this.convertToJSON(t.messages),onSuccess:n=>{this.debug("Transport",this.type,"received response",n);let s=!1;try{const i=this.convertToMessages(n);0===i.length?(Ye(Ze,this,!1),this.transportFailure(t,e,{httpCode:204})):(s=!0,this.transportSuccess(t,e,i))}catch(n){if(this.debug(n),!s){Ye(Ze,this,!1);const s={exception:n};s.httpCode=this.xhrStatus(e.xhr),this.transportFailure(t,e,s)}}},onError:(s,i)=>{this.debug("Transport",this.type,"received error",s,i),Ye(Ze,this,!1);const o={reason:s,exception:i};o.httpCode=this.xhrStatus(e.xhr),n?this.setTimeout(()=>{this.transportFailure(t,e,o)},0):this.transportFailure(t,e,o)}}),n=!1,!0}catch(n){return this.debug("Transport",this.type,"exception:",n),Ye(Ze,this,!1),this.setTimeout(()=>{this.transportFailure(t,e,{exception:n})},0),!1}}reset(t){super.reset(t),Ye(Ze,this,!0)}}function en(){return new window.XMLHttpRequest}function nn(t){try{t.context=this.context}catch(t){this.debug("Could not copy transport context into XHR",t)}}function sn(t,e,n){on(t,e),e.set(t,n)}function on(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rn(t,e){return t.get(cn(t,e))}function an(t,e,n){return t.set(cn(t,e),n),n}function cn(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var hn,un=new WeakMap,ln=new WeakMap,dn=new WeakMap,pn=new WeakMap,fn=new WeakMap,yn=new WeakMap,mn=new WeakMap,gn=new WeakSet;class wn extends _e{constructor(...t){var e,n;super(...t),on(e=this,n=gn),n.add(e),sn(this,un,!0),sn(this,ln,!1),sn(this,dn,!0),sn(this,pn,null),sn(this,fn,null),sn(this,yn,!1),sn(this,mn,null)}reset(t){super.reset(t),an(un,this,!0),t&&an(ln,this,!1),an(dn,this,!0),t&&an(pn,this,null),an(fn,this,null),an(yn,this,!1)}_notifySuccess(t,e){t.call(this,e)}_notifyFailure(t,e,n,s){t.call(this,e,n,s)}accept(t,e,n){return this.debug("Transport",this.type,"accept, supported:",rn(un,this)),rn(un,this)&&!!window.WebSocket&&!1!==this.cometd.websocketEnabled}send(t,e){this.debug("Transport",this.type,"sending",t,"/meta/connect =",e),cn(gn,this,_n).call(this,rn(pn,this),t,e)}abort(){super.abort(),cn(gn,this,bn).call(this,rn(pn,this),{code:1e3,reason:"Abort"}),this.reset(!0)}}function bn(t,e){t&&(cn(gn,this,Rn).call(this,t,e.code,e.reason),cn(gn,this,$n).call(this,t,e))}function vn(t){return t===rn(fn,this)||t===rn(pn,this)}function Sn(t,e,n){const s=[];for(let t=0;t<e.messages.length;++t){const n=e.messages[t];n.id&&s.push(n.id)}t.envelopes[s.join(",")]=[e,n],this.debug("Transport",this.type,"stored envelope, envelopes",t.envelopes)}function Tn(t,e){let n=!1;const s=t.envelopes;for(let t=0;t<e.length;++t){const i=e[t];for(let t in s)if(s.hasOwnProperty(t)){const e=t.split(","),o=e.indexOf(i);if(o>=0){n=!0,e.splice(o,1);const i=s[t][0],r=s[t][1];delete s[t],e.length>0&&(s[e.join(",")]=[i,r]);break}}}n&&this.debug("Transport",this.type,"removed envelope, envelopes",s)}function En(t){if(rn(fn,this))return;const e=this.cometd.getURL().replace(/^http/,"ws");this.debug("Transport",this.type,"connecting to URL",e);try{const n=this.configuration.protocol;t.webSocket=n?new window.WebSocket(e,n):new window.WebSocket(e),an(fn,this,t)}catch(t){throw an(un,this,!1),this.debug("Exception while creating WebSocket object",t),t}an(dn,this,!1!==this.configuration.stickyReconnect);const n=this.configuration.connectTimeout;n>0&&(t.connectTimer=this.setTimeout(()=>{this.debug("Transport",this.type,"timed out while connecting to URL",e,":",n,"ms"),cn(gn,this,bn).call(this,t,{code:1e3,reason:"Connect Timeout"})},n));const s=e=>{e=e||{code:1e3},this.debug("Transport",this.type,"onclose",t,e,"connecting",rn(fn,this),"current",rn(pn,this)),t.connectTimer&&this.clearTimeout(t.connectTimer),cn(gn,this,$n).call(this,t,e)};t.webSocket.onopen=()=>{this.debug("Transport",this.type,"onopen",t),t.connectTimer&&this.clearTimeout(t.connectTimer),cn(gn,this,vn).call(this,t)?(an(fn,this,null),an(pn,this,t),an(ln,this,!0),cn(gn,this,An).call(this,t)):(this.cometd._warn("Closing extra WebSocket connection",this,"active connection",rn(pn,this)),cn(gn,this,bn).call(this,t,{code:1e3,reason:"Extra Connection"}))},t.webSocket.onclose=s,t.webSocket.onerror=()=>{s({code:1e3,reason:"Error"})},t.webSocket.onmessage=e=>{this.debug("Transport",this.type,"onmessage",e,t),cn(gn,this,Nn).call(this,t,e)},this.debug("Transport",this.type,"configured callbacks on",t)}function xn(t,e,n){const s=this.notifyTransportTimeout([e]);s>0?(this.debug("Transport",this.type,"extended waiting for message replies:",s,"ms"),t.timeouts[e.id]=this.setTimeout(()=>{cn(gn,this,xn).call(this,t,e,n+s)},s)):(this.debug("Transport",this.type,"expired waiting for message reply",e.id,":",n,"ms"),cn(gn,this,bn).call(this,t,{code:1e3,reason:"Message Timeout"}))}function kn(t,e,n){let s;try{s=this.convertToJSON(e.messages)}catch(n){this.debug("Transport",this.type,"exception:",n);const s=[];for(let t=0;t<e.messages.length;++t){const n=e.messages[t];s.push(n.id)}return cn(gn,this,Tn).call(this,t,s),void this.setTimeout(()=>{this._notifyFailure(e.onFailure,t,e.messages,{exception:n})},0)}t.webSocket.send(s),this.debug("Transport",this.type,"sent",e,"/meta/connect =",n);let i=this.configuration.maxNetworkDelay;n&&(i+=this.advice.timeout,an(yn,this,!0));const o=[];for(let n=0;n<e.messages.length;++n){const s=e.messages[n];s.id&&(o.push(s.id),t.timeouts[s.id]=this.setTimeout(()=>{cn(gn,this,xn).call(this,t,s,i)},i))}this.debug("Transport",this.type,"started waiting for message replies",i,"ms, messageIds:",o,", timeouts:",t.timeouts)}function _n(t,e,n){try{null===t?(t=rn(fn,this)||{envelopes:{},timeouts:{}},cn(gn,this,Sn).call(this,t,e,n),cn(gn,this,En).call(this,t)):(cn(gn,this,Sn).call(this,t,e,n),cn(gn,this,kn).call(this,t,e,n))}catch(e){this.setTimeout(()=>{cn(gn,this,bn).call(this,t,{code:1e3,reason:"Exception",exception:e})},0)}}function An(t){const e=t.envelopes;this.debug("Transport",this.type,"opened",t,"pending messages",e);for(let n in e)if(e.hasOwnProperty(n)){const s=e[n],i=s[0],o=s[1];an(mn,this,i.onSuccess),cn(gn,this,kn).call(this,t,i,o)}}function Nn(t,e){this.debug("Transport",this.type,"received websocket message",e,t);let n=!1;const s=this.convertToMessages(e.data),i=[];for(let e=0;e<s.length;++e){const o=s[e];if((/^\/meta\//.test(o.channel)||void 0===o.data)&&o.id){i.push(o.id);const e=t.timeouts[o.id];e&&(this.clearTimeout(e),delete t.timeouts[o.id],this.debug("Transport",this.type,"removed timeout for message",o.id,", timeouts",t.timeouts))}"/meta/connect"===o.channel&&an(yn,this,!1),"/meta/disconnect"!==o.channel||rn(yn,this)||(n=!0)}cn(gn,this,Tn).call(this,t,i),this._notifySuccess(rn(mn,this),s),n&&cn(gn,this,Rn).call(this,t,1e3,"Disconnect")}function $n(t,e){this.debug("Transport",this.type,"closed",t,e),cn(gn,this,vn).call(this,t)&&(an(un,this,rn(dn,this)&&rn(ln,this)),an(fn,this,null),an(pn,this,null));const n=t.timeouts;t.timeouts={};for(let t in n)n.hasOwnProperty(t)&&this.clearTimeout(n[t]);const s=t.envelopes;t.envelopes={};for(let n in s)if(s.hasOwnProperty(n)){const i=s[n][0];s[n][1]&&an(yn,this,!1);const o={websocketCode:e.code,reason:e.reason};e.exception&&(o.exception=e.exception),this._notifyFailure(i.onFailure,t,i.messages,o)}}function Rn(t,e,n){try{t.webSocket&&t.webSocket.close(e,n)}catch(t){this.debug(t)}}function Pn(t,e,n){On(t,e),e.set(t,n)}function On(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Cn(t,e){return t.get(jn(t,e))}function In(t,e,n){return t.set(jn(t,e),n),n}function jn(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function Ln(){let t=0;const e={};this.register=n=>{const s=++t;return e[s]=n,s},this.unregister=t=>{const n=e[t];return delete e[t],n},this.setTimeout=(t,e)=>window.setTimeout(t,e),this.clearTimeout=t=>{window.clearTimeout(t)}}function Mn(){const t={};self.onmessage=e=>{const n=e.data,s=t[n.id];switch(n.type){case"setTimeout":t[n.id]=self.setTimeout(()=>{delete t[n.id],self.postMessage({id:n.id})},n.delay);break;case"clearTimeout":delete t[n.id],s&&self.clearTimeout(s);break;default:throw new Error("Unknown command "+n.type)}}}var Un=new WeakMap,Dn=new WeakMap,Bn=new WeakMap,Kn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Fn=new WeakMap,Hn=new WeakMap,qn=new WeakMap,Gn=new WeakMap,Vn=new WeakMap,Jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,ts=new WeakMap,es=new WeakMap,ns=new WeakMap,ss=new WeakMap,is=new WeakMap,os=new WeakMap,rs=new WeakMap,as=new WeakMap,cs=new WeakMap,hs=new WeakMap,us=new WeakMap,ls=new WeakMap,ds=new WeakSet;class ps{constructor(t){var e,n;On(e=this,n=ds),n.add(e),Pn(this,Un,new Ln),Pn(this,Dn,void 0),Pn(this,Bn,!1),Pn(this,Kn,new we),Pn(this,Wn,void 0),Pn(this,zn,"disconnected"),Pn(this,Fn,0),Pn(this,Hn,null),Pn(this,qn,0),Pn(this,Gn,[]),Pn(this,Vn,!1),Pn(this,Jn,0),Pn(this,Yn,{}),Pn(this,Xn,{}),Pn(this,Zn,0),Pn(this,Qn,null),Pn(this,ts,[]),Pn(this,es,{}),Pn(this,ns,void 0),Pn(this,ss,void 0),Pn(this,is,{}),Pn(this,os,{}),Pn(this,rs,!1),Pn(this,as,!1),Pn(this,cs,0),Pn(this,hs,0),Pn(this,us,null),Pn(this,ls,{useWorkerScheduler:!0,protocol:null,stickyReconnect:!0,connectTimeout:0,maxConnections:2,backoffIncrement:1e3,maxBackoff:6e4,logLevel:"info",maxNetworkDelay:1e4,requestHeaders:{},appendMessageTypeToURL:!0,autoBatch:!1,urls:{},maxURILength:2e3,maxSendBayeuxMessageSize:8192,advice:{timeout:6e4,interval:0,reconnect:void 0,maxInterval:0}}),In(Dn,this,t||"default"),window.WebSocket&&this.registerTransport("websocket",new wn),this.registerTransport("long-polling",new tn),this.registerTransport("callback-polling",new Ve)}_mixin(t,e,n){const s=e||{};for(let n=2;n<arguments.length;++n){const i=arguments[n];if(null!=i)for(let n in i)if(i.hasOwnProperty(n)){const o=fs.call(ps,i,n),r=fs.call(ps,s,n);if(o===e)continue;if(void 0===o)continue;if(t&&"object"==typeof o&&null!==o)if(o instanceof Array)s[n]=this._mixin(t,r instanceof Array?r:[],o);else{const e="object"!=typeof r||r instanceof Array?{}:r;s[n]=this._mixin(t,e,o)}else s[n]=o}}return s}_warn(){jn(ds,this,Ts).call(this,"warn",arguments)}_info(){"warn"!==Cn(ls,this).logLevel&&jn(ds,this,Ts).call(this,"info",arguments)}_debug(){"debug"===Cn(ls,this).logLevel&&jn(ds,this,Ts).call(this,"debug",arguments)}send(t){jn(ds,this,Bs).call(this,t)}_getCallback(t){return Cn(is,this)[t]}_putCallback(t,e){const n=this._getCallback(t);return vs.call(ps,e)&&(Cn(is,this)[t]=e),n}onTransportFailure(t,e,n){this._debug("Transport failure",e,"for",t);const s=this.getTransportRegistry(),i=this.getURL(),o=jn(ds,this,xs).call(this,Es.call(ps,i)[2]),r=s.findTransportTypes("1.0",o,i);if("none"===e.action){if("/meta/handshake"===t.channel&&!e.transport){const e="Could not negotiate transport, client=["+r+"], server=["+t.supportedConnectionTypes+"]";this._warn(e);const n=this.getTransport();if(n){const t=n.type;jn(ds,this,Ys).call(this,t,null,{reason:e,connectionType:t,transport:n})}}}else if(e.delay=this.getBackoffPeriod(),"/meta/handshake"===t.channel){if(!e.transport){const n=Cn(Wn,this)?Cn(Wn,this).type:null,a=s.negotiateTransport(r,"1.0",o,i);if(a){const s=a.type;this._debug("Transport",n,"->",s),jn(ds,this,Ys).call(this,n,s,t.failure),e.action="handshake",e.transport=a}else this._warn("Could not negotiate transport, client=["+r+"]"),jn(ds,this,Ys).call(this,n,null,t.failure),e.action="none"}"none"!==e.action&&this.increaseBackoffPeriod()}else{const t=(new Date).getTime();if(0===Cn(cs,this)&&In(cs,this,t),"retry"===e.action){e.delay=this.increaseBackoffPeriod();const n=Cn(es,this).maxInterval;if(n>0){const s=Cn(es,this).timeout+Cn(es,this).interval+n;t-Cn(cs,this)+Cn(Zn,this)>s&&(e.action="handshake")}}"handshake"===e.action&&(e.delay=0,s.reset(!1),this.resetBackoffPeriod())}n.call(this,e)}receive(t){jn(ds,this,Ti).call(this,t)}registerTransport(t,e,n){const s=Cn(Kn,this).add(t,e,n);return s&&(this._debug("Registered transport",t),vs.call(ps,e.registered)&&e.registered(t,this)),s}unregisterTransport(t){const e=Cn(Kn,this).remove(t);return null!==e&&(this._debug("Unregistered transport",t),vs.call(ps,e.unregistered)&&e.unregistered()),e}unregisterTransports(){Cn(Kn,this).clear()}getTransportTypes(){return Cn(Kn,this).getTransportTypes()}findTransport(t){return Cn(Kn,this).find(t)}getTransportRegistry(){return Cn(Kn,this)}configure(t){jn(ds,this,ks).call(this,t)}init(t,e){this.configure(t),this.handshake(e)}handshake(t,e){const n=this.getStatus();if("disconnected"!==n)throw new Error("Illegal state: "+n);jn(ds,this,Xs).call(this,t,e)}disconnect(t,e){if(this.isDisconnected())return;vs.call(ps,t)&&(e=t,t=void 0);const n={id:jn(ds,this,Ps).call(this),channel:"/meta/disconnect"},s=this._mixin(!1,{},t,n);this._putCallback(s.id,e),jn(ds,this,$s).call(this,"disconnecting"),jn(ds,this,Ds).call(this,[s],!1,"disconnect")}startBatch(){jn(ds,this,zs).call(this)}endBatch(){jn(ds,this,Hs).call(this)}batch(t,e){const n=jn(ds,this,_i).call(this,t,e);this.startBatch();try{n.method.call(n.scope),this.endBatch()}catch(t){throw this._info("Exception during execution of batch",t),this.endBatch(),t}}addTransportListener(t,e){if("timeout"!==t)throw new Error("Unsupported event "+t);let n=Cn(Xn,this)[t];n||(Cn(Xn,this)[t]=n=[]),n.push(e)}removeTransportListener(t,e){const n=Cn(Xn,this)[t];if(n){const t=n.indexOf(e);if(t>=0)return n.splice(t,1),!0}return!1}_getTransportListeners(t){return Cn(Xn,this)[t]}addListener(t,e,n){if(arguments.length<2)throw new Error("Illegal arguments number: required 2, got "+arguments.length);if(!ys.call(ps,t))throw new Error("Illegal argument type: channel must be a string");return jn(ds,this,Ai).call(this,t,e,n,!0)}removeListener(t){if(!t||!t.channel||!("id"in t))throw new Error("Invalid argument: expected subscription, not "+t);jn(ds,this,_s).call(this,t)}clearListeners(){In(Yn,this,{})}subscribe(t,e,n,s,i){if(arguments.length<2)throw new Error("Illegal arguments number: required 2, got "+arguments.length);if(!bs.call(ps,t))throw new Error("Illegal argument: invalid channel "+t);if(this.isDisconnected())throw new Error("Illegal state: disconnected");vs.call(ps,e)&&(i=s,s=n,n=e,e=void 0),vs.call(ps,s)&&(i=s,s=void 0);const o=!jn(ds,this,ki).call(this,t),r=jn(ds,this,Ai).call(this,t,e,n,!1);if(o){const e={id:jn(ds,this,Ps).call(this),channel:"/meta/subscribe",subscription:t},n=this._mixin(!1,{},s,e);this._putCallback(n.id,i),jn(ds,this,Bs).call(this,n)}else vs.call(ps,i)&&this.setTimeout(()=>{jn(ds,this,Qs).call(this,i,{id:jn(ds,this,Ps).call(this),successful:!0,channel:"/meta/subscribe",subscription:t})},0);return r}unsubscribe(t,e,n){if(arguments.length<1)throw new Error("Illegal arguments number: required 1, got "+arguments.length);if(this.isDisconnected())throw new Error("Illegal state: disconnected");vs.call(ps,e)&&(n=e,e=void 0),this.removeListener(t);const s=t.channel;if(jn(ds,this,ki).call(this,s))vs.call(ps,n)&&this.setTimeout(()=>{jn(ds,this,Qs).call(this,n,{id:jn(ds,this,Ps).call(this),successful:!0,channel:"/meta/unsubscribe",subscription:s})},0);else{const t={id:jn(ds,this,Ps).call(this),channel:"/meta/unsubscribe",subscription:s},i=this._mixin(!1,{},e,t);this._putCallback(i.id,n),jn(ds,this,Bs).call(this,i)}}resubscribe(t,e){if(jn(ds,this,As).call(this,t),t)return this.subscribe(t.channel,t.scope,t.callback,e)}clearSubscriptions(){jn(ds,this,Ns).call(this)}publish(t,e,n,s){if(arguments.length<1)throw new Error("Illegal arguments number: required 1, got "+arguments.length);if(!bs.call(ps,t))throw new Error("Illegal argument: invalid channel "+t);if(/^\/meta\//.test(t))throw new Error("Illegal argument: cannot publish to meta channels");if(this.isDisconnected())throw new Error("Illegal state: disconnected");vs.call(ps,e)?(s=e,e={},n=void 0):vs.call(ps,n)&&(s=n,n=void 0);const i={id:jn(ds,this,Ps).call(this),channel:t,data:e},o=this._mixin(!1,{},n,i);this._putCallback(o.id,s),jn(ds,this,Bs).call(this,o)}publishBinary(t,e,n,s,i,o){vs.call(ps,e)?(o=e,e=new ArrayBuffer(0),n=!0,s=void 0,i=void 0):vs.call(ps,n)?(o=n,n=!0,s=void 0,i=void 0):vs.call(ps,s)?(o=s,s=void 0,i=void 0):vs.call(ps,i)&&(o=i,i=void 0);const r={meta:s,data:e,last:n},a=this._mixin(!1,i,{ext:{binary:{}}});this.publish(t,r,a,o)}remoteCall(t,e,n,s,i){if(arguments.length<1)throw new Error("Illegal arguments number: required 1, got "+arguments.length);if(!ys.call(ps,t))throw new Error("Illegal argument type: target must be a string");if(this.isDisconnected())throw new Error("Illegal state: disconnected");if(vs.call(ps,e)?(i=e,e={},n=Cn(ls,this).maxNetworkDelay,s=void 0):vs.call(ps,n)?(i=n,n=Cn(ls,this).maxNetworkDelay,s=void 0):vs.call(ps,s)&&(i=s,s=void 0),"number"!=typeof n)throw new Error("Illegal argument type: timeout must be a number");t.match(/^\//)||(t="/"+t);const o="/service"+t;if(!bs.call(ps,o))throw new Error("Illegal argument: invalid target "+t);const r={id:jn(ds,this,Ps).call(this),channel:o,data:e},a=this._mixin(!1,{},s,r),c={callback:i};n>0&&(c.timeout=this.setTimeout(()=>{this._debug("Timing out remote call",a,"after",n,"ms"),jn(ds,this,bi).call(this,{id:a.id,error:"406::timeout",successful:!1,failure:{message:a,reason:"Remote Call Timeout"}})},n),this._debug("Scheduled remote call timeout",a,"in",n,"ms")),Cn(os,this)[a.id]=c,jn(ds,this,Bs).call(this,a)}remoteCallBinary(t,e,n,s,i,o,r){vs.call(ps,e)?(r=e,e=new ArrayBuffer(0),n=!0,s=void 0,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,n)?(r=n,n=!0,s=void 0,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,s)?(r=s,s=void 0,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,i)?(r=i,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,o)&&(r=o,o=void 0);const a={meta:s,data:e,last:n},c=this._mixin(!1,o,{ext:{binary:{}}});this.remoteCall(t,a,i,c,r)}getStatus(){return Cn(zn,this)}isDisconnected(){return jn(ds,this,Rs).call(this)}setBackoffIncrement(t){Cn(ls,this).backoffIncrement=t}getBackoffIncrement(){return Cn(ls,this).backoffIncrement}getBackoffPeriod(){return Cn(Zn,this)}increaseBackoffPeriod(){return jn(ds,this,Ws).call(this)}resetBackoffPeriod(){jn(ds,this,Ks).call(this)}setLogLevel(t){Cn(ls,this).logLevel=t}registerExtension(t,e){if(arguments.length<2)throw new Error("Illegal arguments number: required 2, got "+arguments.length);if(!ys.call(ps,t))throw new Error("Illegal argument type: extension name must be a string");let n=!1;for(let e=0;e<Cn(ts,this).length;++e){if(Cn(ts,this)[e].name===t){n=!0;break}}return n?(this._info("Could not register extension with name",t,"since another extension with the same name already exists"),!1):(Cn(ts,this).push({name:t,extension:e}),this._debug("Registered extension",t),vs.call(ps,e.registered)&&e.registered(t,this),!0)}unregisterExtension(t){if(!ys.call(ps,t))throw new Error("Illegal argument type: extension name must be a string");let e=!1;for(let n=0;n<Cn(ts,this).length;++n){const s=Cn(ts,this)[n];if(s.name===t){Cn(ts,this).splice(n,1),e=!0,this._debug("Unregistered extension",t);const i=s.extension;vs.call(ps,i.unregistered)&&i.unregistered();break}}return e}getExtension(t){for(let e=0;e<Cn(ts,this).length;++e){const n=Cn(ts,this)[e];if(n.name===t)return n.extension}return null}getName(){return Cn(Dn,this)}getClientId(){return Cn(Hn,this)}getURL(){const t=this.getTransport();if(t){let e=t.url;if(e)return e;if(e=Cn(ls,this).urls[t.type],e)return e}return Cn(ls,this).url}getTransport(){return Cn(Wn,this)}getConfiguration(){return this._mixin(!0,{},Cn(ls,this))}getAdvice(){return this._mixin(!0,{},Cn(es,this))}setTimeout(t,e){return Cn(Un,this).setTimeout(()=>{try{this._debug("Invoking timed function",t),t()}catch(e){this._debug("Exception invoking timed function",t,e)}},e)}clearTimeout(t){Cn(Un,this).clearTimeout(t)}}function fs(t,e){try{return t[e]}catch(t){return}}function ys(t){return null!=t&&("string"==typeof t||t instanceof String)}function ms(t){return t>="A"&&t<="Z"||t>="a"&&t<="z"}function gs(t){return t>="0"&&t<="9"}function ws(t){switch(t){case" ":case"!":case"#":case"$":case"(":case")":case"*":case"+":case"-":case".":case"/":case"@":case"_":case"{":case"~":case"}":return!0;default:return!1}}function bs(t){if(!ys.call(hn,t))return!1;if(t.length<2)return!1;if("/"!==t.charAt(0))return!1;for(let e=1;e<t.length;++e){const n=t.charAt(e);if(!(ms.call(hn,n)||gs.call(hn,n)||ws.call(hn,n)))return!1}return!0}function vs(t){return null!=t&&"function"==typeof t}function Ss(t,e){let n="";for(;--e>0&&!(t>=Math.pow(10,e));)n+="0";return n+=t,n}function Ts(t,e){if(window.console){const n=window.console[t];if(vs.call(hn,n)){const t=new Date;[].splice.call(e,0,0,Ss.call(hn,t.getHours(),2)+":"+Ss.call(hn,t.getMinutes(),2)+":"+Ss.call(hn,t.getSeconds(),2)+"."+Ss.call(hn,t.getMilliseconds(),3)),n.apply(window.console,e)}}}function Es(t){return new RegExp("(^https?://)?(((\\[[^\\]]+])|([^:/?#]+))(:(\\d+))?)?([^?#]*)(.*)?").exec(t)}function xs(t){return!!(window.location&&window.location.host&&t)&&t!==window.location.host}function ks(t){this._debug("Configuring cometd object with",t),ys.call(hn,t)&&(t={url:t}),t||(t={}),In(ls,this,this._mixin(!1,Cn(ls,this),t));const e=this.getURL();if(!e)throw new Error("Missing required configuration parameter 'url' specifying the Bayeux server URL");const n=Es.call(hn,e),s=n[2],i=n[8],o=n[9];if(In(Bn,this,jn(ds,this,xs).call(this,s)),Cn(ls,this).appendMessageTypeToURL)if(void 0!==o&&o.length>0)this._info("Appending message type to URI",i,o,"is not supported, disabling 'appendMessageTypeToURL' configuration"),Cn(ls,this).appendMessageTypeToURL=!1;else{const t=i.split("/");let e=t.length-1;i.match(/\/$/)&&(e-=1),t[e].indexOf(".")>=0&&(this._info("Appending message type to URI",i,"is not supported, disabling 'appendMessageTypeToURL' configuration"),Cn(ls,this).appendMessageTypeToURL=!1)}if(window.Worker&&window.Blob&&window.URL&&Cn(ls,this).useWorkerScheduler){let t=Mn.toString();t=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));const e=new window.Blob([t],{type:"application/json"}),n=window.URL.createObjectURL(e),s=new window.Worker(n);Cn(Un,this).setTimeout=(t,e)=>{const n=Cn(Un,this).register(t);return s.postMessage({id:n,type:"setTimeout",delay:e}),n},Cn(Un,this).clearTimeout=t=>{Cn(Un,this).unregister(t),s.postMessage({id:t,type:"clearTimeout"})},s.onmessage=t=>{const e=t.data.id,n=Cn(Un,this).unregister(e);n&&n()}}}function _s(t){if(t){const e=Cn(Yn,this)[t.channel];e&&e[t.id]&&(delete e[t.id],this._debug("Removed",t.listener?"listener":"subscription",t))}}function As(t){t&&!t.listener&&jn(ds,this,_s).call(this,t)}function Ns(){for(let t in Cn(Yn,this))if(Cn(Yn,this).hasOwnProperty(t)){const e=Cn(Yn,this)[t];if(e)for(let t in e)e.hasOwnProperty(t)&&jn(ds,this,As).call(this,e[t])}}function $s(t){const e=this.getStatus();e!==t&&(this._debug("Status",e,"->",t),In(zn,this,t))}function Rs(){const t=Cn(zn,this);return"disconnecting"===t||"disconnected"===t}function Ps(){var t;return""+In(Fn,this,(t=Cn(Fn,this),++t))}function Os(t,e,n,s,i){try{return e.call(t,s)}catch(t){const e=this.onExtensionException;if(vs.call(hn,e)){this._debug("Invoking extension exception handler",n,t);try{e.call(this,t,n,i,s)}catch(t){this._info("Exception during execution of extension exception handler",n,t)}}else this._info("Exception during execution of extension",n,t);return s}}function Cs(t){for(let e=0;e<Cn(ts,this).length&&null!=t;++e){const n=Cn(ts,this)[e],s=n.extension.incoming;if(vs.call(hn,s)){const e=jn(ds,this,Os).call(this,n.extension,s,n.name,t,!1);t=void 0===e?t:e}}return t}function Is(t){for(let e=Cn(ts,this).length-1;e>=0&&null!=t;--e){const n=Cn(ts,this)[e],s=n.extension.outgoing;if(vs.call(hn,s)){const e=jn(ds,this,Os).call(this,n.extension,s,n.name,t,!0);t=void 0===e?t:e}}return t}function js(t,e){const n=Cn(Yn,this)[t];if(n)for(let t in n)if(n.hasOwnProperty(t)){const s=n[t];if(s)try{s.callback.call(s.scope,e)}catch(t){const n=this.onListenerException;if(vs.call(hn,n)){this._debug("Invoking listener exception handler",s,t);try{n.call(this,t,s,s.listener,e)}catch(t){this._info("Exception during execution of listener exception handler",s,t)}}else this._info("Exception during execution of listener",s,e,t)}}}function Ls(t,e){jn(ds,this,js).call(this,t,e);const n=t.split("/"),s=n.length-1;for(let t=s;t>0;--t){let i=n.slice(0,t).join("/")+"/*";t===s&&jn(ds,this,js).call(this,i,e),i+="*",jn(ds,this,js).call(this,i,e)}}function Ms(){null!==Cn(Qn,this)&&this.clearTimeout(Cn(Qn,this)),In(Qn,this,null)}function Us(t,e){jn(ds,this,Ms).call(this);const n=Cn(es,this).interval+e;this._debug("Function scheduled in",n,"ms, interval =",Cn(es,this).interval,"backoff =",Cn(Zn,this),t),In(Qn,this,this.setTimeout(t,n))}function Ds(t,e,n){for(let e=0;e<t.length;++e){let n=t[e];const s=n.id,i=this.getClientId();i&&(n.clientId=i),n=jn(ds,this,Is).call(this,n),null!=n?(n.id=s,t[e]=n):(delete Cn(is,this)[s],t.splice(e--,1))}if(0===t.length)return;e&&In(us,this,t[0]);let s=this.getURL();Cn(ls,this).appendMessageTypeToURL&&(s.match(/\/$/)||(s+="/"),n&&(s+=n));const i={url:s,sync:!1,messages:t,onSuccess:t=>{try{jn(ds,this,Ei).call(this,t)}catch(t){this._info("Exception during handling of messages",t)}},onFailure:(t,e,n)=>{try{const s=this.getTransport();n.connectionType=s?s.type:"unknown",jn(ds,this,xi).call(this,t,e,n)}catch(t){this._info("Exception during handling of failure",t)}}};this._debug("Send",i),this.getTransport().send(i,e)}function Bs(t){Cn(qn,this)>0||!0===Cn(Vn,this)?Cn(Gn,this).push(t):jn(ds,this,Ds).call(this,[t],!1)}function Ks(){In(Zn,this,0)}function Ws(){return Cn(Zn,this)<Cn(ls,this).maxBackoff&&In(Zn,this,Cn(Zn,this)+this.getBackoffIncrement()),Cn(Zn,this)}function zs(){var t;In(qn,this,(t=Cn(qn,this),++t)),this._debug("Starting batch, depth",Cn(qn,this))}function Fs(){const t=Cn(Gn,this);In(Gn,this,[]),t.length>0&&jn(ds,this,Ds).call(this,t,!1)}function Hs(){var t;if(In(qn,this,(t=Cn(qn,this),--t)),this._debug("Ending batch, depth",Cn(qn,this)),Cn(qn,this)<0)throw new Error("Calls to startBatch() and endBatch() are not paired");0!==Cn(qn,this)||this.isDisconnected()||Cn(Vn,this)||jn(ds,this,Fs).call(this)}function qs(){if(!this.isDisconnected()){const t={id:jn(ds,this,Ps).call(this),channel:"/meta/connect",connectionType:this.getTransport().type};Cn(as,this)||(t.advice={timeout:0}),jn(ds,this,$s).call(this,"connecting"),this._debug("Connect sent",t),jn(ds,this,Ds).call(this,[t],!0,"connect"),jn(ds,this,$s).call(this,"connected")}}function Gs(t){jn(ds,this,$s).call(this,"connecting"),jn(ds,this,Us).call(this,()=>{jn(ds,this,qs).call(this)},t)}function Vs(t){t&&(In(es,this,this._mixin(!1,{},Cn(ls,this).advice,t)),this._debug("New advice",Cn(es,this)))}function Js(t){jn(ds,this,Ms).call(this);const e=this.getTransport();if(t&&e&&e.abort(),In(Bn,this,!1),In(Wn,this,null),jn(ds,this,$s).call(this,"disconnected"),In(Hn,this,null),In(qn,this,0),jn(ds,this,Ks).call(this),In(rs,this,!1),In(as,this,!1),In(cs,this,0),In(us,this,null),Cn(Gn,this).length>0){const t=Cn(Gn,this);In(Gn,this,[]),jn(ds,this,xi).call(this,void 0,t,{reason:"Disconnected"})}}function Ys(t,e,n){const s=this.onTransportException;if(vs.call(hn,s)){this._debug("Invoking transport exception handler",t,e,n);try{s.call(this,n,t,e)}catch(t){this._info("Exception during execution of transport exception handler",t)}}}function Xs(t,e){vs.call(hn,t)&&(e=t,t=void 0),In(Hn,this,null),this.clearSubscriptions(),this.isDisconnected()&&Cn(Kn,this).reset(!0),jn(ds,this,Vs).call(this,{}),In(qn,this,0),In(Vn,this,!0),In(ns,this,t),In(ss,this,e);const n="1.0",s=this.getURL(),i=Cn(Kn,this).findTransportTypes(n,Cn(Bn,this),s),o={id:jn(ds,this,Ps).call(this),version:n,minimumVersion:n,channel:"/meta/handshake",supportedConnectionTypes:i,advice:{timeout:Cn(es,this).timeout,interval:Cn(es,this).interval}},r=this._mixin(!1,{},Cn(ns,this),o);if(this._putCallback(r.id,e),!Cn(Wn,this)&&(In(Wn,this,Cn(Kn,this).negotiateTransport(i,n,Cn(Bn,this),s)),!Cn(Wn,this))){const t="Could not find initial transport among: "+this.getTransportTypes();throw this._warn(t),new Error(t)}this._debug("Initial transport is",Cn(Wn,this).type),jn(ds,this,$s).call(this,"handshaking"),this._debug("Handshake sent",r),jn(ds,this,Ds).call(this,[r],!1,"handshake")}function Zs(t){jn(ds,this,$s).call(this,"handshaking"),In(Vn,this,!0),jn(ds,this,Us).call(this,()=>{jn(ds,this,Xs).call(this,Cn(ns,this),Cn(ss,this))},t)}function Qs(t,e){try{t.call(this,e)}catch(t){const n=this.onCallbackException;if(vs.call(hn,n)){this._debug("Invoking callback exception handler",t);try{n.call(this,t,e)}catch(t){this._info("Exception during execution of callback exception handler",t)}}else this._info("Exception during execution of message callback",t)}}function ti(t){const e=this._getCallback([t.id]);vs.call(hn,e)&&(delete Cn(is,this)[t.id],jn(ds,this,Qs).call(this,e,t))}function ei(t){const e=Cn(os,this)[t.id];if(delete Cn(os,this)[t.id],e){this._debug("Handling remote call response for",t,"with context",e);const n=e.timeout;n&&this.clearTimeout(n);const s=e.callback;if(vs.call(hn,s))return jn(ds,this,Qs).call(this,s,t),!0}return!1}function ni(t){this._debug("Transport failure handling",t),t.transport&&In(Wn,this,t.transport),t.url&&(Cn(Wn,this).url=t.url);const e=t.action,n=t.delay||0;switch(e){case"handshake":jn(ds,this,Zs).call(this,n);break;case"retry":jn(ds,this,Gs).call(this,n);break;case"none":jn(ds,this,Js).call(this,!0);break;default:throw new Error("Unknown action "+e)}}function si(t,e){jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/handshake",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t),this.isDisconnected()&&(e.action="none"),this.onTransportFailure(t,e,t=>jn(ds,this,ni).call(this,t))}function ii(t){const e=this.getURL();if(t.successful){const n=jn(ds,this,xs).call(this,Es.call(hn,e)[2]),s=Cn(Kn,this).negotiateTransport(t.supportedConnectionTypes,t.version,n,e);if(null===s)return t.successful=!1,void jn(ds,this,si).call(this,t,{cause:"negotiation",action:"none",transport:null});{const t=Cn(Wn,this);t!==s&&(this._debug("Transport",t&&t.type,"->",s.type),In(Wn,this,s))}In(Hn,this,t.clientId),In(Vn,this,!1),jn(ds,this,Fs).call(this),t.reestablish=Cn(rs,this),In(rs,this,!0),jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/handshake",t),In(hs,this,t["x-messages"]||0);const i=this.isDisconnected()?"none":Cn(es,this).reconnect||"retry";switch(i){case"retry":jn(ds,this,Ks).call(this),0===Cn(hs,this)?jn(ds,this,Gs).call(this,0):this._debug("Processing",Cn(hs,this),"handshake-delivered messages");break;case"none":jn(ds,this,Js).call(this,!0);break;default:throw new Error("Unrecognized advice action "+i)}}else jn(ds,this,si).call(this,t,{cause:"unsuccessful",action:Cn(es,this).reconnect||"handshake",transport:this.getTransport()})}function oi(t){jn(ds,this,si).call(this,t,{cause:"failure",action:"handshake",transport:null})}function ri(t){return"disconnected"===this.getStatus()||!(!Cn(us,this)||Cn(us,this).id!==t.id)&&(In(us,this,null),!0)}function ai(t,e){jn(ds,this,Ls).call(this,"/meta/connect",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t),this.isDisconnected()&&(e.action="none"),this.onTransportFailure(t,e,t=>jn(ds,this,ni).call(this,t))}function ci(t){if(jn(ds,this,ri).call(this,t))if(In(as,this,t.successful),Cn(as,this)){jn(ds,this,Ls).call(this,"/meta/connect",t);const e=this.isDisconnected()?"none":Cn(es,this).reconnect||"retry";switch(e){case"retry":jn(ds,this,Ks).call(this),jn(ds,this,Gs).call(this,Cn(Zn,this));break;case"none":jn(ds,this,Js).call(this,!1);break;default:throw new Error("Unrecognized advice action "+e)}}else jn(ds,this,ai).call(this,t,{cause:"unsuccessful",action:Cn(es,this).reconnect||"retry",transport:this.getTransport()});else this._debug("Mismatched /meta/connect reply",t)}function hi(t){jn(ds,this,ri).call(this,t)?(In(as,this,!1),jn(ds,this,ai).call(this,t,{cause:"failure",action:"retry",transport:null})):this._debug("Mismatched /meta/connect failure",t)}function ui(t){jn(ds,this,Js).call(this,!0),jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/disconnect",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t)}function li(t){t.successful?(jn(ds,this,Js).call(this,!1),jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/disconnect",t)):jn(ds,this,ui).call(this,t)}function di(t){jn(ds,this,ui).call(this,t)}function pi(t){const e=Cn(Yn,this)[t.subscription];if(e)for(let t in e)if(e.hasOwnProperty(t)){const n=e[t];n&&!n.listener&&(delete e[t],this._debug("Removed failed subscription",n))}jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/subscribe",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t)}function fi(t){t.successful?(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/subscribe",t)):jn(ds,this,pi).call(this,t)}function yi(t){jn(ds,this,pi).call(this,t)}function mi(t){jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/unsubscribe",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t)}function gi(t){t.successful?(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/unsubscribe",t)):jn(ds,this,mi).call(this,t)}function wi(t){jn(ds,this,mi).call(this,t)}function bi(t){jn(ds,this,ei).call(this,t)||(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/publish",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t))}function vi(t){var e;void 0!==t.data?jn(ds,this,ei).call(this,t)||(jn(ds,this,Ls).call(this,t.channel,t),Cn(hs,this)>0&&(In(hs,this,(e=Cn(hs,this),--e)),0===Cn(hs,this)&&(this._debug("Processed last handshake-delivered message"),jn(ds,this,Gs).call(this,0)))):void 0===t.successful?this._warn("Unknown Bayeux Message",t):t.successful?(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/publish",t)):jn(ds,this,bi).call(this,t)}function Si(t){jn(ds,this,bi).call(this,t)}function Ti(t){if(In(cs,this,0),null==(t=jn(ds,this,Cs).call(this,t)))return;jn(ds,this,Vs).call(this,t.advice);switch(t.channel){case"/meta/handshake":jn(ds,this,ii).call(this,t);break;case"/meta/connect":jn(ds,this,ci).call(this,t);break;case"/meta/disconnect":jn(ds,this,li).call(this,t);break;case"/meta/subscribe":jn(ds,this,fi).call(this,t);break;case"/meta/unsubscribe":jn(ds,this,gi).call(this,t);break;default:jn(ds,this,vi).call(this,t)}}function Ei(t){this._debug("Received",t);for(let e=0;e<t.length;++e){const n=t[e];this.receive(n)}}function xi(t,e,n){this._debug("handleFailure",t,e,n),n.transport=t;for(let t=0;t<e.length;++t){const s=e[t],i={id:s.id,successful:!1,channel:s.channel,failure:n};switch(n.message=s,s.channel){case"/meta/handshake":jn(ds,this,oi).call(this,i);break;case"/meta/connect":jn(ds,this,hi).call(this,i);break;case"/meta/disconnect":jn(ds,this,di).call(this,i);break;case"/meta/subscribe":i.subscription=s.subscription,jn(ds,this,yi).call(this,i);break;case"/meta/unsubscribe":i.subscription=s.subscription,jn(ds,this,wi).call(this,i);break;default:jn(ds,this,Si).call(this,i)}}}function ki(t){const e=Cn(Yn,this)[t];if(e)for(let t in e)if(e.hasOwnProperty(t)&&e[t])return!0;return!1}function _i(t,e){const n={scope:t,method:e};if(vs.call(hn,t))n.scope=void 0,n.method=t;else if(ys.call(hn,e)){if(!t)throw new Error("Invalid scope "+t);if(n.method=t[e],!vs.call(hn,n.method))throw new Error("Invalid callback "+e+" for scope "+t)}else if(!vs.call(hn,e))throw new Error("Invalid callback "+e);return n}function Ai(t,e,n,s){var i;const o=jn(ds,this,_i).call(this,e,n);this._debug("Adding",s?"listener":"subscription","on",t,"with scope",o.scope,"and callback",o.method);const r=In(Jn,this,(i=Cn(Jn,this),++i)),a={id:r,channel:t,scope:o.scope,callback:o.method,listener:s};let c=Cn(Yn,this)[t];return c||(c={},Cn(Yn,this)[t]=c),c[r]=a,this._debug("Added",s?"listener":"subscription",a),a}function Ni(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function $i(t,e,n){return t.set(Ri(t,e),n),n}function Ri(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}hn=ps;var Pi=new WeakMap;class Oi{constructor(){Ni(this,Pi,void 0)}registered(t,e){$i(Pi,this,e)}unregistered(){$i(Pi,this,null)}get cometd(){return e=this,(t=Pi).get(Ri(t,e));var t,e}incoming(t){return t}outgoing(t){return t}}function Ci(t,e,n){Ii(t,e),e.set(t,n)}function Ii(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ji(t,e){return t.get(Mi(t,e))}function Li(t,e,n){return t.set(Mi(t,e),n),n}function Mi(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ui=new WeakMap,Di=new WeakMap,Bi=new WeakSet;function Ki(t,e){this.cometd._debug(t,e)}function Wi(t,e,n){zi(t,e),e.set(t,n)}function zi(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fi(t,e,n){return t.set(qi(t,e),n),n}function Hi(t,e){return t.get(qi(t,e))}function qi(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Gi=new WeakMap,Vi=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,Xi=new WeakSet;function Zi(t){if(Hi(Gi,this).handshakeResponse){Fi(Yi,this,!0);const e=this.cometd.getTransport();e&&e.abort(),this.configure(t);const n=JSON.stringify(Hi(Gi,this));this.cometd._debug("Reload extension saving state",n),window.sessionStorage.setItem(Hi(Vi,this),n)}}function Qi(t){return Hi(Gi,this).url===t.url}function to(t){!0!==t.successful&&Fi(Gi,this,{})}var eo=Object.freeze({__proto__:null,AckExtension:class extends Oi{constructor(...t){var e,n;super(...t),Ii(e=this,n=Bi),n.add(e),Ci(this,Ui,!1),Ci(this,Di,0)}registered(t,e){super.registered(t,e),Mi(Bi,this,Ki).call(this,"AckExtension: executing registration callback")}unregistered(){Mi(Bi,this,Ki).call(this,"AckExtension: executing unregistration callback"),super.unregistered()}incoming(t){const e=t.channel,n=t.ext;if("/meta/handshake"===e){if(n){const t=n.ack;if("object"==typeof t){Li(Ui,this,!0===t.enabled);const e=t.batch;"number"==typeof e&&Li(Di,this,e)}else Li(Ui,this,!0===t)}Mi(Bi,this,Ki).call(this,"AckExtension: server supports acknowledgements",ji(Ui,this))}else"/meta/connect"===e&&t.successful&&ji(Ui,this)&&n&&"number"==typeof n.ack&&(Li(Di,this,n.ack),Mi(Bi,this,Ki).call(this,"AckExtension: server sent batch",ji(Di,this)));return t}outgoing(t){const e=t.channel;return t.ext||(t.ext={}),"/meta/handshake"===e?(t.ext.ack=this.cometd&&!1!==this.cometd.ackEnabled,Li(Ui,this,!1),Li(Di,this,0)):"/meta/connect"===e&&ji(Ui,this)&&(t.ext.ack=ji(Di,this),Mi(Bi,this,Ki).call(this,"AckExtension: client sending batch",ji(Di,this))),t}},CallbackPollingTransport:Ve,CometD:ps,Extension:Oi,LongPollingTransport:tn,ReloadExtension:class extends Oi{constructor(t){var e,n;super(),zi(e=this,n=Xi),n.add(e),Wi(this,Gi,{}),Wi(this,Vi,"org.cometd.reload"),Wi(this,Ji,!1),Wi(this,Yi,!1),this.configure(t)}configure(t){t&&"string"==typeof t.name&&Fi(Vi,this,t.name)}_receive(t){this.cometd.receive(t)}registered(t,e){super.registered(t,e),this.cometd.reload=t=>qi(Xi,this,Zi).call(this,t),this.cometd.addListener("/meta/handshake",t=>qi(Xi,this,to).call(this,t))}unregistered(){delete this.cometd.reload,super.unregistered()}outgoing(t){switch(t.channel){case"/meta/handshake":{Fi(Gi,this,{url:this.cometd.getURL()});const e=window.sessionStorage.getItem(Hi(Vi,this));if(this.cometd._debug("Reload extension found state",e),e)try{const n=JSON.parse(e);if(window.sessionStorage.removeItem(Hi(Vi,this)),n.handshakeResponse&&qi(Xi,this,Qi).call(this,n)){this.cometd._debug("Reload extension restoring state",n);const e=this.cometd._getCallback(t.id);return this.cometd.setTimeout(()=>{this.cometd._debug("Reload extension replaying handshake response",n.handshakeResponse),Hi(Gi,this).handshakeResponse=n.handshakeResponse,Hi(Gi,this).transportType=n.transportType,this.cometd._putCallback(t.id,e);const s=this.cometd._mixin(!0,{},Hi(Gi,this).handshakeResponse,{id:t.id,ext:{reload:!0}});s.supportedConnectionTypes=[Hi(Gi,this).transportType],this._receive(s),this.cometd._debug("Reload extension replayed handshake response",s)},0),Hi(Ji,this)||(Fi(Ji,this,!0),this.cometd.startBatch()),null}this.cometd._debug("Reload extension could not restore state",n)}catch(t){this.cometd._debug("Reload extension error while trying to restore state",t)}break}case"/meta/connect":if(!0===Hi(Yi,this))return this.cometd._debug("Reload extension aborting /meta/connect during reload"),null;Hi(Gi,this).transportType||(Hi(Gi,this).transportType=t.connectionType,this.cometd._debug("Reload extension tracked transport type",Hi(Gi,this).transportType));break;case"/meta/disconnect":Fi(Gi,this,{})}return t}incoming(t){switch(t.channel){case"/meta/handshake":t.successful&&(Hi(Gi,this).handshakeResponse||(Hi(Gi,this).handshakeResponse=t,this.cometd._debug("Reload extension tracked handshake response",t)));break;case"/meta/connect":Hi(Ji,this)&&(Fi(Ji,this,!1),this.cometd.endBatch());break;case"/meta/disconnect":Hi(Ji,this)&&(Fi(Ji,this,!1),this.cometd.endBatch()),Fi(Gi,this,{})}return t}},RequestTransport:Me,Transport:_e,WebSocketTransport:wn});t.Channel=class{constructor(t){a(this,"path",void 0),a(this,"update",void 0),a(this,"subscription",null);const{scopeBoundary:e,scopeKey:n,pushCategory:s}=t;(t=>{if(!t)throw new d("No scope found where one was required");const{scopeBoundary:e,scopeKey:n,pushCategory:s}=t;if(!e)throw new d("Missing scope component: scopeBoundary");if(!n)throw new d("Missing scope component: scopeKey");if(!s)throw new d("Missing scope component: pushCategory");if(!Object.prototype.hasOwnProperty.call(_,e))throw new d(`Invalid scope boundary: ${e}`);if(!Object.prototype.hasOwnProperty.call(N,s))throw new d(`Invalid push category: ${s}`)})(t),this.path=`/${e.toLowerCase()}/${n}/${s.toLowerCase()}`,ct.subscriptions.has(this.path)&&(this.subscription=ct.subscriptions.get(this.path)||null)}publish(t){return ct.publish(this,t)}async subscribe(t,e={}){if(this.subscription)try{await ct.remove(this.subscription)}catch(t){var n;const e=t,s=(null==e?void 0:e.message)||(null==e||null===(n=e.information)||void 0===n?void 0:n.error)||"";if(!s.includes("session_unknown")&&!s.includes("402"))throw t}this.update=t;let s=0;for(;s<3;)try{return this.subscription=await ct.add(this,t,e),this.subscription}catch(t){var i;const e=t,n=(null==e?void 0:e.message)||(null==e||null===(i=e.information)||void 0===i?void 0:i.error)||"";if((n.includes("session_unknown")||n.includes("402"))&&s<2){s++,ct.handshakeState="idle",ct.handshakePromise=void 0;const t=1e3,e=s;await new Promise(n=>setTimeout(n,t*e));continue}throw t}throw new Error(`Failed to subscribe to ${this.path} after 3 attempts`)}async unsubscribe(){this.subscription&&(await ct.remove(this.subscription),this.subscription=null)}async unsubscribeAll(){await ct.empty()}},t.DEFAULT_ERROR_HANDLERS=le,t.Fault=p,t.PUSH_CATEGORY=N,t.RITUAL=A,t.ROLE=$,t.Router=z,t.SCOPE_BOUNDARY=_,t.accountAdapter=F,t.adminAdapter=H,t.assetAdapter=ft,t.authAdapter=lt,t.chatAdapter=ne,t.cometdAdapter=ct,t.config=R,t.consensusAdapter=se,t.dailyAdapter=ce,t.emailAdapter=yt,t.episodeAdapter=mt,t.errorManager=L,t.groupAdapter=wt,t.leaderboardAdapter=vt,t.matchmakerAdapter=oe,t.presenceAdapter=St,t.projectAdapter=J,t.recaptchaAdapter=Tt,t.runAdapter=At,t.somebodyAdapter=ie,t.taskAdapter=ee,t.timeAdapter=Qt,t.userAdapter=Nt,t.utils=ue,t.vaultAdapter=Rt,t.version="Epicenter (v3.34.0) for Browsers | Build Date: 2026-02-12T21:41:02.367Z",t.videoAPI=Bt,t.videoAdapter=zt,t.vonageAPI=Jt,t.vonageAdapter=Yt,t.walletAdapter=he,t.worldAdapter=Zt});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).epicenter={})}(this,function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var s,i={exports:{}};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function r(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var s=n.call(t,e);if("object"!=o(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}function a(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}s||(s=1,function(t){var e=function(t){var e,n=Object.prototype,s=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},r=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function h(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,n){return t[e]=n}}function u(t,e,n,s){var o=e&&e.prototype instanceof g?e:g,r=Object.create(o.prototype),a=new R(s||[]);return i(r,"_invoke",{value:_(t,n,a)}),r}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d="suspendedStart",p="suspendedYield",f="executing",y="completed",m={};function g(){}function w(){}function b(){}var v={};h(v,r,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S(P([])));T&&T!==n&&s.call(T,r)&&(v=T);var E=b.prototype=g.prototype=Object.create(v);function x(t){["next","throw","return"].forEach(function(e){h(t,e,function(t){return this._invoke(e,t)})})}function k(t,e){function n(i,o,r,a){var c=l(t[i],t,o);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==typeof u&&s.call(u,"__await")?e.resolve(u.__await).then(function(t){n("next",t,r,a)},function(t){n("throw",t,r,a)}):e.resolve(u).then(function(t){h.value=t,r(h)},function(t){return n("throw",t,r,a)})}a(c.arg)}var o;i(this,"_invoke",{value:function(t,s){function i(){return new e(function(e,i){n(t,s,e,i)})}return o=o?o.then(i,i):i()}})}function _(t,n,s){var i=d;return function(o,r){if(i===f)throw new Error("Generator is already running");if(i===y){if("throw"===o)throw r;return{value:e,done:!0}}for(s.method=o,s.arg=r;;){var a=s.delegate;if(a){var c=A(a,s);if(c){if(c===m)continue;return c}}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if(i===d)throw i=y,s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);i=f;var h=l(t,n,s);if("normal"===h.type){if(i=s.done?y:p,h.arg===m)continue;return{value:h.arg,done:s.done}}"throw"===h.type&&(i=y,s.method="throw",s.arg=h.arg)}}}function A(t,n){var s=n.method,i=t.iterator[s];if(i===e)return n.delegate=null,"throw"===s&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==s&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+s+"' method")),m;var o=l(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var r=o.arg;return r?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function $(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function P(t){if(null!=t){var n=t[r];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(s.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return w.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=h(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},t.awrap=function(t){return{__await:t}},x(k.prototype),h(k.prototype,a,function(){return this}),t.AsyncIterator=k,t.async=function(e,n,s,i,o){void 0===o&&(o=Promise);var r=new k(u(e,n,s,i),o);return t.isGeneratorFunction(n)?r:r.next().then(function(t){return t.done?t.value:r.next()})},x(E),h(E,c,"Generator"),h(E,r,function(){return this}),h(E,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),n=[];for(var s in e)n.push(s);return n.reverse(),function t(){for(;n.length;){var s=n.pop();if(s in e)return t.value=s,t.done=!1,t}return t.done=!0,t}},t.values=P,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach($),!t)for(var n in this)"t"===n.charAt(0)&&s.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(s,i){return a.type="throw",a.arg=t,n.next=s,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var r=this.tryEntries[o],a=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var c=s.call(r,"catchLoc"),h=s.call(r,"finallyLoc");if(c&&h){if(this.prev<r.catchLoc)return i(r.catchLoc,!0);if(this.prev<r.finallyLoc)return i(r.finallyLoc)}else if(c){if(this.prev<r.catchLoc)return i(r.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return i(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&s.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=t,r.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(r)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),$(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var s=n.completion;if("throw"===s.type){var i=s.arg;$(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,s){return this.delegate={iterator:P(t),resultName:n,nextLoc:s},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}}(i));var c,h={exports:{}};var u=(c||(c=1,function(t,n){var s="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==e&&e,i=function(){function t(){this.fetch=!1,this.DOMException=s.DOMException}return t.prototype=s,new t}();!function(t){!function(n){var s=void 0!==t&&t||"undefined"!=typeof self&&self||void 0!==e&&e||{},i="URLSearchParams"in s,o="Symbol"in s&&"iterator"in Symbol,r="FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in s,c="ArrayBuffer"in s;if(c)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&h.indexOf(Object.prototype.toString.call(t))>-1};function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function d(t){return"string"!=typeof t&&(t=String(t)),t}function p(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function y(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function m(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function g(t){var e=new FileReader,n=m(e);return e.readAsArrayBuffer(t),n}function w(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():c&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=w(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=w(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=y(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=y(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(r)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,n,s,i,o=y(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=m(e),s=/charset=([A-Za-z0-9_-]+)/.exec(t.type),i=s?s[1]:"utf-8",e.readAsText(t,i),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),s=0;s<e.length;s++)n[s]=String.fromCharCode(e[s]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=l(t),e=d(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},f.prototype.delete=function(t){delete this.map[l(t)]},f.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},f.prototype.set=function(t,e){this.map[l(t)]=d(e)},f.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),p(t)},f.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),p(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),p(t)},o&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function S(t,e){if(!(this instanceof S))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,i,o=(e=e||{}).body;if(t instanceof S){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(n=e.method||this.method||"GET",i=n.toUpperCase(),v.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in s)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var r=/([?&])_=[^&]*/;r.test(this.url)?this.url=this.url.replace(r,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function T(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),s=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(s),decodeURIComponent(i))}}),e}function E(t,e){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},b.call(S.prototype),b.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var x=[301,302,303,307,308];E.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},n.DOMException=s.DOMException;try{new n.DOMException}catch(t){n.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},n.DOMException.prototype=Object.create(Error.prototype),n.DOMException.prototype.constructor=n.DOMException}function k(t,e){return new Promise(function(i,o){var a=new S(t,e);if(a.signal&&a.signal.aborted)return o(new n.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function u(){h.abort()}if(h.onload=function(){var t,e,n={statusText:h.statusText,headers:(t=h.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t}).forEach(function(t){var n=t.split(":"),s=n.shift().trim();if(s){var i=n.join(":").trim();try{e.append(s,i)}catch(t){console.warn("Response "+t.message)}}}),e)};0===a.url.indexOf("file://")&&(h.status<200||h.status>599)?n.status=200:n.status=h.status,n.url="responseURL"in h?h.responseURL:n.headers.get("X-Request-URL");var s="response"in h?h.response:h.responseText;setTimeout(function(){i(new E(s,n))},0)},h.onerror=function(){setTimeout(function(){o(new TypeError("Network request failed"))},0)},h.ontimeout=function(){setTimeout(function(){o(new TypeError("Network request timed out"))},0)},h.onabort=function(){setTimeout(function(){o(new n.DOMException("Aborted","AbortError"))},0)},h.open(a.method,function(t){try{return""===t&&s.location.href?s.location.href:t}catch(e){return t}}(a.url),!0),"include"===a.credentials?h.withCredentials=!0:"omit"===a.credentials&&(h.withCredentials=!1),"responseType"in h&&(r?h.responseType="blob":c&&(h.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof f||s.Headers&&e.headers instanceof s.Headers)){var p=[];Object.getOwnPropertyNames(e.headers).forEach(function(t){p.push(l(t)),h.setRequestHeader(t,d(e.headers[t]))}),a.headers.forEach(function(t,e){-1===p.indexOf(e)&&h.setRequestHeader(e,t)})}else a.headers.forEach(function(t,e){h.setRequestHeader(e,t)});a.signal&&(a.signal.addEventListener("abort",u),h.onreadystatechange=function(){4===h.readyState&&a.signal.removeEventListener("abort",u)}),h.send(void 0===a._bodyInit?null:a._bodyInit)})}k.polyfill=!0,s.fetch||(s.fetch=k,s.Headers=f,s.Request=S,s.Response=E),n.Headers=f,n.Request=S,n.Response=E,n.fetch=k,Object.defineProperty(n,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=s.fetch?s:i;(n=o.fetch).default=o.fetch,n.fetch=o.fetch,n.Headers=o.Headers,n.Request=o.Request,n.Response=o.Response,t.exports=n}(h,h.exports)),h.exports),l=n(u);class d extends Error{constructor(t,e){super(t),a(this,"code",void 0),this.code=e}}class p extends d{constructor(t,e){var n;super(t.message,null===(n=t.information)||void 0===n?void 0:n.code),a(this,"status",void 0),a(this,"information",void 0),a(this,"cause",void 0);const{information:s,message:i,cause:o,status:r}=t;if(this.status=null!=r?r:null==e?void 0:e.status,this.message=i,s){const{code:t,...e}=s;this.code=t,this.information=e}o&&(this.cause=o)}}class f{constructor(t,e){a(this,"status",void 0),a(this,"headers",void 0),a(this,"body",void 0);const{status:n,headers:s}=e;this.status=n,this.headers=s,this.body=t}}const y=new Function("try {return this===window;}catch(e){ return false;}"),m=new Function('try {return (typeof process !== "undefined") && (typeof process.versions.node !== "undefined")}catch(e){return false;}'),g=(t,e)=>e.startsWith(t)?e:`${t}${e}`,w=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var b={getItem:t=>t&&decodeURIComponent(document.cookie.replace(new RegExp(`(?:(?:^|.*;)\\s*${w(encodeURIComponent(t))}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1"))||null,setItem(t,e,n={}){if(!t||/^(?:expires|max-age|path|domain|secure)$/i.test(t))return!1;const{path:s,domain:i,end:o,secure:r,samesite:a}=n,c=(t=>{if(!t)return"";switch(t.constructor){case Number:return t===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":`; max-age=${t}`;case String:return`; expires=${t}`;case Date:return`; expires=${new Date(t).toUTCString()}`;default:return""}})(o),h=i?`; domain=${i}`:"",u=s?`; path=${s}`:"",l=r?"; secure":"",d=a?`; samesite=${a}`:"";return document.cookie=`${encodeURIComponent(t)}=${encodeURIComponent(e)}${c}${h}${u}${l}${d}`,!0},removeItem(t,e={}){if(!this.hasItem(t))return!1;const{path:n,domain:s}=e,i=s?`; domain=${s}`:"",o=n?`; path=${n}`:"";return document.cookie=`${encodeURIComponent(t)}=; expires=Thu, 01 Jan 1970 00:00:00 GMT${i}${o}`,!0},hasItem:t=>!(!t||/^(?:expires|max-age|path|domain|secure)$/i.test(t))&&new RegExp(`(?:^|;\\s*)${w(encodeURIComponent(t))}\\s*\\=`).test(document.cookie),clear(){const t=document.cookie.replace(/((?:^|\s*;)[^=]+)(?=;|$)|^\s*|\s*(?:=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:=[^;]*)?;\s*/);for(let e=t.length,n=0;n<e;n++)t[n]=decodeURIComponent(t[n]),this.removeItem(t[n]);return t}};class v{constructor(t){a(this,"_store",void 0),this._store=t}clear(){this._store.clear()}get store(){return this._store}set store(t){this._store=t}}const S=new Map;class T extends v{constructor(){super(S)}getItem(t){return super.store.get(t)}setItem(t,e){return super.store.set(t,e)}removeItem(t){return super.store.delete(t)}}class E extends v{constructor(){super(window.sessionStorage)}getItem(t){const e=super.store.getItem(t);return e?JSON.parse(e):null}setItem(t,e){return super.store.setItem(t,JSON.stringify(e))}removeItem(t){return super.store.removeItem(t)}}class x{constructor(t={}){a(this,"options",{});this.options={path:"/",...t}}getItem(t){const e=b.getItem(t);return e?JSON.parse(e):null}setItem(t,e){return b.setItem(t,JSON.stringify(e),this.options)}removeItem(t){return b.removeItem(t,this.options)}clear(){return b.clear()}}let k=function(t){return t.COOKIE="COOKIE",t.SESSION="SESSION",t}({}),_=function(t){return t.PROJECT="PROJECT",t.GROUP="GROUP",t.EPISODE="EPISODE",t.WORLD="WORLD",t}({}),A=function(t){return t.NONE="NONE",t.INTER="INTER",t.REANIMATE="REANIMATE",t.REVIVE="REVIVE",t.EXORCISE="EXORCISE",t.RESURRECT="RESURRECT",t}({}),N=function(t){return t.CHAT="CHAT",t.CONSENSUS="CONSENSUS",t.CONTROL="CONTROL",t.PRESENCE="PRESENCE",t.LOBBY="LOBBY",t.STREAM="STREAM",t.RUN="RUN",t.VAULT="VAULT",t.VIDEO="VIDEO",t.WORLD="WORLD",t.LEADERBOARD="LEADERBOARD",t.GROUP="GROUP",t.SYSTEM="SYSTEM",t}({}),$=function(t){return t.SYSTEM="SYSTEM",t.MONITOR="MONITOR",t.OWNER="OWNER",t.AUTHOR="AUTHOR",t.SUPPORT="SUPPORT",t.ASSOCIATE="ASSOCIATE",t.FACILITATOR="FACILITATOR",t.REVIEWER="REVIEWER",t.USER="USER",t.LEADER="LEADER",t.PARTICIPANT="PARTICIPANT",t.ANONYMOUS="ANONYMOUS",t}({});const R=new class{constructor(){if(a(this,"_apiVersion",3),a(this,"_apiProtocol",""),a(this,"_apiHost",""),a(this,"_useProjectProxy",!1),a(this,"_accountShortName",""),a(this,"_projectShortName",""),a(this,"authOverride",void 0),y())this.loadBrowser();else{if(!m())throw new d("Could not identify environment; no configuration was setup");this.loadNode()}}get apiProtocol(){return this._apiProtocol}set apiProtocol(t){let e=t.toLowerCase();e.startsWith("http")&&(e.endsWith(":")&&(e=e.slice(0,-1)),this._apiProtocol=e)}get apiHost(){return this._apiHost}set apiHost(t){this._apiHost=t}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(t){this._useProjectProxy=t}get apiVersion(){return this._apiVersion}set apiVersion(t){}get accountShortName(){return this._accountShortName}set accountShortName(t){this._accountShortName=t}get projectShortName(){return this._projectShortName}set projectShortName(t){this._projectShortName=t}isLocal(){if(!y())return!1;const t=window.location.host;return"127.0.0.1"===t||0===t.indexOf("local.")||-1!==t.indexOf("ngrok")||0===t.indexOf("localhost")}loadNode(){this.apiProtocol="https",this.apiHost="forio.com"}loadBrowser(){const t=this.isLocal(),{protocol:e,pathname:n,host:s}=window.location;this.apiProtocol=t?"https":e,this.apiHost=t?"forio.com":s;const i=n.match(/\/app\/([\w-]+)\/([\w-]+)/);if(i){const[t,e]=i.slice(1);this.accountShortName=t,this.projectShortName=e}}setContext(t){t.apiProtocol&&(this.apiProtocol=t.apiProtocol),t.apiHost&&(this.apiHost=t.apiHost),"boolean"==typeof t.useProjectProxy&&(this.useProjectProxy=t.useProjectProxy),t.accountShortName&&(this.accountShortName=t.accountShortName),t.projectShortName&&(this.projectShortName=t.projectShortName)}},{COOKIE:P,SESSION:O}=k,C="com.forio.epicenter.session",I="epicenter.v3.sso";const j=new class{constructor(t){if(a(this,"type",void 0),t!==P&&t!==O)throw new d(`Invalid Storage Type: "${String(t)}", please use "${String(P)}" or "${String(O)}".`);this.type=t,this.consumeSSO()}get session(){return(new(this.getStore())).getItem(C)}set session(t){const e=this.getStore(),n=this.getStoreOptions(t);t?new e(n).setItem(C,t):this.session&&new e(n).removeItem(C)}setSessionWithOptions(t,e){const n=this.getStore(),s=this.getStoreOptions(t,e);t?new n(s).setItem(C,t):this.session&&new n(s).removeItem(C)}getStore(){return m()?T:this.type===O?E:x}getStoreOptions(t,e){const n=t||this.session;if(!n||m())return"";const{objectType:s}=n,i=R.isLocal(),o={samesite:i?"lax":"none",secure:!i},r=!i&&"app"!==window.location.pathname.split("/")[1],a=!i&&!r;if(!1===e)return{...o,path:"/"};if(!0===e||a&&("user"===s||"admin"===s)){const{accountShortName:t,projectShortName:e}=R,n=t?`/${t}`:"",s=n&&e?`/${e}`:"";return{...o,path:`/app${n}${s}`}}return{...o,path:"/"}}consumeSSO(){if(m())return;let t=b.getItem(I);"string"==typeof t&&'"'!==t.charAt(0)&&'"'!==t.charAt(t.length-1)&&(t=`"${t}"`);const e=JSON.parse(JSON.parse(null!=t?t:'"null"'));if(e){const{accountShortName:t,projectShortName:n}=e,s=t?`/${t}`:"",i=s&&n?`/${n}`:"";this.session=e,b.removeItem(I,{path:`/app${s}${i}`}),b.removeItem(I,{domain:`.${window.location.hostname}`,path:`/app${s}${i}`})}}}(P);const L=new class{constructor(){a(this,"_handlers",[])}get handlers(){return this._handlers}clearHandlers(){this._handlers=[]}registerHandler(t,e){const n={identifier:t,handle:e,unregister:()=>this.unregisterHandler(t)};return this.handlers.unshift(n),n}unregisterHandler(t){const e=this.handlers.findIndex(e=>e.identifier===t);e>-1&&this.handlers.splice(e,1)}async handle(t,e,n){const s=(n=n||this.handlers).findIndex(({identifier:e})=>e(t)),i=n[s];if(!i)throw t;let o;try{o=await i.handle(t,e).catch(t=>{throw t})}catch(i){console.error("Handler failed due to error",i);const r=s>-1?[...n.slice(0,s),...n.slice(s+1)]:[],a=i instanceof p?i:t;o=await this.handle(a,e,r)}return o}};const M=t=>t.constructor===URLSearchParams?t:("object"==typeof t&&t.constructor===Object&&(t=Object.entries(t).reduce((t,[e,n])=>Array.isArray(n)?[...t,...n.map(t=>[e,t])]:(null==n||t.push([e,n.toString()]),t),[])),new URLSearchParams(t)),U=(t,e,n,s)=>{const i=Object.assign({},t);let o=null;if(y()&&e instanceof FormData?o=e:e&&(i["Content-type"]="application/json; charset=UTF-8",o=JSON.stringify(e)),!n)return delete i.Authorization,{headers:i,body:o};const{session:r}=j;return i.Authorization||(r&&(i.Authorization=`Bearer ${r.token}`),s&&(i.Authorization=s),R.authOverride&&(i.Authorization=R.authOverride)),{headers:i,body:o}},D=204,B=400,K=200;async function W(t,e){if(t.href.length>2048)throw new d(`URL length exceeds maximum of 2048 characters: ${t.href.length} characters.`);const{method:n,headers:s,body:i,includeAuthorization:o,inert:r,paginated:a,authorization:c}=e,h=U(s,i,o,c),u=await l(t.toString(),{method:n,cache:"no-cache",redirect:"follow",headers:h.headers,body:h.body});if(u.status===D)return new f(void 0,u);const y=u.headers.get("content-type");if(!y||!y.includes("application/json"))throw new d(`Response content-type '${y}' does not include 'application/json' and my url is ${t.toString()}, ${n}`);const m=await u.json();if(u.status>=K&&u.status<B){const n=new f(a?function(t,e,n){var s;const i=null!==(s=n.parsePage)&&void 0!==s?s:t=>t,o={...t,values:i(t.values)},r=t.totalResults,a=async function(t=0,s=[]){if(t>=r)return s;const o=new URLSearchParams(e.search);o.set("first",t.toString()),o.delete("max"),e.search=o.toString();const c=await W(e,{...n,paginated:!1}).then(({body:t})=>t);return s.push(...i(c.values)),a(t+c.maxResults,s)};return o.prev=async function(){const t=new URLSearchParams(e.search);if(0===o.firstResult)return console.warn('Pagination: cannot call "prev" on first page'),[];const s=o.firstResult-o.maxResults,r=o.maxResults+(s<0?s:0);t.set("first",Math.max(s,0).toString()),t.set("max",r.toString()),e.search=t.toString();const a=await W(e,{...n,paginated:!1}).then(({body:t})=>t);return a.values=i(a.values),Object.assign(o,a),o.values},o.next=async function(){const t=new URLSearchParams(e.search),s=o.firstResult+o.maxResults;if(s>=o.totalResults)return console.warn('Pagination: cannot call "next" on final page'),[];t.set("first",s.toString()),e.search=t.toString();const r=await W(e,{...n,paginated:!1}).then(({body:t})=>t);return r.values=i(r.values),Object.assign(o,r),o.values},o.all=a,o}(m,t,e):m,u);return n}const g=new p(m,u);if(!0===r)throw g;if("function"==typeof r&&r(g))throw g;const w={...e,inert:!0},b=()=>W(t,w);return b.requestArguments={url:t,...w},L.handle(g,b)}class z{constructor(){a(this,"_version",void 0),a(this,"_server",void 0),a(this,"_useProjectProxy",void 0),a(this,"_accountShortName",void 0),a(this,"_projectShortName",void 0),a(this,"_authorization",void 0),a(this,"_searchParams",new URLSearchParams)}get version(){return this._version}set version(t){this._version=t}get server(){return this._server}set server(t){this._server=t}get useProjectProxy(){return this._useProjectProxy}set useProjectProxy(t){this._useProjectProxy=t}get accountShortName(){return this._accountShortName}set accountShortName(t){this._accountShortName=t}get projectShortName(){return this._projectShortName}set projectShortName(t){this._projectShortName=t}get authorization(){return this._authorization}set authorization(t){this._authorization=t}get searchParams(){return this._searchParams}set searchParams(t){this._searchParams=M(t)}withVersion(t){return void 0!==t&&(this.version=t),this}withServer(t){return void 0!==t&&(this.server=t),this}withProjectProxy(t){return void 0!==t&&(this.useProjectProxy=t),this}withAccountShortName(t){return void 0!==t&&(this.accountShortName=t),this}withProjectShortName(t){return void 0!==t&&(this.projectShortName=t),this}withAuthorization(t){return void 0!==t&&(this.authorization=t),this}withSearchParams(t){return void 0!==t&&(this.searchParams=t),this}getURL(t,e={}){var n,s,i,o,r,a,c,h,u,l,d;const p=null!==(n=null!==(s=e.server)&&void 0!==s?s:this.server)&&void 0!==n?n:`${R.apiProtocol}://${R.apiHost}`,f=null!==(i=null!==(o=e.useProjectProxy)&&void 0!==o?o:this.useProjectProxy)&&void 0!==i?i:R.useProjectProxy,y=null!==(r=null!==(a=e.accountShortName)&&void 0!==a?a:this.accountShortName)&&void 0!==r?r:R.accountShortName,m=null!==(c=null!==(h=e.projectShortName)&&void 0!==h?h:this.projectShortName)&&void 0!==c?c:R.projectShortName,w=null!==(u=null!==(l=null==e?void 0:e.version)&&void 0!==l?l:this.version)&&void 0!==u?u:R.apiVersion,b=new URL(`${p}`),v=f?`proxy/${y}/${m}/`:"",S=`api/v${w}/${y}/${m}`,T=g("/",t);return b.pathname=`${v}${S}${T}`,b.search=void 0!==e.query?M(e.query).toString():(null!==(d=this.searchParams)&&void 0!==d?d:new URLSearchParams).toString(),b}async get(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,includeAuthorization:h,inert:u,paginated:l,parsePage:d}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"GET",headers:c,includeAuthorization:null==h||h,authorization:null!=i?i:this.authorization,inert:u,paginated:l,parsePage:d})}async delete(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,includeAuthorization:h,inert:u}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"DELETE",headers:c,includeAuthorization:null==h||h,authorization:null!=i?i:this.authorization,inert:u})}async patch(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,body:h,includeAuthorization:u,inert:l}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"PATCH",headers:c,body:h,includeAuthorization:null==u||u,authorization:null!=i?i:this.authorization,inert:l})}async post(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,body:h,includeAuthorization:u,inert:l}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"POST",headers:c,body:h,includeAuthorization:null==u||u,authorization:null!=i?i:this.authorization,inert:l})}async put(t,e={}){const{accountShortName:n,projectShortName:s,authorization:i,server:o,query:r,useProjectProxy:a,headers:c,body:h,includeAuthorization:u,inert:l}=e;return W(this.getURL(t,{server:o,query:r,accountShortName:n,projectShortName:s,useProjectProxy:a}),{method:"PUT",headers:c,body:h,includeAuthorization:null==u||u,authorization:null!=i?i:this.authorization,inert:l})}}var F=Object.freeze({__proto__:null,createAccount:async function(t){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").post("/account",{body:t}).then(({body:t})=>t)},getAccount:async function(t){return await(new z).withAccountShortName(t).get("/account").then(({body:t})=>t)},removeAccount:async function(t){return await(new z).withAccountShortName(t).delete("/account").then(({body:t})=>t)},teamForAdmin:async function(t,e={}){const{includeAllMembers:n,filter:s,first:i,max:o,...r}=e,a={includeAllMembers:n,filter:s,first:i,max:o};return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").withSearchParams(a).get(`/account/team/for/${t}`,r).then(({body:t})=>t)},updateAccount:async function(t,e={}){return await(new z).patch("/account",{body:t,...e}).then(({body:t})=>t)}});var H=Object.freeze({__proto__:null,createAdmin:async function(t){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").post("/admin",{body:t}).then(({body:t})=>t)},getWithHandle:async function(t,e={}){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").get(`/admin/with/${t}`,e).then(({body:t})=>t)}});function q(t){if(!t.filters||0===t.filters.length)return"";const e=t.filters.map(t=>"string"==typeof t?t:q(t)).filter(t=>t.length>0);if(0===e.length)return"";if(!t.type||!["and","or","taxonomy"].includes(t.type))throw new Error(`Invalid or missing filter group type: ${t.type||"undefined"}`);const n=e.join(";");if(1===e.length)return n;switch(t.type){case"and":return`(${n})`;case"or":return`[${n}]`;case"taxonomy":return`{${n}}`;default:throw new Error(`Unexpected filter group type: ${t.type}`)}}function G(t){if(t)return Array.isArray(t)?t.length>0?t.join(";"):void 0:"string"==typeof t?t||void 0:q(t)||void 0}async function V(t={}){return await(new z).get("/project",t).then(({body:t})=>t)}var J=Object.freeze({__proto__:null,ACCESS_TYPE:{PUBLIC:"PUBLIC",PRIVATE:"PRIVATE",AUTHENTICATED:"AUTHENTICATED"},CHANNEL_PROTOCOL:{OUMUAMUA:"OUMUAMUA",COMETD:"COMETD"},PHYLOGENY:{ORIGINAL:"ORIGINAL",HISTORICAL:"HISTORICAL",REFERENTIAL:"REFERENTIAL",ORDERED:"ORDERED",EVENTUAL:"EVENTUAL",TRANSMOGRIFIED:"TRANSMOGRIFIED",REANIMATED:"REANIMATED",SILENT:"SILENT"},WORKER_PARTITION:{NONE:"NONE",ALL:"ALL",FREE:"FREE",LICENSED:"LICENSED",ACCOUNT:"ACCOUNT"},channelsEnabled:async function(t={}){return await(new z).get("/project/channel/isEnabled",t).then(({body:t})=>t)},get:V,list:async function(t,e={}){return await(new z).withAccountShortName(t).withProjectShortName("manager").get("/project/in",e).then(({body:t})=>t)}});const Y="com.forio.epicenter.token",X="idle",Z="failed",Q="connected",tt="succeeded",et="handshaking",nt="disconnected",st=["402","session_unknown","invalid client id","missing client id","session has been disconnected","invalid session type","handshake_denied","handshake_failed"];function it(t){const e=t.toLowerCase();return st.some(t=>e.includes(t))}function ot(t){return t instanceof Error&&t.message.toLowerCase().includes("illegal state")}function rt(t){var e,n;if("handshake"===(null===(e=t.advice)||void 0===e?void 0:e.reconnect))return!0;return it(null!==(n=t.error)&&void 0!==n?n:"")}let at;const ct=new class{constructor(){a(this,"url",""),a(this,"initialization",void 0),a(this,"handshakePromise",void 0),a(this,"subscriptions",new Map),a(this,"isConnected",!1),a(this,"handshakeState",X),a(this,"pendingOperations",[]),a(this,"processingQueue",!1)}get cometd(){if(!at)throw new d("Tried to get non-existent cometd");return at}set cometd(t){at=t}async startup(t={logLevel:"warn"}){var e;const n=await V();if(!n.channelEnabled)throw new d("Push Channels are not enabled on this project");const s=(null===(e=n.channelProtocol)||void 0===e?void 0:e.toLowerCase())||"cometd",{CometD:i}=await Promise.resolve().then(function(){return eo}),{AckExtension:o}=await Promise.resolve().then(function(){return eo}),{ReloadExtension:r}=await Promise.resolve().then(function(){return eo});this.cometd=new i;const{apiProtocol:a,apiHost:c,apiVersion:h,accountShortName:u,projectShortName:l}=R,p=u&&l?`/${u}/${l}`:"/epicenter/manager";return this.url=`${a}://${c}/push/v${h}${p}/${s}`,this.cometd.registerExtension("ack",new o),y()&&(this.cometd.registerExtension("reload",new r),window.onunload=()=>{if(this.cometd.getStatus()===Q){this.cometd.reload&&this.cometd.reload();const t=this.cometd.getTransport();t&&t.abort()}}),this.cometd.configure({url:this.url,logLevel:t.logLevel}),!0}listenToMetaChannels(){this.cometd.addListener("/meta/handshake",t=>{t.successful?(this.handshakeState=tt,this.processPendingOperations()):(this.handshakeState=Z,this.handleHandshakeFailure(t))});const t=new Promise((t,e)=>{this.cometd.addListener("/meta/connect",n=>{if(this.cometd.isDisconnected())return;const s=this.isConnected;if(this.isConnected=n.successful||!1,!s&&this.isConnected){const n=new p({status:void 0,message:"Reconnected to CometD",information:{code:"COMETD_RECONNECTED"}}),s=()=>Promise.resolve();try{const e=L.handle(n,s);t(e)}catch(t){e(t)}this.processPendingOperations()}else s&&!this.isConnected&&(this.handshakeState=X)})}),e=new Promise(t=>{this.cometd.addListener("/meta/disconnect",e=>{e.successful&&(this.isConnected=!1,this.handshakeState=X),t(e)})});return Promise.all([t,e])}handleHandshakeFailure(t){rt(t)&&(this.handshakeState=X,this.handshakePromise=void 0)}async processPendingOperations(){if(this.processingQueue||0===this.pendingOperations.length)return;this.processingQueue=!0;const t=[...this.pendingOperations];this.pendingOperations=[];try{await Promise.all(t.map(t=>t().catch(console.error)))}finally{this.processingQueue=!1}}async init(t){return this.initialization||(this.initialization=this.startup(t)),this.initialization}async handshake(t={}){if(await this.init(),this.handshakePromise&&this.handshakeState===et)return this.handshakePromise;const e=this.cometd.getStatus();if(e===Q&&this.handshakeState===tt)return Promise.resolve();if("connecting"===e||e===et)return this.handshakePromise?this.handshakePromise:Promise.reject(new Error("CometD is already connecting, please wait"));if(e!==nt)return Promise.resolve();this.handshakeState=et;const{session:n}=j;let s={};return n&&(s={ext:{[Y]:n.token,ack:!0}}),this.cometd.websocketEnabled=!0,this.handshakePromise=new Promise((e,n)=>{this.cometd.handshake(s,s=>{var i;if(s.successful)return this.handshakeState=tt,this.listenToMetaChannels(),void e(void 0);this.handshakeState=Z,rt(s)&&(this.handshakeState=X,this.handshakePromise=void 0);const o=null!==(i=s.error)&&void 0!==i?i:"",r=new p({status:o.includes("403")?403:void 0,message:o,information:{code:"COMETD_ERROR",...s}});if(t.inert)return void n(r);const a=()=>this.handshake({inert:!0});try{const t=L.handle(r,a);e(t)}catch(t){n(t)}})}),this.handshakePromise}async disconnect(){return this.initialization?(await this.init(),await this.empty(),this.cometd.getStatus()!==Q?Promise.resolve():new Promise((t,e)=>this.cometd.disconnect(n=>{var s;if(n.successful)return void t(void 0);it(null!==(s=n.error)&&void 0!==s?s:"")?t(void 0):e(new d("Unable to disconnect from CometD server"))}))):Promise.resolve()}async add(t,e,n={}){var s;await this.init();if((null===(s=this.cometd)||void 0===s?void 0:s.getStatus())!==Q)try{await this.handshake()}catch(t){var i;const e=t;if(null!=e&&null!==(i=e.message)&&void 0!==i&&i.includes("already connecting")){var o;const t=500;await new Promise(e=>setTimeout(e,t)),null===(o=this.cometd)||void 0===o||o.getStatus()}throw t}const{session:r}=j,a=r?{ext:{[Y]:r.token}}:{},c=t=>{let n=t.data;if("string"==typeof n)try{n=JSON.parse(n)}catch(t){}return e(n)};return new Promise((s,i)=>{let o;try{o=this.cometd.subscribe(t.path,c,a,r=>{var a;if(r.successful)return this.subscriptions.set(t.path,o),void s(o);rt(r)&&(this.handshakeState=X,this.handshakePromise=void 0);const c=null!==(a=r.error)&&void 0!==a?a:"",h=new p({status:c.includes("403")?403:void 0,message:c,information:{code:"COMETD_ERROR",...r}});if(n.inert)return void i(h);const u=async()=>(rt(r)&&await this.handshake({inert:!0}),this.add(t,e,{inert:!0}));try{const t=L.handle(h,u);s(t)}catch(t){i(t)}})}catch(o){var r;const a=null!==(r=n._retryCount)&&void 0!==r?r:0;if(ot(o)&&a<3)return this.handshakeState=X,this.handshakePromise=void 0,void this.handshake().then(()=>this.add(t,e,{...n,_retryCount:a+1})).then(s).catch(i);i(o)}})}async publish(t,e,n={}){await this.init(),this.cometd.getStatus()!==Q&&await this.handshake();const{session:s}=j,i={ext:s?{[Y]:s.token}:void 0};return new Promise((s,o)=>{try{this.cometd.publish(t.path,e,i,i=>{var r;if(i.successful)return void s(i);rt(i)&&(this.handshakeState=X,this.handshakePromise=void 0);const a=null!==(r=i.error)&&void 0!==r?r:"",c=new p({status:a.includes("403")?403:void 0,message:a,information:{code:"COMETD_ERROR",...i}});if(n.inert)return void o(c);const h=async()=>(rt(i)&&await this.handshake({inert:!0}),this.publish(t,e,{inert:!0}));try{const t=L.handle(c,h);s(t)}catch(t){o(t)}})}catch(i){var r;const a=null!==(r=n._retryCount)&&void 0!==r?r:0;if(ot(i)&&a<3)return this.handshakeState=X,this.handshakePromise=void 0,void this.handshake().then(()=>this.publish(t,e,{...n,_retryCount:a+1})).then(s).catch(o);o(i)}})}async remove(t){let e;await this.init();for(const[n,s]of this.subscriptions.entries())if(s===t){e=n;break}return e&&(this.subscriptions.delete(e),this.cometd.getStatus()===nt)?Promise.resolve():new Promise((e,n)=>{try{this.cometd.unsubscribe(t,t=>{var s;if(t.successful)return void e(t);const i=null!==(s=t.error)&&void 0!==s?s:"";if(it(i))return void e(t);const o=new p({status:void 0,message:i,information:{code:"COMETD_ERROR",...t}});n(o)})}catch(t){if(ot(t))return void e(void 0);n(t)}})}async empty(){await this.init(),this.cometd.clearSubscriptions(),this.subscriptions.clear()}};async function ht(){j.session=void 0,await ct.disconnect()}async function ut(t,e={}){const{objectType:n="user",accountShortName:s,forcePathInclusion:i,...o}=e,r=await(new z).patch("/authentication",{accountShortName:"admin"===n?t:s,body:{objectType:n,groupKey:"user"===n?t:void 0},...o}).then(({body:t})=>t);return await ht(),j.setSessionWithOptions(r,i),r}var lt=Object.freeze({__proto__:null,generateSAMLLINK:function(t={}){return(new z).getURL("/registration/sso/user/saml",t).toString()},getLocalSession:function(){return j.session},getSAMLLink:async function(t={}){return await(new z).get("/registration/sso/user/saml",t).then(({body:t})=>t)},getSession:async function(t={}){const{body:e}=await(new z).get("/verification",t);return j.session=e,e},login:async function(t,e={}){const{objectType:n,forcePathInclusion:s,...i}=e;let o;if(Object.prototype.hasOwnProperty.call(t,"handle")){const{handle:e,password:s,groupKey:i}=t;o={objectType:null!=n?n:"user",handle:e,password:s,groupKey:i||void 0}}if(Object.prototype.hasOwnProperty.call(t,"secretKey")){const{secretKey:e}=t;o={objectType:null!=n?n:"account",secretKey:e}}const r=await(new z).post("/authentication",{inert:!0,includeAuthorization:!1,body:o,...i}).then(({body:t})=>t);return await ht(),j.setSessionWithOptions(r,s),r},logout:async function(t={},e=t){var n;const s=[ct.disconnect()],i=null==j||null===(n=j.session)||void 0===n?void 0:n.groupKey;i&&s.push((new z).delete(`/presence/group/${i}`,e)),await Promise.allSettled(s),await(new z).delete("/verification",t).finally(()=>j.session=void 0)},regenerate:ut,removeLocalSession:ht,resetPassword:async function(t,e={}){const{redirectURL:n,subject:s,...i}=e;return await(new z).post(`/verification/password/user/${t}`,{...i,body:{redirectUrl:n,subject:s}}).then(({body:t})=>t)},setLocalSession:function(t){return j.session=t},sso:async function(t={}){const e=await(new z).get("/registration/sso/user",t).then(({body:t})=>t);return j.session=e,e},ssoOutcome:async function(t,e,n={}){const{...s}=n;return await(new z).post(`/lti/${t}/outcome`,{body:e,...s}).then(({body:t})=>t)},verify:async function(t,e={}){return await(new z).get("/verification",{authorization:`Bearer ${t}`,...e}).then(({body:t})=>t)}});async function dt(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,ttlSeconds:c,tokenAccessSeconds:h,...u}=n;return await(new z).withSearchParams({tokenAccessSeconds:h}).post("/asset",{body:{file:t,scope:{scopeBoundary:s,scopeKey:i,userKey:o},permit:{readLock:null!=r?r:$.USER,writeLock:null!=a?a:$.USER},ttlSeconds:c},...u}).then(({body:t})=>t)}async function pt(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,ttlSeconds:c,tokenAccessSeconds:h,...u}=n;return await(new z).withSearchParams({tokenAccessSeconds:h}).patch("/asset",{body:{file:t,scope:{scopeBoundary:s,scopeKey:i,userKey:o},permit:{readLock:null!=r?r:$.USER,writeLock:null!=a?a:$.USER},ttlSeconds:c},...u}).then(({body:t})=>t)}var ft=Object.freeze({__proto__:null,create:dt,download:async function(t,e={}){const{tokenAccessSeconds:n,...s}=e;return await(new z).withSearchParams({tokenAccessSeconds:n}).get(`/asset/download/${t}`,s).then(({body:t})=>t)},downloadWithScope:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{tokenAccessSeconds:r,...a}=n,c=o?`/${o}`:"";return await(new z).withSearchParams({tokenAccessSeconds:r}).get(`/asset/download/with/${s}/${i}${c}/${t}`,a).then(({body:t})=>t)},get:async function(t,e={}){const{server:n,accountShortName:s,projectShortName:i}=e;return await(new z).withServer(n).withAccountShortName(s).withProjectShortName(i).get(`/asset/${t}`).then(({body:t})=>t)},getURL:async function(t,e={}){const{tokenAccessSeconds:n,...s}=e;return await(new z).withSearchParams({tokenAccessSeconds:n}).get(`/asset/url/${t}`,s).then(({body:t})=>t)},getURLWithScope:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{tokenAccessSeconds:r,...a}=n,c=o?`/${o}`:"";return await(new z).withSearchParams({tokenAccessSeconds:r}).get(`/asset/url/with/${s}/${i}${c}/${t}`,a).then(({body:t})=>t)},list:async function(t,e={}){const{scopeBoundary:n,scopeKey:s,userKey:i}=t,{filter:o,...r}=e,a=i?`/${i}`:"";return await(new z).get(`/asset/in/${n}/${s}${a}/${null!=o?o:"*"}`,r).then(({body:t})=>t)},remove:async function(t,e={}){return await(new z).delete(`/asset/${t}`,e).then(({body:t})=>t)},removeFromScope:async function(t,e={}){const{scopeBoundary:n,scopeKey:s,userKey:i}=t,o=i?`/${i}`:"";return await(new z).delete(`/asset/in/${n}/${s}${o}`,e).then(({body:t})=>t)},store:async function(t,e,n={}){const{overwrite:s,fileName:i,...o}=n,r=null!=i?i:t.name;let a="";try{a=(await dt(r,e,{inert:!0,...o})).url}catch(t){if(!(t instanceof p))throw t;if(!(409===t.status&&s))throw t;a=(await pt(r,e,o)).url}await l(a,{method:"PUT",body:t})},update:pt});var yt=Object.freeze({__proto__:null,sendEmail:async function(t,e,n,s,i={}){const{accountShortName:o,projectShortName:r,server:a,familyNameFirst:c,html:h,from:u,replyTo:l,fromUserKey:d,attachments:p,...f}=i;let y="";return d?y+=`/as/${d}`:u&&(y+=`/from/${u}`,l&&(y+=`/${l}`)),await(new z).withServer(a).withAccountShortName(o).withProjectShortName(r).post(`/email/user/${t}/${e}${y}`,{body:{subject:n,body:s,familyNameFirst:c,html:h,attachments:p},...f}).then(({body:t})=>t)},sendEmailToAdmin:async function(t,e,n,s={}){const{accountShortName:i,projectShortName:o,server:r,familyNameFirst:a,html:c,attachments:h,...u}=s;return await(new z).withServer(r).withAccountShortName(i).withProjectShortName(o).post(`/email/admin/${t}`,{body:{subject:e,body:n,familyNameFirst:a,html:c,attachments:h},...u}).then(({body:t})=>t)},sendEmailToSupport:async function(t,e,n={}){const{accountShortName:s,projectShortName:i,server:o,supportType:r,familyNameFirst:a,html:c,attachments:h,...u}=n;return await(new z).withServer(o).withAccountShortName(s).withProjectShortName(i).withSearchParams({supportType:r}).post("/email/to/support",{body:{subject:t,body:e,familyNameFirst:a,html:c,attachments:h},...u}).then(({body:t})=>t)}});var mt=Object.freeze({__proto__:null,create:async function(t,e,n={}){const{draft:s,runLimit:i,category:o,...r}=n;return await(new z).post(`/episode/${e}`,{body:{name:t,draft:s,runLimit:i,category:o},...r}).then(({body:t})=>t)},forGroup:async function(t,e={}){return await(new z).get(`/episode/in/${t}`,e).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/episode/${t}`,e).then(({body:t})=>t)},query:async function(t,e={}){const{filter:n,sort:s=[],first:i=0,max:o}=t;return await(new z).withSearchParams({filter:G(n),sort:s.join(";")||void 0,first:i,max:o}).get("/episode/search",{paginated:!0,...e}).then(({body:t})=>t)},remove:async function(t,e={}){return await(new z).delete(`/episode/${t}`,e).then(({body:t})=>t)},withName:async function(t,e={}){const{groupName:n,...s}=e,i=j.session;return await(new z).get(`/episode/with/${null!=n?n:null==i?void 0:i.groupName}/${t}`,s).then(({body:t})=>t)}});async function gt(t,e={}){const{filter:n,sort:s=[],first:i,max:o,quantized:r}=t,a={filter:G(n),sort:s.join(";")||void 0,first:i,max:o};return await(new z).withSearchParams(a).get(`/group${r?"/quantized":""}/search`,{paginated:!0,...e}).then(({body:t})=>t)}var wt=Object.freeze({__proto__:null,addUser:async function(t,e={}){const{groupKey:n,...s}=e,i=Array.isArray(t)?t:[t],o=j.session;return await(new z).post(`/group/member/${null!=n?n:null==o?void 0:o.groupKey}`,{body:i.map(t=>{const e="string"==typeof t?t:t.userKey,n="string"==typeof t?$.PARTICIPANT:t.role,s="string"==typeof t||t.available;return{role:n,userKey:e,objectType:"group",available:null==s||s}}),...s}).then(({body:t})=>t)},create:async function(t,e={}){const{name:n,runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:p,allowChannel:f}=t;if(!n)throw new d("Cannot create a group with no name");return await(new z).post("/group",{body:{name:n,runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:p,allowChannel:f},...e}).then(({body:t})=>t)},destroy:async function(t,e={}){return await(new z).delete(`/group/${t}`,e).then(({body:t})=>t)},forUser:async function(t,e={}){const{includeExpired:n,includeAllMembers:s,role:i,...o}=e,r=Array.isArray(i)&&i.length>0,a={includeExpired:n,includeAllMembers:s,role:i?r?i:[i]:void 0};return await(new z).withSearchParams(a).get(`/group/member/for/${t}`,o).then(({body:t})=>t)},gather:async function(t={}){const{includeExpired:e,...n}=t;return await(new z).withSearchParams({includeExpired:e}).get("/group",n).then(({body:t})=>t)},get:async function(t={}){const{groupKey:e,augment:n,...s}=t;let i="";"MEMBERS"===n&&(i="/member"),"QUANTIZED"===n&&(i="/quantized");const o=j.session;return await(new z).get(`/group${i}/${null!=e?e:null==o?void 0:o.groupKey}`,s).then(({body:t})=>t)},getSessionGroups:async function(t={}){const{includeExpired:e,role:n,...s}=t,i=Array.isArray(n)&&n.length>0,o={includeExpired:e,role:n?i?n:[n]:void 0};return await(new z).withSearchParams(o).get("/group/member",s).then(({body:t})=>t)},getWhitelistedUsers:async function(t,e={}){return await(new z).get(`/group/self/${t}`,e).then(({body:t})=>t)},query:gt,removeUser:async function(t,e={}){const{groupKey:n,...s}=e,i=Array.isArray(t)&&t.length>1,o=i?"":`/${1===t.length?t[0]:t}`,r=i?{userKey:t}:void 0,a=j.session;return await(new z).withSearchParams(r).delete(`/group/member/${null!=n?n:null==a?void 0:a.groupKey}${o}`,s).then(({body:t})=>t)},search:async function(t={}){console.warn("DEPRECATION WARNING: groupAdapter.search is deprecated and will be removed with the next release. Use groupAdapter.query instead.");const{filter:e=[],sort:n=[],first:s,max:i,quantized:o,...r}=t,a={filter:e,sort:n,first:s,max:i,quantized:o};return await gt(a,r)},selfRegister:async function(t,e,n={}){const{displayName:s,givenName:i,familyName:o,handle:r,...a}=n;return await(new z).patch(`/registration/self/${t}`,{body:{password:e,displayName:s,givenName:i,familyName:o,handle:r},...a}).then(({body:t})=>t)},sendRegistrationEmail:async function(t,e,n={}){const{redirectURL:s,linkURL:i,subject:o,...r}=n;return await(new z).post(`/registration/self/${t}`,{body:{email:e,linkUrl:i,redirectUrl:s,subject:o},...r}).then(({body:t})=>t)},statusUpdate:async function(t,e,n={}){const{groupKey:s,...i}=n,o=j.session;return await(new z).patch(`/group/status/${null!=s?s:null==o?void 0:o.groupKey}`,{body:{code:t,message:e},...i}).then(({body:t})=>t)},update:async function(t,e,n={}){const{runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:d,allowChannel:p}=e;return await(new z).patch(`/group/${t}`,{body:{runLimit:s,organization:i,allowSelfRegistration:o,flightRecorder:r,event:a,allowMembershipChanges:c,pricing:h,startDate:u,expirationDate:l,capacity:d,allowChannel:p},...n}).then(({body:t})=>t)},updateUser:async function(t,e,n={}){const{role:s,available:i}=e,{groupKey:o,...r}=n,a=j.session;return await(new z).patch(`/group/member/${null!=o?o:null==a?void 0:a.groupKey}/${t}`,{body:{objectType:"group",role:s,available:i},...r}).then(({body:t})=>t)},whitelistUsers:async function(t,e={}){const{allow:n=!0,emails:s=["*"],...i}=e;return await(new z).post(`/group/self/${t}`,{body:{allow:n,emails:s},...i}).then(({body:t})=>t)},withGroupName:async function(t,e={}){return await(new z).get(`/group/with/${t}`,e).then(({body:t})=>t)}});async function bt(t,e,n,s={}){const{scopeBoundary:i,scopeKey:o}=e,{filter:r,sort:a=[],first:c,max:h}=n,u={filter:G(r),sort:a.join(";")||void 0,first:c,max:h};return await(new z).withSearchParams(u).get(`/leaderboard/${i}/${o}/${t}`,s).then(({body:t})=>t)}var vt=Object.freeze({__proto__:null,get:async function(t,e,n,s={}){return console.warn("DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead."),await bt(t,e,n,s)},getCount:async function(t,e,n,s={}){const{scopeBoundary:i,scopeKey:o}=e,{filter:r}=n,a={filter:G(r)};return await(new z).withSearchParams(a).get(`/leaderboard/count/${i}/${o}/${t}`,s).then(({body:t})=>t)},list:bt,update:async function(t,e,n,s={}){const{tags:i,allowChannel:o,...r}=s,{scopeBoundary:a,scopeKey:c,userKey:h}=e,u=j.session;return await(new z).post("/leaderboard",{body:{scope:{scopeBoundary:a,scopeKey:c,userKey:null!=h?h:null==u?void 0:u.userKey},collection:t,scores:n,tags:i,allowChannel:o},...r}).then(({body:t})=>t)}});var St=Object.freeze({__proto__:null,connect:async function(){await ct.handshake()},disconnect:async function(t){var e;const n=[ct.disconnect()],s=null==j||null===(e=j.session)||void 0===e?void 0:e.groupKey;s&&n.push((new z).delete(`/presence/group/${s}`,t)),await Promise.allSettled(n)},forGroup:async function(t,e={}){return await(new z).get(`/presence/group/${t}`,e).then(({body:t})=>t)},forWorld:async function(t,e={}){return await(new z).get(`/presence/world/${t}`,e).then(({body:t})=>t)}});var Tt=Object.freeze({__proto__:null,google:async function(t){return await(new z).withAccountShortName("epicenter").withProjectShortName("manager").post("/recaptcha/google",{body:{humanKey:t}}).then(({body:t})=>t)}});let Et=function(t){return t.MANY="MANY",t.PROXY="PROXY",t.SINGULAR="SINGULAR",t}({});async function xt(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,ephemeral:c,trackingKey:h,modelContext:u,executionContext:l,allowChannel:d,...p}=n,{WORLD:f}=_,y=j.session,m=r||a,g=Object.assign({},p.headers,m?{"X-Forio-Confirmation":!0}:{}),w=m?{readLock:r,writeLock:a}:void 0;return await(new z).post("/run",{body:{scope:{scopeBoundary:s,scopeKey:i,userKey:s===f?void 0:null!=o?o:null==y?void 0:y.userKey},permit:w,morphology:"MANY",trackingKey:h,modelFile:t,modelContext:u||{},executionContext:l||{},ephemeral:c,allowChannel:d},...p,headers:g}).then(({body:t})=>t)}async function kt(t,e,n={}){const{filter:s,sort:i=[],first:o,max:r,timeout:a,variables:c=[],metadata:h=[],scope:u,groupName:l,episodeName:d,includeEpisodes:p}=e,f=j.session,y=u?`${u.scopeBoundary}/${u.scopeKey}`:`in/${null!=l?l:null==f?void 0:f.groupName}${d?`/${d}`:""}`;let m=s;if(null!=u&&u.userKey){const t=`run.userKey=${u.userKey}`;m=Array.isArray(s)?[...s,t]:"string"==typeof s?s?`${s};${t}`:t:s&&"object"==typeof s?{type:"and",filters:[s,t]}:[t]}const g={filter:G(m),sort:i.join(";")||void 0,var:c.join(";")||void 0,meta:h.join(";")||void 0,first:o,max:r,timeout:a,includeEpisodes:p};return await(new z).withSearchParams(g).get(`/run/${y}/${t}`,{paginated:!0,parsePage:t=>t.map(t=>(t.variables=c.reduce((e,n,s)=>{var i;return e[n]=null===(i=t.variables)||void 0===i?void 0:i[s],e},{}),t)),...n}).then(({body:t})=>t)}async function _t(t,e,n={}){const{timeout:s,ritual:i,ignorable:o,...r}=n,a=Array.isArray(t)&&t.length>1;i!==A.EXORCISE&&a&&console.warn(`Detected ritual: ${i} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`);const c=t=>e.reduce((e,n,s)=>(e[n]=t[s],e),{}),h=a?"":`/${1===t.length?t[0]:t}`,u=e.join(";"),l=a?{runKey:t,include:u,timeout:s}:{ritual:i,include:u,timeout:s},d=o?{ignorable:o}:{};return await(new z).post(`/run/variable${h}`,{body:{...l,...d},...r}).then(({body:t})=>a?Object.keys(t).map(e=>({runKey:e,variables:c(t[e])})):c(t))}var At=Object.freeze({__proto__:null,MORPHOLOGY:Et,action:async function(t,e,n={}){const{timeout:s,ritual:i,...o}=n,r=Array.isArray(t)&&t.length>1,a=r?"":`/${1===t.length?t[0]:t}`,c=r?{runKey:t,timeout:s}:{ritual:i,timeout:s};return i!==A.EXORCISE&&r&&console.warn(`Detected ritual: ${i} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`),await(new z).withSearchParams(c).post(`/run/action${a}`,{body:e,...o}).then(({body:t})=>t)},clone:async function(t,e={}){const{ephemeral:n,trackingKey:s,modelContext:i={},executionContext:o={},...r}=e;return await(new z).post(`/run/clone/${t}`,{body:{trackingKey:s,modelContext:i,executionContext:o,ephemeral:n},...r}).then(({body:t})=>t)},create:xt,createSingular:async function(t,e={}){const{readLock:n,writeLock:s,ephemeral:i,modelContext:o,executionContext:r,...a}=e,c=n||s,h=Object.assign({},a.headers,c?{"X-Forio-Confirmation":!0}:{}),u=c?{readLock:n,writeLock:s}:void 0;return await(new z).post("/run/singular",{body:{modelFile:t,permit:u,modelContext:o||{},executionContext:r||{},ephemeral:i},...a,headers:h}).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/run/${t}`,e).then(({body:t})=>t)},getMetadata:async function(t,e,n={}){const{...s}=n,i=e.join(";"),o=Array.isArray(t)&&t.length>1,r=Array.isArray(t)?t:[t];return await(new z).post("/run/meta",{body:{include:i,runKey:r},...s}).then(({body:t})=>{var e;const n=Object.keys(t).map(e=>({runKey:e,data:t[e]}));return o?n:null==n||null===(e=n[0])||void 0===e?void 0:e.data})},getSingularRunKey:async function(t={}){return await(new z).get("/run/singular/key",t).then(({body:t})=>t)},getVariable:async function(t,e,n={}){const{timeout:s,ritual:i,...o}=n;if(Array.isArray(t)||Array.isArray(e)){return _t(t,Array.isArray(e)?e:[e],n)}return await(new z).withSearchParams({timeout:s,ritual:i}).get(`/run/variable/${t}/${String(e)}`,o).then(({body:t})=>t)},getVariables:_t,getWithStrategy:async function(t,e,n,s={}){if("reuse-across-sessions"===t){const t={scope:n,sort:["-run.created"],max:1},{values:[i]}=await kt(e,t);if(!i){return await xt(e,n,s)}return i}if("reuse-never"===t){return await xt(e,n,s)}throw new d("Invalid run strategy.")},introspect:async function(t,e={}){return await(new z).get(`/run/introspect/model/${t}`,e).then(({body:t})=>t)},introspectWithRunKey:async function(t,e={}){return await(new z).get(`/run/introspect/${t}`,e).then(({body:t})=>t)},migrate:async function(t,e,n={}){const{ephemeral:s,trackingKey:i,modelContext:o={},executionContext:r={},...a}=n;return await(new z).post(`/run/migrate/to/${e}/${t}`,{body:{trackingKey:i,modelContext:o,executionContext:r,ephemeral:s},...a}).then(({body:t})=>t)},operation:async function(t,e,n=[],s={}){const{timeout:i,ritual:o,...r}=s,a=Array.isArray(t)&&t.length>1,c=a?"":`/${1===t.length?t[0]:t}`,h=a?{runKey:t,timeout:i}:{ritual:o,timeout:i};return o!==A.EXORCISE&&a&&console.warn(`Detected ritual: ${o} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`),await(new z).withSearchParams(h).post(`/run/operation${c}`,{body:{name:e,arguments:n,objectType:"execute"},...r}).then(({body:t})=>t)},query:kt,remove:async function(t,e={}){return await(new z).delete(`/run/${t}`,e).then(({body:t})=>t)},removeFromWorld:async function(t,e={}){return await(new z).delete(`/run/world/${t}`,e).then(({body:t})=>t)},restore:async function(t,e={}){const{ephemeral:n,modelContext:s={},executionContext:i={},...o}=e;return await(new z).post(`/run/restore/${t}`,{body:{modelContext:s,executionContext:i,ephemeral:n},...o}).then(({body:t})=>t)},retrieveFromWorld:async function(t,e,n={}){const{readLock:s,writeLock:i,ephemeral:o,trackingKey:r,modelContext:a,executionContext:c,allowChannel:h,...u}=n,l=s||i,d=Object.assign({},u.headers,l?{"X-Forio-Confirmation":!0}:{}),p=l?{readLock:s,writeLock:i}:void 0;return await(new z).post(`/run/world/${t}`,{body:{permit:p,morphology:"MANY",trackingKey:r,modelFile:e,modelContext:a||{},executionContext:c||{},ephemeral:o,allowChannel:h},...u,headers:d}).then(({body:t})=>t)},rewind:async function(t,e,n={}){const{ephemeral:s,modelContext:i={},...o}=n;return await(new z).post(`/run/rewind/${t}`,{body:{rewindCount:e,modelContext:i,ephemeral:s},...o}).then(({body:t})=>t)},update:async function(t,e,n={}){const{readLock:s,writeLock:i,trackingKey:o,marked:r,hidden:a,closed:c,allowChannel:h}=e,u=Array.isArray(t)&&t.length>1,l=u?"":`/${1===t.length?t[0]:t}`,d=s||i?{readLock:s,writeLock:i}:void 0;return await(new z).withSearchParams(u?{runKey:t}:"").patch(`/run${l}`,{body:{permit:d,trackingKey:o,marked:r,hidden:a,closed:c,allowChannel:h},...n}).then(({body:t})=>t)},updateMetadata:async function(t,e,n={}){const{timeout:s,...i}=n,o=Array.isArray(t)&&t.length>1,r=o?"":`/${1===t.length?t[0]:t}`,a=o?{runKey:t,timeout:s}:{timeout:s};return await(new z).withSearchParams(a).patch(`/run/meta${r}`,{body:e,...i}).then(({body:t})=>t)},updateVariables:async function(t,e,n={}){const{timeout:s,ritual:i,...o}=n,r=Array.isArray(t)&&t.length>1,a=r?"":`/${1===t.length?t[0]:t}`,c=r?{runKey:t,timeout:s}:{ritual:i,timeout:s};return i!==A.EXORCISE&&r&&console.warn(`Detected ritual: ${i} usage with multiple runKeys; this not allowed. Defaulting to ritual: EXORCISE`),await(new z).withSearchParams(c).patch(`/run/variable${a}`,{body:e,...o}).then(({body:t})=>t)}});var Nt=Object.freeze({__proto__:null,createUser:async function(t,e={}){return await(new z).post("/user",{body:t,...e}).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/user/${t}`,e).then(({body:t})=>t)},getWithHandle:async function(t,e={}){const{modality:n,...s}=e,i=n?`/${n}`:"";return await(new z).get(`/user/with/${t}${i}`,s).then(({body:t})=>t)},uploadCSV:async function(t,e={}){const{overwrite:n,...s}=e,i=new FormData;return i.append("file",t),await(new z).withSearchParams({overwrite:n}).post("/user/upload",{body:i,...s}).then(({body:t})=>t)}});async function $t(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,{readLock:r,writeLock:a,items:c,ttlSeconds:h,mutationStrategy:u="ERROR",allowChannel:l,...d}=n,{WORLD:p}=_,{PARTICIPANT:f,USER:y}=$,m=s===p?f:y,g={mutationStrategy:u};return await(new z).withSearchParams(g).post(`/vault/${t}`,{body:{scope:{scopeBoundary:s,scopeKey:i,userKey:o},permit:{readLock:r||m,writeLock:a||m},ttlSeconds:h,items:c,allowChannel:l},...d}).then(({body:t})=>t)}var Rt=Object.freeze({__proto__:null,byName:async function(t,e={}){const{groupName:n,episodeName:s,userKey:i,includeEpisodes:o,...r}=e,a=j.session,c={userKey:i,includeEpisodes:o};return await(new z).withSearchParams(c).get(`/vault/in/${null!=n?n:null==a?void 0:a.groupName}${s?`/${s}`:""}/${t}`,{...r}).then(({body:t})=>t)},count:async function(t,e={}){const{first:n,filter:s,max:i}=t,o={filter:G(s),first:n,max:i},{groupName:r,...a}=e;return(new z).withSearchParams(o).get("/vault/count"+(r?`/${r}`:""),a).then(({body:t})=>t)},create:async function(t,e,n,s={}){return console.warn("DEPRECATION WARNING: vaultAdapter.create is deprecated and will be removed with the next release. Use vaultAdapter.define instead."),await $t(t,e,{items:n,...s})},define:$t,get:async function(t,e={}){return await(new z).get(`/vault/${t}`,e).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},list:async function(t,e={}){const{first:n,filter:s,max:i}=t,o={filter:G(s),first:n,max:i},{groupName:r,...a}=e;return(new z).withSearchParams(o).get("/vault/search"+(r?`/${r}`:""),a).then(({body:t})=>t)},remove:async function(t,e={}){const{mutationKey:n,...s}=e;return await(new z).withSearchParams({mutationKey:n}).delete(`/vault/${t}`,s).then(({body:t})=>t)},update:async function(t,e,n={}){var s,i,o;const{mutationKey:r,...a}=n;return await(new z).withSearchParams({mutationKey:r}).put(`/vault/${t}`,{body:{set:null!==(s=e.set)&&void 0!==s?s:{},push:null!==(i=e.push)&&void 0!==i?i:{},pop:null!==(o=e.pop)&&void 0!==o?o:{}},...a}).then(({body:t})=>t)},updateProperties:async function(t,e,n={}){return await(new z).patch(`/vault/${t}`,{body:{...e},...n}).then(({body:t})=>t)},withScope:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i,userKey:o}=e,r=o?`/${o}`:"";return await(new z).get(`/vault/with/${s}/${i}${r}/${t}`,n).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});async function Pt(t,e,n={}){return await(new z).get(`/video/url/${e}/${t}`,n).then(({body:t})=>t)}async function Ot(t,e,n,s,i={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=s,c=a?`/${a}`:"";return await(new z).get(`/video/url/with/${o}/${r}${c}/${n}/${e}/${t}`,i).then(({body:t})=>t)}async function Ct(t,e={}){return await(new z).get(`/video/dir/${t}`,e).then(({body:t})=>t)}async function It(t,e,n,s={}){const{scopeBoundary:i,scopeKey:o,userKey:r}=n,a=r?`/${r}`:"";return await(new z).get(`/video/dir/with/${i}/${o}${a}/${e}/${t}`,s).then(({body:t})=>t)}async function jt(t={}){return await(new z).get("/video/search",t).then(({body:t})=>t)}async function Lt(t,e={}){return await(new z).delete(`/video/${t}`,e).then(({body:t})=>t)}async function Mt(t,e,n={}){return await(new z).post(`/video/execute/${t}`,{body:e,...n}).then(({body:t})=>t)}async function Ut(t,e,n={}){return await(new z).get(`/video/download/${e}/${t}`,n).then(({body:t})=>t)}async function Dt(t,e,n,s,i={}){const{scopeBoundary:o,scopeKey:r,userKey:a}=s,c=a?`/${a}`:"";return await(new z).get(`/video/download/with/${o}/${r}${c}/${n}/${e}/${t}`,i).then(({body:t})=>t)}var Bt=Object.freeze({__proto__:null,AFFILIATE:{VONAGE:"VONAGE",DAILY:"DAILY",DOMESTIC:"DOMESTIC"},LANGUAGE_CODE:{"af-ZA":"af-ZA","ar-AE":"ar-AE","ar-SA":"ar-SA","cy-GB":"cy-GB","da-DK":"da-DK","de-CH":"de-CH","de-DE":"de-DE","en-AB":"en-AB","en-AU":"en-AU","en-GB":"en-GB","en-IE":"en-IE","en-IN":"en-IN","en-US":"en-US","en-WL":"en-WL","es-ES":"es-ES","es-US":"es-US","fa-IR":"fa-IR","fr-CA":"fr-CA","fr-FR":"fr-FR","ga-IE":"ga-IE","gd-GB":"gd-GB","he-IL":"he-IL","hi-IN":"hi-IN","id-ID":"id-ID","it-IT":"it-IT","ja-JP":"ja-JP","ko-KR":"ko-KR","nl-NL":"nl-NL","pt-BR":"pt-BR","pt-PT":"pt-PT","ru-RU":"ru-RU","ta-IN":"ta-IN","te-IN":"te-IN","tr-TR":"tr-TR","zh-CN":"zh-CN","zh-TW":"zh-TW","th-TH":"th-TH","en-ZA":"en-ZA","en-NZ":"en-NZ"},MEDIA_FORMAT:{mp3:"mp3",mp4:"mp4",wav:"wav",flac:"flac",ogg:"ogg",amr:"amr",webm:"webm"},deleteVideoByKey:Lt,downloadVideoByKey:Ut,downloadVideoWith:Dt,getVideoDirectoryByKey:Ct,getVideoDirectoryWith:It,getVideoSearch:jt,getVideoURLByKey:Pt,getVideoURLWith:Ot,postVideoProcessor:Mt});async function Kt(t,e={}){const{scope:n,affiliate:s,family:i,videoKey:o,...r}=e;if(n&&i&&s)return Ot(t,i,s,n,r);if(o)return Pt(t,o,r);throw new d("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}async function Wt(t={}){const{scope:e,affiliate:n,family:s,videoKey:i,...o}=t;if(e&&s&&n)return It(s,n,e,o);if(i)return Ct(i,o);throw new d("Cannot get video URL -- either a video key or scope/affiliate/family specification is required.")}var zt=Object.freeze({__proto__:null,download:async function(t,e={}){const{scope:n,affiliate:s,family:i,videoKey:o,...r}=e;if(n&&i&&s)return Dt(t,i,s,n,r);if(o)return Ut(t,o,r);throw new d("Cannot download video -- either a video key or scope/affiliate/family specification is required.")},getDirectoryURL:Wt,getURL:Kt,processVideo:async function(t,e,n={}){const{log:s,...i}=n;return Mt(t,{processors:e,log:s},i)},query:async function(t,e={}){const{filter:n,sort:s=[],first:i,max:o}=t;return jt({query:{filter:G(n),sort:s.join(";")||void 0,first:i,max:o},paginated:!0,...e})},remove:async function(t,e={}){return Lt(t,e)}});async function Ft(t={}){return await(new z).get("/vonage/session",t).then(({body:t})=>t)}async function Ht(t,e={}){return await(new z).post("/vonage/token",{body:{...t,initialLayoutClassList:["placeholder"]},...e}).then(({body:t})=>t)}async function qt(t,e={}){return await(new z).post("/vonage/archive",{body:t,...e}).then(({body:t})=>t)}async function Gt(t={}){return await(new z).get("/vonage/info",t).then(({body:t})=>t)}async function Vt(t,e={}){return await(new z).delete(`/vonage/archive/${t}`,e).then(({body:t})=>t)}var Jt=Object.freeze({__proto__:null,deleteArchiveByID:Vt,getInfo:Gt,getSession:Ft,postArchive:qt,postToken:Ht});var Yt=Object.freeze({__proto__:null,createSession:async function(t={}){return Ft(t)},generateToken:async function(t,e={}){return(await Ht({sessionId:t},e)).token},getProjectID:async function(t={}){return(await Gt(t)).apiKey},startArchive:async function(t,e,n,s={}){const{readLock:i,writeLock:o,ttlSeconds:r,resolution:a,...c}=s,{PARTICIPANT:h,USER:u}=$,l=n.userKey?u:h;return qt({name:t,sessionId:e,scope:n,permit:{readLock:null!=i?i:l,writeLock:null!=o?o:l},ttlSeconds:r,resolution:a},c)},stopArchive:async function(t,e={}){return Vt(t,e)}});const Xt={MINIMUM:"MINIMUM",MAXIMUM:"MAXIMUM",MARGINAL:"MARGINAL",OPTIMAL:"OPTIMAL"};var Zt=Object.freeze({__proto__:null,OBJECTIVE:Xt,WORLD_NAME_GENERATOR_TYPE:{colorAnimal:"colorAnimal",sequential:"sequential"},assignRun:async function(t,e,n={}){return await(new z).patch(`/world/run/${t}`,{body:{runKey:e},...n}).then(({body:t})=>t)},autoAssignUsers:async function(t,e={}){const{groupName:n,episodeName:s,objective:i=Xt.MINIMUM,requireAllAssignments:o,worldNameGenerator:r,keepEmptyWorlds:a,populace:c,allowChannel:h,...u}=e,l=j.session;return await(new z).post(`/world/assignment/${null!=n?n:null==l?void 0:l.groupName}${s?`/${s}`:""}`,{body:{assignments:t,objective:i,requireAllAssignments:o,worldNameGenerator:r,keepEmptyWorlds:a,populace:c,allowChannel:h},...u}).then(({body:t})=>t)},create:async function(t={}){const{name:e,displayName:n,groupName:s,episodeName:i,worldNameGenerator:o,allowChannel:r,...a}=t,c=j.session;return await(new z).post(`/world/${null!=s?s:null==c?void 0:c.groupName}${i?`/${i}`:""}`,{body:{name:e,worldNameGenerator:o,displayName:n,allowChannel:r},...a}).then(({body:t})=>t)},destroy:async function(t,e={}){return await(new z).delete(`/world/${t}`,e).then(({body:t})=>t)},editAssignments:async function(t,e={}){const{groupName:n,episodeName:s,objective:i=Xt.MINIMUM,requireAllAssignments:o,keepEmptyWorlds:r,...a}=e,c=j.session;return await(new z).put(`/world/assignment/${null!=n?n:null==c?void 0:c.groupName}${s?`/${s}`:""}`,{body:{assignments:t,objective:i,requireAllAssignments:o,keepEmptyWorlds:r},...a}).then(({body:t})=>t)},get:async function(t={}){const{groupName:e,episodeName:n,mine:s,...i}=t,o=j.session;return await(new z).withSearchParams({mine:s}).get(`/world/${null!=e?e:null==o?void 0:o.groupName}${n?`/${n}`:""}`,i).then(({body:t})=>t)},getAssignments:async function(t={}){const{groupName:e,episodeName:n,mine:s,...i}=t,o=j.session;return await(new z).withSearchParams({mine:s}).get(`/world/assignment/for/${null!=e?e:null==o?void 0:o.groupName}${n?`/${n}`:""}`,i).then(({body:t})=>t)},getAssignmentsByKey:async function(t,e={}){return await(new z).get(`/world/assignment/${t}`,e).then(({body:t})=>t)},getPersonas:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t,i=n||_.PROJECT,o=`${i===_.WORLD?"":`/${i.toLowerCase()}`}${i===_.PROJECT?"":`/${s}`}`;return await(new z).get(`/world/persona${o}`,{...e}).then(({body:t})=>t)},getSessionWorlds:async function(t={}){return await(new z).get("/world/assignment",t).then(({body:t})=>t)},removeUsers:async function(t,e={}){const{groupName:n,episodeName:s,keepEmptyWorlds:i,...o}=e,r=j.session;return await(new z).withSearchParams({userKey:t,keepEmptyWorlds:Boolean(i)}).delete(`/world/assignment/${null!=n?n:null==r?void 0:r.groupName}${s?`/${s}`:""}`,o).then(({body:t})=>t)},selfAssign:async function(t={}){const{role:e,groupName:n,episodeName:s,objective:i=Xt.MINIMUM,worldNameGenerator:o,populace:r,allowChannel:a,...c}=t,h=j.session;return await(new z).post(`/world/selfassign/${null!=n?n:null==h?void 0:h.groupName}${s?`/${s}`:""}`,{body:{role:e,objective:i,worldNameGenerator:o,populace:r,allowChannel:a},...c}).then(({body:t})=>t)},setPersonas:async function(t,e,n={}){const s=(null==e?void 0:e.scopeBoundary)||_.PROJECT,i=`${s===_.WORLD?"":`/${s.toLowerCase()}`}${s===_.PROJECT?"":`/${null==e?void 0:e.scopeKey}`}`;return await(new z).put(`/world/persona${i}`,{body:t,...n}).then(({body:t})=>t)},update:async function(t,e,n={}){const{displayName:s,runKey:i,allowChannel:o}=e;return await(new z).patch(`/world/${t}`,{body:{displayName:s,runKey:i,allowChannel:o},...n}).then(({body:t})=>t)}});var Qt=Object.freeze({__proto__:null,get:async function(t={}){return await(new z).get("/time",t).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});let te=function(t){return t.DO_NOTHING="DO_NOTHING",t.RESCHEDULE="RESCHEDULE",t.FIRE_ON_FAIL_SAFE="FIRE_ON_FAIL_SAFE",t}({});var ee=Object.freeze({__proto__:null,RETRY_POLICY:te,create:async function(t,e,n,s,i={}){const{retryPolicy:o,failSafeTermination:r,ttlSeconds:a,...c}=i;return await(new z).post("/task",{body:{payload:{objectType:"http",...n},trigger:s,retryPolicy:o,failSafeTermination:r,ttlSeconds:a,scope:t,name:e},...c}).then(({body:t})=>t)},destroy:async function(t,e={}){return await(new z).delete(`/task/${t}`,e).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/task/${t}`,e).then(({body:t})=>t)},getHistory:async function(t,e={}){return await(new z).get(`/task/history/${t}`,e).then(({body:t})=>t)},getTaskIn:async function(t,e={}){const{scopeBoundary:n,scopeKey:s,userKey:i}=t;return await(new z).get(`/task/in/${n}/${s}${i?`/${i}`:""}`,e).then(({body:t})=>t)}});var ne=Object.freeze({__proto__:null,create:async function(t,e,n,s={}){return(new z).post("/chat",{body:{scope:{scopeBoundary:e.scopeBoundary,scopeKey:e.scopeKey},permit:n,room:t},...s}).then(({body:t})=>t)},get:async function(t,e={}){return(new z).get(`/chat/${t}`,e).then(({body:t})=>t)},getMessages:async function(t,e={}){const{maxRecords:n,horizon:s,...i}=e;return(new z).withSearchParams({maxRecords:n,horizon:s}).get(`/chat/message/${t}`,i).then(({body:t})=>t)},getMessagesAdmin:async function(t,e={}){const{maxRecords:n,horizon:s,...i}=e;return(new z).withSearchParams({maxRecords:n,horizon:s}).get(`/chat/message/all/${t}`,i).then(({body:t})=>t)},getMessagesForUser:async function(t,e,n={}){const{maxRecords:s,horizon:i,...o}=n;return(new z).withSearchParams({maxRecords:s,horizon:i}).get(`/chat/message/${t}/${e}`,o).then(({body:t})=>t)},query:async function(t,e={}){const{filter:n,sort:s=[],first:i=0,max:o}=t,r={filter:G(n),sort:s.join(";")||void 0,first:i,max:o};return await(new z).withSearchParams(r).get("/chat/search",{paginated:!0,...e}).then(({body:t})=>t)},sendMessage:async function(t,e,n={}){const{userKey:s,...i}=n,o=s?`/${s}`:"";return(new z).put(`/chat/message/${t}${o}`,{body:{message:e},...i}).then(({body:t})=>t)},sendMessageAdmin:async function(t,e,n={}){const{userKey:s,...i}=n,o=s?`/${s}`:"";return(new z).put(`/chat/message/system/${t}${o}`,{body:{message:e},...i}).then(({body:t})=>t)},updatePermit:async function(t,e,n={}){return(new z).patch(`/chat/${t}`,{...n,body:{permit:e}}).then(({body:t})=>t)}});var se=Object.freeze({__proto__:null,collectInGroup:async function(t,e,n={}){const{episodeName:s,...i}=n;return await(new z).post(`/consensus/in/${e}${s?`/${s}`:""}`,{body:t,...i}).then(({body:t})=>t)},create:async function(t,e,n,s,i,o={}){const{ttlSeconds:r,transparent:a=!1,allowChannel:c,...h}=o;return await(new z).post(`/consensus/${t}/${e}/${n}`,{body:{expectedRoles:s,ttlSeconds:r,transparent:a,actions:i,allowChannel:c},...h}).then(({body:t})=>t)},deleteAll:async function(t,e,n={}){const{...s}=n;return await(new z).delete(`/consensus/${t}/${e}`,{...s}).then(({body:t})=>t)},deleteBarrier:async function(t,e,n,s={}){const{...i}=s;return await(new z).delete(`/consensus/${t}/${e}/${n}`,{...i}).then(({body:t})=>t)},forceClose:async function(t,e,n,s={}){const{ritual:i,...o}=s;return await(new z).post(`/consensus/close/${t}/${e}/${n}`,{body:{ritual:i},...o}).then(({body:t})=>t)},list:async function(t,e,n={}){return await(new z).get(`/consensus/${t}/${e}`,n).then(({body:t})=>t)},load:async function(t,e,n,s={}){return await(new z).get(`/consensus/${t}/${e}/${n}`,s).then(({body:t})=>t)},pause:async function(t,e,n,s={}){return await(new z).patch(`/consensus/pause/${t}/${e}/${n}`,{body:{resume:!1},...s}).then(({body:t})=>t)},removeRoleExpectationFor:async function(t,e,n,s,i={}){return await(new z).delete(`/consensus/expectation/${t}/${e}/${n}/${s}`,i).then(({body:t})=>t)},resume:async function(t,e,n,s={}){return await(new z).patch(`/consensus/pause/${t}/${e}/${n}`,{body:{resume:!0},...s}).then(({body:t})=>t)},submitActions:async function(t,e,n,s,i={}){const{message:o,ritual:r,...a}=i;return await(new z).post(`/consensus/publish/${t}/${e}/${n}`,{body:{ritual:r,actions:s,message:o},...a}).then(({body:t})=>t)},triggerFor:async function(t,e,n,s,i,o={}){const{ritual:r,message:a,...c}=o;return await(new z).post(`/consensus/trigger/${t}/${e}/${n}`,{body:{ritual:r,userKey:s,message:a,actions:i},...c}).then(({body:t})=>t)},undoSubmit:async function(t,e,n,s={}){const{...i}=s;return await(new z).delete(`/consensus/arrival/${t}/${e}/${n}`,{...i}).then(({body:t})=>t)},undoSubmitFor:async function(t,e,n,s,i={}){const{...o}=i;return await(new z).delete(`/consensus/untrigger/${t}/${e}/${n}/${s}`,{...o}).then(({body:t})=>t)},updateDefaults:async function(t,e,n,s,i={}){const{...o}=i;return await(new z).patch(`/consensus/actions/${t}/${e}/${n}`,{body:{actions:s},...o}).then(({body:t})=>t)}});var ie=Object.freeze({__proto__:null,byEmail:async function(t,e,n={}){const{scopeBoundary:s,scopeKey:i}=e;return await(new z).get(`/somebody/with/${s}/${i}/${t}`,n).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},create:async function(t,e,n={}){const{givenName:s,familyName:i,...o}=n;return await(new z).post("/somebody",{body:{email:t,givenName:s,familyName:i,scope:e},...o}).then(({body:t})=>t)},get:async function(t,e={}){return await(new z).get(`/somebody/${t}`,e).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},inScope:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t,{first:i,max:o,...r}=e,a={first:i,max:o};return await(new z).withSearchParams(a).get(`/somebody/in/${n}/${s}`,{paginated:!0,...r}).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});var oe=Object.freeze({__proto__:null,addUser:async function(t,e={}){const{accountShortName:n,projectShortName:s,server:i}=e;return await(new z).withServer(i).withAccountShortName(n).withProjectShortName(s).patch("/matchmaker/udome",{body:{udomeKey:t}}).then(({body:t})=>t)},byName:async function(t,e,n={}){const{accountShortName:s,projectShortName:i,server:o}=n,{scopeBoundary:r,scopeKey:a}=e;return await(new z).withServer(o).withAccountShortName(s).withProjectShortName(i).get(`/matchmaker/udome/${r}/${a}/${t}`).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},create:async function(t,e,n,s={}){const{accountShortName:i,projectShortName:o,server:r}=s;return await(new z).withServer(r).withAccountShortName(i).withProjectShortName(o).post(`/matchmaker/udome/${t}`,{body:{scope:n,partners:e}}).then(({body:t})=>t)},edit:async function(t,e,n={}){const{accountShortName:s,projectShortName:i,server:o}=n;return await(new z).withServer(o).withAccountShortName(s).withProjectShortName(i).put(`/matchmaker/udome/${t}`,{body:{closed:e}}).then(({body:t})=>t)},get:async function(t,e={}){const{accountShortName:n,projectShortName:s,server:i}=e;return await(new z).withServer(i).withAccountShortName(n).withProjectShortName(s).get(`/matchmaker/udome/${t}`).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});const re=[[6e3,1e4],[11e3,2e4],[3e4,45e3]];async function ae(t,e=0){let n;try{n=await t()}catch(i){if(!(i instanceof p&&429===i.status&&e<=re.length))throw i;{const[i,o]=re[e];await(s=((t,e)=>t+Math.random()*(e-t))(i,o),new Promise(t=>setTimeout(t,s))),n=await ae(t,e+1)}}var s;return n}var ce=Object.freeze({__proto__:null,createRoom:async function(t,e={}){const{readLock:n,writeLock:s,ttlSeconds:i,privacy:o,exp:r,enable_recording:a,streaming_endpoints:c,disableRateLimitHandling:h,...u}=e,{PARTICIPANT:l}=$;return ae(async()=>await(new z).post("/daily/v1/room",{body:{epicenter:{ttlSeconds:i,scope:t,permit:{readLock:n||l,writeLock:s||l}},properties:{exp:r,enable_recording:a,streaming_endpoints:c},privacy:o},...u}).then(({body:t})=>t),h?re.length+1:0)},createToken:async function(t,e={}){const{start_video_off:n,is_owner:s,user_name:i,close_tab_on_exit:o,exp:r,enable_recording:a,disableRateLimitHandling:c,selfSign:h=!0,...u}=e;return ae(async()=>await(new z).withSearchParams({selfSign:h}).post("/daily/v1/meetingToken",{body:{properties:{room_name:t,start_video_off:n,is_owner:s,user_name:i,close_tab_on_exit:o,exp:r,enable_recording:a}},...u}).then(({body:t})=>t),c?re.length+1:0)},getConfig:async function(t={}){return await(new z).get("/daily/v1",t).then(({body:t})=>t)},getVideoByRecordingId:async function(t,e,n,s={}){const i=(await Wt({scope:n,affiliate:"DAILY",family:t,...s})).contents;if(null==i||!i.length)return null;i.sort((t,e)=>Number(e.split(".")[0])-Number(t.split(".")[0]));const o=i.find(t=>t.includes(e)&&t.includes(".mp4"));return o?await Kt(o,{scope:n,affiliate:"DAILY",family:t,...s}):null},updateRecordingStatus:async function(t,e={}){return await(new z).delete(`/daily/v1/meetingToken/${t}`,e).then(({body:t})=>t)}});var he=Object.freeze({__proto__:null,get:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t;let{userKey:i}=t;const o=j.session;return null!=i||(i=null==o?void 0:o.userKey),await(new z).get(`/wallet/${n}/${s}/${i}`,e).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)},update:async function(t,e,n={}){var s;const i=j.session;return null!==(s=t.userKey)&&void 0!==s||(t.userKey=null==i?void 0:i.userKey),await(new z).post("/wallet",{body:{items:e,scope:t},...n}).then(({body:t})=>t)},withScope:async function(t,e={}){const{scopeBoundary:n,scopeKey:s}=t,{first:i=0,max:o,...r}=e;return await(new z).withSearchParams({first:i,max:o}).get(`/wallet/with/${n}/${s}`,{paginated:!0,...r}).catch(t=>404===t.status?{body:void 0}:Promise.reject(t)).then(({body:t})=>t)}});var ue=Object.freeze({__proto__:null,parseFilterInput:G,proxy:async(t,e)=>{const{accountShortName:n,projectShortName:s,isLocal:i}=R;let o=g("/",t);return i()||(o=`/proxy/${n}/${s}${o}`),l(o,e)}});const le={};function de(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function pe(t,e,n){return t.set(ye(t,e),n),n}function fe(t,e){return t.get(ye(t,e))}function ye(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}le.cometdReconnected=L.registerHandler(t=>"COMETD_RECONNECTED"===t.code,async t=>{y()&&console.warn('Cometd Reconnected. If you wish to react to this reconnection, register an error handler with identifier: error.code === "COMETD_RECONNECTED".',t)}),le.cometdError=L.registerHandler(t=>403===t.status&&"COMETD_ERROR"===t.code,async(t,e)=>(console.warn("Cometd error. Attempting to reconnect.",t),await ct.disconnect(),await e())),le.authExpired=L.registerHandler(t=>401===t.status&&"AUTHENTICATION_EXPIRED"===t.code,async t=>{throw await ht(),y()&&alert("Session token has expired, try logging in again."),t}),le.authGroupExpired=L.registerHandler(t=>401===t.status&&"AUTHENTICATION_GROUP_EXPIRED"===t.code,async t=>{throw y()&&alert("This group has expired. Try logging into a different group"),t}),le.authInvalidated=L.registerHandler(t=>401===t.status&&"AUTHENTICATION_INVALIDATED"===t.code,async(t,e)=>{try{var n;const t=j.session;if("admin"===(null==t?void 0:t.objectType))throw new d("Unhandled error: admin session was somehow invalidated");const s=null!==(n=null==t?void 0:t.groupKey)&&void 0!==n?n:"";return await ut(s,{objectType:"user",inert:!0}),await e()}catch(e){throw await ht(),t}}),Object.freeze(le);var me=new WeakMap,ge=new WeakMap;class we{constructor(){de(this,me,[]),de(this,ge,{})}getTransportTypes(){return fe(me,this).slice(0)}add(t,e,n){let s=!1;for(let e=0;e<fe(me,this).length;++e)if(fe(me,this)[e]===t){s=!0;break}return s||("number"!=typeof n?fe(me,this).push(t):fe(me,this).splice(n,0,t),fe(ge,this)[t]=e),!s}find(t){for(let e=0;e<fe(me,this).length;++e)if(fe(me,this)[e]===t)return fe(ge,this)[t];return null}negotiateTransport(t,e,n,s){for(let i=0;i<fe(me,this).length;++i){const o=fe(me,this)[i];for(let i=0;i<t.length;++i)if(o===t[i]){const t=fe(ge,this)[o];if(!0===t.accept(e,n,s))return t}}return null}clear(){pe(me,this,[]),pe(ge,this,{})}reset(t){for(let e=0;e<fe(me,this).length;++e)fe(ge,this)[fe(me,this)[e]].reset(t)}findTransportTypes(t,e,n){const s=[];for(let i=0;i<fe(me,this).length;++i){const o=fe(me,this)[i];!0===fe(ge,this)[o].accept(t,e,n)&&s.push(o)}return s}remove(t){for(let e=0;e<fe(me,this).length;++e)if(fe(me,this)[e]===t){fe(me,this).splice(e,1);const n=fe(ge,this)[t];return delete fe(ge,this)[t],n}return null}}function be(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function ve(t,e){return t.get(Te(t,e))}function Se(t,e,n){return t.set(Te(t,e),n),n}function Te(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ee=new WeakMap,xe=new WeakMap,ke=new WeakMap;class _e{constructor(){be(this,Ee,void 0),be(this,xe,void 0),be(this,ke,void 0)}registered(t,e){Se(Ee,this,t),Se(xe,this,e)}unregistered(){Se(Ee,this,null),Se(xe,this,null)}get cometd(){return ve(xe,this)}notifyTransportTimeout(t){const e=this.cometd._getTransportListeners("timeout");if(e)for(let n=0;n<e.length;++n){const s=e[n];try{const e=s.call(this,t);if("number"==typeof e&&e>0)return e}catch(t){this.cometd._info("Exception during execution of transport listener",s,t)}}return 0}debug(){this.cometd._debug.apply(this.cometd,arguments)}get configuration(){return this.cometd.getConfiguration()}get advice(){return this.cometd.getAdvice()}setTimeout(t,e){return this.cometd.setTimeout(t,e)}clearTimeout(t){this.cometd.clearTimeout(t)}convertToJSON(t){const e=this.configuration.maxSendBayeuxMessageSize;let n="[";for(let s=0;s<t.length;++s){s>0&&(n+=",");const i=t[s],o=JSON.stringify(i);if(o.length>e)throw new Error("maxSendBayeuxMessageSize "+e+" exceeded");n+=o}return n+="]",n}convertToMessages(t){if(null==t)return[];if("string"==typeof t||t instanceof String)try{return JSON.parse(t)}catch(e){throw this.debug("Could not convert to JSON the following string:",t),e}if(Array.isArray(t))return t;if(t instanceof Object)return[t];throw new Error("Conversion Error "+t+", typeof "+typeof t)}accept(t,e,n){throw new Error("Abstract")}get type(){return ve(Ee,this)}get url(){return ve(ke,this)}set url(t){Se(ke,this,t)}send(t,e){throw new Error("Abstract")}reset(t){this.debug("Transport",this.type,"reset",t?"initial":"retry")}abort(){this.debug("Transport",this.type,"aborted")}toString(){return this.type}}function Ae(t,e,n){Ne(t,e),e.set(t,n)}function Ne(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $e(t,e,n){return t.set(Pe(t,e),n),n}function Re(t,e){return t.get(Pe(t,e))}function Pe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Oe=new WeakMap,Ce=new WeakMap,Ie=new WeakMap,je=new WeakMap,Le=new WeakSet;class Me extends _e{constructor(...t){var e,n;super(...t),Ne(e=this,n=Le),n.add(e),Ae(this,Oe,0),Ae(this,Ce,null),Ae(this,Ie,[]),Ae(this,je,[])}complete(t,e,n){n?Pe(Le,this,We).call(this,t):Pe(Le,this,ze).call(this,t,e)}transportSend(t,e){throw new Error("Abstract")}transportSuccess(t,e,n){e.expired||(this.clearTimeout(e.timeout),this.debug("Transport",this.type,"cancelled waiting for message replies"),this.complete(e,!0,e.metaConnect),n&&n.length>0?t.onSuccess(n):t.onFailure(e.xhr,t.messages,{httpCode:204}))}transportFailure(t,e,n){e.expired||(this.clearTimeout(e.timeout),this.debug("Transport",this.type,"cancelled waiting for failed message replies"),this.complete(e,!1,e.metaConnect),t.onFailure(e.xhr,t.messages,n))}send(t,e){e?Pe(Le,this,Fe).call(this,t):Pe(Le,this,Ke).call(this,t)}abort(){super.abort();for(let t=0;t<Re(Ie,this).length;++t){const e=Re(Ie,this)[t];e&&(this.debug("Aborting request",e),this.abortXHR(e.xhr)||this.transportFailure(e.envelope,e,{reason:"abort"}))}const t=Re(Ce,this);t&&(this.debug("Aborting /meta/connect request",t),this.abortXHR(t.xhr)||this.transportFailure(t.envelope,t,{reason:"abort"})),this.reset(!0)}reset(t){super.reset(t),$e(Ce,this,null),$e(Ie,this,[]),$e(je,this,[])}abortXHR(t){if(t)try{const e=t.readyState;return t.abort(),e!==window.XMLHttpRequest.UNSENT}catch(t){this.debug(t)}return!1}xhrStatus(t){if(t)try{return t.status}catch(t){this.debug(t)}return-1}}function Ue(t){for(;Re(je,this).length>0;){const e=Re(je,this)[0],n=e[0],s=e[1];if(n.url!==t.url||n.sync!==t.sync)break;Re(je,this).shift(),t.messages=t.messages.concat(n.messages),this.debug("Coalesced",n.messages.length,"messages from request",s.id)}}function De(t,e,n){const s=this.notifyTransportTimeout(t.messages);if(s>0)this.debug("Transport",this.type,"extended waiting for message replies of request",e.id,":",s,"ms"),e.timeout=this.setTimeout(()=>{Pe(Le,this,De).call(this,t,e,n+s)},s);else{e.expired=!0;const s="Transport "+this+" expired waiting for message replies of request "+e.id+": "+n+" ms",i={reason:s},o=e.xhr;i.httpCode=this.xhrStatus(o),this.abortXHR(o),this.debug(s),this.complete(e,!1,e.metaConnect),t.onFailure(o,t.messages,i)}}function Be(t,e){if(this.transportSend(t,e)&&(e.expired=!1,!t.sync)){let n=this.configuration.maxNetworkDelay;!0===e.metaConnect&&(n+=this.advice.timeout),this.debug("Transport",this.type,"started waiting for message replies of request",e.id,":",n,"ms"),e.timeout=this.setTimeout(()=>{Pe(Le,this,De).call(this,t,e,n)},n)}}function Ke(t){var e;const n=$e(Oe,this,(e=Re(Oe,this),++e)),s={id:n,metaConnect:!1,envelope:t};Re(Ie,this).length<this.configuration.maxConnections-1?(Re(Ie,this).push(s),Pe(Le,this,Be).call(this,t,s)):(this.debug("Transport",this.type,"queueing request",n,"envelope",t),Re(je,this).push([t,s]))}function We(t){const e=t.id;if(this.debug("Transport",this.type,"/meta/connect complete, request",e),null!==Re(Ce,this)&&Re(Ce,this).id!==e)throw new Error("/meta/connect request mismatch, completing request "+e);$e(Ce,this,null)}function ze(t,e){const n=Re(Ie,this).indexOf(t);if(n>=0&&Re(Ie,this).splice(n,1),Re(je,this).length>0){const n=Re(je,this).shift(),s=n[0],i=n[1];this.debug("Transport dequeued request",i.id),e?(this.configuration.autoBatch&&Pe(Le,this,Ue).call(this,s),Pe(Le,this,Ke).call(this,s),this.debug("Transport",this.type,"completed request",t.id,s)):this.setTimeout(()=>{this.complete(i,!1,i.metaConnect);const t={reason:"Previous request failed"},e=i.xhr;t.httpCode=this.xhrStatus(e),s.onFailure(e,s.messages,t)},0)}}function Fe(t){var e;if(null!==Re(Ce,this))throw new Error("Concurrent /meta/connect requests not allowed, request id="+Re(Ce,this).id+" not yet completed");const n=$e(Oe,this,(e=Re(Oe,this),++e));this.debug("Transport",this.type,"/meta/connect send, request",n,"envelope",t);const s={id:n,metaConnect:!0,envelope:t};Pe(Le,this,Be).call(this,t,s),$e(Ce,this,s)}function He(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function qe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ge=new WeakMap;class Ve extends Me{constructor(...t){super(...t),He(this,Ge,0)}accept(t,e,n){return!0}jsonpSend(t){var e,n;const s=window.document.getElementsByTagName("head")[0],i=window.document.createElement("script"),o="_cometd_jsonp_"+(function(t,e,n){t.set(qe(t,e),n)}(Ge,this,(a=this,e=(r=Ge).get(qe(r,a)),n=e++,e)),n);var r,a;window[o]=e=>{s.removeChild(i),delete window[o],t.onSuccess(e)};let c=t.url;c+=c.indexOf("?")<0?"?":"&",c+="jsonp="+o,c+="&message="+encodeURIComponent(t.body),i.src=c,i.async=!0!==t.sync,i.type="text/javascript",i.onerror=e=>{t.onError("jsonp "+e.type)},s.appendChild(i)}transportSend(t,e){let n=0,s=t.messages.length;const i=[];for(;s>0;){const o=JSON.stringify(t.messages.slice(n,n+s)),r=t.url.length+encodeURI(o).length,a=this.configuration.maxURILength;if(r>a){if(1===s){const n="Bayeux message too big ("+r+" bytes, max is "+a+") for transport "+this;return this.setTimeout(()=>this.transportFailure(t,e,{exception:n}),0),!1}--s}else i.push(s),n+=s,s=t.messages.length-n}let o=t;if(i.length>1){let n=0,s=i[0];this.debug("Transport",this.type,"split",t.messages.length,"messages into",i.join(" + ")),o=this.cometd._mixin(!1,{},t),o.messages=t.messages.slice(n,s),o.onSuccess=t.onSuccess,o.onFailure=t.onFailure;for(let o=1;o<i.length;++o){const r=this.cometd._mixin(!1,{},t);n=s,s+=i[o],r.messages=t.messages.slice(n,s),r.onSuccess=t.onSuccess,r.onFailure=t.onFailure,this.send(r,e.metaConnect)}}this.debug("Transport",this.type,"sending request",e.id,"envelope",o);try{let t=!0;return this.jsonpSend({transport:this,url:o.url,sync:o.sync,headers:this.configuration.requestHeaders,body:JSON.stringify(o.messages),onSuccess:t=>{let n=!1;try{const s=this.convertToMessages(t);0===s.length?this.transportFailure(o,e,{httpCode:204}):(n=!0,this.transportSuccess(o,e,s))}catch(t){this.debug(t),n||this.transportFailure(o,e,{exception:t})}},onError:(n,s)=>{const i={reason:n,exception:s};t?this.setTimeout(()=>{this.transportFailure(o,e,i)},0):this.transportFailure(o,e,i)}}),t=!1,!0}catch(t){return this.setTimeout(()=>{this.transportFailure(o,e,{exception:t})},0),!1}}}function Je(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ye(t,e,n){return t.set(Xe(t,e),n),n}function Xe(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ze=new WeakMap,Qe=new WeakSet;class tn extends Me{constructor(...t){var e,n;super(...t),Je(e=this,n=Qe),n.add(e),function(t,e,n){Je(t,e),e.set(t,n)}(this,Ze,!0)}accept(t,e,n){return i=this,(s=Ze).get(Xe(s,i))||!e;var s,i}xhrSend(t){const e=Xe(Qe,this,en).call(this);Xe(Qe,this,nn).call(this,e),e.withCredentials=!0,e.open("POST",t.url,!0!==t.sync);const n=t.headers;if(n)for(let t in n)n.hasOwnProperty(t)&&e.setRequestHeader(t,n[t]);return e.setRequestHeader("Content-Type","application/json"),e.onload=()=>{200===e.status?t.onSuccess(e.responseText):t.onError(e.statusText)},e.onabort=e.onerror=()=>{t.onError(e.statusText)},e.send(t.body),e}transportSend(t,e){this.debug("Transport",this.type,"sending request",e.id,"envelope",t);try{let n=!0;return e.xhr=this.xhrSend({transport:this,url:t.url,sync:t.sync,headers:this.configuration.requestHeaders,body:this.convertToJSON(t.messages),onSuccess:n=>{this.debug("Transport",this.type,"received response",n);let s=!1;try{const i=this.convertToMessages(n);0===i.length?(Ye(Ze,this,!1),this.transportFailure(t,e,{httpCode:204})):(s=!0,this.transportSuccess(t,e,i))}catch(n){if(this.debug(n),!s){Ye(Ze,this,!1);const s={exception:n};s.httpCode=this.xhrStatus(e.xhr),this.transportFailure(t,e,s)}}},onError:(s,i)=>{this.debug("Transport",this.type,"received error",s,i),Ye(Ze,this,!1);const o={reason:s,exception:i};o.httpCode=this.xhrStatus(e.xhr),n?this.setTimeout(()=>{this.transportFailure(t,e,o)},0):this.transportFailure(t,e,o)}}),n=!1,!0}catch(n){return this.debug("Transport",this.type,"exception:",n),Ye(Ze,this,!1),this.setTimeout(()=>{this.transportFailure(t,e,{exception:n})},0),!1}}reset(t){super.reset(t),Ye(Ze,this,!0)}}function en(){return new window.XMLHttpRequest}function nn(t){try{t.context=this.context}catch(t){this.debug("Could not copy transport context into XHR",t)}}function sn(t,e,n){on(t,e),e.set(t,n)}function on(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rn(t,e){return t.get(cn(t,e))}function an(t,e,n){return t.set(cn(t,e),n),n}function cn(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var hn,un=new WeakMap,ln=new WeakMap,dn=new WeakMap,pn=new WeakMap,fn=new WeakMap,yn=new WeakMap,mn=new WeakMap,gn=new WeakSet;class wn extends _e{constructor(...t){var e,n;super(...t),on(e=this,n=gn),n.add(e),sn(this,un,!0),sn(this,ln,!1),sn(this,dn,!0),sn(this,pn,null),sn(this,fn,null),sn(this,yn,!1),sn(this,mn,null)}reset(t){super.reset(t),an(un,this,!0),t&&an(ln,this,!1),an(dn,this,!0),t&&an(pn,this,null),an(fn,this,null),an(yn,this,!1)}_notifySuccess(t,e){t.call(this,e)}_notifyFailure(t,e,n,s){t.call(this,e,n,s)}accept(t,e,n){return this.debug("Transport",this.type,"accept, supported:",rn(un,this)),rn(un,this)&&!!window.WebSocket&&!1!==this.cometd.websocketEnabled}send(t,e){this.debug("Transport",this.type,"sending",t,"/meta/connect =",e),cn(gn,this,_n).call(this,rn(pn,this),t,e)}abort(){super.abort(),cn(gn,this,bn).call(this,rn(pn,this),{code:1e3,reason:"Abort"}),this.reset(!0)}}function bn(t,e){t&&(cn(gn,this,Rn).call(this,t,e.code,e.reason),cn(gn,this,$n).call(this,t,e))}function vn(t){return t===rn(fn,this)||t===rn(pn,this)}function Sn(t,e,n){const s=[];for(let t=0;t<e.messages.length;++t){const n=e.messages[t];n.id&&s.push(n.id)}t.envelopes[s.join(",")]=[e,n],this.debug("Transport",this.type,"stored envelope, envelopes",t.envelopes)}function Tn(t,e){let n=!1;const s=t.envelopes;for(let t=0;t<e.length;++t){const i=e[t];for(let t in s)if(s.hasOwnProperty(t)){const e=t.split(","),o=e.indexOf(i);if(o>=0){n=!0,e.splice(o,1);const i=s[t][0],r=s[t][1];delete s[t],e.length>0&&(s[e.join(",")]=[i,r]);break}}}n&&this.debug("Transport",this.type,"removed envelope, envelopes",s)}function En(t){if(rn(fn,this))return;const e=this.cometd.getURL().replace(/^http/,"ws");this.debug("Transport",this.type,"connecting to URL",e);try{const n=this.configuration.protocol;t.webSocket=n?new window.WebSocket(e,n):new window.WebSocket(e),an(fn,this,t)}catch(t){throw an(un,this,!1),this.debug("Exception while creating WebSocket object",t),t}an(dn,this,!1!==this.configuration.stickyReconnect);const n=this.configuration.connectTimeout;n>0&&(t.connectTimer=this.setTimeout(()=>{this.debug("Transport",this.type,"timed out while connecting to URL",e,":",n,"ms"),cn(gn,this,bn).call(this,t,{code:1e3,reason:"Connect Timeout"})},n));const s=e=>{e=e||{code:1e3},this.debug("Transport",this.type,"onclose",t,e,"connecting",rn(fn,this),"current",rn(pn,this)),t.connectTimer&&this.clearTimeout(t.connectTimer),cn(gn,this,$n).call(this,t,e)};t.webSocket.onopen=()=>{this.debug("Transport",this.type,"onopen",t),t.connectTimer&&this.clearTimeout(t.connectTimer),cn(gn,this,vn).call(this,t)?(an(fn,this,null),an(pn,this,t),an(ln,this,!0),cn(gn,this,An).call(this,t)):(this.cometd._warn("Closing extra WebSocket connection",this,"active connection",rn(pn,this)),cn(gn,this,bn).call(this,t,{code:1e3,reason:"Extra Connection"}))},t.webSocket.onclose=s,t.webSocket.onerror=()=>{s({code:1e3,reason:"Error"})},t.webSocket.onmessage=e=>{this.debug("Transport",this.type,"onmessage",e,t),cn(gn,this,Nn).call(this,t,e)},this.debug("Transport",this.type,"configured callbacks on",t)}function xn(t,e,n){const s=this.notifyTransportTimeout([e]);s>0?(this.debug("Transport",this.type,"extended waiting for message replies:",s,"ms"),t.timeouts[e.id]=this.setTimeout(()=>{cn(gn,this,xn).call(this,t,e,n+s)},s)):(this.debug("Transport",this.type,"expired waiting for message reply",e.id,":",n,"ms"),cn(gn,this,bn).call(this,t,{code:1e3,reason:"Message Timeout"}))}function kn(t,e,n){let s;try{s=this.convertToJSON(e.messages)}catch(n){this.debug("Transport",this.type,"exception:",n);const s=[];for(let t=0;t<e.messages.length;++t){const n=e.messages[t];s.push(n.id)}return cn(gn,this,Tn).call(this,t,s),void this.setTimeout(()=>{this._notifyFailure(e.onFailure,t,e.messages,{exception:n})},0)}t.webSocket.send(s),this.debug("Transport",this.type,"sent",e,"/meta/connect =",n);let i=this.configuration.maxNetworkDelay;n&&(i+=this.advice.timeout,an(yn,this,!0));const o=[];for(let n=0;n<e.messages.length;++n){const s=e.messages[n];s.id&&(o.push(s.id),t.timeouts[s.id]=this.setTimeout(()=>{cn(gn,this,xn).call(this,t,s,i)},i))}this.debug("Transport",this.type,"started waiting for message replies",i,"ms, messageIds:",o,", timeouts:",t.timeouts)}function _n(t,e,n){try{null===t?(t=rn(fn,this)||{envelopes:{},timeouts:{}},cn(gn,this,Sn).call(this,t,e,n),cn(gn,this,En).call(this,t)):(cn(gn,this,Sn).call(this,t,e,n),cn(gn,this,kn).call(this,t,e,n))}catch(e){this.setTimeout(()=>{cn(gn,this,bn).call(this,t,{code:1e3,reason:"Exception",exception:e})},0)}}function An(t){const e=t.envelopes;this.debug("Transport",this.type,"opened",t,"pending messages",e);for(let n in e)if(e.hasOwnProperty(n)){const s=e[n],i=s[0],o=s[1];an(mn,this,i.onSuccess),cn(gn,this,kn).call(this,t,i,o)}}function Nn(t,e){this.debug("Transport",this.type,"received websocket message",e,t);let n=!1;const s=this.convertToMessages(e.data),i=[];for(let e=0;e<s.length;++e){const o=s[e];if((/^\/meta\//.test(o.channel)||void 0===o.data)&&o.id){i.push(o.id);const e=t.timeouts[o.id];e&&(this.clearTimeout(e),delete t.timeouts[o.id],this.debug("Transport",this.type,"removed timeout for message",o.id,", timeouts",t.timeouts))}"/meta/connect"===o.channel&&an(yn,this,!1),"/meta/disconnect"!==o.channel||rn(yn,this)||(n=!0)}cn(gn,this,Tn).call(this,t,i),this._notifySuccess(rn(mn,this),s),n&&cn(gn,this,Rn).call(this,t,1e3,"Disconnect")}function $n(t,e){this.debug("Transport",this.type,"closed",t,e),cn(gn,this,vn).call(this,t)&&(an(un,this,rn(dn,this)&&rn(ln,this)),an(fn,this,null),an(pn,this,null));const n=t.timeouts;t.timeouts={};for(let t in n)n.hasOwnProperty(t)&&this.clearTimeout(n[t]);const s=t.envelopes;t.envelopes={};for(let n in s)if(s.hasOwnProperty(n)){const i=s[n][0];s[n][1]&&an(yn,this,!1);const o={websocketCode:e.code,reason:e.reason};e.exception&&(o.exception=e.exception),this._notifyFailure(i.onFailure,t,i.messages,o)}}function Rn(t,e,n){try{t.webSocket&&t.webSocket.close(e,n)}catch(t){this.debug(t)}}function Pn(t,e,n){On(t,e),e.set(t,n)}function On(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Cn(t,e){return t.get(jn(t,e))}function In(t,e,n){return t.set(jn(t,e),n),n}function jn(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function Ln(){let t=0;const e={};this.register=n=>{const s=++t;return e[s]=n,s},this.unregister=t=>{const n=e[t];return delete e[t],n},this.setTimeout=(t,e)=>window.setTimeout(t,e),this.clearTimeout=t=>{window.clearTimeout(t)}}function Mn(){const t={};self.onmessage=e=>{const n=e.data,s=t[n.id];switch(n.type){case"setTimeout":t[n.id]=self.setTimeout(()=>{delete t[n.id],self.postMessage({id:n.id})},n.delay);break;case"clearTimeout":delete t[n.id],s&&self.clearTimeout(s);break;default:throw new Error("Unknown command "+n.type)}}}var Un=new WeakMap,Dn=new WeakMap,Bn=new WeakMap,Kn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Fn=new WeakMap,Hn=new WeakMap,qn=new WeakMap,Gn=new WeakMap,Vn=new WeakMap,Jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,ts=new WeakMap,es=new WeakMap,ns=new WeakMap,ss=new WeakMap,is=new WeakMap,os=new WeakMap,rs=new WeakMap,as=new WeakMap,cs=new WeakMap,hs=new WeakMap,us=new WeakMap,ls=new WeakMap,ds=new WeakSet;class ps{constructor(t){var e,n;On(e=this,n=ds),n.add(e),Pn(this,Un,new Ln),Pn(this,Dn,void 0),Pn(this,Bn,!1),Pn(this,Kn,new we),Pn(this,Wn,void 0),Pn(this,zn,"disconnected"),Pn(this,Fn,0),Pn(this,Hn,null),Pn(this,qn,0),Pn(this,Gn,[]),Pn(this,Vn,!1),Pn(this,Jn,0),Pn(this,Yn,{}),Pn(this,Xn,{}),Pn(this,Zn,0),Pn(this,Qn,null),Pn(this,ts,[]),Pn(this,es,{}),Pn(this,ns,void 0),Pn(this,ss,void 0),Pn(this,is,{}),Pn(this,os,{}),Pn(this,rs,!1),Pn(this,as,!1),Pn(this,cs,0),Pn(this,hs,0),Pn(this,us,null),Pn(this,ls,{useWorkerScheduler:!0,protocol:null,stickyReconnect:!0,connectTimeout:0,maxConnections:2,backoffIncrement:1e3,maxBackoff:6e4,logLevel:"info",maxNetworkDelay:1e4,requestHeaders:{},appendMessageTypeToURL:!0,autoBatch:!1,urls:{},maxURILength:2e3,maxSendBayeuxMessageSize:8192,advice:{timeout:6e4,interval:0,reconnect:void 0,maxInterval:0}}),In(Dn,this,t||"default"),window.WebSocket&&this.registerTransport("websocket",new wn),this.registerTransport("long-polling",new tn),this.registerTransport("callback-polling",new Ve)}_mixin(t,e,n){const s=e||{};for(let n=2;n<arguments.length;++n){const i=arguments[n];if(null!=i)for(let n in i)if(i.hasOwnProperty(n)){const o=fs.call(ps,i,n),r=fs.call(ps,s,n);if(o===e)continue;if(void 0===o)continue;if(t&&"object"==typeof o&&null!==o)if(o instanceof Array)s[n]=this._mixin(t,r instanceof Array?r:[],o);else{const e="object"!=typeof r||r instanceof Array?{}:r;s[n]=this._mixin(t,e,o)}else s[n]=o}}return s}_warn(){jn(ds,this,Ts).call(this,"warn",arguments)}_info(){"warn"!==Cn(ls,this).logLevel&&jn(ds,this,Ts).call(this,"info",arguments)}_debug(){"debug"===Cn(ls,this).logLevel&&jn(ds,this,Ts).call(this,"debug",arguments)}send(t){jn(ds,this,Bs).call(this,t)}_getCallback(t){return Cn(is,this)[t]}_putCallback(t,e){const n=this._getCallback(t);return vs.call(ps,e)&&(Cn(is,this)[t]=e),n}onTransportFailure(t,e,n){this._debug("Transport failure",e,"for",t);const s=this.getTransportRegistry(),i=this.getURL(),o=jn(ds,this,xs).call(this,Es.call(ps,i)[2]),r=s.findTransportTypes("1.0",o,i);if("none"===e.action){if("/meta/handshake"===t.channel&&!e.transport){const e="Could not negotiate transport, client=["+r+"], server=["+t.supportedConnectionTypes+"]";this._warn(e);const n=this.getTransport();if(n){const t=n.type;jn(ds,this,Ys).call(this,t,null,{reason:e,connectionType:t,transport:n})}}}else if(e.delay=this.getBackoffPeriod(),"/meta/handshake"===t.channel){if(!e.transport){const n=Cn(Wn,this)?Cn(Wn,this).type:null,a=s.negotiateTransport(r,"1.0",o,i);if(a){const s=a.type;this._debug("Transport",n,"->",s),jn(ds,this,Ys).call(this,n,s,t.failure),e.action="handshake",e.transport=a}else this._warn("Could not negotiate transport, client=["+r+"]"),jn(ds,this,Ys).call(this,n,null,t.failure),e.action="none"}"none"!==e.action&&this.increaseBackoffPeriod()}else{const t=(new Date).getTime();if(0===Cn(cs,this)&&In(cs,this,t),"retry"===e.action){e.delay=this.increaseBackoffPeriod();const n=Cn(es,this).maxInterval;if(n>0){const s=Cn(es,this).timeout+Cn(es,this).interval+n;t-Cn(cs,this)+Cn(Zn,this)>s&&(e.action="handshake")}}"handshake"===e.action&&(e.delay=0,s.reset(!1),this.resetBackoffPeriod())}n.call(this,e)}receive(t){jn(ds,this,Ti).call(this,t)}registerTransport(t,e,n){const s=Cn(Kn,this).add(t,e,n);return s&&(this._debug("Registered transport",t),vs.call(ps,e.registered)&&e.registered(t,this)),s}unregisterTransport(t){const e=Cn(Kn,this).remove(t);return null!==e&&(this._debug("Unregistered transport",t),vs.call(ps,e.unregistered)&&e.unregistered()),e}unregisterTransports(){Cn(Kn,this).clear()}getTransportTypes(){return Cn(Kn,this).getTransportTypes()}findTransport(t){return Cn(Kn,this).find(t)}getTransportRegistry(){return Cn(Kn,this)}configure(t){jn(ds,this,ks).call(this,t)}init(t,e){this.configure(t),this.handshake(e)}handshake(t,e){const n=this.getStatus();if("disconnected"!==n)throw new Error("Illegal state: "+n);jn(ds,this,Xs).call(this,t,e)}disconnect(t,e){if(this.isDisconnected())return;vs.call(ps,t)&&(e=t,t=void 0);const n={id:jn(ds,this,Ps).call(this),channel:"/meta/disconnect"},s=this._mixin(!1,{},t,n);this._putCallback(s.id,e),jn(ds,this,$s).call(this,"disconnecting"),jn(ds,this,Ds).call(this,[s],!1,"disconnect")}startBatch(){jn(ds,this,zs).call(this)}endBatch(){jn(ds,this,Hs).call(this)}batch(t,e){const n=jn(ds,this,_i).call(this,t,e);this.startBatch();try{n.method.call(n.scope),this.endBatch()}catch(t){throw this._info("Exception during execution of batch",t),this.endBatch(),t}}addTransportListener(t,e){if("timeout"!==t)throw new Error("Unsupported event "+t);let n=Cn(Xn,this)[t];n||(Cn(Xn,this)[t]=n=[]),n.push(e)}removeTransportListener(t,e){const n=Cn(Xn,this)[t];if(n){const t=n.indexOf(e);if(t>=0)return n.splice(t,1),!0}return!1}_getTransportListeners(t){return Cn(Xn,this)[t]}addListener(t,e,n){if(arguments.length<2)throw new Error("Illegal arguments number: required 2, got "+arguments.length);if(!ys.call(ps,t))throw new Error("Illegal argument type: channel must be a string");return jn(ds,this,Ai).call(this,t,e,n,!0)}removeListener(t){if(!t||!t.channel||!("id"in t))throw new Error("Invalid argument: expected subscription, not "+t);jn(ds,this,_s).call(this,t)}clearListeners(){In(Yn,this,{})}subscribe(t,e,n,s,i){if(arguments.length<2)throw new Error("Illegal arguments number: required 2, got "+arguments.length);if(!bs.call(ps,t))throw new Error("Illegal argument: invalid channel "+t);if(this.isDisconnected())throw new Error("Illegal state: disconnected");vs.call(ps,e)&&(i=s,s=n,n=e,e=void 0),vs.call(ps,s)&&(i=s,s=void 0);const o=!jn(ds,this,ki).call(this,t),r=jn(ds,this,Ai).call(this,t,e,n,!1);if(o){const e={id:jn(ds,this,Ps).call(this),channel:"/meta/subscribe",subscription:t},n=this._mixin(!1,{},s,e);this._putCallback(n.id,i),jn(ds,this,Bs).call(this,n)}else vs.call(ps,i)&&this.setTimeout(()=>{jn(ds,this,Qs).call(this,i,{id:jn(ds,this,Ps).call(this),successful:!0,channel:"/meta/subscribe",subscription:t})},0);return r}unsubscribe(t,e,n){if(arguments.length<1)throw new Error("Illegal arguments number: required 1, got "+arguments.length);if(this.isDisconnected())throw new Error("Illegal state: disconnected");vs.call(ps,e)&&(n=e,e=void 0),this.removeListener(t);const s=t.channel;if(jn(ds,this,ki).call(this,s))vs.call(ps,n)&&this.setTimeout(()=>{jn(ds,this,Qs).call(this,n,{id:jn(ds,this,Ps).call(this),successful:!0,channel:"/meta/unsubscribe",subscription:s})},0);else{const t={id:jn(ds,this,Ps).call(this),channel:"/meta/unsubscribe",subscription:s},i=this._mixin(!1,{},e,t);this._putCallback(i.id,n),jn(ds,this,Bs).call(this,i)}}resubscribe(t,e){if(jn(ds,this,As).call(this,t),t)return this.subscribe(t.channel,t.scope,t.callback,e)}clearSubscriptions(){jn(ds,this,Ns).call(this)}publish(t,e,n,s){if(arguments.length<1)throw new Error("Illegal arguments number: required 1, got "+arguments.length);if(!bs.call(ps,t))throw new Error("Illegal argument: invalid channel "+t);if(/^\/meta\//.test(t))throw new Error("Illegal argument: cannot publish to meta channels");if(this.isDisconnected())throw new Error("Illegal state: disconnected");vs.call(ps,e)?(s=e,e={},n=void 0):vs.call(ps,n)&&(s=n,n=void 0);const i={id:jn(ds,this,Ps).call(this),channel:t,data:e},o=this._mixin(!1,{},n,i);this._putCallback(o.id,s),jn(ds,this,Bs).call(this,o)}publishBinary(t,e,n,s,i,o){vs.call(ps,e)?(o=e,e=new ArrayBuffer(0),n=!0,s=void 0,i=void 0):vs.call(ps,n)?(o=n,n=!0,s=void 0,i=void 0):vs.call(ps,s)?(o=s,s=void 0,i=void 0):vs.call(ps,i)&&(o=i,i=void 0);const r={meta:s,data:e,last:n},a=this._mixin(!1,i,{ext:{binary:{}}});this.publish(t,r,a,o)}remoteCall(t,e,n,s,i){if(arguments.length<1)throw new Error("Illegal arguments number: required 1, got "+arguments.length);if(!ys.call(ps,t))throw new Error("Illegal argument type: target must be a string");if(this.isDisconnected())throw new Error("Illegal state: disconnected");if(vs.call(ps,e)?(i=e,e={},n=Cn(ls,this).maxNetworkDelay,s=void 0):vs.call(ps,n)?(i=n,n=Cn(ls,this).maxNetworkDelay,s=void 0):vs.call(ps,s)&&(i=s,s=void 0),"number"!=typeof n)throw new Error("Illegal argument type: timeout must be a number");t.match(/^\//)||(t="/"+t);const o="/service"+t;if(!bs.call(ps,o))throw new Error("Illegal argument: invalid target "+t);const r={id:jn(ds,this,Ps).call(this),channel:o,data:e},a=this._mixin(!1,{},s,r),c={callback:i};n>0&&(c.timeout=this.setTimeout(()=>{this._debug("Timing out remote call",a,"after",n,"ms"),jn(ds,this,bi).call(this,{id:a.id,error:"406::timeout",successful:!1,failure:{message:a,reason:"Remote Call Timeout"}})},n),this._debug("Scheduled remote call timeout",a,"in",n,"ms")),Cn(os,this)[a.id]=c,jn(ds,this,Bs).call(this,a)}remoteCallBinary(t,e,n,s,i,o,r){vs.call(ps,e)?(r=e,e=new ArrayBuffer(0),n=!0,s=void 0,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,n)?(r=n,n=!0,s=void 0,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,s)?(r=s,s=void 0,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,i)?(r=i,i=Cn(ls,this).maxNetworkDelay,o=void 0):vs.call(ps,o)&&(r=o,o=void 0);const a={meta:s,data:e,last:n},c=this._mixin(!1,o,{ext:{binary:{}}});this.remoteCall(t,a,i,c,r)}getStatus(){return Cn(zn,this)}isDisconnected(){return jn(ds,this,Rs).call(this)}setBackoffIncrement(t){Cn(ls,this).backoffIncrement=t}getBackoffIncrement(){return Cn(ls,this).backoffIncrement}getBackoffPeriod(){return Cn(Zn,this)}increaseBackoffPeriod(){return jn(ds,this,Ws).call(this)}resetBackoffPeriod(){jn(ds,this,Ks).call(this)}setLogLevel(t){Cn(ls,this).logLevel=t}registerExtension(t,e){if(arguments.length<2)throw new Error("Illegal arguments number: required 2, got "+arguments.length);if(!ys.call(ps,t))throw new Error("Illegal argument type: extension name must be a string");let n=!1;for(let e=0;e<Cn(ts,this).length;++e){if(Cn(ts,this)[e].name===t){n=!0;break}}return n?(this._info("Could not register extension with name",t,"since another extension with the same name already exists"),!1):(Cn(ts,this).push({name:t,extension:e}),this._debug("Registered extension",t),vs.call(ps,e.registered)&&e.registered(t,this),!0)}unregisterExtension(t){if(!ys.call(ps,t))throw new Error("Illegal argument type: extension name must be a string");let e=!1;for(let n=0;n<Cn(ts,this).length;++n){const s=Cn(ts,this)[n];if(s.name===t){Cn(ts,this).splice(n,1),e=!0,this._debug("Unregistered extension",t);const i=s.extension;vs.call(ps,i.unregistered)&&i.unregistered();break}}return e}getExtension(t){for(let e=0;e<Cn(ts,this).length;++e){const n=Cn(ts,this)[e];if(n.name===t)return n.extension}return null}getName(){return Cn(Dn,this)}getClientId(){return Cn(Hn,this)}getURL(){const t=this.getTransport();if(t){let e=t.url;if(e)return e;if(e=Cn(ls,this).urls[t.type],e)return e}return Cn(ls,this).url}getTransport(){return Cn(Wn,this)}getConfiguration(){return this._mixin(!0,{},Cn(ls,this))}getAdvice(){return this._mixin(!0,{},Cn(es,this))}setTimeout(t,e){return Cn(Un,this).setTimeout(()=>{try{this._debug("Invoking timed function",t),t()}catch(e){this._debug("Exception invoking timed function",t,e)}},e)}clearTimeout(t){Cn(Un,this).clearTimeout(t)}}function fs(t,e){try{return t[e]}catch(t){return}}function ys(t){return null!=t&&("string"==typeof t||t instanceof String)}function ms(t){return t>="A"&&t<="Z"||t>="a"&&t<="z"}function gs(t){return t>="0"&&t<="9"}function ws(t){switch(t){case" ":case"!":case"#":case"$":case"(":case")":case"*":case"+":case"-":case".":case"/":case"@":case"_":case"{":case"~":case"}":return!0;default:return!1}}function bs(t){if(!ys.call(hn,t))return!1;if(t.length<2)return!1;if("/"!==t.charAt(0))return!1;for(let e=1;e<t.length;++e){const n=t.charAt(e);if(!(ms.call(hn,n)||gs.call(hn,n)||ws.call(hn,n)))return!1}return!0}function vs(t){return null!=t&&"function"==typeof t}function Ss(t,e){let n="";for(;--e>0&&!(t>=Math.pow(10,e));)n+="0";return n+=t,n}function Ts(t,e){if(window.console){const n=window.console[t];if(vs.call(hn,n)){const t=new Date;[].splice.call(e,0,0,Ss.call(hn,t.getHours(),2)+":"+Ss.call(hn,t.getMinutes(),2)+":"+Ss.call(hn,t.getSeconds(),2)+"."+Ss.call(hn,t.getMilliseconds(),3)),n.apply(window.console,e)}}}function Es(t){return new RegExp("(^https?://)?(((\\[[^\\]]+])|([^:/?#]+))(:(\\d+))?)?([^?#]*)(.*)?").exec(t)}function xs(t){return!!(window.location&&window.location.host&&t)&&t!==window.location.host}function ks(t){this._debug("Configuring cometd object with",t),ys.call(hn,t)&&(t={url:t}),t||(t={}),In(ls,this,this._mixin(!1,Cn(ls,this),t));const e=this.getURL();if(!e)throw new Error("Missing required configuration parameter 'url' specifying the Bayeux server URL");const n=Es.call(hn,e),s=n[2],i=n[8],o=n[9];if(In(Bn,this,jn(ds,this,xs).call(this,s)),Cn(ls,this).appendMessageTypeToURL)if(void 0!==o&&o.length>0)this._info("Appending message type to URI",i,o,"is not supported, disabling 'appendMessageTypeToURL' configuration"),Cn(ls,this).appendMessageTypeToURL=!1;else{const t=i.split("/");let e=t.length-1;i.match(/\/$/)&&(e-=1),t[e].indexOf(".")>=0&&(this._info("Appending message type to URI",i,"is not supported, disabling 'appendMessageTypeToURL' configuration"),Cn(ls,this).appendMessageTypeToURL=!1)}if(window.Worker&&window.Blob&&window.URL&&Cn(ls,this).useWorkerScheduler){let t=Mn.toString();t=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));const e=new window.Blob([t],{type:"application/json"}),n=window.URL.createObjectURL(e),s=new window.Worker(n);Cn(Un,this).setTimeout=(t,e)=>{const n=Cn(Un,this).register(t);return s.postMessage({id:n,type:"setTimeout",delay:e}),n},Cn(Un,this).clearTimeout=t=>{Cn(Un,this).unregister(t),s.postMessage({id:t,type:"clearTimeout"})},s.onmessage=t=>{const e=t.data.id,n=Cn(Un,this).unregister(e);n&&n()}}}function _s(t){if(t){const e=Cn(Yn,this)[t.channel];e&&e[t.id]&&(delete e[t.id],this._debug("Removed",t.listener?"listener":"subscription",t))}}function As(t){t&&!t.listener&&jn(ds,this,_s).call(this,t)}function Ns(){for(let t in Cn(Yn,this))if(Cn(Yn,this).hasOwnProperty(t)){const e=Cn(Yn,this)[t];if(e)for(let t in e)e.hasOwnProperty(t)&&jn(ds,this,As).call(this,e[t])}}function $s(t){const e=this.getStatus();e!==t&&(this._debug("Status",e,"->",t),In(zn,this,t))}function Rs(){const t=Cn(zn,this);return"disconnecting"===t||"disconnected"===t}function Ps(){var t;return""+In(Fn,this,(t=Cn(Fn,this),++t))}function Os(t,e,n,s,i){try{return e.call(t,s)}catch(t){const e=this.onExtensionException;if(vs.call(hn,e)){this._debug("Invoking extension exception handler",n,t);try{e.call(this,t,n,i,s)}catch(t){this._info("Exception during execution of extension exception handler",n,t)}}else this._info("Exception during execution of extension",n,t);return s}}function Cs(t){for(let e=0;e<Cn(ts,this).length&&null!=t;++e){const n=Cn(ts,this)[e],s=n.extension.incoming;if(vs.call(hn,s)){const e=jn(ds,this,Os).call(this,n.extension,s,n.name,t,!1);t=void 0===e?t:e}}return t}function Is(t){for(let e=Cn(ts,this).length-1;e>=0&&null!=t;--e){const n=Cn(ts,this)[e],s=n.extension.outgoing;if(vs.call(hn,s)){const e=jn(ds,this,Os).call(this,n.extension,s,n.name,t,!0);t=void 0===e?t:e}}return t}function js(t,e){const n=Cn(Yn,this)[t];if(n)for(let t in n)if(n.hasOwnProperty(t)){const s=n[t];if(s)try{s.callback.call(s.scope,e)}catch(t){const n=this.onListenerException;if(vs.call(hn,n)){this._debug("Invoking listener exception handler",s,t);try{n.call(this,t,s,s.listener,e)}catch(t){this._info("Exception during execution of listener exception handler",s,t)}}else this._info("Exception during execution of listener",s,e,t)}}}function Ls(t,e){jn(ds,this,js).call(this,t,e);const n=t.split("/"),s=n.length-1;for(let t=s;t>0;--t){let i=n.slice(0,t).join("/")+"/*";t===s&&jn(ds,this,js).call(this,i,e),i+="*",jn(ds,this,js).call(this,i,e)}}function Ms(){null!==Cn(Qn,this)&&this.clearTimeout(Cn(Qn,this)),In(Qn,this,null)}function Us(t,e){jn(ds,this,Ms).call(this);const n=Cn(es,this).interval+e;this._debug("Function scheduled in",n,"ms, interval =",Cn(es,this).interval,"backoff =",Cn(Zn,this),t),In(Qn,this,this.setTimeout(t,n))}function Ds(t,e,n){for(let e=0;e<t.length;++e){let n=t[e];const s=n.id,i=this.getClientId();i&&(n.clientId=i),n=jn(ds,this,Is).call(this,n),null!=n?(n.id=s,t[e]=n):(delete Cn(is,this)[s],t.splice(e--,1))}if(0===t.length)return;e&&In(us,this,t[0]);let s=this.getURL();Cn(ls,this).appendMessageTypeToURL&&(s.match(/\/$/)||(s+="/"),n&&(s+=n));const i={url:s,sync:!1,messages:t,onSuccess:t=>{try{jn(ds,this,Ei).call(this,t)}catch(t){this._info("Exception during handling of messages",t)}},onFailure:(t,e,n)=>{try{const s=this.getTransport();n.connectionType=s?s.type:"unknown",jn(ds,this,xi).call(this,t,e,n)}catch(t){this._info("Exception during handling of failure",t)}}};this._debug("Send",i),this.getTransport().send(i,e)}function Bs(t){Cn(qn,this)>0||!0===Cn(Vn,this)?Cn(Gn,this).push(t):jn(ds,this,Ds).call(this,[t],!1)}function Ks(){In(Zn,this,0)}function Ws(){return Cn(Zn,this)<Cn(ls,this).maxBackoff&&In(Zn,this,Cn(Zn,this)+this.getBackoffIncrement()),Cn(Zn,this)}function zs(){var t;In(qn,this,(t=Cn(qn,this),++t)),this._debug("Starting batch, depth",Cn(qn,this))}function Fs(){const t=Cn(Gn,this);In(Gn,this,[]),t.length>0&&jn(ds,this,Ds).call(this,t,!1)}function Hs(){var t;if(In(qn,this,(t=Cn(qn,this),--t)),this._debug("Ending batch, depth",Cn(qn,this)),Cn(qn,this)<0)throw new Error("Calls to startBatch() and endBatch() are not paired");0!==Cn(qn,this)||this.isDisconnected()||Cn(Vn,this)||jn(ds,this,Fs).call(this)}function qs(){if(!this.isDisconnected()){const t={id:jn(ds,this,Ps).call(this),channel:"/meta/connect",connectionType:this.getTransport().type};Cn(as,this)||(t.advice={timeout:0}),jn(ds,this,$s).call(this,"connecting"),this._debug("Connect sent",t),jn(ds,this,Ds).call(this,[t],!0,"connect"),jn(ds,this,$s).call(this,"connected")}}function Gs(t){jn(ds,this,$s).call(this,"connecting"),jn(ds,this,Us).call(this,()=>{jn(ds,this,qs).call(this)},t)}function Vs(t){t&&(In(es,this,this._mixin(!1,{},Cn(ls,this).advice,t)),this._debug("New advice",Cn(es,this)))}function Js(t){jn(ds,this,Ms).call(this);const e=this.getTransport();if(t&&e&&e.abort(),In(Bn,this,!1),In(Wn,this,null),jn(ds,this,$s).call(this,"disconnected"),In(Hn,this,null),In(qn,this,0),jn(ds,this,Ks).call(this),In(rs,this,!1),In(as,this,!1),In(cs,this,0),In(us,this,null),Cn(Gn,this).length>0){const t=Cn(Gn,this);In(Gn,this,[]),jn(ds,this,xi).call(this,void 0,t,{reason:"Disconnected"})}}function Ys(t,e,n){const s=this.onTransportException;if(vs.call(hn,s)){this._debug("Invoking transport exception handler",t,e,n);try{s.call(this,n,t,e)}catch(t){this._info("Exception during execution of transport exception handler",t)}}}function Xs(t,e){vs.call(hn,t)&&(e=t,t=void 0),In(Hn,this,null),this.clearSubscriptions(),this.isDisconnected()&&Cn(Kn,this).reset(!0),jn(ds,this,Vs).call(this,{}),In(qn,this,0),In(Vn,this,!0),In(ns,this,t),In(ss,this,e);const n="1.0",s=this.getURL(),i=Cn(Kn,this).findTransportTypes(n,Cn(Bn,this),s),o={id:jn(ds,this,Ps).call(this),version:n,minimumVersion:n,channel:"/meta/handshake",supportedConnectionTypes:i,advice:{timeout:Cn(es,this).timeout,interval:Cn(es,this).interval}},r=this._mixin(!1,{},Cn(ns,this),o);if(this._putCallback(r.id,e),!Cn(Wn,this)&&(In(Wn,this,Cn(Kn,this).negotiateTransport(i,n,Cn(Bn,this),s)),!Cn(Wn,this))){const t="Could not find initial transport among: "+this.getTransportTypes();throw this._warn(t),new Error(t)}this._debug("Initial transport is",Cn(Wn,this).type),jn(ds,this,$s).call(this,"handshaking"),this._debug("Handshake sent",r),jn(ds,this,Ds).call(this,[r],!1,"handshake")}function Zs(t){jn(ds,this,$s).call(this,"handshaking"),In(Vn,this,!0),jn(ds,this,Us).call(this,()=>{jn(ds,this,Xs).call(this,Cn(ns,this),Cn(ss,this))},t)}function Qs(t,e){try{t.call(this,e)}catch(t){const n=this.onCallbackException;if(vs.call(hn,n)){this._debug("Invoking callback exception handler",t);try{n.call(this,t,e)}catch(t){this._info("Exception during execution of callback exception handler",t)}}else this._info("Exception during execution of message callback",t)}}function ti(t){const e=this._getCallback([t.id]);vs.call(hn,e)&&(delete Cn(is,this)[t.id],jn(ds,this,Qs).call(this,e,t))}function ei(t){const e=Cn(os,this)[t.id];if(delete Cn(os,this)[t.id],e){this._debug("Handling remote call response for",t,"with context",e);const n=e.timeout;n&&this.clearTimeout(n);const s=e.callback;if(vs.call(hn,s))return jn(ds,this,Qs).call(this,s,t),!0}return!1}function ni(t){this._debug("Transport failure handling",t),t.transport&&In(Wn,this,t.transport),t.url&&(Cn(Wn,this).url=t.url);const e=t.action,n=t.delay||0;switch(e){case"handshake":jn(ds,this,Zs).call(this,n);break;case"retry":jn(ds,this,Gs).call(this,n);break;case"none":jn(ds,this,Js).call(this,!0);break;default:throw new Error("Unknown action "+e)}}function si(t,e){jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/handshake",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t),this.isDisconnected()&&(e.action="none"),this.onTransportFailure(t,e,t=>jn(ds,this,ni).call(this,t))}function ii(t){const e=this.getURL();if(t.successful){const n=jn(ds,this,xs).call(this,Es.call(hn,e)[2]),s=Cn(Kn,this).negotiateTransport(t.supportedConnectionTypes,t.version,n,e);if(null===s)return t.successful=!1,void jn(ds,this,si).call(this,t,{cause:"negotiation",action:"none",transport:null});{const t=Cn(Wn,this);t!==s&&(this._debug("Transport",t&&t.type,"->",s.type),In(Wn,this,s))}In(Hn,this,t.clientId),In(Vn,this,!1),jn(ds,this,Fs).call(this),t.reestablish=Cn(rs,this),In(rs,this,!0),jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/handshake",t),In(hs,this,t["x-messages"]||0);const i=this.isDisconnected()?"none":Cn(es,this).reconnect||"retry";switch(i){case"retry":jn(ds,this,Ks).call(this),0===Cn(hs,this)?jn(ds,this,Gs).call(this,0):this._debug("Processing",Cn(hs,this),"handshake-delivered messages");break;case"none":jn(ds,this,Js).call(this,!0);break;default:throw new Error("Unrecognized advice action "+i)}}else jn(ds,this,si).call(this,t,{cause:"unsuccessful",action:Cn(es,this).reconnect||"handshake",transport:this.getTransport()})}function oi(t){jn(ds,this,si).call(this,t,{cause:"failure",action:"handshake",transport:null})}function ri(t){return"disconnected"===this.getStatus()||!(!Cn(us,this)||Cn(us,this).id!==t.id)&&(In(us,this,null),!0)}function ai(t,e){jn(ds,this,Ls).call(this,"/meta/connect",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t),this.isDisconnected()&&(e.action="none"),this.onTransportFailure(t,e,t=>jn(ds,this,ni).call(this,t))}function ci(t){if(jn(ds,this,ri).call(this,t))if(In(as,this,t.successful),Cn(as,this)){jn(ds,this,Ls).call(this,"/meta/connect",t);const e=this.isDisconnected()?"none":Cn(es,this).reconnect||"retry";switch(e){case"retry":jn(ds,this,Ks).call(this),jn(ds,this,Gs).call(this,Cn(Zn,this));break;case"none":jn(ds,this,Js).call(this,!1);break;default:throw new Error("Unrecognized advice action "+e)}}else jn(ds,this,ai).call(this,t,{cause:"unsuccessful",action:Cn(es,this).reconnect||"retry",transport:this.getTransport()});else this._debug("Mismatched /meta/connect reply",t)}function hi(t){jn(ds,this,ri).call(this,t)?(In(as,this,!1),jn(ds,this,ai).call(this,t,{cause:"failure",action:"retry",transport:null})):this._debug("Mismatched /meta/connect failure",t)}function ui(t){jn(ds,this,Js).call(this,!0),jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/disconnect",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t)}function li(t){t.successful?(jn(ds,this,Js).call(this,!1),jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/disconnect",t)):jn(ds,this,ui).call(this,t)}function di(t){jn(ds,this,ui).call(this,t)}function pi(t){const e=Cn(Yn,this)[t.subscription];if(e)for(let t in e)if(e.hasOwnProperty(t)){const n=e[t];n&&!n.listener&&(delete e[t],this._debug("Removed failed subscription",n))}jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/subscribe",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t)}function fi(t){t.successful?(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/subscribe",t)):jn(ds,this,pi).call(this,t)}function yi(t){jn(ds,this,pi).call(this,t)}function mi(t){jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/unsubscribe",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t)}function gi(t){t.successful?(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/unsubscribe",t)):jn(ds,this,mi).call(this,t)}function wi(t){jn(ds,this,mi).call(this,t)}function bi(t){jn(ds,this,ei).call(this,t)||(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/publish",t),jn(ds,this,Ls).call(this,"/meta/unsuccessful",t))}function vi(t){var e;void 0!==t.data?jn(ds,this,ei).call(this,t)||(jn(ds,this,Ls).call(this,t.channel,t),Cn(hs,this)>0&&(In(hs,this,(e=Cn(hs,this),--e)),0===Cn(hs,this)&&(this._debug("Processed last handshake-delivered message"),jn(ds,this,Gs).call(this,0)))):void 0===t.successful?this._warn("Unknown Bayeux Message",t):t.successful?(jn(ds,this,ti).call(this,t),jn(ds,this,Ls).call(this,"/meta/publish",t)):jn(ds,this,bi).call(this,t)}function Si(t){jn(ds,this,bi).call(this,t)}function Ti(t){if(In(cs,this,0),null==(t=jn(ds,this,Cs).call(this,t)))return;jn(ds,this,Vs).call(this,t.advice);switch(t.channel){case"/meta/handshake":jn(ds,this,ii).call(this,t);break;case"/meta/connect":jn(ds,this,ci).call(this,t);break;case"/meta/disconnect":jn(ds,this,li).call(this,t);break;case"/meta/subscribe":jn(ds,this,fi).call(this,t);break;case"/meta/unsubscribe":jn(ds,this,gi).call(this,t);break;default:jn(ds,this,vi).call(this,t)}}function Ei(t){this._debug("Received",t);for(let e=0;e<t.length;++e){const n=t[e];this.receive(n)}}function xi(t,e,n){this._debug("handleFailure",t,e,n),n.transport=t;for(let t=0;t<e.length;++t){const s=e[t],i={id:s.id,successful:!1,channel:s.channel,failure:n};switch(n.message=s,s.channel){case"/meta/handshake":jn(ds,this,oi).call(this,i);break;case"/meta/connect":jn(ds,this,hi).call(this,i);break;case"/meta/disconnect":jn(ds,this,di).call(this,i);break;case"/meta/subscribe":i.subscription=s.subscription,jn(ds,this,yi).call(this,i);break;case"/meta/unsubscribe":i.subscription=s.subscription,jn(ds,this,wi).call(this,i);break;default:jn(ds,this,Si).call(this,i)}}}function ki(t){const e=Cn(Yn,this)[t];if(e)for(let t in e)if(e.hasOwnProperty(t)&&e[t])return!0;return!1}function _i(t,e){const n={scope:t,method:e};if(vs.call(hn,t))n.scope=void 0,n.method=t;else if(ys.call(hn,e)){if(!t)throw new Error("Invalid scope "+t);if(n.method=t[e],!vs.call(hn,n.method))throw new Error("Invalid callback "+e+" for scope "+t)}else if(!vs.call(hn,e))throw new Error("Invalid callback "+e);return n}function Ai(t,e,n,s){var i;const o=jn(ds,this,_i).call(this,e,n);this._debug("Adding",s?"listener":"subscription","on",t,"with scope",o.scope,"and callback",o.method);const r=In(Jn,this,(i=Cn(Jn,this),++i)),a={id:r,channel:t,scope:o.scope,callback:o.method,listener:s};let c=Cn(Yn,this)[t];return c||(c={},Cn(Yn,this)[t]=c),c[r]=a,this._debug("Added",s?"listener":"subscription",a),a}function Ni(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function $i(t,e,n){return t.set(Ri(t,e),n),n}function Ri(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}hn=ps;var Pi=new WeakMap;class Oi{constructor(){Ni(this,Pi,void 0)}registered(t,e){$i(Pi,this,e)}unregistered(){$i(Pi,this,null)}get cometd(){return e=this,(t=Pi).get(Ri(t,e));var t,e}incoming(t){return t}outgoing(t){return t}}function Ci(t,e,n){Ii(t,e),e.set(t,n)}function Ii(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ji(t,e){return t.get(Mi(t,e))}function Li(t,e,n){return t.set(Mi(t,e),n),n}function Mi(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Ui=new WeakMap,Di=new WeakMap,Bi=new WeakSet;function Ki(t,e){this.cometd._debug(t,e)}function Wi(t,e,n){zi(t,e),e.set(t,n)}function zi(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Fi(t,e,n){return t.set(qi(t,e),n),n}function Hi(t,e){return t.get(qi(t,e))}function qi(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Gi=new WeakMap,Vi=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,Xi=new WeakSet;function Zi(t){if(Hi(Gi,this).handshakeResponse){Fi(Yi,this,!0);const e=this.cometd.getTransport();e&&e.abort(),this.configure(t);const n=JSON.stringify(Hi(Gi,this));this.cometd._debug("Reload extension saving state",n),window.sessionStorage.setItem(Hi(Vi,this),n)}}function Qi(t){return Hi(Gi,this).url===t.url}function to(t){!0!==t.successful&&Fi(Gi,this,{})}var eo=Object.freeze({__proto__:null,AckExtension:class extends Oi{constructor(...t){var e,n;super(...t),Ii(e=this,n=Bi),n.add(e),Ci(this,Ui,!1),Ci(this,Di,0)}registered(t,e){super.registered(t,e),Mi(Bi,this,Ki).call(this,"AckExtension: executing registration callback")}unregistered(){Mi(Bi,this,Ki).call(this,"AckExtension: executing unregistration callback"),super.unregistered()}incoming(t){const e=t.channel,n=t.ext;if("/meta/handshake"===e){if(n){const t=n.ack;if("object"==typeof t){Li(Ui,this,!0===t.enabled);const e=t.batch;"number"==typeof e&&Li(Di,this,e)}else Li(Ui,this,!0===t)}Mi(Bi,this,Ki).call(this,"AckExtension: server supports acknowledgements",ji(Ui,this))}else"/meta/connect"===e&&t.successful&&ji(Ui,this)&&n&&"number"==typeof n.ack&&(Li(Di,this,n.ack),Mi(Bi,this,Ki).call(this,"AckExtension: server sent batch",ji(Di,this)));return t}outgoing(t){const e=t.channel;return t.ext||(t.ext={}),"/meta/handshake"===e?(t.ext.ack=this.cometd&&!1!==this.cometd.ackEnabled,Li(Ui,this,!1),Li(Di,this,0)):"/meta/connect"===e&&ji(Ui,this)&&(t.ext.ack=ji(Di,this),Mi(Bi,this,Ki).call(this,"AckExtension: client sending batch",ji(Di,this))),t}},CallbackPollingTransport:Ve,CometD:ps,Extension:Oi,LongPollingTransport:tn,ReloadExtension:class extends Oi{constructor(t){var e,n;super(),zi(e=this,n=Xi),n.add(e),Wi(this,Gi,{}),Wi(this,Vi,"org.cometd.reload"),Wi(this,Ji,!1),Wi(this,Yi,!1),this.configure(t)}configure(t){t&&"string"==typeof t.name&&Fi(Vi,this,t.name)}_receive(t){this.cometd.receive(t)}registered(t,e){super.registered(t,e),this.cometd.reload=t=>qi(Xi,this,Zi).call(this,t),this.cometd.addListener("/meta/handshake",t=>qi(Xi,this,to).call(this,t))}unregistered(){delete this.cometd.reload,super.unregistered()}outgoing(t){switch(t.channel){case"/meta/handshake":{Fi(Gi,this,{url:this.cometd.getURL()});const e=window.sessionStorage.getItem(Hi(Vi,this));if(this.cometd._debug("Reload extension found state",e),e)try{const n=JSON.parse(e);if(window.sessionStorage.removeItem(Hi(Vi,this)),n.handshakeResponse&&qi(Xi,this,Qi).call(this,n)){this.cometd._debug("Reload extension restoring state",n);const e=this.cometd._getCallback(t.id);return this.cometd.setTimeout(()=>{this.cometd._debug("Reload extension replaying handshake response",n.handshakeResponse),Hi(Gi,this).handshakeResponse=n.handshakeResponse,Hi(Gi,this).transportType=n.transportType,this.cometd._putCallback(t.id,e);const s=this.cometd._mixin(!0,{},Hi(Gi,this).handshakeResponse,{id:t.id,ext:{reload:!0}});s.supportedConnectionTypes=[Hi(Gi,this).transportType],this._receive(s),this.cometd._debug("Reload extension replayed handshake response",s)},0),Hi(Ji,this)||(Fi(Ji,this,!0),this.cometd.startBatch()),null}this.cometd._debug("Reload extension could not restore state",n)}catch(t){this.cometd._debug("Reload extension error while trying to restore state",t)}break}case"/meta/connect":if(!0===Hi(Yi,this))return this.cometd._debug("Reload extension aborting /meta/connect during reload"),null;Hi(Gi,this).transportType||(Hi(Gi,this).transportType=t.connectionType,this.cometd._debug("Reload extension tracked transport type",Hi(Gi,this).transportType));break;case"/meta/disconnect":Fi(Gi,this,{})}return t}incoming(t){switch(t.channel){case"/meta/handshake":t.successful&&(Hi(Gi,this).handshakeResponse||(Hi(Gi,this).handshakeResponse=t,this.cometd._debug("Reload extension tracked handshake response",t)));break;case"/meta/connect":Hi(Ji,this)&&(Fi(Ji,this,!1),this.cometd.endBatch());break;case"/meta/disconnect":Hi(Ji,this)&&(Fi(Ji,this,!1),this.cometd.endBatch()),Fi(Gi,this,{})}return t}},RequestTransport:Me,Transport:_e,WebSocketTransport:wn});t.Channel=class{constructor(t){a(this,"path",void 0),a(this,"update",void 0),a(this,"subscription",null);const{scopeBoundary:e,scopeKey:n,pushCategory:s}=t;(t=>{if(!t)throw new d("No scope found where one was required");const{scopeBoundary:e,scopeKey:n,pushCategory:s}=t;if(!e)throw new d("Missing scope component: scopeBoundary");if(!n)throw new d("Missing scope component: scopeKey");if(!s)throw new d("Missing scope component: pushCategory");if(!Object.prototype.hasOwnProperty.call(_,e))throw new d(`Invalid scope boundary: ${e}`);if(!Object.prototype.hasOwnProperty.call(N,s))throw new d(`Invalid push category: ${s}`)})(t),this.path=`/${e.toLowerCase()}/${n}/${s.toLowerCase()}`,ct.subscriptions.has(this.path)&&(this.subscription=ct.subscriptions.get(this.path)||null)}publish(t){return ct.publish(this,t)}async subscribe(t,e={}){if(this.subscription)try{await ct.remove(this.subscription)}catch(t){var n;const e=t,s=(null==e?void 0:e.message)||(null==e||null===(n=e.information)||void 0===n?void 0:n.error)||"";if(!s.includes("session_unknown")&&!s.includes("402"))throw t}this.update=t;let s=0;for(;s<3;)try{return this.subscription=await ct.add(this,t,e),this.subscription}catch(t){var i;const e=t,n=(null==e?void 0:e.message)||(null==e||null===(i=e.information)||void 0===i?void 0:i.error)||"";if((n.includes("session_unknown")||n.includes("402"))&&s<2){s++,ct.handshakeState="idle",ct.handshakePromise=void 0;const t=1e3,e=s;await new Promise(n=>setTimeout(n,t*e));continue}throw t}throw new Error(`Failed to subscribe to ${this.path} after 3 attempts`)}async unsubscribe(){this.subscription&&(await ct.remove(this.subscription),this.subscription=null)}async unsubscribeAll(){await ct.empty()}},t.DEFAULT_ERROR_HANDLERS=le,t.Fault=p,t.PUSH_CATEGORY=N,t.RITUAL=A,t.ROLE=$,t.Router=z,t.SCOPE_BOUNDARY=_,t.accountAdapter=F,t.adminAdapter=H,t.assetAdapter=ft,t.authAdapter=lt,t.chatAdapter=ne,t.cometdAdapter=ct,t.config=R,t.consensusAdapter=se,t.dailyAdapter=ce,t.emailAdapter=yt,t.episodeAdapter=mt,t.errorManager=L,t.groupAdapter=wt,t.leaderboardAdapter=vt,t.matchmakerAdapter=oe,t.presenceAdapter=St,t.projectAdapter=J,t.recaptchaAdapter=Tt,t.runAdapter=At,t.somebodyAdapter=ie,t.taskAdapter=ee,t.timeAdapter=Qt,t.userAdapter=Nt,t.utils=ue,t.vaultAdapter=Rt,t.version="Epicenter (v3.34.2) for Browsers | Build Date: 2026-04-01T19:37:03.682Z",t.videoAPI=Bt,t.videoAdapter=zt,t.vonageAPI=Jt,t.vonageAdapter=Yt,t.walletAdapter=he,t.worldAdapter=Zt});
|
|
2
2
|
//# sourceMappingURL=epicenter.min.js.map
|