@formant/data-sdk 0.0.61 → 0.0.64

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.
Files changed (83) hide show
  1. package/dist/data-sdk.es.js +45 -13
  2. package/dist/data-sdk.umd.js +6 -6
  3. package/dist/types/data-sdk/src/Device.d.ts +1 -0
  4. package/dist/types/data-sdk/src/Fleet.d.ts +6 -1
  5. package/dist/types/data-sdk/src/model/AggregateLevel.d.ts +1 -0
  6. package/dist/types/data-sdk/src/model/AnnotationAreaType.d.ts +2 -0
  7. package/dist/types/data-sdk/src/model/EventSortableColumn.d.ts +1 -0
  8. package/dist/types/data-sdk/src/model/EventType.d.ts +2 -0
  9. package/dist/types/data-sdk/src/model/HealthStatus.d.ts +2 -0
  10. package/dist/types/data-sdk/src/model/HexRgbColor.d.ts +1 -0
  11. package/dist/types/data-sdk/src/model/IAnnotation.d.ts +13 -0
  12. package/dist/types/data-sdk/src/model/IAnnotationAreaTypeMap.d.ts +4 -0
  13. package/dist/types/data-sdk/src/model/IBaseEntity.d.ts +7 -0
  14. package/dist/types/data-sdk/src/model/IBaseEvent.d.ts +19 -0
  15. package/dist/types/data-sdk/src/model/IBattery.d.ts +6 -0
  16. package/dist/types/data-sdk/src/model/IBitset.d.ts +4 -0
  17. package/dist/types/data-sdk/src/model/IBoundingBox.d.ts +6 -0
  18. package/dist/types/data-sdk/src/model/ICommandDeliveryEvent.d.ts +3 -0
  19. package/dist/types/data-sdk/src/model/ICommandEventBase.d.ts +5 -0
  20. package/dist/types/data-sdk/src/model/ICommandRequestEvent.d.ts +5 -0
  21. package/dist/types/data-sdk/src/model/ICommandResponseEvent.d.ts +3 -0
  22. package/dist/types/data-sdk/src/model/IComment.d.ts +7 -0
  23. package/dist/types/data-sdk/src/model/ICustomEvent.d.ts +5 -0
  24. package/dist/types/data-sdk/src/model/IDataPoint.d.ts +7 -0
  25. package/dist/types/data-sdk/src/model/IEvent.d.ts +12 -0
  26. package/dist/types/data-sdk/src/model/IEventFilter.d.ts +19 -0
  27. package/dist/types/data-sdk/src/model/IEventQuery.d.ts +7 -0
  28. package/dist/types/data-sdk/src/model/IEventSort.d.ts +6 -0
  29. package/dist/types/data-sdk/src/model/IFile.d.ts +6 -0
  30. package/dist/types/data-sdk/src/model/IFilter.d.ts +10 -0
  31. package/dist/types/data-sdk/src/model/IGoal.d.ts +5 -0
  32. package/dist/types/data-sdk/src/model/IHealth.d.ts +4 -0
  33. package/dist/types/data-sdk/src/model/IImage.d.ts +6 -0
  34. package/dist/types/data-sdk/src/model/IImageAnnotation.d.ts +9 -0
  35. package/dist/types/data-sdk/src/model/IInterventionRequest.d.ts +9 -0
  36. package/dist/types/data-sdk/src/model/IInterventionResponse.d.ts +10 -0
  37. package/dist/types/data-sdk/src/model/IInterventionTypeMap.d.ts +20 -0
  38. package/dist/types/data-sdk/src/model/ILabel.d.ts +4 -0
  39. package/dist/types/data-sdk/src/model/ILabeledPolygon.d.ts +4 -0
  40. package/dist/types/data-sdk/src/model/ILabelingRequestData.d.ts +8 -0
  41. package/dist/types/data-sdk/src/model/ILabelingResponseData.d.ts +4 -0
  42. package/dist/types/data-sdk/src/model/ILocalization.d.ts +12 -0
  43. package/dist/types/data-sdk/src/model/ILocation.d.ts +6 -0
  44. package/dist/types/data-sdk/src/model/IMap.d.ts +10 -0
  45. package/dist/types/data-sdk/src/model/INumericSetEntry.d.ts +5 -0
  46. package/dist/types/data-sdk/src/model/IOdometry.d.ts +7 -0
  47. package/dist/types/data-sdk/src/model/IPath.d.ts +5 -0
  48. package/dist/types/data-sdk/src/model/IPointCloud.d.ts +6 -0
  49. package/dist/types/data-sdk/src/model/IPortForwardingSessionRecord.d.ts +3 -0
  50. package/dist/types/data-sdk/src/model/IQuaternion.d.ts +6 -0
  51. package/dist/types/data-sdk/src/model/IQuery.d.ts +8 -0
  52. package/dist/types/data-sdk/src/model/IRtcSessionRecord.d.ts +9 -0
  53. package/dist/types/data-sdk/src/model/ISelectionRequestData.d.ts +6 -0
  54. package/dist/types/data-sdk/src/model/ISelectionResponseData.d.ts +3 -0
  55. package/dist/types/data-sdk/src/model/ISpreadsheetIdRange.d.ts +4 -0
  56. package/dist/types/data-sdk/src/model/IStreamData.d.ts +11 -0
  57. package/dist/types/data-sdk/src/model/IStreamTypeMap.d.ts +27 -0
  58. package/dist/types/data-sdk/src/model/ISystemEvent.d.ts +3 -0
  59. package/dist/types/data-sdk/src/model/ITagSets.d.ts +3 -0
  60. package/dist/types/data-sdk/src/model/ITaggedUsers.d.ts +4 -0
  61. package/dist/types/data-sdk/src/model/ITags.d.ts +3 -0
  62. package/dist/types/data-sdk/src/model/ITeleopRequestData.d.ts +3 -0
  63. package/dist/types/data-sdk/src/model/ITeleopResponseData.d.ts +4 -0
  64. package/dist/types/data-sdk/src/model/ITeleopSessionRecord.d.ts +3 -0
  65. package/dist/types/data-sdk/src/model/ITransform.d.ts +6 -0
  66. package/dist/types/data-sdk/src/model/ITransformNode.d.ts +7 -0
  67. package/dist/types/data-sdk/src/model/ITriggeredEvent.d.ts +10 -0
  68. package/dist/types/data-sdk/src/model/ITwist.d.ts +5 -0
  69. package/dist/types/data-sdk/src/model/IVector3.d.ts +5 -0
  70. package/dist/types/data-sdk/src/model/IVideo.d.ts +7 -0
  71. package/dist/types/data-sdk/src/model/InterventionType.d.ts +2 -0
  72. package/dist/types/data-sdk/src/model/IsoDate.d.ts +1 -0
  73. package/dist/types/data-sdk/src/model/Severity.d.ts +2 -0
  74. package/dist/types/data-sdk/src/model/SortOrder.d.ts +1 -0
  75. package/dist/types/data-sdk/src/model/StreamType.d.ts +2 -0
  76. package/dist/types/data-sdk/src/model/Timestamp.d.ts +1 -0
  77. package/dist/types/data-sdk/src/model/Uuid.d.ts +1 -0
  78. package/dist/types/data-sdk/src/model/VideoMimeType.d.ts +2 -0
  79. package/dist/types/data-sdk/src/model/eventTypes.d.ts +1 -0
  80. package/dist/types/data-sdk/src/model/healthStatuses.d.ts +1 -0
  81. package/dist/types/data-sdk/src/model/severities.d.ts +1 -0
  82. package/dist/types/data-sdk/src/model/videoMimeTypes.d.ts +1 -0
  83. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- var lr=Object.defineProperty;var Zt=Object.getOwnPropertySymbols;var ur=Object.prototype.hasOwnProperty,gr=Object.prototype.propertyIsEnumerable;var Et=(Ee,Re,e)=>Re in Ee?lr(Ee,Re,{enumerable:!0,configurable:!0,writable:!0,value:e}):Ee[Re]=e,st=(Ee,Re)=>{for(var e in Re||(Re={}))ur.call(Re,e)&&Et(Ee,e,Re[e]);if(Zt)for(var e of Zt(Re))gr.call(Re,e)&&Et(Ee,e,Re[e]);return Ee};var Ce=(Ee,Re,e)=>(Et(Ee,typeof Re!="symbol"?Re+"":Re,e),e);(function(Ee,Re){typeof exports=="object"&&typeof module!="undefined"?Re(exports):typeof define=="function"&&define.amd?define(["exports"],Re):(Ee=typeof globalThis!="undefined"?globalThis:Ee||self,Re(Ee.FormantDataSDK={}))})(this,function(exports){"use strict";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 m,R,y=u[0],S=u[1],c=0,w=[];c<y.length;c++)R=y[c],Object.prototype.hasOwnProperty.call(n,R)&&n[R]&&w.push(n[R][0]),n[R]=0;for(m in S)Object.prototype.hasOwnProperty.call(S,m)&&(e[m]=S[m]);for(l&&l(u);w.length;)w.shift()()}var r={},n={0:0};function i(u){if(r[u])return r[u].exports;var m=r[u]={i:u,l:!1,exports:{}};return e[u].call(m.exports,m,m.exports,i),m.l=!0,m.exports}i.e=function(){return Promise.resolve()},i.m=e,i.c=r,i.d=function(u,m,R){i.o(u,m)||Object.defineProperty(u,m,{enumerable:!0,get:R})},i.r=function(u){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},i.t=function(u,m){if(1&m&&(u=i(u)),8&m||4&m&&typeof u=="object"&&u&&u.__esModule)return u;var R=Object.create(null);if(i.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:u}),2&m&&typeof u!="string")for(var y in u)i.d(R,y,function(S){return u[S]}.bind(null,y));return R},i.n=function(u){var m=u&&u.__esModule?function(){return u.default}:function(){return u};return i.d(m,"a",m),m},i.o=function(u,m){return Object.prototype.hasOwnProperty.call(u,m)},i.p="",i.oe=function(u){throw console.error(u),u};var g=window.webpackJsonpFormantRealtimeSDK=window.webpackJsonpFormantRealtimeSDK||[],s=g.push.bind(g);g.push=t,g=g.slice();for(var o=0;o<g.length;o++)t(g[o]);var l=s;return i(i.s=228)}([function(e,t,r){r.d(t,"a",function(){return D});const n=Math.pow(2,20),i=n;var g=r(54),s=r(15),o=r(53),l=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),u=new Uint8Array(16);function m(){if(!l)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(u)}for(var R=[],y=0;y<256;++y)R[y]=(y+256).toString(16).substr(1);var S=function(T,C){var U=C||0,b=R;return[b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]]].join("")},c=function(T,C,U){var b=C&&U||0;typeof T=="string"&&(C=T==="binary"?new Array(16):null,T=null);var f=(T=T||{}).random||(T.rng||m)();if(f[6]=15&f[6]|64,f[8]=63&f[8]|128,C)for(var B=0;B<16;++B)C[b+B]=f[B];return C||S(f)},w=r(16),E=r(7),P=r(21),F=r(30),M=function(T,C){var U={};for(var b in T)Object.prototype.hasOwnProperty.call(T,b)&&C.indexOf(b)<0&&(U[b]=T[b]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(b=Object.getOwnPropertySymbols(T);f<b.length;f++)C.indexOf(b[f])<0&&Object.prototype.propertyIsEnumerable.call(T,b[f])&&(U[b[f]]=T[b[f]])}return U};function A(T,C={}){const U=Y=>C.redacted!==!1?Object(F.a)(Y):Y;if(!T.stack)return{message:P(U(T),{cycles:!0})};const{name:b,message:f,stack:B}=T,k=M(T,["name","message","stack"]);return{name:b,message:f!==void 0?f:P(U(T),{cycles:!0}),stack:B,meta:k&&Object.keys(k).length===0?void 0:U(k)}}function p(T,C={}){const{message:U,stack:b,meta:f}=A(T,C);return`${b||U||""}${f&&Object.keys(f).length>0?` -- ${P(f,{cycles:!0})}`:""}`}var N=r(99),$=function(T,C,U,b){return new(U||(U=Promise))(function(f,B){function k(Q){try{K(b.next(Q))}catch(G){B(G)}}function Y(Q){try{K(b.throw(Q))}catch(G){B(G)}}function K(Q){var G;Q.done?f(Q.value):(G=Q.value,G instanceof U?G:new U(function(V){V(G)})).then(k,Y)}K((b=b.apply(T,C||[])).next())})},q=function(T,C){var U={};for(var b in T)Object.prototype.hasOwnProperty.call(T,b)&&C.indexOf(b)<0&&(U[b]=T[b]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(b=Object.getOwnPropertySymbols(T);f<b.length;f++)C.indexOf(b[f])<0&&Object.prototype.propertyIsEnumerable.call(T,b[f])&&(U[b[f]]=T[b[f]])}return U};class h extends N{constructor(C,U){super(),this.endpoint=C,this.meta=U,this.logClient=this.getLogClient()}getLogClient(){return $(this,void 0,void 0,function*(){const{LogClient:C}=yield Promise.resolve().then(r.bind(null,230));return new C(this.endpoint)})}log(C,U){return $(this,void 0,void 0,function*(){const{level:b,message:f,error:B}=C,k=q(C,["level","message","error"]);this.emit("logged");try{yield(yield this.logClient).log([{timestamp:new Date().toISOString(),level:b,message:f.substring(0,1e3),error:B!==void 0?A(B):void 0,meta:Object.assign(Object.assign({},k),this.meta())}])}catch(Y){console.error(`Failed to log to log-api: ${p(Y)}`)}U()})}}var d=function(T,C){var U={};for(var b in T)Object.prototype.hasOwnProperty.call(T,b)&&C.indexOf(b)<0&&(U[b]=T[b]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(b=Object.getOwnPropertySymbols(T);f<b.length;f++)C.indexOf(b[f])<0&&Object.prototype.propertyIsEnumerable.call(T,b[f])&&(U[b[f]]=T[b[f]])}return U};const O={app:E.a,namespace:E.i,buildTag:E.b,instanceId:c()};let _={};const x=E.e?w.format.printf(T=>{var{timestamp:C,level:U,message:b,error:f}=T,B=d(T,["timestamp","level","message","error"]);const k=Object.assign(Object.assign({timestamp:C?new Date(C).getTime():new Date().getTime(),level:U.toUpperCase(),message:b},f?{error:A(f)}:{}),{meta:Object.assign(Object.assign(Object.assign({},O),_),B)});try{return JSON.stringify(k)}catch{return g(k)}}):w.format.printf(T=>{var{timestamp:C,level:U,message:b,error:f}=T,B=d(T,["timestamp","level","message","error"]);let k=`${C||new Date().toISOString()} ${U.toUpperCase()}: ${b} `;if(Object.keys(B).length>0)try{k+=JSON.stringify(B)}catch{k+=g(B)}return f&&(k+=`
1
+ var lr=Object.defineProperty;var Zt=Object.getOwnPropertySymbols;var ur=Object.prototype.hasOwnProperty,gr=Object.prototype.propertyIsEnumerable;var Et=(Ee,Ae,e)=>Ae in Ee?lr(Ee,Ae,{enumerable:!0,configurable:!0,writable:!0,value:e}):Ee[Ae]=e,st=(Ee,Ae)=>{for(var e in Ae||(Ae={}))ur.call(Ae,e)&&Et(Ee,e,Ae[e]);if(Zt)for(var e of Zt(Ae))gr.call(Ae,e)&&Et(Ee,e,Ae[e]);return Ee};var Ce=(Ee,Ae,e)=>(Et(Ee,typeof Ae!="symbol"?Ae+"":Ae,e),e);(function(Ee,Ae){typeof exports=="object"&&typeof module!="undefined"?Ae(exports):typeof define=="function"&&define.amd?define(["exports"],Ae):(Ee=typeof globalThis!="undefined"?globalThis:Ee||self,Ae(Ee.FormantDataSDK={}))})(this,function(exports){"use strict";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 m,R,y=u[0],S=u[1],c=0,w=[];c<y.length;c++)R=y[c],Object.prototype.hasOwnProperty.call(n,R)&&n[R]&&w.push(n[R][0]),n[R]=0;for(m in S)Object.prototype.hasOwnProperty.call(S,m)&&(e[m]=S[m]);for(l&&l(u);w.length;)w.shift()()}var r={},n={0:0};function i(u){if(r[u])return r[u].exports;var m=r[u]={i:u,l:!1,exports:{}};return e[u].call(m.exports,m,m.exports,i),m.l=!0,m.exports}i.e=function(){return Promise.resolve()},i.m=e,i.c=r,i.d=function(u,m,R){i.o(u,m)||Object.defineProperty(u,m,{enumerable:!0,get:R})},i.r=function(u){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})},i.t=function(u,m){if(1&m&&(u=i(u)),8&m||4&m&&typeof u=="object"&&u&&u.__esModule)return u;var R=Object.create(null);if(i.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:u}),2&m&&typeof u!="string")for(var y in u)i.d(R,y,function(S){return u[S]}.bind(null,y));return R},i.n=function(u){var m=u&&u.__esModule?function(){return u.default}:function(){return u};return i.d(m,"a",m),m},i.o=function(u,m){return Object.prototype.hasOwnProperty.call(u,m)},i.p="",i.oe=function(u){throw console.error(u),u};var g=window.webpackJsonpFormantRealtimeSDK=window.webpackJsonpFormantRealtimeSDK||[],s=g.push.bind(g);g.push=t,g=g.slice();for(var o=0;o<g.length;o++)t(g[o]);var l=s;return i(i.s=228)}([function(e,t,r){r.d(t,"a",function(){return D});const n=Math.pow(2,20),i=n;var g=r(54),s=r(15),o=r(53),l=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),u=new Uint8Array(16);function m(){if(!l)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(u)}for(var R=[],y=0;y<256;++y)R[y]=(y+256).toString(16).substr(1);var S=function(T,C){var U=C||0,b=R;return[b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],"-",b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]],b[T[U++]]].join("")},c=function(T,C,U){var b=C&&U||0;typeof T=="string"&&(C=T==="binary"?new Array(16):null,T=null);var f=(T=T||{}).random||(T.rng||m)();if(f[6]=15&f[6]|64,f[8]=63&f[8]|128,C)for(var B=0;B<16;++B)C[b+B]=f[B];return C||S(f)},w=r(16),E=r(7),P=r(21),F=r(30),M=function(T,C){var U={};for(var b in T)Object.prototype.hasOwnProperty.call(T,b)&&C.indexOf(b)<0&&(U[b]=T[b]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(b=Object.getOwnPropertySymbols(T);f<b.length;f++)C.indexOf(b[f])<0&&Object.prototype.propertyIsEnumerable.call(T,b[f])&&(U[b[f]]=T[b[f]])}return U};function A(T,C={}){const U=Y=>C.redacted!==!1?Object(F.a)(Y):Y;if(!T.stack)return{message:P(U(T),{cycles:!0})};const{name:b,message:f,stack:B}=T,k=M(T,["name","message","stack"]);return{name:b,message:f!==void 0?f:P(U(T),{cycles:!0}),stack:B,meta:k&&Object.keys(k).length===0?void 0:U(k)}}function p(T,C={}){const{message:U,stack:b,meta:f}=A(T,C);return`${b||U||""}${f&&Object.keys(f).length>0?` -- ${P(f,{cycles:!0})}`:""}`}var N=r(99),$=function(T,C,U,b){return new(U||(U=Promise))(function(f,B){function k(Q){try{K(b.next(Q))}catch(G){B(G)}}function Y(Q){try{K(b.throw(Q))}catch(G){B(G)}}function K(Q){var G;Q.done?f(Q.value):(G=Q.value,G instanceof U?G:new U(function(V){V(G)})).then(k,Y)}K((b=b.apply(T,C||[])).next())})},q=function(T,C){var U={};for(var b in T)Object.prototype.hasOwnProperty.call(T,b)&&C.indexOf(b)<0&&(U[b]=T[b]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(b=Object.getOwnPropertySymbols(T);f<b.length;f++)C.indexOf(b[f])<0&&Object.prototype.propertyIsEnumerable.call(T,b[f])&&(U[b[f]]=T[b[f]])}return U};class h extends N{constructor(C,U){super(),this.endpoint=C,this.meta=U,this.logClient=this.getLogClient()}getLogClient(){return $(this,void 0,void 0,function*(){const{LogClient:C}=yield Promise.resolve().then(r.bind(null,230));return new C(this.endpoint)})}log(C,U){return $(this,void 0,void 0,function*(){const{level:b,message:f,error:B}=C,k=q(C,["level","message","error"]);this.emit("logged");try{yield(yield this.logClient).log([{timestamp:new Date().toISOString(),level:b,message:f.substring(0,1e3),error:B!==void 0?A(B):void 0,meta:Object.assign(Object.assign({},k),this.meta())}])}catch(Y){console.error(`Failed to log to log-api: ${p(Y)}`)}U()})}}var d=function(T,C){var U={};for(var b in T)Object.prototype.hasOwnProperty.call(T,b)&&C.indexOf(b)<0&&(U[b]=T[b]);if(T!=null&&typeof Object.getOwnPropertySymbols=="function"){var f=0;for(b=Object.getOwnPropertySymbols(T);f<b.length;f++)C.indexOf(b[f])<0&&Object.prototype.propertyIsEnumerable.call(T,b[f])&&(U[b[f]]=T[b[f]])}return U};const O={app:E.a,namespace:E.i,buildTag:E.b,instanceId:c()};let _={};const x=E.e?w.format.printf(T=>{var{timestamp:C,level:U,message:b,error:f}=T,B=d(T,["timestamp","level","message","error"]);const k=Object.assign(Object.assign({timestamp:C?new Date(C).getTime():new Date().getTime(),level:U.toUpperCase(),message:b},f?{error:A(f)}:{}),{meta:Object.assign(Object.assign(Object.assign({},O),_),B)});try{return JSON.stringify(k)}catch{return g(k)}}):w.format.printf(T=>{var{timestamp:C,level:U,message:b,error:f}=T,B=d(T,["timestamp","level","message","error"]);let k=`${C||new Date().toISOString()} ${U.toUpperCase()}: ${b} `;if(Object.keys(B).length>0)try{k+=JSON.stringify(B)}catch{k+=g(B)}return f&&(k+=`
2
2
  ${p(f)}`),k}),D=Object(w.createLogger)({level:E.f});if(E.g&&D.add(new w.transports.Console({format:x,level:"debug"})),E.d&&D.add(new h(E.d,()=>Object.assign(Object.assign(Object.assign({},O),_),{level:"debug"}))),E.h){const T=o.resolve(s.tmpdir(),`silly-${E.a}.log`);D.debug("Logging silly logs to file",{filename:T}),D.add(new w.transports.File({filename:T,maxsize:1*i,maxFiles:10,format:w.format.combine((L="silly",Object(w.format)(C=>C.level===L&&C)()),x),level:"silly"}))}var L},function(e,t,r){r.d(t,"a",function(){return n});const n={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6,year:31536e6}},function(e,t){var r,n,i=e.exports={};function g(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(E){if(r===setTimeout)return setTimeout(E,0);if((r===g||!r)&&setTimeout)return r=setTimeout,setTimeout(E,0);try{return r(E,0)}catch{try{return r.call(null,E,0)}catch{return r.call(this,E,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:g}catch{r=g}try{n=typeof clearTimeout=="function"?clearTimeout:s}catch{n=s}})();var l,u=[],m=!1,R=-1;function y(){m&&l&&(m=!1,l.length?u=l.concat(u):R=-1,u.length&&S())}function S(){if(!m){var E=o(y);m=!0;for(var P=u.length;P;){for(l=u,u=[];++R<P;)l&&l[R].run();R=-1,P=u.length}l=null,m=!1,function(F){if(n===clearTimeout)return clearTimeout(F);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(F);try{n(F)}catch{try{return n.call(null,F)}catch{return n.call(this,F)}}}(E)}}function c(E,P){this.fun=E,this.array=P}function w(){}i.nextTick=function(E){var P=new Array(arguments.length-1);if(arguments.length>1)for(var F=1;F<arguments.length;F++)P[F-1]=arguments[F];u.push(new c(E,P)),u.length!==1||m||o(S)},c.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=w,i.addListener=w,i.once=w,i.off=w,i.removeListener=w,i.removeAllListeners=w,i.emit=w,i.prependListener=w,i.prependOnceListener=w,i.listeners=function(E){return[]},i.binding=function(E){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(E){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){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:r(117)})},function(e,t,r){(function(n){var i=r(125),g=r(126),s=r(38);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function l(v,j){if(o()<j)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(v=new Uint8Array(j)).__proto__=u.prototype:(v===null&&(v=new u(j)),v.length=j),v}function u(v,j,W){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(v,j,W);if(typeof v=="number"){if(typeof j=="string")throw new Error("If encoding is specified then the first argument must be a string");return y(this,v)}return m(this,v,j,W)}function m(v,j,W,ee){if(typeof j=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&j instanceof ArrayBuffer?function(J,re,se,oe){if(re.byteLength,se<0||re.byteLength<se)throw new RangeError("'offset' is out of bounds");if(re.byteLength<se+(oe||0))throw new RangeError("'length' is out of bounds");return re=se===void 0&&oe===void 0?new Uint8Array(re):oe===void 0?new Uint8Array(re,se):new Uint8Array(re,se,oe),u.TYPED_ARRAY_SUPPORT?(J=re).__proto__=u.prototype:J=S(J,re),J}(v,j,W,ee):typeof j=="string"?function(J,re,se){if(typeof se=="string"&&se!==""||(se="utf8"),!u.isEncoding(se))throw new TypeError('"encoding" must be a valid string encoding');var oe=0|w(re,se),z=(J=l(J,oe)).write(re,se);return z!==oe&&(J=J.slice(0,z)),J}(v,j,W):function(J,re){if(u.isBuffer(re)){var se=0|c(re.length);return(J=l(J,se)).length===0||re.copy(J,0,0,se),J}if(re){if(typeof ArrayBuffer!="undefined"&&re.buffer instanceof ArrayBuffer||"length"in re)return typeof re.length!="number"||(oe=re.length)!=oe?l(J,0):S(J,re);if(re.type==="Buffer"&&s(re.data))return S(J,re.data)}var oe;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(v,j)}function R(v){if(typeof v!="number")throw new TypeError('"size" argument must be a number');if(v<0)throw new RangeError('"size" argument must not be negative')}function y(v,j){if(R(j),v=l(v,j<0?0:0|c(j)),!u.TYPED_ARRAY_SUPPORT)for(var W=0;W<j;++W)v[W]=0;return v}function S(v,j){var W=j.length<0?0:0|c(j.length);v=l(v,W);for(var ee=0;ee<W;ee+=1)v[ee]=255&j[ee];return v}function c(v){if(v>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|v}function w(v,j){if(u.isBuffer(v))return v.length;if(typeof ArrayBuffer!="undefined"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(v)||v instanceof ArrayBuffer))return v.byteLength;typeof v!="string"&&(v=""+v);var W=v.length;if(W===0)return 0;for(var ee=!1;;)switch(j){case"ascii":case"latin1":case"binary":return W;case"utf8":case"utf-8":case void 0:return Q(v).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*W;case"hex":return W>>>1;case"base64":return G(v).length;default:if(ee)return Q(v).length;j=(""+j).toLowerCase(),ee=!0}}function E(v,j,W){var ee=!1;if((j===void 0||j<0)&&(j=0),j>this.length||((W===void 0||W>this.length)&&(W=this.length),W<=0)||(W>>>=0)<=(j>>>=0))return"";for(v||(v="utf8");;)switch(v){case"hex":return D(this,j,W);case"utf8":case"utf-8":return O(this,j,W);case"ascii":return _(this,j,W);case"latin1":case"binary":return x(this,j,W);case"base64":return d(this,j,W);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,j,W);default:if(ee)throw new TypeError("Unknown encoding: "+v);v=(v+"").toLowerCase(),ee=!0}}function P(v,j,W){var ee=v[j];v[j]=v[W],v[W]=ee}function F(v,j,W,ee,J){if(v.length===0)return-1;if(typeof W=="string"?(ee=W,W=0):W>2147483647?W=2147483647:W<-2147483648&&(W=-2147483648),W=+W,isNaN(W)&&(W=J?0:v.length-1),W<0&&(W=v.length+W),W>=v.length){if(J)return-1;W=v.length-1}else if(W<0){if(!J)return-1;W=0}if(typeof j=="string"&&(j=u.from(j,ee)),u.isBuffer(j))return j.length===0?-1:M(v,j,W,ee,J);if(typeof j=="number")return j&=255,u.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(v,j,W):Uint8Array.prototype.lastIndexOf.call(v,j,W):M(v,[j],W,ee,J);throw new TypeError("val must be string, number or Buffer")}function M(v,j,W,ee,J){var re,se=1,oe=v.length,z=j.length;if(ee!==void 0&&((ee=String(ee).toLowerCase())==="ucs2"||ee==="ucs-2"||ee==="utf16le"||ee==="utf-16le")){if(v.length<2||j.length<2)return-1;se=2,oe/=2,z/=2,W/=2}function Z(he,de){return se===1?he[de]:he.readUInt16BE(de*se)}if(J){var te=-1;for(re=W;re<oe;re++)if(Z(v,re)===Z(j,te===-1?0:re-te)){if(te===-1&&(te=re),re-te+1===z)return te*se}else te!==-1&&(re-=re-te),te=-1}else for(W+z>oe&&(W=oe-z),re=W;re>=0;re--){for(var ge=!0,ie=0;ie<z;ie++)if(Z(v,re+ie)!==Z(j,ie)){ge=!1;break}if(ge)return re}return-1}function A(v,j,W,ee){W=Number(W)||0;var J=v.length-W;ee?(ee=Number(ee))>J&&(ee=J):ee=J;var re=j.length;if(re%2!=0)throw new TypeError("Invalid hex string");ee>re/2&&(ee=re/2);for(var se=0;se<ee;++se){var oe=parseInt(j.substr(2*se,2),16);if(isNaN(oe))return se;v[W+se]=oe}return se}function p(v,j,W,ee){return V(Q(j,v.length-W),v,W,ee)}function N(v,j,W,ee){return V(function(J){for(var re=[],se=0;se<J.length;++se)re.push(255&J.charCodeAt(se));return re}(j),v,W,ee)}function $(v,j,W,ee){return N(v,j,W,ee)}function q(v,j,W,ee){return V(G(j),v,W,ee)}function h(v,j,W,ee){return V(function(J,re){for(var se,oe,z,Z=[],te=0;te<J.length&&!((re-=2)<0);++te)se=J.charCodeAt(te),oe=se>>8,z=se%256,Z.push(z),Z.push(oe);return Z}(j,v.length-W),v,W,ee)}function d(v,j,W){return j===0&&W===v.length?i.fromByteArray(v):i.fromByteArray(v.slice(j,W))}function O(v,j,W){W=Math.min(v.length,W);for(var ee=[],J=j;J<W;){var re,se,oe,z,Z=v[J],te=null,ge=Z>239?4:Z>223?3:Z>191?2:1;if(J+ge<=W)switch(ge){case 1:Z<128&&(te=Z);break;case 2:(192&(re=v[J+1]))==128&&(z=(31&Z)<<6|63&re)>127&&(te=z);break;case 3:re=v[J+1],se=v[J+2],(192&re)==128&&(192&se)==128&&(z=(15&Z)<<12|(63&re)<<6|63&se)>2047&&(z<55296||z>57343)&&(te=z);break;case 4:re=v[J+1],se=v[J+2],oe=v[J+3],(192&re)==128&&(192&se)==128&&(192&oe)==128&&(z=(15&Z)<<18|(63&re)<<12|(63&se)<<6|63&oe)>65535&&z<1114112&&(te=z)}te===null?(te=65533,ge=1):te>65535&&(te-=65536,ee.push(te>>>10&1023|55296),te=56320|1023&te),ee.push(te),J+=ge}return function(ie){var he=ie.length;if(he<=4096)return String.fromCharCode.apply(String,ie);for(var de="",me=0;me<he;)de+=String.fromCharCode.apply(String,ie.slice(me,me+=4096));return de}(ee)}t.Buffer=u,t.SlowBuffer=function(v){return+v!=v&&(v=0),u.alloc(+v)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=n.TYPED_ARRAY_SUPPORT!==void 0?n.TYPED_ARRAY_SUPPORT:function(){try{var v=new Uint8Array(1);return v.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},v.foo()===42&&typeof v.subarray=="function"&&v.subarray(1,1).byteLength===0}catch{return!1}}(),t.kMaxLength=o(),u.poolSize=8192,u._augment=function(v){return v.__proto__=u.prototype,v},u.from=function(v,j,W){return m(null,v,j,W)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(v,j,W){return function(ee,J,re,se){return R(J),J<=0?l(ee,J):re!==void 0?typeof se=="string"?l(ee,J).fill(re,se):l(ee,J).fill(re):l(ee,J)}(null,v,j,W)},u.allocUnsafe=function(v){return y(null,v)},u.allocUnsafeSlow=function(v){return y(null,v)},u.isBuffer=function(v){return!(v==null||!v._isBuffer)},u.compare=function(v,j){if(!u.isBuffer(v)||!u.isBuffer(j))throw new TypeError("Arguments must be Buffers");if(v===j)return 0;for(var W=v.length,ee=j.length,J=0,re=Math.min(W,ee);J<re;++J)if(v[J]!==j[J]){W=v[J],ee=j[J];break}return W<ee?-1:ee<W?1:0},u.isEncoding=function(v){switch(String(v).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(v,j){if(!s(v))throw new TypeError('"list" argument must be an Array of Buffers');if(v.length===0)return u.alloc(0);var W;if(j===void 0)for(j=0,W=0;W<v.length;++W)j+=v[W].length;var ee=u.allocUnsafe(j),J=0;for(W=0;W<v.length;++W){var re=v[W];if(!u.isBuffer(re))throw new TypeError('"list" argument must be an Array of Buffers');re.copy(ee,J),J+=re.length}return ee},u.byteLength=w,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var v=this.length;if(v%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var j=0;j<v;j+=2)P(this,j,j+1);return this},u.prototype.swap32=function(){var v=this.length;if(v%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var j=0;j<v;j+=4)P(this,j,j+3),P(this,j+1,j+2);return this},u.prototype.swap64=function(){var v=this.length;if(v%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var j=0;j<v;j+=8)P(this,j,j+7),P(this,j+1,j+6),P(this,j+2,j+5),P(this,j+3,j+4);return this},u.prototype.toString=function(){var v=0|this.length;return v===0?"":arguments.length===0?O(this,0,v):E.apply(this,arguments)},u.prototype.equals=function(v){if(!u.isBuffer(v))throw new TypeError("Argument must be a Buffer");return this===v||u.compare(this,v)===0},u.prototype.inspect=function(){var v="",j=t.INSPECT_MAX_BYTES;return this.length>0&&(v=this.toString("hex",0,j).match(/.{2}/g).join(" "),this.length>j&&(v+=" ... ")),"<Buffer "+v+">"},u.prototype.compare=function(v,j,W,ee,J){if(!u.isBuffer(v))throw new TypeError("Argument must be a Buffer");if(j===void 0&&(j=0),W===void 0&&(W=v?v.length:0),ee===void 0&&(ee=0),J===void 0&&(J=this.length),j<0||W>v.length||ee<0||J>this.length)throw new RangeError("out of range index");if(ee>=J&&j>=W)return 0;if(ee>=J)return-1;if(j>=W)return 1;if(this===v)return 0;for(var re=(J>>>=0)-(ee>>>=0),se=(W>>>=0)-(j>>>=0),oe=Math.min(re,se),z=this.slice(ee,J),Z=v.slice(j,W),te=0;te<oe;++te)if(z[te]!==Z[te]){re=z[te],se=Z[te];break}return re<se?-1:se<re?1:0},u.prototype.includes=function(v,j,W){return this.indexOf(v,j,W)!==-1},u.prototype.indexOf=function(v,j,W){return F(this,v,j,W,!0)},u.prototype.lastIndexOf=function(v,j,W){return F(this,v,j,W,!1)},u.prototype.write=function(v,j,W,ee){if(j===void 0)ee="utf8",W=this.length,j=0;else if(W===void 0&&typeof j=="string")ee=j,W=this.length,j=0;else{if(!isFinite(j))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");j|=0,isFinite(W)?(W|=0,ee===void 0&&(ee="utf8")):(ee=W,W=void 0)}var J=this.length-j;if((W===void 0||W>J)&&(W=J),v.length>0&&(W<0||j<0)||j>this.length)throw new RangeError("Attempt to write outside buffer bounds");ee||(ee="utf8");for(var re=!1;;)switch(ee){case"hex":return A(this,v,j,W);case"utf8":case"utf-8":return p(this,v,j,W);case"ascii":return N(this,v,j,W);case"latin1":case"binary":return $(this,v,j,W);case"base64":return q(this,v,j,W);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h(this,v,j,W);default:if(re)throw new TypeError("Unknown encoding: "+ee);ee=(""+ee).toLowerCase(),re=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _(v,j,W){var ee="";W=Math.min(v.length,W);for(var J=j;J<W;++J)ee+=String.fromCharCode(127&v[J]);return ee}function x(v,j,W){var ee="";W=Math.min(v.length,W);for(var J=j;J<W;++J)ee+=String.fromCharCode(v[J]);return ee}function D(v,j,W){var ee=v.length;(!j||j<0)&&(j=0),(!W||W<0||W>ee)&&(W=ee);for(var J="",re=j;re<W;++re)J+=K(v[re]);return J}function L(v,j,W){for(var ee=v.slice(j,W),J="",re=0;re<ee.length;re+=2)J+=String.fromCharCode(ee[re]+256*ee[re+1]);return J}function T(v,j,W){if(v%1!=0||v<0)throw new RangeError("offset is not uint");if(v+j>W)throw new RangeError("Trying to access beyond buffer length")}function C(v,j,W,ee,J,re){if(!u.isBuffer(v))throw new TypeError('"buffer" argument must be a Buffer instance');if(j>J||j<re)throw new RangeError('"value" argument is out of bounds');if(W+ee>v.length)throw new RangeError("Index out of range")}function U(v,j,W,ee){j<0&&(j=65535+j+1);for(var J=0,re=Math.min(v.length-W,2);J<re;++J)v[W+J]=(j&255<<8*(ee?J:1-J))>>>8*(ee?J:1-J)}function b(v,j,W,ee){j<0&&(j=4294967295+j+1);for(var J=0,re=Math.min(v.length-W,4);J<re;++J)v[W+J]=j>>>8*(ee?J:3-J)&255}function f(v,j,W,ee,J,re){if(W+ee>v.length)throw new RangeError("Index out of range");if(W<0)throw new RangeError("Index out of range")}function B(v,j,W,ee,J){return J||f(v,0,W,4),g.write(v,j,W,ee,23,4),W+4}function k(v,j,W,ee,J){return J||f(v,0,W,8),g.write(v,j,W,ee,52,8),W+8}u.prototype.slice=function(v,j){var W,ee=this.length;if((v=~~v)<0?(v+=ee)<0&&(v=0):v>ee&&(v=ee),(j=j===void 0?ee:~~j)<0?(j+=ee)<0&&(j=0):j>ee&&(j=ee),j<v&&(j=v),u.TYPED_ARRAY_SUPPORT)(W=this.subarray(v,j)).__proto__=u.prototype;else{var J=j-v;W=new u(J,void 0);for(var re=0;re<J;++re)W[re]=this[re+v]}return W},u.prototype.readUIntLE=function(v,j,W){v|=0,j|=0,W||T(v,j,this.length);for(var ee=this[v],J=1,re=0;++re<j&&(J*=256);)ee+=this[v+re]*J;return ee},u.prototype.readUIntBE=function(v,j,W){v|=0,j|=0,W||T(v,j,this.length);for(var ee=this[v+--j],J=1;j>0&&(J*=256);)ee+=this[v+--j]*J;return ee},u.prototype.readUInt8=function(v,j){return j||T(v,1,this.length),this[v]},u.prototype.readUInt16LE=function(v,j){return j||T(v,2,this.length),this[v]|this[v+1]<<8},u.prototype.readUInt16BE=function(v,j){return j||T(v,2,this.length),this[v]<<8|this[v+1]},u.prototype.readUInt32LE=function(v,j){return j||T(v,4,this.length),(this[v]|this[v+1]<<8|this[v+2]<<16)+16777216*this[v+3]},u.prototype.readUInt32BE=function(v,j){return j||T(v,4,this.length),16777216*this[v]+(this[v+1]<<16|this[v+2]<<8|this[v+3])},u.prototype.readIntLE=function(v,j,W){v|=0,j|=0,W||T(v,j,this.length);for(var ee=this[v],J=1,re=0;++re<j&&(J*=256);)ee+=this[v+re]*J;return ee>=(J*=128)&&(ee-=Math.pow(2,8*j)),ee},u.prototype.readIntBE=function(v,j,W){v|=0,j|=0,W||T(v,j,this.length);for(var ee=j,J=1,re=this[v+--ee];ee>0&&(J*=256);)re+=this[v+--ee]*J;return re>=(J*=128)&&(re-=Math.pow(2,8*j)),re},u.prototype.readInt8=function(v,j){return j||T(v,1,this.length),128&this[v]?-1*(255-this[v]+1):this[v]},u.prototype.readInt16LE=function(v,j){j||T(v,2,this.length);var W=this[v]|this[v+1]<<8;return 32768&W?4294901760|W:W},u.prototype.readInt16BE=function(v,j){j||T(v,2,this.length);var W=this[v+1]|this[v]<<8;return 32768&W?4294901760|W:W},u.prototype.readInt32LE=function(v,j){return j||T(v,4,this.length),this[v]|this[v+1]<<8|this[v+2]<<16|this[v+3]<<24},u.prototype.readInt32BE=function(v,j){return j||T(v,4,this.length),this[v]<<24|this[v+1]<<16|this[v+2]<<8|this[v+3]},u.prototype.readFloatLE=function(v,j){return j||T(v,4,this.length),g.read(this,v,!0,23,4)},u.prototype.readFloatBE=function(v,j){return j||T(v,4,this.length),g.read(this,v,!1,23,4)},u.prototype.readDoubleLE=function(v,j){return j||T(v,8,this.length),g.read(this,v,!0,52,8)},u.prototype.readDoubleBE=function(v,j){return j||T(v,8,this.length),g.read(this,v,!1,52,8)},u.prototype.writeUIntLE=function(v,j,W,ee){v=+v,j|=0,W|=0,ee||C(this,v,j,W,Math.pow(2,8*W)-1,0);var J=1,re=0;for(this[j]=255&v;++re<W&&(J*=256);)this[j+re]=v/J&255;return j+W},u.prototype.writeUIntBE=function(v,j,W,ee){v=+v,j|=0,W|=0,ee||C(this,v,j,W,Math.pow(2,8*W)-1,0);var J=W-1,re=1;for(this[j+J]=255&v;--J>=0&&(re*=256);)this[j+J]=v/re&255;return j+W},u.prototype.writeUInt8=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,1,255,0),u.TYPED_ARRAY_SUPPORT||(v=Math.floor(v)),this[j]=255&v,j+1},u.prototype.writeUInt16LE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[j]=255&v,this[j+1]=v>>>8):U(this,v,j,!0),j+2},u.prototype.writeUInt16BE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[j]=v>>>8,this[j+1]=255&v):U(this,v,j,!1),j+2},u.prototype.writeUInt32LE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[j+3]=v>>>24,this[j+2]=v>>>16,this[j+1]=v>>>8,this[j]=255&v):b(this,v,j,!0),j+4},u.prototype.writeUInt32BE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[j]=v>>>24,this[j+1]=v>>>16,this[j+2]=v>>>8,this[j+3]=255&v):b(this,v,j,!1),j+4},u.prototype.writeIntLE=function(v,j,W,ee){if(v=+v,j|=0,!ee){var J=Math.pow(2,8*W-1);C(this,v,j,W,J-1,-J)}var re=0,se=1,oe=0;for(this[j]=255&v;++re<W&&(se*=256);)v<0&&oe===0&&this[j+re-1]!==0&&(oe=1),this[j+re]=(v/se>>0)-oe&255;return j+W},u.prototype.writeIntBE=function(v,j,W,ee){if(v=+v,j|=0,!ee){var J=Math.pow(2,8*W-1);C(this,v,j,W,J-1,-J)}var re=W-1,se=1,oe=0;for(this[j+re]=255&v;--re>=0&&(se*=256);)v<0&&oe===0&&this[j+re+1]!==0&&(oe=1),this[j+re]=(v/se>>0)-oe&255;return j+W},u.prototype.writeInt8=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,1,127,-128),u.TYPED_ARRAY_SUPPORT||(v=Math.floor(v)),v<0&&(v=255+v+1),this[j]=255&v,j+1},u.prototype.writeInt16LE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[j]=255&v,this[j+1]=v>>>8):U(this,v,j,!0),j+2},u.prototype.writeInt16BE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[j]=v>>>8,this[j+1]=255&v):U(this,v,j,!1),j+2},u.prototype.writeInt32LE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[j]=255&v,this[j+1]=v>>>8,this[j+2]=v>>>16,this[j+3]=v>>>24):b(this,v,j,!0),j+4},u.prototype.writeInt32BE=function(v,j,W){return v=+v,j|=0,W||C(this,v,j,4,2147483647,-2147483648),v<0&&(v=4294967295+v+1),u.TYPED_ARRAY_SUPPORT?(this[j]=v>>>24,this[j+1]=v>>>16,this[j+2]=v>>>8,this[j+3]=255&v):b(this,v,j,!1),j+4},u.prototype.writeFloatLE=function(v,j,W){return B(this,v,j,!0,W)},u.prototype.writeFloatBE=function(v,j,W){return B(this,v,j,!1,W)},u.prototype.writeDoubleLE=function(v,j,W){return k(this,v,j,!0,W)},u.prototype.writeDoubleBE=function(v,j,W){return k(this,v,j,!1,W)},u.prototype.copy=function(v,j,W,ee){if(W||(W=0),ee||ee===0||(ee=this.length),j>=v.length&&(j=v.length),j||(j=0),ee>0&&ee<W&&(ee=W),ee===W||v.length===0||this.length===0)return 0;if(j<0)throw new RangeError("targetStart out of bounds");if(W<0||W>=this.length)throw new RangeError("sourceStart out of bounds");if(ee<0)throw new RangeError("sourceEnd out of bounds");ee>this.length&&(ee=this.length),v.length-j<ee-W&&(ee=v.length-j+W);var J,re=ee-W;if(this===v&&W<j&&j<ee)for(J=re-1;J>=0;--J)v[J+j]=this[J+W];else if(re<1e3||!u.TYPED_ARRAY_SUPPORT)for(J=0;J<re;++J)v[J+j]=this[J+W];else Uint8Array.prototype.set.call(v,this.subarray(W,W+re),j);return re},u.prototype.fill=function(v,j,W,ee){if(typeof v=="string"){if(typeof j=="string"?(ee=j,j=0,W=this.length):typeof W=="string"&&(ee=W,W=this.length),v.length===1){var J=v.charCodeAt(0);J<256&&(v=J)}if(ee!==void 0&&typeof ee!="string")throw new TypeError("encoding must be a string");if(typeof ee=="string"&&!u.isEncoding(ee))throw new TypeError("Unknown encoding: "+ee)}else typeof v=="number"&&(v&=255);if(j<0||this.length<j||this.length<W)throw new RangeError("Out of range index");if(W<=j)return this;var re;if(j>>>=0,W=W===void 0?this.length:W>>>0,v||(v=0),typeof v=="number")for(re=j;re<W;++re)this[re]=v;else{var se=u.isBuffer(v)?v:Q(new u(v,ee).toString()),oe=se.length;for(re=0;re<W-j;++re)this[re+j]=se[re%oe]}return this};var Y=/[^+\/0-9A-Za-z-_]/g;function K(v){return v<16?"0"+v.toString(16):v.toString(16)}function Q(v,j){var W;j=j||1/0;for(var ee=v.length,J=null,re=[],se=0;se<ee;++se){if((W=v.charCodeAt(se))>55295&&W<57344){if(!J){if(W>56319){(j-=3)>-1&&re.push(239,191,189);continue}if(se+1===ee){(j-=3)>-1&&re.push(239,191,189);continue}J=W;continue}if(W<56320){(j-=3)>-1&&re.push(239,191,189),J=W;continue}W=65536+(J-55296<<10|W-56320)}else J&&(j-=3)>-1&&re.push(239,191,189);if(J=null,W<128){if((j-=1)<0)break;re.push(W)}else if(W<2048){if((j-=2)<0)break;re.push(W>>6|192,63&W|128)}else if(W<65536){if((j-=3)<0)break;re.push(W>>12|224,W>>6&63|128,63&W|128)}else{if(!(W<1114112))throw new Error("Invalid code point");if((j-=4)<0)break;re.push(W>>18|240,W>>12&63|128,W>>6&63|128,63&W|128)}}return re}function G(v){return i.toByteArray(function(j){if((j=function(W){return W.trim?W.trim():W.replace(/^\s+|\s+$/g,"")}(j).replace(Y,"")).length<2)return"";for(;j.length%4!=0;)j+="=";return j}(v))}function V(v,j,W,ee){for(var J=0;J<ee&&!(J+W>=j.length||J>=v.length);++J)j[J+W]=v[J];return J}}).call(this,r(5))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}e.exports=r},function(e,t){typeof Object.create=="function"?e.exports=function(r,n){n&&(r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(r,n){if(n){r.super_=n;var i=function(){};i.prototype=n.prototype,r.prototype=new i,r.prototype.constructor=r}}},function(e,t,r){(function(n){r.d(t,"a",function(){return s}),r.d(t,"i",function(){return o}),r.d(t,"j",function(){return l}),r.d(t,"b",function(){return u}),r.d(t,"f",function(){return m}),r.d(t,"e",function(){return R}),r.d(t,"g",function(){return y}),r.d(t,"d",function(){return S}),r.d(t,"c",function(){return c}),r.d(t,"h",function(){return w});var i=r(98);const g=i.from(Object.assign(Object.assign({},n.env),{ENVIRONMENT:n.env.ENV,APP:"realtime-sdk",NAMESPACE:"production",VERSION:n.env.VERSION,BUILD_TAG:n.env.BUILD_TAG,GIT_COMMIT:n.env.GIT_COMMIT,LOG_LEVEL:n.env.LOG_LEVEL,LOG_JSON:"false",LOG_API_ENDPOINT:n.env.LOG_API_ENDPOINT,JEST_WORKER_ID:n.env.JEST_WORKER_ID,ENABLE_SENTRY:n.env.ENABLE_SENTRY,SENTRY_DSN:n.env.SENTRY_DSN,STABLE_AGENT_VERSION:n.env.STABLE_AGENT_VERSION})),s=(g.get("ENVIRONMENT").default("").asString(),g.get("APP").default("").asString()),o=(g.get("APP_PATH").default("").asString(),g.get("API_ENDPOINT").default("").asString(),g.get("NAMESPACE").default("").asString()),l=g.get("VERSION").default("").asString(),u=g.get("BUILD_TAG").default("").asString(),m=(g.get("GIT_COMMIT").default("").asString(),g.get("ENABLE_SENTRY").default("false").asBool(),g.get("SENTRY_DSN").default("").asString(),g.get("LOG_LEVEL").default("debug").asString()),R=g.get("LOG_JSON").default("true").asBool(),y=g.get("LOG_TO_CONSOLE").default("true").asBool(),S=(g.get("STABLE_AGENT_VERSION").default("").asString(),g.get("LOG_API_ENDPOINT").asString()),c=g.get("JEST_WORKER_ID").asString(),w=(g.get("SHEET_EXPORT_MAX_ROW_COUNT").default("10000").asIntPositive(),g.get("LOG_TO_FILE").default("false").asBoolStrict())}).call(this,r(2))},function(e,t,r){var n=r(95),i=n,g=Function("return this")(),s=r(94);i.object.extend(proto,s),i.exportSymbol("proto.v1.signaling.api.CreatePeerRequest",null,g),i.exportSymbol("proto.v1.signaling.api.CreatePeerResponse",null,g),i.exportSymbol("proto.v1.signaling.api.DeletePeerRequest",null,g),i.exportSymbol("proto.v1.signaling.api.DeletePeerResponse",null,g),i.exportSymbol("proto.v1.signaling.api.GetIceServersRequest",null,g),i.exportSymbol("proto.v1.signaling.api.GetIceServersResponse",null,g),i.exportSymbol("proto.v1.signaling.api.GetPeersRequest",null,g),i.exportSymbol("proto.v1.signaling.api.GetPeersResponse",null,g),i.exportSymbol("proto.v1.signaling.api.Peer",null,g),i.exportSymbol("proto.v1.signaling.api.ReceiveSignalStreamRequest",null,g),i.exportSymbol("proto.v1.signaling.api.ReceiveSignalStreamResponse",null,g),i.exportSymbol("proto.v1.signaling.api.RefreshPeerRequest",null,g),i.exportSymbol("proto.v1.signaling.api.RefreshPeerResponse",null,g),i.exportSymbol("proto.v1.signaling.api.SendSignalRequest",null,g),i.exportSymbol("proto.v1.signaling.api.SendSignalResponse",null,g),i.exportSymbol("proto.v1.signaling.api.SessionType",null,g),i.exportSymbol("proto.v1.signaling.api.Signal",null,g),proto.v1.signaling.api.Peer=function(o){n.Message.initialize(this,o,0,-1,proto.v1.signaling.api.Peer.repeatedFields_,null)},i.inherits(proto.v1.signaling.api.Peer,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.Peer.displayName="proto.v1.signaling.api.Peer"),proto.v1.signaling.api.Signal=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.Signal,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.Signal.displayName="proto.v1.signaling.api.Signal"),proto.v1.signaling.api.CreatePeerRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.CreatePeerRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.CreatePeerRequest.displayName="proto.v1.signaling.api.CreatePeerRequest"),proto.v1.signaling.api.CreatePeerResponse=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.CreatePeerResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.CreatePeerResponse.displayName="proto.v1.signaling.api.CreatePeerResponse"),proto.v1.signaling.api.DeletePeerRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.DeletePeerRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.DeletePeerRequest.displayName="proto.v1.signaling.api.DeletePeerRequest"),proto.v1.signaling.api.DeletePeerResponse=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.DeletePeerResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.DeletePeerResponse.displayName="proto.v1.signaling.api.DeletePeerResponse"),proto.v1.signaling.api.RefreshPeerRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.RefreshPeerRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.RefreshPeerRequest.displayName="proto.v1.signaling.api.RefreshPeerRequest"),proto.v1.signaling.api.RefreshPeerResponse=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.RefreshPeerResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.RefreshPeerResponse.displayName="proto.v1.signaling.api.RefreshPeerResponse"),proto.v1.signaling.api.GetPeersRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetPeersRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetPeersRequest.displayName="proto.v1.signaling.api.GetPeersRequest"),proto.v1.signaling.api.GetPeersResponse=function(o){n.Message.initialize(this,o,0,-1,proto.v1.signaling.api.GetPeersResponse.repeatedFields_,null)},i.inherits(proto.v1.signaling.api.GetPeersResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetPeersResponse.displayName="proto.v1.signaling.api.GetPeersResponse"),proto.v1.signaling.api.GetIceServersRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetIceServersRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetIceServersRequest.displayName="proto.v1.signaling.api.GetIceServersRequest"),proto.v1.signaling.api.GetIceServersResponse=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.GetIceServersResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.GetIceServersResponse.displayName="proto.v1.signaling.api.GetIceServersResponse"),proto.v1.signaling.api.SendSignalRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.SendSignalRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.SendSignalRequest.displayName="proto.v1.signaling.api.SendSignalRequest"),proto.v1.signaling.api.SendSignalResponse=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.SendSignalResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.SendSignalResponse.displayName="proto.v1.signaling.api.SendSignalResponse"),proto.v1.signaling.api.ReceiveSignalStreamRequest=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.ReceiveSignalStreamRequest,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.ReceiveSignalStreamRequest.displayName="proto.v1.signaling.api.ReceiveSignalStreamRequest"),proto.v1.signaling.api.ReceiveSignalStreamResponse=function(o){n.Message.initialize(this,o,0,-1,null,null)},i.inherits(proto.v1.signaling.api.ReceiveSignalStreamResponse,n.Message),i.DEBUG&&!COMPILED&&(proto.v1.signaling.api.ReceiveSignalStreamResponse.displayName="proto.v1.signaling.api.ReceiveSignalStreamResponse"),proto.v1.signaling.api.Peer.repeatedFields_=[5],n.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,l){var u,m={peerId:n.Message.getFieldWithDefault(l,1,""),organizationId:n.Message.getFieldWithDefault(l,2,""),userId:(u=l.getUserId())&&s.StringValue.toObject(o,u),deviceId:(u=l.getDeviceId())&&s.StringValue.toObject(o,u),sessionIdsList:(u=n.Message.getRepeatedField(l,5))==null?void 0:u,peerCreatedTimestamp:(u=l.getPeerCreatedTimestamp())&&s.Int64Value.toObject(o,u)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.Peer.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.Peer;return proto.v1.signaling.api.Peer.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.Peer.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=l.readString();o.setPeerId(u);break;case 2:u=l.readString(),o.setOrganizationId(u);break;case 3:u=new s.StringValue,l.readMessage(u,s.StringValue.deserializeBinaryFromReader),o.setUserId(u);break;case 4:u=new s.StringValue,l.readMessage(u,s.StringValue.deserializeBinaryFromReader),o.setDeviceId(u);break;case 5:u=l.readString(),o.addSessionIds(u);break;case 6:u=new s.Int64Value,l.readMessage(u,s.Int64Value.deserializeBinaryFromReader),o.setPeerCreatedTimestamp(u);break;default:l.skipField()}return o},proto.v1.signaling.api.Peer.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.Peer.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.Peer.serializeBinaryToWriter=function(o,l){var u=void 0;(u=o.getPeerId()).length>0&&l.writeString(1,u),(u=o.getOrganizationId()).length>0&&l.writeString(2,u),(u=o.getUserId())!=null&&l.writeMessage(3,u,s.StringValue.serializeBinaryToWriter),(u=o.getDeviceId())!=null&&l.writeMessage(4,u,s.StringValue.serializeBinaryToWriter),(u=o.getSessionIdsList()).length>0&&l.writeRepeatedString(5,u),(u=o.getPeerCreatedTimestamp())!=null&&l.writeMessage(6,u,s.Int64Value.serializeBinaryToWriter)},proto.v1.signaling.api.Peer.prototype.getPeerId=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.Peer.prototype.setPeerId=function(o){return n.Message.setProto3StringField(this,1,o)},proto.v1.signaling.api.Peer.prototype.getOrganizationId=function(){return n.Message.getFieldWithDefault(this,2,"")},proto.v1.signaling.api.Peer.prototype.setOrganizationId=function(o){return n.Message.setProto3StringField(this,2,o)},proto.v1.signaling.api.Peer.prototype.getUserId=function(){return n.Message.getWrapperField(this,s.StringValue,3)},proto.v1.signaling.api.Peer.prototype.setUserId=function(o){return n.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 n.Message.getField(this,3)!=null},proto.v1.signaling.api.Peer.prototype.getDeviceId=function(){return n.Message.getWrapperField(this,s.StringValue,4)},proto.v1.signaling.api.Peer.prototype.setDeviceId=function(o){return n.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 n.Message.getField(this,4)!=null},proto.v1.signaling.api.Peer.prototype.getSessionIdsList=function(){return n.Message.getRepeatedField(this,5)},proto.v1.signaling.api.Peer.prototype.setSessionIdsList=function(o){return n.Message.setField(this,5,o||[])},proto.v1.signaling.api.Peer.prototype.addSessionIds=function(o,l){return n.Message.addToRepeatedField(this,5,o,l)},proto.v1.signaling.api.Peer.prototype.clearSessionIdsList=function(){return this.setSessionIdsList([])},proto.v1.signaling.api.Peer.prototype.getPeerCreatedTimestamp=function(){return n.Message.getWrapperField(this,s.Int64Value,6)},proto.v1.signaling.api.Peer.prototype.setPeerCreatedTimestamp=function(o){return n.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 n.Message.getField(this,6)!=null},n.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,l){var u,m={sessionId:(u=l.getSessionId())&&s.StringValue.toObject(o,u),sessionCreatedTimestamp:(u=l.getSessionCreatedTimestamp())&&s.Int64Value.toObject(o,u),senderId:n.Message.getFieldWithDefault(l,3,""),receiverId:n.Message.getFieldWithDefault(l,4,""),payload:n.Message.getFieldWithDefault(l,5,""),iceServers:n.Message.getFieldWithDefault(l,6,""),iceTransportPolicy:n.Message.getFieldWithDefault(l,7,""),sessionType:n.Message.getFieldWithDefault(l,8,0)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.Signal.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.Signal;return proto.v1.signaling.api.Signal.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.Signal.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new s.StringValue;l.readMessage(u,s.StringValue.deserializeBinaryFromReader),o.setSessionId(u);break;case 2:u=new s.Int64Value,l.readMessage(u,s.Int64Value.deserializeBinaryFromReader),o.setSessionCreatedTimestamp(u);break;case 3:u=l.readString(),o.setSenderId(u);break;case 4:u=l.readString(),o.setReceiverId(u);break;case 5:u=l.readString(),o.setPayload(u);break;case 6:u=l.readString(),o.setIceServers(u);break;case 7:u=l.readString(),o.setIceTransportPolicy(u);break;case 8:u=l.readEnum(),o.setSessionType(u);break;default:l.skipField()}return o},proto.v1.signaling.api.Signal.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.Signal.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.Signal.serializeBinaryToWriter=function(o,l){var u=void 0;(u=o.getSessionId())!=null&&l.writeMessage(1,u,s.StringValue.serializeBinaryToWriter),(u=o.getSessionCreatedTimestamp())!=null&&l.writeMessage(2,u,s.Int64Value.serializeBinaryToWriter),(u=o.getSenderId()).length>0&&l.writeString(3,u),(u=o.getReceiverId()).length>0&&l.writeString(4,u),(u=o.getPayload()).length>0&&l.writeString(5,u),(u=o.getIceServers()).length>0&&l.writeString(6,u),(u=o.getIceTransportPolicy()).length>0&&l.writeString(7,u),(u=o.getSessionType())!==0&&l.writeEnum(8,u)},proto.v1.signaling.api.Signal.prototype.getSessionId=function(){return n.Message.getWrapperField(this,s.StringValue,1)},proto.v1.signaling.api.Signal.prototype.setSessionId=function(o){return n.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 n.Message.getField(this,1)!=null},proto.v1.signaling.api.Signal.prototype.getSessionCreatedTimestamp=function(){return n.Message.getWrapperField(this,s.Int64Value,2)},proto.v1.signaling.api.Signal.prototype.setSessionCreatedTimestamp=function(o){return n.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 n.Message.getField(this,2)!=null},proto.v1.signaling.api.Signal.prototype.getSenderId=function(){return n.Message.getFieldWithDefault(this,3,"")},proto.v1.signaling.api.Signal.prototype.setSenderId=function(o){return n.Message.setProto3StringField(this,3,o)},proto.v1.signaling.api.Signal.prototype.getReceiverId=function(){return n.Message.getFieldWithDefault(this,4,"")},proto.v1.signaling.api.Signal.prototype.setReceiverId=function(o){return n.Message.setProto3StringField(this,4,o)},proto.v1.signaling.api.Signal.prototype.getPayload=function(){return n.Message.getFieldWithDefault(this,5,"")},proto.v1.signaling.api.Signal.prototype.setPayload=function(o){return n.Message.setProto3StringField(this,5,o)},proto.v1.signaling.api.Signal.prototype.getIceServers=function(){return n.Message.getFieldWithDefault(this,6,"")},proto.v1.signaling.api.Signal.prototype.setIceServers=function(o){return n.Message.setProto3StringField(this,6,o)},proto.v1.signaling.api.Signal.prototype.getIceTransportPolicy=function(){return n.Message.getFieldWithDefault(this,7,"")},proto.v1.signaling.api.Signal.prototype.setIceTransportPolicy=function(o){return n.Message.setProto3StringField(this,7,o)},proto.v1.signaling.api.Signal.prototype.getSessionType=function(){return n.Message.getFieldWithDefault(this,8,0)},proto.v1.signaling.api.Signal.prototype.setSessionType=function(o){return n.Message.setProto3EnumField(this,8,o)},n.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,l){var u={};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.CreatePeerRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.CreatePeerRequest;return proto.v1.signaling.api.CreatePeerRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.CreatePeerRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)l.getFieldNumber(),l.skipField();return o},proto.v1.signaling.api.CreatePeerRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.CreatePeerRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.CreatePeerRequest.serializeBinaryToWriter=function(o,l){},n.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,l){var u,m={peer:(u=l.getPeer())&&proto.v1.signaling.api.Peer.toObject(o,u)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.CreatePeerResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.CreatePeerResponse;return proto.v1.signaling.api.CreatePeerResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.CreatePeerResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Peer;l.readMessage(u,proto.v1.signaling.api.Peer.deserializeBinaryFromReader),o.setPeer(u);break;default:l.skipField()}return o},proto.v1.signaling.api.CreatePeerResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.CreatePeerResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.CreatePeerResponse.serializeBinaryToWriter=function(o,l){var u;(u=o.getPeer())!=null&&l.writeMessage(1,u,proto.v1.signaling.api.Peer.serializeBinaryToWriter)},proto.v1.signaling.api.CreatePeerResponse.prototype.getPeer=function(){return n.Message.getWrapperField(this,proto.v1.signaling.api.Peer,1)},proto.v1.signaling.api.CreatePeerResponse.prototype.setPeer=function(o){return n.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 n.Message.getField(this,1)!=null},n.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,l){var u={peerId:n.Message.getFieldWithDefault(l,1,"")};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.DeletePeerRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.DeletePeerRequest;return proto.v1.signaling.api.DeletePeerRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.DeletePeerRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=l.readString();o.setPeerId(u);break;default:l.skipField()}return o},proto.v1.signaling.api.DeletePeerRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.DeletePeerRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.DeletePeerRequest.serializeBinaryToWriter=function(o,l){var u;(u=o.getPeerId()).length>0&&l.writeString(1,u)},proto.v1.signaling.api.DeletePeerRequest.prototype.getPeerId=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.DeletePeerRequest.prototype.setPeerId=function(o){return n.Message.setProto3StringField(this,1,o)},n.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,l){var u={};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.DeletePeerResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.DeletePeerResponse;return proto.v1.signaling.api.DeletePeerResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.DeletePeerResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)l.getFieldNumber(),l.skipField();return o},proto.v1.signaling.api.DeletePeerResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.DeletePeerResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.DeletePeerResponse.serializeBinaryToWriter=function(o,l){},n.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,l){var u,m={peer:(u=l.getPeer())&&proto.v1.signaling.api.Peer.toObject(o,u)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.RefreshPeerRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.RefreshPeerRequest;return proto.v1.signaling.api.RefreshPeerRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.RefreshPeerRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Peer;l.readMessage(u,proto.v1.signaling.api.Peer.deserializeBinaryFromReader),o.setPeer(u);break;default:l.skipField()}return o},proto.v1.signaling.api.RefreshPeerRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.RefreshPeerRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.RefreshPeerRequest.serializeBinaryToWriter=function(o,l){var u;(u=o.getPeer())!=null&&l.writeMessage(1,u,proto.v1.signaling.api.Peer.serializeBinaryToWriter)},proto.v1.signaling.api.RefreshPeerRequest.prototype.getPeer=function(){return n.Message.getWrapperField(this,proto.v1.signaling.api.Peer,1)},proto.v1.signaling.api.RefreshPeerRequest.prototype.setPeer=function(o){return n.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 n.Message.getField(this,1)!=null},n.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,l){var u={};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.RefreshPeerResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.RefreshPeerResponse;return proto.v1.signaling.api.RefreshPeerResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.RefreshPeerResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)l.getFieldNumber(),l.skipField();return o},proto.v1.signaling.api.RefreshPeerResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.RefreshPeerResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.RefreshPeerResponse.serializeBinaryToWriter=function(o,l){},n.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,l){var u={};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.GetPeersRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.GetPeersRequest;return proto.v1.signaling.api.GetPeersRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.GetPeersRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)l.getFieldNumber(),l.skipField();return o},proto.v1.signaling.api.GetPeersRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.GetPeersRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetPeersRequest.serializeBinaryToWriter=function(o,l){},proto.v1.signaling.api.GetPeersResponse.repeatedFields_=[1],n.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,l){var u={peersList:n.Message.toObjectList(l.getPeersList(),proto.v1.signaling.api.Peer.toObject,o)};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.GetPeersResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.GetPeersResponse;return proto.v1.signaling.api.GetPeersResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.GetPeersResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Peer;l.readMessage(u,proto.v1.signaling.api.Peer.deserializeBinaryFromReader),o.addPeers(u);break;default:l.skipField()}return o},proto.v1.signaling.api.GetPeersResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.GetPeersResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetPeersResponse.serializeBinaryToWriter=function(o,l){var u;(u=o.getPeersList()).length>0&&l.writeRepeatedMessage(1,u,proto.v1.signaling.api.Peer.serializeBinaryToWriter)},proto.v1.signaling.api.GetPeersResponse.prototype.getPeersList=function(){return n.Message.getRepeatedWrapperField(this,proto.v1.signaling.api.Peer,1)},proto.v1.signaling.api.GetPeersResponse.prototype.setPeersList=function(o){return n.Message.setRepeatedWrapperField(this,1,o)},proto.v1.signaling.api.GetPeersResponse.prototype.addPeers=function(o,l){return n.Message.addToRepeatedWrapperField(this,1,o,proto.v1.signaling.api.Peer,l)},proto.v1.signaling.api.GetPeersResponse.prototype.clearPeersList=function(){return this.setPeersList([])},n.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,l){var u={};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.GetIceServersRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.GetIceServersRequest;return proto.v1.signaling.api.GetIceServersRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.GetIceServersRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)l.getFieldNumber(),l.skipField();return o},proto.v1.signaling.api.GetIceServersRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.GetIceServersRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetIceServersRequest.serializeBinaryToWriter=function(o,l){},n.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,l){var u={iceServers:n.Message.getFieldWithDefault(l,1,"")};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.GetIceServersResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.GetIceServersResponse;return proto.v1.signaling.api.GetIceServersResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.GetIceServersResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=l.readString();o.setIceServers(u);break;default:l.skipField()}return o},proto.v1.signaling.api.GetIceServersResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.GetIceServersResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.GetIceServersResponse.serializeBinaryToWriter=function(o,l){var u;(u=o.getIceServers()).length>0&&l.writeString(1,u)},proto.v1.signaling.api.GetIceServersResponse.prototype.getIceServers=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.GetIceServersResponse.prototype.setIceServers=function(o){return n.Message.setProto3StringField(this,1,o)},n.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,l){var u,m={signal:(u=l.getSignal())&&proto.v1.signaling.api.Signal.toObject(o,u)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.SendSignalRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.SendSignalRequest;return proto.v1.signaling.api.SendSignalRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.SendSignalRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Signal;l.readMessage(u,proto.v1.signaling.api.Signal.deserializeBinaryFromReader),o.setSignal(u);break;default:l.skipField()}return o},proto.v1.signaling.api.SendSignalRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.SendSignalRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.SendSignalRequest.serializeBinaryToWriter=function(o,l){var u;(u=o.getSignal())!=null&&l.writeMessage(1,u,proto.v1.signaling.api.Signal.serializeBinaryToWriter)},proto.v1.signaling.api.SendSignalRequest.prototype.getSignal=function(){return n.Message.getWrapperField(this,proto.v1.signaling.api.Signal,1)},proto.v1.signaling.api.SendSignalRequest.prototype.setSignal=function(o){return n.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 n.Message.getField(this,1)!=null},n.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,l){var u,m={sessionId:(u=l.getSessionId())&&s.StringValue.toObject(o,u),sessionCreatedTimestamp:(u=l.getSessionCreatedTimestamp())&&s.Int64Value.toObject(o,u)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.SendSignalResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.SendSignalResponse;return proto.v1.signaling.api.SendSignalResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.SendSignalResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new s.StringValue;l.readMessage(u,s.StringValue.deserializeBinaryFromReader),o.setSessionId(u);break;case 2:u=new s.Int64Value,l.readMessage(u,s.Int64Value.deserializeBinaryFromReader),o.setSessionCreatedTimestamp(u);break;default:l.skipField()}return o},proto.v1.signaling.api.SendSignalResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.SendSignalResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.SendSignalResponse.serializeBinaryToWriter=function(o,l){var u=void 0;(u=o.getSessionId())!=null&&l.writeMessage(1,u,s.StringValue.serializeBinaryToWriter),(u=o.getSessionCreatedTimestamp())!=null&&l.writeMessage(2,u,s.Int64Value.serializeBinaryToWriter)},proto.v1.signaling.api.SendSignalResponse.prototype.getSessionId=function(){return n.Message.getWrapperField(this,s.StringValue,1)},proto.v1.signaling.api.SendSignalResponse.prototype.setSessionId=function(o){return n.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 n.Message.getField(this,1)!=null},proto.v1.signaling.api.SendSignalResponse.prototype.getSessionCreatedTimestamp=function(){return n.Message.getWrapperField(this,s.Int64Value,2)},proto.v1.signaling.api.SendSignalResponse.prototype.setSessionCreatedTimestamp=function(o){return n.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 n.Message.getField(this,2)!=null},n.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,l){var u={peerId:n.Message.getFieldWithDefault(l,1,"")};return o&&(u.$jspbMessageInstance=l),u}),proto.v1.signaling.api.ReceiveSignalStreamRequest.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.ReceiveSignalStreamRequest;return proto.v1.signaling.api.ReceiveSignalStreamRequest.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.ReceiveSignalStreamRequest.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=l.readString();o.setPeerId(u);break;default:l.skipField()}return o},proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.ReceiveSignalStreamRequest.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.ReceiveSignalStreamRequest.serializeBinaryToWriter=function(o,l){var u;(u=o.getPeerId()).length>0&&l.writeString(1,u)},proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.getPeerId=function(){return n.Message.getFieldWithDefault(this,1,"")},proto.v1.signaling.api.ReceiveSignalStreamRequest.prototype.setPeerId=function(o){return n.Message.setProto3StringField(this,1,o)},n.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,l){var u,m={signal:(u=l.getSignal())&&proto.v1.signaling.api.Signal.toObject(o,u)};return o&&(m.$jspbMessageInstance=l),m}),proto.v1.signaling.api.ReceiveSignalStreamResponse.deserializeBinary=function(o){var l=new n.BinaryReader(o),u=new proto.v1.signaling.api.ReceiveSignalStreamResponse;return proto.v1.signaling.api.ReceiveSignalStreamResponse.deserializeBinaryFromReader(u,l)},proto.v1.signaling.api.ReceiveSignalStreamResponse.deserializeBinaryFromReader=function(o,l){for(;l.nextField()&&!l.isEndGroup();)switch(l.getFieldNumber()){case 1:var u=new proto.v1.signaling.api.Signal;l.readMessage(u,proto.v1.signaling.api.Signal.deserializeBinaryFromReader),o.setSignal(u);break;default:l.skipField()}return o},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.serializeBinary=function(){var o=new n.BinaryWriter;return proto.v1.signaling.api.ReceiveSignalStreamResponse.serializeBinaryToWriter(this,o),o.getResultBuffer()},proto.v1.signaling.api.ReceiveSignalStreamResponse.serializeBinaryToWriter=function(o,l){var u;(u=o.getSignal())!=null&&l.writeMessage(1,u,proto.v1.signaling.api.Signal.serializeBinaryToWriter)},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.getSignal=function(){return n.Message.getWrapperField(this,proto.v1.signaling.api.Signal,1)},proto.v1.signaling.api.ReceiveSignalStreamResponse.prototype.setSignal=function(o){return n.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 n.Message.getField(this,1)!=null},proto.v1.signaling.api.SessionType={UNKNOWN:0,TELEOP:1,PORT_FORWARD:2},i.object.extend(t,proto.v1.signaling.api)},function(e,t,r){function n(y){return(n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S})(y)}function i(y,S){return!S||n(S)!=="object"&&typeof S!="function"?g(y):S}function g(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y}function s(y){var S=typeof Map=="function"?new Map:void 0;return(s=function(c){if(c===null||(w=c,Function.toString.call(w).indexOf("[native code]")===-1))return c;var w;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(S!==void 0){if(S.has(c))return S.get(c);S.set(c,E)}function E(){return o(c,arguments,m(this).constructor)}return E.prototype=Object.create(c.prototype,{constructor:{value:E,enumerable:!1,writable:!0,configurable:!0}}),u(E,c)})(y)}function o(y,S,c){return(o=l()?Reflect.construct:function(w,E,P){var F=[null];F.push.apply(F,E);var M=new(Function.bind.apply(w,F));return P&&u(M,P.prototype),M}).apply(null,arguments)}function l(){if(typeof Reflect=="undefined"||!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(y,S){return(u=Object.setPrototypeOf||function(c,w){return c.__proto__=w,c})(y,S)}function m(y){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(S){return S.__proto__||Object.getPrototypeOf(S)})(y)}var R=function(y){(function(P,F){if(typeof F!="function"&&F!==null)throw new TypeError("Super expression must either be null or a function");P.prototype=Object.create(F&&F.prototype,{constructor:{value:P,writable:!0,configurable:!0}}),F&&u(P,F)})(E,y);var S,c,w=(S=E,c=l(),function(){var P,F=m(S);if(c){var M=m(this).constructor;P=Reflect.construct(F,arguments,M)}else P=F.apply(this,arguments);return i(this,P)});function E(P){var F;return function(M,A){if(!(M instanceof A))throw new TypeError("Cannot call a class as a function")}(this,E),F=w.call(this,`Format functions must be synchronous taking a two arguments: (info, opts)
3
3
  Found: `.concat(P.toString().split(`
4
4
  `)[0],`
@@ -12,11 +12,11 @@ Found: `.concat(P.toString().split(`
12
12
  `+Y.split(`
13
13
  `).map(function(Q){return" "+Q}).join(`
14
14
  `)):Y=T.stylize("[Circular]","special")),M(k)){if(B&&f.match(/^\d+$/))return Y;(k=JSON.stringify(""+f)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(k=k.substr(1,k.length-2),k=T.stylize(k,"name")):(k=k.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),k=T.stylize(k,"string"))}return k+": "+Y}function c(T){return Array.isArray(T)}function w(T){return typeof T=="boolean"}function E(T){return T===null}function P(T){return typeof T=="number"}function F(T){return typeof T=="string"}function M(T){return T===void 0}function A(T){return p(T)&&h(T)==="[object RegExp]"}function p(T){return typeof T=="object"&&T!==null}function N(T){return p(T)&&h(T)==="[object Date]"}function $(T){return p(T)&&(h(T)==="[object Error]"||T instanceof Error)}function q(T){return typeof T=="function"}function h(T){return Object.prototype.toString.call(T)}function d(T){return T<10?"0"+T.toString(10):T.toString(10)}t.debuglog=function(T){if(M(s)&&(s=n.env.NODE_DEBUG||""),T=T.toUpperCase(),!o[T])if(new RegExp("\\b"+T+"\\b","i").test(s)){var C=n.pid;o[T]=function(){var U=t.format.apply(t,arguments);console.error("%s %d: %s",T,C,U)}}else o[T]=function(){};return o[T]},t.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=c,t.isBoolean=w,t.isNull=E,t.isNullOrUndefined=function(T){return T==null},t.isNumber=P,t.isString=F,t.isSymbol=function(T){return typeof T=="symbol"},t.isUndefined=M,t.isRegExp=A,t.isObject=p,t.isDate=N,t.isError=$,t.isFunction=q,t.isPrimitive=function(T){return T===null||typeof T=="boolean"||typeof T=="number"||typeof T=="string"||typeof T=="symbol"||T===void 0},t.isBuffer=r(106);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function _(){var T=new Date,C=[d(T.getHours()),d(T.getMinutes()),d(T.getSeconds())].join(":");return[T.getDate(),O[T.getMonth()],C].join(" ")}function x(T,C){return Object.prototype.hasOwnProperty.call(T,C)}t.log=function(){console.log("%s - %s",_(),t.format.apply(t,arguments))},t.inherits=r(107),t._extend=function(T,C){if(!C||!p(C))return T;for(var U=Object.keys(C),b=U.length;b--;)T[U[b]]=C[U[b]];return T};var D=typeof Symbol!="undefined"?Symbol("util.promisify.custom"):void 0;function L(T,C){if(!T){var U=new Error("Promise was rejected with a falsy value");U.reason=T,T=U}return C(T)}t.promisify=function(T){if(typeof T!="function")throw new TypeError('The "original" argument must be of type Function');if(D&&T[D]){var C;if(typeof(C=T[D])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(C,D,{value:C,enumerable:!1,writable:!1,configurable:!0}),C}function C(){for(var U,b,f=new Promise(function(Y,K){U=Y,b=K}),B=[],k=0;k<arguments.length;k++)B.push(arguments[k]);B.push(function(Y,K){Y?b(Y):U(K)});try{T.apply(this,B)}catch(Y){b(Y)}return f}return Object.setPrototypeOf(C,Object.getPrototypeOf(T)),D&&Object.defineProperty(C,D,{value:C,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(C,i(T))},t.promisify.custom=D,t.callbackify=function(T){if(typeof T!="function")throw new TypeError('The "original" argument must be of type Function');function C(){for(var U=[],b=0;b<arguments.length;b++)U.push(arguments[b]);var f=U.pop();if(typeof f!="function")throw new TypeError("The last argument must be of type Function");var B=this,k=function(){return f.apply(B,arguments)};T.apply(this,U).then(function(Y){n.nextTick(k,null,Y)},function(Y){n.nextTick(L,Y,k)})}return Object.setPrototypeOf(C,Object.getPrototypeOf(T)),Object.defineProperties(C,i(T)),C}}).call(this,r(2))},function(e,t,r){r.d(t,"a",function(){return n});const n=i=>new Promise(g=>setTimeout(g,i||0))},function(e,t,r){(function(n){var i=n!==void 0&&n||typeof self!="undefined"&&self||window,g=Function.prototype.apply;function s(o,l){this._id=o,this._clearFn=l}t.setTimeout=function(){return new s(g.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new s(g.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(o){o&&o.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(o,l){clearTimeout(o._idleTimeoutId),o._idleTimeout=l},t.unenroll=function(o){clearTimeout(o._idleTimeoutId),o._idleTimeout=-1},t._unrefActive=t.active=function(o){clearTimeout(o._idleTimeoutId);var l=o._idleTimeout;l>=0&&(o._idleTimeoutId=setTimeout(function(){o._onTimeout&&o._onTimeout()},l))},r(140),t.setImmediate=typeof self!="undefined"&&self.setImmediate||n!==void 0&&n.setImmediate||this&&this.setImmediate,t.clearImmediate=typeof self!="undefined"&&self.clearImmediate||n!==void 0&&n.clearImmediate||this&&this.clearImmediate}).call(this,r(5))},function(e,t,r){(function(n){n===void 0||!n.version||n.version.indexOf("v0.")===0||n.version.indexOf("v1.")===0&&n.version.indexOf("v1.8.")!==0?e.exports={nextTick:function(i,g,s,o){if(typeof i!="function")throw new TypeError('"callback" argument must be a function');var l,u,m=arguments.length;switch(m){case 0:case 1:return n.nextTick(i);case 2:return n.nextTick(function(){i.call(null,g)});case 3:return n.nextTick(function(){i.call(null,g,s)});case 4:return n.nextTick(function(){i.call(null,g,s,o)});default:for(l=new Array(m-1),u=0;u<l.length;)l[u++]=arguments[u];return n.nextTick(function(){i.apply(null,l)})}}}:e.exports=n}).call(this,r(2))},function(e,t,r){(function(n){function i(g){return Object.prototype.toString.call(g)}t.isArray=function(g){return Array.isArray?Array.isArray(g):i(g)==="[object Array]"},t.isBoolean=function(g){return typeof g=="boolean"},t.isNull=function(g){return g===null},t.isNullOrUndefined=function(g){return g==null},t.isNumber=function(g){return typeof g=="number"},t.isString=function(g){return typeof g=="string"},t.isSymbol=function(g){return typeof g=="symbol"},t.isUndefined=function(g){return g===void 0},t.isRegExp=function(g){return i(g)==="[object RegExp]"},t.isObject=function(g){return typeof g=="object"&&g!==null},t.isDate=function(g){return i(g)==="[object Date]"},t.isError=function(g){return i(g)==="[object Error]"||g instanceof Error},t.isFunction=function(g){return typeof g=="function"},t.isPrimitive=function(g){return g===null||typeof g=="boolean"||typeof g=="number"||typeof g=="string"||typeof g=="symbol"||g===void 0},t.isBuffer=n.isBuffer}).call(this,r(4).Buffer)},function(e,t){t.endianness=function(){return"LE"},t.hostname=function(){return typeof location!="undefined"?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return typeof navigator!="undefined"?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL=`
15
- `,t.homedir=function(){return"/"}},function(e,t,r){var n=r(56),i=r(59).warn,g=t;g.version=r(137).version,g.transports=r(138),g.config=r(47),g.addColors=n.levels,g.format=n.format,g.createLogger=r(85),g.ExceptionHandler=r(86),g.RejectionHandler=r(90),g.Container=r(209),g.Transport=r(17),g.loggers=new g.Container;var s=g.createLogger();Object.keys(g.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(function(o){return g[o]=function(){return s[o].apply(s,arguments)}}),Object.defineProperty(g,"level",{get:function(){return s.level},set:function(o){s.level=o}}),Object.defineProperty(g,"exceptions",{get:function(){return s.exceptions}}),["exitOnError"].forEach(function(o){Object.defineProperty(g,o,{get:function(){return s[o]},set:function(l){s[o]=l}})}),Object.defineProperty(g,"default",{get:function(){return{exceptionHandlers:s.exceptionHandlers,rejectionHandlers:s.rejectionHandlers,transports:s.transports}}}),i.deprecated(g,"setLevels"),i.forFunctions(g,"useFormat",["cli"]),i.forProperties(g,"useFormat",["padLevels","stripColors"]),i.forFunctions(g,"deprecated",["addRewriter","addFilter","clone","extend"]),i.forProperties(g,"deprecated",["emitErrs","levelLength"]),i.moved(g,"createLogger","Logger")},function(e,t,r){var n=r(10),i=r(141),g=r(3).LEVEL,s=e.exports=function(){var o=this,l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};i.call(this,{objectMode:!0,highWaterMark:l.highWaterMark}),this.format=l.format,this.level=l.level,this.handleExceptions=l.handleExceptions,this.handleRejections=l.handleRejections,this.silent=l.silent,l.log&&(this.log=l.log),l.logv&&(this.logv=l.logv),l.close&&(this.close=l.close),this.once("pipe",function(u){o.levels=u.levels,o.parent=u}),this.once("unpipe",function(u){u===o.parent&&(o.parent=null,o.close&&o.close())})};n.inherits(s,i),s.prototype._write=function(o,l,u){if(this.silent||o.exception===!0&&!this.handleExceptions)return u(null);var m=this.level||this.parent&&this.parent.level;if(!m||this.levels[m]>=this.levels[o[g]]){if(o&&!this.format)return this.log(o,u);var R=void 0,y=void 0;try{y=this.format.transform(Object.assign({},o),this.format.options)}catch(S){R=S}if(R||!y){if(u(),R)throw R;return}return this.log(y,u)}return u(null)},s.prototype._writev=function(o,l){if(this.logv){var u=o.filter(this._accept,this);return u.length?this.logv(u,l):l(null)}for(var m=0;m<o.length;m++)if(this._accept(o[m]))if(!o[m].chunk||this.format){var R=void 0,y=void 0;try{y=this.format.transform(Object.assign({},o[m].chunk),this.format.options)}catch(S){R=S}if(R||!y){if(o[m].callback(),R)throw l(null),R}else this.log(y,o[m].callback)}else this.log(o[m].chunk,o[m].callback);return l(null)},s.prototype._accept=function(o){var l=o.chunk;if(this.silent)return!1;var u=this.level||this.parent&&this.parent.level;return!(l.exception!==!0&&u&&!(this.levels[u]>=this.levels[l[g]])||!this.handleExceptions&&l.exception===!0)},s.prototype._nop=function(){},e.exports.LegacyTransportStream=r(147)},function(e,t,r){var n,i=typeof Reflect=="object"?Reflect:null,g=i&&typeof i.apply=="function"?i.apply:function(E,P,F){return Function.prototype.apply.call(E,P,F)};n=i&&typeof i.ownKeys=="function"?i.ownKeys:Object.getOwnPropertySymbols?function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:function(E){return Object.getOwnPropertyNames(E)};var s=Number.isNaN||function(E){return E!=E};function o(){o.init.call(this)}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function u(E){return E._maxListeners===void 0?o.defaultMaxListeners:E._maxListeners}function m(E,P,F,M){var A,p,N,$;if(typeof F!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof F);if((p=E._events)===void 0?(p=E._events=Object.create(null),E._eventsCount=0):(p.newListener!==void 0&&(E.emit("newListener",P,F.listener?F.listener:F),p=E._events),N=p[P]),N===void 0)N=p[P]=F,++E._eventsCount;else if(typeof N=="function"?N=p[P]=M?[F,N]:[N,F]:M?N.unshift(F):N.push(F),(A=u(E))>0&&N.length>A&&!N.warned){N.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(P)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=E,q.type=P,q.count=N.length,$=q,console&&console.warn&&console.warn($)}return E}function R(){for(var E=[],P=0;P<arguments.length;P++)E.push(arguments[P]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,g(this.listener,this.target,E))}function y(E,P,F){var M={fired:!1,wrapFn:void 0,target:E,type:P,listener:F},A=R.bind(M);return A.listener=F,M.wrapFn=A,A}function S(E,P,F){var M=E._events;if(M===void 0)return[];var A=M[P];return A===void 0?[]:typeof A=="function"?F?[A.listener||A]:[A]:F?function(p){for(var N=new Array(p.length),$=0;$<N.length;++$)N[$]=p[$].listener||p[$];return N}(A):w(A,A.length)}function c(E){var P=this._events;if(P!==void 0){var F=P[E];if(typeof F=="function")return 1;if(F!==void 0)return F.length}return 0}function w(E,P){for(var F=new Array(P),M=0;M<P;++M)F[M]=E[M];return F}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(E){if(typeof E!="number"||E<0||s(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");l=E}}),o.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(E){if(typeof E!="number"||E<0||s(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(E){for(var P=[],F=1;F<arguments.length;F++)P.push(arguments[F]);var M=E==="error",A=this._events;if(A!==void 0)M=M&&A.error===void 0;else if(!M)return!1;if(M){var p;if(P.length>0&&(p=P[0]),p instanceof Error)throw p;var N=new Error("Unhandled error."+(p?" ("+p.message+")":""));throw N.context=p,N}var $=A[E];if($===void 0)return!1;if(typeof $=="function")g($,this,P);else{var q=$.length,h=w($,q);for(F=0;F<q;++F)g(h[F],this,P)}return!0},o.prototype.addListener=function(E,P){return m(this,E,P,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(E,P){return m(this,E,P,!0)},o.prototype.once=function(E,P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P);return this.on(E,y(this,E,P)),this},o.prototype.prependOnceListener=function(E,P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P);return this.prependListener(E,y(this,E,P)),this},o.prototype.removeListener=function(E,P){var F,M,A,p,N;if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P);if((M=this._events)===void 0)return this;if((F=M[E])===void 0)return this;if(F===P||F.listener===P)--this._eventsCount==0?this._events=Object.create(null):(delete M[E],M.removeListener&&this.emit("removeListener",E,F.listener||P));else if(typeof F!="function"){for(A=-1,p=F.length-1;p>=0;p--)if(F[p]===P||F[p].listener===P){N=F[p].listener,A=p;break}if(A<0)return this;A===0?F.shift():function($,q){for(;q+1<$.length;q++)$[q]=$[q+1];$.pop()}(F,A),F.length===1&&(M[E]=F[0]),M.removeListener!==void 0&&this.emit("removeListener",E,N||P)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(E){var P,F,M;if((F=this._events)===void 0)return this;if(F.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):F[E]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete F[E]),this;if(arguments.length===0){var A,p=Object.keys(F);for(M=0;M<p.length;++M)(A=p[M])!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(P=F[E])=="function")this.removeListener(E,P);else if(P!==void 0)for(M=P.length-1;M>=0;M--)this.removeListener(E,P[M]);return this},o.prototype.listeners=function(E){return S(this,E,!0)},o.prototype.rawListeners=function(E){return S(this,E,!1)},o.listenerCount=function(E,P){return typeof E.listenerCount=="function"?E.listenerCount(P):c.call(E,P)},o.prototype.listenerCount=c,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){var n=r(146).Buffer,i=n.isEncoding||function(c){switch((c=""+c)&&c.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function g(c){var w;switch(this.encoding=function(E){var P=function(F){if(!F)return"utf8";for(var M;;)switch(F){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return F;default:if(M)return;F=(""+F).toLowerCase(),M=!0}}(E);if(typeof P!="string"&&(n.isEncoding===i||!i(E)))throw new Error("Unknown encoding: "+E);return P||E}(c),this.encoding){case"utf16le":this.text=l,this.end=u,w=4;break;case"utf8":this.fillLast=o,w=4;break;case"base64":this.text=m,this.end=R,w=3;break;default:return this.write=y,void(this.end=S)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(w)}function s(c){return c<=127?0:c>>5==6?2:c>>4==14?3:c>>3==30?4:c>>6==2?-1:-2}function o(c){var w=this.lastTotal-this.lastNeed,E=function(P,F,M){if((192&F[0])!=128)return P.lastNeed=0,"\uFFFD";if(P.lastNeed>1&&F.length>1){if((192&F[1])!=128)return P.lastNeed=1,"\uFFFD";if(P.lastNeed>2&&F.length>2&&(192&F[2])!=128)return P.lastNeed=2,"\uFFFD"}}(this,c);return E!==void 0?E:this.lastNeed<=c.length?(c.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(c.copy(this.lastChar,w,0,c.length),void(this.lastNeed-=c.length))}function l(c,w){if((c.length-w)%2==0){var E=c.toString("utf16le",w);if(E){var P=E.charCodeAt(E.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=c[c.length-1],c.toString("utf16le",w,c.length-1)}function u(c){var w=c&&c.length?this.write(c):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,E)}return w}function m(c,w){var E=(c.length-w)%3;return E===0?c.toString("base64",w):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=c[c.length-1]:(this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1]),c.toString("base64",w,c.length-E))}function R(c){var w=c&&c.length?this.write(c):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function y(c){return c.toString(this.encoding)}function S(c){return c&&c.length?this.write(c):""}t.StringDecoder=g,g.prototype.write=function(c){if(c.length===0)return"";var w,E;if(this.lastNeed){if((w=this.fillLast(c))===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<c.length?w?w+this.text(c,E):this.text(c,E):w||""},g.prototype.end=function(c){var w=c&&c.length?this.write(c):"";return this.lastNeed?w+"\uFFFD":w},g.prototype.text=function(c,w){var E=function(F,M,A){var p=M.length-1;if(p<A)return 0;var N=s(M[p]);return N>=0?(N>0&&(F.lastNeed=N-1),N):--p<A||N===-2?0:(N=s(M[p]))>=0?(N>0&&(F.lastNeed=N-2),N):--p<A||N===-2?0:(N=s(M[p]))>=0?(N>0&&(N===2?N=0:F.lastNeed=N-3),N):0}(this,c,w);if(!this.lastNeed)return c.toString("utf8",w);this.lastTotal=E;var P=c.length-(E-this.lastNeed);return c.copy(this.lastChar,0,P),c.toString("utf8",w,P)},g.prototype.fillLast=function(c){if(this.lastNeed<=c.length)return c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,c.length),this.lastNeed-=c.length}},function(e,t,r){var n=r(13),i=Object.keys||function(c){var w=[];for(var E in c)w.push(E);return w};e.exports=R;var g=r(14);g.inherits=r(6);var s=r(67),o=r(44);g.inherits(R,s);for(var l=i(o.prototype),u=0;u<l.length;u++){var m=l[u];R.prototype[m]||(R.prototype[m]=o.prototype[m])}function R(c){if(!(this instanceof R))return new R(c);s.call(this,c),o.call(this,c),c&&c.readable===!1&&(this.readable=!1),c&&c.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,c&&c.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",y)}function y(){this.allowHalfOpen||this._writableState.ended||n.nextTick(S,this)}function S(c){c.end()}Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(R.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(c){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}),R.prototype._destroy=function(c,w){this.push(null),this.end(),n.nextTick(w,c)}},function(e,t,r){e.exports=function(n,i){i||(i={}),typeof i=="function"&&(i={cmp:i});var g,s=typeof i.cycles=="boolean"&&i.cycles,o=i.cmp&&(g=i.cmp,function(u){return function(m,R){var y={key:m,value:u[m]},S={key:R,value:u[R]};return g(y,S)}}),l=[];return function u(m){if(m&&m.toJSON&&typeof m.toJSON=="function"&&(m=m.toJSON()),m!==void 0){if(typeof m=="number")return isFinite(m)?""+m:"null";if(typeof m!="object")return JSON.stringify(m);var R,y;if(Array.isArray(m)){for(y="[",R=0;R<m.length;R++)R&&(y+=","),y+=u(m[R])||"null";return y+"]"}if(m===null)return"null";if(l.indexOf(m)!==-1){if(s)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var S=l.push(m)-1,c=Object.keys(m).sort(o&&o(m));for(y="",R=0;R<c.length;R++){var w=c[R],E=u(m[w]);E&&(y&&(y+=","),y+=JSON.stringify(w)+":"+E)}return l.splice(S,1),"{"+y+"}"}}(n)}},function(e,t,r){(function(n){function i(I){var H=0;return function(){return H<I.length?{done:!1,value:I[H++]}:{done:!0}}}var g=typeof Object.defineProperties=="function"?Object.defineProperty:function(I,H,X){I!=Array.prototype&&I!=Object.prototype&&(I[H]=X.value)},s=function(I){I=[typeof window=="object"&&window,typeof self=="object"&&self,typeof n=="object"&&n,I];for(var H=0;H<I.length;++H){var X=I[H];if(X&&X.Math==Math)return X}throw Error("Cannot find global object")}(this);function o(I,H){if(H){var X=s;I=I.split(".");for(var ne=0;ne<I.length-1;ne++){var le=I[ne];le in X||(X[le]={}),X=X[le]}(H=H(ne=X[I=I[I.length-1]]))!=ne&&H!=null&&g(X,I,{configurable:!0,writable:!0,value:H})}}function l(I){var H=typeof Symbol!="undefined"&&Symbol.iterator&&I[Symbol.iterator];return H?H.call(I):{next:i(I)}}o("Object.is",function(I){return I||function(H,X){return H===X?H!==0||1/H==1/X:H!=H&&X!=X}}),o("Array.prototype.includes",function(I){return I||function(H,X){var ne=this;ne instanceof String&&(ne=String(ne));var le=ne.length;for(0>(X=X||0)&&(X=Math.max(X+le,0));X<le;X++){var pe=ne[X];if(pe===H||Object.is(pe,H))return!0}return!1}}),o("Promise",function(I){function H(ae){this.b=0,this.c=void 0,this.a=[];var ce=this.f();try{ae(ce.resolve,ce.reject)}catch(be){ce.reject(be)}}function X(){this.a=null}function ne(ae){return ae instanceof H?ae:new H(function(ce){ce(ae)})}if(I)return I;X.prototype.b=function(ae){if(this.a==null){this.a=[];var ce=this;this.c(function(){ce.g()})}this.a.push(ae)};var le=s.setTimeout;X.prototype.c=function(ae){le(ae,0)},X.prototype.g=function(){for(;this.a&&this.a.length;){var ae=this.a;this.a=[];for(var ce=0;ce<ae.length;++ce){var be=ae[ce];ae[ce]=null;try{be()}catch(ye){this.f(ye)}}}this.a=null},X.prototype.f=function(ae){this.c(function(){throw ae})},H.prototype.f=function(){function ae(ye){return function(ve){be||(be=!0,ye.call(ce,ve))}}var ce=this,be=!1;return{resolve:ae(this.m),reject:ae(this.g)}},H.prototype.m=function(ae){if(ae===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(ae instanceof H)this.o(ae);else{e:switch(typeof ae){case"object":var ce=ae!=null;break e;case"function":ce=!0;break e;default:ce=!1}ce?this.l(ae):this.h(ae)}},H.prototype.l=function(ae){var ce=void 0;try{ce=ae.then}catch(be){return void this.g(be)}typeof ce=="function"?this.u(ce,ae):this.h(ae)},H.prototype.g=function(ae){this.i(2,ae)},H.prototype.h=function(ae){this.i(1,ae)},H.prototype.i=function(ae,ce){if(this.b!=0)throw Error("Cannot settle("+ae+", "+ce+"): Promise already settled in state"+this.b);this.b=ae,this.c=ce,this.j()},H.prototype.j=function(){if(this.a!=null){for(var ae=0;ae<this.a.length;++ae)pe.b(this.a[ae]);this.a=null}};var pe=new X;return H.prototype.o=function(ae){var ce=this.f();ae.w(ce.resolve,ce.reject)},H.prototype.u=function(ae,ce){var be=this.f();try{ae.call(ce,be.resolve,be.reject)}catch(ye){be.reject(ye)}},H.prototype.then=function(ae,ce){function be(Te,Ie){return typeof Te=="function"?function(je){try{ye(Te(je))}catch(Me){ve(Me)}}:Ie}var ye,ve,Ae=new H(function(Te,Ie){ye=Te,ve=Ie});return this.w(be(ae,ye),be(ce,ve)),Ae},H.prototype.catch=function(ae){return this.then(void 0,ae)},H.prototype.w=function(ae,ce){function be(){switch(ye.b){case 1:ae(ye.c);break;case 2:ce(ye.c);break;default:throw Error("Unexpected state: "+ye.b)}}var ye=this;this.a==null?pe.b(be):this.a.push(be)},H.resolve=ne,H.reject=function(ae){return new H(function(ce,be){be(ae)})},H.race=function(ae){return new H(function(ce,be){for(var ye=l(ae),ve=ye.next();!ve.done;ve=ye.next())ne(ve.value).w(ce,be)})},H.all=function(ae){var ce=l(ae),be=ce.next();return be.done?ne([]):new H(function(ye,ve){function Ae(je){return function(Me){Te[je]=Me,--Ie==0&&ye(Te)}}var Te=[],Ie=0;do Te.push(void 0),Ie++,ne(be.value).w(Ae(Te.length-1),ve),be=ce.next();while(!be.done)})},H});var u=u||{},m=this||self;function R(I,H){I=I.split("."),H=H||m;for(var X=0;X<I.length;X++)if((H=H[I[X]])==null)return null;return H}function y(){}function S(I){var H=typeof I;if(H=="object"){if(!I)return"null";if(I instanceof Array)return"array";if(I instanceof Object)return H;var X=Object.prototype.toString.call(I);if(X=="[object Window]")return"object";if(X=="[object Array]"||typeof I.length=="number"&&I.splice!==void 0&&I.propertyIsEnumerable!==void 0&&!I.propertyIsEnumerable("splice"))return"array";if(X=="[object Function]"||I.call!==void 0&&I.propertyIsEnumerable!==void 0&&!I.propertyIsEnumerable("call"))return"function"}else if(H=="function"&&I.call===void 0)return"object";return H}function c(I){var H=typeof I;return H=="object"&&I!=null||H=="function"}function w(I,H,X){return I.call.apply(I.bind,arguments)}function E(I,H,X){if(!I)throw Error();if(2<arguments.length){var ne=Array.prototype.slice.call(arguments,2);return function(){var le=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(le,ne),I.apply(H,le)}}return function(){return I.apply(H,arguments)}}function P(I,H,X){return(P=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?w:E).apply(null,arguments)}function F(I,H){function X(){}X.prototype=H.prototype,I.S=H.prototype,I.prototype=new X,I.prototype.constructor=I}function M(){this.a={}}function A(I,H,X,ne){this.f=I,this.c=H,this.b=X,this.a=ne}function p(I,H,X,ne){X=X===void 0?{}:X,this.c=I,this.a=X,this.b=H,this.f=ne===void 0?null:ne}function N(I,H,X,ne,le,pe){this.name=I,this.a=le,this.b=pe}function $(I,H,X){X=X===void 0?{}:X;var ne=ne===void 0?new M:ne;return new A(H,I,X,ne)}function q(I,H,X,ne){return ne instanceof N?ne:new N(I,X,ne.b||H.constructor,ne.f,ne.a,ne.c)}function h(I){this.a=I}function d(I){switch(I){case 0:return"No Error";case 1:return"Access denied to content document";case 2:return"File not found";case 3:return"Firefox silently errored";case 4:return"Application custom error";case 5:return"An exception occurred";case 6:return"Http response at 400 or 500 level";case 7:return"Request was aborted";case 8:return"Request timed out";case 9:return"The resource is not available offline";default:return"Unrecognized error code"}}function O(I){if(Error.captureStackTrace)Error.captureStackTrace(this,O);else{var H=Error().stack;H&&(this.stack=H)}I&&(this.message=String(I))}function _(I,H){for(var X="",ne=(I=I.split("%s")).length-1,le=0;le<ne;le++)X+=I[le]+(le<H.length?H[le]:"%s");O.call(this,X+I[ne])}function x(){this.j=null,this.i=[],this.l=0,this.b=D,this.f=this.a=this.h=0,this.c=null,this.g=0}M.prototype.get=function(I){return this.a[I]},M.prototype.f=function(){return Object.keys(this.a)},A.prototype.getRequestMessage=function(){return this.f},A.prototype.getMethodDescriptor=function(){return this.c},A.prototype.getMetadata=function(){return this.b},A.prototype.getCallOptions=function(){return this.a},p.prototype.getResponseMessage=function(){return this.c},p.prototype.getMetadata=function(){return this.a},p.prototype.getMethodDescriptor=function(){return this.b},p.prototype.getStatus=function(){return this.f},h.prototype.on=function(I,H){return I=="data"||I=="error"?this:this.a.on(I,H)},h.prototype.removeListener=function(I,H){return this.a.removeListener(I,H)},h.prototype.cancel=function(){this.a.cancel()},F(O,Error),O.prototype.name="CustomError",F(_,O),_.prototype.name="AssertionError";var D=0,L=1,T=2,C=3,U=0,b=128;function f(I,H,X,ne){throw I.b=C,I.j="The stream is broken @"+I.l+"/"+X+". Error: "+ne+`. With input:
16
- `+H,Error(I.j)}var B=Array.prototype.indexOf?function(I,H){return Array.prototype.indexOf.call(I,H,void 0)}:function(I,H){if(typeof I=="string")return typeof H!="string"||H.length!=1?-1:I.indexOf(H,0);for(var X=0;X<I.length;X++)if(X in I&&I[X]===H)return X;return-1},k,Y=String.prototype.trim?function(I){return I.trim()}:function(I){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(I)[1]};function K(I,H){return I.indexOf(H)!=-1}function Q(I,H){return I<H?-1:I>H?1:0}e:{var G=m.navigator;if(G){var V=G.userAgent;if(V){k=V;break e}}k=""}var v="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function j(I){var H=1;I=I.split(":");for(var X=[];0<H&&I.length;)X.push(I.shift()),H--;return I.length&&X.push(I.join(":")),X}function W(I){return W[" "](I),I}W[" "]=y;var ee,J,re=K(k,"Opera"),se=K(k,"Trident")||K(k,"MSIE"),oe=K(k,"Edge"),z=K(k,"Gecko")&&!(K(k.toLowerCase(),"webkit")&&!K(k,"Edge"))&&!(K(k,"Trident")||K(k,"MSIE"))&&!K(k,"Edge"),Z=K(k.toLowerCase(),"webkit")&&!K(k,"Edge");function te(){var I=m.document;return I?I.documentMode:void 0}e:{var ge="",ie=(J=k,z?/rv:([^\);]+)(\)|;)/.exec(J):oe?/Edge\/([\d\.]+)/.exec(J):se?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(J):Z?/WebKit\/(\S+)/.exec(J):re?/(?:Version)[ \/]?(\S+)/.exec(J):void 0);if(ie&&(ge=ie?ie[1]:""),se){var he=te();if(he!=null&&he>parseFloat(ge)){ee=String(he);break e}}ee=ge}var de,me={};function fe(I){return function(H,X){var ne=me;return Object.prototype.hasOwnProperty.call(ne,H)?ne[H]:ne[H]=X(H)}(I,function(){for(var H=0,X=Y(String(ee)).split("."),ne=Y(String(I)).split("."),le=Math.max(X.length,ne.length),pe=0;H==0&&pe<le;pe++){var ae=X[pe]||"",ce=ne[pe]||"";do{if(ae=/(\d*)(\D*)(.*)/.exec(ae)||["","","",""],ce=/(\d*)(\D*)(.*)/.exec(ce)||["","","",""],ae[0].length==0&&ce[0].length==0)break;H=Q(ae[1].length==0?0:parseInt(ae[1],10),ce[1].length==0?0:parseInt(ce[1],10))||Q(ae[2].length==0,ce[2].length==0)||Q(ae[2],ce[2]),ae=ae[3],ce=ce[3]}while(H==0)}return 0<=H})}if(m.document&&se){var ue=te();de=ue||parseInt(ee,10)||void 0}else de=void 0;var _e=de;function Se(){this.F=this.F}Se.prototype.F=!1;var Oe,Pe=Object.freeze||function(I){return I};(Oe=!se)||(Oe=9<=Number(_e));var Fe=Oe,De=se&&!fe("9"),Le=function(){if(!m.addEventListener||!Object.defineProperty)return!1;var I=!1,H=Object.defineProperty({},"passive",{get:function(){I=!0}});try{m.addEventListener("test",y,H),m.removeEventListener("test",y,H)}catch{}return I}();function xe(I,H){this.type=I,this.a=this.target=H,this.defaultPrevented=!1}function Ne(I,H){if(xe.call(this,I?I.type:""),this.relatedTarget=this.a=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.c=null,I){var X=this.type=I.type,ne=I.changedTouches&&I.changedTouches.length?I.changedTouches[0]:null;if(this.target=I.target||I.srcElement,this.a=H,H=I.relatedTarget){if(z){e:{try{W(H.nodeName);var le=!0;break e}catch{}le=!1}le||(H=null)}}else X=="mouseover"?H=I.fromElement:X=="mouseout"&&(H=I.toElement);this.relatedTarget=H,ne?(this.clientX=ne.clientX!==void 0?ne.clientX:ne.pageX,this.clientY=ne.clientY!==void 0?ne.clientY:ne.pageY,this.screenX=ne.screenX||0,this.screenY=ne.screenY||0):(this.clientX=I.clientX!==void 0?I.clientX:I.pageX,this.clientY=I.clientY!==void 0?I.clientY:I.pageY,this.screenX=I.screenX||0,this.screenY=I.screenY||0),this.button=I.button,this.key=I.key||"",this.ctrlKey=I.ctrlKey,this.altKey=I.altKey,this.shiftKey=I.shiftKey,this.metaKey=I.metaKey,this.pointerId=I.pointerId||0,this.pointerType=typeof I.pointerType=="string"?I.pointerType:Ue[I.pointerType]||"",this.c=I,I.defaultPrevented&&this.b()}}xe.prototype.b=function(){this.defaultPrevented=!0},F(Ne,xe);var Ue=Pe({2:"touch",3:"pen",4:"mouse"});Ne.prototype.b=function(){Ne.S.b.call(this);var I=this.c;if(I.preventDefault)I.preventDefault();else if(I.returnValue=!1,De)try{(I.ctrlKey||112<=I.keyCode&&123>=I.keyCode)&&(I.keyCode=-1)}catch{}};var We="closure_listenable_"+(1e6*Math.random()|0),ze=0;function $t(I,H,X,ne,le){this.listener=I,this.proxy=null,this.src=H,this.type=X,this.capture=!!ne,this.A=le,this.key=++ze,this.s=this.v=!1}function lt(I){I.s=!0,I.listener=null,I.proxy=null,I.src=null,I.A=null}function rt(I){this.src=I,this.a={},this.b=0}function ut(I,H){var X=H.type;if(X in I.a){var ne,le=I.a[X],pe=B(le,H);(ne=0<=pe)&&Array.prototype.splice.call(le,pe,1),ne&&(lt(H),I.a[X].length==0&&(delete I.a[X],I.b--))}}function gt(I,H,X,ne){for(var le=0;le<I.length;++le){var pe=I[le];if(!pe.s&&pe.listener==H&&pe.capture==!!X&&pe.A==ne)return le}return-1}rt.prototype.add=function(I,H,X,ne,le){var pe=I.toString();(I=this.a[pe])||(I=this.a[pe]=[],this.b++);var ae=gt(I,H,ne,le);return-1<ae?(H=I[ae],X||(H.v=!1)):((H=new $t(H,this.src,pe,!!ne,le)).v=X,I.push(H)),H};var ct="closure_lm_"+(1e6*Math.random()|0),ft={};function nt(I,H,X,ne,le){if(ne&&ne.once)(function ae(ce,be,ye,ve,Ae){if(Array.isArray(be))for(var Te=0;Te<be.length;Te++)ae(ce,be[Te],ye,ve,Ae);else ye=ht(ye),ce&&ce[We]?ce.f.add(String(be),ye,!0,c(ve)?!!ve.capture:!!ve,Ae):Tt(ce,be,ye,!0,ve,Ae)})(I,H,X,ne,le);else if(Array.isArray(H))for(var pe=0;pe<H.length;pe++)nt(I,H[pe],X,ne,le);else X=ht(X),I&&I[We]?I.f.add(String(H),X,!1,c(ne)?!!ne.capture:!!ne,le):Tt(I,H,X,!1,ne,le)}function Tt(I,H,X,ne,le,pe){if(!H)throw Error("Invalid event type");var ae=c(le)?!!le.capture:!!le,ce=ot(I);if(ce||(I[ct]=ce=new rt(I)),!(X=ce.add(H,X,ne,ae,pe)).proxy)if(ne=function(){var be=Kt,ye=Fe?function(ve){return be.call(ye.src,ye.listener,ve)}:function(ve){if(!(ve=be.call(ye.src,ye.listener,ve)))return ve};return ye}(),X.proxy=ne,ne.src=I,ne.listener=X,I.addEventListener)Le||(le=ae),le===void 0&&(le=!1),I.addEventListener(H.toString(),ne,le);else if(I.attachEvent)I.attachEvent(At(H.toString()),ne);else{if(!I.addListener||!I.removeListener)throw Error("addEventListener and attachEvent are unavailable.");I.addListener(ne)}}function Rt(I){if(typeof I!="number"&&I&&!I.s){var H=I.src;if(H&&H[We])ut(H.f,I);else{var X=I.type,ne=I.proxy;H.removeEventListener?H.removeEventListener(X,ne,I.capture):H.detachEvent?H.detachEvent(At(X),ne):H.addListener&&H.removeListener&&H.removeListener(ne),(X=ot(H))?(ut(X,I),X.b==0&&(X.src=null,H[ct]=null)):lt(I)}}}function At(I){return I in ft?ft[I]:ft[I]="on"+I}function Ot(I,H,X,ne){var le=!0;if((I=ot(I))&&(H=I.a[H.toString()]))for(H=H.concat(),I=0;I<H.length;I++){var pe=H[I];pe&&pe.capture==X&&!pe.s&&(pe=jt(pe,ne),le=le&&pe!==!1)}return le}function jt(I,H){var X=I.listener,ne=I.A||I.src;return I.v&&Rt(I),X.call(ne,H)}function Kt(I,H){if(I.s)return!0;if(!Fe){var X=H||R("window.event");H=new Ne(X,this);var ne=!0;if(!(0>X.keyCode||X.returnValue!=null)){e:{var le=!1;if(X.keyCode==0)try{X.keyCode=-1;break e}catch{le=!0}(le||X.returnValue==null)&&(X.returnValue=!0)}for(X=[],le=H.a;le;le=le.parentNode)X.push(le);for(I=I.type,le=X.length-1;0<=le;le--){H.a=X[le];var pe=Ot(X[le],I,!0,H);ne=ne&&pe}for(le=0;le<X.length;le++)H.a=X[le],pe=Ot(X[le],I,!1,H),ne=ne&&pe}return ne}return jt(I,new Ne(H,this))}function ot(I){return(I=I[ct])instanceof rt?I:null}var pt="__closure_events_fn_"+(1e9*Math.random()>>>0);function ht(I){return S(I)=="function"?I:(I[pt]||(I[pt]=function(H){return I.handleEvent(H)}),I[pt])}function Ke(){Se.call(this),this.f=new rt(this),this.N=this}function Ge(I,H){I=I.N;var X=H.type||H;if(typeof H=="string")H=new xe(H,I);else if(H instanceof xe)H.target=H.target||I;else{var ne=H;(function(le,pe){for(var ae,ce,be=1;be<arguments.length;be++){for(ae in ce=arguments[be])le[ae]=ce[ae];for(var ye=0;ye<v.length;ye++)ae=v[ye],Object.prototype.hasOwnProperty.call(ce,ae)&&(le[ae]=ce[ae])}})(H=new xe(X,I),ne)}It(I=H.a=I,X,!0,H),It(I,X,!1,H)}function It(I,H,X,ne){if(H=I.f.a[String(H)]){H=H.concat();for(var le=!0,pe=0;pe<H.length;++pe){var ae=H[pe];if(ae&&!ae.s&&ae.capture==X){var ce=ae.listener,be=ae.A||ae.src;ae.v&&ut(I.f,ae),le=ce.call(be,ne)!==!1&&le}}}}function Ct(I,H,X){if(S(I)=="function")X&&(I=P(I,X));else{if(!I||typeof I.handleEvent!="function")throw Error("Invalid listener argument");I=P(I.handleEvent,I)}return 2147483647<Number(H)?-1:m.setTimeout(I,H||0)}function dt(I,H,X){this.reset(I,H,X,void 0,void 0)}F(Ke,Se),Ke.prototype[We]=!0,Ke.prototype.addEventListener=function(I,H,X,ne){nt(this,I,H,X,ne)},Ke.prototype.removeEventListener=function(I,H,X,ne){(function le(pe,ae,ce,be,ye){if(Array.isArray(ae))for(var ve=0;ve<ae.length;ve++)le(pe,ae[ve],ce,be,ye);else be=c(be)?!!be.capture:!!be,ce=ht(ce),pe&&pe[We]?(pe=pe.f,(ae=String(ae).toString())in pe.a&&-1<(ce=gt(ve=pe.a[ae],ce,be,ye))&&(lt(ve[ce]),Array.prototype.splice.call(ve,ce,1),ve.length==0&&(delete pe.a[ae],pe.b--))):pe&&(pe=ot(pe))&&(ae=pe.a[ae.toString()],pe=-1,ae&&(pe=gt(ae,ce,be,ye)),(ce=-1<pe?ae[pe]:null)&&Rt(ce))})(this,I,H,X,ne)},dt.prototype.a=null;function mt(I){this.f=I,this.b=this.c=this.a=null}function it(I,H){this.name=I,this.value=H}dt.prototype.reset=function(I,H,X,ne,le){delete this.a},it.prototype.toString=function(){return this.name};var Mt=new it("SEVERE",1e3),Xt=new it("CONFIG",700),Jt=new it("FINE",500);function Pt(I){return I.c?I.c:I.a?Pt(I.a):(function(H,X){throw new _("Failure"+(H?": "+H:""),Array.prototype.slice.call(arguments,1))}("Root logger has no level set."),null)}mt.prototype.log=function(I,H,X){if(I.value>=Pt(this).value)for(S(H)=="function"&&(H=H()),I=new dt(I,String(H),this.f),X&&(I.a=X),X=this;X;)X=X.a};var yt,bt={},at=null;function ke(I,H){I&&I.log(Jt,H,void 0)}function Nt(){}function xt(I){var H;return(H=I.a)||(H={},Bt(I)&&(H[0]=!0,H[1]=!0),H=I.a=H),H}function Lt(){}function Ut(I){return(I=Bt(I))?new ActiveXObject(I):new XMLHttpRequest}function Bt(I){if(!I.b&&typeof XMLHttpRequest=="undefined"&&typeof ActiveXObject!="undefined"){for(var H=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],X=0;X<H.length;X++){var ne=H[X];try{return new ActiveXObject(ne),I.b=ne}catch{}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return I.b}function Ze(I,H){this.b={},this.a=[],this.c=0;var X=arguments.length;if(1<X){if(X%2)throw Error("Uneven number of arguments");for(var ne=0;ne<X;ne+=2)this.set(arguments[ne],arguments[ne+1])}else I&&Dt(this,I)}function vt(I){if(I.c!=I.a.length){for(var H=0,X=0;H<I.a.length;){var ne=I.a[H];Xe(I.b,ne)&&(I.a[X++]=ne),H++}I.a.length=X}if(I.c!=I.a.length){var le={};for(X=H=0;H<I.a.length;)Xe(le,ne=I.a[H])||(I.a[X++]=ne,le[ne]=1),H++;I.a.length=X}}function Dt(I,H){if(H instanceof Ze)for(var X=H.f(),ne=0;ne<X.length;ne++)I.set(X[ne],H.get(X[ne]));else for(X in H)I.set(X,H[X])}function Xe(I,H){return Object.prototype.hasOwnProperty.call(I,H)}Nt.prototype.a=null,F(Lt,Nt),yt=new Lt,Ze.prototype.f=function(){return vt(this),this.a.concat()},Ze.prototype.get=function(I,H){return Xe(this.b,I)?this.b[I]:H},Ze.prototype.set=function(I,H){Xe(this.b,I)||(this.c++,this.a.push(I)),this.b[I]=H},Ze.prototype.forEach=function(I,H){for(var X=this.f(),ne=0;ne<X.length;ne++){var le=X[ne],pe=this.get(le);I.call(H,pe,le,this)}};var Qt=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Ye(I){Ke.call(this),this.headers=new Ze,this.D=I||null,this.c=!1,this.C=this.a=null,this.J=this.o="",this.g=0,this.i="",this.h=this.I=this.m=this.G=!1,this.l=0,this.u=null,this.j=kt,this.B=this.H=!1}F(Ye,Ke);var kt="",er=Ye.prototype,tr=function I(H){var X;if(at||(at=new mt(""),bt[""]=at,at.c=Xt),!(X=bt[H])){X=new mt(H);var ne=H.lastIndexOf("."),le=H.substr(ne+1);(ne=I(H.substr(0,ne))).b||(ne.b={}),ne.b[le]=X,X.a=ne,bt[H]=X}return X}("goog.net.XhrIo");er.b=tr;var rr=/^https?$/i,nr=["POST","PUT"];function or(I,H,X){if(I.a)throw Error("[goog.net.XhrIo] Object is active with another request="+I.o+"; newUri="+H);I.o=H,I.i="",I.g=0,I.J="POST",I.G=!1,I.c=!0,I.a=I.D?Ut(I.D):Ut(yt),I.C=I.D?xt(I.D):xt(yt),I.a.onreadystatechange=P(I.K,I);try{ke(I.b,qe(I,"Opening Xhr")),I.I=!0,I.a.open("POST",String(H),!0),I.I=!1}catch(pe){return ke(I.b,qe(I,"Error opening Xhr: "+pe.message)),void Ft(I,pe)}H=X||"";var ne=function(pe){e:{for(var ae=ir,ce=pe.length,be=typeof pe=="string"?pe.split(""):pe,ye=0;ye<ce;ye++)if(ye in be&&ae.call(void 0,be[ye],ye,pe)){ae=ye;break e}ae=-1}return 0>ae?null:typeof pe=="string"?pe.charAt(ae):pe[ae]}((X=new Ze(I.headers)).f()),le=m.FormData&&H instanceof m.FormData;!(0<=B(nr,"POST"))||ne||le||X.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),X.forEach(function(pe,ae){this.a.setRequestHeader(ae,pe)},I),I.j&&(I.a.responseType=I.j),"withCredentials"in I.a&&I.a.withCredentials!==I.H&&(I.a.withCredentials=I.H);try{Ht(I),0<I.l&&(I.B=function(pe){return se&&fe(9)&&typeof pe.timeout=="number"&&pe.ontimeout!==void 0}(I.a),ke(I.b,qe(I,"Will abort after "+I.l+"ms if incomplete, xhr2 "+I.B)),I.B?(I.a.timeout=I.l,I.a.ontimeout=P(I.L,I)):I.u=Ct(I.L,I.l,I)),ke(I.b,qe(I,"Sending request")),I.m=!0,I.a.send(H),I.m=!1}catch(pe){ke(I.b,qe(I,"Send error: "+pe.message)),Ft(I,pe)}}function ir(I){return I.toLowerCase()=="content-type"}function Ft(I,H){I.c=!1,I.a&&(I.h=!0,I.a.abort(),I.h=!1),I.i=H,I.g=5,Wt(I),_t(I)}function Wt(I){I.G||(I.G=!0,Ge(I,"complete"),Ge(I,"error"))}function Vt(I){if(I.c&&u!==void 0){if(I.C[1]&&$e(I)==4&&I.getStatus()==2)ke(I.b,qe(I,"Local request error detected and ignored"));else if(I.m&&$e(I)==4)Ct(I.K,0,I);else if(Ge(I,"readystatechange"),$e(I)==4){ke(I.b,qe(I,"Request complete")),I.c=!1;try{var H,X=I.getStatus();e:switch(X){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var ne=!0;break e;default:ne=!1}if(!(H=ne)){var le;if(le=X===0){var pe=String(I.o).match(Qt)[1]||null;if(!pe&&m.self&&m.self.location){var ae=m.self.location.protocol;pe=ae.substr(0,ae.length-1)}le=!rr.test(pe?pe.toLowerCase():"")}H=le}if(H)Ge(I,"complete"),Ge(I,"success");else{I.g=6;try{var ce=2<$e(I)?I.a.statusText:""}catch(be){ke(I.b,"Can not get status: "+be.message),ce=""}I.i=ce+" ["+I.getStatus()+"]",Wt(I)}}finally{_t(I)}}}}function _t(I){if(I.a){Ht(I);var H=I.a,X=I.C[0]?y:null;I.a=null,I.C=null,Ge(I,"ready");try{H.onreadystatechange=X}catch(ne){(I=I.b)&&I.log(Mt,"Problem encountered resetting onreadystatechange: "+ne.message,void 0)}}}function Ht(I){I.a&&I.B&&(I.a.ontimeout=null),I.u&&(m.clearTimeout(I.u),I.u=null)}function $e(I){return I.a?I.a.readyState:0}function zt(I,H){if(I.a&&$e(I)==4)return(I=I.a.getResponseHeader(H))===null?void 0:I}function qe(I,H){return H+" ["+I.J+" "+I.o+" "+I.getStatus()+"]"}Ye.prototype.L=function(){u!==void 0&&this.a&&(this.i="Timed out after "+this.l+"ms, aborting",this.g=8,ke(this.b,qe(this,this.i)),Ge(this,"timeout"),this.abort(8))},Ye.prototype.abort=function(I){this.a&&this.c&&(ke(this.b,qe(this,"Aborting")),this.c=!1,this.h=!0,this.a.abort(),this.h=!1,this.g=I||7,Ge(this,"complete"),Ge(this,"abort"),_t(this))},Ye.prototype.K=function(){this.F||(this.I||this.m||this.h?Vt(this):this.O())},Ye.prototype.O=function(){Vt(this)},Ye.prototype.getStatus=function(){try{return 2<$e(this)?this.a.status:-1}catch{return-1}};var Gt={},et=null;function ar(I){var H=I.length,X=3*H/4;X%3?X=Math.floor(X):K("=.",I[H-1])&&(X=K("=.",I[H-2])?X-2:X-1);var ne=new Uint8Array(X),le=0;return function(pe,ae){function ce(Ie){for(;be<pe.length;){var je=pe.charAt(be++),Me=et[je];if(Me!=null)return Me;if(!/^[\s\xa0]*$/.test(je))throw Error("Unknown base64 encoding at char: "+je)}return Ie}qt();for(var be=0;;){var ye=ce(-1),ve=ce(0),Ae=ce(64),Te=ce(64);if(Te===64&&ye===-1)break;ae(ye<<2|ve>>4),Ae!=64&&(ae(ve<<4&240|Ae>>2),Te!=64&&ae(Ae<<6&192|Te))}}(I,function(pe){ne[le++]=pe}),ne.subarray(0,le)}function qt(){if(!et){et={};for(var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),H=["+/=","+/","-_=","-_.","-_"],X=0;5>X;X++){var ne=I.concat(H[X].split(""));Gt[X]=ne;for(var le=0;le<ne.length;le++){var pe=ne[le];et[pe]===void 0&&(et[pe]=le)}}}}var sr=["content-type","grpc-status","grpc-message"];function Ve(I){this.a=I.T,this.l=null,this.b=[],this.h=[],this.g=[],this.f=[],this.c=[],this.j=!1,this.i=0,this.m=new x;var H=this;nt(this.a,"readystatechange",function(){var X=H.a;if(X=X.a?X.a.getResponseHeader("Content-Type"):null){if((X=X.toLowerCase()).lastIndexOf("application/grpc-web-text",0)==0){X=H.a;try{var ne=X.a?X.a.responseText:""}catch(ye){ke(X.b,"Can not get responseText: "+ye.message),ne=""}if(ne=(X=ne||"").length-X.length%4,(X=X.substr(H.i,ne-H.i)).length==0)return;H.i=ne,X=ar(X)}else{if(X.lastIndexOf("application/grpc",0)!=0)return void Je(H,{code:2,message:"Unknown Content-type received.",metadata:{}});X=new Uint8Array(function(ye){try{if(!ye.a)return null;if("response"in ye.a)return ye.a.response;switch(ye.j){case kt:case"text":return ye.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in ye.a)return ye.a.mozResponseArrayBuffer}var ve=ye.b;return ve&&ve.log(Mt,"Response type "+ye.j+" is not supported on this browser",void 0),null}catch(Ae){return ke(ye.b,"Can not get response: "+Ae.message),null}}(H.a))}ne=null;try{ne=function(ye,ve){function Ae(Qe){we.f++,we.a=(we.a<<8)+Qe,we.f==4&&(we.b=T,we.g=0,typeof Uint8Array!="undefined"?we.c=new Uint8Array(we.a):we.c=Array(we.a),we.a==0&&Ie())}function Te(Qe){we.c[we.g++]=Qe,we.g==we.a&&Ie()}function Ie(){var Qe={};Qe[we.h]=we.c,we.i.push(Qe),we.b=D}var je,Me,we=ye,He=0;for(je=ve instanceof Uint8Array||ve instanceof Array?ve:new Uint8Array(ve);He<je.length;){switch(we.b){case C:f(we,je,He,"stream already broken");break;case D:(Me=je[He])==U||Me==b?we.h=Me:f(we,je,He,"invalid frame byte"),we.b=L,we.a=0,we.f=0;break;case L:Ae(je[He]);break;case T:Te(je[He]);break;default:throw Error("unexpected parser state: "+we.b)}we.l++,He++}return ye=we.i,we.i=[],0<ye.length?ye:null}(H.m,X)}catch{Je(H,{code:2,message:"Error in parsing response body",metadata:{}})}if(ne)for(X=0;X<ne.length;X++){if(U in ne[X]){var le=ne[X][U];if(le)try{var pe=H.l(le);if(pe){le=H;for(var ae=pe,ce=0;ce<le.b.length;ce++)le.b[ce](ae)}}catch{Je(H,{code:2,message:"Error in response deserializer function.",metadata:{}})}}if(b in ne[X]&&0<ne[X][b].length){for(le="",ae=0;ae<ne[X][b].length;ae++)le+=String.fromCharCode(ne[X][b][ae]);for(le=le.trim().split(`\r
15
+ `,t.homedir=function(){return"/"}},function(e,t,r){var n=r(56),i=r(59).warn,g=t;g.version=r(137).version,g.transports=r(138),g.config=r(47),g.addColors=n.levels,g.format=n.format,g.createLogger=r(85),g.ExceptionHandler=r(86),g.RejectionHandler=r(90),g.Container=r(209),g.Transport=r(17),g.loggers=new g.Container;var s=g.createLogger();Object.keys(g.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach(function(o){return g[o]=function(){return s[o].apply(s,arguments)}}),Object.defineProperty(g,"level",{get:function(){return s.level},set:function(o){s.level=o}}),Object.defineProperty(g,"exceptions",{get:function(){return s.exceptions}}),["exitOnError"].forEach(function(o){Object.defineProperty(g,o,{get:function(){return s[o]},set:function(l){s[o]=l}})}),Object.defineProperty(g,"default",{get:function(){return{exceptionHandlers:s.exceptionHandlers,rejectionHandlers:s.rejectionHandlers,transports:s.transports}}}),i.deprecated(g,"setLevels"),i.forFunctions(g,"useFormat",["cli"]),i.forProperties(g,"useFormat",["padLevels","stripColors"]),i.forFunctions(g,"deprecated",["addRewriter","addFilter","clone","extend"]),i.forProperties(g,"deprecated",["emitErrs","levelLength"]),i.moved(g,"createLogger","Logger")},function(e,t,r){var n=r(10),i=r(141),g=r(3).LEVEL,s=e.exports=function(){var o=this,l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};i.call(this,{objectMode:!0,highWaterMark:l.highWaterMark}),this.format=l.format,this.level=l.level,this.handleExceptions=l.handleExceptions,this.handleRejections=l.handleRejections,this.silent=l.silent,l.log&&(this.log=l.log),l.logv&&(this.logv=l.logv),l.close&&(this.close=l.close),this.once("pipe",function(u){o.levels=u.levels,o.parent=u}),this.once("unpipe",function(u){u===o.parent&&(o.parent=null,o.close&&o.close())})};n.inherits(s,i),s.prototype._write=function(o,l,u){if(this.silent||o.exception===!0&&!this.handleExceptions)return u(null);var m=this.level||this.parent&&this.parent.level;if(!m||this.levels[m]>=this.levels[o[g]]){if(o&&!this.format)return this.log(o,u);var R=void 0,y=void 0;try{y=this.format.transform(Object.assign({},o),this.format.options)}catch(S){R=S}if(R||!y){if(u(),R)throw R;return}return this.log(y,u)}return u(null)},s.prototype._writev=function(o,l){if(this.logv){var u=o.filter(this._accept,this);return u.length?this.logv(u,l):l(null)}for(var m=0;m<o.length;m++)if(this._accept(o[m]))if(!o[m].chunk||this.format){var R=void 0,y=void 0;try{y=this.format.transform(Object.assign({},o[m].chunk),this.format.options)}catch(S){R=S}if(R||!y){if(o[m].callback(),R)throw l(null),R}else this.log(y,o[m].callback)}else this.log(o[m].chunk,o[m].callback);return l(null)},s.prototype._accept=function(o){var l=o.chunk;if(this.silent)return!1;var u=this.level||this.parent&&this.parent.level;return!(l.exception!==!0&&u&&!(this.levels[u]>=this.levels[l[g]])||!this.handleExceptions&&l.exception===!0)},s.prototype._nop=function(){},e.exports.LegacyTransportStream=r(147)},function(e,t,r){var n,i=typeof Reflect=="object"?Reflect:null,g=i&&typeof i.apply=="function"?i.apply:function(E,P,F){return Function.prototype.apply.call(E,P,F)};n=i&&typeof i.ownKeys=="function"?i.ownKeys:Object.getOwnPropertySymbols?function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:function(E){return Object.getOwnPropertyNames(E)};var s=Number.isNaN||function(E){return E!=E};function o(){o.init.call(this)}e.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function u(E){return E._maxListeners===void 0?o.defaultMaxListeners:E._maxListeners}function m(E,P,F,M){var A,p,N,$;if(typeof F!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof F);if((p=E._events)===void 0?(p=E._events=Object.create(null),E._eventsCount=0):(p.newListener!==void 0&&(E.emit("newListener",P,F.listener?F.listener:F),p=E._events),N=p[P]),N===void 0)N=p[P]=F,++E._eventsCount;else if(typeof N=="function"?N=p[P]=M?[F,N]:[N,F]:M?N.unshift(F):N.push(F),(A=u(E))>0&&N.length>A&&!N.warned){N.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(P)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=E,q.type=P,q.count=N.length,$=q,console&&console.warn&&console.warn($)}return E}function R(){for(var E=[],P=0;P<arguments.length;P++)E.push(arguments[P]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,g(this.listener,this.target,E))}function y(E,P,F){var M={fired:!1,wrapFn:void 0,target:E,type:P,listener:F},A=R.bind(M);return A.listener=F,M.wrapFn=A,A}function S(E,P,F){var M=E._events;if(M===void 0)return[];var A=M[P];return A===void 0?[]:typeof A=="function"?F?[A.listener||A]:[A]:F?function(p){for(var N=new Array(p.length),$=0;$<N.length;++$)N[$]=p[$].listener||p[$];return N}(A):w(A,A.length)}function c(E){var P=this._events;if(P!==void 0){var F=P[E];if(typeof F=="function")return 1;if(F!==void 0)return F.length}return 0}function w(E,P){for(var F=new Array(P),M=0;M<P;++M)F[M]=E[M];return F}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(E){if(typeof E!="number"||E<0||s(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");l=E}}),o.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(E){if(typeof E!="number"||E<0||s(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(E){for(var P=[],F=1;F<arguments.length;F++)P.push(arguments[F]);var M=E==="error",A=this._events;if(A!==void 0)M=M&&A.error===void 0;else if(!M)return!1;if(M){var p;if(P.length>0&&(p=P[0]),p instanceof Error)throw p;var N=new Error("Unhandled error."+(p?" ("+p.message+")":""));throw N.context=p,N}var $=A[E];if($===void 0)return!1;if(typeof $=="function")g($,this,P);else{var q=$.length,h=w($,q);for(F=0;F<q;++F)g(h[F],this,P)}return!0},o.prototype.addListener=function(E,P){return m(this,E,P,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(E,P){return m(this,E,P,!0)},o.prototype.once=function(E,P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P);return this.on(E,y(this,E,P)),this},o.prototype.prependOnceListener=function(E,P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P);return this.prependListener(E,y(this,E,P)),this},o.prototype.removeListener=function(E,P){var F,M,A,p,N;if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P);if((M=this._events)===void 0)return this;if((F=M[E])===void 0)return this;if(F===P||F.listener===P)--this._eventsCount==0?this._events=Object.create(null):(delete M[E],M.removeListener&&this.emit("removeListener",E,F.listener||P));else if(typeof F!="function"){for(A=-1,p=F.length-1;p>=0;p--)if(F[p]===P||F[p].listener===P){N=F[p].listener,A=p;break}if(A<0)return this;A===0?F.shift():function($,q){for(;q+1<$.length;q++)$[q]=$[q+1];$.pop()}(F,A),F.length===1&&(M[E]=F[0]),M.removeListener!==void 0&&this.emit("removeListener",E,N||P)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(E){var P,F,M;if((F=this._events)===void 0)return this;if(F.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):F[E]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete F[E]),this;if(arguments.length===0){var A,p=Object.keys(F);for(M=0;M<p.length;++M)(A=p[M])!=="removeListener"&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(P=F[E])=="function")this.removeListener(E,P);else if(P!==void 0)for(M=P.length-1;M>=0;M--)this.removeListener(E,P[M]);return this},o.prototype.listeners=function(E){return S(this,E,!0)},o.prototype.rawListeners=function(E){return S(this,E,!1)},o.listenerCount=function(E,P){return typeof E.listenerCount=="function"?E.listenerCount(P):c.call(E,P)},o.prototype.listenerCount=c,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){var n=r(146).Buffer,i=n.isEncoding||function(c){switch((c=""+c)&&c.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function g(c){var w;switch(this.encoding=function(E){var P=function(F){if(!F)return"utf8";for(var M;;)switch(F){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return F;default:if(M)return;F=(""+F).toLowerCase(),M=!0}}(E);if(typeof P!="string"&&(n.isEncoding===i||!i(E)))throw new Error("Unknown encoding: "+E);return P||E}(c),this.encoding){case"utf16le":this.text=l,this.end=u,w=4;break;case"utf8":this.fillLast=o,w=4;break;case"base64":this.text=m,this.end=R,w=3;break;default:return this.write=y,void(this.end=S)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(w)}function s(c){return c<=127?0:c>>5==6?2:c>>4==14?3:c>>3==30?4:c>>6==2?-1:-2}function o(c){var w=this.lastTotal-this.lastNeed,E=function(P,F,M){if((192&F[0])!=128)return P.lastNeed=0,"\uFFFD";if(P.lastNeed>1&&F.length>1){if((192&F[1])!=128)return P.lastNeed=1,"\uFFFD";if(P.lastNeed>2&&F.length>2&&(192&F[2])!=128)return P.lastNeed=2,"\uFFFD"}}(this,c);return E!==void 0?E:this.lastNeed<=c.length?(c.copy(this.lastChar,w,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(c.copy(this.lastChar,w,0,c.length),void(this.lastNeed-=c.length))}function l(c,w){if((c.length-w)%2==0){var E=c.toString("utf16le",w);if(E){var P=E.charCodeAt(E.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=c[c.length-1],c.toString("utf16le",w,c.length-1)}function u(c){var w=c&&c.length?this.write(c):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return w+this.lastChar.toString("utf16le",0,E)}return w}function m(c,w){var E=(c.length-w)%3;return E===0?c.toString("base64",w):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=c[c.length-1]:(this.lastChar[0]=c[c.length-2],this.lastChar[1]=c[c.length-1]),c.toString("base64",w,c.length-E))}function R(c){var w=c&&c.length?this.write(c):"";return this.lastNeed?w+this.lastChar.toString("base64",0,3-this.lastNeed):w}function y(c){return c.toString(this.encoding)}function S(c){return c&&c.length?this.write(c):""}t.StringDecoder=g,g.prototype.write=function(c){if(c.length===0)return"";var w,E;if(this.lastNeed){if((w=this.fillLast(c))===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<c.length?w?w+this.text(c,E):this.text(c,E):w||""},g.prototype.end=function(c){var w=c&&c.length?this.write(c):"";return this.lastNeed?w+"\uFFFD":w},g.prototype.text=function(c,w){var E=function(F,M,A){var p=M.length-1;if(p<A)return 0;var N=s(M[p]);return N>=0?(N>0&&(F.lastNeed=N-1),N):--p<A||N===-2?0:(N=s(M[p]))>=0?(N>0&&(F.lastNeed=N-2),N):--p<A||N===-2?0:(N=s(M[p]))>=0?(N>0&&(N===2?N=0:F.lastNeed=N-3),N):0}(this,c,w);if(!this.lastNeed)return c.toString("utf8",w);this.lastTotal=E;var P=c.length-(E-this.lastNeed);return c.copy(this.lastChar,0,P),c.toString("utf8",w,P)},g.prototype.fillLast=function(c){if(this.lastNeed<=c.length)return c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);c.copy(this.lastChar,this.lastTotal-this.lastNeed,0,c.length),this.lastNeed-=c.length}},function(e,t,r){var n=r(13),i=Object.keys||function(c){var w=[];for(var E in c)w.push(E);return w};e.exports=R;var g=r(14);g.inherits=r(6);var s=r(67),o=r(44);g.inherits(R,s);for(var l=i(o.prototype),u=0;u<l.length;u++){var m=l[u];R.prototype[m]||(R.prototype[m]=o.prototype[m])}function R(c){if(!(this instanceof R))return new R(c);s.call(this,c),o.call(this,c),c&&c.readable===!1&&(this.readable=!1),c&&c.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,c&&c.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",y)}function y(){this.allowHalfOpen||this._writableState.ended||n.nextTick(S,this)}function S(c){c.end()}Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(R.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(c){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}),R.prototype._destroy=function(c,w){this.push(null),this.end(),n.nextTick(w,c)}},function(e,t,r){e.exports=function(n,i){i||(i={}),typeof i=="function"&&(i={cmp:i});var g,s=typeof i.cycles=="boolean"&&i.cycles,o=i.cmp&&(g=i.cmp,function(u){return function(m,R){var y={key:m,value:u[m]},S={key:R,value:u[R]};return g(y,S)}}),l=[];return function u(m){if(m&&m.toJSON&&typeof m.toJSON=="function"&&(m=m.toJSON()),m!==void 0){if(typeof m=="number")return isFinite(m)?""+m:"null";if(typeof m!="object")return JSON.stringify(m);var R,y;if(Array.isArray(m)){for(y="[",R=0;R<m.length;R++)R&&(y+=","),y+=u(m[R])||"null";return y+"]"}if(m===null)return"null";if(l.indexOf(m)!==-1){if(s)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var S=l.push(m)-1,c=Object.keys(m).sort(o&&o(m));for(y="",R=0;R<c.length;R++){var w=c[R],E=u(m[w]);E&&(y&&(y+=","),y+=JSON.stringify(w)+":"+E)}return l.splice(S,1),"{"+y+"}"}}(n)}},function(e,t,r){(function(n){function i(I){var H=0;return function(){return H<I.length?{done:!1,value:I[H++]}:{done:!0}}}var g=typeof Object.defineProperties=="function"?Object.defineProperty:function(I,H,X){I!=Array.prototype&&I!=Object.prototype&&(I[H]=X.value)},s=function(I){I=[typeof window=="object"&&window,typeof self=="object"&&self,typeof n=="object"&&n,I];for(var H=0;H<I.length;++H){var X=I[H];if(X&&X.Math==Math)return X}throw Error("Cannot find global object")}(this);function o(I,H){if(H){var X=s;I=I.split(".");for(var ne=0;ne<I.length-1;ne++){var le=I[ne];le in X||(X[le]={}),X=X[le]}(H=H(ne=X[I=I[I.length-1]]))!=ne&&H!=null&&g(X,I,{configurable:!0,writable:!0,value:H})}}function l(I){var H=typeof Symbol!="undefined"&&Symbol.iterator&&I[Symbol.iterator];return H?H.call(I):{next:i(I)}}o("Object.is",function(I){return I||function(H,X){return H===X?H!==0||1/H==1/X:H!=H&&X!=X}}),o("Array.prototype.includes",function(I){return I||function(H,X){var ne=this;ne instanceof String&&(ne=String(ne));var le=ne.length;for(0>(X=X||0)&&(X=Math.max(X+le,0));X<le;X++){var pe=ne[X];if(pe===H||Object.is(pe,H))return!0}return!1}}),o("Promise",function(I){function H(ae){this.b=0,this.c=void 0,this.a=[];var ce=this.f();try{ae(ce.resolve,ce.reject)}catch(be){ce.reject(be)}}function X(){this.a=null}function ne(ae){return ae instanceof H?ae:new H(function(ce){ce(ae)})}if(I)return I;X.prototype.b=function(ae){if(this.a==null){this.a=[];var ce=this;this.c(function(){ce.g()})}this.a.push(ae)};var le=s.setTimeout;X.prototype.c=function(ae){le(ae,0)},X.prototype.g=function(){for(;this.a&&this.a.length;){var ae=this.a;this.a=[];for(var ce=0;ce<ae.length;++ce){var be=ae[ce];ae[ce]=null;try{be()}catch(ye){this.f(ye)}}}this.a=null},X.prototype.f=function(ae){this.c(function(){throw ae})},H.prototype.f=function(){function ae(ye){return function(ve){be||(be=!0,ye.call(ce,ve))}}var ce=this,be=!1;return{resolve:ae(this.m),reject:ae(this.g)}},H.prototype.m=function(ae){if(ae===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(ae instanceof H)this.o(ae);else{e:switch(typeof ae){case"object":var ce=ae!=null;break e;case"function":ce=!0;break e;default:ce=!1}ce?this.l(ae):this.h(ae)}},H.prototype.l=function(ae){var ce=void 0;try{ce=ae.then}catch(be){return void this.g(be)}typeof ce=="function"?this.u(ce,ae):this.h(ae)},H.prototype.g=function(ae){this.i(2,ae)},H.prototype.h=function(ae){this.i(1,ae)},H.prototype.i=function(ae,ce){if(this.b!=0)throw Error("Cannot settle("+ae+", "+ce+"): Promise already settled in state"+this.b);this.b=ae,this.c=ce,this.j()},H.prototype.j=function(){if(this.a!=null){for(var ae=0;ae<this.a.length;++ae)pe.b(this.a[ae]);this.a=null}};var pe=new X;return H.prototype.o=function(ae){var ce=this.f();ae.w(ce.resolve,ce.reject)},H.prototype.u=function(ae,ce){var be=this.f();try{ae.call(ce,be.resolve,be.reject)}catch(ye){be.reject(ye)}},H.prototype.then=function(ae,ce){function be(Te,Ie){return typeof Te=="function"?function(je){try{ye(Te(je))}catch(Me){ve(Me)}}:Ie}var ye,ve,Re=new H(function(Te,Ie){ye=Te,ve=Ie});return this.w(be(ae,ye),be(ce,ve)),Re},H.prototype.catch=function(ae){return this.then(void 0,ae)},H.prototype.w=function(ae,ce){function be(){switch(ye.b){case 1:ae(ye.c);break;case 2:ce(ye.c);break;default:throw Error("Unexpected state: "+ye.b)}}var ye=this;this.a==null?pe.b(be):this.a.push(be)},H.resolve=ne,H.reject=function(ae){return new H(function(ce,be){be(ae)})},H.race=function(ae){return new H(function(ce,be){for(var ye=l(ae),ve=ye.next();!ve.done;ve=ye.next())ne(ve.value).w(ce,be)})},H.all=function(ae){var ce=l(ae),be=ce.next();return be.done?ne([]):new H(function(ye,ve){function Re(je){return function(Me){Te[je]=Me,--Ie==0&&ye(Te)}}var Te=[],Ie=0;do Te.push(void 0),Ie++,ne(be.value).w(Re(Te.length-1),ve),be=ce.next();while(!be.done)})},H});var u=u||{},m=this||self;function R(I,H){I=I.split("."),H=H||m;for(var X=0;X<I.length;X++)if((H=H[I[X]])==null)return null;return H}function y(){}function S(I){var H=typeof I;if(H=="object"){if(!I)return"null";if(I instanceof Array)return"array";if(I instanceof Object)return H;var X=Object.prototype.toString.call(I);if(X=="[object Window]")return"object";if(X=="[object Array]"||typeof I.length=="number"&&I.splice!==void 0&&I.propertyIsEnumerable!==void 0&&!I.propertyIsEnumerable("splice"))return"array";if(X=="[object Function]"||I.call!==void 0&&I.propertyIsEnumerable!==void 0&&!I.propertyIsEnumerable("call"))return"function"}else if(H=="function"&&I.call===void 0)return"object";return H}function c(I){var H=typeof I;return H=="object"&&I!=null||H=="function"}function w(I,H,X){return I.call.apply(I.bind,arguments)}function E(I,H,X){if(!I)throw Error();if(2<arguments.length){var ne=Array.prototype.slice.call(arguments,2);return function(){var le=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(le,ne),I.apply(H,le)}}return function(){return I.apply(H,arguments)}}function P(I,H,X){return(P=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?w:E).apply(null,arguments)}function F(I,H){function X(){}X.prototype=H.prototype,I.S=H.prototype,I.prototype=new X,I.prototype.constructor=I}function M(){this.a={}}function A(I,H,X,ne){this.f=I,this.c=H,this.b=X,this.a=ne}function p(I,H,X,ne){X=X===void 0?{}:X,this.c=I,this.a=X,this.b=H,this.f=ne===void 0?null:ne}function N(I,H,X,ne,le,pe){this.name=I,this.a=le,this.b=pe}function $(I,H,X){X=X===void 0?{}:X;var ne=ne===void 0?new M:ne;return new A(H,I,X,ne)}function q(I,H,X,ne){return ne instanceof N?ne:new N(I,X,ne.b||H.constructor,ne.f,ne.a,ne.c)}function h(I){this.a=I}function d(I){switch(I){case 0:return"No Error";case 1:return"Access denied to content document";case 2:return"File not found";case 3:return"Firefox silently errored";case 4:return"Application custom error";case 5:return"An exception occurred";case 6:return"Http response at 400 or 500 level";case 7:return"Request was aborted";case 8:return"Request timed out";case 9:return"The resource is not available offline";default:return"Unrecognized error code"}}function O(I){if(Error.captureStackTrace)Error.captureStackTrace(this,O);else{var H=Error().stack;H&&(this.stack=H)}I&&(this.message=String(I))}function _(I,H){for(var X="",ne=(I=I.split("%s")).length-1,le=0;le<ne;le++)X+=I[le]+(le<H.length?H[le]:"%s");O.call(this,X+I[ne])}function x(){this.j=null,this.i=[],this.l=0,this.b=D,this.f=this.a=this.h=0,this.c=null,this.g=0}M.prototype.get=function(I){return this.a[I]},M.prototype.f=function(){return Object.keys(this.a)},A.prototype.getRequestMessage=function(){return this.f},A.prototype.getMethodDescriptor=function(){return this.c},A.prototype.getMetadata=function(){return this.b},A.prototype.getCallOptions=function(){return this.a},p.prototype.getResponseMessage=function(){return this.c},p.prototype.getMetadata=function(){return this.a},p.prototype.getMethodDescriptor=function(){return this.b},p.prototype.getStatus=function(){return this.f},h.prototype.on=function(I,H){return I=="data"||I=="error"?this:this.a.on(I,H)},h.prototype.removeListener=function(I,H){return this.a.removeListener(I,H)},h.prototype.cancel=function(){this.a.cancel()},F(O,Error),O.prototype.name="CustomError",F(_,O),_.prototype.name="AssertionError";var D=0,L=1,T=2,C=3,U=0,b=128;function f(I,H,X,ne){throw I.b=C,I.j="The stream is broken @"+I.l+"/"+X+". Error: "+ne+`. With input:
16
+ `+H,Error(I.j)}var B=Array.prototype.indexOf?function(I,H){return Array.prototype.indexOf.call(I,H,void 0)}:function(I,H){if(typeof I=="string")return typeof H!="string"||H.length!=1?-1:I.indexOf(H,0);for(var X=0;X<I.length;X++)if(X in I&&I[X]===H)return X;return-1},k,Y=String.prototype.trim?function(I){return I.trim()}:function(I){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(I)[1]};function K(I,H){return I.indexOf(H)!=-1}function Q(I,H){return I<H?-1:I>H?1:0}e:{var G=m.navigator;if(G){var V=G.userAgent;if(V){k=V;break e}}k=""}var v="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function j(I){var H=1;I=I.split(":");for(var X=[];0<H&&I.length;)X.push(I.shift()),H--;return I.length&&X.push(I.join(":")),X}function W(I){return W[" "](I),I}W[" "]=y;var ee,J,re=K(k,"Opera"),se=K(k,"Trident")||K(k,"MSIE"),oe=K(k,"Edge"),z=K(k,"Gecko")&&!(K(k.toLowerCase(),"webkit")&&!K(k,"Edge"))&&!(K(k,"Trident")||K(k,"MSIE"))&&!K(k,"Edge"),Z=K(k.toLowerCase(),"webkit")&&!K(k,"Edge");function te(){var I=m.document;return I?I.documentMode:void 0}e:{var ge="",ie=(J=k,z?/rv:([^\);]+)(\)|;)/.exec(J):oe?/Edge\/([\d\.]+)/.exec(J):se?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(J):Z?/WebKit\/(\S+)/.exec(J):re?/(?:Version)[ \/]?(\S+)/.exec(J):void 0);if(ie&&(ge=ie?ie[1]:""),se){var he=te();if(he!=null&&he>parseFloat(ge)){ee=String(he);break e}}ee=ge}var de,me={};function fe(I){return function(H,X){var ne=me;return Object.prototype.hasOwnProperty.call(ne,H)?ne[H]:ne[H]=X(H)}(I,function(){for(var H=0,X=Y(String(ee)).split("."),ne=Y(String(I)).split("."),le=Math.max(X.length,ne.length),pe=0;H==0&&pe<le;pe++){var ae=X[pe]||"",ce=ne[pe]||"";do{if(ae=/(\d*)(\D*)(.*)/.exec(ae)||["","","",""],ce=/(\d*)(\D*)(.*)/.exec(ce)||["","","",""],ae[0].length==0&&ce[0].length==0)break;H=Q(ae[1].length==0?0:parseInt(ae[1],10),ce[1].length==0?0:parseInt(ce[1],10))||Q(ae[2].length==0,ce[2].length==0)||Q(ae[2],ce[2]),ae=ae[3],ce=ce[3]}while(H==0)}return 0<=H})}if(m.document&&se){var ue=te();de=ue||parseInt(ee,10)||void 0}else de=void 0;var _e=de;function Se(){this.F=this.F}Se.prototype.F=!1;var Oe,Pe=Object.freeze||function(I){return I};(Oe=!se)||(Oe=9<=Number(_e));var Fe=Oe,De=se&&!fe("9"),Le=function(){if(!m.addEventListener||!Object.defineProperty)return!1;var I=!1,H=Object.defineProperty({},"passive",{get:function(){I=!0}});try{m.addEventListener("test",y,H),m.removeEventListener("test",y,H)}catch{}return I}();function xe(I,H){this.type=I,this.a=this.target=H,this.defaultPrevented=!1}function Ne(I,H){if(xe.call(this,I?I.type:""),this.relatedTarget=this.a=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.c=null,I){var X=this.type=I.type,ne=I.changedTouches&&I.changedTouches.length?I.changedTouches[0]:null;if(this.target=I.target||I.srcElement,this.a=H,H=I.relatedTarget){if(z){e:{try{W(H.nodeName);var le=!0;break e}catch{}le=!1}le||(H=null)}}else X=="mouseover"?H=I.fromElement:X=="mouseout"&&(H=I.toElement);this.relatedTarget=H,ne?(this.clientX=ne.clientX!==void 0?ne.clientX:ne.pageX,this.clientY=ne.clientY!==void 0?ne.clientY:ne.pageY,this.screenX=ne.screenX||0,this.screenY=ne.screenY||0):(this.clientX=I.clientX!==void 0?I.clientX:I.pageX,this.clientY=I.clientY!==void 0?I.clientY:I.pageY,this.screenX=I.screenX||0,this.screenY=I.screenY||0),this.button=I.button,this.key=I.key||"",this.ctrlKey=I.ctrlKey,this.altKey=I.altKey,this.shiftKey=I.shiftKey,this.metaKey=I.metaKey,this.pointerId=I.pointerId||0,this.pointerType=typeof I.pointerType=="string"?I.pointerType:Ue[I.pointerType]||"",this.c=I,I.defaultPrevented&&this.b()}}xe.prototype.b=function(){this.defaultPrevented=!0},F(Ne,xe);var Ue=Pe({2:"touch",3:"pen",4:"mouse"});Ne.prototype.b=function(){Ne.S.b.call(this);var I=this.c;if(I.preventDefault)I.preventDefault();else if(I.returnValue=!1,De)try{(I.ctrlKey||112<=I.keyCode&&123>=I.keyCode)&&(I.keyCode=-1)}catch{}};var We="closure_listenable_"+(1e6*Math.random()|0),ze=0;function $t(I,H,X,ne,le){this.listener=I,this.proxy=null,this.src=H,this.type=X,this.capture=!!ne,this.A=le,this.key=++ze,this.s=this.v=!1}function lt(I){I.s=!0,I.listener=null,I.proxy=null,I.src=null,I.A=null}function rt(I){this.src=I,this.a={},this.b=0}function ut(I,H){var X=H.type;if(X in I.a){var ne,le=I.a[X],pe=B(le,H);(ne=0<=pe)&&Array.prototype.splice.call(le,pe,1),ne&&(lt(H),I.a[X].length==0&&(delete I.a[X],I.b--))}}function gt(I,H,X,ne){for(var le=0;le<I.length;++le){var pe=I[le];if(!pe.s&&pe.listener==H&&pe.capture==!!X&&pe.A==ne)return le}return-1}rt.prototype.add=function(I,H,X,ne,le){var pe=I.toString();(I=this.a[pe])||(I=this.a[pe]=[],this.b++);var ae=gt(I,H,ne,le);return-1<ae?(H=I[ae],X||(H.v=!1)):((H=new $t(H,this.src,pe,!!ne,le)).v=X,I.push(H)),H};var ct="closure_lm_"+(1e6*Math.random()|0),ft={};function nt(I,H,X,ne,le){if(ne&&ne.once)(function ae(ce,be,ye,ve,Re){if(Array.isArray(be))for(var Te=0;Te<be.length;Te++)ae(ce,be[Te],ye,ve,Re);else ye=ht(ye),ce&&ce[We]?ce.f.add(String(be),ye,!0,c(ve)?!!ve.capture:!!ve,Re):Tt(ce,be,ye,!0,ve,Re)})(I,H,X,ne,le);else if(Array.isArray(H))for(var pe=0;pe<H.length;pe++)nt(I,H[pe],X,ne,le);else X=ht(X),I&&I[We]?I.f.add(String(H),X,!1,c(ne)?!!ne.capture:!!ne,le):Tt(I,H,X,!1,ne,le)}function Tt(I,H,X,ne,le,pe){if(!H)throw Error("Invalid event type");var ae=c(le)?!!le.capture:!!le,ce=ot(I);if(ce||(I[ct]=ce=new rt(I)),!(X=ce.add(H,X,ne,ae,pe)).proxy)if(ne=function(){var be=Kt,ye=Fe?function(ve){return be.call(ye.src,ye.listener,ve)}:function(ve){if(!(ve=be.call(ye.src,ye.listener,ve)))return ve};return ye}(),X.proxy=ne,ne.src=I,ne.listener=X,I.addEventListener)Le||(le=ae),le===void 0&&(le=!1),I.addEventListener(H.toString(),ne,le);else if(I.attachEvent)I.attachEvent(At(H.toString()),ne);else{if(!I.addListener||!I.removeListener)throw Error("addEventListener and attachEvent are unavailable.");I.addListener(ne)}}function Rt(I){if(typeof I!="number"&&I&&!I.s){var H=I.src;if(H&&H[We])ut(H.f,I);else{var X=I.type,ne=I.proxy;H.removeEventListener?H.removeEventListener(X,ne,I.capture):H.detachEvent?H.detachEvent(At(X),ne):H.addListener&&H.removeListener&&H.removeListener(ne),(X=ot(H))?(ut(X,I),X.b==0&&(X.src=null,H[ct]=null)):lt(I)}}}function At(I){return I in ft?ft[I]:ft[I]="on"+I}function Ot(I,H,X,ne){var le=!0;if((I=ot(I))&&(H=I.a[H.toString()]))for(H=H.concat(),I=0;I<H.length;I++){var pe=H[I];pe&&pe.capture==X&&!pe.s&&(pe=jt(pe,ne),le=le&&pe!==!1)}return le}function jt(I,H){var X=I.listener,ne=I.A||I.src;return I.v&&Rt(I),X.call(ne,H)}function Kt(I,H){if(I.s)return!0;if(!Fe){var X=H||R("window.event");H=new Ne(X,this);var ne=!0;if(!(0>X.keyCode||X.returnValue!=null)){e:{var le=!1;if(X.keyCode==0)try{X.keyCode=-1;break e}catch{le=!0}(le||X.returnValue==null)&&(X.returnValue=!0)}for(X=[],le=H.a;le;le=le.parentNode)X.push(le);for(I=I.type,le=X.length-1;0<=le;le--){H.a=X[le];var pe=Ot(X[le],I,!0,H);ne=ne&&pe}for(le=0;le<X.length;le++)H.a=X[le],pe=Ot(X[le],I,!1,H),ne=ne&&pe}return ne}return jt(I,new Ne(H,this))}function ot(I){return(I=I[ct])instanceof rt?I:null}var pt="__closure_events_fn_"+(1e9*Math.random()>>>0);function ht(I){return S(I)=="function"?I:(I[pt]||(I[pt]=function(H){return I.handleEvent(H)}),I[pt])}function Ke(){Se.call(this),this.f=new rt(this),this.N=this}function Ge(I,H){I=I.N;var X=H.type||H;if(typeof H=="string")H=new xe(H,I);else if(H instanceof xe)H.target=H.target||I;else{var ne=H;(function(le,pe){for(var ae,ce,be=1;be<arguments.length;be++){for(ae in ce=arguments[be])le[ae]=ce[ae];for(var ye=0;ye<v.length;ye++)ae=v[ye],Object.prototype.hasOwnProperty.call(ce,ae)&&(le[ae]=ce[ae])}})(H=new xe(X,I),ne)}It(I=H.a=I,X,!0,H),It(I,X,!1,H)}function It(I,H,X,ne){if(H=I.f.a[String(H)]){H=H.concat();for(var le=!0,pe=0;pe<H.length;++pe){var ae=H[pe];if(ae&&!ae.s&&ae.capture==X){var ce=ae.listener,be=ae.A||ae.src;ae.v&&ut(I.f,ae),le=ce.call(be,ne)!==!1&&le}}}}function Ct(I,H,X){if(S(I)=="function")X&&(I=P(I,X));else{if(!I||typeof I.handleEvent!="function")throw Error("Invalid listener argument");I=P(I.handleEvent,I)}return 2147483647<Number(H)?-1:m.setTimeout(I,H||0)}function dt(I,H,X){this.reset(I,H,X,void 0,void 0)}F(Ke,Se),Ke.prototype[We]=!0,Ke.prototype.addEventListener=function(I,H,X,ne){nt(this,I,H,X,ne)},Ke.prototype.removeEventListener=function(I,H,X,ne){(function le(pe,ae,ce,be,ye){if(Array.isArray(ae))for(var ve=0;ve<ae.length;ve++)le(pe,ae[ve],ce,be,ye);else be=c(be)?!!be.capture:!!be,ce=ht(ce),pe&&pe[We]?(pe=pe.f,(ae=String(ae).toString())in pe.a&&-1<(ce=gt(ve=pe.a[ae],ce,be,ye))&&(lt(ve[ce]),Array.prototype.splice.call(ve,ce,1),ve.length==0&&(delete pe.a[ae],pe.b--))):pe&&(pe=ot(pe))&&(ae=pe.a[ae.toString()],pe=-1,ae&&(pe=gt(ae,ce,be,ye)),(ce=-1<pe?ae[pe]:null)&&Rt(ce))})(this,I,H,X,ne)},dt.prototype.a=null;function mt(I){this.f=I,this.b=this.c=this.a=null}function it(I,H){this.name=I,this.value=H}dt.prototype.reset=function(I,H,X,ne,le){delete this.a},it.prototype.toString=function(){return this.name};var Mt=new it("SEVERE",1e3),Xt=new it("CONFIG",700),Jt=new it("FINE",500);function Pt(I){return I.c?I.c:I.a?Pt(I.a):(function(H,X){throw new _("Failure"+(H?": "+H:""),Array.prototype.slice.call(arguments,1))}("Root logger has no level set."),null)}mt.prototype.log=function(I,H,X){if(I.value>=Pt(this).value)for(S(H)=="function"&&(H=H()),I=new dt(I,String(H),this.f),X&&(I.a=X),X=this;X;)X=X.a};var yt,bt={},at=null;function ke(I,H){I&&I.log(Jt,H,void 0)}function Nt(){}function xt(I){var H;return(H=I.a)||(H={},Bt(I)&&(H[0]=!0,H[1]=!0),H=I.a=H),H}function Lt(){}function Ut(I){return(I=Bt(I))?new ActiveXObject(I):new XMLHttpRequest}function Bt(I){if(!I.b&&typeof XMLHttpRequest=="undefined"&&typeof ActiveXObject!="undefined"){for(var H=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],X=0;X<H.length;X++){var ne=H[X];try{return new ActiveXObject(ne),I.b=ne}catch{}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return I.b}function Ze(I,H){this.b={},this.a=[],this.c=0;var X=arguments.length;if(1<X){if(X%2)throw Error("Uneven number of arguments");for(var ne=0;ne<X;ne+=2)this.set(arguments[ne],arguments[ne+1])}else I&&Dt(this,I)}function vt(I){if(I.c!=I.a.length){for(var H=0,X=0;H<I.a.length;){var ne=I.a[H];Xe(I.b,ne)&&(I.a[X++]=ne),H++}I.a.length=X}if(I.c!=I.a.length){var le={};for(X=H=0;H<I.a.length;)Xe(le,ne=I.a[H])||(I.a[X++]=ne,le[ne]=1),H++;I.a.length=X}}function Dt(I,H){if(H instanceof Ze)for(var X=H.f(),ne=0;ne<X.length;ne++)I.set(X[ne],H.get(X[ne]));else for(X in H)I.set(X,H[X])}function Xe(I,H){return Object.prototype.hasOwnProperty.call(I,H)}Nt.prototype.a=null,F(Lt,Nt),yt=new Lt,Ze.prototype.f=function(){return vt(this),this.a.concat()},Ze.prototype.get=function(I,H){return Xe(this.b,I)?this.b[I]:H},Ze.prototype.set=function(I,H){Xe(this.b,I)||(this.c++,this.a.push(I)),this.b[I]=H},Ze.prototype.forEach=function(I,H){for(var X=this.f(),ne=0;ne<X.length;ne++){var le=X[ne],pe=this.get(le);I.call(H,pe,le,this)}};var Qt=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Ye(I){Ke.call(this),this.headers=new Ze,this.D=I||null,this.c=!1,this.C=this.a=null,this.J=this.o="",this.g=0,this.i="",this.h=this.I=this.m=this.G=!1,this.l=0,this.u=null,this.j=kt,this.B=this.H=!1}F(Ye,Ke);var kt="",er=Ye.prototype,tr=function I(H){var X;if(at||(at=new mt(""),bt[""]=at,at.c=Xt),!(X=bt[H])){X=new mt(H);var ne=H.lastIndexOf("."),le=H.substr(ne+1);(ne=I(H.substr(0,ne))).b||(ne.b={}),ne.b[le]=X,X.a=ne,bt[H]=X}return X}("goog.net.XhrIo");er.b=tr;var rr=/^https?$/i,nr=["POST","PUT"];function or(I,H,X){if(I.a)throw Error("[goog.net.XhrIo] Object is active with another request="+I.o+"; newUri="+H);I.o=H,I.i="",I.g=0,I.J="POST",I.G=!1,I.c=!0,I.a=I.D?Ut(I.D):Ut(yt),I.C=I.D?xt(I.D):xt(yt),I.a.onreadystatechange=P(I.K,I);try{ke(I.b,qe(I,"Opening Xhr")),I.I=!0,I.a.open("POST",String(H),!0),I.I=!1}catch(pe){return ke(I.b,qe(I,"Error opening Xhr: "+pe.message)),void Ft(I,pe)}H=X||"";var ne=function(pe){e:{for(var ae=ir,ce=pe.length,be=typeof pe=="string"?pe.split(""):pe,ye=0;ye<ce;ye++)if(ye in be&&ae.call(void 0,be[ye],ye,pe)){ae=ye;break e}ae=-1}return 0>ae?null:typeof pe=="string"?pe.charAt(ae):pe[ae]}((X=new Ze(I.headers)).f()),le=m.FormData&&H instanceof m.FormData;!(0<=B(nr,"POST"))||ne||le||X.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),X.forEach(function(pe,ae){this.a.setRequestHeader(ae,pe)},I),I.j&&(I.a.responseType=I.j),"withCredentials"in I.a&&I.a.withCredentials!==I.H&&(I.a.withCredentials=I.H);try{Ht(I),0<I.l&&(I.B=function(pe){return se&&fe(9)&&typeof pe.timeout=="number"&&pe.ontimeout!==void 0}(I.a),ke(I.b,qe(I,"Will abort after "+I.l+"ms if incomplete, xhr2 "+I.B)),I.B?(I.a.timeout=I.l,I.a.ontimeout=P(I.L,I)):I.u=Ct(I.L,I.l,I)),ke(I.b,qe(I,"Sending request")),I.m=!0,I.a.send(H),I.m=!1}catch(pe){ke(I.b,qe(I,"Send error: "+pe.message)),Ft(I,pe)}}function ir(I){return I.toLowerCase()=="content-type"}function Ft(I,H){I.c=!1,I.a&&(I.h=!0,I.a.abort(),I.h=!1),I.i=H,I.g=5,Wt(I),_t(I)}function Wt(I){I.G||(I.G=!0,Ge(I,"complete"),Ge(I,"error"))}function Vt(I){if(I.c&&u!==void 0){if(I.C[1]&&$e(I)==4&&I.getStatus()==2)ke(I.b,qe(I,"Local request error detected and ignored"));else if(I.m&&$e(I)==4)Ct(I.K,0,I);else if(Ge(I,"readystatechange"),$e(I)==4){ke(I.b,qe(I,"Request complete")),I.c=!1;try{var H,X=I.getStatus();e:switch(X){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var ne=!0;break e;default:ne=!1}if(!(H=ne)){var le;if(le=X===0){var pe=String(I.o).match(Qt)[1]||null;if(!pe&&m.self&&m.self.location){var ae=m.self.location.protocol;pe=ae.substr(0,ae.length-1)}le=!rr.test(pe?pe.toLowerCase():"")}H=le}if(H)Ge(I,"complete"),Ge(I,"success");else{I.g=6;try{var ce=2<$e(I)?I.a.statusText:""}catch(be){ke(I.b,"Can not get status: "+be.message),ce=""}I.i=ce+" ["+I.getStatus()+"]",Wt(I)}}finally{_t(I)}}}}function _t(I){if(I.a){Ht(I);var H=I.a,X=I.C[0]?y:null;I.a=null,I.C=null,Ge(I,"ready");try{H.onreadystatechange=X}catch(ne){(I=I.b)&&I.log(Mt,"Problem encountered resetting onreadystatechange: "+ne.message,void 0)}}}function Ht(I){I.a&&I.B&&(I.a.ontimeout=null),I.u&&(m.clearTimeout(I.u),I.u=null)}function $e(I){return I.a?I.a.readyState:0}function zt(I,H){if(I.a&&$e(I)==4)return(I=I.a.getResponseHeader(H))===null?void 0:I}function qe(I,H){return H+" ["+I.J+" "+I.o+" "+I.getStatus()+"]"}Ye.prototype.L=function(){u!==void 0&&this.a&&(this.i="Timed out after "+this.l+"ms, aborting",this.g=8,ke(this.b,qe(this,this.i)),Ge(this,"timeout"),this.abort(8))},Ye.prototype.abort=function(I){this.a&&this.c&&(ke(this.b,qe(this,"Aborting")),this.c=!1,this.h=!0,this.a.abort(),this.h=!1,this.g=I||7,Ge(this,"complete"),Ge(this,"abort"),_t(this))},Ye.prototype.K=function(){this.F||(this.I||this.m||this.h?Vt(this):this.O())},Ye.prototype.O=function(){Vt(this)},Ye.prototype.getStatus=function(){try{return 2<$e(this)?this.a.status:-1}catch{return-1}};var Gt={},et=null;function ar(I){var H=I.length,X=3*H/4;X%3?X=Math.floor(X):K("=.",I[H-1])&&(X=K("=.",I[H-2])?X-2:X-1);var ne=new Uint8Array(X),le=0;return function(pe,ae){function ce(Ie){for(;be<pe.length;){var je=pe.charAt(be++),Me=et[je];if(Me!=null)return Me;if(!/^[\s\xa0]*$/.test(je))throw Error("Unknown base64 encoding at char: "+je)}return Ie}qt();for(var be=0;;){var ye=ce(-1),ve=ce(0),Re=ce(64),Te=ce(64);if(Te===64&&ye===-1)break;ae(ye<<2|ve>>4),Re!=64&&(ae(ve<<4&240|Re>>2),Te!=64&&ae(Re<<6&192|Te))}}(I,function(pe){ne[le++]=pe}),ne.subarray(0,le)}function qt(){if(!et){et={};for(var I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),H=["+/=","+/","-_=","-_.","-_"],X=0;5>X;X++){var ne=I.concat(H[X].split(""));Gt[X]=ne;for(var le=0;le<ne.length;le++){var pe=ne[le];et[pe]===void 0&&(et[pe]=le)}}}}var sr=["content-type","grpc-status","grpc-message"];function Ve(I){this.a=I.T,this.l=null,this.b=[],this.h=[],this.g=[],this.f=[],this.c=[],this.j=!1,this.i=0,this.m=new x;var H=this;nt(this.a,"readystatechange",function(){var X=H.a;if(X=X.a?X.a.getResponseHeader("Content-Type"):null){if((X=X.toLowerCase()).lastIndexOf("application/grpc-web-text",0)==0){X=H.a;try{var ne=X.a?X.a.responseText:""}catch(ye){ke(X.b,"Can not get responseText: "+ye.message),ne=""}if(ne=(X=ne||"").length-X.length%4,(X=X.substr(H.i,ne-H.i)).length==0)return;H.i=ne,X=ar(X)}else{if(X.lastIndexOf("application/grpc",0)!=0)return void Je(H,{code:2,message:"Unknown Content-type received.",metadata:{}});X=new Uint8Array(function(ye){try{if(!ye.a)return null;if("response"in ye.a)return ye.a.response;switch(ye.j){case kt:case"text":return ye.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in ye.a)return ye.a.mozResponseArrayBuffer}var ve=ye.b;return ve&&ve.log(Mt,"Response type "+ye.j+" is not supported on this browser",void 0),null}catch(Re){return ke(ye.b,"Can not get response: "+Re.message),null}}(H.a))}ne=null;try{ne=function(ye,ve){function Re(Qe){we.f++,we.a=(we.a<<8)+Qe,we.f==4&&(we.b=T,we.g=0,typeof Uint8Array!="undefined"?we.c=new Uint8Array(we.a):we.c=Array(we.a),we.a==0&&Ie())}function Te(Qe){we.c[we.g++]=Qe,we.g==we.a&&Ie()}function Ie(){var Qe={};Qe[we.h]=we.c,we.i.push(Qe),we.b=D}var je,Me,we=ye,He=0;for(je=ve instanceof Uint8Array||ve instanceof Array?ve:new Uint8Array(ve);He<je.length;){switch(we.b){case C:f(we,je,He,"stream already broken");break;case D:(Me=je[He])==U||Me==b?we.h=Me:f(we,je,He,"invalid frame byte"),we.b=L,we.a=0,we.f=0;break;case L:Re(je[He]);break;case T:Te(je[He]);break;default:throw Error("unexpected parser state: "+we.b)}we.l++,He++}return ye=we.i,we.i=[],0<ye.length?ye:null}(H.m,X)}catch{Je(H,{code:2,message:"Error in parsing response body",metadata:{}})}if(ne)for(X=0;X<ne.length;X++){if(U in ne[X]){var le=ne[X][U];if(le)try{var pe=H.l(le);if(pe){le=H;for(var ae=pe,ce=0;ce<le.b.length;ce++)le.b[ce](ae)}}catch{Je(H,{code:2,message:"Error in response deserializer function.",metadata:{}})}}if(b in ne[X]&&0<ne[X][b].length){for(le="",ae=0;ae<ne[X][b].length;ae++)le+=String.fromCharCode(ne[X][b][ae]);for(le=le.trim().split(`\r
17
17
  `),ae={},ce=0;ce<le.length;ce++){var be=le[ce].indexOf(":");ae[le[ce].substring(0,be).trim()]=le[ce].substring(be+1).trim()}le=ae,ae=0,ce="","grpc-status"in le&&(ae=le["grpc-status"],delete le["grpc-status"]),"grpc-message"in le&&(ce=le["grpc-message"],delete le["grpc-message"]),Je(H,{code:Number(ae),message:ce,metadata:le})}}}}),nt(this.a,"complete",function(){var X=H.a.g,ne="",le={},pe=function(ce){var be={};ce=(ce.a&&$e(ce)==4&&ce.a.getAllResponseHeaders()||"").split(`\r
18
- `);for(var ye=0;ye<ce.length;ye++)if(!/^[\s\xa0]*$/.test(ce[ye])){var ve=j(ce[ye]),Ae=ve[0];if(typeof(ve=ve[1])=="string"){ve=ve.trim();var Te=be[Ae]||[];be[Ae]=Te,Te.push(ve)}}return function(Ie,je){var Me,we={};for(Me in Ie)we[Me]=je.call(void 0,Ie[Me],Me,Ie);return we}(be,function(Ie){return Ie.join(", ")})}(H.a);if(Object.keys(pe).forEach(function(ce){sr.includes(ce)||(le[ce]=pe[ce])}),function(ce,be){for(var ye=0;ye<ce.g.length;ye++)ce.g[ye](be)}(H,le),X!=0){switch(X){case 7:var ae=10;break;case 8:ae=4;break;case 6:ae=function(ce){switch(ce){case 200:return 0;case 400:return 3;case 401:return 16;case 403:return 7;case 404:return 5;case 409:return 10;case 412:return 9;case 429:return 8;case 499:return 1;case 500:return 2;case 501:return 12;case 503:return 14;case 504:return 4;default:return 2}}(H.a.getStatus());break;default:ae=14}ae==10&&H.j||Je(H,{code:ae,message:d(X),metadata:{}})}else X=!1,"grpc-status"in pe&&(ae=zt(H.a,"grpc-status"),"grpc-message"in pe&&(ne=zt(H.a,"grpc-message")),Number(ae)!=0&&(Je(H,{code:Number(ae),message:ne,metadata:pe}),X=!0)),X||function(ce){for(var be=0;be<ce.c.length;be++)ce.c[be]()}(H)})}function tt(I,H){-1<(H=I.indexOf(H))&&I.splice(H,1)}function Je(I,H){if(H.code!=0)for(var X={code:H.code,message:decodeURIComponent(H.message||""),metadata:H.metadata},ne=0;ne<I.f.length;ne++)I.f[ne](X);for(H={code:H.code,details:decodeURIComponent(H.message||""),metadata:H.metadata},X=0;X<I.h.length;X++)I.h[X](H)}function Be(I){this.a=R("format",I)||"text",this.f=R("suppressCorsPreflight",I)||!1,this.c=R("withCredentials",I)||!1,this.b=R("streamInterceptors",I)||[],this.g=R("unaryInterceptors",I)||[]}function St(I,H,X){var ne=H.getMethodDescriptor(),le=X+ne.name;(X=new Ye).H=I.c;var pe=new Ve({T:X});if(pe.l=ne.b,Dt(X.headers,H.getMetadata()),I.a=="text"?(X.headers.set("Content-Type","application/grpc-web-text"),X.headers.set("Accept","application/grpc-web-text")):X.headers.set("Content-Type","application/grpc-web+proto"),X.headers.set("X-User-Agent","grpc-web-javascript/0.1"),X.headers.set("X-Grpc-Web","1"),Xe(X.headers.b,"deadline")){var ae=X.headers.get("deadline");ae=Math.round(ae-new Date().getTime());var ce=X.headers;Xe(ce.b,"deadline")&&(delete ce.b.deadline,ce.c--,ce.a.length>2*ce.c&&vt(ce)),1/0===ae&&(ae=0),0<ae&&X.headers.set("grpc-timeout",ae+"m")}if(I.f){vt(ce=X.headers),ae={};for(var be=0;be<ce.a.length;be++){var ye=ce.a[be];ae[ye]=ce.b[ye]}(ce=X.headers).b={},ce.a.length=0,ce.c=0;e:{for(ve in ae){var ve=!1;break e}ve=!0}ve||(ae=function(Ie){var je="";return function(Me,we){for(var He in Me)we.call(void 0,Me[He],He,Me)}(Ie,function(Me,we){je+=we,je+=":",je+=Me,je+=`\r
19
- `}),je}(ae),typeof le=="string"?(ve=encodeURIComponent("$httpHeaders"),(ve+=ae=ae!=null?"="+encodeURIComponent(String(ae)):"")&&(0>(ae=le.indexOf("#"))&&(ae=le.length),0>(ce=le.indexOf("?"))||ce>ae?(ce=ae,be=""):be=le.substring(ce+1,ae),ae=(le=[le.substr(0,ce),be,le.substr(ae)])[1],le[1]=ve?ae?ae+"&"+ve:ve:ae,le=le[0]+(le[1]?"?"+le[1]:"")+le[2])):le.a("$httpHeaders",ae))}for(ne=(H=(0,ne.a)(H.getRequestMessage())).length,ve=[0,0,0,0],ae=new Uint8Array(5+ne),ce=3;0<=ce;ce--)ve[ce]=ne%256,ne>>>=8;if(ae.set(new Uint8Array(ve),1),ae.set(H,5),H=ae,I.a=="text"){var Ae;for(I=H,Ae===void 0&&(Ae=0),qt(),Ae=Gt[Ae],H=[],ne=0;ne<I.length;ne+=3){ye=I[ne];var Te=(ve=ne+1<I.length)?I[ne+1]:0;ce=ye>>2,ye=(3&ye)<<4|Te>>4,Te=(15&Te)<<2|(be=(ae=ne+2<I.length)?I[ne+2]:0)>>6,be&=63,ae||(be=64,ve||(Te=64)),H.push(Ae[ce],Ae[ye],Ae[Te]||"",Ae[be]||"")}H=H.join("")}else I.a=="binary"&&(X.j="arraybuffer");return or(X,le,H),pe}function Yt(I,H,X){var ne=null,le=!1;I.on("data",function(pe){ne=pe}),I.on("error",function(pe){pe.code==0||le||(le=!0,H(pe,null))}),I.on("status",function(pe){pe.code==0||le?X&&H(null,null,pe):(le=!0,H({code:pe.code,message:pe.details,metadata:pe.metadata},null))}),X&&I.on("metadata",function(pe){H(null,null,null,pe)}),I.on("end",function(){le||(ne==null?H({code:2,message:"Incomplete response"}):H(null,ne)),X&&H(null,null)})}function wt(I,H){var X=I;return H.forEach(function(ne){var le=X;X=function(pe){return ne.intercept(pe,le)}}),X}Ve.prototype.on=function(I,H){return I=="data"?this.b.push(H):I=="status"?this.h.push(H):I=="metadata"?this.g.push(H):I=="end"?this.c.push(H):I=="error"&&this.f.push(H),this},Ve.prototype.removeListener=function(I,H){return I=="data"?tt(this.b,H):I=="status"?tt(this.h,H):I=="metadata"?tt(this.g,H):I=="end"?tt(this.c,H):I=="error"&&tt(this.f,H),this},Ve.prototype.cancel=function(){this.j=!0,this.a.abort()},Ve.prototype.cancel=Ve.prototype.cancel,Ve.prototype.removeListener=Ve.prototype.removeListener,Ve.prototype.on=Ve.prototype.on,Be.prototype.P=function(I,H,X,ne,le){var pe=this;ne=q(I,H,"unary",ne);var ae=I.substr(0,I.length-ne.name.length);return Yt(I=wt(function(ce){return St(pe,ce,ae)},this.b).call(this,$(ne,H,X)),le,!1),new h(I)},Be.prototype.M=function(I,H,X,ne){var le=this;ne=q(I,H,"unary",ne);var pe=I.substr(0,I.length-ne.name.length);return wt(function(ae){return new Promise(function(ce,be){var ye,ve,Ae;Yt(St(le,ae,pe),function(Te,Ie,je,Me){Te?be(Te):Ie?Ae=Ie:je?ve=je:Me?ye=Me:(Te=ae.getMethodDescriptor(),ce(new p(Ae,Te,Ie=(Ie=ye)===void 0?{}:Ie,ve===void 0?null:ve)))},!0)})},this.g).call(this,$(ne,H,X)).then(function(ae){return ae.getResponseMessage()})},Be.prototype.unaryCall=function(I,H,X,ne){return this.M(I,H,X,ne)},Be.prototype.R=function(I,H,X,ne){var le=this;ne=q(I,H,"server_streaming",ne);var pe=I.substr(0,I.length-ne.name.length);return wt(function(ae){return St(le,ae,pe)},this.b).call(this,$(ne,H,X))},Be.prototype.serverStreaming=Be.prototype.R,Be.prototype.unaryCall=Be.prototype.unaryCall,Be.prototype.thenableCall=Be.prototype.M,Be.prototype.rpcCall=Be.prototype.P,e.exports.AbstractClientBase={MethodInfo:function(I,H,X,ne,le){this.name=ne,this.b=le,this.f=I,this.a=H,this.c=X}},e.exports.GrpcWebClientBase=Be,e.exports.StatusCode={OK:0,CANCELLED:1,UNKNOWN:2,INVALID_ARGUMENT:3,DEADLINE_EXCEEDED:4,NOT_FOUND:5,ALREADY_EXISTS:6,PERMISSION_DENIED:7,UNAUTHENTICATED:16,RESOURCE_EXHAUSTED:8,FAILED_PRECONDITION:9,ABORTED:10,OUT_OF_RANGE:11,UNIMPLEMENTED:12,INTERNAL:13,UNAVAILABLE:14,DATA_LOSS:15},e.exports.MethodDescriptor=N,e.exports.MethodType={UNARY:"unary",SERVER_STREAMING:"server_streaming"}}).call(this,r(5))},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=t.isAsyncGenerator=t.isAsync=void 0;var n,i=r(151),g=(n=i)&&n.__esModule?n:{default:n};function s(o){return o[Symbol.toStringTag]==="AsyncFunction"}t.default=function(o){if(typeof o!="function")throw new Error("expected a function");return s(o)?(0,g.default)(o):o},t.isAsync=s,t.isAsyncGenerator=function(o){return o[Symbol.toStringTag]==="AsyncGenerator"},t.isAsyncIterable=function(o){return typeof o[Symbol.asyncIterator]=="function"}},function(e,t,r){var n={};function i(s,o,l){l||(l=Error);var u=function(m){var R,y;function S(c,w,E){return m.call(this,function(P,F,M){return typeof o=="string"?o:o(P,F,M)}(c,w,E))||this}return y=m,(R=S).prototype=Object.create(y.prototype),R.prototype.constructor=R,R.__proto__=y,S}(l);u.prototype.name=l.name,u.prototype.code=s,n[s]=u}function g(s,o){if(Array.isArray(s)){var l=s.length;return s=s.map(function(u){return String(u)}),l>2?"one of ".concat(o," ").concat(s.slice(0,l-1).join(", "),", or ")+s[l-1]:l===2?"one of ".concat(o," ").concat(s[0]," or ").concat(s[1]):"of ".concat(o," ").concat(s[0])}return"of ".concat(o," ").concat(String(s))}i("ERR_INVALID_OPT_VALUE",function(s,o){return'The value "'+o+'" is invalid for option "'+s+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(s,o,l){var u,m,R;if(typeof o=="string"&&(m="not ",o.substr(0,m.length)===m)?(u="must not be",o=o.replace(/^not /,"")):u="must be",function(S,c,w){return(w===void 0||w>S.length)&&(w=S.length),S.substring(w-c.length,w)===c}(s," argument"))R="The ".concat(s," ").concat(u," ").concat(g(o,"type"));else{var y=function(S,c,w){return typeof w!="number"&&(w=0),!(w+c.length>S.length)&&S.indexOf(c,w)!==-1}(s,".")?"property":"argument";R='The "'.concat(s,'" ').concat(y," ").concat(u," ").concat(g(o,"type"))}return R+=". Received type ".concat(typeof l)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},function(e,t,r){(function(n){var i=Object.keys||function(S){var c=[];for(var w in S)c.push(w);return c};e.exports=m;var g=r(75),s=r(79);r(6)(m,g);for(var o=i(s.prototype),l=0;l<o.length;l++){var u=o[l];m.prototype[u]||(m.prototype[u]=s.prototype[u])}function m(S){if(!(this instanceof m))return new m(S);g.call(this,S),s.call(this,S),this.allowHalfOpen=!0,S&&(S.readable===!1&&(this.readable=!1),S.writable===!1&&(this.writable=!1),S.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",R)))}function R(){this._writableState.ended||n.nextTick(y,this)}function y(S){S.end()}Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(m.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(m.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(m.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this,r(2))},function(e,t,r){r.d(t,"a",function(){return s});var n=r(36),i=r(7);const g={"app-id":["app-id must match formant/*"]};class s extends n.a{constructor(l,u={}){super(l,Object.assign({validateHeaders:m=>`${m.get("app-id")}`.startsWith("formant/")?{}:g,headers:Object.assign(Object.assign({},s.headers),{"App-ID":`formant/${i.a}`,"App-Version":i.j})},u)),this.endpoint=l}}s.headers={}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n,i=n.length){if(!i)throw new Error("arity is undefined");return function(...g){return typeof g[i-1]=="function"?n.apply(this,g):new Promise((s,o)=>{g[i-1]=(l,...u)=>{if(l)return o(l);s(u.length>1?u:u[0])},n.apply(this,g)})}},e.exports=t.default},function(e,t,r){(t=e.exports=r(67)).Stream=t,t.Readable=t,t.Writable=r(44),t.Duplex=r(20),t.Transform=r(70),t.PassThrough=r(164)},function(e,t,r){(t=e.exports=r(75)).Stream=t,t.Readable=t,t.Writable=r(79),t.Duplex=r(25),t.Transform=r(80),t.PassThrough=r(183),t.finished=r(45),t.pipeline=r(184)},function(e,t,r){r.d(t,"a",function(){return i});const n=["password","secret","token","key","buffer"];function i(g,s=new Set){return s.has(g)?"[ RECURSIVE ]":!(o=g)||typeof o!="object"&&typeof o!="function"?g:(s.add(g),Object.keys(g).reduce((l,u)=>(l[u]=n.some(m=>u.toLowerCase().includes(m.toLowerCase()))?"[ REDACTED ]":i(g[u],s),l),{}));var o}},function(e,t){e.exports=n,n.default=n,n.stable=g,n.stableStringify=g;var r=[];function n(s,o,l){(function R(y,S,c,w){var E;if(typeof y=="object"&&y!==null){for(E=0;E<c.length;E++)if(c[E]===y)return w[S]="[Circular]",void r.push([w,S,y]);if(c.push(y),Array.isArray(y))for(E=0;E<y.length;E++)R(y[E],E,c,y);else{var P=Object.keys(y);for(E=0;E<P.length;E++){var F=P[E];R(y[F],F,c,y)}}c.pop()}})(s,"",[],void 0);for(var u=JSON.stringify(s,o,l);r.length!==0;){var m=r.pop();m[0][m[1]]=m[2]}return u}function i(s,o){return s<o?-1:s>o?1:0}function g(s,o,l){for(var u=function y(S,c,w,E){var P;if(typeof S=="object"&&S!==null){for(P=0;P<w.length;P++)if(w[P]===S)return E[c]="[Circular]",void r.push([E,c,S]);if(typeof S.toJSON=="function")return;if(w.push(S),Array.isArray(S))for(P=0;P<S.length;P++)y(S[P],P,w,S);else{var F={},M=Object.keys(S).sort(i);for(P=0;P<M.length;P++){var A=M[P];y(S[A],A,w,S),F[A]=S[A]}if(E===void 0)return F;r.push([E,c,S]),E[c]=F}w.pop()}}(s,"",[],void 0)||s,m=JSON.stringify(u,o,l);r.length!==0;){var R=r.pop();R[0][R[1]]=R[2]}return m}},function(e,t,r){var n=r(13),i=Object.keys||function(c){var w=[];for(var E in c)w.push(E);return w};e.exports=R;var g=Object.create(r(14));g.inherits=r(6);var s=r(142),o=r(60);g.inherits(R,s);for(var l=i(o.prototype),u=0;u<l.length;u++){var m=l[u];R.prototype[m]||(R.prototype[m]=o.prototype[m])}function R(c){if(!(this instanceof R))return new R(c);s.call(this,c),o.call(this,c),c&&c.readable===!1&&(this.readable=!1),c&&c.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,c&&c.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",y)}function y(){this.allowHalfOpen||this._writableState.ended||n.nextTick(S,this)}function S(c){c.end()}Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(R.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(c){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}),R.prototype._destroy=function(c,w){this.push(null),this.end(),n.nextTick(w,c)}},function(e,t,r){var n=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function i(o,l){return Object.prototype.hasOwnProperty.call(o,l)}t.assign=function(o){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var u=l.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var m in u)i(u,m)&&(o[m]=u[m])}}return o},t.shrinkBuf=function(o,l){return o.length===l?o:o.subarray?o.subarray(0,l):(o.length=l,o)};var g={arraySet:function(o,l,u,m,R){if(l.subarray&&o.subarray)o.set(l.subarray(u,u+m),R);else for(var y=0;y<m;y++)o[R+y]=l[u+y]},flattenChunks:function(o){var l,u,m,R,y,S;for(m=0,l=0,u=o.length;l<u;l++)m+=o[l].length;for(S=new Uint8Array(m),R=0,l=0,u=o.length;l<u;l++)y=o[l],S.set(y,R),R+=y.length;return S}},s={arraySet:function(o,l,u,m,R){for(var y=0;y<m;y++)o[R+y]=l[u+y]},flattenChunks:function(o){return[].concat.apply([],o)}};t.setTyped=function(o){o?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,g)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,s))},t.setTyped(n)},function(e,t,r){e.exports=r(185)},function(e,t,r){e.exports=function(n){return n}},function(e,t,r){r.d(t,"a",function(){return P});var n=r(11),i=r(0);function g(F,M,A=()=>!0){if(F instanceof M&&A(F))return F;throw F}var s=r(1),o=r(100),l=r.n(o),u=r(101),m=r.n(u);class R extends Error{constructor(M,A,p){super(`Connection failure: ${M.message}`),this.cause=M,this.url=A,this.retryable=p}}var y=r(30);class S extends Error{constructor(M,A,p,N,$={},q){super(`Unexpected response (${p}) for ${M} ${A}: ${JSON.stringify(q?Object(y.a)([...q.entries()].reduce((h,[d,O])=>(h[d]=O,h),{})):{})} -- ${JSON.stringify(Object(y.a)(N))}`),this.method=M,this.url=A,this.statusCode=p,this.body=N,this.validationErrors=$,this.headers=q}}class c extends Error{constructor(M,A){super(`Invalid headers (${JSON.stringify(M)}) for response: ${A.message}`),this.validationErrors=M,this.responseError=A}}var w=function(F,M,A,p){return new(A||(A=Promise))(function(N,$){function q(O){try{d(p.next(O))}catch(_){$(_)}}function h(O){try{d(p.throw(O))}catch(_){$(_)}}function d(O){var _;O.done?N(O.value):(_=O.value,_ instanceof A?_:new A(function(x){x(_)})).then(q,h)}d((p=p.apply(F,M||[])).next())})},E=function(F,M){var A={};for(var p in F)Object.prototype.hasOwnProperty.call(F,p)&&M.indexOf(p)<0&&(A[p]=F[p]);if(F!=null&&typeof Object.getOwnPropertySymbols=="function"){var N=0;for(p=Object.getOwnPropertySymbols(F);N<p.length;N++)M.indexOf(p[N])<0&&Object.prototype.propertyIsEnumerable.call(F,p[N])&&(A[p[N]]=F[p[N]])}return A};class P{constructor(M,A={}){if(this.endpoint=M,this.validateHeaders=p=>A.validateHeaders?A.validateHeaders(p):{},this.verbose=A.verbose!==!1,this.retries=A.retries!==void 0?A.retries:P.retries,this.headers=A.headers||{},this.timeoutMs=A.timeoutMs,!(this.retries>=0))throw new Error("retries must be positive or zero");if(this.timeoutMs!==void 0&&!(this.timeoutMs>0))throw new Error("timeoutMs must be positive")}fetch(M,A={}){return w(this,void 0,void 0,function*(){return(yield this.fetchVerbose(M,A)).body})}fetchVerbose(M,A={}){return w(this,void 0,void 0,function*(){let p=100*s.a.millisecond,N=0;const $=this.timeoutMs!==void 0?new Date().getTime()+this.timeoutMs:void 0,q=$?()=>Math.max($-new Date().getTime(),0):void 0;for(;;)try{return yield this.doFetch(M,A,q)}catch(h){const d=g(h,R);if((q==null?void 0:q())===0||N===this.retries||!d.retryable&&!A.allowUnsafeRetries)throw d;N++,p*=2+.1*(Math.random()-.5),yield Object(n.a)(q?Math.min(p,q()):p),this.verbose&&i.a.warn(`Connection failure, retrying. Error: ${h.cause.message}`,{url:h.url,error:h.cause})}})}doFetch(M,A,p){return w(this,void 0,void 0,function*(){const{token:N,json:$}=A,q=E(A,["token","json"]),h=(q.method||"GET").toUpperCase(),d=h!=="POST"&&h!=="PATCH",O=this.endpoint!==void 0?`${this.endpoint}${M?`/${M}`:""}`:M,_=new l.a;let x;if(p){const D=p();D>0?x=setTimeout(()=>{_.abort()},D):_.abort()}try{let D;yield Promise.race([P.waitForConnectivity(),new Promise(B=>{D=setTimeout(B,p?Math.min(s.a.minute,p()):s.a.minute)})]),D&&clearTimeout(D);const L=yield m()(O,Object.assign(Object.assign({},q),{headers:Object.assign(Object.assign(Object.assign(Object.assign({},$!==!1?{"Content-Type":"application/json"}:{}),this.headers),q.headers||{}),N!==void 0?{Authorization:`Bearer ${N}`}:{}),signal:_.signal})),T=L.headers.get("content-type")||"",C=T&&T.startsWith("application/json"),U=C?yield L.json():yield L.text(),b=()=>new S(h,O,L.status,U,U&&U.validationErrors||{},L.headers);if(!L.ok)throw this.verbose&&i.a[L.status>=500?"warn":"info"]("Response error",{method:h,url:O,statusCode:L.status}),b();const f=this.validateHeaders(L.headers);if(Object.keys(f).length!==0)throw new c(f,b());if(L.status===204)return{body:void 0,headers:L.headers};if($&&!C)throw new Error(`Response is not JSON: ${JSON.stringify(U)}`);return{body:U,headers:L.headers}}catch(D){if(D.message==="Network request failed")throw new R(D,O,d);if(D.type==="system"&&["EAI_AGAIN","ECONNREFUSED","EHOSTUNREACH","ENOTFOUND"].find(U=>U===D.code))throw new R(D,O,!0);if(D.type==="system"&&["ETIMEDOUT","ECONNRESET","ESOCKETTIMEDOUT","EPIPE"].find(U=>U===D.code))throw new R(D,O,d);if(D.name==="AbortError")throw new R(D,O,d);const L=g(D,S),{statusCode:T}=L;if(T===408||T===429||T===502||T===503||T===504)throw this.verbose&&!d&&i.a.warn("Potentially unsafe retry"),new R(D,O,!0);const C=this.validateHeaders(L.headers);throw Object.keys(C).length!==0?new c(C,L):(yield P.onResponseError(L),D)}finally{x&&clearTimeout(x)}})}}P.retries=8,P.waitForConnectivity=()=>w(void 0,void 0,void 0,function*(){}),P.onResponseError=()=>w(void 0,void 0,void 0,function*(){})},function(e,t,r){function n(R,y){if(!(R instanceof y))throw new TypeError("Cannot call a class as a function")}function i(R,y){for(var S=0;S<y.length;S++){var c=y[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(R,c.key,c)}}var g=r(57),s=r(3),o=s.LEVEL,l=s.MESSAGE;g.enabled=!0;var u=/\s+/,m=function(){function R(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n(this,R),w.colors&&this.addColors(w.colors),this.options=w}var y,S,c;return y=R,c=[{key:"addColors",value:function(w){var E=Object.keys(w).reduce(function(P,F){return P[F]=u.test(w[F])?w[F].split(u):w[F],P},{});return R.allColors=Object.assign({},R.allColors||{},E),R.allColors}}],(S=[{key:"addColors",value:function(w){return R.addColors(w)}},{key:"colorize",value:function(w,E,P){if(P===void 0&&(P=E),!Array.isArray(R.allColors[w]))return g[R.allColors[w]](P);for(var F=0,M=R.allColors[w].length;F<M;F++)P=g[R.allColors[w][F]](P);return P}},{key:"transform",value:function(w,E){return E.all&&typeof w[l]=="string"&&(w[l]=this.colorize(w[o],w.level,w[l])),(E.level||E.all||!E.message)&&(w.level=this.colorize(w[o],w.level)),(E.all||E.message)&&(w.message=this.colorize(w[o],w.level,w.message)),w}}])&&i(y.prototype,S),c&&i(y,c),R}();e.exports=function(R){return new m(R)},e.exports.Colorizer=e.exports.Format=m},function(e,t){var r={}.toString;e.exports=Array.isArray||function(n){return r.call(n)=="[object Array]"}},function(e,t,r){(function(n){function i(g){try{if(!n.localStorage)return!1}catch{return!1}var s=n.localStorage[g];return s!=null&&String(s).toLowerCase()==="true"}e.exports=function(g,s){if(i("noDeprecation"))return g;var o=!1;return function(){if(!o){if(i("throwDeprecation"))throw new Error(s);i("traceDeprecation")?console.trace(s):console.warn(s),o=!0}return g.apply(this,arguments)}}}).call(this,r(5))},function(e,t,r){var n=r(4),i=n.Buffer;function g(o,l){for(var u in o)l[u]=o[u]}function s(o,l,u){return i(o,l,u)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(g(n,t),t.Buffer=s),g(i,s),s.from=function(o,l,u){if(typeof o=="number")throw new TypeError("Argument must not be a number");return i(o,l,u)},s.alloc=function(o,l,u){if(typeof o!="number")throw new TypeError("Argument must be a number");var m=i(o);return l!==void 0?typeof u=="string"?m.fill(l,u):m.fill(l):m.fill(0),m},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return i(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){return n&&typeof n.length=="number"&&n.length>=0&&n.length%1==0},e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,r){var n=r(4),i=n.Buffer;function g(o,l){for(var u in o)l[u]=o[u]}function s(o,l,u){return i(o,l,u)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(g(n,t),t.Buffer=s),g(i,s),s.from=function(o,l,u){if(typeof o=="number")throw new TypeError("Argument must not be a number");return i(o,l,u)},s.alloc=function(o,l,u){if(typeof o!="number")throw new TypeError("Argument must be a number");var m=i(o);return l!==void 0?typeof u=="string"?m.fill(l,u):m.fill(l):m.fill(0),m},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return i(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}},function(e,t,r){(function(n,i,g){var s=r(13);function o(d){var O=this;this.next=null,this.entry=null,this.finish=function(){(function(_,x,D){var L=_.entry;for(_.entry=null;L;){var T=L.callback;x.pendingcb--,T(D),L=L.next}x.corkedRequestsFree?x.corkedRequestsFree.next=_:x.corkedRequestsFree=_})(O,d)}}e.exports=M;var l,u=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?i:s.nextTick;M.WritableState=F;var m=r(14);m.inherits=r(6);var R={deprecate:r(39)},y=r(68),S=r(43).Buffer,c=g.Uint8Array||function(){},w,E=r(69);function P(){}function F(d,O){l=l||r(20),d=d||{};var _=O instanceof l;this.objectMode=!!d.objectMode,_&&(this.objectMode=this.objectMode||!!d.writableObjectMode);var x=d.highWaterMark,D=d.writableHighWaterMark,L=this.objectMode?16:16384;this.highWaterMark=x||x===0?x:_&&(D||D===0)?D:L,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var T=d.decodeStrings===!1;this.decodeStrings=!T,this.defaultEncoding=d.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(C){(function(U,b){var f=U._writableState,B=f.sync,k=f.writecb;if(function(K){K.writing=!1,K.writecb=null,K.length-=K.writelen,K.writelen=0}(f),b)(function(K,Q,G,V,v){--Q.pendingcb,G?(s.nextTick(v,V),s.nextTick(h,K,Q),K._writableState.errorEmitted=!0,K.emit("error",V)):(v(V),K._writableState.errorEmitted=!0,K.emit("error",V),h(K,Q))})(U,f,B,b,k);else{var Y=$(f);Y||f.corked||f.bufferProcessing||!f.bufferedRequest||N(U,f),B?u(p,U,f,Y,k):p(U,f,Y,k)}})(O,C)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function M(d){if(l=l||r(20),!(w.call(M,this)||this instanceof l))return new M(d);this._writableState=new F(d,this),this.writable=!0,d&&(typeof d.write=="function"&&(this._write=d.write),typeof d.writev=="function"&&(this._writev=d.writev),typeof d.destroy=="function"&&(this._destroy=d.destroy),typeof d.final=="function"&&(this._final=d.final)),y.call(this)}function A(d,O,_,x,D,L,T){O.writelen=x,O.writecb=T,O.writing=!0,O.sync=!0,_?d._writev(D,O.onwrite):d._write(D,L,O.onwrite),O.sync=!1}function p(d,O,_,x){_||function(D,L){L.length===0&&L.needDrain&&(L.needDrain=!1,D.emit("drain"))}(d,O),O.pendingcb--,x(),h(d,O)}function N(d,O){O.bufferProcessing=!0;var _=O.bufferedRequest;if(d._writev&&_&&_.next){var x=O.bufferedRequestCount,D=new Array(x),L=O.corkedRequestsFree;L.entry=_;for(var T=0,C=!0;_;)D[T]=_,_.isBuf||(C=!1),_=_.next,T+=1;D.allBuffers=C,A(d,O,!0,O.length,D,"",L.finish),O.pendingcb++,O.lastBufferedRequest=null,L.next?(O.corkedRequestsFree=L.next,L.next=null):O.corkedRequestsFree=new o(O),O.bufferedRequestCount=0}else{for(;_;){var U=_.chunk,b=_.encoding,f=_.callback;if(A(d,O,!1,O.objectMode?1:U.length,U,b,f),_=_.next,O.bufferedRequestCount--,O.writing)break}_===null&&(O.lastBufferedRequest=null)}O.bufferedRequest=_,O.bufferProcessing=!1}function $(d){return d.ending&&d.length===0&&d.bufferedRequest===null&&!d.finished&&!d.writing}function q(d,O){d._final(function(_){O.pendingcb--,_&&d.emit("error",_),O.prefinished=!0,d.emit("prefinish"),h(d,O)})}function h(d,O){var _=$(O);return _&&(function(x,D){D.prefinished||D.finalCalled||(typeof x._final=="function"?(D.pendingcb++,D.finalCalled=!0,s.nextTick(q,x,D)):(D.prefinished=!0,x.emit("prefinish")))}(d,O),O.pendingcb===0&&(O.finished=!0,d.emit("finish"))),_}m.inherits(M,y),F.prototype.getBuffer=function(){for(var d=this.bufferedRequest,O=[];d;)O.push(d),d=d.next;return O},function(){try{Object.defineProperty(F.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(w=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(d){return!!w.call(this,d)||this===M&&d&&d._writableState instanceof F}})):w=function(d){return d instanceof this},M.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},M.prototype.write=function(d,O,_){var x,D=this._writableState,L=!1,T=!D.objectMode&&(x=d,S.isBuffer(x)||x instanceof c);return T&&!S.isBuffer(d)&&(d=function(C){return S.from(C)}(d)),typeof O=="function"&&(_=O,O=null),T?O="buffer":O||(O=D.defaultEncoding),typeof _!="function"&&(_=P),D.ended?function(C,U){var b=new Error("write after end");C.emit("error",b),s.nextTick(U,b)}(this,_):(T||function(C,U,b,f){var B=!0,k=!1;return b===null?k=new TypeError("May not write null values to stream"):typeof b=="string"||b===void 0||U.objectMode||(k=new TypeError("Invalid non-string/buffer chunk")),k&&(C.emit("error",k),s.nextTick(f,k),B=!1),B}(this,D,d,_))&&(D.pendingcb++,L=function(C,U,b,f,B,k){if(!b){var Y=function(V,v,j){return V.objectMode||V.decodeStrings===!1||typeof v!="string"||(v=S.from(v,j)),v}(U,f,B);f!==Y&&(b=!0,B="buffer",f=Y)}var K=U.objectMode?1:f.length;U.length+=K;var Q=U.length<U.highWaterMark;if(Q||(U.needDrain=!0),U.writing||U.corked){var G=U.lastBufferedRequest;U.lastBufferedRequest={chunk:f,encoding:B,isBuf:b,callback:k,next:null},G?G.next=U.lastBufferedRequest:U.bufferedRequest=U.lastBufferedRequest,U.bufferedRequestCount+=1}else A(C,U,!1,K,f,B,k);return Q}(this,D,T,d,O,_)),L},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var d=this._writableState;d.corked&&(d.corked--,d.writing||d.corked||d.finished||d.bufferProcessing||!d.bufferedRequest||N(this,d))},M.prototype.setDefaultEncoding=function(d){if(typeof d=="string"&&(d=d.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((d+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+d);return this._writableState.defaultEncoding=d,this},Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(d,O,_){_(new Error("_write() is not implemented"))},M.prototype._writev=null,M.prototype.end=function(d,O,_){var x=this._writableState;typeof d=="function"?(_=d,d=null,O=null):typeof O=="function"&&(_=O,O=null),d!=null&&this.write(d,O),x.corked&&(x.corked=1,this.uncork()),x.ending||x.finished||function(D,L,T){L.ending=!0,h(D,L),T&&(L.finished?s.nextTick(T):D.once("finish",T)),L.ended=!0,D.writable=!1}(this,x,_)},Object.defineProperty(M.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(d){this._writableState&&(this._writableState.destroyed=d)}}),M.prototype.destroy=E.destroy,M.prototype._undestroy=E.undestroy,M.prototype._destroy=function(d,O){this.end(),O(d)}}).call(this,r(2),r(12).setImmediate,r(5))},function(e,t,r){var n=r(24).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function g(s,o,l){if(typeof o=="function")return g(s,null,o);o||(o={}),l=function(M){var A=!1;return function(){if(!A){A=!0;for(var p=arguments.length,N=new Array(p),$=0;$<p;$++)N[$]=arguments[$];M.apply(this,N)}}}(l||i);var u=o.readable||o.readable!==!1&&s.readable,m=o.writable||o.writable!==!1&&s.writable,R=function(){s.writable||S()},y=s._writableState&&s._writableState.finished,S=function(){m=!1,y=!0,u||l.call(s)},c=s._readableState&&s._readableState.endEmitted,w=function(){u=!1,c=!0,m||l.call(s)},E=function(M){l.call(s,M)},P=function(){var M;return u&&!c?(s._readableState&&s._readableState.ended||(M=new n),l.call(s,M)):m&&!y?(s._writableState&&s._writableState.ended||(M=new n),l.call(s,M)):void 0},F=function(){s.req.on("finish",S)};return function(M){return M.setHeader&&typeof M.abort=="function"}(s)?(s.on("complete",S),s.on("abort",P),s.req?F():s.on("request",F)):m&&!s._writableState&&(s.on("end",R),s.on("close",R)),s.on("end",w),s.on("finish",S),o.error!==!1&&s.on("error",E),s.on("close",P),function(){s.removeListener("complete",S),s.removeListener("abort",P),s.removeListener("request",F),s.req&&s.req.removeListener("finish",S),s.removeListener("end",R),s.removeListener("close",R),s.removeListener("finish",S),s.removeListener("end",w),s.removeListener("error",E),s.removeListener("close",P)}}},function(e,t,r){var n=r(193),i=r(195);function g(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=M,t.resolve=function(A,p){return M(A,!1,!0).resolve(p)},t.resolveObject=function(A,p){return A?M(A,!1,!0).resolveObject(p):p},t.format=function(A){return i.isString(A)&&(A=M(A)),A instanceof g?A.format():g.prototype.format.call(A)},t.Url=g;var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
18
+ `);for(var ye=0;ye<ce.length;ye++)if(!/^[\s\xa0]*$/.test(ce[ye])){var ve=j(ce[ye]),Re=ve[0];if(typeof(ve=ve[1])=="string"){ve=ve.trim();var Te=be[Re]||[];be[Re]=Te,Te.push(ve)}}return function(Ie,je){var Me,we={};for(Me in Ie)we[Me]=je.call(void 0,Ie[Me],Me,Ie);return we}(be,function(Ie){return Ie.join(", ")})}(H.a);if(Object.keys(pe).forEach(function(ce){sr.includes(ce)||(le[ce]=pe[ce])}),function(ce,be){for(var ye=0;ye<ce.g.length;ye++)ce.g[ye](be)}(H,le),X!=0){switch(X){case 7:var ae=10;break;case 8:ae=4;break;case 6:ae=function(ce){switch(ce){case 200:return 0;case 400:return 3;case 401:return 16;case 403:return 7;case 404:return 5;case 409:return 10;case 412:return 9;case 429:return 8;case 499:return 1;case 500:return 2;case 501:return 12;case 503:return 14;case 504:return 4;default:return 2}}(H.a.getStatus());break;default:ae=14}ae==10&&H.j||Je(H,{code:ae,message:d(X),metadata:{}})}else X=!1,"grpc-status"in pe&&(ae=zt(H.a,"grpc-status"),"grpc-message"in pe&&(ne=zt(H.a,"grpc-message")),Number(ae)!=0&&(Je(H,{code:Number(ae),message:ne,metadata:pe}),X=!0)),X||function(ce){for(var be=0;be<ce.c.length;be++)ce.c[be]()}(H)})}function tt(I,H){-1<(H=I.indexOf(H))&&I.splice(H,1)}function Je(I,H){if(H.code!=0)for(var X={code:H.code,message:decodeURIComponent(H.message||""),metadata:H.metadata},ne=0;ne<I.f.length;ne++)I.f[ne](X);for(H={code:H.code,details:decodeURIComponent(H.message||""),metadata:H.metadata},X=0;X<I.h.length;X++)I.h[X](H)}function Be(I){this.a=R("format",I)||"text",this.f=R("suppressCorsPreflight",I)||!1,this.c=R("withCredentials",I)||!1,this.b=R("streamInterceptors",I)||[],this.g=R("unaryInterceptors",I)||[]}function St(I,H,X){var ne=H.getMethodDescriptor(),le=X+ne.name;(X=new Ye).H=I.c;var pe=new Ve({T:X});if(pe.l=ne.b,Dt(X.headers,H.getMetadata()),I.a=="text"?(X.headers.set("Content-Type","application/grpc-web-text"),X.headers.set("Accept","application/grpc-web-text")):X.headers.set("Content-Type","application/grpc-web+proto"),X.headers.set("X-User-Agent","grpc-web-javascript/0.1"),X.headers.set("X-Grpc-Web","1"),Xe(X.headers.b,"deadline")){var ae=X.headers.get("deadline");ae=Math.round(ae-new Date().getTime());var ce=X.headers;Xe(ce.b,"deadline")&&(delete ce.b.deadline,ce.c--,ce.a.length>2*ce.c&&vt(ce)),1/0===ae&&(ae=0),0<ae&&X.headers.set("grpc-timeout",ae+"m")}if(I.f){vt(ce=X.headers),ae={};for(var be=0;be<ce.a.length;be++){var ye=ce.a[be];ae[ye]=ce.b[ye]}(ce=X.headers).b={},ce.a.length=0,ce.c=0;e:{for(ve in ae){var ve=!1;break e}ve=!0}ve||(ae=function(Ie){var je="";return function(Me,we){for(var He in Me)we.call(void 0,Me[He],He,Me)}(Ie,function(Me,we){je+=we,je+=":",je+=Me,je+=`\r
19
+ `}),je}(ae),typeof le=="string"?(ve=encodeURIComponent("$httpHeaders"),(ve+=ae=ae!=null?"="+encodeURIComponent(String(ae)):"")&&(0>(ae=le.indexOf("#"))&&(ae=le.length),0>(ce=le.indexOf("?"))||ce>ae?(ce=ae,be=""):be=le.substring(ce+1,ae),ae=(le=[le.substr(0,ce),be,le.substr(ae)])[1],le[1]=ve?ae?ae+"&"+ve:ve:ae,le=le[0]+(le[1]?"?"+le[1]:"")+le[2])):le.a("$httpHeaders",ae))}for(ne=(H=(0,ne.a)(H.getRequestMessage())).length,ve=[0,0,0,0],ae=new Uint8Array(5+ne),ce=3;0<=ce;ce--)ve[ce]=ne%256,ne>>>=8;if(ae.set(new Uint8Array(ve),1),ae.set(H,5),H=ae,I.a=="text"){var Re;for(I=H,Re===void 0&&(Re=0),qt(),Re=Gt[Re],H=[],ne=0;ne<I.length;ne+=3){ye=I[ne];var Te=(ve=ne+1<I.length)?I[ne+1]:0;ce=ye>>2,ye=(3&ye)<<4|Te>>4,Te=(15&Te)<<2|(be=(ae=ne+2<I.length)?I[ne+2]:0)>>6,be&=63,ae||(be=64,ve||(Te=64)),H.push(Re[ce],Re[ye],Re[Te]||"",Re[be]||"")}H=H.join("")}else I.a=="binary"&&(X.j="arraybuffer");return or(X,le,H),pe}function Yt(I,H,X){var ne=null,le=!1;I.on("data",function(pe){ne=pe}),I.on("error",function(pe){pe.code==0||le||(le=!0,H(pe,null))}),I.on("status",function(pe){pe.code==0||le?X&&H(null,null,pe):(le=!0,H({code:pe.code,message:pe.details,metadata:pe.metadata},null))}),X&&I.on("metadata",function(pe){H(null,null,null,pe)}),I.on("end",function(){le||(ne==null?H({code:2,message:"Incomplete response"}):H(null,ne)),X&&H(null,null)})}function wt(I,H){var X=I;return H.forEach(function(ne){var le=X;X=function(pe){return ne.intercept(pe,le)}}),X}Ve.prototype.on=function(I,H){return I=="data"?this.b.push(H):I=="status"?this.h.push(H):I=="metadata"?this.g.push(H):I=="end"?this.c.push(H):I=="error"&&this.f.push(H),this},Ve.prototype.removeListener=function(I,H){return I=="data"?tt(this.b,H):I=="status"?tt(this.h,H):I=="metadata"?tt(this.g,H):I=="end"?tt(this.c,H):I=="error"&&tt(this.f,H),this},Ve.prototype.cancel=function(){this.j=!0,this.a.abort()},Ve.prototype.cancel=Ve.prototype.cancel,Ve.prototype.removeListener=Ve.prototype.removeListener,Ve.prototype.on=Ve.prototype.on,Be.prototype.P=function(I,H,X,ne,le){var pe=this;ne=q(I,H,"unary",ne);var ae=I.substr(0,I.length-ne.name.length);return Yt(I=wt(function(ce){return St(pe,ce,ae)},this.b).call(this,$(ne,H,X)),le,!1),new h(I)},Be.prototype.M=function(I,H,X,ne){var le=this;ne=q(I,H,"unary",ne);var pe=I.substr(0,I.length-ne.name.length);return wt(function(ae){return new Promise(function(ce,be){var ye,ve,Re;Yt(St(le,ae,pe),function(Te,Ie,je,Me){Te?be(Te):Ie?Re=Ie:je?ve=je:Me?ye=Me:(Te=ae.getMethodDescriptor(),ce(new p(Re,Te,Ie=(Ie=ye)===void 0?{}:Ie,ve===void 0?null:ve)))},!0)})},this.g).call(this,$(ne,H,X)).then(function(ae){return ae.getResponseMessage()})},Be.prototype.unaryCall=function(I,H,X,ne){return this.M(I,H,X,ne)},Be.prototype.R=function(I,H,X,ne){var le=this;ne=q(I,H,"server_streaming",ne);var pe=I.substr(0,I.length-ne.name.length);return wt(function(ae){return St(le,ae,pe)},this.b).call(this,$(ne,H,X))},Be.prototype.serverStreaming=Be.prototype.R,Be.prototype.unaryCall=Be.prototype.unaryCall,Be.prototype.thenableCall=Be.prototype.M,Be.prototype.rpcCall=Be.prototype.P,e.exports.AbstractClientBase={MethodInfo:function(I,H,X,ne,le){this.name=ne,this.b=le,this.f=I,this.a=H,this.c=X}},e.exports.GrpcWebClientBase=Be,e.exports.StatusCode={OK:0,CANCELLED:1,UNKNOWN:2,INVALID_ARGUMENT:3,DEADLINE_EXCEEDED:4,NOT_FOUND:5,ALREADY_EXISTS:6,PERMISSION_DENIED:7,UNAUTHENTICATED:16,RESOURCE_EXHAUSTED:8,FAILED_PRECONDITION:9,ABORTED:10,OUT_OF_RANGE:11,UNIMPLEMENTED:12,INTERNAL:13,UNAVAILABLE:14,DATA_LOSS:15},e.exports.MethodDescriptor=N,e.exports.MethodType={UNARY:"unary",SERVER_STREAMING:"server_streaming"}}).call(this,r(5))},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.isAsyncIterable=t.isAsyncGenerator=t.isAsync=void 0;var n,i=r(151),g=(n=i)&&n.__esModule?n:{default:n};function s(o){return o[Symbol.toStringTag]==="AsyncFunction"}t.default=function(o){if(typeof o!="function")throw new Error("expected a function");return s(o)?(0,g.default)(o):o},t.isAsync=s,t.isAsyncGenerator=function(o){return o[Symbol.toStringTag]==="AsyncGenerator"},t.isAsyncIterable=function(o){return typeof o[Symbol.asyncIterator]=="function"}},function(e,t,r){var n={};function i(s,o,l){l||(l=Error);var u=function(m){var R,y;function S(c,w,E){return m.call(this,function(P,F,M){return typeof o=="string"?o:o(P,F,M)}(c,w,E))||this}return y=m,(R=S).prototype=Object.create(y.prototype),R.prototype.constructor=R,R.__proto__=y,S}(l);u.prototype.name=l.name,u.prototype.code=s,n[s]=u}function g(s,o){if(Array.isArray(s)){var l=s.length;return s=s.map(function(u){return String(u)}),l>2?"one of ".concat(o," ").concat(s.slice(0,l-1).join(", "),", or ")+s[l-1]:l===2?"one of ".concat(o," ").concat(s[0]," or ").concat(s[1]):"of ".concat(o," ").concat(s[0])}return"of ".concat(o," ").concat(String(s))}i("ERR_INVALID_OPT_VALUE",function(s,o){return'The value "'+o+'" is invalid for option "'+s+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(s,o,l){var u,m,R;if(typeof o=="string"&&(m="not ",o.substr(0,m.length)===m)?(u="must not be",o=o.replace(/^not /,"")):u="must be",function(S,c,w){return(w===void 0||w>S.length)&&(w=S.length),S.substring(w-c.length,w)===c}(s," argument"))R="The ".concat(s," ").concat(u," ").concat(g(o,"type"));else{var y=function(S,c,w){return typeof w!="number"&&(w=0),!(w+c.length>S.length)&&S.indexOf(c,w)!==-1}(s,".")?"property":"argument";R='The "'.concat(s,'" ').concat(y," ").concat(u," ").concat(g(o,"type"))}return R+=". Received type ".concat(typeof l)},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(s){return"The "+s+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(s){return"Cannot call "+s+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(s){return"Unknown encoding: "+s},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=n},function(e,t,r){(function(n){var i=Object.keys||function(S){var c=[];for(var w in S)c.push(w);return c};e.exports=m;var g=r(75),s=r(79);r(6)(m,g);for(var o=i(s.prototype),l=0;l<o.length;l++){var u=o[l];m.prototype[u]||(m.prototype[u]=s.prototype[u])}function m(S){if(!(this instanceof m))return new m(S);g.call(this,S),s.call(this,S),this.allowHalfOpen=!0,S&&(S.readable===!1&&(this.readable=!1),S.writable===!1&&(this.writable=!1),S.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",R)))}function R(){this._writableState.ended||n.nextTick(y,this)}function y(S){S.end()}Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(m.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(m.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(m.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this,r(2))},function(e,t,r){r.d(t,"a",function(){return s});var n=r(36),i=r(7);const g={"app-id":["app-id must match formant/*"]};class s extends n.a{constructor(l,u={}){super(l,Object.assign({validateHeaders:m=>`${m.get("app-id")}`.startsWith("formant/")?{}:g,headers:Object.assign(Object.assign({},s.headers),{"App-ID":`formant/${i.a}`,"App-Version":i.j})},u)),this.endpoint=l}}s.headers={}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n,i=n.length){if(!i)throw new Error("arity is undefined");return function(...g){return typeof g[i-1]=="function"?n.apply(this,g):new Promise((s,o)=>{g[i-1]=(l,...u)=>{if(l)return o(l);s(u.length>1?u:u[0])},n.apply(this,g)})}},e.exports=t.default},function(e,t,r){(t=e.exports=r(67)).Stream=t,t.Readable=t,t.Writable=r(44),t.Duplex=r(20),t.Transform=r(70),t.PassThrough=r(164)},function(e,t,r){(t=e.exports=r(75)).Stream=t,t.Readable=t,t.Writable=r(79),t.Duplex=r(25),t.Transform=r(80),t.PassThrough=r(183),t.finished=r(45),t.pipeline=r(184)},function(e,t,r){r.d(t,"a",function(){return i});const n=["password","secret","token","key","buffer"];function i(g,s=new Set){return s.has(g)?"[ RECURSIVE ]":!(o=g)||typeof o!="object"&&typeof o!="function"?g:(s.add(g),Object.keys(g).reduce((l,u)=>(l[u]=n.some(m=>u.toLowerCase().includes(m.toLowerCase()))?"[ REDACTED ]":i(g[u],s),l),{}));var o}},function(e,t){e.exports=n,n.default=n,n.stable=g,n.stableStringify=g;var r=[];function n(s,o,l){(function R(y,S,c,w){var E;if(typeof y=="object"&&y!==null){for(E=0;E<c.length;E++)if(c[E]===y)return w[S]="[Circular]",void r.push([w,S,y]);if(c.push(y),Array.isArray(y))for(E=0;E<y.length;E++)R(y[E],E,c,y);else{var P=Object.keys(y);for(E=0;E<P.length;E++){var F=P[E];R(y[F],F,c,y)}}c.pop()}})(s,"",[],void 0);for(var u=JSON.stringify(s,o,l);r.length!==0;){var m=r.pop();m[0][m[1]]=m[2]}return u}function i(s,o){return s<o?-1:s>o?1:0}function g(s,o,l){for(var u=function y(S,c,w,E){var P;if(typeof S=="object"&&S!==null){for(P=0;P<w.length;P++)if(w[P]===S)return E[c]="[Circular]",void r.push([E,c,S]);if(typeof S.toJSON=="function")return;if(w.push(S),Array.isArray(S))for(P=0;P<S.length;P++)y(S[P],P,w,S);else{var F={},M=Object.keys(S).sort(i);for(P=0;P<M.length;P++){var A=M[P];y(S[A],A,w,S),F[A]=S[A]}if(E===void 0)return F;r.push([E,c,S]),E[c]=F}w.pop()}}(s,"",[],void 0)||s,m=JSON.stringify(u,o,l);r.length!==0;){var R=r.pop();R[0][R[1]]=R[2]}return m}},function(e,t,r){var n=r(13),i=Object.keys||function(c){var w=[];for(var E in c)w.push(E);return w};e.exports=R;var g=Object.create(r(14));g.inherits=r(6);var s=r(142),o=r(60);g.inherits(R,s);for(var l=i(o.prototype),u=0;u<l.length;u++){var m=l[u];R.prototype[m]||(R.prototype[m]=o.prototype[m])}function R(c){if(!(this instanceof R))return new R(c);s.call(this,c),o.call(this,c),c&&c.readable===!1&&(this.readable=!1),c&&c.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,c&&c.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",y)}function y(){this.allowHalfOpen||this._writableState.ended||n.nextTick(S,this)}function S(c){c.end()}Object.defineProperty(R.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(R.prototype,"destroyed",{get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(c){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}),R.prototype._destroy=function(c,w){this.push(null),this.end(),n.nextTick(w,c)}},function(e,t,r){var n=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function i(o,l){return Object.prototype.hasOwnProperty.call(o,l)}t.assign=function(o){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var u=l.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var m in u)i(u,m)&&(o[m]=u[m])}}return o},t.shrinkBuf=function(o,l){return o.length===l?o:o.subarray?o.subarray(0,l):(o.length=l,o)};var g={arraySet:function(o,l,u,m,R){if(l.subarray&&o.subarray)o.set(l.subarray(u,u+m),R);else for(var y=0;y<m;y++)o[R+y]=l[u+y]},flattenChunks:function(o){var l,u,m,R,y,S;for(m=0,l=0,u=o.length;l<u;l++)m+=o[l].length;for(S=new Uint8Array(m),R=0,l=0,u=o.length;l<u;l++)y=o[l],S.set(y,R),R+=y.length;return S}},s={arraySet:function(o,l,u,m,R){for(var y=0;y<m;y++)o[R+y]=l[u+y]},flattenChunks:function(o){return[].concat.apply([],o)}};t.setTyped=function(o){o?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,g)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,s))},t.setTyped(n)},function(e,t,r){e.exports=r(185)},function(e,t,r){e.exports=function(n){return n}},function(e,t,r){r.d(t,"a",function(){return P});var n=r(11),i=r(0);function g(F,M,A=()=>!0){if(F instanceof M&&A(F))return F;throw F}var s=r(1),o=r(100),l=r.n(o),u=r(101),m=r.n(u);class R extends Error{constructor(M,A,p){super(`Connection failure: ${M.message}`),this.cause=M,this.url=A,this.retryable=p}}var y=r(30);class S extends Error{constructor(M,A,p,N,$={},q){super(`Unexpected response (${p}) for ${M} ${A}: ${JSON.stringify(q?Object(y.a)([...q.entries()].reduce((h,[d,O])=>(h[d]=O,h),{})):{})} -- ${JSON.stringify(Object(y.a)(N))}`),this.method=M,this.url=A,this.statusCode=p,this.body=N,this.validationErrors=$,this.headers=q}}class c extends Error{constructor(M,A){super(`Invalid headers (${JSON.stringify(M)}) for response: ${A.message}`),this.validationErrors=M,this.responseError=A}}var w=function(F,M,A,p){return new(A||(A=Promise))(function(N,$){function q(O){try{d(p.next(O))}catch(_){$(_)}}function h(O){try{d(p.throw(O))}catch(_){$(_)}}function d(O){var _;O.done?N(O.value):(_=O.value,_ instanceof A?_:new A(function(x){x(_)})).then(q,h)}d((p=p.apply(F,M||[])).next())})},E=function(F,M){var A={};for(var p in F)Object.prototype.hasOwnProperty.call(F,p)&&M.indexOf(p)<0&&(A[p]=F[p]);if(F!=null&&typeof Object.getOwnPropertySymbols=="function"){var N=0;for(p=Object.getOwnPropertySymbols(F);N<p.length;N++)M.indexOf(p[N])<0&&Object.prototype.propertyIsEnumerable.call(F,p[N])&&(A[p[N]]=F[p[N]])}return A};class P{constructor(M,A={}){if(this.endpoint=M,this.validateHeaders=p=>A.validateHeaders?A.validateHeaders(p):{},this.verbose=A.verbose!==!1,this.retries=A.retries!==void 0?A.retries:P.retries,this.headers=A.headers||{},this.timeoutMs=A.timeoutMs,!(this.retries>=0))throw new Error("retries must be positive or zero");if(this.timeoutMs!==void 0&&!(this.timeoutMs>0))throw new Error("timeoutMs must be positive")}fetch(M,A={}){return w(this,void 0,void 0,function*(){return(yield this.fetchVerbose(M,A)).body})}fetchVerbose(M,A={}){return w(this,void 0,void 0,function*(){let p=100*s.a.millisecond,N=0;const $=this.timeoutMs!==void 0?new Date().getTime()+this.timeoutMs:void 0,q=$?()=>Math.max($-new Date().getTime(),0):void 0;for(;;)try{return yield this.doFetch(M,A,q)}catch(h){const d=g(h,R);if((q==null?void 0:q())===0||N===this.retries||!d.retryable&&!A.allowUnsafeRetries)throw d;N++,p*=2+.1*(Math.random()-.5),yield Object(n.a)(q?Math.min(p,q()):p),this.verbose&&i.a.warn(`Connection failure, retrying. Error: ${h.cause.message}`,{url:h.url,error:h.cause})}})}doFetch(M,A,p){return w(this,void 0,void 0,function*(){const{token:N,json:$}=A,q=E(A,["token","json"]),h=(q.method||"GET").toUpperCase(),d=h!=="POST"&&h!=="PATCH",O=this.endpoint!==void 0?`${this.endpoint}${M?`/${M}`:""}`:M,_=new l.a;let x;if(p){const D=p();D>0?x=setTimeout(()=>{_.abort()},D):_.abort()}try{let D;yield Promise.race([P.waitForConnectivity(),new Promise(B=>{D=setTimeout(B,p?Math.min(s.a.minute,p()):s.a.minute)})]),D&&clearTimeout(D);const L=yield m()(O,Object.assign(Object.assign({},q),{headers:Object.assign(Object.assign(Object.assign(Object.assign({},$!==!1?{"Content-Type":"application/json"}:{}),this.headers),q.headers||{}),N!==void 0?{Authorization:`Bearer ${N}`}:{}),signal:_.signal})),T=L.headers.get("content-type")||"",C=T&&T.startsWith("application/json"),U=C?yield L.json():yield L.text(),b=()=>new S(h,O,L.status,U,U&&U.validationErrors||{},L.headers);if(!L.ok)throw this.verbose&&i.a[L.status>=500?"warn":"info"]("Response error",{method:h,url:O,statusCode:L.status}),b();const f=this.validateHeaders(L.headers);if(Object.keys(f).length!==0)throw new c(f,b());if(L.status===204)return{body:void 0,headers:L.headers};if($&&!C)throw new Error(`Response is not JSON: ${JSON.stringify(U)}`);return{body:U,headers:L.headers}}catch(D){if(D.message==="Network request failed")throw new R(D,O,d);if(D.type==="system"&&["EAI_AGAIN","ECONNREFUSED","EHOSTUNREACH","ENOTFOUND"].find(U=>U===D.code))throw new R(D,O,!0);if(D.type==="system"&&["ETIMEDOUT","ECONNRESET","ESOCKETTIMEDOUT","EPIPE"].find(U=>U===D.code))throw new R(D,O,d);if(D.name==="AbortError")throw new R(D,O,d);const L=g(D,S),{statusCode:T}=L;if(T===408||T===429||T===502||T===503||T===504)throw this.verbose&&!d&&i.a.warn("Potentially unsafe retry"),new R(D,O,!0);const C=this.validateHeaders(L.headers);throw Object.keys(C).length!==0?new c(C,L):(yield P.onResponseError(L),D)}finally{x&&clearTimeout(x)}})}}P.retries=8,P.waitForConnectivity=()=>w(void 0,void 0,void 0,function*(){}),P.onResponseError=()=>w(void 0,void 0,void 0,function*(){})},function(e,t,r){function n(R,y){if(!(R instanceof y))throw new TypeError("Cannot call a class as a function")}function i(R,y){for(var S=0;S<y.length;S++){var c=y[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(R,c.key,c)}}var g=r(57),s=r(3),o=s.LEVEL,l=s.MESSAGE;g.enabled=!0;var u=/\s+/,m=function(){function R(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n(this,R),w.colors&&this.addColors(w.colors),this.options=w}var y,S,c;return y=R,c=[{key:"addColors",value:function(w){var E=Object.keys(w).reduce(function(P,F){return P[F]=u.test(w[F])?w[F].split(u):w[F],P},{});return R.allColors=Object.assign({},R.allColors||{},E),R.allColors}}],(S=[{key:"addColors",value:function(w){return R.addColors(w)}},{key:"colorize",value:function(w,E,P){if(P===void 0&&(P=E),!Array.isArray(R.allColors[w]))return g[R.allColors[w]](P);for(var F=0,M=R.allColors[w].length;F<M;F++)P=g[R.allColors[w][F]](P);return P}},{key:"transform",value:function(w,E){return E.all&&typeof w[l]=="string"&&(w[l]=this.colorize(w[o],w.level,w[l])),(E.level||E.all||!E.message)&&(w.level=this.colorize(w[o],w.level)),(E.all||E.message)&&(w.message=this.colorize(w[o],w.level,w.message)),w}}])&&i(y.prototype,S),c&&i(y,c),R}();e.exports=function(R){return new m(R)},e.exports.Colorizer=e.exports.Format=m},function(e,t){var r={}.toString;e.exports=Array.isArray||function(n){return r.call(n)=="[object Array]"}},function(e,t,r){(function(n){function i(g){try{if(!n.localStorage)return!1}catch{return!1}var s=n.localStorage[g];return s!=null&&String(s).toLowerCase()==="true"}e.exports=function(g,s){if(i("noDeprecation"))return g;var o=!1;return function(){if(!o){if(i("throwDeprecation"))throw new Error(s);i("traceDeprecation")?console.trace(s):console.warn(s),o=!0}return g.apply(this,arguments)}}}).call(this,r(5))},function(e,t,r){var n=r(4),i=n.Buffer;function g(o,l){for(var u in o)l[u]=o[u]}function s(o,l,u){return i(o,l,u)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(g(n,t),t.Buffer=s),g(i,s),s.from=function(o,l,u){if(typeof o=="number")throw new TypeError("Argument must not be a number");return i(o,l,u)},s.alloc=function(o,l,u){if(typeof o!="number")throw new TypeError("Argument must be a number");var m=i(o);return l!==void 0?typeof u=="string"?m.fill(l,u):m.fill(l):m.fill(0),m},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return i(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){return n&&typeof n.length=="number"&&n.length>=0&&n.length%1==0},e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,r){var n=r(4),i=n.Buffer;function g(o,l){for(var u in o)l[u]=o[u]}function s(o,l,u){return i(o,l,u)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(g(n,t),t.Buffer=s),g(i,s),s.from=function(o,l,u){if(typeof o=="number")throw new TypeError("Argument must not be a number");return i(o,l,u)},s.alloc=function(o,l,u){if(typeof o!="number")throw new TypeError("Argument must be a number");var m=i(o);return l!==void 0?typeof u=="string"?m.fill(l,u):m.fill(l):m.fill(0),m},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return i(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(o)}},function(e,t,r){(function(n,i,g){var s=r(13);function o(d){var O=this;this.next=null,this.entry=null,this.finish=function(){(function(_,x,D){var L=_.entry;for(_.entry=null;L;){var T=L.callback;x.pendingcb--,T(D),L=L.next}x.corkedRequestsFree?x.corkedRequestsFree.next=_:x.corkedRequestsFree=_})(O,d)}}e.exports=M;var l,u=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?i:s.nextTick;M.WritableState=F;var m=r(14);m.inherits=r(6);var R={deprecate:r(39)},y=r(68),S=r(43).Buffer,c=g.Uint8Array||function(){},w,E=r(69);function P(){}function F(d,O){l=l||r(20),d=d||{};var _=O instanceof l;this.objectMode=!!d.objectMode,_&&(this.objectMode=this.objectMode||!!d.writableObjectMode);var x=d.highWaterMark,D=d.writableHighWaterMark,L=this.objectMode?16:16384;this.highWaterMark=x||x===0?x:_&&(D||D===0)?D:L,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var T=d.decodeStrings===!1;this.decodeStrings=!T,this.defaultEncoding=d.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(C){(function(U,b){var f=U._writableState,B=f.sync,k=f.writecb;if(function(K){K.writing=!1,K.writecb=null,K.length-=K.writelen,K.writelen=0}(f),b)(function(K,Q,G,V,v){--Q.pendingcb,G?(s.nextTick(v,V),s.nextTick(h,K,Q),K._writableState.errorEmitted=!0,K.emit("error",V)):(v(V),K._writableState.errorEmitted=!0,K.emit("error",V),h(K,Q))})(U,f,B,b,k);else{var Y=$(f);Y||f.corked||f.bufferProcessing||!f.bufferedRequest||N(U,f),B?u(p,U,f,Y,k):p(U,f,Y,k)}})(O,C)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function M(d){if(l=l||r(20),!(w.call(M,this)||this instanceof l))return new M(d);this._writableState=new F(d,this),this.writable=!0,d&&(typeof d.write=="function"&&(this._write=d.write),typeof d.writev=="function"&&(this._writev=d.writev),typeof d.destroy=="function"&&(this._destroy=d.destroy),typeof d.final=="function"&&(this._final=d.final)),y.call(this)}function A(d,O,_,x,D,L,T){O.writelen=x,O.writecb=T,O.writing=!0,O.sync=!0,_?d._writev(D,O.onwrite):d._write(D,L,O.onwrite),O.sync=!1}function p(d,O,_,x){_||function(D,L){L.length===0&&L.needDrain&&(L.needDrain=!1,D.emit("drain"))}(d,O),O.pendingcb--,x(),h(d,O)}function N(d,O){O.bufferProcessing=!0;var _=O.bufferedRequest;if(d._writev&&_&&_.next){var x=O.bufferedRequestCount,D=new Array(x),L=O.corkedRequestsFree;L.entry=_;for(var T=0,C=!0;_;)D[T]=_,_.isBuf||(C=!1),_=_.next,T+=1;D.allBuffers=C,A(d,O,!0,O.length,D,"",L.finish),O.pendingcb++,O.lastBufferedRequest=null,L.next?(O.corkedRequestsFree=L.next,L.next=null):O.corkedRequestsFree=new o(O),O.bufferedRequestCount=0}else{for(;_;){var U=_.chunk,b=_.encoding,f=_.callback;if(A(d,O,!1,O.objectMode?1:U.length,U,b,f),_=_.next,O.bufferedRequestCount--,O.writing)break}_===null&&(O.lastBufferedRequest=null)}O.bufferedRequest=_,O.bufferProcessing=!1}function $(d){return d.ending&&d.length===0&&d.bufferedRequest===null&&!d.finished&&!d.writing}function q(d,O){d._final(function(_){O.pendingcb--,_&&d.emit("error",_),O.prefinished=!0,d.emit("prefinish"),h(d,O)})}function h(d,O){var _=$(O);return _&&(function(x,D){D.prefinished||D.finalCalled||(typeof x._final=="function"?(D.pendingcb++,D.finalCalled=!0,s.nextTick(q,x,D)):(D.prefinished=!0,x.emit("prefinish")))}(d,O),O.pendingcb===0&&(O.finished=!0,d.emit("finish"))),_}m.inherits(M,y),F.prototype.getBuffer=function(){for(var d=this.bufferedRequest,O=[];d;)O.push(d),d=d.next;return O},function(){try{Object.defineProperty(F.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(w=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(d){return!!w.call(this,d)||this===M&&d&&d._writableState instanceof F}})):w=function(d){return d instanceof this},M.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},M.prototype.write=function(d,O,_){var x,D=this._writableState,L=!1,T=!D.objectMode&&(x=d,S.isBuffer(x)||x instanceof c);return T&&!S.isBuffer(d)&&(d=function(C){return S.from(C)}(d)),typeof O=="function"&&(_=O,O=null),T?O="buffer":O||(O=D.defaultEncoding),typeof _!="function"&&(_=P),D.ended?function(C,U){var b=new Error("write after end");C.emit("error",b),s.nextTick(U,b)}(this,_):(T||function(C,U,b,f){var B=!0,k=!1;return b===null?k=new TypeError("May not write null values to stream"):typeof b=="string"||b===void 0||U.objectMode||(k=new TypeError("Invalid non-string/buffer chunk")),k&&(C.emit("error",k),s.nextTick(f,k),B=!1),B}(this,D,d,_))&&(D.pendingcb++,L=function(C,U,b,f,B,k){if(!b){var Y=function(V,v,j){return V.objectMode||V.decodeStrings===!1||typeof v!="string"||(v=S.from(v,j)),v}(U,f,B);f!==Y&&(b=!0,B="buffer",f=Y)}var K=U.objectMode?1:f.length;U.length+=K;var Q=U.length<U.highWaterMark;if(Q||(U.needDrain=!0),U.writing||U.corked){var G=U.lastBufferedRequest;U.lastBufferedRequest={chunk:f,encoding:B,isBuf:b,callback:k,next:null},G?G.next=U.lastBufferedRequest:U.bufferedRequest=U.lastBufferedRequest,U.bufferedRequestCount+=1}else A(C,U,!1,K,f,B,k);return Q}(this,D,T,d,O,_)),L},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var d=this._writableState;d.corked&&(d.corked--,d.writing||d.corked||d.finished||d.bufferProcessing||!d.bufferedRequest||N(this,d))},M.prototype.setDefaultEncoding=function(d){if(typeof d=="string"&&(d=d.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((d+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+d);return this._writableState.defaultEncoding=d,this},Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(d,O,_){_(new Error("_write() is not implemented"))},M.prototype._writev=null,M.prototype.end=function(d,O,_){var x=this._writableState;typeof d=="function"?(_=d,d=null,O=null):typeof O=="function"&&(_=O,O=null),d!=null&&this.write(d,O),x.corked&&(x.corked=1,this.uncork()),x.ending||x.finished||function(D,L,T){L.ending=!0,h(D,L),T&&(L.finished?s.nextTick(T):D.once("finish",T)),L.ended=!0,D.writable=!1}(this,x,_)},Object.defineProperty(M.prototype,"destroyed",{get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(d){this._writableState&&(this._writableState.destroyed=d)}}),M.prototype.destroy=E.destroy,M.prototype._undestroy=E.undestroy,M.prototype._destroy=function(d,O){this.end(),O(d)}}).call(this,r(2),r(12).setImmediate,r(5))},function(e,t,r){var n=r(24).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function g(s,o,l){if(typeof o=="function")return g(s,null,o);o||(o={}),l=function(M){var A=!1;return function(){if(!A){A=!0;for(var p=arguments.length,N=new Array(p),$=0;$<p;$++)N[$]=arguments[$];M.apply(this,N)}}}(l||i);var u=o.readable||o.readable!==!1&&s.readable,m=o.writable||o.writable!==!1&&s.writable,R=function(){s.writable||S()},y=s._writableState&&s._writableState.finished,S=function(){m=!1,y=!0,u||l.call(s)},c=s._readableState&&s._readableState.endEmitted,w=function(){u=!1,c=!0,m||l.call(s)},E=function(M){l.call(s,M)},P=function(){var M;return u&&!c?(s._readableState&&s._readableState.ended||(M=new n),l.call(s,M)):m&&!y?(s._writableState&&s._writableState.ended||(M=new n),l.call(s,M)):void 0},F=function(){s.req.on("finish",S)};return function(M){return M.setHeader&&typeof M.abort=="function"}(s)?(s.on("complete",S),s.on("abort",P),s.req?F():s.on("request",F)):m&&!s._writableState&&(s.on("end",R),s.on("close",R)),s.on("end",w),s.on("finish",S),o.error!==!1&&s.on("error",E),s.on("close",P),function(){s.removeListener("complete",S),s.removeListener("abort",P),s.removeListener("request",F),s.req&&s.req.removeListener("finish",S),s.removeListener("end",R),s.removeListener("close",R),s.removeListener("finish",S),s.removeListener("end",w),s.removeListener("error",E),s.removeListener("close",P)}}},function(e,t,r){var n=r(193),i=r(195);function g(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=M,t.resolve=function(A,p){return M(A,!1,!0).resolve(p)},t.resolveObject=function(A,p){return A?M(A,!1,!0).resolveObject(p):p},t.format=function(A){return i.isString(A)&&(A=M(A)),A instanceof g?A.format():g.prototype.format.call(A)},t.Url=g;var s=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
20
20
  `," "]),m=["'"].concat(u),R=["%","/","?",";","#"].concat(m),y=["/","?","#"],S=/^[+a-z0-9A-Z_-]{0,63}$/,c=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},P={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},F=r(196);function M(A,p,N){if(A&&i.isObject(A)&&A instanceof g)return A;var $=new g;return $.parse(A,p,N),$}g.prototype.parse=function(A,p,N){if(!i.isString(A))throw new TypeError("Parameter 'url' must be a string, not "+typeof A);var $=A.indexOf("?"),q=$!==-1&&$<A.indexOf("#")?"?":"#",h=A.split(q);h[0]=h[0].replace(/\\/g,"/");var d=A=h.join(q);if(d=d.trim(),!N&&A.split("#").length===1){var O=l.exec(d);if(O)return this.path=d,this.href=d,this.pathname=O[1],O[2]?(this.search=O[2],this.query=p?F.parse(this.search.substr(1)):this.search.substr(1)):p&&(this.search="",this.query={}),this}var _=s.exec(d);if(_){var x=(_=_[0]).toLowerCase();this.protocol=x,d=d.substr(_.length)}if(N||_||d.match(/^\/\/[^@\/]+@[^@\/]+/)){var D=d.substr(0,2)==="//";!D||_&&E[_]||(d=d.substr(2),this.slashes=!0)}if(!E[_]&&(D||_&&!P[_])){for(var L,T,C=-1,U=0;U<y.length;U++)(b=d.indexOf(y[U]))!==-1&&(C===-1||b<C)&&(C=b);for((T=C===-1?d.lastIndexOf("@"):d.lastIndexOf("@",C))!==-1&&(L=d.slice(0,T),d=d.slice(T+1),this.auth=decodeURIComponent(L)),C=-1,U=0;U<R.length;U++){var b;(b=d.indexOf(R[U]))!==-1&&(C===-1||b<C)&&(C=b)}C===-1&&(C=d.length),this.host=d.slice(0,C),d=d.slice(C),this.parseHost(),this.hostname=this.hostname||"";var f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f)for(var B=this.hostname.split(/\./),k=(U=0,B.length);U<k;U++){var Y=B[U];if(Y&&!Y.match(S)){for(var K="",Q=0,G=Y.length;Q<G;Q++)Y.charCodeAt(Q)>127?K+="x":K+=Y[Q];if(!K.match(S)){var V=B.slice(0,U),v=B.slice(U+1),j=Y.match(c);j&&(V.push(j[1]),v.unshift(j[2])),v.length&&(d="/"+v.join(".")+d),this.hostname=V.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),f||(this.hostname=n.toASCII(this.hostname));var W=this.port?":"+this.port:"",ee=this.hostname||"";this.host=ee+W,this.href+=this.host,f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),d[0]!=="/"&&(d="/"+d))}if(!w[x])for(U=0,k=m.length;U<k;U++){var J=m[U];if(d.indexOf(J)!==-1){var re=encodeURIComponent(J);re===J&&(re=escape(J)),d=d.split(J).join(re)}}var se=d.indexOf("#");se!==-1&&(this.hash=d.substr(se),d=d.slice(0,se));var oe=d.indexOf("?");if(oe!==-1?(this.search=d.substr(oe),this.query=d.substr(oe+1),p&&(this.query=F.parse(this.query)),d=d.slice(0,oe)):p&&(this.search="",this.query={}),d&&(this.pathname=d),P[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){W=this.pathname||"";var z=this.search||"";this.path=W+z}return this.href=this.format(),this},g.prototype.format=function(){var A=this.auth||"";A&&(A=(A=encodeURIComponent(A)).replace(/%3A/i,":"),A+="@");var p=this.protocol||"",N=this.pathname||"",$=this.hash||"",q=!1,h="";this.host?q=A+this.host:this.hostname&&(q=A+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(q+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(h=F.stringify(this.query));var d=this.search||h&&"?"+h||"";return p&&p.substr(-1)!==":"&&(p+=":"),this.slashes||(!p||P[p])&&q!==!1?(q="//"+(q||""),N&&N.charAt(0)!=="/"&&(N="/"+N)):q||(q=""),$&&$.charAt(0)!=="#"&&($="#"+$),d&&d.charAt(0)!=="?"&&(d="?"+d),p+q+(N=N.replace(/[?#]/g,function(O){return encodeURIComponent(O)}))+(d=d.replace("#","%23"))+$},g.prototype.resolve=function(A){return this.resolveObject(M(A,!1,!0)).format()},g.prototype.resolveObject=function(A){if(i.isString(A)){var p=new g;p.parse(A,!1,!0),A=p}for(var N=new g,$=Object.keys(this),q=0;q<$.length;q++){var h=$[q];N[h]=this[h]}if(N.hash=A.hash,A.href==="")return N.href=N.format(),N;if(A.slashes&&!A.protocol){for(var d=Object.keys(A),O=0;O<d.length;O++){var _=d[O];_!=="protocol"&&(N[_]=A[_])}return P[N.protocol]&&N.hostname&&!N.pathname&&(N.path=N.pathname="/"),N.href=N.format(),N}if(A.protocol&&A.protocol!==N.protocol){if(!P[A.protocol]){for(var x=Object.keys(A),D=0;D<x.length;D++){var L=x[D];N[L]=A[L]}return N.href=N.format(),N}if(N.protocol=A.protocol,A.host||E[A.protocol])N.pathname=A.pathname;else{for(var T=(A.pathname||"").split("/");T.length&&!(A.host=T.shift()););A.host||(A.host=""),A.hostname||(A.hostname=""),T[0]!==""&&T.unshift(""),T.length<2&&T.unshift(""),N.pathname=T.join("/")}if(N.search=A.search,N.query=A.query,N.host=A.host||"",N.auth=A.auth,N.hostname=A.hostname||A.host,N.port=A.port,N.pathname||N.search){var C=N.pathname||"",U=N.search||"";N.path=C+U}return N.slashes=N.slashes||A.slashes,N.href=N.format(),N}var b=N.pathname&&N.pathname.charAt(0)==="/",f=A.host||A.pathname&&A.pathname.charAt(0)==="/",B=f||b||N.host&&A.pathname,k=B,Y=N.pathname&&N.pathname.split("/")||[],K=(T=A.pathname&&A.pathname.split("/")||[],N.protocol&&!P[N.protocol]);if(K&&(N.hostname="",N.port=null,N.host&&(Y[0]===""?Y[0]=N.host:Y.unshift(N.host)),N.host="",A.protocol&&(A.hostname=null,A.port=null,A.host&&(T[0]===""?T[0]=A.host:T.unshift(A.host)),A.host=null),B=B&&(T[0]===""||Y[0]==="")),f)N.host=A.host||A.host===""?A.host:N.host,N.hostname=A.hostname||A.hostname===""?A.hostname:N.hostname,N.search=A.search,N.query=A.query,Y=T;else if(T.length)Y||(Y=[]),Y.pop(),Y=Y.concat(T),N.search=A.search,N.query=A.query;else if(!i.isNullOrUndefined(A.search))return K&&(N.hostname=N.host=Y.shift(),(j=!!(N.host&&N.host.indexOf("@")>0)&&N.host.split("@"))&&(N.auth=j.shift(),N.host=N.hostname=j.shift())),N.search=A.search,N.query=A.query,i.isNull(N.pathname)&&i.isNull(N.search)||(N.path=(N.pathname?N.pathname:"")+(N.search?N.search:"")),N.href=N.format(),N;if(!Y.length)return N.pathname=null,N.search?N.path="/"+N.search:N.path=null,N.href=N.format(),N;for(var Q=Y.slice(-1)[0],G=(N.host||A.host||Y.length>1)&&(Q==="."||Q==="..")||Q==="",V=0,v=Y.length;v>=0;v--)(Q=Y[v])==="."?Y.splice(v,1):Q===".."?(Y.splice(v,1),V++):V&&(Y.splice(v,1),V--);if(!B&&!k)for(;V--;V)Y.unshift("..");!B||Y[0]===""||Y[0]&&Y[0].charAt(0)==="/"||Y.unshift(""),G&&Y.join("/").substr(-1)!=="/"&&Y.push("");var j,W=Y[0]===""||Y[0]&&Y[0].charAt(0)==="/";return K&&(N.hostname=N.host=W?"":Y.length?Y.shift():"",(j=!!(N.host&&N.host.indexOf("@")>0)&&N.host.split("@"))&&(N.auth=j.shift(),N.host=N.hostname=j.shift())),(B=B||N.host&&Y.length)&&!W&&Y.unshift(""),Y.length?N.pathname=Y.join("/"):(N.pathname=null,N.path=null),i.isNull(N.pathname)&&i.isNull(N.search)||(N.path=(N.pathname?N.pathname:"")+(N.search?N.search:"")),N.auth=A.auth||N.auth,N.slashes=N.slashes||A.slashes,N.href=N.format(),N},g.prototype.parseHost=function(){var A=this.host,p=o.exec(A);p&&((p=p[0])!==":"&&(this.port=p.substr(1)),A=A.substr(0,A.length-p.length)),A&&(this.hostname=A)}},function(e,t,r){var n=r(56),i=r(3).configs;t.cli=n.levels(i.cli),t.npm=n.levels(i.npm),t.syslog=n.levels(i.syslog),t.addColors=n.levels},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(202)),i=o(r(203)),g=o(r(23)),s=o(r(27));function o(l){return l&&l.__esModule?l:{default:l}}t.default=(0,s.default)(function(l,u,m){return(0,n.default)(l,(0,i.default)((0,g.default)(u)),m)},3),e.exports=t.default},function(e,t,r){function n(i){Error.captureStackTrace(this,this.constructor),this.name="EnvVarError",this.message=`env-var: ${i}`}(0,r(10).inherits)(n,Error),e.exports=n},function(e,t,r){e.exports=function(n){const i=parseInt(n,10);if(isNaN(i)||n.toString().indexOf(".")!==-1)throw new Error("should be a valid integer");return i}},function(e,t,r){e.exports=function(n){const i=parseFloat(n);if(isNaN(i))throw new Error("should be a valid float");return i}},function(e,t,r){e.exports=function(n){try{return JSON.parse(n)}catch{throw new Error("should be valid (parseable) JSON")}}},function(e,t,r){(function(n){function i(o,l){for(var u=0,m=o.length-1;m>=0;m--){var R=o[m];R==="."?o.splice(m,1):R===".."?(o.splice(m,1),u++):u&&(o.splice(m,1),u--)}if(l)for(;u--;u)o.unshift("..");return o}function g(o,l){if(o.filter)return o.filter(l);for(var u=[],m=0;m<o.length;m++)l(o[m],m,o)&&u.push(o[m]);return u}t.resolve=function(){for(var o="",l=!1,u=arguments.length-1;u>=-1&&!l;u--){var m=u>=0?arguments[u]:n.cwd();if(typeof m!="string")throw new TypeError("Arguments to path.resolve must be strings");m&&(o=m+"/"+o,l=m.charAt(0)==="/")}return(l?"/":"")+(o=i(g(o.split("/"),function(R){return!!R}),!l).join("/"))||"."},t.normalize=function(o){var l=t.isAbsolute(o),u=s(o,-1)==="/";return(o=i(g(o.split("/"),function(m){return!!m}),!l).join("/"))||l||(o="."),o&&u&&(o+="/"),(l?"/":"")+o},t.isAbsolute=function(o){return o.charAt(0)==="/"},t.join=function(){var o=Array.prototype.slice.call(arguments,0);return t.normalize(g(o,function(l,u){if(typeof l!="string")throw new TypeError("Arguments to path.join must be strings");return l}).join("/"))},t.relative=function(o,l){function u(E){for(var P=0;P<E.length&&E[P]==="";P++);for(var F=E.length-1;F>=0&&E[F]==="";F--);return P>F?[]:E.slice(P,F-P+1)}o=t.resolve(o).substr(1),l=t.resolve(l).substr(1);for(var m=u(o.split("/")),R=u(l.split("/")),y=Math.min(m.length,R.length),S=y,c=0;c<y;c++)if(m[c]!==R[c]){S=c;break}var w=[];for(c=S;c<m.length;c++)w.push("..");return(w=w.concat(R.slice(S))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(o){if(typeof o!="string"&&(o+=""),o.length===0)return".";for(var l=o.charCodeAt(0),u=l===47,m=-1,R=!0,y=o.length-1;y>=1;--y)if((l=o.charCodeAt(y))===47){if(!R){m=y;break}}else R=!1;return m===-1?u?"/":".":u&&m===1?"/":o.slice(0,m)},t.basename=function(o,l){var u=function(m){typeof m!="string"&&(m+="");var R,y=0,S=-1,c=!0;for(R=m.length-1;R>=0;--R)if(m.charCodeAt(R)===47){if(!c){y=R+1;break}}else S===-1&&(c=!1,S=R+1);return S===-1?"":m.slice(y,S)}(o);return l&&u.substr(-1*l.length)===l&&(u=u.substr(0,u.length-l.length)),u},t.extname=function(o){typeof o!="string"&&(o+="");for(var l=-1,u=0,m=-1,R=!0,y=0,S=o.length-1;S>=0;--S){var c=o.charCodeAt(S);if(c!==47)m===-1&&(R=!1,m=S+1),c===46?l===-1?l=S:y!==1&&(y=1):l!==-1&&(y=-1);else if(!R){u=S+1;break}}return l===-1||m===-1||y===0||y===1&&l===m-1&&l===u+1?"":o.slice(l,m)};var s="ab".substr(-1)==="b"?function(o,l,u){return o.substr(l,u)}:function(o,l,u){return l<0&&(l=o.length+l),o.substr(l,u)}}).call(this,r(2))},function(e,t){function r(n,i){var g=[],s=[];return i==null&&(i=function(o,l){return g[0]===l?"[Circular ~]":"[Circular ~."+s.slice(0,g.indexOf(l)).join(".")+"]"}),function(o,l){if(g.length>0){var u=g.indexOf(this);~u?g.splice(u+1):g.push(this),~u?s.splice(u,1/0,o):s.push(o),~g.indexOf(l)&&(l=i.call(this,o,l))}else g.push(l);return n==null?l:n.call(this,o,l)}}(e.exports=function(n,i,g,s){return JSON.stringify(n,r(i,s),g)}).getSerialize=r},function(e,t,r){r(227),e.exports={encode:n=>new TextEncoder().encode(n),decode:n=>new TextDecoder().decode(n)}},function(e,t,r){var n=t.format=r(9);t.levels=r(104),Object.defineProperty(n,"align",{value:r(121)}),Object.defineProperty(n,"cli",{value:r(122)}),Object.defineProperty(n,"combine",{value:r(123)}),Object.defineProperty(n,"colorize",{value:r(37)}),Object.defineProperty(n,"json",{value:r(124)}),Object.defineProperty(n,"label",{value:r(127)}),Object.defineProperty(n,"logstash",{value:r(128)}),Object.defineProperty(n,"metadata",{value:r(129)}),Object.defineProperty(n,"padLevels",{value:r(58)}),Object.defineProperty(n,"prettyPrint",{value:r(130)}),Object.defineProperty(n,"printf",{value:r(131)}),Object.defineProperty(n,"simple",{value:r(132)}),Object.defineProperty(n,"splat",{value:r(133)}),Object.defineProperty(n,"timestamp",{value:r(134)}),Object.defineProperty(n,"uncolorize",{value:r(136)})},function(e,t,r){var n=r(105);e.exports=n},function(e,t,r){function n(y){return function(S){if(Array.isArray(S))return i(S)}(y)||function(S){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(S))return Array.from(S)}(y)||function(S,c){if(!!S){if(typeof S=="string")return i(S,c);var w=Object.prototype.toString.call(S).slice(8,-1);if(w==="Object"&&S.constructor&&(w=S.constructor.name),w==="Map"||w==="Set")return Array.from(S);if(w==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(w))return i(S,c)}}(y)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
21
21
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function i(y,S){(S==null||S>y.length)&&(S=y.length);for(var c=0,w=new Array(S);c<S;c++)w[c]=y[c];return w}function g(y,S){if(!(y instanceof S))throw new TypeError("Cannot call a class as a function")}function s(y,S){for(var c=0;c<S.length;c++){var w=S[c];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(y,w.key,w)}}var o=r(3),l=o.configs,u=o.LEVEL,m=o.MESSAGE,R=function(){function y(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{levels:l.npm.levels};g(this,y),this.paddings=y.paddingForLevels(E.levels,E.filler),this.options=E}var S,c,w;return S=y,w=[{key:"getLongestLevel",value:function(E){var P=Object.keys(E).map(function(F){return F.length});return Math.max.apply(Math,n(P))}},{key:"paddingForLevel",value:function(E,P,F){var M=F+1-E.length,A=Math.floor(M/P.length);return"".concat(P).concat(P.repeat(A)).slice(0,M)}},{key:"paddingForLevels",value:function(E){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ",F=y.getLongestLevel(E);return Object.keys(E).reduce(function(M,A){return M[A]=y.paddingForLevel(A,P,F),M},{})}}],(c=[{key:"transform",value:function(E,P){return E.message="".concat(this.paddings[E[u]]).concat(E.message),E[m]&&(E[m]="".concat(this.paddings[E[u]]).concat(E[m])),E}}])&&s(S.prototype,c),w&&s(S,w),y}();e.exports=function(y){return new R(y)},e.exports.Padder=e.exports.Format=R},function(e,t,r){var n=r(10).format;t.warn={deprecated:function(i){return function(){throw new Error(n("{ %s } was removed in winston@3.0.0.",i))}},useFormat:function(i){return function(){throw new Error([n("{ %s } was removed in winston@3.0.0.",i),"Use a custom winston.format = winston.format(function) instead."].join(`
22
22
  `))}},forFunctions:function(i,g,s){s.forEach(function(o){i[o]=t.warn[g](o)})},moved:function(i,g,s){function o(){return function(){throw new Error([n("winston.%s was moved in winston@3.0.0.",s),n("Use a winston.%s instead.",g)].join(`
@@ -41,4 +41,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
41
41
  `))},s.prototype.close=function(){this.transport.close&&this.transport.close(),this.transport.__winstonError&&(this.transport.removeListener("error",this.transport.__winstonError),this.transport.__winstonError=null)}},function(e,t,r){function n(g){return(n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s})(g)}function i(g,s){for(var o=0;o<s.length;o++){var l=s[o];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(g,l.key,l)}}e.exports=function(){function g(l){if(function(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")}(this,g),!l)throw new Error("Logger is required for profiling.");this.logger=l,this.start=Date.now()}var s,o;return s=g,(o=[{key:"done",value:function(){for(var l=arguments.length,u=new Array(l),m=0;m<l;m++)u[m]=arguments[m];typeof u[u.length-1]=="function"&&(console.warn("Callback function no longer supported as of winston@3.0.0"),u.pop());var R=n(u[u.length-1])==="object"?u.pop():{};return R.level=R.level||"info",R.durationMs=Date.now()-this.start,this.logger.write(R)}}])&&i(s.prototype,o),g}()},function(e,t,r){(function(n){const i=r(208),{MESSAGE:g}=r(3),s=r(31);function o(l,u){return u instanceof n?u.toString("base64"):typeof u=="bigint"?u.toString():u}e.exports=i((l,u={})=>(l[g]=(u.stable?s.stableStringify:s)(l,u.replacer||o,u.space),l))}).call(this,r(4).Buffer)},function(e,t,r){class n extends Error{constructor(g){super(`Format functions must be synchronous taking a two arguments: (info, opts)
42
42
  Found: ${g.toString().split(`
43
43
  `)[0]}
44
- `),Error.captureStackTrace(this,n)}}e.exports=i=>{if(i.length>2)throw new n(i);function g(o={}){this.options=o}function s(o){return new g(o)}return g.prototype.transform=i,s.Format=g,s}},function(e,t,r){function n(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function")}function i(s,o){for(var l=0;l<o.length;l++){var u=o[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}var g=r(85);e.exports=function(){function s(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n(this,s),this.loggers=new Map,this.options=u}var o,l;return o=s,(l=[{key:"add",value:function(u,m){var R=this;if(!this.loggers.has(u)){var y=(m=Object.assign({},m||this.options)).transports||this.options.transports;m.transports=y?y.slice():[];var S=g(m);S.on("close",function(){return R._delete(u)}),this.loggers.set(u,S)}return this.loggers.get(u)}},{key:"get",value:function(u,m){return this.add(u,m)}},{key:"has",value:function(u){return!!this.loggers.has(u)}},{key:"close",value:function(u){var m=this;if(u)return this._removeLogger(u);this.loggers.forEach(function(R,y){return m._removeLogger(y)})}},{key:"_removeLogger",value:function(u){this.loggers.has(u)&&(this.loggers.get(u).close(),this._delete(u))}},{key:"_delete",value:function(u){this.loggers.delete(u)}}])&&i(o.prototype,l),s}()},function(e,t,r){(function(n){const i=r(49),g=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;e.exports=function(s,o,l){let u,m,R=!1,y=!1;function S(E,P){let F=`"${o}" ${P}`;throw E&&(F=`${F}, but is set to "${E}"`),m&&(F=`${F}. An example of a valid value would be: ${m}`),new i(F)}function c(E){return function(){let P=s[o];if(P===void 0)if(u===void 0&&y)S(void 0,"is a required variable, but it was not set");else{if(u===void 0)return;P=u}y&&P.trim().length===0&&S(void 0,"is a required variable, but its value was empty"),R&&(P.match(g)||S(P,"should be a valid base64 string if using convertFromBase64"),P=n.from(P,"base64").toString());const F=[P].concat(Array.prototype.slice.call(arguments));try{return E.apply(E,F)}catch(M){S(P,M.message)}}}const w={asArray:c(r(211)),asBoolStrict:c(r(212)),asBool:c(r(213)),asPortNumber:c(r(214)),asEnum:c(r(215)),asFloatNegative:c(r(216)),asFloatPositive:c(r(217)),asFloat:c(r(51)),asIntNegative:c(r(218)),asIntPositive:c(r(91)),asInt:c(r(50)),asJsonArray:c(r(219)),asJsonObject:c(r(220)),asJson:c(r(52)),asString:c(r(35)),asUrlObject:c(r(92)),asUrlString:c(r(221)),convertFromBase64:function(){return R=!0,w},default:function(E){if(typeof E=="number")u=E.toString();else if(Array.isArray(E)||typeof E=="object"&&E!==null)u=JSON.stringify(E);else{if(typeof E!="string")throw new i("values passed to default() must be of Number, String, Array, or Object type");u=E}return w},required:function(E){return y=E===void 0||E,w},example:function(E){return m=E,w}};return Object.entries(l).forEach(([E,P])=>{w[E]=c(P)}),w}}).call(this,r(4).Buffer)},function(e,t,r){const n=r(35);e.exports=function(i,g){return g=g||",",i.length?n(i).split(g).filter(Boolean):[]}},function(e,t,r){e.exports=function(n){const i=n.toLowerCase();if(i!=="false"&&i!=="true")throw new Error('should be either "true", "false", "TRUE", or "FALSE"');return i!=="false"}},function(e,t,r){e.exports=function(n){const i=n.toLowerCase();if(["false","0","true","1"].indexOf(i)===-1)throw new Error('should be either "true", "false", "TRUE", "FALSE", 1, or 0');return!(i==="0"||i==="false")}},function(e,t,r){const n=r(91);e.exports=function(i){var g=n(i);if(g>65535)throw new Error("cannot assign a port number greater than 65535");return g}},function(e,t,r){const n=r(35);e.exports=function(i,g){const s=n(i);if(g.indexOf(s)<0)throw new Error(`should be one of [${g.join(", ")}]`);return s}},function(e,t,r){const n=r(51);e.exports=function(i){const g=n(i);if(g>0)throw new Error("should be a negative float");return g}},function(e,t,r){const n=r(51);e.exports=function(i){const g=n(i);if(g<0)throw new Error("should be a positive float");return g}},function(e,t,r){const n=r(50);e.exports=function(i){const g=n(i);if(g>0)throw new Error("should be a negative integer");return g}},function(e,t,r){const n=r(52);e.exports=function(i){var g=n(i);if(!Array.isArray(g))throw new Error("should be a parseable JSON Array");return g}},function(e,t,r){const n=r(52);e.exports=function(i){var g=n(i);if(Array.isArray(g))throw new Error("should be a parseable JSON Object");return g}},function(e,t,r){const n=r(92);e.exports=function(i){return n(i).toString()}},function(e,t,r){function n(o){var l=this;if(l instanceof n||(l=new n),l.tail=null,l.head=null,l.length=0,o&&typeof o.forEach=="function")o.forEach(function(R){l.push(R)});else if(arguments.length>0)for(var u=0,m=arguments.length;u<m;u++)l.push(arguments[u]);return l}function i(o,l){o.tail=new s(l,o.tail,null,o),o.head||(o.head=o.tail),o.length++}function g(o,l){o.head=new s(l,null,o.head,o),o.tail||(o.tail=o.head),o.length++}function s(o,l,u,m){if(!(this instanceof s))return new s(o,l,u,m);this.list=m,this.value=o,l?(l.next=this,this.prev=l):this.prev=null,u?(u.prev=this,this.next=u):this.next=null}e.exports=n,n.Node=s,n.create=n,n.prototype.removeNode=function(o){if(o.list!==this)throw new Error("removing node which does not belong to this list");var l=o.next,u=o.prev;l&&(l.prev=u),u&&(u.next=l),o===this.head&&(this.head=l),o===this.tail&&(this.tail=u),o.list.length--,o.next=null,o.prev=null,o.list=null},n.prototype.unshiftNode=function(o){if(o!==this.head){o.list&&o.list.removeNode(o);var l=this.head;o.list=this,o.next=l,l&&(l.prev=o),this.head=o,this.tail||(this.tail=o),this.length++}},n.prototype.pushNode=function(o){if(o!==this.tail){o.list&&o.list.removeNode(o);var l=this.tail;o.list=this,o.prev=l,l&&(l.next=o),this.tail=o,this.head||(this.head=o),this.length++}},n.prototype.push=function(){for(var o=0,l=arguments.length;o<l;o++)i(this,arguments[o]);return this.length},n.prototype.unshift=function(){for(var o=0,l=arguments.length;o<l;o++)g(this,arguments[o]);return this.length},n.prototype.pop=function(){if(this.tail){var o=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,o}},n.prototype.shift=function(){if(this.head){var o=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,o}},n.prototype.forEach=function(o,l){l=l||this;for(var u=this.head,m=0;u!==null;m++)o.call(l,u.value,m,this),u=u.next},n.prototype.forEachReverse=function(o,l){l=l||this;for(var u=this.tail,m=this.length-1;u!==null;m--)o.call(l,u.value,m,this),u=u.prev},n.prototype.get=function(o){for(var l=0,u=this.head;u!==null&&l<o;l++)u=u.next;if(l===o&&u!==null)return u.value},n.prototype.getReverse=function(o){for(var l=0,u=this.tail;u!==null&&l<o;l++)u=u.prev;if(l===o&&u!==null)return u.value},n.prototype.map=function(o,l){l=l||this;for(var u=new n,m=this.head;m!==null;)u.push(o.call(l,m.value,this)),m=m.next;return u},n.prototype.mapReverse=function(o,l){l=l||this;for(var u=new n,m=this.tail;m!==null;)u.push(o.call(l,m.value,this)),m=m.prev;return u},n.prototype.reduce=function(o,l){var u,m=this.head;if(arguments.length>1)u=l;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");m=this.head.next,u=this.head.value}for(var R=0;m!==null;R++)u=o(u,m.value,R),m=m.next;return u},n.prototype.reduceReverse=function(o,l){var u,m=this.tail;if(arguments.length>1)u=l;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");m=this.tail.prev,u=this.tail.value}for(var R=this.length-1;m!==null;R--)u=o(u,m.value,R),m=m.prev;return u},n.prototype.toArray=function(){for(var o=new Array(this.length),l=0,u=this.head;u!==null;l++)o[l]=u.value,u=u.next;return o},n.prototype.toArrayReverse=function(){for(var o=new Array(this.length),l=0,u=this.tail;u!==null;l++)o[l]=u.value,u=u.prev;return o},n.prototype.slice=function(o,l){(l=l||this.length)<0&&(l+=this.length),(o=o||0)<0&&(o+=this.length);var u=new n;if(l<o||l<0)return u;o<0&&(o=0),l>this.length&&(l=this.length);for(var m=0,R=this.head;R!==null&&m<o;m++)R=R.next;for(;R!==null&&m<l;m++,R=R.next)u.push(R.value);return u},n.prototype.sliceReverse=function(o,l){(l=l||this.length)<0&&(l+=this.length),(o=o||0)<0&&(o+=this.length);var u=new n;if(l<o||l<0)return u;o<0&&(o=0),l>this.length&&(l=this.length);for(var m=this.length,R=this.tail;R!==null&&m>l;m--)R=R.prev;for(;R!==null&&m>o;m--,R=R.prev)u.push(R.value);return u},n.prototype.reverse=function(){for(var o=this.head,l=this.tail,u=o;u!==null;u=u.prev){var m=u.prev;u.prev=u.next,u.next=m}return this.head=l,this.tail=o,this};try{r(223)(n)}catch{}},function(e,t,r){e.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let i=this.head;i;i=i.next)yield i.value}}},function(e,t,r){(function(n){(function(){var i,g,s,o,l,u;typeof performance!="undefined"&&performance!==null&&performance.now?e.exports=function(){return performance.now()}:n!=null&&n.hrtime?(e.exports=function(){return(i()-l)/1e6},g=n.hrtime,o=(i=function(){var m;return 1e9*(m=g())[0]+m[1]})(),u=1e9*n.uptime(),l=o-u):Date.now?(e.exports=function(){return Date.now()-s},s=Date.now()):(e.exports=function(){return new Date().getTime()-s},s=new Date().getTime())}).call(this)}).call(this,r(2))},function(e,t,r){var n,i,g=r(96),s=r(97),o=0,l=0;e.exports=function(u,m,R){var y=m&&R||0,S=m||[],c=(u=u||{}).node||n,w=u.clockseq!==void 0?u.clockseq:i;if(c==null||w==null){var E=g();c==null&&(c=n=[1|E[0],E[1],E[2],E[3],E[4],E[5]]),w==null&&(w=i=16383&(E[6]<<8|E[7]))}var P=u.msecs!==void 0?u.msecs:new Date().getTime(),F=u.nsecs!==void 0?u.nsecs:l+1,M=P-o+(F-l)/1e4;if(M<0&&u.clockseq===void 0&&(w=w+1&16383),(M<0||P>o)&&u.nsecs===void 0&&(F=0),F>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");o=P,l=F,i=w;var A=(1e4*(268435455&(P+=122192928e5))+F)%4294967296;S[y++]=A>>>24&255,S[y++]=A>>>16&255,S[y++]=A>>>8&255,S[y++]=255&A;var p=P/4294967296*1e4&268435455;S[y++]=p>>>8&255,S[y++]=255&p,S[y++]=p>>>24&15|16,S[y++]=p>>>16&255,S[y++]=w>>>8|128,S[y++]=255&w;for(var N=0;N<6;++N)S[y+N]=c[N];return m||s(S)}},function(e,t,r){var n=r(96),i=r(97);e.exports=function(g,s,o){var l=s&&o||0;typeof g=="string"&&(s=g==="binary"?new Array(16):null,g=null);var u=(g=g||{}).random||(g.rng||n)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,s)for(var m=0;m<16;++m)s[l+m]=u[m];return s||i(u)}},function(e,t,r){(function(n){(function(i){function g(o){if((o=o===void 0?"utf-8":o)!=="utf-8")throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+o+"') is invalid.")}function s(o,l){if(l=l===void 0?{fatal:!1}:l,(o=o===void 0?"utf-8":o)!=="utf-8")throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+o+"') is invalid.");if(l.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}if(i.TextEncoder&&i.TextDecoder)return!1;Object.defineProperty(g.prototype,"encoding",{value:"utf-8"}),g.prototype.encode=function(o,l){if((l=l===void 0?{stream:!1}:l).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");l=0;for(var u=o.length,m=0,R=Math.max(32,u+(u>>1)+7),y=new Uint8Array(R>>3<<3);l<u;){var S=o.charCodeAt(l++);if(55296<=S&&56319>=S){if(l<u){var c=o.charCodeAt(l);(64512&c)==56320&&(++l,S=((1023&S)<<10)+(1023&c)+65536)}if(55296<=S&&56319>=S)continue}if(m+4>y.length&&(R+=8,R=(R*=1+l/o.length*2)>>3<<3,(c=new Uint8Array(R)).set(y),y=c),(4294967168&S)==0)y[m++]=S;else{if((4294965248&S)==0)y[m++]=S>>6&31|192;else if((4294901760&S)==0)y[m++]=S>>12&15|224,y[m++]=S>>6&63|128;else{if((4292870144&S)!=0)continue;y[m++]=S>>18&7|240,y[m++]=S>>12&63|128,y[m++]=S>>6&63|128}y[m++]=63&S|128}}return y.slice(0,m)},Object.defineProperty(s.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(s.prototype,"fatal",{value:!1}),Object.defineProperty(s.prototype,"ignoreBOM",{value:!1}),s.prototype.decode=function(o,l){if((l=l===void 0?{stream:!1}:l).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");l=0;for(var u=(o=new Uint8Array(o)).length,m=[];l<u;){var R=o[l++];if(R===0)break;if((128&R)==0)m.push(R);else if((224&R)==192){var y=63&o[l++];m.push((31&R)<<6|y)}else if((240&R)==224){y=63&o[l++];var S=63&o[l++];m.push((31&R)<<12|y<<6|S)}else(248&R)==240&&(65535<(R=(7&R)<<18|(y=63&o[l++])<<12|(S=63&o[l++])<<6|63&o[l++])&&(R-=65536,m.push(R>>>10&1023|55296),R=56320|1023&R),m.push(R))}return String.fromCharCode.apply(null,m)},i.TextEncoder=g,i.TextDecoder=s})(typeof window!="undefined"?window:n!==void 0?n:this)}).call(this,r(5))},function(e,t,r){r.r(t),r.d(t,"AuthClient",function(){return g}),r.d(t,"RtcSignalingClient",function(){return o}),r.d(t,"Credentials",function(){return w}),r.d(t,"SignalingPromiseClient",function(){return E.SignalingPromiseClient}),r.d(t,"IRtcClientConfiguration",function(){}),r.d(t,"IRtcConnectConfiguration",function(){}),r.d(t,"IRtcConnectionStatsInfo",function(){}),r.d(t,"IRtcSendConfiguration",function(){}),r.d(t,"IRtcSessionMetricsMessageCounts",function(){}),r.d(t,"IRtcStreamMessage",function(){}),r.d(t,"IStreamControl",function(){}),r.d(t,"RtcClient",function(){return se});var n=r(26),i=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class g extends n.a{adminSignup(z,Z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/admin-signup",{token:Z,method:"POST",body:JSON.stringify(z)})})}login(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/login",{method:"POST",body:JSON.stringify(z),allowUnsafeRetries:!0})})}loginWithGoogleToken(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/login-google",{method:"POST",body:JSON.stringify(z),allowUnsafeRetries:!0})})}refresh(z,Z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/refresh",{method:"POST",body:JSON.stringify({refreshToken:z,tokenExpirationSeconds:Z}),allowUnsafeRetries:!0})})}respondToNewPasswordRequiredChallenge(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/respond-to-new-password-required-challenge",{method:"POST",body:JSON.stringify(z)})})}forgotPassword(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/forgot-password",{method:"POST",body:JSON.stringify({email:z})})})}confirmForgotPassword(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/confirm-forgot-password",{method:"POST",body:JSON.stringify(z)})})}resendInvitation(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/resend-invitation",{method:"POST",body:JSON.stringify({email:z})})})}changePassword({token:z,refreshToken:Z,currentPassword:te,newPassword:ge}){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/change-password",{token:z,method:"POST",body:JSON.stringify({refreshToken:Z,currentPassword:te,newPassword:ge})})})}getDeviceCredentials(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/device-credentials",{token:z,method:"POST",allowUnsafeRetries:!0})})}impersonate(z,Z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/impersonate",{token:z,method:"POST",allowUnsafeRetries:!0,body:JSON.stringify({userId:Z})})})}createServiceAccount(z,Z,te){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/service-account",{token:z,method:"POST",allowUnsafeRetries:!0,body:JSON.stringify({name:Z,roleId:te})})})}getFeatures(z){return i(this,void 0,void 0,function*(){return(yield this.fetch("auth/features",{token:z})).features})}}var s=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class o extends n.a{createPeer(z,Z){return s(this,void 0,void 0,function*(){return yield this.fetch("peers",{token:z,method:"POST",body:JSON.stringify(Z)})})}getPeers(z){return s(this,void 0,void 0,function*(){return(yield this.fetch("peers",{token:z})).items})}refreshPeer(z,Z){return s(this,void 0,void 0,function*(){yield this.fetch(`peers/${Z}/refresh`,{token:z,method:"POST",allowUnsafeRetries:!0})})}createSession(z,Z){return s(this,void 0,void 0,function*(){return yield this.fetch("sessions",{token:z,method:"POST",body:JSON.stringify(Z)})})}refreshSession(z,Z){return s(this,void 0,void 0,function*(){yield this.fetch(`sessions/${Z}/refresh`,{token:z,method:"POST",allowUnsafeRetries:!0})})}deleteSession(z,Z){return s(this,void 0,void 0,function*(){yield this.fetch(`sessions/${Z}`,{token:z,method:"DELETE",allowUnsafeRetries:!0})})}getSessions(z){return s(this,void 0,void 0,function*(){return(yield this.fetch("sessions",{token:z})).items})}getIceServers(z){return s(this,void 0,void 0,function*(){return(yield this.fetch("ice-servers",{token:z})).items})}addSignals(z,Z,te){return s(this,void 0,void 0,function*(){yield this.fetch(`sessions/${Z}/add-signals`,{token:z,method:"POST",body:JSON.stringify(te)})})}takeSignals(z,Z){return s(this,void 0,void 0,function*(){return(yield this.fetch(`sessions/${Z}/take-signals`,{token:z,method:"POST"})).items})}}var l=r(1),u=r(11),m=r(21),R=r(102),y=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class S extends class{constructor(z={}){this.cache=new R(z),this.stringify=z.fastStringify?JSON.stringify:m}set(z,Z,te){if(!this.cache.set(this.stringify(z),Z,te))throw Error(`Value too large (${this.cache.lengthCalculator(Z)} > ${this.cache.max})`)}get(z){return this.cache.get(this.stringify(z))}del(z){this.cache.del(this.stringify(z))}length(){return this.cache.length}reset(){this.cache.reset()}prune(){return this.cache.prune()}forEach(z){return this.cache.forEach(z)}}{constructor(z={}){if(super(z),this.expireRejectedPromiseValues=z.expireRejectedPromiseValues===void 0||z.expireRejectedPromiseValues,this.rejectedPromiseValueTtl=z.rejectedPromiseValueTtl!==void 0?z.rejectedPromiseValueTtl:l.a.second,this.rejectedPromiseValueTtl<0)throw new Error("rejectedPromiseValueTtl must not be negative")}set(z,Z,te){const ge=this.stringify(z);this.cache.set(ge,Z,te),this.expireRejectedPromiseValues&&Promise.resolve(Z).catch(()=>y(this,void 0,void 0,function*(){yield Object(u.a)(this.rejectedPromiseValueTtl),this.cache.peek(ge)===Z&&this.cache.del(ge)}))}}var c=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class w{constructor(z,Z,te){this.authClient=z,this.email=Z,this.password=te,this.tokenTtlMs=1*l.a.hour,this.tokenCache=new S({max:100,maxAge:this.tokenTtlMs-5*l.a.minute,fastStringify:!0})}getToken(){return c(this,void 0,void 0,function*(){let z=this.tokenCache.get(this.email);return z||(z=(()=>c(this,void 0,void 0,function*(){const{authentication:Z}=yield this.authClient.login({email:this.email,password:this.password,tokenExpirationSeconds:this.tokenTtlMs/l.a.second});if(!Z)throw new Error("User account not verified.");return Z.accessToken}))(),this.tokenCache.set(this.email,z)),z})}}var E=r(93),P=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};function F(oe){return P(this,void 0,void 0,function*(){return(yield Promise.all(oe.map(z=>z.catch(Z=>Z)))).filter(z=>z instanceof Error)})}function M(oe){if(oe!==void 0)return oe;throw new Error("Value is undefined")}var A=r(0),p=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};function N({func:oe,delay:z,immediate:Z}){let te=!1,ge=setTimeout(function he(){return p(this,void 0,void 0,function*(){if(te)return;const de=new Date().getTime();try{ie=oe(),yield ie}finally{if(!te){const me=new Date().getTime();ge=setTimeout(he,Math.max(z-(me-de),0))}}})},Z?0:z),ie=Promise.resolve();return{stop(){return p(this,void 0,void 0,function*(){te=!0,clearTimeout(ge),yield ie})}}}function $(oe,z){return Object.keys(oe).reduce((Z,te)=>Object.assign(Object.assign({},Z),{[te]:z(oe[te])}),{})}var q=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class h{constructor(z){this.message=z}send(z){return q(this,void 0,void 0,function*(){A.a.info(this.message,$(z,Z=>{const{sum:te,count:ge}=Z,ie=te/ge;return Object.assign(Object.assign({},Z),{average:ie})}))})}}var d=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};const O=r(224),_=!!r(7).c,x=new class{constructor(oe=60){this.buffer={},this.metrics={},this.reporters=[],this.flushInterval=N({func:()=>this.flushStats(),delay:oe*l.a.second})}shutdown(){return d(this,void 0,void 0,function*(){yield this.flushInterval.stop(),yield this.flushStats(),yield Object(u.a)(2*l.a.second)})}aggregate(oe,z){if(this.buffer[oe]){const{min:Z,max:te,sum:ge,count:ie}=this.buffer[oe];this.buffer[oe]={min:Math.min(Z,z),max:Math.max(te,z),sum:ge+z,count:ie+1}}else this.buffer[oe]={min:z,max:z,sum:z,count:1}}increment(oe){this.aggregate(oe,1)}timer(oe,z){return d(this,void 0,void 0,function*(){const Z=O(),te=yield z(),ge=O();return this.aggregate(oe,ge-Z),te})}metric(oe,z){this.metrics[oe]=z}registerStatsReporter(oe){this.reporters.push(oe)}write(oe){return d(this,void 0,void 0,function*(){if(Object.values(oe).length===0)return;const z=yield F(this.reporters.map(Z=>Z.send(oe)));for(const Z of z)A.a.warn("Failed to write stats",{error:Z})})}flushStats(){return d(this,void 0,void 0,function*(){const oe=Object.assign(Object.assign({},this.buffer),$(this.metrics,z=>{const Z=z();return{min:Z,max:Z,sum:Z,count:1}}));Object.keys(oe).length>0&&(yield this.write(oe),this.buffer={})})}};_||x.registerStatsReporter(new h("stats"));var D=r(8),L=r(22),T=r(103),C=r(36),U=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class b extends C.a{constructor(z){super(z)}postLanRtcOffer(z){return U(this,void 0,void 0,function*(){return yield this.fetch("v1/lan-rtc-offer",{method:"POST",body:JSON.stringify(z)})})}}var f=r(55);const B={ordered:!1,maxPacketLifeTime:300*l.a.millisecond},k={ordered:!0},Y={ordered:!0},K={ordered:!1,maxRetransmits:0},Q={ordered:!1,maxRetransmits:0};function G({entityId:oe,streamName:z,streamType:Z}){return`${oe}.${z}.${Z}`}var V=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class v{constructor(z,Z){this.sessionId=z,this.connection=Z,this.counts={localSent:new Map,localReceived:new Map,remoteSent:new Map,remoteReceived:new Map},this.sessionId=z,this.connection=Z}updateRemoteMessagesCounts(z){if(z.payload.streamsInfo){this.counts.remoteSent=new Map,this.counts.remoteReceived=new Map;for(const Z of z.payload.streamsInfo.items)this.counts.remoteSent.set(Z.streamId,Z.sentCount),this.counts.remoteReceived.set(Z.streamId,Z.receivedCount)}}getLocalStreamsInfo(z){const{localSent:Z,localReceived:te}=this.counts;return{items:[...new Set([...Z.keys(),...te.keys()])].map(ge=>{var ie,he;return{streamId:ge,sentCount:(ie=Z.get(ge))!==null&&ie!==void 0?ie:0,receivedCount:(he=te.get(ge))!==null&&he!==void 0?he:0}}),timestamp:z}}incrementLocalSent(z){const{localSent:Z}=this.counts,te=G(z.header.stream);Z.set(te,(Z.get(te)||0)+1)}incrementLocalReceived(z){const{localReceived:Z}=this.counts,te=G(z.header.stream),ge=Z.get(te)||0;if(ge===0){const{streamName:ie,streamType:he}=z.header.stream;A.a.debug("RTC client received first message for stream",{streamName:ie,streamType:he})}Z.set(te,ge+1)}uploadMetrics(){return V(this,void 0,void 0,function*(){const{sessionId:z}=this,Z=yield this.connection.peerConnection.getStats(),te={};Z.forEach(fe=>te[fe.id]=fe),A.a.debug("rtc-stats",Object.assign(Object.assign({},te),{sessionId:z}));const{localSent:ge,localReceived:ie,remoteSent:he,remoteReceived:de}=this.counts,me=[...new Set([...ge.keys(),...ie.keys()])].reduce((fe,ue)=>{const _e=ge.get(ue),Se=ie.get(ue),Oe=he.get(ue),Pe=de.get(ue);return Object.assign(Object.assign({},fe),{[`local-${ue}-sent`]:_e,[`local-${ue}-received`]:Se,[`remote-${ue}-sent`]:Oe,[`remote-${ue}-received`]:Pe})},{sessionId:z});A.a.debug("rtc-message-report",Object.assign({deviceId:this.connection.getRemoteDeviceId()},me))})}}function j(oe){return new Set(["disconnected","failed","closed"]).has(oe.iceConnectionState)}var W=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class ee{constructor(z,Z,te){this.peerConnection=z,this.config=Z,this.dataChannelNotifier=te,this.connectTimeoutMs=20*l.a.second,this.iceGatheringTimeoutMs=15*l.a.second,this.pingUpdateTimeoutMs=1*l.a.second,this.streamsInfoUpdateTimeoutMs=2*l.a.second,this.reassemblyTimeoutMs=500*l.a.millisecond,this.reassemblyTableCleanupMs=1*l.a.second,this.heartbeatTimeoutMs=20*l.a.millisecond,this.streamLatestTimestamp=new Map,this.reassemblyTable=new Map,this.reassemblyTableLastTimestamp=new Map,this.closeCalled=!1,this.gotOffer=!1,this.hasIceCandidate=!1;const{isOffer:ge}=Z.baseConfig;ge?this.initializeChannels(z):z.ondatachannel=ie=>{switch(ie.channel.label){case"stream.latest-ttl":this.latestTtlStreamChannel=ie.channel;break;case"stream.reliable":this.reliableStreamChannel=ie.channel;break;case"stream.latest-reliable":this.latestReliableStreamChannel=ie.channel;break;case"stream.latest-try-once":this.latestTryOnceStreamChannel=ie.channel;break;case"heartbeat":return void(this.heartbeatChannel=ie.channel);default:return void this.dataChannelNotifier(ie.channel)}this.setupChannel(ie.channel)},this.pingUpdateTimeout=setInterval(()=>{const{reliableStreamChannel:ie}=this;ie&&this.sendSystemMessage(ie,{type:"ping"})},this.pingUpdateTimeoutMs),this.streamsInfoUpdateTimeout=setInterval(()=>{const{latestTtlStreamChannel:ie}=this;ie&&this.sendSystemMessage(ie,{type:"streams-info"})},this.streamsInfoUpdateTimeoutMs),this.reassemblyTableCleanupTimeout=setInterval(()=>{const ie=new Date().getTime();this.reassemblyTableLastTimestamp.forEach((he,de,me)=>{ie>de+this.reassemblyTimeoutMs&&this.reassemblyTable.delete(he)})},this.reassemblyTableCleanupMs),this.heartbeatTimeout=setInterval(()=>{const{heartbeatChannel:ie}=this;ie&&ie.readyState==="open"&&ie.send(new Uint8Array([1]))},this.heartbeatTimeoutMs)}handleSignal(z){return W(this,void 0,void 0,function*(){const{peerConnection:Z}=this,{track:te}=this.config.baseConfig,ge=(()=>{try{return JSON.parse(z.getPayload())}catch{return}})();if(!ge)return void A.a.error("Received unparseable signal.");A.a.debug("Handling signal",{description:ge});const{sdp:ie,type:he}=ge;if(!ie||!he)return void A.a.warn("Received non-SDP signal");const{signalingState:de,connectionState:me}=Z;if(de!=="stable"||me!=="connected")if(Z.remoteDescription)A.a.warn(`Received SDP after remote description was set: ${ie}`);else{if(he==="offer"){if(de!=="stable")return void A.a.warn("Received offer SDP when signaling is ongoing.");yield Z.setRemoteDescription(ge);const fe=yield Z.createAnswer();yield Z.setLocalDescription(fe);const ue=z.clone();return te==null||te("Answer Received",ue),ue.setPayload(JSON.stringify(fe)),ue.setReceiverId(z.getSenderId()),ue.setSenderId(z.getReceiverId()),ue}if(he==="answer"){if(de==="stable")return void A.a.warn("Received answer SDP when signaling hasn't started.");yield Z.setRemoteDescription(ge)}}else A.a.warn(`Received SDP when already connected: ${ie}`)})}send(z,Z){const te=this.getChannelFromLabel(Z.channelLabel);te?this.sendOnChannel(te,z):A.a.warn("Send called with unexpected channel label",{channelLabel:Z.channelLabel})}controlRemoteStream(z){this.sendSystemMessage(M(this.reliableStreamChannel),{type:"stream-control",streamControl:z})}isActive(){return new Set(["new","checking","connected","completed"]).has(this.peerConnection.iceConnectionState)||this.isReady()}isReady(){const{reliableStreamChannel:z,latestTtlStreamChannel:Z,latestTryOnceStreamChannel:te,latestReliableStreamChannel:ge}=this;return(z==null?void 0:z.readyState)==="open"&&(Z==null?void 0:Z.readyState)==="open"&&(te==null?void 0:te.readyState)==="open"&&(ge==null?void 0:ge.readyState)==="open"}close(){return W(this,void 0,void 0,function*(){if(this.closeCalled)return;this.closeCalled=!0,this.sessionMetrics&&(yield this.sessionMetrics.uploadMetrics()),this.pingUpdateTimeout&&clearInterval(this.pingUpdateTimeout),this.reassemblyTableCleanupTimeout&&clearInterval(this.reassemblyTableCleanupTimeout),this.streamsInfoUpdateTimeout&&clearInterval(this.streamsInfoUpdateTimeout),this.heartbeatTimeout&&clearInterval(this.heartbeatTimeout);const{peerConnection:z,reliableStreamChannel:Z,latestTtlStreamChannel:te,latestTryOnceStreamChannel:ge,latestReliableStreamChannel:ie}=this;z.close(),Z==null||Z.close(),te==null||te.close(),ge==null||ge.close(),ie==null||ie.close()})}getPing(){return this.pingTimeMs}getLastMessageTimestamp(){return this.lastMessageTimestamp}getSessionCreatedTimestamp(){var z;return(z=this.config.remoteConfig)===null||z===void 0?void 0:z.sessionCreatedTimestamp}setSessionCreatedTimestamp(z){this.config.remoteConfig&&(this.config.remoteConfig.sessionCreatedTimestamp=z)}getSessionId(){var z;return(z=this.config.remoteConfig)===null||z===void 0?void 0:z.sessionId}setSessionId(z){this.config.remoteConfig&&(this.config.remoteConfig.sessionId=z,this.sessionMetrics=new v(z,this))}getRemotePeerId(){return this.config.baseConfig.remotePeerId}getRemoteDeviceId(){var z;return(z=this.config.baseConfig)===null||z===void 0?void 0:z.remoteDeviceId}setRemoteDeviceId(z){this.config.baseConfig.remoteDeviceId=z}getSessionMetricsMessageCounts(){var z;return(z=this.sessionMetrics)===null||z===void 0?void 0:z.counts}getConnectionStatsInfo(){return W(this,void 0,void 0,function*(){const{peerConnection:z}=this;if(!z)return;const Z=yield z.getStats(null),te=[];Z.forEach(me=>{te.push(me)});const ge=te.find(me=>me.type==="transport");if(!ge)return;const ie=te.find(me=>(me.type==="candidate-pair"||me.type==="candidatepair")&&me.id===ge.selectedCandidatePairId);if(!ie)return;const he=te.find(me=>me.id===ie.localCandidateId),de=te.find(me=>me.id===ie.remoteCandidateId);return he&&de&&(he.address=he.address||he.ip,de.address=de.address||de.ip,he.address!==void 0&&de.address!==void 0)?{transport:ge,localCandidate:he,remoteCandidate:de}:void 0})}initializeChannels(z){this.heartbeatChannel=z.createDataChannel("heartbeat",Q),this.heartbeatChannel.binaryType="arraybuffer",this.latestTtlStreamChannel=z.createDataChannel("stream.latest-ttl",B),this.latestTtlStreamChannel.binaryType="arraybuffer",this.reliableStreamChannel=z.createDataChannel("stream.reliable",k),this.reliableStreamChannel.binaryType="arraybuffer",this.latestReliableStreamChannel=z.createDataChannel("stream.latest-reliable",Y),this.latestReliableStreamChannel.binaryType="arraybuffer",this.latestTryOnceStreamChannel=z.createDataChannel("stream.latest-try-once",K),this.latestTryOnceStreamChannel.binaryType="arraybuffer",this.setupChannel(this.latestTtlStreamChannel),this.setupChannel(this.reliableStreamChannel),this.setupChannel(this.latestReliableStreamChannel),this.setupChannel(this.latestTryOnceStreamChannel)}getOffer(){var z,Z,te;return W(this,void 0,void 0,function*(){const{gotOffer:ge}=this,{peerConnection:ie,config:he}=this;if(this.config.baseConfig.isLan)throw new Error('"getOffer" method can only be called with internet connections. LAN connections should call the "getLanOffer" method.');const de=(z=this.config.remoteConfig)===null||z===void 0?void 0:z.sessionId;if(ge)return void A.a.debug("Failed to generate offer because gotOffer was already called.");if(this.gotOffer=!0,j(this.peerConnection))return void A.a.debug("Failed to generate offer because the peer connection was inactive.");const me=he.baseConfig.track;ie.onicecandidate=()=>{this.hasIceCandidate=!0},ie.oniceconnectionstatechange=()=>W(this,void 0,void 0,function*(){const Oe=ie.iceConnectionState;if(Oe==="connected"||Oe==="completed"){const Pe=yield this.getConnectionStatsInfo(),Fe=Pe?function(De){const Le=De.localCandidate.candidateType,xe=De.remoteCandidate.candidateType;return Le==="host"&&xe==="host"?"local":Le==="relay"||xe==="relay"?"TURN":"STUN"}(Pe):void 0;A.a.info(`ICE connection state changed to ${Oe}`,{sessionId:de,connectionStatsInfo:Pe,iceMode:Fe}),me==null||me("ICE connection state change",{iceConnectionState:Oe,sessionId:de,connectionStatsInfo:Pe,iceMode:Fe})}}),yield ie.setLocalDescription(yield ie.createOffer());const fe=new Date().getTime();for(;;){const Oe=new Date().getTime()-fe;if(Oe>this.connectTimeoutMs)return void A.a.debug("Failed to generate offer because ICE gathering timed out.");if(Oe>this.iceGatheringTimeoutMs&&this.hasIceCandidate){A.a.debug("ICE gathering partially completed; proceeding",{iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe}),me==null||me("ICE gathering partially completed",{sessionId:de,iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe});break}if(ie.iceGatheringState==="complete"){A.a.debug("ICE gathering complete",{iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe}),me==null||me("ICE gathering completed",{sessionId:de,iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe});break}yield Object(u.a)(.1*l.a.second)}const ue=(Z=this.peerConnection.getConfiguration().iceServers)!==null&&Z!==void 0?Z:[];for(const Oe of ue)Oe.credentialType=void 0;const _e=JSON.stringify(ue),Se=new D.Signal;return Se.setPayload(JSON.stringify(ie.localDescription)),Se.setSenderId(this.config.baseConfig.localPeerId),Se.setReceiverId(this.config.baseConfig.remotePeerId),Se.setIceServers(_e),Se.setIceTransportPolicy((te=this.peerConnection.getConfiguration().iceTransportPolicy)!==null&&te!==void 0?te:"all"),Se.setSessionType(D.SessionType.TELEOP),A.a.debug("Sending offer signal with description",{description:Se.getPayload()}),Se})}getLanOffer(){return W(this,void 0,void 0,function*(){const{peerConnection:z,gotOffer:Z}=this;if(!this.config.baseConfig.isLan)throw new Error('"getLanOffer" method can only be used with LAN connections. Internet connections should call the "getOffer" method.');if(Z)return void A.a.debug("Failed to generate offer because gotOffer was already called.");if(this.gotOffer=!0,j(this.peerConnection))return void A.a.debug("Failed to generate offer because the peer connection was inactive.");yield z.setLocalDescription(yield z.createOffer());const te=new Date().getTime();for(;;){if(new Date().getTime()-te>this.iceGatheringTimeoutMs)return void A.a.debug("Failed to generate offer because ICE gathering timed out.");if(z.iceGatheringState==="complete")break;yield Object(u.a)(.1*l.a.second)}const ge=z.localDescription;if(ge)return A.a.debug("Sending LAN offer signal with description",{description:ge}),ge;A.a.error("Failed to generate LAN offer description")})}handleLanAnswer(z){return W(this,void 0,void 0,function*(){const{peerConnection:Z}=this;if(!this.config.baseConfig.isLan)throw new Error('"handleLanAnswer" method can only be used with LAN connections. Internet connections should call the "handleSignal" method.');yield Z.setRemoteDescription(z)})}getChannelFromLabel(z){switch(z){case"stream.latest-ttl":return this.latestTtlStreamChannel;case"stream.reliable":return this.reliableStreamChannel;case"stream.latest-reliable":return this.latestReliableStreamChannel;case"stream.latest-try-once":return this.latestTryOnceStreamChannel}}sendOnChannel(z,Z){let te;try{te=Object(f.encode)(JSON.stringify(Z))}catch(ge){return void A.a.warn("Failed to encode RTC message",{error:ge})}try{z.send(te),this.sessionMetrics&&this.sessionMetrics.incrementLocalSent(Z)}catch(ge){A.a.warn("Failed to send message to channel",{error:ge,channel:z.label})}}channelNotRecognized(z){return z!==this.latestTtlStreamChannel&&z!==this.latestReliableStreamChannel&&z!==this.latestTryOnceStreamChannel&&z!==this.reliableStreamChannel}setupChannel(z){z.onmessage=Z=>{if(this.channelNotRecognized(z))return void A.a.warn("Received message on unrecognized data channel.");let te;try{te=JSON.parse(Object(f.decode)(Z.data))}catch(ge){return void A.a.warn("Received unparseable message on RTC stream data channel",{error:ge,channel:z.label})}te.communicationType==="message-chunk"?this.receiveChannelMessageChunk(z,te):this.receiveChannelMessage(z,te)},z.onerror=Z=>{A.a.warn(`Channel error: ${Z.error}`,{error:Z.error,sessionId:this.getSessionId(),channelLabel:z.label})},z.onopen=()=>{A.a.debug("Channel opened",{sessionId:this.getSessionId(),channelLabel:z.label})},z.onclose=()=>{const Z={bufferedAmount:z.bufferedAmount,sessionId:this.getSessionId(),channelLabel:z.label};this.closeCalled===!1?A.a.debug("Unexpected channel closed",Z):A.a.debug("Channel closed",Z)}}receiveChannelMessage(z,Z){const{config:te}=this,{remotePeerId:ge}=this.config.baseConfig;this.lastMessageTimestamp=new Date().getTime(),Z=function(ie){switch(ie.header.stream.streamType){case"twist":const{twist:he}=ie.payload;if(!he)throw Error("twist not in payload of RTC message with type twist");return{header:ie.header,payload:{twist:{linear:Object.assign({x:0,y:0,z:0},he.linear),angular:Object.assign({x:0,y:0,z:0},he.angular)}}};case"pose":const{pose:de}=ie.payload;if(!de)throw Error("pose not in payload of RTC message with type pose");return{header:ie.header,payload:{pose:{translation:Object.assign({x:0,y:0,z:0},de.translation),rotation:Object.assign({x:0,y:0,z:0,w:0},de.rotation)}}};case"pose-with-covariance":const{poseWithCovariance:me}=ie.payload;if(!me)throw Error("poseWithCovariance not in payload of RTC message with type pose-with-covariance");const fe=new Array(36).fill(0);return me.covariance.forEach((_e,Se)=>{if(Se>=36)throw Error("covariance contains more than 36 elements");fe[Se]=_e}),{header:ie.header,payload:{poseWithCovariance:{pose:{translation:Object.assign({x:0,y:0,z:0},me.pose.translation),rotation:Object.assign({x:0,y:0,z:0,w:0},me.pose.rotation)},covariance:fe}}};case"point":const{point:ue}=ie.payload;if(!ue)throw Error("point not in payload of RTC message with type point");return{header:ie.header,payload:{point:Object.assign({x:0,y:0,z:0},ue)}};default:return ie}}(Z),this.sessionMetrics&&this.sessionMetrics.incrementLocalReceived(Z),this.handleSystemMessage(z,Z)||(z===this.latestTryOnceStreamChannel||z===this.latestTtlStreamChannel||z===this.latestReliableStreamChannel)&&!this.isLatestMessage(Z)||te.baseConfig.receive(ge,Z)}receiveChannelMessageChunk(z,Z){const te=this.reassemblyTable.get(Z.id)||[];if(te.push(Z),te.length===Z.total){const ge=function(ie){const he=ie.sort((de,me)=>de.seq<me.seq?-1:1).map(de=>de.part).reduce((de,me)=>de+me);try{return JSON.parse(he)}catch{return void A.a.warn("Could not reassemble RTC message chunks")}}(te);return ge&&this.receiveChannelMessage(z,ge),void this.reassemblyTable.delete(Z.id)}this.reassemblyTable.set(Z.id,te),this.reassemblyTableLastTimestamp.set(Z.id,new Date().getTime())}handleSystemMessage(z,Z){var te,ge;const{config:ie}=this,{baseConfig:he}=ie,{remotePeerId:de}=he;switch(Z.header.stream.streamType){case"ping":return this.sendSystemMessage(z,{type:"pong",timestamp:M(Z.payload.ping)}),!0;case"pong":const me=new Date().getTime()-M(Z.payload.pong);return this.pingTimeMs=me,x.aggregate("rtc-ping-time",me),!0;case"streams-info":const{sessionMetrics:fe}=this,ue=(te=Z.payload.streamsInfo)===null||te===void 0?void 0:te.timestamp;return!!ue&&(fe==null||fe.updateRemoteMessagesCounts(Z),(ge=he.onStreamsInfoUpdate)===null||ge===void 0||ge.call(he,de,ue),!0);case"stream-control":return!0;default:return!1}}sendSystemMessage(z,Z){var te;const{localUserId:ge,localPeerId:ie}=this.config.baseConfig;if(z.readyState!=="open")return;const he={entityId:ge!=null?ge:ie,streamName:`$.${Z.type}`,streamType:Z.type};let de;switch(Z.type){case"ping":de={ping:new Date().getTime()};break;case"pong":de={pong:Z.timestamp};break;case"stream-control":de={streamControl:Z.streamControl};break;case"streams-info":de={streamsInfo:(te=this.sessionMetrics)===null||te===void 0?void 0:te.getLocalStreamsInfo(new Date().getTime())}}this.sendOnChannel(z,function(me,fe){return{header:{stream:me,created:Date.now(),frameId:""},payload:fe}}(he,de))}isLatestMessage(z){const Z=G(z.header.stream),te=(this.streamLatestTimestamp.get(Z)||0)<=z.header.created;return te&&this.streamLatestTimestamp.set(Z,z.header.created),te}}function J(oe){var z,Z;return{userId:(z=oe.getUserId())===null||z===void 0?void 0:z.getValue(),deviceId:(Z=oe.getDeviceId())===null||Z===void 0?void 0:Z.getValue(),organizationId:oe.getOrganizationId(),id:oe.getPeerId(),capabilities:[],capabilitySet:{}}}var re=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class se{constructor(z){this.config=z,this.grpcCallDeadline=5*l.a.second,this.refreshIntervalDelayMs=2*l.a.second,this.iceServersTtl=30*l.a.minute,this.connections=[],this.localConnections=[],this.isConnectionInitiator=new Map,this.isOutgoingConnection=new Map,this.peerDataChannelListeners=[];const{refreshIntervalDelayMs:Z}=this;this.refreshInterval=N({func:()=>re(this,void 0,void 0,function*(){try{yield this.update()}catch(te){A.a.warn("RTC refresh failed",{error:te})}}),delay:Z,immediate:!0})}send(z,Z,te){const ge=this.getActiveConnection(z);ge?ge.isReady()?ge.send(Z,te):A.a.warn("Send called with unready connection."):A.a.warn("Send called with no connection.")}controlRemoteStream(z,Z){const te=this.getActiveConnection(z);te?te.isReady()?te.controlRemoteStream(Z):A.a.warn("controlRemoteStream called with unready connection."):A.a.warn("controlRemoteStream called with no connection.")}getLocalPeer(){return re(this,void 0,void 0,function*(){for(;!this.localPeer;)yield Object(u.a)(.1*l.a.second);return J(this.localPeer)})}connect(z,Z){var te,ge,ie;return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode===!0)throw new Error("connect method called in local only mode.");const{track:he,signalingClient:de}=this.config,{localPeer:me,receiveSignalStream:fe,iceServers:ue}=this;if(!me||!fe||!ue)return void A.a.warn("Connect called prior to local peer, receiveSignalStream, and ICE servers ready");if(this.getActiveConnection(z))return void A.a.warn("Connect called for peer with existing connection.");if(this.isOutgoingConnection.get(z))return void A.a.warn("Connect called for peer with an existing outgoing connection offer.");this.isOutgoingConnection.set(z,!0);const _e=new ee(yield this.createRTCPeerConnection(ue,Z),{baseConfig:{isOffer:!0,isLan:!1,receive:(Le,xe)=>this.config.receive(Le,xe),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(Le,xe)=>{var Ne,Ue;return(Ue=(Ne=this.config).onStreamsInfoUpdate)===null||Ue===void 0?void 0:Ue.call(Ne,Le,xe)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localUserId:(te=me.getUserId())===null||te===void 0?void 0:te.getValue(),localPeerId:me.getPeerId(),remotePeerId:z},remoteConfig:{}},Le=>this.onCustomDataChannel(z,Le)),Se=yield _e.getOffer();if(!Se)return A.a.error("Failed to generate offer."),void this.isOutgoingConnection.delete(z);A.a.debug("Sending offer."),he==null||he("Sending offer",Se);const Oe=new D.SendSignalRequest;Oe.setSignal(Se);const Pe=yield(()=>re(this,void 0,void 0,function*(){try{return yield de.sendSignal(Oe,yield this.getMetadata({}))}catch(Le){A.a.warn("Error when sending signal",{error:Le})}}))();if(!this.isOutgoingConnection.get(z))return void A.a.debug("No offer set after receiving offer signal response.");A.a.debug("Offer sent.");const Fe=(ge=Pe==null?void 0:Pe.getSessionId())===null||ge===void 0?void 0:ge.getValue(),De=(ie=Pe==null?void 0:Pe.getSessionCreatedTimestamp())===null||ie===void 0?void 0:ie.getValue();return Fe&&De?(_e.setSessionId(Fe),_e.setSessionCreatedTimestamp(De),this.isOutgoingConnection.delete(z),this.connections.push(_e),this.isConnectionInitiator.set(_e,!0),this.setupHandlers(_e),Fe):(A.a.warn("No session ID or no session created timestamp on send signal response."),void this.isOutgoingConnection.delete(z))})}connectLan(z){var Z,te;return re(this,void 0,void 0,function*(){const ge=new b(z),ie=new ee(yield this.createRTCPeerConnection([]),{baseConfig:{isOffer:!0,isLan:!0,receive:(fe,ue)=>this.config.receive(fe,ue),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(fe,ue)=>{var _e,Se;return(Se=(_e=this.config).onStreamsInfoUpdate)===null||Se===void 0?void 0:Se.call(_e,fe,ue)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localUserId:(te=(Z=this.localPeer)===null||Z===void 0?void 0:Z.getUserId())===null||te===void 0?void 0:te.getValue(),localPeerId:"lan_client",remotePeerId:z}},fe=>this.onCustomDataChannel(z,fe)),he=yield ie.getLanOffer();if(!he)return A.a.warn("Could not generate LAN offer"),!1;const de=yield ge.postLanRtcOffer({offer:JSON.stringify(he)}),me=new RTCSessionDescription(JSON.parse(de.answer));return yield ie.handleLanAnswer(me),this.localConnections.push(ie),Object(T.v4)()})}getConnections(){return[...this.connections,...this.localConnections]}createCustomDataChannel(z,Z,te,ge,ie){const he=this.getActiveConnection(z);if(he&&this.isConnectionInitiator.has(he)){const me=he.peerConnection.createDataChannel("custom."+Z,te);return ge&&(me.binaryType="arraybuffer"),ie(z,me),()=>{}}const de=(me,fe)=>{z===me&&fe.label==="custom."+Z&&ie(z,fe)};return this.peerDataChannelListeners.push(de),()=>{this.peerDataChannelListeners=this.peerDataChannelListeners.filter(me=>me!==de)}}onCustomDataChannel(z,Z){this.peerDataChannelListeners.forEach(te=>te(z,Z))}getConnectionStatus(z){if(this.isOutgoingConnection.get(z))return"connecting";const Z=this.getActiveConnection(z);return Z?Z.isReady()?"connected":"connecting":"disconnected"}getConnectionStatsInfo(z){return re(this,void 0,void 0,function*(){const Z=this.getActiveConnection(z);if(Z)return yield Z.getConnectionStatsInfo()})}disconnect(z){return re(this,void 0,void 0,function*(){const Z=this.getActiveConnection(z);Z&&(yield Z.close())})}getPeers(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("getPeers method cannot be used in local-only mode.");const{signalingClient:z}=this.config,Z=yield(()=>re(this,void 0,void 0,function*(){try{return yield z.getPeers(new D.GetPeersRequest,yield this.getMetadata({}))}catch(ie){A.a.warn("Error when getting peers",{error:ie})}}))();if(!Z)return[];const te=Z.getPeersList();if(!te)return[];const ge=ie=>{var he,de;return(de=(he=ie.getPeerCreatedTimestamp())===null||he===void 0?void 0:he.getValue())!==null&&de!==void 0?de:0};return te.sort((ie,he)=>ge(he)-ge(ie)).map(ie=>J(ie))})}getSessions(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("getPeers method cannot be used in local-only mode.");const{signalingClient:z}=this.config,Z=yield(()=>re(this,void 0,void 0,function*(){try{return yield z.getPeers(new D.GetPeersRequest,yield this.getMetadata({}))}catch(ie){A.a.warn("Error when getting peers",{error:ie})}}))();if(!Z)return{};const te=Z.getPeersList(),ge={};for(const ie of te)ge[ie.getPeerId()]=ie.getSessionIdsList();return ge})}getPing(z){const Z=this.getActiveConnection(z);if(Z)return Z.getPing();A.a.warn("Attempted to get ping time from inactive peer.")}getLastMessageTimestamp(z){const Z=this.getActiveConnection(z);if(Z)return Z.getLastMessageTimestamp();A.a.warn("Attempted to get last message time from inactive peer.")}getSessionMetricsMessageCounts(z){const Z=this.getActiveConnection(z);if(Z)return Z.getSessionMetricsMessageCounts();A.a.warn("Attempted to get session metrics counts from inactive peer.")}isReady(){if(this.config.lanOnlyMode)return!0;const{localPeer:z,receiveSignalStream:Z,iceServers:te}=this;return!!(z&&Z&&te)}shutdown(){return re(this,void 0,void 0,function*(){A.a.info("Shutdown called on RTC client"),yield this.refreshInterval.stop(),this.receiveSignalStream&&this.receiveSignalStream.cancel();const z=this.connections;this.connections=[],yield this.closeConnections(z);const{localPeer:Z}=this;if(!Z||this.config.lanOnlyMode)return;const{signalingClient:te}=this.config;yield(()=>re(this,void 0,void 0,function*(){try{const ge=new D.DeletePeerRequest;ge.setPeerId(Z.getPeerId()),yield te.deletePeer(ge,yield this.getMetadata({}))}catch(ge){return void A.a.warn("Error deleting local peer",{error:ge})}}))()})}createPeer(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("createPeer method cannot be used in local-only mode.");const{signalingClient:z}=this.config,Z=yield(()=>re(this,void 0,void 0,function*(){try{return yield z.createPeer(new D.CreatePeerRequest,yield this.getMetadata({}))}catch(ge){throw new Error(`Was not able to create peer: ${ge}`)}}))(),te=Z==null?void 0:Z.getPeer();if(!te)throw new Error("Response did not provide peer.");return this.localPeer=te})}createReceiveSignalStream(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("createReceiveSignalStream method cannot be used in local-only mode.");const{signalingClient:z}=this.config,{localPeer:Z,iceServers:te}=this;if(!Z||!te)return;const{receiveSignalStream:ge}=this;ge&&ge.cancel();const ie=new D.ReceiveSignalStreamRequest;ie.setPeerId(Z.getPeerId());const he=yield(()=>re(this,void 0,void 0,function*(){try{return z.receiveSignalStream(ie,yield this.getMetadata({hasDeadline:!1}))}catch(de){throw new Error(`Unable to create receive signal stream: ${de}`)}}))();if(!he)throw new Error("Response did not provide stream.");return he.on("data",de=>re(this,void 0,void 0,function*(){var me,fe,ue,_e;const Se=de.getSignal(),Oe=(me=Se==null?void 0:Se.getSessionId())===null||me===void 0?void 0:me.getValue(),Pe=Se==null?void 0:Se.getSenderId(),Fe=Se==null?void 0:Se.getReceiverId(),De=(fe=Se==null?void 0:Se.getSessionCreatedTimestamp())===null||fe===void 0?void 0:fe.getValue();if(!(Se&&Oe&&Pe&&Fe&&De))return void A.a.warn("Received signal with missing information.");const Le=this.getActiveConnection(Pe);if(Le)if(Le.getSessionId()!==Oe){if(A.a.debug("Received signal: different session for a peer we're already connected to."),(Le.getSessionCreatedTimestamp()||0)>De)return;const xe=new ee(yield this.createRTCPeerConnection(te),{baseConfig:{isOffer:!1,isLan:!1,receive:(Ne,Ue)=>this.config.receive(Ne,Ue),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(Ne,Ue)=>{var We,ze;return(ze=(We=this.config).onStreamsInfoUpdate)===null||ze===void 0?void 0:ze.call(We,Ne,Ue)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localPeerId:Z.getPeerId(),localUserId:(_e=Z.getUserId())===null||_e===void 0?void 0:_e.getValue(),remotePeerId:Pe},remoteConfig:{sessionId:Oe,sessionCreatedTimestamp:De}},Ne=>this.onCustomDataChannel(Pe,Ne));yield xe.handleSignal(Se),this.connections.push(xe)}else A.a.debug("Received signal: for an existing connection."),yield Le.handleSignal(Se);else{A.a.debug("Received signal: new connection.");const xe=new ee(yield this.createRTCPeerConnection(te),{baseConfig:{isOffer:!1,isLan:!1,receive:(Ne,Ue)=>this.config.receive(Ne,Ue),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(Ne,Ue)=>{var We,ze;return(ze=(We=this.config).onStreamsInfoUpdate)===null||ze===void 0?void 0:ze.call(We,Ne,Ue)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localPeerId:Z.getPeerId(),localUserId:(ue=Z.getUserId())===null||ue===void 0?void 0:ue.getValue(),remotePeerId:Pe},remoteConfig:{sessionId:Oe,sessionCreatedTimestamp:De}},Ne=>this.onCustomDataChannel(Pe,Ne));yield xe.handleSignal(Se),this.connections.push(xe)}})),he.on("end",()=>{he.cancel(),this.receiveSignalStream=void 0}),he.on("error",de=>{switch(de.code){case L.StatusCode.CANCELLED:case L.StatusCode.UNAVAILABLE:case L.StatusCode.UNKNOWN:A.a.debug("Receive signal stream error",{error:de});break;case L.StatusCode.UNAUTHENTICATED:A.a.warn("Receive signal stream error",{error:de});break;default:A.a.error("Receive signal stream error",{error:de})}he.cancel(),this.receiveSignalStream=void 0}),this.receiveSignalStream=he})}createRTCPeerConnection(z,Z){var te;return re(this,void 0,void 0,function*(){const ge=Z==null?void 0:Z.rtcIceTransportPolicy,ie=Z==null?void 0:Z.rtcIceServerProtocol,he=(fe,ue)=>typeof fe=="string"?fe.endsWith(`transport=${ue}`):fe.some(_e=>_e.endsWith(`transport=${ue}`)),de=z.filter(fe=>{return ge!=="relay"||(typeof(ue=fe.urls)=="string"?ue.startsWith("turn:"):ue.some(_e=>_e.startsWith("turn:")));var ue}).filter(fe=>ie!=="udp"||he(fe.urls,"udp")).filter(fe=>ie!=="tcp"||he(fe.urls,"tcp")),me=(te=this.config.alternateRTCPeerConnection)!==null&&te!==void 0?te:window.RTCPeerConnection;if(!me)throw new Error("RTCPeerConnection class not found. WebRTC must be enabled.");return new me(Object.assign({iceServers:de,iceTransportPolicy:ge},Z))})}closeConnections(z){return re(this,void 0,void 0,function*(){const Z=yield F(z.map(te=>re(this,void 0,void 0,function*(){yield te.close()})));for(const te of Z)A.a.warn("Request to close session failed",{error:te})})}getActiveConnection(z){return this.getConnections().find(Z=>Z.getRemotePeerId()===z&&Z.isActive())}update(){var z;return re(this,void 0,void 0,function*(){if(this.localConnections=this.localConnections.filter(de=>de.isActive()),this.config.lanOnlyMode)return;const{signalingClient:Z}=this.config;if(!this.localPeer||!this.receiveSignalStream||!this.iceServers)return this.localPeer||(yield this.createPeer()),this.iceServers||(yield this.updateIceServers()),void(this.receiveSignalStream||(yield this.createReceiveSignalStream()));yield this.closeConnections(this.connections.filter(de=>!de.isActive())),this.connections=this.connections.filter(de=>de.isActive());const{localPeer:te}=this,ge=this.connections.filter(de=>de.getSessionId).map(de=>M(de.getSessionId()));te.setSessionIdsList(ge);const ie=new D.RefreshPeerRequest;ie.setPeer(te);try{yield Z.refreshPeer(ie,yield this.getMetadata({}))}catch(de){de.code===L.StatusCode.NOT_FOUND?(A.a.warn("Peer expired, creating new peer",{peerId:te.getPeerId()}),yield this.reset()):A.a.warn("Error calling RefreshPeer",{error:de})}const he=yield this.getPeers();for(const de of this.connections)de.setRemoteDeviceId((z=he.find(me=>me.id===de.getRemotePeerId()))===null||z===void 0?void 0:z.deviceId)})}reset(){return re(this,void 0,void 0,function*(){yield this.closeConnections(this.connections),this.connections=[],this.isOutgoingConnection=new Map,yield this.createPeer(),yield this.createReceiveSignalStream()})}updateIceServers(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)return;const{iceServersLastUpdate:z,iceServersTtl:Z}=this,te=new Date().getTime();if(!z||te-z>Z)try{const ge=(yield this.config.signalingClient.getIceServers(new D.GetIceServersRequest,yield this.getMetadata({}))).getIceServers();this.iceServers=JSON.parse(ge),this.iceServersLastUpdate=te}catch(ge){A.a.warn("Error in updateIceServers",{error:ge})}})}setupHandlers(z){const{peerConnection:Z}=z,te=z.getSessionCreatedTimestamp();Z.onconnectionstatechange=()=>re(this,void 0,void 0,function*(){const ge=Z.connectionState;if(te)switch(ge){case"connected":x.aggregate("rtc-connect-time",new Date().getTime()-te);break;case"failed":x.increment("rtc-connect-failed")}})}getMetadata(z){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("getMetadata method cannot be called in local-only mode");const{getToken:Z}=this.config,{grpcCallDeadline:te}=this,{hasDeadline:ge}=z,ie=ge===!1?void 0:new Date().getTime()+te;return{authorization:yield Z(),deadline:ie}})}}},,function(e,t,r){r.r(t),r.d(t,"LogClient",function(){return g});var n=r(26),i=function(s,o,l,u){return new(l||(l=Promise))(function(m,R){function y(w){try{c(u.next(w))}catch(E){R(E)}}function S(w){try{c(u.throw(w))}catch(E){R(E)}}function c(w){var E;w.done?m(w.value):(E=w.value,E instanceof l?E:new l(function(P){P(E)})).then(y,S)}c((u=u.apply(s,o||[])).next())})};class g extends n.a{log(o){return i(this,void 0,void 0,function*(){yield this.fetch("logs",{method:"POST",body:JSON.stringify({logs:o}),allowUnsafeRetries:!0})})}}}])})})(dist);let FORMANT_API_URL="https://api.formant.io";typeof window!="undefined"&&(FORMANT_API_URL=window.FORMANT_API_URL||FORMANT_API_URL);let urlParams$1=new URLSearchParams("");typeof window!="undefined"&&(urlParams$1=new URLSearchParams(window.location.search));const moduleName$1=urlParams$1.get("formant_dev");moduleName$1&&(FORMANT_API_URL="https://api-dev.formant.io");function delay(e){return new Promise(t=>setTimeout(t,e))}function defined(e,t){if(e!==void 0)return e;throw new Error(t||"Value is undefined")}class App{static sendAppMessage(t){window.parent.postMessage(t,"*")}static getCurrentModuleContext(){let t=new URLSearchParams("");return typeof window!="undefined"&&(t=new URLSearchParams(window.location.search)),t.get("module")}static isModule(){return this.getCurrentModuleContext()!==null}static goToTime(t){this.sendAppMessage({type:"go_to_time",time:t.getTime()})}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,r){const n=this.getCurrentModuleContext();if(!n)throw new Error("No module context");this.sendAppMessage({type:"set_module_data_time_range",module:n,before:t,after:r||0})}static refreshAuthToken(){const t=this.getCurrentModuleContext();if(!t)throw new Error("No module context");this.sendAppMessage({type:"refresh_auth_token",module:t})}static setupModuleMenus(t){const r=this.getCurrentModuleContext();if(!r)throw new Error("No module context");this.sendAppMessage({type:"setup_module_menus",module:r,menus:t})}static addMenuListener(t){window.addEventListener("message",r=>{const n=r.data;n.type==="module_menu_item_clicked"&&t(n.menu)})}static addAccessTokenRefreshListener(t){window.addEventListener("message",r=>{const n=r.data;n.type==="auth_token"&&t(n.token)})}static addModuleDataListener(t){window.addEventListener("message",r=>{const n=r.data;n.type==="module_data"&&t({streams:n.streams,time:n.time,queryRange:n.queryRange})})}}const Ee=class{static async login(t,r){try{const n=await fetch(`${FORMANT_API_URL}/v1/admin/auth/login`,{method:"POST",body:JSON.stringify({email:t,password:r}),headers:{"Content-Type":"application/json"}}),i=await n.json();if(n.status!==200)throw new Error(i.message);return await Ee.loginWithToken(i.authentication.accessToken,i.authentication.refreshToken),i.authentication}catch(n){return Ee.waitingForAuth.forEach(i=>i(!1)),Ee.waitingForAuth=[],Promise.reject(n)}}static async loginWithToken(t,r){const n=JSON.parse(atob(t.split(".")[1]));try{let i;if(Ee.isShareToken=n["formant:claims"]&&n["formant:claims"].type=="share",n["formant:claims"]&&(Ee.currentOrganization=n["formant:claims"].organizationId),n["custom:organization_id"]&&(Ee.currentOrganization=n["custom:organization_id"]),Ee.isShareToken||(i=n.sub),n["formant:claims"]&&n["formant:claims"].userId&&(i=n["formant:claims"].userId),i){const g=await fetch(`${FORMANT_API_URL}/v1/admin/users/${i}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+t}}),s=await g.json();if(g.status!==200)throw new Error(s.message);Ee.currentUser=s}Ee.token=t,Ee.waitingForAuth.forEach(g=>g(!0))}catch(i){console.error(i),Ee.waitingForAuth.forEach(g=>g(!1))}Ee.waitingForAuth=[],r&&(Ee.refreshToken=r,setInterval(async()=>{if(Ee.refreshToken){const g=await(await fetch(`${FORMANT_API_URL}/v1/admin/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:Ee.refreshToken})})).json();Ee.token=g.authentication.accessToken}},1e3*60*60))}static isAuthenticated(){return Ee.token!==void 0}static getCurrentUser(){return Ee.currentUser}static async waitTilAuthenticated(){return Ee.token!==void 0?!0:new Promise(t=>{Ee.waitingForAuth.push(function(r){t(r)})})}static async listenForRefresh(){App.addAccessTokenRefreshListener(t=>{this.loginWithToken(t)}),setInterval(async()=>{App.refreshAuthToken()},1e3*60*60)}};let Authentication=Ee;Ce(Authentication,"token"),Ce(Authentication,"refreshToken"),Ce(Authentication,"currentUser"),Ce(Authentication,"currentOrganization"),Ce(Authentication,"isShareToken",!1),Ce(Authentication,"defaultDeviceId"),Ce(Authentication,"waitingForAuth",[]);class DataChannel{constructor(t){Ce(this,"ready",!1);Ce(this,"listeners",[]);Ce(this,"binaryListeners",[]);Ce(this,"error");Ce(this,"decoder",new TextDecoder);this.dataChannel=t,this.dataChannel.binaryType="arraybuffer",this.dataChannel.onopen=()=>{this.ready=!0},this.dataChannel.onclose=()=>{this.ready=!1},this.dataChannel.onerror=r=>{console.error(r),this.error="An error occurred in DataChannel"},this.dataChannel.onmessage=r=>{this.listeners.forEach(n=>{const i=new Uint8Array(r.data),g=this.decoder.decode(i);n(g)}),this.binaryListeners.forEach(n=>{n(new Uint8Array(r.data))})}}async waitTilReady(){return this.ready?!0:new Promise((r,n)=>{let i=window.setInterval(()=>{this.ready&&(window.clearInterval(i),r(!0)),this.error&&n(this.error)},10)})}send(t){if(!this.ready)throw new Error("Connection has been closed");this.dataChannel.send(t)}sendBinary(t){if(!this.ready)throw new Error("Connection has been closed");this.dataChannel.send(t)}addListener(t){this.listeners.push(t)}removeListener(t){const r=this.listeners.indexOf(t);if(r===-1)throw new Error("Could not find data channel listener to remove");if(this.error)throw new Error(this.error);this.listeners.splice(r,1)}addBinaryListener(t){this.binaryListeners.push(t)}removeBinaryListener(t){const r=this.binaryListeners.indexOf(t);if(r===-1)throw new Error("Could not find data channel listener to remove");if(this.error)throw new Error(this.error);this.binaryListeners.splice(r,1)}}class CaptureStream{constructor(t){Ce(this,"token");this.captureSession=t}async ingestJSON(t){if(!this.token){const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/capture-sessions/${this.captureSession.code}/authenticate`,{method:"POST"})).json();this.token=n.token}await fetch(`${FORMANT_API_URL}/v1/ingest`,{method:"POST",body:JSON.stringify({deviceId:this.captureSession.deviceId,name:this.captureSession.streamName,type:"json",points:[[Date.now(),JSON.stringify(t)]]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+this.token}})}}class Manipulator{constructor(t,r){Ce(this,"currentListeners",[]);Ce(this,"onRealtimeMessage",(t,r)=>{r.payload.jointState&&this.currentListeners.forEach(n=>n(r.payload.jointState))});this.device=t,this.config=r}async synchronize(){this.device.addRealtimeListener(this.onRealtimeMessage),this.device.startListeningToRealtimeDataStream(this.config.currentJointStateStream)}async desynchronize(){this.device.removeRealtimeListener(this.onRealtimeMessage),this.device.stopListeningToRealtimeDataStream(this.config.currentJointStateStream)}async addCurrentJointStateListener(t){this.currentListeners.push(t)}}class RequestDataChannel{constructor(t,r,n){Ce(this,"channel");Ce(this,"requestIdToResponseMap",new Map);this.device=t,this.channel_name=r,this.timeout=n}}class BinaryRequestDataChannel extends RequestDataChannel{constructor(){super(...arguments);Ce(this,"RESPONSE_SUCCESS_BYTE",0);Ce(this,"decoder",new TextDecoder)}generateBinaryId(){const t=new Uint8Array(16);for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);return t}async initialize(){this.channel=await this.device.createCustomDataChannel(this.channel_name),this.channel.addBinaryListener(t=>{const n=t.slice(0,16).toString();if(n.length===0)throw new Error("Invalid response");const i=t.slice(16);if(i.length===0)throw new Error("Invalid response");this.requestIdToResponseMap.has(n)&&this.requestIdToResponseMap.set(n,i)})}async request(t){if(this.channel||await this.initialize(),!this.channel)throw new Error("Failed to create channel");const{channel:r,requestIdToResponseMap:n,timeout:i}=this;await r.waitTilReady();const g=this.generateBinaryId(),s=g.toString();n.set(s,!0),r.sendBinary(new Uint8Array([...g,...t]));const o=new Date().getTime();for(;new Date().getTime()<o+i;)if(await delay(50),n.has(s)){const l=n.get(s);if(l!==!0){n.delete(s);const u=l[0]===this.RESPONSE_SUCCESS_BYTE,m=l.slice(1);if(u)return m;throw{name:"AdapterError",message:this.decoder.decode(m)}}}throw n.delete(s),{name:"TimeoutError",message:`Request timed out after ${i/1e3} seconds`}}}class TextRequestDataChannel extends RequestDataChannel{generateTextId(){return Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2)}async initialize(){this.channel=await this.device.createCustomDataChannel(this.channel_name),this.channel.addListener(t=>{const r=JSON.parse(t),{id:n,data:i,error:g}=r;if(!n)throw new Error("Invalid response");if(!i&&!g)throw new Error("Invalid response");this.requestIdToResponseMap.has(n)&&this.requestIdToResponseMap.set(n,r)})}async request(t){if(this.channel||await this.initialize(),!this.channel)throw new Error("Failed to create channel");const{channel:r,requestIdToResponseMap:n,timeout:i}=this;await r.waitTilReady();const g=this.generateTextId();n.set(g,!0),r.send(JSON.stringify({id:g,data:t}));const s=new Date().getTime();for(;new Date().getTime()<s+i;)if(await delay(50),n.has(g)){const o=n.get(g);if(o!==!0){n.delete(g);const{data:l,error:u}=o;if(l)return l;if(u)throw{name:"AdapterError",message:u}}}throw n.delete(g),{name:"TimeoutError",message:`Request timed out after ${i/1e3} seconds`}}}class Device{constructor(t,r,n){Ce(this,"rtcClient");Ce(this,"realtimeListeners",[]);Ce(this,"handleMessage",(t,r)=>{this.realtimeListeners.forEach(n=>n(t,r))});this.id=t,this.name=r,this.organizationId=n}async getLatestTelemetry(){return(await(await fetch(`${FORMANT_API_URL}/v1/queries/stream-current-value`,{method:"POST",body:JSON.stringify({deviceIds:[this.id]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}async getConfiguration(){let t=await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}});const r=await t.json();if(!r.state.reportedConfiguration)throw new Error("Device has no configuration, has it ever been turned on?");const n=r.state.reportedConfiguration.version;return t=await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}/configurations/${n}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),(await t.json()).document}async getFileUrl(t){return(await(await fetch(`${FORMANT_API_URL}/v1/admin/files/query`,{method:"POST",body:JSON.stringify({fileId:[t]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).fileUrls}async startRealtimeConnection(){if(this.rtcClient)throw new Error(`Already created realtime connection to device ${this.id}`);{const t=new dist.exports.RtcClient({signalingClient:new dist.exports.SignalingPromiseClient(FORMANT_API_URL,null,null),getToken:async()=>defined(Authentication.token,"Realtime when user isn't authorized"),receive:this.handleMessage});for(;!t.isReady();)await delay(100);const n=(await t.getPeers()).find(g=>g.deviceId===this.id);if(!n)throw new Error("Cannot find peer, is the robot offline?");const i=n.id;for(await t.connect(i);t.getConnectionStatus(i)!=="connected";)await delay(100);this.rtcClient=t}}addRealtimeListener(t){this.realtimeListeners.push(t)}removeRealtimeListener(t){const r=this.realtimeListeners.indexOf(t);if(r===-1)throw new Error("Could not find realtime listener to remove");this.realtimeListeners.splice(r,1)}async getRealtimeVideoStreams(){var n,i,g;const t=await this.getConfiguration(),r=[];for(const s of(n=t.teleop.hardwareStreams)!=null?n:[])s.rtcStreamType==="h264-video-frame"&&r.push({name:s.name});for(const s of(i=t.teleop.rosStreams)!=null?i:[])s.topicType=="formant/H264VideoFrame"&&r.push({name:s.topicName});for(const s of(g=t.teleop.customStreams)!=null?g:[])s.rtcStreamType==="h264-video-frame"&&r.push({name:s.name});return r}async getRealtimeManipulators(){var n;const t=await this.getConfiguration(),r=[];for(const i of(n=t.teleop.rosStreams)!=null?n:[])i.topicType=="sensor_msgs/JointState"&&r.push(new Manipulator(this,{currentJointStateStream:{name:i.topicName},plannedJointStateStream:i.plannedTopic?{name:i.plannedTopic}:void 0,planValidStream:i.planValidTopic?{name:i.planValidTopic}:void 0,endEffectorStream:i.endEffectorTopic?{name:i.endEffectorTopic}:void 0,endEffectorLinkName:i.endEffectorLinkName,baseReferenceFrame:i.baseReferenceFrame,localFrame:i.localFrame}));return r}async startListeningToRealtimeVideo(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!0,pipeline:"rtc"})}async stopListeningToRealtimeVideo(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!1,pipeline:"rtc"})}async startListeningToRealtimeDataStream(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!0,pipeline:"rtc"})}async stopListeningToRealtimeDataStream(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!1,pipeline:"rtc"})}async enableRealtimeTelemetryPriorityIngestion(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t,enablePriorityUpload:!0,pipeline:"telemetry"})}async disableRealtimeTelemetryPriorityIngestion(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t,enablePriorityUpload:!1,pipeline:"telemetry"})}async getRemotePeer(){const r=(await defined(this.rtcClient,"Realtime connection has not been started").getPeers()).find(n=>n.deviceId===this.id);return defined(r,"Could not find remote peer for device "+this.id)}async stopRealtimeConnection(){if(this.rtcClient)await this.rtcClient.disconnect(this.id);else throw new Error(`Realtime connection hasn't been started for ${this.id}`)}async getAvailableCommands(){return(await(await fetch(`${FORMANT_API_URL}/v1/admin/command-templates/`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items.map(n=>({name:n.name,id:n.id,command:n.command,description:n.description,parameterEnabled:n.parameterEnabled,parameterValue:n.parameterValue,parameterMeta:n.parameterMeta}))}async sendCommand(t,r,n,i){var R;const s=(await this.getAvailableCommands()).find(y=>y.name===t);if(!s)throw new Error(`Could not find command with name "${t}"`);let o;if(r===void 0)if(s.parameterEnabled&&s.parameterValue)o=s.parameterValue;else throw new Error("Command has no default parameter value, you must provide one");else o=r;let l={value:o,scrubberTime:(n||new Date).toISOString(),meta:st(st({},s.parameterMeta),i)};return(await(await fetch(`${FORMANT_API_URL}/v1/admin/commands`,{method:"POST",body:JSON.stringify({commandTemplateId:s.id,organizationId:this.organizationId,deviceId:this.id,command:s.command,parameter:l,userId:(R=Authentication.currentUser)==null?void 0:R.id}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).fileUrls}async createCustomDataChannel(t,r){const n=defined(this.rtcClient,"Realtime connection has not been started"),i=await this.getRemotePeer();return new Promise(s=>{n.createCustomDataChannel(defined(i).id,t,st({ordered:!0},r),!1,(o,l)=>{const u=new DataChannel(l);s(u)})})}createCustomRequestDataChannel(t,r=3e3){return new TextRequestDataChannel(this,t,r)}createCustomBinaryRequestDataChannel(t,r=3e3){return new BinaryRequestDataChannel(this,t,r)}async createCaptureStream(t){const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/capture-sessions`,{method:"POST",body:JSON.stringify({deviceId:this.id,streamName:t,tags:{}}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json();return new CaptureStream(n)}async getTelemetry(t,r,n,i){return await Fleet.getTelemetry(this.id,t,r,n,i)}async getTelemetryStreams(){var o,l;const t=await this.getConfiguration(),r=await fetch(`${FORMANT_API_URL}/v1/queries/metadata/stream-names`,{method:"POST",body:JSON.stringify({deviceIds:[this.id]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),n=[],i=[];return(l=(o=t.telemetry)==null?void 0:o.streams)==null||l.forEach(u=>{u.disabled!==!0&&n.push(u.name),u.onDemand===!0&&i.push(u.name)}),console.log(i),(await r.json()).items.filter(u=>!n.includes(u)).map(u=>({name:u,onDemand:i.includes(u)}))}}const Re=class{static async setDefaultDevice(t){Re.defaultDeviceId=t}static async getCurrentDevice(){if(!Authentication.token)throw new Error("Not authenticated");if(!Re.defaultDeviceId)throw new Error("No known default device");const i=(await(await fetch(`${FORMANT_API_URL}/v1/admin/device-details/query`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items.find(s=>s.id===Re.defaultDeviceId).name,g=new Device(Re.defaultDeviceId,i,defined(Authentication.currentOrganization));return Re.knownContext.push(new WeakRef(g)),g}static async getDevice(t){if(!Authentication.token)throw new Error("Not authenticated");const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/devices/${t}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json(),i=n.name,g=new Device(t,i,n.organizationId);return Re.knownContext.push(new WeakRef(g)),g}static async getDevices(){if(!Authentication.token)throw new Error("Not authenticated");const r=await(await fetch(`${FORMANT_API_URL}/v1/admin/device-details/query`,{method:"POST",body:JSON.stringify({enabled:!0,type:"default"}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json();return r.items,r.items.map(n=>new Device(n.id,n.name,n.organizationId))}static async getOnlineDevices(){if(!Authentication.token)throw new Error("Not authenticated");const n=(await(await fetch(`${FORMANT_API_URL}/v1/queries/online-devices`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items;return(await Re.getDevices()).filter(g=>n.includes(g.id))}static async getPeers(){if(!Authentication.token)throw new Error("Not authenticated");return await new dist.exports.RtcClient({signalingClient:new dist.exports.SignalingPromiseClient(FORMANT_API_URL,null,null),getToken:async()=>defined(Authentication.token,"Realtime when user isn't authorized"),receive:()=>{}}).getPeers()}static async getRealtimeSessions(){if(!Authentication.token)throw new Error("Not authenticated");return await new dist.exports.RtcClient({signalingClient:new dist.exports.SignalingPromiseClient(FORMANT_API_URL,null,null),getToken:async()=>defined(Authentication.token,"Realtime when user isn't authorized"),receive:()=>{}}).getSessions()}static async isDeviceInRealtimeSession(t){let r=await Re.getPeers(),n=await Re.getRealtimeSessions(),i=r.find(g=>g.deviceId===t);return i?n[i.id].length>0:!1}static async getRealtimeDevices(){if(!Authentication.token)throw new Error("Not authenticated");const n=(await(await fetch(`${FORMANT_API_URL}/v1/signaling/peers`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items.map(g=>g.deviceId);return(await Re.getDevices()).filter(g=>n.includes(g.id))}static async getLatestTelemetry(t){let r=t;return t&&!Array.isArray(t)&&(t=[t]),(await(await fetch(`${FORMANT_API_URL}/v1/queries/stream-current-value`,{method:"POST",body:JSON.stringify({deviceIds:r}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}static async getTelemetry(t,r,n,i,g){let s=t;Array.isArray(t)||(s=[t]);let o=r;return Array.isArray(r)||(o=[r]),(await(await fetch(`${FORMANT_API_URL}/v1/queries/queries`,{method:"POST",body:JSON.stringify({deviceIds:s,end:i.toISOString(),names:o,start:n.toISOString(),tags:g}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}static async getFileUrl(t){const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/files/query`,{method:"POST",body:JSON.stringify({fileIds:[t]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json();if(n.fileUrls.length===0)throw new Error("File not found");return n.fileUrls[0]}};let Fleet=Re;Ce(Fleet,"defaultDeviceId"),Ce(Fleet,"knownContext",[]);class KeyValue{static async set(t,r){try{const n=await fetch(FORMANT_API_URL+"/v1/admin/key-value",{method:"POST",body:JSON.stringify({organizationId:defined(Authentication.currentUser).organizationId,key:t,value:r}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),i=await n.json();if(n.status!==200)throw new Error(i.message)}catch(n){throw n}}static async get(t){try{const r=await fetch(FORMANT_API_URL+`/v1/admin/key-value/${t}`,{method:"GET",body:JSON.stringify({organizationId:defined(Authentication.currentUser).organizationId}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),n=await r.json();if(r.status!==200)throw new Error(n.message);return n.value}catch(r){throw r}}}let urlParams=new URLSearchParams("");typeof window!="undefined"&&(urlParams=new URLSearchParams(window.location.search));const urlDevice=urlParams.get("device");urlDevice&&Fleet.setDefaultDevice(urlDevice);const urlAuth=urlParams.get("auth");urlAuth&&Authentication.loginWithToken(urlAuth);const moduleName=urlParams.get("module");moduleName&&Authentication.listenForRefresh(),exports.App=App,exports.Authentication=Authentication,exports.BinaryRequestDataChannel=BinaryRequestDataChannel,exports.CaptureStream=CaptureStream,exports.DataChannel=DataChannel,exports.Device=Device,exports.Fleet=Fleet,exports.KeyValue=KeyValue,exports.Manipulator=Manipulator,exports.TextRequestDataChannel=TextRequestDataChannel,Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module"});
44
+ `),Error.captureStackTrace(this,n)}}e.exports=i=>{if(i.length>2)throw new n(i);function g(o={}){this.options=o}function s(o){return new g(o)}return g.prototype.transform=i,s.Format=g,s}},function(e,t,r){function n(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function")}function i(s,o){for(var l=0;l<o.length;l++){var u=o[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}var g=r(85);e.exports=function(){function s(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n(this,s),this.loggers=new Map,this.options=u}var o,l;return o=s,(l=[{key:"add",value:function(u,m){var R=this;if(!this.loggers.has(u)){var y=(m=Object.assign({},m||this.options)).transports||this.options.transports;m.transports=y?y.slice():[];var S=g(m);S.on("close",function(){return R._delete(u)}),this.loggers.set(u,S)}return this.loggers.get(u)}},{key:"get",value:function(u,m){return this.add(u,m)}},{key:"has",value:function(u){return!!this.loggers.has(u)}},{key:"close",value:function(u){var m=this;if(u)return this._removeLogger(u);this.loggers.forEach(function(R,y){return m._removeLogger(y)})}},{key:"_removeLogger",value:function(u){this.loggers.has(u)&&(this.loggers.get(u).close(),this._delete(u))}},{key:"_delete",value:function(u){this.loggers.delete(u)}}])&&i(o.prototype,l),s}()},function(e,t,r){(function(n){const i=r(49),g=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;e.exports=function(s,o,l){let u,m,R=!1,y=!1;function S(E,P){let F=`"${o}" ${P}`;throw E&&(F=`${F}, but is set to "${E}"`),m&&(F=`${F}. An example of a valid value would be: ${m}`),new i(F)}function c(E){return function(){let P=s[o];if(P===void 0)if(u===void 0&&y)S(void 0,"is a required variable, but it was not set");else{if(u===void 0)return;P=u}y&&P.trim().length===0&&S(void 0,"is a required variable, but its value was empty"),R&&(P.match(g)||S(P,"should be a valid base64 string if using convertFromBase64"),P=n.from(P,"base64").toString());const F=[P].concat(Array.prototype.slice.call(arguments));try{return E.apply(E,F)}catch(M){S(P,M.message)}}}const w={asArray:c(r(211)),asBoolStrict:c(r(212)),asBool:c(r(213)),asPortNumber:c(r(214)),asEnum:c(r(215)),asFloatNegative:c(r(216)),asFloatPositive:c(r(217)),asFloat:c(r(51)),asIntNegative:c(r(218)),asIntPositive:c(r(91)),asInt:c(r(50)),asJsonArray:c(r(219)),asJsonObject:c(r(220)),asJson:c(r(52)),asString:c(r(35)),asUrlObject:c(r(92)),asUrlString:c(r(221)),convertFromBase64:function(){return R=!0,w},default:function(E){if(typeof E=="number")u=E.toString();else if(Array.isArray(E)||typeof E=="object"&&E!==null)u=JSON.stringify(E);else{if(typeof E!="string")throw new i("values passed to default() must be of Number, String, Array, or Object type");u=E}return w},required:function(E){return y=E===void 0||E,w},example:function(E){return m=E,w}};return Object.entries(l).forEach(([E,P])=>{w[E]=c(P)}),w}}).call(this,r(4).Buffer)},function(e,t,r){const n=r(35);e.exports=function(i,g){return g=g||",",i.length?n(i).split(g).filter(Boolean):[]}},function(e,t,r){e.exports=function(n){const i=n.toLowerCase();if(i!=="false"&&i!=="true")throw new Error('should be either "true", "false", "TRUE", or "FALSE"');return i!=="false"}},function(e,t,r){e.exports=function(n){const i=n.toLowerCase();if(["false","0","true","1"].indexOf(i)===-1)throw new Error('should be either "true", "false", "TRUE", "FALSE", 1, or 0');return!(i==="0"||i==="false")}},function(e,t,r){const n=r(91);e.exports=function(i){var g=n(i);if(g>65535)throw new Error("cannot assign a port number greater than 65535");return g}},function(e,t,r){const n=r(35);e.exports=function(i,g){const s=n(i);if(g.indexOf(s)<0)throw new Error(`should be one of [${g.join(", ")}]`);return s}},function(e,t,r){const n=r(51);e.exports=function(i){const g=n(i);if(g>0)throw new Error("should be a negative float");return g}},function(e,t,r){const n=r(51);e.exports=function(i){const g=n(i);if(g<0)throw new Error("should be a positive float");return g}},function(e,t,r){const n=r(50);e.exports=function(i){const g=n(i);if(g>0)throw new Error("should be a negative integer");return g}},function(e,t,r){const n=r(52);e.exports=function(i){var g=n(i);if(!Array.isArray(g))throw new Error("should be a parseable JSON Array");return g}},function(e,t,r){const n=r(52);e.exports=function(i){var g=n(i);if(Array.isArray(g))throw new Error("should be a parseable JSON Object");return g}},function(e,t,r){const n=r(92);e.exports=function(i){return n(i).toString()}},function(e,t,r){function n(o){var l=this;if(l instanceof n||(l=new n),l.tail=null,l.head=null,l.length=0,o&&typeof o.forEach=="function")o.forEach(function(R){l.push(R)});else if(arguments.length>0)for(var u=0,m=arguments.length;u<m;u++)l.push(arguments[u]);return l}function i(o,l){o.tail=new s(l,o.tail,null,o),o.head||(o.head=o.tail),o.length++}function g(o,l){o.head=new s(l,null,o.head,o),o.tail||(o.tail=o.head),o.length++}function s(o,l,u,m){if(!(this instanceof s))return new s(o,l,u,m);this.list=m,this.value=o,l?(l.next=this,this.prev=l):this.prev=null,u?(u.prev=this,this.next=u):this.next=null}e.exports=n,n.Node=s,n.create=n,n.prototype.removeNode=function(o){if(o.list!==this)throw new Error("removing node which does not belong to this list");var l=o.next,u=o.prev;l&&(l.prev=u),u&&(u.next=l),o===this.head&&(this.head=l),o===this.tail&&(this.tail=u),o.list.length--,o.next=null,o.prev=null,o.list=null},n.prototype.unshiftNode=function(o){if(o!==this.head){o.list&&o.list.removeNode(o);var l=this.head;o.list=this,o.next=l,l&&(l.prev=o),this.head=o,this.tail||(this.tail=o),this.length++}},n.prototype.pushNode=function(o){if(o!==this.tail){o.list&&o.list.removeNode(o);var l=this.tail;o.list=this,o.prev=l,l&&(l.next=o),this.tail=o,this.head||(this.head=o),this.length++}},n.prototype.push=function(){for(var o=0,l=arguments.length;o<l;o++)i(this,arguments[o]);return this.length},n.prototype.unshift=function(){for(var o=0,l=arguments.length;o<l;o++)g(this,arguments[o]);return this.length},n.prototype.pop=function(){if(this.tail){var o=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,o}},n.prototype.shift=function(){if(this.head){var o=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,o}},n.prototype.forEach=function(o,l){l=l||this;for(var u=this.head,m=0;u!==null;m++)o.call(l,u.value,m,this),u=u.next},n.prototype.forEachReverse=function(o,l){l=l||this;for(var u=this.tail,m=this.length-1;u!==null;m--)o.call(l,u.value,m,this),u=u.prev},n.prototype.get=function(o){for(var l=0,u=this.head;u!==null&&l<o;l++)u=u.next;if(l===o&&u!==null)return u.value},n.prototype.getReverse=function(o){for(var l=0,u=this.tail;u!==null&&l<o;l++)u=u.prev;if(l===o&&u!==null)return u.value},n.prototype.map=function(o,l){l=l||this;for(var u=new n,m=this.head;m!==null;)u.push(o.call(l,m.value,this)),m=m.next;return u},n.prototype.mapReverse=function(o,l){l=l||this;for(var u=new n,m=this.tail;m!==null;)u.push(o.call(l,m.value,this)),m=m.prev;return u},n.prototype.reduce=function(o,l){var u,m=this.head;if(arguments.length>1)u=l;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");m=this.head.next,u=this.head.value}for(var R=0;m!==null;R++)u=o(u,m.value,R),m=m.next;return u},n.prototype.reduceReverse=function(o,l){var u,m=this.tail;if(arguments.length>1)u=l;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");m=this.tail.prev,u=this.tail.value}for(var R=this.length-1;m!==null;R--)u=o(u,m.value,R),m=m.prev;return u},n.prototype.toArray=function(){for(var o=new Array(this.length),l=0,u=this.head;u!==null;l++)o[l]=u.value,u=u.next;return o},n.prototype.toArrayReverse=function(){for(var o=new Array(this.length),l=0,u=this.tail;u!==null;l++)o[l]=u.value,u=u.prev;return o},n.prototype.slice=function(o,l){(l=l||this.length)<0&&(l+=this.length),(o=o||0)<0&&(o+=this.length);var u=new n;if(l<o||l<0)return u;o<0&&(o=0),l>this.length&&(l=this.length);for(var m=0,R=this.head;R!==null&&m<o;m++)R=R.next;for(;R!==null&&m<l;m++,R=R.next)u.push(R.value);return u},n.prototype.sliceReverse=function(o,l){(l=l||this.length)<0&&(l+=this.length),(o=o||0)<0&&(o+=this.length);var u=new n;if(l<o||l<0)return u;o<0&&(o=0),l>this.length&&(l=this.length);for(var m=this.length,R=this.tail;R!==null&&m>l;m--)R=R.prev;for(;R!==null&&m>o;m--,R=R.prev)u.push(R.value);return u},n.prototype.reverse=function(){for(var o=this.head,l=this.tail,u=o;u!==null;u=u.prev){var m=u.prev;u.prev=u.next,u.next=m}return this.head=l,this.tail=o,this};try{r(223)(n)}catch{}},function(e,t,r){e.exports=function(n){n.prototype[Symbol.iterator]=function*(){for(let i=this.head;i;i=i.next)yield i.value}}},function(e,t,r){(function(n){(function(){var i,g,s,o,l,u;typeof performance!="undefined"&&performance!==null&&performance.now?e.exports=function(){return performance.now()}:n!=null&&n.hrtime?(e.exports=function(){return(i()-l)/1e6},g=n.hrtime,o=(i=function(){var m;return 1e9*(m=g())[0]+m[1]})(),u=1e9*n.uptime(),l=o-u):Date.now?(e.exports=function(){return Date.now()-s},s=Date.now()):(e.exports=function(){return new Date().getTime()-s},s=new Date().getTime())}).call(this)}).call(this,r(2))},function(e,t,r){var n,i,g=r(96),s=r(97),o=0,l=0;e.exports=function(u,m,R){var y=m&&R||0,S=m||[],c=(u=u||{}).node||n,w=u.clockseq!==void 0?u.clockseq:i;if(c==null||w==null){var E=g();c==null&&(c=n=[1|E[0],E[1],E[2],E[3],E[4],E[5]]),w==null&&(w=i=16383&(E[6]<<8|E[7]))}var P=u.msecs!==void 0?u.msecs:new Date().getTime(),F=u.nsecs!==void 0?u.nsecs:l+1,M=P-o+(F-l)/1e4;if(M<0&&u.clockseq===void 0&&(w=w+1&16383),(M<0||P>o)&&u.nsecs===void 0&&(F=0),F>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");o=P,l=F,i=w;var A=(1e4*(268435455&(P+=122192928e5))+F)%4294967296;S[y++]=A>>>24&255,S[y++]=A>>>16&255,S[y++]=A>>>8&255,S[y++]=255&A;var p=P/4294967296*1e4&268435455;S[y++]=p>>>8&255,S[y++]=255&p,S[y++]=p>>>24&15|16,S[y++]=p>>>16&255,S[y++]=w>>>8|128,S[y++]=255&w;for(var N=0;N<6;++N)S[y+N]=c[N];return m||s(S)}},function(e,t,r){var n=r(96),i=r(97);e.exports=function(g,s,o){var l=s&&o||0;typeof g=="string"&&(s=g==="binary"?new Array(16):null,g=null);var u=(g=g||{}).random||(g.rng||n)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,s)for(var m=0;m<16;++m)s[l+m]=u[m];return s||i(u)}},function(e,t,r){(function(n){(function(i){function g(o){if((o=o===void 0?"utf-8":o)!=="utf-8")throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+o+"') is invalid.")}function s(o,l){if(l=l===void 0?{fatal:!1}:l,(o=o===void 0?"utf-8":o)!=="utf-8")throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+o+"') is invalid.");if(l.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}if(i.TextEncoder&&i.TextDecoder)return!1;Object.defineProperty(g.prototype,"encoding",{value:"utf-8"}),g.prototype.encode=function(o,l){if((l=l===void 0?{stream:!1}:l).stream)throw Error("Failed to encode: the 'stream' option is unsupported.");l=0;for(var u=o.length,m=0,R=Math.max(32,u+(u>>1)+7),y=new Uint8Array(R>>3<<3);l<u;){var S=o.charCodeAt(l++);if(55296<=S&&56319>=S){if(l<u){var c=o.charCodeAt(l);(64512&c)==56320&&(++l,S=((1023&S)<<10)+(1023&c)+65536)}if(55296<=S&&56319>=S)continue}if(m+4>y.length&&(R+=8,R=(R*=1+l/o.length*2)>>3<<3,(c=new Uint8Array(R)).set(y),y=c),(4294967168&S)==0)y[m++]=S;else{if((4294965248&S)==0)y[m++]=S>>6&31|192;else if((4294901760&S)==0)y[m++]=S>>12&15|224,y[m++]=S>>6&63|128;else{if((4292870144&S)!=0)continue;y[m++]=S>>18&7|240,y[m++]=S>>12&63|128,y[m++]=S>>6&63|128}y[m++]=63&S|128}}return y.slice(0,m)},Object.defineProperty(s.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(s.prototype,"fatal",{value:!1}),Object.defineProperty(s.prototype,"ignoreBOM",{value:!1}),s.prototype.decode=function(o,l){if((l=l===void 0?{stream:!1}:l).stream)throw Error("Failed to decode: the 'stream' option is unsupported.");l=0;for(var u=(o=new Uint8Array(o)).length,m=[];l<u;){var R=o[l++];if(R===0)break;if((128&R)==0)m.push(R);else if((224&R)==192){var y=63&o[l++];m.push((31&R)<<6|y)}else if((240&R)==224){y=63&o[l++];var S=63&o[l++];m.push((31&R)<<12|y<<6|S)}else(248&R)==240&&(65535<(R=(7&R)<<18|(y=63&o[l++])<<12|(S=63&o[l++])<<6|63&o[l++])&&(R-=65536,m.push(R>>>10&1023|55296),R=56320|1023&R),m.push(R))}return String.fromCharCode.apply(null,m)},i.TextEncoder=g,i.TextDecoder=s})(typeof window!="undefined"?window:n!==void 0?n:this)}).call(this,r(5))},function(e,t,r){r.r(t),r.d(t,"AuthClient",function(){return g}),r.d(t,"RtcSignalingClient",function(){return o}),r.d(t,"Credentials",function(){return w}),r.d(t,"SignalingPromiseClient",function(){return E.SignalingPromiseClient}),r.d(t,"IRtcClientConfiguration",function(){}),r.d(t,"IRtcConnectConfiguration",function(){}),r.d(t,"IRtcConnectionStatsInfo",function(){}),r.d(t,"IRtcSendConfiguration",function(){}),r.d(t,"IRtcSessionMetricsMessageCounts",function(){}),r.d(t,"IRtcStreamMessage",function(){}),r.d(t,"IStreamControl",function(){}),r.d(t,"RtcClient",function(){return se});var n=r(26),i=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class g extends n.a{adminSignup(z,Z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/admin-signup",{token:Z,method:"POST",body:JSON.stringify(z)})})}login(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/login",{method:"POST",body:JSON.stringify(z),allowUnsafeRetries:!0})})}loginWithGoogleToken(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/login-google",{method:"POST",body:JSON.stringify(z),allowUnsafeRetries:!0})})}refresh(z,Z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/refresh",{method:"POST",body:JSON.stringify({refreshToken:z,tokenExpirationSeconds:Z}),allowUnsafeRetries:!0})})}respondToNewPasswordRequiredChallenge(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/respond-to-new-password-required-challenge",{method:"POST",body:JSON.stringify(z)})})}forgotPassword(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/forgot-password",{method:"POST",body:JSON.stringify({email:z})})})}confirmForgotPassword(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/confirm-forgot-password",{method:"POST",body:JSON.stringify(z)})})}resendInvitation(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/resend-invitation",{method:"POST",body:JSON.stringify({email:z})})})}changePassword({token:z,refreshToken:Z,currentPassword:te,newPassword:ge}){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/change-password",{token:z,method:"POST",body:JSON.stringify({refreshToken:Z,currentPassword:te,newPassword:ge})})})}getDeviceCredentials(z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/device-credentials",{token:z,method:"POST",allowUnsafeRetries:!0})})}impersonate(z,Z){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/impersonate",{token:z,method:"POST",allowUnsafeRetries:!0,body:JSON.stringify({userId:Z})})})}createServiceAccount(z,Z,te){return i(this,void 0,void 0,function*(){return yield this.fetch("auth/service-account",{token:z,method:"POST",allowUnsafeRetries:!0,body:JSON.stringify({name:Z,roleId:te})})})}getFeatures(z){return i(this,void 0,void 0,function*(){return(yield this.fetch("auth/features",{token:z})).features})}}var s=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class o extends n.a{createPeer(z,Z){return s(this,void 0,void 0,function*(){return yield this.fetch("peers",{token:z,method:"POST",body:JSON.stringify(Z)})})}getPeers(z){return s(this,void 0,void 0,function*(){return(yield this.fetch("peers",{token:z})).items})}refreshPeer(z,Z){return s(this,void 0,void 0,function*(){yield this.fetch(`peers/${Z}/refresh`,{token:z,method:"POST",allowUnsafeRetries:!0})})}createSession(z,Z){return s(this,void 0,void 0,function*(){return yield this.fetch("sessions",{token:z,method:"POST",body:JSON.stringify(Z)})})}refreshSession(z,Z){return s(this,void 0,void 0,function*(){yield this.fetch(`sessions/${Z}/refresh`,{token:z,method:"POST",allowUnsafeRetries:!0})})}deleteSession(z,Z){return s(this,void 0,void 0,function*(){yield this.fetch(`sessions/${Z}`,{token:z,method:"DELETE",allowUnsafeRetries:!0})})}getSessions(z){return s(this,void 0,void 0,function*(){return(yield this.fetch("sessions",{token:z})).items})}getIceServers(z){return s(this,void 0,void 0,function*(){return(yield this.fetch("ice-servers",{token:z})).items})}addSignals(z,Z,te){return s(this,void 0,void 0,function*(){yield this.fetch(`sessions/${Z}/add-signals`,{token:z,method:"POST",body:JSON.stringify(te)})})}takeSignals(z,Z){return s(this,void 0,void 0,function*(){return(yield this.fetch(`sessions/${Z}/take-signals`,{token:z,method:"POST"})).items})}}var l=r(1),u=r(11),m=r(21),R=r(102),y=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class S extends class{constructor(z={}){this.cache=new R(z),this.stringify=z.fastStringify?JSON.stringify:m}set(z,Z,te){if(!this.cache.set(this.stringify(z),Z,te))throw Error(`Value too large (${this.cache.lengthCalculator(Z)} > ${this.cache.max})`)}get(z){return this.cache.get(this.stringify(z))}del(z){this.cache.del(this.stringify(z))}length(){return this.cache.length}reset(){this.cache.reset()}prune(){return this.cache.prune()}forEach(z){return this.cache.forEach(z)}}{constructor(z={}){if(super(z),this.expireRejectedPromiseValues=z.expireRejectedPromiseValues===void 0||z.expireRejectedPromiseValues,this.rejectedPromiseValueTtl=z.rejectedPromiseValueTtl!==void 0?z.rejectedPromiseValueTtl:l.a.second,this.rejectedPromiseValueTtl<0)throw new Error("rejectedPromiseValueTtl must not be negative")}set(z,Z,te){const ge=this.stringify(z);this.cache.set(ge,Z,te),this.expireRejectedPromiseValues&&Promise.resolve(Z).catch(()=>y(this,void 0,void 0,function*(){yield Object(u.a)(this.rejectedPromiseValueTtl),this.cache.peek(ge)===Z&&this.cache.del(ge)}))}}var c=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class w{constructor(z,Z,te){this.authClient=z,this.email=Z,this.password=te,this.tokenTtlMs=1*l.a.hour,this.tokenCache=new S({max:100,maxAge:this.tokenTtlMs-5*l.a.minute,fastStringify:!0})}getToken(){return c(this,void 0,void 0,function*(){let z=this.tokenCache.get(this.email);return z||(z=(()=>c(this,void 0,void 0,function*(){const{authentication:Z}=yield this.authClient.login({email:this.email,password:this.password,tokenExpirationSeconds:this.tokenTtlMs/l.a.second});if(!Z)throw new Error("User account not verified.");return Z.accessToken}))(),this.tokenCache.set(this.email,z)),z})}}var E=r(93),P=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};function F(oe){return P(this,void 0,void 0,function*(){return(yield Promise.all(oe.map(z=>z.catch(Z=>Z)))).filter(z=>z instanceof Error)})}function M(oe){if(oe!==void 0)return oe;throw new Error("Value is undefined")}var A=r(0),p=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};function N({func:oe,delay:z,immediate:Z}){let te=!1,ge=setTimeout(function he(){return p(this,void 0,void 0,function*(){if(te)return;const de=new Date().getTime();try{ie=oe(),yield ie}finally{if(!te){const me=new Date().getTime();ge=setTimeout(he,Math.max(z-(me-de),0))}}})},Z?0:z),ie=Promise.resolve();return{stop(){return p(this,void 0,void 0,function*(){te=!0,clearTimeout(ge),yield ie})}}}function $(oe,z){return Object.keys(oe).reduce((Z,te)=>Object.assign(Object.assign({},Z),{[te]:z(oe[te])}),{})}var q=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class h{constructor(z){this.message=z}send(z){return q(this,void 0,void 0,function*(){A.a.info(this.message,$(z,Z=>{const{sum:te,count:ge}=Z,ie=te/ge;return Object.assign(Object.assign({},Z),{average:ie})}))})}}var d=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};const O=r(224),_=!!r(7).c,x=new class{constructor(oe=60){this.buffer={},this.metrics={},this.reporters=[],this.flushInterval=N({func:()=>this.flushStats(),delay:oe*l.a.second})}shutdown(){return d(this,void 0,void 0,function*(){yield this.flushInterval.stop(),yield this.flushStats(),yield Object(u.a)(2*l.a.second)})}aggregate(oe,z){if(this.buffer[oe]){const{min:Z,max:te,sum:ge,count:ie}=this.buffer[oe];this.buffer[oe]={min:Math.min(Z,z),max:Math.max(te,z),sum:ge+z,count:ie+1}}else this.buffer[oe]={min:z,max:z,sum:z,count:1}}increment(oe){this.aggregate(oe,1)}timer(oe,z){return d(this,void 0,void 0,function*(){const Z=O(),te=yield z(),ge=O();return this.aggregate(oe,ge-Z),te})}metric(oe,z){this.metrics[oe]=z}registerStatsReporter(oe){this.reporters.push(oe)}write(oe){return d(this,void 0,void 0,function*(){if(Object.values(oe).length===0)return;const z=yield F(this.reporters.map(Z=>Z.send(oe)));for(const Z of z)A.a.warn("Failed to write stats",{error:Z})})}flushStats(){return d(this,void 0,void 0,function*(){const oe=Object.assign(Object.assign({},this.buffer),$(this.metrics,z=>{const Z=z();return{min:Z,max:Z,sum:Z,count:1}}));Object.keys(oe).length>0&&(yield this.write(oe),this.buffer={})})}};_||x.registerStatsReporter(new h("stats"));var D=r(8),L=r(22),T=r(103),C=r(36),U=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class b extends C.a{constructor(z){super(z)}postLanRtcOffer(z){return U(this,void 0,void 0,function*(){return yield this.fetch("v1/lan-rtc-offer",{method:"POST",body:JSON.stringify(z)})})}}var f=r(55);const B={ordered:!1,maxPacketLifeTime:300*l.a.millisecond},k={ordered:!0},Y={ordered:!0},K={ordered:!1,maxRetransmits:0},Q={ordered:!1,maxRetransmits:0};function G({entityId:oe,streamName:z,streamType:Z}){return`${oe}.${z}.${Z}`}var V=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class v{constructor(z,Z){this.sessionId=z,this.connection=Z,this.counts={localSent:new Map,localReceived:new Map,remoteSent:new Map,remoteReceived:new Map},this.sessionId=z,this.connection=Z}updateRemoteMessagesCounts(z){if(z.payload.streamsInfo){this.counts.remoteSent=new Map,this.counts.remoteReceived=new Map;for(const Z of z.payload.streamsInfo.items)this.counts.remoteSent.set(Z.streamId,Z.sentCount),this.counts.remoteReceived.set(Z.streamId,Z.receivedCount)}}getLocalStreamsInfo(z){const{localSent:Z,localReceived:te}=this.counts;return{items:[...new Set([...Z.keys(),...te.keys()])].map(ge=>{var ie,he;return{streamId:ge,sentCount:(ie=Z.get(ge))!==null&&ie!==void 0?ie:0,receivedCount:(he=te.get(ge))!==null&&he!==void 0?he:0}}),timestamp:z}}incrementLocalSent(z){const{localSent:Z}=this.counts,te=G(z.header.stream);Z.set(te,(Z.get(te)||0)+1)}incrementLocalReceived(z){const{localReceived:Z}=this.counts,te=G(z.header.stream),ge=Z.get(te)||0;if(ge===0){const{streamName:ie,streamType:he}=z.header.stream;A.a.debug("RTC client received first message for stream",{streamName:ie,streamType:he})}Z.set(te,ge+1)}uploadMetrics(){return V(this,void 0,void 0,function*(){const{sessionId:z}=this,Z=yield this.connection.peerConnection.getStats(),te={};Z.forEach(fe=>te[fe.id]=fe),A.a.debug("rtc-stats",Object.assign(Object.assign({},te),{sessionId:z}));const{localSent:ge,localReceived:ie,remoteSent:he,remoteReceived:de}=this.counts,me=[...new Set([...ge.keys(),...ie.keys()])].reduce((fe,ue)=>{const _e=ge.get(ue),Se=ie.get(ue),Oe=he.get(ue),Pe=de.get(ue);return Object.assign(Object.assign({},fe),{[`local-${ue}-sent`]:_e,[`local-${ue}-received`]:Se,[`remote-${ue}-sent`]:Oe,[`remote-${ue}-received`]:Pe})},{sessionId:z});A.a.debug("rtc-message-report",Object.assign({deviceId:this.connection.getRemoteDeviceId()},me))})}}function j(oe){return new Set(["disconnected","failed","closed"]).has(oe.iceConnectionState)}var W=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class ee{constructor(z,Z,te){this.peerConnection=z,this.config=Z,this.dataChannelNotifier=te,this.connectTimeoutMs=20*l.a.second,this.iceGatheringTimeoutMs=15*l.a.second,this.pingUpdateTimeoutMs=1*l.a.second,this.streamsInfoUpdateTimeoutMs=2*l.a.second,this.reassemblyTimeoutMs=500*l.a.millisecond,this.reassemblyTableCleanupMs=1*l.a.second,this.heartbeatTimeoutMs=20*l.a.millisecond,this.streamLatestTimestamp=new Map,this.reassemblyTable=new Map,this.reassemblyTableLastTimestamp=new Map,this.closeCalled=!1,this.gotOffer=!1,this.hasIceCandidate=!1;const{isOffer:ge}=Z.baseConfig;ge?this.initializeChannels(z):z.ondatachannel=ie=>{switch(ie.channel.label){case"stream.latest-ttl":this.latestTtlStreamChannel=ie.channel;break;case"stream.reliable":this.reliableStreamChannel=ie.channel;break;case"stream.latest-reliable":this.latestReliableStreamChannel=ie.channel;break;case"stream.latest-try-once":this.latestTryOnceStreamChannel=ie.channel;break;case"heartbeat":return void(this.heartbeatChannel=ie.channel);default:return void this.dataChannelNotifier(ie.channel)}this.setupChannel(ie.channel)},this.pingUpdateTimeout=setInterval(()=>{const{reliableStreamChannel:ie}=this;ie&&this.sendSystemMessage(ie,{type:"ping"})},this.pingUpdateTimeoutMs),this.streamsInfoUpdateTimeout=setInterval(()=>{const{latestTtlStreamChannel:ie}=this;ie&&this.sendSystemMessage(ie,{type:"streams-info"})},this.streamsInfoUpdateTimeoutMs),this.reassemblyTableCleanupTimeout=setInterval(()=>{const ie=new Date().getTime();this.reassemblyTableLastTimestamp.forEach((he,de,me)=>{ie>de+this.reassemblyTimeoutMs&&this.reassemblyTable.delete(he)})},this.reassemblyTableCleanupMs),this.heartbeatTimeout=setInterval(()=>{const{heartbeatChannel:ie}=this;ie&&ie.readyState==="open"&&ie.send(new Uint8Array([1]))},this.heartbeatTimeoutMs)}handleSignal(z){return W(this,void 0,void 0,function*(){const{peerConnection:Z}=this,{track:te}=this.config.baseConfig,ge=(()=>{try{return JSON.parse(z.getPayload())}catch{return}})();if(!ge)return void A.a.error("Received unparseable signal.");A.a.debug("Handling signal",{description:ge});const{sdp:ie,type:he}=ge;if(!ie||!he)return void A.a.warn("Received non-SDP signal");const{signalingState:de,connectionState:me}=Z;if(de!=="stable"||me!=="connected")if(Z.remoteDescription)A.a.warn(`Received SDP after remote description was set: ${ie}`);else{if(he==="offer"){if(de!=="stable")return void A.a.warn("Received offer SDP when signaling is ongoing.");yield Z.setRemoteDescription(ge);const fe=yield Z.createAnswer();yield Z.setLocalDescription(fe);const ue=z.clone();return te==null||te("Answer Received",ue),ue.setPayload(JSON.stringify(fe)),ue.setReceiverId(z.getSenderId()),ue.setSenderId(z.getReceiverId()),ue}if(he==="answer"){if(de==="stable")return void A.a.warn("Received answer SDP when signaling hasn't started.");yield Z.setRemoteDescription(ge)}}else A.a.warn(`Received SDP when already connected: ${ie}`)})}send(z,Z){const te=this.getChannelFromLabel(Z.channelLabel);te?this.sendOnChannel(te,z):A.a.warn("Send called with unexpected channel label",{channelLabel:Z.channelLabel})}controlRemoteStream(z){this.sendSystemMessage(M(this.reliableStreamChannel),{type:"stream-control",streamControl:z})}isActive(){return new Set(["new","checking","connected","completed"]).has(this.peerConnection.iceConnectionState)||this.isReady()}isReady(){const{reliableStreamChannel:z,latestTtlStreamChannel:Z,latestTryOnceStreamChannel:te,latestReliableStreamChannel:ge}=this;return(z==null?void 0:z.readyState)==="open"&&(Z==null?void 0:Z.readyState)==="open"&&(te==null?void 0:te.readyState)==="open"&&(ge==null?void 0:ge.readyState)==="open"}close(){return W(this,void 0,void 0,function*(){if(this.closeCalled)return;this.closeCalled=!0,this.sessionMetrics&&(yield this.sessionMetrics.uploadMetrics()),this.pingUpdateTimeout&&clearInterval(this.pingUpdateTimeout),this.reassemblyTableCleanupTimeout&&clearInterval(this.reassemblyTableCleanupTimeout),this.streamsInfoUpdateTimeout&&clearInterval(this.streamsInfoUpdateTimeout),this.heartbeatTimeout&&clearInterval(this.heartbeatTimeout);const{peerConnection:z,reliableStreamChannel:Z,latestTtlStreamChannel:te,latestTryOnceStreamChannel:ge,latestReliableStreamChannel:ie}=this;z.close(),Z==null||Z.close(),te==null||te.close(),ge==null||ge.close(),ie==null||ie.close()})}getPing(){return this.pingTimeMs}getLastMessageTimestamp(){return this.lastMessageTimestamp}getSessionCreatedTimestamp(){var z;return(z=this.config.remoteConfig)===null||z===void 0?void 0:z.sessionCreatedTimestamp}setSessionCreatedTimestamp(z){this.config.remoteConfig&&(this.config.remoteConfig.sessionCreatedTimestamp=z)}getSessionId(){var z;return(z=this.config.remoteConfig)===null||z===void 0?void 0:z.sessionId}setSessionId(z){this.config.remoteConfig&&(this.config.remoteConfig.sessionId=z,this.sessionMetrics=new v(z,this))}getRemotePeerId(){return this.config.baseConfig.remotePeerId}getRemoteDeviceId(){var z;return(z=this.config.baseConfig)===null||z===void 0?void 0:z.remoteDeviceId}setRemoteDeviceId(z){this.config.baseConfig.remoteDeviceId=z}getSessionMetricsMessageCounts(){var z;return(z=this.sessionMetrics)===null||z===void 0?void 0:z.counts}getConnectionStatsInfo(){return W(this,void 0,void 0,function*(){const{peerConnection:z}=this;if(!z)return;const Z=yield z.getStats(null),te=[];Z.forEach(me=>{te.push(me)});const ge=te.find(me=>me.type==="transport");if(!ge)return;const ie=te.find(me=>(me.type==="candidate-pair"||me.type==="candidatepair")&&me.id===ge.selectedCandidatePairId);if(!ie)return;const he=te.find(me=>me.id===ie.localCandidateId),de=te.find(me=>me.id===ie.remoteCandidateId);return he&&de&&(he.address=he.address||he.ip,de.address=de.address||de.ip,he.address!==void 0&&de.address!==void 0)?{transport:ge,localCandidate:he,remoteCandidate:de}:void 0})}initializeChannels(z){this.heartbeatChannel=z.createDataChannel("heartbeat",Q),this.heartbeatChannel.binaryType="arraybuffer",this.latestTtlStreamChannel=z.createDataChannel("stream.latest-ttl",B),this.latestTtlStreamChannel.binaryType="arraybuffer",this.reliableStreamChannel=z.createDataChannel("stream.reliable",k),this.reliableStreamChannel.binaryType="arraybuffer",this.latestReliableStreamChannel=z.createDataChannel("stream.latest-reliable",Y),this.latestReliableStreamChannel.binaryType="arraybuffer",this.latestTryOnceStreamChannel=z.createDataChannel("stream.latest-try-once",K),this.latestTryOnceStreamChannel.binaryType="arraybuffer",this.setupChannel(this.latestTtlStreamChannel),this.setupChannel(this.reliableStreamChannel),this.setupChannel(this.latestReliableStreamChannel),this.setupChannel(this.latestTryOnceStreamChannel)}getOffer(){var z,Z,te;return W(this,void 0,void 0,function*(){const{gotOffer:ge}=this,{peerConnection:ie,config:he}=this;if(this.config.baseConfig.isLan)throw new Error('"getOffer" method can only be called with internet connections. LAN connections should call the "getLanOffer" method.');const de=(z=this.config.remoteConfig)===null||z===void 0?void 0:z.sessionId;if(ge)return void A.a.debug("Failed to generate offer because gotOffer was already called.");if(this.gotOffer=!0,j(this.peerConnection))return void A.a.debug("Failed to generate offer because the peer connection was inactive.");const me=he.baseConfig.track;ie.onicecandidate=()=>{this.hasIceCandidate=!0},ie.oniceconnectionstatechange=()=>W(this,void 0,void 0,function*(){const Oe=ie.iceConnectionState;if(Oe==="connected"||Oe==="completed"){const Pe=yield this.getConnectionStatsInfo(),Fe=Pe?function(De){const Le=De.localCandidate.candidateType,xe=De.remoteCandidate.candidateType;return Le==="host"&&xe==="host"?"local":Le==="relay"||xe==="relay"?"TURN":"STUN"}(Pe):void 0;A.a.info(`ICE connection state changed to ${Oe}`,{sessionId:de,connectionStatsInfo:Pe,iceMode:Fe}),me==null||me("ICE connection state change",{iceConnectionState:Oe,sessionId:de,connectionStatsInfo:Pe,iceMode:Fe})}}),yield ie.setLocalDescription(yield ie.createOffer());const fe=new Date().getTime();for(;;){const Oe=new Date().getTime()-fe;if(Oe>this.connectTimeoutMs)return void A.a.debug("Failed to generate offer because ICE gathering timed out.");if(Oe>this.iceGatheringTimeoutMs&&this.hasIceCandidate){A.a.debug("ICE gathering partially completed; proceeding",{iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe}),me==null||me("ICE gathering partially completed",{sessionId:de,iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe});break}if(ie.iceGatheringState==="complete"){A.a.debug("ICE gathering complete",{iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe}),me==null||me("ICE gathering completed",{sessionId:de,iceTransportPolicy:ie.getConfiguration().iceTransportPolicy,waitTime:Oe});break}yield Object(u.a)(.1*l.a.second)}const ue=(Z=this.peerConnection.getConfiguration().iceServers)!==null&&Z!==void 0?Z:[];for(const Oe of ue)Oe.credentialType=void 0;const _e=JSON.stringify(ue),Se=new D.Signal;return Se.setPayload(JSON.stringify(ie.localDescription)),Se.setSenderId(this.config.baseConfig.localPeerId),Se.setReceiverId(this.config.baseConfig.remotePeerId),Se.setIceServers(_e),Se.setIceTransportPolicy((te=this.peerConnection.getConfiguration().iceTransportPolicy)!==null&&te!==void 0?te:"all"),Se.setSessionType(D.SessionType.TELEOP),A.a.debug("Sending offer signal with description",{description:Se.getPayload()}),Se})}getLanOffer(){return W(this,void 0,void 0,function*(){const{peerConnection:z,gotOffer:Z}=this;if(!this.config.baseConfig.isLan)throw new Error('"getLanOffer" method can only be used with LAN connections. Internet connections should call the "getOffer" method.');if(Z)return void A.a.debug("Failed to generate offer because gotOffer was already called.");if(this.gotOffer=!0,j(this.peerConnection))return void A.a.debug("Failed to generate offer because the peer connection was inactive.");yield z.setLocalDescription(yield z.createOffer());const te=new Date().getTime();for(;;){if(new Date().getTime()-te>this.iceGatheringTimeoutMs)return void A.a.debug("Failed to generate offer because ICE gathering timed out.");if(z.iceGatheringState==="complete")break;yield Object(u.a)(.1*l.a.second)}const ge=z.localDescription;if(ge)return A.a.debug("Sending LAN offer signal with description",{description:ge}),ge;A.a.error("Failed to generate LAN offer description")})}handleLanAnswer(z){return W(this,void 0,void 0,function*(){const{peerConnection:Z}=this;if(!this.config.baseConfig.isLan)throw new Error('"handleLanAnswer" method can only be used with LAN connections. Internet connections should call the "handleSignal" method.');yield Z.setRemoteDescription(z)})}getChannelFromLabel(z){switch(z){case"stream.latest-ttl":return this.latestTtlStreamChannel;case"stream.reliable":return this.reliableStreamChannel;case"stream.latest-reliable":return this.latestReliableStreamChannel;case"stream.latest-try-once":return this.latestTryOnceStreamChannel}}sendOnChannel(z,Z){let te;try{te=Object(f.encode)(JSON.stringify(Z))}catch(ge){return void A.a.warn("Failed to encode RTC message",{error:ge})}try{z.send(te),this.sessionMetrics&&this.sessionMetrics.incrementLocalSent(Z)}catch(ge){A.a.warn("Failed to send message to channel",{error:ge,channel:z.label})}}channelNotRecognized(z){return z!==this.latestTtlStreamChannel&&z!==this.latestReliableStreamChannel&&z!==this.latestTryOnceStreamChannel&&z!==this.reliableStreamChannel}setupChannel(z){z.onmessage=Z=>{if(this.channelNotRecognized(z))return void A.a.warn("Received message on unrecognized data channel.");let te;try{te=JSON.parse(Object(f.decode)(Z.data))}catch(ge){return void A.a.warn("Received unparseable message on RTC stream data channel",{error:ge,channel:z.label})}te.communicationType==="message-chunk"?this.receiveChannelMessageChunk(z,te):this.receiveChannelMessage(z,te)},z.onerror=Z=>{A.a.warn(`Channel error: ${Z.error}`,{error:Z.error,sessionId:this.getSessionId(),channelLabel:z.label})},z.onopen=()=>{A.a.debug("Channel opened",{sessionId:this.getSessionId(),channelLabel:z.label})},z.onclose=()=>{const Z={bufferedAmount:z.bufferedAmount,sessionId:this.getSessionId(),channelLabel:z.label};this.closeCalled===!1?A.a.debug("Unexpected channel closed",Z):A.a.debug("Channel closed",Z)}}receiveChannelMessage(z,Z){const{config:te}=this,{remotePeerId:ge}=this.config.baseConfig;this.lastMessageTimestamp=new Date().getTime(),Z=function(ie){switch(ie.header.stream.streamType){case"twist":const{twist:he}=ie.payload;if(!he)throw Error("twist not in payload of RTC message with type twist");return{header:ie.header,payload:{twist:{linear:Object.assign({x:0,y:0,z:0},he.linear),angular:Object.assign({x:0,y:0,z:0},he.angular)}}};case"pose":const{pose:de}=ie.payload;if(!de)throw Error("pose not in payload of RTC message with type pose");return{header:ie.header,payload:{pose:{translation:Object.assign({x:0,y:0,z:0},de.translation),rotation:Object.assign({x:0,y:0,z:0,w:0},de.rotation)}}};case"pose-with-covariance":const{poseWithCovariance:me}=ie.payload;if(!me)throw Error("poseWithCovariance not in payload of RTC message with type pose-with-covariance");const fe=new Array(36).fill(0);return me.covariance.forEach((_e,Se)=>{if(Se>=36)throw Error("covariance contains more than 36 elements");fe[Se]=_e}),{header:ie.header,payload:{poseWithCovariance:{pose:{translation:Object.assign({x:0,y:0,z:0},me.pose.translation),rotation:Object.assign({x:0,y:0,z:0,w:0},me.pose.rotation)},covariance:fe}}};case"point":const{point:ue}=ie.payload;if(!ue)throw Error("point not in payload of RTC message with type point");return{header:ie.header,payload:{point:Object.assign({x:0,y:0,z:0},ue)}};default:return ie}}(Z),this.sessionMetrics&&this.sessionMetrics.incrementLocalReceived(Z),this.handleSystemMessage(z,Z)||(z===this.latestTryOnceStreamChannel||z===this.latestTtlStreamChannel||z===this.latestReliableStreamChannel)&&!this.isLatestMessage(Z)||te.baseConfig.receive(ge,Z)}receiveChannelMessageChunk(z,Z){const te=this.reassemblyTable.get(Z.id)||[];if(te.push(Z),te.length===Z.total){const ge=function(ie){const he=ie.sort((de,me)=>de.seq<me.seq?-1:1).map(de=>de.part).reduce((de,me)=>de+me);try{return JSON.parse(he)}catch{return void A.a.warn("Could not reassemble RTC message chunks")}}(te);return ge&&this.receiveChannelMessage(z,ge),void this.reassemblyTable.delete(Z.id)}this.reassemblyTable.set(Z.id,te),this.reassemblyTableLastTimestamp.set(Z.id,new Date().getTime())}handleSystemMessage(z,Z){var te,ge;const{config:ie}=this,{baseConfig:he}=ie,{remotePeerId:de}=he;switch(Z.header.stream.streamType){case"ping":return this.sendSystemMessage(z,{type:"pong",timestamp:M(Z.payload.ping)}),!0;case"pong":const me=new Date().getTime()-M(Z.payload.pong);return this.pingTimeMs=me,x.aggregate("rtc-ping-time",me),!0;case"streams-info":const{sessionMetrics:fe}=this,ue=(te=Z.payload.streamsInfo)===null||te===void 0?void 0:te.timestamp;return!!ue&&(fe==null||fe.updateRemoteMessagesCounts(Z),(ge=he.onStreamsInfoUpdate)===null||ge===void 0||ge.call(he,de,ue),!0);case"stream-control":return!0;default:return!1}}sendSystemMessage(z,Z){var te;const{localUserId:ge,localPeerId:ie}=this.config.baseConfig;if(z.readyState!=="open")return;const he={entityId:ge!=null?ge:ie,streamName:`$.${Z.type}`,streamType:Z.type};let de;switch(Z.type){case"ping":de={ping:new Date().getTime()};break;case"pong":de={pong:Z.timestamp};break;case"stream-control":de={streamControl:Z.streamControl};break;case"streams-info":de={streamsInfo:(te=this.sessionMetrics)===null||te===void 0?void 0:te.getLocalStreamsInfo(new Date().getTime())}}this.sendOnChannel(z,function(me,fe){return{header:{stream:me,created:Date.now(),frameId:""},payload:fe}}(he,de))}isLatestMessage(z){const Z=G(z.header.stream),te=(this.streamLatestTimestamp.get(Z)||0)<=z.header.created;return te&&this.streamLatestTimestamp.set(Z,z.header.created),te}}function J(oe){var z,Z;return{userId:(z=oe.getUserId())===null||z===void 0?void 0:z.getValue(),deviceId:(Z=oe.getDeviceId())===null||Z===void 0?void 0:Z.getValue(),organizationId:oe.getOrganizationId(),id:oe.getPeerId(),capabilities:[],capabilitySet:{}}}var re=function(oe,z,Z,te){return new(Z||(Z=Promise))(function(ge,ie){function he(fe){try{me(te.next(fe))}catch(ue){ie(ue)}}function de(fe){try{me(te.throw(fe))}catch(ue){ie(ue)}}function me(fe){var ue;fe.done?ge(fe.value):(ue=fe.value,ue instanceof Z?ue:new Z(function(_e){_e(ue)})).then(he,de)}me((te=te.apply(oe,z||[])).next())})};class se{constructor(z){this.config=z,this.grpcCallDeadline=5*l.a.second,this.refreshIntervalDelayMs=2*l.a.second,this.iceServersTtl=30*l.a.minute,this.connections=[],this.localConnections=[],this.isConnectionInitiator=new Map,this.isOutgoingConnection=new Map,this.peerDataChannelListeners=[];const{refreshIntervalDelayMs:Z}=this;this.refreshInterval=N({func:()=>re(this,void 0,void 0,function*(){try{yield this.update()}catch(te){A.a.warn("RTC refresh failed",{error:te})}}),delay:Z,immediate:!0})}send(z,Z,te){const ge=this.getActiveConnection(z);ge?ge.isReady()?ge.send(Z,te):A.a.warn("Send called with unready connection."):A.a.warn("Send called with no connection.")}controlRemoteStream(z,Z){const te=this.getActiveConnection(z);te?te.isReady()?te.controlRemoteStream(Z):A.a.warn("controlRemoteStream called with unready connection."):A.a.warn("controlRemoteStream called with no connection.")}getLocalPeer(){return re(this,void 0,void 0,function*(){for(;!this.localPeer;)yield Object(u.a)(.1*l.a.second);return J(this.localPeer)})}connect(z,Z){var te,ge,ie;return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode===!0)throw new Error("connect method called in local only mode.");const{track:he,signalingClient:de}=this.config,{localPeer:me,receiveSignalStream:fe,iceServers:ue}=this;if(!me||!fe||!ue)return void A.a.warn("Connect called prior to local peer, receiveSignalStream, and ICE servers ready");if(this.getActiveConnection(z))return void A.a.warn("Connect called for peer with existing connection.");if(this.isOutgoingConnection.get(z))return void A.a.warn("Connect called for peer with an existing outgoing connection offer.");this.isOutgoingConnection.set(z,!0);const _e=new ee(yield this.createRTCPeerConnection(ue,Z),{baseConfig:{isOffer:!0,isLan:!1,receive:(Le,xe)=>this.config.receive(Le,xe),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(Le,xe)=>{var Ne,Ue;return(Ue=(Ne=this.config).onStreamsInfoUpdate)===null||Ue===void 0?void 0:Ue.call(Ne,Le,xe)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localUserId:(te=me.getUserId())===null||te===void 0?void 0:te.getValue(),localPeerId:me.getPeerId(),remotePeerId:z},remoteConfig:{}},Le=>this.onCustomDataChannel(z,Le)),Se=yield _e.getOffer();if(!Se)return A.a.error("Failed to generate offer."),void this.isOutgoingConnection.delete(z);A.a.debug("Sending offer."),he==null||he("Sending offer",Se);const Oe=new D.SendSignalRequest;Oe.setSignal(Se);const Pe=yield(()=>re(this,void 0,void 0,function*(){try{return yield de.sendSignal(Oe,yield this.getMetadata({}))}catch(Le){A.a.warn("Error when sending signal",{error:Le})}}))();if(!this.isOutgoingConnection.get(z))return void A.a.debug("No offer set after receiving offer signal response.");A.a.debug("Offer sent.");const Fe=(ge=Pe==null?void 0:Pe.getSessionId())===null||ge===void 0?void 0:ge.getValue(),De=(ie=Pe==null?void 0:Pe.getSessionCreatedTimestamp())===null||ie===void 0?void 0:ie.getValue();return Fe&&De?(_e.setSessionId(Fe),_e.setSessionCreatedTimestamp(De),this.isOutgoingConnection.delete(z),this.connections.push(_e),this.isConnectionInitiator.set(_e,!0),this.setupHandlers(_e),Fe):(A.a.warn("No session ID or no session created timestamp on send signal response."),void this.isOutgoingConnection.delete(z))})}connectLan(z){var Z,te;return re(this,void 0,void 0,function*(){const ge=new b(z),ie=new ee(yield this.createRTCPeerConnection([]),{baseConfig:{isOffer:!0,isLan:!0,receive:(fe,ue)=>this.config.receive(fe,ue),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(fe,ue)=>{var _e,Se;return(Se=(_e=this.config).onStreamsInfoUpdate)===null||Se===void 0?void 0:Se.call(_e,fe,ue)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localUserId:(te=(Z=this.localPeer)===null||Z===void 0?void 0:Z.getUserId())===null||te===void 0?void 0:te.getValue(),localPeerId:"lan_client",remotePeerId:z}},fe=>this.onCustomDataChannel(z,fe)),he=yield ie.getLanOffer();if(!he)return A.a.warn("Could not generate LAN offer"),!1;const de=yield ge.postLanRtcOffer({offer:JSON.stringify(he)}),me=new RTCSessionDescription(JSON.parse(de.answer));return yield ie.handleLanAnswer(me),this.localConnections.push(ie),Object(T.v4)()})}getConnections(){return[...this.connections,...this.localConnections]}createCustomDataChannel(z,Z,te,ge,ie){const he=this.getActiveConnection(z);if(he&&this.isConnectionInitiator.has(he)){const me=he.peerConnection.createDataChannel("custom."+Z,te);return ge&&(me.binaryType="arraybuffer"),ie(z,me),()=>{}}const de=(me,fe)=>{z===me&&fe.label==="custom."+Z&&ie(z,fe)};return this.peerDataChannelListeners.push(de),()=>{this.peerDataChannelListeners=this.peerDataChannelListeners.filter(me=>me!==de)}}onCustomDataChannel(z,Z){this.peerDataChannelListeners.forEach(te=>te(z,Z))}getConnectionStatus(z){if(this.isOutgoingConnection.get(z))return"connecting";const Z=this.getActiveConnection(z);return Z?Z.isReady()?"connected":"connecting":"disconnected"}getConnectionStatsInfo(z){return re(this,void 0,void 0,function*(){const Z=this.getActiveConnection(z);if(Z)return yield Z.getConnectionStatsInfo()})}disconnect(z){return re(this,void 0,void 0,function*(){const Z=this.getActiveConnection(z);Z&&(yield Z.close())})}getPeers(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("getPeers method cannot be used in local-only mode.");const{signalingClient:z}=this.config,Z=yield(()=>re(this,void 0,void 0,function*(){try{return yield z.getPeers(new D.GetPeersRequest,yield this.getMetadata({}))}catch(ie){A.a.warn("Error when getting peers",{error:ie})}}))();if(!Z)return[];const te=Z.getPeersList();if(!te)return[];const ge=ie=>{var he,de;return(de=(he=ie.getPeerCreatedTimestamp())===null||he===void 0?void 0:he.getValue())!==null&&de!==void 0?de:0};return te.sort((ie,he)=>ge(he)-ge(ie)).map(ie=>J(ie))})}getSessions(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("getPeers method cannot be used in local-only mode.");const{signalingClient:z}=this.config,Z=yield(()=>re(this,void 0,void 0,function*(){try{return yield z.getPeers(new D.GetPeersRequest,yield this.getMetadata({}))}catch(ie){A.a.warn("Error when getting peers",{error:ie})}}))();if(!Z)return{};const te=Z.getPeersList(),ge={};for(const ie of te)ge[ie.getPeerId()]=ie.getSessionIdsList();return ge})}getPing(z){const Z=this.getActiveConnection(z);if(Z)return Z.getPing();A.a.warn("Attempted to get ping time from inactive peer.")}getLastMessageTimestamp(z){const Z=this.getActiveConnection(z);if(Z)return Z.getLastMessageTimestamp();A.a.warn("Attempted to get last message time from inactive peer.")}getSessionMetricsMessageCounts(z){const Z=this.getActiveConnection(z);if(Z)return Z.getSessionMetricsMessageCounts();A.a.warn("Attempted to get session metrics counts from inactive peer.")}isReady(){if(this.config.lanOnlyMode)return!0;const{localPeer:z,receiveSignalStream:Z,iceServers:te}=this;return!!(z&&Z&&te)}shutdown(){return re(this,void 0,void 0,function*(){A.a.info("Shutdown called on RTC client"),yield this.refreshInterval.stop(),this.receiveSignalStream&&this.receiveSignalStream.cancel();const z=this.connections;this.connections=[],yield this.closeConnections(z);const{localPeer:Z}=this;if(!Z||this.config.lanOnlyMode)return;const{signalingClient:te}=this.config;yield(()=>re(this,void 0,void 0,function*(){try{const ge=new D.DeletePeerRequest;ge.setPeerId(Z.getPeerId()),yield te.deletePeer(ge,yield this.getMetadata({}))}catch(ge){return void A.a.warn("Error deleting local peer",{error:ge})}}))()})}createPeer(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("createPeer method cannot be used in local-only mode.");const{signalingClient:z}=this.config,Z=yield(()=>re(this,void 0,void 0,function*(){try{return yield z.createPeer(new D.CreatePeerRequest,yield this.getMetadata({}))}catch(ge){throw new Error(`Was not able to create peer: ${JSON.stringify(ge)}`)}}))(),te=Z==null?void 0:Z.getPeer();if(!te)throw new Error("Response did not provide peer.");return this.localPeer=te})}createReceiveSignalStream(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("createReceiveSignalStream method cannot be used in local-only mode.");const{signalingClient:z}=this.config,{localPeer:Z,iceServers:te}=this;if(!Z||!te)return;const{receiveSignalStream:ge}=this;ge&&ge.cancel();const ie=new D.ReceiveSignalStreamRequest;ie.setPeerId(Z.getPeerId());const he=yield(()=>re(this,void 0,void 0,function*(){try{return z.receiveSignalStream(ie,yield this.getMetadata({hasDeadline:!1}))}catch(de){throw new Error(`Unable to create receive signal stream: ${JSON.stringify(de)}`)}}))();if(!he)throw new Error("Response did not provide stream.");return he.on("data",de=>re(this,void 0,void 0,function*(){var me,fe,ue,_e;const Se=de.getSignal(),Oe=(me=Se==null?void 0:Se.getSessionId())===null||me===void 0?void 0:me.getValue(),Pe=Se==null?void 0:Se.getSenderId(),Fe=Se==null?void 0:Se.getReceiverId(),De=(fe=Se==null?void 0:Se.getSessionCreatedTimestamp())===null||fe===void 0?void 0:fe.getValue();if(!(Se&&Oe&&Pe&&Fe&&De))return void A.a.warn("Received signal with missing information.");const Le=this.getActiveConnection(Pe);if(Le)if(Le.getSessionId()!==Oe){if(A.a.debug("Received signal: different session for a peer we're already connected to."),(Le.getSessionCreatedTimestamp()||0)>De)return;const xe=new ee(yield this.createRTCPeerConnection(te),{baseConfig:{isOffer:!1,isLan:!1,receive:(Ne,Ue)=>this.config.receive(Ne,Ue),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(Ne,Ue)=>{var We,ze;return(ze=(We=this.config).onStreamsInfoUpdate)===null||ze===void 0?void 0:ze.call(We,Ne,Ue)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localPeerId:Z.getPeerId(),localUserId:(_e=Z.getUserId())===null||_e===void 0?void 0:_e.getValue(),remotePeerId:Pe},remoteConfig:{sessionId:Oe,sessionCreatedTimestamp:De}},Ne=>this.onCustomDataChannel(Pe,Ne));yield xe.handleSignal(Se),this.connections.push(xe)}else A.a.debug("Received signal: for an existing connection."),yield Le.handleSignal(Se);else{A.a.debug("Received signal: new connection.");const xe=new ee(yield this.createRTCPeerConnection(te),{baseConfig:{isOffer:!1,isLan:!1,receive:(Ne,Ue)=>this.config.receive(Ne,Ue),onStreamsInfoUpdate:this.config.onStreamsInfoUpdate?(Ne,Ue)=>{var We,ze;return(ze=(We=this.config).onStreamsInfoUpdate)===null||ze===void 0?void 0:ze.call(We,Ne,Ue)}:void 0,track:this.config.lanOnlyMode?void 0:this.config.track,localPeerId:Z.getPeerId(),localUserId:(ue=Z.getUserId())===null||ue===void 0?void 0:ue.getValue(),remotePeerId:Pe},remoteConfig:{sessionId:Oe,sessionCreatedTimestamp:De}},Ne=>this.onCustomDataChannel(Pe,Ne));yield xe.handleSignal(Se),this.connections.push(xe)}})),he.on("end",()=>{he.cancel(),this.receiveSignalStream=void 0}),he.on("error",de=>{switch(de.code){case L.StatusCode.CANCELLED:case L.StatusCode.UNAVAILABLE:case L.StatusCode.UNKNOWN:A.a.debug("Receive signal stream error",{error:de});break;case L.StatusCode.UNAUTHENTICATED:A.a.warn("Receive signal stream error",{error:de});break;default:A.a.error("Receive signal stream error",{error:de})}he.cancel(),this.receiveSignalStream=void 0}),this.receiveSignalStream=he})}createRTCPeerConnection(z,Z){var te;return re(this,void 0,void 0,function*(){const ge=Z==null?void 0:Z.rtcIceTransportPolicy,ie=Z==null?void 0:Z.rtcIceServerProtocol,he=(fe,ue)=>typeof fe=="string"?fe.endsWith(`transport=${ue}`):fe.some(_e=>_e.endsWith(`transport=${ue}`)),de=z.filter(fe=>{return ge!=="relay"||(typeof(ue=fe.urls)=="string"?ue.startsWith("turn:"):ue.some(_e=>_e.startsWith("turn:")));var ue}).filter(fe=>ie!=="udp"||he(fe.urls,"udp")).filter(fe=>ie!=="tcp"||he(fe.urls,"tcp")),me=(te=this.config.alternateRTCPeerConnection)!==null&&te!==void 0?te:window.RTCPeerConnection;if(!me)throw new Error("RTCPeerConnection class not found. WebRTC must be enabled.");return new me(Object.assign({iceServers:de,iceTransportPolicy:ge},Z))})}closeConnections(z){return re(this,void 0,void 0,function*(){const Z=yield F(z.map(te=>re(this,void 0,void 0,function*(){yield te.close()})));for(const te of Z)A.a.warn("Request to close session failed",{error:te})})}getActiveConnection(z){return this.getConnections().find(Z=>Z.getRemotePeerId()===z&&Z.isActive())}update(){var z;return re(this,void 0,void 0,function*(){if(this.localConnections=this.localConnections.filter(de=>de.isActive()),this.config.lanOnlyMode)return;const{signalingClient:Z}=this.config;if(!this.localPeer||!this.receiveSignalStream||!this.iceServers)return this.localPeer||(yield this.createPeer()),this.iceServers||(yield this.updateIceServers()),void(this.receiveSignalStream||(yield this.createReceiveSignalStream()));yield this.closeConnections(this.connections.filter(de=>!de.isActive())),this.connections=this.connections.filter(de=>de.isActive());const{localPeer:te}=this,ge=this.connections.filter(de=>de.getSessionId).map(de=>M(de.getSessionId()));te.setSessionIdsList(ge);const ie=new D.RefreshPeerRequest;ie.setPeer(te);try{yield Z.refreshPeer(ie,yield this.getMetadata({}))}catch(de){de.code===L.StatusCode.NOT_FOUND?(A.a.warn("Peer expired, creating new peer",{peerId:te.getPeerId()}),yield this.reset()):A.a.warn("Error calling RefreshPeer",{error:de})}const he=yield this.getPeers();for(const de of this.connections)de.setRemoteDeviceId((z=he.find(me=>me.id===de.getRemotePeerId()))===null||z===void 0?void 0:z.deviceId)})}reset(){return re(this,void 0,void 0,function*(){yield this.closeConnections(this.connections),this.connections=[],this.isOutgoingConnection=new Map,yield this.createPeer(),yield this.createReceiveSignalStream()})}updateIceServers(){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)return;const{iceServersLastUpdate:z,iceServersTtl:Z}=this,te=new Date().getTime();if(!z||te-z>Z)try{const ge=(yield this.config.signalingClient.getIceServers(new D.GetIceServersRequest,yield this.getMetadata({}))).getIceServers();this.iceServers=JSON.parse(ge),this.iceServersLastUpdate=te}catch(ge){A.a.warn("Error in updateIceServers",{error:ge})}})}setupHandlers(z){const{peerConnection:Z}=z,te=z.getSessionCreatedTimestamp();Z.onconnectionstatechange=()=>re(this,void 0,void 0,function*(){const ge=Z.connectionState;if(te)switch(ge){case"connected":x.aggregate("rtc-connect-time",new Date().getTime()-te);break;case"failed":x.increment("rtc-connect-failed")}})}getMetadata(z){return re(this,void 0,void 0,function*(){if(this.config.lanOnlyMode)throw new Error("getMetadata method cannot be called in local-only mode");const{getToken:Z}=this.config,{grpcCallDeadline:te}=this,{hasDeadline:ge}=z,ie=ge===!1?void 0:new Date().getTime()+te;return{authorization:yield Z(),deadline:ie}})}}},,function(e,t,r){r.r(t),r.d(t,"LogClient",function(){return g});var n=r(26),i=function(s,o,l,u){return new(l||(l=Promise))(function(m,R){function y(w){try{c(u.next(w))}catch(E){R(E)}}function S(w){try{c(u.throw(w))}catch(E){R(E)}}function c(w){var E;w.done?m(w.value):(E=w.value,E instanceof l?E:new l(function(P){P(E)})).then(y,S)}c((u=u.apply(s,o||[])).next())})};class g extends n.a{log(o){return i(this,void 0,void 0,function*(){yield this.fetch("logs",{method:"POST",body:JSON.stringify({logs:o}),allowUnsafeRetries:!0})})}}}])})})(dist);let FORMANT_API_URL="https://api.formant.io";typeof window!="undefined"&&(FORMANT_API_URL=window.FORMANT_API_URL||FORMANT_API_URL);let urlParams$1=new URLSearchParams("");typeof window!="undefined"&&(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");function delay(e){return new Promise(t=>setTimeout(t,e))}function defined(e,t){if(e!==void 0)return e;throw new Error(t||"Value is undefined")}class App{static sendAppMessage(t){window.parent.postMessage(t,"*")}static getCurrentModuleContext(){let t=new URLSearchParams("");return typeof window!="undefined"&&(t=new URLSearchParams(window.location.search)),t.get("module")}static isModule(){return this.getCurrentModuleContext()!==null}static goToTime(t){this.sendAppMessage({type:"go_to_time",time:t.getTime()})}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,r){const n=this.getCurrentModuleContext();if(!n)throw new Error("No module context");this.sendAppMessage({type:"set_module_data_time_range",module:n,before:t,after:r||0})}static refreshAuthToken(){const t=this.getCurrentModuleContext();if(!t)throw new Error("No module context");this.sendAppMessage({type:"refresh_auth_token",module:t})}static setupModuleMenus(t){const r=this.getCurrentModuleContext();if(!r)throw new Error("No module context");this.sendAppMessage({type:"setup_module_menus",module:r,menus:t})}static addMenuListener(t){window.addEventListener("message",r=>{const n=r.data;n.type==="module_menu_item_clicked"&&t(n.menu)})}static addAccessTokenRefreshListener(t){window.addEventListener("message",r=>{const n=r.data;n.type==="auth_token"&&t(n.token)})}static addModuleDataListener(t){window.addEventListener("message",r=>{const n=r.data;n.type==="module_data"&&t({streams:n.streams,time:n.time,queryRange:n.queryRange})})}}const Ee=class{static async login(t,r){try{const n=await fetch(`${FORMANT_API_URL}/v1/admin/auth/login`,{method:"POST",body:JSON.stringify({email:t,password:r}),headers:{"Content-Type":"application/json"}}),i=await n.json();if(n.status!==200)throw new Error(i.message);return await Ee.loginWithToken(i.authentication.accessToken,i.authentication.refreshToken),i.authentication}catch(n){return Ee.waitingForAuth.forEach(i=>i(!1)),Ee.waitingForAuth=[],Promise.reject(n)}}static async loginWithToken(t,r){const n=JSON.parse(atob(t.split(".")[1]));try{let i;if(Ee.isShareToken=n["formant:claims"]&&n["formant:claims"].type=="share",n["formant:claims"]&&(Ee.currentOrganization=n["formant:claims"].organizationId),n["custom:organization_id"]&&(Ee.currentOrganization=n["custom:organization_id"]),Ee.isShareToken||(i=n.sub),n["formant:claims"]&&n["formant:claims"].userId&&(i=n["formant:claims"].userId),i){const g=await fetch(`${FORMANT_API_URL}/v1/admin/users/${i}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+t}}),s=await g.json();if(g.status!==200)throw new Error(s.message);Ee.currentUser=s}Ee.token=t,Ee.waitingForAuth.forEach(g=>g(!0))}catch(i){console.error(i),Ee.waitingForAuth.forEach(g=>g(!1))}Ee.waitingForAuth=[],r&&(Ee.refreshToken=r,setInterval(async()=>{if(Ee.refreshToken){const g=await(await fetch(`${FORMANT_API_URL}/v1/admin/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:Ee.refreshToken})})).json();Ee.token=g.authentication.accessToken}},1e3*60*60))}static isAuthenticated(){return Ee.token!==void 0}static getCurrentUser(){return Ee.currentUser}static async waitTilAuthenticated(){return Ee.token!==void 0?!0:new Promise(t=>{Ee.waitingForAuth.push(function(r){t(r)})})}static async listenForRefresh(){App.addAccessTokenRefreshListener(t=>{this.loginWithToken(t)}),setInterval(async()=>{App.refreshAuthToken()},1e3*60*60)}};let Authentication=Ee;Ce(Authentication,"token"),Ce(Authentication,"refreshToken"),Ce(Authentication,"currentUser"),Ce(Authentication,"currentOrganization"),Ce(Authentication,"isShareToken",!1),Ce(Authentication,"defaultDeviceId"),Ce(Authentication,"waitingForAuth",[]);class DataChannel{constructor(t){Ce(this,"ready",!1);Ce(this,"listeners",[]);Ce(this,"binaryListeners",[]);Ce(this,"error");Ce(this,"decoder",new TextDecoder);this.dataChannel=t,this.dataChannel.binaryType="arraybuffer",this.dataChannel.onopen=()=>{this.ready=!0},this.dataChannel.onclose=()=>{this.ready=!1},this.dataChannel.onerror=r=>{console.error(r),this.error="An error occurred in DataChannel"},this.dataChannel.onmessage=r=>{this.listeners.forEach(n=>{const i=new Uint8Array(r.data),g=this.decoder.decode(i);n(g)}),this.binaryListeners.forEach(n=>{n(new Uint8Array(r.data))})}}async waitTilReady(){return this.ready?!0:new Promise((r,n)=>{let i=window.setInterval(()=>{this.ready&&(window.clearInterval(i),r(!0)),this.error&&n(this.error)},10)})}send(t){if(!this.ready)throw new Error("Connection has been closed");this.dataChannel.send(t)}sendBinary(t){if(!this.ready)throw new Error("Connection has been closed");this.dataChannel.send(t)}addListener(t){this.listeners.push(t)}removeListener(t){const r=this.listeners.indexOf(t);if(r===-1)throw new Error("Could not find data channel listener to remove");if(this.error)throw new Error(this.error);this.listeners.splice(r,1)}addBinaryListener(t){this.binaryListeners.push(t)}removeBinaryListener(t){const r=this.binaryListeners.indexOf(t);if(r===-1)throw new Error("Could not find data channel listener to remove");if(this.error)throw new Error(this.error);this.binaryListeners.splice(r,1)}}class CaptureStream{constructor(t){Ce(this,"token");this.captureSession=t}async ingestJSON(t){if(!this.token){const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/capture-sessions/${this.captureSession.code}/authenticate`,{method:"POST"})).json();this.token=n.token}await fetch(`${FORMANT_API_URL}/v1/ingest`,{method:"POST",body:JSON.stringify({deviceId:this.captureSession.deviceId,name:this.captureSession.streamName,type:"json",points:[[Date.now(),JSON.stringify(t)]]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+this.token}})}}class Manipulator{constructor(t,r){Ce(this,"currentListeners",[]);Ce(this,"onRealtimeMessage",(t,r)=>{r.payload.jointState&&this.currentListeners.forEach(n=>n(r.payload.jointState))});this.device=t,this.config=r}async synchronize(){this.device.addRealtimeListener(this.onRealtimeMessage),this.device.startListeningToRealtimeDataStream(this.config.currentJointStateStream)}async desynchronize(){this.device.removeRealtimeListener(this.onRealtimeMessage),this.device.stopListeningToRealtimeDataStream(this.config.currentJointStateStream)}async addCurrentJointStateListener(t){this.currentListeners.push(t)}}class RequestDataChannel{constructor(t,r,n){Ce(this,"channel");Ce(this,"requestIdToResponseMap",new Map);this.device=t,this.channel_name=r,this.timeout=n}}class BinaryRequestDataChannel extends RequestDataChannel{constructor(){super(...arguments);Ce(this,"RESPONSE_SUCCESS_BYTE",0);Ce(this,"decoder",new TextDecoder)}generateBinaryId(){const t=new Uint8Array(16);for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);return t}async initialize(){this.channel=await this.device.createCustomDataChannel(this.channel_name),this.channel.addBinaryListener(t=>{const n=t.slice(0,16).toString();if(n.length===0)throw new Error("Invalid response");const i=t.slice(16);if(i.length===0)throw new Error("Invalid response");this.requestIdToResponseMap.has(n)&&this.requestIdToResponseMap.set(n,i)})}async request(t){if(this.channel||await this.initialize(),!this.channel)throw new Error("Failed to create channel");const{channel:r,requestIdToResponseMap:n,timeout:i}=this;await r.waitTilReady();const g=this.generateBinaryId(),s=g.toString();n.set(s,!0),r.sendBinary(new Uint8Array([...g,...t]));const o=new Date().getTime();for(;new Date().getTime()<o+i;)if(await delay(50),n.has(s)){const l=n.get(s);if(l!==!0){n.delete(s);const u=l[0]===this.RESPONSE_SUCCESS_BYTE,m=l.slice(1);if(u)return m;throw{name:"AdapterError",message:this.decoder.decode(m)}}}throw n.delete(s),{name:"TimeoutError",message:`Request timed out after ${i/1e3} seconds`}}}class TextRequestDataChannel extends RequestDataChannel{generateTextId(){return Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2)}async initialize(){this.channel=await this.device.createCustomDataChannel(this.channel_name),this.channel.addListener(t=>{const r=JSON.parse(t),{id:n,data:i,error:g}=r;if(!n)throw new Error("Invalid response");if(!i&&!g)throw new Error("Invalid response");this.requestIdToResponseMap.has(n)&&this.requestIdToResponseMap.set(n,r)})}async request(t){if(this.channel||await this.initialize(),!this.channel)throw new Error("Failed to create channel");const{channel:r,requestIdToResponseMap:n,timeout:i}=this;await r.waitTilReady();const g=this.generateTextId();n.set(g,!0),r.send(JSON.stringify({id:g,data:t}));const s=new Date().getTime();for(;new Date().getTime()<s+i;)if(await delay(50),n.has(g)){const o=n.get(g);if(o!==!0){n.delete(g);const{data:l,error:u}=o;if(l)return l;if(u)throw{name:"AdapterError",message:u}}}throw n.delete(g),{name:"TimeoutError",message:`Request timed out after ${i/1e3} seconds`}}}class Device{constructor(t,r,n){Ce(this,"rtcClient");Ce(this,"realtimeListeners",[]);Ce(this,"handleMessage",(t,r)=>{this.realtimeListeners.forEach(n=>n(t,r))});this.id=t,this.name=r,this.organizationId=n}async getLatestTelemetry(){return(await(await fetch(`${FORMANT_API_URL}/v1/queries/stream-current-value`,{method:"POST",body:JSON.stringify({deviceIds:[this.id]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}async getConfiguration(){let t=await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}});const r=await t.json();if(!r.state.reportedConfiguration)throw new Error("Device has no configuration, has it ever been turned on?");const n=r.state.reportedConfiguration.version;return t=await fetch(`${FORMANT_API_URL}/v1/admin/devices/${this.id}/configurations/${n}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),(await t.json()).document}async getFileUrl(t){return(await(await fetch(`${FORMANT_API_URL}/v1/admin/files/query`,{method:"POST",body:JSON.stringify({fileId:[t]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).fileUrls}async startRealtimeConnection(){if(this.rtcClient)throw new Error(`Already created realtime connection to device ${this.id}`);{const t=new dist.exports.RtcClient({signalingClient:new dist.exports.SignalingPromiseClient(FORMANT_API_URL,null,null),getToken:async()=>defined(Authentication.token,"Realtime when user isn't authorized"),receive:this.handleMessage});for(;!t.isReady();)await delay(100);const n=(await t.getPeers()).find(g=>g.deviceId===this.id);if(!n)throw new Error("Cannot find peer, is the robot offline?");const i=n.id;for(await t.connect(i);t.getConnectionStatus(i)!=="connected";)await delay(100);this.rtcClient=t}}addRealtimeListener(t){this.realtimeListeners.push(t)}removeRealtimeListener(t){const r=this.realtimeListeners.indexOf(t);if(r===-1)throw new Error("Could not find realtime listener to remove");this.realtimeListeners.splice(r,1)}async getRealtimeVideoStreams(){var n,i,g;const t=await this.getConfiguration(),r=[];for(const s of(n=t.teleop.hardwareStreams)!=null?n:[])s.rtcStreamType==="h264-video-frame"&&r.push({name:s.name});for(const s of(i=t.teleop.rosStreams)!=null?i:[])s.topicType=="formant/H264VideoFrame"&&r.push({name:s.topicName});for(const s of(g=t.teleop.customStreams)!=null?g:[])s.rtcStreamType==="h264-video-frame"&&r.push({name:s.name});return r}async getRealtimeManipulators(){var n;const t=await this.getConfiguration(),r=[];for(const i of(n=t.teleop.rosStreams)!=null?n:[])i.topicType=="sensor_msgs/JointState"&&r.push(new Manipulator(this,{currentJointStateStream:{name:i.topicName},plannedJointStateStream:i.plannedTopic?{name:i.plannedTopic}:void 0,planValidStream:i.planValidTopic?{name:i.planValidTopic}:void 0,endEffectorStream:i.endEffectorTopic?{name:i.endEffectorTopic}:void 0,endEffectorLinkName:i.endEffectorLinkName,baseReferenceFrame:i.baseReferenceFrame,localFrame:i.localFrame}));return r}async startListeningToRealtimeVideo(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!0,pipeline:"rtc"})}async stopListeningToRealtimeVideo(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!1,pipeline:"rtc"})}async startListeningToRealtimeDataStream(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!0,pipeline:"rtc"})}async stopListeningToRealtimeDataStream(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t.name,enable:!1,pipeline:"rtc"})}async enableRealtimeTelemetryPriorityIngestion(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t,enablePriorityUpload:!0,pipeline:"telemetry"})}async disableRealtimeTelemetryPriorityIngestion(t){const r=defined(this.rtcClient,"Realtime connection has not been started"),n=await this.getRemotePeer();r.controlRemoteStream(defined(n).id,{streamName:t,enablePriorityUpload:!1,pipeline:"telemetry"})}async getRemotePeer(){const r=(await defined(this.rtcClient,"Realtime connection has not been started").getPeers()).find(n=>n.deviceId===this.id);return defined(r,"Could not find remote peer for device "+this.id)}async stopRealtimeConnection(){if(this.rtcClient)await this.rtcClient.disconnect(this.id);else throw new Error(`Realtime connection hasn't been started for ${this.id}`)}async isInRealtimeSession(){let t=await Fleet.getPeers(),r=await Fleet.getRealtimeSessions(),n=t.find(i=>i.deviceId===this.id);return n?r[n.id].length>0:!1}async getAvailableCommands(){return(await(await fetch(`${FORMANT_API_URL}/v1/admin/command-templates/`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items.map(n=>({name:n.name,id:n.id,command:n.command,description:n.description,parameterEnabled:n.parameterEnabled,parameterValue:n.parameterValue,parameterMeta:n.parameterMeta}))}async sendCommand(t,r,n,i){var R;const s=(await this.getAvailableCommands()).find(y=>y.name===t);if(!s)throw new Error(`Could not find command with name "${t}"`);let o;if(r===void 0)if(s.parameterEnabled&&s.parameterValue)o=s.parameterValue;else throw new Error("Command has no default parameter value, you must provide one");else o=r;let l={value:o,scrubberTime:(n||new Date).toISOString(),meta:st(st({},s.parameterMeta),i)};return(await(await fetch(`${FORMANT_API_URL}/v1/admin/commands`,{method:"POST",body:JSON.stringify({commandTemplateId:s.id,organizationId:this.organizationId,deviceId:this.id,command:s.command,parameter:l,userId:(R=Authentication.currentUser)==null?void 0:R.id}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).fileUrls}async createCustomDataChannel(t,r){const n=defined(this.rtcClient,"Realtime connection has not been started"),i=await this.getRemotePeer();return new Promise(s=>{n.createCustomDataChannel(defined(i).id,t,st({ordered:!0},r),!1,(o,l)=>{const u=new DataChannel(l);s(u)})})}createCustomRequestDataChannel(t,r=3e3){return new TextRequestDataChannel(this,t,r)}createCustomBinaryRequestDataChannel(t,r=3e3){return new BinaryRequestDataChannel(this,t,r)}async createCaptureStream(t){const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/capture-sessions`,{method:"POST",body:JSON.stringify({deviceId:this.id,streamName:t,tags:{}}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json();return new CaptureStream(n)}async getTelemetry(t,r,n,i){return await Fleet.getTelemetry(this.id,t,r,n,i)}async getTelemetryStreams(){var o,l;const t=await this.getConfiguration(),r=await fetch(`${FORMANT_API_URL}/v1/queries/metadata/stream-names`,{method:"POST",body:JSON.stringify({deviceIds:[this.id]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),n=[],i=[];return(l=(o=t.telemetry)==null?void 0:o.streams)==null||l.forEach(u=>{u.disabled!==!0&&n.push(u.name),u.onDemand===!0&&i.push(u.name)}),console.log(i),(await r.json()).items.filter(u=>!n.includes(u)).map(u=>({name:u,onDemand:i.includes(u)}))}}const Ae=class{static async setDefaultDevice(t){Ae.defaultDeviceId=t}static async getCurrentDevice(){if(!Authentication.token)throw new Error("Not authenticated");if(!Ae.defaultDeviceId)throw new Error("No known default device");const i=(await(await fetch(`${FORMANT_API_URL}/v1/admin/device-details/query`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items.find(s=>s.id===Ae.defaultDeviceId).name,g=new Device(Ae.defaultDeviceId,i,defined(Authentication.currentOrganization));return Ae.knownContext.push(new WeakRef(g)),g}static async getDevice(t){if(!Authentication.token)throw new Error("Not authenticated");const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/devices/${t}`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json(),i=n.name,g=new Device(t,i,n.organizationId);return Ae.knownContext.push(new WeakRef(g)),g}static async getDevices(){if(!Authentication.token)throw new Error("Not authenticated");const r=await(await fetch(`${FORMANT_API_URL}/v1/admin/device-details/query`,{method:"POST",body:JSON.stringify({enabled:!0,type:"default"}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json();return r.items,r.items.map(n=>new Device(n.id,n.name,n.organizationId))}static async getOnlineDevices(){if(!Authentication.token)throw new Error("Not authenticated");const n=(await(await fetch(`${FORMANT_API_URL}/v1/queries/online-devices`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items;return(await Ae.getDevices()).filter(g=>n.includes(g.id))}static async getPeers(){if(!Authentication.token)throw new Error("Not authenticated");return await new dist.exports.RtcClient({signalingClient:new dist.exports.SignalingPromiseClient(FORMANT_API_URL,null,null),getToken:async()=>defined(Authentication.token,"Realtime when user isn't authorized"),receive:()=>{}}).getPeers()}static async getRealtimeSessions(){if(!Authentication.token)throw new Error("Not authenticated");return await new dist.exports.RtcClient({signalingClient:new dist.exports.SignalingPromiseClient(FORMANT_API_URL,null,null),getToken:async()=>defined(Authentication.token,"Realtime when user isn't authorized"),receive:()=>{}}).getSessions()}static async getRealtimeDevices(){if(!Authentication.token)throw new Error("Not authenticated");const n=(await(await fetch(`${FORMANT_API_URL}/v1/signaling/peers`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items.map(g=>g.deviceId);return(await Ae.getDevices()).filter(g=>n.includes(g.id))}static async getLatestTelemetry(t){let r=t;return t&&!Array.isArray(t)&&(t=[t]),(await(await fetch(`${FORMANT_API_URL}/v1/queries/stream-current-value`,{method:"POST",body:JSON.stringify({deviceIds:r}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}static async getTelemetry(t,r,n,i,g){let s=t;Array.isArray(t)||(s=[t]);let o=r;return Array.isArray(r)||(o=[r]),(await(await fetch(`${FORMANT_API_URL}/v1/queries/queries`,{method:"POST",body:JSON.stringify({deviceIds:s,end:i.toISOString(),names:o,start:n.toISOString(),tags:g}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}static async getFileUrl(t){const n=await(await fetch(`${FORMANT_API_URL}/v1/admin/files/query`,{method:"POST",body:JSON.stringify({fileIds:[t]}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json();if(n.fileUrls.length===0)throw new Error("File not found");return n.fileUrls[0]}static async queryTelemetry(t){if(!Authentication.token)throw new Error("Not authenticated");return(await(await fetch(`${FORMANT_API_URL}/v1/queries/queries`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}static async queryEvents(t){if(!Authentication.token)throw new Error("Not authenticated");return(await(await fetch(`${FORMANT_API_URL}/v1/admin/events/query`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}})).json()).items}};let Fleet=Ae;Ce(Fleet,"defaultDeviceId"),Ce(Fleet,"knownContext",[]);class KeyValue{static async set(t,r){try{const n=await fetch(FORMANT_API_URL+"/v1/admin/key-value",{method:"POST",body:JSON.stringify({organizationId:defined(Authentication.currentUser).organizationId,key:t,value:r}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),i=await n.json();if(n.status!==200)throw new Error(i.message)}catch(n){throw n}}static async get(t){try{const r=await fetch(FORMANT_API_URL+`/v1/admin/key-value/${t}`,{method:"GET",body:JSON.stringify({organizationId:defined(Authentication.currentUser).organizationId}),headers:{"Content-Type":"application/json",Authorization:"Bearer "+Authentication.token}}),n=await r.json();if(r.status!==200)throw new Error(n.message);return n.value}catch(r){throw r}}}let urlParams=new URLSearchParams("");typeof window!="undefined"&&(urlParams=new URLSearchParams(window.location.search));const urlDevice=urlParams.get("device");urlDevice&&Fleet.setDefaultDevice(urlDevice);const urlAuth=urlParams.get("auth");urlAuth&&Authentication.loginWithToken(urlAuth);const moduleName=urlParams.get("module");moduleName&&Authentication.listenForRefresh(),exports.App=App,exports.Authentication=Authentication,exports.BinaryRequestDataChannel=BinaryRequestDataChannel,exports.CaptureStream=CaptureStream,exports.DataChannel=DataChannel,exports.Device=Device,exports.Fleet=Fleet,exports.KeyValue=KeyValue,exports.Manipulator=Manipulator,exports.TextRequestDataChannel=TextRequestDataChannel,Object.defineProperty(exports,"__esModule",{value:!0}),exports[Symbol.toStringTag]="Module"});