@formant/data-sdk 1.0.0 → 1.1.0-rc.0

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/README.md CHANGED
@@ -24,9 +24,22 @@ Distributed under the MIT License. See LICENSE.txt for more information.
24
24
 
25
25
  ## Deploying a new version
26
26
 
27
- ```
28
- <bump version in package.json>
29
- make
30
- git commit everything
27
+ ```bash
28
+ # use npm to bump the version number
29
+ npm version X.Y.Z
30
+
31
+ # add all the changed files from the preversion/postversion tasks
32
+ git add .
33
+
34
+ # commit all the changes with a uniform commit message
35
+ git commit -m data-sdk@$(node -p "require('./package.json').version")
36
+
37
+ # add a unified annotated tag for this version
38
+ git tag -a release/data-sdk/$(node -p "require('./package.json').version") -m data-sdk@$(node -p "require('./package.json').version")
39
+
40
+ # publish this version to npm; use "--tag=next" for future releases
31
41
  npm publish
42
+
43
+ # push everything to remote vcs with the tags
44
+ git push --follow-tags
32
45
  ```
@@ -905,17 +905,33 @@ function defined(e, t) {
905
905
  return e;
906
906
  throw new Error(t || "Value is undefined");
907
907
  }
908
- let FORMANT_API_URL = "https://api.formant.io";
909
- typeof window < "u" && (FORMANT_API_URL = window.FORMANT_API_URL || FORMANT_API_URL);
910
- let urlParams$1 = new URLSearchParams("");
911
- typeof window < "u" && (urlParams$1 = new URLSearchParams(window.location.search));
912
- const envDev = urlParams$1.get("formant_dev");
913
- envDev && (FORMANT_API_URL = "https://api-dev.formant.io");
914
- const envStage = urlParams$1.get("formant_stage");
915
- envStage && (FORMANT_API_URL = "https://api-stage.formant.io");
916
- const envLocal = urlParams$1.get("formant_local");
917
- envLocal && (FORMANT_API_URL = "https://api.formant.local");
918
- const millisecond = 1, second = 1e3, minute = 60 * second, hour = 60 * minute, day = 24 * hour, week = 7 * day, month = 30 * day, year = 365 * day, duration = {
908
+ const DEFAULT_FORMANT_API_URL = "https://api.formant.io";
909
+ function whichFormantApiUrl(e, t) {
910
+ if (t.get("formant_stage"))
911
+ return "https://api-stage.formant.io";
912
+ if (t.get("formant_dev"))
913
+ return "https://api-dev.formant.io";
914
+ if (t.get("formant_local"))
915
+ return "https://api.formant.local";
916
+ if (t.get("formant_url")) {
917
+ const n = t.get("formant_url");
918
+ if (n !== null)
919
+ try {
920
+ return new URL(n).origin;
921
+ } catch {
922
+ console.warn(
923
+ `Ignoring malformed \`formant_url\` url parameter: ${n}`
924
+ );
925
+ }
926
+ }
927
+ return typeof e < "u" && "FORMANT_API_URL" in e && typeof e.FORMANT_API_URL == "string" ? e.FORMANT_API_URL : DEFAULT_FORMANT_API_URL;
928
+ }
929
+ const FORMANT_API_URL = whichFormantApiUrl(
930
+ window,
931
+ new URLSearchParams(
932
+ typeof window < "u" ? window.location.search : void 0
933
+ )
934
+ ), millisecond = 1, second = 1e3, minute = 60 * second, hour = 60 * minute, day = 24 * hour, week = 7 * day, month = 30 * day, year = 365 * day, duration = {
919
935
  millisecond,
920
936
  second,
921
937
  minute,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
5
5
  * @license MIT
6
- */var INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==void 0?global$1.TYPED_ARRAY_SUPPORT:!0,kMaxLength();function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(e,t){if(kMaxLength()<t)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=Buffer.prototype):(e===null&&(e=new Buffer(t)),e.length=t),e}function Buffer(e,t,n){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer))return new Buffer(e,t,n);if(typeof e=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,e)}return from(this,e,t,n)}Buffer.poolSize=8192,Buffer._augment=function(e){return e.__proto__=Buffer.prototype,e};function from(e,t,n,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,n,r):typeof t=="string"?fromString(e,t,n):fromObject(e,t)}Buffer.from=function(e,t,n){return from(null,e,t,n)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array);function assertSize(e){if(typeof e!="number")throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function alloc(e,t,n,r){return assertSize(t),t<=0?createBuffer(e,t):n!==void 0?typeof r=="string"?createBuffer(e,t).fill(n,r):createBuffer(e,t).fill(n):createBuffer(e,t)}Buffer.alloc=function(e,t,n){return alloc(null,e,t,n)};function allocUnsafe(e,t){if(assertSize(t),e=createBuffer(e,t<0?0:checked(t)|0),!Buffer.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}Buffer.allocUnsafe=function(e){return allocUnsafe(null,e)},Buffer.allocUnsafeSlow=function(e){return allocUnsafe(null,e)};function fromString(e,t,n){if((typeof n!="string"||n==="")&&(n="utf8"),!Buffer.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=byteLength(t,n)|0;e=createBuffer(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function fromArrayLike(e,t){var n=t.length<0?0:checked(t.length)|0;e=createBuffer(e,n);for(var r=0;r<n;r+=1)e[r]=t[r]&255;return e}function fromArrayBuffer(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return n===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,n):t=new Uint8Array(t,n,r),Buffer.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=Buffer.prototype):e=fromArrayLike(e,t),e}function fromObject(e,t){if(internalIsBuffer(t)){var n=checked(t.length)|0;return e=createBuffer(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<"u"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if(t.type==="Buffer"&&isArray$1(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(e){if(e>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return e|0}Buffer.isBuffer=isBuffer;function internalIsBuffer(e){return!!(e!=null&&e._isBuffer)}Buffer.compare=function(t,n){if(!internalIsBuffer(t)||!internalIsBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,s=0,l=Math.min(r,i);s<l;++s)if(t[s]!==n[s]){r=t[s],i=n[s];break}return r<i?-1:i<r?1:0},Buffer.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(t,n){if(!isArray$1(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return Buffer.alloc(0);var r;if(n===void 0)for(n=0,r=0;r<t.length;++r)n+=t[r].length;var i=Buffer.allocUnsafe(n),s=0;for(r=0;r<t.length;++r){var l=t[r];if(!internalIsBuffer(l))throw new TypeError('"list" argument must be an Array of Buffers');l.copy(i,s),s+=l.length}return i};function byteLength(e,t){if(internalIsBuffer(e))return e.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return base64ToBytes(e).length;default:if(r)return utf8ToBytes(e).length;t=(""+t).toLowerCase(),r=!0}}Buffer.byteLength=byteLength;function slowToString(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,n);case"utf8":case"utf-8":return utf8Slice(this,t,n);case"ascii":return asciiSlice(this,t,n);case"latin1":case"binary":return latin1Slice(this,t,n);case"base64":return base64Slice(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}Buffer.prototype._isBuffer=!0;function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}Buffer.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<t;n+=2)swap(this,n,n+1);return this},Buffer.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<t;n+=4)swap(this,n,n+3),swap(this,n+1,n+2);return this},Buffer.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<t;n+=8)swap(this,n,n+7),swap(this,n+1,n+6),swap(this,n+2,n+5),swap(this,n+3,n+4);return this},Buffer.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(t){if(!internalIsBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:Buffer.compare(this,t)===0},Buffer.prototype.inspect=function(){var t="",n=INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function(t,n,r,i,s){if(!internalIsBuffer(t))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),n<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&n>=r)return 0;if(i>=s)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var l=s-i,o=r-n,c=Math.min(l,o),u=this.slice(i,s),f=t.slice(n,r),E=0;E<c;++E)if(u[E]!==f[E]){l=u[E],o=f[E];break}return l<o?-1:o<l?1:0};function bidirectionalIndexOf(e,t,n,r,i){if(e.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t=="string"&&(t=Buffer.from(t,r)),internalIsBuffer(t))return t.length===0?-1:arrayIndexOf(e,t,n,r,i);if(typeof t=="number")return t=t&255,Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):arrayIndexOf(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,n,r,i){var s=1,l=e.length,o=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(e.length<2||t.length<2)return-1;s=2,l/=2,o/=2,n/=2}function c(h,g){return s===1?h[g]:h.readUInt16BE(g*s)}var u;if(i){var f=-1;for(u=n;u<l;u++)if(c(e,u)===c(t,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===o)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(n+o>l&&(n=l-o),u=n;u>=0;u--){for(var E=!0,b=0;b<o;b++)if(c(e,u+b)!==c(t,b)){E=!1;break}if(E)return u}return-1}Buffer.prototype.includes=function(t,n,r){return this.indexOf(t,n,r)!==-1},Buffer.prototype.indexOf=function(t,n,r){return bidirectionalIndexOf(this,t,n,r,!0)},Buffer.prototype.lastIndexOf=function(t,n,r){return bidirectionalIndexOf(this,t,n,r,!1)};function hexWrite(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var l=0;l<r;++l){var o=parseInt(t.substr(l*2,2),16);if(isNaN(o))return l;e[n+l]=o}return l}function utf8Write(e,t,n,r){return blitBuffer(utf8ToBytes(t,e.length-n),e,n,r)}function asciiWrite(e,t,n,r){return blitBuffer(asciiToBytes(t),e,n,r)}function latin1Write(e,t,n,r){return asciiWrite(e,t,n,r)}function base64Write(e,t,n,r){return blitBuffer(base64ToBytes(t),e,n,r)}function ucs2Write(e,t,n,r){return blitBuffer(utf16leToBytes(t,e.length-n),e,n,r)}Buffer.prototype.write=function(t,n,r,i){if(n===void 0)i="utf8",r=this.length,n=0;else if(r===void 0&&typeof n=="string")i=n,r=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-n;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var l=!1;;)switch(i){case"hex":return hexWrite(this,t,n,r);case"utf8":case"utf-8":return utf8Write(this,t,n,r);case"ascii":return asciiWrite(this,t,n,r);case"latin1":case"binary":return latin1Write(this,t,n,r);case"base64":return base64Write(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,n,r);default:if(l)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),l=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(e,t,n){return t===0&&n===e.length?fromByteArray(e):fromByteArray(e.slice(t,n))}function utf8Slice(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s=e[i],l=null,o=s>239?4:s>223?3:s>191?2:1;if(i+o<=n){var c,u,f,E;switch(o){case 1:s<128&&(l=s);break;case 2:c=e[i+1],(c&192)===128&&(E=(s&31)<<6|c&63,E>127&&(l=E));break;case 3:c=e[i+1],u=e[i+2],(c&192)===128&&(u&192)===128&&(E=(s&15)<<12|(c&63)<<6|u&63,E>2047&&(E<55296||E>57343)&&(l=E));break;case 4:c=e[i+1],u=e[i+2],f=e[i+3],(c&192)===128&&(u&192)===128&&(f&192)===128&&(E=(s&15)<<18|(c&63)<<12|(u&63)<<6|f&63,E>65535&&E<1114112&&(l=E))}}l===null?(l=65533,o=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l),i+=o}return decodeCodePointsArray(r)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=MAX_ARGUMENTS_LENGTH));return n}function asciiSlice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function latin1Slice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function hexSlice(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=toHex(e[s]);return i}function utf16leSlice(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}Buffer.prototype.slice=function(t,n){var r=this.length;t=~~t,n=n===void 0?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n<t&&(n=t);var i;if(Buffer.TYPED_ARRAY_SUPPORT)i=this.subarray(t,n),i.__proto__=Buffer.prototype;else{var s=n-t;i=new Buffer(s,void 0);for(var l=0;l<s;++l)i[l]=this[l+t]}return i};function checkOffset(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=this[t],s=1,l=0;++l<n&&(s*=256);)i+=this[t+l]*s;return i},Buffer.prototype.readUIntBE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=this[t+--n],s=1;n>0&&(s*=256);)i+=this[t+--n]*s;return i},Buffer.prototype.readUInt8=function(t,n){return n||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,n){return n||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,n){return n||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,n){return n||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},Buffer.prototype.readUInt32BE=function(t,n){return n||checkOffset(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=this[t],s=1,l=0;++l<n&&(s*=256);)i+=this[t+l]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*n)),i},Buffer.prototype.readIntBE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=n,s=1,l=this[t+--i];i>0&&(s*=256);)l+=this[t+--i]*s;return s*=128,l>=s&&(l-=Math.pow(2,8*n)),l},Buffer.prototype.readInt8=function(t,n){return n||checkOffset(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},Buffer.prototype.readInt16LE=function(t,n){n||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r},Buffer.prototype.readInt16BE=function(t,n){n||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r},Buffer.prototype.readInt32LE=function(t,n){return n||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,n){return n||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,n){return n||checkOffset(t,4,this.length),read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,n){return n||checkOffset(t,4,this.length),read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,n){return n||checkOffset(t,8,this.length),read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,n){return n||checkOffset(t,8,this.length),read(this,t,!1,52,8)};function checkInt(e,t,n,r,i,s){if(!internalIsBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function(t,n,r,i){if(t=+t,n=n|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;checkInt(this,t,n,r,s,0)}var l=1,o=0;for(this[n]=t&255;++o<r&&(l*=256);)this[n+o]=t/l&255;return n+r},Buffer.prototype.writeUIntBE=function(t,n,r,i){if(t=+t,n=n|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;checkInt(this,t,n,r,s,0)}var l=r-1,o=1;for(this[n+l]=t&255;--l>=0&&(o*=256);)this[n+l]=t/o&255;return n+r},Buffer.prototype.writeUInt8=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=t&255,n+1};function objectWriteUInt16(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i<s;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}Buffer.prototype.writeUInt16LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):objectWriteUInt16(this,t,n,!0),n+2},Buffer.prototype.writeUInt16BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):objectWriteUInt16(this,t,n,!1),n+2};function objectWriteUInt32(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i<s;++i)e[n+i]=t>>>(r?i:3-i)*8&255}Buffer.prototype.writeUInt32LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255):objectWriteUInt32(this,t,n,!0),n+4},Buffer.prototype.writeUInt32BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):objectWriteUInt32(this,t,n,!1),n+4},Buffer.prototype.writeIntLE=function(t,n,r,i){if(t=+t,n=n|0,!i){var s=Math.pow(2,8*r-1);checkInt(this,t,n,r,s-1,-s)}var l=0,o=1,c=0;for(this[n]=t&255;++l<r&&(o*=256);)t<0&&c===0&&this[n+l-1]!==0&&(c=1),this[n+l]=(t/o>>0)-c&255;return n+r},Buffer.prototype.writeIntBE=function(t,n,r,i){if(t=+t,n=n|0,!i){var s=Math.pow(2,8*r-1);checkInt(this,t,n,r,s-1,-s)}var l=r-1,o=1,c=0;for(this[n+l]=t&255;--l>=0&&(o*=256);)t<0&&c===0&&this[n+l+1]!==0&&(c=1),this[n+l]=(t/o>>0)-c&255;return n+r},Buffer.prototype.writeInt8=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=t&255,n+1},Buffer.prototype.writeInt16LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):objectWriteUInt16(this,t,n,!0),n+2},Buffer.prototype.writeInt16BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):objectWriteUInt16(this,t,n,!1),n+2},Buffer.prototype.writeInt32LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):objectWriteUInt32(this,t,n,!0),n+4},Buffer.prototype.writeInt32BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):objectWriteUInt32(this,t,n,!1),n+4};function checkIEEE754(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function writeFloat(e,t,n,r,i){return i||checkIEEE754(e,t,n,4),write(e,t,n,r,23,4),n+4}Buffer.prototype.writeFloatLE=function(t,n,r){return writeFloat(this,t,n,!0,r)},Buffer.prototype.writeFloatBE=function(t,n,r){return writeFloat(this,t,n,!1,r)};function writeDouble(e,t,n,r,i){return i||checkIEEE754(e,t,n,8),write(e,t,n,r,52,8),n+8}Buffer.prototype.writeDoubleLE=function(t,n,r){return writeDouble(this,t,n,!0,r)},Buffer.prototype.writeDoubleBE=function(t,n,r){return writeDouble(this,t,n,!1,r)},Buffer.prototype.copy=function(t,n,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n<i-r&&(i=t.length-n+r);var s=i-r,l;if(this===t&&r<n&&n<i)for(l=s-1;l>=0;--l)t[l+n]=this[l+r];else if(s<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(l=0;l<s;++l)t[l+n]=this[l+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),n);return s},Buffer.prototype.fill=function(t,n,r,i){if(typeof t=="string"){if(typeof n=="string"?(i=n,n=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!Buffer.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;n=n>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var l;if(typeof t=="number")for(l=n;l<r;++l)this[l]=t;else{var o=internalIsBuffer(t)?t:utf8ToBytes(new Buffer(t,i).toString()),c=o.length;for(l=0;l<r-n;++l)this[l+n]=o[l%c]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(e){if(e=stringtrim(e).replace(INVALID_BASE64_RE,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function stringtrim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function toHex(e){return e<16?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],l=0;l<r;++l){if(n=e.charCodeAt(l),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(l+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return s}function asciiToBytes(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function utf16leToBytes(e,t){for(var n,r,i,s=[],l=0;l<e.length&&!((t-=2)<0);++l)n=e.charCodeAt(l),r=n>>8,i=n%256,s.push(i),s.push(r);return s}function base64ToBytes(e){return toByteArray(base64clean(e))}function blitBuffer(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function isnan(e){return e!==e}function isBuffer(e){return e!=null&&(!!e._isBuffer||isFastBuffer(e)||isSlowBuffer(e))}function isFastBuffer(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&isFastBuffer(e.slice(0,0))}function defined(e,t){if(e!==void 0)return e;throw new Error(t||"Value is undefined")}let FORMANT_API_URL="https://api.formant.io";typeof window<"u"&&(FORMANT_API_URL=window.FORMANT_API_URL||FORMANT_API_URL);let urlParams$1=new URLSearchParams("");typeof window<"u"&&(urlParams$1=new URLSearchParams(window.location.search));const envDev=urlParams$1.get("formant_dev");envDev&&(FORMANT_API_URL="https://api-dev.formant.io");const envStage=urlParams$1.get("formant_stage");envStage&&(FORMANT_API_URL="https://api-stage.formant.io");const envLocal=urlParams$1.get("formant_local");envLocal&&(FORMANT_API_URL="https://api.formant.local");const millisecond=1,second=1e3,minute=60*second,hour=60*minute,day=24*hour,week=7*day,month=30*day,year=365*day,duration={millisecond,second,minute,hour,day,week,month,year};function filterDataByType(e,t){return e.filter(n=>t.includes(n.type))}function filterDataByTime(e,t,n){const r=t.getTime(),i=n.getTime();return e.map(s=>({...s,points:s.points.filter(([l])=>l>=r&&l<i)})).filter(({points:s})=>s.length>0)}function fork(e){}class StoreCache{constructor({capacity:t,timeout:n}={}){Te(this,"entries",new Map);Te(this,"metadata",new Map);Te(this,"capacity");Te(this,"timeout");this.capacity=t||1e4,this.timeout=n||duration.minute}get(t,n){const r=this.keyToCacheKey(t),i=this.entries.get(r),s=this.metadata.get(r);return(i===void 0||s&&(s==null?void 0:s.expiration.getTime())<Date.now())&&!(s!=null&&s.generating)&&n&&this.generate(t,n()),i===void 0&&s&&s.lastValue!==void 0?s.lastValue:i}set(t,n){const r=this.keyToCacheKey(t);this.metadata.set(r,{generating:!1,expiration:new Date(Date.now()+this.timeout),lastValue:n}),this.entries.set(r,n),this.metadata.size>this.capacity&&this.deleteOldestEntry()}clear(){this.entries.clear(),[...this.metadata.values()].forEach(t=>t.generating=!1)}clearKey(t){this.metadata.delete(t),this.entries.delete(t)}keyToCacheKey(t){return JSON.stringify(t)}deleteOldestEntry(){if(this.metadata.size<1)return;const[t]=[...this.metadata.entries()].reduce(([n,r],[i,s])=>s.expiration.getTime()<r.expiration.getTime()?[i,s]:[n,r]);this.clearKey(t)}generate(t,n){const r=this.keyToCacheKey(t),i=this.metadata.get(r)||{};this.metadata.set(r,{...i,generating:!0,expiration:new Date(Date.now()+this.timeout)}),setTimeout(()=>{n.then(s=>{const l=this.metadata.get(r);!(l!=null&&l.generating)||this.set(t,s)})},0)}}class QueryStore{constructor(){Te(this,"queryStoreCache",new StoreCache({capacity:1e4,timeout:20*duration.second}));Te(this,"liveQueryStoreCache",new StoreCache({capacity:1e4,timeout:200*duration.millisecond}))}moduleQuery(t,n,r,i,s,l=!1){const o={...t,names:[...n],types:[...r]},c=this.query(o,i,s,l);return c===void 0||c==="too much data"?c:filterDataByType(c,r)}query(t,n,r,i=!1){const s={...t,start:dateFns.startOfMinute(n).toISOString(),end:i?r.toISOString():dateFns.addMinutes(dateFns.roundToNearestMinutes(r),1).toISOString(),latestOnly:i},l=r>dateFns.addSeconds(new Date,-20);let o;return l?o=this.liveQueryCache(s):o=this.queryCache(s),!o||o==="too much data"||i?o:filterDataByTime(o,n,r)}queryCache(t){return this.queryStoreCache.get(t,async()=>{try{return await Fleet.queryTelemetry(t)}catch(n){throw n}})}liveQueryCache(t){return this.liveQueryStoreCache.get(t,async()=>{try{return await Fleet.queryTelemetry(t)}catch(n){throw n}})}}const queryStore=new QueryStore,Ke=class{static sendAppMessage(t){window.parent.postMessage(t,"*")}static getCurrentModuleContext(){let t=new URLSearchParams("");return typeof window<"u"&&(t=new URLSearchParams(window.location.search)),t.get("module")}static async getCurrentModuleConfiguration(){let t=new URLSearchParams("");typeof window<"u"&&(t=new URLSearchParams(window.location.search));const n=t.get("configuration");return n===null||n.trim()===""?void 0:(await(await fetch(`${FORMANT_API_URL}/v1/admin/module-configurations/`+n,{headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).configuration}static isModule(){return this.getCurrentModuleContext()!==null}static goToTime(t){this.sendAppMessage({type:"go_to_time",time:t.getTime()})}static goToDevice(t){this.sendAppMessage({type:"go_to_device",deviceId:t})}static showMessage(t){this.sendAppMessage({type:"show_message",message:t})}static requestModuleData(){const t=this.getCurrentModuleContext();if(!t)throw new Error("No module context");this.sendAppMessage({type:"request_module_data",module:t})}static setModuleDateTimeRange(t,n){const r=this.getCurrentModuleContext();if(!r)throw new Error("No module context");this.sendAppMessage({type:"set_module_data_time_range",module:r,before:t,after:n||0})}static refreshAuthToken(){const t=this.getCurrentModuleContext();if(!t)throw new Error("No module context");this.sendAppMessage({type:"refresh_auth_token",module:t})}static sendChannelData(t,n){const r=this.getCurrentModuleContext();if(!r)throw new Error("No module context");this.sendAppMessage({type:"send_channel_data",source:r,channel:t,data:n})}static setupModuleMenus(t){const n=this.getCurrentModuleContext();if(!n)throw new Error("No module context");this.sendAppMessage({type:"setup_module_menus",module:n,menus:t})}static addMenuListener(t){window.addEventListener("message",n=>{const r=n.data;r.type==="module_menu_item_clicked"&&t(r.menu)})}static addAccessTokenRefreshListener(t){window.addEventListener("message",n=>{const r=n.data;r.type==="auth_token"&&t(r.token)})}static addModuleDataListener(t){const n=this.getCurrentModuleContext();n&&this.sendAppMessage({type:"request_module_data",module:n}),window.addEventListener("message",r=>{const i=r.data;i.type==="module_data"&&t({streams:i.streams,time:i.time,queryRange:i.queryRange})})}static addOverviewDeviceListener(t){this.sendAppMessage({type:"request_devices"});const n=r=>{const i=r.data;i.type==="overview_devices"&&t(i.data)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}static addStreamListener(t,n,r){const i=s=>{const l=s.data;if(l.type==="module_data"){const{start:o,end:c}=l.queryRange;r(queryStore.moduleQuery({},t,n,new Date(o),new Date(c),!1))}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)}static addModuleConfigurationListener(t){window.addEventListener("message",n=>{const r=n.data;r.type==="module_configuration"&&t(r)})}static addChannelDataListener(t,n){window.addEventListener("message",r=>{const i=r.data;i.type==="channel_data"&&i.channel===t&&n({source:i.source,data:i.data})})}static async prompt(t,n){return new Promise(r=>{const i=Math.random().toString();this.sendAppMessage({type:"prompt",promptId:i,schema:t,okText:n==null?void 0:n.okText,cancelText:n==null?void 0:n.cancelText});const s=l=>{const o=l.data;o.type==="prompt_response"&&o.promptId===i&&r(o.data),window.removeEventListener("message",s)};window.addEventListener("message",s)})}static async getDate(t,n,r){return new Promise(i=>{this.sendAppMessage({type:"request_date",minTime:n,maxTime:r,time:t});const s=l=>{const o=l.data;o.type==="date_response"&&(window.removeEventListener("message",s),i(o.data))};window.addEventListener("message",s)})}static async disableAnalyticsBottomBar(){this.sendAppMessage({type:"hide_analytics_date_picker"})}static get isOnline(){return Ke._isOnline}static listenForConnectionEvents(){window.addEventListener("message",this._handleOnlineEvent)}static checkConnection(t=1e3){return new Promise((n,r)=>{const i=setTimeout(()=>r(new Error("deadline expired: took too long")),t),s=l=>{window.removeEventListener("message",s),clearTimeout(i);const{data:o}=l;o.type==="formant_online"&&(this._isOnline=o.online,n(o.online))};window.addEventListener("message",s),this.sendAppMessage({type:"formant_online"})})}static waitForConnection(t=5e3){let n=!1;const r=new Promise((l,o)=>{setTimeout(()=>{n=!0,o(new Error("deadline expired: took too long"))},t)}),i=l=>new Promise(o=>setTimeout(o,l)),s=async()=>{for(await i(50);!n&&!(this.isOnline||await this.checkConnection);)await i(500)};return Promise.race([r,s()])}};let App=Ke;Te(App,"_isOnline",null),Te(App,"_handleOnlineEvent",t=>{const{data:n}=t;n.type==="formant_online"&&(Ke._isOnline=n.online)});class AuthenticationStore{constructor({apiUrl:t,refreshAuthToken:n,addAccessTokenRefreshListener:r}){Te(this,"_refreshToken");Te(this,"_isShareToken",!1);Te(this,"_currentOrganization");Te(this,"_currentUser");Te(this,"_defaultDeviceId");Te(this,"_token");Te(this,"_waitingForAuth",new Set);Te(this,"_refreshTimer");Te(this,"_apiUrl");Te(this,"_refreshAuthToken");Te(this,"_addAccessTokenRefreshListener");this._apiUrl=t,this._refreshAuthToken=n,this._addAccessTokenRefreshListener=r}get token(){return this._token}get currentUser(){return this._currentUser}get currentOrganization(){return this._currentOrganization}get defaultDeviceId(){return this._defaultDeviceId}get refreshToken(){return this._refreshToken}get isShareToken(){return this._isShareToken}async login(t,n){try{const r=await fetch(`${this._apiUrl}/v1/admin/auth/login`,{method:"POST",body:JSON.stringify({email:t,password:n}),headers:{"Content-Type":"application/json"}}),i=await r.json();if(r.status!==200)throw new Error(i.message);return await this.loginWithToken(i.authentication.accessToken,i.authentication.refreshToken),i.authentication}catch(r){return console.error("login() failed",{err:r}),this._waitingForAuth.forEach(i=>i(!1)),this._waitingForAuth.clear(),Promise.reject(r)}}async loginWithToken(t,n){var i;const r=JSON.parse(atob(t.split(".")[1]));try{let s;if(this._isShareToken=r["formant:claims"]&&r["formant:claims"].type=="share",r["formant:claims"]&&(this._currentOrganization=r["formant:claims"].organizationId),r["custom:organization_id"]&&(this._currentOrganization=r["custom:organization_id"]),this._isShareToken||(s=r.sub),r["formant:claims"]&&r["formant:claims"].userId&&(s=r["formant:claims"].userId),s&&((i=this._currentUser)==null?void 0:i.id)!==s){const l=await fetch(`${this._apiUrl}/v1/admin/users/${s}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+t}}),o=await l.json();if(l.status!==200)throw new Error(o.message);this._currentUser=o}this._token=t,this._waitingForAuth.forEach(l=>l(!0))}catch(s){console.error("loginWithToken() failed",{err:s}),this._waitingForAuth.forEach(l=>l(!1))}finally{this._waitingForAuth.clear()}n&&(this._refreshToken=n,setInterval(async()=>{if(this._refreshToken){const l=await(await fetch(`${this._apiUrl}/v1/admin/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this._refreshToken})})).json();this._token=l.authentication.accessToken}},1e3*60*60))}isAuthenticated(){return this._token!==void 0}getCurrentUser(){return this._currentUser}async waitTilAuthenticated(){return this.token!==void 0?!0:new Promise(t=>{this._waitingForAuth.add(t)})}async listenForRefresh(){const n=()=>{this._refreshTimer=void 0,this._refreshAuthToken()};this._addAccessTokenRefreshListener(r=>{this._refreshTimer&&clearTimeout(this._refreshTimer),this._refreshTimer=setTimeout(n,36e5),this.loginWithToken(r)}),this._refreshTimer=setTimeout(n,36e5)}async forgotPassword(t){await fetch(`${this._apiUrl}/v1/admin/auth/forgot-password`,{method:"POST",body:JSON.stringify({email:t}),headers:{"Content-Type":"application/json"}})}async confirmForgotPassword(t){return(await fetch(`${this._apiUrl}/v1/admin/auth/confirm-forgot-password`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).ok}async respondToNewPasswordRequiredChallenge(t){return await(await fetch(`${this._apiUrl}/v1/admin/auth/respond-to-new-password-required-challenge`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).json()}async loginWithGoogle(t){return await(await fetch(`${this._apiUrl}/v1/admin/auth/login-google`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).json()}async refresh(t){const r=await(await fetch(`${this._apiUrl}/v1/admin/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})})).json();await this.loginWithToken(r.authentication.accessToken,t)}}const Authentication=new AuthenticationStore({apiUrl:FORMANT_API_URL,refreshAuthToken:App.refreshAuthToken,addAccessTokenRefreshListener:App.addAccessTokenRefreshListener});var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype.domain=void 0,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.init=function(){this.domain=null,EventEmitter.usingDomains&&domain.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new EventHandlers,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this};function $getMaxListeners(e){return e._maxListeners===void 0?EventEmitter.defaultMaxListeners:e._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return $getMaxListeners(this)};function emitNone(e,t,n){if(t)e.call(n);else for(var r=e.length,i=arrayClone(e,r),s=0;s<r;++s)i[s].call(n)}function emitOne(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,s=arrayClone(e,i),l=0;l<i;++l)s[l].call(n,r)}function emitTwo(e,t,n,r,i){if(t)e.call(n,r,i);else for(var s=e.length,l=arrayClone(e,s),o=0;o<s;++o)l[o].call(n,r,i)}function emitThree(e,t,n,r,i,s){if(t)e.call(n,r,i,s);else for(var l=e.length,o=arrayClone(e,l),c=0;c<l;++c)o[c].call(n,r,i,s)}function emitMany(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,s=arrayClone(e,i),l=0;l<i;++l)s[l].apply(n,r)}EventEmitter.prototype.emit=function(t){var n,r,i,s,l,o,c,u=t==="error";if(o=this._events,o)u=u&&o.error==null;else if(!u)return!1;if(c=this.domain,u){if(n=arguments[1],c)n||(n=new Error('Uncaught, unspecified "error" event')),n.domainEmitter=this,n.domain=c,n.domainThrown=!1,c.emit("error",n);else{if(n instanceof Error)throw n;var f=new Error('Uncaught, unspecified "error" event. ('+n+")");throw f.context=n,f}return!1}if(r=o[t],!r)return!1;var E=typeof r=="function";switch(i=arguments.length,i){case 1:emitNone(r,E,this);break;case 2:emitOne(r,E,this,arguments[1]);break;case 3:emitTwo(r,E,this,arguments[1],arguments[2]);break;case 4:emitThree(r,E,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(i-1),l=1;l<i;l++)s[l-1]=arguments[l];emitMany(r,E,this,s)}return!0};function _addListener(e,t,n,r){var i,s,l;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(s=e._events,s?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]):(s=e._events=new EventHandlers,e._eventsCount=0),!l)l=s[t]=n,++e._eventsCount;else if(typeof l=="function"?l=s[t]=r?[n,l]:[l,n]:r?l.unshift(n):l.push(n),!l.warned&&(i=$getMaxListeners(e),i&&i>0&&l.length>i)){l.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=l.length,emitWarning(o)}return e}function emitWarning(e){typeof console.warn=="function"?console.warn(e):console.log(e)}EventEmitter.prototype.addListener=function(t,n){return _addListener(this,t,n,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(t,n){return _addListener(this,t,n,!0)};function _onceWrap(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}EventEmitter.prototype.once=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,_onceWrap(this,t,n)),this},EventEmitter.prototype.prependOnceListener=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,_onceWrap(this,t,n)),this},EventEmitter.prototype.removeListener=function(t,n){var r,i,s,l,o;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(i=this._events,!i)return this;if(r=i[t],!r)return this;if(r===n||r.listener&&r.listener===n)--this._eventsCount===0?this._events=new EventHandlers:(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(s=-1,l=r.length;l-- >0;)if(r[l]===n||r[l].listener&&r[l].listener===n){o=r[l].listener,s=l;break}if(s<0)return this;if(r.length===1){if(r[0]=void 0,--this._eventsCount===0)return this._events=new EventHandlers,this;delete i[t]}else spliceOne(r,s);i.removeListener&&this.emit("removeListener",t,o||n)}return this},EventEmitter.prototype.removeAllListeners=function(t){var n,r;if(r=this._events,!r)return this;if(!r.removeListener)return arguments.length===0?(this._events=new EventHandlers,this._eventsCount=0):r[t]&&(--this._eventsCount===0?this._events=new EventHandlers:delete r[t]),this;if(arguments.length===0){for(var i=Object.keys(r),s=0,l;s<i.length;++s)l=i[s],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=new EventHandlers,this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n)do this.removeListener(t,n[n.length-1]);while(n[0]);return this},EventEmitter.prototype.listeners=function(t){var n,r,i=this._events;return i?(n=i[t],n?typeof n=="function"?r=[n.listener||n]:r=unwrapListeners(n):r=[]):r=[],r},EventEmitter.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):listenerCount$1.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount$1;function listenerCount$1(e){var t=this._events;if(t){var n=t[e];if(typeof n=="function")return 1;if(n)return n.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function arrayClone(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}var dist={exports:{}};/*! For license information please see index.js.LICENSE.txt */(function(module,exports){(function(e,t){module.exports=t()})(window,function(){return function(e){function t(u){for(var f,E,b=u[0],h=u[1],g=0,_=[];g<b.length;g++)E=b[g],Object.prototype.hasOwnProperty.call(r,E)&&r[E]&&_.push(r[E][0]),r[E]=0;for(f in h)Object.prototype.hasOwnProperty.call(h,f)&&(e[f]=h[f]);for(c&&c(u);_.length;)_.shift()()}var n={},r={0:0};function i(u){if(n[u])return n[u].exports;var f=n[u]={i:u,l:!1,exports:{}};return e[u].call(f.exports,f,f.exports,i),f.l=!0,f.exports}i.e=function(){return Promise.resolve()},i.m=e,i.c=n,i.d=function(u,f,E){i.o(u,f)||Object.defineProperty(u,f,{enumerable:!0,get:E})},i.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},i.t=function(u,f){if(1&f&&(u=i(u)),8&f||4&f&&typeof u=="object"&&u&&u.__esModule)return u;var E=Object.create(null);if(i.r(E),Object.defineProperty(E,"default",{enumerable:!0,value:u}),2&f&&typeof u!="string")for(var b in u)i.d(E,b,function(h){return u[h]}.bind(null,b));return E},i.n=function(u){var f=u&&u.__esModule?function(){return u.default}:function(){return u};return i.d(f,"a",f),f},i.o=function(u,f){return Object.prototype.hasOwnProperty.call(u,f)},i.p="",i.oe=function(u){throw console.error(u),u};var s=window.webpackJsonpFormantRealtimeSDK=window.webpackJsonpFormantRealtimeSDK||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var o=0;o<s.length;o++)t(s[o]);var c=l;return i(i.s=228)}([function(e,t,n){n.d(t,"a",function(){return G});function r(T,k){if(k.length<T)throw new TypeError(T+" argument"+(T>1?"s":"")+" required, but only "+k.length+" present")}function i(T){if(T===null||T===!0||T===!1)return NaN;var k=Number(T);return isNaN(k)?k:k<0?Math.ceil(k):Math.floor(k)}var s={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},l=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,o=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,c=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(T){var k,J={},K=T.split(s.dateTimeDelimiter);if(K.length>2)return J;if(/:/.test(K[0])?k=K[0]:(J.date=K[0],k=K[1],s.timeZoneDelimiter.test(J.date)&&(J.date=T.split(s.timeZoneDelimiter)[0],k=T.substr(J.date.length,T.length))),k){var re=s.timezone.exec(k);re?(J.time=k.replace(re[1],""),J.timezone=re[1]):J.time=k}return J}function f(T,k){var J=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+k)+"})|(\\d{2}|[+-]\\d{"+(2+k)+"})$)"),K=T.match(J);if(!K)return{year:NaN,restDateString:""};var re=K[1]?parseInt(K[1]):null,se=K[2]?parseInt(K[2]):null;return{year:se===null?re:100*se,restDateString:T.slice((K[1]||K[2]).length)}}function E(T,k){if(k===null)return new Date(NaN);var J=T.match(l);if(!J)return new Date(NaN);var K=!!J[4],re=b(J[1]),se=b(J[2])-1,fe=b(J[3]),ve=b(J[4]),Ie=b(J[5])-1;if(K)return function(Ce,Re,Oe){return Re>=1&&Re<=53&&Oe>=0&&Oe<=6}(0,ve,Ie)?function(Ce,Re,Oe){var Pe=new Date(0);Pe.setUTCFullYear(Ce,0,4);var qe=Pe.getUTCDay()||7,rt=7*(Re-1)+Oe+1-qe;return Pe.setUTCDate(Pe.getUTCDate()+rt),Pe}(k,ve,Ie):new Date(NaN);var Se=new Date(0);return function(Ce,Re,Oe){return Re>=0&&Re<=11&&Oe>=1&&Oe<=(R[Re]||(x(Ce)?29:28))}(k,se,fe)&&function(Ce,Re){return Re>=1&&Re<=(x(Ce)?366:365)}(k,re)?(Se.setUTCFullYear(k,se,Math.max(re,fe)),Se):new Date(NaN)}function b(T){return T?parseInt(T):1}function h(T){var k=T.match(o);if(!k)return NaN;var J=g(k[1]),K=g(k[2]),re=g(k[3]);return function(se,fe,ve){return se===24?fe===0&&ve===0:ve>=0&&ve<60&&fe>=0&&fe<60&&se>=0&&se<25}(J,K,re)?36e5*J+6e4*K+1e3*re:NaN}function g(T){return T&&parseFloat(T.replace(",","."))||0}function _(T){if(T==="Z")return 0;var k=T.match(c);if(!k)return 0;var J=k[1]==="+"?-1:1,K=parseInt(k[2]),re=k[3]&&parseInt(k[3])||0;return function(se,fe){return fe>=0&&fe<=59}(0,re)?J*(36e5*K+6e4*re):NaN}var R=[31,null,31,30,31,30,31,31,30,31,30,31];function x(T){return T%400==0||T%4==0&&T%100!=0}function F(T){return r(1,arguments),T instanceof Date||typeof T=="object"&&Object.prototype.toString.call(T)==="[object Date]"}function M(T){r(1,arguments);var k=Object.prototype.toString.call(T);return T instanceof Date||typeof T=="object"&&k==="[object Date]"?new Date(T.getTime()):typeof T=="number"||k==="[object Number]"?new Date(T):(typeof T!="string"&&k!=="[object String]"||typeof console>"u"||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function A(T){const k=function(J,K){var re;r(1,arguments);var se=i((re=K==null?void 0:K.additionalDigits)!==null&&re!==void 0?re:2);if(se!==2&&se!==1&&se!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(typeof J!="string"&&Object.prototype.toString.call(J)!=="[object String]")return new Date(NaN);var fe,ve=u(J);if(ve.date){var Ie=f(ve.date,se);fe=E(Ie.restDateString,Ie.year)}if(!fe||isNaN(fe.getTime()))return new Date(NaN);var Se,Ce=fe.getTime(),Re=0;if(ve.time&&(Re=h(ve.time),isNaN(Re)))return new Date(NaN);if(!ve.timezone){var Oe=new Date(Ce+Re),Pe=new Date(0);return Pe.setFullYear(Oe.getUTCFullYear(),Oe.getUTCMonth(),Oe.getUTCDate()),Pe.setHours(Oe.getUTCHours(),Oe.getUTCMinutes(),Oe.getUTCSeconds(),Oe.getUTCMilliseconds()),Pe}return Se=_(ve.timezone),isNaN(Se)?new Date(NaN):new Date(Ce+Re+Se)}(T);if(!function(J){if(r(1,arguments),!F(J)&&typeof J!="number")return!1;var K=M(J);return!isNaN(Number(K))}(k))throw new Error(`Invalid ISO 8601 date string (${T})`);return k}const d=Math.pow(2,20),I=d;var $=n(14),q=n.n($),y=n(18),m=n(56),C=n(19),w=n(4),L=n(34);function W(T){return q()(T,{cycles:!0})}var B=function(T,k){var J={};for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&k.indexOf(K)<0&&(J[K]=T[K]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var re=0;for(K=Object.getOwnPropertySymbols(T);re<K.length;re++)k.indexOf(K[re])<0&&Object.prototype.propertyIsEnumerable.call(T,K[re])&&(J[K[re]]=T[K[re]])}return J};function N(T,k={}){const J=ve=>k.redacted!==!1?Object(L.a)(ve):ve;if(!T.stack)return{message:W(J(T))};const{name:K,message:re,stack:se}=T,fe=B(T,["name","message","stack"]);return{name:K,message:re!==void 0?re:W(J(T)),stack:se,meta:fe&&Object.keys(fe).length===0?void 0:J(fe)}}function P(T,k={}){const{message:J,stack:K,meta:re}=N(T,k);return`${K||J||""}${re&&Object.keys(re).length>0?` -- ${W(re)}`:""}`}var z=n(39),O=n(103),p=n.n(O),U=function(T,k,J,K){return new(J||(J=Promise))(function(re,se){function fe(Se){try{Ie(K.next(Se))}catch(Ce){se(Ce)}}function ve(Se){try{Ie(K.throw(Se))}catch(Ce){se(Ce)}}function Ie(Se){var Ce;Se.done?re(Se.value):(Ce=Se.value,Ce instanceof J?Ce:new J(function(Re){Re(Ce)})).then(fe,ve)}Ie((K=K.apply(T,k||[])).next())})},V=function(T,k){var J={};for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&k.indexOf(K)<0&&(J[K]=T[K]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var re=0;for(K=Object.getOwnPropertySymbols(T);re<K.length;re++)k.indexOf(K[re])<0&&Object.prototype.propertyIsEnumerable.call(T,K[re])&&(J[K[re]]=T[K[re]])}return J};class Q extends p.a{constructor(k,J){super(),this.endpoint=k,this.metadata=J,this.logClient=this.getLogClient()}getLogClient(){return U(this,void 0,void 0,function*(){const{LogClient:k}=yield Promise.resolve().then(n.bind(null,231));return new k(this.endpoint)})}log(k,J){return U(this,void 0,void 0,function*(){const{level:K,message:re,error:se}=k,fe=V(k,["level","message","error"]);this.emit("logged");try{yield(yield this.logClient).log([{timestamp:new Date().toISOString(),level:K,message:`${re}`.substring(0,1e3),error:se!==void 0?N(se):void 0,meta:Object.assign(Object.assign({},fe),this.metadata)}])}catch(ve){console.error(`Failed to log to log-api: ${P(ve)}`)}J()})}}var ee=function(T,k){var J={};for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&k.indexOf(K)<0&&(J[K]=T[K]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var re=0;for(K=Object.getOwnPropertySymbols(T);re<K.length;re++)k.indexOf(K[re])<0&&Object.prototype.propertyIsEnumerable.call(T,K[re])&&(J[K[re]]=T[K[re]])}return J};const ne={app:w.a,namespace:w.i,buildTag:w.b,instanceId:z.a},Y=w.e?C.format.printf(T=>{var{timestamp:k,level:J,message:K,error:re}=T,se=ee(T,["timestamp","level","message","error"]);const fe=Object.assign(Object.assign({timestamp:k?A(k).getTime():new Date().getTime(),level:J.toUpperCase(),message:K},re?{error:N(re)}:{}),{meta:Object.assign(Object.assign({},ne),se)});return q()(fe,{cycles:!0})}):C.format.printf(T=>{var{timestamp:k,level:J,message:K,error:re}=T,se=ee(T,["timestamp","level","message","error"]);let fe=`${k||new Date().toISOString()} ${J.toUpperCase()}: ${K} `;return Object.keys(se).length>0&&(fe+=q()(se,{cycles:!0})),re&&(fe+=`
6
+ */var INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==void 0?global$1.TYPED_ARRAY_SUPPORT:!0,kMaxLength();function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(e,t){if(kMaxLength()<t)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=Buffer.prototype):(e===null&&(e=new Buffer(t)),e.length=t),e}function Buffer(e,t,n){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer))return new Buffer(e,t,n);if(typeof e=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,e)}return from(this,e,t,n)}Buffer.poolSize=8192,Buffer._augment=function(e){return e.__proto__=Buffer.prototype,e};function from(e,t,n,r){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,n,r):typeof t=="string"?fromString(e,t,n):fromObject(e,t)}Buffer.from=function(e,t,n){return from(null,e,t,n)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array);function assertSize(e){if(typeof e!="number")throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function alloc(e,t,n,r){return assertSize(t),t<=0?createBuffer(e,t):n!==void 0?typeof r=="string"?createBuffer(e,t).fill(n,r):createBuffer(e,t).fill(n):createBuffer(e,t)}Buffer.alloc=function(e,t,n){return alloc(null,e,t,n)};function allocUnsafe(e,t){if(assertSize(t),e=createBuffer(e,t<0?0:checked(t)|0),!Buffer.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}Buffer.allocUnsafe=function(e){return allocUnsafe(null,e)},Buffer.allocUnsafeSlow=function(e){return allocUnsafe(null,e)};function fromString(e,t,n){if((typeof n!="string"||n==="")&&(n="utf8"),!Buffer.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=byteLength(t,n)|0;e=createBuffer(e,r);var i=e.write(t,n);return i!==r&&(e=e.slice(0,i)),e}function fromArrayLike(e,t){var n=t.length<0?0:checked(t.length)|0;e=createBuffer(e,n);for(var r=0;r<n;r+=1)e[r]=t[r]&255;return e}function fromArrayBuffer(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return n===void 0&&r===void 0?t=new Uint8Array(t):r===void 0?t=new Uint8Array(t,n):t=new Uint8Array(t,n,r),Buffer.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=Buffer.prototype):e=fromArrayLike(e,t),e}function fromObject(e,t){if(internalIsBuffer(t)){var n=checked(t.length)|0;return e=createBuffer(e,n),e.length===0||t.copy(e,0,0,n),e}if(t){if(typeof ArrayBuffer<"u"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if(t.type==="Buffer"&&isArray$1(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(e){if(e>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return e|0}Buffer.isBuffer=isBuffer;function internalIsBuffer(e){return!!(e!=null&&e._isBuffer)}Buffer.compare=function(t,n){if(!internalIsBuffer(t)||!internalIsBuffer(n))throw new TypeError("Arguments must be Buffers");if(t===n)return 0;for(var r=t.length,i=n.length,s=0,l=Math.min(r,i);s<l;++s)if(t[s]!==n[s]){r=t[s],i=n[s];break}return r<i?-1:i<r?1:0},Buffer.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(t,n){if(!isArray$1(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return Buffer.alloc(0);var r;if(n===void 0)for(n=0,r=0;r<t.length;++r)n+=t[r].length;var i=Buffer.allocUnsafe(n),s=0;for(r=0;r<t.length;++r){var l=t[r];if(!internalIsBuffer(l))throw new TypeError('"list" argument must be an Array of Buffers');l.copy(i,s),s+=l.length}return i};function byteLength(e,t){if(internalIsBuffer(e))return e.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return base64ToBytes(e).length;default:if(r)return utf8ToBytes(e).length;t=(""+t).toLowerCase(),r=!0}}Buffer.byteLength=byteLength;function slowToString(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,n);case"utf8":case"utf-8":return utf8Slice(this,t,n);case"ascii":return asciiSlice(this,t,n);case"latin1":case"binary":return latin1Slice(this,t,n);case"base64":return base64Slice(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}Buffer.prototype._isBuffer=!0;function swap(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}Buffer.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var n=0;n<t;n+=2)swap(this,n,n+1);return this},Buffer.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var n=0;n<t;n+=4)swap(this,n,n+3),swap(this,n+1,n+2);return this},Buffer.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var n=0;n<t;n+=8)swap(this,n,n+7),swap(this,n+1,n+6),swap(this,n+2,n+5),swap(this,n+3,n+4);return this},Buffer.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(t){if(!internalIsBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:Buffer.compare(this,t)===0},Buffer.prototype.inspect=function(){var t="",n=INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function(t,n,r,i,s){if(!internalIsBuffer(t))throw new TypeError("Argument must be a Buffer");if(n===void 0&&(n=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),n<0||r>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&n>=r)return 0;if(i>=s)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var l=s-i,o=r-n,c=Math.min(l,o),u=this.slice(i,s),f=t.slice(n,r),E=0;E<c;++E)if(u[E]!==f[E]){l=u[E],o=f[E];break}return l<o?-1:o<l?1:0};function bidirectionalIndexOf(e,t,n,r,i){if(e.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t=="string"&&(t=Buffer.from(t,r)),internalIsBuffer(t))return t.length===0?-1:arrayIndexOf(e,t,n,r,i);if(typeof t=="number")return t=t&255,Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):arrayIndexOf(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,n,r,i){var s=1,l=e.length,o=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(e.length<2||t.length<2)return-1;s=2,l/=2,o/=2,n/=2}function c(h,g){return s===1?h[g]:h.readUInt16BE(g*s)}var u;if(i){var f=-1;for(u=n;u<l;u++)if(c(e,u)===c(t,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===o)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(n+o>l&&(n=l-o),u=n;u>=0;u--){for(var E=!0,b=0;b<o;b++)if(c(e,u+b)!==c(t,b)){E=!1;break}if(E)return u}return-1}Buffer.prototype.includes=function(t,n,r){return this.indexOf(t,n,r)!==-1},Buffer.prototype.indexOf=function(t,n,r){return bidirectionalIndexOf(this,t,n,r,!0)},Buffer.prototype.lastIndexOf=function(t,n,r){return bidirectionalIndexOf(this,t,n,r,!1)};function hexWrite(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var l=0;l<r;++l){var o=parseInt(t.substr(l*2,2),16);if(isNaN(o))return l;e[n+l]=o}return l}function utf8Write(e,t,n,r){return blitBuffer(utf8ToBytes(t,e.length-n),e,n,r)}function asciiWrite(e,t,n,r){return blitBuffer(asciiToBytes(t),e,n,r)}function latin1Write(e,t,n,r){return asciiWrite(e,t,n,r)}function base64Write(e,t,n,r){return blitBuffer(base64ToBytes(t),e,n,r)}function ucs2Write(e,t,n,r){return blitBuffer(utf16leToBytes(t,e.length-n),e,n,r)}Buffer.prototype.write=function(t,n,r,i){if(n===void 0)i="utf8",r=this.length,n=0;else if(r===void 0&&typeof n=="string")i=n,r=this.length,n=0;else if(isFinite(n))n=n|0,isFinite(r)?(r=r|0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-n;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var l=!1;;)switch(i){case"hex":return hexWrite(this,t,n,r);case"utf8":case"utf-8":return utf8Write(this,t,n,r);case"ascii":return asciiWrite(this,t,n,r);case"latin1":case"binary":return latin1Write(this,t,n,r);case"base64":return base64Write(this,t,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,n,r);default:if(l)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),l=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(e,t,n){return t===0&&n===e.length?fromByteArray(e):fromByteArray(e.slice(t,n))}function utf8Slice(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s=e[i],l=null,o=s>239?4:s>223?3:s>191?2:1;if(i+o<=n){var c,u,f,E;switch(o){case 1:s<128&&(l=s);break;case 2:c=e[i+1],(c&192)===128&&(E=(s&31)<<6|c&63,E>127&&(l=E));break;case 3:c=e[i+1],u=e[i+2],(c&192)===128&&(u&192)===128&&(E=(s&15)<<12|(c&63)<<6|u&63,E>2047&&(E<55296||E>57343)&&(l=E));break;case 4:c=e[i+1],u=e[i+2],f=e[i+3],(c&192)===128&&(u&192)===128&&(f&192)===128&&(E=(s&15)<<18|(c&63)<<12|(u&63)<<6|f&63,E>65535&&E<1114112&&(l=E))}}l===null?(l=65533,o=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l),i+=o}return decodeCodePointsArray(r)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=MAX_ARGUMENTS_LENGTH));return n}function asciiSlice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function latin1Slice(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function hexSlice(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=toHex(e[s]);return i}function utf16leSlice(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+r[s+1]*256);return i}Buffer.prototype.slice=function(t,n){var r=this.length;t=~~t,n=n===void 0?r:~~n,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),n<t&&(n=t);var i;if(Buffer.TYPED_ARRAY_SUPPORT)i=this.subarray(t,n),i.__proto__=Buffer.prototype;else{var s=n-t;i=new Buffer(s,void 0);for(var l=0;l<s;++l)i[l]=this[l+t]}return i};function checkOffset(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=this[t],s=1,l=0;++l<n&&(s*=256);)i+=this[t+l]*s;return i},Buffer.prototype.readUIntBE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=this[t+--n],s=1;n>0&&(s*=256);)i+=this[t+--n]*s;return i},Buffer.prototype.readUInt8=function(t,n){return n||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function(t,n){return n||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function(t,n){return n||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function(t,n){return n||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},Buffer.prototype.readUInt32BE=function(t,n){return n||checkOffset(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=this[t],s=1,l=0;++l<n&&(s*=256);)i+=this[t+l]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*n)),i},Buffer.prototype.readIntBE=function(t,n,r){t=t|0,n=n|0,r||checkOffset(t,n,this.length);for(var i=n,s=1,l=this[t+--i];i>0&&(s*=256);)l+=this[t+--i]*s;return s*=128,l>=s&&(l-=Math.pow(2,8*n)),l},Buffer.prototype.readInt8=function(t,n){return n||checkOffset(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},Buffer.prototype.readInt16LE=function(t,n){n||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r},Buffer.prototype.readInt16BE=function(t,n){n||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r},Buffer.prototype.readInt32LE=function(t,n){return n||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function(t,n){return n||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function(t,n){return n||checkOffset(t,4,this.length),read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function(t,n){return n||checkOffset(t,4,this.length),read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function(t,n){return n||checkOffset(t,8,this.length),read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function(t,n){return n||checkOffset(t,8,this.length),read(this,t,!1,52,8)};function checkInt(e,t,n,r,i,s){if(!internalIsBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function(t,n,r,i){if(t=+t,n=n|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;checkInt(this,t,n,r,s,0)}var l=1,o=0;for(this[n]=t&255;++o<r&&(l*=256);)this[n+o]=t/l&255;return n+r},Buffer.prototype.writeUIntBE=function(t,n,r,i){if(t=+t,n=n|0,r=r|0,!i){var s=Math.pow(2,8*r)-1;checkInt(this,t,n,r,s,0)}var l=r-1,o=1;for(this[n+l]=t&255;--l>=0&&(o*=256);)this[n+l]=t/o&255;return n+r},Buffer.prototype.writeUInt8=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[n]=t&255,n+1};function objectWriteUInt16(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i<s;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}Buffer.prototype.writeUInt16LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):objectWriteUInt16(this,t,n,!0),n+2},Buffer.prototype.writeUInt16BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):objectWriteUInt16(this,t,n,!1),n+2};function objectWriteUInt32(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i<s;++i)e[n+i]=t>>>(r?i:3-i)*8&255}Buffer.prototype.writeUInt32LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255):objectWriteUInt32(this,t,n,!0),n+4},Buffer.prototype.writeUInt32BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):objectWriteUInt32(this,t,n,!1),n+4},Buffer.prototype.writeIntLE=function(t,n,r,i){if(t=+t,n=n|0,!i){var s=Math.pow(2,8*r-1);checkInt(this,t,n,r,s-1,-s)}var l=0,o=1,c=0;for(this[n]=t&255;++l<r&&(o*=256);)t<0&&c===0&&this[n+l-1]!==0&&(c=1),this[n+l]=(t/o>>0)-c&255;return n+r},Buffer.prototype.writeIntBE=function(t,n,r,i){if(t=+t,n=n|0,!i){var s=Math.pow(2,8*r-1);checkInt(this,t,n,r,s-1,-s)}var l=r-1,o=1,c=0;for(this[n+l]=t&255;--l>=0&&(o*=256);)t<0&&c===0&&this[n+l+1]!==0&&(c=1),this[n+l]=(t/o>>0)-c&255;return n+r},Buffer.prototype.writeInt8=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[n]=t&255,n+1},Buffer.prototype.writeInt16LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8):objectWriteUInt16(this,t,n,!0),n+2},Buffer.prototype.writeInt16BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>8,this[n+1]=t&255):objectWriteUInt16(this,t,n,!1),n+2},Buffer.prototype.writeInt32LE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24):objectWriteUInt32(this,t,n,!0),n+4},Buffer.prototype.writeInt32BE=function(t,n,r){return t=+t,n=n|0,r||checkInt(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255):objectWriteUInt32(this,t,n,!1),n+4};function checkIEEE754(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function writeFloat(e,t,n,r,i){return i||checkIEEE754(e,t,n,4),write(e,t,n,r,23,4),n+4}Buffer.prototype.writeFloatLE=function(t,n,r){return writeFloat(this,t,n,!0,r)},Buffer.prototype.writeFloatBE=function(t,n,r){return writeFloat(this,t,n,!1,r)};function writeDouble(e,t,n,r,i){return i||checkIEEE754(e,t,n,8),write(e,t,n,r,52,8),n+8}Buffer.prototype.writeDoubleLE=function(t,n,r){return writeDouble(this,t,n,!0,r)},Buffer.prototype.writeDoubleBE=function(t,n,r){return writeDouble(this,t,n,!1,r)},Buffer.prototype.copy=function(t,n,r,i){if(r||(r=0),!i&&i!==0&&(i=this.length),n>=t.length&&(n=t.length),n||(n=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-n<i-r&&(i=t.length-n+r);var s=i-r,l;if(this===t&&r<n&&n<i)for(l=s-1;l>=0;--l)t[l+n]=this[l+r];else if(s<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(l=0;l<s;++l)t[l+n]=this[l+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+s),n);return s},Buffer.prototype.fill=function(t,n,r,i){if(typeof t=="string"){if(typeof n=="string"?(i=n,n=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),t.length===1){var s=t.charCodeAt(0);s<256&&(t=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!Buffer.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;n=n>>>0,r=r===void 0?this.length:r>>>0,t||(t=0);var l;if(typeof t=="number")for(l=n;l<r;++l)this[l]=t;else{var o=internalIsBuffer(t)?t:utf8ToBytes(new Buffer(t,i).toString()),c=o.length;for(l=0;l<r-n;++l)this[l+n]=o[l%c]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(e){if(e=stringtrim(e).replace(INVALID_BASE64_RE,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function stringtrim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function toHex(e){return e<16?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e,t){t=t||1/0;for(var n,r=e.length,i=null,s=[],l=0;l<r;++l){if(n=e.charCodeAt(l),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(l+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return s}function asciiToBytes(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function utf16leToBytes(e,t){for(var n,r,i,s=[],l=0;l<e.length&&!((t-=2)<0);++l)n=e.charCodeAt(l),r=n>>8,i=n%256,s.push(i),s.push(r);return s}function base64ToBytes(e){return toByteArray(base64clean(e))}function blitBuffer(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function isnan(e){return e!==e}function isBuffer(e){return e!=null&&(!!e._isBuffer||isFastBuffer(e)||isSlowBuffer(e))}function isFastBuffer(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&isFastBuffer(e.slice(0,0))}function defined(e,t){if(e!==void 0)return e;throw new Error(t||"Value is undefined")}const DEFAULT_FORMANT_API_URL="https://api.formant.io";function whichFormantApiUrl(e,t){if(t.get("formant_stage"))return"https://api-stage.formant.io";if(t.get("formant_dev"))return"https://api-dev.formant.io";if(t.get("formant_local"))return"https://api.formant.local";if(t.get("formant_url")){const n=t.get("formant_url");if(n!==null)try{return new URL(n).origin}catch{console.warn(`Ignoring malformed \`formant_url\` url parameter: ${n}`)}}return typeof e<"u"&&"FORMANT_API_URL"in e&&typeof e.FORMANT_API_URL=="string"?e.FORMANT_API_URL:DEFAULT_FORMANT_API_URL}const FORMANT_API_URL=whichFormantApiUrl(window,new URLSearchParams(typeof window<"u"?window.location.search:void 0)),millisecond=1,second=1e3,minute=60*second,hour=60*minute,day=24*hour,week=7*day,month=30*day,year=365*day,duration={millisecond,second,minute,hour,day,week,month,year};function filterDataByType(e,t){return e.filter(n=>t.includes(n.type))}function filterDataByTime(e,t,n){const r=t.getTime(),i=n.getTime();return e.map(s=>({...s,points:s.points.filter(([l])=>l>=r&&l<i)})).filter(({points:s})=>s.length>0)}function fork(e){}class StoreCache{constructor({capacity:t,timeout:n}={}){Te(this,"entries",new Map);Te(this,"metadata",new Map);Te(this,"capacity");Te(this,"timeout");this.capacity=t||1e4,this.timeout=n||duration.minute}get(t,n){const r=this.keyToCacheKey(t),i=this.entries.get(r),s=this.metadata.get(r);return(i===void 0||s&&(s==null?void 0:s.expiration.getTime())<Date.now())&&!(s!=null&&s.generating)&&n&&this.generate(t,n()),i===void 0&&s&&s.lastValue!==void 0?s.lastValue:i}set(t,n){const r=this.keyToCacheKey(t);this.metadata.set(r,{generating:!1,expiration:new Date(Date.now()+this.timeout),lastValue:n}),this.entries.set(r,n),this.metadata.size>this.capacity&&this.deleteOldestEntry()}clear(){this.entries.clear(),[...this.metadata.values()].forEach(t=>t.generating=!1)}clearKey(t){this.metadata.delete(t),this.entries.delete(t)}keyToCacheKey(t){return JSON.stringify(t)}deleteOldestEntry(){if(this.metadata.size<1)return;const[t]=[...this.metadata.entries()].reduce(([n,r],[i,s])=>s.expiration.getTime()<r.expiration.getTime()?[i,s]:[n,r]);this.clearKey(t)}generate(t,n){const r=this.keyToCacheKey(t),i=this.metadata.get(r)||{};this.metadata.set(r,{...i,generating:!0,expiration:new Date(Date.now()+this.timeout)}),setTimeout(()=>{n.then(s=>{const l=this.metadata.get(r);!(l!=null&&l.generating)||this.set(t,s)})},0)}}class QueryStore{constructor(){Te(this,"queryStoreCache",new StoreCache({capacity:1e4,timeout:20*duration.second}));Te(this,"liveQueryStoreCache",new StoreCache({capacity:1e4,timeout:200*duration.millisecond}))}moduleQuery(t,n,r,i,s,l=!1){const o={...t,names:[...n],types:[...r]},c=this.query(o,i,s,l);return c===void 0||c==="too much data"?c:filterDataByType(c,r)}query(t,n,r,i=!1){const s={...t,start:dateFns.startOfMinute(n).toISOString(),end:i?r.toISOString():dateFns.addMinutes(dateFns.roundToNearestMinutes(r),1).toISOString(),latestOnly:i},l=r>dateFns.addSeconds(new Date,-20);let o;return l?o=this.liveQueryCache(s):o=this.queryCache(s),!o||o==="too much data"||i?o:filterDataByTime(o,n,r)}queryCache(t){return this.queryStoreCache.get(t,async()=>{try{return await Fleet.queryTelemetry(t)}catch(n){throw n}})}liveQueryCache(t){return this.liveQueryStoreCache.get(t,async()=>{try{return await Fleet.queryTelemetry(t)}catch(n){throw n}})}}const queryStore=new QueryStore,Ke=class{static sendAppMessage(t){window.parent.postMessage(t,"*")}static getCurrentModuleContext(){let t=new URLSearchParams("");return typeof window<"u"&&(t=new URLSearchParams(window.location.search)),t.get("module")}static async getCurrentModuleConfiguration(){let t=new URLSearchParams("");typeof window<"u"&&(t=new URLSearchParams(window.location.search));const n=t.get("configuration");return n===null||n.trim()===""?void 0:(await(await fetch(`${FORMANT_API_URL}/v1/admin/module-configurations/`+n,{headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).configuration}static isModule(){return this.getCurrentModuleContext()!==null}static goToTime(t){this.sendAppMessage({type:"go_to_time",time:t.getTime()})}static goToDevice(t){this.sendAppMessage({type:"go_to_device",deviceId:t})}static showMessage(t){this.sendAppMessage({type:"show_message",message:t})}static requestModuleData(){const t=this.getCurrentModuleContext();if(!t)throw new Error("No module context");this.sendAppMessage({type:"request_module_data",module:t})}static setModuleDateTimeRange(t,n){const r=this.getCurrentModuleContext();if(!r)throw new Error("No module context");this.sendAppMessage({type:"set_module_data_time_range",module:r,before:t,after:n||0})}static refreshAuthToken(){const t=this.getCurrentModuleContext();if(!t)throw new Error("No module context");this.sendAppMessage({type:"refresh_auth_token",module:t})}static sendChannelData(t,n){const r=this.getCurrentModuleContext();if(!r)throw new Error("No module context");this.sendAppMessage({type:"send_channel_data",source:r,channel:t,data:n})}static setupModuleMenus(t){const n=this.getCurrentModuleContext();if(!n)throw new Error("No module context");this.sendAppMessage({type:"setup_module_menus",module:n,menus:t})}static addMenuListener(t){window.addEventListener("message",n=>{const r=n.data;r.type==="module_menu_item_clicked"&&t(r.menu)})}static addAccessTokenRefreshListener(t){window.addEventListener("message",n=>{const r=n.data;r.type==="auth_token"&&t(r.token)})}static addModuleDataListener(t){const n=this.getCurrentModuleContext();n&&this.sendAppMessage({type:"request_module_data",module:n}),window.addEventListener("message",r=>{const i=r.data;i.type==="module_data"&&t({streams:i.streams,time:i.time,queryRange:i.queryRange})})}static addOverviewDeviceListener(t){this.sendAppMessage({type:"request_devices"});const n=r=>{const i=r.data;i.type==="overview_devices"&&t(i.data)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}static addStreamListener(t,n,r){const i=s=>{const l=s.data;if(l.type==="module_data"){const{start:o,end:c}=l.queryRange;r(queryStore.moduleQuery({},t,n,new Date(o),new Date(c),!1))}};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)}static addModuleConfigurationListener(t){window.addEventListener("message",n=>{const r=n.data;r.type==="module_configuration"&&t(r)})}static addChannelDataListener(t,n){window.addEventListener("message",r=>{const i=r.data;i.type==="channel_data"&&i.channel===t&&n({source:i.source,data:i.data})})}static async prompt(t,n){return new Promise(r=>{const i=Math.random().toString();this.sendAppMessage({type:"prompt",promptId:i,schema:t,okText:n==null?void 0:n.okText,cancelText:n==null?void 0:n.cancelText});const s=l=>{const o=l.data;o.type==="prompt_response"&&o.promptId===i&&r(o.data),window.removeEventListener("message",s)};window.addEventListener("message",s)})}static async getDate(t,n,r){return new Promise(i=>{this.sendAppMessage({type:"request_date",minTime:n,maxTime:r,time:t});const s=l=>{const o=l.data;o.type==="date_response"&&(window.removeEventListener("message",s),i(o.data))};window.addEventListener("message",s)})}static async disableAnalyticsBottomBar(){this.sendAppMessage({type:"hide_analytics_date_picker"})}static get isOnline(){return Ke._isOnline}static listenForConnectionEvents(){window.addEventListener("message",this._handleOnlineEvent)}static checkConnection(t=1e3){return new Promise((n,r)=>{const i=setTimeout(()=>r(new Error("deadline expired: took too long")),t),s=l=>{window.removeEventListener("message",s),clearTimeout(i);const{data:o}=l;o.type==="formant_online"&&(this._isOnline=o.online,n(o.online))};window.addEventListener("message",s),this.sendAppMessage({type:"formant_online"})})}static waitForConnection(t=5e3){let n=!1;const r=new Promise((l,o)=>{setTimeout(()=>{n=!0,o(new Error("deadline expired: took too long"))},t)}),i=l=>new Promise(o=>setTimeout(o,l)),s=async()=>{for(await i(50);!n&&!(this.isOnline||await this.checkConnection);)await i(500)};return Promise.race([r,s()])}};let App=Ke;Te(App,"_isOnline",null),Te(App,"_handleOnlineEvent",t=>{const{data:n}=t;n.type==="formant_online"&&(Ke._isOnline=n.online)});class AuthenticationStore{constructor({apiUrl:t,refreshAuthToken:n,addAccessTokenRefreshListener:r}){Te(this,"_refreshToken");Te(this,"_isShareToken",!1);Te(this,"_currentOrganization");Te(this,"_currentUser");Te(this,"_defaultDeviceId");Te(this,"_token");Te(this,"_waitingForAuth",new Set);Te(this,"_refreshTimer");Te(this,"_apiUrl");Te(this,"_refreshAuthToken");Te(this,"_addAccessTokenRefreshListener");this._apiUrl=t,this._refreshAuthToken=n,this._addAccessTokenRefreshListener=r}get token(){return this._token}get currentUser(){return this._currentUser}get currentOrganization(){return this._currentOrganization}get defaultDeviceId(){return this._defaultDeviceId}get refreshToken(){return this._refreshToken}get isShareToken(){return this._isShareToken}async login(t,n){try{const r=await fetch(`${this._apiUrl}/v1/admin/auth/login`,{method:"POST",body:JSON.stringify({email:t,password:n}),headers:{"Content-Type":"application/json"}}),i=await r.json();if(r.status!==200)throw new Error(i.message);return await this.loginWithToken(i.authentication.accessToken,i.authentication.refreshToken),i.authentication}catch(r){return console.error("login() failed",{err:r}),this._waitingForAuth.forEach(i=>i(!1)),this._waitingForAuth.clear(),Promise.reject(r)}}async loginWithToken(t,n){var i;const r=JSON.parse(atob(t.split(".")[1]));try{let s;if(this._isShareToken=r["formant:claims"]&&r["formant:claims"].type=="share",r["formant:claims"]&&(this._currentOrganization=r["formant:claims"].organizationId),r["custom:organization_id"]&&(this._currentOrganization=r["custom:organization_id"]),this._isShareToken||(s=r.sub),r["formant:claims"]&&r["formant:claims"].userId&&(s=r["formant:claims"].userId),s&&((i=this._currentUser)==null?void 0:i.id)!==s){const l=await fetch(`${this._apiUrl}/v1/admin/users/${s}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+t}}),o=await l.json();if(l.status!==200)throw new Error(o.message);this._currentUser=o}this._token=t,this._waitingForAuth.forEach(l=>l(!0))}catch(s){console.error("loginWithToken() failed",{err:s}),this._waitingForAuth.forEach(l=>l(!1))}finally{this._waitingForAuth.clear()}n&&(this._refreshToken=n,setInterval(async()=>{if(this._refreshToken){const l=await(await fetch(`${this._apiUrl}/v1/admin/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this._refreshToken})})).json();this._token=l.authentication.accessToken}},1e3*60*60))}isAuthenticated(){return this._token!==void 0}getCurrentUser(){return this._currentUser}async waitTilAuthenticated(){return this.token!==void 0?!0:new Promise(t=>{this._waitingForAuth.add(t)})}async listenForRefresh(){const n=()=>{this._refreshTimer=void 0,this._refreshAuthToken()};this._addAccessTokenRefreshListener(r=>{this._refreshTimer&&clearTimeout(this._refreshTimer),this._refreshTimer=setTimeout(n,36e5),this.loginWithToken(r)}),this._refreshTimer=setTimeout(n,36e5)}async forgotPassword(t){await fetch(`${this._apiUrl}/v1/admin/auth/forgot-password`,{method:"POST",body:JSON.stringify({email:t}),headers:{"Content-Type":"application/json"}})}async confirmForgotPassword(t){return(await fetch(`${this._apiUrl}/v1/admin/auth/confirm-forgot-password`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).ok}async respondToNewPasswordRequiredChallenge(t){return await(await fetch(`${this._apiUrl}/v1/admin/auth/respond-to-new-password-required-challenge`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).json()}async loginWithGoogle(t){return await(await fetch(`${this._apiUrl}/v1/admin/auth/login-google`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).json()}async refresh(t){const r=await(await fetch(`${this._apiUrl}/v1/admin/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t})})).json();await this.loginWithToken(r.authentication.accessToken,t)}}const Authentication=new AuthenticationStore({apiUrl:FORMANT_API_URL,refreshAuthToken:App.refreshAuthToken,addAccessTokenRefreshListener:App.addAccessTokenRefreshListener});var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.usingDomains=!1,EventEmitter.prototype.domain=void 0,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.init=function(){this.domain=null,EventEmitter.usingDomains&&domain.active,(!this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=new EventHandlers,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this};function $getMaxListeners(e){return e._maxListeners===void 0?EventEmitter.defaultMaxListeners:e._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return $getMaxListeners(this)};function emitNone(e,t,n){if(t)e.call(n);else for(var r=e.length,i=arrayClone(e,r),s=0;s<r;++s)i[s].call(n)}function emitOne(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,s=arrayClone(e,i),l=0;l<i;++l)s[l].call(n,r)}function emitTwo(e,t,n,r,i){if(t)e.call(n,r,i);else for(var s=e.length,l=arrayClone(e,s),o=0;o<s;++o)l[o].call(n,r,i)}function emitThree(e,t,n,r,i,s){if(t)e.call(n,r,i,s);else for(var l=e.length,o=arrayClone(e,l),c=0;c<l;++c)o[c].call(n,r,i,s)}function emitMany(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,s=arrayClone(e,i),l=0;l<i;++l)s[l].apply(n,r)}EventEmitter.prototype.emit=function(t){var n,r,i,s,l,o,c,u=t==="error";if(o=this._events,o)u=u&&o.error==null;else if(!u)return!1;if(c=this.domain,u){if(n=arguments[1],c)n||(n=new Error('Uncaught, unspecified "error" event')),n.domainEmitter=this,n.domain=c,n.domainThrown=!1,c.emit("error",n);else{if(n instanceof Error)throw n;var f=new Error('Uncaught, unspecified "error" event. ('+n+")");throw f.context=n,f}return!1}if(r=o[t],!r)return!1;var E=typeof r=="function";switch(i=arguments.length,i){case 1:emitNone(r,E,this);break;case 2:emitOne(r,E,this,arguments[1]);break;case 3:emitTwo(r,E,this,arguments[1],arguments[2]);break;case 4:emitThree(r,E,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(i-1),l=1;l<i;l++)s[l-1]=arguments[l];emitMany(r,E,this,s)}return!0};function _addListener(e,t,n,r){var i,s,l;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(s=e._events,s?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]):(s=e._events=new EventHandlers,e._eventsCount=0),!l)l=s[t]=n,++e._eventsCount;else if(typeof l=="function"?l=s[t]=r?[n,l]:[l,n]:r?l.unshift(n):l.push(n),!l.warned&&(i=$getMaxListeners(e),i&&i>0&&l.length>i)){l.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=l.length,emitWarning(o)}return e}function emitWarning(e){typeof console.warn=="function"?console.warn(e):console.log(e)}EventEmitter.prototype.addListener=function(t,n){return _addListener(this,t,n,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(t,n){return _addListener(this,t,n,!0)};function _onceWrap(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}EventEmitter.prototype.once=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,_onceWrap(this,t,n)),this},EventEmitter.prototype.prependOnceListener=function(t,n){if(typeof n!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,_onceWrap(this,t,n)),this},EventEmitter.prototype.removeListener=function(t,n){var r,i,s,l,o;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if(i=this._events,!i)return this;if(r=i[t],!r)return this;if(r===n||r.listener&&r.listener===n)--this._eventsCount===0?this._events=new EventHandlers:(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(s=-1,l=r.length;l-- >0;)if(r[l]===n||r[l].listener&&r[l].listener===n){o=r[l].listener,s=l;break}if(s<0)return this;if(r.length===1){if(r[0]=void 0,--this._eventsCount===0)return this._events=new EventHandlers,this;delete i[t]}else spliceOne(r,s);i.removeListener&&this.emit("removeListener",t,o||n)}return this},EventEmitter.prototype.removeAllListeners=function(t){var n,r;if(r=this._events,!r)return this;if(!r.removeListener)return arguments.length===0?(this._events=new EventHandlers,this._eventsCount=0):r[t]&&(--this._eventsCount===0?this._events=new EventHandlers:delete r[t]),this;if(arguments.length===0){for(var i=Object.keys(r),s=0,l;s<i.length;++s)l=i[s],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=new EventHandlers,this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n)do this.removeListener(t,n[n.length-1]);while(n[0]);return this},EventEmitter.prototype.listeners=function(t){var n,r,i=this._events;return i?(n=i[t],n?typeof n=="function"?r=[n.listener||n]:r=unwrapListeners(n):r=[]):r=[],r},EventEmitter.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):listenerCount$1.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount$1;function listenerCount$1(e){var t=this._events;if(t){var n=t[e];if(typeof n=="function")return 1;if(n)return n.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function arrayClone(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}var dist={exports:{}};/*! For license information please see index.js.LICENSE.txt */(function(module,exports){(function(e,t){module.exports=t()})(window,function(){return function(e){function t(u){for(var f,E,b=u[0],h=u[1],g=0,_=[];g<b.length;g++)E=b[g],Object.prototype.hasOwnProperty.call(r,E)&&r[E]&&_.push(r[E][0]),r[E]=0;for(f in h)Object.prototype.hasOwnProperty.call(h,f)&&(e[f]=h[f]);for(c&&c(u);_.length;)_.shift()()}var n={},r={0:0};function i(u){if(n[u])return n[u].exports;var f=n[u]={i:u,l:!1,exports:{}};return e[u].call(f.exports,f,f.exports,i),f.l=!0,f.exports}i.e=function(){return Promise.resolve()},i.m=e,i.c=n,i.d=function(u,f,E){i.o(u,f)||Object.defineProperty(u,f,{enumerable:!0,get:E})},i.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},i.t=function(u,f){if(1&f&&(u=i(u)),8&f||4&f&&typeof u=="object"&&u&&u.__esModule)return u;var E=Object.create(null);if(i.r(E),Object.defineProperty(E,"default",{enumerable:!0,value:u}),2&f&&typeof u!="string")for(var b in u)i.d(E,b,function(h){return u[h]}.bind(null,b));return E},i.n=function(u){var f=u&&u.__esModule?function(){return u.default}:function(){return u};return i.d(f,"a",f),f},i.o=function(u,f){return Object.prototype.hasOwnProperty.call(u,f)},i.p="",i.oe=function(u){throw console.error(u),u};var s=window.webpackJsonpFormantRealtimeSDK=window.webpackJsonpFormantRealtimeSDK||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var o=0;o<s.length;o++)t(s[o]);var c=l;return i(i.s=228)}([function(e,t,n){n.d(t,"a",function(){return G});function r(T,k){if(k.length<T)throw new TypeError(T+" argument"+(T>1?"s":"")+" required, but only "+k.length+" present")}function i(T){if(T===null||T===!0||T===!1)return NaN;var k=Number(T);return isNaN(k)?k:k<0?Math.ceil(k):Math.floor(k)}var s={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},l=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,o=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,c=/^([+-])(\d{2})(?::?(\d{2}))?$/;function u(T){var k,J={},K=T.split(s.dateTimeDelimiter);if(K.length>2)return J;if(/:/.test(K[0])?k=K[0]:(J.date=K[0],k=K[1],s.timeZoneDelimiter.test(J.date)&&(J.date=T.split(s.timeZoneDelimiter)[0],k=T.substr(J.date.length,T.length))),k){var re=s.timezone.exec(k);re?(J.time=k.replace(re[1],""),J.timezone=re[1]):J.time=k}return J}function f(T,k){var J=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+k)+"})|(\\d{2}|[+-]\\d{"+(2+k)+"})$)"),K=T.match(J);if(!K)return{year:NaN,restDateString:""};var re=K[1]?parseInt(K[1]):null,se=K[2]?parseInt(K[2]):null;return{year:se===null?re:100*se,restDateString:T.slice((K[1]||K[2]).length)}}function E(T,k){if(k===null)return new Date(NaN);var J=T.match(l);if(!J)return new Date(NaN);var K=!!J[4],re=b(J[1]),se=b(J[2])-1,fe=b(J[3]),ve=b(J[4]),Ie=b(J[5])-1;if(K)return function(Ce,Re,Oe){return Re>=1&&Re<=53&&Oe>=0&&Oe<=6}(0,ve,Ie)?function(Ce,Re,Oe){var Pe=new Date(0);Pe.setUTCFullYear(Ce,0,4);var qe=Pe.getUTCDay()||7,rt=7*(Re-1)+Oe+1-qe;return Pe.setUTCDate(Pe.getUTCDate()+rt),Pe}(k,ve,Ie):new Date(NaN);var Se=new Date(0);return function(Ce,Re,Oe){return Re>=0&&Re<=11&&Oe>=1&&Oe<=(R[Re]||(x(Ce)?29:28))}(k,se,fe)&&function(Ce,Re){return Re>=1&&Re<=(x(Ce)?366:365)}(k,re)?(Se.setUTCFullYear(k,se,Math.max(re,fe)),Se):new Date(NaN)}function b(T){return T?parseInt(T):1}function h(T){var k=T.match(o);if(!k)return NaN;var J=g(k[1]),K=g(k[2]),re=g(k[3]);return function(se,fe,ve){return se===24?fe===0&&ve===0:ve>=0&&ve<60&&fe>=0&&fe<60&&se>=0&&se<25}(J,K,re)?36e5*J+6e4*K+1e3*re:NaN}function g(T){return T&&parseFloat(T.replace(",","."))||0}function _(T){if(T==="Z")return 0;var k=T.match(c);if(!k)return 0;var J=k[1]==="+"?-1:1,K=parseInt(k[2]),re=k[3]&&parseInt(k[3])||0;return function(se,fe){return fe>=0&&fe<=59}(0,re)?J*(36e5*K+6e4*re):NaN}var R=[31,null,31,30,31,30,31,31,30,31,30,31];function x(T){return T%400==0||T%4==0&&T%100!=0}function F(T){return r(1,arguments),T instanceof Date||typeof T=="object"&&Object.prototype.toString.call(T)==="[object Date]"}function M(T){r(1,arguments);var k=Object.prototype.toString.call(T);return T instanceof Date||typeof T=="object"&&k==="[object Date]"?new Date(T.getTime()):typeof T=="number"||k==="[object Number]"?new Date(T):(typeof T!="string"&&k!=="[object String]"||typeof console>"u"||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function A(T){const k=function(J,K){var re;r(1,arguments);var se=i((re=K==null?void 0:K.additionalDigits)!==null&&re!==void 0?re:2);if(se!==2&&se!==1&&se!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(typeof J!="string"&&Object.prototype.toString.call(J)!=="[object String]")return new Date(NaN);var fe,ve=u(J);if(ve.date){var Ie=f(ve.date,se);fe=E(Ie.restDateString,Ie.year)}if(!fe||isNaN(fe.getTime()))return new Date(NaN);var Se,Ce=fe.getTime(),Re=0;if(ve.time&&(Re=h(ve.time),isNaN(Re)))return new Date(NaN);if(!ve.timezone){var Oe=new Date(Ce+Re),Pe=new Date(0);return Pe.setFullYear(Oe.getUTCFullYear(),Oe.getUTCMonth(),Oe.getUTCDate()),Pe.setHours(Oe.getUTCHours(),Oe.getUTCMinutes(),Oe.getUTCSeconds(),Oe.getUTCMilliseconds()),Pe}return Se=_(ve.timezone),isNaN(Se)?new Date(NaN):new Date(Ce+Re+Se)}(T);if(!function(J){if(r(1,arguments),!F(J)&&typeof J!="number")return!1;var K=M(J);return!isNaN(Number(K))}(k))throw new Error(`Invalid ISO 8601 date string (${T})`);return k}const d=Math.pow(2,20),I=d;var $=n(14),q=n.n($),y=n(18),m=n(56),C=n(19),w=n(4),L=n(34);function W(T){return q()(T,{cycles:!0})}var B=function(T,k){var J={};for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&k.indexOf(K)<0&&(J[K]=T[K]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var re=0;for(K=Object.getOwnPropertySymbols(T);re<K.length;re++)k.indexOf(K[re])<0&&Object.prototype.propertyIsEnumerable.call(T,K[re])&&(J[K[re]]=T[K[re]])}return J};function N(T,k={}){const J=ve=>k.redacted!==!1?Object(L.a)(ve):ve;if(!T.stack)return{message:W(J(T))};const{name:K,message:re,stack:se}=T,fe=B(T,["name","message","stack"]);return{name:K,message:re!==void 0?re:W(J(T)),stack:se,meta:fe&&Object.keys(fe).length===0?void 0:J(fe)}}function P(T,k={}){const{message:J,stack:K,meta:re}=N(T,k);return`${K||J||""}${re&&Object.keys(re).length>0?` -- ${W(re)}`:""}`}var z=n(39),O=n(103),p=n.n(O),U=function(T,k,J,K){return new(J||(J=Promise))(function(re,se){function fe(Se){try{Ie(K.next(Se))}catch(Ce){se(Ce)}}function ve(Se){try{Ie(K.throw(Se))}catch(Ce){se(Ce)}}function Ie(Se){var Ce;Se.done?re(Se.value):(Ce=Se.value,Ce instanceof J?Ce:new J(function(Re){Re(Ce)})).then(fe,ve)}Ie((K=K.apply(T,k||[])).next())})},V=function(T,k){var J={};for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&k.indexOf(K)<0&&(J[K]=T[K]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var re=0;for(K=Object.getOwnPropertySymbols(T);re<K.length;re++)k.indexOf(K[re])<0&&Object.prototype.propertyIsEnumerable.call(T,K[re])&&(J[K[re]]=T[K[re]])}return J};class Q extends p.a{constructor(k,J){super(),this.endpoint=k,this.metadata=J,this.logClient=this.getLogClient()}getLogClient(){return U(this,void 0,void 0,function*(){const{LogClient:k}=yield Promise.resolve().then(n.bind(null,231));return new k(this.endpoint)})}log(k,J){return U(this,void 0,void 0,function*(){const{level:K,message:re,error:se}=k,fe=V(k,["level","message","error"]);this.emit("logged");try{yield(yield this.logClient).log([{timestamp:new Date().toISOString(),level:K,message:`${re}`.substring(0,1e3),error:se!==void 0?N(se):void 0,meta:Object.assign(Object.assign({},fe),this.metadata)}])}catch(ve){console.error(`Failed to log to log-api: ${P(ve)}`)}J()})}}var ee=function(T,k){var J={};for(var K in T)Object.prototype.hasOwnProperty.call(T,K)&&k.indexOf(K)<0&&(J[K]=T[K]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var re=0;for(K=Object.getOwnPropertySymbols(T);re<K.length;re++)k.indexOf(K[re])<0&&Object.prototype.propertyIsEnumerable.call(T,K[re])&&(J[K[re]]=T[K[re]])}return J};const ne={app:w.a,namespace:w.i,buildTag:w.b,instanceId:z.a},Y=w.e?C.format.printf(T=>{var{timestamp:k,level:J,message:K,error:re}=T,se=ee(T,["timestamp","level","message","error"]);const fe=Object.assign(Object.assign({timestamp:k?A(k).getTime():new Date().getTime(),level:J.toUpperCase(),message:K},re?{error:N(re)}:{}),{meta:Object.assign(Object.assign({},ne),se)});return q()(fe,{cycles:!0})}):C.format.printf(T=>{var{timestamp:k,level:J,message:K,error:re}=T,se=ee(T,["timestamp","level","message","error"]);let fe=`${k||new Date().toISOString()} ${J.toUpperCase()}: ${K} `;return Object.keys(se).length>0&&(fe+=q()(se,{cycles:!0})),re&&(fe+=`
7
7
  ${P(re)}`),fe}),G=Object(C.createLogger)({level:w.f});if(G.add(new C.transports.Console({format:Y,level:"debug"})),G.transports.forEach(T=>{T.silent=!w.g}),w.d&&G.add(new Q(w.d,ne)),w.h){const T=m.resolve(y.tmpdir(),`silly-${w.a}.log`);G.debug("Logging silly logs to file",{filename:T}),G.add(new C.transports.File({filename:T,maxsize:1*I,maxFiles:10,format:C.format.combine((S="silly",Object(C.format)(k=>k.level===S&&k)()),Y),level:"silly"}))}var S},function(e,t,n){n.d(t,"a",function(){return r});const r={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6,year:31536e6}},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function o(R){if(n===setTimeout)return setTimeout(R,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(R,0);try{return n(R,0)}catch{try{return n.call(null,R,0)}catch{return n.call(this,R,0)}}}(function(){try{n=typeof setTimeout=="function"?setTimeout:s}catch{n=s}try{r=typeof clearTimeout=="function"?clearTimeout:l}catch{r=l}})();var c,u=[],f=!1,E=-1;function b(){f&&c&&(f=!1,c.length?u=c.concat(u):E=-1,u.length&&h())}function h(){if(!f){var R=o(b);f=!0;for(var x=u.length;x;){for(c=u,u=[];++E<x;)c&&c[E].run();E=-1,x=u.length}c=null,f=!1,function(F){if(r===clearTimeout)return clearTimeout(F);if((r===l||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(F);try{r(F)}catch{try{return r.call(null,F)}catch{return r.call(this,F)}}}(R)}}function g(R,x){this.fun=R,this.array=x}function _(){}i.nextTick=function(R){var x=new Array(arguments.length-1);if(arguments.length>1)for(var F=1;F<arguments.length;F++)x[F-1]=arguments[F];u.push(new g(R,x)),u.length!==1||f||o(h)},g.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(R){return[]},i.binding=function(R){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(R){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){Object.defineProperty(t,"LEVEL",{value:Symbol.for("level")}),Object.defineProperty(t,"MESSAGE",{value:Symbol.for("message")}),Object.defineProperty(t,"SPLAT",{value:Symbol.for("splat")}),Object.defineProperty(t,"configs",{value:n(118)})},function(e,t,n){(function(r){n.d(t,"a",function(){return l}),n.d(t,"i",function(){return o}),n.d(t,"j",function(){return c}),n.d(t,"b",function(){return u}),n.d(t,"f",function(){return f}),n.d(t,"e",function(){return E}),n.d(t,"g",function(){return b}),n.d(t,"d",function(){return h}),n.d(t,"c",function(){return g}),n.d(t,"h",function(){return _});var i=n(102);const s=i.from({ENVIRONMENT:r.env.ENV,AGGREGATE_LEVEL:r.env.AGGREGATE_LEVEL,API_ENDPOINT:r.env.API_ENDPOINT,APP:"realtime-sdk",APP_PATH:r.env.APP_PATH,BUILD_TAG:r.env.BUILD_TAG,ENABLE_SELF_SERVE:r.env.ENABLE_SELF_SERVE,ENABLE_SENTRY:r.env.ENABLE_SENTRY,ENABLE_SENTRY_PROFILING:r.env.ENABLE_SENTRY_PROFILING,GIT_COMMIT:r.env.GIT_COMMIT,JEST_WORKER_ID:r.env.JEST_WORKER_ID,LOG_API_ENDPOINT:r.env.LOG_API_ENDPOINT,LOG_JSON:"false",LOG_LEVEL:r.env.LOG_LEVEL,LOG_TO_CONSOLE:r.env.LOG_TO_CONSOLE,LOG_TO_FILE:r.env.LOG_TO_FILE,NAMESPACE:"production",SENTRY_DSN:r.env.SENTRY_DSN,SHEET_EXPORT_MAX_ROW_COUNT:r.env.SHEET_EXPORT_MAX_ROW_COUNT,STABLE_AGENT_VERSION:r.env.STABLE_AGENT_VERSION,VERSION:r.env.VERSION}),l=(s.get("ENVIRONMENT").default("").asString(),s.get("APP").default("").asString()),o=(s.get("APP_PATH").default("").asString(),s.get("API_ENDPOINT").default("").asString(),s.get("NAMESPACE").default("").asString()),c=s.get("VERSION").default("").asString(),u=s.get("BUILD_TAG").default("").asString(),f=(s.get("GIT_COMMIT").default("").asString(),s.get("ENABLE_SENTRY").default("false").asBool(),s.get("ENABLE_SENTRY_PROFILING").default("false").asBool(),s.get("SENTRY_DSN").default("").asString(),s.get("LOG_LEVEL").default("debug").asString()),E=s.get("LOG_JSON").default("true").asBool(),b=s.get("LOG_TO_CONSOLE").default("true").asBool(),h=(s.get("STABLE_AGENT_VERSION").default("").asString(),s.get("LOG_API_ENDPOINT").asString()),g=s.get("JEST_WORKER_ID").asString(),_=(s.get("SHEET_EXPORT_MAX_ROW_COUNT").default("10000").asIntPositive(),s.get("LOG_TO_FILE").default("false").asBoolStrict());s.get("ENABLE_SELF_SERVE").default("true").asBoolStrict(),s.get("AGGREGATE_LEVEL").default("hour").asEnum(["day","hour","minute"])}).call(this,n(2))},function(e,t,n){(function(r){var i=n(126),s=n(127),l=n(42);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function c(S,T){if(o()<T)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(S=new Uint8Array(T)).__proto__=u.prototype:(S===null&&(S=new u(T)),S.length=T),S}function u(S,T,k){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(S,T,k);if(typeof S=="number"){if(typeof T=="string")throw new Error("If encoding is specified then the first argument must be a string");return b(this,S)}return f(this,S,T,k)}function f(S,T,k,J){if(typeof T=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&T instanceof ArrayBuffer?function(K,re,se,fe){if(re.byteLength,se<0||re.byteLength<se)throw new RangeError("'offset' is out of bounds");if(re.byteLength<se+(fe||0))throw new RangeError("'length' is out of bounds");return re=se===void 0&&fe===void 0?new Uint8Array(re):fe===void 0?new Uint8Array(re,se):new Uint8Array(re,se,fe),u.TYPED_ARRAY_SUPPORT?(K=re).__proto__=u.prototype:K=h(K,re),K}(S,T,k,J):typeof T=="string"?function(K,re,se){if(typeof se=="string"&&se!==""||(se="utf8"),!u.isEncoding(se))throw new TypeError('"encoding" must be a valid string encoding');var fe=0|_(re,se),ve=(K=c(K,fe)).write(re,se);return ve!==fe&&(K=K.slice(0,ve)),K}(S,T,k):function(K,re){if(u.isBuffer(re)){var se=0|g(re.length);return(K=c(K,se)).length===0||re.copy(K,0,0,se),K}if(re){if(typeof ArrayBuffer<"u"&&re.buffer instanceof ArrayBuffer||"length"in re)return typeof re.length!="number"||(fe=re.length)!=fe?c(K,0):h(K,re);if(re.type==="Buffer"&&l(re.data))return h(K,re.data)}var fe;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(S,T)}function E(S){if(typeof S!="number")throw new TypeError('"size" argument must be a number');if(S<0)throw new RangeError('"size" argument must not be negative')}function b(S,T){if(E(T),S=c(S,T<0?0:0|g(T)),!u.TYPED_ARRAY_SUPPORT)for(var k=0;k<T;++k)S[k]=0;return S}function h(S,T){var k=T.length<0?0:0|g(T.length);S=c(S,k);for(var J=0;J<k;J+=1)S[J]=255&T[J];return S}function g(S){if(S>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|S}function _(S,T){if(u.isBuffer(S))return S.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(S)||S instanceof ArrayBuffer))return S.byteLength;typeof S!="string"&&(S=""+S);var k=S.length;if(k===0)return 0;for(var J=!1;;)switch(T){case"ascii":case"latin1":case"binary":return k;case"utf8":case"utf-8":case void 0:return ne(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*k;case"hex":return k>>>1;case"base64":return Y(S).length;default:if(J)return ne(S).length;T=(""+T).toLowerCase(),J=!0}}function R(S,T,k){var J=!1;if((T===void 0||T<0)&&(T=0),T>this.length||((k===void 0||k>this.length)&&(k=this.length),k<=0)||(k>>>=0)<=(T>>>=0))return"";for(S||(S="utf8");;)switch(S){case"hex":return W(this,T,k);case"utf8":case"utf-8":return C(this,T,k);case"ascii":return w(this,T,k);case"latin1":case"binary":return L(this,T,k);case"base64":return m(this,T,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,T,k);default:if(J)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),J=!0}}function x(S,T,k){var J=S[T];S[T]=S[k],S[k]=J}function F(S,T,k,J,K){if(S.length===0)return-1;if(typeof k=="string"?(J=k,k=0):k>2147483647?k=2147483647:k<-2147483648&&(k=-2147483648),k=+k,isNaN(k)&&(k=K?0:S.length-1),k<0&&(k=S.length+k),k>=S.length){if(K)return-1;k=S.length-1}else if(k<0){if(!K)return-1;k=0}if(typeof T=="string"&&(T=u.from(T,J)),u.isBuffer(T))return T.length===0?-1:M(S,T,k,J,K);if(typeof T=="number")return T&=255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?K?Uint8Array.prototype.indexOf.call(S,T,k):Uint8Array.prototype.lastIndexOf.call(S,T,k):M(S,[T],k,J,K);throw new TypeError("val must be string, number or Buffer")}function M(S,T,k,J,K){var re,se=1,fe=S.length,ve=T.length;if(J!==void 0&&((J=String(J).toLowerCase())==="ucs2"||J==="ucs-2"||J==="utf16le"||J==="utf-16le")){if(S.length<2||T.length<2)return-1;se=2,fe/=2,ve/=2,k/=2}function Ie(Oe,Pe){return se===1?Oe[Pe]:Oe.readUInt16BE(Pe*se)}if(K){var Se=-1;for(re=k;re<fe;re++)if(Ie(S,re)===Ie(T,Se===-1?0:re-Se)){if(Se===-1&&(Se=re),re-Se+1===ve)return Se*se}else Se!==-1&&(re-=re-Se),Se=-1}else for(k+ve>fe&&(k=fe-ve),re=k;re>=0;re--){for(var Ce=!0,Re=0;Re<ve;Re++)if(Ie(S,re+Re)!==Ie(T,Re)){Ce=!1;break}if(Ce)return re}return-1}function A(S,T,k,J){k=Number(k)||0;var K=S.length-k;J?(J=Number(J))>K&&(J=K):J=K;var re=T.length;if(re%2!=0)throw new TypeError("Invalid hex string");J>re/2&&(J=re/2);for(var se=0;se<J;++se){var fe=parseInt(T.substr(2*se,2),16);if(isNaN(fe))return se;S[k+se]=fe}return se}function d(S,T,k,J){return G(ne(T,S.length-k),S,k,J)}function I(S,T,k,J){return G(function(K){for(var re=[],se=0;se<K.length;++se)re.push(255&K.charCodeAt(se));return re}(T),S,k,J)}function $(S,T,k,J){return I(S,T,k,J)}function q(S,T,k,J){return G(Y(T),S,k,J)}function y(S,T,k,J){return G(function(K,re){for(var se,fe,ve,Ie=[],Se=0;Se<K.length&&!((re-=2)<0);++Se)se=K.charCodeAt(Se),fe=se>>8,ve=se%256,Ie.push(ve),Ie.push(fe);return Ie}(T,S.length-k),S,k,J)}function m(S,T,k){return T===0&&k===S.length?i.fromByteArray(S):i.fromByteArray(S.slice(T,k))}function C(S,T,k){k=Math.min(S.length,k);for(var J=[],K=T;K<k;){var re,se,fe,ve,Ie=S[K],Se=null,Ce=Ie>239?4:Ie>223?3:Ie>191?2:1;if(K+Ce<=k)switch(Ce){case 1:Ie<128&&(Se=Ie);break;case 2:(192&(re=S[K+1]))==128&&(ve=(31&Ie)<<6|63&re)>127&&(Se=ve);break;case 3:re=S[K+1],se=S[K+2],(192&re)==128&&(192&se)==128&&(ve=(15&Ie)<<12|(63&re)<<6|63&se)>2047&&(ve<55296||ve>57343)&&(Se=ve);break;case 4:re=S[K+1],se=S[K+2],fe=S[K+3],(192&re)==128&&(192&se)==128&&(192&fe)==128&&(ve=(15&Ie)<<18|(63&re)<<12|(63&se)<<6|63&fe)>65535&&ve<1114112&&(Se=ve)}Se===null?(Se=65533,Ce=1):Se>65535&&(Se-=65536,J.push(Se>>>10&1023|55296),Se=56320|1023&Se),J.push(Se),K+=Ce}return function(Re){var Oe=Re.length;if(Oe<=4096)return String.fromCharCode.apply(String,Re);for(var Pe="",qe=0;qe<Oe;)Pe+=String.fromCharCode.apply(String,Re.slice(qe,qe+=4096));return Pe}(J)}t.Buffer=u,t.SlowBuffer=function(S){return+S!=S&&(S=0),u.alloc(+S)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=r.TYPED_ARRAY_SUPPORT!==void 0?r.TYPED_ARRAY_SUPPORT:function(){try{var S=new Uint8Array(1);return S.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},S.foo()===42&&typeof S.subarray=="function"&&S.subarray(1,1).byteLength===0}catch{return!1}}(),t.kMaxLength=o(),u.poolSize=8192,u._augment=function(S){return S.__proto__=u.prototype,S},u.from=function(S,T,k){return f(null,S,T,k)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(S,T,k){return function(J,K,re,se){return E(K),K<=0?c(J,K):re!==void 0?typeof se=="string"?c(J,K).fill(re,se):c(J,K).fill(re):c(J,K)}(null,S,T,k)},u.allocUnsafe=function(S){return b(null,S)},u.allocUnsafeSlow=function(S){return b(null,S)},u.isBuffer=function(S){return!(S==null||!S._isBuffer)},u.compare=function(S,T){if(!u.isBuffer(S)||!u.isBuffer(T))throw new TypeError("Arguments must be Buffers");if(S===T)return 0;for(var k=S.length,J=T.length,K=0,re=Math.min(k,J);K<re;++K)if(S[K]!==T[K]){k=S[K],J=T[K];break}return k<J?-1:J<k?1:0},u.isEncoding=function(S){switch(String(S).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(S,T){if(!l(S))throw new TypeError('"list" argument must be an Array of Buffers');if(S.length===0)return u.alloc(0);var k;if(T===void 0)for(T=0,k=0;k<S.length;++k)T+=S[k].length;var J=u.allocUnsafe(T),K=0;for(k=0;k<S.length;++k){var re=S[k];if(!u.isBuffer(re))throw new TypeError('"list" argument must be an Array of Buffers');re.copy(J,K),K+=re.length}return J},u.byteLength=_,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var S=this.length;if(S%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var T=0;T<S;T+=2)x(this,T,T+1);return this},u.prototype.swap32=function(){var S=this.length;if(S%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var T=0;T<S;T+=4)x(this,T,T+3),x(this,T+1,T+2);return this},u.prototype.swap64=function(){var S=this.length;if(S%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var T=0;T<S;T+=8)x(this,T,T+7),x(this,T+1,T+6),x(this,T+2,T+5),x(this,T+3,T+4);return this},u.prototype.toString=function(){var S=0|this.length;return S===0?"":arguments.length===0?C(this,0,S):R.apply(this,arguments)},u.prototype.equals=function(S){if(!u.isBuffer(S))throw new TypeError("Argument must be a Buffer");return this===S||u.compare(this,S)===0},u.prototype.inspect=function(){var S="",T=t.INSPECT_MAX_BYTES;return this.length>0&&(S=this.toString("hex",0,T).match(/.{2}/g).join(" "),this.length>T&&(S+=" ... ")),"<Buffer "+S+">"},u.prototype.compare=function(S,T,k,J,K){if(!u.isBuffer(S))throw new TypeError("Argument must be a Buffer");if(T===void 0&&(T=0),k===void 0&&(k=S?S.length:0),J===void 0&&(J=0),K===void 0&&(K=this.length),T<0||k>S.length||J<0||K>this.length)throw new RangeError("out of range index");if(J>=K&&T>=k)return 0;if(J>=K)return-1;if(T>=k)return 1;if(this===S)return 0;for(var re=(K>>>=0)-(J>>>=0),se=(k>>>=0)-(T>>>=0),fe=Math.min(re,se),ve=this.slice(J,K),Ie=S.slice(T,k),Se=0;Se<fe;++Se)if(ve[Se]!==Ie[Se]){re=ve[Se],se=Ie[Se];break}return re<se?-1:se<re?1:0},u.prototype.includes=function(S,T,k){return this.indexOf(S,T,k)!==-1},u.prototype.indexOf=function(S,T,k){return F(this,S,T,k,!0)},u.prototype.lastIndexOf=function(S,T,k){return F(this,S,T,k,!1)},u.prototype.write=function(S,T,k,J){if(T===void 0)J="utf8",k=this.length,T=0;else if(k===void 0&&typeof T=="string")J=T,k=this.length,T=0;else{if(!isFinite(T))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");T|=0,isFinite(k)?(k|=0,J===void 0&&(J="utf8")):(J=k,k=void 0)}var K=this.length-T;if((k===void 0||k>K)&&(k=K),S.length>0&&(k<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");J||(J="utf8");for(var re=!1;;)switch(J){case"hex":return A(this,S,T,k);case"utf8":case"utf-8":return d(this,S,T,k);case"ascii":return I(this,S,T,k);case"latin1":case"binary":return $(this,S,T,k);case"base64":return q(this,S,T,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,S,T,k);default:if(re)throw new TypeError("Unknown encoding: "+J);J=(""+J).toLowerCase(),re=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function w(S,T,k){var J="";k=Math.min(S.length,k);for(var K=T;K<k;++K)J+=String.fromCharCode(127&S[K]);return J}function L(S,T,k){var J="";k=Math.min(S.length,k);for(var K=T;K<k;++K)J+=String.fromCharCode(S[K]);return J}function W(S,T,k){var J=S.length;(!T||T<0)&&(T=0),(!k||k<0||k>J)&&(k=J);for(var K="",re=T;re<k;++re)K+=ee(S[re]);return K}function B(S,T,k){for(var J=S.slice(T,k),K="",re=0;re<J.length;re+=2)K+=String.fromCharCode(J[re]+256*J[re+1]);return K}function N(S,T,k){if(S%1!=0||S<0)throw new RangeError("offset is not uint");if(S+T>k)throw new RangeError("Trying to access beyond buffer length")}function P(S,T,k,J,K,re){if(!u.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(T>K||T<re)throw new RangeError('"value" argument is out of bounds');if(k+J>S.length)throw new RangeError("Index out of range")}function z(S,T,k,J){T<0&&(T=65535+T+1);for(var K=0,re=Math.min(S.length-k,2);K<re;++K)S[k+K]=(T&255<<8*(J?K:1-K))>>>8*(J?K:1-K)}function O(S,T,k,J){T<0&&(T=4294967295+T+1);for(var K=0,re=Math.min(S.length-k,4);K<re;++K)S[k+K]=T>>>8*(J?K:3-K)&255}function p(S,T,k,J,K,re){if(k+J>S.length)throw new RangeError("Index out of range");if(k<0)throw new RangeError("Index out of range")}function U(S,T,k,J,K){return K||p(S,0,k,4),s.write(S,T,k,J,23,4),k+4}function V(S,T,k,J,K){return K||p(S,0,k,8),s.write(S,T,k,J,52,8),k+8}u.prototype.slice=function(S,T){var k,J=this.length;if((S=~~S)<0?(S+=J)<0&&(S=0):S>J&&(S=J),(T=T===void 0?J:~~T)<0?(T+=J)<0&&(T=0):T>J&&(T=J),T<S&&(T=S),u.TYPED_ARRAY_SUPPORT)(k=this.subarray(S,T)).__proto__=u.prototype;else{var K=T-S;k=new u(K,void 0);for(var re=0;re<K;++re)k[re]=this[re+S]}return k},u.prototype.readUIntLE=function(S,T,k){S|=0,T|=0,k||N(S,T,this.length);for(var J=this[S],K=1,re=0;++re<T&&(K*=256);)J+=this[S+re]*K;return J},u.prototype.readUIntBE=function(S,T,k){S|=0,T|=0,k||N(S,T,this.length);for(var J=this[S+--T],K=1;T>0&&(K*=256);)J+=this[S+--T]*K;return J},u.prototype.readUInt8=function(S,T){return T||N(S,1,this.length),this[S]},u.prototype.readUInt16LE=function(S,T){return T||N(S,2,this.length),this[S]|this[S+1]<<8},u.prototype.readUInt16BE=function(S,T){return T||N(S,2,this.length),this[S]<<8|this[S+1]},u.prototype.readUInt32LE=function(S,T){return T||N(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+16777216*this[S+3]},u.prototype.readUInt32BE=function(S,T){return T||N(S,4,this.length),16777216*this[S]+(this[S+1]<<16|this[S+2]<<8|this[S+3])},u.prototype.readIntLE=function(S,T,k){S|=0,T|=0,k||N(S,T,this.length);for(var J=this[S],K=1,re=0;++re<T&&(K*=256);)J+=this[S+re]*K;return J>=(K*=128)&&(J-=Math.pow(2,8*T)),J},u.prototype.readIntBE=function(S,T,k){S|=0,T|=0,k||N(S,T,this.length);for(var J=T,K=1,re=this[S+--J];J>0&&(K*=256);)re+=this[S+--J]*K;return re>=(K*=128)&&(re-=Math.pow(2,8*T)),re},u.prototype.readInt8=function(S,T){return T||N(S,1,this.length),128&this[S]?-1*(255-this[S]+1):this[S]},u.prototype.readInt16LE=function(S,T){T||N(S,2,this.length);var k=this[S]|this[S+1]<<8;return 32768&k?4294901760|k:k},u.prototype.readInt16BE=function(S,T){T||N(S,2,this.length);var k=this[S+1]|this[S]<<8;return 32768&k?4294901760|k:k},u.prototype.readInt32LE=function(S,T){return T||N(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},u.prototype.readInt32BE=function(S,T){return T||N(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},u.prototype.readFloatLE=function(S,T){return T||N(S,4,this.length),s.read(this,S,!0,23,4)},u.prototype.readFloatBE=function(S,T){return T||N(S,4,this.length),s.read(this,S,!1,23,4)},u.prototype.readDoubleLE=function(S,T){return T||N(S,8,this.length),s.read(this,S,!0,52,8)},u.prototype.readDoubleBE=function(S,T){return T||N(S,8,this.length),s.read(this,S,!1,52,8)},u.prototype.writeUIntLE=function(S,T,k,J){S=+S,T|=0,k|=0,J||P(this,S,T,k,Math.pow(2,8*k)-1,0);var K=1,re=0;for(this[T]=255&S;++re<k&&(K*=256);)this[T+re]=S/K&255;return T+k},u.prototype.writeUIntBE=function(S,T,k,J){S=+S,T|=0,k|=0,J||P(this,S,T,k,Math.pow(2,8*k)-1,0);var K=k-1,re=1;for(this[T+K]=255&S;--K>=0&&(re*=256);)this[T+K]=S/re&255;return T+k},u.prototype.writeUInt8=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,1,255,0),u.TYPED_ARRAY_SUPPORT||(S=Math.floor(S)),this[T]=255&S,T+1},u.prototype.writeUInt16LE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[T]=255&S,this[T+1]=S>>>8):z(this,S,T,!0),T+2},u.prototype.writeUInt16BE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[T]=S>>>8,this[T+1]=255&S):z(this,S,T,!1),T+2},u.prototype.writeUInt32LE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[T+3]=S>>>24,this[T+2]=S>>>16,this[T+1]=S>>>8,this[T]=255&S):O(this,S,T,!0),T+4},u.prototype.writeUInt32BE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=255&S):O(this,S,T,!1),T+4},u.prototype.writeIntLE=function(S,T,k,J){if(S=+S,T|=0,!J){var K=Math.pow(2,8*k-1);P(this,S,T,k,K-1,-K)}var re=0,se=1,fe=0;for(this[T]=255&S;++re<k&&(se*=256);)S<0&&fe===0&&this[T+re-1]!==0&&(fe=1),this[T+re]=(S/se>>0)-fe&255;return T+k},u.prototype.writeIntBE=function(S,T,k,J){if(S=+S,T|=0,!J){var K=Math.pow(2,8*k-1);P(this,S,T,k,K-1,-K)}var re=k-1,se=1,fe=0;for(this[T+re]=255&S;--re>=0&&(se*=256);)S<0&&fe===0&&this[T+re+1]!==0&&(fe=1),this[T+re]=(S/se>>0)-fe&255;return T+k},u.prototype.writeInt8=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,1,127,-128),u.TYPED_ARRAY_SUPPORT||(S=Math.floor(S)),S<0&&(S=255+S+1),this[T]=255&S,T+1},u.prototype.writeInt16LE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[T]=255&S,this[T+1]=S>>>8):z(this,S,T,!0),T+2},u.prototype.writeInt16BE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[T]=S>>>8,this[T+1]=255&S):z(this,S,T,!1),T+2},u.prototype.writeInt32LE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[T]=255&S,this[T+1]=S>>>8,this[T+2]=S>>>16,this[T+3]=S>>>24):O(this,S,T,!0),T+4},u.prototype.writeInt32BE=function(S,T,k){return S=+S,T|=0,k||P(this,S,T,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),u.TYPED_ARRAY_SUPPORT?(this[T]=S>>>24,this[T+1]=S>>>16,this[T+2]=S>>>8,this[T+3]=255&S):O(this,S,T,!1),T+4},u.prototype.writeFloatLE=function(S,T,k){return U(this,S,T,!0,k)},u.prototype.writeFloatBE=function(S,T,k){return U(this,S,T,!1,k)},u.prototype.writeDoubleLE=function(S,T,k){return V(this,S,T,!0,k)},u.prototype.writeDoubleBE=function(S,T,k){return V(this,S,T,!1,k)},u.prototype.copy=function(S,T,k,J){if(k||(k=0),J||J===0||(J=this.length),T>=S.length&&(T=S.length),T||(T=0),J>0&&J<k&&(J=k),J===k||S.length===0||this.length===0)return 0;if(T<0)throw new RangeError("targetStart out of bounds");if(k<0||k>=this.length)throw new RangeError("sourceStart out of bounds");if(J<0)throw new RangeError("sourceEnd out of bounds");J>this.length&&(J=this.length),S.length-T<J-k&&(J=S.length-T+k);var K,re=J-k;if(this===S&&k<T&&T<J)for(K=re-1;K>=0;--K)S[K+T]=this[K+k];else if(re<1e3||!u.TYPED_ARRAY_SUPPORT)for(K=0;K<re;++K)S[K+T]=this[K+k];else Uint8Array.prototype.set.call(S,this.subarray(k,k+re),T);return re},u.prototype.fill=function(S,T,k,J){if(typeof S=="string"){if(typeof T=="string"?(J=T,T=0,k=this.length):typeof k=="string"&&(J=k,k=this.length),S.length===1){var K=S.charCodeAt(0);K<256&&(S=K)}if(J!==void 0&&typeof J!="string")throw new TypeError("encoding must be a string");if(typeof J=="string"&&!u.isEncoding(J))throw new TypeError("Unknown encoding: "+J)}else typeof S=="number"&&(S&=255);if(T<0||this.length<T||this.length<k)throw new RangeError("Out of range index");if(k<=T)return this;var re;if(T>>>=0,k=k===void 0?this.length:k>>>0,S||(S=0),typeof S=="number")for(re=T;re<k;++re)this[re]=S;else{var se=u.isBuffer(S)?S:ne(new u(S,J).toString()),fe=se.length;for(re=0;re<k-T;++re)this[re+T]=se[re%fe]}return this};var Q=/[^+\/0-9A-Za-z-_]/g;function ee(S){return S<16?"0"+S.toString(16):S.toString(16)}function ne(S,T){var k;T=T||1/0;for(var J=S.length,K=null,re=[],se=0;se<J;++se){if((k=S.charCodeAt(se))>55295&&k<57344){if(!K){if(k>56319){(T-=3)>-1&&re.push(239,191,189);continue}if(se+1===J){(T-=3)>-1&&re.push(239,191,189);continue}K=k;continue}if(k<56320){(T-=3)>-1&&re.push(239,191,189),K=k;continue}k=65536+(K-55296<<10|k-56320)}else K&&(T-=3)>-1&&re.push(239,191,189);if(K=null,k<128){if((T-=1)<0)break;re.push(k)}else if(k<2048){if((T-=2)<0)break;re.push(k>>6|192,63&k|128)}else if(k<65536){if((T-=3)<0)break;re.push(k>>12|224,k>>6&63|128,63&k|128)}else{if(!(k<1114112))throw new Error("Invalid code point");if((T-=4)<0)break;re.push(k>>18|240,k>>12&63|128,k>>6&63|128,63&k|128)}}return re}function Y(S){return i.toByteArray(function(T){if((T=function(k){return k.trim?k.trim():k.replace(/^\s+|\s+$/g,"")}(T).replace(Q,"")).length<2)return"";for(;T.length%4!=0;)T+="=";return T}(S))}function G(S,T,k,J){for(var K=0;K<J&&!(K+k>=T.length||K>=S.length);++K)T[K+k]=S[K];return K}}).call(this,n(6))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch{typeof window=="object"&&(n=window)}e.exports=n},function(e,t){typeof Object.create=="function"?e.exports=function(n,r){r&&(n.super_=r,n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(n,r){if(r){n.super_=r;var i=function(){};i.prototype=r.prototype,n.prototype=new i,n.prototype.constructor=n}}},function(e,t,n){n.d(t,"a",function(){return r});const r=i=>new Promise(s=>setTimeout(s,i||0))},function(e,t,n){var r=n(99),i=r,s=Function("return this")(),l=n(98);i.object.extend(proto,l),i.exportSymbol("proto.v1.signaling.api.CreatePeerRequest",null,s),i.exportSymbol("proto.v1.signaling.api.CreatePeerResponse",null,s),i.exportSymbol("proto.v1.signaling.api.DeletePeerRequest",null,s),i.exportSymbol("proto.v1.signaling.api.DeletePeerResponse",null,s),i.exportSymbol("proto.v1.signaling.api.GetHealthRequest",null,s),i.exportSymbol("proto.v1.signaling.api.GetHealthResponse",null,s),i.exportSymbol("proto.v1.signaling.api.GetIceServersRequest",null,s),i.exportSymbol("proto.v1.signaling.api.GetIceServersResponse",null,s),i.exportSymbol("proto.v1.signaling.api.GetPeersRequest",null,s),i.exportSymbol("proto.v1.signaling.api.GetPeersResponse",null,s),i.exportSymbol("proto.v1.signaling.api.Peer",null,s),i.exportSymbol("proto.v1.signaling.api.ReceiveSignalStreamRequest",null,s),i.exportSymbol("proto.v1.signaling.api.ReceiveSignalStreamResponse",null,s),i.exportSymbol("proto.v1.signaling.api.RefreshPeerRequest",null,s),i.exportSymbol("proto.v1.signaling.api.RefreshPeerResponse",null,s),i.exportSymbol("proto.v1.signaling.api.SendSignalRequest",null,s),i.exportSymbol("proto.v1.signaling.api.SendSignalResponse",null,s),i.exportSymbol("proto.v1.signaling.api.SessionType",null,s),i.exportSymbol("proto.v1.signaling.api.Signal",null,s),proto.v1.signaling.api.Peer=function(o){r.Message.initialize(this,o,0,-1,proto.v1.signaling.api.Peer.repeatedFields_,null)},i.inherits(proto.v1.signaling.api.Peer,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.Peer.displayName="proto.v1.signaling.api.Peer"),proto.v1.signaling.api.Signal=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.Signal,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.Signal.displayName="proto.v1.signaling.api.Signal"),proto.v1.signaling.api.GetHealthRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetHealthRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetHealthRequest.displayName="proto.v1.signaling.api.GetHealthRequest"),proto.v1.signaling.api.GetHealthResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetHealthResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetHealthResponse.displayName="proto.v1.signaling.api.GetHealthResponse"),proto.v1.signaling.api.CreatePeerRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.CreatePeerRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.CreatePeerRequest.displayName="proto.v1.signaling.api.CreatePeerRequest"),proto.v1.signaling.api.CreatePeerResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.CreatePeerResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.CreatePeerResponse.displayName="proto.v1.signaling.api.CreatePeerResponse"),proto.v1.signaling.api.DeletePeerRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.DeletePeerRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.DeletePeerRequest.displayName="proto.v1.signaling.api.DeletePeerRequest"),proto.v1.signaling.api.DeletePeerResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.DeletePeerResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.DeletePeerResponse.displayName="proto.v1.signaling.api.DeletePeerResponse"),proto.v1.signaling.api.RefreshPeerRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.RefreshPeerRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.RefreshPeerRequest.displayName="proto.v1.signaling.api.RefreshPeerRequest"),proto.v1.signaling.api.RefreshPeerResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.RefreshPeerResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.RefreshPeerResponse.displayName="proto.v1.signaling.api.RefreshPeerResponse"),proto.v1.signaling.api.GetPeersRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetPeersRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetPeersRequest.displayName="proto.v1.signaling.api.GetPeersRequest"),proto.v1.signaling.api.GetPeersResponse=function(o){r.Message.initialize(this,o,0,-1,proto.v1.signaling.api.GetPeersResponse.repeatedFields_,null)},i.inherits(proto.v1.signaling.api.GetPeersResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetPeersResponse.displayName="proto.v1.signaling.api.GetPeersResponse"),proto.v1.signaling.api.GetIceServersRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetIceServersRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetIceServersRequest.displayName="proto.v1.signaling.api.GetIceServersRequest"),proto.v1.signaling.api.GetIceServersResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetIceServersResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetIceServersResponse.displayName="proto.v1.signaling.api.GetIceServersResponse"),proto.v1.signaling.api.SendSignalRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.SendSignalRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.SendSignalRequest.displayName="proto.v1.signaling.api.SendSignalRequest"),proto.v1.signaling.api.SendSignalResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.SendSignalResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.SendSignalResponse.displayName="proto.v1.signaling.api.SendSignalResponse"),proto.v1.signaling.api.ReceiveSignalStreamRequest=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.ReceiveSignalStreamRequest,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.ReceiveSignalStreamRequest.displayName="proto.v1.signaling.api.ReceiveSignalStreamRequest"),proto.v1.signaling.api.ReceiveSignalStreamResponse=function(o){r.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.ReceiveSignalStreamResponse,r.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.ReceiveSignalStreamResponse.displayName="proto.v1.signaling.api.ReceiveSignalStreamResponse"),proto.v1.signaling.api.Peer.repeatedFields_=[5],r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.Peer.prototype.toObject=function(o){return proto.v1.signaling.api.Peer.toObject(o,this)},proto.v1.signaling.api.Peer.toObject=function(o,c){var u,f={peerId:r.Message.getFieldWithDefault(c,1,""),organizationId:r.Message.getFieldWithDefault(c,2,""),userId:(u=c.getUserId())&&l.StringValue.toObject(o,u),deviceId:(u=c.getDeviceId())&&l.StringValue.toObject(o,u),sessionIdsList:(u=r.Message.getRepeatedField(c,5))==null?void 0:u,peerCreatedTimestamp:(u=c.getPeerCreatedTimestamp())&&l.Int64Value.toObject(o,u)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.Peer.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.Peer;return proto.v1.signaling.api.Peer.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.Peer.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=c.readString();o.setPeerId(u);break;case 2:u=c.readString(),o.setOrganizationId(u);break;case 3:u=new l.StringValue,c.readMessage(u,l.StringValue.deserializeBinaryFromReader),o.setUserId(u);break;case 4:u=new l.StringValue,c.readMessage(u,l.StringValue.deserializeBinaryFromReader),o.setDeviceId(u);break;case 5:u=c.readString(),o.addSessionIds(u);break;case 6:u=new l.Int64Value,c.readMessage(u,l.Int64Value.deserializeBinaryFromReader),o.setPeerCreatedTimestamp(u);break;default:c.skipField()}return o},proto.v1.signaling.api.Peer.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.Peer.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.Peer.serializeBinaryToWriter=function(o,c){var u=void 0;(u=o.getPeerId()).length>0&&c.writeString(1,u),(u=o.getOrganizationId()).length>0&&c.writeString(2,u),(u=o.getUserId())!=null&&c.writeMessage(3,u,l.StringValue.serializeBinaryToWriter),(u=o.getDeviceId())!=null&&c.writeMessage(4,u,l.StringValue.serializeBinaryToWriter),(u=o.getSessionIdsList()).length>0&&c.writeRepeatedString(5,u),(u=o.getPeerCreatedTimestamp())!=null&&c.writeMessage(6,u,l.Int64Value.serializeBinaryToWriter)},proto.v1.signaling.api.Peer.prototype.getPeerId=function(){return r.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.Peer.prototype.setPeerId=function(o){return r.Message.setProto3StringField(this,1,o)},proto.v1.signaling.api.Peer.prototype.getOrganizationId=function(){return r.Message.getFieldWithDefault(this,2,"")},proto.v1.signaling.api.Peer.prototype.setOrganizationId=function(o){return r.Message.setProto3StringField(this,2,o)},proto.v1.signaling.api.Peer.prototype.getUserId=function(){return r.Message.getWrapperField(this,l.StringValue,3)},proto.v1.signaling.api.Peer.prototype.setUserId=function(o){return r.Message.setWrapperField(this,3,o)},proto.v1.signaling.api.Peer.prototype.clearUserId=function(){return this.setUserId(void 0)},proto.v1.signaling.api.Peer.prototype.hasUserId=function(){return r.Message.getField(this,3)!=null},proto.v1.signaling.api.Peer.prototype.getDeviceId=function(){return r.Message.getWrapperField(this,l.StringValue,4)},proto.v1.signaling.api.Peer.prototype.setDeviceId=function(o){return r.Message.setWrapperField(this,4,o)},proto.v1.signaling.api.Peer.prototype.clearDeviceId=function(){return this.setDeviceId(void 0)},proto.v1.signaling.api.Peer.prototype.hasDeviceId=function(){return r.Message.getField(this,4)!=null},proto.v1.signaling.api.Peer.prototype.getSessionIdsList=function(){return r.Message.getRepeatedField(this,5)},proto.v1.signaling.api.Peer.prototype.setSessionIdsList=function(o){return r.Message.setField(this,5,o||[])},proto.v1.signaling.api.Peer.prototype.addSessionIds=function(o,c){return r.Message.addToRepeatedField(this,5,o,c)},proto.v1.signaling.api.Peer.prototype.clearSessionIdsList=function(){return this.setSessionIdsList([])},proto.v1.signaling.api.Peer.prototype.getPeerCreatedTimestamp=function(){return r.Message.getWrapperField(this,l.Int64Value,6)},proto.v1.signaling.api.Peer.prototype.setPeerCreatedTimestamp=function(o){return r.Message.setWrapperField(this,6,o)},proto.v1.signaling.api.Peer.prototype.clearPeerCreatedTimestamp=function(){return this.setPeerCreatedTimestamp(void 0)},proto.v1.signaling.api.Peer.prototype.hasPeerCreatedTimestamp=function(){return r.Message.getField(this,6)!=null},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.Signal.prototype.toObject=function(o){return proto.v1.signaling.api.Signal.toObject(o,this)},proto.v1.signaling.api.Signal.toObject=function(o,c){var u,f={sessionId:(u=c.getSessionId())&&l.StringValue.toObject(o,u),sessionCreatedTimestamp:(u=c.getSessionCreatedTimestamp())&&l.Int64Value.toObject(o,u),senderId:r.Message.getFieldWithDefault(c,3,""),receiverId:r.Message.getFieldWithDefault(c,4,""),payload:r.Message.getFieldWithDefault(c,5,""),iceServers:r.Message.getFieldWithDefault(c,6,""),iceTransportPolicy:r.Message.getFieldWithDefault(c,7,""),sessionType:r.Message.getFieldWithDefault(c,8,0)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.Signal.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.Signal;return proto.v1.signaling.api.Signal.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.Signal.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new l.StringValue;c.readMessage(u,l.StringValue.deserializeBinaryFromReader),o.setSessionId(u);break;case 2:u=new l.Int64Value,c.readMessage(u,l.Int64Value.deserializeBinaryFromReader),o.setSessionCreatedTimestamp(u);break;case 3:u=c.readString(),o.setSenderId(u);break;case 4:u=c.readString(),o.setReceiverId(u);break;case 5:u=c.readString(),o.setPayload(u);break;case 6:u=c.readString(),o.setIceServers(u);break;case 7:u=c.readString(),o.setIceTransportPolicy(u);break;case 8:u=c.readEnum(),o.setSessionType(u);break;default:c.skipField()}return o},proto.v1.signaling.api.Signal.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.Signal.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.Signal.serializeBinaryToWriter=function(o,c){var u=void 0;(u=o.getSessionId())!=null&&c.writeMessage(1,u,l.StringValue.serializeBinaryToWriter),(u=o.getSessionCreatedTimestamp())!=null&&c.writeMessage(2,u,l.Int64Value.serializeBinaryToWriter),(u=o.getSenderId()).length>0&&c.writeString(3,u),(u=o.getReceiverId()).length>0&&c.writeString(4,u),(u=o.getPayload()).length>0&&c.writeString(5,u),(u=o.getIceServers()).length>0&&c.writeString(6,u),(u=o.getIceTransportPolicy()).length>0&&c.writeString(7,u),(u=o.getSessionType())!==0&&c.writeEnum(8,u)},proto.v1.signaling.api.Signal.prototype.getSessionId=function(){return r.Message.getWrapperField(this,l.StringValue,1)},proto.v1.signaling.api.Signal.prototype.setSessionId=function(o){return r.Message.setWrapperField(this,1,o)},proto.v1.signaling.api.Signal.prototype.clearSessionId=function(){return this.setSessionId(void 0)},proto.v1.signaling.api.Signal.prototype.hasSessionId=function(){return r.Message.getField(this,1)!=null},proto.v1.signaling.api.Signal.prototype.getSessionCreatedTimestamp=function(){return r.Message.getWrapperField(this,l.Int64Value,2)},proto.v1.signaling.api.Signal.prototype.setSessionCreatedTimestamp=function(o){return r.Message.setWrapperField(this,2,o)},proto.v1.signaling.api.Signal.prototype.clearSessionCreatedTimestamp=function(){return this.setSessionCreatedTimestamp(void 0)},proto.v1.signaling.api.Signal.prototype.hasSessionCreatedTimestamp=function(){return r.Message.getField(this,2)!=null},proto.v1.signaling.api.Signal.prototype.getSenderId=function(){return r.Message.getFieldWithDefault(this,3,"")},proto.v1.signaling.api.Signal.prototype.setSenderId=function(o){return r.Message.setProto3StringField(this,3,o)},proto.v1.signaling.api.Signal.prototype.getReceiverId=function(){return r.Message.getFieldWithDefault(this,4,"")},proto.v1.signaling.api.Signal.prototype.setReceiverId=function(o){return r.Message.setProto3StringField(this,4,o)},proto.v1.signaling.api.Signal.prototype.getPayload=function(){return r.Message.getFieldWithDefault(this,5,"")},proto.v1.signaling.api.Signal.prototype.setPayload=function(o){return r.Message.setProto3StringField(this,5,o)},proto.v1.signaling.api.Signal.prototype.getIceServers=function(){return r.Message.getFieldWithDefault(this,6,"")},proto.v1.signaling.api.Signal.prototype.setIceServers=function(o){return r.Message.setProto3StringField(this,6,o)},proto.v1.signaling.api.Signal.prototype.getIceTransportPolicy=function(){return r.Message.getFieldWithDefault(this,7,"")},proto.v1.signaling.api.Signal.prototype.setIceTransportPolicy=function(o){return r.Message.setProto3StringField(this,7,o)},proto.v1.signaling.api.Signal.prototype.getSessionType=function(){return r.Message.getFieldWithDefault(this,8,0)},proto.v1.signaling.api.Signal.prototype.setSessionType=function(o){return r.Message.setProto3EnumField(this,8,o)},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.GetHealthRequest.prototype.toObject=function(o){return proto.v1.signaling.api.GetHealthRequest.toObject(o,this)},proto.v1.signaling.api.GetHealthRequest.toObject=function(o,c){var u={};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.GetHealthRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.GetHealthRequest;return proto.v1.signaling.api.GetHealthRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.GetHealthRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)c.getFieldNumber(),c.skipField();return o},proto.v1.signaling.api.GetHealthRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.GetHealthRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetHealthRequest.serializeBinaryToWriter=function(o,c){},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.GetHealthResponse.prototype.toObject=function(o){return proto.v1.signaling.api.GetHealthResponse.toObject(o,this)},proto.v1.signaling.api.GetHealthResponse.toObject=function(o,c){var u={version:r.Message.getFieldWithDefault(c,1,"")};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.GetHealthResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.GetHealthResponse;return proto.v1.signaling.api.GetHealthResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.GetHealthResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=c.readString();o.setVersion(u);break;default:c.skipField()}return o},proto.v1.signaling.api.GetHealthResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.GetHealthResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetHealthResponse.serializeBinaryToWriter=function(o,c){var u;(u=o.getVersion()).length>0&&c.writeString(1,u)},proto.v1.signaling.api.GetHealthResponse.prototype.getVersion=function(){return r.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.GetHealthResponse.prototype.setVersion=function(o){return r.Message.setProto3StringField(this,1,o)},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.CreatePeerRequest.prototype.toObject=function(o){return proto.v1.signaling.api.CreatePeerRequest.toObject(o,this)},proto.v1.signaling.api.CreatePeerRequest.toObject=function(o,c){var u={};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.CreatePeerRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.CreatePeerRequest;return proto.v1.signaling.api.CreatePeerRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.CreatePeerRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)c.getFieldNumber(),c.skipField();return o},proto.v1.signaling.api.CreatePeerRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.CreatePeerRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.CreatePeerRequest.serializeBinaryToWriter=function(o,c){},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.CreatePeerResponse.prototype.toObject=function(o){return proto.v1.signaling.api.CreatePeerResponse.toObject(o,this)},proto.v1.signaling.api.CreatePeerResponse.toObject=function(o,c){var u,f={peer:(u=c.getPeer())&&proto.v1.signaling.api.Peer.toObject(o,u)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.CreatePeerResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.CreatePeerResponse;return proto.v1.signaling.api.CreatePeerResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.CreatePeerResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Peer;c.readMessage(u,proto.v1.signaling.api.Peer.deserializeBinaryFromReader),o.setPeer(u);break;default:c.skipField()}return o},proto.v1.signaling.api.CreatePeerResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.CreatePeerResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.CreatePeerResponse.serializeBinaryToWriter=function(o,c){var u;(u=o.getPeer())!=null&&c.writeMessage(1,u,proto.v1.signaling.api.Peer.serializeBinaryToWriter)},proto.v1.signaling.api.CreatePeerResponse.prototype.getPeer=function(){return r.Message.getWrapperField(this,proto.v1.signaling.api.Peer,1)},proto.v1.signaling.api.CreatePeerResponse.prototype.setPeer=function(o){return r.Message.setWrapperField(this,1,o)},proto.v1.signaling.api.CreatePeerResponse.prototype.clearPeer=function(){return this.setPeer(void 0)},proto.v1.signaling.api.CreatePeerResponse.prototype.hasPeer=function(){return r.Message.getField(this,1)!=null},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.DeletePeerRequest.prototype.toObject=function(o){return proto.v1.signaling.api.DeletePeerRequest.toObject(o,this)},proto.v1.signaling.api.DeletePeerRequest.toObject=function(o,c){var u={peerId:r.Message.getFieldWithDefault(c,1,"")};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.DeletePeerRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.DeletePeerRequest;return proto.v1.signaling.api.DeletePeerRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.DeletePeerRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=c.readString();o.setPeerId(u);break;default:c.skipField()}return o},proto.v1.signaling.api.DeletePeerRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.DeletePeerRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.DeletePeerRequest.serializeBinaryToWriter=function(o,c){var u;(u=o.getPeerId()).length>0&&c.writeString(1,u)},proto.v1.signaling.api.DeletePeerRequest.prototype.getPeerId=function(){return r.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.DeletePeerRequest.prototype.setPeerId=function(o){return r.Message.setProto3StringField(this,1,o)},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.DeletePeerResponse.prototype.toObject=function(o){return proto.v1.signaling.api.DeletePeerResponse.toObject(o,this)},proto.v1.signaling.api.DeletePeerResponse.toObject=function(o,c){var u={};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.DeletePeerResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.DeletePeerResponse;return proto.v1.signaling.api.DeletePeerResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.DeletePeerResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)c.getFieldNumber(),c.skipField();return o},proto.v1.signaling.api.DeletePeerResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.DeletePeerResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.DeletePeerResponse.serializeBinaryToWriter=function(o,c){},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.RefreshPeerRequest.prototype.toObject=function(o){return proto.v1.signaling.api.RefreshPeerRequest.toObject(o,this)},proto.v1.signaling.api.RefreshPeerRequest.toObject=function(o,c){var u,f={peer:(u=c.getPeer())&&proto.v1.signaling.api.Peer.toObject(o,u)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.RefreshPeerRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.RefreshPeerRequest;return proto.v1.signaling.api.RefreshPeerRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.RefreshPeerRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Peer;c.readMessage(u,proto.v1.signaling.api.Peer.deserializeBinaryFromReader),o.setPeer(u);break;default:c.skipField()}return o},proto.v1.signaling.api.RefreshPeerRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.RefreshPeerRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.RefreshPeerRequest.serializeBinaryToWriter=function(o,c){var u;(u=o.getPeer())!=null&&c.writeMessage(1,u,proto.v1.signaling.api.Peer.serializeBinaryToWriter)},proto.v1.signaling.api.RefreshPeerRequest.prototype.getPeer=function(){return r.Message.getWrapperField(this,proto.v1.signaling.api.Peer,1)},proto.v1.signaling.api.RefreshPeerRequest.prototype.setPeer=function(o){return r.Message.setWrapperField(this,1,o)},proto.v1.signaling.api.RefreshPeerRequest.prototype.clearPeer=function(){return this.setPeer(void 0)},proto.v1.signaling.api.RefreshPeerRequest.prototype.hasPeer=function(){return r.Message.getField(this,1)!=null},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.RefreshPeerResponse.prototype.toObject=function(o){return proto.v1.signaling.api.RefreshPeerResponse.toObject(o,this)},proto.v1.signaling.api.RefreshPeerResponse.toObject=function(o,c){var u={};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.RefreshPeerResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.RefreshPeerResponse;return proto.v1.signaling.api.RefreshPeerResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.RefreshPeerResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)c.getFieldNumber(),c.skipField();return o},proto.v1.signaling.api.RefreshPeerResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.RefreshPeerResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.RefreshPeerResponse.serializeBinaryToWriter=function(o,c){},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.GetPeersRequest.prototype.toObject=function(o){return proto.v1.signaling.api.GetPeersRequest.toObject(o,this)},proto.v1.signaling.api.GetPeersRequest.toObject=function(o,c){var u={};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.GetPeersRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.GetPeersRequest;return proto.v1.signaling.api.GetPeersRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.GetPeersRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)c.getFieldNumber(),c.skipField();return o},proto.v1.signaling.api.GetPeersRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.GetPeersRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetPeersRequest.serializeBinaryToWriter=function(o,c){},proto.v1.signaling.api.GetPeersResponse.repeatedFields_=[1],r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.GetPeersResponse.prototype.toObject=function(o){return proto.v1.signaling.api.GetPeersResponse.toObject(o,this)},proto.v1.signaling.api.GetPeersResponse.toObject=function(o,c){var u={peersList:r.Message.toObjectList(c.getPeersList(),proto.v1.signaling.api.Peer.toObject,o)};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.GetPeersResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.GetPeersResponse;return proto.v1.signaling.api.GetPeersResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.GetPeersResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Peer;c.readMessage(u,proto.v1.signaling.api.Peer.deserializeBinaryFromReader),o.addPeers(u);break;default:c.skipField()}return o},proto.v1.signaling.api.GetPeersResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.GetPeersResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetPeersResponse.serializeBinaryToWriter=function(o,c){var u;(u=o.getPeersList()).length>0&&c.writeRepeatedMessage(1,u,proto.v1.signaling.api.Peer.serializeBinaryToWriter)},proto.v1.signaling.api.GetPeersResponse.prototype.getPeersList=function(){return r.Message.getRepeatedWrapperField(this,proto.v1.signaling.api.Peer,1)},proto.v1.signaling.api.GetPeersResponse.prototype.setPeersList=function(o){return r.Message.setRepeatedWrapperField(this,1,o)},proto.v1.signaling.api.GetPeersResponse.prototype.addPeers=function(o,c){return r.Message.addToRepeatedWrapperField(this,1,o,proto.v1.signaling.api.Peer,c)},proto.v1.signaling.api.GetPeersResponse.prototype.clearPeersList=function(){return this.setPeersList([])},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.GetIceServersRequest.prototype.toObject=function(o){return proto.v1.signaling.api.GetIceServersRequest.toObject(o,this)},proto.v1.signaling.api.GetIceServersRequest.toObject=function(o,c){var u={};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.GetIceServersRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.GetIceServersRequest;return proto.v1.signaling.api.GetIceServersRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.GetIceServersRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)c.getFieldNumber(),c.skipField();return o},proto.v1.signaling.api.GetIceServersRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.GetIceServersRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetIceServersRequest.serializeBinaryToWriter=function(o,c){},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.GetIceServersResponse.prototype.toObject=function(o){return proto.v1.signaling.api.GetIceServersResponse.toObject(o,this)},proto.v1.signaling.api.GetIceServersResponse.toObject=function(o,c){var u={iceServers:r.Message.getFieldWithDefault(c,1,"")};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.GetIceServersResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.GetIceServersResponse;return proto.v1.signaling.api.GetIceServersResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.GetIceServersResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=c.readString();o.setIceServers(u);break;default:c.skipField()}return o},proto.v1.signaling.api.GetIceServersResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.GetIceServersResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetIceServersResponse.serializeBinaryToWriter=function(o,c){var u;(u=o.getIceServers()).length>0&&c.writeString(1,u)},proto.v1.signaling.api.GetIceServersResponse.prototype.getIceServers=function(){return r.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.GetIceServersResponse.prototype.setIceServers=function(o){return r.Message.setProto3StringField(this,1,o)},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.SendSignalRequest.prototype.toObject=function(o){return proto.v1.signaling.api.SendSignalRequest.toObject(o,this)},proto.v1.signaling.api.SendSignalRequest.toObject=function(o,c){var u,f={signal:(u=c.getSignal())&&proto.v1.signaling.api.Signal.toObject(o,u)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.SendSignalRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.SendSignalRequest;return proto.v1.signaling.api.SendSignalRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.SendSignalRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Signal;c.readMessage(u,proto.v1.signaling.api.Signal.deserializeBinaryFromReader),o.setSignal(u);break;default:c.skipField()}return o},proto.v1.signaling.api.SendSignalRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.SendSignalRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.SendSignalRequest.serializeBinaryToWriter=function(o,c){var u;(u=o.getSignal())!=null&&c.writeMessage(1,u,proto.v1.signaling.api.Signal.serializeBinaryToWriter)},proto.v1.signaling.api.SendSignalRequest.prototype.getSignal=function(){return r.Message.getWrapperField(this,proto.v1.signaling.api.Signal,1)},proto.v1.signaling.api.SendSignalRequest.prototype.setSignal=function(o){return r.Message.setWrapperField(this,1,o)},proto.v1.signaling.api.SendSignalRequest.prototype.clearSignal=function(){return this.setSignal(void 0)},proto.v1.signaling.api.SendSignalRequest.prototype.hasSignal=function(){return r.Message.getField(this,1)!=null},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.SendSignalResponse.prototype.toObject=function(o){return proto.v1.signaling.api.SendSignalResponse.toObject(o,this)},proto.v1.signaling.api.SendSignalResponse.toObject=function(o,c){var u,f={sessionId:(u=c.getSessionId())&&l.StringValue.toObject(o,u),sessionCreatedTimestamp:(u=c.getSessionCreatedTimestamp())&&l.Int64Value.toObject(o,u)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.SendSignalResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.SendSignalResponse;return proto.v1.signaling.api.SendSignalResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.SendSignalResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new l.StringValue;c.readMessage(u,l.StringValue.deserializeBinaryFromReader),o.setSessionId(u);break;case 2:u=new l.Int64Value,c.readMessage(u,l.Int64Value.deserializeBinaryFromReader),o.setSessionCreatedTimestamp(u);break;default:c.skipField()}return o},proto.v1.signaling.api.SendSignalResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.SendSignalResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.SendSignalResponse.serializeBinaryToWriter=function(o,c){var u=void 0;(u=o.getSessionId())!=null&&c.writeMessage(1,u,l.StringValue.serializeBinaryToWriter),(u=o.getSessionCreatedTimestamp())!=null&&c.writeMessage(2,u,l.Int64Value.serializeBinaryToWriter)},proto.v1.signaling.api.SendSignalResponse.prototype.getSessionId=function(){return r.Message.getWrapperField(this,l.StringValue,1)},proto.v1.signaling.api.SendSignalResponse.prototype.setSessionId=function(o){return r.Message.setWrapperField(this,1,o)},proto.v1.signaling.api.SendSignalResponse.prototype.clearSessionId=function(){return this.setSessionId(void 0)},proto.v1.signaling.api.SendSignalResponse.prototype.hasSessionId=function(){return r.Message.getField(this,1)!=null},proto.v1.signaling.api.SendSignalResponse.prototype.getSessionCreatedTimestamp=function(){return r.Message.getWrapperField(this,l.Int64Value,2)},proto.v1.signaling.api.SendSignalResponse.prototype.setSessionCreatedTimestamp=function(o){return r.Message.setWrapperField(this,2,o)},proto.v1.signaling.api.SendSignalResponse.prototype.clearSessionCreatedTimestamp=function(){return this.setSessionCreatedTimestamp(void 0)},proto.v1.signaling.api.SendSignalResponse.prototype.hasSessionCreatedTimestamp=function(){return r.Message.getField(this,2)!=null},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.toObject=function(o){return proto.v1.signaling.api.ReceiveSignalStreamRequest.toObject(o,this)},proto.v1.signaling.api.ReceiveSignalStreamRequest.toObject=function(o,c){var u={peerId:r.Message.getFieldWithDefault(c,1,"")};return o&&(u.$jspbMessageInstance=c),u}),proto.v1.signaling.api.ReceiveSignalStreamRequest.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.ReceiveSignalStreamRequest;return proto.v1.signaling.api.ReceiveSignalStreamRequest.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.ReceiveSignalStreamRequest.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=c.readString();o.setPeerId(u);break;default:c.skipField()}return o},proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.ReceiveSignalStreamRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.ReceiveSignalStreamRequest.serializeBinaryToWriter=function(o,c){var u;(u=o.getPeerId()).length>0&&c.writeString(1,u)},proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.getPeerId=function(){return r.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.setPeerId=function(o){return r.Message.setProto3StringField(this,1,o)},r.Message.GENERATE_TO_OBJECT&&(proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.toObject=function(o){return proto.v1.signaling.api.ReceiveSignalStreamResponse.toObject(o,this)},proto.v1.signaling.api.ReceiveSignalStreamResponse.toObject=function(o,c){var u,f={signal:(u=c.getSignal())&&proto.v1.signaling.api.Signal.toObject(o,u)};return o&&(f.$jspbMessageInstance=c),f}),proto.v1.signaling.api.ReceiveSignalStreamResponse.deserializeBinary=function(o){var c=new r.BinaryReader(o),u=new proto.v1.signaling.api.ReceiveSignalStreamResponse;return proto.v1.signaling.api.ReceiveSignalStreamResponse.deserializeBinaryFromReader(u,c)},proto.v1.signaling.api.ReceiveSignalStreamResponse.deserializeBinaryFromReader=function(o,c){for(;c.nextField()&&!c.isEndGroup();)switch(c.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Signal;c.readMessage(u,proto.v1.signaling.api.Signal.deserializeBinaryFromReader),o.setSignal(u);break;default:c.skipField()}return o},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.serializeBinary=function(){var o=new r.BinaryWriter;return proto.v1.signaling.api.ReceiveSignalStreamResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.ReceiveSignalStreamResponse.serializeBinaryToWriter=function(o,c){var u;(u=o.getSignal())!=null&&c.writeMessage(1,u,proto.v1.signaling.api.Signal.serializeBinaryToWriter)},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.getSignal=function(){return r.Message.getWrapperField(this,proto.v1.signaling.api.Signal,1)},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.setSignal=function(o){return r.Message.setWrapperField(this,1,o)},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.clearSignal=function(){return this.setSignal(void 0)},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.hasSignal=function(){return r.Message.getField(this,1)!=null},proto.v1.signaling.api.SessionType={UNKNOWN:0,TELEOP:1,PORT_FORWARD:2,OBSERVE:3},i.object.extend(t,proto.v1.signaling.api)},function(e,t,n){n.d(t,"a",function(){return i});var r=n(34);class i extends Error{constructor(l,o,c,u,f={},E){super(`Unexpected response (${c}) for ${l} ${o}: ${JSON.stringify(E?Object(r.a)([...E.entries()].reduce((b,[h,g])=>(b[h]=g,b),{})):{})} -- ${JSON.stringify(Object(r.a)(u))}`),this.method=l,this.url=o,this.statusCode=c,this.body=u,this.validationErrors=f,this.headers=E}}},function(e,t,n){function r(i,s,l=()=>!0){if(function(o,c,u=()=>!0){return o instanceof c&&u(o)}(i,s,l))return i;throw i}n.d(t,"a",function(){return r})},function(e,t,n){function r(b){return(r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h})(b)}function i(b,h){return!h||r(h)!=="object"&&typeof h!="function"?s(b):h}function s(b){if(b===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b}function l(b){var h=typeof Map=="function"?new Map:void 0;return(l=function(g){if(g===null||(_=g,Function.toString.call(_).indexOf("[native code]")===-1))return g;var _;if(typeof g!="function")throw new TypeError("Super expression must either be null or a function");if(h!==void 0){if(h.has(g))return h.get(g);h.set(g,R)}function R(){return o(g,arguments,f(this).constructor)}return R.prototype=Object.create(g.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),u(R,g)})(b)}function o(b,h,g){return(o=c()?Reflect.construct:function(_,R,x){var F=[null];F.push.apply(F,R);var M=new(Function.bind.apply(_,F));return x&&u(M,x.prototype),M}).apply(null,arguments)}function c(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function u(b,h){return(u=Object.setPrototypeOf||function(g,_){return g.__proto__=_,g})(b,h)}function f(b){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(h){return h.__proto__||Object.getPrototypeOf(h)})(b)}var E=function(b){(function(x,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function");x.prototype=Object.create(F&&F.prototype,{constructor:{value:x,writable:!0,configurable:!0}}),F&&u(x,F)})(R,b);var h,g,_=(h=R,g=c(),function(){var x,F=f(h);if(g){var M=f(this).constructor;x=Reflect.construct(F,arguments,M)}else x=F.apply(this,arguments);return i(this,x)});function R(x){var F;return function(M,A){if(!(M instanceof A))throw new TypeError("Cannot call a class as a function")}(this,R),F=_.call(this,`Format functions must be synchronous taking a two arguments: (info, opts)
8
8
  Found: `.concat(x.toString().split(`
9
9
  `)[0],`
@@ -0,0 +1 @@
1
+ export declare const FORMANT_API_URL: any;
@@ -0,0 +1,6 @@
1
+ interface IHasString {
2
+ get(key: string): string | null;
3
+ has(key: string): boolean;
4
+ }
5
+ export declare function whichFormantApiUrl(global: any, urlParams: IHasString): any;
6
+ export {};
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  }
25
25
  }
26
26
  },
27
- "version": "1.0.0",
27
+ "version": "1.1.0-rc.0",
28
28
  "scripts": {
29
29
  "preversion": "npm run test && tsc --project ./configs/tsconfig.type-check.json",
30
30
  "postversion": "make",
@@ -50,7 +50,7 @@
50
50
  "prettier": "2.8.8",
51
51
  "typedoc": "^0.24.6",
52
52
  "typescript": "^5.0.4",
53
- "vite": "^4.3.3",
53
+ "vite": "^4.3.9",
54
54
  "vitest": "^0.30.1"
55
55
  },
56
56
  "types": "./dist/types/data-sdk/src/main.d.ts",
@@ -1 +0,0 @@
1
- export declare let FORMANT_API_URL: string;